UNPKG

@dethcrypto/eth-sdk

Version:

🛠 Generate type-safe, lightweight SDK for your Ethereum smart contracts

52 lines (51 loc) • 1.84 kB
import { Opaque, SafeDictionary } from 'ts-essentials'; export declare enum NetworkID { MAINNET = 1, ROPSTEN = 3, RINKEBY = 4, GOERLI = 5, KOVAN = 42, SEPOLIA = 11155111, BSC = 56, BSC_TESTNET = 97, HECO = 128, HECO_TESTNET = 256, OPERA = 250, FTM_TESTNET = 4002, OPTIMISTIC_ETHEREUM = 10, OPTIMISTIC_KOVAN = 69, POLYGON = 137, POLYGON_MUMBAI = 80001, ARBITRUM_ONE = 42161, ARBITRUM_TESTNET = 421611, AVALANCHE = 43114, AVALANCHE_FUJI_TESTNET = 43113 } export declare const networkIDtoSymbol: { readonly 1: "mainnet"; readonly 3: "ropsten"; readonly 4: "rinkeby"; readonly 5: "goerli"; readonly 11155111: "sepolia"; readonly 42: "kovan"; readonly 56: "bsc"; readonly 97: "bscTestnet"; readonly 128: "heco"; readonly 256: "hecoTestnet"; readonly 250: "opera"; readonly 4002: "ftmTestnet"; readonly 10: "optimism"; readonly 69: "optimismKovan"; readonly 137: "polygon"; readonly 80001: "polygonMumbai"; readonly 42161: "arbitrumOne"; readonly 421611: "arbitrumTestnet"; readonly 43114: "avalanche"; readonly 43113: "fuji"; }; export declare type UserProvidedNetworkSymbol = Opaque<string, 'UserProvidedNetworkSymbol'>; export declare const UserProvidedNetworkSymbol: (s: string) => UserProvidedNetworkSymbol; export declare function isUserProvidedNetwork(symbol: NetworkSymbol, userNetworks: Record<UserProvidedNetworkSymbol, string | number | undefined>): symbol is UserProvidedNetworkSymbol; export declare type PredefinedNetworkSymbol = typeof networkIDtoSymbol[keyof typeof networkIDtoSymbol]; export declare type NetworkSymbol = UserProvidedNetworkSymbol | PredefinedNetworkSymbol; export declare const symbolToNetworkId: SafeDictionary<NetworkID, PredefinedNetworkSymbol>;