@wagmi/connectors 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +13 -0
  2. package/dist/esm/coinbaseWallet.js +15 -16
  3. package/dist/esm/coinbaseWallet.js.map +1 -1
  4. package/dist/esm/exports/index.js +7 -0
  5. package/dist/esm/exports/index.js.map +1 -0
  6. package/dist/esm/exports/index.test-d.js.map +1 -0
  7. package/dist/esm/metaMask.js +264 -0
  8. package/dist/esm/metaMask.js.map +1 -0
  9. package/dist/esm/safe.js +19 -16
  10. package/dist/esm/safe.js.map +1 -1
  11. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  12. package/dist/esm/version.js +1 -1
  13. package/dist/esm/walletConnect.js +15 -16
  14. package/dist/esm/walletConnect.js.map +1 -1
  15. package/dist/types/coinbaseWallet.d.ts +3 -0
  16. package/dist/types/coinbaseWallet.d.ts.map +1 -1
  17. package/dist/types/exports/index.d.ts +7 -0
  18. package/dist/types/exports/index.d.ts.map +1 -0
  19. package/dist/types/exports/index.test-d.d.ts.map +1 -0
  20. package/dist/types/metaMask.d.ts +13 -0
  21. package/dist/types/metaMask.d.ts.map +1 -0
  22. package/dist/types/safe.d.ts +5 -2
  23. package/dist/types/safe.d.ts.map +1 -1
  24. package/dist/types/version.d.ts +1 -1
  25. package/dist/types/walletConnect.d.ts +3 -0
  26. package/dist/types/walletConnect.d.ts.map +1 -1
  27. package/package.json +21 -38
  28. package/src/coinbaseWallet.ts +16 -16
  29. package/src/exports/index.ts +22 -0
  30. package/src/metaMask.ts +333 -0
  31. package/src/safe.ts +26 -20
  32. package/src/version.ts +1 -1
  33. package/src/walletConnect.ts +15 -20
  34. package/dist/esm/index.js +0 -7
  35. package/dist/esm/index.js.map +0 -1
  36. package/dist/esm/index.test-d.js.map +0 -1
  37. package/dist/esm/injected.js +0 -372
  38. package/dist/esm/injected.js.map +0 -1
  39. package/dist/esm/ledger.js +0 -162
  40. package/dist/esm/ledger.js.map +0 -1
  41. package/dist/types/index.d.ts +0 -7
  42. package/dist/types/index.d.ts.map +0 -1
  43. package/dist/types/index.test-d.d.ts.map +0 -1
  44. package/dist/types/injected.d.ts +0 -381
  45. package/dist/types/injected.d.ts.map +0 -1
  46. package/dist/types/ledger.d.ts +0 -18
  47. package/dist/types/ledger.d.ts.map +0 -1
  48. package/src/index.ts +0 -17
  49. package/src/injected.ts +0 -527
  50. package/src/ledger.ts +0 -210
  51. /package/dist/esm/{index.test-d.js → exports/index.test-d.js} +0 -0
  52. /package/dist/types/{index.test-d.d.ts → exports/index.test-d.d.ts} +0 -0
@@ -0,0 +1,333 @@
1
+ import {
2
+ EventType,
3
+ MetaMaskSDK,
4
+ type MetaMaskSDKOptions,
5
+ SDKProvider,
6
+ } from '@metamask/sdk'
7
+ import {
8
+ ChainNotConfiguredError,
9
+ createConnector,
10
+ normalizeChainId,
11
+ } from '@wagmi/core'
12
+ import type { Evaluate, ExactPartial, Omit } from '@wagmi/core/internal'
13
+ import {
14
+ type Address,
15
+ type ProviderConnectInfo,
16
+ type ProviderRpcError,
17
+ ResourceUnavailableRpcError,
18
+ RpcError,
19
+ SwitchChainError,
20
+ UserRejectedRequestError,
21
+ type WalletPermission,
22
+ getAddress,
23
+ numberToHex,
24
+ } from 'viem'
25
+
26
+ export type MetaMaskParameters = Evaluate<
27
+ ExactPartial<
28
+ Omit<
29
+ MetaMaskSDKOptions,
30
+ | 'checkInstallationImmediately'
31
+ | 'checkInstallationOnAllCalls'
32
+ | 'defaultReadOnlyChainId'
33
+ | 'readonlyRPCMap'
34
+ >
35
+ >
36
+ >
37
+
38
+ metaMask.type = 'metaMask' as const
39
+ export function metaMask(parameters: MetaMaskParameters = {}) {
40
+ type Provider = SDKProvider
41
+ type Properties = {
42
+ onConnect(connectInfo: ProviderConnectInfo): void
43
+ }
44
+ type StorageItem = { 'metaMaskSDK.disconnected': true }
45
+ type Listener = Parameters<Provider['on']>[1]
46
+
47
+ let sdk: MetaMaskSDK
48
+ let walletProvider: Provider | undefined
49
+
50
+ return createConnector<Provider, Properties, StorageItem>((config) => ({
51
+ id: 'metaMaskSDK',
52
+ name: 'MetaMask',
53
+ type: metaMask.type,
54
+ async setup() {
55
+ const provider = await this.getProvider()
56
+ if (provider)
57
+ provider.on('connect', this.onConnect.bind(this) as Listener)
58
+ },
59
+ async connect({ chainId, isReconnecting } = {}) {
60
+ const provider = await this.getProvider()
61
+
62
+ let accounts: readonly Address[] | null = null
63
+ if (!isReconnecting) {
64
+ accounts = await this.getAccounts().catch(() => null)
65
+ const isAuthorized = !!accounts?.length
66
+ if (isAuthorized)
67
+ // Attempt to show another prompt for selecting account if already connected
68
+ try {
69
+ const permissions = (await provider.request({
70
+ method: 'wallet_requestPermissions',
71
+ params: [{ eth_accounts: {} }],
72
+ })) as WalletPermission[]
73
+ accounts = permissions[0]?.caveats?.[0]?.value?.map(getAddress)
74
+ } catch (err) {
75
+ const error = err as RpcError
76
+ // Not all injected providers support `wallet_requestPermissions` (e.g. MetaMask iOS).
77
+ // Only bubble up error if user rejects request
78
+ if (error.code === UserRejectedRequestError.code)
79
+ throw new UserRejectedRequestError(error)
80
+ // Or prompt is already open
81
+ if (error.code === ResourceUnavailableRpcError.code) throw error
82
+ }
83
+ }
84
+
85
+ try {
86
+ if (!accounts?.length) {
87
+ const requestedAccounts = (await sdk.connect()) as string[]
88
+ accounts = requestedAccounts.map(getAddress)
89
+ }
90
+
91
+ provider.removeListener(
92
+ 'connect',
93
+ this.onConnect.bind(this) as Listener,
94
+ )
95
+ provider.on(
96
+ 'accountsChanged',
97
+ this.onAccountsChanged.bind(this) as Listener,
98
+ )
99
+ provider.on('chainChanged', this.onChainChanged as Listener)
100
+ provider.on('disconnect', this.onDisconnect.bind(this) as Listener)
101
+
102
+ // Backward compatibility with older wallet (<7.3) version that return accounts before authorization
103
+ if (!sdk.isExtensionActive() && !sdk._getConnection()?.isAuthorized()) {
104
+ function waitForAuthorized() {
105
+ return new Promise((resolve) => {
106
+ const connection = sdk._getConnection()
107
+ const connector = connection?.getConnector()
108
+ connector?.once(EventType.AUTHORIZED, () => resolve(true))
109
+ })
110
+ }
111
+ await waitForAuthorized()
112
+ }
113
+
114
+ // Switch to chain if provided
115
+ let currentChainId = await this.getChainId()
116
+ if (chainId && currentChainId !== chainId) {
117
+ const chain = await this.switchChain?.({ chainId }).catch(() => ({
118
+ id: currentChainId,
119
+ }))
120
+ currentChainId = chain?.id ?? currentChainId
121
+ }
122
+
123
+ await config.storage?.removeItem('metaMaskSDK.disconnected')
124
+
125
+ return { accounts, chainId: currentChainId }
126
+ } catch (err) {
127
+ const error = err as RpcError
128
+ if (error.code === UserRejectedRequestError.code)
129
+ throw new UserRejectedRequestError(error)
130
+ if (error.code === ResourceUnavailableRpcError.code)
131
+ throw new ResourceUnavailableRpcError(error)
132
+ throw error
133
+ }
134
+ },
135
+ async disconnect() {
136
+ const provider = await this.getProvider()
137
+
138
+ provider.removeListener(
139
+ 'accountsChanged',
140
+ this.onAccountsChanged.bind(this),
141
+ )
142
+ provider.removeListener('chainChanged', this.onChainChanged)
143
+ provider.removeListener('disconnect', this.onDisconnect.bind(this))
144
+ provider.on('connect', this.onConnect.bind(this) as Listener)
145
+
146
+ sdk.terminate()
147
+
148
+ // Add shim signalling connector is disconnected
149
+ await config.storage?.setItem('metaMaskSDK.disconnected', true)
150
+ },
151
+ async getAccounts() {
152
+ const provider = await this.getProvider()
153
+ const accounts = (await provider.request({
154
+ method: 'eth_accounts',
155
+ })) as string[]
156
+ return accounts.map(getAddress)
157
+ },
158
+ async getChainId() {
159
+ const provider = await this.getProvider()
160
+ const chainId =
161
+ provider.chainId ?? (await provider?.request({ method: 'eth_chainId' }))
162
+ return normalizeChainId(chainId)
163
+ },
164
+ async getProvider() {
165
+ if (!walletProvider) {
166
+ if (!sdk || !sdk?.isInitialized()) {
167
+ sdk = new MetaMaskSDK({
168
+ enableDebug: false,
169
+ dappMetadata: { name: 'wagmi' },
170
+ extensionOnly: true,
171
+ modals: {
172
+ // Disable by default since it pops up when mobile tries to reconnect
173
+ otp() {
174
+ const noop = () => {}
175
+ return { mount: noop, unmount: noop }
176
+ },
177
+ },
178
+ useDeeplink: true,
179
+ _source: 'wagmi',
180
+ ...parameters,
181
+ checkInstallationImmediately: false,
182
+ checkInstallationOnAllCalls: false,
183
+ })
184
+ await sdk.init()
185
+ }
186
+ try {
187
+ walletProvider = sdk.getProvider()
188
+ } catch (error) {
189
+ // TODO: SDK sometimes throws errors when MM extension or mobile provider is not detected (don't throw for those errors)
190
+ const regex = /^SDK state invalid -- undefined( mobile)? provider$/
191
+ if (!regex.test((error as Error).message)) throw error
192
+ }
193
+ }
194
+ return walletProvider!
195
+ },
196
+ async isAuthorized() {
197
+ try {
198
+ const isDisconnected =
199
+ // If shim exists in storage, connector is disconnected
200
+ await config.storage?.getItem('metaMaskSDK.disconnected')
201
+ if (isDisconnected) return false
202
+
203
+ const accounts = await this.getAccounts()
204
+ return !!accounts.length
205
+ } catch {
206
+ return false
207
+ }
208
+ },
209
+ async switchChain({ chainId }) {
210
+ const provider = await this.getProvider()
211
+
212
+ const chain = config.chains.find((x) => x.id === chainId)
213
+ if (!chain) throw new SwitchChainError(new ChainNotConfiguredError())
214
+
215
+ try {
216
+ await Promise.all([
217
+ provider.request({
218
+ method: 'wallet_switchEthereumChain',
219
+ params: [{ chainId: numberToHex(chainId) }],
220
+ }),
221
+ new Promise<void>((resolve) =>
222
+ config.emitter.once('change', ({ chainId: currentChainId }) => {
223
+ if (currentChainId === chainId) resolve()
224
+ }),
225
+ ),
226
+ ])
227
+ return chain
228
+ } catch (err) {
229
+ const error = err as RpcError
230
+
231
+ // Indicates chain is not added to provider
232
+ if (
233
+ error.code === 4902 ||
234
+ // Unwrapping for MetaMask Mobile
235
+ // https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719
236
+ (error as ProviderRpcError<{ originalError?: { code: number } }>)
237
+ ?.data?.originalError?.code === 4902
238
+ ) {
239
+ try {
240
+ const { default: blockExplorer, ...blockExplorers } =
241
+ chain.blockExplorers ?? {}
242
+ let blockExplorerUrls: string[] = []
243
+ if (blockExplorer)
244
+ blockExplorerUrls = [
245
+ blockExplorer.url,
246
+ ...Object.values(blockExplorers).map((x) => x.url),
247
+ ]
248
+
249
+ await provider.request({
250
+ method: 'wallet_addEthereumChain',
251
+ params: [
252
+ {
253
+ chainId: numberToHex(chainId),
254
+ chainName: chain.name,
255
+ nativeCurrency: chain.nativeCurrency,
256
+ rpcUrls: [chain.rpcUrls.default?.http[0] ?? ''],
257
+ blockExplorerUrls,
258
+ },
259
+ ],
260
+ })
261
+
262
+ const currentChainId = await this.getChainId()
263
+ if (currentChainId !== chainId)
264
+ throw new UserRejectedRequestError(
265
+ new Error('User rejected switch after adding network.'),
266
+ )
267
+
268
+ return chain
269
+ } catch (error) {
270
+ throw new UserRejectedRequestError(error as Error)
271
+ }
272
+ }
273
+
274
+ if (error.code === UserRejectedRequestError.code)
275
+ throw new UserRejectedRequestError(error)
276
+ throw new SwitchChainError(error)
277
+ }
278
+ },
279
+ async onAccountsChanged(accounts) {
280
+ // Disconnect if there are no accounts
281
+ if (accounts.length === 0) this.onDisconnect()
282
+ // Connect if emitter is listening for connect event (e.g. is disconnected and connects through wallet interface)
283
+ else if (config.emitter.listenerCount('connect')) {
284
+ const chainId = (await this.getChainId()).toString()
285
+ this.onConnect({ chainId })
286
+ await config.storage?.removeItem('metaMaskSDK.disconnected')
287
+ }
288
+ // Regular change event
289
+ else config.emitter.emit('change', { accounts: accounts.map(getAddress) })
290
+ },
291
+ onChainChanged(chain) {
292
+ const chainId = normalizeChainId(chain)
293
+ config.emitter.emit('change', { chainId })
294
+ },
295
+ async onConnect(connectInfo) {
296
+ const accounts = await this.getAccounts()
297
+ if (accounts.length === 0) return
298
+
299
+ const chainId = normalizeChainId(connectInfo.chainId)
300
+ config.emitter.emit('connect', { accounts, chainId })
301
+
302
+ const provider = await this.getProvider()
303
+ if (provider) {
304
+ provider.removeListener('connect', this.onConnect.bind(this))
305
+ provider.on('accountsChanged', this.onAccountsChanged.bind(this) as any)
306
+ provider.on('chainChanged', this.onChainChanged as any)
307
+ provider.on('disconnect', this.onDisconnect.bind(this) as any)
308
+ }
309
+ },
310
+ async onDisconnect(error) {
311
+ const provider = await this.getProvider()
312
+
313
+ // If MetaMask emits a `code: 1013` error, wait for reconnection before disconnecting
314
+ // https://github.com/MetaMask/providers/pull/120
315
+ if (error && (error as RpcError<1013>).code === 1013) {
316
+ if (provider && !!(await this.getAccounts()).length) return
317
+ }
318
+
319
+ // No need to remove 'metaMaskSDK.disconnected' from storage because `onDisconnect` is typically
320
+ // only called when the wallet is disconnected through the wallet's interface, meaning the wallet
321
+ // actually disconnected and we don't need to simulate it.
322
+ config.emitter.emit('disconnect')
323
+
324
+ provider.removeListener(
325
+ 'accountsChanged',
326
+ this.onAccountsChanged.bind(this),
327
+ )
328
+ provider.removeListener('chainChanged', this.onChainChanged)
329
+ provider.removeListener('disconnect', this.onDisconnect.bind(this))
330
+ provider.on('connect', this.onConnect.bind(this) as any)
331
+ },
332
+ }))
333
+ }
package/src/safe.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { SafeAppProvider } from '@safe-global/safe-apps-provider'
2
2
  import { type Opts, default as SafeAppsSDK } from '@safe-global/safe-apps-sdk'
3
- import { ProviderNotFoundError } from '@wagmi/core'
4
- import { createConnector, normalizeChainId } from '@wagmi/core'
3
+ import {
4
+ ProviderNotFoundError,
5
+ createConnector,
6
+ normalizeChainId,
7
+ } from '@wagmi/core'
5
8
  import type { Evaluate } from '@wagmi/core/internal'
6
9
  import { getAddress } from 'viem'
7
10
 
@@ -19,12 +22,13 @@ export type SafeParameters = Evaluate<
19
22
  }
20
23
  >
21
24
 
25
+ safe.type = 'safe' as const
22
26
  export function safe(parameters: SafeParameters = {}) {
23
- type Provider = SafeAppProvider
24
- type Properties = {}
25
- type StorageItem = { 'safe.shimDisconnect': true }
27
+ const { shimDisconnect = false } = parameters
26
28
 
27
- const shimDisconnectStorageKey = 'safe.shimDisconnect'
29
+ type Provider = SafeAppProvider | undefined
30
+ type Properties = {}
31
+ type StorageItem = { 'safe.disconnected': true }
28
32
 
29
33
  let provider_: Provider | undefined
30
34
  let SDK: typeof SafeAppsSDK.default
@@ -39,12 +43,8 @@ export function safe(parameters: SafeParameters = {}) {
39
43
  return createConnector<Provider, Properties, StorageItem>((config) => ({
40
44
  id: 'safe',
41
45
  name: 'Safe',
46
+ type: safe.type,
42
47
  async connect() {
43
- // Only allowed in iframe context
44
- const isIframe =
45
- typeof window !== 'undefined' && window?.parent !== window
46
- if (!isIframe) throw new ProviderNotFoundError()
47
-
48
48
  const provider = await this.getProvider()
49
49
  if (!provider) throw new ProviderNotFoundError()
50
50
 
@@ -53,19 +53,20 @@ export function safe(parameters: SafeParameters = {}) {
53
53
 
54
54
  provider.on('disconnect', this.onDisconnect.bind(this))
55
55
 
56
- // Add shim to storage signalling wallet is connected
57
- if (parameters.shimDisconnect)
58
- await config.storage?.setItem(shimDisconnectStorageKey, true)
56
+ // Remove disconnected shim if it exists
57
+ if (shimDisconnect) await config.storage?.removeItem('safe.disconnected')
59
58
 
60
59
  return { accounts, chainId }
61
60
  },
62
61
  async disconnect() {
63
62
  const provider = await this.getProvider()
63
+ if (!provider) throw new ProviderNotFoundError()
64
+
64
65
  provider.removeListener('disconnect', this.onDisconnect.bind(this))
65
66
 
66
- // Remove shim signalling wallet is disconnected
67
- if (parameters.shimDisconnect)
68
- await config.storage?.removeItem(shimDisconnectStorageKey)
67
+ // Add shim signalling connector is disconnected
68
+ if (shimDisconnect)
69
+ await config.storage?.setItem('safe.disconnected', true)
69
70
  },
70
71
  async getAccounts() {
71
72
  const provider = await this.getProvider()
@@ -75,6 +76,11 @@ export function safe(parameters: SafeParameters = {}) {
75
76
  )
76
77
  },
77
78
  async getProvider() {
79
+ // Only allowed in iframe context
80
+ const isIframe =
81
+ typeof window !== 'undefined' && window?.parent !== window
82
+ if (!isIframe) return
83
+
78
84
  if (!provider_) {
79
85
  const safe = await sdk.safe.getInfo()
80
86
  if (!safe) throw new Error('Could not load Safe information')
@@ -90,9 +96,9 @@ export function safe(parameters: SafeParameters = {}) {
90
96
  async isAuthorized() {
91
97
  try {
92
98
  const isDisconnected =
93
- parameters.shimDisconnect &&
94
- // If shim does not exist in storage, wallet is disconnected
95
- !(await config.storage?.getItem(shimDisconnectStorageKey))
99
+ shimDisconnect &&
100
+ // If shim exists in storage, connector is disconnected
101
+ (await config.storage?.getItem('safe.disconnected'))
96
102
  if (isDisconnected) return false
97
103
 
98
104
  const accounts = await this.getAccounts()
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '4.0.0'
1
+ export const version = '4.0.1'
@@ -5,11 +5,7 @@ import {
5
5
  normalizeChainId,
6
6
  } from '@wagmi/core'
7
7
  import type { Evaluate, ExactPartial, Omit } from '@wagmi/core/internal'
8
- import {
9
- EthereumProvider,
10
- OPTIONAL_EVENTS,
11
- OPTIONAL_METHODS,
12
- } from '@walletconnect/ethereum-provider'
8
+ import { EthereumProvider } from '@walletconnect/ethereum-provider'
13
9
  import {
14
10
  type Address,
15
11
  type ProviderConnectInfo,
@@ -71,6 +67,7 @@ export type WalletConnectParameters = Evaluate<
71
67
  ExactPartial<Pick<EthereumProviderOptions, 'showQrModal'>>
72
68
  >
73
69
 
70
+ walletConnect.type = 'walletConnect' as const
74
71
  export function walletConnect(parameters: WalletConnectParameters) {
75
72
  const isNewChainsStale = parameters.isNewChainsStale ?? true
76
73
 
@@ -104,8 +101,9 @@ export function walletConnect(parameters: WalletConnectParameters) {
104
101
  return createConnector<Provider, Properties, StorageItem>((config) => ({
105
102
  id: 'walletConnect',
106
103
  name: 'WalletConnect',
104
+ type: walletConnect.type,
107
105
  async setup() {
108
- const provider = await this.getProvider()
106
+ const provider = await this.getProvider().catch(() => null)
109
107
  if (!provider) return
110
108
  provider.on('connect', this.onConnect.bind(this))
111
109
  provider.on('session_delete', this.onSessionDelete.bind(this))
@@ -137,8 +135,7 @@ export function walletConnect(parameters: WalletConnectParameters) {
137
135
  .filter((chain) => chain.id !== targetChainId)
138
136
  .map((optionalChain) => optionalChain.id)
139
137
  await provider.connect({
140
- chains: [targetChainId],
141
- optionalChains,
138
+ optionalChains: [targetChainId, ...optionalChains],
142
139
  ...('pairingTopic' in rest
143
140
  ? { pairingTopic: rest.pairingTopic }
144
141
  : {}),
@@ -173,21 +170,21 @@ export function walletConnect(parameters: WalletConnectParameters) {
173
170
  async disconnect() {
174
171
  const provider = await this.getProvider()
175
172
  try {
176
- await provider.disconnect()
173
+ await provider?.disconnect()
177
174
  } catch (error) {
178
175
  if (!/No matching key/i.test((error as Error).message)) throw error
179
176
  } finally {
180
- provider.removeListener(
177
+ provider?.removeListener(
181
178
  'accountsChanged',
182
179
  this.onAccountsChanged.bind(this),
183
180
  )
184
- provider.removeListener('chainChanged', this.onChainChanged)
185
- provider.removeListener('disconnect', this.onDisconnect.bind(this))
186
- provider.removeListener(
181
+ provider?.removeListener('chainChanged', this.onChainChanged)
182
+ provider?.removeListener('disconnect', this.onDisconnect.bind(this))
183
+ provider?.removeListener(
187
184
  'session_delete',
188
185
  this.onSessionDelete.bind(this),
189
186
  )
190
- provider.on('connect', this.onConnect.bind(this))
187
+ provider?.on('connect', this.onConnect.bind(this))
191
188
 
192
189
  this.setRequestedChainsIds([])
193
190
  }
@@ -198,14 +195,11 @@ export function walletConnect(parameters: WalletConnectParameters) {
198
195
  },
199
196
  async getProvider({ chainId } = {}) {
200
197
  async function initProvider() {
201
- const [defaultChain, ...optionalChains] = config.chains.map((x) => x.id)
202
- if (!defaultChain) return
198
+ const optionalChains = config.chains.map((x) => x.id) as [number]
199
+ if (!optionalChains.length) return
203
200
  return await EthereumProvider.init({
204
201
  ...parameters,
205
- chains: [defaultChain],
206
202
  disableProviderPing: true,
207
- optionalMethods: OPTIONAL_METHODS,
208
- optionalEvents: OPTIONAL_EVENTS,
209
203
  optionalChains,
210
204
  projectId: parameters.projectId,
211
205
  rpcMap: Object.fromEntries(
@@ -269,7 +263,7 @@ export function walletConnect(parameters: WalletConnectParameters) {
269
263
  params: [
270
264
  {
271
265
  chainId: numberToHex(chain.id),
272
- blockExplorerUrls: [chain.blockExplorers?.default],
266
+ blockExplorerUrls: [chain.blockExplorers?.default.url],
273
267
  chainName: chain.name,
274
268
  nativeCurrency: chain.nativeCurrency,
275
269
  rpcUrls: [...chain.rpcUrls.default.http],
@@ -286,6 +280,7 @@ export function walletConnect(parameters: WalletConnectParameters) {
286
280
  })
287
281
  return chain
288
282
  } catch (error) {
283
+ console.log({ error })
289
284
  const message =
290
285
  typeof error === 'string'
291
286
  ? error
package/dist/esm/index.js DELETED
@@ -1,7 +0,0 @@
1
- export { coinbaseWallet, } from './coinbaseWallet.js';
2
- export { injected } from './injected.js';
3
- export { ledger } from './ledger.js';
4
- export { safe } from './safe.js';
5
- export { walletConnect, } from './walletConnect.js';
6
- export { version } from './version.js';
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,GACf,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAA2B,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEjE,OAAO,EAAyB,MAAM,EAAE,MAAM,aAAa,CAAA;AAE3D,OAAO,EAAuB,IAAI,EAAE,MAAM,WAAW,CAAA;AAErD,OAAO,EAEL,aAAa,GACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test-d.js","sourceRoot":"","sources":["../../src/index.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,uFAAuF;AACvF,YAAY,CAAC,CAAC,CAAC,CAAC,aAAa,EAAU,CAAA"}