@wagmi/core 0.6.12 → 0.7.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.
Files changed (184) hide show
  1. package/chains/package.json +2 -2
  2. package/connectors/coinbaseWallet/package.json +2 -2
  3. package/connectors/metaMask/package.json +2 -2
  4. package/connectors/mock/package.json +2 -2
  5. package/connectors/walletConnect/package.json +2 -2
  6. package/dist/{declarations/src/connectors/base.d.ts → base-5bd9b5ed.d.ts} +8 -5
  7. package/dist/chains.d.ts +3 -0
  8. package/dist/chains.js +29 -0
  9. package/dist/chunk-2EDVJWOA.js +3496 -0
  10. package/dist/chunk-4DNFSL2K.js +376 -0
  11. package/dist/chunk-MQXBDTVK.js +29 -0
  12. package/dist/{declarations/src/connectors → connectors}/coinbaseWallet.d.ts +10 -6
  13. package/dist/connectors/coinbaseWallet.js +215 -0
  14. package/dist/{declarations/src/connectors → connectors}/metaMask.d.ts +11 -4
  15. package/dist/connectors/metaMask.js +115 -0
  16. package/dist/connectors/mock/index.d.ts +78 -0
  17. package/dist/connectors/mock/index.js +190 -0
  18. package/dist/{declarations/src/connectors → connectors}/walletConnect.d.ts +9 -5
  19. package/dist/connectors/walletConnect.js +160 -0
  20. package/dist/{declarations/src/types/contracts.d.ts → contracts-fb6a6ff0.d.ts} +122 -17
  21. package/dist/{declarations/src/types/index.d.ts → index-bacc1c49.d.ts} +83 -15
  22. package/dist/index.d.ts +1738 -0
  23. package/dist/index.js +165 -0
  24. package/dist/{declarations/src/connectors/injected.d.ts → injected-6980e5c3.d.ts} +9 -6
  25. package/dist/internal.d.ts +8 -0
  26. package/dist/internal.js +8 -0
  27. package/dist/providers/alchemy.d.ts +11 -0
  28. package/dist/providers/alchemy.js +32 -0
  29. package/dist/providers/infura.d.ts +11 -0
  30. package/dist/providers/infura.js +32 -0
  31. package/dist/providers/jsonRpc.d.ts +14 -0
  32. package/dist/providers/jsonRpc.js +44 -0
  33. package/dist/providers/public.d.ts +8 -0
  34. package/dist/providers/public.js +30 -0
  35. package/internal/package.json +2 -2
  36. package/package.json +40 -51
  37. package/providers/alchemy/package.json +2 -2
  38. package/providers/infura/package.json +2 -2
  39. package/providers/jsonRpc/package.json +2 -2
  40. package/providers/public/package.json +2 -2
  41. package/chains/dist/wagmi-core-chains.cjs.d.ts +0 -1
  42. package/chains/dist/wagmi-core-chains.cjs.dev.js +0 -26
  43. package/chains/dist/wagmi-core-chains.cjs.js +0 -7
  44. package/chains/dist/wagmi-core-chains.cjs.prod.js +0 -26
  45. package/chains/dist/wagmi-core-chains.esm.js +0 -2
  46. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.d.ts +0 -1
  47. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +0 -274
  48. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.js +0 -7
  49. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +0 -274
  50. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +0 -252
  51. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.d.ts +0 -1
  52. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +0 -153
  53. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.js +0 -7
  54. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +0 -153
  55. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +0 -149
  56. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.d.ts +0 -1
  57. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +0 -262
  58. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.js +0 -7
  59. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +0 -262
  60. package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +0 -253
  61. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.d.ts +0 -1
  62. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +0 -228
  63. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.js +0 -7
  64. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +0 -228
  65. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +0 -206
  66. package/dist/chains-73cc6c23.cjs.prod.js +0 -526
  67. package/dist/chains-8fce19d8.esm.js +0 -502
  68. package/dist/chains-fe1f4131.cjs.dev.js +0 -526
  69. package/dist/debounce-0862bf88.esm.js +0 -18
  70. package/dist/debounce-2d836dc9.cjs.prod.js +0 -20
  71. package/dist/debounce-46ac0312.cjs.dev.js +0 -20
  72. package/dist/declarations/src/actions/accounts/connect.d.ts +0 -18
  73. package/dist/declarations/src/actions/accounts/disconnect.d.ts +0 -1
  74. package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +0 -19
  75. package/dist/declarations/src/actions/accounts/fetchSigner.d.ts +0 -7
  76. package/dist/declarations/src/actions/accounts/getAccount.d.ts +0 -36
  77. package/dist/declarations/src/actions/accounts/getNetwork.d.ts +0 -8
  78. package/dist/declarations/src/actions/accounts/index.d.ts +0 -12
  79. package/dist/declarations/src/actions/accounts/signMessage.d.ts +0 -7
  80. package/dist/declarations/src/actions/accounts/signTypedData.d.ts +0 -23
  81. package/dist/declarations/src/actions/accounts/switchNetwork.d.ts +0 -6
  82. package/dist/declarations/src/actions/accounts/watchAccount.d.ts +0 -12
  83. package/dist/declarations/src/actions/accounts/watchNetwork.d.ts +0 -10
  84. package/dist/declarations/src/actions/accounts/watchSigner.d.ts +0 -5
  85. package/dist/declarations/src/actions/contracts/fetchToken.d.ts +0 -21
  86. package/dist/declarations/src/actions/contracts/getContract.d.ts +0 -113
  87. package/dist/declarations/src/actions/contracts/index.d.ts +0 -11
  88. package/dist/declarations/src/actions/contracts/multicall.d.ts +0 -17
  89. package/dist/declarations/src/actions/contracts/prepareWriteContract.d.ts +0 -47
  90. package/dist/declarations/src/actions/contracts/readContract.d.ts +0 -15
  91. package/dist/declarations/src/actions/contracts/readContracts.d.ts +0 -28
  92. package/dist/declarations/src/actions/contracts/watchContractEvent.d.ts +0 -28
  93. package/dist/declarations/src/actions/contracts/watchMulticall.d.ts +0 -10
  94. package/dist/declarations/src/actions/contracts/watchReadContract.d.ts +0 -7
  95. package/dist/declarations/src/actions/contracts/watchReadContracts.d.ts +0 -10
  96. package/dist/declarations/src/actions/contracts/writeContract.d.ts +0 -72
  97. package/dist/declarations/src/actions/ens/fetchEnsAddress.d.ts +0 -9
  98. package/dist/declarations/src/actions/ens/fetchEnsAvatar.d.ts +0 -8
  99. package/dist/declarations/src/actions/ens/fetchEnsName.d.ts +0 -9
  100. package/dist/declarations/src/actions/ens/fetchEnsResolver.d.ts +0 -9
  101. package/dist/declarations/src/actions/ens/index.d.ts +0 -4
  102. package/dist/declarations/src/actions/index.d.ts +0 -6
  103. package/dist/declarations/src/actions/network-status/fetchBlockNumber.d.ts +0 -5
  104. package/dist/declarations/src/actions/network-status/fetchFeeData.d.ts +0 -16
  105. package/dist/declarations/src/actions/network-status/index.d.ts +0 -3
  106. package/dist/declarations/src/actions/network-status/watchBlockNumber.d.ts +0 -7
  107. package/dist/declarations/src/actions/providers/getProvider.d.ts +0 -7
  108. package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +0 -7
  109. package/dist/declarations/src/actions/providers/index.d.ts +0 -4
  110. package/dist/declarations/src/actions/providers/watchProvider.d.ts +0 -4
  111. package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +0 -4
  112. package/dist/declarations/src/actions/transactions/fetchTransaction.d.ts +0 -21
  113. package/dist/declarations/src/actions/transactions/index.d.ts +0 -4
  114. package/dist/declarations/src/actions/transactions/prepareSendTransaction.d.ts +0 -37
  115. package/dist/declarations/src/actions/transactions/sendTransaction.d.ts +0 -48
  116. package/dist/declarations/src/actions/transactions/waitForTransaction.d.ts +0 -18
  117. package/dist/declarations/src/chains.d.ts +0 -1
  118. package/dist/declarations/src/client.d.ts +0 -91
  119. package/dist/declarations/src/connectors/index.d.ts +0 -2
  120. package/dist/declarations/src/connectors/mock/connector.d.ts +0 -34
  121. package/dist/declarations/src/connectors/mock/index.d.ts +0 -2
  122. package/dist/declarations/src/connectors/mock/provider.d.ts +0 -41
  123. package/dist/declarations/src/constants/abis.d.ts +0 -941
  124. package/dist/declarations/src/constants/blockExplorers.d.ts +0 -9
  125. package/dist/declarations/src/constants/chains.d.ts +0 -64
  126. package/dist/declarations/src/constants/index.d.ts +0 -7
  127. package/dist/declarations/src/constants/rpcs.d.ts +0 -11
  128. package/dist/declarations/src/constants/units.d.ts +0 -1
  129. package/dist/declarations/src/errors.d.ts +0 -134
  130. package/dist/declarations/src/index.d.ts +0 -14
  131. package/dist/declarations/src/internal.d.ts +0 -3
  132. package/dist/declarations/src/providers/alchemy.d.ts +0 -6
  133. package/dist/declarations/src/providers/infura.d.ts +0 -6
  134. package/dist/declarations/src/providers/jsonRpc.d.ts +0 -10
  135. package/dist/declarations/src/providers/public.d.ts +0 -4
  136. package/dist/declarations/src/storage.d.ts +0 -12
  137. package/dist/declarations/src/types/utils.d.ts +0 -103
  138. package/dist/declarations/src/utils/assertActiveChain.d.ts +0 -5
  139. package/dist/declarations/src/utils/configureChains.d.ts +0 -26
  140. package/dist/declarations/src/utils/debounce.d.ts +0 -1
  141. package/dist/declarations/src/utils/deepEqual.d.ts +0 -2
  142. package/dist/declarations/src/utils/getInjectedName.d.ts +0 -2
  143. package/dist/declarations/src/utils/index.d.ts +0 -11
  144. package/dist/declarations/src/utils/logger.d.ts +0 -1
  145. package/dist/declarations/src/utils/minimizeContractInterface.d.ts +0 -5
  146. package/dist/declarations/src/utils/normalizeChainId.d.ts +0 -1
  147. package/dist/declarations/src/utils/normalizeFunctionName.d.ts +0 -17
  148. package/dist/declarations/src/utils/parseContractResult.d.ts +0 -7
  149. package/dist/getProvider-3b1af4e6.cjs.dev.js +0 -1143
  150. package/dist/getProvider-84f303a1.cjs.prod.js +0 -1143
  151. package/dist/getProvider-97db849e.esm.js +0 -1105
  152. package/dist/rpcs-38f4faba.cjs.prod.js +0 -57
  153. package/dist/rpcs-52ea3d8d.cjs.dev.js +0 -57
  154. package/dist/rpcs-d533516e.esm.js +0 -51
  155. package/dist/wagmi-core.cjs.d.ts +0 -1
  156. package/dist/wagmi-core.cjs.dev.js +0 -2683
  157. package/dist/wagmi-core.cjs.js +0 -7
  158. package/dist/wagmi-core.cjs.prod.js +0 -2683
  159. package/dist/wagmi-core.esm.js +0 -2599
  160. package/internal/dist/wagmi-core-internal.cjs.d.ts +0 -1
  161. package/internal/dist/wagmi-core-internal.cjs.dev.js +0 -9
  162. package/internal/dist/wagmi-core-internal.cjs.js +0 -7
  163. package/internal/dist/wagmi-core-internal.cjs.prod.js +0 -9
  164. package/internal/dist/wagmi-core-internal.esm.js +0 -1
  165. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.d.ts +0 -1
  166. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.dev.js +0 -36
  167. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.js +0 -7
  168. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.prod.js +0 -36
  169. package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +0 -32
  170. package/providers/infura/dist/wagmi-core-providers-infura.cjs.d.ts +0 -1
  171. package/providers/infura/dist/wagmi-core-providers-infura.cjs.dev.js +0 -36
  172. package/providers/infura/dist/wagmi-core-providers-infura.cjs.js +0 -7
  173. package/providers/infura/dist/wagmi-core-providers-infura.cjs.prod.js +0 -36
  174. package/providers/infura/dist/wagmi-core-providers-infura.esm.js +0 -32
  175. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.d.ts +0 -1
  176. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.dev.js +0 -46
  177. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.js +0 -7
  178. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.prod.js +0 -46
  179. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.esm.js +0 -42
  180. package/providers/public/dist/wagmi-core-providers-public.cjs.d.ts +0 -1
  181. package/providers/public/dist/wagmi-core-providers-public.cjs.dev.js +0 -32
  182. package/providers/public/dist/wagmi-core-providers-public.cjs.js +0 -7
  183. package/providers/public/dist/wagmi-core-providers-public.cjs.prod.js +0 -32
  184. package/providers/public/dist/wagmi-core-providers-public.esm.js +0 -28
@@ -0,0 +1,1738 @@
1
+ import { P as Provider, W as WebSocketProvider, C as Chain, U as Unit, S as Signer, H as Hash, a as ChainProviderFn, b as ProviderWithFallbackConfig } from './index-bacc1c49.js';
2
+ export { C as Chain, a as ChainProviderFn, E as Ethereum, F as FallbackProviderConfig, H as Hash, P as Provider, b as ProviderWithFallbackConfig, S as Signer, U as Unit, W as WebSocketProvider, c as alchemyRpcUrls, d as allChains, e as chain, f as chainId, g as defaultChains, h as defaultL2Chains, i as etherscanBlockExplorers, j as infuraRpcUrls, p as publicRpcUrls, u as units } from './index-bacc1c49.js';
3
+ import { Mutate, StoreApi } from 'zustand/vanilla';
4
+ import { C as Connector, a as ConnectorData } from './base-5bd9b5ed.js';
5
+ export { C as Connector, a as ConnectorData, b as ConnectorEvents } from './base-5bd9b5ed.js';
6
+ import * as abitype from 'abitype';
7
+ import { Address, ResolvedConfig, TypedDataDomain, Narrow, TypedData, TypedDataToPrimitiveTypes, Abi, ExtractAbiFunction, ExtractAbiEventNames, AbiParametersToPrimitiveTypes, ExtractAbiEvent, AbiFunction, AbiParameterToPrimitiveType, AbiEvent, ExtractAbiFunctionNames } from 'abitype';
8
+ export { Address } from 'abitype';
9
+ import { PopulatedTransaction, Signer as Signer$1, providers, Contract as Contract$1, ethers, ContractInterface } from 'ethers';
10
+ import { O as Options$2, D as DefaultOptions, G as GetConfig$1, a as GetOverridesForAbiStateMutability, U as UnionToIntersection, C as CountOccurrences, A as AbiItemName, I as IsUnknown, E as Event, b as ContractsConfig, c as ContractsResult, d as GetReturnType, e as Or, f as IsNever, N as NotEqual } from './contracts-fb6a6ff0.js';
11
+ export { I as InjectedConnector, a as InjectedConnectorOptions } from './injected-6980e5c3.js';
12
+ import 'eventemitter3';
13
+
14
+ /**
15
+ * [ERC-20 Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-20)
16
+ */
17
+ declare const erc20ABI: readonly [{
18
+ readonly type: "event";
19
+ readonly name: "Approval";
20
+ readonly inputs: readonly [{
21
+ readonly indexed: true;
22
+ readonly name: "owner";
23
+ readonly type: "address";
24
+ }, {
25
+ readonly indexed: true;
26
+ readonly name: "spender";
27
+ readonly type: "address";
28
+ }, {
29
+ readonly indexed: false;
30
+ readonly name: "value";
31
+ readonly type: "uint256";
32
+ }];
33
+ }, {
34
+ readonly type: "event";
35
+ readonly name: "Transfer";
36
+ readonly inputs: readonly [{
37
+ readonly indexed: true;
38
+ readonly name: "from";
39
+ readonly type: "address";
40
+ }, {
41
+ readonly indexed: true;
42
+ readonly name: "to";
43
+ readonly type: "address";
44
+ }, {
45
+ readonly indexed: false;
46
+ readonly name: "value";
47
+ readonly type: "uint256";
48
+ }];
49
+ }, {
50
+ readonly type: "function";
51
+ readonly name: "allowance";
52
+ readonly stateMutability: "view";
53
+ readonly inputs: readonly [{
54
+ readonly name: "owner";
55
+ readonly type: "address";
56
+ }, {
57
+ readonly name: "spender";
58
+ readonly type: "address";
59
+ }];
60
+ readonly outputs: readonly [{
61
+ readonly name: "";
62
+ readonly type: "uint256";
63
+ }];
64
+ }, {
65
+ readonly type: "function";
66
+ readonly name: "approve";
67
+ readonly stateMutability: "nonpayable";
68
+ readonly inputs: readonly [{
69
+ readonly name: "spender";
70
+ readonly type: "address";
71
+ }, {
72
+ readonly name: "amount";
73
+ readonly type: "uint256";
74
+ }];
75
+ readonly outputs: readonly [{
76
+ readonly name: "";
77
+ readonly type: "bool";
78
+ }];
79
+ }, {
80
+ readonly type: "function";
81
+ readonly name: "balanceOf";
82
+ readonly stateMutability: "view";
83
+ readonly inputs: readonly [{
84
+ readonly name: "account";
85
+ readonly type: "address";
86
+ }];
87
+ readonly outputs: readonly [{
88
+ readonly name: "";
89
+ readonly type: "uint256";
90
+ }];
91
+ }, {
92
+ readonly type: "function";
93
+ readonly name: "decimals";
94
+ readonly stateMutability: "view";
95
+ readonly inputs: readonly [];
96
+ readonly outputs: readonly [{
97
+ readonly name: "";
98
+ readonly type: "uint8";
99
+ }];
100
+ }, {
101
+ readonly type: "function";
102
+ readonly name: "name";
103
+ readonly stateMutability: "view";
104
+ readonly inputs: readonly [];
105
+ readonly outputs: readonly [{
106
+ readonly name: "";
107
+ readonly type: "string";
108
+ }];
109
+ }, {
110
+ readonly type: "function";
111
+ readonly name: "symbol";
112
+ readonly stateMutability: "view";
113
+ readonly inputs: readonly [];
114
+ readonly outputs: readonly [{
115
+ readonly name: "";
116
+ readonly type: "string";
117
+ }];
118
+ }, {
119
+ readonly type: "function";
120
+ readonly name: "totalSupply";
121
+ readonly stateMutability: "view";
122
+ readonly inputs: readonly [];
123
+ readonly outputs: readonly [{
124
+ readonly name: "";
125
+ readonly type: "uint256";
126
+ }];
127
+ }, {
128
+ readonly type: "function";
129
+ readonly name: "transfer";
130
+ readonly stateMutability: "nonpayable";
131
+ readonly inputs: readonly [{
132
+ readonly name: "recipient";
133
+ readonly type: "address";
134
+ }, {
135
+ readonly name: "amount";
136
+ readonly type: "uint256";
137
+ }];
138
+ readonly outputs: readonly [{
139
+ readonly name: "";
140
+ readonly type: "bool";
141
+ }];
142
+ }, {
143
+ readonly type: "function";
144
+ readonly name: "transferFrom";
145
+ readonly stateMutability: "nonpayable";
146
+ readonly inputs: readonly [{
147
+ readonly name: "sender";
148
+ readonly type: "address";
149
+ }, {
150
+ readonly name: "recipient";
151
+ readonly type: "address";
152
+ }, {
153
+ readonly name: "amount";
154
+ readonly type: "uint256";
155
+ }];
156
+ readonly outputs: readonly [{
157
+ readonly name: "";
158
+ readonly type: "bool";
159
+ }];
160
+ }];
161
+ /**
162
+ * [ERC-721 Non-Fungible Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-721)
163
+ */
164
+ declare const erc721ABI: readonly [{
165
+ readonly type: "event";
166
+ readonly name: "Approval";
167
+ readonly inputs: readonly [{
168
+ readonly indexed: true;
169
+ readonly name: "owner";
170
+ readonly type: "address";
171
+ }, {
172
+ readonly indexed: true;
173
+ readonly name: "spender";
174
+ readonly type: "address";
175
+ }, {
176
+ readonly indexed: true;
177
+ readonly name: "tokenId";
178
+ readonly type: "uint256";
179
+ }];
180
+ }, {
181
+ readonly type: "event";
182
+ readonly name: "ApprovalForAll";
183
+ readonly inputs: readonly [{
184
+ readonly indexed: true;
185
+ readonly name: "owner";
186
+ readonly type: "address";
187
+ }, {
188
+ readonly indexed: true;
189
+ readonly name: "operator";
190
+ readonly type: "address";
191
+ }, {
192
+ readonly indexed: false;
193
+ readonly name: "approved";
194
+ readonly type: "bool";
195
+ }];
196
+ }, {
197
+ readonly type: "event";
198
+ readonly name: "Transfer";
199
+ readonly inputs: readonly [{
200
+ readonly indexed: true;
201
+ readonly name: "from";
202
+ readonly type: "address";
203
+ }, {
204
+ readonly indexed: true;
205
+ readonly name: "to";
206
+ readonly type: "address";
207
+ }, {
208
+ readonly indexed: true;
209
+ readonly name: "tokenId";
210
+ readonly type: "uint256";
211
+ }];
212
+ }, {
213
+ readonly type: "function";
214
+ readonly name: "approve";
215
+ readonly stateMutability: "payable";
216
+ readonly inputs: readonly [{
217
+ readonly name: "spender";
218
+ readonly type: "address";
219
+ }, {
220
+ readonly name: "tokenId";
221
+ readonly type: "uint256";
222
+ }];
223
+ readonly outputs: readonly [];
224
+ }, {
225
+ readonly type: "function";
226
+ readonly name: "balanceOf";
227
+ readonly stateMutability: "view";
228
+ readonly inputs: readonly [{
229
+ readonly name: "account";
230
+ readonly type: "address";
231
+ }];
232
+ readonly outputs: readonly [{
233
+ readonly name: "";
234
+ readonly type: "uint256";
235
+ }];
236
+ }, {
237
+ readonly type: "function";
238
+ readonly name: "getApproved";
239
+ readonly stateMutability: "view";
240
+ readonly inputs: readonly [{
241
+ readonly name: "tokenId";
242
+ readonly type: "uint256";
243
+ }];
244
+ readonly outputs: readonly [{
245
+ readonly name: "";
246
+ readonly type: "address";
247
+ }];
248
+ }, {
249
+ readonly type: "function";
250
+ readonly name: "isApprovedForAll";
251
+ readonly stateMutability: "view";
252
+ readonly inputs: readonly [{
253
+ readonly name: "owner";
254
+ readonly type: "address";
255
+ }, {
256
+ readonly name: "operator";
257
+ readonly type: "address";
258
+ }];
259
+ readonly outputs: readonly [{
260
+ readonly name: "";
261
+ readonly type: "bool";
262
+ }];
263
+ }, {
264
+ readonly type: "function";
265
+ readonly name: "name";
266
+ readonly stateMutability: "view";
267
+ readonly inputs: readonly [];
268
+ readonly outputs: readonly [{
269
+ readonly name: "";
270
+ readonly type: "string";
271
+ }];
272
+ }, {
273
+ readonly type: "function";
274
+ readonly name: "ownerOf";
275
+ readonly stateMutability: "view";
276
+ readonly inputs: readonly [{
277
+ readonly name: "tokenId";
278
+ readonly type: "uint256";
279
+ }];
280
+ readonly outputs: readonly [{
281
+ readonly name: "owner";
282
+ readonly type: "address";
283
+ }];
284
+ }, {
285
+ readonly type: "function";
286
+ readonly name: "safeTransferFrom";
287
+ readonly stateMutability: "payable";
288
+ readonly inputs: readonly [{
289
+ readonly name: "from";
290
+ readonly type: "address";
291
+ }, {
292
+ readonly name: "to";
293
+ readonly type: "address";
294
+ }, {
295
+ readonly name: "tokenId";
296
+ readonly type: "uint256";
297
+ }];
298
+ readonly outputs: readonly [];
299
+ }, {
300
+ readonly type: "function";
301
+ readonly name: "safeTransferFrom";
302
+ readonly stateMutability: "nonpayable";
303
+ readonly inputs: readonly [{
304
+ readonly name: "from";
305
+ readonly type: "address";
306
+ }, {
307
+ readonly name: "to";
308
+ readonly type: "address";
309
+ }, {
310
+ readonly name: "id";
311
+ readonly type: "uint256";
312
+ }, {
313
+ readonly name: "data";
314
+ readonly type: "bytes";
315
+ }];
316
+ readonly outputs: readonly [];
317
+ }, {
318
+ readonly type: "function";
319
+ readonly name: "setApprovalForAll";
320
+ readonly stateMutability: "nonpayable";
321
+ readonly inputs: readonly [{
322
+ readonly name: "operator";
323
+ readonly type: "address";
324
+ }, {
325
+ readonly name: "approved";
326
+ readonly type: "bool";
327
+ }];
328
+ readonly outputs: readonly [];
329
+ }, {
330
+ readonly type: "function";
331
+ readonly name: "symbol";
332
+ readonly stateMutability: "view";
333
+ readonly inputs: readonly [];
334
+ readonly outputs: readonly [{
335
+ readonly name: "";
336
+ readonly type: "string";
337
+ }];
338
+ }, {
339
+ readonly type: "function";
340
+ readonly name: "tokenByIndex";
341
+ readonly stateMutability: "view";
342
+ readonly inputs: readonly [{
343
+ readonly name: "index";
344
+ readonly type: "uint256";
345
+ }];
346
+ readonly outputs: readonly [{
347
+ readonly name: "";
348
+ readonly type: "uint256";
349
+ }];
350
+ }, {
351
+ readonly type: "function";
352
+ readonly name: "tokenByIndex";
353
+ readonly stateMutability: "view";
354
+ readonly inputs: readonly [{
355
+ readonly name: "owner";
356
+ readonly type: "address";
357
+ }, {
358
+ readonly name: "index";
359
+ readonly type: "uint256";
360
+ }];
361
+ readonly outputs: readonly [{
362
+ readonly name: "tokenId";
363
+ readonly type: "uint256";
364
+ }];
365
+ }, {
366
+ readonly type: "function";
367
+ readonly name: "tokenURI";
368
+ readonly stateMutability: "view";
369
+ readonly inputs: readonly [{
370
+ readonly name: "tokenId";
371
+ readonly type: "uint256";
372
+ }];
373
+ readonly outputs: readonly [{
374
+ readonly name: "";
375
+ readonly type: "string";
376
+ }];
377
+ }, {
378
+ readonly type: "function";
379
+ readonly name: "totalSupply";
380
+ readonly stateMutability: "view";
381
+ readonly inputs: readonly [];
382
+ readonly outputs: readonly [{
383
+ readonly name: "";
384
+ readonly type: "uint256";
385
+ }];
386
+ }, {
387
+ readonly type: "function";
388
+ readonly name: "transferFrom";
389
+ readonly stateMutability: "payable";
390
+ readonly inputs: readonly [{
391
+ readonly name: "sender";
392
+ readonly type: "address";
393
+ }, {
394
+ readonly name: "recipient";
395
+ readonly type: "address";
396
+ }, {
397
+ readonly name: "tokeId";
398
+ readonly type: "uint256";
399
+ }];
400
+ readonly outputs: readonly [];
401
+ }];
402
+ /**
403
+ * [ERC-4626 Tokenized Vaults Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626)
404
+ */
405
+ declare const erc4626ABI: readonly [{
406
+ readonly anonymous: false;
407
+ readonly inputs: readonly [{
408
+ readonly indexed: true;
409
+ readonly name: "owner";
410
+ readonly type: "address";
411
+ }, {
412
+ readonly indexed: true;
413
+ readonly name: "spender";
414
+ readonly type: "address";
415
+ }, {
416
+ readonly indexed: false;
417
+ readonly name: "value";
418
+ readonly type: "uint256";
419
+ }];
420
+ readonly name: "Approval";
421
+ readonly type: "event";
422
+ }, {
423
+ readonly anonymous: false;
424
+ readonly inputs: readonly [{
425
+ readonly indexed: true;
426
+ readonly name: "sender";
427
+ readonly type: "address";
428
+ }, {
429
+ readonly indexed: true;
430
+ readonly name: "receiver";
431
+ readonly type: "address";
432
+ }, {
433
+ readonly indexed: false;
434
+ readonly name: "assets";
435
+ readonly type: "uint256";
436
+ }, {
437
+ readonly indexed: false;
438
+ readonly name: "shares";
439
+ readonly type: "uint256";
440
+ }];
441
+ readonly name: "Deposit";
442
+ readonly type: "event";
443
+ }, {
444
+ readonly anonymous: false;
445
+ readonly inputs: readonly [{
446
+ readonly indexed: true;
447
+ readonly name: "from";
448
+ readonly type: "address";
449
+ }, {
450
+ readonly indexed: true;
451
+ readonly name: "to";
452
+ readonly type: "address";
453
+ }, {
454
+ readonly indexed: false;
455
+ readonly name: "value";
456
+ readonly type: "uint256";
457
+ }];
458
+ readonly name: "Transfer";
459
+ readonly type: "event";
460
+ }, {
461
+ readonly anonymous: false;
462
+ readonly inputs: readonly [{
463
+ readonly indexed: true;
464
+ readonly name: "sender";
465
+ readonly type: "address";
466
+ }, {
467
+ readonly indexed: true;
468
+ readonly name: "receiver";
469
+ readonly type: "address";
470
+ }, {
471
+ readonly indexed: true;
472
+ readonly name: "owner";
473
+ readonly type: "address";
474
+ }, {
475
+ readonly indexed: false;
476
+ readonly name: "assets";
477
+ readonly type: "uint256";
478
+ }, {
479
+ readonly indexed: false;
480
+ readonly name: "shares";
481
+ readonly type: "uint256";
482
+ }];
483
+ readonly name: "Withdraw";
484
+ readonly type: "event";
485
+ }, {
486
+ readonly inputs: readonly [{
487
+ readonly name: "owner";
488
+ readonly type: "address";
489
+ }, {
490
+ readonly name: "spender";
491
+ readonly type: "address";
492
+ }];
493
+ readonly name: "allowance";
494
+ readonly outputs: readonly [{
495
+ readonly name: "";
496
+ readonly type: "uint256";
497
+ }];
498
+ readonly stateMutability: "view";
499
+ readonly type: "function";
500
+ }, {
501
+ readonly inputs: readonly [{
502
+ readonly name: "spender";
503
+ readonly type: "address";
504
+ }, {
505
+ readonly name: "amount";
506
+ readonly type: "uint256";
507
+ }];
508
+ readonly name: "approve";
509
+ readonly outputs: readonly [{
510
+ readonly name: "";
511
+ readonly type: "bool";
512
+ }];
513
+ readonly stateMutability: "nonpayable";
514
+ readonly type: "function";
515
+ }, {
516
+ readonly inputs: readonly [];
517
+ readonly name: "asset";
518
+ readonly outputs: readonly [{
519
+ readonly name: "assetTokenAddress";
520
+ readonly type: "address";
521
+ }];
522
+ readonly stateMutability: "view";
523
+ readonly type: "function";
524
+ }, {
525
+ readonly inputs: readonly [{
526
+ readonly name: "account";
527
+ readonly type: "address";
528
+ }];
529
+ readonly name: "balanceOf";
530
+ readonly outputs: readonly [{
531
+ readonly name: "";
532
+ readonly type: "uint256";
533
+ }];
534
+ readonly stateMutability: "view";
535
+ readonly type: "function";
536
+ }, {
537
+ readonly inputs: readonly [{
538
+ readonly name: "shares";
539
+ readonly type: "uint256";
540
+ }];
541
+ readonly name: "convertToAssets";
542
+ readonly outputs: readonly [{
543
+ readonly name: "assets";
544
+ readonly type: "uint256";
545
+ }];
546
+ readonly stateMutability: "view";
547
+ readonly type: "function";
548
+ }, {
549
+ readonly inputs: readonly [{
550
+ readonly name: "assets";
551
+ readonly type: "uint256";
552
+ }];
553
+ readonly name: "convertToShares";
554
+ readonly outputs: readonly [{
555
+ readonly name: "shares";
556
+ readonly type: "uint256";
557
+ }];
558
+ readonly stateMutability: "view";
559
+ readonly type: "function";
560
+ }, {
561
+ readonly inputs: readonly [{
562
+ readonly name: "assets";
563
+ readonly type: "uint256";
564
+ }, {
565
+ readonly name: "receiver";
566
+ readonly type: "address";
567
+ }];
568
+ readonly name: "deposit";
569
+ readonly outputs: readonly [{
570
+ readonly name: "shares";
571
+ readonly type: "uint256";
572
+ }];
573
+ readonly stateMutability: "nonpayable";
574
+ readonly type: "function";
575
+ }, {
576
+ readonly inputs: readonly [{
577
+ readonly name: "caller";
578
+ readonly type: "address";
579
+ }];
580
+ readonly name: "maxDeposit";
581
+ readonly outputs: readonly [{
582
+ readonly name: "maxAssets";
583
+ readonly type: "uint256";
584
+ }];
585
+ readonly stateMutability: "view";
586
+ readonly type: "function";
587
+ }, {
588
+ readonly inputs: readonly [{
589
+ readonly name: "caller";
590
+ readonly type: "address";
591
+ }];
592
+ readonly name: "maxMint";
593
+ readonly outputs: readonly [{
594
+ readonly name: "maxShares";
595
+ readonly type: "uint256";
596
+ }];
597
+ readonly stateMutability: "view";
598
+ readonly type: "function";
599
+ }, {
600
+ readonly inputs: readonly [{
601
+ readonly name: "owner";
602
+ readonly type: "address";
603
+ }];
604
+ readonly name: "maxRedeem";
605
+ readonly outputs: readonly [{
606
+ readonly name: "maxShares";
607
+ readonly type: "uint256";
608
+ }];
609
+ readonly stateMutability: "view";
610
+ readonly type: "function";
611
+ }, {
612
+ readonly inputs: readonly [{
613
+ readonly name: "owner";
614
+ readonly type: "address";
615
+ }];
616
+ readonly name: "maxWithdraw";
617
+ readonly outputs: readonly [{
618
+ readonly name: "maxAssets";
619
+ readonly type: "uint256";
620
+ }];
621
+ readonly stateMutability: "view";
622
+ readonly type: "function";
623
+ }, {
624
+ readonly inputs: readonly [{
625
+ readonly name: "shares";
626
+ readonly type: "uint256";
627
+ }, {
628
+ readonly name: "receiver";
629
+ readonly type: "address";
630
+ }];
631
+ readonly name: "mint";
632
+ readonly outputs: readonly [{
633
+ readonly name: "assets";
634
+ readonly type: "uint256";
635
+ }];
636
+ readonly stateMutability: "nonpayable";
637
+ readonly type: "function";
638
+ }, {
639
+ readonly inputs: readonly [{
640
+ readonly name: "assets";
641
+ readonly type: "uint256";
642
+ }];
643
+ readonly name: "previewDeposit";
644
+ readonly outputs: readonly [{
645
+ readonly name: "shares";
646
+ readonly type: "uint256";
647
+ }];
648
+ readonly stateMutability: "view";
649
+ readonly type: "function";
650
+ }, {
651
+ readonly inputs: readonly [{
652
+ readonly name: "shares";
653
+ readonly type: "uint256";
654
+ }];
655
+ readonly name: "previewMint";
656
+ readonly outputs: readonly [{
657
+ readonly name: "assets";
658
+ readonly type: "uint256";
659
+ }];
660
+ readonly stateMutability: "view";
661
+ readonly type: "function";
662
+ }, {
663
+ readonly inputs: readonly [{
664
+ readonly name: "shares";
665
+ readonly type: "uint256";
666
+ }];
667
+ readonly name: "previewRedeem";
668
+ readonly outputs: readonly [{
669
+ readonly name: "assets";
670
+ readonly type: "uint256";
671
+ }];
672
+ readonly stateMutability: "view";
673
+ readonly type: "function";
674
+ }, {
675
+ readonly inputs: readonly [{
676
+ readonly name: "assets";
677
+ readonly type: "uint256";
678
+ }];
679
+ readonly name: "previewWithdraw";
680
+ readonly outputs: readonly [{
681
+ readonly name: "shares";
682
+ readonly type: "uint256";
683
+ }];
684
+ readonly stateMutability: "view";
685
+ readonly type: "function";
686
+ }, {
687
+ readonly inputs: readonly [{
688
+ readonly name: "shares";
689
+ readonly type: "uint256";
690
+ }, {
691
+ readonly name: "receiver";
692
+ readonly type: "address";
693
+ }, {
694
+ readonly name: "owner";
695
+ readonly type: "address";
696
+ }];
697
+ readonly name: "redeem";
698
+ readonly outputs: readonly [{
699
+ readonly name: "assets";
700
+ readonly type: "uint256";
701
+ }];
702
+ readonly stateMutability: "nonpayable";
703
+ readonly type: "function";
704
+ }, {
705
+ readonly inputs: readonly [];
706
+ readonly name: "totalAssets";
707
+ readonly outputs: readonly [{
708
+ readonly name: "totalManagedAssets";
709
+ readonly type: "uint256";
710
+ }];
711
+ readonly stateMutability: "view";
712
+ readonly type: "function";
713
+ }, {
714
+ readonly inputs: readonly [];
715
+ readonly name: "totalSupply";
716
+ readonly outputs: readonly [{
717
+ readonly name: "";
718
+ readonly type: "uint256";
719
+ }];
720
+ readonly stateMutability: "view";
721
+ readonly type: "function";
722
+ }, {
723
+ readonly inputs: readonly [{
724
+ readonly name: "to";
725
+ readonly type: "address";
726
+ }, {
727
+ readonly name: "amount";
728
+ readonly type: "uint256";
729
+ }];
730
+ readonly name: "transfer";
731
+ readonly outputs: readonly [{
732
+ readonly name: "";
733
+ readonly type: "bool";
734
+ }];
735
+ readonly stateMutability: "nonpayable";
736
+ readonly type: "function";
737
+ }, {
738
+ readonly inputs: readonly [{
739
+ readonly name: "from";
740
+ readonly type: "address";
741
+ }, {
742
+ readonly name: "to";
743
+ readonly type: "address";
744
+ }, {
745
+ readonly name: "amount";
746
+ readonly type: "uint256";
747
+ }];
748
+ readonly name: "transferFrom";
749
+ readonly outputs: readonly [{
750
+ readonly name: "";
751
+ readonly type: "bool";
752
+ }];
753
+ readonly stateMutability: "nonpayable";
754
+ readonly type: "function";
755
+ }, {
756
+ readonly inputs: readonly [{
757
+ readonly name: "assets";
758
+ readonly type: "uint256";
759
+ }, {
760
+ readonly name: "receiver";
761
+ readonly type: "address";
762
+ }, {
763
+ readonly name: "owner";
764
+ readonly type: "address";
765
+ }];
766
+ readonly name: "withdraw";
767
+ readonly outputs: readonly [{
768
+ readonly name: "shares";
769
+ readonly type: "uint256";
770
+ }];
771
+ readonly stateMutability: "nonpayable";
772
+ readonly type: "function";
773
+ }];
774
+
775
+ declare type BaseStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
776
+ declare type ClientStorage = {
777
+ getItem<T>(key: string, defaultState?: T | null): T | null;
778
+ setItem<T>(key: string, value: T | null): void;
779
+ removeItem(key: string): void;
780
+ };
781
+ declare const noopStorage: BaseStorage;
782
+ declare function createStorage({ storage, key: prefix, }: {
783
+ storage: BaseStorage;
784
+ key?: string;
785
+ }): ClientStorage;
786
+
787
+ declare type ClientConfig<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = {
788
+ /** Enables reconnecting to last used connector on init */
789
+ autoConnect?: boolean;
790
+ /**
791
+ * Connectors used for linking accounts
792
+ * @default [new InjectedConnector()]
793
+ */
794
+ connectors?: (() => Connector[]) | Connector[];
795
+ /** Custom logger */
796
+ logger?: {
797
+ warn: typeof console.warn | null;
798
+ };
799
+ /** Interface for connecting to network */
800
+ provider: ((config: {
801
+ chainId?: number;
802
+ }) => TProvider) | TProvider;
803
+ /**
804
+ * Custom storage for data persistance
805
+ * @default window.localStorage
806
+ */
807
+ storage?: ClientStorage;
808
+ /** WebSocket interface for connecting to network */
809
+ webSocketProvider?: ((config: {
810
+ chainId?: number;
811
+ }) => TWebSocketProvider | undefined) | TWebSocketProvider;
812
+ };
813
+ declare type Data$1<TProvider extends Provider> = ConnectorData<TProvider>;
814
+ declare type State<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = {
815
+ chains?: Connector['chains'];
816
+ connector?: Connector;
817
+ connectors: Connector[];
818
+ data?: Data$1<TProvider>;
819
+ error?: Error;
820
+ provider: TProvider;
821
+ status: 'connected' | 'connecting' | 'reconnecting' | 'disconnected';
822
+ webSocketProvider?: TWebSocketProvider;
823
+ };
824
+ declare class Client<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> {
825
+ #private;
826
+ config: ClientConfig<TProvider, TWebSocketProvider>;
827
+ providers: Map<number, TProvider | undefined>;
828
+ storage: ClientStorage;
829
+ store: Mutate<StoreApi<State<TProvider, TWebSocketProvider>>, [
830
+ [
831
+ 'zustand/subscribeWithSelector',
832
+ never
833
+ ],
834
+ [
835
+ 'zustand/persist',
836
+ Partial<State<TProvider, TWebSocketProvider>>
837
+ ]
838
+ ]>;
839
+ webSocketProviders: Map<number, TWebSocketProvider | undefined>;
840
+ constructor({ autoConnect, connectors, provider, storage, logger, webSocketProvider, }: ClientConfig<TProvider, TWebSocketProvider>);
841
+ get chains(): Chain[] | undefined;
842
+ get connectors(): Connector<any, any, any>[];
843
+ get connector(): Connector<any, any, any> | undefined;
844
+ get data(): Data$1<TProvider> | undefined;
845
+ get error(): Error | undefined;
846
+ get lastUsedChainId(): number | undefined;
847
+ get provider(): TProvider;
848
+ get status(): "connecting" | "connected" | "reconnecting" | "disconnected";
849
+ get subscribe(): {
850
+ (listener: (selectedState: State<TProvider, TWebSocketProvider>, previousSelectedState: State<TProvider, TWebSocketProvider>) => void): () => void;
851
+ <U>(selector: (state: State<TProvider, TWebSocketProvider>) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
852
+ equalityFn?: ((a: U, b: U) => boolean) | undefined;
853
+ fireImmediately?: boolean | undefined;
854
+ } | undefined): () => void;
855
+ };
856
+ get webSocketProvider(): TWebSocketProvider | undefined;
857
+ setState(updater: State<TProvider, TWebSocketProvider> | ((state: State<TProvider, TWebSocketProvider>) => State<TProvider, TWebSocketProvider>)): void;
858
+ clearState(): void;
859
+ destroy(): Promise<void>;
860
+ autoConnect(): Promise<Data$1<TProvider> | undefined>;
861
+ getProvider({ bust, chainId }?: {
862
+ bust?: boolean;
863
+ chainId?: number;
864
+ }): TProvider;
865
+ getWebSocketProvider({ bust, chainId, }?: {
866
+ bust?: boolean;
867
+ chainId?: number;
868
+ }): TWebSocketProvider | undefined;
869
+ setLastUsedConnector(lastUsedConnector?: string | null): void;
870
+ }
871
+ declare function createClient<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider>(config: ClientConfig<TProvider, TWebSocketProvider>): Client<TProvider, TWebSocketProvider>;
872
+
873
+ declare type ConnectArgs = {
874
+ /** Chain ID to connect to */
875
+ chainId?: number;
876
+ /** Connector to connect */
877
+ connector: Connector;
878
+ };
879
+ declare type Data<TProvider extends Provider = Provider> = Required<ConnectorData<TProvider>>;
880
+ declare type ConnectResult<TProvider extends Provider = Provider> = {
881
+ account: Data<TProvider>['account'];
882
+ chain: Data<TProvider>['chain'];
883
+ connector: Client<TProvider>['connector'];
884
+ provider: Data<TProvider>['provider'];
885
+ };
886
+ declare function connect<TProvider extends Provider = Provider>({ chainId, connector, }: ConnectArgs): Promise<ConnectResult<TProvider>>;
887
+
888
+ declare function disconnect(): Promise<void>;
889
+
890
+ declare type FetchBalanceArgs = {
891
+ /** Address of balance to check */
892
+ address: Address;
893
+ /** Chain id to use for provider */
894
+ chainId?: number;
895
+ /** Units for formatting output */
896
+ formatUnits?: Unit | number;
897
+ /** ERC-20 address */
898
+ token?: Address;
899
+ };
900
+ declare type FetchBalanceResult = {
901
+ decimals: ResolvedConfig['IntType'];
902
+ formatted: string;
903
+ symbol: string;
904
+ value: ResolvedConfig['BigIntType'];
905
+ };
906
+ declare function fetchBalance({ address, chainId, formatUnits: unit, token, }: FetchBalanceArgs): Promise<FetchBalanceResult>;
907
+
908
+ declare type FetchSignerArgs = {
909
+ /** Chain ID to use for signer */
910
+ chainId?: number;
911
+ };
912
+ declare type FetchSignerResult<TSigner extends Signer = Signer> = TSigner | null;
913
+ declare function fetchSigner<TSigner extends Signer = Signer>({ chainId, }?: FetchSignerArgs): Promise<FetchSignerResult<TSigner>>;
914
+
915
+ declare type GetAccountResult<TProvider extends Provider = Provider> = {
916
+ address: NonNullable<Data$1<TProvider>['account']>;
917
+ connector: NonNullable<Client<TProvider>['connector']>;
918
+ isConnected: true;
919
+ isConnecting: false;
920
+ isDisconnected: false;
921
+ isReconnecting: false;
922
+ status: 'connected';
923
+ } | {
924
+ address: Data$1<TProvider>['account'];
925
+ connector: Client<TProvider>['connector'];
926
+ isConnected: boolean;
927
+ isConnecting: false;
928
+ isDisconnected: false;
929
+ isReconnecting: true;
930
+ status: 'reconnecting';
931
+ } | {
932
+ address: undefined;
933
+ connector: undefined;
934
+ isConnected: false;
935
+ isReconnecting: false;
936
+ isConnecting: true;
937
+ isDisconnected: false;
938
+ status: 'connecting';
939
+ } | {
940
+ address: undefined;
941
+ connector: undefined;
942
+ isConnected: false;
943
+ isReconnecting: false;
944
+ isConnecting: false;
945
+ isDisconnected: true;
946
+ status: 'disconnected';
947
+ };
948
+ declare function getAccount<TProvider extends Provider>(): GetAccountResult<TProvider>;
949
+
950
+ declare type GetNetworkResult = {
951
+ chain?: Chain & {
952
+ unsupported?: boolean;
953
+ };
954
+ chains: Chain[];
955
+ };
956
+ declare function getNetwork(): GetNetworkResult;
957
+
958
+ declare type SignMessageArgs = {
959
+ /** Message to sign with wallet */
960
+ message: string | Uint8Array;
961
+ };
962
+ declare type SignMessageResult = ResolvedConfig['BytesType'];
963
+ declare function signMessage(args: SignMessageArgs): Promise<SignMessageResult>;
964
+
965
+ declare type SignTypedDataArgs<TTypedData = unknown> = {
966
+ /** Domain or domain signature for origin or contract */
967
+ domain: TypedDataDomain;
968
+ /** Named list of all type definitions */
969
+ types: Narrow<TTypedData>;
970
+ } & (TTypedData extends TypedData ? TypedDataToPrimitiveTypes<TTypedData> extends infer TSchema ? TSchema[keyof TSchema] extends infer TValue ? {
971
+ [key: string]: any;
972
+ } extends TValue ? {
973
+ /**
974
+ * Data to sign
975
+ *
976
+ * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link types} for type inference.
977
+ */
978
+ value: {
979
+ [key: string]: unknown;
980
+ };
981
+ } : {
982
+ /** Data to sign */
983
+ value: TValue;
984
+ } : never : never : never);
985
+ declare type SignTypedDataResult = string;
986
+ declare function signTypedData<TTypedData extends TypedData>({ domain, types, value, }: SignTypedDataArgs<TTypedData>): Promise<SignTypedDataResult>;
987
+
988
+ declare type SwitchNetworkArgs = {
989
+ chainId: number;
990
+ };
991
+ declare type SwitchNetworkResult = Chain;
992
+ declare function switchNetwork({ chainId, }: SwitchNetworkArgs): Promise<SwitchNetworkResult>;
993
+
994
+ declare type WatchAccountCallback<TProvider extends Provider = Provider> = (data: GetAccountResult<TProvider>) => void;
995
+ declare type WatchAccountConfig = {
996
+ selector?({ address, connector, status, }: {
997
+ address?: string;
998
+ connector?: Connector;
999
+ status: GetAccountResult['status'];
1000
+ }): any;
1001
+ };
1002
+ declare function watchAccount<TProvider extends Provider>(callback: WatchAccountCallback<TProvider>, { selector }?: WatchAccountConfig): () => void;
1003
+
1004
+ declare type WatchNetworkCallback = (data: GetNetworkResult) => void;
1005
+ declare type WatchNetworkConfig = {
1006
+ selector?({ chainId, chains }: {
1007
+ chainId?: number;
1008
+ chains?: Chain[];
1009
+ }): any;
1010
+ };
1011
+ declare function watchNetwork(callback: WatchNetworkCallback, { selector }?: WatchNetworkConfig): () => void;
1012
+
1013
+ declare type WatchSignerArgs = FetchSignerArgs;
1014
+ declare type WatchSignerCallback<TSigner extends Signer = Signer> = (data: FetchSignerResult<TSigner>) => void;
1015
+ declare function watchSigner<TSigner extends Signer = Signer>({ chainId }: WatchSignerArgs, callback: WatchSignerCallback<TSigner>): () => void;
1016
+
1017
+ declare type FetchTokenArgs = {
1018
+ /** Address of ERC-20 token */
1019
+ address: Address;
1020
+ /** Chain id to use for provider */
1021
+ chainId?: number;
1022
+ /** Units for formatting output */
1023
+ formatUnits?: Unit | number;
1024
+ };
1025
+ declare type FetchTokenResult = {
1026
+ address: Address;
1027
+ decimals: ResolvedConfig['IntType'];
1028
+ name: string;
1029
+ symbol: string;
1030
+ totalSupply: {
1031
+ formatted: string;
1032
+ value: ResolvedConfig['BigIntType'];
1033
+ };
1034
+ };
1035
+ declare function fetchToken({ address, chainId, formatUnits: units, }: FetchTokenArgs): Promise<FetchTokenResult>;
1036
+
1037
+ declare type PrepareWriteContractConfig<TAbi = Abi, TFunctionName = string, TSigner extends Signer = Signer, TOptions extends Options$2 = DefaultOptions> = GetConfig$1<{
1038
+ abi: TAbi;
1039
+ functionName: TFunctionName;
1040
+ /** Chain id to use for provider */
1041
+ chainId?: number;
1042
+ /** Overrides */
1043
+ overrides?: GetOverridesForAbiStateMutability<[
1044
+ TAbi,
1045
+ TFunctionName
1046
+ ] extends [
1047
+ infer TAbi_ extends Abi,
1048
+ infer TFunctionName_ extends string
1049
+ ] ? ExtractAbiFunction<TAbi_, TFunctionName_>['stateMutability'] : 'nonpayable' | 'payable'>;
1050
+ /** Custom signer */
1051
+ signer?: TSigner | null;
1052
+ }, 'nonpayable' | 'payable', TOptions>;
1053
+ declare type PrepareWriteContractResult<TAbi = Abi, TFunctionName extends string = string> = {
1054
+ abi: TAbi extends Abi ? [ExtractAbiFunction<TAbi, TFunctionName>] : readonly unknown[];
1055
+ address: string;
1056
+ chainId?: number;
1057
+ functionName: TFunctionName;
1058
+ mode: 'prepared';
1059
+ request: PopulatedTransaction & {
1060
+ to: Address;
1061
+ gasLimit: NonNullable<PopulatedTransaction['gasLimit']>;
1062
+ };
1063
+ };
1064
+ /**
1065
+ * @description Prepares the parameters required for a contract write transaction.
1066
+ *
1067
+ * Returns config to be passed through to `writeContract`.
1068
+ *
1069
+ * @example
1070
+ * import { prepareWriteContract, writeContract } from '@wagmi/core'
1071
+ *
1072
+ * const config = await prepareWriteContract({
1073
+ * address: '0x...',
1074
+ * abi: wagmiAbi,
1075
+ * functionName: 'mint',
1076
+ * })
1077
+ * const result = await writeContract(config)
1078
+ */
1079
+ declare function prepareWriteContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TSigner extends Signer = Signer>({ abi, address, args, chainId, functionName, overrides, signer: signer_, }: PrepareWriteContractConfig<TAbi, TFunctionName, TSigner>): Promise<PrepareWriteContractResult<TAbi, TFunctionName>>;
1080
+
1081
+ declare type GetContractArgs<TAbi extends Abi | readonly unknown[] = Abi> = {
1082
+ /** Contract address */
1083
+ address: string;
1084
+ /** Contract ABI */
1085
+ abi: Narrow<TAbi>;
1086
+ /** Signer or provider to attach to contract */
1087
+ signerOrProvider?: Signer$1 | providers.Provider;
1088
+ };
1089
+ declare type GetContractResult<TAbi = unknown> = TAbi extends Abi ? Contract<TAbi> & Contract$1 : Contract$1;
1090
+ declare function getContract<TAbi extends Abi | readonly unknown[]>({ address, abi, signerOrProvider, }: GetContractArgs<TAbi>): GetContractResult<TAbi>;
1091
+ declare type PropertyKeys = 'address' | 'attach' | 'connect' | 'deployed' | 'interface' | 'resolvedAddress';
1092
+ declare type FunctionKeys = 'callStatic' | 'estimateGas' | 'functions' | 'populateTransaction';
1093
+ declare type EventKeys = 'emit' | 'filters' | 'listenerCount' | 'listeners' | 'off' | 'on' | 'once' | 'queryFilter' | 'removeAllListeners' | 'removeListener';
1094
+ declare type BaseContract<TContract extends Record<keyof Pick<Contract$1, PropertyKeys | FunctionKeys | EventKeys>, unknown>> = Omit<Contract$1, PropertyKeys | FunctionKeys | EventKeys> & TContract;
1095
+ declare type InterfaceKeys = 'events' | 'functions';
1096
+ declare type BaseInterface<Interface extends Record<keyof Pick<ethers.utils.Interface, InterfaceKeys>, unknown>> = Omit<ethers.utils.Interface, InterfaceKeys> & Interface;
1097
+ declare type Contract<TAbi extends Abi, _Functions = Functions<TAbi>> = _Functions & BaseContract<{
1098
+ address: Address;
1099
+ resolvedAddress: Promise<Address>;
1100
+ attach(addressOrName: Address | string): Contract<TAbi>;
1101
+ connect(signerOrProvider: ethers.Signer | ethers.providers.Provider | string): Contract<TAbi>;
1102
+ deployed(): Promise<Contract<TAbi>>;
1103
+ interface: BaseInterface<{
1104
+ events: InterfaceEvents<TAbi>;
1105
+ functions: InterfaceFunctions<TAbi>;
1106
+ }>;
1107
+ callStatic: _Functions;
1108
+ estimateGas: Functions<TAbi, {
1109
+ ReturnType: ResolvedConfig['BigIntType'];
1110
+ }>;
1111
+ functions: Functions<TAbi, {
1112
+ ReturnTypeAsArray: true;
1113
+ }>;
1114
+ populateTransaction: Functions<TAbi, {
1115
+ ReturnType: ethers.PopulatedTransaction;
1116
+ }>;
1117
+ emit<TEventName extends ExtractAbiEventNames<TAbi> | ethers.EventFilter>(eventName: TEventName, ...args: AbiParametersToPrimitiveTypes<ExtractAbiEvent<TAbi, TEventName extends string ? TEventName : ExtractAbiEventNames<TAbi>>['inputs']> extends infer TArgs extends readonly unknown[] ? TArgs : never): boolean;
1118
+ filters: Filters<TAbi>;
1119
+ listenerCount(): number;
1120
+ listenerCount<TEventName extends ExtractAbiEventNames<TAbi>>(eventName: TEventName): number;
1121
+ listenerCount(eventFilter: ethers.EventFilter): number;
1122
+ listeners(): Array<(...args: any[]) => void>;
1123
+ listeners<TEventName extends ExtractAbiEventNames<TAbi>>(eventName: TEventName): Array<Listener<TAbi, TEventName>>;
1124
+ listeners(eventFilter: ethers.EventFilter): Array<Listener<TAbi, ExtractAbiEventNames<TAbi>>>;
1125
+ off: EventListener<TAbi>;
1126
+ on: EventListener<TAbi>;
1127
+ once: EventListener<TAbi>;
1128
+ queryFilter<TEventName extends ExtractAbiEventNames<TAbi>>(event: TEventName, fromBlockOrBlockhash?: string | number, toBlock?: string | number): Promise<Array<ethers.Event>>;
1129
+ queryFilter(eventFilter: ethers.EventFilter, fromBlockOrBlockhash?: string | number, toBlock?: string | number): Promise<Array<ethers.Event>>;
1130
+ removeAllListeners(eventName?: ExtractAbiEventNames<TAbi>): Contract<TAbi>;
1131
+ removeAllListeners(eventFilter: ethers.EventFilter): Contract<TAbi>;
1132
+ removeListener: EventListener<TAbi>;
1133
+ }>;
1134
+ declare type Functions<TAbi extends Abi, Options extends {
1135
+ ReturnType?: any;
1136
+ ReturnTypeAsArray?: boolean;
1137
+ } = {
1138
+ ReturnTypeAsArray: false;
1139
+ }> = UnionToIntersection<{
1140
+ [K in keyof TAbi]: TAbi[K] extends infer TAbiFunction extends AbiFunction & {
1141
+ type: 'function';
1142
+ } ? {
1143
+ [K in CountOccurrences<TAbi, {
1144
+ name: TAbiFunction['name'];
1145
+ }> extends 1 ? AbiItemName<TAbiFunction> : AbiItemName<TAbiFunction, true>]: (...args: [
1146
+ ...args: TAbiFunction['inputs'] extends infer TInputs extends readonly AbiParameter[] ? AbiParametersToPrimitiveTypes<TInputs> : never,
1147
+ overrides?: GetOverridesForAbiStateMutability<TAbiFunction['stateMutability']>
1148
+ ]) => Promise<IsUnknown<Options['ReturnType']> extends true ? AbiFunctionReturnType<TAbiFunction> extends infer TAbiFunctionReturnType ? Options['ReturnTypeAsArray'] extends true ? [TAbiFunctionReturnType] : TAbiFunctionReturnType : never : Options['ReturnType']>;
1149
+ } : never;
1150
+ }[number]>;
1151
+ declare type AbiFunctionReturnType<TAbiFunction extends AbiFunction & {
1152
+ type: 'function';
1153
+ }> = ({
1154
+ payable: ethers.ContractTransaction;
1155
+ nonpayable: ethers.ContractTransaction;
1156
+ } & {
1157
+ [_ in 'pure' | 'view']: TAbiFunction['outputs']['length'] extends infer TLength ? TLength extends 0 ? void : TLength extends 1 ? AbiParameterToPrimitiveType<TAbiFunction['outputs'][0]> : {
1158
+ [Output in TAbiFunction['outputs'][number] as Output['name'] extends '' ? never : Output['name']]: AbiParameterToPrimitiveType<Output>;
1159
+ } & AbiParametersToPrimitiveTypes<TAbiFunction['outputs']> : never;
1160
+ })[TAbiFunction['stateMutability']];
1161
+ declare type InterfaceFunctions<TAbi extends Abi> = UnionToIntersection<{
1162
+ [K in keyof TAbi]: TAbi[K] extends infer TAbiFunction extends AbiFunction & {
1163
+ type: 'function';
1164
+ } ? {
1165
+ [K in AbiItemName<TAbiFunction, true>]: ethers.utils.FunctionFragment;
1166
+ } : never;
1167
+ }[number]>;
1168
+ declare type InterfaceEvents<TAbi extends Abi> = UnionToIntersection<{
1169
+ [K in keyof TAbi]: TAbi[K] extends infer TAbiEvent extends AbiEvent ? {
1170
+ [K in AbiItemName<TAbiEvent, true>]: ethers.utils.EventFragment;
1171
+ } : never;
1172
+ }[number]>;
1173
+ interface EventListener<TAbi extends Abi> {
1174
+ <TEventName extends ExtractAbiEventNames<TAbi>>(eventName: TEventName, listener: Listener<TAbi, TEventName>): Contract<TAbi>;
1175
+ (eventFilter: ethers.EventFilter, listener: Listener<TAbi, ExtractAbiEventNames<TAbi>>): Contract<TAbi>;
1176
+ }
1177
+ declare type Listener<TAbi extends Abi, TEventName extends string, TAbiEvent extends AbiEvent = ExtractAbiEvent<TAbi, TEventName>> = AbiParametersToPrimitiveTypes<TAbiEvent['inputs']> extends infer TArgs extends readonly unknown[] ? (...args: [...args: TArgs, event: Event<TAbiEvent>]) => void : never;
1178
+ declare type Filters<TAbi extends Abi> = UnionToIntersection<{
1179
+ [K in keyof TAbi]: TAbi[K] extends infer TAbiEvent extends AbiEvent ? {
1180
+ [K in CountOccurrences<TAbi, {
1181
+ name: TAbiEvent['name'];
1182
+ }> extends 1 ? AbiItemName<TAbiEvent> : AbiItemName<TAbiEvent, true>]: (...args: TAbiEvent['inputs'] extends infer TAbiParameters extends readonly (AbiParameter & {
1183
+ indexed?: boolean;
1184
+ })[] ? {
1185
+ [K in keyof TAbiParameters]: TAbiParameters[K]['indexed'] extends true ? AbiParameterToPrimitiveType<TAbiParameters[K]> | null : null;
1186
+ } : never) => ethers.EventFilter;
1187
+ } : never;
1188
+ }[number]>;
1189
+
1190
+ declare type MulticallConfig<TContracts extends unknown[]> = {
1191
+ /** Failures in the multicall will fail silently */
1192
+ allowFailure?: boolean;
1193
+ /** Chain id to use for provider */
1194
+ chainId?: number;
1195
+ /** Contracts to query */
1196
+ contracts: readonly [...ContractsConfig<TContracts>];
1197
+ /** Call overrides */
1198
+ overrides?: GetOverridesForAbiStateMutability<'pure'> | GetOverridesForAbiStateMutability<'view'>;
1199
+ };
1200
+ declare type MulticallResult<TContracts extends unknown[]> = ContractsResult<TContracts>;
1201
+ declare function multicall<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TContracts extends {
1202
+ abi: TAbi;
1203
+ functionName: TFunctionName;
1204
+ }[]>({ allowFailure, chainId, contracts, overrides, }: MulticallConfig<TContracts>): Promise<MulticallResult<TContracts>>;
1205
+
1206
+ declare type ReadContractConfig<TAbi = Abi, TFunctionName = string, TOptions extends Options$2 = DefaultOptions> = GetConfig$1<{
1207
+ abi: TAbi;
1208
+ functionName: TFunctionName;
1209
+ /** Chain id to use for provider */
1210
+ chainId?: number;
1211
+ /** Call overrides */
1212
+ overrides?: GetOverridesForAbiStateMutability<'pure' | 'view'>;
1213
+ }, 'pure' | 'view', TOptions>;
1214
+ declare type ReadContractResult<TAbi = Abi, TFunctionName = string> = GetReturnType<{
1215
+ abi: TAbi;
1216
+ functionName: TFunctionName;
1217
+ }>;
1218
+ declare function readContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ address, args, chainId, abi, functionName, overrides, }: ReadContractConfig<TAbi, TFunctionName>): Promise<ReadContractResult<TAbi, TFunctionName>>;
1219
+
1220
+ declare type Options$1 = Options$2 & {
1221
+ isContractsOptional?: boolean;
1222
+ };
1223
+ declare type ReadContractsConfig<TContracts extends unknown[], TOptions extends Options$1 = DefaultOptions, _Contracts = readonly [
1224
+ ...ContractsConfig<TContracts, {
1225
+ /** Chain id to use for provider */
1226
+ chainId?: number;
1227
+ }, TOptions>
1228
+ ]> = {
1229
+ /** Failures in the multicall will fail silently */
1230
+ allowFailure?: boolean;
1231
+ /** Call overrides */
1232
+ overrides?: GetOverridesForAbiStateMutability<'pure' | 'view'>;
1233
+ } & (TOptions['isContractsOptional'] extends true ? {
1234
+ /** Contracts to query */
1235
+ contracts?: _Contracts;
1236
+ } : {
1237
+ /** Contracts to query */
1238
+ contracts: _Contracts;
1239
+ });
1240
+ declare type ReadContractsResult<TContracts extends unknown[]> = ContractsResult<TContracts>;
1241
+ declare function readContracts<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TContracts extends {
1242
+ abi: TAbi;
1243
+ functionName: TFunctionName;
1244
+ }[]>({ allowFailure, contracts, overrides, }: ReadContractsConfig<TContracts>): Promise<ReadContractsResult<TContracts>>;
1245
+
1246
+ declare type ContractEventConfig<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string = string> = {
1247
+ /** Contract address */
1248
+ address: string;
1249
+ /** Contract ABI */
1250
+ abi: Narrow<TAbi>;
1251
+ /** Chain id to use for provider */
1252
+ chainId?: number;
1253
+ /** Event to listen for */
1254
+ eventName: IsNever<TEventName> extends true ? string : TEventName;
1255
+ /** Receive only a single event */
1256
+ once?: boolean;
1257
+ };
1258
+ declare type GetConfig<T> = T extends {
1259
+ abi: infer TAbi extends Abi;
1260
+ } ? ContractEventConfig<TAbi, ExtractAbiEventNames<TAbi>> : T extends {
1261
+ abi: infer TAbi extends readonly unknown[];
1262
+ eventName: infer TEventName extends string;
1263
+ } ? ContractEventConfig<TAbi, TEventName> : ContractEventConfig;
1264
+ declare type WatchContractEventConfig<TAbi = Abi, TEventName = string> = GetConfig<{
1265
+ abi: TAbi;
1266
+ eventName: TEventName;
1267
+ }>;
1268
+ declare type WatchContractEventCallback<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string = string, TAbiEvent extends AbiEvent = TAbi extends Abi ? ExtractAbiEvent<TAbi, TEventName> : never> = AbiParametersToPrimitiveTypes<TAbiEvent['inputs']> extends infer TArgs extends readonly unknown[] ? Or<IsNever<TArgs>, NotEqual<TAbi, Abi>> extends true ? (...args: any) => void : (...args: [...args: TArgs, event: Event<TAbiEvent>]) => void : never;
1269
+ declare function watchContractEvent<TAbi extends Abi | readonly unknown[], TEventName extends string>({ address, abi, chainId, eventName, once, }: WatchContractEventConfig<TAbi, TEventName>, callback: WatchContractEventCallback<TAbi, TEventName>): () => void;
1270
+
1271
+ declare type WatchMulticallConfig<TContracts extends unknown[]> = MulticallConfig<TContracts> & {
1272
+ listenToBlock?: boolean;
1273
+ };
1274
+ declare type WatchMulticallCallback<TContracts extends unknown[]> = (results: MulticallResult<TContracts>) => void;
1275
+ declare function watchMulticall<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TContracts extends {
1276
+ abi: TAbi;
1277
+ functionName: TFunctionName;
1278
+ }[]>(config: WatchMulticallConfig<TContracts>, callback: WatchMulticallCallback<TContracts>): () => void;
1279
+
1280
+ declare type WatchReadContractConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ReadContractConfig<TAbi, TFunctionName> & {
1281
+ listenToBlock?: boolean;
1282
+ };
1283
+ declare type WatchReadContractCallback<TAbi extends Abi | readonly unknown[], TFunctionName extends string> = (result: ReadContractResult<TAbi, TFunctionName>) => void;
1284
+ declare function watchReadContract<TAbi extends Abi | readonly unknown[], TFunctionName extends TAbi extends Abi ? ExtractAbiFunctionNames<TAbi, 'view' | 'pure'> : string>(config: WatchReadContractConfig<TAbi, TFunctionName>, callback: WatchReadContractCallback<TAbi, TFunctionName>): () => void;
1285
+
1286
+ declare type WatchReadContractsConfig<TContracts extends unknown[]> = ReadContractsConfig<TContracts> & {
1287
+ listenToBlock?: boolean;
1288
+ };
1289
+ declare type WatchReadContractsCallback<TContracts extends unknown[]> = (results: ReadContractsResult<TContracts>) => void;
1290
+ declare function watchReadContracts<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TContracts extends {
1291
+ abi: TAbi;
1292
+ functionName: TFunctionName;
1293
+ }[]>(config: WatchReadContractsConfig<TContracts>, callback: WatchReadContractsCallback<TContracts>): () => void;
1294
+
1295
+ declare type FetchTransactionArgs = {
1296
+ /** Chain ID used to validate if the signer is connected to the target chain */
1297
+ chainId?: number;
1298
+ /** Transaction hash */
1299
+ hash: Hash;
1300
+ };
1301
+ declare type FetchTransactionResult = providers.TransactionResponse;
1302
+ /**
1303
+ * @description Fetches transaction for hash
1304
+ *
1305
+ * @example
1306
+ * import { fetchTransaction } from '@wagmi/core'
1307
+ *
1308
+ * const transaction = await fetchTransaction({
1309
+ * chainId: 1,
1310
+ * hash: '0x...',
1311
+ * })
1312
+ */
1313
+ declare function fetchTransaction({ chainId, hash, }: FetchTransactionArgs): Promise<FetchTransactionResult>;
1314
+
1315
+ declare type PrepareSendTransactionArgs<TSigner extends Signer = Signer> = {
1316
+ /** Chain ID used to validate if the signer is connected to the target chain */
1317
+ chainId?: number;
1318
+ /** Request data to prepare the transaction */
1319
+ request: providers.TransactionRequest & {
1320
+ to: NonNullable<providers.TransactionRequest['to']>;
1321
+ };
1322
+ signer?: TSigner | null;
1323
+ };
1324
+ declare type PrepareSendTransactionResult = {
1325
+ chainId?: number;
1326
+ request: providers.TransactionRequest & {
1327
+ to: Address;
1328
+ gasLimit: NonNullable<providers.TransactionRequest['gasLimit']>;
1329
+ };
1330
+ mode: 'prepared';
1331
+ };
1332
+ /**
1333
+ * @description Prepares the parameters required for sending a transaction.
1334
+ *
1335
+ * Returns config to be passed through to `sendTransaction`.
1336
+ *
1337
+ * @example
1338
+ * import { prepareSendTransaction, sendTransaction } from '@wagmi/core'
1339
+ *
1340
+ * const config = await prepareSendTransaction({
1341
+ * request: {
1342
+ * to: 'moxey.eth',
1343
+ * value: parseEther('1'),
1344
+ * }
1345
+ * })
1346
+ * const result = await sendTransaction(config)
1347
+ */
1348
+ declare function prepareSendTransaction({ chainId, request, signer: signer_, }: PrepareSendTransactionArgs): Promise<PrepareSendTransactionResult>;
1349
+
1350
+ declare type SendTransactionPreparedRequest = {
1351
+ /**
1352
+ * `recklesslyUnprepared`: Allow to pass through an unprepared `request`. Note: This has
1353
+ * [UX pitfalls](/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks), it is highly recommended
1354
+ * to not use this and instead prepare the request upfront using the `prepareSendTransaction` function.
1355
+ *
1356
+ * `prepared`: The request has been prepared with parameters required for sending a transaction
1357
+ * via the `prepareSendTransaction` function
1358
+ * */
1359
+ mode: 'prepared';
1360
+ /** The prepared request for sending a transaction. */
1361
+ request: providers.TransactionRequest & {
1362
+ to: Address;
1363
+ gasLimit: NonNullable<providers.TransactionRequest['gasLimit']>;
1364
+ };
1365
+ };
1366
+ declare type SendTransactionUnpreparedRequest = {
1367
+ mode: 'recklesslyUnprepared';
1368
+ /** The unprepared request for sending a transaction. */
1369
+ request: providers.TransactionRequest;
1370
+ };
1371
+ declare type SendTransactionArgs = {
1372
+ /** Chain ID used to validate if the signer is connected to the target chain */
1373
+ chainId?: number;
1374
+ } & (SendTransactionPreparedRequest | SendTransactionUnpreparedRequest);
1375
+ declare type SendTransactionResult = {
1376
+ hash: Hash;
1377
+ wait: providers.TransactionResponse['wait'];
1378
+ };
1379
+ /**
1380
+ * @description Function to send a transaction.
1381
+ *
1382
+ * It is recommended to pair this with the `prepareSendTransaction` function to avoid
1383
+ * [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks).
1384
+ *
1385
+ * @example
1386
+ * import { prepareSendTransaction, sendTransaction } from '@wagmi/core'
1387
+ *
1388
+ * const config = await prepareSendTransaction({
1389
+ * to: 'moxey.eth',
1390
+ * value: parseEther('1'),
1391
+ * })
1392
+ * const result = await sendTransaction(config)
1393
+ */
1394
+ declare function sendTransaction({ chainId, mode, request, }: SendTransactionArgs): Promise<SendTransactionResult>;
1395
+
1396
+ declare type WaitForTransactionArgs = {
1397
+ /** Chain id to use for provider */
1398
+ chainId?: number;
1399
+ /**
1400
+ * Number of blocks to wait for after transaction is mined
1401
+ * @default 1
1402
+ */
1403
+ confirmations?: number;
1404
+ /** Transaction hash to monitor */
1405
+ hash?: Hash;
1406
+ timeout?: number;
1407
+ /** Function resolving to transaction receipt */
1408
+ wait?: providers.TransactionResponse['wait'];
1409
+ };
1410
+ declare type WaitForTransactionResult = providers.TransactionReceipt;
1411
+ declare function waitForTransaction({ chainId, confirmations, hash, timeout, wait: wait_, }: WaitForTransactionArgs): Promise<WaitForTransactionResult>;
1412
+
1413
+ declare type Options = Options$2 & {
1414
+ isRequestOptional?: boolean;
1415
+ };
1416
+ declare type Request = PopulatedTransaction & {
1417
+ to: Address;
1418
+ gasLimit: NonNullable<PopulatedTransaction['gasLimit']>;
1419
+ };
1420
+ declare type WriteContractPreparedArgs<TOptions extends Options = DefaultOptions> = {
1421
+ /**
1422
+ * `recklesslyUnprepared`: Allow to pass through unprepared config. Note: This has
1423
+ * [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks),
1424
+ * it is highly recommended to not use this and instead prepare the request upfront
1425
+ * using the {@link prepareWriteContract} function.
1426
+ *
1427
+ * `prepared`: The request has been prepared with parameters required for sending a transaction
1428
+ * via the {@link prepareWriteContract} function
1429
+ * */
1430
+ mode: 'prepared';
1431
+ args?: never;
1432
+ overrides?: never;
1433
+ } & (TOptions['isRequestOptional'] extends true ? {
1434
+ /** The prepared request. */
1435
+ request?: Request;
1436
+ } : {
1437
+ /** The prepared request. */
1438
+ request: Request;
1439
+ });
1440
+ declare type WriteContractUnpreparedArgs<TAbi = Abi, TFunctionName = string, TOptions extends Options = DefaultOptions> = {
1441
+ mode: 'recklesslyUnprepared';
1442
+ request?: never;
1443
+ } & GetConfig$1<{
1444
+ abi: TAbi;
1445
+ functionName: TFunctionName;
1446
+ /** Call overrides */
1447
+ overrides?: GetOverridesForAbiStateMutability<[
1448
+ TAbi,
1449
+ TFunctionName
1450
+ ] extends [
1451
+ infer TAbi_ extends Abi,
1452
+ infer TFunctionName_ extends string
1453
+ ] ? ExtractAbiFunction<TAbi_, TFunctionName_>['stateMutability'] : 'nonpayable' | 'payable'>;
1454
+ }, 'nonpayable' | 'payable', TOptions>;
1455
+ declare type WriteContractArgs<TAbi = Abi, TFunctionName = string, TOptions extends Options = DefaultOptions> = Omit<GetConfig$1<{
1456
+ abi: TAbi;
1457
+ functionName: TFunctionName;
1458
+ /** Chain id to use for provider */
1459
+ chainId?: number;
1460
+ }, 'nonpayable' | 'payable', TOptions>, 'args'> & (WriteContractUnpreparedArgs<TAbi, TFunctionName, TOptions> | WriteContractPreparedArgs<TOptions>);
1461
+ declare type WriteContractResult = SendTransactionResult;
1462
+ /**
1463
+ * @description Function to call a contract write method.
1464
+ *
1465
+ * It is recommended to pair this with the {@link prepareWriteContract} function
1466
+ * to avoid [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks).
1467
+ *
1468
+ * @example
1469
+ * import { prepareWriteContract, writeContract } from '@wagmi/core'
1470
+ *
1471
+ * const config = await prepareWriteContract({
1472
+ * address: '0x...',
1473
+ * abi: wagmiAbi,
1474
+ * functionName: 'mint',
1475
+ * })
1476
+ * const result = await writeContract(config)
1477
+ */
1478
+ declare function writeContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TSigner extends Signer = Signer>({ address, args, chainId, abi, functionName, mode, overrides, request: request_, }: WriteContractArgs<TAbi, TFunctionName>): Promise<WriteContractResult>;
1479
+
1480
+ declare type FetchEnsAddressArgs = {
1481
+ /** Chain id to use for provider */
1482
+ chainId?: number;
1483
+ /** ENS name to resolve */
1484
+ name: string;
1485
+ };
1486
+ declare type FetchEnsAddressResult = Address | null;
1487
+ declare function fetchEnsAddress({ chainId, name, }: FetchEnsAddressArgs): Promise<FetchEnsAddressResult>;
1488
+
1489
+ declare type FetchEnsAvatarArgs = {
1490
+ /** Address or ENS name */
1491
+ address: Address;
1492
+ /** Chain id to use for provider */
1493
+ chainId?: number;
1494
+ };
1495
+ declare type FetchEnsAvatarResult = string | null;
1496
+ declare function fetchEnsAvatar({ address, chainId, }: FetchEnsAvatarArgs): Promise<FetchEnsAvatarResult>;
1497
+
1498
+ declare type FetchEnsNameArgs = {
1499
+ /** Address to lookup */
1500
+ address: Address;
1501
+ /** Chain id to use for provider */
1502
+ chainId?: number;
1503
+ };
1504
+ declare type FetchEnsNameResult = string | null;
1505
+ declare function fetchEnsName({ address, chainId, }: FetchEnsNameArgs): Promise<FetchEnsNameResult>;
1506
+
1507
+ declare type FetchEnsResolverArgs = {
1508
+ /** Chain id to use for provider */
1509
+ chainId?: number;
1510
+ /** ENS name to resolve */
1511
+ name: string;
1512
+ };
1513
+ declare type FetchEnsResolverResult = providers.Resolver | null;
1514
+ declare function fetchEnsResolver({ chainId, name, }: FetchEnsResolverArgs): Promise<FetchEnsResolverResult>;
1515
+
1516
+ declare type FetchBlockNumberArgs = {
1517
+ chainId?: number;
1518
+ };
1519
+ declare type FetchBlockNumberResult = number;
1520
+ declare function fetchBlockNumber({ chainId, }?: FetchBlockNumberArgs): Promise<FetchBlockNumberResult>;
1521
+
1522
+ declare type FetchFeeDataArgs = {
1523
+ /** Units for formatting output */
1524
+ formatUnits?: Unit | number;
1525
+ /** Chain id to use for provider */
1526
+ chainId?: number;
1527
+ };
1528
+ declare type FetchFeeDataResult = providers.FeeData & {
1529
+ formatted: {
1530
+ gasPrice: string | null;
1531
+ maxFeePerGas: string | null;
1532
+ maxPriorityFeePerGas: string | null;
1533
+ };
1534
+ };
1535
+ declare function fetchFeeData({ chainId, formatUnits: units, }?: FetchFeeDataArgs): Promise<FetchFeeDataResult>;
1536
+
1537
+ declare type WatchBlockNumberArgs = {
1538
+ chainId?: number;
1539
+ listen: boolean;
1540
+ };
1541
+ declare type WatchBlockNumberCallback = (blockNumber: FetchBlockNumberResult) => void;
1542
+ declare function watchBlockNumber(args: WatchBlockNumberArgs, callback: WatchBlockNumberCallback): () => void;
1543
+
1544
+ declare type GetProviderArgs = {
1545
+ /** Chain id to use for provider */
1546
+ chainId?: number;
1547
+ };
1548
+ declare type GetProviderResult<TProvider extends Provider = Provider> = TProvider;
1549
+ declare function getProvider<TProvider extends Provider = Provider>({ chainId, }?: GetProviderArgs): GetProviderResult<TProvider>;
1550
+
1551
+ declare type GetWebSocketProviderArgs = {
1552
+ /** Chain id to use for provider */
1553
+ chainId?: number;
1554
+ };
1555
+ declare type GetWebSocketProviderResult<TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = TWebSocketProvider | undefined;
1556
+ declare function getWebSocketProvider<TWebSocketProvider extends WebSocketProvider = WebSocketProvider>({ chainId, }?: GetWebSocketProviderArgs): GetWebSocketProviderResult<TWebSocketProvider>;
1557
+
1558
+ declare type WatchProviderCallback<TProvider extends Provider = Provider> = (provider: GetProviderResult<TProvider>) => void;
1559
+ declare function watchProvider<TProvider extends Provider = Provider>(args: GetProviderArgs, callback: WatchProviderCallback<TProvider>): () => void;
1560
+
1561
+ declare type WatchWebSocketProviderCallback<TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = (webSocketProvider: GetWebSocketProviderResult<TWebSocketProvider>) => void;
1562
+ declare function watchWebSocketProvider<TWebSocketProvider extends WebSocketProvider = WebSocketProvider>(args: GetWebSocketProviderArgs, callback: WatchWebSocketProviderCallback<TWebSocketProvider>): () => void;
1563
+
1564
+ /**
1565
+ * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors per EIP-1474.
1566
+ * @see https://eips.ethereum.org/EIPS/eip-1474
1567
+ */
1568
+ declare class RpcError<T = undefined> extends Error {
1569
+ readonly code: number;
1570
+ readonly data?: T;
1571
+ readonly internal?: unknown;
1572
+ constructor(
1573
+ /** Number error code */
1574
+ code: number,
1575
+ /** Human-readable string */
1576
+ message: string,
1577
+ /** Low-level error */
1578
+ internal?: unknown,
1579
+ /** Other useful information about error */
1580
+ data?: T);
1581
+ }
1582
+ /**
1583
+ * Error subclass implementing Ethereum Provider errors per EIP-1193.
1584
+ * @see https://eips.ethereum.org/EIPS/eip-1193
1585
+ */
1586
+ declare class ProviderRpcError<T = undefined> extends RpcError<T> {
1587
+ /**
1588
+ * Create an Ethereum Provider JSON-RPC error.
1589
+ * `code` must be an integer in the 1000 <= 4999 range.
1590
+ */
1591
+ constructor(
1592
+ /**
1593
+ * Number error code
1594
+ * @see https://eips.ethereum.org/EIPS/eip-1193#error-standards
1595
+ */
1596
+ code: 4001 | 4100 | 4200 | 4900 | 4901 | 4902,
1597
+ /** Human-readable string */
1598
+ message: string,
1599
+ /** Low-level error */
1600
+ internal?: unknown,
1601
+ /** Other useful information about error */
1602
+ data?: T);
1603
+ }
1604
+ declare class AddChainError extends Error {
1605
+ name: string;
1606
+ message: string;
1607
+ }
1608
+ declare class ChainDoesNotSupportMulticallError extends Error {
1609
+ name: string;
1610
+ constructor({ blockNumber, chain }: {
1611
+ blockNumber?: number;
1612
+ chain: Chain;
1613
+ });
1614
+ }
1615
+ declare class ChainMismatchError extends Error {
1616
+ name: string;
1617
+ constructor({ activeChain, targetChain, }: {
1618
+ activeChain: string;
1619
+ targetChain: string;
1620
+ });
1621
+ }
1622
+ declare class ChainNotConfiguredError extends Error {
1623
+ name: string;
1624
+ constructor({ chainId, connectorId, }: {
1625
+ chainId: number;
1626
+ connectorId: string;
1627
+ });
1628
+ }
1629
+ declare class ConnectorAlreadyConnectedError extends Error {
1630
+ name: string;
1631
+ message: string;
1632
+ }
1633
+ declare class ConnectorNotFoundError extends Error {
1634
+ name: string;
1635
+ message: string;
1636
+ }
1637
+ declare class ContractMethodDoesNotExistError extends Error {
1638
+ name: string;
1639
+ constructor({ address, chainId, functionName, }: {
1640
+ address: string;
1641
+ chainId?: number;
1642
+ functionName: string;
1643
+ });
1644
+ }
1645
+ declare class ContractMethodNoResultError extends Error {
1646
+ name: string;
1647
+ constructor({ address, args, chainId, functionName, }: {
1648
+ address: string;
1649
+ args: any;
1650
+ chainId: number;
1651
+ functionName: string;
1652
+ });
1653
+ }
1654
+ declare class ContractMethodRevertedError extends Error {
1655
+ name: string;
1656
+ constructor({ address, args, chainId, functionName, errorMessage, }: {
1657
+ address: string;
1658
+ args: any;
1659
+ chainId: number;
1660
+ functionName: string;
1661
+ errorMessage: string;
1662
+ });
1663
+ }
1664
+ declare class ContractResultDecodeError extends Error {
1665
+ name: string;
1666
+ constructor({ address, args, chainId, functionName, errorMessage, }: {
1667
+ address: string;
1668
+ args: any;
1669
+ chainId: number;
1670
+ functionName: string;
1671
+ errorMessage: string;
1672
+ });
1673
+ }
1674
+ declare class ProviderChainsNotFound extends Error {
1675
+ name: string;
1676
+ message: string;
1677
+ }
1678
+ declare class ResourceUnavailableError extends RpcError {
1679
+ name: string;
1680
+ constructor(error: unknown);
1681
+ }
1682
+ declare class SwitchChainError extends ProviderRpcError {
1683
+ name: string;
1684
+ constructor(error: unknown);
1685
+ }
1686
+ declare class SwitchChainNotSupportedError extends Error {
1687
+ name: string;
1688
+ constructor({ connector }: {
1689
+ connector: Connector;
1690
+ });
1691
+ }
1692
+ declare class UserRejectedRequestError extends ProviderRpcError {
1693
+ name: string;
1694
+ constructor(error: unknown);
1695
+ }
1696
+
1697
+ declare type ConfigureChainsConfig = {
1698
+ pollingInterval?: number;
1699
+ stallTimeout?: number;
1700
+ } & ({
1701
+ targetQuorum?: number;
1702
+ minQuorum?: never;
1703
+ } | {
1704
+ targetQuorum: number;
1705
+ minQuorum?: number;
1706
+ });
1707
+ declare function configureChains<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider, TChain extends Chain = Chain>(defaultChains: TChain[], providers: ChainProviderFn<TProvider, TWebSocketProvider, TChain>[], { minQuorum, pollingInterval, targetQuorum, stallTimeout, }?: ConfigureChainsConfig): {
1708
+ readonly chains: TChain[];
1709
+ readonly provider: ({ chainId }: {
1710
+ chainId?: number | undefined;
1711
+ }) => (ProviderWithFallbackConfig<TProvider> | providers.FallbackProvider) & {
1712
+ chains: TChain[];
1713
+ pollingInterval: number;
1714
+ };
1715
+ readonly webSocketProvider: ({ chainId }: {
1716
+ chainId?: number | undefined;
1717
+ }) => (TWebSocketProvider & {
1718
+ chains: TChain[];
1719
+ }) | undefined;
1720
+ };
1721
+
1722
+ /** Forked from https://github.com/epoberezkin/fast-deep-equal */
1723
+ declare function deepEqual(a: any, b: any): boolean;
1724
+
1725
+ declare function minimizeContractInterface<TAbi extends Abi | readonly unknown[]>(config: {
1726
+ abi: TAbi;
1727
+ functionName: TAbi extends Abi ? ExtractAbiFunctionNames<TAbi> : string;
1728
+ }): string[] | (abitype.AbiFunction | abitype.AbiEvent | abitype.AbiError)[];
1729
+
1730
+ declare function normalizeChainId(chainId: string | number | bigint): number;
1731
+
1732
+ declare function parseContractResult({ abi, data, functionName, }: {
1733
+ abi: ContractInterface | Abi | readonly unknown[];
1734
+ data: any;
1735
+ functionName: string;
1736
+ }): any;
1737
+
1738
+ export { AddChainError, ChainDoesNotSupportMulticallError, ChainMismatchError, ChainNotConfiguredError, Client, ClientConfig, ConfigureChainsConfig, ConnectArgs, ConnectResult, ConnectorAlreadyConnectedError, ConnectorNotFoundError, ContractMethodDoesNotExistError, ContractMethodNoResultError, ContractMethodRevertedError, ContractResultDecodeError, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerArgs, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, MulticallConfig, MulticallResult, PrepareSendTransactionArgs, PrepareSendTransactionResult, PrepareWriteContractConfig, PrepareWriteContractResult, ProviderChainsNotFound, ProviderRpcError, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, ResourceUnavailableError, RpcError, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, ClientStorage as Storage, SwitchChainError, SwitchChainNotSupportedError, SwitchNetworkArgs, SwitchNetworkResult, UserRejectedRequestError, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchProviderCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, configureChains, connect, createClient, createStorage, deepEqual, disconnect, erc20ABI, erc4626ABI, erc721ABI, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, minimizeContractInterface, multicall, noopStorage, normalizeChainId, parseContractResult, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract };