Skip to content

Commit 33a85e4

Browse files
authored
Merge pull request #312 from blocknative/fix/wallet-connect-resolve
Fix: WalletConnect Resolve. Closes #310
2 parents c8321db + 0f97df6 commit 33a85e4

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/modules/check/connect.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ function connect(
2121
if (address === null) {
2222
// wait for address sync if is still on initial value
2323
if (stateSyncStatus.address) {
24-
try {
25-
await stateSyncStatus.address
26-
} catch (error) {}
24+
await new Promise(resolve => {
25+
stateSyncStatus.address && stateSyncStatus.address.then(resolve)
26+
27+
setTimeout(() => {
28+
if (address === null) {
29+
// if prom isn't resolving after 250ms, then stop waiting
30+
resolve()
31+
}
32+
}, 250)
33+
})
2734
}
2835
}
2936

src/modules/check/network.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ function network(
2424
if (network === null) {
2525
// wait for network sync if is still on initial value
2626
if (stateSyncStatus.network) {
27-
try {
28-
await stateSyncStatus.network
29-
} catch (error) {}
27+
await new Promise(resolve => {
28+
stateSyncStatus.network && stateSyncStatus.network.then(resolve)
29+
30+
setTimeout(() => {
31+
if (network === null) {
32+
// if prom isn't resolving after 250ms, then stop waiting
33+
resolve()
34+
}
35+
}, 250)
36+
})
3037
}
3138
}
3239

0 commit comments

Comments
 (0)