From 0ef8afcf1baaabd91cf02149e5c60de1bcda4eff Mon Sep 17 00:00:00 2001 From: ronaldsg Date: Mon, 6 May 2024 13:47:18 -0500 Subject: [PATCH] Fix signing inputs collection on xverse I've updated the signingInput collection on the xverse service in order to select the inputs indexes of the created tx instead of the utxo. Reported by --- src/common/services/XverseService.ts | 8 ++++++-- src/pegin/middleware/TxBuilder/XverseTxBuilder.ts | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/services/XverseService.ts b/src/common/services/XverseService.ts index 21aeeff8..44b4add6 100644 --- a/src/common/services/XverseService.ts +++ b/src/common/services/XverseService.ts @@ -57,8 +57,12 @@ export default class XverseService extends WalletService { const xverseTx = tx as XverseTx; return new Promise((resolve, reject) => { const signInputs: Record = {}; - xverseTx.inputs.forEach((input: { address: string | number; idx: number; }) => { - signInputs[input.address] = [input.idx]; + xverseTx.inputs.forEach((input: { address: string; idx: number; }, inputIdx) => { + if (signInputs[input.address]) { + signInputs[input.address].push(inputIdx); + } else { + signInputs[input.address] = [inputIdx]; + } }); const signPsbtOptions = { psbt: xverseTx.base64UnsignedPsbt, diff --git a/src/pegin/middleware/TxBuilder/XverseTxBuilder.ts b/src/pegin/middleware/TxBuilder/XverseTxBuilder.ts index 486bc0e3..f36c80cf 100644 --- a/src/pegin/middleware/TxBuilder/XverseTxBuilder.ts +++ b/src/pegin/middleware/TxBuilder/XverseTxBuilder.ts @@ -15,7 +15,6 @@ export interface XverseTx extends Tx { export default class XverseTxBuilder extends TxBuilder { buildTx(normalizedTx: NormalizedTx): Promise { - console.log('XverseTxBuilder.buildTx()'); return new Promise((resolve, reject) => { const psbt = new bitcoin.Psbt({ network: this.network }); this.getExtendedInputs(normalizedTx.inputs)