@aave/react 4.0.0-next.2 → 4.0.0-next.20
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 +707 -155
- package/dist/index.d.ts +707 -155
- 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, MarketOrderTokenSwapQuoteInput, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, TokenSwapQuoteRequest, 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,94 @@ 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<MarketOrderTokenSwapQuoteInput & 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({
|
|
1072
1181
|
* chainId: chainId(1),
|
|
1073
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6
|
|
1074
|
-
* sell: { erc20: evmAddress('0x6B175474E
|
|
1182
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1183
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1075
1184
|
* amount: bigDecimal('1000'),
|
|
1076
|
-
* kind: SwapKind.
|
|
1185
|
+
* kind: SwapKind.Sell,
|
|
1077
1186
|
* suspense: true,
|
|
1078
1187
|
* });
|
|
1079
1188
|
* ```
|
|
1080
1189
|
*/
|
|
1081
|
-
declare function
|
|
1190
|
+
declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1082
1191
|
/**
|
|
1083
|
-
* @internal
|
|
1084
1192
|
* Fetch a swap quote for the specified trade parameters.
|
|
1085
1193
|
*
|
|
1086
1194
|
* Pausable suspense mode.
|
|
1087
1195
|
*
|
|
1088
1196
|
* ```tsx
|
|
1089
|
-
* const { data } =
|
|
1197
|
+
* const { data } = useTokenSwapQuote({
|
|
1090
1198
|
* chainId: chainId(1),
|
|
1091
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6
|
|
1092
|
-
* sell: { erc20: evmAddress('0x6B175474E
|
|
1199
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1200
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1093
1201
|
* amount: bigDecimal('1000'),
|
|
1094
|
-
* kind: SwapKind.
|
|
1095
|
-
* from: evmAddress('0x742d35cc
|
|
1202
|
+
* kind: SwapKind.Sell,
|
|
1203
|
+
* from: evmAddress('0x742d35cc…'),
|
|
1096
1204
|
* suspense: true,
|
|
1097
1205
|
* pause: true,
|
|
1098
1206
|
* });
|
|
1099
1207
|
* ```
|
|
1100
1208
|
*/
|
|
1101
|
-
declare function
|
|
1209
|
+
declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1102
1210
|
/**
|
|
1103
|
-
* @internal
|
|
1104
1211
|
* Fetch a swap quote for the specified trade parameters.
|
|
1105
1212
|
*
|
|
1106
1213
|
* ```tsx
|
|
1107
|
-
* const { data, error, loading } =
|
|
1214
|
+
* const { data, error, loading } = useTokenSwapQuote({
|
|
1108
1215
|
* chainId: chainId(1),
|
|
1109
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6
|
|
1110
|
-
* sell: { erc20: evmAddress('0x6B175474E
|
|
1216
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1217
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1111
1218
|
* amount: bigDecimal('1000'),
|
|
1112
|
-
* kind: SwapKind.
|
|
1219
|
+
* kind: SwapKind.Sell,
|
|
1113
1220
|
* });
|
|
1114
1221
|
* ```
|
|
1115
1222
|
*/
|
|
1116
|
-
declare function
|
|
1223
|
+
declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1117
1224
|
/**
|
|
1118
|
-
* @internal
|
|
1119
1225
|
* Fetch a swap quote for the specified trade parameters.
|
|
1120
1226
|
*
|
|
1121
1227
|
* Pausable loading state mode.
|
|
1122
1228
|
*
|
|
1123
1229
|
* ```tsx
|
|
1124
|
-
* const { data, error, loading, paused } =
|
|
1230
|
+
* const { data, error, loading, paused } = useTokenSwapQuote({
|
|
1125
1231
|
* chainId: chainId(1),
|
|
1126
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6
|
|
1127
|
-
* sell: { erc20: evmAddress('0x6B175474E
|
|
1232
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1233
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1128
1234
|
* amount: bigDecimal('1000'),
|
|
1129
|
-
* kind: SwapKind.
|
|
1130
|
-
* from: evmAddress('0x742d35cc
|
|
1235
|
+
* kind: SwapKind.Sell,
|
|
1236
|
+
* from: evmAddress('0x742d35cc…'),
|
|
1131
1237
|
* pause: true,
|
|
1132
1238
|
* });
|
|
1133
1239
|
* ```
|
|
1134
1240
|
*/
|
|
1135
|
-
declare function
|
|
1241
|
+
declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1136
1242
|
/**
|
|
1137
|
-
* @internal
|
|
1138
1243
|
* Low-level hook to execute a swap quote action directly.
|
|
1139
1244
|
*
|
|
1140
|
-
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
1141
1245
|
* @remarks
|
|
1142
1246
|
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1143
1247
|
* Use this hook to retrieve quotes on demand as part of a larger workflow
|
|
1144
1248
|
* (e.g., in an event handler to get a fresh quote before executing a swap).
|
|
1145
1249
|
*
|
|
1146
1250
|
* ```ts
|
|
1147
|
-
* const [getQuote, { called, data, error, loading }] =
|
|
1251
|
+
* const [getQuote, { called, data, error, loading }] = useTokenSwapQuoteAction();
|
|
1148
1252
|
*
|
|
1149
1253
|
* // …
|
|
1150
1254
|
*
|
|
1151
1255
|
* const result = await getQuote({
|
|
1152
1256
|
* chainId: chainId(1),
|
|
1153
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6
|
|
1154
|
-
* sell: { erc20: evmAddress('0x6B175474E
|
|
1257
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1258
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1155
1259
|
* amount: bigDecimal('1000'),
|
|
1156
|
-
* kind: SwapKind.
|
|
1260
|
+
* kind: SwapKind.Sell,
|
|
1157
1261
|
* });
|
|
1158
1262
|
*
|
|
1159
1263
|
* if (result.isOk()) {
|
|
@@ -1163,10 +1267,9 @@ declare function useSwapQuote(args: Pausable<UseSwapQuoteArgs>): PausableReadRes
|
|
|
1163
1267
|
* }
|
|
1164
1268
|
* ```
|
|
1165
1269
|
*/
|
|
1166
|
-
declare function
|
|
1270
|
+
declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<MarketOrderTokenSwapQuoteInput, SwapQuote, UnexpectedError$1>;
|
|
1167
1271
|
type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
1168
1272
|
/**
|
|
1169
|
-
* @internal
|
|
1170
1273
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1171
1274
|
*
|
|
1172
1275
|
* This signature supports React Suspense:
|
|
@@ -1180,7 +1283,6 @@ type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
|
1180
1283
|
*/
|
|
1181
1284
|
declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable): SuspenseResult<Token[]>;
|
|
1182
1285
|
/**
|
|
1183
|
-
* @internal
|
|
1184
1286
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1185
1287
|
*
|
|
1186
1288
|
* Pausable suspense mode.
|
|
@@ -1195,7 +1297,6 @@ declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable):
|
|
|
1195
1297
|
*/
|
|
1196
1298
|
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Suspendable): PausableSuspenseResult<Token[]>;
|
|
1197
1299
|
/**
|
|
1198
|
-
* @internal
|
|
1199
1300
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1200
1301
|
*
|
|
1201
1302
|
* ```tsx
|
|
@@ -1206,7 +1307,6 @@ declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Sus
|
|
|
1206
1307
|
*/
|
|
1207
1308
|
declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<Token[]>;
|
|
1208
1309
|
/**
|
|
1209
|
-
* @internal
|
|
1210
1310
|
* Fetch the list of tokens available for swapping on a specific chain.
|
|
1211
1311
|
*
|
|
1212
1312
|
* Pausable loading state mode.
|
|
@@ -1219,9 +1319,8 @@ declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<To
|
|
|
1219
1319
|
* ```
|
|
1220
1320
|
*/
|
|
1221
1321
|
declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs>): PausableReadResult<Token[]>;
|
|
1222
|
-
type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
1322
|
+
type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1223
1323
|
/**
|
|
1224
|
-
* @internal
|
|
1225
1324
|
* Fetch the user's swap history for a specific chain.
|
|
1226
1325
|
*
|
|
1227
1326
|
* This signature supports React Suspense:
|
|
@@ -1229,7 +1328,7 @@ type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
|
1229
1328
|
* ```tsx
|
|
1230
1329
|
* const { data } = useUserSwaps({
|
|
1231
1330
|
* chainId: chainId(1),
|
|
1232
|
-
* user: evmAddress('0x742d35cc
|
|
1331
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1233
1332
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1234
1333
|
* suspense: true,
|
|
1235
1334
|
* });
|
|
@@ -1237,7 +1336,6 @@ type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions>;
|
|
|
1237
1336
|
*/
|
|
1238
1337
|
declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseResult<PaginatedUserSwapsResult>;
|
|
1239
1338
|
/**
|
|
1240
|
-
* @internal
|
|
1241
1339
|
* Fetch the user's swap history for a specific chain.
|
|
1242
1340
|
*
|
|
1243
1341
|
* Pausable suspense mode.
|
|
@@ -1245,7 +1343,7 @@ declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseRes
|
|
|
1245
1343
|
* ```tsx
|
|
1246
1344
|
* const { data } = useUserSwaps({
|
|
1247
1345
|
* chainId: chainId(1),
|
|
1248
|
-
* user: evmAddress('0x742d35cc
|
|
1346
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1249
1347
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1250
1348
|
* suspense: true,
|
|
1251
1349
|
* pause: true,
|
|
@@ -1254,20 +1352,18 @@ declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseRes
|
|
|
1254
1352
|
*/
|
|
1255
1353
|
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs> & Suspendable): PausableSuspenseResult<PaginatedUserSwapsResult>;
|
|
1256
1354
|
/**
|
|
1257
|
-
* @internal
|
|
1258
1355
|
* Fetch the user's swap history for a specific chain.
|
|
1259
1356
|
*
|
|
1260
1357
|
* ```tsx
|
|
1261
1358
|
* const { data, error, loading } = useUserSwaps({
|
|
1262
1359
|
* chainId: chainId(1),
|
|
1263
|
-
* user: evmAddress('0x742d35cc
|
|
1360
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1264
1361
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1265
1362
|
* });
|
|
1266
1363
|
* ```
|
|
1267
1364
|
*/
|
|
1268
1365
|
declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserSwapsResult>;
|
|
1269
1366
|
/**
|
|
1270
|
-
* @internal
|
|
1271
1367
|
* Fetch the user's swap history for a specific chain.
|
|
1272
1368
|
*
|
|
1273
1369
|
* Pausable loading state mode.
|
|
@@ -1275,36 +1371,467 @@ declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserS
|
|
|
1275
1371
|
* ```tsx
|
|
1276
1372
|
* const { data, error, loading, paused } = useUserSwaps({
|
|
1277
1373
|
* chainId: chainId(1),
|
|
1278
|
-
* user: evmAddress('0x742d35cc
|
|
1374
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1279
1375
|
* filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
|
|
1280
1376
|
* pause: true,
|
|
1281
1377
|
* });
|
|
1282
1378
|
* ```
|
|
1283
1379
|
*/
|
|
1284
1380
|
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
|
|
1285
|
-
type
|
|
1286
|
-
|
|
1381
|
+
type UseSupplySwapQuoteArgs = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1384
|
+
*
|
|
1385
|
+
* This signature supports React Suspense:
|
|
1386
|
+
*
|
|
1387
|
+
* ```tsx
|
|
1388
|
+
* const { data } = useSupplySwapQuote({
|
|
1389
|
+
* market: {
|
|
1390
|
+
* sellPosition: userSupplyItem.id,
|
|
1391
|
+
* buyReserve: reserve.id,
|
|
1392
|
+
* amount: bigDecimal('1000'),
|
|
1393
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1394
|
+
* },
|
|
1395
|
+
* suspense: true,
|
|
1396
|
+
* });
|
|
1397
|
+
* ```
|
|
1398
|
+
*/
|
|
1399
|
+
declare function useSupplySwapQuote(args: UseSupplySwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1400
|
+
/**
|
|
1401
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1402
|
+
*
|
|
1403
|
+
* Pausable suspense mode.
|
|
1404
|
+
*
|
|
1405
|
+
* ```tsx
|
|
1406
|
+
* const { data } = useSupplySwapQuote({
|
|
1407
|
+
* market: {
|
|
1408
|
+
* sellPosition: userSupplyItem.id,
|
|
1409
|
+
* buyReserve: reserve.id,
|
|
1410
|
+
* amount: bigDecimal('1000'),
|
|
1411
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1412
|
+
* },
|
|
1413
|
+
* suspense: true,
|
|
1414
|
+
* pause: true,
|
|
1415
|
+
* });
|
|
1416
|
+
* ```
|
|
1417
|
+
*/
|
|
1418
|
+
declare function useSupplySwapQuote(args: Pausable<UseSupplySwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1419
|
+
/**
|
|
1420
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1421
|
+
*
|
|
1422
|
+
* ```tsx
|
|
1423
|
+
* const { data, error, loading } = useSupplySwapQuote({
|
|
1424
|
+
* market: {
|
|
1425
|
+
* sellPosition: userSupplyItem.id,
|
|
1426
|
+
* buyReserve: reserve.id,
|
|
1427
|
+
* amount: bigDecimal('1000'),
|
|
1428
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1429
|
+
* },
|
|
1430
|
+
* });
|
|
1431
|
+
* ```
|
|
1432
|
+
*/
|
|
1433
|
+
declare function useSupplySwapQuote(args: UseSupplySwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
1436
|
+
*
|
|
1437
|
+
* Pausable loading state mode.
|
|
1438
|
+
*
|
|
1439
|
+
* ```tsx
|
|
1440
|
+
* const { data, error, loading, paused } = useSupplySwapQuote({
|
|
1441
|
+
* market: {
|
|
1442
|
+
* sellPosition: userSupplyItem.id,
|
|
1443
|
+
* buyReserve: reserve.id,
|
|
1444
|
+
* amount: bigDecimal('1000'),
|
|
1445
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1446
|
+
* },
|
|
1447
|
+
* pause: true,
|
|
1448
|
+
* });
|
|
1449
|
+
* ```
|
|
1450
|
+
*/
|
|
1451
|
+
declare function useSupplySwapQuote(args: Pausable<UseSupplySwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1452
|
+
/**
|
|
1453
|
+
* Low-level hook to execute a supply swap quote action directly.
|
|
1454
|
+
*
|
|
1455
|
+
* @remarks
|
|
1456
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1457
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1458
|
+
*
|
|
1459
|
+
* ```ts
|
|
1460
|
+
* const [getQuote, { called, data, error, loading }] = useSupplySwapQuoteAction();
|
|
1461
|
+
*
|
|
1462
|
+
* // …
|
|
1463
|
+
*
|
|
1464
|
+
* const result = await getQuote({
|
|
1465
|
+
* sellPosition: userSupplyItem.id,
|
|
1466
|
+
* buyReserve: reserve.id,
|
|
1467
|
+
* amount: bigDecimal('1000'),
|
|
1468
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1469
|
+
* });
|
|
1470
|
+
*
|
|
1471
|
+
* if (result.isOk()) {
|
|
1472
|
+
* console.log('Supply swap quote:', result.value);
|
|
1473
|
+
* } else {
|
|
1474
|
+
* console.error(result.error);
|
|
1475
|
+
* }
|
|
1476
|
+
* ```
|
|
1477
|
+
*/
|
|
1478
|
+
declare function useSupplySwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<SupplySwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1479
|
+
type UseBorrowSwapQuoteArgs = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1482
|
+
*
|
|
1483
|
+
* This signature supports React Suspense:
|
|
1484
|
+
*
|
|
1485
|
+
* ```tsx
|
|
1486
|
+
* const { data } = useBorrowSwapQuote({
|
|
1487
|
+
* market: {
|
|
1488
|
+
* sellPosition: userBorrowItem.id,
|
|
1489
|
+
* buyReserve: reserve.id,
|
|
1490
|
+
* amount: bigDecimal('1000'),
|
|
1491
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1492
|
+
* },
|
|
1493
|
+
* suspense: true,
|
|
1494
|
+
* });
|
|
1495
|
+
* ```
|
|
1496
|
+
*/
|
|
1497
|
+
declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1498
|
+
/**
|
|
1499
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1500
|
+
*
|
|
1501
|
+
* Pausable suspense mode.
|
|
1502
|
+
*
|
|
1503
|
+
* ```tsx
|
|
1504
|
+
* const { data } = useBorrowSwapQuote({
|
|
1505
|
+
* market: {
|
|
1506
|
+
* sellPosition: userBorrowItem.id,
|
|
1507
|
+
* buyReserve: reserve.id,
|
|
1508
|
+
* amount: bigDecimal('1000'),
|
|
1509
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1510
|
+
* },
|
|
1511
|
+
* suspense: true,
|
|
1512
|
+
* pause: true,
|
|
1513
|
+
* });
|
|
1514
|
+
* ```
|
|
1515
|
+
*/
|
|
1516
|
+
declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1517
|
+
/**
|
|
1518
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1519
|
+
*
|
|
1520
|
+
* ```tsx
|
|
1521
|
+
* const { data, error, loading } = useBorrowSwapQuote({
|
|
1522
|
+
* market: {
|
|
1523
|
+
* sellPosition: userBorrowItem.id,
|
|
1524
|
+
* buyReserve: reserve.id,
|
|
1525
|
+
* amount: bigDecimal('1000'),
|
|
1526
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1527
|
+
* },
|
|
1528
|
+
* });
|
|
1529
|
+
* ```
|
|
1530
|
+
*/
|
|
1531
|
+
declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1532
|
+
/**
|
|
1533
|
+
* Fetch a quote for a borrow swap operation with the specified parameters.
|
|
1534
|
+
*
|
|
1535
|
+
* Pausable loading state mode.
|
|
1536
|
+
*
|
|
1537
|
+
* ```tsx
|
|
1538
|
+
* const { data, error, loading, paused } = useBorrowSwapQuote({
|
|
1539
|
+
* market: {
|
|
1540
|
+
* sellPosition: userBorrowItem.id,
|
|
1541
|
+
* buyReserve: reserve.id,
|
|
1542
|
+
* amount: bigDecimal('1000'),
|
|
1543
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1544
|
+
* },
|
|
1545
|
+
* pause: true,
|
|
1546
|
+
* });
|
|
1547
|
+
* ```
|
|
1548
|
+
*/
|
|
1549
|
+
declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1550
|
+
/**
|
|
1551
|
+
* Low-level hook to execute a borrow swap quote action directly.
|
|
1552
|
+
*
|
|
1553
|
+
* @remarks
|
|
1554
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1555
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1556
|
+
*
|
|
1557
|
+
* ```ts
|
|
1558
|
+
* const [getQuote, { called, data, error, loading }] = useBorrowSwapQuoteAction();
|
|
1559
|
+
*
|
|
1560
|
+
* // …
|
|
1561
|
+
*
|
|
1562
|
+
* const result = await getQuote({
|
|
1563
|
+
* debtPosition: userBorrowItem.id,
|
|
1564
|
+
* buyReserve: reserve.id,
|
|
1565
|
+
* amount: bigDecimal('1000'),
|
|
1566
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1567
|
+
* });
|
|
1568
|
+
*
|
|
1569
|
+
* if (result.isOk()) {
|
|
1570
|
+
* console.log('Borrow swap quote:', result.value);
|
|
1571
|
+
* } else {
|
|
1572
|
+
* console.error(result.error);
|
|
1573
|
+
* }
|
|
1574
|
+
* ```
|
|
1575
|
+
*/
|
|
1576
|
+
declare function useBorrowSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<BorrowSwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1287
1577
|
type SwapHandlerOptions = {
|
|
1288
1578
|
cancel: CancelOperation;
|
|
1289
1579
|
};
|
|
1290
|
-
type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAsync<ERC20PermitSignature | SwapReceipt, SendTransactionError | PendingTransactionError>;
|
|
1291
1580
|
/**
|
|
1292
|
-
|
|
1581
|
+
*/
|
|
1582
|
+
type UseSwapSignerRequest = TransactionRequest;
|
|
1583
|
+
/**
|
|
1584
|
+
*/
|
|
1585
|
+
type SwapSignerError = CancelError | SigningError | UnexpectedError$1;
|
|
1586
|
+
/**
|
|
1587
|
+
*/
|
|
1588
|
+
type UseSwapSignerResult = UseAsyncTask<UseSwapSignerRequest, PendingTransaction | Signature, SwapSignerError>;
|
|
1589
|
+
type PositionSwapPlan = PositionSwapApproval | SwapTypedData;
|
|
1590
|
+
type PositionSwapHandler = (plan: PositionSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
|
|
1591
|
+
type PositionSwapValue = {
|
|
1592
|
+
quote?: SwapQuote;
|
|
1593
|
+
};
|
|
1594
|
+
/**
|
|
1595
|
+
*/
|
|
1596
|
+
type UseSupplySwapRequest = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1597
|
+
/**
|
|
1598
|
+
*/
|
|
1599
|
+
declare function useSupplySwap(handler: PositionSwapHandler): UseAsyncTask<SupplySwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1600
|
+
/**
|
|
1601
|
+
*/
|
|
1602
|
+
type UseBorrowSwapRequest = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1603
|
+
/**
|
|
1604
|
+
*/
|
|
1605
|
+
declare function useBorrowSwap(handler: PositionSwapHandler): UseAsyncTask<BorrowSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1606
|
+
type UseRepayWithSupplyQuoteArgs = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
|
|
1607
|
+
/**
|
|
1608
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1609
|
+
*
|
|
1610
|
+
* This signature supports React Suspense:
|
|
1611
|
+
*
|
|
1612
|
+
* ```tsx
|
|
1613
|
+
* const { data } = useRepayWithSupplyQuote({
|
|
1614
|
+
* market: {
|
|
1615
|
+
* sellPosition: userSupplyItem.id,
|
|
1616
|
+
* buyPosition: userBorrowItem.id,
|
|
1617
|
+
* amount: bigDecimal('1000'),
|
|
1618
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1619
|
+
* },
|
|
1620
|
+
* suspense: true,
|
|
1621
|
+
* });
|
|
1622
|
+
* ```
|
|
1623
|
+
*/
|
|
1624
|
+
declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1625
|
+
/**
|
|
1626
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1627
|
+
*
|
|
1628
|
+
* Pausable suspense mode.
|
|
1629
|
+
*
|
|
1630
|
+
* ```tsx
|
|
1631
|
+
* const { data } = useRepayWithSupplyQuote({
|
|
1632
|
+
* market: {
|
|
1633
|
+
* sellPosition: userSupplyItem.id,
|
|
1634
|
+
* buyPosition: userBorrowItem.id,
|
|
1635
|
+
* amount: bigDecimal('1000'),
|
|
1636
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1637
|
+
* },
|
|
1638
|
+
* suspense: true,
|
|
1639
|
+
* pause: true,
|
|
1640
|
+
* });
|
|
1641
|
+
* ```
|
|
1642
|
+
*/
|
|
1643
|
+
declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1644
|
+
/**
|
|
1645
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1646
|
+
*
|
|
1647
|
+
* ```tsx
|
|
1648
|
+
* const { data, error, loading } = useRepayWithSupplyQuote({
|
|
1649
|
+
* market: {
|
|
1650
|
+
* sellPosition: userSupplyItem.id,
|
|
1651
|
+
* buyPosition: userBorrowItem.id,
|
|
1652
|
+
* amount: bigDecimal('1000'),
|
|
1653
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1654
|
+
* },
|
|
1655
|
+
* });
|
|
1656
|
+
* ```
|
|
1657
|
+
*/
|
|
1658
|
+
declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs): ReadResult<SwapQuote>;
|
|
1659
|
+
/**
|
|
1660
|
+
* Fetch a quote for a repay with supply operation with the specified parameters.
|
|
1661
|
+
*
|
|
1662
|
+
* Pausable loading state mode.
|
|
1663
|
+
*
|
|
1664
|
+
* ```tsx
|
|
1665
|
+
* const { data, error, loading, paused } = useRepayWithSupplyQuote({
|
|
1666
|
+
* market: {
|
|
1667
|
+
* sellPosition: userSupplyItem.id,
|
|
1668
|
+
* buyPosition: userBorrowItem.id,
|
|
1669
|
+
* amount: bigDecimal('1000'),
|
|
1670
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1671
|
+
* },
|
|
1672
|
+
* pause: true,
|
|
1673
|
+
* });
|
|
1674
|
+
* ```
|
|
1675
|
+
*/
|
|
1676
|
+
declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1677
|
+
/**
|
|
1678
|
+
* Low-level hook to execute a repay with supply quote action directly.
|
|
1679
|
+
*
|
|
1680
|
+
* @remarks
|
|
1681
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1682
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1683
|
+
*
|
|
1684
|
+
* ```ts
|
|
1685
|
+
* const [getQuote, { called, data, error, loading }] = useRepayWithSupplyQuoteAction();
|
|
1686
|
+
*
|
|
1687
|
+
* // …
|
|
1688
|
+
*
|
|
1689
|
+
* const result = await getQuote({
|
|
1690
|
+
* repayWithReserve: reserve.id,
|
|
1691
|
+
* debtPosition: userBorrowItem.id,
|
|
1692
|
+
* amount: bigDecimal('1000'),
|
|
1693
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1694
|
+
* });
|
|
1695
|
+
*
|
|
1696
|
+
* if (result.isOk()) {
|
|
1697
|
+
* console.log('Repay with supply quote:', result.value);
|
|
1698
|
+
* } else {
|
|
1699
|
+
* console.error(result.error);
|
|
1700
|
+
* }
|
|
1701
|
+
* ```
|
|
1702
|
+
*/
|
|
1703
|
+
declare function useRepayWithSupplyQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1704
|
+
/**
|
|
1705
|
+
*/
|
|
1706
|
+
type UseRepayWithSupplyRequest = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
|
|
1707
|
+
/**
|
|
1708
|
+
*/
|
|
1709
|
+
declare function useRepayWithSupply(handler: PositionSwapHandler): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1710
|
+
type UseWithdrawSwapQuoteArgs = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1713
|
+
*
|
|
1714
|
+
* This signature supports React Suspense:
|
|
1715
|
+
*
|
|
1716
|
+
* ```tsx
|
|
1717
|
+
* const { data } = useWithdrawSwapQuote({
|
|
1718
|
+
* market: {
|
|
1719
|
+
* position: userSupplyItem.id,
|
|
1720
|
+
* buyReserve: reserve.id,
|
|
1721
|
+
* amount: bigDecimal('1000'),
|
|
1722
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1723
|
+
* },
|
|
1724
|
+
* suspense: true,
|
|
1725
|
+
* });
|
|
1726
|
+
* ```
|
|
1727
|
+
*/
|
|
1728
|
+
declare function useWithdrawSwapQuote(args: UseWithdrawSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
|
|
1729
|
+
/**
|
|
1730
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1731
|
+
*
|
|
1732
|
+
* Pausable suspense mode.
|
|
1733
|
+
*
|
|
1734
|
+
* ```tsx
|
|
1735
|
+
* const { data } = useWithdrawSwapQuote({
|
|
1736
|
+
* market: {
|
|
1737
|
+
* position: userSupplyItem.id,
|
|
1738
|
+
* buyReserve: reserve.id,
|
|
1739
|
+
* amount: bigDecimal('1000'),
|
|
1740
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1741
|
+
* },
|
|
1742
|
+
* suspense: true,
|
|
1743
|
+
* pause: true,
|
|
1744
|
+
* });
|
|
1745
|
+
* ```
|
|
1746
|
+
*/
|
|
1747
|
+
declare function useWithdrawSwapQuote(args: Pausable<UseWithdrawSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
|
|
1748
|
+
/**
|
|
1749
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1750
|
+
*
|
|
1751
|
+
* ```tsx
|
|
1752
|
+
* const { data, error, loading } = useWithdrawSwapQuote({
|
|
1753
|
+
* market: {
|
|
1754
|
+
* position: userSupplyItem.id,
|
|
1755
|
+
* buyReserve: reserve.id,
|
|
1756
|
+
* amount: bigDecimal('1000'),
|
|
1757
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1758
|
+
* },
|
|
1759
|
+
* });
|
|
1760
|
+
* ```
|
|
1761
|
+
*/
|
|
1762
|
+
declare function useWithdrawSwapQuote(args: UseWithdrawSwapQuoteArgs): ReadResult<SwapQuote>;
|
|
1763
|
+
/**
|
|
1764
|
+
* Fetch a quote for a withdraw swap operation with the specified parameters.
|
|
1765
|
+
*
|
|
1766
|
+
* Pausable loading state mode.
|
|
1767
|
+
*
|
|
1768
|
+
* ```tsx
|
|
1769
|
+
* const { data, error, loading, paused } = useWithdrawSwapQuote({
|
|
1770
|
+
* market: {
|
|
1771
|
+
* position: userSupplyItem.id,
|
|
1772
|
+
* buyReserve: reserve.id,
|
|
1773
|
+
* amount: bigDecimal('1000'),
|
|
1774
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1775
|
+
* },
|
|
1776
|
+
* pause: true,
|
|
1777
|
+
* });
|
|
1778
|
+
* ```
|
|
1779
|
+
*/
|
|
1780
|
+
declare function useWithdrawSwapQuote(args: Pausable<UseWithdrawSwapQuoteArgs>): PausableReadResult<SwapQuote>;
|
|
1781
|
+
/**
|
|
1782
|
+
* Low-level hook to execute a withdraw swap quote action directly.
|
|
1783
|
+
*
|
|
1784
|
+
* @remarks
|
|
1785
|
+
* This hook **does not** actively watch for updated data on the swap quote.
|
|
1786
|
+
* Use this hook to retrieve quotes on demand as part of a larger workflow.
|
|
1787
|
+
*
|
|
1788
|
+
* ```ts
|
|
1789
|
+
* const [getQuote, { called, data, error, loading }] = useWithdrawSwapQuoteAction();
|
|
1790
|
+
*
|
|
1791
|
+
* // …
|
|
1792
|
+
*
|
|
1793
|
+
* const result = await getQuote({
|
|
1794
|
+
* position: userSupplyItem.id,
|
|
1795
|
+
* buyReserve: reserve.id,
|
|
1796
|
+
* amount: bigDecimal('1000'),
|
|
1797
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1798
|
+
* });
|
|
1799
|
+
*
|
|
1800
|
+
* if (result.isOk()) {
|
|
1801
|
+
* console.log('Withdraw swap quote:', result.value);
|
|
1802
|
+
* } else {
|
|
1803
|
+
* console.error(result.error);
|
|
1804
|
+
* }
|
|
1805
|
+
* ```
|
|
1806
|
+
*/
|
|
1807
|
+
declare function useWithdrawSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<WithdrawSwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1808
|
+
/**
|
|
1809
|
+
*/
|
|
1810
|
+
type UseWithdrawSwapRequest = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1811
|
+
/**
|
|
1812
|
+
*/
|
|
1813
|
+
declare function useWithdrawSwap(handler: PositionSwapHandler): UseAsyncTask<WithdrawSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1814
|
+
type UseTokenSwapRequest = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1815
|
+
type TokenSwapPlan = SwapTypedData | Erc20Approval | SwapTransactionRequest;
|
|
1816
|
+
type TokenSwapHandler = (plan: TokenSwapPlan, options: SwapHandlerOptions) => ResultAsync<ERC20PermitSignature | PendingTransaction | Signature, SwapSignerError>;
|
|
1817
|
+
/**
|
|
1293
1818
|
* Orchestrate the swap execution plan.
|
|
1294
1819
|
*
|
|
1295
1820
|
* ```tsx
|
|
1296
|
-
* const [sendTransaction
|
|
1297
|
-
* const [
|
|
1821
|
+
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1822
|
+
* const [signSwapTypedData] = useSignSwapTypedData(wallet);
|
|
1298
1823
|
*
|
|
1299
|
-
* const [swap,
|
|
1824
|
+
* const [swap, { loading, error }] = useTokenSwap((plan) => {
|
|
1300
1825
|
* switch (plan.__typename) {
|
|
1301
|
-
* case '
|
|
1302
|
-
* return
|
|
1826
|
+
* case 'SwapTypedData':
|
|
1827
|
+
* return signSwapTypedData(plan);
|
|
1303
1828
|
*
|
|
1304
1829
|
* case 'SwapApprovalRequired':
|
|
1305
|
-
* case 'SwapByIntentWithApprovalRequired':
|
|
1306
1830
|
* return sendTransaction(plan.transaction);
|
|
1307
1831
|
*
|
|
1832
|
+
* case 'SwapByIntentWithApprovalRequired':
|
|
1833
|
+
* return sendTransaction(plan.approval);
|
|
1834
|
+
*
|
|
1308
1835
|
* case 'SwapTransactionRequest':
|
|
1309
1836
|
* return sendTransaction(plan.transaction);
|
|
1310
1837
|
* }
|
|
@@ -1313,11 +1840,11 @@ type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAs
|
|
|
1313
1840
|
* const result = await swap({
|
|
1314
1841
|
* market: {
|
|
1315
1842
|
* chainId: chainId(1),
|
|
1316
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6
|
|
1317
|
-
* sell: { erc20: evmAddress('0x6B175474E
|
|
1843
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1844
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1318
1845
|
* amount: bigDecimal('1000'),
|
|
1319
|
-
* kind: SwapKind.
|
|
1320
|
-
* user: evmAddress('0x742d35cc
|
|
1846
|
+
* kind: SwapKind.Sell,
|
|
1847
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1321
1848
|
* },
|
|
1322
1849
|
* });
|
|
1323
1850
|
*
|
|
@@ -1329,32 +1856,31 @@ type SwapHandler = (intent: SwapIntent, options: SwapHandlerOptions) => ResultAs
|
|
|
1329
1856
|
* // result.value: SwapReceipt
|
|
1330
1857
|
* ```
|
|
1331
1858
|
*/
|
|
1332
|
-
declare function
|
|
1333
|
-
type CancelSwapHandler = (data:
|
|
1859
|
+
declare function useTokenSwap(handler: TokenSwapHandler): UseAsyncTask<UseTokenSwapRequest, SwapReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
|
|
1860
|
+
type CancelSwapHandler = (data: SwapTypedData | TransactionRequest, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
|
|
1334
1861
|
declare class CannotCancelSwapError extends ResultAwareError {
|
|
1335
1862
|
name: "CannotCancelSwapError";
|
|
1336
1863
|
}
|
|
1337
1864
|
type CancelSwapError = CancelError | CannotCancelSwapError | SigningError | TimeoutError | TransactionError | UnexpectedError$1;
|
|
1338
1865
|
/**
|
|
1339
|
-
* @internal
|
|
1340
1866
|
* Executes the complete swap cancellation workflow combining preparation and execution.
|
|
1341
1867
|
*
|
|
1342
1868
|
* ```tsx
|
|
1343
1869
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1344
|
-
* const [
|
|
1870
|
+
* const [signSwapTypedData] = useSignSwapTypedData(wallet);
|
|
1345
1871
|
*
|
|
1346
|
-
* const [cancelSwap, {loading, error}] = useCancelSwap((plan
|
|
1872
|
+
* const [cancelSwap, { loading, error }] = useCancelSwap((plan) => {
|
|
1347
1873
|
* switch (plan.__typename) {
|
|
1348
1874
|
* case 'TransactionRequest':
|
|
1349
1875
|
* return sendTransaction(plan);
|
|
1350
1876
|
*
|
|
1351
|
-
* case '
|
|
1352
|
-
* return
|
|
1877
|
+
* case 'SwapTypedData':
|
|
1878
|
+
* return signSwapTypedData(plan);
|
|
1353
1879
|
* }
|
|
1354
1880
|
* });
|
|
1355
1881
|
*
|
|
1356
1882
|
* const result = await cancelSwap({
|
|
1357
|
-
* id: swapId('123
|
|
1883
|
+
* id: swapId('123…'),
|
|
1358
1884
|
* });
|
|
1359
1885
|
*
|
|
1360
1886
|
* if (result.isErr()) {
|
|
@@ -1627,62 +2153,21 @@ declare function useWithdraw(handler: TransactionHandler): UseAsyncTask<Withdraw
|
|
|
1627
2153
|
*/
|
|
1628
2154
|
declare function useRenounceSpokeUserPositionManager(handler: TransactionHandler): UseAsyncTask<RenounceSpokeUserPositionManagerRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1629
2155
|
/**
|
|
1630
|
-
*
|
|
2156
|
+
* Hook for updating user position conditions (dynamic config and/or risk premium).
|
|
1631
2157
|
*
|
|
1632
2158
|
* ```ts
|
|
1633
2159
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1634
|
-
* const [
|
|
2160
|
+
* const [update, { loading, error }] = useUpdateUserPositionConditions((transaction, { cancel }) => {
|
|
1635
2161
|
* return sendTransaction(transaction);
|
|
1636
2162
|
* });
|
|
1637
2163
|
*
|
|
1638
2164
|
* // …
|
|
1639
2165
|
*
|
|
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);
|
|
2166
|
+
* const result = await update({
|
|
2167
|
+
* userPositionId: userPosition.id,
|
|
2168
|
+
* update: UserPositionConditionsUpdate.AllDynamicConfig,
|
|
1680
2169
|
* });
|
|
1681
2170
|
*
|
|
1682
|
-
* // …
|
|
1683
|
-
*
|
|
1684
|
-
* const result = await updateUserDynamicConfig({ ... });
|
|
1685
|
-
*
|
|
1686
2171
|
* if (result.isErr()) {
|
|
1687
2172
|
* switch (result.error.name) {
|
|
1688
2173
|
* case 'CancelError':
|
|
@@ -1713,20 +2198,24 @@ declare function useUpdateUserRiskPremium(handler: TransactionHandler): UseAsync
|
|
|
1713
2198
|
*
|
|
1714
2199
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1715
2200
|
*/
|
|
1716
|
-
declare function
|
|
2201
|
+
declare function useUpdateUserPositionConditions(handler: TransactionHandler): UseAsyncTask<UpdateUserPositionConditionsRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1717
2202
|
/**
|
|
1718
|
-
* Hook for
|
|
2203
|
+
* Hook for updating the collateral status of user's supplies.
|
|
1719
2204
|
*
|
|
1720
2205
|
* ```ts
|
|
1721
2206
|
* const [sendTransaction] = useSendTransaction(wallet);
|
|
1722
|
-
* const [
|
|
2207
|
+
* const [setUserSuppliesAsCollateral, { loading, error }] = useSetUserSuppliesAsCollateral((transaction, { cancel }) => {
|
|
1723
2208
|
* return sendTransaction(transaction);
|
|
1724
2209
|
* });
|
|
1725
2210
|
*
|
|
1726
|
-
* const result = await
|
|
1727
|
-
*
|
|
1728
|
-
*
|
|
1729
|
-
*
|
|
2211
|
+
* const result = await setUserSuppliesAsCollateral({
|
|
2212
|
+
* changes: [
|
|
2213
|
+
* {
|
|
2214
|
+
* reserve: reserve.id,
|
|
2215
|
+
* enableCollateral: true
|
|
2216
|
+
* }
|
|
2217
|
+
* ],
|
|
2218
|
+
* sender: evmAddress('0x456...')
|
|
1730
2219
|
* });
|
|
1731
2220
|
*
|
|
1732
2221
|
* if (result.isErr()) {
|
|
@@ -1759,7 +2248,7 @@ declare function useUpdateUserDynamicConfig(handler: TransactionHandler): UseAsy
|
|
|
1759
2248
|
*
|
|
1760
2249
|
* @param handler - The handler that will be used to handle the transaction.
|
|
1761
2250
|
*/
|
|
1762
|
-
declare function
|
|
2251
|
+
declare function useSetUserSuppliesAsCollateral(handler: TransactionHandler): UseAsyncTask<SetUserSuppliesAsCollateralRequest, TxHash, SendTransactionError | PendingTransactionError>;
|
|
1763
2252
|
/**
|
|
1764
2253
|
* A hook that provides a way to liquidate a user's position.
|
|
1765
2254
|
*
|
|
@@ -2011,7 +2500,7 @@ declare function usePreview(args: UsePreviewArgs): ReadResult<PreviewUserPositio
|
|
|
2011
2500
|
* ```
|
|
2012
2501
|
*/
|
|
2013
2502
|
declare function usePreview(args: Pausable<UsePreviewArgs>): PausableReadResult<PreviewUserPosition>;
|
|
2014
|
-
type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions>;
|
|
2503
|
+
type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2015
2504
|
/**
|
|
2016
2505
|
* Fetch paginated list of activities.
|
|
2017
2506
|
*
|
|
@@ -2093,9 +2582,9 @@ declare function useActivities(args: Pausable<UseActivitiesArgs>): PausableReadR
|
|
|
2093
2582
|
* @param options - The query options.
|
|
2094
2583
|
* @returns The user history.
|
|
2095
2584
|
*/
|
|
2096
|
-
declare function useActivitiesAction(options?:
|
|
2585
|
+
declare function useActivitiesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError>;
|
|
2097
2586
|
|
|
2098
|
-
type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions>;
|
|
2587
|
+
type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2099
2588
|
/**
|
|
2100
2589
|
* Fetch all user supply positions.
|
|
2101
2590
|
*
|
|
@@ -2208,8 +2697,8 @@ declare function useUserSupplies(args: Pausable<UseUserSuppliesArgs>): PausableR
|
|
|
2208
2697
|
* }
|
|
2209
2698
|
* ```
|
|
2210
2699
|
*/
|
|
2211
|
-
declare function useUserSuppliesAction(options?:
|
|
2212
|
-
type UseUserBorrowsArgs = Prettify<UserBorrowsRequest & CurrencyQueryOptions>;
|
|
2700
|
+
declare function useUserSuppliesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<UserSuppliesRequest, UserSupplyItem[], UnexpectedError>;
|
|
2701
|
+
type UseUserBorrowsArgs = Prettify<UserBorrowsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
2213
2702
|
/**
|
|
2214
2703
|
* Fetch all user borrow positions.
|
|
2215
2704
|
*
|
|
@@ -2315,7 +2804,7 @@ declare function useUserBorrows(args: Pausable<UseUserBorrowsArgs>): PausableRea
|
|
|
2315
2804
|
* }
|
|
2316
2805
|
* ```
|
|
2317
2806
|
*/
|
|
2318
|
-
declare function useUserBorrowsAction(options?:
|
|
2807
|
+
declare function useUserBorrowsAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<UserBorrowsRequest, UserBorrowItem[], UnexpectedError>;
|
|
2319
2808
|
type UseUserSummaryArgs = Prettify<UserSummaryRequest & TimeWindowQueryOptions & CurrencyQueryOptions>;
|
|
2320
2809
|
/**
|
|
2321
2810
|
* Fetch a user's financial summary.
|
|
@@ -2578,6 +3067,69 @@ declare function useUserBalances(args: UseUserBalancesArgs): ReadResult<UserBala
|
|
|
2578
3067
|
* ```
|
|
2579
3068
|
*/
|
|
2580
3069
|
declare function useUserBalances(args: Pausable<UseUserBalancesArgs>): PausableReadResult<UserBalance[]>;
|
|
3070
|
+
type UseUserRiskPremiumBreakdownArgs = UserRiskPremiumBreakdownRequest;
|
|
3071
|
+
/**
|
|
3072
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3073
|
+
*
|
|
3074
|
+
* This signature supports React Suspense:
|
|
3075
|
+
*
|
|
3076
|
+
* ```tsx
|
|
3077
|
+
* const { data } = useUserRiskPremiumBreakdown({
|
|
3078
|
+
* query: {
|
|
3079
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3080
|
+
* },
|
|
3081
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3082
|
+
* suspense: true,
|
|
3083
|
+
* });
|
|
3084
|
+
* ```
|
|
3085
|
+
*/
|
|
3086
|
+
declare function useUserRiskPremiumBreakdown(args: UseUserRiskPremiumBreakdownArgs & Suspendable): SuspenseResult<UserRiskPremiumBreakdownItem[]>;
|
|
3087
|
+
/**
|
|
3088
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3089
|
+
*
|
|
3090
|
+
* Pausable suspense mode.
|
|
3091
|
+
*
|
|
3092
|
+
* ```tsx
|
|
3093
|
+
* const { data } = useUserRiskPremiumBreakdown({
|
|
3094
|
+
* query: {
|
|
3095
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3096
|
+
* },
|
|
3097
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3098
|
+
* suspense: true,
|
|
3099
|
+
* pause: true,
|
|
3100
|
+
* });
|
|
3101
|
+
* ```
|
|
3102
|
+
*/
|
|
3103
|
+
declare function useUserRiskPremiumBreakdown(args: Pausable<UseUserRiskPremiumBreakdownArgs> & Suspendable): PausableSuspenseResult<UserRiskPremiumBreakdownItem[]>;
|
|
3104
|
+
/**
|
|
3105
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3106
|
+
*
|
|
3107
|
+
* ```tsx
|
|
3108
|
+
* const { data, error, loading } = useUserRiskPremiumBreakdown({
|
|
3109
|
+
* query: {
|
|
3110
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3111
|
+
* },
|
|
3112
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3113
|
+
* });
|
|
3114
|
+
* ```
|
|
3115
|
+
*/
|
|
3116
|
+
declare function useUserRiskPremiumBreakdown(args: UseUserRiskPremiumBreakdownArgs): ReadResult<UserRiskPremiumBreakdownItem[]>;
|
|
3117
|
+
/**
|
|
3118
|
+
* Fetch the risk premium breakdown for a user position or spoke.
|
|
3119
|
+
*
|
|
3120
|
+
* Pausable loading state mode.
|
|
3121
|
+
*
|
|
3122
|
+
* ```tsx
|
|
3123
|
+
* const { data, error, loading, paused } = useUserRiskPremiumBreakdown({
|
|
3124
|
+
* query: {
|
|
3125
|
+
* userPositionId: userPositionId('SGVsbG8h'),
|
|
3126
|
+
* },
|
|
3127
|
+
* user: evmAddress('0x742d35cc…'),
|
|
3128
|
+
* pause: true,
|
|
3129
|
+
* });
|
|
3130
|
+
* ```
|
|
3131
|
+
*/
|
|
3132
|
+
declare function useUserRiskPremiumBreakdown(args: Pausable<UseUserRiskPremiumBreakdownArgs>): PausableReadResult<UserRiskPremiumBreakdownItem[]>;
|
|
2581
3133
|
/**
|
|
2582
3134
|
* Low-level hook to execute a {@link userBalances} action directly.
|
|
2583
3135
|
*
|
|
@@ -2667,4 +3219,4 @@ declare function useUserSummaryHistory(args: UseUserSummaryHistoryArgs): ReadRes
|
|
|
2667
3219
|
*/
|
|
2668
3220
|
declare function useUserSummaryHistory(args: Pausable<UseUserSummaryHistoryArgs>): PausableReadResult<UserSummaryHistoryItem[]>;
|
|
2669
3221
|
|
|
2670
|
-
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError,
|
|
3222
|
+
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 };
|