@wagmi/core 1.0.6-cjs → 1.0.7
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 +1 -1
- package/dist/chains.js +187 -187
- 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-MQXBDTVK.js +7 -7
- package/dist/{chunk-BMHDSNLV.js → chunk-OKULXQAF.js} +236 -233
- package/dist/chunk-OL6OIPEP.js +188 -188
- 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/safe.js +5 -5
- package/dist/connectors/walletConnect.js +5 -5
- package/dist/connectors/walletConnectLegacy.js +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +136 -136
- package/dist/internal/index.d.ts +7 -3
- package/dist/internal/index.js +10 -10
- package/dist/internal/test.js +36 -36
- package/dist/providers/alchemy.js +6 -6
- package/dist/providers/infura.js +6 -6
- package/dist/providers/jsonRpc.js +4 -4
- package/dist/providers/public.js +4 -4
- package/dist/window.js +0 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
import "./chunk-KX4UEHS5.js";
|
|
2
|
+
import {
|
|
3
|
+
ChainMismatchError,
|
|
4
|
+
ChainNotConfiguredError,
|
|
5
|
+
Config,
|
|
6
|
+
ConfigChainsNotFound,
|
|
7
|
+
ConnectorAlreadyConnectedError,
|
|
8
|
+
ConnectorNotFoundError,
|
|
9
|
+
SwitchChainNotSupportedError,
|
|
10
|
+
configureChains,
|
|
11
|
+
connect,
|
|
12
|
+
createConfig,
|
|
13
|
+
createStorage,
|
|
14
|
+
deepEqual,
|
|
15
|
+
deserialize,
|
|
16
|
+
disconnect,
|
|
17
|
+
erc20ABI,
|
|
18
|
+
erc4626ABI,
|
|
19
|
+
erc721ABI,
|
|
20
|
+
fetchBalance,
|
|
21
|
+
fetchBlockNumber,
|
|
22
|
+
fetchEnsAddress,
|
|
23
|
+
fetchEnsAvatar,
|
|
24
|
+
fetchEnsName,
|
|
25
|
+
fetchEnsResolver,
|
|
26
|
+
fetchFeeData,
|
|
27
|
+
fetchToken,
|
|
28
|
+
fetchTransaction,
|
|
29
|
+
getAccount,
|
|
30
|
+
getConfig,
|
|
31
|
+
getContract,
|
|
32
|
+
getNetwork,
|
|
33
|
+
getPublicClient,
|
|
34
|
+
getUnit,
|
|
35
|
+
getWalletClient,
|
|
36
|
+
getWebSocketPublicClient,
|
|
37
|
+
multicall,
|
|
38
|
+
noopStorage,
|
|
39
|
+
prepareSendTransaction,
|
|
40
|
+
prepareWriteContract,
|
|
41
|
+
readContract,
|
|
42
|
+
readContracts,
|
|
43
|
+
sendTransaction,
|
|
44
|
+
serialize,
|
|
45
|
+
signMessage,
|
|
46
|
+
signTypedData,
|
|
47
|
+
switchNetwork,
|
|
48
|
+
waitForTransaction,
|
|
49
|
+
watchAccount,
|
|
50
|
+
watchBlockNumber,
|
|
51
|
+
watchContractEvent,
|
|
52
|
+
watchMulticall,
|
|
53
|
+
watchNetwork,
|
|
54
|
+
watchPendingTransactions,
|
|
55
|
+
watchPublicClient,
|
|
56
|
+
watchReadContract,
|
|
57
|
+
watchReadContracts,
|
|
58
|
+
watchWalletClient,
|
|
59
|
+
watchWebSocketPublicClient,
|
|
60
|
+
writeContract
|
|
61
|
+
} from "./chunk-OKULXQAF.js";
|
|
62
|
+
import {
|
|
63
|
+
mainnet,
|
|
64
|
+
sepolia
|
|
65
|
+
} from "./chunk-OL6OIPEP.js";
|
|
66
|
+
import {
|
|
67
|
+
Connector
|
|
68
|
+
} from "./chunk-BVC4KGLQ.js";
|
|
69
|
+
import {
|
|
70
|
+
InjectedConnector
|
|
71
|
+
} from "./chunk-EQOEZP46.js";
|
|
72
|
+
import "./chunk-MQXBDTVK.js";
|
|
73
|
+
export {
|
|
74
|
+
ChainMismatchError,
|
|
75
|
+
ChainNotConfiguredError,
|
|
76
|
+
Config,
|
|
77
|
+
ConfigChainsNotFound,
|
|
78
|
+
Connector,
|
|
79
|
+
ConnectorAlreadyConnectedError,
|
|
80
|
+
ConnectorNotFoundError,
|
|
81
|
+
InjectedConnector,
|
|
82
|
+
SwitchChainNotSupportedError,
|
|
83
|
+
configureChains,
|
|
84
|
+
connect,
|
|
85
|
+
createConfig,
|
|
86
|
+
createStorage,
|
|
87
|
+
deepEqual,
|
|
88
|
+
deserialize,
|
|
89
|
+
disconnect,
|
|
90
|
+
erc20ABI,
|
|
91
|
+
erc4626ABI,
|
|
92
|
+
erc721ABI,
|
|
93
|
+
fetchBalance,
|
|
94
|
+
fetchBlockNumber,
|
|
95
|
+
fetchEnsAddress,
|
|
96
|
+
fetchEnsAvatar,
|
|
97
|
+
fetchEnsName,
|
|
98
|
+
fetchEnsResolver,
|
|
99
|
+
fetchFeeData,
|
|
100
|
+
fetchToken,
|
|
101
|
+
fetchTransaction,
|
|
102
|
+
getAccount,
|
|
103
|
+
getConfig,
|
|
104
|
+
getContract,
|
|
105
|
+
getNetwork,
|
|
106
|
+
getPublicClient,
|
|
107
|
+
getUnit,
|
|
108
|
+
getWalletClient,
|
|
109
|
+
getWebSocketPublicClient,
|
|
110
|
+
mainnet,
|
|
111
|
+
multicall,
|
|
112
|
+
noopStorage,
|
|
113
|
+
prepareSendTransaction,
|
|
114
|
+
prepareWriteContract,
|
|
115
|
+
readContract,
|
|
116
|
+
readContracts,
|
|
117
|
+
sendTransaction,
|
|
118
|
+
sepolia,
|
|
119
|
+
serialize,
|
|
120
|
+
signMessage,
|
|
121
|
+
signTypedData,
|
|
122
|
+
switchNetwork,
|
|
123
|
+
waitForTransaction,
|
|
124
|
+
watchAccount,
|
|
125
|
+
watchBlockNumber,
|
|
126
|
+
watchContractEvent,
|
|
127
|
+
watchMulticall,
|
|
128
|
+
watchNetwork,
|
|
129
|
+
watchPendingTransactions,
|
|
130
|
+
watchPublicClient,
|
|
131
|
+
watchReadContract,
|
|
132
|
+
watchReadContracts,
|
|
133
|
+
watchWalletClient,
|
|
134
|
+
watchWebSocketPublicClient,
|
|
135
|
+
writeContract
|
|
136
|
+
};
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { CallParameters, SendTransactionParameters } from 'viem';
|
|
2
2
|
|
|
3
|
-
declare function getCallParameters(args: Omit<CallParameters, 'account'>): Omit<CallParameters, 'account'>;
|
|
4
|
-
declare function getSendTransactionParameters(args: Omit<SendTransactionParameters, 'account' | 'chain'>): Omit<SendTransactionParameters, 'account' | 'chain'>;
|
|
5
|
-
|
|
6
3
|
/**
|
|
7
4
|
* Converts properties of {@link T} to never
|
|
8
5
|
*
|
|
@@ -16,5 +13,12 @@ declare function getSendTransactionParameters(args: Omit<SendTransactionParamete
|
|
|
16
13
|
type Never<T> = {
|
|
17
14
|
[K in keyof T]: never;
|
|
18
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Makes {@link TKeys} optional in {@link TType} while preserving type inference.
|
|
18
|
+
*/
|
|
19
|
+
type PartialBy<TType, TKeys extends keyof TType> = Partial<Pick<TType, TKeys>> & Omit<TType, TKeys>;
|
|
20
|
+
|
|
21
|
+
declare function getCallParameters(args: Omit<CallParameters, 'chain'>): CallParameters;
|
|
22
|
+
declare function getSendTransactionParameters(args: PartialBy<Omit<SendTransactionParameters, 'chain'>, 'account'>): PartialBy<Omit<SendTransactionParameters, 'chain'>, 'account'>;
|
|
19
23
|
|
|
20
24
|
export { Never, getCallParameters, getSendTransactionParameters };
|
package/dist/internal/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import {
|
|
2
|
+
getCallParameters,
|
|
3
|
+
getSendTransactionParameters
|
|
4
|
+
} from "../chunk-OKULXQAF.js";
|
|
5
|
+
import "../chunk-BVC4KGLQ.js";
|
|
6
|
+
import "../chunk-MQXBDTVK.js";
|
|
7
|
+
export {
|
|
8
|
+
getCallParameters,
|
|
9
|
+
getSendTransactionParameters
|
|
10
|
+
};
|
package/dist/internal/test.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import "../chunk-KX4UEHS5.js";
|
|
2
|
+
import "../chunk-OKULXQAF.js";
|
|
3
|
+
import {
|
|
4
|
+
foundry,
|
|
5
|
+
goerli,
|
|
6
|
+
mainnet,
|
|
7
|
+
optimism,
|
|
8
|
+
polygon
|
|
9
|
+
} from "../chunk-OL6OIPEP.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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
import {
|
|
17
|
+
createPublicClient,
|
|
18
|
+
createWalletClient,
|
|
19
|
+
custom,
|
|
20
|
+
http,
|
|
21
|
+
webSocket
|
|
22
|
+
} from "viem";
|
|
23
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
24
|
+
import { rpc } from "viem/utils";
|
|
25
25
|
var foundryMainnet = {
|
|
26
|
-
...
|
|
27
|
-
rpcUrls:
|
|
26
|
+
...mainnet,
|
|
27
|
+
rpcUrls: foundry.rpcUrls
|
|
28
28
|
};
|
|
29
|
-
var testChains = [foundryMainnet,
|
|
29
|
+
var testChains = [foundryMainnet, mainnet, goerli, optimism, polygon];
|
|
30
30
|
function getPublicClient({
|
|
31
31
|
chains = testChains,
|
|
32
32
|
chainId
|
|
33
33
|
} = {}) {
|
|
34
|
-
const chain =
|
|
34
|
+
const chain = chains.find((x) => x.id === chainId) ?? foundryMainnet;
|
|
35
35
|
const url = foundryMainnet.rpcUrls.default.http[0];
|
|
36
|
-
const publicClient =
|
|
36
|
+
const publicClient = createPublicClient({
|
|
37
37
|
chain,
|
|
38
|
-
transport:
|
|
38
|
+
transport: http(url),
|
|
39
39
|
pollingInterval: 1e3
|
|
40
40
|
});
|
|
41
41
|
return Object.assign(publicClient, {
|
|
@@ -134,7 +134,7 @@ function getWalletClients() {
|
|
|
134
134
|
method = "eth_sign";
|
|
135
135
|
params = [params[1], params[0]];
|
|
136
136
|
}
|
|
137
|
-
const { result } = await
|
|
137
|
+
const { result } = await rpc.http(foundryMainnet.rpcUrls.default.http[0], {
|
|
138
138
|
body: {
|
|
139
139
|
method,
|
|
140
140
|
params
|
|
@@ -143,14 +143,14 @@ function getWalletClients() {
|
|
|
143
143
|
return result;
|
|
144
144
|
};
|
|
145
145
|
return accounts.map(
|
|
146
|
-
(x) =>
|
|
147
|
-
account:
|
|
146
|
+
(x) => createWalletClient({
|
|
147
|
+
account: privateKeyToAccount(x.privateKey).address,
|
|
148
148
|
chain: publicClient.chain,
|
|
149
|
-
transport:
|
|
149
|
+
transport: custom(publicClient)
|
|
150
150
|
})
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
export {
|
|
154
|
+
getWalletClients,
|
|
155
|
+
testChains
|
|
156
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/alchemy.ts
|
|
4
4
|
function alchemyProvider({
|
|
5
5
|
apiKey
|
|
6
6
|
}) {
|
|
7
7
|
return function(chain) {
|
|
8
|
-
const baseHttpUrl =
|
|
9
|
-
const baseWsUrl =
|
|
8
|
+
const baseHttpUrl = chain.rpcUrls.alchemy?.http[0];
|
|
9
|
+
const baseWsUrl = chain.rpcUrls.alchemy?.webSocket?.[0];
|
|
10
10
|
if (!baseHttpUrl)
|
|
11
11
|
return null;
|
|
12
12
|
return {
|
|
@@ -24,6 +24,6 @@ function alchemyProvider({
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export {
|
|
28
|
+
alchemyProvider
|
|
29
|
+
};
|
package/dist/providers/infura.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/infura.ts
|
|
4
4
|
function infuraProvider({
|
|
5
5
|
apiKey
|
|
6
6
|
}) {
|
|
7
7
|
return function(chain) {
|
|
8
|
-
const baseHttpUrl =
|
|
9
|
-
const baseWsUrl =
|
|
8
|
+
const baseHttpUrl = chain.rpcUrls.infura?.http[0];
|
|
9
|
+
const baseWsUrl = chain.rpcUrls.infura?.webSocket?.[0];
|
|
10
10
|
if (!baseHttpUrl)
|
|
11
11
|
return null;
|
|
12
12
|
return {
|
|
@@ -24,6 +24,6 @@ function infuraProvider({
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export {
|
|
28
|
+
infuraProvider
|
|
29
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/jsonRpc.ts
|
|
4
4
|
function jsonRpcProvider({
|
|
@@ -23,6 +23,6 @@ function jsonRpcProvider({
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export {
|
|
27
|
+
jsonRpcProvider
|
|
28
|
+
};
|
package/dist/providers/public.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import "../chunk-MQXBDTVK.js";
|
|
2
2
|
|
|
3
3
|
// src/providers/public.ts
|
|
4
4
|
function publicProvider() {
|
|
@@ -11,6 +11,6 @@ function publicProvider() {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export {
|
|
15
|
+
publicProvider
|
|
16
|
+
};
|
package/dist/window.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
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": "1.0.
|
|
5
|
+
"version": "1.0.7",
|
|
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": {
|
|
@@ -119,11 +120,11 @@
|
|
|
119
120
|
}
|
|
120
121
|
},
|
|
121
122
|
"dependencies": {
|
|
122
|
-
"@wagmi/chains": "0.2.25-cjs",
|
|
123
|
-
"@wagmi/connectors": "1.0.5-cjs",
|
|
124
123
|
"abitype": "0.8.1",
|
|
125
124
|
"eventemitter3": "^4.0.7",
|
|
126
|
-
"zustand": "^4.3.1"
|
|
125
|
+
"zustand": "^4.3.1",
|
|
126
|
+
"@wagmi/chains": "0.3.1",
|
|
127
|
+
"@wagmi/connectors": "2.0.0"
|
|
127
128
|
},
|
|
128
129
|
"devDependencies": {
|
|
129
130
|
"viem": "~0.3.35"
|