@aave/react 4.0.0-next.2 → 4.0.0-next.21
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 -4
- package/dist/chunk-YGW2LSLM.js +2 -0
- package/dist/chunk-YGW2LSLM.js.map +1 -0
- package/dist/chunk-YPQBKWEA.js +2 -0
- package/dist/chunk-YPQBKWEA.js.map +1 -0
- package/dist/ethers.cjs +1 -1
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +6 -6
- package/dist/ethers.d.ts +6 -6
- 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 +728 -164
- package/dist/index.d.ts +728 -164
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{misc-gmAnSdm5.d.ts → misc-Bqd-LTM7.d.cts} +12 -14
- package/dist/{misc-BkG5G4yl.d.cts → misc-DrMxWliM.d.ts} +12 -14
- package/dist/privy.cjs +1 -1
- package/dist/privy.cjs.map +1 -1
- package/dist/privy.d.cts +6 -6
- package/dist/privy.d.ts +6 -6
- package/dist/privy.js +1 -1
- package/dist/privy.js.map +1 -1
- package/dist/thirdweb.cjs +1 -2
- package/dist/thirdweb.cjs.map +1 -1
- package/dist/thirdweb.d.cts +6 -6
- package/dist/thirdweb.d.ts +6 -6
- package/dist/thirdweb.js +1 -2
- 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 +11 -21
- package/dist/viem/index.d.ts +11 -21
- package/dist/viem/index.js +1 -1
- package/dist/viem/index.js.map +1 -1
- package/dist/{writes-BXnwYgAQ.d.cts → writes-YQQTp7E5.d.cts} +5 -1
- package/dist/{writes-BXnwYgAQ.d.ts → writes-YQQTp7E5.d.ts} +5 -1
- package/package.json +7 -7
- package/dist/chunk-GTUQRT5Q.js +0 -2
- package/dist/chunk-GTUQRT5Q.js.map +0 -1
- package/dist/chunk-XIDOSID3.js +0 -2
- package/dist/chunk-XIDOSID3.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AaveClient, CurrencyQueryOptions,
|
|
1
|
+
import { AaveClient, CurrencyQueryOptions, TimeWindowQueryOptions, UnexpectedError, ValidationError, 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, g as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-
|
|
6
|
-
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ReserveRequest, Reserve, ReservesRequest,
|
|
7
|
-
import { Prettify, ResultAsync, ResultAwareError, TxHash } from '@aave/types';
|
|
8
|
-
import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult, d as Selector } from './misc-
|
|
9
|
-
export { e as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-
|
|
10
|
-
import { UnexpectedError as UnexpectedError$1,
|
|
4
|
+
import { a as UseAsyncTask, C as CancelOperation, P as PendingTransaction, S as SendTransactionError, b as PendingTransactionError, T as TransactionHandler } from './writes-YQQTp7E5.js';
|
|
5
|
+
export { A as AsyncTaskError, c as AsyncTaskIdle, d as AsyncTaskLoading, e as AsyncTaskState, f as AsyncTaskSuccess, g as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-YQQTp7E5.js';
|
|
6
|
+
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, ERC20PermitSignature, PrepareSwapCancelRequest, SwapCancelled, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
7
|
+
import { Prettify, Signature, ResultAsync, ResultAwareError, TxHash } from '@aave/types';
|
|
8
|
+
import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult, d as Selector } from './misc-DrMxWliM.js';
|
|
9
|
+
export { e as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-DrMxWliM.js';
|
|
10
|
+
import { UnexpectedError as UnexpectedError$1, CancelError, SigningError, TimeoutError, TransactionError, ValidationError as ValidationError$1 } 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
|
*
|
|
@@ -456,8 +511,63 @@ declare function useAssetBorrowHistory(args: UseAssetBorrowHistoryArgs): ReadRes
|
|
|
456
511
|
* ```
|
|
457
512
|
*/
|
|
458
513
|
declare function useAssetBorrowHistory(args: Pausable<UseAssetBorrowHistoryArgs>): PausableReadResult<AssetBorrowSample[]>;
|
|
514
|
+
type UseProtocolHistoryArgs = ProtocolHistoryRequest;
|
|
515
|
+
/**
|
|
516
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
517
|
+
*
|
|
518
|
+
* This signature supports React Suspense:
|
|
519
|
+
*
|
|
520
|
+
* ```tsx
|
|
521
|
+
* const { data } = useProtocolHistory({
|
|
522
|
+
* currency: Currency.Usd,
|
|
523
|
+
* window: TimeWindow.LastWeek,
|
|
524
|
+
* suspense: true,
|
|
525
|
+
* });
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
declare function useProtocolHistory(args: UseProtocolHistoryArgs & Suspendable): SuspenseResult<ProtocolHistorySample[]>;
|
|
529
|
+
/**
|
|
530
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
531
|
+
*
|
|
532
|
+
* Pausable suspense mode.
|
|
533
|
+
*
|
|
534
|
+
* ```tsx
|
|
535
|
+
* const { data } = useProtocolHistory({
|
|
536
|
+
* currency: Currency.Usd,
|
|
537
|
+
* window: TimeWindow.LastWeek,
|
|
538
|
+
* suspense: true,
|
|
539
|
+
* pause: true,
|
|
540
|
+
* });
|
|
541
|
+
* ```
|
|
542
|
+
*/
|
|
543
|
+
declare function useProtocolHistory(args: Pausable<UseProtocolHistoryArgs> & Suspendable): PausableSuspenseResult<ProtocolHistorySample[]>;
|
|
544
|
+
/**
|
|
545
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
546
|
+
*
|
|
547
|
+
* ```tsx
|
|
548
|
+
* const { data, error, loading } = useProtocolHistory({
|
|
549
|
+
* currency: Currency.Usd,
|
|
550
|
+
* window: TimeWindow.LastWeek,
|
|
551
|
+
* });
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
declare function useProtocolHistory(args: UseProtocolHistoryArgs): ReadResult<ProtocolHistorySample[]>;
|
|
555
|
+
/**
|
|
556
|
+
* Fetch historical protocol-wide data (deposits, borrows, earnings).
|
|
557
|
+
*
|
|
558
|
+
* Pausable loading state mode.
|
|
559
|
+
*
|
|
560
|
+
* ```tsx
|
|
561
|
+
* const { data, error, loading, paused } = useProtocolHistory({
|
|
562
|
+
* currency: Currency.Usd,
|
|
563
|
+
* window: TimeWindow.LastWeek,
|
|
564
|
+
* pause: true,
|
|
565
|
+
* });
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
568
|
+
declare function useProtocolHistory(args: Pausable<UseProtocolHistoryArgs>): PausableReadResult<ProtocolHistorySample[]>;
|
|
459
569
|
|
|
460
|
-
type UseReserveArgs = Prettify<ReserveRequest & CurrencyQueryOptions>;
|
|
570
|
+
type UseReserveArgs = Prettify<ReserveRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
461
571
|
/**
|
|
462
572
|
* Fetch a specific reserve by reserve ID, spoke, and chain.
|
|
463
573
|
*
|
|
@@ -537,8 +647,8 @@ declare function useReserve(args: Pausable<UseReserveArgs>): PausableReadResult<
|
|
|
537
647
|
* }
|
|
538
648
|
* ```
|
|
539
649
|
*/
|
|
540
|
-
declare function useReserveAction(options?:
|
|
541
|
-
type UseReservesArgs<T = Reserve[]> = Prettify<ReservesRequest & CurrencyQueryOptions & {
|
|
650
|
+
declare function useReserveAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ReserveRequest, Reserve | null, UnexpectedError>;
|
|
651
|
+
type UseReservesArgs<T = Reserve[]> = Prettify<ReservesRequest & CurrencyQueryOptions & TimeWindowQueryOptions & {
|
|
542
652
|
/**
|
|
543
653
|
* A function that maps the full list of reserves
|
|
544
654
|
* into a derived or narrowed value.
|
|
@@ -737,8 +847,8 @@ declare function useReserves<T = Reserve[]>(args: Pausable<UseReservesArgs<T>>):
|
|
|
737
847
|
* }
|
|
738
848
|
* ```
|
|
739
849
|
*/
|
|
740
|
-
declare function useReservesAction(options?:
|
|
741
|
-
type UseBorrowApyHistoryArgs =
|
|
850
|
+
declare function useReservesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ReservesRequest, Reserve[], UnexpectedError>;
|
|
851
|
+
type UseBorrowApyHistoryArgs = BorrowApyHistoryRequest;
|
|
742
852
|
/**
|
|
743
853
|
* Fetch borrow APY history for a specific reserve over time.
|
|
744
854
|
*
|
|
@@ -752,7 +862,7 @@ type UseBorrowApyHistoryArgs = BorrowAPYHistoryRequest;
|
|
|
752
862
|
* });
|
|
753
863
|
* ```
|
|
754
864
|
*/
|
|
755
|
-
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs & Suspendable): SuspenseResult<
|
|
865
|
+
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs & Suspendable): SuspenseResult<ApySample[]>;
|
|
756
866
|
/**
|
|
757
867
|
* Fetch borrow APY history for a specific reserve over time.
|
|
758
868
|
*
|
|
@@ -767,7 +877,7 @@ declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs & Suspendable
|
|
|
767
877
|
* });
|
|
768
878
|
* ```
|
|
769
879
|
*/
|
|
770
|
-
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs> & Suspendable): PausableSuspenseResult<
|
|
880
|
+
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs> & Suspendable): PausableSuspenseResult<ApySample[]>;
|
|
771
881
|
/**
|
|
772
882
|
* Fetch borrow APY history for a specific reserve over time.
|
|
773
883
|
*
|
|
@@ -778,7 +888,7 @@ declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs> & S
|
|
|
778
888
|
* });
|
|
779
889
|
* ```
|
|
780
890
|
*/
|
|
781
|
-
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs): ReadResult<
|
|
891
|
+
declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs): ReadResult<ApySample[]>;
|
|
782
892
|
/**
|
|
783
893
|
* Fetch borrow APY history for a specific reserve over time.
|
|
784
894
|
*
|
|
@@ -792,8 +902,8 @@ declare function useBorrowApyHistory(args: UseBorrowApyHistoryArgs): ReadResult<
|
|
|
792
902
|
* });
|
|
793
903
|
* ```
|
|
794
904
|
*/
|
|
795
|
-
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs>): PausableReadResult<
|
|
796
|
-
type UseSupplyApyHistoryArgs =
|
|
905
|
+
declare function useBorrowApyHistory(args: Pausable<UseBorrowApyHistoryArgs>): PausableReadResult<ApySample[]>;
|
|
906
|
+
type UseSupplyApyHistoryArgs = SupplyApyHistoryRequest;
|
|
797
907
|
/**
|
|
798
908
|
* Fetch supply APY history for a specific reserve over time.
|
|
799
909
|
*
|
|
@@ -807,7 +917,7 @@ type UseSupplyApyHistoryArgs = SupplyAPYHistoryRequest;
|
|
|
807
917
|
* });
|
|
808
918
|
* ```
|
|
809
919
|
*/
|
|
810
|
-
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs & Suspendable): SuspenseResult<
|
|
920
|
+
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs & Suspendable): SuspenseResult<ApySample[]>;
|
|
811
921
|
/**
|
|
812
922
|
* Fetch supply APY history for a specific reserve over time.
|
|
813
923
|
*
|
|
@@ -822,7 +932,7 @@ declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs & Suspendable
|
|
|
822
932
|
* });
|
|
823
933
|
* ```
|
|
824
934
|
*/
|
|
825
|
-
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs> & Suspendable): PausableSuspenseResult<
|
|
935
|
+
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs> & Suspendable): PausableSuspenseResult<ApySample[]>;
|
|
826
936
|
/**
|
|
827
937
|
* Fetch supply APY history for a specific reserve over time.
|
|
828
938
|
*
|
|
@@ -833,7 +943,7 @@ declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs> & S
|
|
|
833
943
|
* });
|
|
834
944
|
* ```
|
|
835
945
|
*/
|
|
836
|
-
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs): ReadResult<
|
|
946
|
+
declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs): ReadResult<ApySample[]>;
|
|
837
947
|
/**
|
|
838
948
|
* Fetch supply APY history for a specific reserve over time.
|
|
839
949
|
*
|
|
@@ -847,7 +957,7 @@ declare function useSupplyApyHistory(args: UseSupplyApyHistoryArgs): ReadResult<
|
|
|
847
957
|
* });
|
|
848
958
|
* ```
|
|
849
959
|
*/
|
|
850
|
-
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs>): PausableReadResult<
|
|
960
|
+
declare function useSupplyApyHistory(args: Pausable<UseSupplyApyHistoryArgs>): PausableReadResult<ApySample[]>;
|
|
851
961
|
|
|
852
962
|
type UseSpokeArgs = SpokeRequest;
|
|
853
963
|
/**
|
|
@@ -1060,100 +1170,106 @@ declare function useSpokeUserPositionManagers(args: UseSpokeUserPositionManagers
|
|
|
1060
1170
|
*/
|
|
1061
1171
|
declare function useSpokeUserPositionManagers(args: Pausable<UseSpokeUserPositionManagersArgs>): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1062
1172
|
|
|
1063
|
-
type
|
|
1173
|
+
type UseTokenSwapQuoteArgs = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1064
1174
|
/**
|
|
1065
|
-
* @internal
|
|
1066
1175
|
* Fetch a swap quote for the specified trade parameters.
|
|
1067
1176
|
*
|
|
1068
1177
|
* This signature supports React Suspense:
|
|
1069
1178
|
*
|
|
1070
1179
|
* ```tsx
|
|
1071
|
-
* const { data } =
|
|
1180
|
+
* const { data } = useTokenSwapQuote({
|
|
1181
|
+
* market: {
|
|
1182
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1183
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1184
|
+
* amount: bigDecimal('1000'),
|
|
1185
|
+
* kind: SwapKind.Sell,
|
|
1186
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1187
|
+
* },
|
|
1072
1188
|
* chainId: chainId(1),
|
|
1073
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6...') },
|
|
1074
|
-
* sell: { erc20: evmAddress('0x6B175474E...') },
|
|
1075
|
-
* amount: bigDecimal('1000'),
|
|
1076
|
-
* kind: SwapKind.SELL,
|
|
1077
1189
|
* suspense: true,
|
|
1078
1190
|
* });
|
|
1079
1191
|
* ```
|
|
1080
1192
|
*/
|
|
1081
|
-
declare function
|
|
1193
|
+
declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1082
1194
|
/**
|
|
1083
|
-
* @internal
|
|
1084
1195
|
* Fetch a swap quote for the specified trade parameters.
|
|
1085
1196
|
*
|
|
1086
1197
|
* Pausable suspense mode.
|
|
1087
1198
|
*
|
|
1088
1199
|
* ```tsx
|
|
1089
|
-
* const { data } =
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1200
|
+
* const { data } = useTokenSwapQuote({
|
|
1201
|
+
* market: {
|
|
1202
|
+
* chainId: chainId(1),
|
|
1203
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1204
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1205
|
+
* amount: bigDecimal('1000'),
|
|
1206
|
+
* kind: SwapKind.Sell,
|
|
1207
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1208
|
+
* },
|
|
1096
1209
|
* suspense: true,
|
|
1097
1210
|
* pause: true,
|
|
1098
1211
|
* });
|
|
1099
1212
|
* ```
|
|
1100
1213
|
*/
|
|
1101
|
-
declare function
|
|
1214
|
+
declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1102
1215
|
/**
|
|
1103
|
-
* @internal
|
|
1104
1216
|
* Fetch a swap quote for the specified trade parameters.
|
|
1105
1217
|
*
|
|
1106
1218
|
* ```tsx
|
|
1107
|
-
* const { data, error, loading } =
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1219
|
+
* const { data, error, loading } = useTokenSwapQuote({
|
|
1220
|
+
* market: {
|
|
1221
|
+
* chainId: chainId(1),
|
|
1222
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1223
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1224
|
+
* amount: bigDecimal('1000'),
|
|
1225
|
+
* kind: SwapKind.Sell,
|
|
1226
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1227
|
+
* },
|
|
1113
1228
|
* });
|
|
1114
1229
|
* ```
|
|
1115
1230
|
*/
|
|
1116
|
-
declare function
|
|
1231
|
+
declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1117
1232
|
/**
|
|
1118
|
-
* @internal
|
|
1119
1233
|
* Fetch a swap quote for the specified trade parameters.
|
|
1120
1234
|
*
|
|
1121
1235
|
* Pausable loading state mode.
|
|
1122
1236
|
*
|
|
1123
1237
|
* ```tsx
|
|
1124
|
-
* const { data, error, loading, paused } =
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1238
|
+
* const { data, error, loading, paused } = useTokenSwapQuote({
|
|
1239
|
+
* market: {
|
|
1240
|
+
* chainId: chainId(1),
|
|
1241
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1242
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1243
|
+
* amount: bigDecimal('1000'),
|
|
1244
|
+
* kind: SwapKind.Sell,
|
|
1245
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1246
|
+
* },
|
|
1131
1247
|
* pause: true,
|
|
1132
1248
|
* });
|
|
1133
1249
|
* ```
|
|
1134
1250
|
*/
|
|
1135
|
-
declare function
|
|
1251
|
+
declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1136
1252
|
/**
|
|
1137
|
-
* @internal
|
|
1138
1253
|
* Low-level hook to execute a swap quote action directly.
|
|
1139
1254
|
*
|
|
1140
|
-
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
1141
1255
|
* @remarks
|
|
1142
1256
|
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1143
1257
|
* Use this hook to retrieve quotes on demand as part of a larger workflow
|
|
1144
1258
|
* (e.g., in an event handler to get a fresh quote before executing a swap).
|
|
1145
1259
|
*
|
|
1146
1260
|
* ```ts
|
|
1147
|
-
* const [getQuote, { called, data, error, loading }] =
|
|
1261
|
+
* const [getQuote, { called, data, error, loading }] = useTokenSwapQuoteAction();
|
|
1148
1262
|
*
|
|
1149
1263
|
* // …
|
|
1150
1264
|
*
|
|
1151
1265
|
* const result = await getQuote({
|
|
1152
|
-
*
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1266
|
+
* market: {
|
|
1267
|
+
* chainId: chainId(1),
|
|
1268
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1269
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1270
|
+
* amount: bigDecimal('1000'),
|
|
1271
|
+
* kind: SwapKind.Sell,
|
|
1272
|
+
* },
|
|
1157
1273
|
* });
|
|
1158
1274
|
*
|
|
1159
1275
|
* if (result.isOk()) {
|
|
@@ -1163,10 +1279,9 @@ declare function useSwapQuote(args: Pausable<UseSwapQuoteArgs>): PausableReadRes
|
|
|
1163
1279
|
* }
|
|
1164
1280
|
* ```
|
|
1165
1281
|
*/
|
|
1166
|
-
declare function
|
|
1282
|
+
declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<TokenSwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1167
1283
|
type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
1168
1284
|
/**
|
|
1169
|
-
* @internal
|
|
1170
1285
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1171
1286
|
*
|
|
1172
1287
|
* This signature supports React Suspense:
|
|
@@ -1180,7 +1295,6 @@ type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
|
1180
1295
|
*/
|
|
1181
1296
|
declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable): SuspenseResult<Token[]>;
|
|
1182
1297
|
/**
|
|
1183
|
-
* @internal
|
|
1184
1298
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1185
1299
|
*
|
|
1186
1300
|
* Pausable suspense mode.
|
|
@@ -1195,7 +1309,6 @@ declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable):
|
|
|
1195
1309
|
*/
|
|
1196
1310
|
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Suspendable): PausableSuspenseResult<Token[]>;
|
|
1197
1311
|
/**
|
|
1198
|
-
* @internal
|
|
1199
1312
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1200
1313
|
*
|
|
1201
1314
|
* ```tsx
|
|
@@ -1206,7 +1319,6 @@ declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Sus
|
|
|
1206
1319
|
*/
|
|
1207
1320
|
declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<Token[]>;
|
|
1208
1321
|
/**
|
|
1209
|
-
* @internal
|
|
1210
1322
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1211
1323
|
*
|
|
1212
1324
|
* Pausable loading state mode.
|
|
@@ -1219,9 +1331,8 @@ declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<To
|
|
|
1219
1331
|
* ```
|
|
1220
1332
|
*/
|
|
1221
1333
|
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs>): PausableReadResult<Token[]>;
|
|
1222
|
-
type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
1334
|
+
type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1223
1335
|
/**
|
|
1224
|
-
* @internal
|
|
1225
1336
|
* Fetch the user's swap history for a specific chain.
|
|
1226
1337
|
*
|
|
1227
1338
|
* This signature supports React Suspense:
|
|
@@ -1229,7 +1340,7 @@ type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
|
1229
1340
|
* ```tsx
|
|
1230
1341
|
* const { data } = useUserSwaps({
|
|
1231
1342
|
* chainId: chainId(1),
|
|
1232
|
-
* user: evmAddress('0x742d35cc
|
|
1343
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1233
1344
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1234
1345
|
* suspense: true,
|
|
1235
1346
|
* });
|
|
@@ -1237,7 +1348,6 @@ type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
|
1237
1348
|
*/
|
|
1238
1349
|
declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseResult<PaginatedUserSwapsResult>;
|
|
1239
1350
|
/**
|
|
1240
|
-
* @internal
|
|
1241
1351
|
* Fetch the user's swap history for a specific chain.
|
|
1242
1352
|
*
|
|
1243
1353
|
* Pausable suspense mode.
|
|
@@ -1245,7 +1355,7 @@ declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseRes
|
|
|
1245
1355
|
* ```tsx
|
|
1246
1356
|
* const { data } = useUserSwaps({
|
|
1247
1357
|
* chainId: chainId(1),
|
|
1248
|
-
* user: evmAddress('0x742d35cc
|
|
1358
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1249
1359
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1250
1360
|
* suspense: true,
|
|
1251
1361
|
* pause: true,
|
|
@@ -1254,20 +1364,18 @@ declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseRes
|
|
|
1254
1364
|
*/
|
|
1255
1365
|
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs> & Suspendable): PausableSuspenseResult<PaginatedUserSwapsResult>;
|
|
1256
1366
|
/**
|
|
1257
|
-
* @internal
|
|
1258
1367
|
* Fetch the user's swap history for a specific chain.
|
|
1259
1368
|
*
|
|
1260
1369
|
* ```tsx
|
|
1261
1370
|
* const { data, error, loading } = useUserSwaps({
|
|
1262
1371
|
* chainId: chainId(1),
|
|
1263
|
-
* user: evmAddress('0x742d35cc
|
|
1372
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1264
1373
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1265
1374
|
* });
|
|
1266
1375
|
* ```
|
|
1267
1376
|
*/
|
|
1268
1377
|
declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserSwapsResult>;
|
|
1269
1378
|
/**
|
|
1270
|
-
* @internal
|
|
1271
1379
|
* Fetch the user's swap history for a specific chain.
|
|
1272
1380
|
*
|
|
1273
1381
|
* Pausable loading state mode.
|
|
@@ -1275,36 +1383,467 @@ declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserS
|
|
|
1275
1383
|
* ```tsx
|
|
1276
1384
|
* const { data, error, loading, paused } = useUserSwaps({
|
|
1277
1385
|
* chainId: chainId(1),
|
|
1278
|
-
* user: evmAddress('0x742d35cc
|
|
1386
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1279
1387
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1280
1388
|
* pause: true,
|
|
1281
1389
|
* });
|
|
1282
1390
|
* ```
|
|
1283
1391
|
*/
|
|
1284
1392
|
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
|
|
1285
|
-
type
|
|
1286
|
-
|
|
1393
|
+
type UseSupplySwapQuoteArgs = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1396
|
+
*
|
|
1397
|
+
* This signature supports React Suspense:
|
|
1398
|
+
*
|
|
1399
|
+
* ```tsx
|
|
1400
|
+
* const { data } = useSupplySwapQuote({
|
|
1401
|
+
* market: {
|
|
1402
|
+
* sellPosition: userSupplyItem.id,
|
|
1403
|
+
* buyReserve: reserve.id,
|
|
1404
|
+
* amount: bigDecimal('1000'),
|
|
1405
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1406
|
+
* },
|
|
1407
|
+
* suspense: true,
|
|
1408
|
+
* });
|
|
1409
|
+
* ```
|
|
1410
|
+
*/
|
|
1411
|
+
declare function useSupplySwapQuote(args: UseSupplySwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1412
|
+
/**
|
|
1413
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1414
|
+
*
|
|
1415
|
+
* Pausable suspense mode.
|
|
1416
|
+
*
|
|
1417
|
+
* ```tsx
|
|
1418
|
+
* const { data } = useSupplySwapQuote({
|
|
1419
|
+
* market: {
|
|
1420
|
+
* sellPosition: userSupplyItem.id,
|
|
1421
|
+
* buyReserve: reserve.id,
|
|
1422
|
+
* amount: bigDecimal('1000'),
|
|
1423
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1424
|
+
* },
|
|
1425
|
+
* suspense: true,
|
|
1426
|
+
* pause: true,
|
|
1427
|
+
* });
|
|
1428
|
+
* ```
|
|
1429
|
+
*/
|
|
1430
|
+
declare function useSupplySwapQuote(args: Pausable<UseSupplySwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1433
|
+
*
|
|
1434
|
+
* ```tsx
|
|
1435
|
+
* const { data, error, loading } = useSupplySwapQuote({
|
|
1436
|
+
* market: {
|
|
1437
|
+
* sellPosition: userSupplyItem.id,
|
|
1438
|
+
* buyReserve: reserve.id,
|
|
1439
|
+
* amount: bigDecimal('1000'),
|
|
1440
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1441
|
+
* },
|
|
1442
|
+
* });
|
|
1443
|
+
* ```
|
|
1444
|
+
*/
|
|
1445
|
+
declare function useSupplySwapQuote(args: UseSupplySwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1446
|
+
/**
|
|
1447
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1448
|
+
*
|
|
1449
|
+
* Pausable loading state mode.
|
|
1450
|
+
*
|
|
1451
|
+
* ```tsx
|
|
1452
|
+
* const { data, error, loading, paused } = useSupplySwapQuote({
|
|
1453
|
+
* market: {
|
|
1454
|
+
* sellPosition: userSupplyItem.id,
|
|
1455
|
+
* buyReserve: reserve.id,
|
|
1456
|
+
* amount: bigDecimal('1000'),
|
|
1457
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1458
|
+
* },
|
|
1459
|
+
* pause: true,
|
|
1460
|
+
* });
|
|
1461
|
+
* ```
|
|
1462
|
+
*/
|
|
1463
|
+
declare function useSupplySwapQuote(args: Pausable<UseSupplySwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1464
|
+
/**
|
|
1465
|
+
* Low-level hook to execute a supply swap quote action directly.
|
|
1466
|
+
*
|
|
1467
|
+
* @remarks
|
|
1468
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1469
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1470
|
+
*
|
|
1471
|
+
* ```ts
|
|
1472
|
+
* const [getQuote, { called, data, error, loading }] = useSupplySwapQuoteAction();
|
|
1473
|
+
*
|
|
1474
|
+
* // …
|
|
1475
|
+
*
|
|
1476
|
+
* const result = await getQuote({
|
|
1477
|
+
* sellPosition: userSupplyItem.id,
|
|
1478
|
+
* buyReserve: reserve.id,
|
|
1479
|
+
* amount: bigDecimal('1000'),
|
|
1480
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1481
|
+
* });
|
|
1482
|
+
*
|
|
1483
|
+
* if (result.isOk()) {
|
|
1484
|
+
* console.log('Supply swap quote:', result.value);
|
|
1485
|
+
* } else {
|
|
1486
|
+
* console.error(result.error);
|
|
1487
|
+
* }
|
|
1488
|
+
* ```
|
|
1489
|
+
*/
|
|
1490
|
+
declare function useSupplySwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<SupplySwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1491
|
+
type UseBorrowSwapQuoteArgs = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1492
|
+
/**
|
|
1493
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1494
|
+
*
|
|
1495
|
+
* This signature supports React Suspense:
|
|
1496
|
+
*
|
|
1497
|
+
* ```tsx
|
|
1498
|
+
* const { data } = useBorrowSwapQuote({
|
|
1499
|
+
* market: {
|
|
1500
|
+
* sellPosition: userBorrowItem.id,
|
|
1501
|
+
* buyReserve: reserve.id,
|
|
1502
|
+
* amount: bigDecimal('1000'),
|
|
1503
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1504
|
+
* },
|
|
1505
|
+
* suspense: true,
|
|
1506
|
+
* });
|
|
1507
|
+
* ```
|
|
1508
|
+
*/
|
|
1509
|
+
declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1512
|
+
*
|
|
1513
|
+
* Pausable suspense mode.
|
|
1514
|
+
*
|
|
1515
|
+
* ```tsx
|
|
1516
|
+
* const { data } = useBorrowSwapQuote({
|
|
1517
|
+
* market: {
|
|
1518
|
+
* sellPosition: userBorrowItem.id,
|
|
1519
|
+
* buyReserve: reserve.id,
|
|
1520
|
+
* amount: bigDecimal('1000'),
|
|
1521
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1522
|
+
* },
|
|
1523
|
+
* suspense: true,
|
|
1524
|
+
* pause: true,
|
|
1525
|
+
* });
|
|
1526
|
+
* ```
|
|
1527
|
+
*/
|
|
1528
|
+
declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1531
|
+
*
|
|
1532
|
+
* ```tsx
|
|
1533
|
+
* const { data, error, loading } = useBorrowSwapQuote({
|
|
1534
|
+
* market: {
|
|
1535
|
+
* sellPosition: userBorrowItem.id,
|
|
1536
|
+
* buyReserve: reserve.id,
|
|
1537
|
+
* amount: bigDecimal('1000'),
|
|
1538
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1539
|
+
* },
|
|
1540
|
+
* });
|
|
1541
|
+
* ```
|
|
1542
|
+
*/
|
|
1543
|
+
declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1546
|
+
*
|
|
1547
|
+
* Pausable loading state mode.
|
|
1548
|
+
*
|
|
1549
|
+
* ```tsx
|
|
1550
|
+
* const { data, error, loading, paused } = useBorrowSwapQuote({
|
|
1551
|
+
* market: {
|
|
1552
|
+
* sellPosition: userBorrowItem.id,
|
|
1553
|
+
* buyReserve: reserve.id,
|
|
1554
|
+
* amount: bigDecimal('1000'),
|
|
1555
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1556
|
+
* },
|
|
1557
|
+
* pause: true,
|
|
1558
|
+
* });
|
|
1559
|
+
* ```
|
|
1560
|
+
*/
|
|
1561
|
+
declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Low-level hook to execute a borrow swap quote action directly.
|
|
1564
|
+
*
|
|
1565
|
+
* @remarks
|
|
1566
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1567
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1568
|
+
*
|
|
1569
|
+
* ```ts
|
|
1570
|
+
* const [getQuote, { called, data, error, loading }] = useBorrowSwapQuoteAction();
|
|
1571
|
+
*
|
|
1572
|
+
* // …
|
|
1573
|
+
*
|
|
1574
|
+
* const result = await getQuote({
|
|
1575
|
+
* debtPosition: userBorrowItem.id,
|
|
1576
|
+
* buyReserve: reserve.id,
|
|
1577
|
+
* amount: bigDecimal('1000'),
|
|
1578
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1579
|
+
* });
|
|
1580
|
+
*
|
|
1581
|
+
* if (result.isOk()) {
|
|
1582
|
+
* console.log('Borrow swap quote:', result.value);
|
|
1583
|
+
* } else {
|
|
1584
|
+
* console.error(result.error);
|
|
1585
|
+
* }
|
|
1586
|
+
* ```
|
|
1587
|
+
*/
|
|
1588
|
+
declare function useBorrowSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<BorrowSwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1287
1589
|
type SwapHandlerOptions = {
|
|
1288
1590
|
cancel: CancelOperation;
|
|
1289
1591
|
};
|
|
1290
|
-
type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAsync<ERC20PermitSignature | SwapReceipt, SendTransactionError | PendingTransactionError>;
|
|
1291
1592
|
/**
|
|
1292
|
-
|
|
1593
|
+
*/
|
|
1594
|
+
type UseSwapSignerRequest = TransactionRequest;
|
|
1595
|
+
/**
|
|
1596
|
+
*/
|
|
1597
|
+
type SwapSignerError = CancelError | SigningError | UnexpectedError$1;
|
|
1598
|
+
/**
|
|
1599
|
+
*/
|
|
1600
|
+
type UseSwapSignerResult = UseAsyncTask<UseSwapSignerRequest, PendingTransaction | Signature, SwapSignerError>;
|
|
1601
|
+
type PositionSwapPlan = PositionSwapApproval | SwapTypedData;
|
|
1602
|
+
type PositionSwapHandler = (plan: PositionSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
|
|
1603
|
+
type PositionSwapValue = {
|
|
1604
|
+
quote?: SwapQuote;
|
|
1605
|
+
};
|
|
1606
|
+
/**
|
|
1607
|
+
*/
|
|
1608
|
+
type UseSupplySwapRequest = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1609
|
+
/**
|
|
1610
|
+
*/
|
|
1611
|
+
declare function useSupplySwap(handler: PositionSwapHandler): UseAsyncTask<SupplySwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1612
|
+
/**
|
|
1613
|
+
*/
|
|
1614
|
+
type UseBorrowSwapRequest = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1615
|
+
/**
|
|
1616
|
+
*/
|
|
1617
|
+
declare function useBorrowSwap(handler: PositionSwapHandler): UseAsyncTask<BorrowSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1618
|
+
type UseRepayWithSupplyQuoteArgs = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
|
|
1619
|
+
/**
|
|
1620
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1621
|
+
*
|
|
1622
|
+
* This signature supports React Suspense:
|
|
1623
|
+
*
|
|
1624
|
+
* ```tsx
|
|
1625
|
+
* const { data } = useRepayWithSupplyQuote({
|
|
1626
|
+
* market: {
|
|
1627
|
+
* sellPosition: userSupplyItem.id,
|
|
1628
|
+
* buyPosition: userBorrowItem.id,
|
|
1629
|
+
* amount: bigDecimal('1000'),
|
|
1630
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1631
|
+
* },
|
|
1632
|
+
* suspense: true,
|
|
1633
|
+
* });
|
|
1634
|
+
* ```
|
|
1635
|
+
*/
|
|
1636
|
+
declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1637
|
+
/**
|
|
1638
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1639
|
+
*
|
|
1640
|
+
* Pausable suspense mode.
|
|
1641
|
+
*
|
|
1642
|
+
* ```tsx
|
|
1643
|
+
* const { data } = useRepayWithSupplyQuote({
|
|
1644
|
+
* market: {
|
|
1645
|
+
* sellPosition: userSupplyItem.id,
|
|
1646
|
+
* buyPosition: userBorrowItem.id,
|
|
1647
|
+
* amount: bigDecimal('1000'),
|
|
1648
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1649
|
+
* },
|
|
1650
|
+
* suspense: true,
|
|
1651
|
+
* pause: true,
|
|
1652
|
+
* });
|
|
1653
|
+
* ```
|
|
1654
|
+
*/
|
|
1655
|
+
declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1658
|
+
*
|
|
1659
|
+
* ```tsx
|
|
1660
|
+
* const { data, error, loading } = useRepayWithSupplyQuote({
|
|
1661
|
+
* market: {
|
|
1662
|
+
* sellPosition: userSupplyItem.id,
|
|
1663
|
+
* buyPosition: userBorrowItem.id,
|
|
1664
|
+
* amount: bigDecimal('1000'),
|
|
1665
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1666
|
+
* },
|
|
1667
|
+
* });
|
|
1668
|
+
* ```
|
|
1669
|
+
*/
|
|
1670
|
+
declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs): ReadResult<SwapQuote>;
|
|
1671
|
+
/**
|
|
1672
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1673
|
+
*
|
|
1674
|
+
* Pausable loading state mode.
|
|
1675
|
+
*
|
|
1676
|
+
* ```tsx
|
|
1677
|
+
* const { data, error, loading, paused } = useRepayWithSupplyQuote({
|
|
1678
|
+
* market: {
|
|
1679
|
+
* sellPosition: userSupplyItem.id,
|
|
1680
|
+
* buyPosition: userBorrowItem.id,
|
|
1681
|
+
* amount: bigDecimal('1000'),
|
|
1682
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1683
|
+
* },
|
|
1684
|
+
* pause: true,
|
|
1685
|
+
* });
|
|
1686
|
+
* ```
|
|
1687
|
+
*/
|
|
1688
|
+
declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1689
|
+
/**
|
|
1690
|
+
* Low-level hook to execute a repay with supply quote action directly.
|
|
1691
|
+
*
|
|
1692
|
+
* @remarks
|
|
1693
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1694
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1695
|
+
*
|
|
1696
|
+
* ```ts
|
|
1697
|
+
* const [getQuote, { called, data, error, loading }] = useRepayWithSupplyQuoteAction();
|
|
1698
|
+
*
|
|
1699
|
+
* // …
|
|
1700
|
+
*
|
|
1701
|
+
* const result = await getQuote({
|
|
1702
|
+
* repayWithReserve: reserve.id,
|
|
1703
|
+
* debtPosition: userBorrowItem.id,
|
|
1704
|
+
* amount: bigDecimal('1000'),
|
|
1705
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1706
|
+
* });
|
|
1707
|
+
*
|
|
1708
|
+
* if (result.isOk()) {
|
|
1709
|
+
* console.log('Repay with supply quote:', result.value);
|
|
1710
|
+
* } else {
|
|
1711
|
+
* console.error(result.error);
|
|
1712
|
+
* }
|
|
1713
|
+
* ```
|
|
1714
|
+
*/
|
|
1715
|
+
declare function useRepayWithSupplyQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1716
|
+
/**
|
|
1717
|
+
*/
|
|
1718
|
+
type UseRepayWithSupplyRequest = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
|
|
1719
|
+
/**
|
|
1720
|
+
*/
|
|
1721
|
+
declare function useRepayWithSupply(handler: PositionSwapHandler): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1722
|
+
type UseWithdrawSwapQuoteArgs = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1723
|
+
/**
|
|
1724
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1725
|
+
*
|
|
1726
|
+
* This signature supports React Suspense:
|
|
1727
|
+
*
|
|
1728
|
+
* ```tsx
|
|
1729
|
+
* const { data } = useWithdrawSwapQuote({
|
|
1730
|
+
* market: {
|
|
1731
|
+
* position: userSupplyItem.id,
|
|
1732
|
+
* buyReserve: reserve.id,
|
|
1733
|
+
* amount: bigDecimal('1000'),
|
|
1734
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1735
|
+
* },
|
|
1736
|
+
* suspense: true,
|
|
1737
|
+
* });
|
|
1738
|
+
* ```
|
|
1739
|
+
*/
|
|
1740
|
+
declare function useWithdrawSwapQuote(args: UseWithdrawSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1741
|
+
/**
|
|
1742
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1743
|
+
*
|
|
1744
|
+
* Pausable suspense mode.
|
|
1745
|
+
*
|
|
1746
|
+
* ```tsx
|
|
1747
|
+
* const { data } = useWithdrawSwapQuote({
|
|
1748
|
+
* market: {
|
|
1749
|
+
* position: userSupplyItem.id,
|
|
1750
|
+
* buyReserve: reserve.id,
|
|
1751
|
+
* amount: bigDecimal('1000'),
|
|
1752
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1753
|
+
* },
|
|
1754
|
+
* suspense: true,
|
|
1755
|
+
* pause: true,
|
|
1756
|
+
* });
|
|
1757
|
+
* ```
|
|
1758
|
+
*/
|
|
1759
|
+
declare function useWithdrawSwapQuote(args: Pausable<UseWithdrawSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1760
|
+
/**
|
|
1761
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1762
|
+
*
|
|
1763
|
+
* ```tsx
|
|
1764
|
+
* const { data, error, loading } = useWithdrawSwapQuote({
|
|
1765
|
+
* market: {
|
|
1766
|
+
* position: userSupplyItem.id,
|
|
1767
|
+
* buyReserve: reserve.id,
|
|
1768
|
+
* amount: bigDecimal('1000'),
|
|
1769
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1770
|
+
* },
|
|
1771
|
+
* });
|
|
1772
|
+
* ```
|
|
1773
|
+
*/
|
|
1774
|
+
declare function useWithdrawSwapQuote(args: UseWithdrawSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1775
|
+
/**
|
|
1776
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1777
|
+
*
|
|
1778
|
+
* Pausable loading state mode.
|
|
1779
|
+
*
|
|
1780
|
+
* ```tsx
|
|
1781
|
+
* const { data, error, loading, paused } = useWithdrawSwapQuote({
|
|
1782
|
+
* market: {
|
|
1783
|
+
* position: userSupplyItem.id,
|
|
1784
|
+
* buyReserve: reserve.id,
|
|
1785
|
+
* amount: bigDecimal('1000'),
|
|
1786
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1787
|
+
* },
|
|
1788
|
+
* pause: true,
|
|
1789
|
+
* });
|
|
1790
|
+
* ```
|
|
1791
|
+
*/
|
|
1792
|
+
declare function useWithdrawSwapQuote(args: Pausable<UseWithdrawSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1793
|
+
/**
|
|
1794
|
+
* Low-level hook to execute a withdraw swap quote action directly.
|
|
1795
|
+
*
|
|
1796
|
+
* @remarks
|
|
1797
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1798
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1799
|
+
*
|
|
1800
|
+
* ```ts
|
|
1801
|
+
* const [getQuote, { called, data, error, loading }] = useWithdrawSwapQuoteAction();
|
|
1802
|
+
*
|
|
1803
|
+
* // …
|
|
1804
|
+
*
|
|
1805
|
+
* const result = await getQuote({
|
|
1806
|
+
* position: userSupplyItem.id,
|
|
1807
|
+
* buyReserve: reserve.id,
|
|
1808
|
+
* amount: bigDecimal('1000'),
|
|
1809
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1810
|
+
* });
|
|
1811
|
+
*
|
|
1812
|
+
* if (result.isOk()) {
|
|
1813
|
+
* console.log('Withdraw swap quote:', result.value);
|
|
1814
|
+
* } else {
|
|
1815
|
+
* console.error(result.error);
|
|
1816
|
+
* }
|
|
1817
|
+
* ```
|
|
1818
|
+
*/
|
|
1819
|
+
declare function useWithdrawSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<WithdrawSwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1820
|
+
/**
|
|
1821
|
+
*/
|
|
1822
|
+
type UseWithdrawSwapRequest = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1823
|
+
/**
|
|
1824
|
+
*/
|
|
1825
|
+
declare function useWithdrawSwap(handler: PositionSwapHandler): UseAsyncTask<WithdrawSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1826
|
+
type UseTokenSwapRequest = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1827
|
+
type TokenSwapPlan = SwapTypedData | Erc20Approval | SwapTransactionRequest;
|
|
1828
|
+
type TokenSwapHandler = (plan: TokenSwapPlan, options: SwapHandlerOptions) => ResultAsync<ERC20PermitSignature | PendingTransaction | Signature, SwapSignerError>;
|
|
1829
|
+
/**
|
|
1293
1830
|
* Orchestrate the swap execution plan.
|
|
1294
1831
|
*
|
|
1295
1832
|
* ```tsx
|
|
1296
|
-
* const [sendTransaction
|
|
1297
|
-
* const [
|
|
1833
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1834
|
+
* const [signSwapTypedData] = useSignSwapTypedData(wallet);
|
|
1298
1835
|
*
|
|
1299
|
-
* const [swap,
|
|
1836
|
+
* const [swap, { loading, error }] = useTokenSwap((plan) => {
|
|
1300
1837
|
* switch (plan.__typename) {
|
|
1301
|
-
* case '
|
|
1302
|
-
* return
|
|
1838
|
+
* case 'SwapTypedData':
|
|
1839
|
+
* return signSwapTypedData(plan);
|
|
1303
1840
|
*
|
|
1304
1841
|
* case 'SwapApprovalRequired':
|
|
1305
|
-
* case 'SwapByIntentWithApprovalRequired':
|
|
1306
1842
|
* return sendTransaction(plan.transaction);
|
|
1307
1843
|
*
|
|
1844
|
+
* case 'SwapByIntentWithApprovalRequired':
|
|
1845
|
+
* return sendTransaction(plan.approval);
|
|
1846
|
+
*
|
|
1308
1847
|
* case 'SwapTransactionRequest':
|
|
1309
1848
|
* return sendTransaction(plan.transaction);
|
|
1310
1849
|
* }
|
|
@@ -1313,11 +1852,11 @@ type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAs
|
|
|
1313
1852
|
* const result = await swap({
|
|
1314
1853
|
* market: {
|
|
1315
1854
|
* chainId: chainId(1),
|
|
1316
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6
|
|
1317
|
-
* sell: { erc20: evmAddress('0x6B175474E
|
|
1855
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1856
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1318
1857
|
* amount: bigDecimal('1000'),
|
|
1319
|
-
* kind: SwapKind.
|
|
1320
|
-
* user: evmAddress('0x742d35cc
|
|
1858
|
+
* kind: SwapKind.Sell,
|
|
1859
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1321
1860
|
* },
|
|
1322
1861
|
* });
|
|
1323
1862
|
*
|
|
@@ -1329,32 +1868,31 @@ type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAs
|
|
|
1329
1868
|
* // result.value: SwapReceipt
|
|
1330
1869
|
* ```
|
|
1331
1870
|
*/
|
|
1332
|
-
declare function
|
|
1333
|
-
type CancelSwapHandler = (data:
|
|
1871
|
+
declare function useTokenSwap(handler: TokenSwapHandler): UseAsyncTask<UseTokenSwapRequest, SwapReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1872
|
+
type CancelSwapHandler = (data: SwapTypedData | TransactionRequest, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
|
|
1334
1873
|
declare class CannotCancelSwapError extends ResultAwareError {
|
|
1335
1874
|
name: "CannotCancelSwapError";
|
|
1336
1875
|
}
|
|
1337
1876
|
type CancelSwapError = CancelError | CannotCancelSwapError | SigningError | TimeoutError | TransactionError | UnexpectedError$1;
|
|
1338
1877
|
/**
|
|
1339
|
-
* @internal
|
|
1340
1878
|
* Executes the complete swap cancellation workflow combining preparation and execution.
|
|
1341
1879
|
*
|
|
1342
1880
|
* ```tsx
|
|
1343
1881
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1344
|
-
* const [
|
|
1882
|
+
* const [signSwapTypedData] = useSignSwapTypedData(wallet);
|
|
1345
1883
|
*
|
|
1346
|
-
* const [cancelSwap, {loading, error}] = useCancelSwap((plan
|
|
1884
|
+
* const [cancelSwap, { loading, error }] = useCancelSwap((plan) => {
|
|
1347
1885
|
* switch (plan.__typename) {
|
|
1348
1886
|
* case 'TransactionRequest':
|
|
1349
1887
|
* return sendTransaction(plan);
|
|
1350
1888
|
*
|
|
1351
|
-
* case '
|
|
1352
|
-
* return
|
|
1889
|
+
* case 'SwapTypedData':
|
|
1890
|
+
* return signSwapTypedData(plan);
|
|
1353
1891
|
* }
|
|
1354
1892
|
* });
|
|
1355
1893
|
*
|
|
1356
1894
|
* const result = await cancelSwap({
|
|
1357
|
-
* id: swapId('123
|
|
1895
|
+
* id: swapId('123…'),
|
|
1358
1896
|
* });
|
|
1359
1897
|
*
|
|
1360
1898
|
* if (result.isErr()) {
|
|
@@ -1627,62 +2165,21 @@ declare function useWithdraw(handler: TransactionHandler): UseAsyncTask<Withdraw
|
|
|
1627
2165
|
*/
|
|
1628
2166
|
declare function useRenounceSpokeUserPositionManager(handler: TransactionHandler): UseAsyncTask<RenounceSpokeUserPositionManagerRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1629
2167
|
/**
|
|
1630
|
-
*
|
|
2168
|
+
* Hook for updating user position conditions (dynamic config and/or risk premium).
|
|
1631
2169
|
*
|
|
1632
2170
|
* ```ts
|
|
1633
2171
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1634
|
-
* const [
|
|
2172
|
+
* const [update, { loading, error }] = useUpdateUserPositionConditions((transaction, { cancel }) => {
|
|
1635
2173
|
* return sendTransaction(transaction);
|
|
1636
2174
|
* });
|
|
1637
2175
|
*
|
|
1638
2176
|
* // …
|
|
1639
2177
|
*
|
|
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);
|
|
2178
|
+
* const result = await update({
|
|
2179
|
+
* userPositionId: userPosition.id,
|
|
2180
|
+
* update: UserPositionConditionsUpdate.AllDynamicConfig,
|
|
1680
2181
|
* });
|
|
1681
2182
|
*
|
|
1682
|
-
* // …
|
|
1683
|
-
*
|
|
1684
|
-
* const result = await updateUserDynamicConfig({ ... });
|
|
1685
|
-
*
|
|
1686
2183
|
* if (result.isErr()) {
|
|
1687
2184
|
* switch (result.error.name) {
|
|
1688
2185
|
* case 'CancelError':
|
|
@@ -1713,20 +2210,24 @@ declare function useUpdateUserRiskPremium(handler: TransactionHandler): UseAsync
|
|
|
1713
2210
|
*
|
|
1714
2211
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1715
2212
|
*/
|
|
1716
|
-
declare function
|
|
2213
|
+
declare function useUpdateUserPositionConditions(handler: TransactionHandler): UseAsyncTask<UpdateUserPositionConditionsRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1717
2214
|
/**
|
|
1718
|
-
* Hook for
|
|
2215
|
+
* Hook for updating the collateral status of user's supplies.
|
|
1719
2216
|
*
|
|
1720
2217
|
* ```ts
|
|
1721
2218
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1722
|
-
* const [
|
|
2219
|
+
* const [setUserSuppliesAsCollateral, { loading, error }] = useSetUserSuppliesAsCollateral((transaction, { cancel }) => {
|
|
1723
2220
|
* return sendTransaction(transaction);
|
|
1724
2221
|
* });
|
|
1725
2222
|
*
|
|
1726
|
-
* const result = await
|
|
1727
|
-
*
|
|
1728
|
-
*
|
|
1729
|
-
*
|
|
2223
|
+
* const result = await setUserSuppliesAsCollateral({
|
|
2224
|
+
* changes: [
|
|
2225
|
+
* {
|
|
2226
|
+
* reserve: reserve.id,
|
|
2227
|
+
* enableCollateral: true
|
|
2228
|
+
* }
|
|
2229
|
+
* ],
|
|
2230
|
+
* sender: evmAddress('0x456...')
|
|
1730
2231
|
* });
|
|
1731
2232
|
*
|
|
1732
2233
|
* if (result.isErr()) {
|
|
@@ -1759,7 +2260,7 @@ declare function useUpdateUserDynamicConfig(handler: TransactionHandler): UseAsy
|
|
|
1759
2260
|
*
|
|
1760
2261
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1761
2262
|
*/
|
|
1762
|
-
declare function
|
|
2263
|
+
declare function useSetUserSuppliesAsCollateral(handler: TransactionHandler): UseAsyncTask<SetUserSuppliesAsCollateralRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1763
2264
|
/**
|
|
1764
2265
|
* A hook that provides a way to liquidate a user's position.
|
|
1765
2266
|
*
|
|
@@ -2011,7 +2512,7 @@ declare function usePreview(args: UsePreviewArgs): ReadResult<PreviewUserPositio
|
|
|
2011
2512
|
* ```
|
|
2012
2513
|
*/
|
|
2013
2514
|
declare function usePreview(args: Pausable<UsePreviewArgs>): PausableReadResult<PreviewUserPosition>;
|
|
2014
|
-
type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions>;
|
|
2515
|
+
type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2015
2516
|
/**
|
|
2016
2517
|
* Fetch paginated list of activities.
|
|
2017
2518
|
*
|
|
@@ -2093,9 +2594,9 @@ declare function useActivities(args: Pausable<UseActivitiesArgs>): PausableReadR
|
|
|
2093
2594
|
* @param options - The query options.
|
|
2094
2595
|
* @returns The user history.
|
|
2095
2596
|
*/
|
|
2096
|
-
declare function useActivitiesAction(options?:
|
|
2597
|
+
declare function useActivitiesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError>;
|
|
2097
2598
|
|
|
2098
|
-
type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions>;
|
|
2599
|
+
type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2099
2600
|
/**
|
|
2100
2601
|
* Fetch all user supply positions.
|
|
2101
2602
|
*
|
|
@@ -2208,8 +2709,8 @@ declare function useUserSupplies(args: Pausable<UseUserSuppliesArgs>): PausableR
|
|
|
2208
2709
|
* }
|
|
2209
2710
|
* ```
|
|
2210
2711
|
*/
|
|
2211
|
-
declare function useUserSuppliesAction(options?:
|
|
2212
|
-
type UseUserBorrowsArgs = Prettify<UserBorrowsRequest & CurrencyQueryOptions>;
|
|
2712
|
+
declare function useUserSuppliesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<UserSuppliesRequest, UserSupplyItem[], UnexpectedError>;
|
|
2713
|
+
type UseUserBorrowsArgs = Prettify<UserBorrowsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2213
2714
|
/**
|
|
2214
2715
|
* Fetch all user borrow positions.
|
|
2215
2716
|
*
|
|
@@ -2315,7 +2816,7 @@ declare function useUserBorrows(args: Pausable<UseUserBorrowsArgs>): PausableRea
|
|
|
2315
2816
|
* }
|
|
2316
2817
|
* ```
|
|
2317
2818
|
*/
|
|
2318
|
-
declare function useUserBorrowsAction(options?:
|
|
2819
|
+
declare function useUserBorrowsAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<UserBorrowsRequest, UserBorrowItem[], UnexpectedError>;
|
|
2319
2820
|
type UseUserSummaryArgs = Prettify<UserSummaryRequest & TimeWindowQueryOptions & CurrencyQueryOptions>;
|
|
2320
2821
|
/**
|
|
2321
2822
|
* Fetch a user's financial summary.
|
|
@@ -2578,6 +3079,69 @@ declare function useUserBalances(args: UseUserBalancesArgs): ReadResult<UserBala
|
|
|
2578
3079
|
* ```
|
|
2579
3080
|
*/
|
|
2580
3081
|
declare function useUserBalances(args: Pausable<UseUserBalancesArgs>): PausableReadResult<UserBalance[]>;
|
|
3082
|
+
type UseUserRiskPremiumBreakdownArgs = UserRiskPremiumBreakdownRequest;
|
|
3083
|
+
/**
|
|
3084
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3085
|
+
*
|
|
3086
|
+
* This signature supports React Suspense:
|
|
3087
|
+
*
|
|
3088
|
+
* ```tsx
|
|
3089
|
+
* const { data } = useUserRiskPremiumBreakdown({
|
|
3090
|
+
* query: {
|
|
3091
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3092
|
+
* },
|
|
3093
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3094
|
+
* suspense: true,
|
|
3095
|
+
* });
|
|
3096
|
+
* ```
|
|
3097
|
+
*/
|
|
3098
|
+
declare function useUserRiskPremiumBreakdown(args: UseUserRiskPremiumBreakdownArgs & Suspendable): SuspenseResult<UserRiskPremiumBreakdownItem[]>;
|
|
3099
|
+
/**
|
|
3100
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3101
|
+
*
|
|
3102
|
+
* Pausable suspense mode.
|
|
3103
|
+
*
|
|
3104
|
+
* ```tsx
|
|
3105
|
+
* const { data } = useUserRiskPremiumBreakdown({
|
|
3106
|
+
* query: {
|
|
3107
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3108
|
+
* },
|
|
3109
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3110
|
+
* suspense: true,
|
|
3111
|
+
* pause: true,
|
|
3112
|
+
* });
|
|
3113
|
+
* ```
|
|
3114
|
+
*/
|
|
3115
|
+
declare function useUserRiskPremiumBreakdown(args: Pausable<UseUserRiskPremiumBreakdownArgs> & Suspendable): PausableSuspenseResult<UserRiskPremiumBreakdownItem[]>;
|
|
3116
|
+
/**
|
|
3117
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3118
|
+
*
|
|
3119
|
+
* ```tsx
|
|
3120
|
+
* const { data, error, loading } = useUserRiskPremiumBreakdown({
|
|
3121
|
+
* query: {
|
|
3122
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3123
|
+
* },
|
|
3124
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3125
|
+
* });
|
|
3126
|
+
* ```
|
|
3127
|
+
*/
|
|
3128
|
+
declare function useUserRiskPremiumBreakdown(args: UseUserRiskPremiumBreakdownArgs): ReadResult<UserRiskPremiumBreakdownItem[]>;
|
|
3129
|
+
/**
|
|
3130
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3131
|
+
*
|
|
3132
|
+
* Pausable loading state mode.
|
|
3133
|
+
*
|
|
3134
|
+
* ```tsx
|
|
3135
|
+
* const { data, error, loading, paused } = useUserRiskPremiumBreakdown({
|
|
3136
|
+
* query: {
|
|
3137
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3138
|
+
* },
|
|
3139
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3140
|
+
* pause: true,
|
|
3141
|
+
* });
|
|
3142
|
+
* ```
|
|
3143
|
+
*/
|
|
3144
|
+
declare function useUserRiskPremiumBreakdown(args: Pausable<UseUserRiskPremiumBreakdownArgs>): PausableReadResult<UserRiskPremiumBreakdownItem[]>;
|
|
2581
3145
|
/**
|
|
2582
3146
|
* Low-level hook to execute a {@link userBalances} action directly.
|
|
2583
3147
|
*
|
|
@@ -2667,4 +3231,4 @@ declare function useUserSummaryHistory(args: UseUserSummaryHistoryArgs): ReadRes
|
|
|
2667
3231
|
*/
|
|
2668
3232
|
declare function useUserSummaryHistory(args: Pausable<UseUserSummaryHistoryArgs>): PausableReadResult<UserSummaryHistoryItem[]>;
|
|
2669
3233
|
|
|
2670
|
-
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError,
|
|
3234
|
+
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 UseSwapSignerRequest, type UseSwapSignerResult, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, 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, useHub, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePermitTypedDataAction, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|