UNPKG

@metamask/multichain-network-controller

Version:
41 lines 2.19 kB
import { BaseController } from "@metamask/base-controller"; import type { NetworkClientId } from "@metamask/network-controller"; import { type CaipChainId } from "@metamask/utils"; import { type ActiveNetworksByAddress } from "../api/accounts-api.mjs"; import type { AbstractMultichainNetworkService } from "../MultichainNetworkService/AbstractMultichainNetworkService.mjs"; import { MULTICHAIN_NETWORK_CONTROLLER_NAME, type MultichainNetworkControllerState, type MultichainNetworkControllerMessenger, type SupportedCaipChainId } from "../types.mjs"; /** * The MultichainNetworkController is responsible for fetching and caching account * balances. */ export declare class MultichainNetworkController extends BaseController<typeof MULTICHAIN_NETWORK_CONTROLLER_NAME, MultichainNetworkControllerState, MultichainNetworkControllerMessenger> { #private; constructor({ messenger, state, networkService, }: { messenger: MultichainNetworkControllerMessenger; state?: Omit<Partial<MultichainNetworkControllerState>, 'multichainNetworkConfigurationsByChainId'>; networkService: AbstractMultichainNetworkService; }); /** * Sets the active network. * * @param id - The non-EVM Caip chain ID or EVM client ID of the network to set active. * @returns - A promise that resolves when the network is set active. */ setActiveNetwork(id: SupportedCaipChainId | NetworkClientId): Promise<void>; /** * Returns the active networks for the available EVM addresses (non-EVM networks will be supported in the future). * Fetches the data from the API and caches it in state. * * @returns A promise that resolves to the active networks for the available addresses */ getNetworksWithTransactionActivityByAccounts(): Promise<ActiveNetworksByAddress>; /** * Removes a network from the list of networks. * It only supports EVM networks. * * @param chainId - The chain ID of the network to remove. * @returns - A promise that resolves when the network is removed. */ removeNetwork(chainId: CaipChainId): Promise<void>; } //# sourceMappingURL=MultichainNetworkController.d.mts.map