@aave/react 4.0.0-next.22 → 4.0.0-next.24
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 +57 -2
- package/dist/index.d.ts +57 -2
- 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, T as TransactionHandler } from './writes-CqRSU8Ho.cjs';
|
|
5
5
|
export { A as AsyncTaskError, c as AsyncTaskIdle, d as AsyncTaskLoading, e as AsyncTaskState, f as AsyncTaskSuccess, g as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-CqRSU8Ho.cjs';
|
|
6
|
-
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, ERC20PermitSignature, PrepareSwapCancelRequest, SwapCancelled, Erc20ApprovalRequired, PreContractActionRequired, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
6
|
+
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SwapStatusRequest, SwapStatus, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, ERC20PermitSignature, PrepareSwapCancelRequest, SwapCancelled, Erc20ApprovalRequired, PreContractActionRequired, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
7
7
|
import { Prettify, Signature, ResultAsync, ResultAwareError, TxHash } from '@aave/types';
|
|
8
8
|
import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult, d as Selector } from './misc-B9yMweLr.cjs';
|
|
9
9
|
export { e as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-B9yMweLr.cjs';
|
|
@@ -1385,6 +1385,61 @@ declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserS
|
|
|
1385
1385
|
* ```
|
|
1386
1386
|
*/
|
|
1387
1387
|
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
|
|
1388
|
+
type UseSwapStatusArgs = Prettify<SwapStatusRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1389
|
+
/**
|
|
1390
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1391
|
+
*
|
|
1392
|
+
* Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
|
|
1393
|
+
*
|
|
1394
|
+
* This signature supports React Suspense:
|
|
1395
|
+
*
|
|
1396
|
+
* ```tsx
|
|
1397
|
+
* const { data } = useSwapStatus({
|
|
1398
|
+
* id: swapReceipt.id,
|
|
1399
|
+
* suspense: true,
|
|
1400
|
+
* });
|
|
1401
|
+
* ```
|
|
1402
|
+
*/
|
|
1403
|
+
declare function useSwapStatus(args: UseSwapStatusArgs & Suspendable): SuspenseResult<SwapStatus>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1406
|
+
*
|
|
1407
|
+
* Pausable suspense mode.
|
|
1408
|
+
*
|
|
1409
|
+
* ```tsx
|
|
1410
|
+
* const { data } = useSwapStatus({
|
|
1411
|
+
* id: swapReceipt.id,
|
|
1412
|
+
* suspense: true,
|
|
1413
|
+
* pause: shouldPause,
|
|
1414
|
+
* });
|
|
1415
|
+
* ```
|
|
1416
|
+
*/
|
|
1417
|
+
declare function useSwapStatus(args: Pausable<UseSwapStatusArgs> & Suspendable): PausableSuspenseResult<SwapStatus>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1420
|
+
*
|
|
1421
|
+
* Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
|
|
1422
|
+
*
|
|
1423
|
+
* ```tsx
|
|
1424
|
+
* const { data, error, loading } = useSwapStatus({
|
|
1425
|
+
* id: swapReceipt.id,
|
|
1426
|
+
* });
|
|
1427
|
+
* ```
|
|
1428
|
+
*/
|
|
1429
|
+
declare function useSwapStatus(args: UseSwapStatusArgs): ReadResult<SwapStatus>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1432
|
+
*
|
|
1433
|
+
* Pausable loading state mode.
|
|
1434
|
+
*
|
|
1435
|
+
* ```tsx
|
|
1436
|
+
* const { data, error, loading, paused } = useSwapStatus({
|
|
1437
|
+
* id: swapReceipt.id,
|
|
1438
|
+
* pause: shouldPause,
|
|
1439
|
+
* });
|
|
1440
|
+
* ```
|
|
1441
|
+
*/
|
|
1442
|
+
declare function useSwapStatus(args: Pausable<UseSwapStatusArgs>): PausableReadResult<SwapStatus>;
|
|
1388
1443
|
type UseSupplySwapQuoteArgs = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1389
1444
|
/**
|
|
1390
1445
|
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
@@ -3235,4 +3290,4 @@ declare function useUserSummaryHistory(args: UseUserSummaryHistoryArgs): ReadRes
|
|
|
3235
3290
|
*/
|
|
3236
3291
|
declare function useUserSummaryHistory(args: Pausable<UseUserSummaryHistoryArgs>): PausableReadResult<UserSummaryHistoryItem[]>;
|
|
3237
3292
|
|
|
3238
|
-
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError, PendingTransactionError, type PositionSwapHandler, type PositionSwapPlan, type PositionSwapValue, SendTransactionError, type SwapHandlerOptions, type SwapSignerError, type TokenSwapHandler, type TokenSwapPlan, type UseActivitiesArgs, type UseAssetArgs, type UseAssetBorrowHistoryArgs, type UseAssetPriceHistoryArgs, type UseAssetSupplyHistoryArgs, UseAsyncTask, type UseBorrowApyHistoryArgs, type UseBorrowSwapQuoteArgs, type UseBorrowSwapRequest, type UseHubArgs, type UseHubAssetsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapSignerRequest, type UseSwapSignerResult, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useHub, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|
|
3293
|
+
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError, PendingTransactionError, type PositionSwapHandler, type PositionSwapPlan, type PositionSwapValue, SendTransactionError, type SwapHandlerOptions, type SwapSignerError, type TokenSwapHandler, type TokenSwapPlan, type UseActivitiesArgs, type UseAssetArgs, type UseAssetBorrowHistoryArgs, type UseAssetPriceHistoryArgs, type UseAssetSupplyHistoryArgs, UseAsyncTask, type UseBorrowApyHistoryArgs, type UseBorrowSwapQuoteArgs, type UseBorrowSwapRequest, type UseHubArgs, type UseHubAssetsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapSignerRequest, type UseSwapSignerResult, type UseSwapStatusArgs, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useHub, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwapStatus, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, 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, T as TransactionHandler } from './writes-CqRSU8Ho.js';
|
|
5
5
|
export { A as AsyncTaskError, c as AsyncTaskIdle, d as AsyncTaskLoading, e as AsyncTaskState, f as AsyncTaskSuccess, g as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-CqRSU8Ho.js';
|
|
6
|
-
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, ERC20PermitSignature, PrepareSwapCancelRequest, SwapCancelled, Erc20ApprovalRequired, PreContractActionRequired, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
6
|
+
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SwapStatusRequest, SwapStatus, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, ERC20PermitSignature, PrepareSwapCancelRequest, SwapCancelled, Erc20ApprovalRequired, PreContractActionRequired, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
7
7
|
import { Prettify, Signature, ResultAsync, ResultAwareError, TxHash } from '@aave/types';
|
|
8
8
|
import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult, d as Selector } from './misc-NiE1QAVK.js';
|
|
9
9
|
export { e as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-NiE1QAVK.js';
|
|
@@ -1385,6 +1385,61 @@ declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserS
|
|
|
1385
1385
|
* ```
|
|
1386
1386
|
*/
|
|
1387
1387
|
declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
|
|
1388
|
+
type UseSwapStatusArgs = Prettify<SwapStatusRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
|
|
1389
|
+
/**
|
|
1390
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1391
|
+
*
|
|
1392
|
+
* Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
|
|
1393
|
+
*
|
|
1394
|
+
* This signature supports React Suspense:
|
|
1395
|
+
*
|
|
1396
|
+
* ```tsx
|
|
1397
|
+
* const { data } = useSwapStatus({
|
|
1398
|
+
* id: swapReceipt.id,
|
|
1399
|
+
* suspense: true,
|
|
1400
|
+
* });
|
|
1401
|
+
* ```
|
|
1402
|
+
*/
|
|
1403
|
+
declare function useSwapStatus(args: UseSwapStatusArgs & Suspendable): SuspenseResult<SwapStatus>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1406
|
+
*
|
|
1407
|
+
* Pausable suspense mode.
|
|
1408
|
+
*
|
|
1409
|
+
* ```tsx
|
|
1410
|
+
* const { data } = useSwapStatus({
|
|
1411
|
+
* id: swapReceipt.id,
|
|
1412
|
+
* suspense: true,
|
|
1413
|
+
* pause: shouldPause,
|
|
1414
|
+
* });
|
|
1415
|
+
* ```
|
|
1416
|
+
*/
|
|
1417
|
+
declare function useSwapStatus(args: Pausable<UseSwapStatusArgs> & Suspendable): PausableSuspenseResult<SwapStatus>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1420
|
+
*
|
|
1421
|
+
* Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
|
|
1422
|
+
*
|
|
1423
|
+
* ```tsx
|
|
1424
|
+
* const { data, error, loading } = useSwapStatus({
|
|
1425
|
+
* id: swapReceipt.id,
|
|
1426
|
+
* });
|
|
1427
|
+
* ```
|
|
1428
|
+
*/
|
|
1429
|
+
declare function useSwapStatus(args: UseSwapStatusArgs): ReadResult<SwapStatus>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Monitor the status of a single swap operation in real-time.
|
|
1432
|
+
*
|
|
1433
|
+
* Pausable loading state mode.
|
|
1434
|
+
*
|
|
1435
|
+
* ```tsx
|
|
1436
|
+
* const { data, error, loading, paused } = useSwapStatus({
|
|
1437
|
+
* id: swapReceipt.id,
|
|
1438
|
+
* pause: shouldPause,
|
|
1439
|
+
* });
|
|
1440
|
+
* ```
|
|
1441
|
+
*/
|
|
1442
|
+
declare function useSwapStatus(args: Pausable<UseSwapStatusArgs>): PausableReadResult<SwapStatus>;
|
|
1388
1443
|
type UseSupplySwapQuoteArgs = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
|
|
1389
1444
|
/**
|
|
1390
1445
|
* Fetch a quote for a supply swap operation with the specified parameters.
|
|
@@ -3235,4 +3290,4 @@ declare function useUserSummaryHistory(args: UseUserSummaryHistoryArgs): ReadRes
|
|
|
3235
3290
|
*/
|
|
3236
3291
|
declare function useUserSummaryHistory(args: Pausable<UseUserSummaryHistoryArgs>): PausableReadResult<UserSummaryHistoryItem[]>;
|
|
3237
3292
|
|
|
3238
|
-
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError, PendingTransactionError, type PositionSwapHandler, type PositionSwapPlan, type PositionSwapValue, SendTransactionError, type SwapHandlerOptions, type SwapSignerError, type TokenSwapHandler, type TokenSwapPlan, type UseActivitiesArgs, type UseAssetArgs, type UseAssetBorrowHistoryArgs, type UseAssetPriceHistoryArgs, type UseAssetSupplyHistoryArgs, UseAsyncTask, type UseBorrowApyHistoryArgs, type UseBorrowSwapQuoteArgs, type UseBorrowSwapRequest, type UseHubArgs, type UseHubAssetsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapSignerRequest, type UseSwapSignerResult, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useHub, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, useUserPosition, useUserPositions, useUserPositionsAction, useUserRiskPremiumBreakdown, useUserSummary, useUserSummaryHistory, useUserSupplies, useUserSuppliesAction, useUserSwaps, useWithdraw, useWithdrawSwap, useWithdrawSwapQuote, useWithdrawSwapQuoteAction };
|
|
3293
|
+
export { AaveProvider, type AaveProviderProps, type CancelSwapError, type CancelSwapHandler, CannotCancelSwapError, PendingTransactionError, type PositionSwapHandler, type PositionSwapPlan, type PositionSwapValue, SendTransactionError, type SwapHandlerOptions, type SwapSignerError, type TokenSwapHandler, type TokenSwapPlan, type UseActivitiesArgs, type UseAssetArgs, type UseAssetBorrowHistoryArgs, type UseAssetPriceHistoryArgs, type UseAssetSupplyHistoryArgs, UseAsyncTask, type UseBorrowApyHistoryArgs, type UseBorrowSwapQuoteArgs, type UseBorrowSwapRequest, type UseHubArgs, type UseHubAssetsArgs, type UseHubSummaryHistoryArgs, type UseHubsArgs, type UsePreviewArgs, type UseProtocolHistoryArgs, type UseRepayWithSupplyQuoteArgs, type UseRepayWithSupplyRequest, type UseReserveArgs, type UseReservesArgs, type UseSpokeArgs, type UseSpokePositionManagersArgs, type UseSpokeUserPositionManagersArgs, type UseSpokesArgs, type UseSupplyApyHistoryArgs, type UseSupplySwapQuoteArgs, type UseSupplySwapRequest, type UseSwapSignerRequest, type UseSwapSignerResult, type UseSwapStatusArgs, type UseSwappableTokensArgs, type UseTokenSwapQuoteArgs, type UseTokenSwapRequest, type UseUserBalancesArgs, type UseUserBorrowsArgs, type UseUserPositionArgs, type UseUserPositionsArgs, type UseUserRiskPremiumBreakdownArgs, type UseUserSummaryArgs, type UseUserSummaryHistoryArgs, type UseUserSuppliesArgs, type UseUserSwapsArgs, type UseWithdrawSwapQuoteArgs, type UseWithdrawSwapRequest, useAaveClient, useActivities, useActivitiesAction, useAsset, useAssetBorrowHistory, useAssetPriceHistory, useAssetSupplyHistory, useBorrow, useBorrowApyHistory, useBorrowSwap, useBorrowSwapQuote, useBorrowSwapQuoteAction, useCancelSwap, useHub, useHubAssets, useHubSummaryHistory, useHubs, useHubsAction, useLiquidatePosition, usePreview, usePreviewAction, useProtocolHistory, useRenounceSpokeUserPositionManager, useRepay, useRepayWithSupply, useRepayWithSupplyQuote, useRepayWithSupplyQuoteAction, useReserve, useReserveAction, useReserves, useReservesAction, useSetSpokeUserPositionManager, useSetUserSuppliesAsCollateral, useSpoke, useSpokePositionManagers, useSpokeUserPositionManagers, useSpokes, useSupply, useSupplyApyHistory, useSupplySwap, useSupplySwapQuote, useSupplySwapQuoteAction, useSwapStatus, useSwappableTokens, useTokenSwap, useTokenSwapQuote, useTokenSwapQuoteAction, useUpdateUserPositionConditions, useUserBalances, useUserBalancesAction, useUserBorrows, useUserBorrowsAction, 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-3T44WW7A.js';export{c as useChain,d as useChains,f as useExchangeRate,e as useExchangeRateAction}from'./chunk-3T44WW7A.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,c}from'./chunk-VGAHEW5B.js';import {DEFAULT_QUERY_OPTIONS,UnexpectedError as UnexpectedError$1}from'@aave/client';export*from'@aave/client';import oe,{useCallback}from'react';import {hubs,reserve,reserves,tokenSwapQuote,supplySwapQuote,borrowSwapQuote,preparePositionSwap,repayWithSupplyQuote,withdrawSwapQuote,swap,prepareTokenSwap,swapStatus,prepareSwapCancel,cancelSwap,supply,borrow,repay,withdraw,renounceSpokeUserPositionManager,updateUserPositionConditions,setUserSuppliesAsCollateral,liquidatePosition,setSpokeUserPositionManager,preview,activities,userSupplies,userBorrows,userPositions,userBalances}from'@aave/client/actions';import {HubQuery,HubsQuery,HubAssetsQuery,HubSummaryHistoryQuery,AssetQuery,AssetPriceHistoryQuery,AssetSupplyHistoryQuery,AssetBorrowHistoryQuery,ProtocolHistoryQuery,ReserveQuery,ReservesQuery,BorrowApyHistoryQuery,SupplyApyHistoryQuery,SpokeQuery,SpokesQuery,SpokePositionManagersQuery,SpokeUserPositionManagersQuery,TokenSwapQuoteQuery,QuoteAccuracy,SwappableTokensQuery,UserSwapsQuery,SupplySwapQuoteQuery,BorrowSwapQuoteQuery,RepayWithSupplyQuoteQuery,WithdrawSwapQuoteQuery,UserPositionsQuery,UserPositionQuery,decodeReserveId,UserSummaryQuery,isSpokeInputVariant,isChainIdsVariant,isHubInputVariant,decodeHubId,PreviewQuery,ActivitiesQuery,UserSuppliesQuery,UserBorrowsQuery,UserBalancesQuery,UserRiskPremiumBreakdownQuery,UserSummaryHistoryQuery}from'@aave/graphql';import {UnexpectedError,ValidationError}from'@aave/core';import {invariant,isSignature,okAsync,never,ResultAwareError,errAsync,expectTypename}from'@aave/types';function Ps({children:e,client:s}){return oe.createElement(a,{client:s},e)}function qs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:HubQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function ks({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:HubsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function hs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:HubAssetsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Hs({suspense:e=false,pause:s=false,...r}){return b({document:HubSummaryHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function vs(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>hubs(s,r,{currency:e.currency}),[s,e.currency])}function Cs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:AssetQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Os({suspense:e=false,pause:s=false,...r}){return b({document:AssetPriceHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ds({suspense:e=false,pause:s=false,...r}){return b({document:AssetSupplyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ms({suspense:e=false,pause:s=false,...r}){return b({document:AssetBorrowHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ns({suspense:e=false,pause:s=false,...r}){return b({document:ProtocolHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Gs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:ReserveQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function $s(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>reserve(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function zs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,selector:t,...a}){return b({document:ReservesQuery,variables:{request:a,currency:r,timeWindow:n},suspense:e,pause:s,selector:t||void 0})}function Js(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>reserves(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function Ks({suspense:e=false,pause:s=false,...r}){return b({document:BorrowApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Xs({suspense:e=false,pause:s=false,...r}){return b({document:SupplyApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function rr({suspense:e=false,pause:s=false,...r}){return b({document:SpokeQuery,variables:{request:r},suspense:e,pause:s})}function tr({suspense:e=false,pause:s=false,...r}){return b({document:SpokesQuery,variables:{request:r},suspense:e,pause:s})}function nr({suspense:e=false,pause:s=false,...r}){return b({document:SpokePositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function ar({suspense:e=false,pause:s=false,...r}){return b({document:SpokeUserPositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function W(e){switch(e.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":return e.quote;default:throw UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${e.__typename}`)}}function F(e,s){return "market"in e&&e.market?{...e,market:{...e.market,accuracy:s}}:"limit"in e&&e.limit?{...e,limit:{...e.limit,accuracy:s}}:e}function Ur({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){let t=b$1(),a=b({document:TokenSwapQuoteQuery,variables:{request:F(n,QuoteAccuracy.Fast),currency:r},selector:W,suspense:e,pause:s,batch:false}),u=b({document:TokenSwapQuoteQuery,variables:{request:F(n,QuoteAccuracy.Accurate),currency:r},selector:W,suspense:false,pause:s||e&&!a.data,pollInterval:t.context.environment.swapQuoteInterval,batch:false});return u.data?u:a}function wr(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>tokenSwapQuote(s,r,{currency:e.currency}).map(W),[s,e.currency])}function mr({suspense:e=false,pause:s=false,...r}){return b({document:SwappableTokensQuery,variables:{request:r},suspense:e,pause:s})}function gr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserSwapsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Pr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:SupplySwapQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function Ar(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>supplySwapQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function br({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:BorrowSwapQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function fr(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>borrowSwapQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function k(e){return {with:s=>e.approvals.reduce((r,n)=>r.andThen(t=>s(n,{cancel:b$2}).map(a=>{switch(n.__typename){case "PositionSwapAdapterContractApproval":t.adapterContractSignature=isSignature(a)?a:null;break;case "PositionSwapPositionManagerApproval":t.positionManagerSignature=isSignature(a)?a:null;break}return t})),okAsync({quoteId:e.quote.quoteId,adapterContractSignature:null,positionManagerSignature:null}))}}function h(e,s){return swap(e,{intent:s}).andThen(r=>{switch(r.__typename){case "SwapReceipt":return okAsync(r);default:return UnexpectedError.from(r).asResultAsync()}})}function Tr(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>supplySwapQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function xr(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>borrowSwapQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function Qr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:RepayWithSupplyQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function qr(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>repayWithSupplyQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function kr(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>repayWithSupplyQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function hr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:WithdrawSwapQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function Hr(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>withdrawSwapQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function vr(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>withdrawSwapQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function Er(e){let s=b$1(),r=useCallback(n=>swap(s,n).andThen(t=>{switch(t.__typename){case "SwapTransactionRequest":return e(t,{cancel:b$2}).map(c.ensure).andThen(a=>a.wait()).andThen(()=>okAsync(t.orderReceipt));case "SwapReceipt":return okAsync(t)}}),[s,e]);return a$1(({currency:n=DEFAULT_QUERY_OPTIONS.currency,...t})=>tokenSwapQuote(s,t,{currency:n}).andThen(a=>{switch(a.__typename){case "SwapByTransaction":return r({transaction:{quoteId:a.quote.quoteId}});case "SwapByIntent":return prepareTokenSwap(s,{quoteId:a.quote.quoteId}).andThen(u=>e(u.data,{cancel:b$2}).map(c=>(invariant(isSignature(c),"Invalid signature"),c)).andThen(c=>r({intent:{quoteId:u.newQuoteId,signature:c}})));case "SwapByIntentWithApprovalRequired":return e(a.approval,{cancel:b$2}).andThen(u=>{if(isSignature(u)){let c=a.approval.bySignature;if(!c)return UnexpectedError.from("Expected bySignature to be present in SwapByIntentWithApprovalRequired").asResultAsync();let R={deadline:c.message.deadline,value:u};return prepareTokenSwap(s,{quoteId:a.quote.quoteId,permitSig:R})}return c.isInstanceOf(u)?u.wait().andThen(()=>prepareTokenSwap(s,{quoteId:a.quote.quoteId})):UnexpectedError.from(u).asResultAsync()}).andThen(u=>e(u.data,{cancel:b$2}).map(c=>(invariant(isSignature(c),"Invalid signature"),c)).andThen(c=>r({intent:{quoteId:a.quote.quoteId,signature:c}})));default:never(`Unsupported swap quote result: ${a.__typename}. To be removed from API soon.`);}}),[s,e,r])}var Q=class extends ResultAwareError{name="CannotCancelSwapError"};function Br(e){let s=b$1();return a$1(r=>swapStatus(s,{id:r.id}).andThen(n=>{switch(n.__typename){case "SwapOpen":case "SwapPendingSignature":return prepareSwapCancel(s,r).andThen(t=>e(t.data,{cancel:b$2})).map(t=>(invariant(isSignature(t),"Invalid signature"),t)).andThen(t=>cancelSwap(s,{intent:{id:r.id,signature:t}})).andThen(t=>t.__typename==="SwapCancelled"?okAsync(t):e(t,{cancel:b$2}).map(c.ensure).andThen(a=>a.wait()).andThen(()=>swapStatus(s,{id:r.id})).andThen(a=>a.__typename==="SwapCancelled"?okAsync(a):new Q("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return okAsync(n);case "SwapExpired":return new Q("Swap cannot longer be cancelled").asResultAsync();default:return UnexpectedError.upgradeRequired(`Unsupported swap status: ${n.__typename}`).asResultAsync()}}),[s,e])}function E(e,s){let{chainId:r,spoke:n}=decodeReserveId(s.reserve);return async()=>Promise.all([await e.refreshQueryWhere(UserPositionsQuery,(t,a)=>t.request.user===s.sender&&a.some(u=>u.spoke.chain.chainId===r&&u.spoke.address===n)),await e.refreshQueryWhere(UserPositionQuery,(t,a)=>a?.spoke.chain.chainId===r&&a?.spoke.address===n&&a.user===s.sender),await e.refreshQueryWhere(UserSummaryQuery,t=>t.request.user===s.sender&&isSpokeInputVariant(t.request.filter)?t.request.filter.spoke.chainId===r&&t.request.filter.spoke.address===n:isChainIdsVariant(t.request.filter)?t.request.filter.chainIds.some(a=>a===r):false),await e.refreshQueryWhere(ReservesQuery,(t,a)=>a.some(u=>u.id===s.reserve)),await e.refreshQueryWhere(SpokesQuery,(t,a)=>a.some(u=>u.chain.chainId===r&&u.address===n)),await e.refreshQueryWhere(UserBalancesQuery,t=>t.request.user===s.sender),await e.refreshQueryWhere(HubsQuery,t=>isChainIdsVariant(t.request)&&t.request.chainIds.some(a=>a===r))])}function Fr(e){let s=b$1();return a$1(r=>supply(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":return e(n,{cancel:b$2}).andThen(t=>{if(isSignature(t)){let a=n.approval.bySignature;if(!a)return UnexpectedError$1.from("Expected bySignature to be present in Erc20ApprovalRequired").asResultAsync();let u={deadline:a.message.deadline,value:t};return supply(s,es(r,u)).map(expectTypename("TransactionRequest")).andThen(c=>e(c,{cancel:b$2})).map(c.ensure)}return okAsync(t)}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}).andTee(E(s,r)),[s,e])}function es(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function Vr(e){let s=b$1();return a$1(r=>borrow(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n));case "Erc20ApprovalRequired":return UnexpectedError$1.from(n).asResultAsync()}}).andTee(E(s,r)),[s,e])}function Lr(e){let s=b$1();return a$1(r=>repay(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":return e(n,{cancel:b$2}).andThen(t=>{if(isSignature(t)){let a=n.approval.bySignature;if(!a)return UnexpectedError$1.from("Expected bySignature to be present in Erc20ApprovalRequired").asResultAsync();let u={deadline:a.message.deadline,value:t};return repay(s,ss(r,u)).map(expectTypename("TransactionRequest")).andThen(c=>e(c,{cancel:b$2})).map(c.ensure)}return okAsync(t)}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}).andTee(E(s,r)),[s,e])}function ss(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function jr(e){let s=b$1();return a$1(r=>withdraw(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n));case "Erc20ApprovalRequired":return UnexpectedError$1.from(n).asResultAsync()}}).andTee(E(s,r)),[s,e])}function Yr(e){let s=b$1();return a$1(r=>renounceSpokeUserPositionManager(s,r).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(SpokePositionManagersQuery,n=>n.request.spoke===r.spoke)),[s,e])}function Gr(e){let s=b$1();return a$1(r=>updateUserPositionConditions(s,r).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(async()=>{let{userPositionId:n}=r;return Promise.all([s.refreshQueryWhere(UserPositionsQuery,(t,a)=>a.some(u=>u.id===n)),s.refreshQueryWhere(UserPositionQuery,(t,a)=>a?.id===n)])}),[s,e])}function $r(e){let s=b$1();return a$1(r=>{let n=r.changes.map(a=>a.reserve),t=n.map(a=>decodeReserveId(a));return setUserSuppliesAsCollateral(s,r).andThen(a=>e(a,{cancel:b$2})).andThen(a=>a.wait()).andThen(s.waitForTransaction).andTee(()=>Promise.all([...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(UserPositionsQuery,(c,R)=>c.request.user===r.sender&&R.some(b=>b.spoke.chain.chainId===a&&b.spoke.address===u))),...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(UserPositionQuery,(c,R)=>R?.spoke.chain.chainId===a&&R?.spoke.address===u&&R.user===r.sender)),...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(UserSummaryQuery,c=>c.request.user===r.sender&&isSpokeInputVariant(c.request.filter)?c.request.filter.spoke.chainId===a&&c.request.filter.spoke.address===u:isChainIdsVariant(c.request.filter)?c.request.filter.chainIds.some(R=>R===a):false)),s.refreshQueryWhere(ReservesQuery,(a,u)=>u.some(c=>n.includes(c.id))),...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(SpokesQuery,(c,R)=>R.some(b=>b.chain.chainId===a&&b.address===u))),...t.map(({chainId:a})=>s.refreshQueryWhere(HubsQuery,u=>isChainIdsVariant(u.request.query)?u.request.query.chainIds.some(c=>c===a):u.request.query.tokens.some(c=>c.chainId===a))),...t.map(({chainId:a})=>s.refreshQueryWhere(HubQuery,u=>isHubInputVariant(u.request.query)?u.request.query.hubInput.chainId===a:decodeHubId(u.request.query.hubId).chainId===a))]))},[s,e])}function zr(e){let s=b$1();return a$1(r=>liquidatePosition(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}),[s,e])}function Jr(e){let s=b$1();return a$1(r=>setSpokeUserPositionManager(s,r).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(SpokePositionManagersQuery,n=>n.request.spoke===r.spoke)),[s,e])}function Kr(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>preview(s,r,{currency:e.currency}),[s,e.currency])}function Xr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:PreviewQuery,variables:{request:n,currency:r},suspense:e,pause:s})}function Zr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:ActivitiesQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function et(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>activities(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function ot({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserSuppliesQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function pt(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userSupplies(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function it({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserBorrowsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function lt(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userBorrows(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function ct({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserSummaryQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function yt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserPositionsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function St(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userPositions(s,r,{currency:e.currency,timeWindow:e.timeWindow}),[s,e.currency,e.timeWindow])}function dt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserPositionQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Rt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:UserBalancesQuery,variables:{request:n,currency:r},suspense:e,pause:s})}function Ut({suspense:e=false,pause:s=false,...r}){return b({document:UserRiskPremiumBreakdownQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function wt(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userBalances(s,r,{currency:e.currency}),[s,e.currency])}function mt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:UserSummaryHistoryQuery,variables:{request:n,currency:r},suspense:e,pause:s,batch:false})}export{Ps as AaveProvider,Q as CannotCancelSwapError,Zr as useActivities,et as useActivitiesAction,Cs as useAsset,Ms as useAssetBorrowHistory,Os as useAssetPriceHistory,Ds as useAssetSupplyHistory,Vr as useBorrow,Ks as useBorrowApyHistory,xr as useBorrowSwap,br as useBorrowSwapQuote,fr as useBorrowSwapQuoteAction,Br as useCancelSwap,qs as useHub,hs as useHubAssets,Hs as useHubSummaryHistory,ks as useHubs,vs as useHubsAction,zr as useLiquidatePosition,Xr as usePreview,Kr as usePreviewAction,Ns as useProtocolHistory,Yr as useRenounceSpokeUserPositionManager,Lr as useRepay,kr as useRepayWithSupply,Qr as useRepayWithSupplyQuote,qr as useRepayWithSupplyQuoteAction,Gs as useReserve,$s as useReserveAction,zs as useReserves,Js as useReservesAction,Jr as useSetSpokeUserPositionManager,$r as useSetUserSuppliesAsCollateral,rr as useSpoke,nr as useSpokePositionManagers,ar as useSpokeUserPositionManagers,tr as useSpokes,Fr as useSupply,Xs as useSupplyApyHistory,Tr as useSupplySwap,Pr as useSupplySwapQuote,Ar as useSupplySwapQuoteAction,mr as useSwappableTokens,Er as useTokenSwap,Ur as useTokenSwapQuote,wr as useTokenSwapQuoteAction,Gr as useUpdateUserPositionConditions,Rt as useUserBalances,wt as useUserBalancesAction,it as useUserBorrows,lt as useUserBorrowsAction,dt as useUserPosition,yt as useUserPositions,St as useUserPositionsAction,Ut as useUserRiskPremiumBreakdown,ct as useUserSummary,mt as useUserSummaryHistory,ot as useUserSupplies,pt as useUserSuppliesAction,gr as useUserSwaps,jr as useWithdraw,vr as useWithdrawSwap,hr as useWithdrawSwapQuote,Hr as useWithdrawSwapQuoteAction};//# sourceMappingURL=index.js.map
|
|
1
|
+
import {b}from'./chunk-3T44WW7A.js';export{c as useChain,d as useChains,f as useExchangeRate,e as useExchangeRateAction}from'./chunk-3T44WW7A.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,c}from'./chunk-VGAHEW5B.js';import {DEFAULT_QUERY_OPTIONS,UnexpectedError as UnexpectedError$1}from'@aave/client';export*from'@aave/client';import le,{useState,useEffect,useCallback}from'react';import {hubs,reserve,reserves,tokenSwapQuote,supplySwapQuote,borrowSwapQuote,preparePositionSwap,repayWithSupplyQuote,withdrawSwapQuote,swap,prepareTokenSwap,swapStatus,prepareSwapCancel,cancelSwap,supply,borrow,repay,withdraw,renounceSpokeUserPositionManager,updateUserPositionConditions,setUserSuppliesAsCollateral,liquidatePosition,setSpokeUserPositionManager,preview,activities,userSupplies,userBorrows,userPositions,userBalances}from'@aave/client/actions';import {HubQuery,HubsQuery,HubAssetsQuery,HubSummaryHistoryQuery,AssetQuery,AssetPriceHistoryQuery,AssetSupplyHistoryQuery,AssetBorrowHistoryQuery,ProtocolHistoryQuery,ReserveQuery,ReservesQuery,BorrowApyHistoryQuery,SupplyApyHistoryQuery,SpokeQuery,SpokesQuery,SpokePositionManagersQuery,SpokeUserPositionManagersQuery,TokenSwapQuoteQuery,QuoteAccuracy,SwappableTokensQuery,UserSwapsQuery,SwapStatusQuery,SupplySwapQuoteQuery,BorrowSwapQuoteQuery,RepayWithSupplyQuoteQuery,WithdrawSwapQuoteQuery,UserPositionsQuery,UserPositionQuery,decodeReserveId,UserSummaryQuery,isSpokeInputVariant,isChainIdsVariant,isHubInputVariant,decodeHubId,PreviewQuery,ActivitiesQuery,UserSuppliesQuery,UserBorrowsQuery,UserBalancesQuery,UserRiskPremiumBreakdownQuery,UserSummaryHistoryQuery}from'@aave/graphql';import {UnexpectedError,ValidationError}from'@aave/core';import {invariant,isSignature,okAsync,never,ResultAwareError,errAsync,expectTypename}from'@aave/types';function Ts({children:e,client:s}){return le.createElement(a,{client:s},e)}function vs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:HubQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Es({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:HubsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Bs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:HubAssetsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Ws({suspense:e=false,pause:s=false,...r}){return b({document:HubSummaryHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Is(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>hubs(s,r,{currency:e.currency}),[s,e.currency])}function Ns({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:AssetQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Ms({suspense:e=false,pause:s=false,...r}){return b({document:AssetPriceHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Fs({suspense:e=false,pause:s=false,...r}){return b({document:AssetSupplyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Vs({suspense:e=false,pause:s=false,...r}){return b({document:AssetBorrowHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ls({suspense:e=false,pause:s=false,...r}){return b({document:ProtocolHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ks({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:ReserveQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Xs(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>reserve(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function Zs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,selector:t,...a}){return b({document:ReservesQuery,variables:{request:a,currency:r,timeWindow:n},suspense:e,pause:s,selector:t||void 0})}function er(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>reserves(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function sr({suspense:e=false,pause:s=false,...r}){return b({document:BorrowApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function rr({suspense:e=false,pause:s=false,...r}){return b({document:SupplyApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function ur({suspense:e=false,pause:s=false,...r}){return b({document:SpokeQuery,variables:{request:r},suspense:e,pause:s})}function or({suspense:e=false,pause:s=false,...r}){return b({document:SpokesQuery,variables:{request:r},suspense:e,pause:s})}function pr({suspense:e=false,pause:s=false,...r}){return b({document:SpokePositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function ir({suspense:e=false,pause:s=false,...r}){return b({document:SpokeUserPositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function W(e){switch(e.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":return e.quote;default:throw UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${e.__typename}`)}}function F(e,s){return "market"in e&&e.market?{...e,market:{...e.market,accuracy:s}}:"limit"in e&&e.limit?{...e,limit:{...e.limit,accuracy:s}}:e}function Pr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){let t=b$1(),a=b({document:TokenSwapQuoteQuery,variables:{request:F(n,QuoteAccuracy.Fast),currency:r},selector:W,suspense:e,pause:s,batch:false}),u=b({document:TokenSwapQuoteQuery,variables:{request:F(n,QuoteAccuracy.Accurate),currency:r},selector:W,suspense:false,pause:s||e&&!a.data,pollInterval:t.context.environment.swapQuoteInterval,batch:false});return u.data?u:a}function Ar(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>tokenSwapQuote(s,r,{currency:e.currency}).map(W),[s,e.currency])}function br({suspense:e=false,pause:s=false,...r}){return b({document:SwappableTokensQuery,variables:{request:r},suspense:e,pause:s})}function fr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){let a=b$1(),[u,i]=useState(false),y=b({document:UserSwapsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s||u,pollInterval:a.context.environment.swapStatusInterval});return useEffect(()=>{y.data&&y.data.items.length>0&&y.data.items.every(K)&&i(true);},[y.data]),y}function K(e){return e.__typename==="SwapFulfilled"||e.__typename==="SwapCancelled"||e.__typename==="SwapExpired"}function Tr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){let a=b$1(),[u,i]=useState(false),y=b({document:SwapStatusQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s||u,pollInterval:a.context.environment.swapStatusInterval});return useEffect(()=>{y.data&&K(y.data)&&i(true);},[y.data]),y}function xr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:SupplySwapQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function Qr(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>supplySwapQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function qr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:BorrowSwapQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function kr(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>borrowSwapQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function k(e){return {with:s=>e.approvals.reduce((r,n)=>r.andThen(t=>s(n,{cancel:b$2}).map(a=>{switch(n.__typename){case "PositionSwapAdapterContractApproval":t.adapterContractSignature=isSignature(a)?a:null;break;case "PositionSwapPositionManagerApproval":t.positionManagerSignature=isSignature(a)?a:null;break}return t})),okAsync({quoteId:e.quote.quoteId,adapterContractSignature:null,positionManagerSignature:null}))}}function h(e,s){return swap(e,{intent:s}).andThen(r=>{switch(r.__typename){case "SwapReceipt":return okAsync(r);default:return UnexpectedError.from(r).asResultAsync()}})}function hr(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>supplySwapQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function Hr(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>borrowSwapQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function vr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:RepayWithSupplyQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function Er(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>repayWithSupplyQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function Br(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>repayWithSupplyQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function Wr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:WithdrawSwapQuoteQuery,variables:{request:n,currency:r},selector:t=>t.quote,suspense:e,pause:s})}function Ir(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>withdrawSwapQuote(s,r,{currency:e.currency}).map(n=>n.quote),[s,e.currency])}function Cr(e){let s=b$1();return a$1(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...n})=>withdrawSwapQuote(s,n,{currency:r}).andThen(t=>k(t).with(e).andThen(a=>preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:b$2}).map(u=>(invariant(isSignature(u),"Expected signature, got an object instead."),u))).andThen(a=>h(s,{quoteId:t.quote.quoteId,signature:a}))),[s,e])}function Or(e){let s=b$1(),r=useCallback(n=>swap(s,n).andThen(t=>{switch(t.__typename){case "SwapTransactionRequest":return e(t,{cancel:b$2}).map(c.ensure).andThen(a=>a.wait()).andThen(()=>okAsync(t.orderReceipt));case "SwapReceipt":return okAsync(t)}}),[s,e]);return a$1(({currency:n=DEFAULT_QUERY_OPTIONS.currency,...t})=>tokenSwapQuote(s,t,{currency:n}).andThen(a=>{switch(a.__typename){case "SwapByTransaction":return r({transaction:{quoteId:a.quote.quoteId}});case "SwapByIntent":return prepareTokenSwap(s,{quoteId:a.quote.quoteId}).andThen(u=>e(u.data,{cancel:b$2}).map(i=>(invariant(isSignature(i),"Invalid signature"),i)).andThen(i=>r({intent:{quoteId:u.newQuoteId,signature:i}})));case "SwapByIntentWithApprovalRequired":return e(a.approval,{cancel:b$2}).andThen(u=>{if(isSignature(u)){let i=a.approval.bySignature;if(!i)return UnexpectedError.from("Expected bySignature to be present in SwapByIntentWithApprovalRequired").asResultAsync();let y={deadline:i.message.deadline,value:u};return prepareTokenSwap(s,{quoteId:a.quote.quoteId,permitSig:y})}return c.isInstanceOf(u)?u.wait().andThen(()=>prepareTokenSwap(s,{quoteId:a.quote.quoteId})):UnexpectedError.from(u).asResultAsync()}).andThen(u=>e(u.data,{cancel:b$2}).map(i=>(invariant(isSignature(i),"Invalid signature"),i)).andThen(i=>r({intent:{quoteId:a.quote.quoteId,signature:i}})));default:never(`Unsupported swap quote result: ${a.__typename}. To be removed from API soon.`);}}),[s,e,r])}var Q=class extends ResultAwareError{name="CannotCancelSwapError"};function _r(e){let s=b$1();return a$1(r=>swapStatus(s,{id:r.id}).andThen(n=>{switch(n.__typename){case "SwapOpen":case "SwapPendingSignature":return prepareSwapCancel(s,r).andThen(t=>e(t.data,{cancel:b$2})).map(t=>(invariant(isSignature(t),"Invalid signature"),t)).andThen(t=>cancelSwap(s,{intent:{id:r.id,signature:t}})).andThen(t=>t.__typename==="SwapCancelled"?okAsync(t):e(t,{cancel:b$2}).map(c.ensure).andThen(a=>a.wait()).andThen(()=>swapStatus(s,{id:r.id})).andThen(a=>a.__typename==="SwapCancelled"?okAsync(a):new Q("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return okAsync(n);case "SwapExpired":return new Q("Swap cannot longer be cancelled").asResultAsync();default:return UnexpectedError.upgradeRequired(`Unsupported swap status: ${n.__typename}`).asResultAsync()}}),[s,e])}function E(e,s){let{chainId:r,spoke:n}=decodeReserveId(s.reserve);return async()=>Promise.all([await e.refreshQueryWhere(UserPositionsQuery,(t,a)=>t.request.user===s.sender&&a.some(u=>u.spoke.chain.chainId===r&&u.spoke.address===n)),await e.refreshQueryWhere(UserPositionQuery,(t,a)=>a?.spoke.chain.chainId===r&&a?.spoke.address===n&&a.user===s.sender),await e.refreshQueryWhere(UserSummaryQuery,t=>t.request.user===s.sender&&isSpokeInputVariant(t.request.filter)?t.request.filter.spoke.chainId===r&&t.request.filter.spoke.address===n:isChainIdsVariant(t.request.filter)?t.request.filter.chainIds.some(a=>a===r):false),await e.refreshQueryWhere(ReservesQuery,(t,a)=>a.some(u=>u.id===s.reserve)),await e.refreshQueryWhere(SpokesQuery,(t,a)=>a.some(u=>u.chain.chainId===r&&u.address===n)),await e.refreshQueryWhere(UserBalancesQuery,t=>t.request.user===s.sender),await e.refreshQueryWhere(HubsQuery,t=>isChainIdsVariant(t.request)&&t.request.chainIds.some(a=>a===r))])}function Gr(e){let s=b$1();return a$1(r=>supply(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":return e(n,{cancel:b$2}).andThen(t=>{if(isSignature(t)){let a=n.approval.bySignature;if(!a)return UnexpectedError$1.from("Expected bySignature to be present in Erc20ApprovalRequired").asResultAsync();let u={deadline:a.message.deadline,value:t};return supply(s,ns(r,u)).map(expectTypename("TransactionRequest")).andThen(i=>e(i,{cancel:b$2})).map(c.ensure)}return okAsync(t)}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}).andTee(E(s,r)),[s,e])}function ns(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function $r(e){let s=b$1();return a$1(r=>borrow(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n));case "Erc20ApprovalRequired":return UnexpectedError$1.from(n).asResultAsync()}}).andTee(E(s,r)),[s,e])}function zr(e){let s=b$1();return a$1(r=>repay(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":return e(n,{cancel:b$2}).andThen(t=>{if(isSignature(t)){let a=n.approval.bySignature;if(!a)return UnexpectedError$1.from("Expected bySignature to be present in Erc20ApprovalRequired").asResultAsync();let u={deadline:a.message.deadline,value:t};return repay(s,as(r,u)).map(expectTypename("TransactionRequest")).andThen(i=>e(i,{cancel:b$2})).map(c.ensure)}return okAsync(t)}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).map(c.ensure).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).map(c.ensure).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}).andTee(E(s,r)),[s,e])}function as(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function Jr(e){let s=b$1();return a$1(r=>withdraw(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "PreContractActionRequired":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n));case "Erc20ApprovalRequired":return UnexpectedError$1.from(n).asResultAsync()}}).andTee(E(s,r)),[s,e])}function Kr(e){let s=b$1();return a$1(r=>renounceSpokeUserPositionManager(s,r).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(SpokePositionManagersQuery,n=>n.request.spoke===r.spoke)),[s,e])}function Xr(e){let s=b$1();return a$1(r=>updateUserPositionConditions(s,r).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(async()=>{let{userPositionId:n}=r;return Promise.all([s.refreshQueryWhere(UserPositionsQuery,(t,a)=>a.some(u=>u.id===n)),s.refreshQueryWhere(UserPositionQuery,(t,a)=>a?.id===n)])}),[s,e])}function Zr(e){let s=b$1();return a$1(r=>{let n=r.changes.map(a=>a.reserve),t=n.map(a=>decodeReserveId(a));return setUserSuppliesAsCollateral(s,r).andThen(a=>e(a,{cancel:b$2})).andThen(a=>a.wait()).andThen(s.waitForTransaction).andTee(()=>Promise.all([...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(UserPositionsQuery,(i,y)=>i.request.user===r.sender&&y.some(b=>b.spoke.chain.chainId===a&&b.spoke.address===u))),...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(UserPositionQuery,(i,y)=>y?.spoke.chain.chainId===a&&y?.spoke.address===u&&y.user===r.sender)),...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(UserSummaryQuery,i=>i.request.user===r.sender&&isSpokeInputVariant(i.request.filter)?i.request.filter.spoke.chainId===a&&i.request.filter.spoke.address===u:isChainIdsVariant(i.request.filter)?i.request.filter.chainIds.some(y=>y===a):false)),s.refreshQueryWhere(ReservesQuery,(a,u)=>u.some(i=>n.includes(i.id))),...t.map(({chainId:a,spoke:u})=>s.refreshQueryWhere(SpokesQuery,(i,y)=>y.some(b=>b.chain.chainId===a&&b.address===u))),...t.map(({chainId:a})=>s.refreshQueryWhere(HubsQuery,u=>isChainIdsVariant(u.request.query)?u.request.query.chainIds.some(i=>i===a):u.request.query.tokens.some(i=>i.chainId===a))),...t.map(({chainId:a})=>s.refreshQueryWhere(HubQuery,u=>isHubInputVariant(u.request.query)?u.request.query.hubInput.chainId===a:decodeHubId(u.request.query.hubId).chainId===a))]))},[s,e])}function et(e){let s=b$1();return a$1(r=>liquidatePosition(s,r).andThen(n=>{switch(n.__typename){case "TransactionRequest":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e(n,{cancel:b$2}).andThen(t=>t.wait()).andThen(()=>e(n.originalTransaction,{cancel:b$2})).andThen(t=>t.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}),[s,e])}function st(e){let s=b$1();return a$1(r=>setSpokeUserPositionManager(s,r).andThen(n=>e(n,{cancel:b$2})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(SpokePositionManagersQuery,n=>n.request.spoke===r.spoke)),[s,e])}function rt(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>preview(s,r,{currency:e.currency}),[s,e.currency])}function tt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:PreviewQuery,variables:{request:n,currency:r},suspense:e,pause:s})}function nt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:ActivitiesQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function at(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>activities(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function yt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserSuppliesQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function St(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userSupplies(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function dt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserBorrowsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Rt(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userBorrows(s,r,{currency:e.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e.currency,e.timeWindow])}function Ut({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserSummaryQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function wt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserPositionsQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function mt(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userPositions(s,r,{currency:e.currency,timeWindow:e.timeWindow}),[s,e.currency,e.timeWindow])}function gt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:n=DEFAULT_QUERY_OPTIONS.timeWindow,...t}){return b({document:UserPositionQuery,variables:{request:t,currency:r,timeWindow:n},suspense:e,pause:s})}function Pt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:UserBalancesQuery,variables:{request:n,currency:r},suspense:e,pause:s})}function At({suspense:e=false,pause:s=false,...r}){return b({document:UserRiskPremiumBreakdownQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function bt(e=DEFAULT_QUERY_OPTIONS){let s=b$1();return a$1(r=>userBalances(s,r,{currency:e.currency}),[s,e.currency])}function ft({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...n}){return b({document:UserSummaryHistoryQuery,variables:{request:n,currency:r},suspense:e,pause:s,batch:false})}export{Ts as AaveProvider,Q as CannotCancelSwapError,nt as useActivities,at as useActivitiesAction,Ns as useAsset,Vs as useAssetBorrowHistory,Ms as useAssetPriceHistory,Fs as useAssetSupplyHistory,$r as useBorrow,sr as useBorrowApyHistory,Hr as useBorrowSwap,qr as useBorrowSwapQuote,kr as useBorrowSwapQuoteAction,_r as useCancelSwap,vs as useHub,Bs as useHubAssets,Ws as useHubSummaryHistory,Es as useHubs,Is as useHubsAction,et as useLiquidatePosition,tt as usePreview,rt as usePreviewAction,Ls as useProtocolHistory,Kr as useRenounceSpokeUserPositionManager,zr as useRepay,Br as useRepayWithSupply,vr as useRepayWithSupplyQuote,Er as useRepayWithSupplyQuoteAction,Ks as useReserve,Xs as useReserveAction,Zs as useReserves,er as useReservesAction,st as useSetSpokeUserPositionManager,Zr as useSetUserSuppliesAsCollateral,ur as useSpoke,pr as useSpokePositionManagers,ir as useSpokeUserPositionManagers,or as useSpokes,Gr as useSupply,rr as useSupplyApyHistory,hr as useSupplySwap,xr as useSupplySwapQuote,Qr as useSupplySwapQuoteAction,Tr as useSwapStatus,br as useSwappableTokens,Or as useTokenSwap,Pr as useTokenSwapQuote,Ar as useTokenSwapQuoteAction,Xr as useUpdateUserPositionConditions,Pt as useUserBalances,bt as useUserBalancesAction,dt as useUserBorrows,Rt as useUserBorrowsAction,gt as useUserPosition,wt as useUserPositions,mt as useUserPositionsAction,At as useUserRiskPremiumBreakdown,Ut as useUserSummary,ft as useUserSummaryHistory,yt as useUserSupplies,St as useUserSuppliesAction,fr as useUserSwaps,Jr as useWithdraw,Cr as useWithdrawSwap,Wr as useWithdrawSwapQuote,Ir as useWithdrawSwapQuoteAction};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|