network.d.ts
1 import { TAB } from 'components/Header/components/constants'; 2 3 type StaticNetworkIds = 4 | 'ETH' 5 | 'Ropsten' 6 | 'Kovan' 7 | 'Rinkeby' 8 | 'ETC' 9 | 'UBQ' 10 | 'EXP' 11 | 'POA' 12 | 'TOMO' 13 | 'ELLA' 14 | 'MUSIC' 15 | 'ETSC' 16 | 'EGEM' 17 | 'CLO' 18 | 'RSK' 19 | 'RSK_TESTNET' 20 | 'GO' 21 | 'GO_TESTNET' 22 | 'EOSC' 23 | 'ESN' 24 | 'AQUA'; 25 26 export interface BlockExplorerConfig { 27 name: string; 28 origin: string; 29 txUrl(txHash: string): string; 30 addressUrl(address: string): string; 31 blockUrl(blockNum: string | number): string; 32 } 33 34 interface Token { 35 address: string; 36 symbol: string; 37 decimal: number; 38 error?: string | null; 39 } 40 41 interface NetworkContract { 42 name: StaticNetworkIds; 43 address?: string; 44 abi: string; 45 } 46 47 interface DPathFormats { 48 trezor?: DPath; 49 safeTmini?: DPath; 50 ledgerNanoS?: DPath; 51 mnemonicPhrase: DPath; 52 } 53 54 export interface GasPriceSetting { 55 min: number; 56 max: number; 57 initial: number; 58 } 59 60 interface StaticNetworkConfig { 61 isCustom: false; // used for type guards 62 id: StaticNetworkIds; 63 name: string; 64 unit: string; 65 color?: string; 66 blockExplorer: BlockExplorerConfig; 67 tokenExplorer?: { 68 name: string; 69 address(address: string): string; 70 }; 71 chainId: number; 72 tokens: Token[]; 73 contracts: NetworkContract[] | null; 74 dPathFormats: DPathFormats; 75 isTestnet?: boolean; 76 gasPriceSettings: GasPriceSetting; 77 shouldEstimateGasPrice?: boolean; 78 unsupportedTabs?: TAB[]; 79 } 80 81 interface CustomNetworkConfig { 82 isCustom: true; // used for type guards 83 isTestnet?: boolean; 84 id: string; 85 name: string; 86 unit: string; 87 chainId: number; 88 dPathFormats: DPathFormats | null; 89 unsupportedTabs?: TAB[]; 90 } 91 92 type NetworkConfig = CustomNetworkConfig | StaticNetworkConfig;