@@ -48,7 +48,9 @@ abstract class BasedUtxoNetwork implements Enumerate {
48
48
BitcoinCashNetwork .testnet,
49
49
BitcoinSVNetwork .mainnet,
50
50
BitcoinSVNetwork .testnet,
51
- PepeNetwork .mainnet
51
+ PepeNetwork .mainnet,
52
+ ElectraProtocolNetwork .mainnet,
53
+ ElectraProtocolNetwork .testnet,
52
54
];
53
55
54
56
static BasedUtxoNetwork fromName (String name) {
@@ -379,6 +381,7 @@ class BitcoinCashNetwork implements BasedUtxoNetwork {
379
381
380
382
/// Constructor for creating a Bitcoin Cash network with a specific configuration.
381
383
const BitcoinCashNetwork ._(this .value, this .conf);
384
+
382
385
@override
383
386
final String value;
384
387
@@ -493,3 +496,76 @@ class PepeNetwork implements BasedUtxoNetwork {
493
496
return [Bip44Coins .pepecoinTestnet, Bip49Coins .pepecoinTestnet];
494
497
}
495
498
}
499
+
500
+ /// Class representing a Electra Protocol network, implementing the `BasedUtxoNetwork` abstract class.
501
+ class ElectraProtocolNetwork implements BasedUtxoNetwork {
502
+ /// Mainnet configuration with associated `CoinConf` .
503
+ static const ElectraProtocolNetwork mainnet = ElectraProtocolNetwork ._(
504
+ "electraProtocolMainnet" ,
505
+ CoinsConf .electraProtocolMainNet,
506
+ );
507
+
508
+ /// Testnet configuration with associated `CoinConf` .
509
+ static const ElectraProtocolNetwork testnet = ElectraProtocolNetwork ._(
510
+ "electraProtocolTestnet" ,
511
+ CoinsConf .electraProtocolTestNet,
512
+ );
513
+
514
+ /// Overrides the `conf` property from `BasedUtxoNetwork` with the associated `CoinConf` .
515
+ @override
516
+ final CoinConf conf;
517
+
518
+ /// Constructor for creating a OmniXEP network with a specific configuration.
519
+ const ElectraProtocolNetwork ._(this .value, this .conf);
520
+
521
+ @override
522
+ final String value;
523
+
524
+ /// Retrieves the Wallet Import Format (WIF) version bytes from the associated `CoinConf` .
525
+ @override
526
+ List <int > get wifNetVer => conf.params.wifNetVer! ;
527
+
528
+ /// Retrieves the Pay-to-Public-Key-Hash (P2PKH) version bytes from the associated `CoinConf` .
529
+ @override
530
+ List <int > get p2pkhNetVer => conf.params.p2pkhNetVer! ;
531
+
532
+ /// Retrieves the Pay-to-Script-Hash (P2SH) version bytes from the associated `CoinConf` .
533
+ @override
534
+ List <int > get p2shNetVer => conf.params.p2shNetVer! ;
535
+
536
+ /// Retrieves the Human-Readable Part (HRP) for Pay-to-Witness-Public-Key-Hash (P2WPKH) addresses.
537
+ @override
538
+ String get p2wpkhHrp => conf.params.p2wpkhHrp! ;
539
+
540
+ /// Checks if the current network is the mainnet.
541
+ @override
542
+ bool get isMainnet => this == ElectraProtocolNetwork .mainnet;
543
+
544
+ @override
545
+ final List <BitcoinAddressType > supportedAddress = const [
546
+ PubKeyAddressType .p2pk,
547
+ P2pkhAddressType .p2pkh,
548
+ SegwitAddresType .p2wpkh,
549
+ SegwitAddresType .p2wsh,
550
+ P2shAddressType .p2pkInP2sh,
551
+ P2shAddressType .p2pkhInP2sh,
552
+ P2shAddressType .p2wpkhInP2sh,
553
+ P2shAddressType .p2wshInP2sh,
554
+ ];
555
+
556
+ @override
557
+ List <BipCoins > get coins {
558
+ if (isMainnet) {
559
+ return [
560
+ Bip44Coins .electraProtocol,
561
+ Bip49Coins .electraProtocol,
562
+ Bip84Coins .electraProtocol,
563
+ ];
564
+ }
565
+ return [
566
+ Bip44Coins .electraProtocolTestnet,
567
+ Bip49Coins .electraProtocolTestnet,
568
+ Bip84Coins .electraProtocolTestnet,
569
+ ];
570
+ }
571
+ }
0 commit comments