diff --git a/dist/esm/actions/connect.js b/dist/esm/actions/connect.js index a51f111e8ed4c075799a9e0ca9bb6dca44f7fe11..b363d0d755f964d29fb4d4fae480ad9cd4dc2919 100644 --- a/dist/esm/actions/connect.js +++ b/dist/esm/actions/connect.js @@ -1,4 +1,7 @@ import { ConnectorAlreadyConnectedError, } from '../errors/config.js'; +import { getChainId, } from './getChainId.js'; + + /** https://wagmi.sh/core/api/actions/connect */ export async function connect(config, parameters) { // "Register" connector if not already created @@ -14,7 +17,8 @@ export async function connect(config, parameters) { try { config.setState((x) => ({ ...x, status: 'connecting' })); connector.emitter.emit('message', { type: 'connecting' }); - const data = await connector.connect({ chainId: parameters.chainId }); + const chainId = getChainId(config); + const data = await connector.connect(); const accounts = data.accounts; connector.emitter.off('connect', config._internal.events.connect); connector.emitter.on('change', config._internal.events.change); @@ -24,13 +28,13 @@ export async function connect(config, parameters) { ...x, connections: new Map(x.connections).set(connector.uid, { accounts, - chainId: data.chainId, + chainId, connector: connector, }), current: connector.uid, status: 'connected', })); - return { accounts, chainId: data.chainId }; + return { accounts, chainId }; } catch (error) { config.setState((x) => ({