Skip to content

Commit 43fa971

Browse files
committedJun 27, 2024··
fix: #4058
1 parent 275cccb commit 43fa971

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed
 

‎.changeset/angry-sheep-tan.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@wagmi/connectors": patch
3+
---
4+
5+
Bumped Coinbase Wallet SDK and fixed `metaMask` connector hang on mobile.

‎packages/connectors/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
}
4646
},
4747
"dependencies": {
48-
"@coinbase/wallet-sdk": "4.0.3",
48+
"@coinbase/wallet-sdk": "4.0.4",
4949
"@metamask/sdk": "0.26.3",
5050
"@safe-global/safe-apps-provider": "0.18.1",
5151
"@safe-global/safe-apps-sdk": "8.1.0",

‎packages/connectors/src/metaMask.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
getAddress,
2222
numberToHex,
2323
withRetry,
24+
withTimeout,
2425
} from 'viem'
2526

2627
export type MetaMaskParameters = Evaluate<
@@ -194,10 +195,14 @@ export function metaMask(parameters: MetaMaskParameters = {}) {
194195
try {
195196
// MetaMask mobile provider sometimes fails to immediately resolve
196197
// JSON-RPC requests on page load
197-
const accounts = await withRetry(() => this.getAccounts(), {
198-
delay: 200,
199-
retryCount: 3,
200-
})
198+
const timeout = 200
199+
const accounts = await withRetry(
200+
() => withTimeout(() => this.getAccounts(), { timeout }),
201+
{
202+
delay: timeout + 1,
203+
retryCount: 3,
204+
},
205+
)
201206
return !!accounts.length
202207
} catch {
203208
return false

‎packages/core/src/query/readContract.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { expectTypeOf, test } from 'vitest'
44
import { readContractQueryOptions } from './readContract.js'
55

66
test('default', async () => {
7-
const options = await readContractQueryOptions(config, {
7+
const options = readContractQueryOptions(config, {
88
address: '0x',
99
abi: abi.erc20,
1010
functionName: 'balanceOf',

‎pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.