@aave/react 4.0.0-next.20 → 4.0.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -29
- package/dist/index.d.ts +41 -29
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
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-YQQTp7E5.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-YQQTp7E5.cjs';
|
|
6
|
-
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult,
|
|
6
|
+
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, ERC20PermitSignature, PrepareSwapCancelRequest, SwapCancelled, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
7
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-Bqd-LTM7.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-Bqd-LTM7.cjs';
|
|
@@ -1170,7 +1170,7 @@ declare function useSpokeUserPositionManagers(args: UseSpokeUserPositionManagers
|
|
|
1170
1170
|
*/
|
|
1171
1171
|
declare function useSpokeUserPositionManagers(args: Pausable<UseSpokeUserPositionManagersArgs>): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1172
1172
|
|
|
1173
|
-
type UseTokenSwapQuoteArgs = Prettify<
|
|
1173
|
+
type UseTokenSwapQuoteArgs = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1174
1174
|
/**
|
|
1175
1175
|
* Fetch a swap quote for the specified trade parameters.
|
|
1176
1176
|
*
|
|
@@ -1178,11 +1178,14 @@ type UseTokenSwapQuoteArgs = Prettify<MarketOrderTokenSwapQuoteInput & CurrencyQ
|
|
|
1178
1178
|
*
|
|
1179
1179
|
* ```tsx
|
|
1180
1180
|
* const { data } = useTokenSwapQuote({
|
|
1181
|
+
* market: {
|
|
1182
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1183
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1184
|
+
* amount: bigDecimal('1000'),
|
|
1185
|
+
* kind: SwapKind.Sell,
|
|
1186
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1187
|
+
* },
|
|
1181
1188
|
* chainId: chainId(1),
|
|
1182
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1183
|
-
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1184
|
-
* amount: bigDecimal('1000'),
|
|
1185
|
-
* kind: SwapKind.Sell,
|
|
1186
1189
|
* suspense: true,
|
|
1187
1190
|
* });
|
|
1188
1191
|
* ```
|
|
@@ -1195,12 +1198,14 @@ declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): S
|
|
|
1195
1198
|
*
|
|
1196
1199
|
* ```tsx
|
|
1197
1200
|
* const { data } = useTokenSwapQuote({
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1202
|
-
*
|
|
1203
|
-
*
|
|
1201
|
+
* market: {
|
|
1202
|
+
* chainId: chainId(1),
|
|
1203
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1204
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1205
|
+
* amount: bigDecimal('1000'),
|
|
1206
|
+
* kind: SwapKind.Sell,
|
|
1207
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1208
|
+
* },
|
|
1204
1209
|
* suspense: true,
|
|
1205
1210
|
* pause: true,
|
|
1206
1211
|
* });
|
|
@@ -1212,11 +1217,14 @@ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs> & Suspe
|
|
|
1212
1217
|
*
|
|
1213
1218
|
* ```tsx
|
|
1214
1219
|
* const { data, error, loading } = useTokenSwapQuote({
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
+
* market: {
|
|
1221
|
+
* chainId: chainId(1),
|
|
1222
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1223
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1224
|
+
* amount: bigDecimal('1000'),
|
|
1225
|
+
* kind: SwapKind.Sell,
|
|
1226
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1227
|
+
* },
|
|
1220
1228
|
* });
|
|
1221
1229
|
* ```
|
|
1222
1230
|
*/
|
|
@@ -1228,12 +1236,14 @@ declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs): ReadResult<Swap
|
|
|
1228
1236
|
*
|
|
1229
1237
|
* ```tsx
|
|
1230
1238
|
* const { data, error, loading, paused } = useTokenSwapQuote({
|
|
1231
|
-
*
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1239
|
+
* market: {
|
|
1240
|
+
* chainId: chainId(1),
|
|
1241
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1242
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1243
|
+
* amount: bigDecimal('1000'),
|
|
1244
|
+
* kind: SwapKind.Sell,
|
|
1245
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1246
|
+
* },
|
|
1237
1247
|
* pause: true,
|
|
1238
1248
|
* });
|
|
1239
1249
|
* ```
|
|
@@ -1253,11 +1263,13 @@ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): Pausa
|
|
|
1253
1263
|
* // …
|
|
1254
1264
|
*
|
|
1255
1265
|
* const result = await getQuote({
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1266
|
+
* market: {
|
|
1267
|
+
* chainId: chainId(1),
|
|
1268
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1269
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1270
|
+
* amount: bigDecimal('1000'),
|
|
1271
|
+
* kind: SwapKind.Sell,
|
|
1272
|
+
* },
|
|
1261
1273
|
* });
|
|
1262
1274
|
*
|
|
1263
1275
|
* if (result.isOk()) {
|
|
@@ -1267,7 +1279,7 @@ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): Pausa
|
|
|
1267
1279
|
* }
|
|
1268
1280
|
* ```
|
|
1269
1281
|
*/
|
|
1270
|
-
declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<
|
|
1282
|
+
declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<TokenSwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1271
1283
|
type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
1272
1284
|
/**
|
|
1273
1285
|
* Fetch the list of tokens available for swapping on a specific chain.
|
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-YQQTp7E5.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-YQQTp7E5.js';
|
|
6
|
-
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult,
|
|
6
|
+
import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, TransactionRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, ERC20PermitSignature, PrepareSwapCancelRequest, SwapCancelled, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
|
|
7
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-DrMxWliM.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-DrMxWliM.js';
|
|
@@ -1170,7 +1170,7 @@ declare function useSpokeUserPositionManagers(args: UseSpokeUserPositionManagers
|
|
|
1170
1170
|
*/
|
|
1171
1171
|
declare function useSpokeUserPositionManagers(args: Pausable<UseSpokeUserPositionManagersArgs>): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;
|
|
1172
1172
|
|
|
1173
|
-
type UseTokenSwapQuoteArgs = Prettify<
|
|
1173
|
+
type UseTokenSwapQuoteArgs = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
|
|
1174
1174
|
/**
|
|
1175
1175
|
* Fetch a swap quote for the specified trade parameters.
|
|
1176
1176
|
*
|
|
@@ -1178,11 +1178,14 @@ type UseTokenSwapQuoteArgs = Prettify<MarketOrderTokenSwapQuoteInput & CurrencyQ
|
|
|
1178
1178
|
*
|
|
1179
1179
|
* ```tsx
|
|
1180
1180
|
* const { data } = useTokenSwapQuote({
|
|
1181
|
+
* market: {
|
|
1182
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1183
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1184
|
+
* amount: bigDecimal('1000'),
|
|
1185
|
+
* kind: SwapKind.Sell,
|
|
1186
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1187
|
+
* },
|
|
1181
1188
|
* chainId: chainId(1),
|
|
1182
|
-
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1183
|
-
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1184
|
-
* amount: bigDecimal('1000'),
|
|
1185
|
-
* kind: SwapKind.Sell,
|
|
1186
1189
|
* suspense: true,
|
|
1187
1190
|
* });
|
|
1188
1191
|
* ```
|
|
@@ -1195,12 +1198,14 @@ declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): S
|
|
|
1195
1198
|
*
|
|
1196
1199
|
* ```tsx
|
|
1197
1200
|
* const { data } = useTokenSwapQuote({
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1202
|
-
*
|
|
1203
|
-
*
|
|
1201
|
+
* market: {
|
|
1202
|
+
* chainId: chainId(1),
|
|
1203
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1204
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1205
|
+
* amount: bigDecimal('1000'),
|
|
1206
|
+
* kind: SwapKind.Sell,
|
|
1207
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1208
|
+
* },
|
|
1204
1209
|
* suspense: true,
|
|
1205
1210
|
* pause: true,
|
|
1206
1211
|
* });
|
|
@@ -1212,11 +1217,14 @@ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs> & Suspe
|
|
|
1212
1217
|
*
|
|
1213
1218
|
* ```tsx
|
|
1214
1219
|
* const { data, error, loading } = useTokenSwapQuote({
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
+
* market: {
|
|
1221
|
+
* chainId: chainId(1),
|
|
1222
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1223
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1224
|
+
* amount: bigDecimal('1000'),
|
|
1225
|
+
* kind: SwapKind.Sell,
|
|
1226
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1227
|
+
* },
|
|
1220
1228
|
* });
|
|
1221
1229
|
* ```
|
|
1222
1230
|
*/
|
|
@@ -1228,12 +1236,14 @@ declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs): ReadResult<Swap
|
|
|
1228
1236
|
*
|
|
1229
1237
|
* ```tsx
|
|
1230
1238
|
* const { data, error, loading, paused } = useTokenSwapQuote({
|
|
1231
|
-
*
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1239
|
+
* market: {
|
|
1240
|
+
* chainId: chainId(1),
|
|
1241
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1242
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1243
|
+
* amount: bigDecimal('1000'),
|
|
1244
|
+
* kind: SwapKind.Sell,
|
|
1245
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1246
|
+
* },
|
|
1237
1247
|
* pause: true,
|
|
1238
1248
|
* });
|
|
1239
1249
|
* ```
|
|
@@ -1253,11 +1263,13 @@ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): Pausa
|
|
|
1253
1263
|
* // …
|
|
1254
1264
|
*
|
|
1255
1265
|
* const result = await getQuote({
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1266
|
+
* market: {
|
|
1267
|
+
* chainId: chainId(1),
|
|
1268
|
+
* buy: { erc20: evmAddress('0xA0b86a33E6…') },
|
|
1269
|
+
* sell: { erc20: evmAddress('0x6B175474E…') },
|
|
1270
|
+
* amount: bigDecimal('1000'),
|
|
1271
|
+
* kind: SwapKind.Sell,
|
|
1272
|
+
* },
|
|
1261
1273
|
* });
|
|
1262
1274
|
*
|
|
1263
1275
|
* if (result.isOk()) {
|
|
@@ -1267,7 +1279,7 @@ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): Pausa
|
|
|
1267
1279
|
* }
|
|
1268
1280
|
* ```
|
|
1269
1281
|
*/
|
|
1270
|
-
declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<
|
|
1282
|
+
declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<TokenSwapQuoteRequest, SwapQuote, UnexpectedError$1>;
|
|
1271
1283
|
type UseSwappableTokensArgs = SwappableTokensRequest;
|
|
1272
1284
|
/**
|
|
1273
1285
|
* Fetch the list of tokens available for swapping on a specific chain.
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b}from'./chunk-YGW2LSLM.js';export{c as useChain,d as useChains,f as useExchangeRate,e as useExchangeRateAction}from'./chunk-YGW2LSLM.js';import {d,e,a,b as b$1,c}from'./chunk-YPQBKWEA.js';export{e as useAaveClient,f as usePermitTypedDataAction}from'./chunk-YPQBKWEA.js';import {DEFAULT_QUERY_OPTIONS}from'@aave/client';export*from'@aave/client';import X,{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,SwappableTokensQuery,UserSwapsQuery,SupplySwapQuoteQuery,BorrowSwapQuoteQuery,RepayWithSupplyQuoteQuery,WithdrawSwapQuoteQuery,isERC20PermitSignature,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}from'@aave/types';function ds({children:s,client:e}){return X.createElement(d,{client:e},s)}function As({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:HubQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function bs({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:HubsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function fs({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:HubAssetsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function xs({suspense:s=false,pause:e=false,...r}){return b({document:HubSummaryHistoryQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function Ts(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>hubs(e$1,r,{currency:s.currency}),[e$1,s.currency])}function hs({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:AssetQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function vs({suspense:s=false,pause:e=false,...r}){return b({document:AssetPriceHistoryQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function Es({suspense:s=false,pause:e=false,...r}){return b({document:AssetSupplyHistoryQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function Bs({suspense:s=false,pause:e=false,...r}){return b({document:AssetBorrowHistoryQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function Ws({suspense:s=false,pause:e=false,...r}){return b({document:ProtocolHistoryQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function _s({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:ReserveQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function Fs(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>reserve(e$1,r,{currency:s.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:s.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[e$1,s.currency,s.timeWindow])}function Vs({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,selector:n,...u}){return b({document:ReservesQuery,variables:{request:u,currency:r,timeWindow:t},suspense:s,pause:e,selector:n||void 0})}function Ls(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>reserves(e$1,r,{currency:s.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:s.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[e$1,s.currency,s.timeWindow])}function Ys({suspense:s=false,pause:e=false,...r}){return b({document:BorrowApyHistoryQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function Gs({suspense:s=false,pause:e=false,...r}){return b({document:SupplyApyHistoryQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function Js({suspense:s=false,pause:e=false,...r}){return b({document:SpokeQuery,variables:{request:r},suspense:s,pause:e})}function Ks({suspense:s=false,pause:e=false,...r}){return b({document:SpokesQuery,variables:{request:r},suspense:s,pause:e})}function Xs({suspense:s=false,pause:e=false,...r}){return b({document:SpokePositionManagersQuery,variables:{request:r},suspense:s,pause:e})}function Zs({suspense:s=false,pause:e=false,...r}){return b({document:SpokeUserPositionManagersQuery,variables:{request:r},suspense:s,pause:e})}function L(s){switch(s.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":return s.quote;default:throw UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${s.__typename}`)}}function lr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:TokenSwapQuoteQuery,variables:{request:{market:t},currency:r},selector:L,suspense:s,pause:e})}function cr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>tokenSwapQuote(e$1,{market:r},{currency:s.currency}).map(L),[e$1,s.currency])}function yr({suspense:s=false,pause:e=false,...r}){return b({document:SwappableTokensQuery,variables:{request:r},suspense:s,pause:e})}function Sr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserSwapsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function dr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:SupplySwapQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:s,pause:e})}function Rr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>supplySwapQuote(e$1,r,{currency:s.currency}).map(t=>t.quote),[e$1,s.currency])}function Ur({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:BorrowSwapQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:s,pause:e})}function wr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>borrowSwapQuote(e$1,r,{currency:s.currency}).map(t=>t.quote),[e$1,s.currency])}function q(s){return {with:e=>s.approvals.reduce((r,t)=>r.andThen(n=>e(t,{cancel:b$1}).map(u=>{switch(t.__typename){case "PositionSwapAdapterContractApproval":n.adapterContractSignature=isSignature(u)?u:null;break;case "PositionSwapPositionManagerApproval":n.positionManagerSignature=isSignature(u)?u:null;break}return n})),okAsync({quoteId:s.quote.quoteId,adapterContractSignature:null,positionManagerSignature:null}))}}function H(s,e){return swap(s,{intent:e}).andThen(r=>{switch(r.__typename){case "SwapReceipt":return okAsync(r);default:return UnexpectedError.from(r).asResultAsync()}})}function mr(s){let e$1=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>supplySwapQuote(e$1,t,{currency:r}).andThen(n=>q(n).with(s).andThen(u=>preparePositionSwap(e$1,u)).andThen(u=>s(u.data,{cancel:b$1}).map(o=>(invariant(isSignature(o),"Expected signature, got an object instead."),o))).andThen(u=>H(e$1,{quoteId:n.quote.quoteId,signature:u}))),[e$1,s])}function gr(s){let e$1=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>borrowSwapQuote(e$1,t,{currency:r}).andThen(n=>q(n).with(s).andThen(u=>preparePositionSwap(e$1,u)).andThen(u=>s(u.data,{cancel:b$1}).map(o=>(invariant(isSignature(o),"Expected signature, got an object instead."),o))).andThen(u=>H(e$1,{quoteId:n.quote.quoteId,signature:u}))),[e$1,s])}function Pr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:RepayWithSupplyQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:s,pause:e})}function Ar(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>repayWithSupplyQuote(e$1,r,{currency:s.currency}).map(t=>t.quote),[e$1,s.currency])}function br(s){let e$1=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>repayWithSupplyQuote(e$1,t,{currency:r}).andThen(n=>q(n).with(s).andThen(u=>preparePositionSwap(e$1,u)).andThen(u=>s(u.data,{cancel:b$1}).map(o=>(invariant(isSignature(o),"Expected signature, got an object instead."),o))).andThen(u=>H(e$1,{quoteId:n.quote.quoteId,signature:u}))),[e$1,s])}function fr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:WithdrawSwapQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:s,pause:e})}function xr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>withdrawSwapQuote(e$1,r,{currency:s.currency}).map(t=>t.quote),[e$1,s.currency])}function Tr(s){let e$1=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>withdrawSwapQuote(e$1,t,{currency:r}).andThen(n=>q(n).with(s).andThen(u=>preparePositionSwap(e$1,u)).andThen(u=>s(u.data,{cancel:b$1}).map(o=>(invariant(isSignature(o),"Expected signature, got an object instead."),o))).andThen(u=>H(e$1,{quoteId:n.quote.quoteId,signature:u}))),[e$1,s])}function Qr(s){let e$1=e(),r=useCallback(t=>swap(e$1,t).andThen(n=>{switch(n.__typename){case "SwapTransactionRequest":return s(n,{cancel:b$1}).map(c.ensure).andThen(u=>u.wait()).andThen(()=>okAsync(n.orderReceipt));case "SwapReceipt":return okAsync(n)}}),[e$1,s]);return a(({currency:t=DEFAULT_QUERY_OPTIONS.currency,...n})=>tokenSwapQuote(e$1,n,{currency:t}).andThen(u=>{switch(u.__typename){case "SwapByTransaction":return r({transaction:{quoteId:u.quote.quoteId}});case "SwapByIntent":return prepareTokenSwap(e$1,{quoteId:u.quote.quoteId}).andThen(o=>s(o.data,{cancel:b$1}).map(c=>(invariant(isSignature(c),"Invalid signature"),c)).andThen(c=>r({intent:{quoteId:o.newQuoteId,signature:c}})));case "SwapByIntentWithApprovalRequired":return s(u.approval,{cancel:b$1}).andThen(o=>isERC20PermitSignature(o)?prepareTokenSwap(e$1,{quoteId:u.quote.quoteId,permitSig:o}):c.isInstanceOf(o)?o.wait().andThen(()=>prepareTokenSwap(e$1,{quoteId:u.quote.quoteId})):UnexpectedError.from(o).asResultAsync()).andThen(o=>s(o.data,{cancel:b$1}).map(c=>(invariant(isSignature(c),"Invalid signature"),c)).andThen(c=>r({intent:{quoteId:u.quote.quoteId,signature:c}})));default:never(`Unsupported swap quote result: ${u.__typename}. To be removed from API soon.`);}}),[e$1,s,r])}var T=class extends ResultAwareError{name="CannotCancelSwapError"};function kr(s){let e$1=e();return a(r=>swapStatus(e$1,{id:r.id}).andThen(t=>{switch(t.__typename){case "SwapOpen":case "SwapPendingSignature":return prepareSwapCancel(e$1,r).andThen(n=>s(n.data,{cancel:b$1})).map(n=>(invariant(isSignature(n),"Invalid signature"),n)).andThen(n=>cancelSwap(e$1,{intent:{id:r.id,signature:n}})).andThen(n=>n.__typename==="SwapCancelled"?okAsync(n):s(n,{cancel:b$1}).map(c.ensure).andThen(u=>u.wait()).andThen(()=>swapStatus(e$1,{id:r.id})).andThen(u=>u.__typename==="SwapCancelled"?okAsync(u):new T("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return okAsync(t);case "SwapExpired":return new T("Swap cannot longer be cancelled").asResultAsync();default:return UnexpectedError.upgradeRequired(`Unsupported swap status: ${t.__typename}`).asResultAsync()}}),[e$1,s])}function v(s,e){let{chainId:r,spoke:t}=decodeReserveId(e.reserve);return async()=>Promise.all([await s.refreshQueryWhere(UserPositionsQuery,(n,u)=>n.request.user===e.sender&&u.some(o=>o.spoke.chain.chainId===r&&o.spoke.address===t)),await s.refreshQueryWhere(UserPositionQuery,(n,u)=>u?.spoke.chain.chainId===r&&u?.spoke.address===t&&u.user===e.sender),await s.refreshQueryWhere(UserSummaryQuery,n=>n.request.user===e.sender&&isSpokeInputVariant(n.request.filter)?n.request.filter.spoke.chainId===r&&n.request.filter.spoke.address===t:isChainIdsVariant(n.request.filter)?n.request.filter.chainIds.some(u=>u===r):false),await s.refreshQueryWhere(ReservesQuery,(n,u)=>u.some(o=>o.id===e.reserve)),await s.refreshQueryWhere(SpokesQuery,(n,u)=>u.some(o=>o.chain.chainId===r&&o.address===t)),await s.refreshQueryWhere(UserBalancesQuery,n=>n.request.user===e.sender),await s.refreshQueryWhere(HubsQuery,n=>isChainIdsVariant(n.request)&&n.request.chainIds.some(u=>u===r))])}function Cr(s){let e$1=e();return a(r=>supply(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(e$1,r)),[e$1,s])}function Or(s){let e$1=e();return a(r=>borrow(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(e$1,r)),[e$1,s])}function Mr(s){let e$1=e();return a(r=>repay(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(e$1,r)),[e$1,s])}function Nr(s){let e$1=e();return a(r=>withdraw(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(e$1,r)),[e$1,s])}function Dr(s){let e$1=e();return a(r=>renounceSpokeUserPositionManager(e$1,r).andThen(t=>s(t,{cancel:b$1})).andThen(t=>t.wait()).andThen(e$1.waitForTransaction).andTee(()=>e$1.refreshQueryWhere(SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[e$1,s])}function _r(s){let e$1=e();return a(r=>updateUserPositionConditions(e$1,r).andThen(t=>s(t,{cancel:b$1})).andThen(t=>t.wait()).andThen(e$1.waitForTransaction).andTee(async()=>{let{userPositionId:t}=r;return Promise.all([e$1.refreshQueryWhere(UserPositionsQuery,(n,u)=>u.some(o=>o.id===t)),e$1.refreshQueryWhere(UserPositionQuery,(n,u)=>u?.id===t)])}),[e$1,s])}function Fr(s){let e$1=e();return a(r=>{let t=r.changes.map(u=>u.reserve),n=t.map(u=>decodeReserveId(u));return setUserSuppliesAsCollateral(e$1,r).andThen(u=>s(u,{cancel:b$1})).andThen(u=>u.wait()).andThen(e$1.waitForTransaction).andTee(()=>Promise.all([...n.map(({chainId:u,spoke:o})=>e$1.refreshQueryWhere(UserPositionsQuery,(c,R)=>c.request.user===r.sender&&R.some(A=>A.spoke.chain.chainId===u&&A.spoke.address===o))),...n.map(({chainId:u,spoke:o})=>e$1.refreshQueryWhere(UserPositionQuery,(c,R)=>R?.spoke.chain.chainId===u&&R?.spoke.address===o&&R.user===r.sender)),...n.map(({chainId:u,spoke:o})=>e$1.refreshQueryWhere(UserSummaryQuery,c=>c.request.user===r.sender&&isSpokeInputVariant(c.request.filter)?c.request.filter.spoke.chainId===u&&c.request.filter.spoke.address===o:isChainIdsVariant(c.request.filter)?c.request.filter.chainIds.some(R=>R===u):false)),e$1.refreshQueryWhere(ReservesQuery,(u,o)=>o.some(c=>t.includes(c.id))),...n.map(({chainId:u,spoke:o})=>e$1.refreshQueryWhere(SpokesQuery,(c,R)=>R.some(A=>A.chain.chainId===u&&A.address===o))),...n.map(({chainId:u})=>e$1.refreshQueryWhere(HubsQuery,o=>isChainIdsVariant(o.request.query)?o.request.query.chainIds.some(c=>c===u):o.request.query.tokens.some(c=>c.chainId===u))),...n.map(({chainId:u})=>e$1.refreshQueryWhere(HubQuery,o=>isHubInputVariant(o.request.query)?o.request.query.hubInput.chainId===u:decodeHubId(o.request.query.hubId).chainId===u))]))},[e$1,s])}function Vr(s){let e$1=e();return a(r=>liquidatePosition(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}),[e$1,s])}function Lr(s){let e$1=e();return a(r=>setSpokeUserPositionManager(e$1,r).andThen(t=>s(t,{cancel:b$1})).andThen(t=>t.wait()).andThen(e$1.waitForTransaction).andTee(()=>e$1.refreshQueryWhere(SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[e$1,s])}function Yr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>preview(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Gr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:PreviewQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function jr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:ActivitiesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function $r(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>activities(e$1,r,{currency:s.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:s.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[e$1,s.currency,s.timeWindow])}function st({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserSuppliesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function rt(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>userSupplies(e$1,r,{currency:s.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:s.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[e$1,s.currency,s.timeWindow])}function tt({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserBorrowsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function nt(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>userBorrows(e$1,r,{currency:s.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:s.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[e$1,s.currency,s.timeWindow])}function ut({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserSummaryQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function ot({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserPositionsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function at(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>userPositions(e$1,r,{currency:s.currency,timeWindow:s.timeWindow}),[e$1,s.currency,s.timeWindow])}function pt({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserPositionQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function it({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserBalancesQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function lt({suspense:s=false,pause:e=false,...r}){return b({document:UserRiskPremiumBreakdownQuery,variables:{request:r},suspense:s,pause:e,batch:false})}function ct(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>userBalances(e$1,r,{currency:s.currency}),[e$1,s.currency])}function yt({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserSummaryHistoryQuery,variables:{request:t,currency:r},suspense:s,pause:e,batch:false})}export{ds as AaveProvider,T as CannotCancelSwapError,jr as useActivities,$r as useActivitiesAction,hs as useAsset,Bs as useAssetBorrowHistory,vs as useAssetPriceHistory,Es as useAssetSupplyHistory,Or as useBorrow,Ys as useBorrowApyHistory,gr as useBorrowSwap,Ur as useBorrowSwapQuote,wr as useBorrowSwapQuoteAction,kr as useCancelSwap,As as useHub,fs as useHubAssets,xs as useHubSummaryHistory,bs as useHubs,Ts as useHubsAction,Vr as useLiquidatePosition,Gr as usePreview,Yr as usePreviewAction,Ws as useProtocolHistory,Dr as useRenounceSpokeUserPositionManager,Mr as useRepay,br as useRepayWithSupply,Pr as useRepayWithSupplyQuote,Ar as useRepayWithSupplyQuoteAction,_s as useReserve,Fs as useReserveAction,Vs as useReserves,Ls as useReservesAction,Lr as useSetSpokeUserPositionManager,Fr as useSetUserSuppliesAsCollateral,Js as useSpoke,Xs as useSpokePositionManagers,Zs as useSpokeUserPositionManagers,Ks as useSpokes,Cr as useSupply,Gs as useSupplyApyHistory,mr as useSupplySwap,dr as useSupplySwapQuote,Rr as useSupplySwapQuoteAction,yr as useSwappableTokens,Qr as useTokenSwap,lr as useTokenSwapQuote,cr as useTokenSwapQuoteAction,_r as useUpdateUserPositionConditions,it as useUserBalances,ct as useUserBalancesAction,tt as useUserBorrows,nt as useUserBorrowsAction,pt as useUserPosition,ot as useUserPositions,at as useUserPositionsAction,lt as useUserRiskPremiumBreakdown,ut as useUserSummary,yt as useUserSummaryHistory,st as useUserSupplies,rt as useUserSuppliesAction,Sr as useUserSwaps,Nr as useWithdraw,Tr as useWithdrawSwap,fr as useWithdrawSwapQuote,xr as useWithdrawSwapQuoteAction};//# sourceMappingURL=index.js.map
|
|
1
|
+
import {b}from'./chunk-YGW2LSLM.js';export{c as useChain,d as useChains,f as useExchangeRate,e as useExchangeRateAction}from'./chunk-YGW2LSLM.js';import {d,e,a,b as b$1,c}from'./chunk-YPQBKWEA.js';export{e as useAaveClient,f as usePermitTypedDataAction}from'./chunk-YPQBKWEA.js';import {DEFAULT_QUERY_OPTIONS}from'@aave/client';export*from'@aave/client';import se,{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,isERC20PermitSignature,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}from'@aave/types';function Us({children:e,client:s}){return se.createElement(d,{client:s},e)}function fs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:HubQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Ts({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:HubsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function xs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:HubAssetsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Qs({suspense:e=false,pause:s=false,...r}){return b({document:HubSummaryHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function ks(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>hubs(s,r,{currency:e$1.currency}),[s,e$1.currency])}function Es({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:AssetQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Bs({suspense:e=false,pause:s=false,...r}){return b({document:AssetPriceHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ws({suspense:e=false,pause:s=false,...r}){return b({document:AssetSupplyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Is({suspense:e=false,pause:s=false,...r}){return b({document:AssetBorrowHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Cs({suspense:e=false,pause:s=false,...r}){return b({document:ProtocolHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Vs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:ReserveQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Ls(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>reserve(s,r,{currency:e$1.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function Ys({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,selector:n,...u}){return b({document:ReservesQuery,variables:{request:u,currency:r,timeWindow:t},suspense:e,pause:s,selector:n||void 0})}function js(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>reserves(s,r,{currency:e$1.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function Gs({suspense:e=false,pause:s=false,...r}){return b({document:BorrowApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function $s({suspense:e=false,pause:s=false,...r}){return b({document:SupplyApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Xs({suspense:e=false,pause:s=false,...r}){return b({document:SpokeQuery,variables:{request:r},suspense:e,pause:s})}function Zs({suspense:e=false,pause:s=false,...r}){return b({document:SpokesQuery,variables:{request:r},suspense:e,pause:s})}function er({suspense:e=false,pause:s=false,...r}){return b({document:SpokePositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function sr({suspense:e=false,pause:s=false,...r}){return b({document:SpokeUserPositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function B(e){switch(e.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":return e.quote;default:throw UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${e.__typename}`)}}function _(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 yr({suspense:e$1=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){let n=e(),u=b({document:TokenSwapQuoteQuery,variables:{request:_(t,QuoteAccuracy.Fast),currency:r},selector:B,suspense:e$1,pause:s,batch:false}),a=b({document:TokenSwapQuoteQuery,variables:{request:_(t,QuoteAccuracy.Accurate),currency:r},selector:B,suspense:false,pause:s||e$1&&!u.data,pollInterval:n.context.environment.swapQuoteInterval,batch:false});return a.data?a:u}function Sr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>tokenSwapQuote(s,r,{currency:e$1.currency}).map(B),[s,e$1.currency])}function dr({suspense:e=false,pause:s=false,...r}){return b({document:SwappableTokensQuery,variables:{request:r},suspense:e,pause:s})}function Rr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserSwapsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Ur({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:SupplySwapQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:e,pause:s})}function wr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>supplySwapQuote(s,r,{currency:e$1.currency}).map(t=>t.quote),[s,e$1.currency])}function mr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:BorrowSwapQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:e,pause:s})}function gr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>borrowSwapQuote(s,r,{currency:e$1.currency}).map(t=>t.quote),[s,e$1.currency])}function H(e){return {with:s=>e.approvals.reduce((r,t)=>r.andThen(n=>s(t,{cancel:b$1}).map(u=>{switch(t.__typename){case "PositionSwapAdapterContractApproval":n.adapterContractSignature=isSignature(u)?u:null;break;case "PositionSwapPositionManagerApproval":n.positionManagerSignature=isSignature(u)?u:null;break}return n})),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 Ar(e$1){let s=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>supplySwapQuote(s,t,{currency:r}).andThen(n=>H(n).with(e$1).andThen(u=>preparePositionSwap(s,u)).andThen(u=>e$1(u.data,{cancel:b$1}).map(a=>(invariant(isSignature(a),"Expected signature, got an object instead."),a))).andThen(u=>h(s,{quoteId:n.quote.quoteId,signature:u}))),[s,e$1])}function Pr(e$1){let s=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>borrowSwapQuote(s,t,{currency:r}).andThen(n=>H(n).with(e$1).andThen(u=>preparePositionSwap(s,u)).andThen(u=>e$1(u.data,{cancel:b$1}).map(a=>(invariant(isSignature(a),"Expected signature, got an object instead."),a))).andThen(u=>h(s,{quoteId:n.quote.quoteId,signature:u}))),[s,e$1])}function br({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:RepayWithSupplyQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:e,pause:s})}function fr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>repayWithSupplyQuote(s,r,{currency:e$1.currency}).map(t=>t.quote),[s,e$1.currency])}function Tr(e$1){let s=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>repayWithSupplyQuote(s,t,{currency:r}).andThen(n=>H(n).with(e$1).andThen(u=>preparePositionSwap(s,u)).andThen(u=>e$1(u.data,{cancel:b$1}).map(a=>(invariant(isSignature(a),"Expected signature, got an object instead."),a))).andThen(u=>h(s,{quoteId:n.quote.quoteId,signature:u}))),[s,e$1])}function xr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:WithdrawSwapQuoteQuery,variables:{request:t,currency:r},selector:n=>n.quote,suspense:e,pause:s})}function Qr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>withdrawSwapQuote(s,r,{currency:e$1.currency}).map(t=>t.quote),[s,e$1.currency])}function kr(e$1){let s=e();return a(({currency:r=DEFAULT_QUERY_OPTIONS.currency,...t})=>withdrawSwapQuote(s,t,{currency:r}).andThen(n=>H(n).with(e$1).andThen(u=>preparePositionSwap(s,u)).andThen(u=>e$1(u.data,{cancel:b$1}).map(a=>(invariant(isSignature(a),"Expected signature, got an object instead."),a))).andThen(u=>h(s,{quoteId:n.quote.quoteId,signature:u}))),[s,e$1])}function Hr(e$1){let s=e(),r=useCallback(t=>swap(s,t).andThen(n=>{switch(n.__typename){case "SwapTransactionRequest":return e$1(n,{cancel:b$1}).map(c.ensure).andThen(u=>u.wait()).andThen(()=>okAsync(n.orderReceipt));case "SwapReceipt":return okAsync(n)}}),[s,e$1]);return a(({currency:t=DEFAULT_QUERY_OPTIONS.currency,...n})=>tokenSwapQuote(s,n,{currency:t}).andThen(u=>{switch(u.__typename){case "SwapByTransaction":return r({transaction:{quoteId:u.quote.quoteId}});case "SwapByIntent":return prepareTokenSwap(s,{quoteId:u.quote.quoteId}).andThen(a=>e$1(a.data,{cancel:b$1}).map(c=>(invariant(isSignature(c),"Invalid signature"),c)).andThen(c=>r({intent:{quoteId:a.newQuoteId,signature:c}})));case "SwapByIntentWithApprovalRequired":return e$1(u.approval,{cancel:b$1}).andThen(a=>isERC20PermitSignature(a)?prepareTokenSwap(s,{quoteId:u.quote.quoteId,permitSig:a}):c.isInstanceOf(a)?a.wait().andThen(()=>prepareTokenSwap(s,{quoteId:u.quote.quoteId})):UnexpectedError.from(a).asResultAsync()).andThen(a=>e$1(a.data,{cancel:b$1}).map(c=>(invariant(isSignature(c),"Invalid signature"),c)).andThen(c=>r({intent:{quoteId:u.quote.quoteId,signature:c}})));default:never(`Unsupported swap quote result: ${u.__typename}. To be removed from API soon.`);}}),[s,e$1,r])}var x=class extends ResultAwareError{name="CannotCancelSwapError"};function hr(e$1){let s=e();return a(r=>swapStatus(s,{id:r.id}).andThen(t=>{switch(t.__typename){case "SwapOpen":case "SwapPendingSignature":return prepareSwapCancel(s,r).andThen(n=>e$1(n.data,{cancel:b$1})).map(n=>(invariant(isSignature(n),"Invalid signature"),n)).andThen(n=>cancelSwap(s,{intent:{id:r.id,signature:n}})).andThen(n=>n.__typename==="SwapCancelled"?okAsync(n):e$1(n,{cancel:b$1}).map(c.ensure).andThen(u=>u.wait()).andThen(()=>swapStatus(s,{id:r.id})).andThen(u=>u.__typename==="SwapCancelled"?okAsync(u):new x("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return okAsync(t);case "SwapExpired":return new x("Swap cannot longer be cancelled").asResultAsync();default:return UnexpectedError.upgradeRequired(`Unsupported swap status: ${t.__typename}`).asResultAsync()}}),[s,e$1])}function v(e,s){let{chainId:r,spoke:t}=decodeReserveId(s.reserve);return async()=>Promise.all([await e.refreshQueryWhere(UserPositionsQuery,(n,u)=>n.request.user===s.sender&&u.some(a=>a.spoke.chain.chainId===r&&a.spoke.address===t)),await e.refreshQueryWhere(UserPositionQuery,(n,u)=>u?.spoke.chain.chainId===r&&u?.spoke.address===t&&u.user===s.sender),await e.refreshQueryWhere(UserSummaryQuery,n=>n.request.user===s.sender&&isSpokeInputVariant(n.request.filter)?n.request.filter.spoke.chainId===r&&n.request.filter.spoke.address===t:isChainIdsVariant(n.request.filter)?n.request.filter.chainIds.some(u=>u===r):false),await e.refreshQueryWhere(ReservesQuery,(n,u)=>u.some(a=>a.id===s.reserve)),await e.refreshQueryWhere(SpokesQuery,(n,u)=>u.some(a=>a.chain.chainId===r&&a.address===t)),await e.refreshQueryWhere(UserBalancesQuery,n=>n.request.user===s.sender),await e.refreshQueryWhere(HubsQuery,n=>isChainIdsVariant(n.request)&&n.request.chainIds.some(u=>u===r))])}function Mr(e$1){let s=e();return a(r=>supply(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(s,r)),[s,e$1])}function Nr(e$1){let s=e();return a(r=>borrow(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(s,r)),[s,e$1])}function Dr(e$1){let s=e();return a(r=>repay(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(s,r)),[s,e$1])}function _r(e$1){let s=e();return a(r=>withdraw(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}).andTee(v(s,r)),[s,e$1])}function Fr(e$1){let s=e();return a(r=>renounceSpokeUserPositionManager(s,r).andThen(t=>e$1(t,{cancel:b$1})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[s,e$1])}function Vr(e$1){let s=e();return a(r=>updateUserPositionConditions(s,r).andThen(t=>e$1(t,{cancel:b$1})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(async()=>{let{userPositionId:t}=r;return Promise.all([s.refreshQueryWhere(UserPositionsQuery,(n,u)=>u.some(a=>a.id===t)),s.refreshQueryWhere(UserPositionQuery,(n,u)=>u?.id===t)])}),[s,e$1])}function Lr(e$1){let s=e();return a(r=>{let t=r.changes.map(u=>u.reserve),n=t.map(u=>decodeReserveId(u));return setUserSuppliesAsCollateral(s,r).andThen(u=>e$1(u,{cancel:b$1})).andThen(u=>u.wait()).andThen(s.waitForTransaction).andTee(()=>Promise.all([...n.map(({chainId:u,spoke:a})=>s.refreshQueryWhere(UserPositionsQuery,(c,R)=>c.request.user===r.sender&&R.some(P=>P.spoke.chain.chainId===u&&P.spoke.address===a))),...n.map(({chainId:u,spoke:a})=>s.refreshQueryWhere(UserPositionQuery,(c,R)=>R?.spoke.chain.chainId===u&&R?.spoke.address===a&&R.user===r.sender)),...n.map(({chainId:u,spoke:a})=>s.refreshQueryWhere(UserSummaryQuery,c=>c.request.user===r.sender&&isSpokeInputVariant(c.request.filter)?c.request.filter.spoke.chainId===u&&c.request.filter.spoke.address===a:isChainIdsVariant(c.request.filter)?c.request.filter.chainIds.some(R=>R===u):false)),s.refreshQueryWhere(ReservesQuery,(u,a)=>a.some(c=>t.includes(c.id))),...n.map(({chainId:u,spoke:a})=>s.refreshQueryWhere(SpokesQuery,(c,R)=>R.some(P=>P.chain.chainId===u&&P.address===a))),...n.map(({chainId:u})=>s.refreshQueryWhere(HubsQuery,a=>isChainIdsVariant(a.request.query)?a.request.query.chainIds.some(c=>c===u):a.request.query.tokens.some(c=>c.chainId===u))),...n.map(({chainId:u})=>s.refreshQueryWhere(HubQuery,a=>isHubInputVariant(a.request.query)?a.request.query.hubInput.chainId===u:decodeHubId(a.request.query.hubId).chainId===u))]))},[s,e$1])}function Yr(e$1){let s=e();return a(r=>liquidatePosition(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(n=>n.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(n=>n.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t))}}),[s,e$1])}function jr(e$1){let s=e();return a(r=>setSpokeUserPositionManager(s,r).andThen(t=>e$1(t,{cancel:b$1})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[s,e$1])}function Gr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>preview(s,r,{currency:e$1.currency}),[s,e$1.currency])}function $r({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:PreviewQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function zr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:ActivitiesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Jr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>activities(s,r,{currency:e$1.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function tt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserSuppliesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function nt(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>userSupplies(s,r,{currency:e$1.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function ut({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserBorrowsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function at(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>userBorrows(s,r,{currency:e$1.currency??DEFAULT_QUERY_OPTIONS.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function ot({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserSummaryQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function pt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserPositionsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function it(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>userPositions(s,r,{currency:e$1.currency,timeWindow:e$1.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function lt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b({document:UserPositionQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function ct({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserBalancesQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function yt({suspense:e=false,pause:s=false,...r}){return b({document:UserRiskPremiumBreakdownQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function St(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>userBalances(s,r,{currency:e$1.currency}),[s,e$1.currency])}function dt({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserSummaryHistoryQuery,variables:{request:t,currency:r},suspense:e,pause:s,batch:false})}export{Us as AaveProvider,x as CannotCancelSwapError,zr as useActivities,Jr as useActivitiesAction,Es as useAsset,Is as useAssetBorrowHistory,Bs as useAssetPriceHistory,Ws as useAssetSupplyHistory,Nr as useBorrow,Gs as useBorrowApyHistory,Pr as useBorrowSwap,mr as useBorrowSwapQuote,gr as useBorrowSwapQuoteAction,hr as useCancelSwap,fs as useHub,xs as useHubAssets,Qs as useHubSummaryHistory,Ts as useHubs,ks as useHubsAction,Yr as useLiquidatePosition,$r as usePreview,Gr as usePreviewAction,Cs as useProtocolHistory,Fr as useRenounceSpokeUserPositionManager,Dr as useRepay,Tr as useRepayWithSupply,br as useRepayWithSupplyQuote,fr as useRepayWithSupplyQuoteAction,Vs as useReserve,Ls as useReserveAction,Ys as useReserves,js as useReservesAction,jr as useSetSpokeUserPositionManager,Lr as useSetUserSuppliesAsCollateral,Xs as useSpoke,er as useSpokePositionManagers,sr as useSpokeUserPositionManagers,Zs as useSpokes,Mr as useSupply,$s as useSupplyApyHistory,Ar as useSupplySwap,Ur as useSupplySwapQuote,wr as useSupplySwapQuoteAction,dr as useSwappableTokens,Hr as useTokenSwap,yr as useTokenSwapQuote,Sr as useTokenSwapQuoteAction,Vr as useUpdateUserPositionConditions,ct as useUserBalances,St as useUserBalancesAction,ut as useUserBorrows,at as useUserBorrowsAction,lt as useUserPosition,pt as useUserPositions,it as useUserPositionsAction,yt as useUserRiskPremiumBreakdown,ot as useUserSummary,dt as useUserSummaryHistory,tt as useUserSupplies,nt as useUserSuppliesAction,Rr as useUserSwaps,_r as useWithdraw,kr as useWithdrawSwap,xr as useWithdrawSwapQuote,Qr as useWithdrawSwapQuoteAction};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|