@@ -838,20 +838,8 @@ export const getDecodedWithdrawalAmount = (
838838 }
839839
840840 case "bitcoin-vm" : {
841- try {
842- const psbt = bitcoin . Psbt . fromHex ( decodedWithdrawal . withdrawal . psbt ) ;
843- const tx = psbt . extractTransaction ( false ) ;
844- const totalAmount = tx . outs . reduce ( ( sum , output ) => {
845- return sum + output . value ;
846- } , 0 ) ;
847- return totalAmount . toString ( ) ;
848- } catch ( error ) {
849- throw new Error (
850- `Failed to decode PSBT: ${
851- error instanceof Error ? error . message : String ( error )
852- } `
853- ) ;
854- }
841+ const psbt = bitcoin . Psbt . fromHex ( decodedWithdrawal . withdrawal . psbt ) ;
842+ return psbt . txOutputs [ 0 ] . value . toString ( ) ;
855843 }
856844
857845 case "hyperliquid-vm" : {
@@ -902,26 +890,9 @@ export const getDecodedWithdrawalRecipient = (
902890 }
903891
904892 case "bitcoin-vm" : {
905- try {
906- const psbt = bitcoin . Psbt . fromHex ( decodedWithdrawal . withdrawal . psbt ) ;
907- const tx = psbt . extractTransaction ( false ) ;
908- if ( tx . outs . length === 0 ) {
909- throw new Error ( "Transaction has no outputs" ) ;
910- }
911- // Extract address from the first output
912- const firstOutput = tx . outs [ 0 ] ;
913- const address = bitcoin . address . fromOutputScript (
914- firstOutput . script ,
915- bitcoin . networks . bitcoin
916- ) ;
917- return address ;
918- } catch ( error ) {
919- throw new Error (
920- `Failed to decode PSBT: ${
921- error instanceof Error ? error . message : String ( error )
922- } `
923- ) ;
924- }
893+ const psbt = bitcoin . Psbt . fromHex ( decodedWithdrawal . withdrawal . psbt ) ;
894+ const firstOutput = psbt . txOutputs [ 0 ] ;
895+ return bitcoin . address . fromOutputScript ( firstOutput . script ) ;
925896 }
926897
927898 case "hyperliquid-vm" : {
0 commit comments