UNPKG

@metamask/network-controller

Version:

Provides an interface to the currently selected network via a MetaMask-compatible provider object

1 lines 2 kB
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B","sourcesContent":["import type { InfuraNetworkType, ChainId } from '@metamask/controller-utils';\nimport type { BlockTracker as BaseBlockTracker } from '@metamask/eth-block-tracker';\nimport type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';\nimport type { Hex } from '@metamask/utils';\n\nexport type Provider = SafeEventEmitterProvider;\n\nexport type BlockTracker = BaseBlockTracker & {\n checkForLatestBlock(): Promise<string>;\n};\n\n/**\n * The type of network client that can be created.\n */\nexport enum NetworkClientType {\n Custom = 'custom',\n Infura = 'infura',\n}\n\n/**\n * A configuration object that can be used to create a client for a network.\n */\ntype CommonNetworkClientConfiguration = {\n chainId: Hex;\n failoverRpcUrls?: string[];\n ticker: string;\n};\n\n/**\n * A configuration object that can be used to create a client for a custom\n * network.\n */\nexport type CustomNetworkClientConfiguration =\n CommonNetworkClientConfiguration & {\n rpcUrl: string;\n type: NetworkClientType.Custom;\n };\n\n/**\n * A configuration object that can be used to create a client for an Infura\n * network.\n */\nexport type InfuraNetworkClientConfiguration =\n CommonNetworkClientConfiguration & {\n network: InfuraNetworkType;\n infuraProjectId: string;\n type: NetworkClientType.Infura;\n };\n\n/**\n * A configuration object that can be used to create a client for a network.\n */\nexport type NetworkClientConfiguration =\n | CustomNetworkClientConfiguration\n | InfuraNetworkClientConfiguration;\n\n/**\n * The Chain ID representing the additional networks to be included as default.\n */\nexport type AdditionalDefaultNetwork = (typeof ChainId)[\n | 'megaeth-testnet'\n | 'monad-testnet'];\n"]}