File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,9 @@ const (
189
189
AddressHeaderNetworkMask = 0x0F
190
190
AddressHashSize = 28
191
191
192
+ AddressNetworkTestnet = 0
193
+ AddressNetworkMainnet = 1
194
+
192
195
AddressTypeKeyKey = 0b0000
193
196
AddressTypeScriptKey = 0b0001
194
197
AddressTypeKeyScript = 0b0010
@@ -323,7 +326,7 @@ func (a Address) generateHRP() string {
323
326
ret = "addr"
324
327
}
325
328
// Add test_ suffix if not mainnet
326
- if a .networkId != 1 {
329
+ if a .networkId != AddressNetworkMainnet {
327
330
ret += "_test"
328
331
}
329
332
return ret
Original file line number Diff line number Diff line change 14
14
15
15
package ouroboros
16
16
17
+ import (
18
+ "github.com/blinklabs-io/gouroboros/ledger"
19
+ )
20
+
17
21
// Network definitions
18
22
var (
19
- NetworkTestnet = Network {Id : 0 , Name : "testnet" , NetworkMagic : 1097911063 }
23
+ NetworkTestnet = Network {
24
+ Id : ledger .AddressNetworkTestnet ,
25
+ Name : "testnet" ,
26
+ NetworkMagic : 1097911063 ,
27
+ }
20
28
NetworkMainnet = Network {
21
- Id : 1 ,
29
+ Id : ledger . AddressNetworkMainnet ,
22
30
Name : "mainnet" ,
23
31
NetworkMagic : 764824073 ,
24
32
PublicRootAddress : "backbone.cardano-mainnet.iohk.io" ,
25
33
PublicRootPort : 3001 ,
26
34
}
27
35
NetworkPreprod = Network {
28
- Id : 2 ,
36
+ Id : ledger . AddressNetworkTestnet ,
29
37
Name : "preprod" ,
30
38
NetworkMagic : 1 ,
31
39
PublicRootAddress : "preprod-node.world.dev.cardano.org" ,
32
40
PublicRootPort : 30000 ,
33
41
}
34
42
NetworkPreview = Network {
35
- Id : 3 ,
43
+ Id : ledger . AddressNetworkTestnet ,
36
44
Name : "preview" ,
37
45
NetworkMagic : 2 ,
38
46
PublicRootAddress : "preview-node.play.dev.cardano.org" ,
39
47
PublicRootPort : 3001 ,
40
48
}
41
49
NetworkSancho = Network {
42
- Id : 4 ,
50
+ Id : ledger . AddressNetworkTestnet ,
43
51
Name : "sanchonet" ,
44
52
NetworkMagic : 4 ,
45
53
PublicRootAddress : "sanchonet-node.play.dev.cardano.org" ,
@@ -94,7 +102,7 @@ func NetworkByNetworkMagic(networkMagic uint32) Network {
94
102
95
103
// Network represents a Cardano network
96
104
type Network struct {
97
- Id uint8
105
+ Id uint8 // network ID used for addresses
98
106
Name string
99
107
NetworkMagic uint32
100
108
PublicRootAddress string
You can’t perform that action at this time.
0 commit comments