@@ -355,37 +355,43 @@ export const getSignatureFromContract = async (
355355 const unsignedPayload = await onchainAllocator . contract . read . payloads ( [
356356 payloadId as Hex ,
357357 ] ) ;
358- const transactionData = decodeAbiParameters (
359- [
360- {
361- type : "tuple" ,
362- components : [
363- {
364- type : "tuple[]" ,
365- name : "inputs" ,
366- components : [
367- { type : "bytes" , name : "txid" } ,
368- { type : "bytes" , name : "index" } ,
369- { type : "bytes" , name : "script" } ,
370- { type : "bytes" , name : "value" } ,
371- ] ,
372- } ,
373- {
374- type : "tuple[]" ,
375- name : "outputs" ,
376- components : [
377- { type : "bytes" , name : "value" } ,
378- { type : "bytes" , name : "script" } ,
379- ] ,
380- } ,
381- ] ,
382- } ,
383- ] ,
358+
359+ const decodeBitcoinTransactionData = ( encodedData : Hex ) =>
360+ decodeAbiParameters (
361+ [
362+ {
363+ type : "tuple" ,
364+ components : [
365+ {
366+ type : "tuple[]" ,
367+ name : "inputs" ,
368+ components : [
369+ { type : "bytes" , name : "txid" } ,
370+ { type : "bytes" , name : "index" } ,
371+ { type : "bytes" , name : "script" } ,
372+ { type : "bytes" , name : "value" } ,
373+ ] ,
374+ } ,
375+ {
376+ type : "tuple[]" ,
377+ name : "outputs" ,
378+ components : [
379+ { type : "bytes" , name : "value" } ,
380+ { type : "bytes" , name : "script" } ,
381+ ] ,
382+ } ,
383+ ] ,
384+ } ,
385+ ] ,
386+ encodedData ,
387+ ) [ 0 ] as {
388+ inputs : { txid : Hex ; index : Hex ; script : Hex ; value : Hex } [ ] ;
389+ outputs : { value : Hex ; script : Hex } [ ] ;
390+ } ;
391+
392+ const transactionData = decodeBitcoinTransactionData (
384393 unsignedPayload as Hex ,
385- ) [ 0 ] as {
386- inputs : { txid : Hex ; index : Hex ; script : Hex ; value : Hex } [ ] ;
387- outputs : { value : Hex ; script : Hex } [ ] ;
388- } ;
394+ ) ;
389395
390396 const signatures = await Promise . all (
391397 transactionData . inputs . map ( async ( _ , index ) => {
0 commit comments