@wagmi/core 0.10.10 → 1.0.0-next.1

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