Skip to content

Commit

Permalink
Merge pull request #78 from XDeFi-tech/fix/revert-timeouts
Browse files Browse the repository at this point in the history
revert timeouts
  • Loading branch information
maxlm-devico committed Feb 6, 2024
2 parents e153c7d + 3b5355e commit 62e4746
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@xdefi/wallets-connector",
"version": "2.1.5",
"version": "2.1.6",
"description": "Cross chain wallets connector with react hooks",
"author": "garageinc",
"license": "MIT",
Expand Down
14 changes: 1 addition & 13 deletions src/controllers/providers.ts
Expand Up @@ -259,21 +259,9 @@ export class ProviderController {
}

public async connectToCachedProviders() {
const connectionTimeout = 600
return Promise.allSettled(
(this.cachedProviders || []).map((pid: string) =>
Promise.race([
this.connectTo(pid, this.injectedChains[pid]),
new Promise<undefined>((_, reject) =>
setTimeout(() => {
reject(
new Error(
'Connection to cached provider timed out: no response from wallet'
)
)
}, connectionTimeout)
)
])
this.connectTo(pid, this.injectedChains[pid])
)
)
}
Expand Down
5 changes: 1 addition & 4 deletions src/wallets/index.ts
Expand Up @@ -119,10 +119,7 @@ export class WalletsConnector {

this.cachedProviders.map((providerId, providerIndex) => {
const cachedProviderConnect = results[providerIndex]
if (
cachedProviderConnect.status === 'fulfilled' &&
cachedProviderConnect.value !== undefined
) {
if (cachedProviderConnect.status === 'fulfilled') {
const { id, connectedList } = cachedProviderConnect.value
this.setAccounts(id, connectedList)
} else {
Expand Down

0 comments on commit 62e4746

Please sign in to comment.