|
7 | 7 |
|
8 | 8 | package etherscan
|
9 | 9 |
|
10 |
| -const ( |
11 |
| - // // Ethereum public networks |
12 |
| - |
| 10 | +var ( |
13 | 11 | // EthMainnet Ethereum mainnet for production
|
14 |
| - EthMainnet Network = "https://api.etherscan.io/api?" |
| 12 | + EthMainnet Network = Network{"Ethereum", "main", "https://api.etherscan.io/api?"} |
15 | 13 | // EthRopsten Testnet(POW)
|
16 |
| - EthRopsten Network = "https://api-ropsten.etherscan.io/api?" |
| 14 | + EthRopsten Network = Network{"Ethereum Ropsten", "test", "https://api-ropsten.etherscan.io/api?"} |
17 | 15 | // EthKovan Testnet(POA)
|
18 |
| - EthKovan Network = "https://api-kovan.etherscan.io/api?" |
| 16 | + EthKovan Network = Network{"Ethereum Kovan", "test", "https://api-kovan.etherscan.io/api?"} |
19 | 17 | // EthRinkby Testnet(CLIQUE)
|
20 |
| - EthRinkby Network = "https://api-rinkeby.etherscan.io/api?" |
| 18 | + EthRinkby Network = Network{"Ethereum Rinkby", "test", "https://api-rinkeby.etherscan.io/api?"} |
21 | 19 | // EthGoerli Testnet(CLIQUE)
|
22 |
| - EthGoerli Network = "https://api-goerli.etherscan.io/api?" |
| 20 | + EthGoerli Network = Network{"Ethereum Goerli", "test", "https://api-goerli.etherscan.io/api?"} |
23 | 21 | // EthTobalaba Testnet
|
24 |
| - EthTobalaba Network = "https://api-tobalaba.etherscan.io/api?" |
| 22 | + EthTobalaba Network = Network{"Ethereum Tobalaba", "test", "https://api-tobalaba.etherscan.io/api?"} |
25 | 23 | // MaticMainnet Matic mainnet for production
|
26 |
| - MaticMainnet Network = "https://api.polygonscan.com/api?" |
| 24 | + MaticMainnet Network = Network{"Polygon", "main", "https://api.polygonscan.com/api?"} |
27 | 25 | // MaticTestnet Matic testnet for development
|
28 |
| - MaticTestnet Network = "https://api-testnet.polygonscan.com/api?" |
| 26 | + MaticTestnet Network = Network{"Polygon Mumbai", "test", "https://api-testnet.polygonscan.com/api?"} |
29 | 27 | // BscMainnet Bsc mainnet for production
|
30 |
| - BscMainnet Network = "https://api.bscscan.com/api?" |
| 28 | + BscMainnet Network = Network{"Binance", "main", "https://api.bscscan.com/api?"} |
31 | 29 | // BscTestnet Bsc testnet for development
|
32 |
| - BscTestnet Network = "https://api-testnet.bscscan.com/api?" |
| 30 | + BscTestnet Network = Network{"Binance test", "test", "https://api-testnet.bscscan.com/api?"} |
33 | 31 | )
|
34 | 32 |
|
35 | 33 | // Network is ethereum network type (mainnet, ropsten, etc)
|
36 |
| -type Network string |
| 34 | +type Network struct { |
| 35 | + Name string |
| 36 | + Type string |
| 37 | + BaseURL string |
| 38 | +} |
37 | 39 |
|
38 |
| -// SubDomain returns the subdomain of etherscan API |
39 |
| -// via n provided. |
| 40 | +// Domain returns the subdomain of etherscan API via n provided. |
40 | 41 | func (n Network) Domain() (sub string) {
|
41 |
| - return string(n) |
| 42 | + return n.BaseURL |
42 | 43 | }
|
0 commit comments