@aave/react 4.0.0-next.0 → 4.0.0-next.10

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.js CHANGED
@@ -1,2 +1,2 @@
1
- import {b as b$1}from'./chunk-XIDOSID3.js';export{c as useChain,d as useChains,f as useExchangeRate,e as useExchangeRateAction}from'./chunk-XIDOSID3.js';import {d,e,a,b as b$2,c}from'./chunk-GTUQRT5Q.js';export{e as useAaveClient,f as usePermitTypedDataAction}from'./chunk-GTUQRT5Q.js';import {DEFAULT_QUERY_OPTIONS,errAsync,ValidationError}from'@aave/client';export*from'@aave/client';import W,{useCallback}from'react';import {hubs,reserve,reserves,swapQuote,prepareSwap,swap,swapStatus,prepareSwapCancel,cancelSwap,supply,borrow,repay,withdraw,renounceSpokeUserPositionManager,updateUserRiskPremium,updateUserDynamicConfig,setUserSupplyAsCollateral,liquidatePosition,setSpokeUserPositionManager,preview,activities,userSupplies,userBorrows,userPositions,userBalances}from'@aave/client/actions';import {HubQuery,HubsQuery,HubAssetsQuery,AssetQuery,AssetPriceHistoryQuery,AssetSupplyHistoryQuery,AssetBorrowHistoryQuery,ReserveQuery,ReservesQuery,BorrowApyHistoryQuery,SupplyApyHistoryQuery,SpokeQuery,SpokesQuery,SpokePositionManagersQuery,SpokeUserPositionManagersQuery,SwapQuoteQuery,SwappableTokensQuery,UserSwapsQuery,UserPositionsQuery,UserPositionQuery,decodeReserveId,UserSummaryQuery,isSpokeInputVariant,isChainIdsVariant,isHubInputVariant,decodeHubId,PreviewQuery,ActivitiesQuery,UserSuppliesQuery,UserBorrowsQuery,UserBalancesQuery,UserSummaryHistoryQuery}from'@aave/graphql';import {okAsync,invariant,ResultAwareError,errAsync as errAsync$1}from'@aave/types';import {ValidationError as ValidationError$1}from'@aave/core';function Xe({children:s,client:e}){return W.createElement(d,{client:e},s)}function ns({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:HubQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function as({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:HubsQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function us({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:HubAssetsQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function os(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>hubs(e$1,r,{currency:s.currency}),[e$1,s.currency])}function ys({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b$1({document:AssetQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function Ss({suspense:s=false,pause:e=false,...r}){return b$1({document:AssetPriceHistoryQuery,variables:{request:r},suspense:s,pause:e})}function ds({suspense:s=false,pause:e=false,...r}){return b$1({document:AssetSupplyHistoryQuery,variables:{request:r},suspense:s,pause:e})}function Rs({suspense:s=false,pause:e=false,...r}){return b$1({document:AssetBorrowHistoryQuery,variables:{request:r},suspense:s,pause:e})}function ms({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:ReserveQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function ws(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>reserve(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Ts({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,selector:t,...n}){return b$1({document:ReservesQuery,variables:{request:n,currency:r},suspense:s,pause:e,selector:t||void 0})}function xs(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>reserves(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Hs({suspense:s=false,pause:e=false,...r}){return b$1({document:BorrowApyHistoryQuery,variables:{request:r},suspense:s,pause:e})}function ks({suspense:s=false,pause:e=false,...r}){return b$1({document:SupplyApyHistoryQuery,variables:{request:r},suspense:s,pause:e})}function Es({suspense:s=false,pause:e=false,...r}){return b$1({document:SpokeQuery,variables:{request:r},suspense:s,pause:e})}function Qs({suspense:s=false,pause:e=false,...r}){return b$1({document:SpokesQuery,variables:{request:r},suspense:s,pause:e})}function Bs({suspense:s=false,pause:e=false,...r}){return b$1({document:SpokePositionManagersQuery,variables:{request:r},suspense:s,pause:e})}function Cs({suspense:s=false,pause:e=false,...r}){return b$1({document:SpokeUserPositionManagersQuery,variables:{request:r},suspense:s,pause:e})}function Vs({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:SwapQuoteQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function Ls(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>swapQuote(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Gs({suspense:s=false,pause:e=false,...r}){return b$1({document:SwappableTokensQuery,variables:{request:r},suspense:s,pause:e})}function js({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:UserSwapsQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function k(s){return typeof s=="object"&&s!==null&&"deadline"in s&&"value"in s}function zs(s){let e$1=e(),r=useCallback(t=>{switch(t.__typename){case "SwapTransactionRequest":return s(t,{cancel:b$2}).map(c.ensure).andThen(n=>n.wait()).andThen(()=>okAsync(t.orderReceipt));case "SwapApprovalRequired":return s(t,{cancel:b$2}).map(c.ensure).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$2})).map(c.ensure).andThen(n=>n.wait()).andThen(()=>okAsync(t.originalTransaction.orderReceipt));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t));case "SwapReceipt":return okAsync(t)}},[s]);return a(({currency:t=DEFAULT_QUERY_OPTIONS.currency,...n})=>prepareSwap(e$1,n,{currency:t}).andThen(a=>{switch(a.__typename){case "SwapByTransaction":return swap(e$1,{transaction:{quoteId:a.quote.quoteId}}).andThen(r);case "SwapByIntent":return s(a.data,{cancel:b$2}).andThen(o=>(invariant(k(o),"Invalid signature"),swap(e$1,{intent:{quoteId:a.quote.quoteId,signature:o.value}}).andThen(r)));case "SwapByIntentWithApprovalRequired":return s(a,{cancel:b$2}).map(c.ensure).andThen(o=>o.wait()).andThen(()=>s(a.data,{cancel:b$2})).map(c.ensure).andThen(o=>o.wait()).andThen(o=>(invariant(k(o),"Invalid signature"),swap(e$1,{intent:{quoteId:a.quote.quoteId,signature:o.value}}).andThen(r)));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(a))}}),[e$1,s,r])}var b=class extends ResultAwareError{name="CannotCancelSwapError"};function Js(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)).andThen(n=>(invariant(k(n),"Invalid signature"),cancelSwap(e$1,{intent:{id:r.id,signature:n.value}}))).andThen(n=>n.__typename==="SwapCancelled"?okAsync(n):s(n).map(c.ensure).andThen(a=>a.wait()).andThen(()=>swapStatus(e$1,{id:r.id})).andThen(a=>a.__typename==="SwapCancelled"?okAsync(a):errAsync(new b("Failed to cancel swap"))));case "SwapCancelled":return okAsync(t);default:return errAsync(new b("Swap cannot longer be cancelled"))}}),[e$1,s])}function T(s,e){let{chainId:r,spoke:t}=decodeReserveId(e.reserve);return async()=>Promise.all([await s.refreshQueryWhere(UserPositionsQuery,(n,a)=>n.request.user===e.sender&&a.some(o=>o.spoke.chain.chainId===r&&o.spoke.address===t)),await s.refreshQueryWhere(UserPositionQuery,(n,a)=>a?.spoke.chain.chainId===r&&a?.spoke.address===t&&a.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(a=>a===r):false),await s.refreshQueryWhere(ReservesQuery,(n,a)=>a.some(o=>o.id===e.reserve)),await s.refreshQueryWhere(SpokesQuery,(n,a)=>a.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(a=>a===r))])}function nr(s){let e$1=e();return a(r=>supply(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$2})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(T(e$1,r)),[e$1,s])}function ar(s){let e$1=e();return a(r=>borrow(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$2})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(T(e$1,r)),[e$1,s])}function ur(s){let e$1=e();return a(r=>repay(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$2})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(T(e$1,r)),[e$1,s])}function or(s){let e$1=e();return a(r=>withdraw(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$2})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(T(e$1,r)),[e$1,s])}function pr(s){let e$1=e();return a(r=>renounceSpokeUserPositionManager(e$1,r).andThen(t=>s(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(e$1.waitForTransaction).andTee(()=>e$1.refreshQueryWhere(SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[e$1,s])}function ir(s){let e$1=e();return a(r=>updateUserRiskPremium(e$1,r).andThen(t=>s(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(e$1.waitForTransaction).andTee(async()=>Promise.all([e$1.refreshQueryWhere(UserPositionsQuery,(t,n)=>t.request.user===r.sender&&n.some(a=>a.spoke.id===r.spoke)),e$1.refreshQueryWhere(UserPositionQuery,(t,n)=>n?.spoke.id===r.spoke&&n.user===r.sender)])),[e$1,s])}function lr(s){let e$1=e();return a(r=>updateUserDynamicConfig(e$1,r).andThen(t=>s(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(e$1.waitForTransaction),[e$1,s])}function cr(s){let e$1=e();return a(r=>{let{chainId:t,spoke:n}=decodeReserveId(r.reserve);return setUserSupplyAsCollateral(e$1,r).andThen(a=>s(a,{cancel:b$2})).andThen(a=>a.wait()).andThen(e$1.waitForTransaction).andTee(()=>Promise.all([e$1.refreshQueryWhere(UserPositionsQuery,(a,o)=>a.request.user===r.sender&&o.some(y=>y.spoke.chain.chainId===t&&y.spoke.address===n)),e$1.refreshQueryWhere(UserPositionQuery,(a,o)=>o?.spoke.chain.chainId===t&&o?.spoke.address===n&&o.user===r.sender),e$1.refreshQueryWhere(UserSummaryQuery,a=>a.request.user===r.sender&&isSpokeInputVariant(a.request.filter)?a.request.filter.spoke.chainId===t&&a.request.filter.spoke.address===n:isChainIdsVariant(a.request.filter)?a.request.filter.chainIds.some(o=>o===t):false),e$1.refreshQueryWhere(ReservesQuery,(a,o)=>o.some(y=>y.id===r.reserve)),e$1.refreshQueryWhere(SpokesQuery,(a,o)=>o.some(y=>y.chain.chainId===t&&y.address===n)),e$1.refreshQueryWhere(HubsQuery,a=>isChainIdsVariant(a.request.query)?a.request.query.chainIds.some(o=>o===t):a.request.query.tokens.some(o=>o.chainId===t)),e$1.refreshQueryWhere(HubQuery,a=>isHubInputVariant(a.request.query)?a.request.query.hubInput.chainId===t:decodeHubId(a.request.query.hubId).chainId===t)]))},[e$1,s])}function yr(s){let e$1=e();return a(r=>liquidatePosition(e$1,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return s(t,{cancel:b$2}).andThen(n=>n.wait()).andThen(()=>s(t.originalTransaction,{cancel:b$2})).andThen(n=>n.wait()).andThen(e$1.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}),[e$1,s])}function Sr(s){let e$1=e();return a(r=>setSpokeUserPositionManager(e$1,r).andThen(t=>s(t,{cancel:b$2})).andThen(t=>t.wait()).andThen(e$1.waitForTransaction).andTee(()=>e$1.refreshQueryWhere(SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[e$1,s])}function dr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>preview(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Rr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:PreviewQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function Ur({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:ActivitiesQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function Ar(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>activities(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Tr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:UserSuppliesQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function xr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>userSupplies(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Hr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:UserBorrowsQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function kr(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>userBorrows(e$1,r,{currency:s.currency}),[e$1,s.currency])}function qr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b$1({document:UserSummaryQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function hr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b$1({document:UserPositionsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function vr(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 Er({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return b$1({document:UserPositionQuery,variables:{request:n,currency:r,timeWindow:t},suspense:s,pause:e})}function Qr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:UserBalancesQuery,variables:{request:t,currency:r},suspense:s,pause:e})}function Br(s=DEFAULT_QUERY_OPTIONS){let e$1=e();return a(r=>userBalances(e$1,r,{currency:s.currency}),[e$1,s.currency])}function Cr({suspense:s=false,pause:e=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b$1({document:UserSummaryHistoryQuery,variables:{request:t,currency:r},suspense:s,pause:e})}export{Xe as AaveProvider,b as CannotCancelSwapError,Ur as useActivities,Ar as useActivitiesAction,ys as useAsset,Rs as useAssetBorrowHistory,Ss as useAssetPriceHistory,ds as useAssetSupplyHistory,ar as useBorrow,Hs as useBorrowApyHistory,Js as useCancelSwap,ns as useHub,us as useHubAssets,as as useHubs,os as useHubsAction,yr as useLiquidatePosition,Rr as usePreview,dr as usePreviewAction,pr as useRenounceSpokeUserPositionManager,ur as useRepay,ms as useReserve,ws as useReserveAction,Ts as useReserves,xs as useReservesAction,Sr as useSetSpokeUserPositionManager,cr as useSetUserSupplyAsCollateral,Es as useSpoke,Bs as useSpokePositionManagers,Cs as useSpokeUserPositionManagers,Qs as useSpokes,nr as useSupply,ks as useSupplyApyHistory,Vs as useSwapQuote,Ls as useSwapQuoteAction,zs as useSwapTokens,Gs as useSwappableTokens,lr as useUpdateUserDynamicConfig,ir as useUpdateUserRiskPremium,Qr as useUserBalances,Br as useUserBalancesAction,Hr as useUserBorrows,kr as useUserBorrowsAction,Er as useUserPosition,hr as useUserPositions,vr as useUserPositionsAction,qr as useUserSummary,Cr as useUserSummaryHistory,Tr as useUserSupplies,xr as useUserSuppliesAction,js as useUserSwaps,or as useWithdraw};//# sourceMappingURL=index.js.map
1
+ import {b}from'./chunk-7FNJZJRF.js';export{c as useChain,d as useChains,f as useExchangeRate,e as useExchangeRateAction}from'./chunk-7FNJZJRF.js';import {d,e,a,b as b$1,c}from'./chunk-IESN2WLA.js';export{e as useAaveClient,f as usePermitTypedDataAction}from'./chunk-IESN2WLA.js';import {DEFAULT_QUERY_OPTIONS,errAsync,ValidationError}from'@aave/client';export*from'@aave/client';import V,{useCallback}from'react';import {hubs,reserve,reserves,swapQuote,prepareSwap,swap,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,AssetCategoryBorrowHistoryQuery,AssetCategorySupplyHistoryQuery,ProtocolHistoryQuery,ReserveQuery,ReservesQuery,BorrowApyHistoryQuery,SupplyApyHistoryQuery,SpokeQuery,SpokesQuery,SpokePositionManagersQuery,SpokeUserPositionManagersQuery,SwapQuoteQuery,SwappableTokensQuery,UserSwapsQuery,UserPositionsQuery,UserPositionQuery,decodeReserveId,UserSummaryQuery,isSpokeInputVariant,isChainIdsVariant,isHubInputVariant,decodeHubId,PreviewQuery,ActivitiesQuery,UserSuppliesQuery,UserBorrowsQuery,UserBalancesQuery,UserRiskPremiumBreakdownQuery,UserSummaryHistoryQuery}from'@aave/graphql';import {okAsync,invariant,ResultAwareError,errAsync as errAsync$1}from'@aave/types';import {ValidationError as ValidationError$1}from'@aave/core';function ts({children:e,client:s}){return V.createElement(d,{client:s},e)}function ls({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:HubQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function ys({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:HubsQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function cs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:HubAssetsQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function Ss({suspense:e=false,pause:s=false,...r}){return b({document:HubSummaryHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function ds(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>hubs(s,r,{currency:e$1.currency}),[s,e$1.currency])}function gs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:AssetQuery,variables:{request:o,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 Ps({suspense:e=false,pause:s=false,...r}){return b({document:AssetSupplyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function fs({suspense:e=false,pause:s=false,...r}){return b({document:AssetBorrowHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function ws({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:AssetCategoryBorrowHistoryQuery,variables:{request:t,currency:r},suspense:e,pause:s,batch:false})}function xs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:AssetCategorySupplyHistoryQuery,variables:{request:t,currency:r},suspense:e,pause:s,batch:false})}function Ts({suspense:e=false,pause:s=false,...r}){return b({document:ProtocolHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Bs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:ReserveQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function Es(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>reserve(s,r,{currency:e$1.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function Cs({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,selector:o,...n}){return b({document:ReservesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s,selector:o||void 0})}function Is(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>reserves(s,r,{currency:e$1.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function Ws({suspense:e=false,pause:s=false,...r}){return b({document:BorrowApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Os({suspense:e=false,pause:s=false,...r}){return b({document:SupplyApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function _s({suspense:e=false,pause:s=false,...r}){return b({document:SpokeQuery,variables:{request:r},suspense:e,pause:s})}function Fs({suspense:e=false,pause:s=false,...r}){return b({document:SpokesQuery,variables:{request:r},suspense:e,pause:s})}function Vs({suspense:e=false,pause:s=false,...r}){return b({document:SpokePositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function Ls({suspense:e=false,pause:s=false,...r}){return b({document:SpokeUserPositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function er({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:SwapQuoteQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function sr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>swapQuote(s,r,{currency:e$1.currency}),[s,e$1.currency])}function rr({suspense:e=false,pause:s=false,...r}){return b({document:SwappableTokensQuery,variables:{request:r},suspense:e,pause:s})}function tr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,...t}){return b({document:UserSwapsQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function v(e){return typeof e=="object"&&e!==null&&"deadline"in e&&"value"in e}function or(e$1){let s=e(),r=useCallback(t=>{switch(t.__typename){case "SwapTransactionRequest":return e$1(t,{cancel:b$1}).map(c.ensure).andThen(o=>o.wait()).andThen(()=>okAsync(t.orderReceipt));case "SwapApprovalRequired":return e$1(t,{cancel:b$1}).map(c.ensure).andThen(o=>o.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).map(c.ensure).andThen(o=>o.wait()).andThen(()=>okAsync(t.originalTransaction.orderReceipt));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(t));case "SwapReceipt":return okAsync(t)}},[e$1]);return a(({currency:t=DEFAULT_QUERY_OPTIONS.currency,...o})=>prepareSwap(s,o,{currency:t}).andThen(n=>{switch(n.__typename){case "SwapByTransaction":return swap(s,{transaction:{quoteId:n.quote.quoteId}}).andThen(r);case "SwapByIntent":return e$1(n.data,{cancel:b$1}).andThen(a=>(invariant(v(a),"Invalid signature"),swap(s,{intent:{quoteId:n.quote.quoteId,signature:a.value}}).andThen(r)));case "SwapByIntentWithApprovalRequired":return e$1(n,{cancel:b$1}).map(c.ensure).andThen(a=>a.wait()).andThen(()=>e$1(n.data,{cancel:b$1})).map(c.ensure).andThen(a=>a.wait()).andThen(a=>(invariant(v(a),"Invalid signature"),swap(s,{intent:{quoteId:n.quote.quoteId,signature:a.value}}).andThen(r)));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}),[s,e$1,r])}var x=class extends ResultAwareError{name="CannotCancelSwapError"};function nr(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(o=>e$1(o.data)).andThen(o=>(invariant(v(o),"Invalid signature"),cancelSwap(s,{intent:{id:r.id,signature:o.value}}))).andThen(o=>o.__typename==="SwapCancelled"?okAsync(o):e$1(o).map(c.ensure).andThen(n=>n.wait()).andThen(()=>swapStatus(s,{id:r.id})).andThen(n=>n.__typename==="SwapCancelled"?okAsync(n):errAsync(new x("Failed to cancel swap"))));case "SwapCancelled":return okAsync(t);default:return errAsync(new x("Swap cannot longer be cancelled"))}}),[s,e$1])}function k(e,s){let{chainId:r,spoke:t}=decodeReserveId(s.reserve);return async()=>Promise.all([await e.refreshQueryWhere(UserPositionsQuery,(o,n)=>o.request.user===s.sender&&n.some(a=>a.spoke.chain.chainId===r&&a.spoke.address===t)),await e.refreshQueryWhere(UserPositionQuery,(o,n)=>n?.spoke.chain.chainId===r&&n?.spoke.address===t&&n.user===s.sender),await e.refreshQueryWhere(UserSummaryQuery,o=>o.request.user===s.sender&&isSpokeInputVariant(o.request.filter)?o.request.filter.spoke.chainId===r&&o.request.filter.spoke.address===t:isChainIdsVariant(o.request.filter)?o.request.filter.chainIds.some(n=>n===r):false),await e.refreshQueryWhere(ReservesQuery,(o,n)=>n.some(a=>a.id===s.reserve)),await e.refreshQueryWhere(SpokesQuery,(o,n)=>n.some(a=>a.chain.chainId===r&&a.address===t)),await e.refreshQueryWhere(UserBalancesQuery,o=>o.request.user===s.sender),await e.refreshQueryWhere(HubsQuery,o=>isChainIdsVariant(o.request)&&o.request.chainIds.some(n=>n===r))])}function dr(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(o=>o.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(o=>o.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(o=>o.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(k(s,r)),[s,e$1])}function Rr(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(o=>o.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(o=>o.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(o=>o.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(k(s,r)),[s,e$1])}function Ur(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(o=>o.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(o=>o.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(o=>o.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(k(s,r)),[s,e$1])}function Ar(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(o=>o.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(o=>o.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(o=>o.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}).andTee(k(s,r)),[s,e$1])}function mr(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 gr(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,(o,n)=>n.some(a=>a.id===t)),s.refreshQueryWhere(UserPositionQuery,(o,n)=>n?.id===t)])}),[s,e$1])}function br(e$1){let s=e();return a(r=>{let t=r.changes.map(n=>n.reserve),o=t.map(n=>decodeReserveId(n));return setUserSuppliesAsCollateral(s,r).andThen(n=>e$1(n,{cancel:b$1})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(()=>Promise.all([...o.map(({chainId:n,spoke:a})=>s.refreshQueryWhere(UserPositionsQuery,(c,S)=>c.request.user===r.sender&&S.some(g=>g.spoke.chain.chainId===n&&g.spoke.address===a))),...o.map(({chainId:n,spoke:a})=>s.refreshQueryWhere(UserPositionQuery,(c,S)=>S?.spoke.chain.chainId===n&&S?.spoke.address===a&&S.user===r.sender)),...o.map(({chainId:n,spoke:a})=>s.refreshQueryWhere(UserSummaryQuery,c=>c.request.user===r.sender&&isSpokeInputVariant(c.request.filter)?c.request.filter.spoke.chainId===n&&c.request.filter.spoke.address===a:isChainIdsVariant(c.request.filter)?c.request.filter.chainIds.some(S=>S===n):false)),s.refreshQueryWhere(ReservesQuery,(n,a)=>a.some(c=>t.includes(c.id))),...o.map(({chainId:n,spoke:a})=>s.refreshQueryWhere(SpokesQuery,(c,S)=>S.some(g=>g.chain.chainId===n&&g.address===a))),...o.map(({chainId:n})=>s.refreshQueryWhere(HubsQuery,a=>isChainIdsVariant(a.request.query)?a.request.query.chainIds.some(c=>c===n):a.request.query.tokens.some(c=>c.chainId===n))),...o.map(({chainId:n})=>s.refreshQueryWhere(HubQuery,a=>isHubInputVariant(a.request.query)?a.request.query.hubInput.chainId===n:decodeHubId(a.request.query.hubId).chainId===n))]))},[s,e$1])}function Pr(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(o=>o.wait()).andThen(s.waitForTransaction);case "Erc20ApprovalRequired":case "PreContractActionRequired":return e$1(t,{cancel:b$1}).andThen(o=>o.wait()).andThen(()=>e$1(t.originalTransaction,{cancel:b$1})).andThen(o=>o.wait()).andThen(s.waitForTransaction);case "InsufficientBalanceError":return errAsync$1(ValidationError$1.fromGqlNode(t))}}),[s,e$1])}function fr(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 wr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>preview(s,r,{currency:e$1.currency}),[s,e$1.currency])}function xr({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 Tr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:ActivitiesQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function Hr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>activities(s,r,{currency:e$1.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function Er({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:UserSuppliesQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function Cr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>userSupplies(s,r,{currency:e$1.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function Ir({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:UserBorrowsQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function Wr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>userBorrows(s,r,{currency:e$1.currency,timeWindow:e$1.timeWindow??DEFAULT_QUERY_OPTIONS.timeWindow}),[s,e$1.currency,e$1.timeWindow])}function Or({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:UserSummaryQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function Nr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:UserPositionsQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function Mr(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 Dr({suspense:e=false,pause:s=false,currency:r=DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=DEFAULT_QUERY_OPTIONS.timeWindow,...o}){return b({document:UserPositionQuery,variables:{request:o,currency:r,timeWindow:t},suspense:e,pause:s})}function _r({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 Fr({suspense:e=false,pause:s=false,...r}){return b({document:UserRiskPremiumBreakdownQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Vr(e$1=DEFAULT_QUERY_OPTIONS){let s=e();return a(r=>userBalances(s,r,{currency:e$1.currency}),[s,e$1.currency])}function Lr({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{ts as AaveProvider,x as CannotCancelSwapError,Tr as useActivities,Hr as useActivitiesAction,gs as useAsset,fs as useAssetBorrowHistory,ws as useAssetCategoryBorrowHistory,xs as useAssetCategorySupplyHistory,bs as useAssetPriceHistory,Ps as useAssetSupplyHistory,Rr as useBorrow,Ws as useBorrowApyHistory,nr as useCancelSwap,ls as useHub,cs as useHubAssets,Ss as useHubSummaryHistory,ys as useHubs,ds as useHubsAction,Pr as useLiquidatePosition,xr as usePreview,wr as usePreviewAction,Ts as useProtocolHistory,mr as useRenounceSpokeUserPositionManager,Ur as useRepay,Bs as useReserve,Es as useReserveAction,Cs as useReserves,Is as useReservesAction,fr as useSetSpokeUserPositionManager,br as useSetUserSuppliesAsCollateral,_s as useSpoke,Vs as useSpokePositionManagers,Ls as useSpokeUserPositionManagers,Fs as useSpokes,dr as useSupply,Os as useSupplyApyHistory,er as useSwapQuote,sr as useSwapQuoteAction,or as useSwapTokens,rr as useSwappableTokens,gr as useUpdateUserPositionConditions,_r as useUserBalances,Vr as useUserBalancesAction,Ir as useUserBorrows,Wr as useUserBorrowsAction,Dr as useUserPosition,Nr as useUserPositions,Mr as useUserPositionsAction,Fr as useUserRiskPremiumBreakdown,Or as useUserSummary,Lr as useUserSummaryHistory,Er as useUserSupplies,Cr as useUserSuppliesAction,tr as useUserSwaps,Ar as useWithdraw};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map