signPsbts

signPsbts

Sign multiple PSBTs at once. This method will traverse all inputs that match the current address to sign.

Wallet & Address Type Compatibility

Wallet Type
Model
Address Types Supported

Software Wallet

All

p2wpkh (Native Segwit), p2tr (Taproot)

Hardware Wallet

Pro, Classic1S

p2tr (Taproot)

Method

async function signPsbts(
    psbtHexs: string[],
    options?: {
        autoFinalized?: boolean;
        toSignInputs?: Array<{
            index: number;
            address?: string;
            publicKey?: string;
            sighashTypes?: number[];
            disableTweakSigner?: boolean;
            useTweakedSigner?: boolean;
        }>;
    },
): Promise<string[]>

Parameters

  • psbtHexsrequired string[] Array of hex strings of PSBTs to sign

  • optionsoptional object

    • autoFinalizedoptional boolean Whether to finalize PSBTs after signing, default is true

    • toSignInputsoptional array Specify which inputs to sign

      • indexrequired number Which input to sign

      • addressoptional string Which corresponding private key to use for signing (specify either address or publicKey)

      • publicKeyoptional string Which corresponding private key to use for signing (specify either address or publicKey)

      • sighashTypesoptional number[] Optional sighash types

      • disableTweakSigneroptional boolean Default is false. Set true to use original private key when signing Taproot inputs

      • useTweakedSigneroptional boolean Force whether to use tweaked signer; higher priority than disableTweakSigner

Returns

  • Promise<string[]> Array of hex strings of signed PSBTs

Example

Demo

Last updated

Was this helpful?