UNPKG

@reown/appkit-controllers

Version:

The full stack toolkit to build onchain app UX.

38 lines 1.14 kB
import { vi } from 'vitest'; import { AccountController, ChainController } from '../exports/index.js'; export const extendedMainnet = { id: 1, caipNetworkId: 'eip155:1', chainNamespace: 'eip155', name: 'Ethereum Mainnet', nativeCurrency: { decimals: 18, name: 'Ether', symbol: 'ETH' }, rpcUrls: { default: { http: [], webSocket: undefined } } }; export function mockChainControllerState(state) { // @ts-expect-error - we need to mock the state vi.spyOn(ChainController, 'state', 'get').mockReturnValue({ ...ChainController.state, ...state }); } export function updateChainsMap(namespace, state) { const currentState = ChainController.state.chains.get(namespace); // @ts-expect-error - we need to mock the state ChainController.state.chains.set(namespace, { ...currentState, ...state }); } export function mockAccountControllerState(state) { vi.spyOn(AccountController, 'state', 'get').mockReturnValue({ ...AccountController.state, ...state }); } //# sourceMappingURL=testing.js.map