@wagmi/core 0.2.0-next.7 → 0.2.0
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/LICENSE +2 -2
- package/README.md +30 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +135 -154
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +135 -154
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +136 -155
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +98 -152
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +98 -152
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +98 -152
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +91 -126
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +91 -126
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +91 -126
- package/dist/base-30d4fad4.cjs.prod.js +544 -0
- package/dist/base-a0d63eb0.cjs.dev.js +544 -0
- package/dist/base-f0102d32.esm.js +517 -0
- package/dist/{classPrivateMethodGet-0e9a7925.cjs.prod.js → classPrivateMethodGet-656c08a7.cjs.prod.js} +1 -1
- package/dist/{classPrivateMethodGet-38b54c7a.cjs.dev.js → classPrivateMethodGet-9b9cd39b.cjs.dev.js} +1 -1
- package/dist/{classPrivateMethodGet-c9db96d6.esm.js → classPrivateMethodGet-e0eaacfc.esm.js} +1 -1
- package/dist/declarations/src/actions/accounts/connect.d.ts +14 -5
- package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +3 -1
- package/dist/declarations/src/actions/accounts/fetchSigner.d.ts +1 -1
- package/dist/declarations/src/actions/accounts/getAccount.d.ts +5 -4
- package/dist/declarations/src/actions/accounts/index.d.ts +1 -2
- package/dist/declarations/src/actions/accounts/switchNetwork.d.ts +1 -1
- package/dist/declarations/src/actions/accounts/watchAccount.d.ts +3 -2
- package/dist/declarations/src/actions/contracts/readContract.d.ts +4 -1
- package/dist/declarations/src/actions/contracts/watchContractEvent.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsAddress.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsAvatar.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsName.d.ts +3 -1
- package/dist/declarations/src/actions/ens/fetchEnsResolver.d.ts +3 -1
- package/dist/declarations/src/actions/ens/index.d.ts +0 -4
- package/dist/declarations/src/actions/index.d.ts +5 -5
- package/dist/declarations/src/actions/network-status/fetchBlockNumber.d.ts +4 -1
- package/dist/declarations/src/actions/network-status/fetchFeeData.d.ts +3 -1
- package/dist/declarations/src/actions/network-status/index.d.ts +1 -2
- package/dist/declarations/src/actions/providers/getProvider.d.ts +6 -2
- package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +6 -2
- package/dist/declarations/src/actions/providers/index.d.ts +2 -2
- package/dist/declarations/src/actions/providers/watchProvider.d.ts +4 -3
- package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +4 -3
- package/dist/declarations/src/actions/tokens/fetchToken.d.ts +6 -10
- package/dist/declarations/src/actions/tokens/index.d.ts +0 -1
- package/dist/declarations/src/actions/transactions/waitForTransaction.d.ts +3 -1
- package/dist/declarations/src/client.d.ts +23 -22
- package/dist/declarations/src/connectors/base.d.ts +3 -1
- package/dist/declarations/src/connectors/coinbaseWallet.d.ts +9 -0
- package/dist/declarations/src/connectors/injected.d.ts +2 -10
- package/dist/declarations/src/connectors/mock/connector.d.ts +1 -1
- package/dist/declarations/src/connectors/mock/provider.d.ts +2 -0
- package/dist/declarations/src/constants/abis.d.ts +2 -0
- package/dist/declarations/src/constants/blockExplorers.d.ts +9 -0
- package/dist/declarations/src/constants/chains.d.ts +17 -6
- package/dist/declarations/src/constants/index.d.ts +6 -2
- package/dist/declarations/src/constants/rpcs.d.ts +9 -0
- package/dist/declarations/src/index.d.ts +9 -6
- package/dist/declarations/src/types/index.d.ts +77 -6
- package/dist/declarations/src/utils/getInjectedName.d.ts +1 -1
- package/dist/wagmi-core.cjs.dev.js +658 -1153
- package/dist/wagmi-core.cjs.prod.js +658 -1153
- package/dist/wagmi-core.esm.js +653 -1147
- package/package.json +17 -9
- package/dist/base-09a653f3.cjs.dev.js +0 -453
- package/dist/base-824c3b6d.esm.js +0 -430
- package/dist/base-d8123d5f.cjs.prod.js +0 -453
- package/dist/declarations/src/actions/accounts/watchBalance.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsAddress.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsAvatar.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsName.d.ts +0 -3
- package/dist/declarations/src/actions/ens/watchEnsResolver.d.ts +0 -3
- package/dist/declarations/src/actions/network-status/watchFeeData.d.ts +0 -7
- package/dist/declarations/src/actions/tokens/watchToken.d.ts +0 -3
- package/dist/declarations/src/constants/abis/erc1155.d.ts +0 -17
- package/dist/declarations/src/constants/abis/erc20.d.ts +0 -38
- package/dist/declarations/src/constants/abis/erc721.d.ts +0 -15
- package/dist/declarations/src/constants/abis/index.d.ts +0 -3
- package/dist/declarations/src/types/declarations.d.ts +0 -52
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wagmi/core",
|
|
3
|
-
"description": "
|
|
4
|
-
"license": "
|
|
5
|
-
"version": "0.2.0
|
|
3
|
+
"description": "Vanilla JS library for Ethereum",
|
|
4
|
+
"license": "WAGMIT",
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"author": "awkweb.eth",
|
|
6
7
|
"ethereum": "awkweb.eth",
|
|
7
8
|
"repository": "tmm/wagmi",
|
|
8
9
|
"sideEffects": false,
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
]
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
|
-
"@coinbase/wallet-sdk": ">=3.0.
|
|
46
|
+
"@coinbase/wallet-sdk": ">=3.0.6",
|
|
46
47
|
"@walletconnect/ethereum-provider": ">=1.7.5",
|
|
47
48
|
"ethers": ">=5.5.1"
|
|
48
49
|
},
|
|
@@ -56,12 +57,19 @@
|
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
59
|
"eventemitter3": "^4.0.7",
|
|
59
|
-
"zustand": "^
|
|
60
|
+
"zustand": "^4.0.0-rc.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
|
-
"@coinbase/wallet-sdk": "^3.0.
|
|
63
|
-
"@ethersproject/providers": "^5.5.1",
|
|
63
|
+
"@coinbase/wallet-sdk": "^3.0.8",
|
|
64
64
|
"@walletconnect/ethereum-provider": "1.7.5",
|
|
65
|
-
"ethers": "^5.
|
|
66
|
-
}
|
|
65
|
+
"ethers": "^5.6.4"
|
|
66
|
+
},
|
|
67
|
+
"keywords": [
|
|
68
|
+
"eth",
|
|
69
|
+
"ethereum",
|
|
70
|
+
"dapps",
|
|
71
|
+
"wallet",
|
|
72
|
+
"web3"
|
|
73
|
+
],
|
|
74
|
+
"readme": "# @wagmi/core\n\n## Documentation\n\nFor full documentation and examples, visit [wagmi.sh](https://wagmi.sh).\n\n## Installation\n\nInstall wagmi and its ethers peer dependency.\n\n```bash\nnpm install @wagmi/core ethers\n```\n\n## Community\n\nCheck out the following places for more wagmi-related content:\n\n- Join the [discussions on GitHub](https://github.com/tmm/wagmi/discussions)\n- Follow [@awkweb](https://twitter.com/awkweb) on Twitter for project updates\n- Sign the [guestbook](https://github.com/tmm/wagmi/discussions/2)\n- Share [your project/organization](https://github.com/tmm/wagmi/discussions/201) using wagmi\n\n## Support\n\nIf you find wagmi useful, please consider supporting development. Thank you 🙏\n\n- [awkweb.eth](https://etherscan.io/enslookup-search?search=awkweb.eth)\n- [GitHub Sponsors](https://github.com/sponsors/tmm?metadata_campaign=readme_core)\n- [Gitcoin Grant](https://gitcoin.co/grants/4493/wagmi-react-hooks-library-for-ethereum)\n"
|
|
67
75
|
}
|
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var EventEmitter = require('eventemitter3');
|
|
4
|
-
|
|
5
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
6
|
-
|
|
7
|
-
var EventEmitter__default = /*#__PURE__*/_interopDefault(EventEmitter);
|
|
8
|
-
|
|
9
|
-
function _defineProperty(obj, key, value) {
|
|
10
|
-
if (key in obj) {
|
|
11
|
-
Object.defineProperty(obj, key, {
|
|
12
|
-
value: value,
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true
|
|
16
|
-
});
|
|
17
|
-
} else {
|
|
18
|
-
obj[key] = value;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return obj;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
25
|
-
try {
|
|
26
|
-
var info = gen[key](arg);
|
|
27
|
-
var value = info.value;
|
|
28
|
-
} catch (error) {
|
|
29
|
-
reject(error);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (info.done) {
|
|
34
|
-
resolve(value);
|
|
35
|
-
} else {
|
|
36
|
-
Promise.resolve(value).then(_next, _throw);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _asyncToGenerator(fn) {
|
|
41
|
-
return function () {
|
|
42
|
-
var self = this,
|
|
43
|
-
args = arguments;
|
|
44
|
-
return new Promise(function (resolve, reject) {
|
|
45
|
-
var gen = fn.apply(self, args);
|
|
46
|
-
|
|
47
|
-
function _next(value) {
|
|
48
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _throw(err) {
|
|
52
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_next(undefined);
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
61
|
-
if (privateCollection.has(obj)) {
|
|
62
|
-
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
67
|
-
_checkPrivateRedeclaration(obj, privateMap);
|
|
68
|
-
privateMap.set(obj, value);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
72
|
-
if (descriptor.get) {
|
|
73
|
-
return descriptor.get.call(receiver);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return descriptor.value;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
80
|
-
if (!privateMap.has(receiver)) {
|
|
81
|
-
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return privateMap.get(receiver);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function _classPrivateFieldGet(receiver, privateMap) {
|
|
88
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
89
|
-
return _classApplyDescriptorGet(receiver, descriptor);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
93
|
-
if (descriptor.set) {
|
|
94
|
-
descriptor.set.call(receiver, value);
|
|
95
|
-
} else {
|
|
96
|
-
if (!descriptor.writable) {
|
|
97
|
-
throw new TypeError("attempted to set read only private field");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
descriptor.value = value;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
105
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
106
|
-
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
107
|
-
return value;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Data from Chainlist
|
|
112
|
-
* @see https://chainlist.org
|
|
113
|
-
*/
|
|
114
|
-
var chain = {
|
|
115
|
-
mainnet: {
|
|
116
|
-
id: 1,
|
|
117
|
-
name: 'Mainnet',
|
|
118
|
-
nativeCurrency: {
|
|
119
|
-
name: 'Ether',
|
|
120
|
-
symbol: 'ETH',
|
|
121
|
-
decimals: 18
|
|
122
|
-
},
|
|
123
|
-
rpcUrls: ['https://mainnet.infura.io/v3'],
|
|
124
|
-
blockExplorers: [{
|
|
125
|
-
name: 'Etherscan',
|
|
126
|
-
url: 'https://etherscan.io'
|
|
127
|
-
}]
|
|
128
|
-
},
|
|
129
|
-
ropsten: {
|
|
130
|
-
id: 3,
|
|
131
|
-
name: 'Ropsten',
|
|
132
|
-
nativeCurrency: {
|
|
133
|
-
name: 'Ropsten Ether',
|
|
134
|
-
symbol: 'ropETH',
|
|
135
|
-
decimals: 18
|
|
136
|
-
},
|
|
137
|
-
rpcUrls: ['https://ropsten.infura.io/v3'],
|
|
138
|
-
blockExplorers: [{
|
|
139
|
-
name: 'Etherscan',
|
|
140
|
-
url: 'https://ropsten.etherscan.io'
|
|
141
|
-
}],
|
|
142
|
-
testnet: true
|
|
143
|
-
},
|
|
144
|
-
rinkeby: {
|
|
145
|
-
id: 4,
|
|
146
|
-
name: 'Rinkeby',
|
|
147
|
-
nativeCurrency: {
|
|
148
|
-
name: 'Rinkeby Ether',
|
|
149
|
-
symbol: 'rETH',
|
|
150
|
-
decimals: 18
|
|
151
|
-
},
|
|
152
|
-
rpcUrls: ['https://rinkeby.infura.io/v3'],
|
|
153
|
-
blockExplorers: [{
|
|
154
|
-
name: 'Etherscan',
|
|
155
|
-
url: 'https://rinkeby.etherscan.io'
|
|
156
|
-
}],
|
|
157
|
-
testnet: true
|
|
158
|
-
},
|
|
159
|
-
goerli: {
|
|
160
|
-
id: 5,
|
|
161
|
-
name: 'Goerli',
|
|
162
|
-
nativeCurrency: {
|
|
163
|
-
name: 'Goerli Ether',
|
|
164
|
-
symbol: 'gETH',
|
|
165
|
-
decimals: 18
|
|
166
|
-
},
|
|
167
|
-
rpcUrls: ['https://goerli.infura.io/v3'],
|
|
168
|
-
blockExplorers: [{
|
|
169
|
-
name: 'Etherscan',
|
|
170
|
-
url: 'https://goerli.etherscan.io'
|
|
171
|
-
}],
|
|
172
|
-
testnet: true
|
|
173
|
-
},
|
|
174
|
-
kovan: {
|
|
175
|
-
id: 42,
|
|
176
|
-
name: 'Kovan',
|
|
177
|
-
nativeCurrency: {
|
|
178
|
-
name: 'Kovan Ether',
|
|
179
|
-
symbol: 'kETH',
|
|
180
|
-
decimals: 18
|
|
181
|
-
},
|
|
182
|
-
rpcUrls: ['https://kovan.infura.io/v3'],
|
|
183
|
-
blockExplorers: [{
|
|
184
|
-
name: 'Etherscan',
|
|
185
|
-
url: 'https://kovan.etherscan.io'
|
|
186
|
-
}],
|
|
187
|
-
testnet: true
|
|
188
|
-
},
|
|
189
|
-
optimism: {
|
|
190
|
-
id: 10,
|
|
191
|
-
name: 'Optimism',
|
|
192
|
-
nativeCurrency: {
|
|
193
|
-
name: 'Ether',
|
|
194
|
-
symbol: 'ETH',
|
|
195
|
-
decimals: 18
|
|
196
|
-
},
|
|
197
|
-
rpcUrls: ['https://mainnet.optimism.io'],
|
|
198
|
-
blockExplorers: [{
|
|
199
|
-
name: 'Etherscan',
|
|
200
|
-
url: 'https://optimistic.etherscan.io'
|
|
201
|
-
}]
|
|
202
|
-
},
|
|
203
|
-
optimismKovan: {
|
|
204
|
-
id: 69,
|
|
205
|
-
name: 'Optimism Kovan',
|
|
206
|
-
nativeCurrency: {
|
|
207
|
-
name: 'Kovan Ether',
|
|
208
|
-
symbol: 'KOR',
|
|
209
|
-
decimals: 18
|
|
210
|
-
},
|
|
211
|
-
rpcUrls: ['https://kovan.optimism.io'],
|
|
212
|
-
blockExplorers: [{
|
|
213
|
-
name: 'Etherscan',
|
|
214
|
-
url: 'https://kovan-optimistic.etherscan.io'
|
|
215
|
-
}],
|
|
216
|
-
testnet: true
|
|
217
|
-
},
|
|
218
|
-
polygonMainnet: {
|
|
219
|
-
id: 137,
|
|
220
|
-
name: 'Polygon Mainnet',
|
|
221
|
-
nativeCurrency: {
|
|
222
|
-
name: 'MATIC',
|
|
223
|
-
symbol: 'MATIC',
|
|
224
|
-
decimals: 18
|
|
225
|
-
},
|
|
226
|
-
rpcUrls: ['https://polygon-rpc.com', 'https://rpc-mainnet.matic.network', 'https://matic-mainnet.chainstacklabs.com', 'https://rpc-mainnet.maticvigil.com', 'https://rpc-mainnet.matic.quiknode.pro', 'https://matic-mainnet-full-rpc.bwarelabs.com'],
|
|
227
|
-
blockExplorers: [{
|
|
228
|
-
name: 'Polygonscan',
|
|
229
|
-
url: 'https://polygonscan.com'
|
|
230
|
-
}]
|
|
231
|
-
},
|
|
232
|
-
polygonTestnetMumbai: {
|
|
233
|
-
id: 80001,
|
|
234
|
-
name: 'Mumbai',
|
|
235
|
-
nativeCurrency: {
|
|
236
|
-
name: 'MATIC',
|
|
237
|
-
symbol: 'MATIC',
|
|
238
|
-
decimals: 18
|
|
239
|
-
},
|
|
240
|
-
rpcUrls: ['https://matic-mumbai.chainstacklabs.com', 'https://rpc-mumbai.maticvigil.com', 'https://matic-testnet-archive-rpc.bwarelabs.com'],
|
|
241
|
-
blockExplorers: [{
|
|
242
|
-
name: 'Polygonscan',
|
|
243
|
-
url: 'https://mumbai.polygonscan.com'
|
|
244
|
-
}],
|
|
245
|
-
testnet: true
|
|
246
|
-
},
|
|
247
|
-
arbitrumOne: {
|
|
248
|
-
id: 42161,
|
|
249
|
-
name: 'Arbitrum One',
|
|
250
|
-
nativeCurrency: {
|
|
251
|
-
name: 'Ether',
|
|
252
|
-
symbol: 'AETH',
|
|
253
|
-
decimals: 18
|
|
254
|
-
},
|
|
255
|
-
rpcUrls: ['https://arb1.arbitrum.io/rpc'],
|
|
256
|
-
blockExplorers: [{
|
|
257
|
-
name: 'Arbiscan',
|
|
258
|
-
url: 'https://arbiscan.io'
|
|
259
|
-
}, {
|
|
260
|
-
name: 'Arbitrum Explorer',
|
|
261
|
-
url: 'https://explorer.arbitrum.io'
|
|
262
|
-
}]
|
|
263
|
-
},
|
|
264
|
-
arbitrumRinkeby: {
|
|
265
|
-
id: 421611,
|
|
266
|
-
name: 'Arbitrum Rinkeby',
|
|
267
|
-
nativeCurrency: {
|
|
268
|
-
name: 'Arbitrum Rinkeby Ether',
|
|
269
|
-
symbol: 'ARETH',
|
|
270
|
-
decimals: 18
|
|
271
|
-
},
|
|
272
|
-
rpcUrls: ['https://rinkeby.arbitrum.io/rpc'],
|
|
273
|
-
blockExplorers: [{
|
|
274
|
-
name: 'Arbitrum Explorer',
|
|
275
|
-
url: 'https://rinkeby-explorer.arbitrum.io'
|
|
276
|
-
}],
|
|
277
|
-
testnet: true
|
|
278
|
-
},
|
|
279
|
-
avalanche: {
|
|
280
|
-
id: 43114,
|
|
281
|
-
name: 'Avalanche Mainnet',
|
|
282
|
-
nativeCurrency: {
|
|
283
|
-
name: 'Avalanche',
|
|
284
|
-
symbol: 'AVAX',
|
|
285
|
-
decimals: 18
|
|
286
|
-
},
|
|
287
|
-
rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'],
|
|
288
|
-
blockExplorers: [{
|
|
289
|
-
name: 'SnowTrace',
|
|
290
|
-
url: 'https://snowtrace.io'
|
|
291
|
-
}],
|
|
292
|
-
testnet: false
|
|
293
|
-
},
|
|
294
|
-
avalancheFuji: {
|
|
295
|
-
id: 43113,
|
|
296
|
-
name: 'Avalanche Fuji Testnet',
|
|
297
|
-
nativeCurrency: {
|
|
298
|
-
name: 'Avalanche',
|
|
299
|
-
symbol: 'AVAX',
|
|
300
|
-
decimals: 18
|
|
301
|
-
},
|
|
302
|
-
rpcUrls: ['https://api.avax-test.network/ext/bc/C/rpc'],
|
|
303
|
-
blockExplorers: [{
|
|
304
|
-
name: 'SnowTrace',
|
|
305
|
-
url: 'https://testnet.snowtrace.io'
|
|
306
|
-
}],
|
|
307
|
-
testnet: true
|
|
308
|
-
},
|
|
309
|
-
localhost: {
|
|
310
|
-
id: 1337,
|
|
311
|
-
name: 'Localhost',
|
|
312
|
-
rpcUrls: ['https://127.0.0.1:8545']
|
|
313
|
-
},
|
|
314
|
-
hardhat: {
|
|
315
|
-
id: 31337,
|
|
316
|
-
name: 'Hardhat',
|
|
317
|
-
rpcUrls: ['http://127.0.0.1:8545']
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
var allChains = Object.values(chain);
|
|
321
|
-
var defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
322
|
-
|
|
323
|
-
function normalizeChainId(chainId) {
|
|
324
|
-
if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
|
|
325
|
-
return chainId;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
class AddChainError extends Error {
|
|
329
|
-
constructor() {
|
|
330
|
-
super(...arguments);
|
|
331
|
-
|
|
332
|
-
_defineProperty(this, "name", 'AddChainError');
|
|
333
|
-
|
|
334
|
-
_defineProperty(this, "message", 'Error adding chain');
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
class ChainNotConfiguredError extends Error {
|
|
339
|
-
constructor() {
|
|
340
|
-
super(...arguments);
|
|
341
|
-
|
|
342
|
-
_defineProperty(this, "name", 'ChainNotConfigured');
|
|
343
|
-
|
|
344
|
-
_defineProperty(this, "message", 'Chain not configured');
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
class ConnectorAlreadyConnectedError extends Error {
|
|
349
|
-
constructor() {
|
|
350
|
-
super(...arguments);
|
|
351
|
-
|
|
352
|
-
_defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
|
|
353
|
-
|
|
354
|
-
_defineProperty(this, "message", 'Connector already connected');
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
class ConnectorNotFoundError extends Error {
|
|
359
|
-
constructor() {
|
|
360
|
-
super(...arguments);
|
|
361
|
-
|
|
362
|
-
_defineProperty(this, "name", 'ConnectorNotFoundError');
|
|
363
|
-
|
|
364
|
-
_defineProperty(this, "message", 'Connector not found');
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
class SwitchChainError extends Error {
|
|
369
|
-
constructor() {
|
|
370
|
-
super(...arguments);
|
|
371
|
-
|
|
372
|
-
_defineProperty(this, "name", 'SwitchChainError');
|
|
373
|
-
|
|
374
|
-
_defineProperty(this, "message", 'Error switching chain');
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
class SwitchChainNotSupportedError extends Error {
|
|
379
|
-
constructor() {
|
|
380
|
-
super(...arguments);
|
|
381
|
-
|
|
382
|
-
_defineProperty(this, "name", 'SwitchChainNotSupportedError');
|
|
383
|
-
|
|
384
|
-
_defineProperty(this, "message", 'Switch chain not supported by connector');
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
class UserRejectedRequestError extends Error {
|
|
389
|
-
constructor() {
|
|
390
|
-
super(...arguments);
|
|
391
|
-
|
|
392
|
-
_defineProperty(this, "name", 'UserRejectedRequestError');
|
|
393
|
-
|
|
394
|
-
_defineProperty(this, "message", 'User rejected request');
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
class Connector extends EventEmitter__default["default"] {
|
|
400
|
-
/** Unique connector id */
|
|
401
|
-
|
|
402
|
-
/** Connector name */
|
|
403
|
-
|
|
404
|
-
/** Chains connector supports */
|
|
405
|
-
|
|
406
|
-
/** Options to use with connector */
|
|
407
|
-
|
|
408
|
-
/** Whether connector is usable */
|
|
409
|
-
constructor(_ref) {
|
|
410
|
-
var {
|
|
411
|
-
chains = defaultChains,
|
|
412
|
-
options
|
|
413
|
-
} = _ref;
|
|
414
|
-
super();
|
|
415
|
-
|
|
416
|
-
_defineProperty(this, "id", void 0);
|
|
417
|
-
|
|
418
|
-
_defineProperty(this, "name", void 0);
|
|
419
|
-
|
|
420
|
-
_defineProperty(this, "chains", void 0);
|
|
421
|
-
|
|
422
|
-
_defineProperty(this, "options", void 0);
|
|
423
|
-
|
|
424
|
-
_defineProperty(this, "ready", void 0);
|
|
425
|
-
|
|
426
|
-
this.chains = chains;
|
|
427
|
-
this.options = options;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
isChainUnsupported(chainId) {
|
|
431
|
-
return !this.chains.some(x => x.id === chainId);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
exports.AddChainError = AddChainError;
|
|
437
|
-
exports.ChainNotConfiguredError = ChainNotConfiguredError;
|
|
438
|
-
exports.Connector = Connector;
|
|
439
|
-
exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError;
|
|
440
|
-
exports.ConnectorNotFoundError = ConnectorNotFoundError;
|
|
441
|
-
exports.SwitchChainError = SwitchChainError;
|
|
442
|
-
exports.SwitchChainNotSupportedError = SwitchChainNotSupportedError;
|
|
443
|
-
exports.UserRejectedRequestError = UserRejectedRequestError;
|
|
444
|
-
exports._asyncToGenerator = _asyncToGenerator;
|
|
445
|
-
exports._checkPrivateRedeclaration = _checkPrivateRedeclaration;
|
|
446
|
-
exports._classPrivateFieldGet = _classPrivateFieldGet;
|
|
447
|
-
exports._classPrivateFieldInitSpec = _classPrivateFieldInitSpec;
|
|
448
|
-
exports._classPrivateFieldSet = _classPrivateFieldSet;
|
|
449
|
-
exports._defineProperty = _defineProperty;
|
|
450
|
-
exports.allChains = allChains;
|
|
451
|
-
exports.chain = chain;
|
|
452
|
-
exports.defaultChains = defaultChains;
|
|
453
|
-
exports.normalizeChainId = normalizeChainId;
|