Skip to content

Commit 7ac007d

Browse files
Merge pull request #8363 from BitGo/BTC-0.enable-legacy-tx-on-mainnet
feat(abstract-utxo)!: enable legacy tx format for mainnet
2 parents 388fbec + ed26128 commit 7ac007d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import {
7979
getFullNameFromCoinName,
8080
getMainnetCoinName,
8181
getNetworkFromCoinName,
82+
isMainnetCoin,
8283
isUtxoCoinNameMainnet,
8384
UtxoCoinName,
8485
UtxoCoinNameMainnet,
@@ -409,11 +410,20 @@ export abstract class AbstractUtxoCoin
409410
{
410411
abstract name: UtxoCoinName;
411412

413+
/**
414+
* Returns whether this coin is a mainnet coin.
415+
* Default implementation uses the name property.
416+
* Can be overridden by subclasses.
417+
*/
418+
protected isMainnet(): boolean {
419+
return isMainnetCoin(this.name);
420+
}
421+
412422
public readonly amountType: 'number' | 'bigint';
413423

414-
protected readonly supportedTxFormats: { readonly psbt: boolean; readonly legacy: boolean } = {
424+
protected supportedTxFormats: { psbt: boolean; legacy: boolean } = {
415425
psbt: true,
416-
legacy: false,
426+
legacy: this.isMainnet(),
417427
};
418428

419429
protected constructor(bitgo: BitGoBase, amountType: 'number' | 'bigint' = 'number') {

0 commit comments

Comments
 (0)