@metamask/multichain-network-controller
Version:
Multichain network controller
42 lines • 2.21 kB
text/typescript
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.cjs";
import type { AbstractMultichainNetworkService } from "../MultichainNetworkService/AbstractMultichainNetworkService.cjs";
import { MULTICHAIN_NETWORK_CONTROLLER_NAME } from "../types.cjs";
import type { MultichainNetworkControllerState, MultichainNetworkControllerMessenger, SupportedCaipChainId } from "../types.cjs";
/**
* 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.cts.map