33from pathlib import Path
44from typing import List
55
6+ from pydantic .json import pydantic_encoder
7+
68from .cli import ChainCommand
79from .context import Context
810from .network import get_data_ip
911from .topology import connect_all
10- from .types import GenesisAccount , PeerPacket
12+ from .types import Balance , GenesisAccount , PeerPacket
1113from .utils import eth_to_bech32 , gen_account , patch_json , patch_toml
1214
15+ DEFAULT_DENOM = "basecro"
1316VAL_ACCOUNT = "validator"
14- VAL_INITIAL_AMOUNT = "100000000000000000000basecro"
15- VAL_STAKED_AMOUNT = "10000000000000000000basecro"
16- ACC_INITIAL_AMOUNT = "10000000000000000000000000basecro"
17+ VAL_INITIAL_AMOUNT = Balance ( amount = "100000000000000000000" , denom = DEFAULT_DENOM )
18+ VAL_STAKED_AMOUNT = Balance ( amount = "10000000000000000000" , denom = DEFAULT_DENOM )
19+ ACC_INITIAL_AMOUNT = Balance ( amount = "10000000000000000000000000" , denom = DEFAULT_DENOM )
1720MEMPOOL_SIZE = 10000
18- DEFAULT_DENOM = "basecro"
1921VALIDATOR_GROUP = "validators"
2022FULLNODE_GROUP = "fullnodes"
2123CONTAINER_CRONOSD_PATH = "/bin/cronosd"
@@ -85,12 +87,13 @@ def init_node(
8587 )
8688 accounts = [
8789 GenesisAccount (
88- address = eth_to_bech32 (val_acct .address ), balance = VAL_INITIAL_AMOUNT
90+ address = eth_to_bech32 (val_acct .address ),
91+ coins = [VAL_INITIAL_AMOUNT ],
8992 ),
9093 ] + [
9194 GenesisAccount (
9295 address = eth_to_bech32 (gen_account (global_seq , i + 1 ).address ),
93- balance = ACC_INITIAL_AMOUNT ,
96+ coins = [ ACC_INITIAL_AMOUNT ] ,
9497 )
9598 for i in range (num_accounts )
9699 ]
@@ -115,7 +118,7 @@ def gen_genesis(
115118):
116119 for peer in peers :
117120 with tempfile .NamedTemporaryFile () as fp :
118- fp .write (json .dumps (peer .bulk_genesis_accounts () ).encode ())
121+ fp .write (json .dumps (peer .accounts , default = pydantic_encoder ).encode ())
119122 fp .flush ()
120123 cli (
121124 "genesis" ,
@@ -171,7 +174,7 @@ def gentx(cli, **kwargs):
171174 "genesis" ,
172175 "add-genesis-account" ,
173176 VAL_ACCOUNT ,
174- VAL_INITIAL_AMOUNT ,
177+ str ( VAL_INITIAL_AMOUNT ) ,
175178 ** kwargs ,
176179 )
177180 with tempfile .TemporaryDirectory () as tmp :
0 commit comments