Skip to content

Commit 3dd77d6

Browse files
Merge pull request #8674 from BitGo/BTC-0.deprecate-utxolib-on-nonprod
feat(abstract-utxo)!: default to wasm-utxo for all coins
2 parents 94da3fc + 79849ce commit 3dd77d6

5 files changed

Lines changed: 248 additions & 370 deletions

File tree

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ import {
8181
getMainnetCoinName,
8282
getNetworkFromCoinName,
8383
isMainnetCoin,
84-
isUtxoCoinNameMainnet,
8584
UtxoCoinName,
8685
UtxoCoinNameMainnet,
8786
} from './names';
@@ -435,14 +434,17 @@ export abstract class AbstractUtxoCoin
435434
legacy: this.isMainnet(),
436435
};
437436

437+
protected supportedSdkBackends: { utxolib: boolean; 'wasm-utxo': boolean } = {
438+
utxolib: this.isMainnet(),
439+
'wasm-utxo': true,
440+
};
441+
438442
protected constructor(bitgo: BitGoBase, amountType: 'number' | 'bigint' = 'number') {
439443
super(bitgo);
440444
this.amountType = amountType;
441445
}
442446

443-
get defaultSdkBackend(): SdkBackend {
444-
return isUtxoCoinNameMainnet(this.name) ? 'utxolib' : 'wasm-utxo';
445-
}
447+
defaultSdkBackend: SdkBackend = 'wasm-utxo';
446448

447449
/**
448450
* @deprecated - will be removed when we drop support for utxolib
@@ -627,6 +629,10 @@ export abstract class AbstractUtxoCoin
627629
}
628630

629631
if (utxolib.bitgo.isPsbt(input)) {
632+
if (this.supportedSdkBackends[decodeWith] !== true) {
633+
throw new Error(`SDK support for decodeWith=${decodeWith} is not available on this environment.`);
634+
}
635+
630636
if (!this.supportedTxFormats.psbt) {
631637
throw new ErrorDeprecatedTxFormat('psbt');
632638
}

0 commit comments

Comments
 (0)