@wagmi/core 0.4.8 → 0.4.9
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 +1 -1
- package/chains/dist/wagmi-core-chains.cjs.prod.js +1 -1
- package/chains/dist/wagmi-core-chains.esm.js +1 -1
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +2 -2
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +2 -2
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +2 -2
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +5 -5
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +5 -5
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +5 -5
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +2 -2
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +2 -2
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +2 -2
- 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/{base-797ad073.cjs.prod.js → base-337e6424.cjs.prod.js} +1 -1
- package/dist/{base-90b7f3e4.cjs.dev.js → base-bd337280.cjs.dev.js} +1 -1
- package/dist/{base-b565d5d4.esm.js → base-f1bbf263.esm.js} +1 -1
- package/dist/{chains-fd2c546c.esm.js → chains-174cf4b4.esm.js} +3 -3
- package/dist/{chains-f7bb3211.cjs.prod.js → chains-b8e32454.cjs.prod.js} +3 -3
- package/dist/{chains-7e6dc59c.cjs.dev.js → chains-ba6218fb.cjs.dev.js} +3 -3
- package/dist/{client-71ece661.cjs.dev.js → client-4983a639.cjs.dev.js} +17 -14
- package/dist/{client-a6e61429.cjs.prod.js → client-dfad744f.cjs.prod.js} +17 -14
- package/dist/{client-a05fd511.esm.js → client-fbdcbdb2.esm.js} +18 -14
- package/dist/declarations/src/actions/tokens/fetchToken.d.ts +1 -0
- package/dist/declarations/src/client.d.ts +1 -1
- package/dist/declarations/src/connectors/index.d.ts +1 -1
- package/dist/declarations/src/connectors/injected.d.ts +3 -3
- package/dist/declarations/src/connectors/metaMask.d.ts +1 -1
- package/dist/declarations/src/index.d.ts +2 -2
- package/dist/declarations/src/types/index.d.ts +129 -128
- package/dist/declarations/src/utils/getInjectedName.d.ts +2 -1
- package/dist/wagmi-core.cjs.dev.js +26 -11
- package/dist/wagmi-core.cjs.prod.js +26 -11
- package/dist/wagmi-core.esm.js +28 -13
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { g as arbitrum, h as arbitrumRinkeby, i as foundry, j as goerli, k as hardhat, l as kovan, m as localhost, n as mainnet, o as optimism, p as optimismKovan, q as polygon, r as polygonMumbai, s as rinkeby, t as ropsten } from '../../dist/chains-
|
|
1
|
+
export { g as arbitrum, h as arbitrumRinkeby, i as foundry, j as goerli, k as hardhat, l as kovan, m as localhost, n as mainnet, o as optimism, p as optimismKovan, q as polygon, r as polygonMumbai, s as rinkeby, t as ropsten } from '../../dist/chains-174cf4b4.esm.js';
|
|
2
2
|
import '../../dist/rpcs-b73a8f60.esm.js';
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
5
|
+
var base = require('../../../dist/base-bd337280.cjs.dev.js');
|
|
6
6
|
var ethers = require('ethers');
|
|
7
7
|
var utils = require('ethers/lib/utils');
|
|
8
8
|
require('eventemitter3');
|
|
9
|
-
require('../../../dist/chains-
|
|
9
|
+
require('../../../dist/chains-ba6218fb.cjs.dev.js');
|
|
10
10
|
require('../../../dist/rpcs-f1d24f0e.cjs.dev.js');
|
|
11
11
|
|
|
12
12
|
function _interopNamespace(e) {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
5
|
+
var base = require('../../../dist/base-337e6424.cjs.prod.js');
|
|
6
6
|
var ethers = require('ethers');
|
|
7
7
|
var utils = require('ethers/lib/utils');
|
|
8
8
|
require('eventemitter3');
|
|
9
|
-
require('../../../dist/chains-
|
|
9
|
+
require('../../../dist/chains-b8e32454.cjs.prod.js');
|
|
10
10
|
require('../../../dist/rpcs-1fd0a12f.cjs.prod.js');
|
|
11
11
|
|
|
12
12
|
function _interopNamespace(e) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { e as Connector, m as _classPrivateMethodInitSpec, _ as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, U as UserRejectedRequestError, k as _classPrivateFieldGet, l as _classPrivateFieldSet, f as ChainNotConfiguredError, o as _classPrivateMethodGet, A as AddChainError, i as SwitchChainError } from '../../../dist/base-
|
|
1
|
+
import { e as Connector, m as _classPrivateMethodInitSpec, _ as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, U as UserRejectedRequestError, k as _classPrivateFieldGet, l as _classPrivateFieldSet, f as ChainNotConfiguredError, o as _classPrivateMethodGet, A as AddChainError, i as SwitchChainError } from '../../../dist/base-f1bbf263.esm.js';
|
|
2
2
|
import { providers } from 'ethers';
|
|
3
3
|
import { getAddress, hexValue } from 'ethers/lib/utils';
|
|
4
4
|
import 'eventemitter3';
|
|
5
|
-
import '../../../dist/chains-
|
|
5
|
+
import '../../../dist/chains-174cf4b4.esm.js';
|
|
6
6
|
import '../../../dist/rpcs-b73a8f60.esm.js';
|
|
7
7
|
|
|
8
8
|
var _client = /*#__PURE__*/new WeakMap();
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
6
|
-
var client = require('../../../dist/client-
|
|
5
|
+
var base = require('../../../dist/base-bd337280.cjs.dev.js');
|
|
6
|
+
var client = require('../../../dist/client-4983a639.cjs.dev.js');
|
|
7
7
|
require('eventemitter3');
|
|
8
|
-
require('../../../dist/chains-
|
|
8
|
+
require('../../../dist/chains-ba6218fb.cjs.dev.js');
|
|
9
9
|
require('../../../dist/rpcs-f1d24f0e.cjs.dev.js');
|
|
10
10
|
require('zustand/vanilla');
|
|
11
11
|
require('zustand/middleware');
|
|
@@ -80,7 +80,7 @@ class MetaMaskConnector extends client.InjectedConnector {
|
|
|
80
80
|
}); // Attempt to show wallet select prompt with `wallet_requestPermissions` when
|
|
81
81
|
// `shimDisconnect` is active and account is in disconnected state (flag in storage)
|
|
82
82
|
|
|
83
|
-
if (base._classPrivateFieldGet(this, _UNSTABLE_shimOnConnectSelectAccount) && (_this$options = this.options) !== null && _this$options !== void 0 && _this$options.shimDisconnect && !((_getClient$storage = client.getClient().storage) !== null && _getClient$storage !== void 0 && _getClient$storage.getItem(
|
|
83
|
+
if (base._classPrivateFieldGet(this, _UNSTABLE_shimOnConnectSelectAccount) && (_this$options = this.options) !== null && _this$options !== void 0 && _this$options.shimDisconnect && !((_getClient$storage = client.getClient().storage) !== null && _getClient$storage !== void 0 && _getClient$storage.getItem(this.shimDisconnectKey))) {
|
|
84
84
|
const accounts = await provider.request({
|
|
85
85
|
method: 'eth_accounts'
|
|
86
86
|
}).catch(() => []);
|
|
@@ -104,7 +104,7 @@ class MetaMaskConnector extends client.InjectedConnector {
|
|
|
104
104
|
unsupported = this.isChainUnsupported(id);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage2 = client.getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(
|
|
107
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage2 = client.getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(this.shimDisconnectKey, true);
|
|
108
108
|
return {
|
|
109
109
|
account,
|
|
110
110
|
chain: {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
6
|
-
var client = require('../../../dist/client-
|
|
5
|
+
var base = require('../../../dist/base-337e6424.cjs.prod.js');
|
|
6
|
+
var client = require('../../../dist/client-dfad744f.cjs.prod.js');
|
|
7
7
|
require('eventemitter3');
|
|
8
|
-
require('../../../dist/chains-
|
|
8
|
+
require('../../../dist/chains-b8e32454.cjs.prod.js');
|
|
9
9
|
require('../../../dist/rpcs-1fd0a12f.cjs.prod.js');
|
|
10
10
|
require('zustand/vanilla');
|
|
11
11
|
require('zustand/middleware');
|
|
@@ -80,7 +80,7 @@ class MetaMaskConnector extends client.InjectedConnector {
|
|
|
80
80
|
}); // Attempt to show wallet select prompt with `wallet_requestPermissions` when
|
|
81
81
|
// `shimDisconnect` is active and account is in disconnected state (flag in storage)
|
|
82
82
|
|
|
83
|
-
if (base._classPrivateFieldGet(this, _UNSTABLE_shimOnConnectSelectAccount) && (_this$options = this.options) !== null && _this$options !== void 0 && _this$options.shimDisconnect && !((_getClient$storage = client.getClient().storage) !== null && _getClient$storage !== void 0 && _getClient$storage.getItem(
|
|
83
|
+
if (base._classPrivateFieldGet(this, _UNSTABLE_shimOnConnectSelectAccount) && (_this$options = this.options) !== null && _this$options !== void 0 && _this$options.shimDisconnect && !((_getClient$storage = client.getClient().storage) !== null && _getClient$storage !== void 0 && _getClient$storage.getItem(this.shimDisconnectKey))) {
|
|
84
84
|
const accounts = await provider.request({
|
|
85
85
|
method: 'eth_accounts'
|
|
86
86
|
}).catch(() => []);
|
|
@@ -104,7 +104,7 @@ class MetaMaskConnector extends client.InjectedConnector {
|
|
|
104
104
|
unsupported = this.isChainUnsupported(id);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage2 = client.getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(
|
|
107
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage2 = client.getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(this.shimDisconnectKey, true);
|
|
108
108
|
return {
|
|
109
109
|
account,
|
|
110
110
|
chain: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as _classPrivateMethodInitSpec, _ as _defineProperty, o as _classPrivateMethodGet, j as _classPrivateFieldInitSpec, l as _classPrivateFieldSet, c as ConnectorNotFoundError, k as _classPrivateFieldGet, U as UserRejectedRequestError, R as ResourceUnavailableError } from '../../../dist/base-
|
|
2
|
-
import { I as InjectedConnector, g as getClient
|
|
1
|
+
import { m as _classPrivateMethodInitSpec, _ as _defineProperty, o as _classPrivateMethodGet, j as _classPrivateFieldInitSpec, l as _classPrivateFieldSet, c as ConnectorNotFoundError, k as _classPrivateFieldGet, U as UserRejectedRequestError, R as ResourceUnavailableError } from '../../../dist/base-f1bbf263.esm.js';
|
|
2
|
+
import { I as InjectedConnector, g as getClient } from '../../../dist/client-fbdcbdb2.esm.js';
|
|
3
3
|
import 'eventemitter3';
|
|
4
|
-
import '../../../dist/chains-
|
|
4
|
+
import '../../../dist/chains-174cf4b4.esm.js';
|
|
5
5
|
import '../../../dist/rpcs-b73a8f60.esm.js';
|
|
6
6
|
import 'zustand/vanilla';
|
|
7
7
|
import 'zustand/middleware';
|
|
@@ -76,7 +76,7 @@ class MetaMaskConnector extends InjectedConnector {
|
|
|
76
76
|
}); // Attempt to show wallet select prompt with `wallet_requestPermissions` when
|
|
77
77
|
// `shimDisconnect` is active and account is in disconnected state (flag in storage)
|
|
78
78
|
|
|
79
|
-
if (_classPrivateFieldGet(this, _UNSTABLE_shimOnConnectSelectAccount) && (_this$options = this.options) !== null && _this$options !== void 0 && _this$options.shimDisconnect && !((_getClient$storage = getClient().storage) !== null && _getClient$storage !== void 0 && _getClient$storage.getItem(shimDisconnectKey))) {
|
|
79
|
+
if (_classPrivateFieldGet(this, _UNSTABLE_shimOnConnectSelectAccount) && (_this$options = this.options) !== null && _this$options !== void 0 && _this$options.shimDisconnect && !((_getClient$storage = getClient().storage) !== null && _getClient$storage !== void 0 && _getClient$storage.getItem(this.shimDisconnectKey))) {
|
|
80
80
|
const accounts = await provider.request({
|
|
81
81
|
method: 'eth_accounts'
|
|
82
82
|
}).catch(() => []);
|
|
@@ -100,7 +100,7 @@ class MetaMaskConnector extends InjectedConnector {
|
|
|
100
100
|
unsupported = this.isChainUnsupported(id);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(shimDisconnectKey, true);
|
|
103
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(this.shimDisconnectKey, true);
|
|
104
104
|
return {
|
|
105
105
|
account,
|
|
106
106
|
chain: {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
5
|
+
var base = require('../../../dist/base-bd337280.cjs.dev.js');
|
|
6
6
|
var utils = require('ethers/lib/utils');
|
|
7
7
|
var EventEmitter = require('eventemitter3');
|
|
8
8
|
var ethers = require('ethers');
|
|
9
|
-
require('../../../dist/chains-
|
|
9
|
+
require('../../../dist/chains-ba6218fb.cjs.dev.js');
|
|
10
10
|
require('../../../dist/rpcs-f1d24f0e.cjs.dev.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
5
|
+
var base = require('../../../dist/base-337e6424.cjs.prod.js');
|
|
6
6
|
var utils = require('ethers/lib/utils');
|
|
7
7
|
var EventEmitter = require('eventemitter3');
|
|
8
8
|
var ethers = require('ethers');
|
|
9
|
-
require('../../../dist/chains-
|
|
9
|
+
require('../../../dist/chains-b8e32454.cjs.prod.js');
|
|
10
10
|
require('../../../dist/rpcs-1fd0a12f.cjs.prod.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as _defineProperty, j as _classPrivateFieldInitSpec, l as _classPrivateFieldSet, k as _classPrivateFieldGet, U as UserRejectedRequestError, e as Connector, m as _classPrivateMethodInitSpec, n as normalizeChainId, o as _classPrivateMethodGet } from '../../../dist/base-
|
|
1
|
+
import { _ as _defineProperty, j as _classPrivateFieldInitSpec, l as _classPrivateFieldSet, k as _classPrivateFieldGet, U as UserRejectedRequestError, e as Connector, m as _classPrivateMethodInitSpec, n as normalizeChainId, o as _classPrivateMethodGet } from '../../../dist/base-f1bbf263.esm.js';
|
|
2
2
|
import { getAddress } from 'ethers/lib/utils';
|
|
3
3
|
import EventEmitter from 'eventemitter3';
|
|
4
4
|
import { providers } from 'ethers';
|
|
5
|
-
import '../../../dist/chains-
|
|
5
|
+
import '../../../dist/chains-174cf4b4.esm.js';
|
|
6
6
|
import '../../../dist/rpcs-b73a8f60.esm.js';
|
|
7
7
|
|
|
8
8
|
var _options = /*#__PURE__*/new WeakMap();
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
5
|
+
var base = require('../../../dist/base-bd337280.cjs.dev.js');
|
|
6
6
|
var ethers = require('ethers');
|
|
7
7
|
var utils = require('ethers/lib/utils');
|
|
8
|
-
var client = require('../../../dist/client-
|
|
8
|
+
var client = require('../../../dist/client-4983a639.cjs.dev.js');
|
|
9
9
|
require('eventemitter3');
|
|
10
|
-
require('../../../dist/chains-
|
|
10
|
+
require('../../../dist/chains-ba6218fb.cjs.dev.js');
|
|
11
11
|
require('../../../dist/rpcs-f1d24f0e.cjs.dev.js');
|
|
12
12
|
require('zustand/vanilla');
|
|
13
13
|
require('zustand/middleware');
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var base = require('../../../dist/base-
|
|
5
|
+
var base = require('../../../dist/base-337e6424.cjs.prod.js');
|
|
6
6
|
var ethers = require('ethers');
|
|
7
7
|
var utils = require('ethers/lib/utils');
|
|
8
|
-
var client = require('../../../dist/client-
|
|
8
|
+
var client = require('../../../dist/client-dfad744f.cjs.prod.js');
|
|
9
9
|
require('eventemitter3');
|
|
10
|
-
require('../../../dist/chains-
|
|
10
|
+
require('../../../dist/chains-b8e32454.cjs.prod.js');
|
|
11
11
|
require('../../../dist/rpcs-1fd0a12f.cjs.prod.js');
|
|
12
12
|
require('zustand/vanilla');
|
|
13
13
|
require('zustand/middleware');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { e as Connector, m as _classPrivateMethodInitSpec, _ as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, o as _classPrivateMethodGet, U as UserRejectedRequestError, k as _classPrivateFieldGet, l as _classPrivateFieldSet, i as SwitchChainError } from '../../../dist/base-
|
|
1
|
+
import { e as Connector, m as _classPrivateMethodInitSpec, _ as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, o as _classPrivateMethodGet, U as UserRejectedRequestError, k as _classPrivateFieldGet, l as _classPrivateFieldSet, i as SwitchChainError } from '../../../dist/base-f1bbf263.esm.js';
|
|
2
2
|
import { providers } from 'ethers';
|
|
3
3
|
import { getAddress, hexValue } from 'ethers/lib/utils';
|
|
4
|
-
import { g as getClient } from '../../../dist/client-
|
|
4
|
+
import { g as getClient } from '../../../dist/client-fbdcbdb2.esm.js';
|
|
5
5
|
import 'eventemitter3';
|
|
6
|
-
import '../../../dist/chains-
|
|
6
|
+
import '../../../dist/chains-174cf4b4.esm.js';
|
|
7
7
|
import '../../../dist/rpcs-b73a8f60.esm.js';
|
|
8
8
|
import 'zustand/vanilla';
|
|
9
9
|
import 'zustand/middleware';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
|
-
import { d as defaultChains } from './chains-
|
|
2
|
+
import { d as defaultChains } from './chains-174cf4b4.esm.js';
|
|
3
3
|
|
|
4
4
|
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
5
5
|
if (privateCollection.has(obj)) {
|
|
@@ -399,8 +399,8 @@ const chain = {
|
|
|
399
399
|
hardhat,
|
|
400
400
|
foundry
|
|
401
401
|
};
|
|
402
|
-
const allChains =
|
|
403
|
-
const defaultChains = [
|
|
404
|
-
const defaultL2Chains = [
|
|
402
|
+
const allChains = [mainnet, ropsten, rinkeby, goerli, kovan, optimism, optimismKovan, polygon, polygonMumbai, arbitrum, arbitrumRinkeby, localhost, hardhat, foundry];
|
|
403
|
+
const defaultChains = [mainnet, ropsten, rinkeby, goerli, kovan];
|
|
404
|
+
const defaultL2Chains = [arbitrum, arbitrumRinkeby, optimism, optimismKovan];
|
|
405
405
|
|
|
406
406
|
export { allChains as a, chainId as b, chain as c, defaultChains as d, defaultL2Chains as e, etherscanBlockExplorers as f, arbitrum as g, arbitrumRinkeby as h, foundry as i, goerli as j, hardhat as k, kovan as l, localhost as m, mainnet as n, optimism as o, optimismKovan as p, polygon as q, polygonMumbai as r, rinkeby as s, ropsten as t };
|
|
@@ -401,9 +401,9 @@ const chain = {
|
|
|
401
401
|
hardhat,
|
|
402
402
|
foundry
|
|
403
403
|
};
|
|
404
|
-
const allChains =
|
|
405
|
-
const defaultChains = [
|
|
406
|
-
const defaultL2Chains = [
|
|
404
|
+
const allChains = [mainnet, ropsten, rinkeby, goerli, kovan, optimism, optimismKovan, polygon, polygonMumbai, arbitrum, arbitrumRinkeby, localhost, hardhat, foundry];
|
|
405
|
+
const defaultChains = [mainnet, ropsten, rinkeby, goerli, kovan];
|
|
406
|
+
const defaultL2Chains = [arbitrum, arbitrumRinkeby, optimism, optimismKovan];
|
|
407
407
|
|
|
408
408
|
exports.allChains = allChains;
|
|
409
409
|
exports.arbitrum = arbitrum;
|
|
@@ -401,9 +401,9 @@ const chain = {
|
|
|
401
401
|
hardhat,
|
|
402
402
|
foundry
|
|
403
403
|
};
|
|
404
|
-
const allChains =
|
|
405
|
-
const defaultChains = [
|
|
406
|
-
const defaultL2Chains = [
|
|
404
|
+
const allChains = [mainnet, ropsten, rinkeby, goerli, kovan, optimism, optimismKovan, polygon, polygonMumbai, arbitrum, arbitrumRinkeby, localhost, hardhat, foundry];
|
|
405
|
+
const defaultChains = [mainnet, ropsten, rinkeby, goerli, kovan];
|
|
406
|
+
const defaultL2Chains = [arbitrum, arbitrumRinkeby, optimism, optimismKovan];
|
|
407
407
|
|
|
408
408
|
exports.allChains = allChains;
|
|
409
409
|
exports.arbitrum = arbitrum;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-bd337280.cjs.dev.js');
|
|
4
4
|
var create = require('zustand/vanilla');
|
|
5
5
|
var middleware = require('zustand/middleware');
|
|
6
6
|
var ethers = require('ethers');
|
|
@@ -56,8 +56,6 @@ function getInjectedName(ethereum) {
|
|
|
56
56
|
return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const shimDisconnectKey = 'injected.shimDisconnect';
|
|
60
|
-
|
|
61
59
|
var _provider = /*#__PURE__*/new WeakMap();
|
|
62
60
|
|
|
63
61
|
var _switchingChains = /*#__PURE__*/new WeakMap();
|
|
@@ -91,6 +89,8 @@ class InjectedConnector extends base.Connector {
|
|
|
91
89
|
value: void 0
|
|
92
90
|
});
|
|
93
91
|
|
|
92
|
+
base._defineProperty(this, "shimDisconnectKey", 'injected.shimDisconnect');
|
|
93
|
+
|
|
94
94
|
base._defineProperty(this, "onAccountsChanged", accounts => {
|
|
95
95
|
if (accounts.length === 0) this.emit('disconnect');else this.emit('change', {
|
|
96
96
|
account: utils.getAddress(accounts[0])
|
|
@@ -122,17 +122,15 @@ class InjectedConnector extends base.Connector {
|
|
|
122
122
|
|
|
123
123
|
this.emit('disconnect'); // Remove shim signalling wallet is disconnected
|
|
124
124
|
|
|
125
|
-
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage = getClient().storage) === null || _getClient$storage === void 0 ? void 0 : _getClient$storage.removeItem(shimDisconnectKey);
|
|
125
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage = getClient().storage) === null || _getClient$storage === void 0 ? void 0 : _getClient$storage.removeItem(this.shimDisconnectKey);
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
let name = 'Injected';
|
|
129
|
-
|
|
130
|
-
if (typeof window !== 'undefined') {
|
|
131
|
-
const overrideName = options.name;
|
|
129
|
+
const overrideName = options.name;
|
|
130
|
+
if (typeof overrideName === 'string') name = overrideName;else if (typeof window !== 'undefined') {
|
|
132
131
|
const detectedName = getInjectedName(window.ethereum);
|
|
133
|
-
if (overrideName) name =
|
|
132
|
+
if (overrideName) name = overrideName(detectedName);else name = typeof detectedName === 'string' ? detectedName : detectedName[0];
|
|
134
133
|
}
|
|
135
|
-
|
|
136
134
|
this.id = 'injected';
|
|
137
135
|
this.name = name;
|
|
138
136
|
}
|
|
@@ -169,7 +167,7 @@ class InjectedConnector extends base.Connector {
|
|
|
169
167
|
} // Add shim to storage signalling wallet is connected
|
|
170
168
|
|
|
171
169
|
|
|
172
|
-
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(shimDisconnectKey, true);
|
|
170
|
+
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(this.shimDisconnectKey, true);
|
|
173
171
|
return {
|
|
174
172
|
account,
|
|
175
173
|
chain: {
|
|
@@ -194,7 +192,7 @@ class InjectedConnector extends base.Connector {
|
|
|
194
192
|
provider.removeListener('chainChanged', this.onChainChanged);
|
|
195
193
|
provider.removeListener('disconnect', this.onDisconnect); // Remove shim signalling wallet is disconnected
|
|
196
194
|
|
|
197
|
-
if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.shimDisconnect) (_getClient$storage3 = getClient().storage) === null || _getClient$storage3 === void 0 ? void 0 : _getClient$storage3.removeItem(shimDisconnectKey);
|
|
195
|
+
if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.shimDisconnect) (_getClient$storage3 = getClient().storage) === null || _getClient$storage3 === void 0 ? void 0 : _getClient$storage3.removeItem(this.shimDisconnectKey);
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
async getAccount() {
|
|
@@ -230,7 +228,7 @@ class InjectedConnector extends base.Connector {
|
|
|
230
228
|
var _this$options5, _getClient$storage4;
|
|
231
229
|
|
|
232
230
|
if ((_this$options5 = this.options) !== null && _this$options5 !== void 0 && _this$options5.shimDisconnect && // If shim does not exist in storage, wallet is disconnected
|
|
233
|
-
!((_getClient$storage4 = getClient().storage) !== null && _getClient$storage4 !== void 0 && _getClient$storage4.getItem(shimDisconnectKey))) return false;
|
|
231
|
+
!((_getClient$storage4 = getClient().storage) !== null && _getClient$storage4 !== void 0 && _getClient$storage4.getItem(this.shimDisconnectKey))) return false;
|
|
234
232
|
const provider = await this.getProvider();
|
|
235
233
|
if (!provider) throw new base.ConnectorNotFoundError();
|
|
236
234
|
const accounts = await provider.request({
|
|
@@ -536,7 +534,13 @@ class Client {
|
|
|
536
534
|
|
|
537
535
|
base._classPrivateFieldSet(this, _isAutoConnecting, true);
|
|
538
536
|
|
|
539
|
-
|
|
537
|
+
this.setState(x => {
|
|
538
|
+
var _x$data;
|
|
539
|
+
|
|
540
|
+
return { ...x,
|
|
541
|
+
status: (_x$data = x.data) !== null && _x$data !== void 0 && _x$data.account ? 'reconnecting' : 'connecting'
|
|
542
|
+
};
|
|
543
|
+
}); // Try last used connector first
|
|
540
544
|
|
|
541
545
|
const sorted = base._classPrivateFieldGet(this, _lastUsedConnector) ? [...this.connectors].sort(x => x.id === base._classPrivateFieldGet(this, _lastUsedConnector) ? -1 : 1) : this.connectors;
|
|
542
546
|
let connected = false;
|
|
@@ -656,4 +660,3 @@ exports.createClient = createClient;
|
|
|
656
660
|
exports.createStorage = createStorage;
|
|
657
661
|
exports.getClient = getClient;
|
|
658
662
|
exports.noopStorage = noopStorage;
|
|
659
|
-
exports.shimDisconnectKey = shimDisconnectKey;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-337e6424.cjs.prod.js');
|
|
4
4
|
var create = require('zustand/vanilla');
|
|
5
5
|
var middleware = require('zustand/middleware');
|
|
6
6
|
var ethers = require('ethers');
|
|
@@ -56,8 +56,6 @@ function getInjectedName(ethereum) {
|
|
|
56
56
|
return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const shimDisconnectKey = 'injected.shimDisconnect';
|
|
60
|
-
|
|
61
59
|
var _provider = /*#__PURE__*/new WeakMap();
|
|
62
60
|
|
|
63
61
|
var _switchingChains = /*#__PURE__*/new WeakMap();
|
|
@@ -91,6 +89,8 @@ class InjectedConnector extends base.Connector {
|
|
|
91
89
|
value: void 0
|
|
92
90
|
});
|
|
93
91
|
|
|
92
|
+
base._defineProperty(this, "shimDisconnectKey", 'injected.shimDisconnect');
|
|
93
|
+
|
|
94
94
|
base._defineProperty(this, "onAccountsChanged", accounts => {
|
|
95
95
|
if (accounts.length === 0) this.emit('disconnect');else this.emit('change', {
|
|
96
96
|
account: utils.getAddress(accounts[0])
|
|
@@ -122,17 +122,15 @@ class InjectedConnector extends base.Connector {
|
|
|
122
122
|
|
|
123
123
|
this.emit('disconnect'); // Remove shim signalling wallet is disconnected
|
|
124
124
|
|
|
125
|
-
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage = getClient().storage) === null || _getClient$storage === void 0 ? void 0 : _getClient$storage.removeItem(shimDisconnectKey);
|
|
125
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage = getClient().storage) === null || _getClient$storage === void 0 ? void 0 : _getClient$storage.removeItem(this.shimDisconnectKey);
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
let name = 'Injected';
|
|
129
|
-
|
|
130
|
-
if (typeof window !== 'undefined') {
|
|
131
|
-
const overrideName = options.name;
|
|
129
|
+
const overrideName = options.name;
|
|
130
|
+
if (typeof overrideName === 'string') name = overrideName;else if (typeof window !== 'undefined') {
|
|
132
131
|
const detectedName = getInjectedName(window.ethereum);
|
|
133
|
-
if (overrideName) name =
|
|
132
|
+
if (overrideName) name = overrideName(detectedName);else name = typeof detectedName === 'string' ? detectedName : detectedName[0];
|
|
134
133
|
}
|
|
135
|
-
|
|
136
134
|
this.id = 'injected';
|
|
137
135
|
this.name = name;
|
|
138
136
|
}
|
|
@@ -169,7 +167,7 @@ class InjectedConnector extends base.Connector {
|
|
|
169
167
|
} // Add shim to storage signalling wallet is connected
|
|
170
168
|
|
|
171
169
|
|
|
172
|
-
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(shimDisconnectKey, true);
|
|
170
|
+
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(this.shimDisconnectKey, true);
|
|
173
171
|
return {
|
|
174
172
|
account,
|
|
175
173
|
chain: {
|
|
@@ -194,7 +192,7 @@ class InjectedConnector extends base.Connector {
|
|
|
194
192
|
provider.removeListener('chainChanged', this.onChainChanged);
|
|
195
193
|
provider.removeListener('disconnect', this.onDisconnect); // Remove shim signalling wallet is disconnected
|
|
196
194
|
|
|
197
|
-
if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.shimDisconnect) (_getClient$storage3 = getClient().storage) === null || _getClient$storage3 === void 0 ? void 0 : _getClient$storage3.removeItem(shimDisconnectKey);
|
|
195
|
+
if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.shimDisconnect) (_getClient$storage3 = getClient().storage) === null || _getClient$storage3 === void 0 ? void 0 : _getClient$storage3.removeItem(this.shimDisconnectKey);
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
async getAccount() {
|
|
@@ -230,7 +228,7 @@ class InjectedConnector extends base.Connector {
|
|
|
230
228
|
var _this$options5, _getClient$storage4;
|
|
231
229
|
|
|
232
230
|
if ((_this$options5 = this.options) !== null && _this$options5 !== void 0 && _this$options5.shimDisconnect && // If shim does not exist in storage, wallet is disconnected
|
|
233
|
-
!((_getClient$storage4 = getClient().storage) !== null && _getClient$storage4 !== void 0 && _getClient$storage4.getItem(shimDisconnectKey))) return false;
|
|
231
|
+
!((_getClient$storage4 = getClient().storage) !== null && _getClient$storage4 !== void 0 && _getClient$storage4.getItem(this.shimDisconnectKey))) return false;
|
|
234
232
|
const provider = await this.getProvider();
|
|
235
233
|
if (!provider) throw new base.ConnectorNotFoundError();
|
|
236
234
|
const accounts = await provider.request({
|
|
@@ -536,7 +534,13 @@ class Client {
|
|
|
536
534
|
|
|
537
535
|
base._classPrivateFieldSet(this, _isAutoConnecting, true);
|
|
538
536
|
|
|
539
|
-
|
|
537
|
+
this.setState(x => {
|
|
538
|
+
var _x$data;
|
|
539
|
+
|
|
540
|
+
return { ...x,
|
|
541
|
+
status: (_x$data = x.data) !== null && _x$data !== void 0 && _x$data.account ? 'reconnecting' : 'connecting'
|
|
542
|
+
};
|
|
543
|
+
}); // Try last used connector first
|
|
540
544
|
|
|
541
545
|
const sorted = base._classPrivateFieldGet(this, _lastUsedConnector) ? [...this.connectors].sort(x => x.id === base._classPrivateFieldGet(this, _lastUsedConnector) ? -1 : 1) : this.connectors;
|
|
542
546
|
let connected = false;
|
|
@@ -656,4 +660,3 @@ exports.createClient = createClient;
|
|
|
656
660
|
exports.createStorage = createStorage;
|
|
657
661
|
exports.getClient = getClient;
|
|
658
662
|
exports.noopStorage = noopStorage;
|
|
659
|
-
exports.shimDisconnectKey = shimDisconnectKey;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as Connector, _ as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, k as _classPrivateFieldGet, l as _classPrivateFieldSet, c as ConnectorNotFoundError, U as UserRejectedRequestError, R as ResourceUnavailableError, f as ChainNotConfiguredError, A as AddChainError, i as SwitchChainError, m as _classPrivateMethodInitSpec, o as _classPrivateMethodGet } from './base-
|
|
1
|
+
import { e as Connector, _ as _defineProperty, j as _classPrivateFieldInitSpec, n as normalizeChainId, k as _classPrivateFieldGet, l as _classPrivateFieldSet, c as ConnectorNotFoundError, U as UserRejectedRequestError, R as ResourceUnavailableError, f as ChainNotConfiguredError, A as AddChainError, i as SwitchChainError, m as _classPrivateMethodInitSpec, o as _classPrivateMethodGet } from './base-f1bbf263.esm.js';
|
|
2
2
|
import create from 'zustand/vanilla';
|
|
3
3
|
import { subscribeWithSelector, persist } from 'zustand/middleware';
|
|
4
4
|
import { providers } from 'ethers';
|
|
@@ -50,8 +50,6 @@ function getInjectedName(ethereum) {
|
|
|
50
50
|
return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const shimDisconnectKey = 'injected.shimDisconnect';
|
|
54
|
-
|
|
55
53
|
var _provider = /*#__PURE__*/new WeakMap();
|
|
56
54
|
|
|
57
55
|
var _switchingChains = /*#__PURE__*/new WeakMap();
|
|
@@ -85,6 +83,8 @@ class InjectedConnector extends Connector {
|
|
|
85
83
|
value: void 0
|
|
86
84
|
});
|
|
87
85
|
|
|
86
|
+
_defineProperty(this, "shimDisconnectKey", 'injected.shimDisconnect');
|
|
87
|
+
|
|
88
88
|
_defineProperty(this, "onAccountsChanged", accounts => {
|
|
89
89
|
if (accounts.length === 0) this.emit('disconnect');else this.emit('change', {
|
|
90
90
|
account: getAddress(accounts[0])
|
|
@@ -116,17 +116,15 @@ class InjectedConnector extends Connector {
|
|
|
116
116
|
|
|
117
117
|
this.emit('disconnect'); // Remove shim signalling wallet is disconnected
|
|
118
118
|
|
|
119
|
-
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage = getClient().storage) === null || _getClient$storage === void 0 ? void 0 : _getClient$storage.removeItem(shimDisconnectKey);
|
|
119
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage = getClient().storage) === null || _getClient$storage === void 0 ? void 0 : _getClient$storage.removeItem(this.shimDisconnectKey);
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
let name = 'Injected';
|
|
123
|
-
|
|
124
|
-
if (typeof window !== 'undefined') {
|
|
125
|
-
const overrideName = options.name;
|
|
123
|
+
const overrideName = options.name;
|
|
124
|
+
if (typeof overrideName === 'string') name = overrideName;else if (typeof window !== 'undefined') {
|
|
126
125
|
const detectedName = getInjectedName(window.ethereum);
|
|
127
|
-
if (overrideName) name =
|
|
126
|
+
if (overrideName) name = overrideName(detectedName);else name = typeof detectedName === 'string' ? detectedName : detectedName[0];
|
|
128
127
|
}
|
|
129
|
-
|
|
130
128
|
this.id = 'injected';
|
|
131
129
|
this.name = name;
|
|
132
130
|
}
|
|
@@ -163,7 +161,7 @@ class InjectedConnector extends Connector {
|
|
|
163
161
|
} // Add shim to storage signalling wallet is connected
|
|
164
162
|
|
|
165
163
|
|
|
166
|
-
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(shimDisconnectKey, true);
|
|
164
|
+
if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(this.shimDisconnectKey, true);
|
|
167
165
|
return {
|
|
168
166
|
account,
|
|
169
167
|
chain: {
|
|
@@ -188,7 +186,7 @@ class InjectedConnector extends Connector {
|
|
|
188
186
|
provider.removeListener('chainChanged', this.onChainChanged);
|
|
189
187
|
provider.removeListener('disconnect', this.onDisconnect); // Remove shim signalling wallet is disconnected
|
|
190
188
|
|
|
191
|
-
if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.shimDisconnect) (_getClient$storage3 = getClient().storage) === null || _getClient$storage3 === void 0 ? void 0 : _getClient$storage3.removeItem(shimDisconnectKey);
|
|
189
|
+
if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.shimDisconnect) (_getClient$storage3 = getClient().storage) === null || _getClient$storage3 === void 0 ? void 0 : _getClient$storage3.removeItem(this.shimDisconnectKey);
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
async getAccount() {
|
|
@@ -224,7 +222,7 @@ class InjectedConnector extends Connector {
|
|
|
224
222
|
var _this$options5, _getClient$storage4;
|
|
225
223
|
|
|
226
224
|
if ((_this$options5 = this.options) !== null && _this$options5 !== void 0 && _this$options5.shimDisconnect && // If shim does not exist in storage, wallet is disconnected
|
|
227
|
-
!((_getClient$storage4 = getClient().storage) !== null && _getClient$storage4 !== void 0 && _getClient$storage4.getItem(shimDisconnectKey))) return false;
|
|
225
|
+
!((_getClient$storage4 = getClient().storage) !== null && _getClient$storage4 !== void 0 && _getClient$storage4.getItem(this.shimDisconnectKey))) return false;
|
|
228
226
|
const provider = await this.getProvider();
|
|
229
227
|
if (!provider) throw new ConnectorNotFoundError();
|
|
230
228
|
const accounts = await provider.request({
|
|
@@ -530,7 +528,13 @@ class Client {
|
|
|
530
528
|
|
|
531
529
|
_classPrivateFieldSet(this, _isAutoConnecting, true);
|
|
532
530
|
|
|
533
|
-
|
|
531
|
+
this.setState(x => {
|
|
532
|
+
var _x$data;
|
|
533
|
+
|
|
534
|
+
return { ...x,
|
|
535
|
+
status: (_x$data = x.data) !== null && _x$data !== void 0 && _x$data.account ? 'reconnecting' : 'connecting'
|
|
536
|
+
};
|
|
537
|
+
}); // Try last used connector first
|
|
534
538
|
|
|
535
539
|
const sorted = _classPrivateFieldGet(this, _lastUsedConnector) ? [...this.connectors].sort(x => x.id === _classPrivateFieldGet(this, _lastUsedConnector) ? -1 : 1) : this.connectors;
|
|
536
540
|
let connected = false;
|
|
@@ -644,4 +648,4 @@ function getClient() {
|
|
|
644
648
|
return client;
|
|
645
649
|
}
|
|
646
650
|
|
|
647
|
-
export { Client as C, InjectedConnector as I, createStorage as a, createClient as c, getClient as g, noopStorage as n
|
|
651
|
+
export { Client as C, InjectedConnector as I, createStorage as a, createClient as c, getClient as g, noopStorage as n };
|
|
@@ -25,7 +25,7 @@ export declare type ClientConfig<TProvider extends Provider = Provider, TWebSock
|
|
|
25
25
|
}) => TWebSocketProvider | undefined) | TWebSocketProvider;
|
|
26
26
|
};
|
|
27
27
|
export declare type Data<TProvider extends Provider> = ConnectorData<TProvider>;
|
|
28
|
-
export declare type State<TProvider extends Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = {
|
|
28
|
+
export declare type State<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = {
|
|
29
29
|
chains?: Connector['chains'];
|
|
30
30
|
connector?: Connector;
|
|
31
31
|
connectors: Connector[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { InjectedConnector } from './injected';
|
|
1
|
+
export { InjectedConnector, type InjectedConnectorOptions } from './injected';
|
|
2
2
|
export { Connector, type ConnectorData, type ConnectorEvents } from './base';
|
|
@@ -18,12 +18,12 @@ export declare type InjectedConnectorOptions = {
|
|
|
18
18
|
*/
|
|
19
19
|
shimDisconnect?: boolean;
|
|
20
20
|
};
|
|
21
|
-
export declare const shimDisconnectKey = "injected.shimDisconnect";
|
|
22
21
|
export declare class InjectedConnector extends Connector<Window['ethereum'], InjectedConnectorOptions | undefined> {
|
|
23
22
|
#private;
|
|
24
23
|
readonly id: string;
|
|
25
24
|
readonly name: string;
|
|
26
25
|
readonly ready: boolean;
|
|
26
|
+
protected shimDisconnectKey: string;
|
|
27
27
|
constructor({ chains, options, }?: {
|
|
28
28
|
chains?: Chain[];
|
|
29
29
|
options?: InjectedConnectorOptions;
|
|
@@ -36,12 +36,12 @@ export declare class InjectedConnector extends Connector<Window['ethereum'], Inj
|
|
|
36
36
|
id: number;
|
|
37
37
|
unsupported: boolean;
|
|
38
38
|
};
|
|
39
|
-
provider: Ethereum;
|
|
39
|
+
provider: import("../types").Ethereum;
|
|
40
40
|
}>;
|
|
41
41
|
disconnect(): Promise<void>;
|
|
42
42
|
getAccount(): Promise<string>;
|
|
43
43
|
getChainId(): Promise<number>;
|
|
44
|
-
getProvider(): Promise<Ethereum | undefined>;
|
|
44
|
+
getProvider(): Promise<import("../types").Ethereum | undefined>;
|
|
45
45
|
getSigner(): Promise<providers.JsonRpcSigner>;
|
|
46
46
|
isAuthorized(): Promise<boolean>;
|
|
47
47
|
switchChain(chainId: number): Promise<Chain>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chain } from '../types';
|
|
1
|
+
import { Chain, Ethereum } from '../types';
|
|
2
2
|
import { InjectedConnector, InjectedConnectorOptions } from './injected';
|
|
3
3
|
export declare type MetaMaskConnectorOptions = Pick<InjectedConnectorOptions, 'shimChainChangedDisconnect' | 'shimDisconnect'> & {
|
|
4
4
|
/**
|
|
@@ -3,11 +3,11 @@ export type { ConnectArgs, ConnectResult, FetchBalanceArgs, FetchBalanceResult,
|
|
|
3
3
|
export { createClient, Client } from './client';
|
|
4
4
|
export type { ClientConfig } from './client';
|
|
5
5
|
export { Connector, InjectedConnector } from './connectors';
|
|
6
|
-
export type { ConnectorData, ConnectorEvents } from './connectors';
|
|
6
|
+
export type { ConnectorData, ConnectorEvents, InjectedConnectorOptions, } from './connectors';
|
|
7
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, ContractMethodNoResultError, 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';
|
|
11
|
-
export type { Chain, ChainProviderFn, FallbackProviderConfig, ProviderWithFallbackConfig, Provider, Unit, WebSocketProvider, } from './types';
|
|
11
|
+
export type { Chain, ChainProviderFn, Ethereum, FallbackProviderConfig, ProviderWithFallbackConfig, Provider, Unit, WebSocketProvider, } from './types';
|
|
12
12
|
export { configureChains, deepEqual, normalizeChainId, parseContractResult, } from './utils';
|
|
13
13
|
export type { ConfigureChainsConfig } from './utils';
|
|
@@ -49,139 +49,140 @@ export declare type WebSocketProvider = providers.WebSocketProvider & {
|
|
|
49
49
|
chains?: Chain[];
|
|
50
50
|
};
|
|
51
51
|
export declare type Unit = typeof units[number];
|
|
52
|
-
declare
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
decimals: number;
|
|
62
|
-
};
|
|
63
|
-
rpcUrls: string[];
|
|
64
|
-
blockExplorerUrls?: string[];
|
|
65
|
-
/** Currently ignored. */
|
|
66
|
-
iconUrls?: string[];
|
|
67
|
-
};
|
|
68
|
-
type WalletPermissionCaveat = {
|
|
69
|
-
type: string;
|
|
70
|
-
value: any;
|
|
52
|
+
declare type AddEthereumChainParameter = {
|
|
53
|
+
/** A 0x-prefixed hexadecimal string */
|
|
54
|
+
chainId: string;
|
|
55
|
+
chainName: string;
|
|
56
|
+
nativeCurrency?: {
|
|
57
|
+
name: string;
|
|
58
|
+
/** 2-6 characters long */
|
|
59
|
+
symbol: string;
|
|
60
|
+
decimals: number;
|
|
71
61
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
62
|
+
rpcUrls: string[];
|
|
63
|
+
blockExplorerUrls?: string[];
|
|
64
|
+
/** Currently ignored. */
|
|
65
|
+
iconUrls?: string[];
|
|
66
|
+
};
|
|
67
|
+
declare type WalletPermissionCaveat = {
|
|
68
|
+
type: string;
|
|
69
|
+
value: any;
|
|
70
|
+
};
|
|
71
|
+
declare type WalletPermission = {
|
|
72
|
+
caveats: WalletPermissionCaveat[];
|
|
73
|
+
date: number;
|
|
74
|
+
id: string;
|
|
75
|
+
invoker: `http://${string}` | `https://${string}`;
|
|
76
|
+
parentCapability: 'eth_accounts' | string;
|
|
77
|
+
};
|
|
78
|
+
declare type WatchAssetParams = {
|
|
79
|
+
/** In the future, other standards will be supported */
|
|
80
|
+
type: 'ERC20';
|
|
81
|
+
options: {
|
|
82
|
+
/** Address of token contract */
|
|
83
|
+
address: string;
|
|
84
|
+
/** Number of token decimals */
|
|
85
|
+
decimals: number;
|
|
86
|
+
/** String url of token logo */
|
|
87
|
+
image?: string;
|
|
88
|
+
/** A ticker symbol or shorthand, up to 5 characters */
|
|
89
|
+
symbol: string;
|
|
92
90
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
};
|
|
92
|
+
declare type InjectedProviderFlags = {
|
|
93
|
+
isBraveWallet?: true;
|
|
94
|
+
isCoinbaseWallet?: true;
|
|
95
|
+
isExodus?: true;
|
|
96
|
+
isFrame?: true;
|
|
97
|
+
isMetaMask?: true;
|
|
98
|
+
isOpera?: true;
|
|
99
|
+
isTally?: true;
|
|
100
|
+
isTokenPocket?: true;
|
|
101
|
+
isTokenary?: true;
|
|
102
|
+
isTrust?: true;
|
|
103
|
+
};
|
|
104
|
+
declare type InjectedProviders = InjectedProviderFlags & {
|
|
105
|
+
isMetaMask: true;
|
|
106
|
+
/** Only exists in MetaMask as of 2022/04/03 */
|
|
107
|
+
_events: {
|
|
108
|
+
connect?: () => void;
|
|
104
109
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
_state?: {
|
|
113
|
-
accounts?: string[];
|
|
114
|
-
initialized?: boolean;
|
|
115
|
-
isConnected?: boolean;
|
|
116
|
-
isPermanentlyDisconnected?: boolean;
|
|
117
|
-
isUnlocked?: boolean;
|
|
118
|
-
};
|
|
110
|
+
/** Only exists in MetaMask as of 2022/04/03 */
|
|
111
|
+
_state?: {
|
|
112
|
+
accounts?: string[];
|
|
113
|
+
initialized?: boolean;
|
|
114
|
+
isConnected?: boolean;
|
|
115
|
+
isPermanentlyDisconnected?: boolean;
|
|
116
|
+
isUnlocked?: boolean;
|
|
119
117
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
}
|
|
118
|
+
};
|
|
119
|
+
export interface Ethereum extends InjectedProviders {
|
|
120
|
+
on?: (...args: any[]) => void;
|
|
121
|
+
removeListener?: (...args: any[]) => void;
|
|
122
|
+
providers?: Ethereum[];
|
|
123
|
+
/**
|
|
124
|
+
* EIP-747: Add wallet_watchAsset to Provider
|
|
125
|
+
* https://eips.ethereum.org/EIPS/eip-747
|
|
126
|
+
*/
|
|
127
|
+
request(args: {
|
|
128
|
+
method: 'wallet_watchAsset';
|
|
129
|
+
params: WatchAssetParams;
|
|
130
|
+
}): Promise<boolean>;
|
|
131
|
+
/**
|
|
132
|
+
* EIP-1193: Ethereum Provider JavaScript API
|
|
133
|
+
* https://eips.ethereum.org/EIPS/eip-1193
|
|
134
|
+
*/
|
|
135
|
+
request(args: {
|
|
136
|
+
method: 'eth_accounts';
|
|
137
|
+
}): Promise<string[]>;
|
|
138
|
+
request(args: {
|
|
139
|
+
method: 'eth_chainId';
|
|
140
|
+
}): Promise<string>;
|
|
141
|
+
request(args: {
|
|
142
|
+
method: 'eth_requestAccounts';
|
|
143
|
+
}): Promise<string[]>;
|
|
144
|
+
/**
|
|
145
|
+
* EIP-1474: Remote procedure call specification
|
|
146
|
+
* https://eips.ethereum.org/EIPS/eip-1474
|
|
147
|
+
*/
|
|
148
|
+
request(args: {
|
|
149
|
+
method: 'web3_clientVersion';
|
|
150
|
+
}): Promise<string>;
|
|
151
|
+
/**
|
|
152
|
+
* EIP-2255: Wallet Permissions System
|
|
153
|
+
* https://eips.ethereum.org/EIPS/eip-2255
|
|
154
|
+
*/
|
|
155
|
+
request(args: {
|
|
156
|
+
method: 'wallet_requestPermissions';
|
|
157
|
+
params: [{
|
|
158
|
+
eth_accounts: Record<string, any>;
|
|
159
|
+
}];
|
|
160
|
+
}): Promise<WalletPermission[]>;
|
|
161
|
+
request(args: {
|
|
162
|
+
method: 'wallet_getPermissions';
|
|
163
|
+
}): Promise<WalletPermission[]>;
|
|
164
|
+
/**
|
|
165
|
+
* EIP-3085: Wallet Add Ethereum Chain RPC Method
|
|
166
|
+
* https://eips.ethereum.org/EIPS/eip-3085
|
|
167
|
+
*/
|
|
168
|
+
request(args: {
|
|
169
|
+
method: 'wallet_addEthereumChain';
|
|
170
|
+
params: AddEthereumChainParameter[];
|
|
171
|
+
}): Promise<null>;
|
|
172
|
+
/**
|
|
173
|
+
* EIP-3326: Wallet Switch Ethereum Chain RPC Method
|
|
174
|
+
* https://eips.ethereum.org/EIPS/eip-3326
|
|
175
|
+
*/
|
|
176
|
+
request(args: {
|
|
177
|
+
method: 'wallet_switchEthereumChain';
|
|
178
|
+
params: [{
|
|
179
|
+
chainId: string;
|
|
180
|
+
}];
|
|
181
|
+
}): Promise<null>;
|
|
182
|
+
}
|
|
183
|
+
declare global {
|
|
184
184
|
interface Window {
|
|
185
185
|
ethereum?: Ethereum;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
export {};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Ethereum } from '../types';
|
|
2
|
+
export declare function getInjectedName(ethereum?: Ethereum): string | string[];
|
|
@@ -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-4983a639.cjs.dev.js');
|
|
6
|
+
var base = require('./base-bd337280.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
11
|
var rpcs = require('./rpcs-f1d24f0e.cjs.dev.js');
|
|
12
|
-
var chains = require('./chains-
|
|
12
|
+
var chains = require('./chains-ba6218fb.cjs.dev.js');
|
|
13
13
|
require('zustand/vanilla');
|
|
14
14
|
require('zustand/middleware');
|
|
15
15
|
require('eventemitter3');
|
|
@@ -270,9 +270,12 @@ async function connect(_ref) {
|
|
|
270
270
|
connector
|
|
271
271
|
};
|
|
272
272
|
} catch (err) {
|
|
273
|
-
client$1.setState(x =>
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
client$1.setState(x => {
|
|
274
|
+
return { ...x,
|
|
275
|
+
// Keep existing connector connected in case of error
|
|
276
|
+
status: x.connector ? 'connected' : 'disconnected'
|
|
277
|
+
};
|
|
278
|
+
});
|
|
276
279
|
throw err;
|
|
277
280
|
}
|
|
278
281
|
}
|
|
@@ -1083,21 +1086,33 @@ async function fetchToken(_ref) {
|
|
|
1083
1086
|
chainId,
|
|
1084
1087
|
formatUnits: units = 'ether'
|
|
1085
1088
|
} = _ref;
|
|
1086
|
-
const
|
|
1089
|
+
const erc20Config = {
|
|
1090
|
+
addressOrName: address,
|
|
1091
|
+
contractInterface: erc20ABI,
|
|
1087
1092
|
chainId
|
|
1093
|
+
};
|
|
1094
|
+
const [decimals, name, symbol, totalSupply] = await readContracts({
|
|
1095
|
+
allowFailure: false,
|
|
1096
|
+
contracts: [{ ...erc20Config,
|
|
1097
|
+
functionName: 'decimals'
|
|
1098
|
+
}, { ...erc20Config,
|
|
1099
|
+
functionName: 'name'
|
|
1100
|
+
}, { ...erc20Config,
|
|
1101
|
+
functionName: 'symbol'
|
|
1102
|
+
}, { ...erc20Config,
|
|
1103
|
+
functionName: 'totalSupply'
|
|
1104
|
+
}]
|
|
1088
1105
|
});
|
|
1089
|
-
|
|
1090
|
-
const [symbol, decimals, totalSupply] = await Promise.all([contract.symbol(), contract.decimals(), contract.totalSupply()]);
|
|
1091
|
-
const token = {
|
|
1106
|
+
return {
|
|
1092
1107
|
address,
|
|
1093
1108
|
decimals,
|
|
1109
|
+
name,
|
|
1094
1110
|
symbol,
|
|
1095
1111
|
totalSupply: {
|
|
1096
1112
|
formatted: utils.formatUnits(totalSupply, units),
|
|
1097
1113
|
value: totalSupply
|
|
1098
1114
|
}
|
|
1099
1115
|
};
|
|
1100
|
-
return token;
|
|
1101
1116
|
}
|
|
1102
1117
|
|
|
1103
1118
|
async function sendTransaction(_ref) {
|
|
@@ -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-dfad744f.cjs.prod.js');
|
|
6
|
+
var base = require('./base-337e6424.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
11
|
var rpcs = require('./rpcs-1fd0a12f.cjs.prod.js');
|
|
12
|
-
var chains = require('./chains-
|
|
12
|
+
var chains = require('./chains-b8e32454.cjs.prod.js');
|
|
13
13
|
require('zustand/vanilla');
|
|
14
14
|
require('zustand/middleware');
|
|
15
15
|
require('eventemitter3');
|
|
@@ -270,9 +270,12 @@ async function connect(_ref) {
|
|
|
270
270
|
connector
|
|
271
271
|
};
|
|
272
272
|
} catch (err) {
|
|
273
|
-
client$1.setState(x =>
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
client$1.setState(x => {
|
|
274
|
+
return { ...x,
|
|
275
|
+
// Keep existing connector connected in case of error
|
|
276
|
+
status: x.connector ? 'connected' : 'disconnected'
|
|
277
|
+
};
|
|
278
|
+
});
|
|
276
279
|
throw err;
|
|
277
280
|
}
|
|
278
281
|
}
|
|
@@ -1083,21 +1086,33 @@ async function fetchToken(_ref) {
|
|
|
1083
1086
|
chainId,
|
|
1084
1087
|
formatUnits: units = 'ether'
|
|
1085
1088
|
} = _ref;
|
|
1086
|
-
const
|
|
1089
|
+
const erc20Config = {
|
|
1090
|
+
addressOrName: address,
|
|
1091
|
+
contractInterface: erc20ABI,
|
|
1087
1092
|
chainId
|
|
1093
|
+
};
|
|
1094
|
+
const [decimals, name, symbol, totalSupply] = await readContracts({
|
|
1095
|
+
allowFailure: false,
|
|
1096
|
+
contracts: [{ ...erc20Config,
|
|
1097
|
+
functionName: 'decimals'
|
|
1098
|
+
}, { ...erc20Config,
|
|
1099
|
+
functionName: 'name'
|
|
1100
|
+
}, { ...erc20Config,
|
|
1101
|
+
functionName: 'symbol'
|
|
1102
|
+
}, { ...erc20Config,
|
|
1103
|
+
functionName: 'totalSupply'
|
|
1104
|
+
}]
|
|
1088
1105
|
});
|
|
1089
|
-
|
|
1090
|
-
const [symbol, decimals, totalSupply] = await Promise.all([contract.symbol(), contract.decimals(), contract.totalSupply()]);
|
|
1091
|
-
const token = {
|
|
1106
|
+
return {
|
|
1092
1107
|
address,
|
|
1093
1108
|
decimals,
|
|
1109
|
+
name,
|
|
1094
1110
|
symbol,
|
|
1095
1111
|
totalSupply: {
|
|
1096
1112
|
formatted: utils.formatUnits(totalSupply, units),
|
|
1097
1113
|
value: totalSupply
|
|
1098
1114
|
}
|
|
1099
1115
|
};
|
|
1100
|
-
return token;
|
|
1101
1116
|
}
|
|
1102
1117
|
|
|
1103
1118
|
async function sendTransaction(_ref) {
|
package/dist/wagmi-core.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { g as getClient } from './client-
|
|
2
|
-
export { C as Client, I as InjectedConnector, c as createClient, a as createStorage, n as noopStorage } from './client-
|
|
3
|
-
import { C as ConnectorAlreadyConnectedError, P as ProviderChainsNotFound, a as ChainDoesNotSupportMulticallError, b as ContractMethodNoResultError, c as ConnectorNotFoundError, d as ChainMismatchError, U as UserRejectedRequestError, n as normalizeChainId, S as SwitchChainNotSupportedError } from './base-
|
|
4
|
-
export { A as AddChainError, a as ChainDoesNotSupportMulticallError, d as ChainMismatchError, f as ChainNotConfiguredError, e as Connector, C as ConnectorAlreadyConnectedError, c as ConnectorNotFoundError, b as ContractMethodNoResultError, P as ProviderChainsNotFound, g as ProviderRpcError, R as ResourceUnavailableError, h as RpcError, i as SwitchChainError, S as SwitchChainNotSupportedError, U as UserRejectedRequestError, n as normalizeChainId } from './base-
|
|
1
|
+
import { g as getClient } from './client-fbdcbdb2.esm.js';
|
|
2
|
+
export { C as Client, I as InjectedConnector, c as createClient, a as createStorage, n as noopStorage } from './client-fbdcbdb2.esm.js';
|
|
3
|
+
import { C as ConnectorAlreadyConnectedError, P as ProviderChainsNotFound, a as ChainDoesNotSupportMulticallError, b as ContractMethodNoResultError, c as ConnectorNotFoundError, d as ChainMismatchError, U as UserRejectedRequestError, n as normalizeChainId, S as SwitchChainNotSupportedError } from './base-f1bbf263.esm.js';
|
|
4
|
+
export { A as AddChainError, a as ChainDoesNotSupportMulticallError, d as ChainMismatchError, f as ChainNotConfiguredError, e as Connector, C as ConnectorAlreadyConnectedError, c as ConnectorNotFoundError, b as ContractMethodNoResultError, P as ProviderChainsNotFound, g as ProviderRpcError, R as ResourceUnavailableError, h as RpcError, i as SwitchChainError, S as SwitchChainNotSupportedError, U as UserRejectedRequestError, n as normalizeChainId } from './base-f1bbf263.esm.js';
|
|
5
5
|
import { Contract, logger } from 'ethers/lib/ethers';
|
|
6
6
|
import { isAddress, Logger, formatUnits, getAddress } from 'ethers/lib/utils';
|
|
7
7
|
import { providers, Contract as Contract$1 } from 'ethers';
|
|
8
8
|
import shallow from 'zustand/shallow';
|
|
9
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-
|
|
10
|
+
export { a as allChains, c as chain, b as chainId, d as defaultChains, e as defaultL2Chains, f as etherscanBlockExplorers } from './chains-174cf4b4.esm.js';
|
|
11
11
|
import 'zustand/vanilla';
|
|
12
12
|
import 'zustand/middleware';
|
|
13
13
|
import 'eventemitter3';
|
|
@@ -264,9 +264,12 @@ async function connect(_ref) {
|
|
|
264
264
|
connector
|
|
265
265
|
};
|
|
266
266
|
} catch (err) {
|
|
267
|
-
client.setState(x =>
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
client.setState(x => {
|
|
268
|
+
return { ...x,
|
|
269
|
+
// Keep existing connector connected in case of error
|
|
270
|
+
status: x.connector ? 'connected' : 'disconnected'
|
|
271
|
+
};
|
|
272
|
+
});
|
|
270
273
|
throw err;
|
|
271
274
|
}
|
|
272
275
|
}
|
|
@@ -1077,21 +1080,33 @@ async function fetchToken(_ref) {
|
|
|
1077
1080
|
chainId,
|
|
1078
1081
|
formatUnits: units = 'ether'
|
|
1079
1082
|
} = _ref;
|
|
1080
|
-
const
|
|
1083
|
+
const erc20Config = {
|
|
1084
|
+
addressOrName: address,
|
|
1085
|
+
contractInterface: erc20ABI,
|
|
1081
1086
|
chainId
|
|
1087
|
+
};
|
|
1088
|
+
const [decimals, name, symbol, totalSupply] = await readContracts({
|
|
1089
|
+
allowFailure: false,
|
|
1090
|
+
contracts: [{ ...erc20Config,
|
|
1091
|
+
functionName: 'decimals'
|
|
1092
|
+
}, { ...erc20Config,
|
|
1093
|
+
functionName: 'name'
|
|
1094
|
+
}, { ...erc20Config,
|
|
1095
|
+
functionName: 'symbol'
|
|
1096
|
+
}, { ...erc20Config,
|
|
1097
|
+
functionName: 'totalSupply'
|
|
1098
|
+
}]
|
|
1082
1099
|
});
|
|
1083
|
-
|
|
1084
|
-
const [symbol, decimals, totalSupply] = await Promise.all([contract.symbol(), contract.decimals(), contract.totalSupply()]);
|
|
1085
|
-
const token = {
|
|
1100
|
+
return {
|
|
1086
1101
|
address,
|
|
1087
1102
|
decimals,
|
|
1103
|
+
name,
|
|
1088
1104
|
symbol,
|
|
1089
1105
|
totalSupply: {
|
|
1090
1106
|
formatted: formatUnits(totalSupply, units),
|
|
1091
1107
|
value: totalSupply
|
|
1092
1108
|
}
|
|
1093
1109
|
};
|
|
1094
|
-
return token;
|
|
1095
1110
|
}
|
|
1096
1111
|
|
|
1097
1112
|
async function sendTransaction(_ref) {
|