@wagmi/core 0.4.0 → 0.4.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.
- package/chains/dist/wagmi-core-chains.cjs.dev.js +2 -2
- package/chains/dist/wagmi-core-chains.cjs.prod.js +2 -2
- package/chains/dist/wagmi-core-chains.esm.js +2 -2
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +6 -4
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +6 -4
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +6 -4
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +4 -4
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +4 -4
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +4 -4
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +3 -3
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +3 -3
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +3 -3
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +4 -4
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +4 -4
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +4 -4
- package/dist/{base-6f16410c.cjs.dev.js → base-2d484f6c.cjs.prod.js} +2 -1
- package/dist/{base-33eceda3.esm.js → base-e66f9622.esm.js} +2 -1
- package/dist/{base-457b5f55.cjs.prod.js → base-e71ae4b2.cjs.dev.js} +2 -1
- package/dist/{chains-1390c48d.cjs.prod.js → chains-865492ea.cjs.prod.js} +23 -12
- package/dist/{chains-e98fda1e.esm.js → chains-c389721d.esm.js} +23 -12
- package/dist/{chains-2ca34f98.cjs.dev.js → chains-d970ee8d.cjs.dev.js} +23 -12
- package/dist/{client-b3902dbf.cjs.dev.js → client-1feb9121.cjs.prod.js} +9 -3
- package/dist/{client-7864fb0c.cjs.prod.js → client-53f2119c.cjs.dev.js} +9 -3
- package/dist/{client-71653c40.esm.js → client-ffba0e25.esm.js} +9 -3
- package/dist/declarations/src/actions/accounts/signTypedData.d.ts +7 -3
- package/dist/declarations/src/constants/index.d.ts +1 -1
- package/dist/declarations/src/constants/rpcs.d.ts +3 -1
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/utils/normalizeChainId.d.ts +1 -1
- package/dist/{rpcs-9c4eb960.cjs.dev.js → rpcs-1fd0a12f.cjs.prod.js} +14 -0
- package/dist/{rpcs-7cfbd91c.esm.js → rpcs-b73a8f60.esm.js} +14 -1
- package/dist/{rpcs-b3c52116.cjs.prod.js → rpcs-f1d24f0e.cjs.dev.js} +14 -0
- package/dist/wagmi-core.cjs.dev.js +41 -8
- package/dist/wagmi-core.cjs.prod.js +41 -8
- package/dist/wagmi-core.esm.js +42 -10
- package/package.json +1 -1
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.dev.js +1 -1
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.prod.js +1 -1
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +1 -1
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.dev.js +1 -1
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.prod.js +1 -1
- package/providers/infura/dist/wagmi-core-providers-infura.esm.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var rpcs = require('./rpcs-
|
|
3
|
+
var rpcs = require('./rpcs-f1d24f0e.cjs.dev.js');
|
|
4
4
|
|
|
5
5
|
const etherscanBlockExplorers = {
|
|
6
6
|
mainnet: {
|
|
@@ -76,8 +76,9 @@ const mainnet = {
|
|
|
76
76
|
},
|
|
77
77
|
rpcUrls: {
|
|
78
78
|
alchemy: rpcs.alchemyRpcUrls.mainnet,
|
|
79
|
+
default: rpcs.publicRpcUrls.mainnet,
|
|
79
80
|
infura: rpcs.infuraRpcUrls.mainnet,
|
|
80
|
-
|
|
81
|
+
public: rpcs.publicRpcUrls.mainnet
|
|
81
82
|
},
|
|
82
83
|
blockExplorers: {
|
|
83
84
|
etherscan: etherscanBlockExplorers.mainnet,
|
|
@@ -102,8 +103,9 @@ const ropsten = {
|
|
|
102
103
|
},
|
|
103
104
|
rpcUrls: {
|
|
104
105
|
alchemy: rpcs.alchemyRpcUrls.ropsten,
|
|
106
|
+
default: rpcs.publicRpcUrls.ropsten,
|
|
105
107
|
infura: rpcs.infuraRpcUrls.ropsten,
|
|
106
|
-
|
|
108
|
+
public: rpcs.publicRpcUrls.ropsten
|
|
107
109
|
},
|
|
108
110
|
blockExplorers: {
|
|
109
111
|
etherscan: etherscanBlockExplorers.ropsten,
|
|
@@ -129,8 +131,9 @@ const rinkeby = {
|
|
|
129
131
|
},
|
|
130
132
|
rpcUrls: {
|
|
131
133
|
alchemy: rpcs.alchemyRpcUrls.rinkeby,
|
|
134
|
+
default: rpcs.publicRpcUrls.rinkeby,
|
|
132
135
|
infura: rpcs.infuraRpcUrls.rinkeby,
|
|
133
|
-
|
|
136
|
+
public: rpcs.publicRpcUrls.rinkeby
|
|
134
137
|
},
|
|
135
138
|
blockExplorers: {
|
|
136
139
|
etherscan: etherscanBlockExplorers.rinkeby,
|
|
@@ -156,8 +159,9 @@ const goerli = {
|
|
|
156
159
|
},
|
|
157
160
|
rpcUrls: {
|
|
158
161
|
alchemy: rpcs.alchemyRpcUrls.goerli,
|
|
162
|
+
default: rpcs.publicRpcUrls.goerli,
|
|
159
163
|
infura: rpcs.infuraRpcUrls.goerli,
|
|
160
|
-
|
|
164
|
+
public: rpcs.publicRpcUrls.goerli
|
|
161
165
|
},
|
|
162
166
|
blockExplorers: {
|
|
163
167
|
etherscan: etherscanBlockExplorers.goerli,
|
|
@@ -183,8 +187,9 @@ const kovan = {
|
|
|
183
187
|
},
|
|
184
188
|
rpcUrls: {
|
|
185
189
|
alchemy: rpcs.alchemyRpcUrls.kovan,
|
|
190
|
+
default: rpcs.publicRpcUrls.kovan,
|
|
186
191
|
infura: rpcs.infuraRpcUrls.kovan,
|
|
187
|
-
|
|
192
|
+
public: rpcs.publicRpcUrls.kovan
|
|
188
193
|
},
|
|
189
194
|
blockExplorers: {
|
|
190
195
|
etherscan: etherscanBlockExplorers.kovan,
|
|
@@ -207,8 +212,9 @@ const optimism = {
|
|
|
207
212
|
},
|
|
208
213
|
rpcUrls: {
|
|
209
214
|
alchemy: rpcs.alchemyRpcUrls.optimism,
|
|
215
|
+
default: rpcs.publicRpcUrls.optimism,
|
|
210
216
|
infura: rpcs.infuraRpcUrls.optimism,
|
|
211
|
-
|
|
217
|
+
public: rpcs.publicRpcUrls.optimism
|
|
212
218
|
},
|
|
213
219
|
blockExplorers: {
|
|
214
220
|
etherscan: etherscanBlockExplorers.optimism,
|
|
@@ -230,8 +236,9 @@ const optimismKovan = {
|
|
|
230
236
|
},
|
|
231
237
|
rpcUrls: {
|
|
232
238
|
alchemy: rpcs.alchemyRpcUrls.optimismKovan,
|
|
239
|
+
default: rpcs.publicRpcUrls.optimismKovan,
|
|
233
240
|
infura: rpcs.infuraRpcUrls.optimismKovan,
|
|
234
|
-
|
|
241
|
+
public: rpcs.publicRpcUrls.optimismKovan
|
|
235
242
|
},
|
|
236
243
|
blockExplorers: {
|
|
237
244
|
etherscan: etherscanBlockExplorers.optimismKovan,
|
|
@@ -254,8 +261,9 @@ const polygon = {
|
|
|
254
261
|
},
|
|
255
262
|
rpcUrls: {
|
|
256
263
|
alchemy: rpcs.alchemyRpcUrls.polygon,
|
|
264
|
+
default: rpcs.publicRpcUrls.polygon,
|
|
257
265
|
infura: rpcs.infuraRpcUrls.polygon,
|
|
258
|
-
|
|
266
|
+
public: rpcs.publicRpcUrls.polygon
|
|
259
267
|
},
|
|
260
268
|
blockExplorers: {
|
|
261
269
|
etherscan: etherscanBlockExplorers.polygon,
|
|
@@ -277,8 +285,9 @@ const polygonMumbai = {
|
|
|
277
285
|
},
|
|
278
286
|
rpcUrls: {
|
|
279
287
|
alchemy: rpcs.alchemyRpcUrls.polygonMumbai,
|
|
288
|
+
default: rpcs.publicRpcUrls.polygonMumbai,
|
|
280
289
|
infura: rpcs.infuraRpcUrls.polygonMumbai,
|
|
281
|
-
|
|
290
|
+
public: rpcs.publicRpcUrls.polygonMumbai
|
|
282
291
|
},
|
|
283
292
|
blockExplorers: {
|
|
284
293
|
etherscan: etherscanBlockExplorers.polygonMumbai,
|
|
@@ -301,8 +310,9 @@ const arbitrum = {
|
|
|
301
310
|
},
|
|
302
311
|
rpcUrls: {
|
|
303
312
|
alchemy: rpcs.alchemyRpcUrls.arbitrum,
|
|
313
|
+
default: rpcs.publicRpcUrls.arbitrum,
|
|
304
314
|
infura: rpcs.infuraRpcUrls.arbitrum,
|
|
305
|
-
|
|
315
|
+
public: rpcs.publicRpcUrls.arbitrum
|
|
306
316
|
},
|
|
307
317
|
blockExplorers: {
|
|
308
318
|
arbitrum: {
|
|
@@ -328,8 +338,9 @@ const arbitrumRinkeby = {
|
|
|
328
338
|
},
|
|
329
339
|
rpcUrls: {
|
|
330
340
|
alchemy: rpcs.alchemyRpcUrls.arbitrumRinkeby,
|
|
341
|
+
default: rpcs.publicRpcUrls.arbitrumRinkeby,
|
|
331
342
|
infura: rpcs.infuraRpcUrls.arbitrumRinkeby,
|
|
332
|
-
|
|
343
|
+
public: rpcs.publicRpcUrls.arbitrumRinkeby
|
|
333
344
|
},
|
|
334
345
|
blockExplorers: {
|
|
335
346
|
arbitrum: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-2d484f6c.cjs.prod.js');
|
|
4
4
|
var create = require('zustand/vanilla');
|
|
5
5
|
var middleware = require('zustand/middleware');
|
|
6
6
|
var ethers = require('ethers');
|
|
@@ -269,18 +269,24 @@ class InjectedConnector extends base.Connector {
|
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
} catch (error) {
|
|
272
|
+
var _data, _data$originalError;
|
|
273
|
+
|
|
272
274
|
const chain = this.chains.find(x => x.id === chainId);
|
|
273
275
|
if (!chain) throw new base.ChainNotConfiguredError(); // Indicates chain is not added to provider
|
|
274
276
|
|
|
275
|
-
if (error.code === 4902
|
|
277
|
+
if (error.code === 4902 || // Unwrapping for MetaMask Mobile
|
|
278
|
+
// https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719
|
|
279
|
+
(error === null || error === void 0 ? void 0 : (_data = error.data) === null || _data === void 0 ? void 0 : (_data$originalError = _data.originalError) === null || _data$originalError === void 0 ? void 0 : _data$originalError.code) === 4902) {
|
|
276
280
|
try {
|
|
281
|
+
var _chain$rpcUrls$public;
|
|
282
|
+
|
|
277
283
|
await provider.request({
|
|
278
284
|
method: 'wallet_addEthereumChain',
|
|
279
285
|
params: [{
|
|
280
286
|
chainId: id,
|
|
281
287
|
chainName: chain.name,
|
|
282
288
|
nativeCurrency: chain.nativeCurrency,
|
|
283
|
-
rpcUrls: [chain.rpcUrls.default],
|
|
289
|
+
rpcUrls: [(_chain$rpcUrls$public = chain.rpcUrls.public) !== null && _chain$rpcUrls$public !== void 0 ? _chain$rpcUrls$public : chain.rpcUrls.default],
|
|
284
290
|
blockExplorerUrls: this.getBlockExplorerUrls(chain)
|
|
285
291
|
}]
|
|
286
292
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-e71ae4b2.cjs.dev.js');
|
|
4
4
|
var create = require('zustand/vanilla');
|
|
5
5
|
var middleware = require('zustand/middleware');
|
|
6
6
|
var ethers = require('ethers');
|
|
@@ -269,18 +269,24 @@ class InjectedConnector extends base.Connector {
|
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
} catch (error) {
|
|
272
|
+
var _data, _data$originalError;
|
|
273
|
+
|
|
272
274
|
const chain = this.chains.find(x => x.id === chainId);
|
|
273
275
|
if (!chain) throw new base.ChainNotConfiguredError(); // Indicates chain is not added to provider
|
|
274
276
|
|
|
275
|
-
if (error.code === 4902
|
|
277
|
+
if (error.code === 4902 || // Unwrapping for MetaMask Mobile
|
|
278
|
+
// https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719
|
|
279
|
+
(error === null || error === void 0 ? void 0 : (_data = error.data) === null || _data === void 0 ? void 0 : (_data$originalError = _data.originalError) === null || _data$originalError === void 0 ? void 0 : _data$originalError.code) === 4902) {
|
|
276
280
|
try {
|
|
281
|
+
var _chain$rpcUrls$public;
|
|
282
|
+
|
|
277
283
|
await provider.request({
|
|
278
284
|
method: 'wallet_addEthereumChain',
|
|
279
285
|
params: [{
|
|
280
286
|
chainId: id,
|
|
281
287
|
chainName: chain.name,
|
|
282
288
|
nativeCurrency: chain.nativeCurrency,
|
|
283
|
-
rpcUrls: [chain.rpcUrls.default],
|
|
289
|
+
rpcUrls: [(_chain$rpcUrls$public = chain.rpcUrls.public) !== null && _chain$rpcUrls$public !== void 0 ? _chain$rpcUrls$public : chain.rpcUrls.default],
|
|
284
290
|
blockExplorerUrls: this.getBlockExplorerUrls(chain)
|
|
285
291
|
}]
|
|
286
292
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as Connector, _ as _classPrivateMethodInitSpec, i as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, k as _classPrivateFieldGet, l as _classPrivateFieldSet, b as ConnectorNotFoundError, m as _classPrivateMethodGet, U as UserRejectedRequestError, R as ResourceUnavailableError, e as ChainNotConfiguredError, A as AddChainError, h as SwitchChainError } from './base-
|
|
1
|
+
import { d as Connector, _ as _classPrivateMethodInitSpec, i as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, k as _classPrivateFieldGet, l as _classPrivateFieldSet, b as ConnectorNotFoundError, m as _classPrivateMethodGet, U as UserRejectedRequestError, R as ResourceUnavailableError, e as ChainNotConfiguredError, A as AddChainError, h as SwitchChainError } from './base-e66f9622.esm.js';
|
|
2
2
|
import create from 'zustand/vanilla';
|
|
3
3
|
import { subscribeWithSelector, persist } from 'zustand/middleware';
|
|
4
4
|
import { providers } from 'ethers';
|
|
@@ -263,18 +263,24 @@ class InjectedConnector extends Connector {
|
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
} catch (error) {
|
|
266
|
+
var _data, _data$originalError;
|
|
267
|
+
|
|
266
268
|
const chain = this.chains.find(x => x.id === chainId);
|
|
267
269
|
if (!chain) throw new ChainNotConfiguredError(); // Indicates chain is not added to provider
|
|
268
270
|
|
|
269
|
-
if (error.code === 4902
|
|
271
|
+
if (error.code === 4902 || // Unwrapping for MetaMask Mobile
|
|
272
|
+
// https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719
|
|
273
|
+
(error === null || error === void 0 ? void 0 : (_data = error.data) === null || _data === void 0 ? void 0 : (_data$originalError = _data.originalError) === null || _data$originalError === void 0 ? void 0 : _data$originalError.code) === 4902) {
|
|
270
274
|
try {
|
|
275
|
+
var _chain$rpcUrls$public;
|
|
276
|
+
|
|
271
277
|
await provider.request({
|
|
272
278
|
method: 'wallet_addEthereumChain',
|
|
273
279
|
params: [{
|
|
274
280
|
chainId: id,
|
|
275
281
|
chainName: chain.name,
|
|
276
282
|
nativeCurrency: chain.nativeCurrency,
|
|
277
|
-
rpcUrls: [chain.rpcUrls.default],
|
|
283
|
+
rpcUrls: [(_chain$rpcUrls$public = chain.rpcUrls.public) !== null && _chain$rpcUrls$public !== void 0 ? _chain$rpcUrls$public : chain.rpcUrls.default],
|
|
278
284
|
blockExplorerUrls: this.getBlockExplorerUrls(chain)
|
|
279
285
|
}]
|
|
280
286
|
});
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BytesLike } from 'ethers';
|
|
2
2
|
export declare type SignTypedDataArgs = {
|
|
3
3
|
/** Domain or domain signature for origin or contract */
|
|
4
4
|
domain: {
|
|
5
5
|
name?: string;
|
|
6
6
|
version?: string;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Chain permitted for signing
|
|
9
|
+
* If signer is not active on this chain, it will attempt to programmatically switch
|
|
10
|
+
*/
|
|
11
|
+
chainId?: string | number | bigint;
|
|
8
12
|
verifyingContract?: string;
|
|
9
13
|
salt?: BytesLike;
|
|
10
14
|
};
|
|
@@ -17,4 +21,4 @@ export declare type SignTypedDataArgs = {
|
|
|
17
21
|
value: Record<string, any>;
|
|
18
22
|
};
|
|
19
23
|
export declare type SignTypedDataResult = string;
|
|
20
|
-
export declare function signTypedData(
|
|
24
|
+
export declare function signTypedData({ domain, types, value, }: SignTypedDataArgs): Promise<SignTypedDataResult>;
|
|
@@ -3,6 +3,6 @@ export { etherscanBlockExplorers } from './blockExplorers';
|
|
|
3
3
|
export type { BlockExplorer, BlockExplorerName } from './blockExplorers';
|
|
4
4
|
export { chain, chainId, allChains, defaultChains, defaultL2Chains, } from './chains';
|
|
5
5
|
export { multicallInterface } from './multicall';
|
|
6
|
-
export { alchemyRpcUrls, defaultAlchemyId, infuraRpcUrls,
|
|
6
|
+
export { alchemyRpcUrls, defaultAlchemyId, defaultInfuraId, infuraRpcUrls, publicRpcUrls, } from './rpcs';
|
|
7
7
|
export type { RpcProviderName } from './rpcs';
|
|
8
8
|
export { units } from './units';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ChainName } from './chains';
|
|
2
2
|
export declare const defaultAlchemyId = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
|
|
3
3
|
export declare const defaultInfuraId = "84842078b09946638c03157f83405213";
|
|
4
|
-
export declare type RpcProviderName = 'alchemy' | 'infura';
|
|
4
|
+
export declare type RpcProviderName = 'alchemy' | 'infura' | 'public';
|
|
5
5
|
declare type AlchemyChains = Extract<ChainName, 'mainnet' | 'ropsten' | 'rinkeby' | 'goerli' | 'kovan' | 'optimism' | 'optimismKovan' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumRinkeby'>;
|
|
6
6
|
export declare const alchemyRpcUrls: Record<AlchemyChains, string>;
|
|
7
7
|
declare type InfuraChains = Extract<ChainName, 'mainnet' | 'ropsten' | 'rinkeby' | 'goerli' | 'kovan' | 'optimism' | 'optimismKovan' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumRinkeby'>;
|
|
8
8
|
export declare const infuraRpcUrls: Record<InfuraChains, string>;
|
|
9
|
+
declare type PublicChains = Extract<ChainName, 'mainnet' | 'ropsten' | 'rinkeby' | 'goerli' | 'kovan' | 'optimism' | 'optimismKovan' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumRinkeby'>;
|
|
10
|
+
export declare const publicRpcUrls: Record<PublicChains, string>;
|
|
9
11
|
export {};
|
|
@@ -4,7 +4,7 @@ export { createClient, Client } from './client';
|
|
|
4
4
|
export type { ClientConfig } from './client';
|
|
5
5
|
export { Connector, InjectedConnector } from './connectors';
|
|
6
6
|
export type { ConnectorData, ConnectorEvents } from './connectors';
|
|
7
|
-
export { alchemyRpcUrls, allChains, chain, chainId, defaultChains, defaultL2Chains, erc20ABI, erc721ABI, etherscanBlockExplorers, infuraRpcUrls, units, } from './constants';
|
|
7
|
+
export { alchemyRpcUrls, allChains, chain, chainId, defaultChains, defaultL2Chains, erc20ABI, erc721ABI, etherscanBlockExplorers, infuraRpcUrls, publicRpcUrls, units, } from './constants';
|
|
8
8
|
export { AddChainError, ChainDoesNotSupportMulticallError, ChainMismatchError, ChainNotConfiguredError, ConnectorAlreadyConnectedError, ConnectorNotFoundError, ProviderChainsNotFound, ProviderRpcError, ResourceUnavailableError, RpcError, SwitchChainError, SwitchChainNotSupportedError, UserRejectedRequestError, } from './errors';
|
|
9
9
|
export { createStorage, noopStorage } from './storage';
|
|
10
10
|
export type { ClientStorage as Storage } from './storage';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function normalizeChainId(chainId: string | number): number;
|
|
1
|
+
export declare function normalizeChainId(chainId: string | number | bigint): number;
|
|
@@ -28,8 +28,22 @@ const infuraRpcUrls = {
|
|
|
28
28
|
arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
|
|
29
29
|
arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
|
|
30
30
|
};
|
|
31
|
+
const publicRpcUrls = {
|
|
32
|
+
mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId),
|
|
33
|
+
ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId),
|
|
34
|
+
rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId),
|
|
35
|
+
goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId),
|
|
36
|
+
kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId),
|
|
37
|
+
optimism: 'https://mainnet.optimism.io',
|
|
38
|
+
optimismKovan: 'https://kovan.optimism.io',
|
|
39
|
+
polygon: 'https://polygon-rpc.com',
|
|
40
|
+
polygonMumbai: 'https://matic-mumbai.chainstacklabs.com',
|
|
41
|
+
arbitrum: 'https://arb1.arbitrum.io/rpc',
|
|
42
|
+
arbitrumRinkeby: 'https://rinkeby.arbitrum.io/rpc'
|
|
43
|
+
};
|
|
31
44
|
|
|
32
45
|
exports.alchemyRpcUrls = alchemyRpcUrls;
|
|
33
46
|
exports.defaultAlchemyId = defaultAlchemyId;
|
|
34
47
|
exports.defaultInfuraId = defaultInfuraId;
|
|
35
48
|
exports.infuraRpcUrls = infuraRpcUrls;
|
|
49
|
+
exports.publicRpcUrls = publicRpcUrls;
|
|
@@ -26,5 +26,18 @@ const infuraRpcUrls = {
|
|
|
26
26
|
arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
|
|
27
27
|
arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
|
|
28
28
|
};
|
|
29
|
+
const publicRpcUrls = {
|
|
30
|
+
mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId),
|
|
31
|
+
ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId),
|
|
32
|
+
rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId),
|
|
33
|
+
goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId),
|
|
34
|
+
kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId),
|
|
35
|
+
optimism: 'https://mainnet.optimism.io',
|
|
36
|
+
optimismKovan: 'https://kovan.optimism.io',
|
|
37
|
+
polygon: 'https://polygon-rpc.com',
|
|
38
|
+
polygonMumbai: 'https://matic-mumbai.chainstacklabs.com',
|
|
39
|
+
arbitrum: 'https://arb1.arbitrum.io/rpc',
|
|
40
|
+
arbitrumRinkeby: 'https://rinkeby.arbitrum.io/rpc'
|
|
41
|
+
};
|
|
29
42
|
|
|
30
|
-
export { alchemyRpcUrls as a, defaultInfuraId as b, defaultAlchemyId as d, infuraRpcUrls as i };
|
|
43
|
+
export { alchemyRpcUrls as a, defaultInfuraId as b, defaultAlchemyId as d, infuraRpcUrls as i, publicRpcUrls as p };
|
|
@@ -28,8 +28,22 @@ const infuraRpcUrls = {
|
|
|
28
28
|
arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
|
|
29
29
|
arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
|
|
30
30
|
};
|
|
31
|
+
const publicRpcUrls = {
|
|
32
|
+
mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId),
|
|
33
|
+
ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId),
|
|
34
|
+
rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId),
|
|
35
|
+
goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId),
|
|
36
|
+
kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId),
|
|
37
|
+
optimism: 'https://mainnet.optimism.io',
|
|
38
|
+
optimismKovan: 'https://kovan.optimism.io',
|
|
39
|
+
polygon: 'https://polygon-rpc.com',
|
|
40
|
+
polygonMumbai: 'https://matic-mumbai.chainstacklabs.com',
|
|
41
|
+
arbitrum: 'https://arb1.arbitrum.io/rpc',
|
|
42
|
+
arbitrumRinkeby: 'https://rinkeby.arbitrum.io/rpc'
|
|
43
|
+
};
|
|
31
44
|
|
|
32
45
|
exports.alchemyRpcUrls = alchemyRpcUrls;
|
|
33
46
|
exports.defaultAlchemyId = defaultAlchemyId;
|
|
34
47
|
exports.defaultInfuraId = defaultInfuraId;
|
|
35
48
|
exports.infuraRpcUrls = infuraRpcUrls;
|
|
49
|
+
exports.publicRpcUrls = publicRpcUrls;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var client = require('./client-
|
|
6
|
-
var base = require('./base-
|
|
5
|
+
var client = require('./client-53f2119c.cjs.dev.js');
|
|
6
|
+
var base = require('./base-e71ae4b2.cjs.dev.js');
|
|
7
7
|
var ethers$1 = require('ethers/lib/ethers');
|
|
8
8
|
var utils = require('ethers/lib/utils');
|
|
9
9
|
var ethers = require('ethers');
|
|
10
10
|
var shallow = require('zustand/shallow');
|
|
11
|
-
var rpcs = require('./rpcs-
|
|
12
|
-
var chains = require('./chains-
|
|
11
|
+
var rpcs = require('./rpcs-f1d24f0e.cjs.dev.js');
|
|
12
|
+
var chains = require('./chains-d970ee8d.cjs.dev.js');
|
|
13
13
|
require('zustand/vanilla');
|
|
14
14
|
require('zustand/middleware');
|
|
15
15
|
require('eventemitter3');
|
|
@@ -790,12 +790,44 @@ async function signMessage(args) {
|
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
|
|
793
|
-
async function signTypedData(
|
|
793
|
+
async function signTypedData(_ref) {
|
|
794
|
+
let {
|
|
795
|
+
domain,
|
|
796
|
+
types,
|
|
797
|
+
value
|
|
798
|
+
} = _ref;
|
|
799
|
+
const {
|
|
800
|
+
connector
|
|
801
|
+
} = client.getClient();
|
|
802
|
+
if (!connector) throw new base.ConnectorNotFoundError();
|
|
803
|
+
|
|
794
804
|
try {
|
|
795
|
-
|
|
796
|
-
|
|
805
|
+
var _chain;
|
|
806
|
+
|
|
807
|
+
const {
|
|
808
|
+
chainId
|
|
809
|
+
} = domain;
|
|
810
|
+
let chain;
|
|
811
|
+
|
|
812
|
+
if (chainId) {
|
|
813
|
+
const chainId_ = base.normalizeChainId(chainId);
|
|
814
|
+
const activeChainId = await connector.getChainId(); // Try to switch chain to provided `chainId`
|
|
815
|
+
|
|
816
|
+
if (chainId !== activeChainId) {
|
|
817
|
+
var _connector$chains$fin, _connector$chains$fin2, _connector$chains$fin3, _connector$chains$fin4;
|
|
818
|
+
|
|
819
|
+
if (connector.switchChain) chain = await connector.switchChain(chainId_);else throw new base.ChainMismatchError({
|
|
820
|
+
activeChain: (_connector$chains$fin = (_connector$chains$fin2 = connector.chains.find(x => x.id === activeChainId)) === null || _connector$chains$fin2 === void 0 ? void 0 : _connector$chains$fin2.name) !== null && _connector$chains$fin !== void 0 ? _connector$chains$fin : "Chain ".concat(activeChainId),
|
|
821
|
+
targetChain: (_connector$chains$fin3 = (_connector$chains$fin4 = connector.chains.find(x => x.id === chainId_)) === null || _connector$chains$fin4 === void 0 ? void 0 : _connector$chains$fin4.name) !== null && _connector$chains$fin3 !== void 0 ? _connector$chains$fin3 : "Chain ".concat(chainId_)
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
const signer = await connector.getSigner({
|
|
827
|
+
chainId: (_chain = chain) === null || _chain === void 0 ? void 0 : _chain.id
|
|
828
|
+
}); // Method name may be changed in the future, see https://docs.ethers.io/v5/api/signer/#Signer-signTypedData
|
|
797
829
|
|
|
798
|
-
return await signer._signTypedData(
|
|
830
|
+
return await signer._signTypedData(domain, types, value);
|
|
799
831
|
} catch (error) {
|
|
800
832
|
if (error.code === 4001) throw new base.UserRejectedRequestError(error);
|
|
801
833
|
throw error;
|
|
@@ -1065,6 +1097,7 @@ exports.UserRejectedRequestError = base.UserRejectedRequestError;
|
|
|
1065
1097
|
exports.normalizeChainId = base.normalizeChainId;
|
|
1066
1098
|
exports.alchemyRpcUrls = rpcs.alchemyRpcUrls;
|
|
1067
1099
|
exports.infuraRpcUrls = rpcs.infuraRpcUrls;
|
|
1100
|
+
exports.publicRpcUrls = rpcs.publicRpcUrls;
|
|
1068
1101
|
exports.allChains = chains.allChains;
|
|
1069
1102
|
exports.chain = chains.chain;
|
|
1070
1103
|
exports.chainId = chains.chainId;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var client = require('./client-
|
|
6
|
-
var base = require('./base-
|
|
5
|
+
var client = require('./client-1feb9121.cjs.prod.js');
|
|
6
|
+
var base = require('./base-2d484f6c.cjs.prod.js');
|
|
7
7
|
var ethers$1 = require('ethers/lib/ethers');
|
|
8
8
|
var utils = require('ethers/lib/utils');
|
|
9
9
|
var ethers = require('ethers');
|
|
10
10
|
var shallow = require('zustand/shallow');
|
|
11
|
-
var rpcs = require('./rpcs-
|
|
12
|
-
var chains = require('./chains-
|
|
11
|
+
var rpcs = require('./rpcs-1fd0a12f.cjs.prod.js');
|
|
12
|
+
var chains = require('./chains-865492ea.cjs.prod.js');
|
|
13
13
|
require('zustand/vanilla');
|
|
14
14
|
require('zustand/middleware');
|
|
15
15
|
require('eventemitter3');
|
|
@@ -790,12 +790,44 @@ async function signMessage(args) {
|
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
|
|
793
|
-
async function signTypedData(
|
|
793
|
+
async function signTypedData(_ref) {
|
|
794
|
+
let {
|
|
795
|
+
domain,
|
|
796
|
+
types,
|
|
797
|
+
value
|
|
798
|
+
} = _ref;
|
|
799
|
+
const {
|
|
800
|
+
connector
|
|
801
|
+
} = client.getClient();
|
|
802
|
+
if (!connector) throw new base.ConnectorNotFoundError();
|
|
803
|
+
|
|
794
804
|
try {
|
|
795
|
-
|
|
796
|
-
|
|
805
|
+
var _chain;
|
|
806
|
+
|
|
807
|
+
const {
|
|
808
|
+
chainId
|
|
809
|
+
} = domain;
|
|
810
|
+
let chain;
|
|
811
|
+
|
|
812
|
+
if (chainId) {
|
|
813
|
+
const chainId_ = base.normalizeChainId(chainId);
|
|
814
|
+
const activeChainId = await connector.getChainId(); // Try to switch chain to provided `chainId`
|
|
815
|
+
|
|
816
|
+
if (chainId !== activeChainId) {
|
|
817
|
+
var _connector$chains$fin, _connector$chains$fin2, _connector$chains$fin3, _connector$chains$fin4;
|
|
818
|
+
|
|
819
|
+
if (connector.switchChain) chain = await connector.switchChain(chainId_);else throw new base.ChainMismatchError({
|
|
820
|
+
activeChain: (_connector$chains$fin = (_connector$chains$fin2 = connector.chains.find(x => x.id === activeChainId)) === null || _connector$chains$fin2 === void 0 ? void 0 : _connector$chains$fin2.name) !== null && _connector$chains$fin !== void 0 ? _connector$chains$fin : "Chain ".concat(activeChainId),
|
|
821
|
+
targetChain: (_connector$chains$fin3 = (_connector$chains$fin4 = connector.chains.find(x => x.id === chainId_)) === null || _connector$chains$fin4 === void 0 ? void 0 : _connector$chains$fin4.name) !== null && _connector$chains$fin3 !== void 0 ? _connector$chains$fin3 : "Chain ".concat(chainId_)
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
const signer = await connector.getSigner({
|
|
827
|
+
chainId: (_chain = chain) === null || _chain === void 0 ? void 0 : _chain.id
|
|
828
|
+
}); // Method name may be changed in the future, see https://docs.ethers.io/v5/api/signer/#Signer-signTypedData
|
|
797
829
|
|
|
798
|
-
return await signer._signTypedData(
|
|
830
|
+
return await signer._signTypedData(domain, types, value);
|
|
799
831
|
} catch (error) {
|
|
800
832
|
if (error.code === 4001) throw new base.UserRejectedRequestError(error);
|
|
801
833
|
throw error;
|
|
@@ -1065,6 +1097,7 @@ exports.UserRejectedRequestError = base.UserRejectedRequestError;
|
|
|
1065
1097
|
exports.normalizeChainId = base.normalizeChainId;
|
|
1066
1098
|
exports.alchemyRpcUrls = rpcs.alchemyRpcUrls;
|
|
1067
1099
|
exports.infuraRpcUrls = rpcs.infuraRpcUrls;
|
|
1100
|
+
exports.publicRpcUrls = rpcs.publicRpcUrls;
|
|
1068
1101
|
exports.allChains = chains.allChains;
|
|
1069
1102
|
exports.chain = chains.chain;
|
|
1070
1103
|
exports.chainId = chains.chainId;
|
package/dist/wagmi-core.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { c as client, g as getClient } from './client-
|
|
2
|
-
export { C as Client, I as InjectedConnector, a as createClient, b as createStorage, n as noopStorage } from './client-
|
|
3
|
-
import { C as ConnectorAlreadyConnectedError, P as ProviderChainsNotFound, a as ChainDoesNotSupportMulticallError, b as ConnectorNotFoundError, c as ChainMismatchError, U as UserRejectedRequestError, S as SwitchChainNotSupportedError } from './base-
|
|
4
|
-
export { A as AddChainError, a as ChainDoesNotSupportMulticallError, c as ChainMismatchError, e as ChainNotConfiguredError, d as Connector, C as ConnectorAlreadyConnectedError, b as ConnectorNotFoundError, P as ProviderChainsNotFound, f as ProviderRpcError, R as ResourceUnavailableError, g as RpcError, h as SwitchChainError, S as SwitchChainNotSupportedError, U as UserRejectedRequestError, n as normalizeChainId } from './base-
|
|
1
|
+
import { c as client, g as getClient } from './client-ffba0e25.esm.js';
|
|
2
|
+
export { C as Client, I as InjectedConnector, a as createClient, b as createStorage, n as noopStorage } from './client-ffba0e25.esm.js';
|
|
3
|
+
import { C as ConnectorAlreadyConnectedError, P as ProviderChainsNotFound, a as ChainDoesNotSupportMulticallError, b as ConnectorNotFoundError, c as ChainMismatchError, U as UserRejectedRequestError, n as normalizeChainId, S as SwitchChainNotSupportedError } from './base-e66f9622.esm.js';
|
|
4
|
+
export { A as AddChainError, a as ChainDoesNotSupportMulticallError, c as ChainMismatchError, e as ChainNotConfiguredError, d as Connector, C as ConnectorAlreadyConnectedError, b as ConnectorNotFoundError, P as ProviderChainsNotFound, f as ProviderRpcError, R as ResourceUnavailableError, g as RpcError, h as SwitchChainError, S as SwitchChainNotSupportedError, U as UserRejectedRequestError, n as normalizeChainId } from './base-e66f9622.esm.js';
|
|
5
5
|
import { logger, Contract as Contract$1 } from 'ethers/lib/ethers';
|
|
6
6
|
import { isAddress, Logger, formatUnits, getAddress } from 'ethers/lib/utils';
|
|
7
7
|
import { providers, Contract } from 'ethers';
|
|
8
8
|
import shallow from 'zustand/shallow';
|
|
9
|
-
export { a as alchemyRpcUrls, i as infuraRpcUrls } from './rpcs-
|
|
10
|
-
export { a as allChains, c as chain, b as chainId, d as defaultChains, e as defaultL2Chains, f as etherscanBlockExplorers } from './chains-
|
|
9
|
+
export { a as alchemyRpcUrls, i as infuraRpcUrls, p as publicRpcUrls } from './rpcs-b73a8f60.esm.js';
|
|
10
|
+
export { a as allChains, c as chain, b as chainId, d as defaultChains, e as defaultL2Chains, f as etherscanBlockExplorers } from './chains-c389721d.esm.js';
|
|
11
11
|
import 'zustand/vanilla';
|
|
12
12
|
import 'zustand/middleware';
|
|
13
13
|
import 'eventemitter3';
|
|
@@ -784,12 +784,44 @@ async function signMessage(args) {
|
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
|
|
787
|
-
async function signTypedData(
|
|
787
|
+
async function signTypedData(_ref) {
|
|
788
|
+
let {
|
|
789
|
+
domain,
|
|
790
|
+
types,
|
|
791
|
+
value
|
|
792
|
+
} = _ref;
|
|
793
|
+
const {
|
|
794
|
+
connector
|
|
795
|
+
} = getClient();
|
|
796
|
+
if (!connector) throw new ConnectorNotFoundError();
|
|
797
|
+
|
|
788
798
|
try {
|
|
789
|
-
|
|
790
|
-
|
|
799
|
+
var _chain;
|
|
800
|
+
|
|
801
|
+
const {
|
|
802
|
+
chainId
|
|
803
|
+
} = domain;
|
|
804
|
+
let chain;
|
|
805
|
+
|
|
806
|
+
if (chainId) {
|
|
807
|
+
const chainId_ = normalizeChainId(chainId);
|
|
808
|
+
const activeChainId = await connector.getChainId(); // Try to switch chain to provided `chainId`
|
|
809
|
+
|
|
810
|
+
if (chainId !== activeChainId) {
|
|
811
|
+
var _connector$chains$fin, _connector$chains$fin2, _connector$chains$fin3, _connector$chains$fin4;
|
|
812
|
+
|
|
813
|
+
if (connector.switchChain) chain = await connector.switchChain(chainId_);else throw new ChainMismatchError({
|
|
814
|
+
activeChain: (_connector$chains$fin = (_connector$chains$fin2 = connector.chains.find(x => x.id === activeChainId)) === null || _connector$chains$fin2 === void 0 ? void 0 : _connector$chains$fin2.name) !== null && _connector$chains$fin !== void 0 ? _connector$chains$fin : "Chain ".concat(activeChainId),
|
|
815
|
+
targetChain: (_connector$chains$fin3 = (_connector$chains$fin4 = connector.chains.find(x => x.id === chainId_)) === null || _connector$chains$fin4 === void 0 ? void 0 : _connector$chains$fin4.name) !== null && _connector$chains$fin3 !== void 0 ? _connector$chains$fin3 : "Chain ".concat(chainId_)
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
const signer = await connector.getSigner({
|
|
821
|
+
chainId: (_chain = chain) === null || _chain === void 0 ? void 0 : _chain.id
|
|
822
|
+
}); // Method name may be changed in the future, see https://docs.ethers.io/v5/api/signer/#Signer-signTypedData
|
|
791
823
|
|
|
792
|
-
return await signer._signTypedData(
|
|
824
|
+
return await signer._signTypedData(domain, types, value);
|
|
793
825
|
} catch (error) {
|
|
794
826
|
if (error.code === 4001) throw new UserRejectedRequestError(error);
|
|
795
827
|
throw error;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var ethers = require('ethers');
|
|
6
|
-
var rpcs = require('../../../dist/rpcs-
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-f1d24f0e.cjs.dev.js');
|
|
7
7
|
|
|
8
8
|
function alchemyProvider() {
|
|
9
9
|
let {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var ethers = require('ethers');
|
|
6
|
-
var rpcs = require('../../../dist/rpcs-
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-1fd0a12f.cjs.prod.js');
|
|
7
7
|
|
|
8
8
|
function alchemyProvider() {
|
|
9
9
|
let {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var ethers = require('ethers');
|
|
6
|
-
var rpcs = require('../../../dist/rpcs-
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-f1d24f0e.cjs.dev.js');
|
|
7
7
|
|
|
8
8
|
function infuraProvider() {
|
|
9
9
|
let {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var ethers = require('ethers');
|
|
6
|
-
var rpcs = require('../../../dist/rpcs-
|
|
6
|
+
var rpcs = require('../../../dist/rpcs-1fd0a12f.cjs.prod.js');
|
|
7
7
|
|
|
8
8
|
function infuraProvider() {
|
|
9
9
|
let {
|