@aave/react 4.0.0-next.1 → 4.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -2
- package/dist/chunk-GTUQRT5Q.js +2 -0
- package/dist/chunk-GTUQRT5Q.js.map +1 -0
- package/dist/chunk-XIDOSID3.js +2 -0
- package/dist/chunk-XIDOSID3.js.map +1 -0
- package/dist/ethers.cjs +2 -0
- package/dist/ethers.cjs.map +1 -0
- package/dist/ethers.d.cts +93 -0
- package/dist/ethers.d.ts +93 -0
- package/dist/ethers.js +2 -0
- package/dist/ethers.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2670 -0
- package/dist/index.d.ts +2670 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/misc-BkG5G4yl.d.cts +377 -0
- package/dist/misc-gmAnSdm5.d.ts +377 -0
- package/dist/privy.cjs +2 -0
- package/dist/privy.cjs.map +1 -0
- package/dist/privy.d.cts +72 -0
- package/dist/privy.d.ts +72 -0
- package/dist/privy.js +2 -0
- package/dist/privy.js.map +1 -0
- package/dist/thirdweb.cjs +3 -0
- package/dist/thirdweb.cjs.map +1 -0
- package/dist/thirdweb.d.cts +69 -0
- package/dist/thirdweb.d.ts +69 -0
- package/dist/thirdweb.js +3 -0
- package/dist/thirdweb.js.map +1 -0
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/dist/viem/index.cjs +2 -0
- package/dist/viem/index.cjs.map +1 -0
- package/dist/viem/index.d.cts +97 -0
- package/dist/viem/index.d.ts +97 -0
- package/dist/viem/index.js +2 -0
- package/dist/viem/index.js.map +1 -0
- package/dist/writes-BXnwYgAQ.d.cts +123 -0
- package/dist/writes-BXnwYgAQ.d.ts +123 -0
- package/package.json +6 -6
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2670 @@
|
|
|
1
|
+
import { AaveClient, CurrencyQueryOptions, UnexpectedError, TimeWindowQueryOptions, ValidationError, ActivitiesRequest, PaginatedActivitiesResult } from '@aave/client';
|
|
2
|
+
export * from '@aave/client';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
import { a as UseAsyncTask, C as CancelOperation, S as SendTransactionError, P as PendingTransactionError, b as PendingTransaction, T as TransactionHandler } from './writes-BXnwYgAQ.cjs';
|
|
5
|
+
export { A as AsyncTaskError, c as AsyncTaskIdle, d as AsyncTaskLoading, e as AsyncTaskState, f as AsyncTaskSuccess, g as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-BXnwYgAQ.cjs';
|
|
6
|
+
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ReserveRequest, Reserve, ReservesRequest, BorrowAPYHistoryRequest, APYSample, SupplyAPYHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, SwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, PrepareSwapRequest, SwapByIntentTypedData, SwapByIntentWithApprovalRequired, SwapTransactionRequest, SwapApprovalRequired, ERC20PermitSignature, SwapReceipt, InsufficientBalanceError, CancelSwapTypedData, TransactionRequest, PrepareSwapCancelRequest, SwapCancelled, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserRiskPremiumRequest, UpdateUserDynamicConfigRequest, SetUserSupplyAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
7
|
+
import { Prettify, ResultAsync, ResultAwareError, TxHash } from '@aave/types';
|
|
8
|
+
import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult, d as Selector } from './misc-BkG5G4yl.cjs';
|
|
9
|
+
export { e as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-BkG5G4yl.cjs';
|
|
10
|
+
import { UnexpectedError as UnexpectedError$1, SigningError, CancelError, TimeoutError, TransactionError, ValidationError as ValidationError$1 } from '@aave/core';
|
|
11
|
+
import { UserPositionQueryOptions } from '@aave/client/actions';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* <AaveProvider> props
|
|
15
|
+
*/
|
|
16
|
+
type AaveProviderProps = {
|
|
17
|
+
/**
|
|
18
|
+
* The children to render
|
|
19
|
+
*/
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* The Aave client instance to use
|
|
23
|
+
*/
|
|
24
|
+
client: AaveClient;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Manages the internal state of the Aave SDK.
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { AaveProvider, AaveClient, production } from '@aave/react';
|
|
31
|
+
*
|
|
32
|
+
* const client = AaveClient.create({
|
|
33
|
+
* environment: production,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* function App() {
|
|
37
|
+
* return (
|
|
38
|
+
* <AaveProvider client={client}>
|
|
39
|
+
* // ...
|
|
40
|
+
* </AaveProvider>
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare function AaveProvider({ children, client }: AaveProviderProps): React.JSX.Element;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
declare function useAaveClient(): AaveClient;
|
|
51
|
+
|
|
52
|
+
type UseHubArgs = Prettify<HubRequest & CurrencyQueryOptions>;
|
|
53
|
+
/**
|
|
54
|
+
* Fetch a specific hub by ID or by address and chain ID.
|
|
55
|
+
*
|
|
56
|
+
* This signature supports React Suspense:
|
|
57
|
+
*
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const { data } = useHub({
|
|
60
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
61
|
+
* suspense: true,
|
|
62
|
+
* });
|
|
63
|
+
* // data will be Hub | null
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function useHub(args: UseHubArgs & Suspendable): SuspenseResult<Hub | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Fetch a specific hub by ID or by address and chain ID.
|
|
69
|
+
*
|
|
70
|
+
* Pausable suspense mode.
|
|
71
|
+
*
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const { data } = useHub({
|
|
74
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
75
|
+
* suspense: true,
|
|
76
|
+
* pause: true,
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare function useHub(args: Pausable<UseHubArgs> & Suspendable): PausableSuspenseResult<Hub | null>;
|
|
81
|
+
/**
|
|
82
|
+
* Fetch a specific hub by ID or by address and chain ID.
|
|
83
|
+
*
|
|
84
|
+
* ```tsx
|
|
85
|
+
* const { data, error, loading } = useHub({
|
|
86
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
87
|
+
* });
|
|
88
|
+
* // data will be Hub | null
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare function useHub(args: UseHubArgs): ReadResult<Hub | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Fetch a specific hub by ID or by address and chain ID.
|
|
94
|
+
*
|
|
95
|
+
* Pausable loading state mode.
|
|
96
|
+
*
|
|
97
|
+
* ```tsx
|
|
98
|
+
* const { data, error, loading, paused } = useHub({
|
|
99
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
100
|
+
* pause: true,
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
declare function useHub(args: Pausable<UseHubArgs>): PausableReadResult<Hub | null>;
|
|
105
|
+
type UseHubsArgs = Prettify<HubsRequest & CurrencyQueryOptions>;
|
|
106
|
+
/**
|
|
107
|
+
* Fetch multiple hubs based on specified criteria.
|
|
108
|
+
*
|
|
109
|
+
* This signature supports React Suspense:
|
|
110
|
+
*
|
|
111
|
+
* ```tsx
|
|
112
|
+
* const { data } = useHubs({
|
|
113
|
+
* query: { chainIds: [chainId(1)] },
|
|
114
|
+
* suspense: true,
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function useHubs(args: UseHubsArgs & Suspendable): SuspenseResult<Hub[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Fetch multiple hubs based on specified criteria.
|
|
121
|
+
*
|
|
122
|
+
* Pausable suspense mode.
|
|
123
|
+
*
|
|
124
|
+
* ```tsx
|
|
125
|
+
* const { data } = useHubs({
|
|
126
|
+
* query: { chainIds: [chainId(1)] },
|
|
127
|
+
* suspense: true,
|
|
128
|
+
* pause: true,
|
|
129
|
+
* });
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
declare function useHubs(args: Pausable<UseHubsArgs> & Suspendable): PausableSuspenseResult<Hub[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Fetch multiple hubs based on specified criteria.
|
|
135
|
+
*
|
|
136
|
+
* ```tsx
|
|
137
|
+
* const { data, error, loading } = useHubs({
|
|
138
|
+
* query: { chainIds: [chainId(1)] },
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
declare function useHubs(args: UseHubsArgs): ReadResult<Hub[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Fetch multiple hubs based on specified criteria.
|
|
145
|
+
*
|
|
146
|
+
* Pausable loading state mode.
|
|
147
|
+
*
|
|
148
|
+
* ```tsx
|
|
149
|
+
* const { data, error, loading, paused } = useHubs({
|
|
150
|
+
* query: { chainIds: [chainId(1)] },
|
|
151
|
+
* pause: true,
|
|
152
|
+
* });
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
declare function useHubs(args: Pausable<UseHubsArgs>): PausableReadResult<Hub[]>;
|
|
156
|
+
type UseHubAssetsArgs = Prettify<HubAssetsRequest & CurrencyQueryOptions>;
|
|
157
|
+
/**
|
|
158
|
+
* Fetch hub assets for a specific hub by ID or by address and chain ID.
|
|
159
|
+
*
|
|
160
|
+
* This signature supports React Suspense:
|
|
161
|
+
*
|
|
162
|
+
* ```tsx
|
|
163
|
+
* const { data } = useHubAssets({
|
|
164
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
165
|
+
* user: evmAddress('0x456...'), // optional
|
|
166
|
+
* suspense: true,
|
|
167
|
+
* });
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
declare function useHubAssets(args: UseHubAssetsArgs & Suspendable): SuspenseResult<HubAsset[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Fetch hub assets for a specific hub by ID or by address and chain ID.
|
|
173
|
+
*
|
|
174
|
+
* Pausable suspense mode.
|
|
175
|
+
*
|
|
176
|
+
* ```tsx
|
|
177
|
+
* const { data } = useHubAssets({
|
|
178
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
179
|
+
* user: evmAddress('0x456...'), // optional
|
|
180
|
+
* suspense: true,
|
|
181
|
+
* pause: true,
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
declare function useHubAssets(args: Pausable<UseHubAssetsArgs> & Suspendable): PausableSuspenseResult<HubAsset[]>;
|
|
186
|
+
/**
|
|
187
|
+
* Fetch hub assets for a specific hub by ID or by address and chain ID.
|
|
188
|
+
*
|
|
189
|
+
* ```tsx
|
|
190
|
+
* const { data, error, loading } = useHubAssets({
|
|
191
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
192
|
+
* user: evmAddress('0x456...'), // optional
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
declare function useHubAssets(args: UseHubAssetsArgs): ReadResult<HubAsset[]>;
|
|
197
|
+
/**
|
|
198
|
+
* Fetch hub assets for a specific hub by ID or by address and chain ID.
|
|
199
|
+
*
|
|
200
|
+
* Pausable loading state mode.
|
|
201
|
+
*
|
|
202
|
+
* ```tsx
|
|
203
|
+
* const { data, error, loading, paused } = useHubAssets({
|
|
204
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
205
|
+
* user: evmAddress('0x456...'), // optional
|
|
206
|
+
* pause: true,
|
|
207
|
+
* });
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
declare function useHubAssets(args: Pausable<UseHubAssetsArgs>): PausableReadResult<HubAsset[]>;
|
|
211
|
+
/**
|
|
212
|
+
* Low-level hook to execute a {@link hubs} action directly.
|
|
213
|
+
*
|
|
214
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
215
|
+
* @remarks
|
|
216
|
+
* This hook **does not** actively watch for updated data on the hubs.
|
|
217
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
218
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
219
|
+
*
|
|
220
|
+
* ```ts
|
|
221
|
+
* const [execute, { called, data, error, loading }] = useHubsAction();
|
|
222
|
+
*
|
|
223
|
+
* // …
|
|
224
|
+
*
|
|
225
|
+
* const result = await execute({
|
|
226
|
+
* query: {
|
|
227
|
+
* chainIds: [chainId(1)]
|
|
228
|
+
* }
|
|
229
|
+
* });
|
|
230
|
+
*
|
|
231
|
+
* if (result.isOk()) {
|
|
232
|
+
* console.log(result.value); // Hub[]
|
|
233
|
+
* } else {
|
|
234
|
+
* console.error(result.error);
|
|
235
|
+
* }
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
declare function useHubsAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<HubsRequest, Hub[], UnexpectedError>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @internal
|
|
242
|
+
*/
|
|
243
|
+
declare function usePermitTypedDataAction(): UseAsyncTask<PermitRequest, PermitTypedDataResponse, UnexpectedError>;
|
|
244
|
+
|
|
245
|
+
type UseAssetArgs = Prettify<AssetRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
246
|
+
/**
|
|
247
|
+
* Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.
|
|
248
|
+
*
|
|
249
|
+
* This signature supports React Suspense:
|
|
250
|
+
*
|
|
251
|
+
* ```tsx
|
|
252
|
+
* const { data } = useAsset({
|
|
253
|
+
* query: { assetId: assetId('SGVsbG8h') },
|
|
254
|
+
* suspense: true,
|
|
255
|
+
* });
|
|
256
|
+
* // data will be Asset | null
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
declare function useAsset(args: UseAssetArgs & Suspendable): SuspenseResult<Asset | null>;
|
|
260
|
+
/**
|
|
261
|
+
* Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.
|
|
262
|
+
*
|
|
263
|
+
* Pausable suspense mode.
|
|
264
|
+
*
|
|
265
|
+
* ```tsx
|
|
266
|
+
* const { data } = useAsset({
|
|
267
|
+
* query: { assetId: assetId('SGVsbG8h') },
|
|
268
|
+
* suspense: true,
|
|
269
|
+
* pause: true,
|
|
270
|
+
* });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
declare function useAsset(args: Pausable<UseAssetArgs> & Suspendable): PausableSuspenseResult<Asset | null>;
|
|
274
|
+
/**
|
|
275
|
+
* Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.
|
|
276
|
+
*
|
|
277
|
+
* ```tsx
|
|
278
|
+
* const { data, error, loading } = useAsset({
|
|
279
|
+
* query: { assetId: assetId('SGVsbG8h') },
|
|
280
|
+
* });
|
|
281
|
+
* // data will be Asset | null
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
declare function useAsset(args: UseAssetArgs): ReadResult<Asset | null>;
|
|
285
|
+
/**
|
|
286
|
+
* Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.
|
|
287
|
+
*
|
|
288
|
+
* Pausable loading state mode.
|
|
289
|
+
*
|
|
290
|
+
* ```tsx
|
|
291
|
+
* const { data, error, loading, paused } = useAsset({
|
|
292
|
+
* query: { assetId: assetId('SGVsbG8h') },
|
|
293
|
+
* pause: true,
|
|
294
|
+
* });
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
declare function useAsset(args: Pausable<UseAssetArgs>): PausableReadResult<Asset | null>;
|
|
298
|
+
type UseAssetPriceHistoryArgs = AssetPriceHistoryRequest;
|
|
299
|
+
/**
|
|
300
|
+
* Fetch historical price data for a specific asset.
|
|
301
|
+
*
|
|
302
|
+
* This signature supports React Suspense:
|
|
303
|
+
*
|
|
304
|
+
* ```tsx
|
|
305
|
+
* const { data } = useAssetPriceHistory({
|
|
306
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
307
|
+
* currency: Currency.Usd,
|
|
308
|
+
* window: TimeWindow.LastWeek,
|
|
309
|
+
* suspense: true,
|
|
310
|
+
* });
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
declare function useAssetPriceHistory(args: UseAssetPriceHistoryArgs & Suspendable): SuspenseResult<AssetPriceSample[]>;
|
|
314
|
+
/**
|
|
315
|
+
* Fetch historical price data for a specific asset.
|
|
316
|
+
*
|
|
317
|
+
* Pausable suspense mode.
|
|
318
|
+
*
|
|
319
|
+
* ```tsx
|
|
320
|
+
* const { data } = useAssetPriceHistory({
|
|
321
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
322
|
+
* suspense: true,
|
|
323
|
+
* pause: true,
|
|
324
|
+
* });
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
declare function useAssetPriceHistory(args: Pausable<UseAssetPriceHistoryArgs> & Suspendable): PausableSuspenseResult<AssetPriceSample[]>;
|
|
328
|
+
/**
|
|
329
|
+
* Fetch historical price data for a specific asset.
|
|
330
|
+
*
|
|
331
|
+
* ```tsx
|
|
332
|
+
* const { data, error, loading } = useAssetPriceHistory({
|
|
333
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
334
|
+
* currency: Currency.Usd,
|
|
335
|
+
* window: TimeWindow.LastWeek,
|
|
336
|
+
* });
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
declare function useAssetPriceHistory(args: UseAssetPriceHistoryArgs): ReadResult<AssetPriceSample[]>;
|
|
340
|
+
/**
|
|
341
|
+
* Fetch historical price data for a specific asset.
|
|
342
|
+
*
|
|
343
|
+
* Pausable loading state mode.
|
|
344
|
+
*
|
|
345
|
+
* ```tsx
|
|
346
|
+
* const { data, error, loading, paused } = useAssetPriceHistory({
|
|
347
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
348
|
+
* pause: true,
|
|
349
|
+
* });
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
declare function useAssetPriceHistory(args: Pausable<UseAssetPriceHistoryArgs>): PausableReadResult<AssetPriceSample[]>;
|
|
353
|
+
type UseAssetSupplyHistoryArgs = AssetSupplyHistoryRequest;
|
|
354
|
+
/**
|
|
355
|
+
* Fetch historical supply data for a specific asset.
|
|
356
|
+
*
|
|
357
|
+
* This signature supports React Suspense:
|
|
358
|
+
*
|
|
359
|
+
* ```tsx
|
|
360
|
+
* const { data } = useAssetSupplyHistory({
|
|
361
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
362
|
+
* window: TimeWindow.LastWeek,
|
|
363
|
+
* suspense: true,
|
|
364
|
+
* });
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
declare function useAssetSupplyHistory(args: UseAssetSupplyHistoryArgs & Suspendable): SuspenseResult<AssetSupplySample[]>;
|
|
368
|
+
/**
|
|
369
|
+
* Fetch historical supply data for a specific asset.
|
|
370
|
+
*
|
|
371
|
+
* Pausable suspense mode.
|
|
372
|
+
*
|
|
373
|
+
* ```tsx
|
|
374
|
+
* const { data } = useAssetSupplyHistory({
|
|
375
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
376
|
+
* suspense: true,
|
|
377
|
+
* pause: true,
|
|
378
|
+
* });
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
declare function useAssetSupplyHistory(args: Pausable<UseAssetSupplyHistoryArgs> & Suspendable): PausableSuspenseResult<AssetSupplySample[]>;
|
|
382
|
+
/**
|
|
383
|
+
* Fetch historical supply data for a specific asset.
|
|
384
|
+
*
|
|
385
|
+
* ```tsx
|
|
386
|
+
* const { data, error, loading } = useAssetSupplyHistory({
|
|
387
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
388
|
+
* window: TimeWindow.LastWeek,
|
|
389
|
+
* });
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
declare function useAssetSupplyHistory(args: UseAssetSupplyHistoryArgs): ReadResult<AssetSupplySample[]>;
|
|
393
|
+
/**
|
|
394
|
+
* Fetch historical supply data for a specific asset.
|
|
395
|
+
*
|
|
396
|
+
* Pausable loading state mode.
|
|
397
|
+
*
|
|
398
|
+
* ```tsx
|
|
399
|
+
* const { data, error, loading, paused } = useAssetSupplyHistory({
|
|
400
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
401
|
+
* pause: true,
|
|
402
|
+
* });
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
declare function useAssetSupplyHistory(args: Pausable<UseAssetSupplyHistoryArgs>): PausableReadResult<AssetSupplySample[]>;
|
|
406
|
+
type UseAssetBorrowHistoryArgs = AssetBorrowHistoryRequest;
|
|
407
|
+
/**
|
|
408
|
+
* Fetch historical borrow data for a specific asset.
|
|
409
|
+
*
|
|
410
|
+
* This signature supports React Suspense:
|
|
411
|
+
*
|
|
412
|
+
* ```tsx
|
|
413
|
+
* const { data } = useAssetBorrowHistory({
|
|
414
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
415
|
+
* window: TimeWindow.LastWeek,
|
|
416
|
+
* suspense: true,
|
|
417
|
+
* });
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
declare function useAssetBorrowHistory(args: UseAssetBorrowHistoryArgs & Suspendable): SuspenseResult<AssetBorrowSample[]>;
|
|
421
|
+
/**
|
|
422
|
+
* Fetch historical borrow data for a specific asset.
|
|
423
|
+
*
|
|
424
|
+
* Pausable suspense mode.
|
|
425
|
+
*
|
|
426
|
+
* ```tsx
|
|
427
|
+
* const { data } = useAssetBorrowHistory({
|
|
428
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
429
|
+
* suspense: true,
|
|
430
|
+
* pause: true,
|
|
431
|
+
* });
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
declare function useAssetBorrowHistory(args: Pausable<UseAssetBorrowHistoryArgs> & Suspendable): PausableSuspenseResult<AssetBorrowSample[]>;
|
|
435
|
+
/**
|
|
436
|
+
* Fetch historical borrow data for a specific asset.
|
|
437
|
+
*
|
|
438
|
+
* ```tsx
|
|
439
|
+
* const { data, error, loading } = useAssetBorrowHistory({
|
|
440
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
441
|
+
* window: TimeWindow.LastWeek,
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
declare function useAssetBorrowHistory(args: UseAssetBorrowHistoryArgs): ReadResult<AssetBorrowSample[]>;
|
|
446
|
+
/**
|
|
447
|
+
* Fetch historical borrow data for a specific asset.
|
|
448
|
+
*
|
|
449
|
+
* Pausable loading state mode.
|
|
450
|
+
*
|
|
451
|
+
* ```tsx
|
|
452
|
+
* const { data, error, loading, paused } = useAssetBorrowHistory({
|
|
453
|
+
* token: { chainId: chainId(1), address: evmAddress('0x123...') },
|
|
454
|
+
* pause: true,
|
|
455
|
+
* });
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
declare function useAssetBorrowHistory(args: Pausable<UseAssetBorrowHistoryArgs>): PausableReadResult<AssetBorrowSample[]>;
|
|
459
|
+
|
|
460
|
+
type UseReserveArgs = Prettify<ReserveRequest & CurrencyQueryOptions>;
|
|
461
|
+
/**
|
|
462
|
+
* Fetch a specific reserve by reserve ID, spoke, and chain.
|
|
463
|
+
*
|
|
464
|
+
* This signature supports React Suspense:
|
|
465
|
+
*
|
|
466
|
+
* ```tsx
|
|
467
|
+
* const { data } = useReserve({
|
|
468
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
469
|
+
* user: evmAddress('0xabc...'),
|
|
470
|
+
* suspense: true,
|
|
471
|
+
* });
|
|
472
|
+
* // data will be Reserve | null
|
|
473
|
+
* ```
|
|
474
|
+
*/
|
|
475
|
+
declare function useReserve(args: UseReserveArgs & Suspendable): SuspenseResult<Reserve | null>;
|
|
476
|
+
/**
|
|
477
|
+
* Fetch a specific reserve by reserve ID, spoke, and chain.
|
|
478
|
+
*
|
|
479
|
+
* Pausable suspense mode.
|
|
480
|
+
*
|
|
481
|
+
* ```tsx
|
|
482
|
+
* const { data } = useReserve({
|
|
483
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
484
|
+
* suspense: true,
|
|
485
|
+
* pause: true,
|
|
486
|
+
* });
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
declare function useReserve(args: Pausable<UseReserveArgs> & Suspendable): PausableSuspenseResult<Reserve | null>;
|
|
490
|
+
/**
|
|
491
|
+
* Fetch a specific reserve by reserve ID, spoke, and chain.
|
|
492
|
+
*
|
|
493
|
+
* ```tsx
|
|
494
|
+
* const { data, error, loading } = useReserve({
|
|
495
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
496
|
+
* user: evmAddress('0xabc...'),
|
|
497
|
+
* });
|
|
498
|
+
* // data will be Reserve | null
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
declare function useReserve(args: UseReserveArgs): ReadResult<Reserve | null>;
|
|
502
|
+
/**
|
|
503
|
+
* Fetch a specific reserve by reserve ID, spoke, and chain.
|
|
504
|
+
*
|
|
505
|
+
* Pausable loading state mode.
|
|
506
|
+
*
|
|
507
|
+
* ```tsx
|
|
508
|
+
* const { data, error, loading, paused } = useReserve({
|
|
509
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
510
|
+
* pause: true,
|
|
511
|
+
* });
|
|
512
|
+
* ```
|
|
513
|
+
*/
|
|
514
|
+
declare function useReserve(args: Pausable<UseReserveArgs>): PausableReadResult<Reserve | null>;
|
|
515
|
+
/**
|
|
516
|
+
* Low-level hook to execute a {@link reserve} action directly.
|
|
517
|
+
*
|
|
518
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
519
|
+
* @remarks
|
|
520
|
+
* This hook **does not** actively watch for updated data on the reserve.
|
|
521
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
522
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
523
|
+
*
|
|
524
|
+
* ```ts
|
|
525
|
+
* const [execute, { called, data, error, loading }] = useReserveAction();
|
|
526
|
+
*
|
|
527
|
+
* // …
|
|
528
|
+
*
|
|
529
|
+
* const result = await execute({
|
|
530
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
531
|
+
* });
|
|
532
|
+
*
|
|
533
|
+
* if (result.isOk()) {
|
|
534
|
+
* console.log(result.value); // Reserve | null
|
|
535
|
+
* } else {
|
|
536
|
+
* console.error(result.error);
|
|
537
|
+
* }
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
declare function useReserveAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<ReserveRequest, Reserve | null, UnexpectedError>;
|
|
541
|
+
type UseReservesArgs<T = Reserve[]> = Prettify<ReservesRequest & CurrencyQueryOptions & {
|
|
542
|
+
/**
|
|
543
|
+
* A function that maps the full list of reserves
|
|
544
|
+
* into a derived or narrowed value.
|
|
545
|
+
*
|
|
546
|
+
* Example: pick a single reserve based on a criteria.
|
|
547
|
+
*
|
|
548
|
+
* @experimental This is experimental and may be subject to breaking changes.
|
|
549
|
+
*/
|
|
550
|
+
selector?: Selector<Reserve[], T>;
|
|
551
|
+
}>;
|
|
552
|
+
/**
|
|
553
|
+
* Fetch reserves based on specified criteria.
|
|
554
|
+
*
|
|
555
|
+
* This signature supports React Suspense:
|
|
556
|
+
*
|
|
557
|
+
* ```tsx
|
|
558
|
+
* const { data } = useReserves({
|
|
559
|
+
* query: {
|
|
560
|
+
* spoke: {
|
|
561
|
+
* address: evmAddress('0x123...'),
|
|
562
|
+
* chainId: chainId(1)
|
|
563
|
+
* }
|
|
564
|
+
* },
|
|
565
|
+
* filter: ReservesRequestFilter.All,
|
|
566
|
+
* orderBy: { name: 'ASC' },
|
|
567
|
+
* suspense: true,
|
|
568
|
+
* });
|
|
569
|
+
* ```
|
|
570
|
+
*
|
|
571
|
+
* **Reserves with Highest Supply APY**
|
|
572
|
+
* ```tsx
|
|
573
|
+
* const { data } = useReserves({
|
|
574
|
+
* query: {
|
|
575
|
+
* spoke: {
|
|
576
|
+
* address: evmAddress('0x123...'),
|
|
577
|
+
* chainId: chainId(1)
|
|
578
|
+
* }
|
|
579
|
+
* },
|
|
580
|
+
* suspense: true,
|
|
581
|
+
* selector: pickHighestSupplyApyReserve,
|
|
582
|
+
* });
|
|
583
|
+
* ```
|
|
584
|
+
*
|
|
585
|
+
* **Reserves with Lowest Borrow APY**
|
|
586
|
+
* ```tsx
|
|
587
|
+
* const { data } = useReserves({
|
|
588
|
+
* query: {
|
|
589
|
+
* spoke: {
|
|
590
|
+
* address: evmAddress('0x123...'),
|
|
591
|
+
* chainId: chainId(1)
|
|
592
|
+
* }
|
|
593
|
+
* },
|
|
594
|
+
* suspense: true,
|
|
595
|
+
* selector: pickLowestBorrowApyReserve,
|
|
596
|
+
* });
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
declare function useReserves<T = Reserve[]>(args: UseReservesArgs<T> & Suspendable): SuspenseResult<T>;
|
|
600
|
+
/**
|
|
601
|
+
* Fetch reserves based on specified criteria.
|
|
602
|
+
*
|
|
603
|
+
* Pausable suspense mode.
|
|
604
|
+
*
|
|
605
|
+
* ```tsx
|
|
606
|
+
* const { data } = useReserves({
|
|
607
|
+
* query: {
|
|
608
|
+
* spoke: {
|
|
609
|
+
* address: evmAddress('0x123...'),
|
|
610
|
+
* chainId: chainId(1)
|
|
611
|
+
* }
|
|
612
|
+
* },
|
|
613
|
+
* suspense: true,
|
|
614
|
+
* pause: true,
|
|
615
|
+
* });
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
|
+
declare function useReserves<T = Reserve[]>(args: Pausable<UseReservesArgs<T>> & Suspendable): PausableSuspenseResult<T>;
|
|
619
|
+
/**
|
|
620
|
+
* Fetch reserves based on specified criteria.
|
|
621
|
+
*
|
|
622
|
+
* ```tsx
|
|
623
|
+
* const { data, error, loading } = useReserves({
|
|
624
|
+
* query: {
|
|
625
|
+
* spoke: {
|
|
626
|
+
* address: evmAddress('0x123...'),
|
|
627
|
+
* chainId: chainId(1)
|
|
628
|
+
* }
|
|
629
|
+
* },
|
|
630
|
+
* filter: ReservesRequestFilter.All,
|
|
631
|
+
* orderBy: { name: 'ASC' },
|
|
632
|
+
* });
|
|
633
|
+
* ```
|
|
634
|
+
*
|
|
635
|
+
* **Reserves with Highest Supply APY**
|
|
636
|
+
* ```tsx
|
|
637
|
+
* const { data } = useReserves({
|
|
638
|
+
* query: {
|
|
639
|
+
* spoke: {
|
|
640
|
+
* address: evmAddress('0x123...'),
|
|
641
|
+
* chainId: chainId(1)
|
|
642
|
+
* }
|
|
643
|
+
* },
|
|
644
|
+
* selector: pickHighestSupplyApyReserve,
|
|
645
|
+
* });
|
|
646
|
+
* ```
|
|
647
|
+
*
|
|
648
|
+
* **Reserves with Lowest Borrow APY**
|
|
649
|
+
* ```tsx
|
|
650
|
+
* const { data } = useReserves({
|
|
651
|
+
* query: {
|
|
652
|
+
* spoke: {
|
|
653
|
+
* address: evmAddress('0x123...'),
|
|
654
|
+
* chainId: chainId(1)
|
|
655
|
+
* }
|
|
656
|
+
* },
|
|
657
|
+
* selector: pickLowestBorrowApyReserve,
|
|
658
|
+
* });
|
|
659
|
+
* ```
|
|
660
|
+
*/
|
|
661
|
+
declare function useReserves<T = Reserve[]>(args: UseReservesArgs<T>): ReadResult<T>;
|
|
662
|
+
/**
|
|
663
|
+
* Fetch reserves based on specified criteria.
|
|
664
|
+
*
|
|
665
|
+
* Pausable loading state mode.
|
|
666
|
+
*
|
|
667
|
+
* ```tsx
|
|
668
|
+
* const { data, error, loading, paused } = useReserves({
|
|
669
|
+
* query: {
|
|
670
|
+
* spoke: {
|
|
671
|
+
* address: evmAddress('0x123...'),
|
|
672
|
+
* chainId: chainId(1)
|
|
673
|
+
* }
|
|
674
|
+
* },
|
|
675
|
+
* pause: true,
|
|
676
|
+
* });
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
declare function useReserves<T = Reserve[]>(args: Pausable<UseReservesArgs<T>>): PausableReadResult<T>;
|
|
680
|
+
/**
|
|
681
|
+
* Low-level hook to execute a {@link reserves} action directly.
|
|
682
|
+
*
|
|
683
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
684
|
+
* @remarks
|
|
685
|
+
* This hook **does not** actively watch for updated data on the reserves.
|
|
686
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
687
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
688
|
+
*
|
|
689
|
+
* ```ts
|
|
690
|
+
* const [execute, { called, data, error, loading }] = useReservesAction();
|
|
691
|
+
*
|
|
692
|
+
* // …
|
|
693
|
+
*
|
|
694
|
+
* const result = await execute({
|
|
695
|
+
* query: {
|
|
696
|
+
* spoke: {
|
|
697
|
+
* address: evmAddress('0x1234…'),
|
|
698
|
+
* chainId: chainId(1)
|
|
699
|
+
* }
|
|
700
|
+
* }
|
|
701
|
+
* });
|
|
702
|
+
*
|
|
703
|
+
* if (result.isOk()) {
|
|
704
|
+
* console.log(result.value); // Reserve[]
|
|
705
|
+
* } else {
|
|
706
|
+
* console.error(result.error);
|
|
707
|
+
* }
|
|
708
|
+
* ```
|
|
709
|
+
*
|
|
710
|
+
* **Reserves with Highest Supply APY**
|
|
711
|
+
* ```ts
|
|
712
|
+
* const [execute, { called, data, error, loading }] = useReservesAction();
|
|
713
|
+
*
|
|
714
|
+
* // …
|
|
715
|
+
*
|
|
716
|
+
* const result = await execute(…).map(pickHighestSupplyApyReserve);
|
|
717
|
+
*
|
|
718
|
+
* if (result.isOk()) {
|
|
719
|
+
* console.log(result.value); // Reserve | null
|
|
720
|
+
* } else {
|
|
721
|
+
* console.error(result.error);
|
|
722
|
+
* }
|
|
723
|
+
* ```
|
|
724
|
+
*
|
|
725
|
+
* **Reserves with Lowest Borrow APY**
|
|
726
|
+
* ```ts
|
|
727
|
+
* const [execute, { called, data, error, loading }] = useReservesAction();
|
|
728
|
+
*
|
|
729
|
+
* // …
|
|
730
|
+
*
|
|
731
|
+
* const result = await execute(…).map(pickLowestBorrowApyReserve);
|
|
732
|
+
*
|
|
733
|
+
* if (result.isOk()) {
|
|
734
|
+
* console.log(result.value); // Reserve | null
|
|
735
|
+
* } else {
|
|
736
|
+
* console.error(result.error);
|
|
737
|
+
* }
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
declare function useReservesAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<ReservesRequest, Reserve[], UnexpectedError>;
|
|
741
|
+
type UseBorrowApyHistoryArgs = BorrowAPYHistoryRequest;
|
|
742
|
+
/**
|
|
743
|
+
* Fetch borrow APY history for a specific reserve over time.
|
|
744
|
+
*
|
|
745
|
+
* This signature supports React Suspense:
|
|
746
|
+
*
|
|
747
|
+
* ```tsx
|
|
748
|
+
* const { data } = useBorrowApyHistory({
|
|
749
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
750
|
+
* window: TimeWindow.LastWeek,
|
|
751
|
+
* suspense: true,
|
|
752
|
+
* });
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs & Suspendable): SuspenseResult<APYSample[]>;
|
|
756
|
+
/**
|
|
757
|
+
* Fetch borrow APY history for a specific reserve over time.
|
|
758
|
+
*
|
|
759
|
+
* Pausable suspense mode.
|
|
760
|
+
*
|
|
761
|
+
* ```tsx
|
|
762
|
+
* const { data } = useBorrowApyHistory({
|
|
763
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
764
|
+
* window: TimeWindow.LastWeek,
|
|
765
|
+
* suspense: true,
|
|
766
|
+
* pause: true,
|
|
767
|
+
* });
|
|
768
|
+
* ```
|
|
769
|
+
*/
|
|
770
|
+
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs> & Suspendable): PausableSuspenseResult<APYSample[]>;
|
|
771
|
+
/**
|
|
772
|
+
* Fetch borrow APY history for a specific reserve over time.
|
|
773
|
+
*
|
|
774
|
+
* ```tsx
|
|
775
|
+
* const { data, error, loading } = useBorrowApyHistory({
|
|
776
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
777
|
+
* window: TimeWindow.LastWeek,
|
|
778
|
+
* });
|
|
779
|
+
* ```
|
|
780
|
+
*/
|
|
781
|
+
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs): ReadResult<APYSample[]>;
|
|
782
|
+
/**
|
|
783
|
+
* Fetch borrow APY history for a specific reserve over time.
|
|
784
|
+
*
|
|
785
|
+
* Pausable loading state mode.
|
|
786
|
+
*
|
|
787
|
+
* ```tsx
|
|
788
|
+
* const { data, error, loading, paused } = useBorrowApyHistory({
|
|
789
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
790
|
+
* window: TimeWindow.LastWeek,
|
|
791
|
+
* pause: true,
|
|
792
|
+
* });
|
|
793
|
+
* ```
|
|
794
|
+
*/
|
|
795
|
+
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs>): PausableReadResult<APYSample[]>;
|
|
796
|
+
type UseSupplyApyHistoryArgs = SupplyAPYHistoryRequest;
|
|
797
|
+
/**
|
|
798
|
+
* Fetch supply APY history for a specific reserve over time.
|
|
799
|
+
*
|
|
800
|
+
* This signature supports React Suspense:
|
|
801
|
+
*
|
|
802
|
+
* ```tsx
|
|
803
|
+
* const { data } = useSupplyApyHistory({
|
|
804
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
805
|
+
* window: TimeWindow.LastWeek,
|
|
806
|
+
* suspense: true,
|
|
807
|
+
* });
|
|
808
|
+
* ```
|
|
809
|
+
*/
|
|
810
|
+
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs & Suspendable): SuspenseResult<APYSample[]>;
|
|
811
|
+
/**
|
|
812
|
+
* Fetch supply APY history for a specific reserve over time.
|
|
813
|
+
*
|
|
814
|
+
* Pausable suspense mode.
|
|
815
|
+
*
|
|
816
|
+
* ```tsx
|
|
817
|
+
* const { data } = useSupplyApyHistory({
|
|
818
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
819
|
+
* window: TimeWindow.LastWeek,
|
|
820
|
+
* suspense: true,
|
|
821
|
+
* pause: true,
|
|
822
|
+
* });
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs> & Suspendable): PausableSuspenseResult<APYSample[]>;
|
|
826
|
+
/**
|
|
827
|
+
* Fetch supply APY history for a specific reserve over time.
|
|
828
|
+
*
|
|
829
|
+
* ```tsx
|
|
830
|
+
* const { data, error, loading } = useSupplyApyHistory({
|
|
831
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
832
|
+
* window: TimeWindow.LastWeek,
|
|
833
|
+
* });
|
|
834
|
+
* ```
|
|
835
|
+
*/
|
|
836
|
+
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs): ReadResult<APYSample[]>;
|
|
837
|
+
/**
|
|
838
|
+
* Fetch supply APY history for a specific reserve over time.
|
|
839
|
+
*
|
|
840
|
+
* Pausable loading state mode.
|
|
841
|
+
*
|
|
842
|
+
* ```tsx
|
|
843
|
+
* const { data, error, loading, paused } = useSupplyApyHistory({
|
|
844
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
845
|
+
* window: TimeWindow.LastWeek,
|
|
846
|
+
* pause: true,
|
|
847
|
+
* });
|
|
848
|
+
* ```
|
|
849
|
+
*/
|
|
850
|
+
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs>): PausableReadResult<APYSample[]>;
|
|
851
|
+
|
|
852
|
+
type UseSpokeArgs = SpokeRequest;
|
|
853
|
+
/**
|
|
854
|
+
* Fetch a specific spoke.
|
|
855
|
+
*
|
|
856
|
+
* This signature supports React Suspense:
|
|
857
|
+
*
|
|
858
|
+
* ```tsx
|
|
859
|
+
* const { data } = useSpoke({
|
|
860
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
861
|
+
* suspense: true,
|
|
862
|
+
* });
|
|
863
|
+
* // data will be Spoke | null
|
|
864
|
+
* ```
|
|
865
|
+
*/
|
|
866
|
+
declare function useSpoke(args: UseSpokeArgs & Suspendable): SuspenseResult<Spoke | null>;
|
|
867
|
+
/**
|
|
868
|
+
* Fetch a specific spoke.
|
|
869
|
+
*
|
|
870
|
+
* Pausable suspense mode.
|
|
871
|
+
*
|
|
872
|
+
* ```tsx
|
|
873
|
+
* const { data } = useSpoke({
|
|
874
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
875
|
+
* suspense: true,
|
|
876
|
+
* pause: true,
|
|
877
|
+
* });
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
declare function useSpoke(args: Pausable<UseSpokeArgs> & Suspendable): PausableSuspenseResult<Spoke | null>;
|
|
881
|
+
/**
|
|
882
|
+
* Fetch a specific spoke.
|
|
883
|
+
*
|
|
884
|
+
* ```tsx
|
|
885
|
+
* const { data, error, loading } = useSpoke({
|
|
886
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
887
|
+
* });
|
|
888
|
+
* // data will be Spoke | null
|
|
889
|
+
* ```
|
|
890
|
+
*/
|
|
891
|
+
declare function useSpoke(args: UseSpokeArgs): ReadResult<Spoke | null>;
|
|
892
|
+
/**
|
|
893
|
+
* Fetch a specific spoke.
|
|
894
|
+
*
|
|
895
|
+
* Pausable loading state mode.
|
|
896
|
+
*
|
|
897
|
+
* ```tsx
|
|
898
|
+
* const { data, error, loading, paused } = useSpoke({
|
|
899
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
900
|
+
* pause: true,
|
|
901
|
+
* });
|
|
902
|
+
* ```
|
|
903
|
+
*/
|
|
904
|
+
declare function useSpoke(args: Pausable<UseSpokeArgs>): PausableReadResult<Spoke | null>;
|
|
905
|
+
type UseSpokesArgs = SpokesRequest;
|
|
906
|
+
/**
|
|
907
|
+
* Fetch spokes based on specified criteria.
|
|
908
|
+
*
|
|
909
|
+
* This signature supports React Suspense:
|
|
910
|
+
*
|
|
911
|
+
* ```tsx
|
|
912
|
+
* const { data } = useSpokes({
|
|
913
|
+
* query: { chainIds: [chainId(1)] },
|
|
914
|
+
* suspense: true,
|
|
915
|
+
* });
|
|
916
|
+
* ```
|
|
917
|
+
*/
|
|
918
|
+
declare function useSpokes(args: UseSpokesArgs & Suspendable): SuspenseResult<Spoke[]>;
|
|
919
|
+
/**
|
|
920
|
+
* Fetch spokes based on specified criteria.
|
|
921
|
+
*
|
|
922
|
+
* Pausable suspense mode.
|
|
923
|
+
*
|
|
924
|
+
* ```tsx
|
|
925
|
+
* const { data } = useSpokes({
|
|
926
|
+
* query: { chainIds: [chainId(1)] },
|
|
927
|
+
* suspense: true,
|
|
928
|
+
* pause: true,
|
|
929
|
+
* });
|
|
930
|
+
* ```
|
|
931
|
+
*/
|
|
932
|
+
declare function useSpokes(args: Pausable<UseSpokesArgs> & Suspendable): PausableSuspenseResult<Spoke[]>;
|
|
933
|
+
/**
|
|
934
|
+
* Fetch spokes based on specified criteria.
|
|
935
|
+
*
|
|
936
|
+
* ```tsx
|
|
937
|
+
* const { data, error, loading } = useSpokes({
|
|
938
|
+
* query: { chainIds: [chainId(1)] },
|
|
939
|
+
* });
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
942
|
+
declare function useSpokes(args: UseSpokesArgs): ReadResult<Spoke[]>;
|
|
943
|
+
/**
|
|
944
|
+
* Fetch spokes based on specified criteria.
|
|
945
|
+
*
|
|
946
|
+
* Pausable loading state mode.
|
|
947
|
+
*
|
|
948
|
+
* ```tsx
|
|
949
|
+
* const { data, error, loading, paused } = useSpokes({
|
|
950
|
+
* query: { chainIds: [chainId(1)] },
|
|
951
|
+
* pause: true,
|
|
952
|
+
* });
|
|
953
|
+
* ```
|
|
954
|
+
*/
|
|
955
|
+
declare function useSpokes(args: Pausable<UseSpokesArgs>): PausableReadResult<Spoke[]>;
|
|
956
|
+
type UseSpokePositionManagersArgs = SpokePositionManagersRequest;
|
|
957
|
+
/**
|
|
958
|
+
* Fetches all the positions manager for a specific spoke.
|
|
959
|
+
*
|
|
960
|
+
* This signature supports React Suspense:
|
|
961
|
+
*
|
|
962
|
+
* ```tsx
|
|
963
|
+
* const { data } = useSpokePositionManagers({
|
|
964
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
965
|
+
* suspense: true,
|
|
966
|
+
* });
|
|
967
|
+
* ```
|
|
968
|
+
*/
|
|
969
|
+
declare function useSpokePositionManagers(args: UseSpokePositionManagersArgs & Suspendable): SuspenseResult<PaginatedSpokePositionManagerResult>;
|
|
970
|
+
/**
|
|
971
|
+
* Fetches all the positions manager for a specific spoke.
|
|
972
|
+
*
|
|
973
|
+
* Pausable suspense mode.
|
|
974
|
+
*
|
|
975
|
+
* ```tsx
|
|
976
|
+
* const { data } = useSpokePositionManagers({
|
|
977
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
978
|
+
* suspense: true,
|
|
979
|
+
* pause: true,
|
|
980
|
+
* });
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
declare function useSpokePositionManagers(args: Pausable<UseSpokePositionManagersArgs> & Suspendable): PausableSuspenseResult<PaginatedSpokePositionManagerResult>;
|
|
984
|
+
/**
|
|
985
|
+
* Fetches all the positions manager for a specific spoke.
|
|
986
|
+
*
|
|
987
|
+
* ```tsx
|
|
988
|
+
* const { data, error, loading } = useSpokePositionManagers({
|
|
989
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
990
|
+
* });
|
|
991
|
+
* ```
|
|
992
|
+
*/
|
|
993
|
+
declare function useSpokePositionManagers(args: UseSpokePositionManagersArgs): ReadResult<PaginatedSpokePositionManagerResult>;
|
|
994
|
+
/**
|
|
995
|
+
* Fetches all the positions manager for a specific spoke.
|
|
996
|
+
*
|
|
997
|
+
* Pausable loading state mode.
|
|
998
|
+
*
|
|
999
|
+
* ```tsx
|
|
1000
|
+
* const { data, error, loading, paused } = useSpokePositionManagers({
|
|
1001
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
1002
|
+
* pause: true,
|
|
1003
|
+
* });
|
|
1004
|
+
* ```
|
|
1005
|
+
*/
|
|
1006
|
+
declare function useSpokePositionManagers(args: Pausable<UseSpokePositionManagersArgs>): PausableReadResult<PaginatedSpokePositionManagerResult>;
|
|
1007
|
+
type UseSpokeUserPositionManagersArgs = SpokeUserPositionManagersRequest;
|
|
1008
|
+
/**
|
|
1009
|
+
* Fetches all the position managers of a user for a specific spoke
|
|
1010
|
+
*
|
|
1011
|
+
* This signature supports React Suspense:
|
|
1012
|
+
*
|
|
1013
|
+
* ```tsx
|
|
1014
|
+
* const { data } = useSpokeUserPositionManagers({
|
|
1015
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
1016
|
+
* user: evmAddress('0x123...'),
|
|
1017
|
+
* suspense: true,
|
|
1018
|
+
* });
|
|
1019
|
+
* ```
|
|
1020
|
+
*/
|
|
1021
|
+
declare function useSpokeUserPositionManagers(args: UseSpokeUserPositionManagersArgs & Suspendable): SuspenseResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Fetches all the position managers of a user for a specific spoke
|
|
1024
|
+
*
|
|
1025
|
+
* Pausable suspense mode.
|
|
1026
|
+
*
|
|
1027
|
+
* ```tsx
|
|
1028
|
+
* const { data } = useSpokeUserPositionManagers({
|
|
1029
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
1030
|
+
* user: evmAddress('0x123...'),
|
|
1031
|
+
* suspense: true,
|
|
1032
|
+
* pause: true,
|
|
1033
|
+
* });
|
|
1034
|
+
* ```
|
|
1035
|
+
*/
|
|
1036
|
+
declare function useSpokeUserPositionManagers(args: Pausable<UseSpokeUserPositionManagersArgs> & Suspendable): PausableSuspenseResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Fetches all the position managers of a user for a specific spoke
|
|
1039
|
+
*
|
|
1040
|
+
* ```tsx
|
|
1041
|
+
* const { data, error, loading } = useSpokeUserPositionManagers({
|
|
1042
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
1043
|
+
* user: evmAddress('0x123...'),
|
|
1044
|
+
* });
|
|
1045
|
+
* ```
|
|
1046
|
+
*/
|
|
1047
|
+
declare function useSpokeUserPositionManagers(args: UseSpokeUserPositionManagersArgs): ReadResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Fetches all the position managers of a user for a specific spoke
|
|
1050
|
+
*
|
|
1051
|
+
* Pausable loading state mode.
|
|
1052
|
+
*
|
|
1053
|
+
* ```tsx
|
|
1054
|
+
* const { data, error, loading, paused } = useSpokeUserPositionManagers({
|
|
1055
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
1056
|
+
* user: evmAddress('0x123...'),
|
|
1057
|
+
* pause: true,
|
|
1058
|
+
* });
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
declare function useSpokeUserPositionManagers(args: Pausable<UseSpokeUserPositionManagersArgs>): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1062
|
+
|
|
1063
|
+
type UseSwapQuoteArgs = Prettify<SwapQuoteRequest & CurrencyQueryOptions>;
|
|
1064
|
+
/**
|
|
1065
|
+
* @internal
|
|
1066
|
+
* Fetch a swap quote for the specified trade parameters.
|
|
1067
|
+
*
|
|
1068
|
+
* This signature supports React Suspense:
|
|
1069
|
+
*
|
|
1070
|
+
* ```tsx
|
|
1071
|
+
* const { data } = useSwapQuote({
|
|
1072
|
+
* chainId: chainId(1),
|
|
1073
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1074
|
+
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1075
|
+
* amount: bigDecimal('1000'),
|
|
1076
|
+
* kind: SwapKind.SELL,
|
|
1077
|
+
* suspense: true,
|
|
1078
|
+
* });
|
|
1079
|
+
* ```
|
|
1080
|
+
*/
|
|
1081
|
+
declare function useSwapQuote(args: UseSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1082
|
+
/**
|
|
1083
|
+
* @internal
|
|
1084
|
+
* Fetch a swap quote for the specified trade parameters.
|
|
1085
|
+
*
|
|
1086
|
+
* Pausable suspense mode.
|
|
1087
|
+
*
|
|
1088
|
+
* ```tsx
|
|
1089
|
+
* const { data } = useSwapQuote({
|
|
1090
|
+
* chainId: chainId(1),
|
|
1091
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1092
|
+
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1093
|
+
* amount: bigDecimal('1000'),
|
|
1094
|
+
* kind: SwapKind.SELL,
|
|
1095
|
+
* from: evmAddress('0x742d35cc...'),
|
|
1096
|
+
* suspense: true,
|
|
1097
|
+
* pause: true,
|
|
1098
|
+
* });
|
|
1099
|
+
* ```
|
|
1100
|
+
*/
|
|
1101
|
+
declare function useSwapQuote(args: Pausable<UseSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1102
|
+
/**
|
|
1103
|
+
* @internal
|
|
1104
|
+
* Fetch a swap quote for the specified trade parameters.
|
|
1105
|
+
*
|
|
1106
|
+
* ```tsx
|
|
1107
|
+
* const { data, error, loading } = useSwapQuote({
|
|
1108
|
+
* chainId: chainId(1),
|
|
1109
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1110
|
+
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1111
|
+
* amount: bigDecimal('1000'),
|
|
1112
|
+
* kind: SwapKind.SELL,
|
|
1113
|
+
* });
|
|
1114
|
+
* ```
|
|
1115
|
+
*/
|
|
1116
|
+
declare function useSwapQuote(args: UseSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1117
|
+
/**
|
|
1118
|
+
* @internal
|
|
1119
|
+
* Fetch a swap quote for the specified trade parameters.
|
|
1120
|
+
*
|
|
1121
|
+
* Pausable loading state mode.
|
|
1122
|
+
*
|
|
1123
|
+
* ```tsx
|
|
1124
|
+
* const { data, error, loading, paused } = useSwapQuote({
|
|
1125
|
+
* chainId: chainId(1),
|
|
1126
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1127
|
+
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1128
|
+
* amount: bigDecimal('1000'),
|
|
1129
|
+
* kind: SwapKind.SELL,
|
|
1130
|
+
* from: evmAddress('0x742d35cc...'),
|
|
1131
|
+
* pause: true,
|
|
1132
|
+
* });
|
|
1133
|
+
* ```
|
|
1134
|
+
*/
|
|
1135
|
+
declare function useSwapQuote(args: Pausable<UseSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1136
|
+
/**
|
|
1137
|
+
* @internal
|
|
1138
|
+
* Low-level hook to execute a swap quote action directly.
|
|
1139
|
+
*
|
|
1140
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
1141
|
+
* @remarks
|
|
1142
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1143
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow
|
|
1144
|
+
* (e.g., in an event handler to get a fresh quote before executing a swap).
|
|
1145
|
+
*
|
|
1146
|
+
* ```ts
|
|
1147
|
+
* const [getQuote, { called, data, error, loading }] = useSwapQuoteAction();
|
|
1148
|
+
*
|
|
1149
|
+
* // …
|
|
1150
|
+
*
|
|
1151
|
+
* const result = await getQuote({
|
|
1152
|
+
* chainId: chainId(1),
|
|
1153
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1154
|
+
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1155
|
+
* amount: bigDecimal('1000'),
|
|
1156
|
+
* kind: SwapKind.SELL,
|
|
1157
|
+
* });
|
|
1158
|
+
*
|
|
1159
|
+
* if (result.isOk()) {
|
|
1160
|
+
* console.log('Swap quote:', result.value);
|
|
1161
|
+
* } else {
|
|
1162
|
+
* console.error(result.error);
|
|
1163
|
+
* }
|
|
1164
|
+
* ```
|
|
1165
|
+
*/
|
|
1166
|
+
declare function useSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<SwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1167
|
+
type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
1168
|
+
/**
|
|
1169
|
+
* @internal
|
|
1170
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1171
|
+
*
|
|
1172
|
+
* This signature supports React Suspense:
|
|
1173
|
+
*
|
|
1174
|
+
* ```tsx
|
|
1175
|
+
* const { data } = useSwappableTokens({
|
|
1176
|
+
* query: { chainIds: [chainId(1)] },
|
|
1177
|
+
* suspense: true,
|
|
1178
|
+
* });
|
|
1179
|
+
* ```
|
|
1180
|
+
*/
|
|
1181
|
+
declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable): SuspenseResult<Token[]>;
|
|
1182
|
+
/**
|
|
1183
|
+
* @internal
|
|
1184
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1185
|
+
*
|
|
1186
|
+
* Pausable suspense mode.
|
|
1187
|
+
*
|
|
1188
|
+
* ```tsx
|
|
1189
|
+
* const { data } = useSwappableTokens({
|
|
1190
|
+
* query: { chainIds: [chainId(1)] },
|
|
1191
|
+
* suspense: true,
|
|
1192
|
+
* pause: true,
|
|
1193
|
+
* });
|
|
1194
|
+
* ```
|
|
1195
|
+
*/
|
|
1196
|
+
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Suspendable): PausableSuspenseResult<Token[]>;
|
|
1197
|
+
/**
|
|
1198
|
+
* @internal
|
|
1199
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1200
|
+
*
|
|
1201
|
+
* ```tsx
|
|
1202
|
+
* const { data, error, loading } = useSwappableTokens({
|
|
1203
|
+
* query: { chainIds: [chainId(1)] },
|
|
1204
|
+
* });
|
|
1205
|
+
* ```
|
|
1206
|
+
*/
|
|
1207
|
+
declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<Token[]>;
|
|
1208
|
+
/**
|
|
1209
|
+
* @internal
|
|
1210
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1211
|
+
*
|
|
1212
|
+
* Pausable loading state mode.
|
|
1213
|
+
*
|
|
1214
|
+
* ```tsx
|
|
1215
|
+
* const { data, error, loading, paused } = useSwappableTokens({
|
|
1216
|
+
* query: { chainIds: [chainId(1)] },
|
|
1217
|
+
* pause: true,
|
|
1218
|
+
* });
|
|
1219
|
+
* ```
|
|
1220
|
+
*/
|
|
1221
|
+
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs>): PausableReadResult<Token[]>;
|
|
1222
|
+
type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
1223
|
+
/**
|
|
1224
|
+
* @internal
|
|
1225
|
+
* Fetch the user's swap history for a specific chain.
|
|
1226
|
+
*
|
|
1227
|
+
* This signature supports React Suspense:
|
|
1228
|
+
*
|
|
1229
|
+
* ```tsx
|
|
1230
|
+
* const { data } = useUserSwaps({
|
|
1231
|
+
* chainId: chainId(1),
|
|
1232
|
+
* user: evmAddress('0x742d35cc...'),
|
|
1233
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1234
|
+
* suspense: true,
|
|
1235
|
+
* });
|
|
1236
|
+
* ```
|
|
1237
|
+
*/
|
|
1238
|
+
declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseResult<PaginatedUserSwapsResult>;
|
|
1239
|
+
/**
|
|
1240
|
+
* @internal
|
|
1241
|
+
* Fetch the user's swap history for a specific chain.
|
|
1242
|
+
*
|
|
1243
|
+
* Pausable suspense mode.
|
|
1244
|
+
*
|
|
1245
|
+
* ```tsx
|
|
1246
|
+
* const { data } = useUserSwaps({
|
|
1247
|
+
* chainId: chainId(1),
|
|
1248
|
+
* user: evmAddress('0x742d35cc...'),
|
|
1249
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1250
|
+
* suspense: true,
|
|
1251
|
+
* pause: true,
|
|
1252
|
+
* });
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs> & Suspendable): PausableSuspenseResult<PaginatedUserSwapsResult>;
|
|
1256
|
+
/**
|
|
1257
|
+
* @internal
|
|
1258
|
+
* Fetch the user's swap history for a specific chain.
|
|
1259
|
+
*
|
|
1260
|
+
* ```tsx
|
|
1261
|
+
* const { data, error, loading } = useUserSwaps({
|
|
1262
|
+
* chainId: chainId(1),
|
|
1263
|
+
* user: evmAddress('0x742d35cc...'),
|
|
1264
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1265
|
+
* });
|
|
1266
|
+
* ```
|
|
1267
|
+
*/
|
|
1268
|
+
declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserSwapsResult>;
|
|
1269
|
+
/**
|
|
1270
|
+
* @internal
|
|
1271
|
+
* Fetch the user's swap history for a specific chain.
|
|
1272
|
+
*
|
|
1273
|
+
* Pausable loading state mode.
|
|
1274
|
+
*
|
|
1275
|
+
* ```tsx
|
|
1276
|
+
* const { data, error, loading, paused } = useUserSwaps({
|
|
1277
|
+
* chainId: chainId(1),
|
|
1278
|
+
* user: evmAddress('0x742d35cc...'),
|
|
1279
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1280
|
+
* pause: true,
|
|
1281
|
+
* });
|
|
1282
|
+
* ```
|
|
1283
|
+
*/
|
|
1284
|
+
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
|
|
1285
|
+
type UseSwapTokensRequest = Prettify<PrepareSwapRequest & CurrencyQueryOptions>;
|
|
1286
|
+
type SwapIntent = SwapByIntentTypedData | SwapByIntentWithApprovalRequired | SwapTransactionRequest | SwapApprovalRequired;
|
|
1287
|
+
type SwapHandlerOptions = {
|
|
1288
|
+
cancel: CancelOperation;
|
|
1289
|
+
};
|
|
1290
|
+
type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAsync<ERC20PermitSignature | SwapReceipt, SendTransactionError | PendingTransactionError>;
|
|
1291
|
+
/**
|
|
1292
|
+
* @internal
|
|
1293
|
+
* Orchestrate the swap execution plan.
|
|
1294
|
+
*
|
|
1295
|
+
* ```tsx
|
|
1296
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
1297
|
+
* const [signSwapByIntentWith, signing] = useSignSwapByIntentWith(wallet);
|
|
1298
|
+
*
|
|
1299
|
+
* const [swap, swapping] = useSwapTokens((plan) => {
|
|
1300
|
+
* switch (plan.__typename) {
|
|
1301
|
+
* case 'SwapByIntentTypedData':
|
|
1302
|
+
* return signSwapByIntentWith(plan);
|
|
1303
|
+
*
|
|
1304
|
+
* case 'SwapApprovalRequired':
|
|
1305
|
+
* case 'SwapByIntentWithApprovalRequired':
|
|
1306
|
+
* return sendTransaction(plan.transaction);
|
|
1307
|
+
*
|
|
1308
|
+
* case 'SwapTransactionRequest':
|
|
1309
|
+
* return sendTransaction(plan.transaction);
|
|
1310
|
+
* }
|
|
1311
|
+
* });
|
|
1312
|
+
*
|
|
1313
|
+
* const result = await swap({
|
|
1314
|
+
* market: {
|
|
1315
|
+
* chainId: chainId(1),
|
|
1316
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1317
|
+
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1318
|
+
* amount: bigDecimal('1000'),
|
|
1319
|
+
* kind: SwapKind.SELL,
|
|
1320
|
+
* user: evmAddress('0x742d35cc...'),
|
|
1321
|
+
* },
|
|
1322
|
+
* });
|
|
1323
|
+
*
|
|
1324
|
+
* if (result.isErr()) {
|
|
1325
|
+
* console.error(result.error);
|
|
1326
|
+
* return;
|
|
1327
|
+
* }
|
|
1328
|
+
*
|
|
1329
|
+
* // result.value: SwapReceipt
|
|
1330
|
+
* ```
|
|
1331
|
+
*/
|
|
1332
|
+
declare function useSwapTokens(handler: SwapHandler): UseAsyncTask<PrepareSwapRequest, SwapReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1333
|
+
type CancelSwapHandler = (data: CancelSwapTypedData | TransactionRequest) => ResultAsync<ERC20PermitSignature | PendingTransaction, SigningError | UnexpectedError$1>;
|
|
1334
|
+
declare class CannotCancelSwapError extends ResultAwareError {
|
|
1335
|
+
name: "CannotCancelSwapError";
|
|
1336
|
+
}
|
|
1337
|
+
type CancelSwapError = CancelError | CannotCancelSwapError | SigningError | TimeoutError | TransactionError | UnexpectedError$1;
|
|
1338
|
+
/**
|
|
1339
|
+
* @internal
|
|
1340
|
+
* Executes the complete swap cancellation workflow combining preparation and execution.
|
|
1341
|
+
*
|
|
1342
|
+
* ```tsx
|
|
1343
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1344
|
+
* const [signSwapCancelWith] = useSignSwapCancelWith(wallet);
|
|
1345
|
+
*
|
|
1346
|
+
* const [cancelSwap, {loading, error}] = useCancelSwap((plan: CancelSwapTypedData | TransactionRequest) => {
|
|
1347
|
+
* switch (plan.__typename) {
|
|
1348
|
+
* case 'TransactionRequest':
|
|
1349
|
+
* return sendTransaction(plan);
|
|
1350
|
+
*
|
|
1351
|
+
* case 'CancelSwapTypedData':
|
|
1352
|
+
* return signSwapCancelWith(plan);
|
|
1353
|
+
* }
|
|
1354
|
+
* });
|
|
1355
|
+
*
|
|
1356
|
+
* const result = await cancelSwap({
|
|
1357
|
+
* id: swapId('123...'),
|
|
1358
|
+
* });
|
|
1359
|
+
*
|
|
1360
|
+
* if (result.isErr()) {
|
|
1361
|
+
* console.error(result.error);
|
|
1362
|
+
* return;
|
|
1363
|
+
* }
|
|
1364
|
+
*
|
|
1365
|
+
* // result.value: SwapCancelled
|
|
1366
|
+
* console.log('Swap cancelled:', result.value);
|
|
1367
|
+
* ```
|
|
1368
|
+
*/
|
|
1369
|
+
declare function useCancelSwap(handler: CancelSwapHandler): UseAsyncTask<PrepareSwapCancelRequest, SwapCancelled, CancelSwapError>;
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* A hook that provides a way to supply assets to an Aave reserve.
|
|
1373
|
+
*
|
|
1374
|
+
* ```ts
|
|
1375
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1376
|
+
* const [supply, { loading, error }] = useSupply((plan, { cancel }) => {
|
|
1377
|
+
* switch (plan.__typename) {
|
|
1378
|
+
* case 'TransactionRequest':
|
|
1379
|
+
* return sendTransaction(plan);
|
|
1380
|
+
* case 'Erc20ApprovalRequired':
|
|
1381
|
+
* case 'PreContractActionRequired':
|
|
1382
|
+
* return sendTransaction(plan.transaction);
|
|
1383
|
+
* }
|
|
1384
|
+
* });
|
|
1385
|
+
*
|
|
1386
|
+
* // …
|
|
1387
|
+
*
|
|
1388
|
+
* const result = await supply({ ... });
|
|
1389
|
+
*
|
|
1390
|
+
* if (result.isErr()) {
|
|
1391
|
+
* switch (result.error.name) {
|
|
1392
|
+
* case 'CancelError':
|
|
1393
|
+
* // The user cancelled the operation
|
|
1394
|
+
* return;
|
|
1395
|
+
*
|
|
1396
|
+
* case 'SigningError':
|
|
1397
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1398
|
+
* break;
|
|
1399
|
+
*
|
|
1400
|
+
* case 'TimeoutError':
|
|
1401
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1402
|
+
* break;
|
|
1403
|
+
*
|
|
1404
|
+
* case 'TransactionError':
|
|
1405
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1406
|
+
* break;
|
|
1407
|
+
*
|
|
1408
|
+
* case 'ValidationError':
|
|
1409
|
+
* console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
|
|
1410
|
+
* break;
|
|
1411
|
+
*
|
|
1412
|
+
* case 'UnexpectedError':
|
|
1413
|
+
* console.error(result.error.message);
|
|
1414
|
+
* break;
|
|
1415
|
+
* }
|
|
1416
|
+
* return;
|
|
1417
|
+
* }
|
|
1418
|
+
*
|
|
1419
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1420
|
+
* ```
|
|
1421
|
+
*
|
|
1422
|
+
* @param handler - The handler that will be used to handle the transactions.
|
|
1423
|
+
*/
|
|
1424
|
+
declare function useSupply(handler: TransactionHandler): UseAsyncTask<SupplyRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError$1<InsufficientBalanceError>>;
|
|
1425
|
+
/**
|
|
1426
|
+
* A hook that provides a way to borrow assets from an Aave reserve.
|
|
1427
|
+
*
|
|
1428
|
+
* ```ts
|
|
1429
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1430
|
+
* const [borrow, { loading, error }] = useBorrow((plan, { cancel }) => {
|
|
1431
|
+
* switch (plan.__typename) {
|
|
1432
|
+
* case 'TransactionRequest':
|
|
1433
|
+
* return sendTransaction(plan);
|
|
1434
|
+
* case 'Erc20ApprovalRequired':
|
|
1435
|
+
* case 'PreContractActionRequired':
|
|
1436
|
+
* return sendTransaction(plan.transaction);
|
|
1437
|
+
* }
|
|
1438
|
+
* });
|
|
1439
|
+
*
|
|
1440
|
+
* // …
|
|
1441
|
+
*
|
|
1442
|
+
* const result = await borrow({ ... });
|
|
1443
|
+
*
|
|
1444
|
+
* if (result.isErr()) {
|
|
1445
|
+
* switch (result.error.name) {
|
|
1446
|
+
* case 'CancelError':
|
|
1447
|
+
* // The user cancelled the operation
|
|
1448
|
+
* return;
|
|
1449
|
+
*
|
|
1450
|
+
* case 'SigningError':
|
|
1451
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1452
|
+
* break;
|
|
1453
|
+
*
|
|
1454
|
+
* case 'TimeoutError':
|
|
1455
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1456
|
+
* break;
|
|
1457
|
+
*
|
|
1458
|
+
* case 'TransactionError':
|
|
1459
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1460
|
+
* break;
|
|
1461
|
+
*
|
|
1462
|
+
* case 'ValidationError':
|
|
1463
|
+
* console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
|
|
1464
|
+
* break;
|
|
1465
|
+
*
|
|
1466
|
+
* case 'UnexpectedError':
|
|
1467
|
+
* console.error(result.error.message);
|
|
1468
|
+
* break;
|
|
1469
|
+
* }
|
|
1470
|
+
* return;
|
|
1471
|
+
* }
|
|
1472
|
+
*
|
|
1473
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1474
|
+
* ```
|
|
1475
|
+
*
|
|
1476
|
+
* @param handler - The handler that will be used to handle the transactions.
|
|
1477
|
+
*/
|
|
1478
|
+
declare function useBorrow(handler: TransactionHandler): UseAsyncTask<BorrowRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError$1<InsufficientBalanceError>>;
|
|
1479
|
+
/**
|
|
1480
|
+
* A hook that provides a way to repay borrowed assets to an Aave reserve.
|
|
1481
|
+
*
|
|
1482
|
+
* ```ts
|
|
1483
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1484
|
+
* const [repay, { loading, error }] = useRepay((plan, { cancel }) => {
|
|
1485
|
+
* switch (plan.__typename) {
|
|
1486
|
+
* case 'TransactionRequest':
|
|
1487
|
+
* return sendTransaction(plan);
|
|
1488
|
+
* case 'Erc20ApprovalRequired':
|
|
1489
|
+
* case 'PreContractActionRequired':
|
|
1490
|
+
* return sendTransaction(plan.transaction);
|
|
1491
|
+
* }
|
|
1492
|
+
* });
|
|
1493
|
+
*
|
|
1494
|
+
* // …
|
|
1495
|
+
*
|
|
1496
|
+
* const result = await repay({ ... });
|
|
1497
|
+
*
|
|
1498
|
+
* if (result.isErr()) {
|
|
1499
|
+
* switch (result.error.name) {
|
|
1500
|
+
* case 'CancelError':
|
|
1501
|
+
* // The user cancelled the operation
|
|
1502
|
+
* return;
|
|
1503
|
+
*
|
|
1504
|
+
* case 'SigningError':
|
|
1505
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1506
|
+
* break;
|
|
1507
|
+
*
|
|
1508
|
+
* case 'TimeoutError':
|
|
1509
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1510
|
+
* break;
|
|
1511
|
+
*
|
|
1512
|
+
* case 'TransactionError':
|
|
1513
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1514
|
+
* break;
|
|
1515
|
+
*
|
|
1516
|
+
* case 'ValidationError':
|
|
1517
|
+
* console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
|
|
1518
|
+
* break;
|
|
1519
|
+
*
|
|
1520
|
+
* case 'UnexpectedError':
|
|
1521
|
+
* console.error(result.error.message);
|
|
1522
|
+
* break;
|
|
1523
|
+
* }
|
|
1524
|
+
* return;
|
|
1525
|
+
* }
|
|
1526
|
+
*
|
|
1527
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1528
|
+
* ```
|
|
1529
|
+
*
|
|
1530
|
+
* @param handler - The handler that will be used to handle the transactions.
|
|
1531
|
+
*/
|
|
1532
|
+
declare function useRepay(handler: TransactionHandler): UseAsyncTask<RepayRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError$1<InsufficientBalanceError>>;
|
|
1533
|
+
/**
|
|
1534
|
+
* A hook that provides a way to withdraw supplied assets from an Aave reserve.
|
|
1535
|
+
*
|
|
1536
|
+
* ```ts
|
|
1537
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1538
|
+
* const [withdraw, { loading, error }] = useWithdraw((plan, { cancel }) => {
|
|
1539
|
+
* switch (plan.__typename) {
|
|
1540
|
+
* case 'TransactionRequest':
|
|
1541
|
+
* return sendTransaction(plan);
|
|
1542
|
+
* case 'Erc20ApprovalRequired':
|
|
1543
|
+
* case 'PreContractActionRequired':
|
|
1544
|
+
* return sendTransaction(plan.transaction);
|
|
1545
|
+
* }
|
|
1546
|
+
* });
|
|
1547
|
+
*
|
|
1548
|
+
* // …
|
|
1549
|
+
*
|
|
1550
|
+
* const result = await withdraw({ ... });
|
|
1551
|
+
*
|
|
1552
|
+
* if (result.isErr()) {
|
|
1553
|
+
* switch (result.error.name) {
|
|
1554
|
+
* case 'CancelError':
|
|
1555
|
+
* // The user cancelled the operation
|
|
1556
|
+
* return;
|
|
1557
|
+
*
|
|
1558
|
+
* case 'SigningError':
|
|
1559
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1560
|
+
* break;
|
|
1561
|
+
*
|
|
1562
|
+
* case 'TimeoutError':
|
|
1563
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1564
|
+
* break;
|
|
1565
|
+
*
|
|
1566
|
+
* case 'TransactionError':
|
|
1567
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1568
|
+
* break;
|
|
1569
|
+
*
|
|
1570
|
+
* case 'ValidationError':
|
|
1571
|
+
* console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
|
|
1572
|
+
* break;
|
|
1573
|
+
*
|
|
1574
|
+
* case 'UnexpectedError':
|
|
1575
|
+
* console.error(result.error.message);
|
|
1576
|
+
* break;
|
|
1577
|
+
* }
|
|
1578
|
+
* return;
|
|
1579
|
+
* }
|
|
1580
|
+
*
|
|
1581
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1582
|
+
* ```
|
|
1583
|
+
*
|
|
1584
|
+
* @param handler - The handler that will be used to handle the transactions.
|
|
1585
|
+
*/
|
|
1586
|
+
declare function useWithdraw(handler: TransactionHandler): UseAsyncTask<WithdrawRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError$1<InsufficientBalanceError>>;
|
|
1587
|
+
/**
|
|
1588
|
+
* A hook that provides a way to renounce a position manager of a user for a specific spoke.
|
|
1589
|
+
*
|
|
1590
|
+
* ```ts
|
|
1591
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1592
|
+
* const [renounceSpokeUserPositionManager, { loading, error }] = useRenounceSpokeUserPositionManager(sendTransaction);
|
|
1593
|
+
*
|
|
1594
|
+
* // …
|
|
1595
|
+
*
|
|
1596
|
+
* const result = await renounceSpokeUserPositionManager({ ... });
|
|
1597
|
+
*
|
|
1598
|
+
* if (result.isErr()) {
|
|
1599
|
+
* switch (result.error.name) {
|
|
1600
|
+
* case 'CancelError':
|
|
1601
|
+
* // The user cancelled the operation
|
|
1602
|
+
* return;
|
|
1603
|
+
*
|
|
1604
|
+
* case 'SigningError':
|
|
1605
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1606
|
+
* break;
|
|
1607
|
+
*
|
|
1608
|
+
* case 'TimeoutError':
|
|
1609
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1610
|
+
* break;
|
|
1611
|
+
*
|
|
1612
|
+
* case 'TransactionError':
|
|
1613
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1614
|
+
* break;
|
|
1615
|
+
*
|
|
1616
|
+
* case 'UnexpectedError':
|
|
1617
|
+
* console.error(result.error.message);
|
|
1618
|
+
* break;
|
|
1619
|
+
* }
|
|
1620
|
+
* return;
|
|
1621
|
+
* }
|
|
1622
|
+
*
|
|
1623
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1624
|
+
* ```
|
|
1625
|
+
*
|
|
1626
|
+
* @param handler - The handler that will be used to handle the transaction.
|
|
1627
|
+
*/
|
|
1628
|
+
declare function useRenounceSpokeUserPositionManager(handler: TransactionHandler): UseAsyncTask<RenounceSpokeUserPositionManagerRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1629
|
+
/**
|
|
1630
|
+
* A hook that provides a way to update the user risk premium for a spoke.
|
|
1631
|
+
*
|
|
1632
|
+
* ```ts
|
|
1633
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1634
|
+
* const [updateUserRiskPremium, { loading, error }] = useUpdateUserRiskPremium((transaction, { cancel }) => {
|
|
1635
|
+
* return sendTransaction(transaction);
|
|
1636
|
+
* });
|
|
1637
|
+
*
|
|
1638
|
+
* // …
|
|
1639
|
+
*
|
|
1640
|
+
* const result = await updateUserRiskPremium({ ... });
|
|
1641
|
+
*
|
|
1642
|
+
* if (result.isErr()) {
|
|
1643
|
+
* switch (result.error.name) {
|
|
1644
|
+
* case 'CancelError':
|
|
1645
|
+
* // The user cancelled the operation
|
|
1646
|
+
* return;
|
|
1647
|
+
*
|
|
1648
|
+
* case 'SigningError':
|
|
1649
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1650
|
+
* break;
|
|
1651
|
+
*
|
|
1652
|
+
* case 'TimeoutError':
|
|
1653
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1654
|
+
* break;
|
|
1655
|
+
*
|
|
1656
|
+
* case 'TransactionError':
|
|
1657
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1658
|
+
* break;
|
|
1659
|
+
*
|
|
1660
|
+
* case 'UnexpectedError':
|
|
1661
|
+
* console.error(result.error.message);
|
|
1662
|
+
* break;
|
|
1663
|
+
* }
|
|
1664
|
+
* return;
|
|
1665
|
+
* }
|
|
1666
|
+
*
|
|
1667
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1668
|
+
* ```
|
|
1669
|
+
*
|
|
1670
|
+
* @param handler - The handler that will be used to handle the transaction.
|
|
1671
|
+
*/
|
|
1672
|
+
declare function useUpdateUserRiskPremium(handler: TransactionHandler): UseAsyncTask<UpdateUserRiskPremiumRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1673
|
+
/**
|
|
1674
|
+
* A hook that provides a way to update the user dynamic configuration for a spoke.
|
|
1675
|
+
*
|
|
1676
|
+
* ```ts
|
|
1677
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1678
|
+
* const [updateUserDynamicConfig, { loading, error }] = useUpdateUserDynamicConfig((transaction, { cancel }) => {
|
|
1679
|
+
* return sendTransaction(transaction);
|
|
1680
|
+
* });
|
|
1681
|
+
*
|
|
1682
|
+
* // …
|
|
1683
|
+
*
|
|
1684
|
+
* const result = await updateUserDynamicConfig({ ... });
|
|
1685
|
+
*
|
|
1686
|
+
* if (result.isErr()) {
|
|
1687
|
+
* switch (result.error.name) {
|
|
1688
|
+
* case 'CancelError':
|
|
1689
|
+
* // The user cancelled the operation
|
|
1690
|
+
* return;
|
|
1691
|
+
*
|
|
1692
|
+
* case 'SigningError':
|
|
1693
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1694
|
+
* break;
|
|
1695
|
+
*
|
|
1696
|
+
* case 'TimeoutError':
|
|
1697
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1698
|
+
* break;
|
|
1699
|
+
*
|
|
1700
|
+
* case 'TransactionError':
|
|
1701
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1702
|
+
* break;
|
|
1703
|
+
*
|
|
1704
|
+
* case 'UnexpectedError':
|
|
1705
|
+
* console.error(result.error.message);
|
|
1706
|
+
* break;
|
|
1707
|
+
* }
|
|
1708
|
+
* return;
|
|
1709
|
+
* }
|
|
1710
|
+
*
|
|
1711
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1712
|
+
* ```
|
|
1713
|
+
*
|
|
1714
|
+
* @param handler - The handler that will be used to handle the transaction.
|
|
1715
|
+
*/
|
|
1716
|
+
declare function useUpdateUserDynamicConfig(handler: TransactionHandler): UseAsyncTask<UpdateUserDynamicConfigRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1717
|
+
/**
|
|
1718
|
+
* Hook for setting whether a user's supply should be used as collateral.
|
|
1719
|
+
*
|
|
1720
|
+
* ```ts
|
|
1721
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1722
|
+
* const [setUserSupplyAsCollateral, { loading, error }] = useSetUserSupplyAsCollateral((transaction, { cancel }) => {
|
|
1723
|
+
* return sendTransaction(transaction);
|
|
1724
|
+
* });
|
|
1725
|
+
*
|
|
1726
|
+
* const result = await setUserSupplyAsCollateral({
|
|
1727
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
1728
|
+
* sender: evmAddress('0x456...'),
|
|
1729
|
+
* enableCollateral: true,
|
|
1730
|
+
* });
|
|
1731
|
+
*
|
|
1732
|
+
* if (result.isErr()) {
|
|
1733
|
+
* switch (result.error.name) {
|
|
1734
|
+
* case 'CancelError':
|
|
1735
|
+
* // The user cancelled the operation
|
|
1736
|
+
* return;
|
|
1737
|
+
*
|
|
1738
|
+
* case 'SigningError':
|
|
1739
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1740
|
+
* break;
|
|
1741
|
+
*
|
|
1742
|
+
* case 'TimeoutError':
|
|
1743
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1744
|
+
* break;
|
|
1745
|
+
*
|
|
1746
|
+
* case 'TransactionError':
|
|
1747
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1748
|
+
* break;
|
|
1749
|
+
*
|
|
1750
|
+
* case 'UnexpectedError':
|
|
1751
|
+
* console.error(result.error.message);
|
|
1752
|
+
* break;
|
|
1753
|
+
* }
|
|
1754
|
+
* return;
|
|
1755
|
+
* }
|
|
1756
|
+
*
|
|
1757
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1758
|
+
* ```
|
|
1759
|
+
*
|
|
1760
|
+
* @param handler - The handler that will be used to handle the transaction.
|
|
1761
|
+
*/
|
|
1762
|
+
declare function useSetUserSupplyAsCollateral(handler: TransactionHandler): UseAsyncTask<SetUserSupplyAsCollateralRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1763
|
+
/**
|
|
1764
|
+
* A hook that provides a way to liquidate a user's position.
|
|
1765
|
+
*
|
|
1766
|
+
* ```ts
|
|
1767
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1768
|
+
* const [liquidatePosition, { loading, error }] = useLiquidatePosition((plan, { cancel }) => {
|
|
1769
|
+
* switch (plan.__typename) {
|
|
1770
|
+
* case 'TransactionRequest':
|
|
1771
|
+
* return sendTransaction(plan);
|
|
1772
|
+
* case 'Erc20ApprovalRequired':
|
|
1773
|
+
* case 'PreContractActionRequired':
|
|
1774
|
+
* return sendTransaction(plan.transaction);
|
|
1775
|
+
* }
|
|
1776
|
+
* });
|
|
1777
|
+
*
|
|
1778
|
+
* // …
|
|
1779
|
+
*
|
|
1780
|
+
* const result = await liquidatePosition({
|
|
1781
|
+
* collateral: reserveId('SGVsbG8h'),
|
|
1782
|
+
* debt: reserveId('Q2lhbyE= '),
|
|
1783
|
+
* amount: amount,
|
|
1784
|
+
* liquidator: liquidator,
|
|
1785
|
+
* borrower: borrower,
|
|
1786
|
+
* });
|
|
1787
|
+
*
|
|
1788
|
+
* if (result.isErr()) {
|
|
1789
|
+
* switch (result.error.name) {
|
|
1790
|
+
* case 'CancelError':
|
|
1791
|
+
* // The user cancelled the operation
|
|
1792
|
+
* return;
|
|
1793
|
+
*
|
|
1794
|
+
* case 'SigningError':
|
|
1795
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1796
|
+
* break;
|
|
1797
|
+
*
|
|
1798
|
+
* case 'TimeoutError':
|
|
1799
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1800
|
+
* break;
|
|
1801
|
+
*
|
|
1802
|
+
* case 'TransactionError':
|
|
1803
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1804
|
+
* break;
|
|
1805
|
+
*
|
|
1806
|
+
* case 'ValidationError':
|
|
1807
|
+
* console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
|
|
1808
|
+
* break;
|
|
1809
|
+
*
|
|
1810
|
+
* case 'UnexpectedError':
|
|
1811
|
+
* console.error(result.error.message);
|
|
1812
|
+
* break;
|
|
1813
|
+
* }
|
|
1814
|
+
* return;
|
|
1815
|
+
* }
|
|
1816
|
+
*
|
|
1817
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1818
|
+
* ```
|
|
1819
|
+
*
|
|
1820
|
+
* @param handler - The handler that will be used to handle the transactions.
|
|
1821
|
+
*/
|
|
1822
|
+
declare function useLiquidatePosition(handler: TransactionHandler): UseAsyncTask<LiquidatePositionRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError$1<InsufficientBalanceError>>;
|
|
1823
|
+
/**
|
|
1824
|
+
* A hook that provides a way to set or remove a position manager for a user on a specific spoke.
|
|
1825
|
+
*
|
|
1826
|
+
* **Position managers** can perform transactions on behalf of other users, including:
|
|
1827
|
+
* - Supply assets
|
|
1828
|
+
* - Borrow assets
|
|
1829
|
+
* - Withdraw assets
|
|
1830
|
+
* - Enable/disable collateral
|
|
1831
|
+
*
|
|
1832
|
+
* The `signature` parameter is an **ERC712 signature** that must be signed by the **user**
|
|
1833
|
+
* (the account granting permissions) to authorize the position manager. The signature contains:
|
|
1834
|
+
* - `value`: The actual cryptographic signature
|
|
1835
|
+
* - `deadline`: Unix timestamp when the authorization expires
|
|
1836
|
+
*
|
|
1837
|
+
* ```ts
|
|
1838
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1839
|
+
* const [setSpokeUserPositionManager, { loading, error }] = useSetSpokeUserPositionManager((transaction, { cancel }) => {
|
|
1840
|
+
* return sendTransaction(transaction);
|
|
1841
|
+
* });
|
|
1842
|
+
*
|
|
1843
|
+
* const result = await setSpokeUserPositionManager({
|
|
1844
|
+
* spoke: spokeId('SGVsbG8h'),
|
|
1845
|
+
* manager: evmAddress('0x9abc…'), // Address that will become the position manager
|
|
1846
|
+
* approve: true, // true to approve, false to remove the manager
|
|
1847
|
+
* user: evmAddress('0xdef0…'), // User granting the permission (must sign the signature)
|
|
1848
|
+
* signature: {
|
|
1849
|
+
* value: '0x1234...', // ERC712 signature signed by the user
|
|
1850
|
+
* deadline: 1735689600, // Unix timestamp when signature expires
|
|
1851
|
+
* },
|
|
1852
|
+
* });
|
|
1853
|
+
*
|
|
1854
|
+
* if (result.isErr()) {
|
|
1855
|
+
* switch (result.error.name) {
|
|
1856
|
+
* case 'CancelError':
|
|
1857
|
+
* // The user cancelled the operation
|
|
1858
|
+
* return;
|
|
1859
|
+
*
|
|
1860
|
+
* case 'SigningError':
|
|
1861
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
1862
|
+
* break;
|
|
1863
|
+
*
|
|
1864
|
+
* case 'TimeoutError':
|
|
1865
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
1866
|
+
* break;
|
|
1867
|
+
*
|
|
1868
|
+
* case 'TransactionError':
|
|
1869
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
1870
|
+
* break;
|
|
1871
|
+
*
|
|
1872
|
+
* case 'UnexpectedError':
|
|
1873
|
+
* console.error(result.error.message);
|
|
1874
|
+
* break;
|
|
1875
|
+
* }
|
|
1876
|
+
* return;
|
|
1877
|
+
* }
|
|
1878
|
+
*
|
|
1879
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
1880
|
+
* ```
|
|
1881
|
+
*
|
|
1882
|
+
* @param handler - The handler that will be used to handle the transaction.
|
|
1883
|
+
*/
|
|
1884
|
+
declare function useSetSpokeUserPositionManager(handler: TransactionHandler): UseAsyncTask<SetSpokeUserPositionManagerRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1885
|
+
/**
|
|
1886
|
+
* Preview the impact of a potential action on a user's position.
|
|
1887
|
+
*
|
|
1888
|
+
* ```tsx
|
|
1889
|
+
* const [getPreview, previewing] = usePreviewAction();
|
|
1890
|
+
*
|
|
1891
|
+
* const loading = previewing.loading;
|
|
1892
|
+
* const error = previewing.error;
|
|
1893
|
+
*
|
|
1894
|
+
* // …
|
|
1895
|
+
*
|
|
1896
|
+
* const result = await getPreview({
|
|
1897
|
+
* action: {
|
|
1898
|
+
* supply: {
|
|
1899
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
1900
|
+
* amount: {
|
|
1901
|
+
* erc20: {
|
|
1902
|
+
* value: '1000',
|
|
1903
|
+
* },
|
|
1904
|
+
* },
|
|
1905
|
+
* sender: evmAddress('0x9abc…'),
|
|
1906
|
+
* },
|
|
1907
|
+
* },
|
|
1908
|
+
* });
|
|
1909
|
+
*
|
|
1910
|
+
* if (result.isErr()) {
|
|
1911
|
+
* console.error(result.error);
|
|
1912
|
+
* return;
|
|
1913
|
+
* }
|
|
1914
|
+
*
|
|
1915
|
+
* console.log('Preview result:', result.value);
|
|
1916
|
+
* ```
|
|
1917
|
+
*/
|
|
1918
|
+
declare function usePreviewAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<PreviewRequest, PreviewUserPosition, UnexpectedError>;
|
|
1919
|
+
type UsePreviewArgs = Prettify<PreviewRequest & CurrencyQueryOptions>;
|
|
1920
|
+
/**
|
|
1921
|
+
* Fetch a preview of the impact of a potential action on a user's position.
|
|
1922
|
+
*
|
|
1923
|
+
* This signature supports React Suspense:
|
|
1924
|
+
*
|
|
1925
|
+
* ```tsx
|
|
1926
|
+
* const { data } = usePreview({
|
|
1927
|
+
* action: {
|
|
1928
|
+
* supply: {
|
|
1929
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
1930
|
+
* amount: {
|
|
1931
|
+
* erc20: {
|
|
1932
|
+
* currency: evmAddress('0x5678…'),
|
|
1933
|
+
* value: '1000',
|
|
1934
|
+
* },
|
|
1935
|
+
* },
|
|
1936
|
+
* supplier: evmAddress('0x9abc…'),
|
|
1937
|
+
* },
|
|
1938
|
+
* },
|
|
1939
|
+
* suspense: true,
|
|
1940
|
+
* });
|
|
1941
|
+
* ```
|
|
1942
|
+
*/
|
|
1943
|
+
declare function usePreview(args: UsePreviewArgs & Suspendable): SuspenseResult<PreviewUserPosition>;
|
|
1944
|
+
/**
|
|
1945
|
+
* Fetch a preview of the impact of a potential action on a user's position.
|
|
1946
|
+
*
|
|
1947
|
+
* Pausable suspense mode.
|
|
1948
|
+
*
|
|
1949
|
+
* ```tsx
|
|
1950
|
+
* const { data } = usePreview({
|
|
1951
|
+
* action: {
|
|
1952
|
+
* supply: {
|
|
1953
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
1954
|
+
* amount: {
|
|
1955
|
+
* erc20: {
|
|
1956
|
+
* currency: evmAddress('0x5678…'),
|
|
1957
|
+
* value: '1000',
|
|
1958
|
+
* },
|
|
1959
|
+
* },
|
|
1960
|
+
* supplier: evmAddress('0x9abc…'),
|
|
1961
|
+
* },
|
|
1962
|
+
* },
|
|
1963
|
+
* suspense: true,
|
|
1964
|
+
* pause: true,
|
|
1965
|
+
* });
|
|
1966
|
+
* ```
|
|
1967
|
+
*/
|
|
1968
|
+
declare function usePreview(args: Pausable<UsePreviewArgs> & Suspendable): PausableSuspenseResult<PreviewUserPosition>;
|
|
1969
|
+
/**
|
|
1970
|
+
* Fetch a preview of the impact of a potential action on a user's position.
|
|
1971
|
+
*
|
|
1972
|
+
* ```tsx
|
|
1973
|
+
* const { data, error, loading } = usePreview({
|
|
1974
|
+
* action: {
|
|
1975
|
+
* supply: {
|
|
1976
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
1977
|
+
* amount: {
|
|
1978
|
+
* erc20: {
|
|
1979
|
+
* currency: evmAddress('0x5678…'),
|
|
1980
|
+
* value: '1000',
|
|
1981
|
+
* },
|
|
1982
|
+
* },
|
|
1983
|
+
* supplier: evmAddress('0x9abc…'),
|
|
1984
|
+
* },
|
|
1985
|
+
* },
|
|
1986
|
+
* });
|
|
1987
|
+
* ```
|
|
1988
|
+
*/
|
|
1989
|
+
declare function usePreview(args: UsePreviewArgs): ReadResult<PreviewUserPosition>;
|
|
1990
|
+
/**
|
|
1991
|
+
* Fetch a preview of the impact of a potential action on a user's position.
|
|
1992
|
+
*
|
|
1993
|
+
* Pausable loading state mode.
|
|
1994
|
+
*
|
|
1995
|
+
* ```tsx
|
|
1996
|
+
* const { data, error, loading, paused } = usePreview({
|
|
1997
|
+
* action: {
|
|
1998
|
+
* supply: {
|
|
1999
|
+
* reserve: reserveId('SGVsbG8h'),
|
|
2000
|
+
* amount: {
|
|
2001
|
+
* erc20: {
|
|
2002
|
+
* currency: evmAddress('0x5678…'),
|
|
2003
|
+
* value: '1000',
|
|
2004
|
+
* },
|
|
2005
|
+
* },
|
|
2006
|
+
* supplier: evmAddress('0x9abc…'),
|
|
2007
|
+
* },
|
|
2008
|
+
* },
|
|
2009
|
+
* pause: true,
|
|
2010
|
+
* });
|
|
2011
|
+
* ```
|
|
2012
|
+
*/
|
|
2013
|
+
declare function usePreview(args: Pausable<UsePreviewArgs>): PausableReadResult<PreviewUserPosition>;
|
|
2014
|
+
type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions>;
|
|
2015
|
+
/**
|
|
2016
|
+
* Fetch paginated list of activities.
|
|
2017
|
+
*
|
|
2018
|
+
* This signature supports React Suspense:
|
|
2019
|
+
*
|
|
2020
|
+
* ```tsx
|
|
2021
|
+
* const { data } = useActivities({
|
|
2022
|
+
* query: {
|
|
2023
|
+
* chainId: chainId(1),
|
|
2024
|
+
* },
|
|
2025
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2026
|
+
* suspense: true,
|
|
2027
|
+
* });
|
|
2028
|
+
*
|
|
2029
|
+
* // data.items: ActivityItem[]
|
|
2030
|
+
* ```
|
|
2031
|
+
*/
|
|
2032
|
+
declare function useActivities(args: UseActivitiesArgs & Suspendable): SuspenseResult<PaginatedActivitiesResult>;
|
|
2033
|
+
/**
|
|
2034
|
+
* Fetch paginated list of activities.
|
|
2035
|
+
*
|
|
2036
|
+
* Pausable suspense mode.
|
|
2037
|
+
*
|
|
2038
|
+
* ```tsx
|
|
2039
|
+
* const { data } = useActivities({
|
|
2040
|
+
* query: {
|
|
2041
|
+
* chainId: chainId(1),
|
|
2042
|
+
* },
|
|
2043
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2044
|
+
* suspense: true,
|
|
2045
|
+
* pause: true,
|
|
2046
|
+
* });
|
|
2047
|
+
*
|
|
2048
|
+
* // data?.items: ActivityItem[] | undefined
|
|
2049
|
+
* ```
|
|
2050
|
+
*/
|
|
2051
|
+
declare function useActivities(args: Pausable<UseActivitiesArgs> & Suspendable): PausableSuspenseResult<PaginatedActivitiesResult>;
|
|
2052
|
+
/**
|
|
2053
|
+
* Fetch paginated list of activities.
|
|
2054
|
+
*
|
|
2055
|
+
* ```tsx
|
|
2056
|
+
* const { data, error, loading } = useActivities({
|
|
2057
|
+
* query: {
|
|
2058
|
+
* chainId: chainId(1),
|
|
2059
|
+
* },
|
|
2060
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2061
|
+
* });
|
|
2062
|
+
* ```
|
|
2063
|
+
*/
|
|
2064
|
+
declare function useActivities(args: UseActivitiesArgs): ReadResult<PaginatedActivitiesResult>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Fetch paginated list of activities.
|
|
2067
|
+
*
|
|
2068
|
+
* Pausable loading state mode.
|
|
2069
|
+
*
|
|
2070
|
+
* ```tsx
|
|
2071
|
+
* const { data, error, loading } = useActivities({
|
|
2072
|
+
* query: {
|
|
2073
|
+
* chainId: chainId(1),
|
|
2074
|
+
* },
|
|
2075
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2076
|
+
* pause: true,
|
|
2077
|
+
* });
|
|
2078
|
+
*
|
|
2079
|
+
* // data?.items: ActivityItem[] | undefined
|
|
2080
|
+
* // error: UnexpectedError | undefined
|
|
2081
|
+
* // loading: boolean | undefined
|
|
2082
|
+
* ```
|
|
2083
|
+
*/
|
|
2084
|
+
declare function useActivities(args: Pausable<UseActivitiesArgs>): PausableReadResult<PaginatedActivitiesResult>;
|
|
2085
|
+
/**
|
|
2086
|
+
* Low-level hook to execute a {@link activities} action directly.
|
|
2087
|
+
*
|
|
2088
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
2089
|
+
* @remarks
|
|
2090
|
+
* This hook does not actively watch for updates. Use it to fetch activities on demand
|
|
2091
|
+
* (e.g., in an event handler when paginating or refining filters).
|
|
2092
|
+
*
|
|
2093
|
+
* @param options - The query options.
|
|
2094
|
+
* @returns The user history.
|
|
2095
|
+
*/
|
|
2096
|
+
declare function useActivitiesAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError>;
|
|
2097
|
+
|
|
2098
|
+
type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions>;
|
|
2099
|
+
/**
|
|
2100
|
+
* Fetch all user supply positions.
|
|
2101
|
+
*
|
|
2102
|
+
* This signature supports React Suspense:
|
|
2103
|
+
*
|
|
2104
|
+
* ```tsx
|
|
2105
|
+
* const { data } = useUserSupplies({
|
|
2106
|
+
* query: {
|
|
2107
|
+
* userSpoke: {
|
|
2108
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2109
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2110
|
+
* },
|
|
2111
|
+
* },
|
|
2112
|
+
* orderBy: { name: 'ASC' },
|
|
2113
|
+
* suspense: true,
|
|
2114
|
+
* });
|
|
2115
|
+
* ```
|
|
2116
|
+
*/
|
|
2117
|
+
declare function useUserSupplies(args: UseUserSuppliesArgs & Suspendable): SuspenseResult<UserSupplyItem[]>;
|
|
2118
|
+
/**
|
|
2119
|
+
* Fetch all user supply positions.
|
|
2120
|
+
*
|
|
2121
|
+
* Pausable suspense mode.
|
|
2122
|
+
*
|
|
2123
|
+
* ```tsx
|
|
2124
|
+
* const { data } = useUserSupplies({
|
|
2125
|
+
* query: {
|
|
2126
|
+
* userSpoke: {
|
|
2127
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2128
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2129
|
+
* },
|
|
2130
|
+
* },
|
|
2131
|
+
* orderBy: { name: 'ASC' },
|
|
2132
|
+
* suspense: true,
|
|
2133
|
+
* pause: true,
|
|
2134
|
+
* });
|
|
2135
|
+
*
|
|
2136
|
+
* // data?.length: number | undefined
|
|
2137
|
+
* ```
|
|
2138
|
+
*/
|
|
2139
|
+
declare function useUserSupplies(args: Pausable<UseUserSuppliesArgs> & Suspendable): PausableSuspenseResult<UserSupplyItem[]>;
|
|
2140
|
+
/**
|
|
2141
|
+
* Fetch all user supply positions.
|
|
2142
|
+
*
|
|
2143
|
+
* ```tsx
|
|
2144
|
+
* const { data, error, loading } = useUserSupplies({
|
|
2145
|
+
* query: {
|
|
2146
|
+
* userSpoke: {
|
|
2147
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2148
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2149
|
+
* },
|
|
2150
|
+
* },
|
|
2151
|
+
* orderBy: { name: 'ASC' },
|
|
2152
|
+
* });
|
|
2153
|
+
* ```
|
|
2154
|
+
*/
|
|
2155
|
+
declare function useUserSupplies(args: UseUserSuppliesArgs): ReadResult<UserSupplyItem[]>;
|
|
2156
|
+
/**
|
|
2157
|
+
* Fetch all user supply positions.
|
|
2158
|
+
*
|
|
2159
|
+
* Pausable loading state mode.
|
|
2160
|
+
*
|
|
2161
|
+
* ```tsx
|
|
2162
|
+
* const { data, error, loading, paused } = useUserSupplies({
|
|
2163
|
+
* query: {
|
|
2164
|
+
* userSpoke: {
|
|
2165
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2166
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2167
|
+
* },
|
|
2168
|
+
* },
|
|
2169
|
+
* orderBy: { name: 'ASC' },
|
|
2170
|
+
* pause: true,
|
|
2171
|
+
* });
|
|
2172
|
+
*
|
|
2173
|
+
* // data?.length: number | undefined
|
|
2174
|
+
* // error: UnexpectedError | undefined
|
|
2175
|
+
* // loading: boolean | undefined
|
|
2176
|
+
* // paused: boolean
|
|
2177
|
+
* ```
|
|
2178
|
+
*/
|
|
2179
|
+
declare function useUserSupplies(args: Pausable<UseUserSuppliesArgs>): PausableReadResult<UserSupplyItem[]>;
|
|
2180
|
+
/**
|
|
2181
|
+
* Low-level hook to execute a {@link userSupplies} action directly.
|
|
2182
|
+
*
|
|
2183
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
2184
|
+
* @remarks
|
|
2185
|
+
* This hook **does not** actively watch for updated data on user supplies.
|
|
2186
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
2187
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
2188
|
+
*
|
|
2189
|
+
* ```ts
|
|
2190
|
+
* const [execute, { called, data, error, loading }] = useUserSuppliesAction();
|
|
2191
|
+
*
|
|
2192
|
+
* // …
|
|
2193
|
+
*
|
|
2194
|
+
* const result = await execute({
|
|
2195
|
+
* query: {
|
|
2196
|
+
* userSpoke: {
|
|
2197
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2198
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2199
|
+
* },
|
|
2200
|
+
* },
|
|
2201
|
+
* orderBy: { name: 'ASC' },
|
|
2202
|
+
* });
|
|
2203
|
+
*
|
|
2204
|
+
* if (result.isOk()) {
|
|
2205
|
+
* console.log(result.value); // UserSupplyItem[]
|
|
2206
|
+
* } else {
|
|
2207
|
+
* console.error(result.error);
|
|
2208
|
+
* }
|
|
2209
|
+
* ```
|
|
2210
|
+
*/
|
|
2211
|
+
declare function useUserSuppliesAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<UserSuppliesRequest, UserSupplyItem[], UnexpectedError>;
|
|
2212
|
+
type UseUserBorrowsArgs = Prettify<UserBorrowsRequest & CurrencyQueryOptions>;
|
|
2213
|
+
/**
|
|
2214
|
+
* Fetch all user borrow positions.
|
|
2215
|
+
*
|
|
2216
|
+
* This signature supports React Suspense:
|
|
2217
|
+
*
|
|
2218
|
+
* ```tsx
|
|
2219
|
+
* const { data } = useUserBorrows({
|
|
2220
|
+
* query: {
|
|
2221
|
+
* userSpoke: {
|
|
2222
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2223
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2224
|
+
* },
|
|
2225
|
+
* },
|
|
2226
|
+
* orderBy: { name: 'ASC' },
|
|
2227
|
+
* suspense: true,
|
|
2228
|
+
* });
|
|
2229
|
+
* ```
|
|
2230
|
+
*/
|
|
2231
|
+
declare function useUserBorrows(args: UseUserBorrowsArgs & Suspendable): SuspenseResult<UserBorrowItem[]>;
|
|
2232
|
+
/**
|
|
2233
|
+
* Fetch all user borrow positions.
|
|
2234
|
+
*
|
|
2235
|
+
* Pausable suspense mode.
|
|
2236
|
+
*
|
|
2237
|
+
* ```tsx
|
|
2238
|
+
* const { data } = useUserBorrows({
|
|
2239
|
+
* query: {
|
|
2240
|
+
* userSpoke: {
|
|
2241
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2242
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2243
|
+
* },
|
|
2244
|
+
* },
|
|
2245
|
+
* orderBy: { name: 'ASC' },
|
|
2246
|
+
* suspense: true,
|
|
2247
|
+
* pause: true,
|
|
2248
|
+
* });
|
|
2249
|
+
* ```
|
|
2250
|
+
*/
|
|
2251
|
+
declare function useUserBorrows(args: Pausable<UseUserBorrowsArgs> & Suspendable): PausableSuspenseResult<UserBorrowItem[]>;
|
|
2252
|
+
/**
|
|
2253
|
+
* Fetch all user borrow positions.
|
|
2254
|
+
*
|
|
2255
|
+
* ```tsx
|
|
2256
|
+
* const { data, error, loading } = useUserBorrows({
|
|
2257
|
+
* query: {
|
|
2258
|
+
* userSpoke: {
|
|
2259
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2260
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2261
|
+
* },
|
|
2262
|
+
* },
|
|
2263
|
+
* orderBy: { name: 'ASC' },
|
|
2264
|
+
* });
|
|
2265
|
+
* ```
|
|
2266
|
+
*/
|
|
2267
|
+
declare function useUserBorrows(args: UseUserBorrowsArgs): ReadResult<UserBorrowItem[]>;
|
|
2268
|
+
/**
|
|
2269
|
+
* Fetch all user borrow positions.
|
|
2270
|
+
*
|
|
2271
|
+
* Pausable loading state mode.
|
|
2272
|
+
*
|
|
2273
|
+
* ```tsx
|
|
2274
|
+
* const { data, error, loading, paused } = useUserBorrows({
|
|
2275
|
+
* query: {
|
|
2276
|
+
* userSpoke: {
|
|
2277
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2278
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2279
|
+
* },
|
|
2280
|
+
* },
|
|
2281
|
+
* orderBy: { name: 'ASC' },
|
|
2282
|
+
* pause: true,
|
|
2283
|
+
* });
|
|
2284
|
+
* ```
|
|
2285
|
+
*/
|
|
2286
|
+
declare function useUserBorrows(args: Pausable<UseUserBorrowsArgs>): PausableReadResult<UserBorrowItem[]>;
|
|
2287
|
+
/**
|
|
2288
|
+
* Low-level hook to execute a {@link userBorrows} action directly.
|
|
2289
|
+
*
|
|
2290
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
2291
|
+
* @remarks
|
|
2292
|
+
* This hook **does not** actively watch for updated data on user borrows.
|
|
2293
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
2294
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
2295
|
+
*
|
|
2296
|
+
* ```ts
|
|
2297
|
+
* const [execute, { called, data, error, loading }] = useUserBorrowsAction();
|
|
2298
|
+
*
|
|
2299
|
+
* // …
|
|
2300
|
+
*
|
|
2301
|
+
* const result = await execute({
|
|
2302
|
+
* query: {
|
|
2303
|
+
* userSpoke: {
|
|
2304
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2305
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2306
|
+
* },
|
|
2307
|
+
* },
|
|
2308
|
+
* orderBy: { name: 'ASC' },
|
|
2309
|
+
* });
|
|
2310
|
+
*
|
|
2311
|
+
* if (result.isOk()) {
|
|
2312
|
+
* console.log(result.value); // UserBorrowItem[]
|
|
2313
|
+
* } else {
|
|
2314
|
+
* console.error(result.error);
|
|
2315
|
+
* }
|
|
2316
|
+
* ```
|
|
2317
|
+
*/
|
|
2318
|
+
declare function useUserBorrowsAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<UserBorrowsRequest, UserBorrowItem[], UnexpectedError>;
|
|
2319
|
+
type UseUserSummaryArgs = Prettify<UserSummaryRequest & TimeWindowQueryOptions & CurrencyQueryOptions>;
|
|
2320
|
+
/**
|
|
2321
|
+
* Fetch a user's financial summary.
|
|
2322
|
+
*
|
|
2323
|
+
* This signature supports React Suspense:
|
|
2324
|
+
*
|
|
2325
|
+
* ```tsx
|
|
2326
|
+
* const { data } = useUserSummary({
|
|
2327
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2328
|
+
* filter: {
|
|
2329
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2330
|
+
* },
|
|
2331
|
+
* suspense: true,
|
|
2332
|
+
* });
|
|
2333
|
+
* ```
|
|
2334
|
+
*/
|
|
2335
|
+
declare function useUserSummary(args: UseUserSummaryArgs & Suspendable): SuspenseResult<UserSummary>;
|
|
2336
|
+
/**
|
|
2337
|
+
* Fetch a user's financial summary.
|
|
2338
|
+
*
|
|
2339
|
+
* Pausable suspense mode.
|
|
2340
|
+
*
|
|
2341
|
+
* ```tsx
|
|
2342
|
+
* const { data } = useUserSummary({
|
|
2343
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2344
|
+
* filter: {
|
|
2345
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2346
|
+
* },
|
|
2347
|
+
* suspense: true,
|
|
2348
|
+
* pause: true,
|
|
2349
|
+
* });
|
|
2350
|
+
* ```
|
|
2351
|
+
*/
|
|
2352
|
+
declare function useUserSummary(args: Pausable<UseUserSummaryArgs> & Suspendable): PausableSuspenseResult<UserSummary>;
|
|
2353
|
+
/**
|
|
2354
|
+
* Fetch a user's financial summary.
|
|
2355
|
+
*
|
|
2356
|
+
* ```tsx
|
|
2357
|
+
* const { data, error, loading } = useUserSummary({
|
|
2358
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2359
|
+
* filter: {
|
|
2360
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2361
|
+
* },
|
|
2362
|
+
* });
|
|
2363
|
+
* ```
|
|
2364
|
+
*/
|
|
2365
|
+
declare function useUserSummary(args: UseUserSummaryArgs): ReadResult<UserSummary>;
|
|
2366
|
+
/**
|
|
2367
|
+
* Fetch a user's financial summary.
|
|
2368
|
+
*
|
|
2369
|
+
* Pausable loading state mode.
|
|
2370
|
+
*
|
|
2371
|
+
* ```tsx
|
|
2372
|
+
* const { data, error, loading, paused } = useUserSummary({
|
|
2373
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2374
|
+
* filter: {
|
|
2375
|
+
* spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
|
|
2376
|
+
* },
|
|
2377
|
+
* pause: true,
|
|
2378
|
+
* });
|
|
2379
|
+
* ```
|
|
2380
|
+
*/
|
|
2381
|
+
declare function useUserSummary(args: Pausable<UseUserSummaryArgs>): PausableReadResult<UserSummary>;
|
|
2382
|
+
type UseUserPositionsArgs = Prettify<UserPositionsRequest & UserPositionQueryOptions>;
|
|
2383
|
+
/**
|
|
2384
|
+
* Fetch all user positions across specified chains.
|
|
2385
|
+
*
|
|
2386
|
+
* This signature supports React Suspense:
|
|
2387
|
+
*
|
|
2388
|
+
* ```tsx
|
|
2389
|
+
* const { data } = useUserPositions({
|
|
2390
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2391
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2392
|
+
* orderBy: { balance: 'DESC' },
|
|
2393
|
+
* suspense: true,
|
|
2394
|
+
* });
|
|
2395
|
+
* ```
|
|
2396
|
+
*/
|
|
2397
|
+
declare function useUserPositions(args: UseUserPositionsArgs & Suspendable): SuspenseResult<UserPosition[]>;
|
|
2398
|
+
/**
|
|
2399
|
+
* Fetch all user positions across specified chains.
|
|
2400
|
+
*
|
|
2401
|
+
* Pausable suspense mode.
|
|
2402
|
+
*
|
|
2403
|
+
* ```tsx
|
|
2404
|
+
* const { data } = useUserPositions({
|
|
2405
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2406
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2407
|
+
* orderBy: { balance: 'DESC' },
|
|
2408
|
+
* suspense: true,
|
|
2409
|
+
* pause: true,
|
|
2410
|
+
* });
|
|
2411
|
+
* ```
|
|
2412
|
+
*/
|
|
2413
|
+
declare function useUserPositions(args: Pausable<UseUserPositionsArgs> & Suspendable): PausableSuspenseResult<UserPosition[]>;
|
|
2414
|
+
/**
|
|
2415
|
+
* Fetch all user positions across specified chains.
|
|
2416
|
+
*
|
|
2417
|
+
* ```tsx
|
|
2418
|
+
* const { data, error, loading } = useUserPositions({
|
|
2419
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2420
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2421
|
+
* orderBy: { balance: 'DESC' },
|
|
2422
|
+
* });
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
2425
|
+
declare function useUserPositions(args: UseUserPositionsArgs): ReadResult<UserPosition[]>;
|
|
2426
|
+
/**
|
|
2427
|
+
* Fetch all user positions across specified chains.
|
|
2428
|
+
*
|
|
2429
|
+
* Pausable loading state mode.
|
|
2430
|
+
*
|
|
2431
|
+
* ```tsx
|
|
2432
|
+
* const { data, error, loading, paused } = useUserPositions({
|
|
2433
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2434
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2435
|
+
* orderBy: { balance: 'DESC' },
|
|
2436
|
+
* pause: true,
|
|
2437
|
+
* });
|
|
2438
|
+
* ```
|
|
2439
|
+
*/
|
|
2440
|
+
declare function useUserPositions(args: Pausable<UseUserPositionsArgs>): PausableReadResult<UserPosition[]>;
|
|
2441
|
+
/**
|
|
2442
|
+
* Low-level hook to execute a {@link userPositions} action directly.
|
|
2443
|
+
*
|
|
2444
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
2445
|
+
* @remarks
|
|
2446
|
+
* This hook **does not** actively watch for updated data on user positions.
|
|
2447
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
2448
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
2449
|
+
*
|
|
2450
|
+
* ```ts
|
|
2451
|
+
* const [execute, { called, data, error, loading }] = useUserPositionsAction();
|
|
2452
|
+
*
|
|
2453
|
+
* // …
|
|
2454
|
+
*
|
|
2455
|
+
* const result = await execute({
|
|
2456
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2457
|
+
* filter: {
|
|
2458
|
+
* chainIds: [chainId(1), chainId(137)]
|
|
2459
|
+
* },
|
|
2460
|
+
* orderBy: { balance: 'DESC' },
|
|
2461
|
+
* });
|
|
2462
|
+
*
|
|
2463
|
+
* if (result.isOk()) {
|
|
2464
|
+
* console.log(result.value); // UserPosition[]
|
|
2465
|
+
* } else {
|
|
2466
|
+
* console.error(result.error);
|
|
2467
|
+
* }
|
|
2468
|
+
* ```
|
|
2469
|
+
*/
|
|
2470
|
+
declare function useUserPositionsAction(options?: UserPositionQueryOptions): UseAsyncTask<UserPositionsRequest, UserPosition[], UnexpectedError>;
|
|
2471
|
+
type UseUserPositionArgs = Prettify<UserPositionRequest & UserPositionQueryOptions>;
|
|
2472
|
+
/**
|
|
2473
|
+
* Fetch a specific user position by ID.
|
|
2474
|
+
*
|
|
2475
|
+
* This signature supports React Suspense:
|
|
2476
|
+
*
|
|
2477
|
+
* ```tsx
|
|
2478
|
+
* const { data } = useUserPosition({
|
|
2479
|
+
* id: userPositionId('SGVsbG8h'),
|
|
2480
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2481
|
+
* suspense: true,
|
|
2482
|
+
* });
|
|
2483
|
+
* ```
|
|
2484
|
+
*/
|
|
2485
|
+
declare function useUserPosition(args: UseUserPositionArgs & Suspendable): SuspenseResult<UserPosition>;
|
|
2486
|
+
/**
|
|
2487
|
+
* Fetch a specific user position by ID.
|
|
2488
|
+
*
|
|
2489
|
+
* Pausable suspense mode.
|
|
2490
|
+
*
|
|
2491
|
+
* ```tsx
|
|
2492
|
+
* const { data } = useUserPosition({
|
|
2493
|
+
* id: userPositionId('SGVsbG8h'),
|
|
2494
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2495
|
+
* suspense: true,
|
|
2496
|
+
* pause: true,
|
|
2497
|
+
* });
|
|
2498
|
+
* ```
|
|
2499
|
+
*/
|
|
2500
|
+
declare function useUserPosition(args: Pausable<UseUserPositionArgs> & Suspendable): PausableSuspenseResult<UserPosition>;
|
|
2501
|
+
/**
|
|
2502
|
+
* Fetch a specific user position by ID.
|
|
2503
|
+
*
|
|
2504
|
+
* ```tsx
|
|
2505
|
+
* const { data, error, loading } = useUserPosition({
|
|
2506
|
+
* id: userPositionId('SGVsbG8h'),
|
|
2507
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2508
|
+
* });
|
|
2509
|
+
* ```
|
|
2510
|
+
*/
|
|
2511
|
+
declare function useUserPosition(args: UseUserPositionArgs): ReadResult<UserPosition>;
|
|
2512
|
+
/**
|
|
2513
|
+
* Fetch a specific user position by ID.
|
|
2514
|
+
*
|
|
2515
|
+
* Pausable loading state mode.
|
|
2516
|
+
*
|
|
2517
|
+
* ```tsx
|
|
2518
|
+
* const { data, error, loading, paused } = useUserPosition({
|
|
2519
|
+
* id: userPositionId('SGVsbG8h'),
|
|
2520
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2521
|
+
* pause: true,
|
|
2522
|
+
* });
|
|
2523
|
+
* ```
|
|
2524
|
+
*/
|
|
2525
|
+
declare function useUserPosition(args: Pausable<UseUserPositionArgs>): PausableReadResult<UserPosition>;
|
|
2526
|
+
type UseUserBalancesArgs = Prettify<UserBalancesRequest & CurrencyQueryOptions>;
|
|
2527
|
+
/**
|
|
2528
|
+
* Fetch all user balances across specified chains.
|
|
2529
|
+
*
|
|
2530
|
+
* This signature supports React Suspense:
|
|
2531
|
+
*
|
|
2532
|
+
* ```tsx
|
|
2533
|
+
* const { data } = useUserBalances({
|
|
2534
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2535
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2536
|
+
* suspense: true,
|
|
2537
|
+
* });
|
|
2538
|
+
* ```
|
|
2539
|
+
*/
|
|
2540
|
+
declare function useUserBalances(args: UseUserBalancesArgs & Suspendable): SuspenseResult<UserBalance[]>;
|
|
2541
|
+
/**
|
|
2542
|
+
* Fetch all user balances across specified chains.
|
|
2543
|
+
*
|
|
2544
|
+
* Pausable suspense mode.
|
|
2545
|
+
*
|
|
2546
|
+
* ```tsx
|
|
2547
|
+
* const { data } = useUserBalances({
|
|
2548
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2549
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2550
|
+
* suspense: true,
|
|
2551
|
+
* pause: true,
|
|
2552
|
+
* });
|
|
2553
|
+
* ```
|
|
2554
|
+
*/
|
|
2555
|
+
declare function useUserBalances(args: Pausable<UseUserBalancesArgs> & Suspendable): PausableSuspenseResult<UserBalance[]>;
|
|
2556
|
+
/**
|
|
2557
|
+
* Fetch all user balances across specified chains.
|
|
2558
|
+
*
|
|
2559
|
+
* ```tsx
|
|
2560
|
+
* const { data, error, loading } = useUserBalances({
|
|
2561
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2562
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2563
|
+
* });
|
|
2564
|
+
* ```
|
|
2565
|
+
*/
|
|
2566
|
+
declare function useUserBalances(args: UseUserBalancesArgs): ReadResult<UserBalance[]>;
|
|
2567
|
+
/**
|
|
2568
|
+
* Fetch all user balances across specified chains.
|
|
2569
|
+
*
|
|
2570
|
+
* Pausable loading state mode.
|
|
2571
|
+
*
|
|
2572
|
+
* ```tsx
|
|
2573
|
+
* const { data, error, loading, paused } = useUserBalances({
|
|
2574
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2575
|
+
* chainIds: [chainId(1), chainId(137)],
|
|
2576
|
+
* pause: true,
|
|
2577
|
+
* });
|
|
2578
|
+
* ```
|
|
2579
|
+
*/
|
|
2580
|
+
declare function useUserBalances(args: Pausable<UseUserBalancesArgs>): PausableReadResult<UserBalance[]>;
|
|
2581
|
+
/**
|
|
2582
|
+
* Low-level hook to execute a {@link userBalances} action directly.
|
|
2583
|
+
*
|
|
2584
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
2585
|
+
* @remarks
|
|
2586
|
+
* This hook **does not** actively watch for updated data on user balances.
|
|
2587
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
2588
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
2589
|
+
*
|
|
2590
|
+
* ```ts
|
|
2591
|
+
* const [execute, { called, data, error, loading }] = useUserBalancesAction();
|
|
2592
|
+
*
|
|
2593
|
+
* // …
|
|
2594
|
+
*
|
|
2595
|
+
* const result = await execute({
|
|
2596
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2597
|
+
* filter: {
|
|
2598
|
+
* chainIds: [chainId(1), chainId(137)]
|
|
2599
|
+
* },
|
|
2600
|
+
* });
|
|
2601
|
+
*
|
|
2602
|
+
* if (result.isOk()) {
|
|
2603
|
+
* console.log(result.value); // UserBalance[]
|
|
2604
|
+
* } else {
|
|
2605
|
+
* console.error(result.error);
|
|
2606
|
+
* }
|
|
2607
|
+
* ```
|
|
2608
|
+
*/
|
|
2609
|
+
declare function useUserBalancesAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<UserBalancesRequest, UserBalance[], UnexpectedError>;
|
|
2610
|
+
type UseUserSummaryHistoryArgs = Prettify<UserSummaryHistoryRequest & CurrencyQueryOptions>;
|
|
2611
|
+
/**
|
|
2612
|
+
* Fetch user summary history over time.
|
|
2613
|
+
*
|
|
2614
|
+
* This signature supports React Suspense:
|
|
2615
|
+
*
|
|
2616
|
+
* ```tsx
|
|
2617
|
+
* const { data } = useUserSummaryHistory({
|
|
2618
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2619
|
+
* window: TimeWindow.LastWeek,
|
|
2620
|
+
* filter: { chainIds: [chainId(1)] },
|
|
2621
|
+
* suspense: true,
|
|
2622
|
+
* });
|
|
2623
|
+
* ```
|
|
2624
|
+
*/
|
|
2625
|
+
declare function useUserSummaryHistory(args: UseUserSummaryHistoryArgs & Suspendable): SuspenseResult<UserSummaryHistoryItem[]>;
|
|
2626
|
+
/**
|
|
2627
|
+
* Fetch user summary history over time.
|
|
2628
|
+
*
|
|
2629
|
+
* Pausable suspense mode.
|
|
2630
|
+
*
|
|
2631
|
+
* ```tsx
|
|
2632
|
+
* const { data } = useUserSummaryHistory({
|
|
2633
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2634
|
+
* window: TimeWindow.LastWeek,
|
|
2635
|
+
* filter: { chainIds: [chainId(1)] },
|
|
2636
|
+
* suspense: true,
|
|
2637
|
+
* pause: true,
|
|
2638
|
+
* });
|
|
2639
|
+
* ```
|
|
2640
|
+
*/
|
|
2641
|
+
declare function useUserSummaryHistory(args: Pausable<UseUserSummaryHistoryArgs> & Suspendable): PausableSuspenseResult<UserSummaryHistoryItem[]>;
|
|
2642
|
+
/**
|
|
2643
|
+
* Fetch user summary history over time.
|
|
2644
|
+
*
|
|
2645
|
+
* ```tsx
|
|
2646
|
+
* const { data, error, loading } = useUserSummaryHistory({
|
|
2647
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2648
|
+
* window: TimeWindow.LastWeek,
|
|
2649
|
+
* filter: { chainIds: [chainId(1)] },
|
|
2650
|
+
* });
|
|
2651
|
+
* ```
|
|
2652
|
+
*/
|
|
2653
|
+
declare function useUserSummaryHistory(args: UseUserSummaryHistoryArgs): ReadResult<UserSummaryHistoryItem[]>;
|
|
2654
|
+
/**
|
|
2655
|
+
* Fetch user summary history over time.
|
|
2656
|
+
*
|
|
2657
|
+
* Pausable loading state mode.
|
|
2658
|
+
*
|
|
2659
|
+
* ```tsx
|
|
2660
|
+
* const { data, error, loading, paused } = useUserSummaryHistory({
|
|
2661
|
+
* user: evmAddress('0x742d35cc…'),
|
|
2662
|
+
* window: TimeWindow.LastWeek,
|
|
2663
|
+
* filter: { chainIds: [chainId(1)] },
|
|
2664
|
+
* pause: true,
|
|
2665
|
+
* });
|
|
2666
|
+
* ```
|
|
2667
|
+
*/
|
|
2668
|
+
declare function useUserSummaryHistory(args: Pausable<UseUserSummaryHistoryArgs>): PausableReadResult<UserSummaryHistoryItem[]>;
|
|
2669
|
+
|
|
2670
|
+
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError, SendTransactionError, type SwapHandler, type SwapHandlerOptions, type SwapIntent, type UseActivitiesArgs, type UseAssetArgs, type UseAssetBorrowHistoryArgs, type UseAssetPriceHistoryArgs, type UseAssetSupplyHistoryArgs, UseAsyncTask, type UseBorrowApyHistoryArgs, type UseHubArgs, type UseHubAssetsArgs, type UseHubsArgs, type UsePreviewArgs, type UseReserveArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseSupplyApyHistoryArgs, type UseSwapQuoteArgs, type UseSwapTokensRequest, type UseSwappableTokensArgs, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useCancelSwap, useHub, useHubAssets, useHubs, useHubsAction, useLiquidatePosition, usePermitTypedDataAction, usePreview, usePreviewAction, useRenounceSpokeUserPositionManager, useRepay, useReserve, useReserveAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSupplyAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useSupply, useSupplyApyHistory, useSwapQuote, useSwapQuoteAction, useSwapTokens, useSwappableTokens, useUpdateUserDynamicConfig, useUpdateUserRiskPremium, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw };
|