Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions packages/connect-evm/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,23 +786,16 @@ export class MetamaskConnectEVM {
if (hexPermittedChainIds.length === 0) {
this.#onDisconnect();
} else {
let initialAccounts: Address[] = [];
if (this.#core.status === 'connected') {
const ethAccountsResponse =
await this.#core.transport.sendEip1193Message({
method: 'eth_accounts',
params: [],
});
initialAccounts = ethAccountsResponse.result as Address[];
} else {
initialAccounts = getEthAccounts(this.#sessionScopes);
if (this.#status === 'connected') {
return;
}

const accounts: Address[] = getEthAccounts(this.#sessionScopes);
const chainId = await this.#getSelectedChainId(hexPermittedChainIds);

this.#onConnect({
chainId,
accounts: initialAccounts,
accounts,
});
}
}
Expand Down Expand Up @@ -861,8 +854,6 @@ export class MetamaskConnectEVM {
};

if (this.#status === 'connected') {
this.#onChainChanged(chainId);
this.#onAccountsChanged(accounts);
return;
}

Expand Down
Loading