Skip to content
Merged
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: 12 additions & 2 deletions modules/abstract-utxo/src/abstractUtxoCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import {
getFullNameFromCoinName,
getMainnetCoinName,
getNetworkFromCoinName,
isMainnetCoin,
isUtxoCoinNameMainnet,
UtxoCoinName,
UtxoCoinNameMainnet,
Expand Down Expand Up @@ -409,11 +410,20 @@ export abstract class AbstractUtxoCoin
{
abstract name: UtxoCoinName;

/**
* Returns whether this coin is a mainnet coin.
* Default implementation uses the name property.
* Can be overridden by subclasses.
*/
protected isMainnet(): boolean {
return isMainnetCoin(this.name);
}

public readonly amountType: 'number' | 'bigint';

protected readonly supportedTxFormats: { readonly psbt: boolean; readonly legacy: boolean } = {
protected supportedTxFormats: { psbt: boolean; legacy: boolean } = {
psbt: true,
legacy: false,
legacy: this.isMainnet(),
};

protected constructor(bitgo: BitGoBase, amountType: 'number' | 'bigint' = 'number') {
Expand Down
Loading