Skip to content

Commit

Permalink
Fix signing inputs collection on xverse
Browse files Browse the repository at this point in the history
		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 <lucio.serra@iovlabs.org>
  • Loading branch information
ronaldsg20 authored and alexjavabraz committed May 6, 2024
1 parent 3c23914 commit 0ef8afc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/common/services/XverseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ export default class XverseService extends WalletService {
const xverseTx = tx as XverseTx;
return new Promise<SignedTx>((resolve, reject) => {
const signInputs: Record<string, number[]> = {};
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,
Expand Down
1 change: 0 additions & 1 deletion src/pegin/middleware/TxBuilder/XverseTxBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface XverseTx extends Tx {

export default class XverseTxBuilder extends TxBuilder {
buildTx(normalizedTx: NormalizedTx): Promise<XverseTx> {
console.log('XverseTxBuilder.buildTx()');
return new Promise<XverseTx>((resolve, reject) => {
const psbt = new bitcoin.Psbt({ network: this.network });
this.getExtendedInputs(normalizedTx.inputs)
Expand Down

0 comments on commit 0ef8afc

Please sign in to comment.