diff --git a/packages/sender/src/lib/sender.ts b/packages/sender/src/lib/sender.ts index 15cae127b..a8a6d48e4 100644 --- a/packages/sender/src/lib/sender.ts +++ b/packages/sender/src/lib/sender.ts @@ -102,6 +102,16 @@ const Sender: WalletBehaviourFactory = async ({ }; const getAccounts = async (): Promise> => { + // Add extra wait to ensure Sender's sign in status is read from the + // browser extension background env. + // Check for isSignedIn() in only if selectedWalletId is set. + const { selectedWalletId } = store.getState(); + if (selectedWalletId) { + await waitFor(() => !!_state.wallet?.isSignedIn(), { + timeout: 1000, + }).catch(); + } + const accountId = _state.wallet.getAccountId(); if (!accountId) { @@ -322,15 +332,6 @@ export function setupSender({ const installed = await isInstalled(); - // Add extra wait to ensure Sender's sign in status is read from the - // browser extension background env. - // Check for isSignedIn() in only if extension is installed. - if (installed) { - await waitFor(() => !!window.near?.isSignedIn(), { timeout: 200 }).catch( - () => false - ); - } - return { id: "sender", type: "injected",