Skip to content

Commit 805ab5d

Browse files
committed
Merge remote-tracking branch 'origin/feat/connect-methods' into feat/connect-methods
2 parents 2ee2010 + 999e719 commit 805ab5d

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

packages/connect-evm/src/connect.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -410,22 +410,14 @@ export class MetamaskConnectEVM {
410410
forceRequest,
411411
});
412412

413-
// If account is already available, proceed immediately
414-
if (this.#provider.selectedAccount) {
415-
const resolvedParams =
416-
typeof params === 'function'
417-
? params(this.#provider.selectedAccount)
418-
: params;
419-
return await this.#provider.request({
420-
method,
421-
params: resolvedParams,
422-
});
423-
}
424-
425-
// Otherwise, wait for the accountsChanged event to be triggered
426413
// This is only needed for methods that require an account
427414
const timeout = 5000;
428415
const accountPromise = new Promise<Address>((resolve, reject) => {
416+
// If account is already available, proceed immediately
417+
if (this.#provider.selectedAccount) {
418+
return this.#provider.selectedAccount;
419+
}
420+
// Otherwise, wait for the accountsChanged event to be triggered
429421
// eslint-disable-next-line prefer-const
430422
let timeoutId: ReturnType<typeof setTimeout>;
431423

0 commit comments

Comments
 (0)