Skip to content

signPSBT

signPSBT(config, params): Promise<SignPSBTResponse>

Signs a PSBT with the given parameters. Optionally, it can broadcast the transaction.

Import

ts
import { signPSBT } from "@midl-xyz/midl-js-core";

Example

ts
const signedPSBT = await signPSBT(config, {
  psbt: "cHNidP8BAHECAAAA...",
  signInputs: {
    "02c6047f9441ed7d6d3045406e95c07cd85a4697e2e6e5d1b1e7e6e5d1b1e7e6": [0],
  },
  publish: true,
});

console.log(signedPSBT);

Parameters

NameTypeDescription
configConfigThe configuration object
paramsSignPSBTParamsThe parameters for the request

SignPSBTParams

NameTypeDescription
psbtstringBase64 encoded PSBT to sign
signInputsRecord<string, number[]>The inputs to sign, in the format { pubkey: [inputIndex] }
publish?booleanIf true, the transaction will be broadcasted (optional)
disableTweakSigner?booleanIf true, tweaking the signer will be disabled for supported connectors (optional)

Returns

Promise<SignPSBTResponse>

The signed PSBT

SignPSBTResponse

NameTypeDescription
psbtstringSigned Base64 encoded PSBT
txId?stringThe transaction ID, if the transaction was broadcasted