Skip to content

Commit b491a42

Browse files
davidkaplanbitgollm-git
andcommitted
feat(utxo-core): use standard Psbt type for BIP322 functions
Update BIP322 functions to work with standard Psbt type instead of UtxoPsbt, making the API more flexible and consistent. There is no need for that function to be UtxoPsbt, which is geared towards 2of3 scripts. Issue: BTC-2385 Co-authored-by: llm-git <[email protected]>
1 parent 01475ec commit b491a42

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

modules/utxo-core/src/bip322/toSign.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function buildToSignPsbt(message: string, addressDetails: AddressDetails,
4646
}
4747

4848
// Add the message as a proprietary key value to the PSBT so we can verify it later
49-
addBip322ProofMessage(psbt as bitgo.UtxoPsbt, 0, Buffer.from(message));
49+
addBip322ProofMessage(psbt, 0, Buffer.from(message));
5050

5151
// Set the output
5252
psbt.addOutput({

modules/utxo-core/src/bip322/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as utxolib from '@bitgo/utxo-lib';
22

3-
export function addBip322ProofMessage(psbt: utxolib.bitgo.UtxoPsbt, inputIndex: number, message: Buffer): void {
3+
export function addBip322ProofMessage(psbt: utxolib.Psbt, inputIndex: number, message: Buffer): void {
44
utxolib.bitgo.addProprietaryKeyValuesFromUnknownKeyValues(psbt, 'input', inputIndex, {
55
key: {
66
identifier: utxolib.bitgo.PSBT_PROPRIETARY_IDENTIFIER,

modules/utxo-lib/src/bitgo/ProprietaryKeyValUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PsbtInput, PsbtOutput } from 'bip174/src/lib/interfaces';
22
import { decodeProprietaryKey, encodeProprietaryKey, ProprietaryKey } from 'bip174/src/lib/proprietaryKeyVal';
3-
import { UtxoPsbt } from './UtxoPsbt';
3+
import { Psbt } from '../';
44

55
/**
66
* Psbt proprietary keydata object search fields.
@@ -88,7 +88,7 @@ export function updateProprietaryKeyValuesFromUnknownKeyValues(
8888
}
8989

9090
export function addProprietaryKeyValuesFromUnknownKeyValues(
91-
psbt: UtxoPsbt,
91+
psbt: Psbt,
9292
entry: string,
9393
index: number,
9494
keyValueData: ProprietaryKeyValue

0 commit comments

Comments
 (0)