@aave/react 4.1.1 → 4.2.0
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +114 -4
- package/dist/index.d.ts +114 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export * from '@aave/client';
|
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
import { a as UseAsyncTask, C as CancelOperation, P as PendingTransaction, S as SendTransactionError, b as PendingTransactionError, c as cancel, E as ExecutionPlanHandler } from './writes-sBt0thuG.cjs';
|
|
5
5
|
export { A as AsyncTaskError, d as AsyncTaskIdle, e as AsyncTaskLoading, f as AsyncTaskState, g as AsyncTaskSuccess, T as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-sBt0thuG.cjs';
|
|
6
|
-
import { HubRequest, HubAssetInterestRateModelRequest, HubAssetsRequest, HubSummaryHistoryRequest, HubsRequest, Hub, HubAssetInterestRateModelPoint, HubAsset, HubSummarySample, AssetRequest, AssetBorrowHistoryRequest, AssetPriceHistoryRequest, AssetSupplyHistoryRequest, ProtocolHistoryRequest, Asset, AssetBorrowSample, AssetPriceSample, AssetSupplySample, ProtocolHistorySample, BorrowApyHistoryRequest, ReserveRequest, ReserveHoldersRequest, ReservesRequest, SupplyApyHistoryRequest, ApySample, Reserve, PaginatedReserveHoldersResult, UserClaimableRewardsRequest, UserClaimableReward, SpokeRequest, SpokePositionManagersRequest, SpokeUserPositionManagersRequest, SpokesRequest, Spoke, PaginatedSpokePositionManagerResult, PaginatedSpokeUserPositionManagerResult, PositionSwapApproval, SwapTypedData, SwapQuote, BorrowSwapQuoteRequest, SwapReceipt, InsufficientBalanceError, InsufficientLiquidityError, TransactionRequest, PrepareSwapCancelRequest, SwapCancelledResult, RepayWithSupplyQuoteRequest, SupplySwapQuoteRequest, SwappableTokensRequest, Token, SwapStatusRequest, SwapStatus, Erc20Approval, SwapTransactionRequest, TokenSwapQuoteRequest, UserSwapsRequest, PaginatedUserSwapsResult, WithdrawSwapQuoteRequest, PreContractActionRequired, BorrowRequest, ClaimRewardsRequest, LiquidatePositionRequest, PreviewRequest, PreviewUserPosition, RenounceSpokeUserPositionManagerRequest, RepayRequest, SetSpokeUserPositionManagerRequest, SetUserSuppliesAsCollateralRequest, SupplyRequest, UpdateUserPositionConditionsRequest, WithdrawRequest, UserBalancesRequest, UserBorrowsRequest, UserPositionRequest, UserPositionsRequest, UserRiskPremiumBreakdownRequest, UserSummaryRequest, UserSummaryHistoryRequest, UserSuppliesRequest, UserBalance, UserBorrowItem, UserPosition, UserRiskPremiumBreakdownItem, UserSummary, UserSummaryHistoryItem, UserSupplyItem, StableVaultRequest, StableVaultClaimStatusRequest, StableVaultUserPositionsRequest, StableVaultsRequest, StableVault, StableVaultClaimStatus, StableVaultDepositRequest, StableVaultUserPosition, StableVaultWithdrawRequest, StableVaultWithdrawClaim, StableVaultWithdrawRedeemRequest } from '@aave/graphql';
|
|
6
|
+
import { HubRequest, HubAssetInterestRateModelRequest, HubAssetsRequest, HubSpokeConfigsRequest, HubSummaryHistoryRequest, HubsRequest, Hub, HubAssetInterestRateModelPoint, HubAsset, HubSpokeConfig, HubSummarySample, AssetRequest, AssetBorrowHistoryRequest, AssetPriceHistoryRequest, AssetSupplyHistoryRequest, ProtocolHistoryRequest, Asset, AssetBorrowSample, AssetPriceSample, AssetSupplySample, ProtocolHistorySample, BorrowApyHistoryRequest, ReserveRequest, ReserveHoldersRequest, ReservesRequest, SupplyApyHistoryRequest, ApySample, Reserve, PaginatedReserveHoldersResult, UserClaimableRewardsRequest, UserClaimableReward, SpokeRequest, SpokePositionManagersRequest, SpokeSummaryHistoryRequest, SpokeUserPositionManagersRequest, SpokesRequest, Spoke, PaginatedSpokePositionManagerResult, SpokeSummarySample, PaginatedSpokeUserPositionManagerResult, PositionSwapApproval, SwapTypedData, SwapQuote, BorrowSwapQuoteRequest, SwapReceipt, InsufficientBalanceError, InsufficientLiquidityError, TransactionRequest, PrepareSwapCancelRequest, SwapCancelledResult, RepayWithSupplyQuoteRequest, SupplySwapQuoteRequest, SwappableTokensRequest, Token, SwapStatusRequest, SwapStatus, Erc20Approval, SwapTransactionRequest, TokenSwapQuoteRequest, UserSwapsRequest, PaginatedUserSwapsResult, WithdrawSwapQuoteRequest, PreContractActionRequired, BorrowRequest, ClaimRewardsRequest, LiquidatePositionRequest, PreviewRequest, PreviewUserPosition, RenounceSpokeUserPositionManagerRequest, RepayRequest, SetSpokeUserPositionManagerRequest, SetUserSuppliesAsCollateralRequest, SupplyRequest, UpdateUserPositionConditionsRequest, WithdrawRequest, UserBalancesRequest, UserBorrowsRequest, UserPositionRequest, UserPositionsRequest, UserRiskPremiumBreakdownRequest, UserSummaryRequest, UserSummaryHistoryRequest, UserSuppliesRequest, UserBalance, UserBorrowItem, UserPosition, UserRiskPremiumBreakdownItem, UserSummary, UserSummaryHistoryItem, UserSupplyItem, StableVaultRequest, StableVaultClaimStatusRequest, StableVaultUserPositionsRequest, StableVaultsRequest, StableVault, StableVaultClaimStatus, StableVaultDepositRequest, StableVaultUserPosition, StableVaultWithdrawRequest, StableVaultWithdrawClaim, StableVaultWithdrawRedeemRequest } from '@aave/graphql';
|
|
7
7
|
import { Prettify, ResultAsync, Signature, ResultAwareError } from '@aave/types';
|
|
8
8
|
import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult } from './misc-BYT0opC5.cjs';
|
|
9
9
|
export { d as UseChainArgs, e as UseChainsArgs, f as UseExchangeRateArgs, U as UseNetworkFee, g as UseNetworkFeeArgs, h as UseNetworkFeeRequestQuery, u as useChain, i as useChainAction, j as useChains, k as useExchangeRate, l as useExchangeRateAction } from './misc-BYT0opC5.cjs';
|
|
@@ -367,6 +367,61 @@ declare function useHubAssetInterestRateModelAction(options?: Required<CurrencyQ
|
|
|
367
367
|
* ```
|
|
368
368
|
*/
|
|
369
369
|
declare function useHubsAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<HubsRequest, Hub[], UnexpectedError>;
|
|
370
|
+
type UseHubSpokeConfigsArgs = Prettify<HubSpokeConfigsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
371
|
+
/**
|
|
372
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
373
|
+
*
|
|
374
|
+
* This signature supports React Suspense:
|
|
375
|
+
*
|
|
376
|
+
* ```tsx
|
|
377
|
+
* const { data } = useHubSpokeConfigs({
|
|
378
|
+
* hubId: hubId('SGVsbG8h'),
|
|
379
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
380
|
+
* suspense: true,
|
|
381
|
+
* });
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
declare function useHubSpokeConfigs(args: UseHubSpokeConfigsArgs & Suspendable): SuspenseResult<HubSpokeConfig[]>;
|
|
385
|
+
/**
|
|
386
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
387
|
+
*
|
|
388
|
+
* Pausable suspense mode.
|
|
389
|
+
*
|
|
390
|
+
* ```tsx
|
|
391
|
+
* const { data } = useHubSpokeConfigs({
|
|
392
|
+
* hubId: hubId('SGVsbG8h'),
|
|
393
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
394
|
+
* suspense: true,
|
|
395
|
+
* pause: true,
|
|
396
|
+
* });
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
declare function useHubSpokeConfigs(args: Pausable<UseHubSpokeConfigsArgs> & Suspendable): PausableSuspenseResult<HubSpokeConfig[]>;
|
|
400
|
+
/**
|
|
401
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
402
|
+
*
|
|
403
|
+
* ```tsx
|
|
404
|
+
* const { data, error, loading } = useHubSpokeConfigs({
|
|
405
|
+
* hubId: hubId('SGVsbG8h'),
|
|
406
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
407
|
+
* });
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
declare function useHubSpokeConfigs(args: UseHubSpokeConfigsArgs): ReadResult<HubSpokeConfig[]>;
|
|
411
|
+
/**
|
|
412
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
413
|
+
*
|
|
414
|
+
* Pausable loading state mode.
|
|
415
|
+
*
|
|
416
|
+
* ```tsx
|
|
417
|
+
* const { data, error, loading, paused } = useHubSpokeConfigs({
|
|
418
|
+
* hubId: hubId('SGVsbG8h'),
|
|
419
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
420
|
+
* pause: true,
|
|
421
|
+
* });
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
declare function useHubSpokeConfigs(args: Pausable<UseHubSpokeConfigsArgs>): PausableReadResult<HubSpokeConfig[]>;
|
|
370
425
|
|
|
371
426
|
type UseAssetArgs = Prettify<AssetRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
372
427
|
/**
|
|
@@ -1098,7 +1153,7 @@ declare function useUserClaimableRewards(args: Pausable<UseUserClaimableRewardsA
|
|
|
1098
1153
|
*/
|
|
1099
1154
|
declare function useUserClaimableRewardsAction(): UseAsyncTask<UserClaimableRewardsRequest, UserClaimableReward[], UnexpectedError>;
|
|
1100
1155
|
|
|
1101
|
-
type UseSpokeArgs = SpokeRequest
|
|
1156
|
+
type UseSpokeArgs = Prettify<SpokeRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1102
1157
|
/**
|
|
1103
1158
|
* Fetch a specific spoke.
|
|
1104
1159
|
*
|
|
@@ -1151,7 +1206,7 @@ declare function useSpoke(args: UseSpokeArgs): ReadResult<Spoke | null>;
|
|
|
1151
1206
|
* ```
|
|
1152
1207
|
*/
|
|
1153
1208
|
declare function useSpoke(args: Pausable<UseSpokeArgs>): PausableReadResult<Spoke | null>;
|
|
1154
|
-
type UseSpokesArgs = SpokesRequest
|
|
1209
|
+
type UseSpokesArgs = Prettify<SpokesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1155
1210
|
/**
|
|
1156
1211
|
* Fetch spokes based on specified criteria.
|
|
1157
1212
|
*
|
|
@@ -1253,6 +1308,61 @@ declare function useSpokePositionManagers(args: UseSpokePositionManagersArgs): R
|
|
|
1253
1308
|
* ```
|
|
1254
1309
|
*/
|
|
1255
1310
|
declare function useSpokePositionManagers(args: Pausable<UseSpokePositionManagersArgs>): PausableReadResult<PaginatedSpokePositionManagerResult>;
|
|
1311
|
+
type UseSpokeSummaryHistoryArgs = SpokeSummaryHistoryRequest;
|
|
1312
|
+
/**
|
|
1313
|
+
* Fetch historical summary data for a specific spoke.
|
|
1314
|
+
*
|
|
1315
|
+
* This signature supports React Suspense:
|
|
1316
|
+
*
|
|
1317
|
+
* ```tsx
|
|
1318
|
+
* const { data } = useSpokeSummaryHistory({
|
|
1319
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1320
|
+
* currency: Currency.Usd,
|
|
1321
|
+
* window: TimeWindow.LastWeek,
|
|
1322
|
+
* suspense: true,
|
|
1323
|
+
* });
|
|
1324
|
+
* ```
|
|
1325
|
+
*/
|
|
1326
|
+
declare function useSpokeSummaryHistory(args: UseSpokeSummaryHistoryArgs & Suspendable): SuspenseResult<SpokeSummarySample[]>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Fetch historical summary data for a specific spoke.
|
|
1329
|
+
*
|
|
1330
|
+
* Pausable suspense mode.
|
|
1331
|
+
*
|
|
1332
|
+
* ```tsx
|
|
1333
|
+
* const { data } = useSpokeSummaryHistory({
|
|
1334
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1335
|
+
* suspense: true,
|
|
1336
|
+
* pause: true,
|
|
1337
|
+
* });
|
|
1338
|
+
* ```
|
|
1339
|
+
*/
|
|
1340
|
+
declare function useSpokeSummaryHistory(args: Pausable<UseSpokeSummaryHistoryArgs> & Suspendable): PausableSuspenseResult<SpokeSummarySample[]>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Fetch historical summary data for a specific spoke.
|
|
1343
|
+
*
|
|
1344
|
+
* ```tsx
|
|
1345
|
+
* const { data, error, loading } = useSpokeSummaryHistory({
|
|
1346
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1347
|
+
* currency: Currency.Usd,
|
|
1348
|
+
* window: TimeWindow.LastWeek,
|
|
1349
|
+
* });
|
|
1350
|
+
* ```
|
|
1351
|
+
*/
|
|
1352
|
+
declare function useSpokeSummaryHistory(args: UseSpokeSummaryHistoryArgs): ReadResult<SpokeSummarySample[]>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Fetch historical summary data for a specific spoke.
|
|
1355
|
+
*
|
|
1356
|
+
* Pausable loading state mode.
|
|
1357
|
+
*
|
|
1358
|
+
* ```tsx
|
|
1359
|
+
* const { data, error, loading, paused } = useSpokeSummaryHistory({
|
|
1360
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1361
|
+
* pause: true,
|
|
1362
|
+
* });
|
|
1363
|
+
* ```
|
|
1364
|
+
*/
|
|
1365
|
+
declare function useSpokeSummaryHistory(args: Pausable<UseSpokeSummaryHistoryArgs>): PausableReadResult<SpokeSummarySample[]>;
|
|
1256
1366
|
type UseSpokeUserPositionManagersArgs = SpokeUserPositionManagersRequest;
|
|
1257
1367
|
/**
|
|
1258
1368
|
* Fetches all the position managers of a user for a specific spoke
|
|
@@ -3803,4 +3913,4 @@ declare function useStableVaults(args: UseStableVaultsArgs): ReadResult<StableVa
|
|
|
3803
3913
|
*/
|
|
3804
3914
|
declare function useStableVaults(args: Pausable<UseStableVaultsArgs>): PausableReadResult<StableVault[]>;
|
|
3805
3915
|
|
|
3806
|
-
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 UseHubAssetInterestRateModelArgs, type UseHubAssetsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReserveHoldersArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseStableVaultArgs, type UseStableVaultClaimStatusArgs, type UseStableVaultUserPositionsArgs, type UseStableVaultsArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapStatusArgs, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserClaimableRewardsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useClaimRewards, useHub, useHubAssetInterestRateModel, useHubAssetInterestRateModelAction, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserveHolders, useReserveHoldersAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useStableVault, useStableVaultClaimStatus, useStableVaultDeposit, useStableVaultUserPositions, useStableVaultWithdraw, useStableVaultWithdrawRedeem, useStableVaults, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwapStatus, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserClaimableRewards, useUserClaimableRewardsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|
|
3916
|
+
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 UseHubAssetInterestRateModelArgs, type UseHubAssetsArgs, type UseHubSpokeConfigsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReserveHoldersArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeSummaryHistoryArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseStableVaultArgs, type UseStableVaultClaimStatusArgs, type UseStableVaultUserPositionsArgs, type UseStableVaultsArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapStatusArgs, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserClaimableRewardsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useClaimRewards, useHub, useHubAssetInterestRateModel, useHubAssetInterestRateModelAction, useHubAssets, useHubSpokeConfigs, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserveHolders, useReserveHoldersAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeSummaryHistory, useSpokeUserPositionManagers, useSpokes, useStableVault, useStableVaultClaimStatus, useStableVaultDeposit, useStableVaultUserPositions, useStableVaultWithdraw, useStableVaultWithdrawRedeem, useStableVaults, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwapStatus, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserClaimableRewards, useUserClaimableRewardsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from '@aave/client';
|
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
import { a as UseAsyncTask, C as CancelOperation, P as PendingTransaction, S as SendTransactionError, b as PendingTransactionError, c as cancel, E as ExecutionPlanHandler } from './writes-sBt0thuG.js';
|
|
5
5
|
export { A as AsyncTaskError, d as AsyncTaskIdle, e as AsyncTaskLoading, f as AsyncTaskState, g as AsyncTaskSuccess, T as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-sBt0thuG.js';
|
|
6
|
-
import { HubRequest, HubAssetInterestRateModelRequest, HubAssetsRequest, HubSummaryHistoryRequest, HubsRequest, Hub, HubAssetInterestRateModelPoint, HubAsset, HubSummarySample, AssetRequest, AssetBorrowHistoryRequest, AssetPriceHistoryRequest, AssetSupplyHistoryRequest, ProtocolHistoryRequest, Asset, AssetBorrowSample, AssetPriceSample, AssetSupplySample, ProtocolHistorySample, BorrowApyHistoryRequest, ReserveRequest, ReserveHoldersRequest, ReservesRequest, SupplyApyHistoryRequest, ApySample, Reserve, PaginatedReserveHoldersResult, UserClaimableRewardsRequest, UserClaimableReward, SpokeRequest, SpokePositionManagersRequest, SpokeUserPositionManagersRequest, SpokesRequest, Spoke, PaginatedSpokePositionManagerResult, PaginatedSpokeUserPositionManagerResult, PositionSwapApproval, SwapTypedData, SwapQuote, BorrowSwapQuoteRequest, SwapReceipt, InsufficientBalanceError, InsufficientLiquidityError, TransactionRequest, PrepareSwapCancelRequest, SwapCancelledResult, RepayWithSupplyQuoteRequest, SupplySwapQuoteRequest, SwappableTokensRequest, Token, SwapStatusRequest, SwapStatus, Erc20Approval, SwapTransactionRequest, TokenSwapQuoteRequest, UserSwapsRequest, PaginatedUserSwapsResult, WithdrawSwapQuoteRequest, PreContractActionRequired, BorrowRequest, ClaimRewardsRequest, LiquidatePositionRequest, PreviewRequest, PreviewUserPosition, RenounceSpokeUserPositionManagerRequest, RepayRequest, SetSpokeUserPositionManagerRequest, SetUserSuppliesAsCollateralRequest, SupplyRequest, UpdateUserPositionConditionsRequest, WithdrawRequest, UserBalancesRequest, UserBorrowsRequest, UserPositionRequest, UserPositionsRequest, UserRiskPremiumBreakdownRequest, UserSummaryRequest, UserSummaryHistoryRequest, UserSuppliesRequest, UserBalance, UserBorrowItem, UserPosition, UserRiskPremiumBreakdownItem, UserSummary, UserSummaryHistoryItem, UserSupplyItem, StableVaultRequest, StableVaultClaimStatusRequest, StableVaultUserPositionsRequest, StableVaultsRequest, StableVault, StableVaultClaimStatus, StableVaultDepositRequest, StableVaultUserPosition, StableVaultWithdrawRequest, StableVaultWithdrawClaim, StableVaultWithdrawRedeemRequest } from '@aave/graphql';
|
|
6
|
+
import { HubRequest, HubAssetInterestRateModelRequest, HubAssetsRequest, HubSpokeConfigsRequest, HubSummaryHistoryRequest, HubsRequest, Hub, HubAssetInterestRateModelPoint, HubAsset, HubSpokeConfig, HubSummarySample, AssetRequest, AssetBorrowHistoryRequest, AssetPriceHistoryRequest, AssetSupplyHistoryRequest, ProtocolHistoryRequest, Asset, AssetBorrowSample, AssetPriceSample, AssetSupplySample, ProtocolHistorySample, BorrowApyHistoryRequest, ReserveRequest, ReserveHoldersRequest, ReservesRequest, SupplyApyHistoryRequest, ApySample, Reserve, PaginatedReserveHoldersResult, UserClaimableRewardsRequest, UserClaimableReward, SpokeRequest, SpokePositionManagersRequest, SpokeSummaryHistoryRequest, SpokeUserPositionManagersRequest, SpokesRequest, Spoke, PaginatedSpokePositionManagerResult, SpokeSummarySample, PaginatedSpokeUserPositionManagerResult, PositionSwapApproval, SwapTypedData, SwapQuote, BorrowSwapQuoteRequest, SwapReceipt, InsufficientBalanceError, InsufficientLiquidityError, TransactionRequest, PrepareSwapCancelRequest, SwapCancelledResult, RepayWithSupplyQuoteRequest, SupplySwapQuoteRequest, SwappableTokensRequest, Token, SwapStatusRequest, SwapStatus, Erc20Approval, SwapTransactionRequest, TokenSwapQuoteRequest, UserSwapsRequest, PaginatedUserSwapsResult, WithdrawSwapQuoteRequest, PreContractActionRequired, BorrowRequest, ClaimRewardsRequest, LiquidatePositionRequest, PreviewRequest, PreviewUserPosition, RenounceSpokeUserPositionManagerRequest, RepayRequest, SetSpokeUserPositionManagerRequest, SetUserSuppliesAsCollateralRequest, SupplyRequest, UpdateUserPositionConditionsRequest, WithdrawRequest, UserBalancesRequest, UserBorrowsRequest, UserPositionRequest, UserPositionsRequest, UserRiskPremiumBreakdownRequest, UserSummaryRequest, UserSummaryHistoryRequest, UserSuppliesRequest, UserBalance, UserBorrowItem, UserPosition, UserRiskPremiumBreakdownItem, UserSummary, UserSummaryHistoryItem, UserSupplyItem, StableVaultRequest, StableVaultClaimStatusRequest, StableVaultUserPositionsRequest, StableVaultsRequest, StableVault, StableVaultClaimStatus, StableVaultDepositRequest, StableVaultUserPosition, StableVaultWithdrawRequest, StableVaultWithdrawClaim, StableVaultWithdrawRedeemRequest } from '@aave/graphql';
|
|
7
7
|
import { Prettify, ResultAsync, Signature, ResultAwareError } from '@aave/types';
|
|
8
8
|
import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult } from './misc-mjFkGr9I.js';
|
|
9
9
|
export { d as UseChainArgs, e as UseChainsArgs, f as UseExchangeRateArgs, U as UseNetworkFee, g as UseNetworkFeeArgs, h as UseNetworkFeeRequestQuery, u as useChain, i as useChainAction, j as useChains, k as useExchangeRate, l as useExchangeRateAction } from './misc-mjFkGr9I.js';
|
|
@@ -367,6 +367,61 @@ declare function useHubAssetInterestRateModelAction(options?: Required<CurrencyQ
|
|
|
367
367
|
* ```
|
|
368
368
|
*/
|
|
369
369
|
declare function useHubsAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<HubsRequest, Hub[], UnexpectedError>;
|
|
370
|
+
type UseHubSpokeConfigsArgs = Prettify<HubSpokeConfigsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
371
|
+
/**
|
|
372
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
373
|
+
*
|
|
374
|
+
* This signature supports React Suspense:
|
|
375
|
+
*
|
|
376
|
+
* ```tsx
|
|
377
|
+
* const { data } = useHubSpokeConfigs({
|
|
378
|
+
* hubId: hubId('SGVsbG8h'),
|
|
379
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
380
|
+
* suspense: true,
|
|
381
|
+
* });
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
declare function useHubSpokeConfigs(args: UseHubSpokeConfigsArgs & Suspendable): SuspenseResult<HubSpokeConfig[]>;
|
|
385
|
+
/**
|
|
386
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
387
|
+
*
|
|
388
|
+
* Pausable suspense mode.
|
|
389
|
+
*
|
|
390
|
+
* ```tsx
|
|
391
|
+
* const { data } = useHubSpokeConfigs({
|
|
392
|
+
* hubId: hubId('SGVsbG8h'),
|
|
393
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
394
|
+
* suspense: true,
|
|
395
|
+
* pause: true,
|
|
396
|
+
* });
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
declare function useHubSpokeConfigs(args: Pausable<UseHubSpokeConfigsArgs> & Suspendable): PausableSuspenseResult<HubSpokeConfig[]>;
|
|
400
|
+
/**
|
|
401
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
402
|
+
*
|
|
403
|
+
* ```tsx
|
|
404
|
+
* const { data, error, loading } = useHubSpokeConfigs({
|
|
405
|
+
* hubId: hubId('SGVsbG8h'),
|
|
406
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
407
|
+
* });
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
declare function useHubSpokeConfigs(args: UseHubSpokeConfigsArgs): ReadResult<HubSpokeConfig[]>;
|
|
411
|
+
/**
|
|
412
|
+
* Fetch per-asset configuration for a (hub, spoke) pair.
|
|
413
|
+
*
|
|
414
|
+
* Pausable loading state mode.
|
|
415
|
+
*
|
|
416
|
+
* ```tsx
|
|
417
|
+
* const { data, error, loading, paused } = useHubSpokeConfigs({
|
|
418
|
+
* hubId: hubId('SGVsbG8h'),
|
|
419
|
+
* spokeId: spokeId('SGVsbG8h'),
|
|
420
|
+
* pause: true,
|
|
421
|
+
* });
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
declare function useHubSpokeConfigs(args: Pausable<UseHubSpokeConfigsArgs>): PausableReadResult<HubSpokeConfig[]>;
|
|
370
425
|
|
|
371
426
|
type UseAssetArgs = Prettify<AssetRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
372
427
|
/**
|
|
@@ -1098,7 +1153,7 @@ declare function useUserClaimableRewards(args: Pausable<UseUserClaimableRewardsA
|
|
|
1098
1153
|
*/
|
|
1099
1154
|
declare function useUserClaimableRewardsAction(): UseAsyncTask<UserClaimableRewardsRequest, UserClaimableReward[], UnexpectedError>;
|
|
1100
1155
|
|
|
1101
|
-
type UseSpokeArgs = SpokeRequest
|
|
1156
|
+
type UseSpokeArgs = Prettify<SpokeRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1102
1157
|
/**
|
|
1103
1158
|
* Fetch a specific spoke.
|
|
1104
1159
|
*
|
|
@@ -1151,7 +1206,7 @@ declare function useSpoke(args: UseSpokeArgs): ReadResult<Spoke | null>;
|
|
|
1151
1206
|
* ```
|
|
1152
1207
|
*/
|
|
1153
1208
|
declare function useSpoke(args: Pausable<UseSpokeArgs>): PausableReadResult<Spoke | null>;
|
|
1154
|
-
type UseSpokesArgs = SpokesRequest
|
|
1209
|
+
type UseSpokesArgs = Prettify<SpokesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1155
1210
|
/**
|
|
1156
1211
|
* Fetch spokes based on specified criteria.
|
|
1157
1212
|
*
|
|
@@ -1253,6 +1308,61 @@ declare function useSpokePositionManagers(args: UseSpokePositionManagersArgs): R
|
|
|
1253
1308
|
* ```
|
|
1254
1309
|
*/
|
|
1255
1310
|
declare function useSpokePositionManagers(args: Pausable<UseSpokePositionManagersArgs>): PausableReadResult<PaginatedSpokePositionManagerResult>;
|
|
1311
|
+
type UseSpokeSummaryHistoryArgs = SpokeSummaryHistoryRequest;
|
|
1312
|
+
/**
|
|
1313
|
+
* Fetch historical summary data for a specific spoke.
|
|
1314
|
+
*
|
|
1315
|
+
* This signature supports React Suspense:
|
|
1316
|
+
*
|
|
1317
|
+
* ```tsx
|
|
1318
|
+
* const { data } = useSpokeSummaryHistory({
|
|
1319
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1320
|
+
* currency: Currency.Usd,
|
|
1321
|
+
* window: TimeWindow.LastWeek,
|
|
1322
|
+
* suspense: true,
|
|
1323
|
+
* });
|
|
1324
|
+
* ```
|
|
1325
|
+
*/
|
|
1326
|
+
declare function useSpokeSummaryHistory(args: UseSpokeSummaryHistoryArgs & Suspendable): SuspenseResult<SpokeSummarySample[]>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Fetch historical summary data for a specific spoke.
|
|
1329
|
+
*
|
|
1330
|
+
* Pausable suspense mode.
|
|
1331
|
+
*
|
|
1332
|
+
* ```tsx
|
|
1333
|
+
* const { data } = useSpokeSummaryHistory({
|
|
1334
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1335
|
+
* suspense: true,
|
|
1336
|
+
* pause: true,
|
|
1337
|
+
* });
|
|
1338
|
+
* ```
|
|
1339
|
+
*/
|
|
1340
|
+
declare function useSpokeSummaryHistory(args: Pausable<UseSpokeSummaryHistoryArgs> & Suspendable): PausableSuspenseResult<SpokeSummarySample[]>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Fetch historical summary data for a specific spoke.
|
|
1343
|
+
*
|
|
1344
|
+
* ```tsx
|
|
1345
|
+
* const { data, error, loading } = useSpokeSummaryHistory({
|
|
1346
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1347
|
+
* currency: Currency.Usd,
|
|
1348
|
+
* window: TimeWindow.LastWeek,
|
|
1349
|
+
* });
|
|
1350
|
+
* ```
|
|
1351
|
+
*/
|
|
1352
|
+
declare function useSpokeSummaryHistory(args: UseSpokeSummaryHistoryArgs): ReadResult<SpokeSummarySample[]>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Fetch historical summary data for a specific spoke.
|
|
1355
|
+
*
|
|
1356
|
+
* Pausable loading state mode.
|
|
1357
|
+
*
|
|
1358
|
+
* ```tsx
|
|
1359
|
+
* const { data, error, loading, paused } = useSpokeSummaryHistory({
|
|
1360
|
+
* query: { spokeId: spokeId('SGVsbG8h') },
|
|
1361
|
+
* pause: true,
|
|
1362
|
+
* });
|
|
1363
|
+
* ```
|
|
1364
|
+
*/
|
|
1365
|
+
declare function useSpokeSummaryHistory(args: Pausable<UseSpokeSummaryHistoryArgs>): PausableReadResult<SpokeSummarySample[]>;
|
|
1256
1366
|
type UseSpokeUserPositionManagersArgs = SpokeUserPositionManagersRequest;
|
|
1257
1367
|
/**
|
|
1258
1368
|
* Fetches all the position managers of a user for a specific spoke
|
|
@@ -3803,4 +3913,4 @@ declare function useStableVaults(args: UseStableVaultsArgs): ReadResult<StableVa
|
|
|
3803
3913
|
*/
|
|
3804
3914
|
declare function useStableVaults(args: Pausable<UseStableVaultsArgs>): PausableReadResult<StableVault[]>;
|
|
3805
3915
|
|
|
3806
|
-
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 UseHubAssetInterestRateModelArgs, type UseHubAssetsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReserveHoldersArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseStableVaultArgs, type UseStableVaultClaimStatusArgs, type UseStableVaultUserPositionsArgs, type UseStableVaultsArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapStatusArgs, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserClaimableRewardsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useClaimRewards, useHub, useHubAssetInterestRateModel, useHubAssetInterestRateModelAction, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserveHolders, useReserveHoldersAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useStableVault, useStableVaultClaimStatus, useStableVaultDeposit, useStableVaultUserPositions, useStableVaultWithdraw, useStableVaultWithdrawRedeem, useStableVaults, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwapStatus, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserClaimableRewards, useUserClaimableRewardsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|
|
3916
|
+
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 UseHubAssetInterestRateModelArgs, type UseHubAssetsArgs, type UseHubSpokeConfigsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReserveHoldersArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeSummaryHistoryArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseStableVaultArgs, type UseStableVaultClaimStatusArgs, type UseStableVaultUserPositionsArgs, type UseStableVaultsArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapStatusArgs, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserClaimableRewardsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useClaimRewards, useHub, useHubAssetInterestRateModel, useHubAssetInterestRateModelAction, useHubAssets, useHubSpokeConfigs, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserveHolders, useReserveHoldersAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeSummaryHistory, useSpokeUserPositionManagers, useSpokes, useStableVault, useStableVaultClaimStatus, useStableVaultDeposit, useStableVaultUserPositions, useStableVaultWithdraw, useStableVaultWithdrawRedeem, useStableVaults, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwapStatus, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserClaimableRewards, useUserClaimableRewardsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b}from'./chunk-V6Q6TCNV.js';export{c as useChain,d as useChainAction,e as useChains,g as useExchangeRate,f as useExchangeRateAction}from'./chunk-V6Q6TCNV.js';import {a,b as b$1}from'./chunk-4NA4FB6K.js';export{b as useAaveClient}from'./chunk-4NA4FB6K.js';import {a as a$1,b as b$2,d,c}from'./chunk-4LHXPD6N.js';import {DEFAULT_QUERY_OPTIONS,supportsPermit,UnexpectedError as UnexpectedError$1,transactionReceipt}from'@aave/client';export*from'@aave/client';import Ie,{useState,useEffect,useCallback,useDeferredValue}from'react';import {hubAssetInterestRateModel,hubs,reserve,reserves,reserveHolders,userClaimableRewards,borrowSwapQuote,preparePositionSwap,swapStatus,prepareSwapCancel,cancelSwap,repayWithSupplyQuote,supplySwapQuote,swap,tokenSwapQuote,prepareTokenSwap,withdrawSwapQuote,activities,borrow,claimRewards,liquidatePosition,preview,renounceSpokeUserPositionManager,repay,setSpokeUserPositionManager,setUserSuppliesAsCollateral,supply,updateUserPositionConditions,withdraw,userSupplies,userBorrows,userPositions,userBalances,stableVaultDeposit,stableVaultWithdraw,stableVaultWithdrawRedeem}from'@aave/client/actions';import {HubQuery,HubsQuery,HubAssetsQuery,HubSummaryHistoryQuery,HubAssetInterestRateModelQuery,AssetQuery,AssetPriceHistoryQuery,AssetSupplyHistoryQuery,AssetBorrowHistoryQuery,ProtocolHistoryQuery,ReserveQuery,ReservesQuery,BorrowApyHistoryQuery,SupplyApyHistoryQuery,ReserveHoldersQuery,UserClaimableRewardsQuery,SpokeQuery,SpokesQuery,SpokePositionManagersQuery,SpokeUserPositionManagersQuery,BorrowSwapQuoteQuery,QuoteAccuracy,RepayWithSupplyQuoteQuery,SupplySwapQuoteQuery,SwappableTokensQuery,SwapStatusQuery,TokenSwapQuoteQuery,UserSwapsQuery,WithdrawSwapQuoteQuery,ActivitiesQuery,PreviewQuery,decodeReserveId,UserSuppliesQuery,UserBorrowsQuery,UserSummaryQuery,UserPositionsQuery,UserPositionQuery,UserBalancesQuery,UserRiskPremiumBreakdownQuery,UserSummaryHistoryQuery,StableVaultClaimStatusQuery,StableVaultUserPositionsQuery,StableVaultQuery,StableVaultsQuery,isSpokeInputVariant,isChainIdsVariant,decodeUserPositionId}from'@aave/graphql';import {ok,ResultAwareError,okAsync,never,isSignature,errAsync,ResultAsync,err,expectTypename}from'@aave/types';import {UnexpectedError,ValidationError}from'@aave/core';function Zt({children:e,client:r}){return Ie.createElement(a,{client:r},e)}function $e(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:r}=decodeUserPositionId(e.userPositionId);return r}function ze(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:r}=decodeUserPositionId(e.userPositionId);return r}function P(e,r){return e.refreshQueryWhere(UserBalancesQuery,s=>s.request.user===r)}function E(e,r){return e.refreshQueryWhere(UserSuppliesQuery,s=>$e(s.request.query)===r)}function q(e,r){return e.refreshQueryWhere(UserBorrowsQuery,s=>ze(s.request.query)===r)}function O(e,r,s){let t=a=>a.spoke.chain.chainId===s.chainId&&a.spoke.address===s.address&&a.user===r;return ResultAsync.combine([e.refreshQueryWhere(UserPositionsQuery,(a,n)=>n.some(t)),e.refreshQueryWhere(UserPositionQuery,(a,n)=>n!==null&&t(n))])}function D(e,r){let s=t=>r.includes(t.id);return ResultAsync.combine([e.refreshQueryWhere(ReserveQuery,(t,a)=>a!==null&&s(a)),e.refreshQueryWhere(ReservesQuery,(t,a)=>a.some(s))])}function Je(e,r){let s=r.map(decodeReserveId);return e.refreshQueryWhere(ReserveHoldersQuery,t=>{let{reserve:a}=t.request;return "reserveId"in a?r.includes(a.reserveId):s.some(n=>a.reserveInput.chainId===n.chainId&&a.reserveInput.spoke===n.spoke&&a.reserveInput.onChainId===n.onChainId)})}function _(e,r,s){return e.refreshQueryWhere(UserSummaryQuery,t=>t.request.user===r&&(isSpokeInputVariant(t.request.filter)?t.request.filter.spoke.chainId===s.chainId&&t.request.filter.spoke.address===s.address:isChainIdsVariant(t.request.filter)?t.request.filter.chainIds.some(a=>a===s.chainId):false))}function N(e,r){let s=t=>t.chain.chainId===r.chainId&&t.address===r.address;return ResultAsync.combine([e.refreshQueryWhere(SpokeQuery,(t,a)=>a!==null&&s(a)),e.refreshQueryWhere(SpokesQuery,(t,a)=>a.some(s))])}function M(e,r){let s=t=>t.chain.chainId===r;return ResultAsync.combine([e.refreshQueryWhere(HubQuery,(t,a)=>a!==null&&s(a)),e.refreshQueryWhere(HubsQuery,(t,a)=>a.some(s))])}function B(e,r){return e.refreshQueryWhere(SpokePositionManagersQuery,s=>s.request.spoke===r)}function z(e,r){return ResultAsync.combine([e.refreshQueryWhere(UserPositionsQuery,(s,t)=>t.some(a=>a.id===r)),e.refreshQueryWhere(UserPositionQuery,(s,t)=>t?.id===r)])}function g(e,r){let{chainId:s,spoke:t}=decodeReserveId(r.reserve),a={chainId:s,address:t};return ResultAsync.combine([O(e,r.sender,a),_(e,r.sender,a),D(e,[r.reserve]),Je(e,[r.reserve]),N(e,a),P(e,r.sender),E(e,r.sender),q(e,r.sender),M(e,s)])}function J(e,r){return P(e,r)}function X(e,r){return ResultAsync.combine([E(e,r),P(e,r)])}function Z(e,r){return ResultAsync.combine([q(e,r),P(e,r)])}function ee(e,r){return ResultAsync.combine([E(e,r),q(e,r),P(e,r)])}function re(e,r){return ResultAsync.combine([E(e,r),P(e,r)])}function ca({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:HubQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function ya({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:HubsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Sa({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:HubAssetsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function da({suspense:e=false,pause:r=false,...s}){return b({document:HubSummaryHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function ma({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:HubAssetInterestRateModelQuery,variables:{request:t,currency:s},suspense:e,pause:r,selector:a=>ok(a.points)})}function Ra(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>hubAssetInterestRateModel(r,s,{currency:e.currency,requestPolicy:"cache-first"}),[r,e.currency])}function fa(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>hubs(r,s,{currency:e.currency,requestPolicy:"cache-first"}),[r,e.currency])}function Pa({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:AssetQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function ga({suspense:e=false,pause:r=false,...s}){return b({document:AssetPriceHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Ta({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:AssetSupplyHistoryQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r,batch:false})}function xa({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:AssetBorrowHistoryQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r,batch:false})}function ha({suspense:e=false,pause:r=false,...s}){return b({document:ProtocolHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Ca({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:ReserveQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Ia(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>reserve(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Ba({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:ReservesQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Wa(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>reserves(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Va({suspense:e=false,pause:r=false,...s}){return b({document:BorrowApyHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Oa({suspense:e=false,pause:r=false,...s}){return b({document:SupplyApyHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Da({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:ReserveHoldersQuery,variables:{request:t,currency:s},suspense:e,pause:r})}function _a(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>reserveHolders(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,requestPolicy:"cache-first"}),[r,e.currency])}function Ka({suspense:e=false,pause:r=false,...s}){return b({document:UserClaimableRewardsQuery,variables:{request:s},suspense:e,pause:r})}function ja(){let e=b$1();return a$1(r=>userClaimableRewards(e,r,{requestPolicy:"cache-first"}),[e])}function Ja({suspense:e=false,pause:r=false,...s}){return b({document:SpokeQuery,variables:{request:s},suspense:e,pause:r})}function Xa({suspense:e=false,pause:r=false,...s}){return b({document:SpokesQuery,variables:{request:s},suspense:e,pause:r})}function Za({suspense:e=false,pause:r=false,...s}){return b({document:SpokePositionManagersQuery,variables:{request:s},suspense:e,pause:r})}function en({suspense:e=false,pause:r=false,...s}){return b({document:SpokeUserPositionManagersQuery,variables:{request:s},suspense:e,pause:r})}function m(e){switch(e.__typename){case "PositionSwapByIntentApprovalsRequired":return ok(e.quote);case "InsufficientLiquidityError":return err(ValidationError.fromGqlNode(e));default:return err(UnexpectedError.upgradeRequired(`Unsupported position swap quote result: ${e.__typename}`))}}function W(e){return e.__typename==="SwapFulfilled"||e.__typename==="SwapCancelled"||e.__typename==="SwapExpired"}function T(e){return {with:r=>e.approvals.reduce((s,t)=>s.andThen(a=>r(t,{cancel:b$2}).map(n=>{switch(t.__typename){case "PositionSwapAdapterContractApproval":a.adapterContractSignature=isSignature(n)?n:null;break;case "PositionSwapPositionManagerApproval":a.positionManagerSignature=isSignature(n)?n:null;break;case "PositionSwapSetCollateralApproval":a.setCollateralSignature=isSignature(n)?n:null;break}return a})),okAsync({quoteId:e.quote.quoteId,adapterContractSignature:null,positionManagerSignature:null,setCollateralSignature:null}))}}function x(e,r){return swap(e,{intent:r}).andThen(s=>{switch(s.__typename){case "SwapReceipt":return okAsync(s);default:return UnexpectedError.from(s).asResultAsync()}})}function kr(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>borrowSwapQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function oe(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Hr({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:BorrowSwapQuoteQuery,variables:{request:oe(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:BorrowSwapQuoteQuery,variables:{request:oe(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function Cr(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>borrowSwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function pe(e){return {__typename:"SwapCancelledResult",swapId:e.swapId,createdAt:e.createdAt,cancelledAt:e.cancelledAt,explorerUrl:e.explorerUrl}}var C=class extends ResultAwareError{name="CannotCancelSwapError"};function Vr(e){let r=b$1();return a$1(s=>swapStatus(r,{id:s.id}).andThen(t=>{if(t===null)return UnexpectedError.from("Swap not found").asResultAsync();switch(t.__typename){case "SwapOpen":case "SwapPendingSignature":return prepareSwapCancel(r,s).andThen(a=>e(a.data,{cancel:b$2})).andThen(d).andThen(a=>cancelSwap(r,{intent:{id:s.id,signature:a}})).andThen(a=>a.__typename==="SwapCancelledResult"?okAsync(a):e(a,{cancel:b$2}).andThen(c.tryFrom).andThen(n=>n.wait()).andThen(()=>swapStatus(r,{id:s.id})).andThen(n=>n?.__typename==="SwapCancelled"?okAsync(pe(n)):new C("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return okAsync(pe(t));case "SwapExpired":return new C("Swap cannot longer be cancelled").asResultAsync();default:return UnexpectedError.upgradeRequired(`Unsupported swap status: ${t.__typename}`).asResultAsync()}}),[r,e])}function _r(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>repayWithSupplyQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function ye(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Mr({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:RepayWithSupplyQuoteQuery,variables:{request:ye(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:RepayWithSupplyQuoteQuery,variables:{request:ye(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function Fr(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>repayWithSupplyQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function Kr(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>supplySwapQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function me(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Gr({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:SupplySwapQuoteQuery,variables:{request:me(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:SupplySwapQuoteQuery,variables:{request:me(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function $r(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>supplySwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function Jr({suspense:e=false,pause:r=false,...s}){return b({document:SwappableTokensQuery,variables:{request:s},suspense:e,pause:r})}function rs({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){let n=b$1(),[l,S]=useState(false),f=b({document:SwapStatusQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r||l,pollInterval:n.context.environment.swapStatusInterval});return useEffect(()=>{f.data&&W(f.data)&&S(true);},[f.data]),f}function is(e){let r=b$1(),s=useCallback(t=>swap(r,t).andThen(a=>{switch(a.__typename){case "SwapTransactionRequest":return e(a,{cancel:b$2}).andThen(c.tryFrom).andThen(n=>n.wait()).andThen(()=>okAsync(a.orderReceipt));case "SwapReceipt":return okAsync(a)}}),[r,e]);return a$1(({currency:t=DEFAULT_QUERY_OPTIONS.currency,...a})=>tokenSwapQuote(r,a,{currency:t}).andThen(n=>{switch(n.__typename){case "SwapByTransaction":return s({transaction:{quoteId:n.quote.quoteId}});case "SwapByIntent":return prepareTokenSwap(r,{quoteId:n.quote.quoteId}).andThen(l=>e(l.data,{cancel:b$2}).andThen(d).andThen(S=>s({intent:{quoteId:l.newQuoteId,signature:S}})));case "SwapByIntentWithApprovalRequired":if(supportsPermit(n)){let l=n.approvals[0];return e(l,{cancel:b$2}).andThen(S=>isSignature(S)?prepareTokenSwap(r,{quoteId:n.quote.quoteId,permitSig:{deadline:l.bySignature.message.deadline,value:S}}):c.isInstanceOf(S)?S.wait().andThen(()=>prepareTokenSwap(r,{quoteId:n.quote.quoteId})):UnexpectedError.from(S).asResultAsync()).andThen(S=>e(S.data,{cancel:b$2}).andThen(d).andThen(f=>s({intent:{quoteId:S.newQuoteId,signature:f}})))}return n.approvals.reduce((l,S)=>l.andThen(()=>e({...S,bySignature:null},{cancel:b$2}).andThen(c.tryFrom).andThen(f=>f.wait())),okAsync(void 0)).andThen(()=>prepareTokenSwap(r,{quoteId:n.quote.quoteId})).andThen(l=>e(l.data,{cancel:b$2})).andThen(d).andThen(l=>s({intent:{quoteId:n.quote.quoteId,signature:l}}));case "SwapByTransactionWithApprovalRequired":return n.approvals.reduce((l,S)=>l.andThen(()=>e({...S,bySignature:null},{cancel:b$2}).andThen(c.tryFrom).andThen(f=>f.wait())),okAsync(void 0)).andThen(()=>s({transaction:{quoteId:n.quote.quoteId}}));default:never(`Unsupported swap quote result: ${n.__typename}. To be removed from API soon.`);}}),[r,e,s])}function F(e){switch(e.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":case "SwapByTransactionWithApprovalRequired":return ok(e.quote);case "InsufficientLiquidityError":return err(ValidationError.fromGqlNode(e));default:return err(UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${e.__typename}`))}}function we(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Ss({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:TokenSwapQuoteQuery,variables:{request:we(t,QuoteAccuracy.Fast),currency:s},selector:F,suspense:e,pause:r,batch:false}),l=b({document:TokenSwapQuoteQuery,variables:{request:we(t,QuoteAccuracy.Accurate),currency:s},selector:F,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function ds(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>tokenSwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(F),[r,e.currency])}function As(e,r){let s=new Map(r.map(t=>[t.swapId,t.__typename]));return e.filter(t=>t.__typename==="SwapFulfilled"&&s.get(t.swapId)!=="SwapFulfilled")}function ws({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){let n=b$1(),[l,S]=useState(false),f=b({document:UserSwapsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r||l,pollInterval:n.context.environment.swapStatusInterval}),k=f.data?.items??[],L=useDeferredValue(k);return useEffect(()=>{if(k.length===0)return;k.every(W)&&S(true);for(let Ce of As(k,L))switch(Ce.operation.__typename){case "TokenSwap":a.user&&J(n,a.user);break;case "BorrowSwap":a.user&&Z(n,a.user);break;case "RepayWithSupply":a.user&&ee(n,a.user);break;case "SupplySwap":a.user&&X(n,a.user);break;case "WithdrawSwap":a.user&&re(n,a.user);break}},[k,L,n,a.user]),f}function gs(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>withdrawSwapQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function Te(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function xs({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:WithdrawSwapQuoteQuery,variables:{request:Te(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:WithdrawSwapQuoteQuery,variables:{request:Te(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function hs(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>withdrawSwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function Qs({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:ActivitiesQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function ks(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>activities(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Bs(e){let r=b$1();return a$1(s=>borrow(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return UnexpectedError$1.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function Os(e){let r=b$1();return a$1(s=>claimRewards(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(t=>t.operations?.length?r.waitForTransaction(t):okAsync(transactionReceipt(t.txHash))).andThrough(()=>(r.markRewardsClaimed(s.user,s.chainId,s.ids),okAsync(void 0))),[r,e])}function Ms(e,r){return {deadline:r.message.deadline,value:e}}function h(e,r){return e.approvals.reduce((s,t)=>s.andThen(()=>r({...t,bySignature:null},{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait())),okAsync(void 0)).map(()=>e.originalTransaction)}function v(e,r,s){let t=e.approvals[0];return r(t,{cancel:b$2}).andThen(a=>isSignature(a)?s(Ms(a,t.bySignature)).map(expectTypename("TransactionRequest")):a.wait().map(()=>e.originalTransaction))}function Ks(e,r){return "exact"in e.amount&&e.amount.exact?{...e,amount:{exact:{...e.amount.exact,permitSig:r}}}:e}function js(e){let r=b$1();return a$1(s=>liquidatePosition(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>liquidatePosition(r,Ks(s,a))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>P(r,s.liquidator)),[r,e])}function zs(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>preview(r,s,{currency:e.currency,requestPolicy:"network-only"}),[r,e.currency])}function Js({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:PreviewQuery,variables:{request:t,currency:s},suspense:e,pause:r})}function Zs(e){let r=b$1();return a$1(s=>renounceSpokeUserPositionManager(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>B(r,s.spoke)),[r,e])}function tt(e,r,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permit:{permitSig:r,signedAmount:s}}}}:e}function at(e){let r=b$1();return a$1(s=>repay(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>repay(r,tt(s,a,t.approvals[0].bySignature.signedAmount))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function ot(e){let r=b$1();return a$1(s=>setSpokeUserPositionManager(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>B(r,s.spoke)),[r,e])}function lt(e){let r=b$1();return a$1(s=>{let t=s.changes.map(n=>n.reserve),a=t.map(n=>decodeReserveId(n));return setUserSuppliesAsCollateral(r,s).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(r.waitForTransaction).andThrough(()=>ResultAsync.combine([E(r,s.sender),q(r,s.sender),...a.flatMap(({chainId:n,spoke:l})=>[O(r,s.sender,{chainId:n,address:l}),_(r,s.sender,{chainId:n,address:l}),N(r,{chainId:n,address:l})]),D(r,t),...a.map(({chainId:n})=>M(r,n))]))},[r,e])}function dt(e,r){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:r}}}:e}function mt(e){let r=b$1();return a$1(s=>supply(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>supply(r,dt(s,a))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function ft(e){let r=b$1();return a$1(s=>updateUserPositionConditions(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>z(r,s.userPositionId)),[r,e])}function Pt(e){let r=b$1();return a$1(s=>withdraw(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return UnexpectedError$1.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function Li({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserSuppliesQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Yi(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userSupplies(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Ki({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserBorrowsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function ji(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userBorrows(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Gi({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserSummaryQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function $i({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserPositionsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function zi(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userPositions(r,s,{currency:e.currency,timeWindow:e.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Ji({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserPositionQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Xi({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserBalancesQuery,variables:{request:t,currency:s},suspense:e,pause:r})}function Zi({suspense:e=false,pause:r=false,...s}){return b({document:UserRiskPremiumBreakdownQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function ep(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userBalances(r,s,{currency:e.currency,requestPolicy:"cache-first"}),[r,e.currency])}function rp({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserSummaryHistoryQuery,variables:{request:t,currency:s},suspense:e,pause:r,batch:false})}function Lt(e,r){return {...e,amount:{...e.amount,permitSig:r}}}function cp(e){let r=b$1();return a$1(s=>stableVaultDeposit(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>stableVaultDeposit(r,Lt(s,a))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>He(r,s.user)),[r,e])}function yp(e){let r=b$1();return a$1(s=>stableVaultWithdraw(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(r.waitForTransaction).andThrough(()=>He(r,s.user));case "StableVaultWithdrawClaim":return e(t.transaction,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(r.waitForTransaction).map(()=>t)}}),[r,e])}function Sp(e){let r=b$1();return a$1(s=>stableVaultWithdrawRedeem(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "StableVaultPendingAvailability":return UnexpectedError.from(`Funds not yet available. Please retry after ${t.executableAfter.toLocaleString()}`).asResultAsync()}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction),[r,e])}function dp({suspense:e=false,pause:r=false,...s}){let t=b$1();return b({document:StableVaultClaimStatusQuery,variables:{request:s},suspense:e,pause:r,pollInterval:t.context.environment.pollingInterval})}function mp({suspense:e=false,pause:r=false,...s}){return b({document:StableVaultUserPositionsQuery,variables:{request:s},suspense:e,pause:r})}function Rp({suspense:e=false,pause:r=false,...s}){return b({document:StableVaultQuery,variables:{request:s},suspense:e,pause:r})}function fp({suspense:e=false,pause:r=false,...s}){return b({document:StableVaultsQuery,variables:{request:s},suspense:e,pause:r})}function He(e,r){return e.refreshQueryWhere(StableVaultUserPositionsQuery,s=>s.request.user===r)}export{Zt as AaveProvider,C as CannotCancelSwapError,Qs as useActivities,ks as useActivitiesAction,Pa as useAsset,xa as useAssetBorrowHistory,ga as useAssetPriceHistory,Ta as useAssetSupplyHistory,Bs as useBorrow,Va as useBorrowApyHistory,kr as useBorrowSwap,Hr as useBorrowSwapQuote,Cr as useBorrowSwapQuoteAction,Vr as useCancelSwap,Os as useClaimRewards,ca as useHub,ma as useHubAssetInterestRateModel,Ra as useHubAssetInterestRateModelAction,Sa as useHubAssets,da as useHubSummaryHistory,ya as useHubs,fa as useHubsAction,js as useLiquidatePosition,Js as usePreview,zs as usePreviewAction,ha as useProtocolHistory,Zs as useRenounceSpokeUserPositionManager,at as useRepay,_r as useRepayWithSupply,Mr as useRepayWithSupplyQuote,Fr as useRepayWithSupplyQuoteAction,Ca as useReserve,Ia as useReserveAction,Da as useReserveHolders,_a as useReserveHoldersAction,Ba as useReserves,Wa as useReservesAction,ot as useSetSpokeUserPositionManager,lt as useSetUserSuppliesAsCollateral,Ja as useSpoke,Za as useSpokePositionManagers,en as useSpokeUserPositionManagers,Xa as useSpokes,Rp as useStableVault,dp as useStableVaultClaimStatus,cp as useStableVaultDeposit,mp as useStableVaultUserPositions,yp as useStableVaultWithdraw,Sp as useStableVaultWithdrawRedeem,fp as useStableVaults,mt as useSupply,Oa as useSupplyApyHistory,Kr as useSupplySwap,Gr as useSupplySwapQuote,$r as useSupplySwapQuoteAction,rs as useSwapStatus,Jr as useSwappableTokens,is as useTokenSwap,Ss as useTokenSwapQuote,ds as useTokenSwapQuoteAction,ft as useUpdateUserPositionConditions,Xi as useUserBalances,ep as useUserBalancesAction,Ki as useUserBorrows,ji as useUserBorrowsAction,Ka as useUserClaimableRewards,ja as useUserClaimableRewardsAction,Ji as useUserPosition,$i as useUserPositions,zi as useUserPositionsAction,Zi as useUserRiskPremiumBreakdown,Gi as useUserSummary,rp as useUserSummaryHistory,Li as useUserSupplies,Yi as useUserSuppliesAction,ws as useUserSwaps,Pt as useWithdraw,gs as useWithdrawSwap,xs as useWithdrawSwapQuote,hs as useWithdrawSwapQuoteAction};//# sourceMappingURL=index.js.map
|
|
1
|
+
import {b}from'./chunk-V6Q6TCNV.js';export{c as useChain,d as useChainAction,e as useChains,g as useExchangeRate,f as useExchangeRateAction}from'./chunk-V6Q6TCNV.js';import {a,b as b$1}from'./chunk-4NA4FB6K.js';export{b as useAaveClient}from'./chunk-4NA4FB6K.js';import {a as a$1,b as b$2,d,c}from'./chunk-4LHXPD6N.js';import {DEFAULT_QUERY_OPTIONS,supportsPermit,UnexpectedError as UnexpectedError$1,transactionReceipt}from'@aave/client';export*from'@aave/client';import Be,{useState,useEffect,useCallback,useDeferredValue}from'react';import {hubAssetInterestRateModel,hubs,reserve,reserves,reserveHolders,userClaimableRewards,borrowSwapQuote,preparePositionSwap,swapStatus,prepareSwapCancel,cancelSwap,repayWithSupplyQuote,supplySwapQuote,swap,tokenSwapQuote,prepareTokenSwap,withdrawSwapQuote,activities,borrow,claimRewards,liquidatePosition,preview,renounceSpokeUserPositionManager,repay,setSpokeUserPositionManager,setUserSuppliesAsCollateral,supply,updateUserPositionConditions,withdraw,userSupplies,userBorrows,userPositions,userBalances,stableVaultDeposit,stableVaultWithdraw,stableVaultWithdrawRedeem}from'@aave/client/actions';import {HubQuery,HubsQuery,HubAssetsQuery,HubSummaryHistoryQuery,HubAssetInterestRateModelQuery,HubSpokeConfigsQuery,AssetQuery,AssetPriceHistoryQuery,AssetSupplyHistoryQuery,AssetBorrowHistoryQuery,ProtocolHistoryQuery,ReserveQuery,ReservesQuery,BorrowApyHistoryQuery,SupplyApyHistoryQuery,ReserveHoldersQuery,UserClaimableRewardsQuery,SpokeQuery,SpokesQuery,SpokePositionManagersQuery,SpokeSummaryHistoryQuery,SpokeUserPositionManagersQuery,BorrowSwapQuoteQuery,QuoteAccuracy,RepayWithSupplyQuoteQuery,SupplySwapQuoteQuery,SwappableTokensQuery,SwapStatusQuery,TokenSwapQuoteQuery,UserSwapsQuery,WithdrawSwapQuoteQuery,ActivitiesQuery,PreviewQuery,decodeReserveId,UserSuppliesQuery,UserBorrowsQuery,UserSummaryQuery,UserPositionsQuery,UserPositionQuery,UserBalancesQuery,UserRiskPremiumBreakdownQuery,UserSummaryHistoryQuery,StableVaultClaimStatusQuery,StableVaultUserPositionsQuery,StableVaultQuery,StableVaultsQuery,isSpokeInputVariant,isChainIdsVariant,decodeUserPositionId}from'@aave/graphql';import {ok,ResultAwareError,okAsync,never,isSignature,errAsync,ResultAsync,err,expectTypename}from'@aave/types';import {UnexpectedError,ValidationError}from'@aave/core';function sa({children:e,client:r}){return Be.createElement(a,{client:r},e)}function ze(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:r}=decodeUserPositionId(e.userPositionId);return r}function Je(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:r}=decodeUserPositionId(e.userPositionId);return r}function P(e,r){return e.refreshQueryWhere(UserBalancesQuery,s=>s.request.user===r)}function E(e,r){return e.refreshQueryWhere(UserSuppliesQuery,s=>ze(s.request.query)===r)}function q(e,r){return e.refreshQueryWhere(UserBorrowsQuery,s=>Je(s.request.query)===r)}function D(e,r,s){let t=a=>a.spoke.chain.chainId===s.chainId&&a.spoke.address===s.address&&a.user===r;return ResultAsync.combine([e.refreshQueryWhere(UserPositionsQuery,(a,n)=>n.some(t)),e.refreshQueryWhere(UserPositionQuery,(a,n)=>n!==null&&t(n))])}function _(e,r){let s=t=>r.includes(t.id);return ResultAsync.combine([e.refreshQueryWhere(ReserveQuery,(t,a)=>a!==null&&s(a)),e.refreshQueryWhere(ReservesQuery,(t,a)=>a.some(s))])}function Xe(e,r){let s=r.map(decodeReserveId);return e.refreshQueryWhere(ReserveHoldersQuery,t=>{let{reserve:a}=t.request;return "reserveId"in a?r.includes(a.reserveId):s.some(n=>a.reserveInput.chainId===n.chainId&&a.reserveInput.spoke===n.spoke&&a.reserveInput.onChainId===n.onChainId)})}function N(e,r,s){return e.refreshQueryWhere(UserSummaryQuery,t=>t.request.user===r&&(isSpokeInputVariant(t.request.filter)?t.request.filter.spoke.chainId===s.chainId&&t.request.filter.spoke.address===s.address:isChainIdsVariant(t.request.filter)?t.request.filter.chainIds.some(a=>a===s.chainId):false))}function M(e,r){let s=t=>t.chain.chainId===r.chainId&&t.address===r.address;return ResultAsync.combine([e.refreshQueryWhere(SpokeQuery,(t,a)=>a!==null&&s(a)),e.refreshQueryWhere(SpokesQuery,(t,a)=>a.some(s))])}function F(e,r){let s=t=>t.chain.chainId===r;return ResultAsync.combine([e.refreshQueryWhere(HubQuery,(t,a)=>a!==null&&s(a)),e.refreshQueryWhere(HubsQuery,(t,a)=>a.some(s))])}function B(e,r){return e.refreshQueryWhere(SpokePositionManagersQuery,s=>s.request.spoke===r)}function J(e,r){return ResultAsync.combine([e.refreshQueryWhere(UserPositionsQuery,(s,t)=>t.some(a=>a.id===r)),e.refreshQueryWhere(UserPositionQuery,(s,t)=>t?.id===r)])}function g(e,r){let{chainId:s,spoke:t}=decodeReserveId(r.reserve),a={chainId:s,address:t};return ResultAsync.combine([D(e,r.sender,a),N(e,r.sender,a),_(e,[r.reserve]),Xe(e,[r.reserve]),M(e,a),P(e,r.sender),E(e,r.sender),q(e,r.sender),F(e,s)])}function X(e,r){return P(e,r)}function Z(e,r){return ResultAsync.combine([E(e,r),P(e,r)])}function ee(e,r){return ResultAsync.combine([q(e,r),P(e,r)])}function re(e,r){return ResultAsync.combine([E(e,r),q(e,r),P(e,r)])}function se(e,r){return ResultAsync.combine([E(e,r),P(e,r)])}function da({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:HubQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function ma({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:HubsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Ra({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:HubAssetsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function fa({suspense:e=false,pause:r=false,...s}){return b({document:HubSummaryHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function ba({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:HubAssetInterestRateModelQuery,variables:{request:t,currency:s},suspense:e,pause:r,selector:a=>ok(a.points)})}function Aa(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>hubAssetInterestRateModel(r,s,{currency:e.currency,requestPolicy:"cache-first"}),[r,e.currency])}function Ua(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>hubs(r,s,{currency:e.currency,requestPolicy:"cache-first"}),[r,e.currency])}function wa({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:HubSpokeConfigsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function ha({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:AssetQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function va({suspense:e=false,pause:r=false,...s}){return b({document:AssetPriceHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Ea({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:AssetSupplyHistoryQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r,batch:false})}function Qa({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:AssetBorrowHistoryQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r,batch:false})}function ka({suspense:e=false,pause:r=false,...s}){return b({document:ProtocolHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Oa({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:ReserveQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Va(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>reserve(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Da({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:ReservesQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function _a(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>reserves(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Na({suspense:e=false,pause:r=false,...s}){return b({document:BorrowApyHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Ma({suspense:e=false,pause:r=false,...s}){return b({document:SupplyApyHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function Fa({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:ReserveHoldersQuery,variables:{request:t,currency:s},suspense:e,pause:r})}function La(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>reserveHolders(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,requestPolicy:"cache-first"}),[r,e.currency])}function za({suspense:e=false,pause:r=false,...s}){return b({document:UserClaimableRewardsQuery,variables:{request:s},suspense:e,pause:r})}function Ja(){let e=b$1();return a$1(r=>userClaimableRewards(e,r,{requestPolicy:"cache-first"}),[e])}function sn({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:SpokeQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function tn({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:SpokesQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function an({suspense:e=false,pause:r=false,...s}){return b({document:SpokePositionManagersQuery,variables:{request:s},suspense:e,pause:r})}function nn({suspense:e=false,pause:r=false,...s}){return b({document:SpokeSummaryHistoryQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function on({suspense:e=false,pause:r=false,...s}){return b({document:SpokeUserPositionManagersQuery,variables:{request:s},suspense:e,pause:r})}function m(e){switch(e.__typename){case "PositionSwapByIntentApprovalsRequired":return ok(e.quote);case "InsufficientLiquidityError":return err(ValidationError.fromGqlNode(e));default:return err(UnexpectedError.upgradeRequired(`Unsupported position swap quote result: ${e.__typename}`))}}function O(e){return e.__typename==="SwapFulfilled"||e.__typename==="SwapCancelled"||e.__typename==="SwapExpired"}function T(e){return {with:r=>e.approvals.reduce((s,t)=>s.andThen(a=>r(t,{cancel:b$2}).map(n=>{switch(t.__typename){case "PositionSwapAdapterContractApproval":a.adapterContractSignature=isSignature(n)?n:null;break;case "PositionSwapPositionManagerApproval":a.positionManagerSignature=isSignature(n)?n:null;break;case "PositionSwapSetCollateralApproval":a.setCollateralSignature=isSignature(n)?n:null;break}return a})),okAsync({quoteId:e.quote.quoteId,adapterContractSignature:null,positionManagerSignature:null,setCollateralSignature:null}))}}function x(e,r){return swap(e,{intent:r}).andThen(s=>{switch(s.__typename){case "SwapReceipt":return okAsync(s);default:return UnexpectedError.from(s).asResultAsync()}})}function Cr(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>borrowSwapQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function ue(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Br({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:BorrowSwapQuoteQuery,variables:{request:ue(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:BorrowSwapQuoteQuery,variables:{request:ue(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function Wr(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>borrowSwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function le(e){return {__typename:"SwapCancelledResult",swapId:e.swapId,createdAt:e.createdAt,cancelledAt:e.cancelledAt,explorerUrl:e.explorerUrl}}var C=class extends ResultAwareError{name="CannotCancelSwapError"};function _r(e){let r=b$1();return a$1(s=>swapStatus(r,{id:s.id}).andThen(t=>{if(t===null)return UnexpectedError.from("Swap not found").asResultAsync();switch(t.__typename){case "SwapOpen":case "SwapPendingSignature":return prepareSwapCancel(r,s).andThen(a=>e(a.data,{cancel:b$2})).andThen(d).andThen(a=>cancelSwap(r,{intent:{id:s.id,signature:a}})).andThen(a=>a.__typename==="SwapCancelledResult"?okAsync(a):e(a,{cancel:b$2}).andThen(c.tryFrom).andThen(n=>n.wait()).andThen(()=>swapStatus(r,{id:s.id})).andThen(n=>n?.__typename==="SwapCancelled"?okAsync(le(n)):new C("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return okAsync(le(t));case "SwapExpired":return new C("Swap cannot longer be cancelled").asResultAsync();default:return UnexpectedError.upgradeRequired(`Unsupported swap status: ${t.__typename}`).asResultAsync()}}),[r,e])}function Fr(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>repayWithSupplyQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function Se(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Yr({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:RepayWithSupplyQuoteQuery,variables:{request:Se(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:RepayWithSupplyQuoteQuery,variables:{request:Se(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function Kr(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>repayWithSupplyQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function $r(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>supplySwapQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function Re(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Jr({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:SupplySwapQuoteQuery,variables:{request:Re(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:SupplySwapQuoteQuery,variables:{request:Re(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function Xr(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>supplySwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function es({suspense:e=false,pause:r=false,...s}){return b({document:SwappableTokensQuery,variables:{request:s},suspense:e,pause:r})}function as({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){let n=b$1(),[l,S]=useState(false),f=b({document:SwapStatusQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r||l,pollInterval:n.context.environment.swapStatusInterval});return useEffect(()=>{f.data&&O(f.data)&&S(true);},[f.data]),f}function cs(e){let r=b$1(),s=useCallback(t=>swap(r,t).andThen(a=>{switch(a.__typename){case "SwapTransactionRequest":return e(a,{cancel:b$2}).andThen(c.tryFrom).andThen(n=>n.wait()).andThen(()=>okAsync(a.orderReceipt));case "SwapReceipt":return okAsync(a)}}),[r,e]);return a$1(({currency:t=DEFAULT_QUERY_OPTIONS.currency,...a})=>tokenSwapQuote(r,a,{currency:t}).andThen(n=>{switch(n.__typename){case "SwapByTransaction":return s({transaction:{quoteId:n.quote.quoteId}});case "SwapByIntent":return prepareTokenSwap(r,{quoteId:n.quote.quoteId}).andThen(l=>e(l.data,{cancel:b$2}).andThen(d).andThen(S=>s({intent:{quoteId:l.newQuoteId,signature:S}})));case "SwapByIntentWithApprovalRequired":if(supportsPermit(n)){let l=n.approvals[0];return e(l,{cancel:b$2}).andThen(S=>isSignature(S)?prepareTokenSwap(r,{quoteId:n.quote.quoteId,permitSig:{deadline:l.bySignature.message.deadline,value:S}}):c.isInstanceOf(S)?S.wait().andThen(()=>prepareTokenSwap(r,{quoteId:n.quote.quoteId})):UnexpectedError.from(S).asResultAsync()).andThen(S=>e(S.data,{cancel:b$2}).andThen(d).andThen(f=>s({intent:{quoteId:S.newQuoteId,signature:f}})))}return n.approvals.reduce((l,S)=>l.andThen(()=>e({...S,bySignature:null},{cancel:b$2}).andThen(c.tryFrom).andThen(f=>f.wait())),okAsync(void 0)).andThen(()=>prepareTokenSwap(r,{quoteId:n.quote.quoteId})).andThen(l=>e(l.data,{cancel:b$2})).andThen(d).andThen(l=>s({intent:{quoteId:n.quote.quoteId,signature:l}}));case "SwapByTransactionWithApprovalRequired":return n.approvals.reduce((l,S)=>l.andThen(()=>e({...S,bySignature:null},{cancel:b$2}).andThen(c.tryFrom).andThen(f=>f.wait())),okAsync(void 0)).andThen(()=>s({transaction:{quoteId:n.quote.quoteId}}));default:never(`Unsupported swap quote result: ${n.__typename}. To be removed from API soon.`);}}),[r,e,s])}function L(e){switch(e.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":case "SwapByTransactionWithApprovalRequired":return ok(e.quote);case "InsufficientLiquidityError":return err(ValidationError.fromGqlNode(e));default:return err(UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${e.__typename}`))}}function we(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Rs({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:TokenSwapQuoteQuery,variables:{request:we(t,QuoteAccuracy.Fast),currency:s},selector:L,suspense:e,pause:r,batch:false}),l=b({document:TokenSwapQuoteQuery,variables:{request:we(t,QuoteAccuracy.Accurate),currency:s},selector:L,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function fs(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>tokenSwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(L),[r,e.currency])}function Ps(e,r){let s=new Map(r.map(t=>[t.swapId,t.__typename]));return e.filter(t=>t.__typename==="SwapFulfilled"&&s.get(t.swapId)!=="SwapFulfilled")}function gs({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){let n=b$1(),[l,S]=useState(false),f=b({document:UserSwapsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r||l,pollInterval:n.context.environment.swapStatusInterval}),k=f.data?.items??[],Y=useDeferredValue(k);return useEffect(()=>{if(k.length===0)return;k.every(O)&&S(true);for(let Ie of Ps(k,Y))switch(Ie.operation.__typename){case "TokenSwap":a.user&&X(n,a.user);break;case "BorrowSwap":a.user&&ee(n,a.user);break;case "RepayWithSupply":a.user&&re(n,a.user);break;case "SupplySwap":a.user&&Z(n,a.user);break;case "WithdrawSwap":a.user&&se(n,a.user);break}},[k,Y,n,a.user]),f}function hs(e){let r=b$1();return a$1(({currency:s=DEFAULT_QUERY_OPTIONS.currency,...t})=>withdrawSwapQuote(r,t,{currency:s}).andThen(a=>T(a).with(e).andThen(n=>preparePositionSwap(r,n)).andThen(n=>e(n.data,{cancel:b$2}).andThen(d).andThen(l=>x(r,{quoteId:n.newQuoteId,signature:l})))),[r,e])}function xe(e,r){return "market"in e&&e.market?{market:{...e.market,accuracy:r}}:e}function Es({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){let a=b$1(),n=b({document:WithdrawSwapQuoteQuery,variables:{request:xe(t,QuoteAccuracy.Fast),currency:s},selector:m,suspense:e,pause:r,batch:false}),l=b({document:WithdrawSwapQuoteQuery,variables:{request:xe(t,QuoteAccuracy.Accurate),currency:s},selector:m,suspense:false,pause:r||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return l.data&&l.metadata.resultOperationKey===l.metadata.operationKey?l:n}function Qs(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>withdrawSwapQuote(r,s,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[r,e.currency])}function Hs({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:ActivitiesQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Cs(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>activities(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Vs(e){let r=b$1();return a$1(s=>borrow(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return UnexpectedError$1.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function Ns(e){let r=b$1();return a$1(s=>claimRewards(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(t=>t.operations?.length?r.waitForTransaction(t):okAsync(transactionReceipt(t.txHash))).andThrough(()=>(r.markRewardsClaimed(s.user,s.chainId,s.ids),okAsync(void 0))),[r,e])}function Ys(e,r){return {deadline:r.message.deadline,value:e}}function h(e,r){return e.approvals.reduce((s,t)=>s.andThen(()=>r({...t,bySignature:null},{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait())),okAsync(void 0)).map(()=>e.originalTransaction)}function v(e,r,s){let t=e.approvals[0];return r(t,{cancel:b$2}).andThen(a=>isSignature(a)?s(Ys(a,t.bySignature)).map(expectTypename("TransactionRequest")):a.wait().map(()=>e.originalTransaction))}function $s(e,r){return "exact"in e.amount&&e.amount.exact?{...e,amount:{exact:{...e.amount.exact,permitSig:r}}}:e}function zs(e){let r=b$1();return a$1(s=>liquidatePosition(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>liquidatePosition(r,$s(s,a))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>P(r,s.liquidator)),[r,e])}function Zs(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>preview(r,s,{currency:e.currency,requestPolicy:"network-only"}),[r,e.currency])}function et({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:PreviewQuery,variables:{request:t,currency:s},suspense:e,pause:r})}function st(e){let r=b$1();return a$1(s=>renounceSpokeUserPositionManager(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>B(r,s.spoke)),[r,e])}function ot(e,r,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permit:{permitSig:r,signedAmount:s}}}}:e}function ut(e){let r=b$1();return a$1(s=>repay(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>repay(r,ot(s,a,t.approvals[0].bySignature.signedAmount))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function pt(e){let r=b$1();return a$1(s=>setSpokeUserPositionManager(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>B(r,s.spoke)),[r,e])}function St(e){let r=b$1();return a$1(s=>{let t=s.changes.map(n=>n.reserve),a=t.map(n=>decodeReserveId(n));return setUserSuppliesAsCollateral(r,s).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(r.waitForTransaction).andThrough(()=>ResultAsync.combine([E(r,s.sender),q(r,s.sender),...a.flatMap(({chainId:n,spoke:l})=>[D(r,s.sender,{chainId:n,address:l}),N(r,s.sender,{chainId:n,address:l}),M(r,{chainId:n,address:l})]),_(r,t),...a.map(({chainId:n})=>F(r,n))]))},[r,e])}function ft(e,r){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:r}}}:e}function bt(e){let r=b$1();return a$1(s=>supply(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>supply(r,ft(s,a))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function Ut(e){let r=b$1();return a$1(s=>updateUserPositionConditions(r,s).andThen(t=>e(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>J(r,s.userPositionId)),[r,e])}function xt(e){let r=b$1();return a$1(s=>withdraw(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "PreContractActionRequired":return e(t,{cancel:b$2}).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return UnexpectedError$1.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>g(r,s)),[r,e])}function zi({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserSuppliesQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Ji(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userSupplies(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function Xi({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserBorrowsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function Zi(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userBorrows(r,s,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function ep({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserSummaryQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function rp({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserPositionsQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function sp(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userPositions(r,s,{currency:e.currency,timeWindow:e.timeWindow,requestPolicy:"cache-first"}),[r,e.currency,e.timeWindow])}function tp({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return b({document:UserPositionQuery,variables:{request:a,currency:s,timeWindow:t},suspense:e,pause:r})}function ap({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserBalancesQuery,variables:{request:t,currency:s},suspense:e,pause:r})}function np({suspense:e=false,pause:r=false,...s}){return b({document:UserRiskPremiumBreakdownQuery,variables:{request:s},suspense:e,pause:r,batch:false})}function op(e=DEFAULT_QUERY_OPTIONS){let r=b$1();return a$1(s=>userBalances(r,s,{currency:e.currency,requestPolicy:"cache-first"}),[r,e.currency])}function up({suspense:e=false,pause:r=false,currency:s=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserSummaryHistoryQuery,variables:{request:t,currency:s},suspense:e,pause:r,batch:false})}function jt(e,r){return {...e,amount:{...e.amount,permitSig:r}}}function fp(e){let r=b$1();return a$1(s=>stableVaultDeposit(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "Erc20ApprovalRequired":return supportsPermit(t)?v(t,e,a=>stableVaultDeposit(r,jt(s,a))).andThen(a=>e(a,{cancel:b$2})):h(t,e).andThen(a=>e(a,{cancel:b$2}));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction).andThrough(()=>Ce(r,s.user)),[r,e])}function bp(e){let r=b$1();return a$1(s=>stableVaultWithdraw(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(r.waitForTransaction).andThrough(()=>Ce(r,s.user));case "StableVaultWithdrawClaim":return e(t.transaction,{cancel:b$2}).andThen(c.tryFrom).andThen(a=>a.wait()).andThen(r.waitForTransaction).map(()=>t)}}),[r,e])}function Ap(e){let r=b$1();return a$1(s=>stableVaultWithdrawRedeem(r,s).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:b$2});case "StableVaultPendingAvailability":return UnexpectedError.from(`Funds not yet available. Please retry after ${t.executableAfter.toLocaleString()}`).asResultAsync()}}).andThen(c.tryFrom).andThen(t=>t.wait()).andThen(r.waitForTransaction),[r,e])}function Up({suspense:e=false,pause:r=false,...s}){let t=b$1();return b({document:StableVaultClaimStatusQuery,variables:{request:s},suspense:e,pause:r,pollInterval:t.context.environment.pollingInterval})}function wp({suspense:e=false,pause:r=false,...s}){return b({document:StableVaultUserPositionsQuery,variables:{request:s},suspense:e,pause:r})}function Pp({suspense:e=false,pause:r=false,...s}){return b({document:StableVaultQuery,variables:{request:s},suspense:e,pause:r})}function gp({suspense:e=false,pause:r=false,...s}){return b({document:StableVaultsQuery,variables:{request:s},suspense:e,pause:r})}function Ce(e,r){return e.refreshQueryWhere(StableVaultUserPositionsQuery,s=>s.request.user===r)}export{sa as AaveProvider,C as CannotCancelSwapError,Hs as useActivities,Cs as useActivitiesAction,ha as useAsset,Qa as useAssetBorrowHistory,va as useAssetPriceHistory,Ea as useAssetSupplyHistory,Vs as useBorrow,Na as useBorrowApyHistory,Cr as useBorrowSwap,Br as useBorrowSwapQuote,Wr as useBorrowSwapQuoteAction,_r as useCancelSwap,Ns as useClaimRewards,da as useHub,ba as useHubAssetInterestRateModel,Aa as useHubAssetInterestRateModelAction,Ra as useHubAssets,wa as useHubSpokeConfigs,fa as useHubSummaryHistory,ma as useHubs,Ua as useHubsAction,zs as useLiquidatePosition,et as usePreview,Zs as usePreviewAction,ka as useProtocolHistory,st as useRenounceSpokeUserPositionManager,ut as useRepay,Fr as useRepayWithSupply,Yr as useRepayWithSupplyQuote,Kr as useRepayWithSupplyQuoteAction,Oa as useReserve,Va as useReserveAction,Fa as useReserveHolders,La as useReserveHoldersAction,Da as useReserves,_a as useReservesAction,pt as useSetSpokeUserPositionManager,St as useSetUserSuppliesAsCollateral,sn as useSpoke,an as useSpokePositionManagers,nn as useSpokeSummaryHistory,on as useSpokeUserPositionManagers,tn as useSpokes,Pp as useStableVault,Up as useStableVaultClaimStatus,fp as useStableVaultDeposit,wp as useStableVaultUserPositions,bp as useStableVaultWithdraw,Ap as useStableVaultWithdrawRedeem,gp as useStableVaults,bt as useSupply,Ma as useSupplyApyHistory,$r as useSupplySwap,Jr as useSupplySwapQuote,Xr as useSupplySwapQuoteAction,as as useSwapStatus,es as useSwappableTokens,cs as useTokenSwap,Rs as useTokenSwapQuote,fs as useTokenSwapQuoteAction,Ut as useUpdateUserPositionConditions,ap as useUserBalances,op as useUserBalancesAction,Xi as useUserBorrows,Zi as useUserBorrowsAction,za as useUserClaimableRewards,Ja as useUserClaimableRewardsAction,tp as useUserPosition,rp as useUserPositions,sp as useUserPositionsAction,np as useUserRiskPremiumBreakdown,ep as useUserSummary,up as useUserSummaryHistory,zi as useUserSupplies,Ji as useUserSuppliesAction,gs as useUserSwaps,xt as useWithdraw,hs as useWithdrawSwap,Es as useWithdrawSwapQuote,Qs as useWithdrawSwapQuoteAction};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|