@wagmi/core 0.5.3 → 0.5.6
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 +3 -2
- package/chains/dist/wagmi-core-chains.cjs.prod.js +3 -2
- package/chains/dist/wagmi-core-chains.esm.js +2 -2
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +3 -3
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +3 -3
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +3 -3
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +3 -3
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +3 -3
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +3 -3
- 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 +3 -3
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +3 -3
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +3 -3
- package/dist/{chains-3916cd7d.cjs.prod.js → chains-4fdb21bc.cjs.dev.js} +32 -2
- package/dist/{chains-bd8ad853.cjs.dev.js → chains-868f0ac6.cjs.prod.js} +32 -2
- package/dist/{chains-505e1070.esm.js → chains-a22bcfea.esm.js} +32 -3
- package/dist/declarations/src/actions/contracts/prepareWriteContract.d.ts +1 -1
- package/dist/declarations/src/chains.d.ts +1 -1
- package/dist/declarations/src/client.d.ts +5 -1
- package/dist/declarations/src/constants/blockExplorers.d.ts +1 -1
- package/dist/declarations/src/constants/chains.d.ts +3 -0
- package/dist/declarations/src/constants/rpcs.d.ts +1 -1
- package/dist/declarations/src/errors.d.ts +23 -2
- package/dist/declarations/src/index.d.ts +2 -2
- package/dist/declarations/src/types/index.d.ts +2 -0
- package/dist/declarations/src/utils/index.d.ts +2 -1
- package/dist/declarations/src/utils/logger.d.ts +1 -0
- package/dist/declarations/src/utils/minimizeContractInterface.d.ts +5 -0
- package/dist/{getProvider-a1ad435d.cjs.prod.js → getProvider-3a26f086.cjs.dev.js} +61 -17
- package/dist/{getProvider-e3d84eba.esm.js → getProvider-a3c8cf52.esm.js} +60 -18
- package/dist/{getProvider-e2217cb6.cjs.dev.js → getProvider-b220fed1.cjs.prod.js} +61 -17
- package/dist/{rpcs-3cf5a783.cjs.dev.js → rpcs-3326627e.cjs.dev.js} +1 -0
- package/dist/{rpcs-afd1cc09.cjs.prod.js → rpcs-45537550.cjs.prod.js} +1 -0
- package/dist/{rpcs-e837abf2.esm.js → rpcs-6e1b1718.esm.js} +1 -0
- package/dist/wagmi-core.cjs.dev.js +117 -35
- package/dist/wagmi-core.cjs.prod.js +117 -35
- package/dist/wagmi-core.esm.js +115 -35
- package/package.json +2 -2
- 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
- package/dist/declarations/src/utils/warn.d.ts +0 -1
|
@@ -5,7 +5,7 @@ var create = require('zustand/vanilla');
|
|
|
5
5
|
var ethers = require('ethers');
|
|
6
6
|
var utils = require('ethers/lib/utils');
|
|
7
7
|
var EventEmitter = require('eventemitter3');
|
|
8
|
-
var chains = require('./chains-
|
|
8
|
+
var chains = require('./chains-4fdb21bc.cjs.dev.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -239,29 +239,65 @@ class ContractMethodDoesNotExistError extends Error {
|
|
|
239
239
|
}
|
|
240
240
|
class ContractMethodNoResultError extends Error {
|
|
241
241
|
constructor(_ref5) {
|
|
242
|
-
var _chain$blockExplorers2;
|
|
243
|
-
|
|
244
242
|
let {
|
|
245
243
|
addressOrName,
|
|
244
|
+
args,
|
|
246
245
|
chainId,
|
|
247
246
|
functionName
|
|
248
247
|
} = _ref5;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
} = _ref6;
|
|
257
|
-
return id === (chainId || network.chainId);
|
|
258
|
-
});
|
|
259
|
-
const blockExplorer = chain === null || chain === void 0 ? void 0 : (_chain$blockExplorers2 = chain.blockExplorers) === null || _chain$blockExplorers2 === void 0 ? void 0 : _chain$blockExplorers2.default;
|
|
260
|
-
super(["Function \"".concat(functionName, "\" on contract \"").concat(addressOrName, "\" returned an empty response."), '', "Are you sure the function \"".concat(functionName, "\" exists on this contract?"), ...(blockExplorer ? ['', "".concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.name, ": ").concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.url, "/address/").concat(addressOrName, "#readContract")] : [])].join('\n'));
|
|
248
|
+
super(['Contract read returned an empty response. This could be due to any of the following:', "- The contract does not have the function \"".concat(functionName, "\","), '- The parameters passed to the contract function may be invalid, or', '- The address is not a contract.', '', "Config:", JSON.stringify({
|
|
249
|
+
addressOrName,
|
|
250
|
+
contractInterface: '...',
|
|
251
|
+
functionName,
|
|
252
|
+
chainId,
|
|
253
|
+
args
|
|
254
|
+
}, null, 2)].join('\n'));
|
|
261
255
|
|
|
262
256
|
_defineProperty(this, "name", 'ContractMethodNoResultError');
|
|
263
257
|
}
|
|
264
258
|
|
|
259
|
+
}
|
|
260
|
+
class ContractMethodRevertedError extends Error {
|
|
261
|
+
constructor(_ref6) {
|
|
262
|
+
let {
|
|
263
|
+
addressOrName,
|
|
264
|
+
args,
|
|
265
|
+
chainId,
|
|
266
|
+
functionName,
|
|
267
|
+
errorMessage
|
|
268
|
+
} = _ref6;
|
|
269
|
+
super(['Contract method reverted with an error.', '', "Config:", JSON.stringify({
|
|
270
|
+
addressOrName,
|
|
271
|
+
contractInterface: '...',
|
|
272
|
+
functionName,
|
|
273
|
+
chainId,
|
|
274
|
+
args
|
|
275
|
+
}, null, 2), '', "Details: ".concat(errorMessage)].join('\n'));
|
|
276
|
+
|
|
277
|
+
_defineProperty(this, "name", 'ContractMethodRevertedError');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
}
|
|
281
|
+
class ContractResultDecodeError extends Error {
|
|
282
|
+
constructor(_ref7) {
|
|
283
|
+
let {
|
|
284
|
+
addressOrName,
|
|
285
|
+
args,
|
|
286
|
+
chainId,
|
|
287
|
+
functionName,
|
|
288
|
+
errorMessage
|
|
289
|
+
} = _ref7;
|
|
290
|
+
super(['Failed to decode contract function result.', '', "Config:", JSON.stringify({
|
|
291
|
+
addressOrName,
|
|
292
|
+
contractInterface: '...',
|
|
293
|
+
functionName,
|
|
294
|
+
chainId,
|
|
295
|
+
args
|
|
296
|
+
}, null, 2), '', "Details: ".concat(errorMessage)].join('\n'));
|
|
297
|
+
|
|
298
|
+
_defineProperty(this, "name", 'ContractResultDecodeError');
|
|
299
|
+
}
|
|
300
|
+
|
|
265
301
|
}
|
|
266
302
|
class ProviderChainsNotFound extends Error {
|
|
267
303
|
constructor() {
|
|
@@ -290,10 +326,10 @@ class SwitchChainError extends ProviderRpcError {
|
|
|
290
326
|
|
|
291
327
|
}
|
|
292
328
|
class SwitchChainNotSupportedError extends Error {
|
|
293
|
-
constructor(
|
|
329
|
+
constructor(_ref8) {
|
|
294
330
|
let {
|
|
295
331
|
connector
|
|
296
|
-
} =
|
|
332
|
+
} = _ref8;
|
|
297
333
|
super("\"".concat(connector.name, "\" does not support programmatic chain switching."));
|
|
298
334
|
|
|
299
335
|
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
@@ -315,10 +351,12 @@ function getInjectedName(ethereum) {
|
|
|
315
351
|
if (!ethereum) return 'Injected';
|
|
316
352
|
|
|
317
353
|
const getName = provider => {
|
|
354
|
+
if (provider.isBitKeep) return 'BitKeep';
|
|
318
355
|
if (provider.isBraveWallet) return 'Brave Wallet';
|
|
319
356
|
if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
|
|
320
357
|
if (provider.isExodus) return 'Exodus';
|
|
321
358
|
if (provider.isFrame) return 'Frame';
|
|
359
|
+
if (provider.isMathWallet) return 'MathWallet';
|
|
322
360
|
if (provider.isOpera) return 'Opera';
|
|
323
361
|
if (provider.isTally) return 'Tally';
|
|
324
362
|
if (provider.isTokenPocket) return 'TokenPocket';
|
|
@@ -737,6 +775,9 @@ class Client {
|
|
|
737
775
|
storage = createStorage({
|
|
738
776
|
storage: typeof window !== 'undefined' ? window.localStorage : noopStorage
|
|
739
777
|
}),
|
|
778
|
+
logger = {
|
|
779
|
+
warn: console.warn
|
|
780
|
+
},
|
|
740
781
|
webSocketProvider: _webSocketProvider
|
|
741
782
|
} = _ref;
|
|
742
783
|
|
|
@@ -805,6 +846,7 @@ class Client {
|
|
|
805
846
|
this.config = {
|
|
806
847
|
autoConnect,
|
|
807
848
|
connectors,
|
|
849
|
+
logger,
|
|
808
850
|
provider: _provider,
|
|
809
851
|
storage,
|
|
810
852
|
webSocketProvider: _webSocketProvider
|
|
@@ -1031,6 +1073,8 @@ exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError;
|
|
|
1031
1073
|
exports.ConnectorNotFoundError = ConnectorNotFoundError;
|
|
1032
1074
|
exports.ContractMethodDoesNotExistError = ContractMethodDoesNotExistError;
|
|
1033
1075
|
exports.ContractMethodNoResultError = ContractMethodNoResultError;
|
|
1076
|
+
exports.ContractMethodRevertedError = ContractMethodRevertedError;
|
|
1077
|
+
exports.ContractResultDecodeError = ContractResultDecodeError;
|
|
1034
1078
|
exports.InjectedConnector = InjectedConnector;
|
|
1035
1079
|
exports.ProviderChainsNotFound = ProviderChainsNotFound;
|
|
1036
1080
|
exports.ProviderRpcError = ProviderRpcError;
|
|
@@ -3,7 +3,7 @@ import create from 'zustand/vanilla';
|
|
|
3
3
|
import { providers } from 'ethers';
|
|
4
4
|
import { getAddress, hexValue } from 'ethers/lib/utils';
|
|
5
5
|
import EventEmitter from 'eventemitter3';
|
|
6
|
-
import { d as defaultChains } from './chains-
|
|
6
|
+
import { d as defaultChains } from './chains-a22bcfea.esm.js';
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
9
9
|
if (privateCollection.has(obj)) {
|
|
@@ -232,29 +232,65 @@ class ContractMethodDoesNotExistError extends Error {
|
|
|
232
232
|
}
|
|
233
233
|
class ContractMethodNoResultError extends Error {
|
|
234
234
|
constructor(_ref5) {
|
|
235
|
-
var _chain$blockExplorers2;
|
|
236
|
-
|
|
237
235
|
let {
|
|
238
236
|
addressOrName,
|
|
237
|
+
args,
|
|
239
238
|
chainId,
|
|
240
239
|
functionName
|
|
241
240
|
} = _ref5;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
} = _ref6;
|
|
250
|
-
return id === (chainId || network.chainId);
|
|
251
|
-
});
|
|
252
|
-
const blockExplorer = chain === null || chain === void 0 ? void 0 : (_chain$blockExplorers2 = chain.blockExplorers) === null || _chain$blockExplorers2 === void 0 ? void 0 : _chain$blockExplorers2.default;
|
|
253
|
-
super(["Function \"".concat(functionName, "\" on contract \"").concat(addressOrName, "\" returned an empty response."), '', "Are you sure the function \"".concat(functionName, "\" exists on this contract?"), ...(blockExplorer ? ['', "".concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.name, ": ").concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.url, "/address/").concat(addressOrName, "#readContract")] : [])].join('\n'));
|
|
241
|
+
super(['Contract read returned an empty response. This could be due to any of the following:', "- The contract does not have the function \"".concat(functionName, "\","), '- The parameters passed to the contract function may be invalid, or', '- The address is not a contract.', '', "Config:", JSON.stringify({
|
|
242
|
+
addressOrName,
|
|
243
|
+
contractInterface: '...',
|
|
244
|
+
functionName,
|
|
245
|
+
chainId,
|
|
246
|
+
args
|
|
247
|
+
}, null, 2)].join('\n'));
|
|
254
248
|
|
|
255
249
|
_defineProperty(this, "name", 'ContractMethodNoResultError');
|
|
256
250
|
}
|
|
257
251
|
|
|
252
|
+
}
|
|
253
|
+
class ContractMethodRevertedError extends Error {
|
|
254
|
+
constructor(_ref6) {
|
|
255
|
+
let {
|
|
256
|
+
addressOrName,
|
|
257
|
+
args,
|
|
258
|
+
chainId,
|
|
259
|
+
functionName,
|
|
260
|
+
errorMessage
|
|
261
|
+
} = _ref6;
|
|
262
|
+
super(['Contract method reverted with an error.', '', "Config:", JSON.stringify({
|
|
263
|
+
addressOrName,
|
|
264
|
+
contractInterface: '...',
|
|
265
|
+
functionName,
|
|
266
|
+
chainId,
|
|
267
|
+
args
|
|
268
|
+
}, null, 2), '', "Details: ".concat(errorMessage)].join('\n'));
|
|
269
|
+
|
|
270
|
+
_defineProperty(this, "name", 'ContractMethodRevertedError');
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
class ContractResultDecodeError extends Error {
|
|
275
|
+
constructor(_ref7) {
|
|
276
|
+
let {
|
|
277
|
+
addressOrName,
|
|
278
|
+
args,
|
|
279
|
+
chainId,
|
|
280
|
+
functionName,
|
|
281
|
+
errorMessage
|
|
282
|
+
} = _ref7;
|
|
283
|
+
super(['Failed to decode contract function result.', '', "Config:", JSON.stringify({
|
|
284
|
+
addressOrName,
|
|
285
|
+
contractInterface: '...',
|
|
286
|
+
functionName,
|
|
287
|
+
chainId,
|
|
288
|
+
args
|
|
289
|
+
}, null, 2), '', "Details: ".concat(errorMessage)].join('\n'));
|
|
290
|
+
|
|
291
|
+
_defineProperty(this, "name", 'ContractResultDecodeError');
|
|
292
|
+
}
|
|
293
|
+
|
|
258
294
|
}
|
|
259
295
|
class ProviderChainsNotFound extends Error {
|
|
260
296
|
constructor() {
|
|
@@ -283,10 +319,10 @@ class SwitchChainError extends ProviderRpcError {
|
|
|
283
319
|
|
|
284
320
|
}
|
|
285
321
|
class SwitchChainNotSupportedError extends Error {
|
|
286
|
-
constructor(
|
|
322
|
+
constructor(_ref8) {
|
|
287
323
|
let {
|
|
288
324
|
connector
|
|
289
|
-
} =
|
|
325
|
+
} = _ref8;
|
|
290
326
|
super("\"".concat(connector.name, "\" does not support programmatic chain switching."));
|
|
291
327
|
|
|
292
328
|
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
@@ -308,10 +344,12 @@ function getInjectedName(ethereum) {
|
|
|
308
344
|
if (!ethereum) return 'Injected';
|
|
309
345
|
|
|
310
346
|
const getName = provider => {
|
|
347
|
+
if (provider.isBitKeep) return 'BitKeep';
|
|
311
348
|
if (provider.isBraveWallet) return 'Brave Wallet';
|
|
312
349
|
if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
|
|
313
350
|
if (provider.isExodus) return 'Exodus';
|
|
314
351
|
if (provider.isFrame) return 'Frame';
|
|
352
|
+
if (provider.isMathWallet) return 'MathWallet';
|
|
315
353
|
if (provider.isOpera) return 'Opera';
|
|
316
354
|
if (provider.isTally) return 'Tally';
|
|
317
355
|
if (provider.isTokenPocket) return 'TokenPocket';
|
|
@@ -730,6 +768,9 @@ class Client {
|
|
|
730
768
|
storage = createStorage({
|
|
731
769
|
storage: typeof window !== 'undefined' ? window.localStorage : noopStorage
|
|
732
770
|
}),
|
|
771
|
+
logger = {
|
|
772
|
+
warn: console.warn
|
|
773
|
+
},
|
|
733
774
|
webSocketProvider: _webSocketProvider
|
|
734
775
|
} = _ref;
|
|
735
776
|
|
|
@@ -798,6 +839,7 @@ class Client {
|
|
|
798
839
|
this.config = {
|
|
799
840
|
autoConnect,
|
|
800
841
|
connectors,
|
|
842
|
+
logger,
|
|
801
843
|
provider: _provider,
|
|
802
844
|
storage,
|
|
803
845
|
webSocketProvider: _webSocketProvider
|
|
@@ -1014,4 +1056,4 @@ function getProvider() {
|
|
|
1014
1056
|
return client.provider;
|
|
1015
1057
|
}
|
|
1016
1058
|
|
|
1017
|
-
export { AddChainError as A, ConnectorAlreadyConnectedError as C, InjectedConnector as I, ProviderChainsNotFound as P, ResourceUnavailableError as R, SwitchChainNotSupportedError as S, UserRejectedRequestError as U, _classPrivateMethodInitSpec as _, ConnectorNotFoundError as a, ChainMismatchError as b, ContractMethodDoesNotExistError as c, getProvider as d, ChainDoesNotSupportMulticallError as e,
|
|
1059
|
+
export { AddChainError as A, ConnectorAlreadyConnectedError as C, InjectedConnector as I, ProviderChainsNotFound as P, ResourceUnavailableError as R, SwitchChainNotSupportedError as S, UserRejectedRequestError as U, _classPrivateMethodInitSpec as _, ConnectorNotFoundError as a, ChainMismatchError as b, ContractMethodDoesNotExistError as c, getProvider as d, ChainDoesNotSupportMulticallError as e, ContractMethodRevertedError as f, getClient as g, ContractMethodNoResultError as h, ContractResultDecodeError as i, createClient as j, Client as k, Connector as l, ChainNotConfiguredError as m, normalizeChainId as n, ProviderRpcError as o, RpcError as p, SwitchChainError as q, createStorage as r, noopStorage as s, _defineProperty as t, _classPrivateFieldInitSpec as u, _classPrivateFieldGet as v, _classPrivateFieldSet as w, _classPrivateMethodGet as x };
|
|
@@ -5,7 +5,7 @@ var create = require('zustand/vanilla');
|
|
|
5
5
|
var ethers = require('ethers');
|
|
6
6
|
var utils = require('ethers/lib/utils');
|
|
7
7
|
var EventEmitter = require('eventemitter3');
|
|
8
|
-
var chains = require('./chains-
|
|
8
|
+
var chains = require('./chains-868f0ac6.cjs.prod.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -239,29 +239,65 @@ class ContractMethodDoesNotExistError extends Error {
|
|
|
239
239
|
}
|
|
240
240
|
class ContractMethodNoResultError extends Error {
|
|
241
241
|
constructor(_ref5) {
|
|
242
|
-
var _chain$blockExplorers2;
|
|
243
|
-
|
|
244
242
|
let {
|
|
245
243
|
addressOrName,
|
|
244
|
+
args,
|
|
246
245
|
chainId,
|
|
247
246
|
functionName
|
|
248
247
|
} = _ref5;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
} = _ref6;
|
|
257
|
-
return id === (chainId || network.chainId);
|
|
258
|
-
});
|
|
259
|
-
const blockExplorer = chain === null || chain === void 0 ? void 0 : (_chain$blockExplorers2 = chain.blockExplorers) === null || _chain$blockExplorers2 === void 0 ? void 0 : _chain$blockExplorers2.default;
|
|
260
|
-
super(["Function \"".concat(functionName, "\" on contract \"").concat(addressOrName, "\" returned an empty response."), '', "Are you sure the function \"".concat(functionName, "\" exists on this contract?"), ...(blockExplorer ? ['', "".concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.name, ": ").concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.url, "/address/").concat(addressOrName, "#readContract")] : [])].join('\n'));
|
|
248
|
+
super(['Contract read returned an empty response. This could be due to any of the following:', "- The contract does not have the function \"".concat(functionName, "\","), '- The parameters passed to the contract function may be invalid, or', '- The address is not a contract.', '', "Config:", JSON.stringify({
|
|
249
|
+
addressOrName,
|
|
250
|
+
contractInterface: '...',
|
|
251
|
+
functionName,
|
|
252
|
+
chainId,
|
|
253
|
+
args
|
|
254
|
+
}, null, 2)].join('\n'));
|
|
261
255
|
|
|
262
256
|
_defineProperty(this, "name", 'ContractMethodNoResultError');
|
|
263
257
|
}
|
|
264
258
|
|
|
259
|
+
}
|
|
260
|
+
class ContractMethodRevertedError extends Error {
|
|
261
|
+
constructor(_ref6) {
|
|
262
|
+
let {
|
|
263
|
+
addressOrName,
|
|
264
|
+
args,
|
|
265
|
+
chainId,
|
|
266
|
+
functionName,
|
|
267
|
+
errorMessage
|
|
268
|
+
} = _ref6;
|
|
269
|
+
super(['Contract method reverted with an error.', '', "Config:", JSON.stringify({
|
|
270
|
+
addressOrName,
|
|
271
|
+
contractInterface: '...',
|
|
272
|
+
functionName,
|
|
273
|
+
chainId,
|
|
274
|
+
args
|
|
275
|
+
}, null, 2), '', "Details: ".concat(errorMessage)].join('\n'));
|
|
276
|
+
|
|
277
|
+
_defineProperty(this, "name", 'ContractMethodRevertedError');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
}
|
|
281
|
+
class ContractResultDecodeError extends Error {
|
|
282
|
+
constructor(_ref7) {
|
|
283
|
+
let {
|
|
284
|
+
addressOrName,
|
|
285
|
+
args,
|
|
286
|
+
chainId,
|
|
287
|
+
functionName,
|
|
288
|
+
errorMessage
|
|
289
|
+
} = _ref7;
|
|
290
|
+
super(['Failed to decode contract function result.', '', "Config:", JSON.stringify({
|
|
291
|
+
addressOrName,
|
|
292
|
+
contractInterface: '...',
|
|
293
|
+
functionName,
|
|
294
|
+
chainId,
|
|
295
|
+
args
|
|
296
|
+
}, null, 2), '', "Details: ".concat(errorMessage)].join('\n'));
|
|
297
|
+
|
|
298
|
+
_defineProperty(this, "name", 'ContractResultDecodeError');
|
|
299
|
+
}
|
|
300
|
+
|
|
265
301
|
}
|
|
266
302
|
class ProviderChainsNotFound extends Error {
|
|
267
303
|
constructor() {
|
|
@@ -290,10 +326,10 @@ class SwitchChainError extends ProviderRpcError {
|
|
|
290
326
|
|
|
291
327
|
}
|
|
292
328
|
class SwitchChainNotSupportedError extends Error {
|
|
293
|
-
constructor(
|
|
329
|
+
constructor(_ref8) {
|
|
294
330
|
let {
|
|
295
331
|
connector
|
|
296
|
-
} =
|
|
332
|
+
} = _ref8;
|
|
297
333
|
super("\"".concat(connector.name, "\" does not support programmatic chain switching."));
|
|
298
334
|
|
|
299
335
|
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
@@ -315,10 +351,12 @@ function getInjectedName(ethereum) {
|
|
|
315
351
|
if (!ethereum) return 'Injected';
|
|
316
352
|
|
|
317
353
|
const getName = provider => {
|
|
354
|
+
if (provider.isBitKeep) return 'BitKeep';
|
|
318
355
|
if (provider.isBraveWallet) return 'Brave Wallet';
|
|
319
356
|
if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
|
|
320
357
|
if (provider.isExodus) return 'Exodus';
|
|
321
358
|
if (provider.isFrame) return 'Frame';
|
|
359
|
+
if (provider.isMathWallet) return 'MathWallet';
|
|
322
360
|
if (provider.isOpera) return 'Opera';
|
|
323
361
|
if (provider.isTally) return 'Tally';
|
|
324
362
|
if (provider.isTokenPocket) return 'TokenPocket';
|
|
@@ -737,6 +775,9 @@ class Client {
|
|
|
737
775
|
storage = createStorage({
|
|
738
776
|
storage: typeof window !== 'undefined' ? window.localStorage : noopStorage
|
|
739
777
|
}),
|
|
778
|
+
logger = {
|
|
779
|
+
warn: console.warn
|
|
780
|
+
},
|
|
740
781
|
webSocketProvider: _webSocketProvider
|
|
741
782
|
} = _ref;
|
|
742
783
|
|
|
@@ -805,6 +846,7 @@ class Client {
|
|
|
805
846
|
this.config = {
|
|
806
847
|
autoConnect,
|
|
807
848
|
connectors,
|
|
849
|
+
logger,
|
|
808
850
|
provider: _provider,
|
|
809
851
|
storage,
|
|
810
852
|
webSocketProvider: _webSocketProvider
|
|
@@ -1031,6 +1073,8 @@ exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError;
|
|
|
1031
1073
|
exports.ConnectorNotFoundError = ConnectorNotFoundError;
|
|
1032
1074
|
exports.ContractMethodDoesNotExistError = ContractMethodDoesNotExistError;
|
|
1033
1075
|
exports.ContractMethodNoResultError = ContractMethodNoResultError;
|
|
1076
|
+
exports.ContractMethodRevertedError = ContractMethodRevertedError;
|
|
1077
|
+
exports.ContractResultDecodeError = ContractResultDecodeError;
|
|
1034
1078
|
exports.InjectedConnector = InjectedConnector;
|
|
1035
1079
|
exports.ProviderChainsNotFound = ProviderChainsNotFound;
|
|
1036
1080
|
exports.ProviderRpcError = ProviderRpcError;
|
|
@@ -38,6 +38,7 @@ const publicRpcUrls = {
|
|
|
38
38
|
rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyApiKey),
|
|
39
39
|
goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyApiKey),
|
|
40
40
|
kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyApiKey),
|
|
41
|
+
sepolia: 'https://rpc.sepolia.org',
|
|
41
42
|
optimism: 'https://mainnet.optimism.io',
|
|
42
43
|
optimismKovan: 'https://kovan.optimism.io',
|
|
43
44
|
optimismGoerli: 'https://goerli.optimism.io',
|
|
@@ -38,6 +38,7 @@ const publicRpcUrls = {
|
|
|
38
38
|
rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyApiKey),
|
|
39
39
|
goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyApiKey),
|
|
40
40
|
kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyApiKey),
|
|
41
|
+
sepolia: 'https://rpc.sepolia.org',
|
|
41
42
|
optimism: 'https://mainnet.optimism.io',
|
|
42
43
|
optimismKovan: 'https://kovan.optimism.io',
|
|
43
44
|
optimismGoerli: 'https://goerli.optimism.io',
|
|
@@ -36,6 +36,7 @@ const publicRpcUrls = {
|
|
|
36
36
|
rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyApiKey),
|
|
37
37
|
goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyApiKey),
|
|
38
38
|
kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyApiKey),
|
|
39
|
+
sepolia: 'https://rpc.sepolia.org',
|
|
39
40
|
optimism: 'https://mainnet.optimism.io',
|
|
40
41
|
optimismKovan: 'https://kovan.optimism.io',
|
|
41
42
|
optimismGoerli: 'https://goerli.optimism.io',
|