Skip to content

Commit 5c97d43

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): add protected isMainnet method
Add protected `isMainnet()` method to AbstractUtxoCoin class. Default implementation delegates to `isMainnetCoin()` helper and can be overridden by subclasses if needed. Issue: BTC-0 Co-authored-by: llm-git <llm-git@ttll.de>
1 parent 30e144d commit 5c97d43

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 10 additions & 0 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,6 +410,15 @@ 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

414424
protected readonly supportedTxFormats: { readonly psbt: boolean; readonly legacy: boolean } = {

0 commit comments

Comments
 (0)