@wagmi/core 0.3.7 → 0.4.0-test.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chains/dist/wagmi-core-chains.cjs.dev.js +2 -1
- package/chains/dist/wagmi-core-chains.cjs.prod.js +2 -1
- package/chains/dist/wagmi-core-chains.esm.js +1 -1
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +2 -3
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +2 -3
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +2 -3
- package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.d.ts +1 -0
- package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.dev.js +200 -0
- package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.js +7 -0
- package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.prod.js +200 -0
- package/connectors/injected/dist/wagmi-core-connectors-injected.esm.js +196 -0
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +3 -4
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +3 -4
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +3 -4
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +3 -8
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +3 -8
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +2 -3
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +3 -4
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +3 -4
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +3 -4
- package/connectors/walletLink/dist/wagmi-core-connectors-walletLink.cjs.d.ts +11 -0
- package/connectors/walletLink/dist/wagmi-core-connectors-walletLink.cjs.js +16 -0
- package/dist/base-7f682723.cjs.prod.js +623 -0
- package/dist/base-ae774f26.cjs.dev.js +623 -0
- package/dist/base-c546f171.esm.js +603 -0
- package/dist/{chains-1b1bdb4e.cjs.dev.js → chains-7e369752.cjs.dev.js} +19 -8
- package/dist/{chains-01801dff.cjs.prod.js → chains-d045862c.cjs.prod.js} +19 -8
- package/dist/{chains-541a65cc.esm.js → chains-fa406563.esm.js} +19 -9
- package/dist/{client-b9a38d26.cjs.dev.js → client-42cf11b7.cjs.dev.js} +3 -2
- package/dist/{client-ba0c162e.esm.js → client-60ee0298.esm.js} +3 -2
- package/dist/{client-d8761bad.cjs.prod.js → client-ed3aaa6a.cjs.prod.js} +3 -2
- package/dist/declarations/src/chains.d.ts +1 -1
- package/dist/declarations/src/connectors/base.d.ts +1 -1
- package/dist/declarations/src/connectors/mock/provider.d.ts +1 -2
- package/dist/declarations/src/constants/chains.d.ts +3 -0
- package/dist/declarations/src/types/index.d.ts +1 -0
- package/dist/declarations/src/utils/eventemitter.d.ts +135 -0
- package/dist/wagmi-core.cjs.dev.js +4 -5
- package/dist/wagmi-core.cjs.prod.js +4 -5
- package/dist/wagmi-core.esm.js +7 -8
- package/package.json +1 -2
- package/dist/base-147e77ca.cjs.dev.js +0 -290
- package/dist/base-f5e9d7e7.cjs.prod.js +0 -290
- package/dist/base-f818d190.esm.js +0 -267
|
@@ -62,7 +62,8 @@ const chainId = {
|
|
|
62
62
|
arbitrum: 42161,
|
|
63
63
|
arbitrumRinkeby: 421611,
|
|
64
64
|
localhost: 1337,
|
|
65
|
-
hardhat: 31337
|
|
65
|
+
hardhat: 31337,
|
|
66
|
+
foundry: 31337
|
|
66
67
|
};
|
|
67
68
|
const mainnet = {
|
|
68
69
|
id: chainId.mainnet,
|
|
@@ -91,7 +92,7 @@ const ropsten = {
|
|
|
91
92
|
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
92
93
|
nativeCurrency: {
|
|
93
94
|
name: 'Ropsten Ether',
|
|
94
|
-
symbol: '
|
|
95
|
+
symbol: 'ROP',
|
|
95
96
|
decimals: 18
|
|
96
97
|
},
|
|
97
98
|
rpcUrls: {
|
|
@@ -112,7 +113,7 @@ const rinkeby = {
|
|
|
112
113
|
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
113
114
|
nativeCurrency: {
|
|
114
115
|
name: 'Rinkeby Ether',
|
|
115
|
-
symbol: '
|
|
116
|
+
symbol: 'RIN',
|
|
116
117
|
decimals: 18
|
|
117
118
|
},
|
|
118
119
|
rpcUrls: {
|
|
@@ -133,7 +134,7 @@ const goerli = {
|
|
|
133
134
|
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
134
135
|
nativeCurrency: {
|
|
135
136
|
name: 'Goerli Ether',
|
|
136
|
-
symbol: '
|
|
137
|
+
symbol: 'GOR',
|
|
137
138
|
decimals: 18
|
|
138
139
|
},
|
|
139
140
|
rpcUrls: {
|
|
@@ -153,7 +154,7 @@ const kovan = {
|
|
|
153
154
|
network: 'kovan',
|
|
154
155
|
nativeCurrency: {
|
|
155
156
|
name: 'Kovan Ether',
|
|
156
|
-
symbol: '
|
|
157
|
+
symbol: 'KOV',
|
|
157
158
|
decimals: 18
|
|
158
159
|
},
|
|
159
160
|
rpcUrls: {
|
|
@@ -247,11 +248,11 @@ const polygonMumbai = {
|
|
|
247
248
|
};
|
|
248
249
|
const arbitrum = {
|
|
249
250
|
id: chainId.arbitrum,
|
|
250
|
-
name: 'Arbitrum',
|
|
251
|
+
name: 'Arbitrum One',
|
|
251
252
|
network: 'arbitrum',
|
|
252
253
|
nativeCurrency: {
|
|
253
254
|
name: 'Ether',
|
|
254
|
-
symbol: '
|
|
255
|
+
symbol: 'ETH',
|
|
255
256
|
decimals: 18
|
|
256
257
|
},
|
|
257
258
|
rpcUrls: {
|
|
@@ -308,6 +309,14 @@ const hardhat = {
|
|
|
308
309
|
default: 'http://127.0.0.1:8545'
|
|
309
310
|
}
|
|
310
311
|
};
|
|
312
|
+
const foundry = {
|
|
313
|
+
id: chainId.hardhat,
|
|
314
|
+
name: 'Foundry',
|
|
315
|
+
network: 'foundry',
|
|
316
|
+
rpcUrls: {
|
|
317
|
+
default: 'http://127.0.0.1:8545'
|
|
318
|
+
}
|
|
319
|
+
};
|
|
311
320
|
/**
|
|
312
321
|
* Common chains for convenience
|
|
313
322
|
* Should not contain all possible chains
|
|
@@ -326,7 +335,8 @@ const chain = {
|
|
|
326
335
|
arbitrum,
|
|
327
336
|
arbitrumRinkeby,
|
|
328
337
|
localhost,
|
|
329
|
-
hardhat
|
|
338
|
+
hardhat,
|
|
339
|
+
foundry
|
|
330
340
|
};
|
|
331
341
|
const allChains = Object.values(chain);
|
|
332
342
|
const defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
@@ -340,6 +350,7 @@ exports.chainId = chainId;
|
|
|
340
350
|
exports.defaultChains = defaultChains;
|
|
341
351
|
exports.defaultL2Chains = defaultL2Chains;
|
|
342
352
|
exports.etherscanBlockExplorers = etherscanBlockExplorers;
|
|
353
|
+
exports.foundry = foundry;
|
|
343
354
|
exports.goerli = goerli;
|
|
344
355
|
exports.hardhat = hardhat;
|
|
345
356
|
exports.kovan = kovan;
|
|
@@ -60,7 +60,8 @@ const chainId = {
|
|
|
60
60
|
arbitrum: 42161,
|
|
61
61
|
arbitrumRinkeby: 421611,
|
|
62
62
|
localhost: 1337,
|
|
63
|
-
hardhat: 31337
|
|
63
|
+
hardhat: 31337,
|
|
64
|
+
foundry: 31337
|
|
64
65
|
};
|
|
65
66
|
const mainnet = {
|
|
66
67
|
id: chainId.mainnet,
|
|
@@ -89,7 +90,7 @@ const ropsten = {
|
|
|
89
90
|
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
90
91
|
nativeCurrency: {
|
|
91
92
|
name: 'Ropsten Ether',
|
|
92
|
-
symbol: '
|
|
93
|
+
symbol: 'ROP',
|
|
93
94
|
decimals: 18
|
|
94
95
|
},
|
|
95
96
|
rpcUrls: {
|
|
@@ -110,7 +111,7 @@ const rinkeby = {
|
|
|
110
111
|
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
111
112
|
nativeCurrency: {
|
|
112
113
|
name: 'Rinkeby Ether',
|
|
113
|
-
symbol: '
|
|
114
|
+
symbol: 'RIN',
|
|
114
115
|
decimals: 18
|
|
115
116
|
},
|
|
116
117
|
rpcUrls: {
|
|
@@ -131,7 +132,7 @@ const goerli = {
|
|
|
131
132
|
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
132
133
|
nativeCurrency: {
|
|
133
134
|
name: 'Goerli Ether',
|
|
134
|
-
symbol: '
|
|
135
|
+
symbol: 'GOR',
|
|
135
136
|
decimals: 18
|
|
136
137
|
},
|
|
137
138
|
rpcUrls: {
|
|
@@ -151,7 +152,7 @@ const kovan = {
|
|
|
151
152
|
network: 'kovan',
|
|
152
153
|
nativeCurrency: {
|
|
153
154
|
name: 'Kovan Ether',
|
|
154
|
-
symbol: '
|
|
155
|
+
symbol: 'KOV',
|
|
155
156
|
decimals: 18
|
|
156
157
|
},
|
|
157
158
|
rpcUrls: {
|
|
@@ -245,11 +246,11 @@ const polygonMumbai = {
|
|
|
245
246
|
};
|
|
246
247
|
const arbitrum = {
|
|
247
248
|
id: chainId.arbitrum,
|
|
248
|
-
name: 'Arbitrum',
|
|
249
|
+
name: 'Arbitrum One',
|
|
249
250
|
network: 'arbitrum',
|
|
250
251
|
nativeCurrency: {
|
|
251
252
|
name: 'Ether',
|
|
252
|
-
symbol: '
|
|
253
|
+
symbol: 'ETH',
|
|
253
254
|
decimals: 18
|
|
254
255
|
},
|
|
255
256
|
rpcUrls: {
|
|
@@ -306,6 +307,14 @@ const hardhat = {
|
|
|
306
307
|
default: 'http://127.0.0.1:8545'
|
|
307
308
|
}
|
|
308
309
|
};
|
|
310
|
+
const foundry = {
|
|
311
|
+
id: chainId.hardhat,
|
|
312
|
+
name: 'Foundry',
|
|
313
|
+
network: 'foundry',
|
|
314
|
+
rpcUrls: {
|
|
315
|
+
default: 'http://127.0.0.1:8545'
|
|
316
|
+
}
|
|
317
|
+
};
|
|
309
318
|
/**
|
|
310
319
|
* Common chains for convenience
|
|
311
320
|
* Should not contain all possible chains
|
|
@@ -324,10 +333,11 @@ const chain = {
|
|
|
324
333
|
arbitrum,
|
|
325
334
|
arbitrumRinkeby,
|
|
326
335
|
localhost,
|
|
327
|
-
hardhat
|
|
336
|
+
hardhat,
|
|
337
|
+
foundry
|
|
328
338
|
};
|
|
329
339
|
const allChains = Object.values(chain);
|
|
330
340
|
const defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
|
|
331
341
|
const defaultL2Chains = [chain.arbitrum, chain.arbitrumRinkeby, chain.optimism, chain.optimismKovan];
|
|
332
342
|
|
|
333
|
-
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,
|
|
343
|
+
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 };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-ae774f26.cjs.dev.js');
|
|
4
4
|
var ethers = require('ethers');
|
|
5
5
|
var create = require('zustand/vanilla');
|
|
6
6
|
var middleware = require('zustand/middleware');
|
|
7
7
|
var utils = require('ethers/lib/utils');
|
|
8
|
-
var chains = require('./chains-
|
|
8
|
+
var chains = require('./chains-7e369752.cjs.dev.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -19,6 +19,7 @@ function getInjectedName(ethereum) {
|
|
|
19
19
|
const getName = provider => {
|
|
20
20
|
if (provider.isBraveWallet) return 'Brave Wallet';
|
|
21
21
|
if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
|
|
22
|
+
if (provider.isExodus) return 'Exodus';
|
|
22
23
|
if (provider.isFrame) return 'Frame';
|
|
23
24
|
if (provider.isOpera) return 'Opera';
|
|
24
25
|
if (provider.isTally) return 'Tally';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { b as Connector, _ as _classPrivateMethodInitSpec, f as _defineProperty, g as _classPrivateFieldInitSpec, n as normalizeChainId, h as _classPrivateFieldGet, i as _classPrivateFieldSet, a as ConnectorNotFoundError, j as _classPrivateMethodGet, U as UserRejectedRequestError, R as ResourceUnavailableError, c as ChainNotConfiguredError, A as AddChainError, e as SwitchChainError } from './base-
|
|
1
|
+
import { b as Connector, _ as _classPrivateMethodInitSpec, f as _defineProperty, g as _classPrivateFieldInitSpec, n as normalizeChainId, h as _classPrivateFieldGet, i as _classPrivateFieldSet, a as ConnectorNotFoundError, j as _classPrivateMethodGet, U as UserRejectedRequestError, R as ResourceUnavailableError, c as ChainNotConfiguredError, A as AddChainError, e as SwitchChainError } from './base-c546f171.esm.js';
|
|
2
2
|
import { providers, getDefaultProvider } from 'ethers';
|
|
3
3
|
import create from 'zustand/vanilla';
|
|
4
4
|
import { subscribeWithSelector, persist } from 'zustand/middleware';
|
|
5
5
|
import { getAddress, hexValue } from 'ethers/lib/utils';
|
|
6
|
-
import { a as allChains } from './chains-
|
|
6
|
+
import { a as allChains } from './chains-fa406563.esm.js';
|
|
7
7
|
|
|
8
8
|
function getInjectedName(ethereum) {
|
|
9
9
|
var _ethereum$providers, _getName;
|
|
@@ -13,6 +13,7 @@ function getInjectedName(ethereum) {
|
|
|
13
13
|
const getName = provider => {
|
|
14
14
|
if (provider.isBraveWallet) return 'Brave Wallet';
|
|
15
15
|
if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
|
|
16
|
+
if (provider.isExodus) return 'Exodus';
|
|
16
17
|
if (provider.isFrame) return 'Frame';
|
|
17
18
|
if (provider.isOpera) return 'Opera';
|
|
18
19
|
if (provider.isTally) return 'Tally';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-7f682723.cjs.prod.js');
|
|
4
4
|
var ethers = require('ethers');
|
|
5
5
|
var create = require('zustand/vanilla');
|
|
6
6
|
var middleware = require('zustand/middleware');
|
|
7
7
|
var utils = require('ethers/lib/utils');
|
|
8
|
-
var chains = require('./chains-
|
|
8
|
+
var chains = require('./chains-d045862c.cjs.prod.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -19,6 +19,7 @@ function getInjectedName(ethereum) {
|
|
|
19
19
|
const getName = provider => {
|
|
20
20
|
if (provider.isBraveWallet) return 'Brave Wallet';
|
|
21
21
|
if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
|
|
22
|
+
if (provider.isExodus) return 'Exodus';
|
|
22
23
|
if (provider.isFrame) return 'Frame';
|
|
23
24
|
if (provider.isOpera) return 'Opera';
|
|
24
25
|
if (provider.isTally) return 'Tally';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { arbitrum, arbitrumRinkeby, goerli, hardhat, kovan, localhost, mainnet, optimism, optimismKovan, polygon, polygonMumbai, rinkeby, ropsten, } from './constants/chains';
|
|
1
|
+
export { arbitrum, arbitrumRinkeby, foundry, goerli, hardhat, kovan, localhost, mainnet, optimism, optimismKovan, polygon, polygonMumbai, rinkeby, ropsten, } from './constants/chains';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as EventEmitter } from 'eventemitter3';
|
|
2
1
|
import { Signer } from 'ethers/lib/ethers';
|
|
2
|
+
import { EventEmitter } from '../utils/eventemitter';
|
|
3
3
|
import { Chain } from '../types';
|
|
4
4
|
export declare type ConnectorData<Provider = any> = {
|
|
5
5
|
account?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { default as EventEmitter } from 'eventemitter3';
|
|
2
1
|
import { Signer, providers } from 'ethers';
|
|
3
2
|
export declare type MockProviderOptions = {
|
|
4
3
|
chainId?: number;
|
|
@@ -18,7 +17,7 @@ declare type Events = {
|
|
|
18
17
|
declare type Event = keyof Events;
|
|
19
18
|
export declare class MockProvider extends providers.BaseProvider {
|
|
20
19
|
#private;
|
|
21
|
-
events:
|
|
20
|
+
events: import("../../utils/eventemitter")<Events, any>;
|
|
22
21
|
constructor(options: MockProviderOptions);
|
|
23
22
|
enable(): Promise<string[]>;
|
|
24
23
|
disconnect(): Promise<void>;
|
|
@@ -13,6 +13,7 @@ export declare const chainId: {
|
|
|
13
13
|
readonly arbitrumRinkeby: 421611;
|
|
14
14
|
readonly localhost: 1337;
|
|
15
15
|
readonly hardhat: 31337;
|
|
16
|
+
readonly foundry: 31337;
|
|
16
17
|
};
|
|
17
18
|
export declare type ChainName = keyof typeof chainId;
|
|
18
19
|
export declare const mainnet: Chain;
|
|
@@ -28,6 +29,7 @@ export declare const arbitrum: Chain;
|
|
|
28
29
|
export declare const arbitrumRinkeby: Chain;
|
|
29
30
|
export declare const localhost: Chain;
|
|
30
31
|
export declare const hardhat: Chain;
|
|
32
|
+
export declare const foundry: Chain;
|
|
31
33
|
/**
|
|
32
34
|
* Common chains for convenience
|
|
33
35
|
* Should not contain all possible chains
|
|
@@ -46,6 +48,7 @@ export declare const chain: {
|
|
|
46
48
|
readonly arbitrumRinkeby: Chain;
|
|
47
49
|
readonly localhost: Chain;
|
|
48
50
|
readonly hardhat: Chain;
|
|
51
|
+
readonly foundry: Chain;
|
|
49
52
|
};
|
|
50
53
|
export declare const allChains: Chain[];
|
|
51
54
|
export declare const defaultChains: Chain[];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
3
|
+
* `EventEmitter` interface.
|
|
4
|
+
*/
|
|
5
|
+
declare class EventEmitter<
|
|
6
|
+
EventTypes extends EventEmitter.ValidEventTypes = string | symbol,
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
8
|
+
Context extends any = any,
|
|
9
|
+
> {
|
|
10
|
+
static prefixed: string | boolean
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Return an array listing the events for which the emitter has registered
|
|
14
|
+
* listeners.
|
|
15
|
+
*/
|
|
16
|
+
eventNames(): Array<EventEmitter.EventNames<EventTypes>>
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Return the listeners registered for a given event.
|
|
20
|
+
*/
|
|
21
|
+
listeners<T extends EventEmitter.EventNames<EventTypes>>(
|
|
22
|
+
event: T,
|
|
23
|
+
): Array<EventEmitter.EventListener<EventTypes, T>>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Return the number of listeners listening to a given event.
|
|
27
|
+
*/
|
|
28
|
+
listenerCount(event: EventEmitter.EventNames<EventTypes>): number
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Calls each of the listeners registered for a given event.
|
|
32
|
+
*/
|
|
33
|
+
emit<T extends EventEmitter.EventNames<EventTypes>>(
|
|
34
|
+
event: T,
|
|
35
|
+
...args: EventEmitter.EventArgs<EventTypes, T>
|
|
36
|
+
): boolean
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Add a listener for a given event.
|
|
40
|
+
*/
|
|
41
|
+
on<T extends EventEmitter.EventNames<EventTypes>>(
|
|
42
|
+
event: T,
|
|
43
|
+
fn: EventEmitter.EventListener<EventTypes, T>,
|
|
44
|
+
context?: Context,
|
|
45
|
+
): this
|
|
46
|
+
addListener<T extends EventEmitter.EventNames<EventTypes>>(
|
|
47
|
+
event: T,
|
|
48
|
+
fn: EventEmitter.EventListener<EventTypes, T>,
|
|
49
|
+
context?: Context,
|
|
50
|
+
): this
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Add a one-time listener for a given event.
|
|
54
|
+
*/
|
|
55
|
+
once<T extends EventEmitter.EventNames<EventTypes>>(
|
|
56
|
+
event: T,
|
|
57
|
+
fn: EventEmitter.EventListener<EventTypes, T>,
|
|
58
|
+
context?: Context,
|
|
59
|
+
): this
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Remove the listeners of a given event.
|
|
63
|
+
*/
|
|
64
|
+
removeListener<T extends EventEmitter.EventNames<EventTypes>>(
|
|
65
|
+
event: T,
|
|
66
|
+
fn?: EventEmitter.EventListener<EventTypes, T>,
|
|
67
|
+
context?: Context,
|
|
68
|
+
once?: boolean,
|
|
69
|
+
): this
|
|
70
|
+
off<T extends EventEmitter.EventNames<EventTypes>>(
|
|
71
|
+
event: T,
|
|
72
|
+
fn?: EventEmitter.EventListener<EventTypes, T>,
|
|
73
|
+
context?: Context,
|
|
74
|
+
once?: boolean,
|
|
75
|
+
): this
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Remove all listeners, or those of the specified event.
|
|
79
|
+
*/
|
|
80
|
+
removeAllListeners(event?: EventEmitter.EventNames<EventTypes>): this
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare namespace EventEmitter {
|
|
84
|
+
export interface ListenerFn<Args extends any[] = any[]> {
|
|
85
|
+
(...args: Args): void
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface EventEmitterStatic {
|
|
89
|
+
new <
|
|
90
|
+
EventTypes extends ValidEventTypes = string | symbol,
|
|
91
|
+
Context = any,
|
|
92
|
+
>(): EventEmitter<EventTypes, Context>
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* `object` should be in either of the following forms:
|
|
97
|
+
* ```
|
|
98
|
+
* interface EventTypes {
|
|
99
|
+
* 'event-with-parameters': any[]
|
|
100
|
+
* 'event-with-example-handler': (...args: any[]) => void
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export type ValidEventTypes = string | symbol | object
|
|
105
|
+
|
|
106
|
+
export type EventNames<T extends ValidEventTypes> = T extends string | symbol
|
|
107
|
+
? T
|
|
108
|
+
: keyof T
|
|
109
|
+
|
|
110
|
+
export type ArgumentMap<T extends object> = {
|
|
111
|
+
[K in keyof T]: T[K] extends (...args: any[]) => void
|
|
112
|
+
? Parameters<T[K]>
|
|
113
|
+
: T[K] extends any[]
|
|
114
|
+
? T[K]
|
|
115
|
+
: any[]
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type EventListener<
|
|
119
|
+
T extends ValidEventTypes,
|
|
120
|
+
K extends EventNames<T>,
|
|
121
|
+
> = T extends string | symbol
|
|
122
|
+
? (...args: any[]) => void
|
|
123
|
+
: (
|
|
124
|
+
...args: ArgumentMap<Exclude<T, string | symbol>>[Extract<K, keyof T>]
|
|
125
|
+
) => void
|
|
126
|
+
|
|
127
|
+
export type EventArgs<
|
|
128
|
+
T extends ValidEventTypes,
|
|
129
|
+
K extends EventNames<T>,
|
|
130
|
+
> = Parameters<EventListener<T, K>>
|
|
131
|
+
|
|
132
|
+
export const EventEmitter: EventEmitterStatic
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export = EventEmitter
|
|
@@ -2,16 +2,15 @@
|
|
|
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-42cf11b7.cjs.dev.js');
|
|
6
|
+
var base = require('./base-ae774f26.cjs.dev.js');
|
|
7
7
|
var ethers$1 = require('ethers/lib/ethers');
|
|
8
8
|
var utils = require('ethers/lib/utils');
|
|
9
|
-
var chains = require('./chains-
|
|
9
|
+
var chains = require('./chains-7e369752.cjs.dev.js');
|
|
10
10
|
var ethers = require('ethers');
|
|
11
11
|
var rpcs = require('./rpcs-9c4eb960.cjs.dev.js');
|
|
12
12
|
require('zustand/vanilla');
|
|
13
13
|
require('zustand/middleware');
|
|
14
|
-
require('eventemitter3');
|
|
15
14
|
|
|
16
15
|
// https://ethereum.org/en/developers/docs/standards/tokens/erc-20
|
|
17
16
|
const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721
|
|
@@ -413,7 +412,7 @@ async function readContract(contractConfig, functionName) {
|
|
|
413
412
|
});
|
|
414
413
|
const params = [...(Array.isArray(args) ? args : args ? [args] : []), ...(overrides ? [overrides] : [])];
|
|
415
414
|
const contractFunction = contract[functionName];
|
|
416
|
-
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
415
|
+
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not exist in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
417
416
|
const response = await (contractFunction === null || contractFunction === void 0 ? void 0 : contractFunction(...params));
|
|
418
417
|
return response;
|
|
419
418
|
}
|
|
@@ -2,16 +2,15 @@
|
|
|
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-ed3aaa6a.cjs.prod.js');
|
|
6
|
+
var base = require('./base-7f682723.cjs.prod.js');
|
|
7
7
|
var ethers$1 = require('ethers/lib/ethers');
|
|
8
8
|
var utils = require('ethers/lib/utils');
|
|
9
|
-
var chains = require('./chains-
|
|
9
|
+
var chains = require('./chains-d045862c.cjs.prod.js');
|
|
10
10
|
var ethers = require('ethers');
|
|
11
11
|
var rpcs = require('./rpcs-b3c52116.cjs.prod.js');
|
|
12
12
|
require('zustand/vanilla');
|
|
13
13
|
require('zustand/middleware');
|
|
14
|
-
require('eventemitter3');
|
|
15
14
|
|
|
16
15
|
// https://ethereum.org/en/developers/docs/standards/tokens/erc-20
|
|
17
16
|
const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721
|
|
@@ -413,7 +412,7 @@ async function readContract(contractConfig, functionName) {
|
|
|
413
412
|
});
|
|
414
413
|
const params = [...(Array.isArray(args) ? args : args ? [args] : []), ...(overrides ? [overrides] : [])];
|
|
415
414
|
const contractFunction = contract[functionName];
|
|
416
|
-
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
415
|
+
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not exist in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
417
416
|
const response = await (contractFunction === null || contractFunction === void 0 ? void 0 : contractFunction(...params));
|
|
418
417
|
return response;
|
|
419
418
|
}
|
package/dist/wagmi-core.esm.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { c as client, g as getClient } from './client-
|
|
2
|
-
export { C as Client, I as InjectedConnector, a as createClient, b as createStorage, n as noopStorage } from './client-
|
|
3
|
-
import { C as ConnectorAlreadyConnectedError, a as ConnectorNotFoundError, U as UserRejectedRequestError, S as SwitchChainNotSupportedError } from './base-
|
|
4
|
-
export { A as AddChainError, c as ChainNotConfiguredError, b as Connector, C as ConnectorAlreadyConnectedError, a as ConnectorNotFoundError, P as ProviderRpcError, R as ResourceUnavailableError, d as RpcError, e as SwitchChainError, S as SwitchChainNotSupportedError, U as UserRejectedRequestError, n as normalizeChainId } from './base-
|
|
1
|
+
import { c as client, g as getClient } from './client-60ee0298.esm.js';
|
|
2
|
+
export { C as Client, I as InjectedConnector, a as createClient, b as createStorage, n as noopStorage } from './client-60ee0298.esm.js';
|
|
3
|
+
import { C as ConnectorAlreadyConnectedError, a as ConnectorNotFoundError, U as UserRejectedRequestError, S as SwitchChainNotSupportedError } from './base-c546f171.esm.js';
|
|
4
|
+
export { A as AddChainError, c as ChainNotConfiguredError, b as Connector, C as ConnectorAlreadyConnectedError, a as ConnectorNotFoundError, P as ProviderRpcError, R as ResourceUnavailableError, d as RpcError, e as SwitchChainError, S as SwitchChainNotSupportedError, U as UserRejectedRequestError, n as normalizeChainId } from './base-c546f171.esm.js';
|
|
5
5
|
import { Contract } from 'ethers/lib/ethers';
|
|
6
6
|
import { formatUnits, getAddress } from 'ethers/lib/utils';
|
|
7
|
-
import { a as allChains } from './chains-
|
|
8
|
-
export { a as allChains, c as chain, b as chainId, d as defaultChains, e as defaultL2Chains, f as etherscanBlockExplorers } from './chains-
|
|
7
|
+
import { a as allChains } from './chains-fa406563.esm.js';
|
|
8
|
+
export { a as allChains, c as chain, b as chainId, d as defaultChains, e as defaultL2Chains, f as etherscanBlockExplorers } from './chains-fa406563.esm.js';
|
|
9
9
|
import { providers, Contract as Contract$1 } from 'ethers';
|
|
10
10
|
export { a as alchemyRpcUrls, i as infuraRpcUrls } from './rpcs-7cfbd91c.esm.js';
|
|
11
11
|
import 'zustand/vanilla';
|
|
12
12
|
import 'zustand/middleware';
|
|
13
|
-
import 'eventemitter3';
|
|
14
13
|
|
|
15
14
|
// https://ethereum.org/en/developers/docs/standards/tokens/erc-20
|
|
16
15
|
const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721
|
|
@@ -412,7 +411,7 @@ async function readContract(contractConfig, functionName) {
|
|
|
412
411
|
});
|
|
413
412
|
const params = [...(Array.isArray(args) ? args : args ? [args] : []), ...(overrides ? [overrides] : [])];
|
|
414
413
|
const contractFunction = contract[functionName];
|
|
415
|
-
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
414
|
+
if (!contractFunction) console.warn("\"".concat(functionName, "\" does not exist in interface for contract \"").concat(contractConfig.addressOrName, "\""));
|
|
416
415
|
const response = await (contractFunction === null || contractFunction === void 0 ? void 0 : contractFunction(...params));
|
|
417
416
|
return response;
|
|
418
417
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@wagmi/core",
|
|
3
3
|
"description": "Vanilla JS library for Ethereum",
|
|
4
4
|
"license": "WAGMIT",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4.0-test.1",
|
|
6
6
|
"repository": "tmm/wagmi",
|
|
7
7
|
"author": "awkweb.eth",
|
|
8
8
|
"ethereum": "awkweb.eth",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"eventemitter3": "^4.0.7",
|
|
90
89
|
"zustand": "^4.0.0-rc.1"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|