2018-02-12 12:43:07 -08:00
|
|
|
import { StaticNetworksState, CustomNetworksState } from 'reducers/config/networks';
|
|
|
|
|
|
|
|
type StaticNetworkIds = 'ETH' | 'Ropsten' | 'Kovan' | 'Rinkeby' | 'ETC' | 'UBQ' | 'EXP';
|
|
|
|
|
|
|
|
interface BlockExplorerConfig {
|
2018-02-16 08:57:23 -08:00
|
|
|
name: string;
|
2018-02-12 12:43:07 -08:00
|
|
|
origin: string;
|
|
|
|
txUrl(txHash: string): string;
|
|
|
|
addressUrl(address: string): string;
|
2018-02-16 08:57:23 -08:00
|
|
|
blockUrl(blockNum: string | number): string;
|
2018-02-12 12:43:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Token {
|
|
|
|
address: string;
|
|
|
|
symbol: string;
|
|
|
|
decimal: number;
|
|
|
|
error?: string | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface NetworkContract {
|
|
|
|
name: StaticNetworkIds;
|
|
|
|
address?: string;
|
|
|
|
abi: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface DPathFormats {
|
|
|
|
trezor: DPath;
|
|
|
|
ledgerNanoS: DPath;
|
|
|
|
mnemonicPhrase: DPath;
|
|
|
|
}
|
|
|
|
|
2018-02-24 10:00:00 -08:00
|
|
|
export interface GasPriceSetting {
|
|
|
|
min: number;
|
|
|
|
max: number;
|
|
|
|
initial: number;
|
|
|
|
}
|
|
|
|
|
2018-02-12 12:43:07 -08:00
|
|
|
interface StaticNetworkConfig {
|
|
|
|
isCustom: false; // used for type guards
|
|
|
|
name: StaticNetworkIds;
|
|
|
|
unit: string;
|
|
|
|
color?: string;
|
2018-02-16 08:57:23 -08:00
|
|
|
blockExplorer: BlockExplorerConfig;
|
2018-02-12 12:43:07 -08:00
|
|
|
tokenExplorer?: {
|
|
|
|
name: string;
|
|
|
|
address(address: string): string;
|
|
|
|
};
|
|
|
|
chainId: number;
|
|
|
|
tokens: Token[];
|
|
|
|
contracts: NetworkContract[] | null;
|
|
|
|
dPathFormats: DPathFormats;
|
|
|
|
isTestnet?: boolean;
|
2018-02-24 10:00:00 -08:00
|
|
|
gasPriceSettings: GasPriceSetting;
|
|
|
|
shouldEstimateGasPrice?: boolean;
|
2018-02-12 12:43:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
interface CustomNetworkConfig {
|
|
|
|
isCustom: true; // used for type guards
|
|
|
|
isTestnet?: boolean;
|
|
|
|
name: string;
|
|
|
|
unit: string;
|
|
|
|
chainId: number;
|
|
|
|
dPathFormats: DPathFormats | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
type NetworkConfig = StaticNetworksState[StaticNetworkIds] | CustomNetworksState[string];
|