@wagmi/core 0.9.2-cjs → 0.9.3
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/dist/chains.d.ts +1 -1
- package/dist/chains.js +91 -87
- package/dist/chunk-55IO54NW.js +242 -242
- package/dist/chunk-BVC4KGLQ.js +8 -8
- package/dist/chunk-EQOEZP46.js +5 -5
- package/dist/chunk-KFW652VN.js +6 -6
- package/dist/chunk-KX4UEHS5.js +0 -1
- package/dist/chunk-LH5WKLUU.js +92 -0
- package/dist/chunk-MQXBDTVK.js +7 -7
- package/dist/connectors/coinbaseWallet.js +5 -5
- package/dist/connectors/index.js +9 -9
- package/dist/connectors/injected.js +7 -7
- package/dist/connectors/ledger.js +5 -5
- package/dist/connectors/metaMask.js +5 -5
- package/dist/connectors/mock.js +9 -9
- package/dist/connectors/walletConnect.js +5 -5
- package/dist/index.js +164 -164
- package/dist/internal/index.js +8 -8
- package/dist/internal/test.js +25 -25
- package/dist/providers/alchemy.js +11 -11
- package/dist/providers/infura.js +11 -11
- package/dist/providers/jsonRpc.js +8 -8
- package/dist/providers/public.js +7 -7
- package/package.json +5 -4
- package/dist/chunk-4XWPOWOL.js +0 -88
package/dist/internal/test.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import "../chunk-KX4UEHS5.js";
|
|
2
|
+
import "../chunk-55IO54NW.js";
|
|
3
|
+
import {
|
|
4
|
+
foundry,
|
|
5
|
+
goerli,
|
|
6
|
+
mainnet,
|
|
7
|
+
optimism,
|
|
8
|
+
polygon
|
|
9
|
+
} from "../chunk-LH5WKLUU.js";
|
|
10
|
+
import "../chunk-BVC4KGLQ.js";
|
|
11
|
+
import "../chunk-EQOEZP46.js";
|
|
12
|
+
import "../chunk-KFW652VN.js";
|
|
13
|
+
import "../chunk-MQXBDTVK.js";
|
|
14
14
|
|
|
15
15
|
// test/utils.ts
|
|
16
|
-
|
|
16
|
+
import { BigNumber, Wallet, providers } from "ethers";
|
|
17
17
|
function getNetwork(chain) {
|
|
18
18
|
return {
|
|
19
19
|
chainId: chain.id,
|
|
@@ -22,11 +22,11 @@ function getNetwork(chain) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
var foundryMainnet = {
|
|
25
|
-
...
|
|
26
|
-
rpcUrls:
|
|
25
|
+
...mainnet,
|
|
26
|
+
rpcUrls: foundry.rpcUrls
|
|
27
27
|
};
|
|
28
|
-
var testChains = [foundryMainnet,
|
|
29
|
-
var EthersProviderWrapper = class extends
|
|
28
|
+
var testChains = [foundryMainnet, mainnet, goerli, optimism, polygon];
|
|
29
|
+
var EthersProviderWrapper = class extends providers.StaticJsonRpcProvider {
|
|
30
30
|
toJSON() {
|
|
31
31
|
return `<Provider network={${this.network.chainId}} />`;
|
|
32
32
|
}
|
|
@@ -35,13 +35,13 @@ function getProvider({
|
|
|
35
35
|
chains = testChains,
|
|
36
36
|
chainId
|
|
37
37
|
} = {}) {
|
|
38
|
-
const chain =
|
|
38
|
+
const chain = testChains.find((x) => x.id === chainId) ?? foundryMainnet;
|
|
39
39
|
const url = foundryMainnet.rpcUrls.default.http[0];
|
|
40
40
|
const provider = new EthersProviderWrapper(url, getNetwork(chain));
|
|
41
41
|
provider.pollingInterval = 1e3;
|
|
42
42
|
return Object.assign(provider, { chains });
|
|
43
43
|
}
|
|
44
|
-
var EthersWebSocketProviderWrapper = class extends
|
|
44
|
+
var EthersWebSocketProviderWrapper = class extends providers.WebSocketProvider {
|
|
45
45
|
toJSON() {
|
|
46
46
|
return `<WebSocketProvider network={${this.network.chainId}} />`;
|
|
47
47
|
}
|
|
@@ -128,7 +128,7 @@ var accounts = [
|
|
|
128
128
|
balance: "10000000000000000000000"
|
|
129
129
|
}
|
|
130
130
|
];
|
|
131
|
-
var WalletSigner = class extends
|
|
131
|
+
var WalletSigner = class extends Wallet {
|
|
132
132
|
connectUnchecked() {
|
|
133
133
|
const uncheckedSigner = this.provider.getUncheckedSigner(this.address);
|
|
134
134
|
return uncheckedSigner;
|
|
@@ -138,7 +138,7 @@ function getSigners() {
|
|
|
138
138
|
const provider = getProvider();
|
|
139
139
|
return accounts.map((x) => new WalletSigner(x.privateKey, provider));
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
export {
|
|
142
|
+
getSigners,
|
|
143
|
+
testChains
|
|
144
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/alchemy.ts
|
|
4
|
-
|
|
4
|
+
import { providers } from "ethers";
|
|
5
5
|
function alchemyProvider({
|
|
6
6
|
apiKey,
|
|
7
7
|
priority,
|
|
@@ -9,38 +9,38 @@ function alchemyProvider({
|
|
|
9
9
|
weight
|
|
10
10
|
}) {
|
|
11
11
|
return function(chain) {
|
|
12
|
-
if (!
|
|
12
|
+
if (!chain.rpcUrls.alchemy?.http[0])
|
|
13
13
|
return null;
|
|
14
14
|
return {
|
|
15
15
|
chain: {
|
|
16
16
|
...chain,
|
|
17
17
|
rpcUrls: {
|
|
18
18
|
...chain.rpcUrls,
|
|
19
|
-
default: { http: [`${
|
|
19
|
+
default: { http: [`${chain.rpcUrls.alchemy?.http[0]}/${apiKey}`] }
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
provider: () => {
|
|
23
|
-
const provider = new
|
|
23
|
+
const provider = new providers.AlchemyProvider(
|
|
24
24
|
{
|
|
25
25
|
chainId: chain.id,
|
|
26
26
|
name: chain.network,
|
|
27
|
-
ensAddress:
|
|
27
|
+
ensAddress: chain.contracts?.ensRegistry?.address
|
|
28
28
|
},
|
|
29
29
|
apiKey
|
|
30
30
|
);
|
|
31
31
|
return Object.assign(provider, { priority, stallTimeout, weight });
|
|
32
32
|
},
|
|
33
|
-
webSocketProvider: () => new
|
|
33
|
+
webSocketProvider: () => new providers.AlchemyWebSocketProvider(
|
|
34
34
|
{
|
|
35
35
|
chainId: chain.id,
|
|
36
36
|
name: chain.network,
|
|
37
|
-
ensAddress:
|
|
37
|
+
ensAddress: chain.contracts?.ensRegistry?.address
|
|
38
38
|
},
|
|
39
39
|
apiKey
|
|
40
40
|
)
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
export {
|
|
45
|
+
alchemyProvider
|
|
46
|
+
};
|
package/dist/providers/infura.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/infura.ts
|
|
4
|
-
|
|
4
|
+
import { providers } from "ethers";
|
|
5
5
|
function infuraProvider({
|
|
6
6
|
apiKey,
|
|
7
7
|
priority,
|
|
@@ -9,38 +9,38 @@ function infuraProvider({
|
|
|
9
9
|
weight
|
|
10
10
|
}) {
|
|
11
11
|
return function(chain) {
|
|
12
|
-
if (!
|
|
12
|
+
if (!chain.rpcUrls.infura?.http[0])
|
|
13
13
|
return null;
|
|
14
14
|
return {
|
|
15
15
|
chain: {
|
|
16
16
|
...chain,
|
|
17
17
|
rpcUrls: {
|
|
18
18
|
...chain.rpcUrls,
|
|
19
|
-
default: { http: [`${
|
|
19
|
+
default: { http: [`${chain.rpcUrls.infura?.http[0]}/${apiKey}`] }
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
provider: () => {
|
|
23
|
-
const provider = new
|
|
23
|
+
const provider = new providers.InfuraProvider(
|
|
24
24
|
{
|
|
25
25
|
chainId: chain.id,
|
|
26
26
|
name: chain.network,
|
|
27
|
-
ensAddress:
|
|
27
|
+
ensAddress: chain.contracts?.ensRegistry?.address
|
|
28
28
|
},
|
|
29
29
|
apiKey
|
|
30
30
|
);
|
|
31
31
|
return Object.assign(provider, { priority, stallTimeout, weight });
|
|
32
32
|
},
|
|
33
|
-
webSocketProvider: () => new
|
|
33
|
+
webSocketProvider: () => new providers.InfuraWebSocketProvider(
|
|
34
34
|
{
|
|
35
35
|
chainId: chain.id,
|
|
36
36
|
name: chain.network,
|
|
37
|
-
ensAddress:
|
|
37
|
+
ensAddress: chain.contracts?.ensRegistry?.address
|
|
38
38
|
},
|
|
39
39
|
apiKey
|
|
40
40
|
)
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
export {
|
|
45
|
+
infuraProvider
|
|
46
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/jsonRpc.ts
|
|
4
|
-
|
|
4
|
+
import { providers } from "ethers";
|
|
5
5
|
function jsonRpcProvider({
|
|
6
6
|
priority,
|
|
7
7
|
rpc,
|
|
@@ -22,16 +22,16 @@ function jsonRpcProvider({
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
provider: () => {
|
|
25
|
-
const RpcProvider = static_ ?
|
|
25
|
+
const RpcProvider = static_ ? providers.StaticJsonRpcProvider : providers.JsonRpcProvider;
|
|
26
26
|
const provider = new RpcProvider(rpcConfig.http, {
|
|
27
|
-
ensAddress:
|
|
27
|
+
ensAddress: chain.contracts?.ensRegistry?.address,
|
|
28
28
|
chainId: chain.id,
|
|
29
29
|
name: chain.network
|
|
30
30
|
});
|
|
31
31
|
return Object.assign(provider, { priority, stallTimeout, weight });
|
|
32
32
|
},
|
|
33
33
|
...rpcConfig.webSocket && {
|
|
34
|
-
webSocketProvider: () => new
|
|
34
|
+
webSocketProvider: () => new providers.WebSocketProvider(
|
|
35
35
|
rpcConfig.webSocket,
|
|
36
36
|
chain.id
|
|
37
37
|
)
|
|
@@ -39,6 +39,6 @@ function jsonRpcProvider({
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
export {
|
|
43
|
+
jsonRpcProvider
|
|
44
|
+
};
|
package/dist/providers/public.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/public.ts
|
|
4
|
-
|
|
4
|
+
import { providers } from "ethers";
|
|
5
5
|
function publicProvider({
|
|
6
6
|
priority,
|
|
7
7
|
stallTimeout,
|
|
@@ -13,12 +13,12 @@ function publicProvider({
|
|
|
13
13
|
return {
|
|
14
14
|
chain,
|
|
15
15
|
provider: () => {
|
|
16
|
-
const provider = new
|
|
16
|
+
const provider = new providers.StaticJsonRpcProvider(
|
|
17
17
|
chain.rpcUrls.default.http[0],
|
|
18
18
|
{
|
|
19
19
|
chainId: chain.id,
|
|
20
20
|
name: chain.network,
|
|
21
|
-
ensAddress:
|
|
21
|
+
ensAddress: chain.contracts?.ensRegistry?.address
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
24
|
return Object.assign(provider, { priority, stallTimeout, weight });
|
|
@@ -26,6 +26,6 @@ function publicProvider({
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
export {
|
|
30
|
+
publicProvider
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@wagmi/core",
|
|
3
3
|
"description": "Vanilla JS library for Ethereum",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.3",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/wagmi-dev/wagmi.git",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"url": "https://github.com/sponsors/wagmi-dev"
|
|
24
24
|
}
|
|
25
25
|
],
|
|
26
|
+
"type": "module",
|
|
26
27
|
"main": "dist/index.js",
|
|
27
28
|
"types": "dist/index.d.ts",
|
|
28
29
|
"exports": {
|
|
@@ -106,11 +107,11 @@
|
|
|
106
107
|
}
|
|
107
108
|
},
|
|
108
109
|
"dependencies": {
|
|
109
|
-
"@wagmi/chains": "0.2.4-cjs",
|
|
110
|
-
"@wagmi/connectors": "0.2.2-cjs",
|
|
111
110
|
"abitype": "^0.3.0",
|
|
112
111
|
"eventemitter3": "^4.0.7",
|
|
113
|
-
"zustand": "^4.3.1"
|
|
112
|
+
"zustand": "^4.3.1",
|
|
113
|
+
"@wagmi/chains": "0.2.5",
|
|
114
|
+
"@wagmi/connectors": "0.2.3"
|
|
114
115
|
},
|
|
115
116
|
"devDependencies": {
|
|
116
117
|
"ethers": "^5.7.1"
|
package/dist/chunk-4XWPOWOL.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/chains.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _chains = require('@wagmi/chains');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
exports.arbitrum = _chains.arbitrum; exports.arbitrumGoerli = _chains.arbitrumGoerli; exports.aurora = _chains.aurora; exports.auroraTestnet = _chains.auroraTestnet; exports.avalanche = _chains.avalanche; exports.avalancheFuji = _chains.avalancheFuji; exports.bronos = _chains.bronos; exports.bronosTestnet = _chains.bronosTestnet; exports.bsc = _chains.bsc; exports.bscTestnet = _chains.bscTestnet; exports.canto = _chains.canto; exports.celo = _chains.celo; exports.celoAlfajores = _chains.celoAlfajores; exports.crossbell = _chains.crossbell; exports.evmos = _chains.evmos; exports.evmosTestnet = _chains.evmosTestnet; exports.fantom = _chains.fantom; exports.fantomTestnet = _chains.fantomTestnet; exports.filecoin = _chains.filecoin; exports.filecoinHyperspace = _chains.filecoinHyperspace; exports.foundry = _chains.foundry; exports.goerli = _chains.goerli; exports.gnosis = _chains.gnosis; exports.gnosisChiado = _chains.gnosisChiado; exports.hardhat = _chains.hardhat; exports.iotex = _chains.iotex; exports.iotexTestnet = _chains.iotexTestnet; exports.localhost = _chains.localhost; exports.mainnet = _chains.mainnet; exports.metis = _chains.metis; exports.metisGoerli = _chains.metisGoerli; exports.okc = _chains.okc; exports.optimism = _chains.optimism; exports.optimismGoerli = _chains.optimismGoerli; exports.polygon = _chains.polygon; exports.polygonMumbai = _chains.polygonMumbai; exports.sepolia = _chains.sepolia; exports.taraxa = _chains.taraxa; exports.taraxaTestnet = _chains.taraxaTestnet; exports.zkSync = _chains.zkSync; exports.zkSyncTestnet = _chains.zkSyncTestnet;
|