wagmi-extended 1.1.8 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/fetch-functions/erc20/fetchAllowanceX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchBalanceOfX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchERC20DataX.d.ts +18 -0
- package/dist/fetch-functions/erc20/fetchNameX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchSymbolX.d.ts +4 -0
- package/dist/fetch-functions/erc20/fetchTotalSupplyX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626AssetX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626ConvertToAssetsX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626ConvertToSharesX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626DataX.d.ts +24 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxDepositX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxMintX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxRedeemX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626MaxWithdrawX.d.ts +4 -0
- package/dist/fetch-functions/erc4626/fetchERC4626TotalAssetsX.d.ts +4 -0
- package/dist/hooks/{useContractWriteX.d.ts → mutations/useContractWriteX.d.ts} +40 -35
- package/dist/hooks/{useHandleTransactionMutationX.d.ts → mutations/useHandleTransactionMutationX.d.ts} +8 -1
- package/dist/hooks/{useSendTransactionX.d.ts → mutations/useSendTransactionX.d.ts} +14 -13
- package/dist/hooks/queries/useERC20Data.d.ts +22 -0
- package/dist/hooks/queries/useFetchERC4626DataX.d.ts +28 -0
- package/dist/hooks/{useTokenX.d.ts → queries/useTokenX.d.ts} +18 -18
- package/dist/index.cjs.js +348 -114
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +16 -5
- package/dist/index.esm.js +339 -116
- package/dist/index.esm.js.map +1 -1
- package/dist/query-config/index.d.ts +20 -2
- package/dist/utils/ensureClientAndConfig.d.ts +6 -0
- package/package.json +1 -1
- package/src/fetch-functions/erc20/fetchAllowanceX.ts +31 -0
- package/src/fetch-functions/erc20/fetchBalanceOfX.ts +28 -0
- package/src/fetch-functions/erc20/fetchERC20DataX.ts +52 -0
- package/src/fetch-functions/erc20/fetchNameX.ts +26 -0
- package/src/fetch-functions/erc20/fetchSymbolX.ts +26 -0
- package/src/fetch-functions/erc20/fetchTotalSupplyX.ts +26 -0
- package/src/fetch-functions/erc4626/fetchERC4626AssetX.ts +25 -0
- package/src/fetch-functions/erc4626/fetchERC4626ConvertToAssetsX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626ConvertToSharesX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626DataX.ts +60 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxDepositX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxMintX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxRedeemX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626MaxWithdrawX.ts +27 -0
- package/src/fetch-functions/erc4626/fetchERC4626TotalAssetsX.ts +25 -0
- package/src/fetch-functions/fetchTokenX.ts +16 -30
- package/src/hooks/{useContractWriteX.ts → mutations/useContractWriteX.ts} +32 -12
- package/src/hooks/{useERC20ApproveX.ts → mutations/useERC20ApproveX.ts} +1 -1
- package/src/hooks/{useHandleTransactionMutationX.ts → mutations/useHandleTransactionMutationX.ts} +30 -4
- package/src/hooks/{useSendTransactionX.ts → mutations/useSendTransactionX.ts} +36 -3
- package/src/hooks/queries/useERC20Data.ts +40 -0
- package/src/hooks/{useFetchAssetAllowanceX.ts → queries/useFetchAssetAllowanceX.ts} +6 -4
- package/src/hooks/queries/useFetchERC4626DataX.ts +39 -0
- package/src/hooks/{useTokenX.ts → queries/useTokenX.ts} +1 -1
- package/src/index.ts +16 -5
- package/src/query-config/index.ts +13 -3
- package/src/utils/ensureClientAndConfig.ts +18 -0
- package/dist/fetch-functions/fetchAllowanceX.d.ts +0 -2
- package/src/fetch-functions/fetchAllowanceX.ts +0 -22
- /package/dist/hooks/{useERC20ApproveX.d.ts → mutations/useERC20ApproveX.d.ts} +0 -0
- /package/dist/hooks/{useInvalidateQueries.d.ts → mutations/useInvalidateQueries.d.ts} +0 -0
- /package/dist/hooks/{useFetchAssetAllowanceX.d.ts → queries/useFetchAssetAllowanceX.d.ts} +0 -0
- /package/src/hooks/{useInvalidateQueries.ts → mutations/useInvalidateQueries.ts} +0 -0
package/README.md
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Address } from "viem";
|
|
2
|
+
import type { Config } from "wagmi";
|
|
3
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
4
|
+
export declare function fetchAllowanceX(asset: Address, spender: Address, user: Address, queryClient?: QueryClient, wagmiConfig?: Config): Promise<bigint>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
import { Config } from "wagmi";
|
|
4
|
+
/**
|
|
5
|
+
* Fetches the full ERC-20 “summary” for a given vault and user context.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchERC20DataX(address: Address, user?: Address, spender?: Address, queryClient?: QueryClient, wagmiConfig?: Config): Promise<{
|
|
8
|
+
name: string;
|
|
9
|
+
symbol: string;
|
|
10
|
+
decimals: number | undefined;
|
|
11
|
+
allowance: bigint | undefined;
|
|
12
|
+
balanceOf: bigint | undefined;
|
|
13
|
+
asset: bigint | undefined;
|
|
14
|
+
address: `0x${string}`;
|
|
15
|
+
user: `0x${string}` | undefined;
|
|
16
|
+
spender: `0x${string}` | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export type ERC20DataX = Awaited<ReturnType<typeof fetchERC20DataX>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
import { Config } from "wagmi";
|
|
4
|
+
export declare function fetchERC4626ConvertToAssetsX(vault: Address, shares: bigint, queryClient?: QueryClient, wagmiConfig?: Config): Promise<bigint>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
import { Config } from "wagmi";
|
|
4
|
+
export declare function fetchERC4626ConvertToSharesX(vault: Address, assets: bigint, queryClient?: QueryClient, wagmiConfig?: Config): Promise<bigint>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
import { Config } from "wagmi";
|
|
4
|
+
/**
|
|
5
|
+
* Fetches the full ERC-4626 “summary” for a given vault and user context.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchERC4626DataX(vault: Address, user?: Address, spender?: Address, queryClient?: QueryClient, wagmiConfig?: Config): Promise<{
|
|
8
|
+
maxDeposit: `0x${string}`;
|
|
9
|
+
maxMint: bigint;
|
|
10
|
+
maxRedeem: bigint | undefined;
|
|
11
|
+
maxWithdraw: bigint | undefined;
|
|
12
|
+
vault: `0x${string}`;
|
|
13
|
+
owner: `0x${string}` | undefined;
|
|
14
|
+
spender: `0x${string}` | undefined;
|
|
15
|
+
name: string;
|
|
16
|
+
symbol: string;
|
|
17
|
+
decimals: number | undefined;
|
|
18
|
+
allowance: bigint | undefined;
|
|
19
|
+
balanceOf: bigint | undefined;
|
|
20
|
+
asset: bigint | undefined;
|
|
21
|
+
address: `0x${string}`;
|
|
22
|
+
user: `0x${string}` | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type ERC4626DataX = Awaited<ReturnType<typeof fetchERC4626DataX>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WriteExtendedAsyncParams } from "./useHandleTransactionMutationX.js";
|
|
2
|
+
import { Address } from "viem";
|
|
2
3
|
/**
|
|
3
4
|
* Custom hook for writing to a smart contract using Wagmi.
|
|
4
5
|
*
|
|
@@ -58,10 +59,10 @@ import { WriteExtendedAsyncParams } from "./useHandleTransactionMutationX.js";
|
|
|
58
59
|
* );
|
|
59
60
|
* }
|
|
60
61
|
*/
|
|
61
|
-
export declare function useContractWriteX(settings
|
|
62
|
+
export declare function useContractWriteX(settings: WriteExtendedAsyncParams): {
|
|
63
|
+
simulateAsyncAndWriteContract: (params: Parameters<import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>>[0]) => Promise<void>;
|
|
62
64
|
isPending: boolean;
|
|
63
65
|
errorMessage: string | undefined;
|
|
64
|
-
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
65
66
|
error: null;
|
|
66
67
|
status: "idle";
|
|
67
68
|
data: undefined;
|
|
@@ -76,18 +77,19 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
76
77
|
isPaused: boolean;
|
|
77
78
|
submittedAt: number;
|
|
78
79
|
writeContract: import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>;
|
|
80
|
+
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
79
81
|
} | {
|
|
82
|
+
simulateAsyncAndWriteContract: (params: Parameters<import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>>[0]) => Promise<void>;
|
|
80
83
|
isPending: boolean;
|
|
81
84
|
errorMessage: string | undefined;
|
|
82
|
-
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
83
85
|
error: null;
|
|
84
86
|
status: "pending";
|
|
85
87
|
data: undefined;
|
|
86
88
|
variables: {
|
|
87
|
-
abi: import("
|
|
89
|
+
abi: import("viem").Abi;
|
|
88
90
|
functionName: string;
|
|
89
91
|
args?: readonly unknown[] | undefined;
|
|
90
|
-
address:
|
|
92
|
+
address: Address;
|
|
91
93
|
chain?: import("viem").Chain | null | undefined;
|
|
92
94
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
93
95
|
value?: bigint | undefined;
|
|
@@ -109,10 +111,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
109
111
|
connector?: import("wagmi").Connector | undefined;
|
|
110
112
|
__mode?: "prepared" | undefined;
|
|
111
113
|
} | {
|
|
112
|
-
abi: import("
|
|
114
|
+
abi: import("viem").Abi;
|
|
113
115
|
functionName: string;
|
|
114
116
|
args?: readonly unknown[] | undefined;
|
|
115
|
-
address:
|
|
117
|
+
address: Address;
|
|
116
118
|
chain?: import("viem").Chain | null | undefined;
|
|
117
119
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
118
120
|
value?: bigint | undefined;
|
|
@@ -134,10 +136,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
134
136
|
connector?: import("wagmi").Connector | undefined;
|
|
135
137
|
__mode?: "prepared" | undefined;
|
|
136
138
|
} | {
|
|
137
|
-
abi: import("
|
|
139
|
+
abi: import("viem").Abi;
|
|
138
140
|
functionName: string;
|
|
139
141
|
args?: readonly unknown[] | undefined;
|
|
140
|
-
address:
|
|
142
|
+
address: Address;
|
|
141
143
|
chain?: import("viem").Chain | null | undefined;
|
|
142
144
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
143
145
|
value?: bigint | undefined;
|
|
@@ -159,10 +161,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
159
161
|
connector?: import("wagmi").Connector | undefined;
|
|
160
162
|
__mode?: "prepared" | undefined;
|
|
161
163
|
} | {
|
|
162
|
-
abi: import("
|
|
164
|
+
abi: import("viem").Abi;
|
|
163
165
|
functionName: string;
|
|
164
166
|
args?: readonly unknown[] | undefined;
|
|
165
|
-
address:
|
|
167
|
+
address: Address;
|
|
166
168
|
chain?: import("viem").Chain | null | undefined;
|
|
167
169
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
168
170
|
value?: bigint | undefined;
|
|
@@ -184,10 +186,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
184
186
|
connector?: import("wagmi").Connector | undefined;
|
|
185
187
|
__mode?: "prepared" | undefined;
|
|
186
188
|
} | {
|
|
187
|
-
abi: import("
|
|
189
|
+
abi: import("viem").Abi;
|
|
188
190
|
functionName: string;
|
|
189
191
|
args?: readonly unknown[] | undefined;
|
|
190
|
-
address:
|
|
192
|
+
address: Address;
|
|
191
193
|
chain?: import("viem").Chain | null | undefined;
|
|
192
194
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
193
195
|
value?: bigint | undefined;
|
|
@@ -219,18 +221,19 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
219
221
|
isPaused: boolean;
|
|
220
222
|
submittedAt: number;
|
|
221
223
|
writeContract: import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>;
|
|
224
|
+
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
222
225
|
} | {
|
|
226
|
+
simulateAsyncAndWriteContract: (params: Parameters<import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>>[0]) => Promise<void>;
|
|
223
227
|
isPending: boolean;
|
|
224
228
|
errorMessage: string | undefined;
|
|
225
|
-
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
226
229
|
error: import("@wagmi/core").WriteContractErrorType;
|
|
227
230
|
status: "error";
|
|
228
231
|
data: undefined;
|
|
229
232
|
variables: {
|
|
230
|
-
abi: import("
|
|
233
|
+
abi: import("viem").Abi;
|
|
231
234
|
functionName: string;
|
|
232
235
|
args?: readonly unknown[] | undefined;
|
|
233
|
-
address:
|
|
236
|
+
address: Address;
|
|
234
237
|
chain?: import("viem").Chain | null | undefined;
|
|
235
238
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
236
239
|
value?: bigint | undefined;
|
|
@@ -252,10 +255,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
252
255
|
connector?: import("wagmi").Connector | undefined;
|
|
253
256
|
__mode?: "prepared" | undefined;
|
|
254
257
|
} | {
|
|
255
|
-
abi: import("
|
|
258
|
+
abi: import("viem").Abi;
|
|
256
259
|
functionName: string;
|
|
257
260
|
args?: readonly unknown[] | undefined;
|
|
258
|
-
address:
|
|
261
|
+
address: Address;
|
|
259
262
|
chain?: import("viem").Chain | null | undefined;
|
|
260
263
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
261
264
|
value?: bigint | undefined;
|
|
@@ -277,10 +280,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
277
280
|
connector?: import("wagmi").Connector | undefined;
|
|
278
281
|
__mode?: "prepared" | undefined;
|
|
279
282
|
} | {
|
|
280
|
-
abi: import("
|
|
283
|
+
abi: import("viem").Abi;
|
|
281
284
|
functionName: string;
|
|
282
285
|
args?: readonly unknown[] | undefined;
|
|
283
|
-
address:
|
|
286
|
+
address: Address;
|
|
284
287
|
chain?: import("viem").Chain | null | undefined;
|
|
285
288
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
286
289
|
value?: bigint | undefined;
|
|
@@ -302,10 +305,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
302
305
|
connector?: import("wagmi").Connector | undefined;
|
|
303
306
|
__mode?: "prepared" | undefined;
|
|
304
307
|
} | {
|
|
305
|
-
abi: import("
|
|
308
|
+
abi: import("viem").Abi;
|
|
306
309
|
functionName: string;
|
|
307
310
|
args?: readonly unknown[] | undefined;
|
|
308
|
-
address:
|
|
311
|
+
address: Address;
|
|
309
312
|
chain?: import("viem").Chain | null | undefined;
|
|
310
313
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
311
314
|
value?: bigint | undefined;
|
|
@@ -327,10 +330,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
327
330
|
connector?: import("wagmi").Connector | undefined;
|
|
328
331
|
__mode?: "prepared" | undefined;
|
|
329
332
|
} | {
|
|
330
|
-
abi: import("
|
|
333
|
+
abi: import("viem").Abi;
|
|
331
334
|
functionName: string;
|
|
332
335
|
args?: readonly unknown[] | undefined;
|
|
333
|
-
address:
|
|
336
|
+
address: Address;
|
|
334
337
|
chain?: import("viem").Chain | null | undefined;
|
|
335
338
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
336
339
|
value?: bigint | undefined;
|
|
@@ -362,18 +365,19 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
362
365
|
isPaused: boolean;
|
|
363
366
|
submittedAt: number;
|
|
364
367
|
writeContract: import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>;
|
|
368
|
+
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
365
369
|
} | {
|
|
370
|
+
simulateAsyncAndWriteContract: (params: Parameters<import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>>[0]) => Promise<void>;
|
|
366
371
|
isPending: boolean;
|
|
367
372
|
errorMessage: string | undefined;
|
|
368
|
-
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
369
373
|
error: null;
|
|
370
374
|
status: "success";
|
|
371
375
|
data: `0x${string}`;
|
|
372
376
|
variables: {
|
|
373
|
-
abi: import("
|
|
377
|
+
abi: import("viem").Abi;
|
|
374
378
|
functionName: string;
|
|
375
379
|
args?: readonly unknown[] | undefined;
|
|
376
|
-
address:
|
|
380
|
+
address: Address;
|
|
377
381
|
chain?: import("viem").Chain | null | undefined;
|
|
378
382
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
379
383
|
value?: bigint | undefined;
|
|
@@ -395,10 +399,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
395
399
|
connector?: import("wagmi").Connector | undefined;
|
|
396
400
|
__mode?: "prepared" | undefined;
|
|
397
401
|
} | {
|
|
398
|
-
abi: import("
|
|
402
|
+
abi: import("viem").Abi;
|
|
399
403
|
functionName: string;
|
|
400
404
|
args?: readonly unknown[] | undefined;
|
|
401
|
-
address:
|
|
405
|
+
address: Address;
|
|
402
406
|
chain?: import("viem").Chain | null | undefined;
|
|
403
407
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
404
408
|
value?: bigint | undefined;
|
|
@@ -420,10 +424,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
420
424
|
connector?: import("wagmi").Connector | undefined;
|
|
421
425
|
__mode?: "prepared" | undefined;
|
|
422
426
|
} | {
|
|
423
|
-
abi: import("
|
|
427
|
+
abi: import("viem").Abi;
|
|
424
428
|
functionName: string;
|
|
425
429
|
args?: readonly unknown[] | undefined;
|
|
426
|
-
address:
|
|
430
|
+
address: Address;
|
|
427
431
|
chain?: import("viem").Chain | null | undefined;
|
|
428
432
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
429
433
|
value?: bigint | undefined;
|
|
@@ -445,10 +449,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
445
449
|
connector?: import("wagmi").Connector | undefined;
|
|
446
450
|
__mode?: "prepared" | undefined;
|
|
447
451
|
} | {
|
|
448
|
-
abi: import("
|
|
452
|
+
abi: import("viem").Abi;
|
|
449
453
|
functionName: string;
|
|
450
454
|
args?: readonly unknown[] | undefined;
|
|
451
|
-
address:
|
|
455
|
+
address: Address;
|
|
452
456
|
chain?: import("viem").Chain | null | undefined;
|
|
453
457
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
454
458
|
value?: bigint | undefined;
|
|
@@ -470,10 +474,10 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
470
474
|
connector?: import("wagmi").Connector | undefined;
|
|
471
475
|
__mode?: "prepared" | undefined;
|
|
472
476
|
} | {
|
|
473
|
-
abi: import("
|
|
477
|
+
abi: import("viem").Abi;
|
|
474
478
|
functionName: string;
|
|
475
479
|
args?: readonly unknown[] | undefined;
|
|
476
|
-
address:
|
|
480
|
+
address: Address;
|
|
477
481
|
chain?: import("viem").Chain | null | undefined;
|
|
478
482
|
account?: `0x${string}` | import("viem").Account | null | undefined;
|
|
479
483
|
value?: bigint | undefined;
|
|
@@ -505,4 +509,5 @@ export declare function useContractWriteX(settings?: WriteExtendedAsyncParams):
|
|
|
505
509
|
isPaused: boolean;
|
|
506
510
|
submittedAt: number;
|
|
507
511
|
writeContract: import("wagmi/query").WriteContractMutate<import("wagmi").Config, void>;
|
|
512
|
+
writeContractAsync: import("wagmi/query").WriteContractMutateAsync<import("wagmi").Config, void>;
|
|
508
513
|
};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { QueryKey } from "@tanstack/query-core";
|
|
1
|
+
import { Query, QueryKey } from "@tanstack/query-core";
|
|
2
2
|
import { Address } from "viem";
|
|
3
3
|
export type WriteExtendedAsyncParams = {
|
|
4
4
|
onSuccess?: (txHash: Address) => void;
|
|
5
5
|
onError?: (e: any) => void;
|
|
6
6
|
onSettled?: () => void;
|
|
7
|
+
onSuccessAsync?: (txHash: Address) => Promise<void>;
|
|
8
|
+
onErrorAsync?: (e: any) => Promise<void>;
|
|
9
|
+
onSettledAsync?: () => Promise<void>;
|
|
10
|
+
/** simple list of keys to invalidate */
|
|
7
11
|
queriesToInvalidate?: (QueryKey | undefined)[];
|
|
12
|
+
/** a predicate to decide which queries to invalidate */
|
|
13
|
+
invalidatePredicate?: (query: Query<unknown, unknown>) => boolean;
|
|
14
|
+
simulationOverrideAbis?: any;
|
|
8
15
|
disableLogging?: boolean;
|
|
9
16
|
disableWaitingForReceipt?: boolean;
|
|
10
17
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WriteExtendedAsyncParams } from "./useHandleTransactionMutationX.js";
|
|
2
|
+
import { writeContract } from "wagmi/actions";
|
|
2
3
|
/**
|
|
3
4
|
* Custom hook for sending a transaction using Wagmi.
|
|
4
5
|
*
|
|
@@ -48,7 +49,7 @@ import { WriteExtendedAsyncParams } from "./useHandleTransactionMutationX.js";
|
|
|
48
49
|
export declare function useSendTransactionX(settings?: WriteExtendedAsyncParams): {
|
|
49
50
|
isPending: boolean;
|
|
50
51
|
errorMessage: string | undefined;
|
|
51
|
-
|
|
52
|
+
simulateAsyncAndSendTransaction: (params: Parameters<import("wagmi/query").SendTransactionMutate<import("wagmi").Config, void>>[0], simulationParams: Parameters<typeof writeContract>[1]) => Promise<void>;
|
|
52
53
|
error: null;
|
|
53
54
|
status: "idle";
|
|
54
55
|
data: undefined;
|
|
@@ -59,14 +60,14 @@ export declare function useSendTransactionX(settings?: WriteExtendedAsyncParams)
|
|
|
59
60
|
reset: () => void;
|
|
60
61
|
context: void | undefined;
|
|
61
62
|
failureCount: number;
|
|
62
|
-
failureReason: import("
|
|
63
|
+
failureReason: import("wagmi/actions").SendTransactionErrorType | null;
|
|
63
64
|
isPaused: boolean;
|
|
64
65
|
submittedAt: number;
|
|
65
|
-
|
|
66
|
+
sendTransactionAsync: import("wagmi/query").SendTransactionMutateAsync<import("wagmi").Config, void>;
|
|
66
67
|
} | {
|
|
67
68
|
isPending: boolean;
|
|
68
69
|
errorMessage: string | undefined;
|
|
69
|
-
|
|
70
|
+
simulateAsyncAndSendTransaction: (params: Parameters<import("wagmi/query").SendTransactionMutate<import("wagmi").Config, void>>[0], simulationParams: Parameters<typeof writeContract>[1]) => Promise<void>;
|
|
70
71
|
error: null;
|
|
71
72
|
status: "pending";
|
|
72
73
|
data: undefined;
|
|
@@ -77,15 +78,15 @@ export declare function useSendTransactionX(settings?: WriteExtendedAsyncParams)
|
|
|
77
78
|
reset: () => void;
|
|
78
79
|
context: void | undefined;
|
|
79
80
|
failureCount: number;
|
|
80
|
-
failureReason: import("
|
|
81
|
+
failureReason: import("wagmi/actions").SendTransactionErrorType | null;
|
|
81
82
|
isPaused: boolean;
|
|
82
83
|
submittedAt: number;
|
|
83
|
-
|
|
84
|
+
sendTransactionAsync: import("wagmi/query").SendTransactionMutateAsync<import("wagmi").Config, void>;
|
|
84
85
|
} | {
|
|
85
86
|
isPending: boolean;
|
|
86
87
|
errorMessage: string | undefined;
|
|
87
|
-
|
|
88
|
-
error: import("
|
|
88
|
+
simulateAsyncAndSendTransaction: (params: Parameters<import("wagmi/query").SendTransactionMutate<import("wagmi").Config, void>>[0], simulationParams: Parameters<typeof writeContract>[1]) => Promise<void>;
|
|
89
|
+
error: import("wagmi/actions").SendTransactionErrorType;
|
|
89
90
|
status: "error";
|
|
90
91
|
data: undefined;
|
|
91
92
|
variables: import("wagmi/query").SendTransactionVariables<import("wagmi").Config, number>;
|
|
@@ -95,14 +96,14 @@ export declare function useSendTransactionX(settings?: WriteExtendedAsyncParams)
|
|
|
95
96
|
reset: () => void;
|
|
96
97
|
context: void | undefined;
|
|
97
98
|
failureCount: number;
|
|
98
|
-
failureReason: import("
|
|
99
|
+
failureReason: import("wagmi/actions").SendTransactionErrorType | null;
|
|
99
100
|
isPaused: boolean;
|
|
100
101
|
submittedAt: number;
|
|
101
|
-
|
|
102
|
+
sendTransactionAsync: import("wagmi/query").SendTransactionMutateAsync<import("wagmi").Config, void>;
|
|
102
103
|
} | {
|
|
103
104
|
isPending: boolean;
|
|
104
105
|
errorMessage: string | undefined;
|
|
105
|
-
|
|
106
|
+
simulateAsyncAndSendTransaction: (params: Parameters<import("wagmi/query").SendTransactionMutate<import("wagmi").Config, void>>[0], simulationParams: Parameters<typeof writeContract>[1]) => Promise<void>;
|
|
106
107
|
error: null;
|
|
107
108
|
status: "success";
|
|
108
109
|
data: `0x${string}`;
|
|
@@ -113,8 +114,8 @@ export declare function useSendTransactionX(settings?: WriteExtendedAsyncParams)
|
|
|
113
114
|
reset: () => void;
|
|
114
115
|
context: void | undefined;
|
|
115
116
|
failureCount: number;
|
|
116
|
-
failureReason: import("
|
|
117
|
+
failureReason: import("wagmi/actions").SendTransactionErrorType | null;
|
|
117
118
|
isPaused: boolean;
|
|
118
119
|
submittedAt: number;
|
|
119
|
-
|
|
120
|
+
sendTransactionAsync: import("wagmi/query").SendTransactionMutateAsync<import("wagmi").Config, void>;
|
|
120
121
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Address } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to fetch ERC-20 summary data for a given token and optional user/spender context.
|
|
4
|
+
*
|
|
5
|
+
* @param {{ address?: Address; user?: Address; spender?: Address }} params
|
|
6
|
+
* @param {import('@tanstack/react-query').UseQueryOptions=} options
|
|
7
|
+
*/
|
|
8
|
+
export declare function useFetchERC20DataX({ address, user, spender, }: {
|
|
9
|
+
address?: Address;
|
|
10
|
+
user?: Address;
|
|
11
|
+
spender?: Address;
|
|
12
|
+
}): import("@tanstack/react-query").UseQueryResult<{
|
|
13
|
+
name: string;
|
|
14
|
+
symbol: string;
|
|
15
|
+
decimals: number | undefined;
|
|
16
|
+
allowance: bigint | undefined;
|
|
17
|
+
balanceOf: bigint | undefined;
|
|
18
|
+
asset: bigint | undefined;
|
|
19
|
+
address: `0x${string}`;
|
|
20
|
+
user: `0x${string}` | undefined;
|
|
21
|
+
spender: `0x${string}` | undefined;
|
|
22
|
+
}, Error>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Address } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to fetch ERC-4626 vault summary data for a given vault and user/spender.
|
|
4
|
+
*
|
|
5
|
+
* @param {{ vault?: Address; user?: Address; spender?: Address }} params
|
|
6
|
+
* @param {import('@tanstack/react-query').UseQueryOptions=} options
|
|
7
|
+
*/
|
|
8
|
+
export declare function useFetchERC4626DataX({ vault, user, spender, }: {
|
|
9
|
+
vault?: Address;
|
|
10
|
+
user?: Address;
|
|
11
|
+
spender?: Address;
|
|
12
|
+
}): import("@tanstack/react-query").UseQueryResult<{
|
|
13
|
+
maxDeposit: `0x${string}`;
|
|
14
|
+
maxMint: bigint;
|
|
15
|
+
maxRedeem: bigint | undefined;
|
|
16
|
+
maxWithdraw: bigint | undefined;
|
|
17
|
+
vault: `0x${string}`;
|
|
18
|
+
owner: `0x${string}` | undefined;
|
|
19
|
+
spender: `0x${string}` | undefined;
|
|
20
|
+
name: string;
|
|
21
|
+
symbol: string;
|
|
22
|
+
decimals: number | undefined;
|
|
23
|
+
allowance: bigint | undefined;
|
|
24
|
+
balanceOf: bigint | undefined;
|
|
25
|
+
asset: bigint | undefined;
|
|
26
|
+
address: `0x${string}`;
|
|
27
|
+
user: `0x${string}` | undefined;
|
|
28
|
+
}, Error>;
|
|
@@ -40,7 +40,7 @@ export declare const HookFetchTokenQK: (asset?: Address) => any[];
|
|
|
40
40
|
* }
|
|
41
41
|
*/
|
|
42
42
|
export declare const useTokenX: (asset?: Address) => {
|
|
43
|
-
data: import("
|
|
43
|
+
data: import("../../fetch-functions/fetchTokenX.js").Token | undefined;
|
|
44
44
|
queryKey: any[];
|
|
45
45
|
error: Error;
|
|
46
46
|
isError: true;
|
|
@@ -63,11 +63,11 @@ export declare const useTokenX: (asset?: Address) => {
|
|
|
63
63
|
isPaused: boolean;
|
|
64
64
|
isRefetching: boolean;
|
|
65
65
|
isStale: boolean;
|
|
66
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("
|
|
66
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../../fetch-functions/fetchTokenX.js").Token, Error>>;
|
|
67
67
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
68
|
-
promise: Promise<import("
|
|
68
|
+
promise: Promise<import("../../fetch-functions/fetchTokenX.js").Token>;
|
|
69
69
|
} | {
|
|
70
|
-
data: import("
|
|
70
|
+
data: import("../../fetch-functions/fetchTokenX.js").Token | undefined;
|
|
71
71
|
queryKey: any[];
|
|
72
72
|
error: null;
|
|
73
73
|
isError: false;
|
|
@@ -90,11 +90,11 @@ export declare const useTokenX: (asset?: Address) => {
|
|
|
90
90
|
isPaused: boolean;
|
|
91
91
|
isRefetching: boolean;
|
|
92
92
|
isStale: boolean;
|
|
93
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("
|
|
93
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../../fetch-functions/fetchTokenX.js").Token, Error>>;
|
|
94
94
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
95
|
-
promise: Promise<import("
|
|
95
|
+
promise: Promise<import("../../fetch-functions/fetchTokenX.js").Token>;
|
|
96
96
|
} | {
|
|
97
|
-
data: import("
|
|
97
|
+
data: import("../../fetch-functions/fetchTokenX.js").Token | undefined;
|
|
98
98
|
queryKey: any[];
|
|
99
99
|
error: Error;
|
|
100
100
|
isError: true;
|
|
@@ -117,11 +117,11 @@ export declare const useTokenX: (asset?: Address) => {
|
|
|
117
117
|
isPaused: boolean;
|
|
118
118
|
isRefetching: boolean;
|
|
119
119
|
isStale: boolean;
|
|
120
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("
|
|
120
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../../fetch-functions/fetchTokenX.js").Token, Error>>;
|
|
121
121
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
122
|
-
promise: Promise<import("
|
|
122
|
+
promise: Promise<import("../../fetch-functions/fetchTokenX.js").Token>;
|
|
123
123
|
} | {
|
|
124
|
-
data: import("
|
|
124
|
+
data: import("../../fetch-functions/fetchTokenX.js").Token | undefined;
|
|
125
125
|
queryKey: any[];
|
|
126
126
|
error: null;
|
|
127
127
|
isError: false;
|
|
@@ -144,11 +144,11 @@ export declare const useTokenX: (asset?: Address) => {
|
|
|
144
144
|
isPaused: boolean;
|
|
145
145
|
isRefetching: boolean;
|
|
146
146
|
isStale: boolean;
|
|
147
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("
|
|
147
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../../fetch-functions/fetchTokenX.js").Token, Error>>;
|
|
148
148
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
149
|
-
promise: Promise<import("
|
|
149
|
+
promise: Promise<import("../../fetch-functions/fetchTokenX.js").Token>;
|
|
150
150
|
} | {
|
|
151
|
-
data: import("
|
|
151
|
+
data: import("../../fetch-functions/fetchTokenX.js").Token | undefined;
|
|
152
152
|
queryKey: any[];
|
|
153
153
|
error: null;
|
|
154
154
|
isError: false;
|
|
@@ -171,11 +171,11 @@ export declare const useTokenX: (asset?: Address) => {
|
|
|
171
171
|
isPaused: boolean;
|
|
172
172
|
isRefetching: boolean;
|
|
173
173
|
isStale: boolean;
|
|
174
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("
|
|
174
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../../fetch-functions/fetchTokenX.js").Token, Error>>;
|
|
175
175
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
176
|
-
promise: Promise<import("
|
|
176
|
+
promise: Promise<import("../../fetch-functions/fetchTokenX.js").Token>;
|
|
177
177
|
} | {
|
|
178
|
-
data: import("
|
|
178
|
+
data: import("../../fetch-functions/fetchTokenX.js").Token | undefined;
|
|
179
179
|
queryKey: any[];
|
|
180
180
|
isError: false;
|
|
181
181
|
error: null;
|
|
@@ -198,7 +198,7 @@ export declare const useTokenX: (asset?: Address) => {
|
|
|
198
198
|
isPaused: boolean;
|
|
199
199
|
isRefetching: boolean;
|
|
200
200
|
isStale: boolean;
|
|
201
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("
|
|
201
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../../fetch-functions/fetchTokenX.js").Token, Error>>;
|
|
202
202
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
203
|
-
promise: Promise<import("
|
|
203
|
+
promise: Promise<import("../../fetch-functions/fetchTokenX.js").Token>;
|
|
204
204
|
};
|