@aave/react 4.0.0-next.4 → 4.0.0-next.40
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 +8 -3
- package/dist/chunk-4GURAVFN.js +2 -0
- package/dist/chunk-4GURAVFN.js.map +1 -0
- package/dist/chunk-4NA4FB6K.js +2 -0
- package/dist/chunk-4NA4FB6K.js.map +1 -0
- package/dist/chunk-IAK4S3R4.js +2 -0
- package/dist/chunk-IAK4S3R4.js.map +1 -0
- package/dist/ethers.cjs +1 -1
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +10 -66
- package/dist/ethers.d.ts +10 -66
- package/dist/ethers.js +1 -1
- package/dist/ethers.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1112 -351
- package/dist/index.d.ts +1112 -351
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{misc-BkG5G4yl.d.cts → misc-COaS62_P.d.ts} +54 -24
- package/dist/{misc-gmAnSdm5.d.ts → misc-DBn3Mp67.d.cts} +54 -24
- package/dist/privy.cjs +1 -1
- package/dist/privy.cjs.map +1 -1
- package/dist/privy.d.cts +9 -54
- package/dist/privy.d.ts +9 -54
- package/dist/privy.js +1 -1
- package/dist/privy.js.map +1 -1
- package/dist/thirdweb.cjs +1 -1
- package/dist/thirdweb.cjs.map +1 -1
- package/dist/thirdweb.d.cts +9 -54
- package/dist/thirdweb.d.ts +9 -54
- package/dist/thirdweb.js +1 -1
- package/dist/thirdweb.js.map +1 -1
- package/dist/viem/index.cjs +1 -1
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +13 -68
- package/dist/viem/index.d.ts +13 -68
- package/dist/viem/index.js +1 -1
- package/dist/viem/index.js.map +1 -1
- package/dist/{writes-BXnwYgAQ.d.cts → writes-CcVGQGt5.d.cts} +13 -6
- package/dist/{writes-BXnwYgAQ.d.ts → writes-CcVGQGt5.d.ts} +13 -6
- package/package.json +6 -6
- package/dist/chunk-GTUQRT5Q.js +0 -2
- package/dist/chunk-GTUQRT5Q.js.map +0 -1
- package/dist/chunk-YJ6HF5HO.js +0 -2
- package/dist/chunk-YJ6HF5HO.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AaveClient, CurrencyQueryOptions,
|
|
1
|
+
import { AaveClient, CurrencyQueryOptions, TimeWindowQueryOptions, UnexpectedError, ActivitiesRequest, PaginatedActivitiesResult } from '@aave/client';
|
|
2
2
|
export * from '@aave/client';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
-
import { a as UseAsyncTask, C as CancelOperation,
|
|
5
|
-
export { A as AsyncTaskError, c as AsyncTaskIdle, d as AsyncTaskLoading, e as AsyncTaskState, f as AsyncTaskSuccess,
|
|
6
|
-
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset,
|
|
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
|
|
9
|
-
export {
|
|
10
|
-
import { UnexpectedError as UnexpectedError$1,
|
|
4
|
+
import { a as UseAsyncTask, C as CancelOperation, P as PendingTransaction, S as SendTransactionError, b as PendingTransactionError, E as ExecutionPlanHandler } from './writes-CcVGQGt5.cjs';
|
|
5
|
+
export { A as AsyncTaskError, c as AsyncTaskIdle, d as AsyncTaskLoading, e as AsyncTaskState, f as AsyncTaskSuccess, T as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-CcVGQGt5.cjs';
|
|
6
|
+
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, UserClaimableRewardsRequest, UserClaimableReward, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, InsufficientLiquidityError, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SwapStatusRequest, SwapStatus, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, TransactionRequest, PrepareSwapCancelRequest, SwapCancelledResult, PreContractActionRequired, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, ClaimRewardsRequest, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
7
|
+
import { Prettify, ResultAsync, Signature, 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 } from './misc-DBn3Mp67.cjs';
|
|
9
|
+
export { d as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, e as useChainAction, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-DBn3Mp67.cjs';
|
|
10
|
+
import { UnexpectedError as UnexpectedError$1, ValidationError, CancelError, SigningError, TimeoutError, TransactionError } from '@aave/core';
|
|
11
11
|
import { UserPositionQueryOptions } from '@aave/client/actions';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -49,7 +49,7 @@ declare function AaveProvider({ children, client }: AaveProviderProps): React.JS
|
|
|
49
49
|
*/
|
|
50
50
|
declare function useAaveClient(): AaveClient;
|
|
51
51
|
|
|
52
|
-
type UseHubArgs = Prettify<HubRequest & CurrencyQueryOptions>;
|
|
52
|
+
type UseHubArgs = Prettify<HubRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
53
53
|
/**
|
|
54
54
|
* Fetch a specific hub by ID or by address and chain ID.
|
|
55
55
|
*
|
|
@@ -102,7 +102,7 @@ declare function useHub(args: UseHubArgs): ReadResult<Hub | null>;
|
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
104
|
declare function useHub(args: Pausable<UseHubArgs>): PausableReadResult<Hub | null>;
|
|
105
|
-
type UseHubsArgs = Prettify<HubsRequest & CurrencyQueryOptions>;
|
|
105
|
+
type UseHubsArgs = Prettify<HubsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
106
106
|
/**
|
|
107
107
|
* Fetch multiple hubs based on specified criteria.
|
|
108
108
|
*
|
|
@@ -153,7 +153,7 @@ declare function useHubs(args: UseHubsArgs): ReadResult<Hub[]>;
|
|
|
153
153
|
* ```
|
|
154
154
|
*/
|
|
155
155
|
declare function useHubs(args: Pausable<UseHubsArgs>): PausableReadResult<Hub[]>;
|
|
156
|
-
type UseHubAssetsArgs = Prettify<HubAssetsRequest & CurrencyQueryOptions>;
|
|
156
|
+
type UseHubAssetsArgs = Prettify<HubAssetsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
157
157
|
/**
|
|
158
158
|
* Fetch hub assets for a specific hub by ID or by address and chain ID.
|
|
159
159
|
*
|
|
@@ -208,6 +208,61 @@ declare function useHubAssets(args: UseHubAssetsArgs): ReadResult<HubAsset[]>;
|
|
|
208
208
|
* ```
|
|
209
209
|
*/
|
|
210
210
|
declare function useHubAssets(args: Pausable<UseHubAssetsArgs>): PausableReadResult<HubAsset[]>;
|
|
211
|
+
type UseHubSummaryHistoryArgs = HubSummaryHistoryRequest;
|
|
212
|
+
/**
|
|
213
|
+
* Fetch historical summary data for a specific hub.
|
|
214
|
+
*
|
|
215
|
+
* This signature supports React Suspense:
|
|
216
|
+
*
|
|
217
|
+
* ```tsx
|
|
218
|
+
* const { data } = useHubSummaryHistory({
|
|
219
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
220
|
+
* currency: Currency.Usd,
|
|
221
|
+
* window: TimeWindow.LastWeek,
|
|
222
|
+
* suspense: true,
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
declare function useHubSummaryHistory(args: UseHubSummaryHistoryArgs & Suspendable): SuspenseResult<HubSummarySample[]>;
|
|
227
|
+
/**
|
|
228
|
+
* Fetch historical summary data for a specific hub.
|
|
229
|
+
*
|
|
230
|
+
* Pausable suspense mode.
|
|
231
|
+
*
|
|
232
|
+
* ```tsx
|
|
233
|
+
* const { data } = useHubSummaryHistory({
|
|
234
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
235
|
+
* suspense: true,
|
|
236
|
+
* pause: true,
|
|
237
|
+
* });
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
declare function useHubSummaryHistory(args: Pausable<UseHubSummaryHistoryArgs> & Suspendable): PausableSuspenseResult<HubSummarySample[]>;
|
|
241
|
+
/**
|
|
242
|
+
* Fetch historical summary data for a specific hub.
|
|
243
|
+
*
|
|
244
|
+
* ```tsx
|
|
245
|
+
* const { data, error, loading } = useHubSummaryHistory({
|
|
246
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
247
|
+
* currency: Currency.Usd,
|
|
248
|
+
* window: TimeWindow.LastWeek,
|
|
249
|
+
* });
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
declare function useHubSummaryHistory(args: UseHubSummaryHistoryArgs): ReadResult<HubSummarySample[]>;
|
|
253
|
+
/**
|
|
254
|
+
* Fetch historical summary data for a specific hub.
|
|
255
|
+
*
|
|
256
|
+
* Pausable loading state mode.
|
|
257
|
+
*
|
|
258
|
+
* ```tsx
|
|
259
|
+
* const { data, error, loading, paused } = useHubSummaryHistory({
|
|
260
|
+
* query: { hubId: hubId('SGVsbG8h') },
|
|
261
|
+
* pause: true,
|
|
262
|
+
* });
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
declare function useHubSummaryHistory(args: Pausable<UseHubSummaryHistoryArgs>): PausableReadResult<HubSummarySample[]>;
|
|
211
266
|
/**
|
|
212
267
|
* Low-level hook to execute a {@link hubs} action directly.
|
|
213
268
|
*
|
|
@@ -237,11 +292,6 @@ declare function useHubAssets(args: Pausable<UseHubAssetsArgs>): PausableReadRes
|
|
|
237
292
|
*/
|
|
238
293
|
declare function useHubsAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<HubsRequest, Hub[], UnexpectedError>;
|
|
239
294
|
|
|
240
|
-
/**
|
|
241
|
-
* @internal
|
|
242
|
-
*/
|
|
243
|
-
declare function usePermitTypedDataAction(): UseAsyncTask<PermitRequest, PermitTypedDataResponse, UnexpectedError>;
|
|
244
|
-
|
|
245
295
|
type UseAssetArgs = Prettify<AssetRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
246
296
|
/**
|
|
247
297
|
* Fetch information about a specific asset (ERC20 token) in the protocol by ID or by token.
|
|
@@ -350,7 +400,7 @@ declare function useAssetPriceHistory(args: UseAssetPriceHistoryArgs): ReadResul
|
|
|
350
400
|
* ```
|
|
351
401
|
*/
|
|
352
402
|
declare function useAssetPriceHistory(args: Pausable<UseAssetPriceHistoryArgs>): PausableReadResult<AssetPriceSample[]>;
|
|
353
|
-
type UseAssetSupplyHistoryArgs = AssetSupplyHistoryRequest
|
|
403
|
+
type UseAssetSupplyHistoryArgs = Prettify<AssetSupplyHistoryRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
354
404
|
/**
|
|
355
405
|
* Fetch historical supply data for a specific asset.
|
|
356
406
|
*
|
|
@@ -403,7 +453,7 @@ declare function useAssetSupplyHistory(args: UseAssetSupplyHistoryArgs): ReadRes
|
|
|
403
453
|
* ```
|
|
404
454
|
*/
|
|
405
455
|
declare function useAssetSupplyHistory(args: Pausable<UseAssetSupplyHistoryArgs>): PausableReadResult<AssetSupplySample[]>;
|
|
406
|
-
type UseAssetBorrowHistoryArgs = AssetBorrowHistoryRequest
|
|
456
|
+
type UseAssetBorrowHistoryArgs = Prettify<AssetBorrowHistoryRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
407
457
|
/**
|
|
408
458
|
* Fetch historical borrow data for a specific asset.
|
|
409
459
|
*
|
|
@@ -456,8 +506,63 @@ declare function useAssetBorrowHistory(args: UseAssetBorrowHistoryArgs): ReadRes
|
|
|
456
506
|
* ```
|
|
457
507
|
*/
|
|
458
508
|
declare function useAssetBorrowHistory(args: Pausable<UseAssetBorrowHistoryArgs>): PausableReadResult<AssetBorrowSample[]>;
|
|
509
|
+
type UseProtocolHistoryArgs = ProtocolHistoryRequest;
|
|
510
|
+
/**
|
|
511
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
512
|
+
*
|
|
513
|
+
* This signature supports React Suspense:
|
|
514
|
+
*
|
|
515
|
+
* ```tsx
|
|
516
|
+
* const { data } = useProtocolHistory({
|
|
517
|
+
* currency: Currency.Usd,
|
|
518
|
+
* window: TimeWindow.LastWeek,
|
|
519
|
+
* suspense: true,
|
|
520
|
+
* });
|
|
521
|
+
* ```
|
|
522
|
+
*/
|
|
523
|
+
declare function useProtocolHistory(args: UseProtocolHistoryArgs & Suspendable): SuspenseResult<ProtocolHistorySample[]>;
|
|
524
|
+
/**
|
|
525
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
526
|
+
*
|
|
527
|
+
* Pausable suspense mode.
|
|
528
|
+
*
|
|
529
|
+
* ```tsx
|
|
530
|
+
* const { data } = useProtocolHistory({
|
|
531
|
+
* currency: Currency.Usd,
|
|
532
|
+
* window: TimeWindow.LastWeek,
|
|
533
|
+
* suspense: true,
|
|
534
|
+
* pause: true,
|
|
535
|
+
* });
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
declare function useProtocolHistory(args: Pausable<UseProtocolHistoryArgs> & Suspendable): PausableSuspenseResult<ProtocolHistorySample[]>;
|
|
539
|
+
/**
|
|
540
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
541
|
+
*
|
|
542
|
+
* ```tsx
|
|
543
|
+
* const { data, error, loading } = useProtocolHistory({
|
|
544
|
+
* currency: Currency.Usd,
|
|
545
|
+
* window: TimeWindow.LastWeek,
|
|
546
|
+
* });
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
declare function useProtocolHistory(args: UseProtocolHistoryArgs): ReadResult<ProtocolHistorySample[]>;
|
|
550
|
+
/**
|
|
551
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
552
|
+
*
|
|
553
|
+
* Pausable loading state mode.
|
|
554
|
+
*
|
|
555
|
+
* ```tsx
|
|
556
|
+
* const { data, error, loading, paused } = useProtocolHistory({
|
|
557
|
+
* currency: Currency.Usd,
|
|
558
|
+
* window: TimeWindow.LastWeek,
|
|
559
|
+
* pause: true,
|
|
560
|
+
* });
|
|
561
|
+
* ```
|
|
562
|
+
*/
|
|
563
|
+
declare function useProtocolHistory(args: Pausable<UseProtocolHistoryArgs>): PausableReadResult<ProtocolHistorySample[]>;
|
|
459
564
|
|
|
460
|
-
type UseReserveArgs = Prettify<ReserveRequest & CurrencyQueryOptions>;
|
|
565
|
+
type UseReserveArgs = Prettify<ReserveRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
461
566
|
/**
|
|
462
567
|
* Fetch a specific reserve by reserve ID, spoke, and chain.
|
|
463
568
|
*
|
|
@@ -537,18 +642,8 @@ declare function useReserve(args: Pausable<UseReserveArgs>): PausableReadResult<
|
|
|
537
642
|
* }
|
|
538
643
|
* ```
|
|
539
644
|
*/
|
|
540
|
-
declare function useReserveAction(options?:
|
|
541
|
-
type UseReservesArgs
|
|
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
|
-
}>;
|
|
645
|
+
declare function useReserveAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ReserveRequest, Reserve | null, UnexpectedError>;
|
|
646
|
+
type UseReservesArgs = Prettify<ReservesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
552
647
|
/**
|
|
553
648
|
* Fetch reserves based on specified criteria.
|
|
554
649
|
*
|
|
@@ -567,36 +662,8 @@ type UseReservesArgs<T = Reserve[]> = Prettify<ReservesRequest & CurrencyQueryOp
|
|
|
567
662
|
* suspense: true,
|
|
568
663
|
* });
|
|
569
664
|
* ```
|
|
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
665
|
*/
|
|
599
|
-
declare function useReserves
|
|
666
|
+
declare function useReserves(args: UseReservesArgs & Suspendable): SuspenseResult<Reserve[]>;
|
|
600
667
|
/**
|
|
601
668
|
* Fetch reserves based on specified criteria.
|
|
602
669
|
*
|
|
@@ -615,7 +682,7 @@ declare function useReserves<T = Reserve[]>(args: UseReservesArgs<T> & Suspendab
|
|
|
615
682
|
* });
|
|
616
683
|
* ```
|
|
617
684
|
*/
|
|
618
|
-
declare function useReserves
|
|
685
|
+
declare function useReserves(args: Pausable<UseReservesArgs> & Suspendable): PausableSuspenseResult<Reserve[]>;
|
|
619
686
|
/**
|
|
620
687
|
* Fetch reserves based on specified criteria.
|
|
621
688
|
*
|
|
@@ -631,34 +698,8 @@ declare function useReserves<T = Reserve[]>(args: Pausable<UseReservesArgs<T>> &
|
|
|
631
698
|
* orderBy: { name: 'ASC' },
|
|
632
699
|
* });
|
|
633
700
|
* ```
|
|
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
701
|
*/
|
|
661
|
-
declare function useReserves
|
|
702
|
+
declare function useReserves(args: UseReservesArgs): ReadResult<Reserve[], UnexpectedError>;
|
|
662
703
|
/**
|
|
663
704
|
* Fetch reserves based on specified criteria.
|
|
664
705
|
*
|
|
@@ -676,7 +717,7 @@ declare function useReserves<T = Reserve[]>(args: UseReservesArgs<T>): ReadResul
|
|
|
676
717
|
* });
|
|
677
718
|
* ```
|
|
678
719
|
*/
|
|
679
|
-
declare function useReserves
|
|
720
|
+
declare function useReserves(args: Pausable<UseReservesArgs>): PausableReadResult<Reserve[], UnexpectedError>;
|
|
680
721
|
/**
|
|
681
722
|
* Low-level hook to execute a {@link reserves} action directly.
|
|
682
723
|
*
|
|
@@ -706,39 +747,9 @@ declare function useReserves<T = Reserve[]>(args: Pausable<UseReservesArgs<T>>):
|
|
|
706
747
|
* console.error(result.error);
|
|
707
748
|
* }
|
|
708
749
|
* ```
|
|
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
750
|
*/
|
|
740
|
-
declare function useReservesAction(options?:
|
|
741
|
-
type UseBorrowApyHistoryArgs =
|
|
751
|
+
declare function useReservesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ReservesRequest, Reserve[], UnexpectedError>;
|
|
752
|
+
type UseBorrowApyHistoryArgs = BorrowApyHistoryRequest;
|
|
742
753
|
/**
|
|
743
754
|
* Fetch borrow APY history for a specific reserve over time.
|
|
744
755
|
*
|
|
@@ -752,7 +763,7 @@ type UseBorrowApyHistoryArgs = BorrowAPYHistoryRequest;
|
|
|
752
763
|
* });
|
|
753
764
|
* ```
|
|
754
765
|
*/
|
|
755
|
-
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs & Suspendable): SuspenseResult<
|
|
766
|
+
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs & Suspendable): SuspenseResult<ApySample[]>;
|
|
756
767
|
/**
|
|
757
768
|
* Fetch borrow APY history for a specific reserve over time.
|
|
758
769
|
*
|
|
@@ -767,7 +778,7 @@ declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs & Suspendable
|
|
|
767
778
|
* });
|
|
768
779
|
* ```
|
|
769
780
|
*/
|
|
770
|
-
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs> & Suspendable): PausableSuspenseResult<
|
|
781
|
+
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs> & Suspendable): PausableSuspenseResult<ApySample[]>;
|
|
771
782
|
/**
|
|
772
783
|
* Fetch borrow APY history for a specific reserve over time.
|
|
773
784
|
*
|
|
@@ -778,7 +789,7 @@ declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs> & S
|
|
|
778
789
|
* });
|
|
779
790
|
* ```
|
|
780
791
|
*/
|
|
781
|
-
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs): ReadResult<
|
|
792
|
+
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs): ReadResult<ApySample[]>;
|
|
782
793
|
/**
|
|
783
794
|
* Fetch borrow APY history for a specific reserve over time.
|
|
784
795
|
*
|
|
@@ -792,8 +803,8 @@ declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs): ReadResult<
|
|
|
792
803
|
* });
|
|
793
804
|
* ```
|
|
794
805
|
*/
|
|
795
|
-
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs>): PausableReadResult<
|
|
796
|
-
type UseSupplyApyHistoryArgs =
|
|
806
|
+
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs>): PausableReadResult<ApySample[]>;
|
|
807
|
+
type UseSupplyApyHistoryArgs = SupplyApyHistoryRequest;
|
|
797
808
|
/**
|
|
798
809
|
* Fetch supply APY history for a specific reserve over time.
|
|
799
810
|
*
|
|
@@ -807,7 +818,7 @@ type UseSupplyApyHistoryArgs = SupplyAPYHistoryRequest;
|
|
|
807
818
|
* });
|
|
808
819
|
* ```
|
|
809
820
|
*/
|
|
810
|
-
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs & Suspendable): SuspenseResult<
|
|
821
|
+
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs & Suspendable): SuspenseResult<ApySample[]>;
|
|
811
822
|
/**
|
|
812
823
|
* Fetch supply APY history for a specific reserve over time.
|
|
813
824
|
*
|
|
@@ -822,7 +833,7 @@ declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs & Suspendable
|
|
|
822
833
|
* });
|
|
823
834
|
* ```
|
|
824
835
|
*/
|
|
825
|
-
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs> & Suspendable): PausableSuspenseResult<
|
|
836
|
+
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs> & Suspendable): PausableSuspenseResult<ApySample[]>;
|
|
826
837
|
/**
|
|
827
838
|
* Fetch supply APY history for a specific reserve over time.
|
|
828
839
|
*
|
|
@@ -833,7 +844,7 @@ declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs> & S
|
|
|
833
844
|
* });
|
|
834
845
|
* ```
|
|
835
846
|
*/
|
|
836
|
-
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs): ReadResult<
|
|
847
|
+
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs): ReadResult<ApySample[]>;
|
|
837
848
|
/**
|
|
838
849
|
* Fetch supply APY history for a specific reserve over time.
|
|
839
850
|
*
|
|
@@ -847,7 +858,85 @@ declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs): ReadResult<
|
|
|
847
858
|
* });
|
|
848
859
|
* ```
|
|
849
860
|
*/
|
|
850
|
-
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs>): PausableReadResult<
|
|
861
|
+
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs>): PausableReadResult<ApySample[]>;
|
|
862
|
+
|
|
863
|
+
type UseUserClaimableRewardsArgs = Prettify<UserClaimableRewardsRequest>;
|
|
864
|
+
/**
|
|
865
|
+
* Fetch all claimable rewards for a user.
|
|
866
|
+
*
|
|
867
|
+
* This signature supports React Suspense:
|
|
868
|
+
*
|
|
869
|
+
* ```tsx
|
|
870
|
+
* const { data } = useUserClaimableRewards({
|
|
871
|
+
* user: evmAddress('0x742d35cc…'),
|
|
872
|
+
* suspense: true,
|
|
873
|
+
* });
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
declare function useUserClaimableRewards(args: UseUserClaimableRewardsArgs & Suspendable): SuspenseResult<UserClaimableReward[]>;
|
|
877
|
+
/**
|
|
878
|
+
* Fetch all claimable rewards for a user.
|
|
879
|
+
*
|
|
880
|
+
* Pausable suspense mode.
|
|
881
|
+
*
|
|
882
|
+
* ```tsx
|
|
883
|
+
* const { data } = useUserClaimableRewards({
|
|
884
|
+
* user: evmAddress('0x742d35cc…'),
|
|
885
|
+
* suspense: true,
|
|
886
|
+
* pause: true,
|
|
887
|
+
* });
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
declare function useUserClaimableRewards(args: Pausable<UseUserClaimableRewardsArgs> & Suspendable): PausableSuspenseResult<UserClaimableReward[]>;
|
|
891
|
+
/**
|
|
892
|
+
* Fetch all claimable rewards for a user.
|
|
893
|
+
*
|
|
894
|
+
* ```tsx
|
|
895
|
+
* const { data, error, loading } = useUserClaimableRewards({
|
|
896
|
+
* user: evmAddress('0x742d35cc…'),
|
|
897
|
+
* });
|
|
898
|
+
* ```
|
|
899
|
+
*/
|
|
900
|
+
declare function useUserClaimableRewards(args: UseUserClaimableRewardsArgs): ReadResult<UserClaimableReward[]>;
|
|
901
|
+
/**
|
|
902
|
+
* Fetch all claimable rewards for a user.
|
|
903
|
+
*
|
|
904
|
+
* Pausable loading state mode.
|
|
905
|
+
*
|
|
906
|
+
* ```tsx
|
|
907
|
+
* const { data, error, loading, paused } = useUserClaimableRewards({
|
|
908
|
+
* user: evmAddress('0x742d35cc…'),
|
|
909
|
+
* pause: true,
|
|
910
|
+
* });
|
|
911
|
+
* ```
|
|
912
|
+
*/
|
|
913
|
+
declare function useUserClaimableRewards(args: Pausable<UseUserClaimableRewardsArgs>): PausableReadResult<UserClaimableReward[]>;
|
|
914
|
+
/**
|
|
915
|
+
* Low-level hook to execute a {@link userClaimableRewards} action directly.
|
|
916
|
+
*
|
|
917
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
918
|
+
* @remarks
|
|
919
|
+
* This hook **does not** actively watch for updated data on claimable rewards.
|
|
920
|
+
* Use this hook to retrieve data on demand as part of a larger workflow
|
|
921
|
+
* (e.g., in an event handler in order to move to the next step).
|
|
922
|
+
*
|
|
923
|
+
* ```ts
|
|
924
|
+
* const [execute, { called, data, error, loading }] = useUserClaimableRewardsAction();
|
|
925
|
+
*
|
|
926
|
+
* // …
|
|
927
|
+
*
|
|
928
|
+
* const result = await execute({
|
|
929
|
+
* user: evmAddress('0x742d35cc…'),
|
|
930
|
+
* });
|
|
931
|
+
*
|
|
932
|
+
* if (result.isOk()) {
|
|
933
|
+
* console.log(result.value); // UserClaimableReward[]
|
|
934
|
+
* } else {
|
|
935
|
+
* console.error(result.error);
|
|
936
|
+
* }
|
|
937
|
+
* ```
|
|
938
|
+
*/
|
|
939
|
+
declare function useUserClaimableRewardsAction(): UseAsyncTask<UserClaimableRewardsRequest, UserClaimableReward[], UnexpectedError>;
|
|
851
940
|
|
|
852
941
|
type UseSpokeArgs = SpokeRequest;
|
|
853
942
|
/**
|
|
@@ -1060,264 +1149,856 @@ declare function useSpokeUserPositionManagers(args: UseSpokeUserPositionManagers
|
|
|
1060
1149
|
*/
|
|
1061
1150
|
declare function useSpokeUserPositionManagers(args: Pausable<UseSpokeUserPositionManagersArgs>): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1062
1151
|
|
|
1063
|
-
type
|
|
1152
|
+
type UseTokenSwapQuoteArgs = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1064
1153
|
/**
|
|
1065
|
-
* @internal
|
|
1066
1154
|
* Fetch a swap quote for the specified trade parameters.
|
|
1067
1155
|
*
|
|
1068
1156
|
* This signature supports React Suspense:
|
|
1069
1157
|
*
|
|
1070
1158
|
* ```tsx
|
|
1071
|
-
* const { data } =
|
|
1159
|
+
* const { data } = useTokenSwapQuote({
|
|
1160
|
+
* market: {
|
|
1161
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1162
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1163
|
+
* amount: bigDecimal('1000'),
|
|
1164
|
+
* kind: SwapKind.Sell,
|
|
1165
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1166
|
+
* },
|
|
1072
1167
|
* chainId: chainId(1),
|
|
1073
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1074
|
-
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1075
|
-
* amount: bigDecimal('1000'),
|
|
1076
|
-
* kind: SwapKind.SELL,
|
|
1077
1168
|
* suspense: true,
|
|
1078
1169
|
* });
|
|
1079
1170
|
* ```
|
|
1080
1171
|
*/
|
|
1081
|
-
declare function
|
|
1172
|
+
declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1082
1173
|
/**
|
|
1083
|
-
* @internal
|
|
1084
1174
|
* Fetch a swap quote for the specified trade parameters.
|
|
1085
1175
|
*
|
|
1086
1176
|
* Pausable suspense mode.
|
|
1087
1177
|
*
|
|
1088
1178
|
* ```tsx
|
|
1089
|
-
* const { data } =
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1179
|
+
* const { data } = useTokenSwapQuote({
|
|
1180
|
+
* market: {
|
|
1181
|
+
* chainId: chainId(1),
|
|
1182
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1183
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1184
|
+
* amount: bigDecimal('1000'),
|
|
1185
|
+
* kind: SwapKind.Sell,
|
|
1186
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1187
|
+
* },
|
|
1096
1188
|
* suspense: true,
|
|
1097
1189
|
* pause: true,
|
|
1098
1190
|
* });
|
|
1099
1191
|
* ```
|
|
1100
1192
|
*/
|
|
1101
|
-
declare function
|
|
1193
|
+
declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1102
1194
|
/**
|
|
1103
|
-
* @internal
|
|
1104
1195
|
* Fetch a swap quote for the specified trade parameters.
|
|
1105
1196
|
*
|
|
1106
1197
|
* ```tsx
|
|
1107
|
-
* const { data, error, loading } =
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1198
|
+
* const { data, error, loading } = useTokenSwapQuote({
|
|
1199
|
+
* market: {
|
|
1200
|
+
* chainId: chainId(1),
|
|
1201
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1202
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1203
|
+
* amount: bigDecimal('1000'),
|
|
1204
|
+
* kind: SwapKind.Sell,
|
|
1205
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1206
|
+
* },
|
|
1113
1207
|
* });
|
|
1114
1208
|
* ```
|
|
1115
1209
|
*/
|
|
1116
|
-
declare function
|
|
1210
|
+
declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1117
1211
|
/**
|
|
1118
|
-
* @internal
|
|
1119
1212
|
* Fetch a swap quote for the specified trade parameters.
|
|
1120
1213
|
*
|
|
1121
1214
|
* Pausable loading state mode.
|
|
1122
1215
|
*
|
|
1123
1216
|
* ```tsx
|
|
1124
|
-
* const { data, error, loading, paused } =
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1217
|
+
* const { data, error, loading, paused } = useTokenSwapQuote({
|
|
1218
|
+
* market: {
|
|
1219
|
+
* chainId: chainId(1),
|
|
1220
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1221
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1222
|
+
* amount: bigDecimal('1000'),
|
|
1223
|
+
* kind: SwapKind.Sell,
|
|
1224
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1225
|
+
* },
|
|
1131
1226
|
* pause: true,
|
|
1132
1227
|
* });
|
|
1133
1228
|
* ```
|
|
1134
1229
|
*/
|
|
1135
|
-
declare function
|
|
1230
|
+
declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1136
1231
|
/**
|
|
1137
|
-
* @internal
|
|
1138
1232
|
* Low-level hook to execute a swap quote action directly.
|
|
1139
1233
|
*
|
|
1140
|
-
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
1141
1234
|
* @remarks
|
|
1142
1235
|
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1143
1236
|
* Use this hook to retrieve quotes on demand as part of a larger workflow
|
|
1144
1237
|
* (e.g., in an event handler to get a fresh quote before executing a swap).
|
|
1145
1238
|
*
|
|
1146
1239
|
* ```ts
|
|
1147
|
-
* const [getQuote, { called, data, error, loading }] =
|
|
1240
|
+
* const [getQuote, { called, data, error, loading }] = useTokenSwapQuoteAction();
|
|
1148
1241
|
*
|
|
1149
1242
|
* // …
|
|
1150
1243
|
*
|
|
1151
1244
|
* const result = await getQuote({
|
|
1152
|
-
*
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1245
|
+
* market: {
|
|
1246
|
+
* chainId: chainId(1),
|
|
1247
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1248
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1249
|
+
* amount: bigDecimal('1000'),
|
|
1250
|
+
* kind: SwapKind.Sell,
|
|
1251
|
+
* },
|
|
1252
|
+
* });
|
|
1253
|
+
*
|
|
1254
|
+
* if (result.isOk()) {
|
|
1255
|
+
* console.log('Swap quote:', result.value);
|
|
1256
|
+
* } else {
|
|
1257
|
+
* console.error(result.error);
|
|
1258
|
+
* }
|
|
1259
|
+
* ```
|
|
1260
|
+
*/
|
|
1261
|
+
declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<TokenSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
|
|
1262
|
+
type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
1263
|
+
/**
|
|
1264
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1265
|
+
*
|
|
1266
|
+
* This signature supports React Suspense:
|
|
1267
|
+
*
|
|
1268
|
+
* ```tsx
|
|
1269
|
+
* const { data } = useSwappableTokens({
|
|
1270
|
+
* query: { chainIds: [chainId(1)] },
|
|
1271
|
+
* suspense: true,
|
|
1272
|
+
* });
|
|
1273
|
+
* ```
|
|
1274
|
+
*/
|
|
1275
|
+
declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable): SuspenseResult<Token[]>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1278
|
+
*
|
|
1279
|
+
* Pausable suspense mode.
|
|
1280
|
+
*
|
|
1281
|
+
* ```tsx
|
|
1282
|
+
* const { data } = useSwappableTokens({
|
|
1283
|
+
* query: { chainIds: [chainId(1)] },
|
|
1284
|
+
* suspense: true,
|
|
1285
|
+
* pause: true,
|
|
1286
|
+
* });
|
|
1287
|
+
* ```
|
|
1288
|
+
*/
|
|
1289
|
+
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Suspendable): PausableSuspenseResult<Token[]>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1292
|
+
*
|
|
1293
|
+
* ```tsx
|
|
1294
|
+
* const { data, error, loading } = useSwappableTokens({
|
|
1295
|
+
* query: { chainIds: [chainId(1)] },
|
|
1296
|
+
* });
|
|
1297
|
+
* ```
|
|
1298
|
+
*/
|
|
1299
|
+
declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<Token[]>;
|
|
1300
|
+
/**
|
|
1301
|
+
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1302
|
+
*
|
|
1303
|
+
* Pausable loading state mode.
|
|
1304
|
+
*
|
|
1305
|
+
* ```tsx
|
|
1306
|
+
* const { data, error, loading, paused } = useSwappableTokens({
|
|
1307
|
+
* query: { chainIds: [chainId(1)] },
|
|
1308
|
+
* pause: true,
|
|
1309
|
+
* });
|
|
1310
|
+
* ```
|
|
1311
|
+
*/
|
|
1312
|
+
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs>): PausableReadResult<Token[]>;
|
|
1313
|
+
type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1314
|
+
/**
|
|
1315
|
+
* Fetch the user's swap history for a specific chain.
|
|
1316
|
+
*
|
|
1317
|
+
* This signature supports React Suspense:
|
|
1318
|
+
*
|
|
1319
|
+
* ```tsx
|
|
1320
|
+
* const { data } = useUserSwaps({
|
|
1321
|
+
* chainId: chainId(1),
|
|
1322
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1323
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1324
|
+
* suspense: true,
|
|
1325
|
+
* });
|
|
1326
|
+
* ```
|
|
1327
|
+
*/
|
|
1328
|
+
declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseResult<PaginatedUserSwapsResult>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Fetch the user's swap history for a specific chain.
|
|
1331
|
+
*
|
|
1332
|
+
* Pausable suspense mode.
|
|
1333
|
+
*
|
|
1334
|
+
* ```tsx
|
|
1335
|
+
* const { data } = useUserSwaps({
|
|
1336
|
+
* chainId: chainId(1),
|
|
1337
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1338
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1339
|
+
* suspense: true,
|
|
1340
|
+
* pause: true,
|
|
1341
|
+
* });
|
|
1342
|
+
* ```
|
|
1343
|
+
*/
|
|
1344
|
+
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs> & Suspendable): PausableSuspenseResult<PaginatedUserSwapsResult>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Fetch the user's swap history for a specific chain.
|
|
1347
|
+
*
|
|
1348
|
+
* ```tsx
|
|
1349
|
+
* const { data, error, loading } = useUserSwaps({
|
|
1350
|
+
* chainId: chainId(1),
|
|
1351
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1352
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1353
|
+
* });
|
|
1354
|
+
* ```
|
|
1355
|
+
*/
|
|
1356
|
+
declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserSwapsResult>;
|
|
1357
|
+
/**
|
|
1358
|
+
* Fetch the user's swap history for a specific chain.
|
|
1359
|
+
*
|
|
1360
|
+
* Pausable loading state mode.
|
|
1361
|
+
*
|
|
1362
|
+
* ```tsx
|
|
1363
|
+
* const { data, error, loading, paused } = useUserSwaps({
|
|
1364
|
+
* chainId: chainId(1),
|
|
1365
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1366
|
+
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1367
|
+
* pause: true,
|
|
1368
|
+
* });
|
|
1369
|
+
* ```
|
|
1370
|
+
*/
|
|
1371
|
+
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
|
|
1372
|
+
type UseSwapStatusArgs = Prettify<SwapStatusRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1373
|
+
/**
|
|
1374
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1375
|
+
*
|
|
1376
|
+
* Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
|
|
1377
|
+
*
|
|
1378
|
+
* This signature supports React Suspense:
|
|
1379
|
+
*
|
|
1380
|
+
* ```tsx
|
|
1381
|
+
* const { data } = useSwapStatus({
|
|
1382
|
+
* id: swapReceipt.id,
|
|
1383
|
+
* suspense: true,
|
|
1384
|
+
* });
|
|
1385
|
+
* ```
|
|
1386
|
+
*/
|
|
1387
|
+
declare function useSwapStatus(args: UseSwapStatusArgs & Suspendable): SuspenseResult<SwapStatus>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1390
|
+
*
|
|
1391
|
+
* Pausable suspense mode.
|
|
1392
|
+
*
|
|
1393
|
+
* ```tsx
|
|
1394
|
+
* const { data } = useSwapStatus({
|
|
1395
|
+
* id: swapReceipt.id,
|
|
1396
|
+
* suspense: true,
|
|
1397
|
+
* pause: shouldPause,
|
|
1398
|
+
* });
|
|
1399
|
+
* ```
|
|
1400
|
+
*/
|
|
1401
|
+
declare function useSwapStatus(args: Pausable<UseSwapStatusArgs> & Suspendable): PausableSuspenseResult<SwapStatus>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1404
|
+
*
|
|
1405
|
+
* Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
|
|
1406
|
+
*
|
|
1407
|
+
* ```tsx
|
|
1408
|
+
* const { data, error, loading } = useSwapStatus({
|
|
1409
|
+
* id: swapReceipt.id,
|
|
1410
|
+
* });
|
|
1411
|
+
* ```
|
|
1412
|
+
*/
|
|
1413
|
+
declare function useSwapStatus(args: UseSwapStatusArgs): ReadResult<SwapStatus>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1416
|
+
*
|
|
1417
|
+
* Pausable loading state mode.
|
|
1418
|
+
*
|
|
1419
|
+
* ```tsx
|
|
1420
|
+
* const { data, error, loading, paused } = useSwapStatus({
|
|
1421
|
+
* id: swapReceipt.id,
|
|
1422
|
+
* pause: shouldPause,
|
|
1423
|
+
* });
|
|
1424
|
+
* ```
|
|
1425
|
+
*/
|
|
1426
|
+
declare function useSwapStatus(args: Pausable<UseSwapStatusArgs>): PausableReadResult<SwapStatus>;
|
|
1427
|
+
type UseSupplySwapQuoteArgs = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1430
|
+
*
|
|
1431
|
+
* This signature supports React Suspense:
|
|
1432
|
+
*
|
|
1433
|
+
* ```tsx
|
|
1434
|
+
* const { data } = useSupplySwapQuote({
|
|
1435
|
+
* market: {
|
|
1436
|
+
* sellPosition: userSupplyItem.id,
|
|
1437
|
+
* buyReserve: reserve.id,
|
|
1438
|
+
* amount: bigDecimal('1000'),
|
|
1439
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1440
|
+
* },
|
|
1441
|
+
* suspense: true,
|
|
1442
|
+
* });
|
|
1443
|
+
* ```
|
|
1444
|
+
*/
|
|
1445
|
+
declare function useSupplySwapQuote(args: UseSupplySwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1446
|
+
/**
|
|
1447
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1448
|
+
*
|
|
1449
|
+
* Pausable suspense mode.
|
|
1450
|
+
*
|
|
1451
|
+
* ```tsx
|
|
1452
|
+
* const { data } = useSupplySwapQuote({
|
|
1453
|
+
* market: {
|
|
1454
|
+
* sellPosition: userSupplyItem.id,
|
|
1455
|
+
* buyReserve: reserve.id,
|
|
1456
|
+
* amount: bigDecimal('1000'),
|
|
1457
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1458
|
+
* },
|
|
1459
|
+
* suspense: true,
|
|
1460
|
+
* pause: true,
|
|
1461
|
+
* });
|
|
1462
|
+
* ```
|
|
1463
|
+
*/
|
|
1464
|
+
declare function useSupplySwapQuote(args: Pausable<UseSupplySwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1465
|
+
/**
|
|
1466
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1467
|
+
*
|
|
1468
|
+
* ```tsx
|
|
1469
|
+
* const { data, error, loading } = useSupplySwapQuote({
|
|
1470
|
+
* market: {
|
|
1471
|
+
* sellPosition: userSupplyItem.id,
|
|
1472
|
+
* buyReserve: reserve.id,
|
|
1473
|
+
* amount: bigDecimal('1000'),
|
|
1474
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1475
|
+
* },
|
|
1476
|
+
* });
|
|
1477
|
+
* ```
|
|
1478
|
+
*/
|
|
1479
|
+
declare function useSupplySwapQuote(args: UseSupplySwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1482
|
+
*
|
|
1483
|
+
* Pausable loading state mode.
|
|
1484
|
+
*
|
|
1485
|
+
* ```tsx
|
|
1486
|
+
* const { data, error, loading, paused } = useSupplySwapQuote({
|
|
1487
|
+
* market: {
|
|
1488
|
+
* sellPosition: userSupplyItem.id,
|
|
1489
|
+
* buyReserve: reserve.id,
|
|
1490
|
+
* amount: bigDecimal('1000'),
|
|
1491
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1492
|
+
* },
|
|
1493
|
+
* pause: true,
|
|
1494
|
+
* });
|
|
1495
|
+
* ```
|
|
1496
|
+
*/
|
|
1497
|
+
declare function useSupplySwapQuote(args: Pausable<UseSupplySwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1498
|
+
/**
|
|
1499
|
+
* Low-level hook to execute a supply swap quote action directly.
|
|
1500
|
+
*
|
|
1501
|
+
* @remarks
|
|
1502
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1503
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1504
|
+
*
|
|
1505
|
+
* ```ts
|
|
1506
|
+
* const [getQuote, { called, data, error, loading }] = useSupplySwapQuoteAction();
|
|
1507
|
+
*
|
|
1508
|
+
* // …
|
|
1509
|
+
*
|
|
1510
|
+
* const result = await getQuote({
|
|
1511
|
+
* sellPosition: userSupplyItem.id,
|
|
1512
|
+
* buyReserve: reserve.id,
|
|
1513
|
+
* amount: bigDecimal('1000'),
|
|
1514
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1515
|
+
* });
|
|
1516
|
+
*
|
|
1517
|
+
* if (result.isOk()) {
|
|
1518
|
+
* console.log('Supply swap quote:', result.value);
|
|
1519
|
+
* } else {
|
|
1520
|
+
* console.error(result.error);
|
|
1521
|
+
* }
|
|
1522
|
+
* ```
|
|
1523
|
+
*/
|
|
1524
|
+
declare function useSupplySwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<SupplySwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
|
|
1525
|
+
type UseBorrowSwapQuoteArgs = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1526
|
+
/**
|
|
1527
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1528
|
+
*
|
|
1529
|
+
* This signature supports React Suspense:
|
|
1530
|
+
*
|
|
1531
|
+
* ```tsx
|
|
1532
|
+
* const { data } = useBorrowSwapQuote({
|
|
1533
|
+
* market: {
|
|
1534
|
+
* sellPosition: userBorrowItem.id,
|
|
1535
|
+
* buyReserve: reserve.id,
|
|
1536
|
+
* amount: bigDecimal('1000'),
|
|
1537
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1538
|
+
* },
|
|
1539
|
+
* suspense: true,
|
|
1540
|
+
* });
|
|
1541
|
+
* ```
|
|
1542
|
+
*/
|
|
1543
|
+
declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1546
|
+
*
|
|
1547
|
+
* Pausable suspense mode.
|
|
1548
|
+
*
|
|
1549
|
+
* ```tsx
|
|
1550
|
+
* const { data } = useBorrowSwapQuote({
|
|
1551
|
+
* market: {
|
|
1552
|
+
* sellPosition: userBorrowItem.id,
|
|
1553
|
+
* buyReserve: reserve.id,
|
|
1554
|
+
* amount: bigDecimal('1000'),
|
|
1555
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1556
|
+
* },
|
|
1557
|
+
* suspense: true,
|
|
1558
|
+
* pause: true,
|
|
1559
|
+
* });
|
|
1560
|
+
* ```
|
|
1561
|
+
*/
|
|
1562
|
+
declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1563
|
+
/**
|
|
1564
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1565
|
+
*
|
|
1566
|
+
* ```tsx
|
|
1567
|
+
* const { data, error, loading } = useBorrowSwapQuote({
|
|
1568
|
+
* market: {
|
|
1569
|
+
* sellPosition: userBorrowItem.id,
|
|
1570
|
+
* buyReserve: reserve.id,
|
|
1571
|
+
* amount: bigDecimal('1000'),
|
|
1572
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1573
|
+
* },
|
|
1574
|
+
* });
|
|
1575
|
+
* ```
|
|
1576
|
+
*/
|
|
1577
|
+
declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1578
|
+
/**
|
|
1579
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1580
|
+
*
|
|
1581
|
+
* Pausable loading state mode.
|
|
1582
|
+
*
|
|
1583
|
+
* ```tsx
|
|
1584
|
+
* const { data, error, loading, paused } = useBorrowSwapQuote({
|
|
1585
|
+
* market: {
|
|
1586
|
+
* sellPosition: userBorrowItem.id,
|
|
1587
|
+
* buyReserve: reserve.id,
|
|
1588
|
+
* amount: bigDecimal('1000'),
|
|
1589
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1590
|
+
* },
|
|
1591
|
+
* pause: true,
|
|
1592
|
+
* });
|
|
1593
|
+
* ```
|
|
1594
|
+
*/
|
|
1595
|
+
declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1596
|
+
/**
|
|
1597
|
+
* Low-level hook to execute a borrow swap quote action directly.
|
|
1598
|
+
*
|
|
1599
|
+
* @remarks
|
|
1600
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1601
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1602
|
+
*
|
|
1603
|
+
* ```ts
|
|
1604
|
+
* const [getQuote, { called, data, error, loading }] = useBorrowSwapQuoteAction();
|
|
1605
|
+
*
|
|
1606
|
+
* // …
|
|
1607
|
+
*
|
|
1608
|
+
* const result = await getQuote({
|
|
1609
|
+
* debtPosition: userBorrowItem.id,
|
|
1610
|
+
* buyReserve: reserve.id,
|
|
1611
|
+
* amount: bigDecimal('1000'),
|
|
1612
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1613
|
+
* });
|
|
1614
|
+
*
|
|
1615
|
+
* if (result.isOk()) {
|
|
1616
|
+
* console.log('Borrow swap quote:', result.value);
|
|
1617
|
+
* } else {
|
|
1618
|
+
* console.error(result.error);
|
|
1619
|
+
* }
|
|
1620
|
+
* ```
|
|
1621
|
+
*/
|
|
1622
|
+
declare function useBorrowSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<BorrowSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
|
|
1623
|
+
type SwapHandlerOptions = {
|
|
1624
|
+
cancel: CancelOperation;
|
|
1625
|
+
};
|
|
1626
|
+
type SwapSignerError = CancelError | SigningError | UnexpectedError$1;
|
|
1627
|
+
type PositionSwapPlan = PositionSwapApproval | SwapTypedData;
|
|
1628
|
+
type PositionSwapHandler = (plan: PositionSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
|
|
1629
|
+
type PositionSwapValue = {
|
|
1630
|
+
quote?: SwapQuote;
|
|
1631
|
+
};
|
|
1632
|
+
type UseSupplySwapRequest = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1633
|
+
/**
|
|
1634
|
+
* Orchestrate the supply swap execution plan.
|
|
1635
|
+
*
|
|
1636
|
+
* ```tsx
|
|
1637
|
+
* const [signTypedData] = useSignTypedData(wallet);
|
|
1638
|
+
*
|
|
1639
|
+
* const [swapSupply, { loading, error }] = useSupplySwap((plan) => {
|
|
1640
|
+
* switch (plan.__typename) {
|
|
1641
|
+
* case 'PositionSwapAdapterContractApproval':
|
|
1642
|
+
* case 'PositionSwapPositionManagerApproval':
|
|
1643
|
+
* return signTypedData(plan.bySignature);
|
|
1644
|
+
*
|
|
1645
|
+
* case 'SwapTypedData':
|
|
1646
|
+
* return signTypedData(plan);
|
|
1647
|
+
* }
|
|
1648
|
+
* });
|
|
1649
|
+
*
|
|
1650
|
+
* const result = await swapSupply({
|
|
1651
|
+
* market: {
|
|
1652
|
+
* sellPosition: supplyPosition.id,
|
|
1653
|
+
* buyReserve: targetReserve.id,
|
|
1654
|
+
* amount: bigDecimal('1000'),
|
|
1655
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1656
|
+
* enableCollateral: true,
|
|
1657
|
+
* },
|
|
1658
|
+
* });
|
|
1659
|
+
*
|
|
1660
|
+
* if (result.isErr()) {
|
|
1661
|
+
* console.error(result.error);
|
|
1662
|
+
* return;
|
|
1663
|
+
* }
|
|
1664
|
+
*
|
|
1665
|
+
* // result.value: SwapReceipt
|
|
1666
|
+
* ```
|
|
1667
|
+
*/
|
|
1668
|
+
declare function useSupplySwap(handler: PositionSwapHandler): UseAsyncTask<SupplySwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
|
|
1669
|
+
type UseBorrowSwapRequest = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1670
|
+
/**
|
|
1671
|
+
* Orchestrate the borrow swap execution plan.
|
|
1672
|
+
*
|
|
1673
|
+
* ```tsx
|
|
1674
|
+
* const [signTypedData] = useSignTypedData(wallet);
|
|
1675
|
+
*
|
|
1676
|
+
* const [swapBorrow, { loading, error }] = useBorrowSwap((plan) => {
|
|
1677
|
+
* switch (plan.__typename) {
|
|
1678
|
+
* case 'PositionSwapAdapterContractApproval':
|
|
1679
|
+
* case 'PositionSwapPositionManagerApproval':
|
|
1680
|
+
* return signTypedData(plan.bySignature);
|
|
1681
|
+
*
|
|
1682
|
+
* case 'SwapTypedData':
|
|
1683
|
+
* return signTypedData(plan);
|
|
1684
|
+
* }
|
|
1685
|
+
* });
|
|
1686
|
+
*
|
|
1687
|
+
* const result = await swapBorrow({
|
|
1688
|
+
* market: {
|
|
1689
|
+
* debtPosition: userBorrowItem.id,
|
|
1690
|
+
* buyReserve: targetReserve.id,
|
|
1691
|
+
* amount: bigDecimal('1000'),
|
|
1692
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1693
|
+
* },
|
|
1694
|
+
* });
|
|
1695
|
+
*
|
|
1696
|
+
* if (result.isErr()) {
|
|
1697
|
+
* console.error(result.error);
|
|
1698
|
+
* return;
|
|
1699
|
+
* }
|
|
1700
|
+
*
|
|
1701
|
+
* // result.value: SwapReceipt
|
|
1702
|
+
* ```
|
|
1703
|
+
*/
|
|
1704
|
+
declare function useBorrowSwap(handler: PositionSwapHandler): UseAsyncTask<BorrowSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
|
|
1705
|
+
type UseRepayWithSupplyQuoteArgs = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1708
|
+
*
|
|
1709
|
+
* This signature supports React Suspense:
|
|
1710
|
+
*
|
|
1711
|
+
* ```tsx
|
|
1712
|
+
* const { data } = useRepayWithSupplyQuote({
|
|
1713
|
+
* market: {
|
|
1714
|
+
* sellPosition: userSupplyItem.id,
|
|
1715
|
+
* buyPosition: userBorrowItem.id,
|
|
1716
|
+
* amount: bigDecimal('1000'),
|
|
1717
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1718
|
+
* },
|
|
1719
|
+
* suspense: true,
|
|
1720
|
+
* });
|
|
1721
|
+
* ```
|
|
1722
|
+
*/
|
|
1723
|
+
declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1724
|
+
/**
|
|
1725
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1726
|
+
*
|
|
1727
|
+
* Pausable suspense mode.
|
|
1728
|
+
*
|
|
1729
|
+
* ```tsx
|
|
1730
|
+
* const { data } = useRepayWithSupplyQuote({
|
|
1731
|
+
* market: {
|
|
1732
|
+
* sellPosition: userSupplyItem.id,
|
|
1733
|
+
* buyPosition: userBorrowItem.id,
|
|
1734
|
+
* amount: bigDecimal('1000'),
|
|
1735
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1736
|
+
* },
|
|
1737
|
+
* suspense: true,
|
|
1738
|
+
* pause: true,
|
|
1739
|
+
* });
|
|
1740
|
+
* ```
|
|
1741
|
+
*/
|
|
1742
|
+
declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1743
|
+
/**
|
|
1744
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1745
|
+
*
|
|
1746
|
+
* ```tsx
|
|
1747
|
+
* const { data, error, loading } = useRepayWithSupplyQuote({
|
|
1748
|
+
* market: {
|
|
1749
|
+
* sellPosition: userSupplyItem.id,
|
|
1750
|
+
* buyPosition: userBorrowItem.id,
|
|
1751
|
+
* amount: bigDecimal('1000'),
|
|
1752
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1753
|
+
* },
|
|
1754
|
+
* });
|
|
1755
|
+
* ```
|
|
1756
|
+
*/
|
|
1757
|
+
declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs): ReadResult<SwapQuote>;
|
|
1758
|
+
/**
|
|
1759
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1760
|
+
*
|
|
1761
|
+
* Pausable loading state mode.
|
|
1762
|
+
*
|
|
1763
|
+
* ```tsx
|
|
1764
|
+
* const { data, error, loading, paused } = useRepayWithSupplyQuote({
|
|
1765
|
+
* market: {
|
|
1766
|
+
* sellPosition: userSupplyItem.id,
|
|
1767
|
+
* buyPosition: userBorrowItem.id,
|
|
1768
|
+
* amount: bigDecimal('1000'),
|
|
1769
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1770
|
+
* },
|
|
1771
|
+
* pause: true,
|
|
1772
|
+
* });
|
|
1773
|
+
* ```
|
|
1774
|
+
*/
|
|
1775
|
+
declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1776
|
+
/**
|
|
1777
|
+
* Low-level hook to execute a repay with supply quote action directly.
|
|
1778
|
+
*
|
|
1779
|
+
* @remarks
|
|
1780
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1781
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1782
|
+
*
|
|
1783
|
+
* ```ts
|
|
1784
|
+
* const [getQuote, { called, data, error, loading }] = useRepayWithSupplyQuoteAction();
|
|
1785
|
+
*
|
|
1786
|
+
* // …
|
|
1787
|
+
*
|
|
1788
|
+
* const result = await getQuote({
|
|
1789
|
+
* repayWithReserve: reserve.id,
|
|
1790
|
+
* debtPosition: userBorrowItem.id,
|
|
1791
|
+
* amount: bigDecimal('1000'),
|
|
1792
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1793
|
+
* });
|
|
1794
|
+
*
|
|
1795
|
+
* if (result.isOk()) {
|
|
1796
|
+
* console.log('Repay with supply quote:', result.value);
|
|
1797
|
+
* } else {
|
|
1798
|
+
* console.error(result.error);
|
|
1799
|
+
* }
|
|
1800
|
+
* ```
|
|
1801
|
+
*/
|
|
1802
|
+
declare function useRepayWithSupplyQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
|
|
1803
|
+
type UseRepayWithSupplyRequest = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
|
|
1804
|
+
/**
|
|
1805
|
+
* Orchestrate the repay with supply execution plan.
|
|
1806
|
+
*
|
|
1807
|
+
* ```tsx
|
|
1808
|
+
* const [signTypedData] = useSignTypedData(wallet);
|
|
1809
|
+
*
|
|
1810
|
+
* const [repayWithSupply, { loading, error }] = useRepayWithSupply((plan) => {
|
|
1811
|
+
* switch (plan.__typename) {
|
|
1812
|
+
* case 'PositionSwapAdapterContractApproval':
|
|
1813
|
+
* case 'PositionSwapPositionManagerApproval':
|
|
1814
|
+
* return signTypedData(plan.bySignature);
|
|
1815
|
+
*
|
|
1816
|
+
* case 'SwapTypedData':
|
|
1817
|
+
* return signTypedData(plan);
|
|
1818
|
+
* }
|
|
1819
|
+
* });
|
|
1820
|
+
*
|
|
1821
|
+
* const result = await repayWithSupply({
|
|
1822
|
+
* market: {
|
|
1823
|
+
* sellPosition: userSupplyItem.id,
|
|
1824
|
+
* buyPosition: userBorrowItem.id,
|
|
1825
|
+
* amount: bigDecimal('1000'),
|
|
1826
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1827
|
+
* },
|
|
1157
1828
|
* });
|
|
1158
1829
|
*
|
|
1159
|
-
* if (result.
|
|
1160
|
-
* console.log('Swap quote:', result.value);
|
|
1161
|
-
* } else {
|
|
1830
|
+
* if (result.isErr()) {
|
|
1162
1831
|
* console.error(result.error);
|
|
1832
|
+
* return;
|
|
1163
1833
|
* }
|
|
1834
|
+
*
|
|
1835
|
+
* // result.value: SwapReceipt
|
|
1164
1836
|
* ```
|
|
1165
1837
|
*/
|
|
1166
|
-
declare function
|
|
1167
|
-
type
|
|
1838
|
+
declare function useRepayWithSupply(handler: PositionSwapHandler): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
|
|
1839
|
+
type UseWithdrawSwapQuoteArgs = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1168
1840
|
/**
|
|
1169
|
-
*
|
|
1170
|
-
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1841
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1171
1842
|
*
|
|
1172
1843
|
* This signature supports React Suspense:
|
|
1173
1844
|
*
|
|
1174
1845
|
* ```tsx
|
|
1175
|
-
* const { data } =
|
|
1176
|
-
*
|
|
1846
|
+
* const { data } = useWithdrawSwapQuote({
|
|
1847
|
+
* market: {
|
|
1848
|
+
* position: userSupplyItem.id,
|
|
1849
|
+
* buyReserve: reserve.id,
|
|
1850
|
+
* amount: bigDecimal('1000'),
|
|
1851
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1852
|
+
* },
|
|
1177
1853
|
* suspense: true,
|
|
1178
1854
|
* });
|
|
1179
1855
|
* ```
|
|
1180
1856
|
*/
|
|
1181
|
-
declare function
|
|
1857
|
+
declare function useWithdrawSwapQuote(args: UseWithdrawSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1182
1858
|
/**
|
|
1183
|
-
*
|
|
1184
|
-
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1859
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1185
1860
|
*
|
|
1186
1861
|
* Pausable suspense mode.
|
|
1187
1862
|
*
|
|
1188
1863
|
* ```tsx
|
|
1189
|
-
* const { data } =
|
|
1190
|
-
*
|
|
1864
|
+
* const { data } = useWithdrawSwapQuote({
|
|
1865
|
+
* market: {
|
|
1866
|
+
* position: userSupplyItem.id,
|
|
1867
|
+
* buyReserve: reserve.id,
|
|
1868
|
+
* amount: bigDecimal('1000'),
|
|
1869
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1870
|
+
* },
|
|
1191
1871
|
* suspense: true,
|
|
1192
1872
|
* pause: true,
|
|
1193
1873
|
* });
|
|
1194
1874
|
* ```
|
|
1195
1875
|
*/
|
|
1196
|
-
declare function
|
|
1876
|
+
declare function useWithdrawSwapQuote(args: Pausable<UseWithdrawSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1197
1877
|
/**
|
|
1198
|
-
*
|
|
1199
|
-
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1878
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1200
1879
|
*
|
|
1201
1880
|
* ```tsx
|
|
1202
|
-
* const { data, error, loading } =
|
|
1203
|
-
*
|
|
1881
|
+
* const { data, error, loading } = useWithdrawSwapQuote({
|
|
1882
|
+
* market: {
|
|
1883
|
+
* position: userSupplyItem.id,
|
|
1884
|
+
* buyReserve: reserve.id,
|
|
1885
|
+
* amount: bigDecimal('1000'),
|
|
1886
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1887
|
+
* },
|
|
1204
1888
|
* });
|
|
1205
1889
|
* ```
|
|
1206
1890
|
*/
|
|
1207
|
-
declare function
|
|
1891
|
+
declare function useWithdrawSwapQuote(args: UseWithdrawSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1208
1892
|
/**
|
|
1209
|
-
*
|
|
1210
|
-
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1893
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1211
1894
|
*
|
|
1212
1895
|
* Pausable loading state mode.
|
|
1213
1896
|
*
|
|
1214
1897
|
* ```tsx
|
|
1215
|
-
* const { data, error, loading, paused } =
|
|
1216
|
-
*
|
|
1898
|
+
* const { data, error, loading, paused } = useWithdrawSwapQuote({
|
|
1899
|
+
* market: {
|
|
1900
|
+
* position: userSupplyItem.id,
|
|
1901
|
+
* buyReserve: reserve.id,
|
|
1902
|
+
* amount: bigDecimal('1000'),
|
|
1903
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1904
|
+
* },
|
|
1217
1905
|
* pause: true,
|
|
1218
1906
|
* });
|
|
1219
1907
|
* ```
|
|
1220
1908
|
*/
|
|
1221
|
-
declare function
|
|
1222
|
-
type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
1909
|
+
declare function useWithdrawSwapQuote(args: Pausable<UseWithdrawSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1223
1910
|
/**
|
|
1224
|
-
*
|
|
1225
|
-
* Fetch the user's swap history for a specific chain.
|
|
1911
|
+
* Low-level hook to execute a withdraw swap quote action directly.
|
|
1226
1912
|
*
|
|
1227
|
-
*
|
|
1913
|
+
* @remarks
|
|
1914
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1915
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1228
1916
|
*
|
|
1229
|
-
* ```
|
|
1230
|
-
* const { data } =
|
|
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.
|
|
1917
|
+
* ```ts
|
|
1918
|
+
* const [getQuote, { called, data, error, loading }] = useWithdrawSwapQuoteAction();
|
|
1242
1919
|
*
|
|
1243
|
-
*
|
|
1920
|
+
* // …
|
|
1244
1921
|
*
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1250
|
-
* suspense: true,
|
|
1251
|
-
* pause: true,
|
|
1922
|
+
* const result = await getQuote({
|
|
1923
|
+
* position: userSupplyItem.id,
|
|
1924
|
+
* buyReserve: reserve.id,
|
|
1925
|
+
* amount: bigDecimal('1000'),
|
|
1926
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1252
1927
|
* });
|
|
1928
|
+
*
|
|
1929
|
+
* if (result.isOk()) {
|
|
1930
|
+
* console.log('Withdraw swap quote:', result.value);
|
|
1931
|
+
* } else {
|
|
1932
|
+
* console.error(result.error);
|
|
1933
|
+
* }
|
|
1253
1934
|
* ```
|
|
1254
1935
|
*/
|
|
1255
|
-
declare function
|
|
1936
|
+
declare function useWithdrawSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<WithdrawSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
|
|
1937
|
+
type UseWithdrawSwapRequest = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1256
1938
|
/**
|
|
1257
|
-
*
|
|
1258
|
-
* Fetch the user's swap history for a specific chain.
|
|
1939
|
+
* Orchestrate the withdraw swap execution plan.
|
|
1259
1940
|
*
|
|
1260
1941
|
* ```tsx
|
|
1261
|
-
* const
|
|
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.
|
|
1942
|
+
* const [signTypedData] = useSignTypedData(wallet);
|
|
1272
1943
|
*
|
|
1273
|
-
*
|
|
1944
|
+
* const [withdrawSwap, { loading, error }] = useWithdrawSwap((plan) => {
|
|
1945
|
+
* switch (plan.__typename) {
|
|
1946
|
+
* case 'PositionSwapAdapterContractApproval':
|
|
1947
|
+
* case 'PositionSwapPositionManagerApproval':
|
|
1948
|
+
* return signTypedData(plan.bySignature);
|
|
1274
1949
|
*
|
|
1275
|
-
*
|
|
1276
|
-
*
|
|
1277
|
-
*
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1280
|
-
*
|
|
1950
|
+
* case 'SwapTypedData':
|
|
1951
|
+
* return signTypedData(plan);
|
|
1952
|
+
* }
|
|
1953
|
+
* });
|
|
1954
|
+
*
|
|
1955
|
+
* const result = await withdrawSwap({
|
|
1956
|
+
* market: {
|
|
1957
|
+
* position: userSupplyItem.id,
|
|
1958
|
+
* buyToken: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1959
|
+
* amount: bigDecimal('1000'),
|
|
1960
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1961
|
+
* },
|
|
1281
1962
|
* });
|
|
1963
|
+
*
|
|
1964
|
+
* if (result.isErr()) {
|
|
1965
|
+
* console.error(result.error);
|
|
1966
|
+
* return;
|
|
1967
|
+
* }
|
|
1968
|
+
*
|
|
1969
|
+
* // result.value: SwapReceipt
|
|
1282
1970
|
* ```
|
|
1283
1971
|
*/
|
|
1284
|
-
declare function
|
|
1285
|
-
type
|
|
1286
|
-
type
|
|
1287
|
-
type
|
|
1288
|
-
cancel: CancelOperation;
|
|
1289
|
-
};
|
|
1290
|
-
type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAsync<ERC20PermitSignature | SwapReceipt, SendTransactionError | PendingTransactionError>;
|
|
1972
|
+
declare function useWithdrawSwap(handler: PositionSwapHandler): UseAsyncTask<WithdrawSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
|
|
1973
|
+
type UseTokenSwapRequest = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1974
|
+
type TokenSwapPlan = SwapTypedData | Erc20Approval | SwapTransactionRequest;
|
|
1975
|
+
type TokenSwapHandler = (plan: TokenSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
|
|
1291
1976
|
/**
|
|
1292
|
-
*
|
|
1293
|
-
* Orchestrate the swap execution plan.
|
|
1977
|
+
* Orchestrate the token swap execution plan.
|
|
1294
1978
|
*
|
|
1295
1979
|
* ```tsx
|
|
1296
|
-
* const [sendTransaction
|
|
1297
|
-
* const [
|
|
1980
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1981
|
+
* const [signTypedData] = useSignTypedData(wallet);
|
|
1298
1982
|
*
|
|
1299
|
-
* const [swap,
|
|
1983
|
+
* const [swap, { loading, error }] = useTokenSwap((plan) => {
|
|
1300
1984
|
* switch (plan.__typename) {
|
|
1301
|
-
* case '
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
* return sendTransaction(plan.transaction);
|
|
1985
|
+
* case 'Erc20Approval':
|
|
1986
|
+
* if (plan.bySignature) {
|
|
1987
|
+
* return signTypedData(plan.bySignature);
|
|
1988
|
+
* }
|
|
1989
|
+
* return sendTransaction(plan.byTransaction);
|
|
1307
1990
|
*
|
|
1308
1991
|
* case 'SwapTransactionRequest':
|
|
1309
1992
|
* return sendTransaction(plan.transaction);
|
|
1993
|
+
*
|
|
1994
|
+
* case 'SwapTypedData':
|
|
1995
|
+
* return signTypedData(plan);
|
|
1310
1996
|
* }
|
|
1311
1997
|
* });
|
|
1312
1998
|
*
|
|
1313
1999
|
* const result = await swap({
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1317
|
-
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1318
|
-
* amount: bigDecimal('1000'),
|
|
1319
|
-
* kind: SwapKind.SELL,
|
|
1320
|
-
* user: evmAddress('0x742d35cc...'),
|
|
2000
|
+
* fromQuote: {
|
|
2001
|
+
* quoteId: quote.quoteId,
|
|
1321
2002
|
* },
|
|
1322
2003
|
* });
|
|
1323
2004
|
*
|
|
@@ -1329,32 +2010,31 @@ type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAs
|
|
|
1329
2010
|
* // result.value: SwapReceipt
|
|
1330
2011
|
* ```
|
|
1331
2012
|
*/
|
|
1332
|
-
declare function
|
|
1333
|
-
type CancelSwapHandler = (data:
|
|
2013
|
+
declare function useTokenSwap(handler: TokenSwapHandler): UseAsyncTask<UseTokenSwapRequest, SwapReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
|
|
2014
|
+
type CancelSwapHandler = (data: SwapTypedData | TransactionRequest, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
|
|
1334
2015
|
declare class CannotCancelSwapError extends ResultAwareError {
|
|
1335
2016
|
name: "CannotCancelSwapError";
|
|
1336
2017
|
}
|
|
1337
2018
|
type CancelSwapError = CancelError | CannotCancelSwapError | SigningError | TimeoutError | TransactionError | UnexpectedError$1;
|
|
1338
2019
|
/**
|
|
1339
|
-
* @internal
|
|
1340
2020
|
* Executes the complete swap cancellation workflow combining preparation and execution.
|
|
1341
2021
|
*
|
|
1342
2022
|
* ```tsx
|
|
1343
2023
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1344
|
-
* const [
|
|
2024
|
+
* const [signTypedData] = useSignTypedData(wallet);
|
|
1345
2025
|
*
|
|
1346
|
-
* const [cancelSwap, {loading, error}] = useCancelSwap((plan
|
|
2026
|
+
* const [cancelSwap, { loading, error }] = useCancelSwap((plan) => {
|
|
1347
2027
|
* switch (plan.__typename) {
|
|
1348
2028
|
* case 'TransactionRequest':
|
|
1349
2029
|
* return sendTransaction(plan);
|
|
1350
2030
|
*
|
|
1351
|
-
* case '
|
|
1352
|
-
* return
|
|
2031
|
+
* case 'SwapTypedData':
|
|
2032
|
+
* return signTypedData(plan);
|
|
1353
2033
|
* }
|
|
1354
2034
|
* });
|
|
1355
2035
|
*
|
|
1356
2036
|
* const result = await cancelSwap({
|
|
1357
|
-
* id: swapId('123
|
|
2037
|
+
* id: swapId('123…'),
|
|
1358
2038
|
* });
|
|
1359
2039
|
*
|
|
1360
2040
|
* if (result.isErr()) {
|
|
@@ -1362,11 +2042,11 @@ type CancelSwapError = CancelError | CannotCancelSwapError | SigningError | Time
|
|
|
1362
2042
|
* return;
|
|
1363
2043
|
* }
|
|
1364
2044
|
*
|
|
1365
|
-
* // result.value:
|
|
2045
|
+
* // result.value: SwapCancelledResult
|
|
1366
2046
|
* console.log('Swap cancelled:', result.value);
|
|
1367
2047
|
* ```
|
|
1368
2048
|
*/
|
|
1369
|
-
declare function useCancelSwap(handler: CancelSwapHandler): UseAsyncTask<PrepareSwapCancelRequest,
|
|
2049
|
+
declare function useCancelSwap(handler: CancelSwapHandler): UseAsyncTask<PrepareSwapCancelRequest, SwapCancelledResult, CancelSwapError>;
|
|
1370
2050
|
|
|
1371
2051
|
/**
|
|
1372
2052
|
* A hook that provides a way to supply assets to an Aave reserve.
|
|
@@ -1377,7 +2057,10 @@ declare function useCancelSwap(handler: CancelSwapHandler): UseAsyncTask<Prepare
|
|
|
1377
2057
|
* switch (plan.__typename) {
|
|
1378
2058
|
* case 'TransactionRequest':
|
|
1379
2059
|
* return sendTransaction(plan);
|
|
1380
|
-
*
|
|
2060
|
+
*
|
|
2061
|
+
* case 'Erc20Approval':
|
|
2062
|
+
* return sendTransaction(plan.byTransaction);
|
|
2063
|
+
*
|
|
1381
2064
|
* case 'PreContractActionRequired':
|
|
1382
2065
|
* return sendTransaction(plan.transaction);
|
|
1383
2066
|
* }
|
|
@@ -1421,7 +2104,7 @@ declare function useCancelSwap(handler: CancelSwapHandler): UseAsyncTask<Prepare
|
|
|
1421
2104
|
*
|
|
1422
2105
|
* @param handler - The handler that will be used to handle the transactions.
|
|
1423
2106
|
*/
|
|
1424
|
-
declare function useSupply(handler:
|
|
2107
|
+
declare function useSupply(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, Signature | PendingTransaction>): UseAsyncTask<SupplyRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1425
2108
|
/**
|
|
1426
2109
|
* A hook that provides a way to borrow assets from an Aave reserve.
|
|
1427
2110
|
*
|
|
@@ -1431,7 +2114,7 @@ declare function useSupply(handler: TransactionHandler): UseAsyncTask<SupplyRequ
|
|
|
1431
2114
|
* switch (plan.__typename) {
|
|
1432
2115
|
* case 'TransactionRequest':
|
|
1433
2116
|
* return sendTransaction(plan);
|
|
1434
|
-
*
|
|
2117
|
+
*
|
|
1435
2118
|
* case 'PreContractActionRequired':
|
|
1436
2119
|
* return sendTransaction(plan.transaction);
|
|
1437
2120
|
* }
|
|
@@ -1475,7 +2158,7 @@ declare function useSupply(handler: TransactionHandler): UseAsyncTask<SupplyRequ
|
|
|
1475
2158
|
*
|
|
1476
2159
|
* @param handler - The handler that will be used to handle the transactions.
|
|
1477
2160
|
*/
|
|
1478
|
-
declare function useBorrow(handler:
|
|
2161
|
+
declare function useBorrow(handler: ExecutionPlanHandler<TransactionRequest | PreContractActionRequired, PendingTransaction>): UseAsyncTask<BorrowRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1479
2162
|
/**
|
|
1480
2163
|
* A hook that provides a way to repay borrowed assets to an Aave reserve.
|
|
1481
2164
|
*
|
|
@@ -1485,7 +2168,10 @@ declare function useBorrow(handler: TransactionHandler): UseAsyncTask<BorrowRequ
|
|
|
1485
2168
|
* switch (plan.__typename) {
|
|
1486
2169
|
* case 'TransactionRequest':
|
|
1487
2170
|
* return sendTransaction(plan);
|
|
1488
|
-
*
|
|
2171
|
+
*
|
|
2172
|
+
* case 'Erc20Approval':
|
|
2173
|
+
* return sendTransaction(plan.byTransaction);
|
|
2174
|
+
*
|
|
1489
2175
|
* case 'PreContractActionRequired':
|
|
1490
2176
|
* return sendTransaction(plan.transaction);
|
|
1491
2177
|
* }
|
|
@@ -1529,7 +2215,7 @@ declare function useBorrow(handler: TransactionHandler): UseAsyncTask<BorrowRequ
|
|
|
1529
2215
|
*
|
|
1530
2216
|
* @param handler - The handler that will be used to handle the transactions.
|
|
1531
2217
|
*/
|
|
1532
|
-
declare function useRepay(handler:
|
|
2218
|
+
declare function useRepay(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, Signature | PendingTransaction>): UseAsyncTask<RepayRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1533
2219
|
/**
|
|
1534
2220
|
* A hook that provides a way to withdraw supplied assets from an Aave reserve.
|
|
1535
2221
|
*
|
|
@@ -1539,7 +2225,7 @@ declare function useRepay(handler: TransactionHandler): UseAsyncTask<RepayReques
|
|
|
1539
2225
|
* switch (plan.__typename) {
|
|
1540
2226
|
* case 'TransactionRequest':
|
|
1541
2227
|
* return sendTransaction(plan);
|
|
1542
|
-
*
|
|
2228
|
+
*
|
|
1543
2229
|
* case 'PreContractActionRequired':
|
|
1544
2230
|
* return sendTransaction(plan.transaction);
|
|
1545
2231
|
* }
|
|
@@ -1583,7 +2269,7 @@ declare function useRepay(handler: TransactionHandler): UseAsyncTask<RepayReques
|
|
|
1583
2269
|
*
|
|
1584
2270
|
* @param handler - The handler that will be used to handle the transactions.
|
|
1585
2271
|
*/
|
|
1586
|
-
declare function useWithdraw(handler:
|
|
2272
|
+
declare function useWithdraw(handler: ExecutionPlanHandler<TransactionRequest | PreContractActionRequired, PendingTransaction>): UseAsyncTask<WithdrawRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1587
2273
|
/**
|
|
1588
2274
|
* A hook that provides a way to renounce a position manager of a user for a specific spoke.
|
|
1589
2275
|
*
|
|
@@ -1625,64 +2311,23 @@ declare function useWithdraw(handler: TransactionHandler): UseAsyncTask<Withdraw
|
|
|
1625
2311
|
*
|
|
1626
2312
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1627
2313
|
*/
|
|
1628
|
-
declare function useRenounceSpokeUserPositionManager(handler:
|
|
2314
|
+
declare function useRenounceSpokeUserPositionManager(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<RenounceSpokeUserPositionManagerRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1629
2315
|
/**
|
|
1630
|
-
*
|
|
2316
|
+
* Hook for updating user position conditions (dynamic config and/or risk premium).
|
|
1631
2317
|
*
|
|
1632
2318
|
* ```ts
|
|
1633
2319
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1634
|
-
* const [
|
|
2320
|
+
* const [update, { loading, error }] = useUpdateUserPositionConditions((transaction, { cancel }) => {
|
|
1635
2321
|
* return sendTransaction(transaction);
|
|
1636
2322
|
* });
|
|
1637
2323
|
*
|
|
1638
2324
|
* // …
|
|
1639
2325
|
*
|
|
1640
|
-
* const result = await
|
|
1641
|
-
*
|
|
1642
|
-
*
|
|
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);
|
|
2326
|
+
* const result = await update({
|
|
2327
|
+
* userPositionId: userPosition.id,
|
|
2328
|
+
* update: UserPositionConditionsUpdate.AllDynamicConfig,
|
|
1680
2329
|
* });
|
|
1681
2330
|
*
|
|
1682
|
-
* // …
|
|
1683
|
-
*
|
|
1684
|
-
* const result = await updateUserDynamicConfig({ ... });
|
|
1685
|
-
*
|
|
1686
2331
|
* if (result.isErr()) {
|
|
1687
2332
|
* switch (result.error.name) {
|
|
1688
2333
|
* case 'CancelError':
|
|
@@ -1713,20 +2358,24 @@ declare function useUpdateUserRiskPremium(handler: TransactionHandler): UseAsync
|
|
|
1713
2358
|
*
|
|
1714
2359
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1715
2360
|
*/
|
|
1716
|
-
declare function
|
|
2361
|
+
declare function useUpdateUserPositionConditions(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<UpdateUserPositionConditionsRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1717
2362
|
/**
|
|
1718
|
-
* Hook for
|
|
2363
|
+
* Hook for updating the collateral status of user's supplies.
|
|
1719
2364
|
*
|
|
1720
2365
|
* ```ts
|
|
1721
2366
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1722
|
-
* const [
|
|
2367
|
+
* const [setUserSuppliesAsCollateral, { loading, error }] = useSetUserSuppliesAsCollateral((transaction, { cancel }) => {
|
|
1723
2368
|
* return sendTransaction(transaction);
|
|
1724
2369
|
* });
|
|
1725
2370
|
*
|
|
1726
|
-
* const result = await
|
|
1727
|
-
*
|
|
1728
|
-
*
|
|
1729
|
-
*
|
|
2371
|
+
* const result = await setUserSuppliesAsCollateral({
|
|
2372
|
+
* changes: [
|
|
2373
|
+
* {
|
|
2374
|
+
* reserve: reserve.id,
|
|
2375
|
+
* enableCollateral: true
|
|
2376
|
+
* }
|
|
2377
|
+
* ],
|
|
2378
|
+
* sender: evmAddress('0x456...')
|
|
1730
2379
|
* });
|
|
1731
2380
|
*
|
|
1732
2381
|
* if (result.isErr()) {
|
|
@@ -1759,7 +2408,7 @@ declare function useUpdateUserDynamicConfig(handler: TransactionHandler): UseAsy
|
|
|
1759
2408
|
*
|
|
1760
2409
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1761
2410
|
*/
|
|
1762
|
-
declare function
|
|
2411
|
+
declare function useSetUserSuppliesAsCollateral(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<SetUserSuppliesAsCollateralRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1763
2412
|
/**
|
|
1764
2413
|
* A hook that provides a way to liquidate a user's position.
|
|
1765
2414
|
*
|
|
@@ -1769,7 +2418,10 @@ declare function useSetUserSupplyAsCollateral(handler: TransactionHandler): UseA
|
|
|
1769
2418
|
* switch (plan.__typename) {
|
|
1770
2419
|
* case 'TransactionRequest':
|
|
1771
2420
|
* return sendTransaction(plan);
|
|
1772
|
-
*
|
|
2421
|
+
*
|
|
2422
|
+
* case 'Erc20Approval':
|
|
2423
|
+
* return sendTransaction(plan.byTransaction);
|
|
2424
|
+
*
|
|
1773
2425
|
* case 'PreContractActionRequired':
|
|
1774
2426
|
* return sendTransaction(plan.transaction);
|
|
1775
2427
|
* }
|
|
@@ -1819,7 +2471,7 @@ declare function useSetUserSupplyAsCollateral(handler: TransactionHandler): UseA
|
|
|
1819
2471
|
*
|
|
1820
2472
|
* @param handler - The handler that will be used to handle the transactions.
|
|
1821
2473
|
*/
|
|
1822
|
-
declare function useLiquidatePosition(handler:
|
|
2474
|
+
declare function useLiquidatePosition(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, PendingTransaction | Signature>): UseAsyncTask<LiquidatePositionRequest, TxHash, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1823
2475
|
/**
|
|
1824
2476
|
* A hook that provides a way to set or remove a position manager for a user on a specific spoke.
|
|
1825
2477
|
*
|
|
@@ -1881,7 +2533,7 @@ declare function useLiquidatePosition(handler: TransactionHandler): UseAsyncTask
|
|
|
1881
2533
|
*
|
|
1882
2534
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1883
2535
|
*/
|
|
1884
|
-
declare function useSetSpokeUserPositionManager(handler:
|
|
2536
|
+
declare function useSetSpokeUserPositionManager(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<SetSpokeUserPositionManagerRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1885
2537
|
/**
|
|
1886
2538
|
* Preview the impact of a potential action on a user's position.
|
|
1887
2539
|
*
|
|
@@ -2011,7 +2663,7 @@ declare function usePreview(args: UsePreviewArgs): ReadResult<PreviewUserPositio
|
|
|
2011
2663
|
* ```
|
|
2012
2664
|
*/
|
|
2013
2665
|
declare function usePreview(args: Pausable<UsePreviewArgs>): PausableReadResult<PreviewUserPosition>;
|
|
2014
|
-
type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions>;
|
|
2666
|
+
type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2015
2667
|
/**
|
|
2016
2668
|
* Fetch paginated list of activities.
|
|
2017
2669
|
*
|
|
@@ -2093,9 +2745,55 @@ declare function useActivities(args: Pausable<UseActivitiesArgs>): PausableReadR
|
|
|
2093
2745
|
* @param options - The query options.
|
|
2094
2746
|
* @returns The user history.
|
|
2095
2747
|
*/
|
|
2096
|
-
declare function useActivitiesAction(options?:
|
|
2748
|
+
declare function useActivitiesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError>;
|
|
2749
|
+
/**
|
|
2750
|
+
* A hook that provides a way to claim rewards.
|
|
2751
|
+
*
|
|
2752
|
+
* ```ts
|
|
2753
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
2754
|
+
* const [claim, { loading, error }] = useClaimRewards((transaction, { cancel }) => {
|
|
2755
|
+
* return sendTransaction(transaction);
|
|
2756
|
+
* });
|
|
2757
|
+
*
|
|
2758
|
+
* // …
|
|
2759
|
+
*
|
|
2760
|
+
* const result = await claim({
|
|
2761
|
+
* ids: [rewardId('abc123')],
|
|
2762
|
+
* });
|
|
2763
|
+
*
|
|
2764
|
+
* if (result.isErr()) {
|
|
2765
|
+
* switch (result.error.name) {
|
|
2766
|
+
* case 'CancelError':
|
|
2767
|
+
* // The user cancelled the operation
|
|
2768
|
+
* return;
|
|
2769
|
+
*
|
|
2770
|
+
* case 'SigningError':
|
|
2771
|
+
* console.error(`Failed to sign the transaction: ${result.error.message}`);
|
|
2772
|
+
* break;
|
|
2773
|
+
*
|
|
2774
|
+
* case 'TimeoutError':
|
|
2775
|
+
* console.error(`Transaction timed out: ${result.error.message}`);
|
|
2776
|
+
* break;
|
|
2777
|
+
*
|
|
2778
|
+
* case 'TransactionError':
|
|
2779
|
+
* console.error(`Transaction failed: ${result.error.message}`);
|
|
2780
|
+
* break;
|
|
2781
|
+
*
|
|
2782
|
+
* case 'UnexpectedError':
|
|
2783
|
+
* console.error(result.error.message);
|
|
2784
|
+
* break;
|
|
2785
|
+
* }
|
|
2786
|
+
* return;
|
|
2787
|
+
* }
|
|
2788
|
+
*
|
|
2789
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
2790
|
+
* ```
|
|
2791
|
+
*
|
|
2792
|
+
* @param handler - The handler that will be used to handle the transaction.
|
|
2793
|
+
*/
|
|
2794
|
+
declare function useClaimRewards(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<ClaimRewardsRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
2097
2795
|
|
|
2098
|
-
type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions>;
|
|
2796
|
+
type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2099
2797
|
/**
|
|
2100
2798
|
* Fetch all user supply positions.
|
|
2101
2799
|
*
|
|
@@ -2208,8 +2906,8 @@ declare function useUserSupplies(args: Pausable<UseUserSuppliesArgs>): PausableR
|
|
|
2208
2906
|
* }
|
|
2209
2907
|
* ```
|
|
2210
2908
|
*/
|
|
2211
|
-
declare function useUserSuppliesAction(options?:
|
|
2212
|
-
type UseUserBorrowsArgs = Prettify<UserBorrowsRequest & CurrencyQueryOptions>;
|
|
2909
|
+
declare function useUserSuppliesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<UserSuppliesRequest, UserSupplyItem[], UnexpectedError>;
|
|
2910
|
+
type UseUserBorrowsArgs = Prettify<UserBorrowsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2213
2911
|
/**
|
|
2214
2912
|
* Fetch all user borrow positions.
|
|
2215
2913
|
*
|
|
@@ -2315,7 +3013,7 @@ declare function useUserBorrows(args: Pausable<UseUserBorrowsArgs>): PausableRea
|
|
|
2315
3013
|
* }
|
|
2316
3014
|
* ```
|
|
2317
3015
|
*/
|
|
2318
|
-
declare function useUserBorrowsAction(options?:
|
|
3016
|
+
declare function useUserBorrowsAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<UserBorrowsRequest, UserBorrowItem[], UnexpectedError>;
|
|
2319
3017
|
type UseUserSummaryArgs = Prettify<UserSummaryRequest & TimeWindowQueryOptions & CurrencyQueryOptions>;
|
|
2320
3018
|
/**
|
|
2321
3019
|
* Fetch a user's financial summary.
|
|
@@ -2578,6 +3276,69 @@ declare function useUserBalances(args: UseUserBalancesArgs): ReadResult<UserBala
|
|
|
2578
3276
|
* ```
|
|
2579
3277
|
*/
|
|
2580
3278
|
declare function useUserBalances(args: Pausable<UseUserBalancesArgs>): PausableReadResult<UserBalance[]>;
|
|
3279
|
+
type UseUserRiskPremiumBreakdownArgs = UserRiskPremiumBreakdownRequest;
|
|
3280
|
+
/**
|
|
3281
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3282
|
+
*
|
|
3283
|
+
* This signature supports React Suspense:
|
|
3284
|
+
*
|
|
3285
|
+
* ```tsx
|
|
3286
|
+
* const { data } = useUserRiskPremiumBreakdown({
|
|
3287
|
+
* query: {
|
|
3288
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3289
|
+
* },
|
|
3290
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3291
|
+
* suspense: true,
|
|
3292
|
+
* });
|
|
3293
|
+
* ```
|
|
3294
|
+
*/
|
|
3295
|
+
declare function useUserRiskPremiumBreakdown(args: UseUserRiskPremiumBreakdownArgs & Suspendable): SuspenseResult<UserRiskPremiumBreakdownItem[]>;
|
|
3296
|
+
/**
|
|
3297
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3298
|
+
*
|
|
3299
|
+
* Pausable suspense mode.
|
|
3300
|
+
*
|
|
3301
|
+
* ```tsx
|
|
3302
|
+
* const { data } = useUserRiskPremiumBreakdown({
|
|
3303
|
+
* query: {
|
|
3304
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3305
|
+
* },
|
|
3306
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3307
|
+
* suspense: true,
|
|
3308
|
+
* pause: true,
|
|
3309
|
+
* });
|
|
3310
|
+
* ```
|
|
3311
|
+
*/
|
|
3312
|
+
declare function useUserRiskPremiumBreakdown(args: Pausable<UseUserRiskPremiumBreakdownArgs> & Suspendable): PausableSuspenseResult<UserRiskPremiumBreakdownItem[]>;
|
|
3313
|
+
/**
|
|
3314
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3315
|
+
*
|
|
3316
|
+
* ```tsx
|
|
3317
|
+
* const { data, error, loading } = useUserRiskPremiumBreakdown({
|
|
3318
|
+
* query: {
|
|
3319
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3320
|
+
* },
|
|
3321
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3322
|
+
* });
|
|
3323
|
+
* ```
|
|
3324
|
+
*/
|
|
3325
|
+
declare function useUserRiskPremiumBreakdown(args: UseUserRiskPremiumBreakdownArgs): ReadResult<UserRiskPremiumBreakdownItem[]>;
|
|
3326
|
+
/**
|
|
3327
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3328
|
+
*
|
|
3329
|
+
* Pausable loading state mode.
|
|
3330
|
+
*
|
|
3331
|
+
* ```tsx
|
|
3332
|
+
* const { data, error, loading, paused } = useUserRiskPremiumBreakdown({
|
|
3333
|
+
* query: {
|
|
3334
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3335
|
+
* },
|
|
3336
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3337
|
+
* pause: true,
|
|
3338
|
+
* });
|
|
3339
|
+
* ```
|
|
3340
|
+
*/
|
|
3341
|
+
declare function useUserRiskPremiumBreakdown(args: Pausable<UseUserRiskPremiumBreakdownArgs>): PausableReadResult<UserRiskPremiumBreakdownItem[]>;
|
|
2581
3342
|
/**
|
|
2582
3343
|
* Low-level hook to execute a {@link userBalances} action directly.
|
|
2583
3344
|
*
|
|
@@ -2667,4 +3428,4 @@ declare function useUserSummaryHistory(args: UseUserSummaryHistoryArgs): ReadRes
|
|
|
2667
3428
|
*/
|
|
2668
3429
|
declare function useUserSummaryHistory(args: Pausable<UseUserSummaryHistoryArgs>): PausableReadResult<UserSummaryHistoryItem[]>;
|
|
2669
3430
|
|
|
2670
|
-
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError,
|
|
3431
|
+
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError, PendingTransactionError, type PositionSwapHandler, type PositionSwapPlan, type PositionSwapValue, SendTransactionError, type SwapHandlerOptions, type SwapSignerError, type TokenSwapHandler, type TokenSwapPlan, type UseActivitiesArgs, type UseAssetArgs, type UseAssetBorrowHistoryArgs, type UseAssetPriceHistoryArgs, type UseAssetSupplyHistoryArgs, UseAsyncTask, type UseBorrowApyHistoryArgs, type UseBorrowSwapQuoteArgs, type UseBorrowSwapRequest, type UseHubArgs, type UseHubAssetsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapStatusArgs, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserClaimableRewardsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useClaimRewards, useHub, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwapStatus, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserClaimableRewards, useUserClaimableRewardsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|