Skip to content

Commit

Permalink
fix(sdk-xverse): finalize specific inputs when passed explicitly (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcrazycoder authored Sep 7, 2023
1 parent d9b5906 commit 44728e8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/sdk/src/browser-wallets/xverse/signatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ export async function signPsbt({

const signedPsbt = Psbt.fromBase64(psbtBase64)

finalize && signedPsbt.finalizeAllInputs()
if (finalize) {
if (!inputs.length) {
signedPsbt.finalizeAllInputs()
} else {
inputs.forEach((input) => {
input.signingIndexes.forEach((index) => {
signedPsbt.finalizeInput(index)
})
})
}
}

hex = extractTx ? signedPsbt.extractTransaction().toHex() : signedPsbt.toHex()
base64 = !extractTx ? signedPsbt.toBase64() : null
}
Expand Down

0 comments on commit 44728e8

Please sign in to comment.