Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions modules/abstract-utxo/src/abstractUtxoCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ import {
getMainnetCoinName,
getNetworkFromCoinName,
isMainnetCoin,
isUtxoCoinNameMainnet,
UtxoCoinName,
UtxoCoinNameMainnet,
} from './names';
Expand Down Expand Up @@ -429,14 +428,17 @@ export abstract class AbstractUtxoCoin
legacy: this.isMainnet(),
};

protected supportedSdkBackends: { utxolib: boolean; 'wasm-utxo': boolean } = {
utxolib: this.isMainnet(),
'wasm-utxo': true,
};

protected constructor(bitgo: BitGoBase, amountType: 'number' | 'bigint' = 'number') {
super(bitgo);
this.amountType = amountType;
}

get defaultSdkBackend(): SdkBackend {
return isUtxoCoinNameMainnet(this.name) ? 'utxolib' : 'wasm-utxo';
}
defaultSdkBackend: SdkBackend = 'wasm-utxo';

/**
* @deprecated - will be removed when we drop support for utxolib
Expand Down Expand Up @@ -618,6 +620,10 @@ export abstract class AbstractUtxoCoin
}

if (utxolib.bitgo.isPsbt(input)) {
if (this.supportedSdkBackends[decodeWith] !== true) {
throw new Error(`SDK support for decodeWith=${decodeWith} is not available on this environment.`);
}

if (!this.supportedTxFormats.psbt) {
throw new ErrorDeprecatedTxFormat('psbt');
}
Expand Down
Loading
Loading