UNPKG

@metamask/network-controller

Version:

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

30 lines 1.36 kB
import type { NetworkControllerMessenger } from "./NetworkController.mjs"; import type { RpcServiceOptions } from "./rpc-service/rpc-service.mjs"; import type { BlockTracker, NetworkClientConfiguration, Provider } from "./types.mjs"; /** * The pair of provider / block tracker that can be used to interface with the * network and respond to new activity. */ export type NetworkClient = { configuration: NetworkClientConfiguration; provider: Provider; blockTracker: BlockTracker; destroy: () => void; }; /** * Create a JSON RPC network client for a specific network. * * @param args - The arguments. * @param args.configuration - The network configuration. * @param args.getRpcServiceOptions - Factory for constructing RPC service * options. See {@link NetworkControllerOptions.getRpcServiceOptions}. * @param args.messenger - The network controller messenger. * See {@link NetworkControllerOptions.getRpcServiceOptions}. * @returns The network client. */ export declare function createNetworkClient({ configuration, getRpcServiceOptions, messenger, }: { configuration: NetworkClientConfiguration; getRpcServiceOptions: (rpcEndpointUrl: string) => Omit<RpcServiceOptions, 'failoverService' | 'endpointUrl'>; messenger: NetworkControllerMessenger; }): NetworkClient; //# sourceMappingURL=create-network-client.d.mts.map