Skip to content

Commit 7e72cf2

Browse files
feat(abstract-utxo): add supportedSdkBackends with validation
Introduce supportedSdkBackends property to gate backend availability and validate SDK backend support before decoding PSBTs. Co-authored-by: llm-git <llm-git@ttll.de> Issue: BTC-2650
1 parent f42350b commit 7e72cf2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@ export abstract class AbstractUtxoCoin
428428
legacy: this.isMainnet(),
429429
};
430430

431+
protected supportedSdkBackends: { utxolib: boolean; 'wasm-utxo': boolean } = {
432+
utxolib: this.isMainnet(),
433+
'wasm-utxo': true,
434+
};
435+
431436
protected constructor(bitgo: BitGoBase, amountType: 'number' | 'bigint' = 'number') {
432437
super(bitgo);
433438
this.amountType = amountType;
@@ -615,6 +620,10 @@ export abstract class AbstractUtxoCoin
615620
}
616621

617622
if (utxolib.bitgo.isPsbt(input)) {
623+
if (this.supportedSdkBackends[decodeWith] !== true) {
624+
throw new Error(`SDK support for decodeWith=${decodeWith} is not available on this environment.`);
625+
}
626+
618627
if (!this.supportedTxFormats.psbt) {
619628
throw new ErrorDeprecatedTxFormat('psbt');
620629
}

0 commit comments

Comments
 (0)