From 06d0b30e6987678c8147f98781f17cdc4e9cb37b Mon Sep 17 00:00:00 2001 From: Otto Allmendinger Date: Fri, 27 Sep 2024 11:29:12 +0200 Subject: [PATCH] fix(sdk-api): use createPsbtDecode instead of createPsbtFromBuffer The endpoint will now accept both hex and base64 encoded PSBTs. Issue: BTC-1351 --- modules/sdk-api/src/v1/signPsbt.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sdk-api/src/v1/signPsbt.ts b/modules/sdk-api/src/v1/signPsbt.ts index 1057ecacec..22f67be8a6 100644 --- a/modules/sdk-api/src/v1/signPsbt.ts +++ b/modules/sdk-api/src/v1/signPsbt.ts @@ -28,7 +28,7 @@ export function signPsbtRequest(params: { psbt: string; keychain: { xprv: string throw new Error(`invalid params.keychain.xprv`); } - const psbt = utxolib.bitgo.createPsbtFromBuffer(Buffer.from(params.psbt, 'hex'), utxolib.networks.bitcoin); + const psbt = utxolib.bitgo.createPsbtDecode(params.psbt, utxolib.networks.bitcoin); const keypair = utxolib.bip32.fromBase58(params.keychain.xprv, utxolib.networks.bitcoin); debug('signing PSBT with keychain %s', keypair.neutered().toBase58()); utxolib.bitgo.withUnsafeNonSegwit(psbt, () => psbt.signAllInputsHD(keypair));