diff --git a/packages/sdk/src/wallet/Ordit.ts b/packages/sdk/src/wallet/Ordit.ts index 55630e3e..8112b55c 100644 --- a/packages/sdk/src/wallet/Ordit.ts +++ b/packages/sdk/src/wallet/Ordit.ts @@ -160,7 +160,7 @@ export class Ordit { return accounts; } - signPsbt(value: string, { finalized = true }: { finalized?: boolean }) { + signPsbt(value: string, { finalized = true, instantBuy = false }: SignPSBTOptions) { const networkObj = getNetwork(this.#network); let psbt: bitcoin.Psbt | null = null; @@ -194,7 +194,9 @@ export class Ordit { const isSigned = v.finalScriptSig || v.finalScriptWitness; if (script && !isSigned) { const address = bitcoin.address.fromOutputScript(script, networkObj); - if (this.selectedAddress === address) { + + // TODO: improvise the below logic by accepting indexes to sign + if (!instantBuy || (instantBuy && this.selectedAddress === address)) { inputsToSign.push({ index, publicKey: this.publicKey, @@ -336,3 +338,8 @@ export interface Input { publicKey: string; sighashTypes?: number[]; } + +export interface SignPSBTOptions { + finalized?: boolean; + instantBuy?: boolean; +}