fix(trading,governance): eager connection for browser wallet (#4444)

This commit is contained in:
Matthew Russell 2023-08-02 17:16:09 +01:00 committed by GitHub
parent b87c981a90
commit 65071f57d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,14 @@ export function useEagerConnect(Connectors: {
return;
}
try {
await connect(Connectors[cfg.connector]);
if (cfg.connector === 'injected') {
const injectedInstance = Connectors[cfg.connector];
// @ts-ignore only injected wallet has connectWallet method
await injectedInstance.connectWallet();
await connect(injectedInstance);
} else {
await connect(Connectors[cfg.connector]);
}
} catch {
console.warn(`Failed to connect with connector: ${cfg.connector}`);
} finally {