signPsbt

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

-

p2wpkh (Native Segwit), p2tr (Taproot)

Hardware Wallet

Pro, Classic1S

p2tr (Taproot)

Method

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

Params

  • psbtHexrequired string the hex string of psbt to sign

  • optionsoptional object

    • autoFinalizedoptional boolean: whether finalize psbt after signing, default is true

    • toSignInputsoptional Array: specify which inputs to sign

      • indexrequired number: which input to sign

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

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

      • sighashTypesoptional number[]: optional sighash types for the input

      • 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> — the hex string of signed psbt

Example

Demo

Last updated

Was this helpful?