|
| 1 | +package clients |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + "math/big" |
| 6 | +) |
| 7 | + |
| 8 | +/** |
| 9 | +# ---------------- dev mnemonics source ---------------- |
| 10 | +# dev0 address 0xC6Fe5D33615a1C52c08018c47E8Bc53646A0E101 | cosmos1cml96vmptgw99syqrrz8az79xer2pcgp84pdun |
| 11 | +# dev0's private key: 0x88cbead91aee890d27bf06e003ade3d4e952427e88f88d31d61d3ef5e5d54305 # gitleaks:allow |
| 12 | +
|
| 13 | +# dev1 address 0x963EBDf2e1f8DB8707D05FC75bfeFFBa1B5BaC17 | cosmos1jcltmuhplrdcwp7stlr4hlhlhgd4htqh3a79sq |
| 14 | +# dev1's private key: 0x741de4f8988ea941d3ff0287911ca4074e62b7d45c991a51186455366f10b544 # gitleaks:allow |
| 15 | +
|
| 16 | +# dev2 address 0x40a0cb1C63e026A81B55EE1308586E21eec1eFa9 | cosmos1gzsvk8rruqn2sx64acfsskrwy8hvrmafqkaze8 |
| 17 | +# dev2's private key: 0x3b7955d25189c99a7468192fcbc6429205c158834053ebe3f78f4512ab432db9 # gitleaks:allow |
| 18 | +
|
| 19 | +# dev3 address 0x498B5AeC5D439b733dC2F58AB489783A23FB26dA | cosmos1fx944mzagwdhx0wz7k9tfztc8g3lkfk6rrgv6l |
| 20 | +# dev3's private key: 0x8a36c69d940a92fcea94b36d0f2928c7a0ee19a90073eda769693298dfa9603b # gitleaks:allow |
| 21 | +*/ |
| 22 | + |
| 23 | +const ( |
| 24 | + ChainID = "local-4221" |
| 25 | + EVMChainID = "262144" |
| 26 | + |
| 27 | + Acc0PrivKey = "88cbead91aee890d27bf06e003ade3d4e952427e88f88d31d61d3ef5e5d54305" |
| 28 | + Acc1PrivKey = "741de4f8988ea941d3ff0287911ca4074e62b7d45c991a51186455366f10b544" |
| 29 | + Acc2PrivKey = "3b7955d25189c99a7468192fcbc6429205c158834053ebe3f78f4512ab432db9" |
| 30 | + Acc3PrivKey = "8a36c69d940a92fcea94b36d0f2928c7a0ee19a90073eda769693298dfa9603b" |
| 31 | + |
| 32 | + JsonRPCUrl0 = "http://127.0.0.1:8545" |
| 33 | + JsonRPCUrl1 = "http://127.0.0.1:8555" |
| 34 | + JsonRPCUrl2 = "http://127.0.0.1:8565" |
| 35 | + JsonRPCUrl3 = "http://127.0.0.1:8575" |
| 36 | + |
| 37 | + NodeRPCUrl0 = "http://127.0.0.1:26657" |
| 38 | + NodeRPCUrl1 = "http://127.0.0.1:26658" |
| 39 | + NodeRPCUrl2 = "http://127.0.0.1:26659" |
| 40 | + NodeRPCUrl3 = "http://127.0.0.1:26660" |
| 41 | +) |
| 42 | + |
| 43 | +type Config struct { |
| 44 | + ChainID string |
| 45 | + EVMChainID *big.Int |
| 46 | + PrivKeys []string |
| 47 | + JsonRPCUrls []string |
| 48 | + NodeRPCUrls []string |
| 49 | +} |
| 50 | + |
| 51 | +// NewConfig creates a new Config instance. |
| 52 | +func NewConfig() (*Config, error) { |
| 53 | + // evm chainID |
| 54 | + evmChainID, ok := new(big.Int).SetString(EVMChainID, 10) |
| 55 | + if !ok { |
| 56 | + return nil, fmt.Errorf("error whilte setting chain id") |
| 57 | + } |
| 58 | + |
| 59 | + // private keys of test accounts |
| 60 | + privKeys := []string{Acc0PrivKey, Acc1PrivKey, Acc2PrivKey, Acc3PrivKey} |
| 61 | + |
| 62 | + // jsonrpc urls of testnet nodes |
| 63 | + jsonRPCUrls := []string{JsonRPCUrl0, JsonRPCUrl1, JsonRPCUrl2, JsonRPCUrl3} |
| 64 | + |
| 65 | + // rpc urls of test nodes |
| 66 | + nodeRPCUrls := []string{NodeRPCUrl0, NodeRPCUrl1, NodeRPCUrl2, NodeRPCUrl3} |
| 67 | + |
| 68 | + return &Config{ |
| 69 | + ChainID: ChainID, |
| 70 | + EVMChainID: evmChainID, |
| 71 | + PrivKeys: privKeys, |
| 72 | + JsonRPCUrls: jsonRPCUrls, |
| 73 | + NodeRPCUrls: nodeRPCUrls, |
| 74 | + }, nil |
| 75 | +} |
0 commit comments