@aave/react 4.0.0-next.42 → 4.0.0-next.43
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.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var client=require('@aave/client'),M=require('react'),types=require('@aave/types'),urql=require('urql'),actions=require('@aave/client/actions'),graphql=require('@aave/graphql'),core=require('@aave/core');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var M__default=/*#__PURE__*/_interopDefault(M);var te=M__default.default.createContext(null);function ae({children:e,client:s}){return M__default.default.createElement(te.Provider,{value:s},M__default.default.createElement(urql.Provider,{value:s.urql},e))}function o(){let e=M.useContext(te);return types.invariant(e,"Could not find Aave SDK context, ensure your code is wrapped in a <AaveProvider>"),e}function Fr({children:e,client:s}){return M__default.default.createElement(ae,{client:s},e)}function ps(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:s}=graphql.decodeUserPositionId(e.userPositionId);return s}function ls(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:s}=graphql.decodeUserPositionId(e.userPositionId);return s}function oe(e,s){return e.refreshQueryWhere(graphql.UserBalancesQuery,r=>r.request.user===s)}function F(e,s){return e.refreshQueryWhere(graphql.UserSuppliesQuery,r=>ps(r.request.query)===s)}function L(e,s){return e.refreshQueryWhere(graphql.UserBorrowsQuery,r=>ls(r.request.query)===s)}function j(e,s,r){return Promise.all([e.refreshQueryWhere(graphql.UserPositionsQuery,(t,a)=>a.some(n=>n.spoke.chain.chainId===r.chainId&&n.spoke.address===r.address&&n.user===s)),e.refreshQueryWhere(graphql.UserPositionQuery,(t,a)=>a?.spoke.chain.chainId===r.chainId&&a?.spoke.address===r.address&&a.user===s)])}function G(e,s){return Promise.all([e.refreshQueryWhere(graphql.ReserveQuery,(r,t)=>t!==null&&s.includes(t.id)),e.refreshQueryWhere(graphql.ReservesQuery,(r,t)=>t.some(a=>s.includes(a.id)))])}function Y(e,s,r){return e.refreshQueryWhere(graphql.UserSummaryQuery,t=>t.request.user===s&&graphql.isSpokeInputVariant(t.request.filter)?t.request.filter.spoke.chainId===r.chainId&&t.request.filter.spoke.address===r.address:graphql.isChainIdsVariant(t.request.filter)?t.request.filter.chainIds.some(a=>a===r.chainId):false)}function $(e,s){return Promise.all([e.refreshQueryWhere(graphql.SpokeQuery,(r,t)=>t?.chain.chainId===s.chainId&&t?.address===s.address),e.refreshQueryWhere(graphql.SpokesQuery,(r,t)=>t.some(a=>a.chain.chainId===s.chainId&&a.address===s.address))])}function K(e,s){return Promise.all([e.refreshQueryWhere(graphql.HubQuery,r=>graphql.isHubInputVariant(r.request.query)?r.request.query.hubInput.chainId===s:graphql.decodeHubId(r.request.query.hubId).chainId===s),e.refreshQueryWhere(graphql.HubsQuery,r=>graphql.isChainIdsVariant(r.request)?r.request.chainIds.some(t=>t===s):graphql.isTokensVariant(r.request.query)?r.request.query.tokens.some(t=>t.chainId===s):true)])}var w={Loading:()=>({data:void 0,error:void 0,loading:true,paused:false,reloading:false}),Success:(e,s=false)=>({data:e,error:void 0,loading:false,paused:false,reloading:s}),Failure:(e,s=false)=>({data:void 0,error:e,loading:false,paused:false,reloading:s}),Paused:(e,s)=>({data:e,error:s,loading:false,paused:true,reloading:false})};function u({document:e,variables:s,suspense:r,pause:t,selector:a=types.ok,pollInterval:n=0,batch:i=true}){let[c,y]=M.useState(true),[{fetching:f,data:g,error:q,stale:Me},re]=urql.useQuery({query:e,variables:s,pause:t,context:M.useMemo(()=>({batch:i,suspense:r}),[i,r])});if(M.useEffect(()=>{t||f||y(false);},[f,t]),M.useEffect(()=>{if(n<=0||f||t)return;let T=setTimeout(()=>{re({requestPolicy:"network-only",batch:false});},n);return ()=>clearTimeout(T)},[f,re,n,t]),t){let T=q?client.UnexpectedError.from(q):void 0;if(!g)return w.Paused(void 0,T);let _=a(g.value);return _.isErr()?w.Paused(void 0,_.error):w.Paused(_.value,T)}if(!r&&c)return w.Loading();let V=Me||!c&&f;if(q){let T=client.UnexpectedError.from(q);if(r)throw T;return w.Failure(T,V)}types.invariant(g,"No data returned");let H=a(g.value);if(H.isErr()){if(r)throw H.error;return w.Failure(H.error,V)}return w.Success(H.value,V)}var z={Idle:()=>({called:false,loading:false,data:void 0,error:void 0}),Loading:e=>({called:true,loading:true,data:e,error:void 0}),Success:e=>({called:true,loading:false,data:e,error:void 0}),Failed:e=>({called:true,loading:false,data:void 0,error:e})};function l(e,s){let[r,t]=M.useState(z.Idle()),a=M.useRef(false),n=M.useCallback(e,s);return [M.useCallback(c=>{types.invariant(!a.current,"Cannot execute a task while another is in progress."),a.current=true;let y;t(f=>(y=f,{called:true,loading:true,data:f.data,error:void 0}));try{let f=n(c);return f.match(g=>{a.current=!1,t(z.Success(g));},g=>{a.current=!1,t(z.Failed(g));}),f}catch(f){throw a.current=false,t(types.nonNullable(y)),f}},[n]),r]}var p=e=>core.CancelError.from(e).asResultAsync(),R=class e{constructor(s){this.wait=s;}static isInstanceOf(s){return s instanceof e}static tryFrom(s){return e.isInstanceOf(s)?types.okAsync(s):core.UnexpectedError.from(s).asResultAsync()}};function A(e){return types.isSignature(e)?types.okAsync(e):core.UnexpectedError.from(`Expected Signature, but got ${String(e)}`).asResultAsync()}function ct({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.HubQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function dt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.HubsQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function yt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.HubAssetsQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function St({suspense:e=false,pause:s=false,...r}){return u({document:graphql.HubSummaryHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Rt(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.hubs(s,r,{currency:e.currency,requestPolicy:"cache-first"}),[s,e.currency])}function wt({suspense:e=false,pause:s=false,...r}){return u({document:graphql.ChainQuery,variables:{request:r},suspense:e,pause:s})}function Pt(){let e=o();return l(s=>actions.chain(e,s,{batch:false,requestPolicy:"cache-first"}),[e])}function Tt({suspense:e=false,pause:s=false,...r}={query:{filter:graphql.ChainsFilter.ALL}}){return u({document:graphql.ChainsQuery,variables:{request:r},suspense:e,pause:s})}function xt(){let e=o();return l(s=>actions.exchangeRate(e,s,{requestPolicy:"network-only"}),[e])}function ht({suspense:e=false,pause:s=false,...r}){let t=o();return u({document:graphql.ExchangeRateQuery,variables:{request:r},suspense:e,pause:s,pollInterval:r.at?0:t.context.environment.exchangeRateInterval})}function qt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.AssetQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function Ht({suspense:e=false,pause:s=false,...r}){return u({document:graphql.AssetPriceHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ct({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.AssetSupplyHistoryQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s,batch:false})}function It({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.AssetBorrowHistoryQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s,batch:false})}function Bt({suspense:e=false,pause:s=false,...r}){return u({document:graphql.ProtocolHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Mt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.ReserveQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function Ft(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.reserve(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function Lt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.ReservesQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function jt(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.reserves(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function Gt({suspense:e=false,pause:s=false,...r}){return u({document:graphql.BorrowApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Yt({suspense:e=false,pause:s=false,...r}){return u({document:graphql.SupplyApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Zt({suspense:e=false,pause:s=false,...r}){return u({document:graphql.UserClaimableRewardsQuery,variables:{request:r},suspense:e,pause:s})}function ea(){let e=o();return l(s=>actions.userClaimableRewards(e,s,{requestPolicy:"cache-first"}),[e])}function aa({suspense:e=false,pause:s=false,...r}){return u({document:graphql.SpokeQuery,variables:{request:r},suspense:e,pause:s})}function na({suspense:e=false,pause:s=false,...r}){return u({document:graphql.SpokesQuery,variables:{request:r},suspense:e,pause:s})}function ua({suspense:e=false,pause:s=false,...r}){return u({document:graphql.SpokePositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function oa({suspense:e=false,pause:s=false,...r}){return u({document:graphql.SpokeUserPositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function X(e){switch(e.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":return types.ok(e.quote);case "InsufficientLiquidityError":return types.err(core.ValidationError.fromGqlNode(e));default:return types.err(core.UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${e.__typename}`))}}function be(e){return {__typename:"SwapCancelledResult",swapId:e.swapId,createdAt:e.createdAt,cancelledAt:e.cancelledAt,explorerUrl:e.explorerUrl}}function m(e){switch(e.__typename){case "PositionSwapByIntentApprovalsRequired":return types.ok(e.quote);case "InsufficientLiquidityError":return types.err(core.ValidationError.fromGqlNode(e));default:return types.err(core.UnexpectedError.upgradeRequired(`Unsupported position swap quote result: ${e.__typename}`))}}function Ae(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function ge(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function we(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function Pe(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function Te(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function Ua({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let a=o(),n=u({document:graphql.TokenSwapQuoteQuery,variables:{request:Ae(t,graphql.QuoteAccuracy.Fast),currency:r},selector:X,suspense:e,pause:s,batch:false}),i=u({document:graphql.TokenSwapQuoteQuery,variables:{request:Ae(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:X,suspense:false,pause:s||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return i.data?i:n}function ba(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.tokenSwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(X),[s,e.currency])}function Aa({suspense:e=false,pause:s=false,...r}){return u({document:graphql.SwappableTokensQuery,variables:{request:r},suspense:e,pause:s})}function ga({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){let n=o(),[i,c]=M.useState(false),y=u({document:graphql.UserSwapsQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s||i,pollInterval:n.context.environment.swapStatusInterval});return M.useEffect(()=>{y.data&&y.data.items.length>0&&y.data.items.every(Be)&&c(true);},[y.data]),y}function Be(e){return e.__typename==="SwapFulfilled"||e.__typename==="SwapCancelled"||e.__typename==="SwapExpired"}function wa({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){let n=o(),[i,c]=M.useState(false),y=u({document:graphql.SwapStatusQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s||i,pollInterval:n.context.environment.swapStatusInterval});return M.useEffect(()=>{y.data&&Be(y.data)&&c(true);},[y.data]),y}function Pa({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let a=o(),n=u({document:graphql.SupplySwapQuoteQuery,variables:{request:ge(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=u({document:graphql.SupplySwapQuoteQuery,variables:{request:ge(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return i.data?i:n}function Ta(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.supplySwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function xa({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let a=o(),n=u({document:graphql.BorrowSwapQuoteQuery,variables:{request:we(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=u({document:graphql.BorrowSwapQuoteQuery,variables:{request:we(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return i.data?i:n}function ha(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.borrowSwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function D(e){return {with:s=>e.approvals.reduce((r,t)=>r.andThen(a=>s(t,{cancel:p}).map(n=>{switch(t.__typename){case "PositionSwapAdapterContractApproval":a.adapterContractSignature=types.isSignature(n)?n:null;break;case "PositionSwapPositionManagerApproval":a.positionManagerSignature=types.isSignature(n)?n:null;break}return a})),types.okAsync({quoteId:e.quote.quoteId,adapterContractSignature:null,positionManagerSignature:null}))}}function O(e,s){return actions.swap(e,{intent:s}).andThen(r=>{switch(r.__typename){case "SwapReceipt":return types.okAsync(r);default:return core.UnexpectedError.from(r).asResultAsync()}})}function Ea(e){let s=o();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.supplySwapQuote(s,t,{currency:r}).andThen(a=>D(a).with(e).andThen(n=>actions.preparePositionSwap(s,n)).andThen(n=>e(n.data,{cancel:p}).andThen(A).andThen(i=>O(s,{quoteId:n.newQuoteId,signature:i})))),[s,e])}function Qa(e){let s=o();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.borrowSwapQuote(s,t,{currency:r}).andThen(a=>D(a).with(e).andThen(n=>actions.preparePositionSwap(s,n)).andThen(n=>e(n.data,{cancel:p}).andThen(A).andThen(i=>O(s,{quoteId:n.newQuoteId,signature:i})))),[s,e])}function ka({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let a=o(),n=u({document:graphql.RepayWithSupplyQuoteQuery,variables:{request:Pe(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=u({document:graphql.RepayWithSupplyQuoteQuery,variables:{request:Pe(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return i.data?i:n}function va(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.repayWithSupplyQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function qa(e){let s=o();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.repayWithSupplyQuote(s,t,{currency:r}).andThen(a=>D(a).with(e).andThen(n=>actions.preparePositionSwap(s,n)).andThen(n=>e(n.data,{cancel:p}).andThen(A).andThen(i=>O(s,{quoteId:n.newQuoteId,signature:i})))),[s,e])}function Ha({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let a=o(),n=u({document:graphql.WithdrawSwapQuoteQuery,variables:{request:Te(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=u({document:graphql.WithdrawSwapQuoteQuery,variables:{request:Te(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!n.data,pollInterval:a.context.environment.swapQuoteInterval,batch:false});return i.data?i:n}function Ca(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.withdrawSwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function Ia(e){let s=o();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.withdrawSwapQuote(s,t,{currency:r}).andThen(a=>D(a).with(e).andThen(n=>actions.preparePositionSwap(s,n)).andThen(n=>e(n.data,{cancel:p}).andThen(A).andThen(i=>O(s,{quoteId:n.newQuoteId,signature:i})))),[s,e])}function Ba(e){let s=o(),r=M.useCallback(t=>actions.swap(s,t).andThen(a=>{switch(a.__typename){case "SwapTransactionRequest":return e(a,{cancel:p}).andThen(R.tryFrom).andThen(n=>n.wait()).andThen(()=>types.okAsync(a.orderReceipt));case "SwapReceipt":return types.okAsync(a)}}),[s,e]);return l(({currency:t=client.DEFAULT_QUERY_OPTIONS.currency,...a})=>actions.tokenSwapQuote(s,a,{currency:t}).andThen(n=>{switch(n.__typename){case "SwapByTransaction":return r({transaction:{quoteId:n.quote.quoteId}});case "SwapByIntent":return actions.prepareTokenSwap(s,{quoteId:n.quote.quoteId}).andThen(i=>e(i.data,{cancel:p}).andThen(A).andThen(c=>r({intent:{quoteId:i.newQuoteId,signature:c}})));case "SwapByIntentWithApprovalRequired":if(client.supportsPermit(n)){let i=n.approvals[0];return e(i,{cancel:p}).andThen(c=>types.isSignature(c)?actions.prepareTokenSwap(s,{quoteId:n.quote.quoteId,permitSig:{deadline:i.bySignature.message.deadline,value:c}}):R.isInstanceOf(c)?c.wait().andThen(()=>actions.prepareTokenSwap(s,{quoteId:n.quote.quoteId})):core.UnexpectedError.from(c).asResultAsync()).andThen(c=>e(c.data,{cancel:p}).andThen(A).andThen(y=>r({intent:{quoteId:c.newQuoteId,signature:y}})))}return n.approvals.reduce((i,c)=>i.andThen(()=>e({...c,bySignature:null},{cancel:p}).andThen(R.tryFrom).andThen(y=>y.wait())),types.okAsync(void 0)).andThen(()=>actions.prepareTokenSwap(s,{quoteId:n.quote.quoteId})).andThen(i=>e(i.data,{cancel:p})).andThen(A).andThen(i=>r({intent:{quoteId:n.quote.quoteId,signature:i}}));default:types.never(`Unsupported swap quote result: ${n.__typename}. To be removed from API soon.`);}}),[s,e,r])}var B=class extends types.ResultAwareError{name="CannotCancelSwapError"};function Wa(e){let s=o();return l(r=>actions.swapStatus(s,{id:r.id}).andThen(t=>{if(t===null)return core.UnexpectedError.from("Swap not found").asResultAsync();switch(t.__typename){case "SwapOpen":case "SwapPendingSignature":return actions.prepareSwapCancel(s,r).andThen(a=>e(a.data,{cancel:p})).andThen(A).andThen(a=>actions.cancelSwap(s,{intent:{id:r.id,signature:a}})).andThen(a=>a.__typename==="SwapCancelledResult"?types.okAsync(a):e(a,{cancel:p}).andThen(R.tryFrom).andThen(n=>n.wait()).andThen(()=>actions.swapStatus(s,{id:r.id})).andThen(n=>n?.__typename==="SwapCancelled"?types.okAsync(be(n)):new B("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return types.okAsync(be(t));case "SwapExpired":return new B("Swap cannot longer be cancelled").asResultAsync();default:return core.UnexpectedError.upgradeRequired(`Unsupported swap status: ${t.__typename}`).asResultAsync()}}),[s,e])}function N(e,s){let{chainId:r,spoke:t}=graphql.decodeReserveId(s.reserve),a={chainId:r,address:t};return async()=>Promise.all([j(e,s.sender,a),Y(e,s.sender,a),G(e,[s.reserve]),$(e,a),oe(e,s.sender),F(e,s.sender),L(e,s.sender),K(e,r)])}function gr(e,s){return {deadline:s.message.deadline,value:e}}function ee(e,s){return e.approvals.reduce((r,t)=>r.andThen(()=>s({...t,bySignature:null},{cancel:p}).andThen(R.tryFrom).andThen(a=>a.wait())),types.okAsync(void 0)).map(()=>e.originalTransaction)}function se(e,s,r){let t=e.approvals[0];return s(t,{cancel:p}).andThen(a=>types.isSignature(a)?r(gr(a,t.bySignature)).map(types.expectTypename("TransactionRequest")):a.wait().map(()=>e.originalTransaction))}function ja(e){let s=o();return l(r=>actions.supply(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "Erc20ApprovalRequired":return client.supportsPermit(t)?se(t,e,a=>actions.supply(s,wr(r,a))).andThen(a=>e(a,{cancel:p})):ee(t,e).andThen(a=>e(a,{cancel:p}));case "PreContractActionRequired":return e(t,{cancel:p}).andThen(R.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t))}}).andThen(R.tryFrom).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(N(s,r)),[s,e])}function wr(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function Ga(e){let s=o();return l(r=>actions.borrow(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "PreContractActionRequired":return e(t,{cancel:p}).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return client.UnexpectedError.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(N(s,r)),[s,e])}function Ya(e){let s=o();return l(r=>actions.repay(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "Erc20ApprovalRequired":return client.supportsPermit(t)?se(t,e,a=>actions.repay(s,Pr(r,a))).andThen(a=>e(a,{cancel:p})):ee(t,e).andThen(a=>e(a,{cancel:p}));case "PreContractActionRequired":return e(t,{cancel:p}).andThen(R.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t))}}).andThen(R.tryFrom).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(N(s,r)),[s,e])}function Pr(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function $a(e){let s=o();return l(r=>actions.withdraw(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "PreContractActionRequired":return e(t,{cancel:p}).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return client.UnexpectedError.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(N(s,r)),[s,e])}function Ka(e){let s=o();return l(r=>actions.renounceSpokeUserPositionManager(s,r).andThen(t=>e(t,{cancel:p})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(graphql.SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[s,e])}function za(e){let s=o();return l(r=>actions.updateUserPositionConditions(s,r).andThen(t=>e(t,{cancel:p})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(async()=>{let{userPositionId:t}=r;return Promise.all([s.refreshQueryWhere(graphql.UserPositionsQuery,(a,n)=>n.some(i=>i.id===t)),s.refreshQueryWhere(graphql.UserPositionQuery,(a,n)=>n?.id===t)])}),[s,e])}function Ja(e){let s=o();return l(r=>{let t=r.changes.map(n=>n.reserve),a=t.map(n=>graphql.decodeReserveId(n));return actions.setUserSuppliesAsCollateral(s,r).andThen(n=>e(n,{cancel:p})).andThen(n=>n.wait()).andThen(s.waitForTransaction).andTee(()=>Promise.all([F(s,r.sender),L(s,r.sender),...a.flatMap(({chainId:n,spoke:i})=>[j(s,r.sender,{chainId:n,address:i}),Y(s,r.sender,{chainId:n,address:i}),$(s,{chainId:n,address:i})]),G(s,t),...a.map(({chainId:n})=>K(s,n))]))},[s,e])}function Xa(e){let s=o();return l(r=>actions.liquidatePosition(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "Erc20ApprovalRequired":return client.supportsPermit(t)?se(t,e,a=>actions.liquidatePosition(s,Tr(r))).andThen(a=>e(a,{cancel:p})):ee(t,e).andThen(a=>e(a,{cancel:p}));case "PreContractActionRequired":return e(t,{cancel:p}).andThen(R.tryFrom).andThen(a=>a.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t))}}).andThen(R.tryFrom).andThen(t=>t.wait()).andThen(s.waitForTransaction),[s,e])}function Tr(e,s){return e}function Za(e){let s=o();return l(r=>actions.setSpokeUserPositionManager(s,r).andThen(t=>e(t,{cancel:p})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andTee(()=>s.refreshQueryWhere(graphql.SpokePositionManagersQuery,t=>t.request.spoke===r.spoke)),[s,e])}function en(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.preview(s,r,{currency:e.currency,requestPolicy:"network-only"}),[s,e.currency])}function sn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){return u({document:graphql.PreviewQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function rn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.ActivitiesQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function tn(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.activities(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function an(e){let s=o();return l(r=>actions.claimRewards(s,r).andThen(t=>e(t,{cancel:p})).andThen(R.tryFrom).andThen(t=>t.wait()).map(t=>t.txHash),[s,e])}function dn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.UserSuppliesQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function yn(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.userSupplies(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function Sn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.UserBorrowsQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function Rn(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.userBorrows(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function fn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.UserSummaryQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function mn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.UserPositionsQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function Un(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.userPositions(s,r,{currency:e.currency,timeWindow:e.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function bn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...a}){return u({document:graphql.UserPositionQuery,variables:{request:a,currency:r,timeWindow:t},suspense:e,pause:s})}function An({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){return u({document:graphql.UserBalancesQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function gn({suspense:e=false,pause:s=false,...r}){return u({document:graphql.UserRiskPremiumBreakdownQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function wn(e=client.DEFAULT_QUERY_OPTIONS){let s=o();return l(r=>actions.userBalances(s,r,{currency:e.currency,requestPolicy:"cache-first"}),[s,e.currency])}function Pn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){return u({document:graphql.UserSummaryHistoryQuery,variables:{request:t,currency:r},suspense:e,pause:s,batch:false})}exports.AaveProvider=Fr;exports.CannotCancelSwapError=B;exports.useAaveClient=o;exports.useActivities=rn;exports.useActivitiesAction=tn;exports.useAsset=qt;exports.useAssetBorrowHistory=It;exports.useAssetPriceHistory=Ht;exports.useAssetSupplyHistory=Ct;exports.useBorrow=Ga;exports.useBorrowApyHistory=Gt;exports.useBorrowSwap=Qa;exports.useBorrowSwapQuote=xa;exports.useBorrowSwapQuoteAction=ha;exports.useCancelSwap=Wa;exports.useChain=wt;exports.useChainAction=Pt;exports.useChains=Tt;exports.useClaimRewards=an;exports.useExchangeRate=ht;exports.useExchangeRateAction=xt;exports.useHub=ct;exports.useHubAssets=yt;exports.useHubSummaryHistory=St;exports.useHubs=dt;exports.useHubsAction=Rt;exports.useLiquidatePosition=Xa;exports.usePreview=sn;exports.usePreviewAction=en;exports.useProtocolHistory=Bt;exports.useRenounceSpokeUserPositionManager=Ka;exports.useRepay=Ya;exports.useRepayWithSupply=qa;exports.useRepayWithSupplyQuote=ka;exports.useRepayWithSupplyQuoteAction=va;exports.useReserve=Mt;exports.useReserveAction=Ft;exports.useReserves=Lt;exports.useReservesAction=jt;exports.useSetSpokeUserPositionManager=Za;exports.useSetUserSuppliesAsCollateral=Ja;exports.useSpoke=aa;exports.useSpokePositionManagers=ua;exports.useSpokeUserPositionManagers=oa;exports.useSpokes=na;exports.useSupply=ja;exports.useSupplyApyHistory=Yt;exports.useSupplySwap=Ea;exports.useSupplySwapQuote=Pa;exports.useSupplySwapQuoteAction=Ta;exports.useSwapStatus=wa;exports.useSwappableTokens=Aa;exports.useTokenSwap=Ba;exports.useTokenSwapQuote=Ua;exports.useTokenSwapQuoteAction=ba;exports.useUpdateUserPositionConditions=za;exports.useUserBalances=An;exports.useUserBalancesAction=wn;exports.useUserBorrows=Sn;exports.useUserBorrowsAction=Rn;exports.useUserClaimableRewards=Zt;exports.useUserClaimableRewardsAction=ea;exports.useUserPosition=bn;exports.useUserPositions=mn;exports.useUserPositionsAction=Un;exports.useUserRiskPremiumBreakdown=gn;exports.useUserSummary=fn;exports.useUserSummaryHistory=Pn;exports.useUserSupplies=dn;exports.useUserSuppliesAction=yn;exports.useUserSwaps=ga;exports.useWithdraw=$a;exports.useWithdrawSwap=Ia;exports.useWithdrawSwapQuote=Ha;exports.useWithdrawSwapQuoteAction=Ca;Object.keys(client).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return client[k]}})});//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var client=require('@aave/client'),F=require('react'),types=require('@aave/types'),urql=require('urql'),actions=require('@aave/client/actions'),graphql=require('@aave/graphql'),core=require('@aave/core');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var F__default=/*#__PURE__*/_interopDefault(F);var ae=F__default.default.createContext(null);function oe({children:e,client:s}){return F__default.default.createElement(ae.Provider,{value:s},F__default.default.createElement(urql.Provider,{value:s.urql},e))}function u(){let e=F.useContext(ae);return types.invariant(e,"Could not find Aave SDK context, ensure your code is wrapped in a <AaveProvider>"),e}function Mr({children:e,client:s}){return F__default.default.createElement(oe,{client:s},e)}function ls(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:s}=graphql.decodeUserPositionId(e.userPositionId);return s}function cs(e){if("userSpoke"in e)return e.userSpoke.user;if("userToken"in e)return e.userToken.user;if("userChains"in e)return e.userChains.user;if("userHub"in e)return e.userHub.user;let{user:s}=graphql.decodeUserPositionId(e.userPositionId);return s}function le(e,s){return e.refreshQueryWhere(graphql.UserBalancesQuery,r=>r.request.user===s)}function L(e,s){return e.refreshQueryWhere(graphql.UserSuppliesQuery,r=>ls(r.request.query)===s)}function j(e,s){return e.refreshQueryWhere(graphql.UserBorrowsQuery,r=>cs(r.request.query)===s)}function G(e,s,r){let t=n=>n.spoke.chain.chainId===r.chainId&&n.spoke.address===r.address&&n.user===s;return types.ResultAsync.combine([e.refreshQueryWhere(graphql.UserPositionsQuery,(n,a)=>a.some(t)),e.refreshQueryWhere(graphql.UserPositionQuery,(n,a)=>a!==null&&t(a))])}function Y(e,s){let r=t=>s.includes(t.id);return types.ResultAsync.combine([e.refreshQueryWhere(graphql.ReserveQuery,(t,n)=>n!==null&&r(n)),e.refreshQueryWhere(graphql.ReservesQuery,(t,n)=>n.some(r))])}function $(e,s,r){return e.refreshQueryWhere(graphql.UserSummaryQuery,t=>t.request.user===s&&(graphql.isSpokeInputVariant(t.request.filter)?t.request.filter.spoke.chainId===r.chainId&&t.request.filter.spoke.address===r.address:graphql.isChainIdsVariant(t.request.filter)?t.request.filter.chainIds.some(n=>n===r.chainId):false))}function K(e,s){let r=t=>t.chain.chainId===s.chainId&&t.address===s.address;return types.ResultAsync.combine([e.refreshQueryWhere(graphql.SpokeQuery,(t,n)=>n!==null&&r(n)),e.refreshQueryWhere(graphql.SpokesQuery,(t,n)=>n.some(r))])}function z(e,s){let r=t=>t.chain.chainId===s;return types.ResultAsync.combine([e.refreshQueryWhere(graphql.HubQuery,(t,n)=>n!==null&&r(n)),e.refreshQueryWhere(graphql.HubsQuery,(t,n)=>n.some(r))])}function J(e,s){return e.refreshQueryWhere(graphql.SpokePositionManagersQuery,r=>r.request.spoke===s)}function ce(e,s){return types.ResultAsync.combine([e.refreshQueryWhere(graphql.UserPositionsQuery,(r,t)=>t.some(n=>n.id===s)),e.refreshQueryWhere(graphql.UserPositionQuery,(r,t)=>t?.id===s)])}var w={Loading:()=>({data:void 0,error:void 0,loading:true,paused:false,reloading:false}),Success:(e,s=false)=>({data:e,error:void 0,loading:false,paused:false,reloading:s}),Failure:(e,s=false)=>({data:void 0,error:e,loading:false,paused:false,reloading:s}),Paused:(e,s)=>({data:e,error:s,loading:false,paused:true,reloading:false})};function o({document:e,variables:s,suspense:r,pause:t,selector:n=types.ok,pollInterval:a=0,batch:i=true}){let[c,d]=F.useState(true),[{fetching:f,data:A,error:H,stale:Ge},ne]=urql.useQuery({query:e,variables:s,pause:t,context:F.useMemo(()=>({batch:i,suspense:r}),[i,r])});if(F.useEffect(()=>{t||f||d(false);},[f,t]),F.useEffect(()=>{if(a<=0||f||t)return;let T=setTimeout(()=>{ne({requestPolicy:"network-only",batch:false});},a);return ()=>clearTimeout(T)},[f,ne,a,t]),t){let T=H?client.UnexpectedError.from(H):void 0;if(!A)return w.Paused(void 0,T);let M=n(A.value);return M.isErr()?w.Paused(void 0,M.error):w.Paused(M.value,T)}if(!r&&c)return w.Loading();let _=Ge||!c&&f;if(H){let T=client.UnexpectedError.from(H);if(r)throw T;return w.Failure(T,_)}types.invariant(A,"No data returned");let C=n(A.value);if(C.isErr()){if(r)throw C.error;return w.Failure(C.error,_)}return w.Success(C.value,_)}var X={Idle:()=>({called:false,loading:false,data:void 0,error:void 0}),Loading:e=>({called:true,loading:true,data:e,error:void 0}),Success:e=>({called:true,loading:false,data:e,error:void 0}),Failed:e=>({called:true,loading:false,data:void 0,error:e})};function l(e,s){let[r,t]=F.useState(X.Idle()),n=F.useRef(false),a=F.useCallback(e,s);return [F.useCallback(c=>{types.invariant(!n.current,"Cannot execute a task while another is in progress."),n.current=true;let d;t(f=>(d=f,{called:true,loading:true,data:f.data,error:void 0}));try{let f=a(c);return f.match(A=>{n.current=!1,t(X.Success(A));},A=>{n.current=!1,t(X.Failed(A));}),f}catch(f){throw n.current=false,t(types.nonNullable(d)),f}},[a]),r]}var p=e=>core.CancelError.from(e).asResultAsync(),R=class e{constructor(s){this.wait=s;}static isInstanceOf(s){return s instanceof e}static tryFrom(s){return e.isInstanceOf(s)?types.okAsync(s):core.UnexpectedError.from(s).asResultAsync()}};function g(e){return types.isSignature(e)?types.okAsync(e):core.UnexpectedError.from(`Expected Signature, but got ${String(e)}`).asResultAsync()}function ct({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.HubQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function yt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.HubsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function dt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.HubAssetsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function St({suspense:e=false,pause:s=false,...r}){return o({document:graphql.HubSummaryHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Rt(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.hubs(s,r,{currency:e.currency,requestPolicy:"cache-first"}),[s,e.currency])}function wt({suspense:e=false,pause:s=false,...r}){return o({document:graphql.ChainQuery,variables:{request:r},suspense:e,pause:s})}function Pt(){let e=u();return l(s=>actions.chain(e,s,{batch:false,requestPolicy:"cache-first"}),[e])}function Tt({suspense:e=false,pause:s=false,...r}={query:{filter:graphql.ChainsFilter.ALL}}){return o({document:graphql.ChainsQuery,variables:{request:r},suspense:e,pause:s})}function xt(){let e=u();return l(s=>actions.exchangeRate(e,s,{requestPolicy:"network-only"}),[e])}function ht({suspense:e=false,pause:s=false,...r}){let t=u();return o({document:graphql.ExchangeRateQuery,variables:{request:r},suspense:e,pause:s,pollInterval:r.at?0:t.context.environment.exchangeRateInterval})}function qt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.AssetQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Ht({suspense:e=false,pause:s=false,...r}){return o({document:graphql.AssetPriceHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Ct({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.AssetSupplyHistoryQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s,batch:false})}function It({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.AssetBorrowHistoryQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s,batch:false})}function Bt({suspense:e=false,pause:s=false,...r}){return o({document:graphql.ProtocolHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Mt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.ReserveQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Ft(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.reserve(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function Lt({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.ReservesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function jt(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.reserves(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function Gt({suspense:e=false,pause:s=false,...r}){return o({document:graphql.BorrowApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Yt({suspense:e=false,pause:s=false,...r}){return o({document:graphql.SupplyApyHistoryQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function Zt({suspense:e=false,pause:s=false,...r}){return o({document:graphql.UserClaimableRewardsQuery,variables:{request:r},suspense:e,pause:s})}function en(){let e=u();return l(s=>actions.userClaimableRewards(e,s,{requestPolicy:"cache-first"}),[e])}function nn({suspense:e=false,pause:s=false,...r}){return o({document:graphql.SpokeQuery,variables:{request:r},suspense:e,pause:s})}function an({suspense:e=false,pause:s=false,...r}){return o({document:graphql.SpokesQuery,variables:{request:r},suspense:e,pause:s})}function on({suspense:e=false,pause:s=false,...r}){return o({document:graphql.SpokePositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function un({suspense:e=false,pause:s=false,...r}){return o({document:graphql.SpokeUserPositionManagersQuery,variables:{request:r},suspense:e,pause:s})}function ee(e){switch(e.__typename){case "SwapByIntent":case "SwapByIntentWithApprovalRequired":case "SwapByTransaction":return types.ok(e.quote);case "InsufficientLiquidityError":return types.err(core.ValidationError.fromGqlNode(e));default:return types.err(core.UnexpectedError.upgradeRequired(`Unsupported swap quote result: ${e.__typename}`))}}function Pe(e){return {__typename:"SwapCancelledResult",swapId:e.swapId,createdAt:e.createdAt,cancelledAt:e.cancelledAt,explorerUrl:e.explorerUrl}}function m(e){switch(e.__typename){case "PositionSwapByIntentApprovalsRequired":return types.ok(e.quote);case "InsufficientLiquidityError":return types.err(core.ValidationError.fromGqlNode(e));default:return types.err(core.UnexpectedError.upgradeRequired(`Unsupported position swap quote result: ${e.__typename}`))}}function Te(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function xe(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function he(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function Ee(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function Qe(e,s){return "market"in e&&e.market?{market:{...e.market,accuracy:s}}:e}function bn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let n=u(),a=o({document:graphql.TokenSwapQuoteQuery,variables:{request:Te(t,graphql.QuoteAccuracy.Fast),currency:r},selector:ee,suspense:e,pause:s,batch:false}),i=o({document:graphql.TokenSwapQuoteQuery,variables:{request:Te(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:ee,suspense:false,pause:s||e&&!a.data,pollInterval:n.context.environment.swapQuoteInterval,batch:false});return i.data?i:a}function gn(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.tokenSwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(ee),[s,e.currency])}function An({suspense:e=false,pause:s=false,...r}){return o({document:graphql.SwappableTokensQuery,variables:{request:r},suspense:e,pause:s})}function wn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){let a=u(),[i,c]=F.useState(false),d=o({document:graphql.UserSwapsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s||i,pollInterval:a.context.environment.swapStatusInterval});return F.useEffect(()=>{d.data&&d.data.items.length>0&&d.data.items.every(Ne)&&c(true);},[d.data]),d}function Ne(e){return e.__typename==="SwapFulfilled"||e.__typename==="SwapCancelled"||e.__typename==="SwapExpired"}function Pn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){let a=u(),[i,c]=F.useState(false),d=o({document:graphql.SwapStatusQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s||i,pollInterval:a.context.environment.swapStatusInterval});return F.useEffect(()=>{d.data&&Ne(d.data)&&c(true);},[d.data]),d}function Tn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let n=u(),a=o({document:graphql.SupplySwapQuoteQuery,variables:{request:xe(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=o({document:graphql.SupplySwapQuoteQuery,variables:{request:xe(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!a.data,pollInterval:n.context.environment.swapQuoteInterval,batch:false});return i.data?i:a}function xn(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.supplySwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function hn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let n=u(),a=o({document:graphql.BorrowSwapQuoteQuery,variables:{request:he(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=o({document:graphql.BorrowSwapQuoteQuery,variables:{request:he(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!a.data,pollInterval:n.context.environment.swapQuoteInterval,batch:false});return i.data?i:a}function En(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.borrowSwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function O(e){return {with:s=>e.approvals.reduce((r,t)=>r.andThen(n=>s(t,{cancel:p}).map(a=>{switch(t.__typename){case "PositionSwapAdapterContractApproval":n.adapterContractSignature=types.isSignature(a)?a:null;break;case "PositionSwapPositionManagerApproval":n.positionManagerSignature=types.isSignature(a)?a:null;break}return n})),types.okAsync({quoteId:e.quote.quoteId,adapterContractSignature:null,positionManagerSignature:null}))}}function N(e,s){return actions.swap(e,{intent:s}).andThen(r=>{switch(r.__typename){case "SwapReceipt":return types.okAsync(r);default:return core.UnexpectedError.from(r).asResultAsync()}})}function Qn(e){let s=u();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.supplySwapQuote(s,t,{currency:r}).andThen(n=>O(n).with(e).andThen(a=>actions.preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:p}).andThen(g).andThen(i=>N(s,{quoteId:a.newQuoteId,signature:i})))),[s,e])}function kn(e){let s=u();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.borrowSwapQuote(s,t,{currency:r}).andThen(n=>O(n).with(e).andThen(a=>actions.preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:p}).andThen(g).andThen(i=>N(s,{quoteId:a.newQuoteId,signature:i})))),[s,e])}function vn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let n=u(),a=o({document:graphql.RepayWithSupplyQuoteQuery,variables:{request:Ee(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=o({document:graphql.RepayWithSupplyQuoteQuery,variables:{request:Ee(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!a.data,pollInterval:n.context.environment.swapQuoteInterval,batch:false});return i.data?i:a}function qn(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.repayWithSupplyQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function Hn(e){let s=u();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.repayWithSupplyQuote(s,t,{currency:r}).andThen(n=>O(n).with(e).andThen(a=>actions.preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:p}).andThen(g).andThen(i=>N(s,{quoteId:a.newQuoteId,signature:i})))),[s,e])}function Cn({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){let n=u(),a=o({document:graphql.WithdrawSwapQuoteQuery,variables:{request:Qe(t,graphql.QuoteAccuracy.Fast),currency:r},selector:m,suspense:e,pause:s,batch:false}),i=o({document:graphql.WithdrawSwapQuoteQuery,variables:{request:Qe(t,graphql.QuoteAccuracy.Accurate),currency:r},selector:m,suspense:false,pause:s||e&&!a.data,pollInterval:n.context.environment.swapQuoteInterval,batch:false});return i.data?i:a}function In(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.withdrawSwapQuote(s,r,{currency:e.currency,requestPolicy:"network-only"}).andThen(m),[s,e.currency])}function Bn(e){let s=u();return l(({currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t})=>actions.withdrawSwapQuote(s,t,{currency:r}).andThen(n=>O(n).with(e).andThen(a=>actions.preparePositionSwap(s,a)).andThen(a=>e(a.data,{cancel:p}).andThen(g).andThen(i=>N(s,{quoteId:a.newQuoteId,signature:i})))),[s,e])}function Wn(e){let s=u(),r=F.useCallback(t=>actions.swap(s,t).andThen(n=>{switch(n.__typename){case "SwapTransactionRequest":return e(n,{cancel:p}).andThen(R.tryFrom).andThen(a=>a.wait()).andThen(()=>types.okAsync(n.orderReceipt));case "SwapReceipt":return types.okAsync(n)}}),[s,e]);return l(({currency:t=client.DEFAULT_QUERY_OPTIONS.currency,...n})=>actions.tokenSwapQuote(s,n,{currency:t}).andThen(a=>{switch(a.__typename){case "SwapByTransaction":return r({transaction:{quoteId:a.quote.quoteId}});case "SwapByIntent":return actions.prepareTokenSwap(s,{quoteId:a.quote.quoteId}).andThen(i=>e(i.data,{cancel:p}).andThen(g).andThen(c=>r({intent:{quoteId:i.newQuoteId,signature:c}})));case "SwapByIntentWithApprovalRequired":if(client.supportsPermit(a)){let i=a.approvals[0];return e(i,{cancel:p}).andThen(c=>types.isSignature(c)?actions.prepareTokenSwap(s,{quoteId:a.quote.quoteId,permitSig:{deadline:i.bySignature.message.deadline,value:c}}):R.isInstanceOf(c)?c.wait().andThen(()=>actions.prepareTokenSwap(s,{quoteId:a.quote.quoteId})):core.UnexpectedError.from(c).asResultAsync()).andThen(c=>e(c.data,{cancel:p}).andThen(g).andThen(d=>r({intent:{quoteId:c.newQuoteId,signature:d}})))}return a.approvals.reduce((i,c)=>i.andThen(()=>e({...c,bySignature:null},{cancel:p}).andThen(R.tryFrom).andThen(d=>d.wait())),types.okAsync(void 0)).andThen(()=>actions.prepareTokenSwap(s,{quoteId:a.quote.quoteId})).andThen(i=>e(i.data,{cancel:p})).andThen(g).andThen(i=>r({intent:{quoteId:a.quote.quoteId,signature:i}}));default:types.never(`Unsupported swap quote result: ${a.__typename}. To be removed from API soon.`);}}),[s,e,r])}var W=class extends types.ResultAwareError{name="CannotCancelSwapError"};function Dn(e){let s=u();return l(r=>actions.swapStatus(s,{id:r.id}).andThen(t=>{if(t===null)return core.UnexpectedError.from("Swap not found").asResultAsync();switch(t.__typename){case "SwapOpen":case "SwapPendingSignature":return actions.prepareSwapCancel(s,r).andThen(n=>e(n.data,{cancel:p})).andThen(g).andThen(n=>actions.cancelSwap(s,{intent:{id:r.id,signature:n}})).andThen(n=>n.__typename==="SwapCancelledResult"?types.okAsync(n):e(n,{cancel:p}).andThen(R.tryFrom).andThen(a=>a.wait()).andThen(()=>actions.swapStatus(s,{id:r.id})).andThen(a=>a?.__typename==="SwapCancelled"?types.okAsync(Pe(a)):new W("Failed to cancel swap").asResultAsync()));case "SwapCancelled":return types.okAsync(Pe(t));case "SwapExpired":return new W("Swap cannot longer be cancelled").asResultAsync();default:return core.UnexpectedError.upgradeRequired(`Unsupported swap status: ${t.__typename}`).asResultAsync()}}),[s,e])}function V(e,s){let{chainId:r,spoke:t}=graphql.decodeReserveId(s.reserve),n={chainId:r,address:t};return types.ResultAsync.combine([G(e,s.sender,n),$(e,s.sender,n),Y(e,[s.reserve]),K(e,n),le(e,s.sender),L(e,s.sender),j(e,s.sender),z(e,r)])}function gr(e,s){return {deadline:s.message.deadline,value:e}}function re(e,s){return e.approvals.reduce((r,t)=>r.andThen(()=>s({...t,bySignature:null},{cancel:p}).andThen(R.tryFrom).andThen(n=>n.wait())),types.okAsync(void 0)).map(()=>e.originalTransaction)}function te(e,s,r){let t=e.approvals[0];return s(t,{cancel:p}).andThen(n=>types.isSignature(n)?r(gr(n,t.bySignature)).map(types.expectTypename("TransactionRequest")):n.wait().map(()=>e.originalTransaction))}function Gn(e){let s=u();return l(r=>actions.supply(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "Erc20ApprovalRequired":return client.supportsPermit(t)?te(t,e,n=>actions.supply(s,Ar(r,n))).andThen(n=>e(n,{cancel:p})):re(t,e).andThen(n=>e(n,{cancel:p}));case "PreContractActionRequired":return e(t,{cancel:p}).andThen(R.tryFrom).andThen(n=>n.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t))}}).andThen(R.tryFrom).andThen(t=>t.wait()).andThen(s.waitForTransaction).andThrough(()=>V(s,r)),[s,e])}function Ar(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function Yn(e){let s=u();return l(r=>actions.borrow(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "PreContractActionRequired":return e(t,{cancel:p}).andThen(n=>n.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return client.UnexpectedError.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(s.waitForTransaction).andThrough(()=>V(s,r)),[s,e])}function $n(e){let s=u();return l(r=>actions.repay(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "Erc20ApprovalRequired":return client.supportsPermit(t)?te(t,e,n=>actions.repay(s,wr(r,n))).andThen(n=>e(n,{cancel:p})):re(t,e).andThen(n=>e(n,{cancel:p}));case "PreContractActionRequired":return e(t,{cancel:p}).andThen(R.tryFrom).andThen(n=>n.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t))}}).andThen(R.tryFrom).andThen(t=>t.wait()).andThen(s.waitForTransaction).andThrough(()=>V(s,r)),[s,e])}function wr(e,s){return "erc20"in e.amount?{...e,amount:{erc20:{...e.amount.erc20,permitSig:s}}}:e}function Kn(e){let s=u();return l(r=>actions.withdraw(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "PreContractActionRequired":return e(t,{cancel:p}).andThen(n=>n.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t));case "Erc20ApprovalRequired":return client.UnexpectedError.from(t).asResultAsync()}}).andThen(t=>t.wait()).andThen(s.waitForTransaction).andThrough(()=>V(s,r)),[s,e])}function zn(e){let s=u();return l(r=>actions.renounceSpokeUserPositionManager(s,r).andThen(t=>e(t,{cancel:p})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andThrough(()=>J(s,r.spoke)),[s,e])}function Jn(e){let s=u();return l(r=>actions.updateUserPositionConditions(s,r).andThen(t=>e(t,{cancel:p})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andThrough(()=>ce(s,r.userPositionId)),[s,e])}function Xn(e){let s=u();return l(r=>{let t=r.changes.map(a=>a.reserve),n=t.map(a=>graphql.decodeReserveId(a));return actions.setUserSuppliesAsCollateral(s,r).andThen(a=>e(a,{cancel:p})).andThen(a=>a.wait()).andThen(s.waitForTransaction).andThrough(()=>types.ResultAsync.combine([L(s,r.sender),j(s,r.sender),...n.flatMap(({chainId:a,spoke:i})=>[G(s,r.sender,{chainId:a,address:i}),$(s,r.sender,{chainId:a,address:i}),K(s,{chainId:a,address:i})]),Y(s,t),...n.map(({chainId:a})=>z(s,a))]))},[s,e])}function Zn(e){let s=u();return l(r=>actions.liquidatePosition(s,r).andThen(t=>{switch(t.__typename){case "TransactionRequest":return e(t,{cancel:p});case "Erc20ApprovalRequired":return client.supportsPermit(t)?te(t,e,n=>actions.liquidatePosition(s,Pr(r))).andThen(n=>e(n,{cancel:p})):re(t,e).andThen(n=>e(n,{cancel:p}));case "PreContractActionRequired":return e(t,{cancel:p}).andThen(R.tryFrom).andThen(n=>n.wait()).andThen(()=>e(t.originalTransaction,{cancel:p}));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(t))}}).andThen(R.tryFrom).andThen(t=>t.wait()).andThen(s.waitForTransaction),[s,e])}function Pr(e,s){return e}function ea(e){let s=u();return l(r=>actions.setSpokeUserPositionManager(s,r).andThen(t=>e(t,{cancel:p})).andThen(t=>t.wait()).andThen(s.waitForTransaction).andThrough(()=>J(s,r.spoke)),[s,e])}function sa(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.preview(s,r,{currency:e.currency,requestPolicy:"network-only"}),[s,e.currency])}function ra({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){return o({document:graphql.PreviewQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function ta({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.ActivitiesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function na(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.activities(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function aa(e){let s=u();return l(r=>actions.claimRewards(s,r).andThen(t=>e(t,{cancel:p})).andThen(R.tryFrom).andThen(t=>t.wait()).map(t=>t.txHash),[s,e])}function ya({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.UserSuppliesQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function da(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.userSupplies(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function Sa({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.UserBorrowsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Ra(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.userBorrows(s,r,{currency:e.currency??client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:e.timeWindow??client.DEFAULT_QUERY_OPTIONS.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function fa({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.UserSummaryQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function ma({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.UserPositionsQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function Ua(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.userPositions(s,r,{currency:e.currency,timeWindow:e.timeWindow,requestPolicy:"cache-first"}),[s,e.currency,e.timeWindow])}function ba({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,timeWindow:t=client.DEFAULT_QUERY_OPTIONS.timeWindow,...n}){return o({document:graphql.UserPositionQuery,variables:{request:n,currency:r,timeWindow:t},suspense:e,pause:s})}function ga({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){return o({document:graphql.UserBalancesQuery,variables:{request:t,currency:r},suspense:e,pause:s})}function Aa({suspense:e=false,pause:s=false,...r}){return o({document:graphql.UserRiskPremiumBreakdownQuery,variables:{request:r},suspense:e,pause:s,batch:false})}function wa(e=client.DEFAULT_QUERY_OPTIONS){let s=u();return l(r=>actions.userBalances(s,r,{currency:e.currency,requestPolicy:"cache-first"}),[s,e.currency])}function Pa({suspense:e=false,pause:s=false,currency:r=client.DEFAULT_QUERY_OPTIONS.currency,...t}){return o({document:graphql.UserSummaryHistoryQuery,variables:{request:t,currency:r},suspense:e,pause:s,batch:false})}exports.AaveProvider=Mr;exports.CannotCancelSwapError=W;exports.useAaveClient=u;exports.useActivities=ta;exports.useActivitiesAction=na;exports.useAsset=qt;exports.useAssetBorrowHistory=It;exports.useAssetPriceHistory=Ht;exports.useAssetSupplyHistory=Ct;exports.useBorrow=Yn;exports.useBorrowApyHistory=Gt;exports.useBorrowSwap=kn;exports.useBorrowSwapQuote=hn;exports.useBorrowSwapQuoteAction=En;exports.useCancelSwap=Dn;exports.useChain=wt;exports.useChainAction=Pt;exports.useChains=Tt;exports.useClaimRewards=aa;exports.useExchangeRate=ht;exports.useExchangeRateAction=xt;exports.useHub=ct;exports.useHubAssets=dt;exports.useHubSummaryHistory=St;exports.useHubs=yt;exports.useHubsAction=Rt;exports.useLiquidatePosition=Zn;exports.usePreview=ra;exports.usePreviewAction=sa;exports.useProtocolHistory=Bt;exports.useRenounceSpokeUserPositionManager=zn;exports.useRepay=$n;exports.useRepayWithSupply=Hn;exports.useRepayWithSupplyQuote=vn;exports.useRepayWithSupplyQuoteAction=qn;exports.useReserve=Mt;exports.useReserveAction=Ft;exports.useReserves=Lt;exports.useReservesAction=jt;exports.useSetSpokeUserPositionManager=ea;exports.useSetUserSuppliesAsCollateral=Xn;exports.useSpoke=nn;exports.useSpokePositionManagers=on;exports.useSpokeUserPositionManagers=un;exports.useSpokes=an;exports.useSupply=Gn;exports.useSupplyApyHistory=Yt;exports.useSupplySwap=Qn;exports.useSupplySwapQuote=Tn;exports.useSupplySwapQuoteAction=xn;exports.useSwapStatus=Pn;exports.useSwappableTokens=An;exports.useTokenSwap=Wn;exports.useTokenSwapQuote=bn;exports.useTokenSwapQuoteAction=gn;exports.useUpdateUserPositionConditions=Jn;exports.useUserBalances=ga;exports.useUserBalancesAction=wa;exports.useUserBorrows=Sa;exports.useUserBorrowsAction=Ra;exports.useUserClaimableRewards=Zt;exports.useUserClaimableRewardsAction=en;exports.useUserPosition=ba;exports.useUserPositions=ma;exports.useUserPositionsAction=Ua;exports.useUserRiskPremiumBreakdown=Aa;exports.useUserSummary=fa;exports.useUserSummaryHistory=Pa;exports.useUserSupplies=ya;exports.useUserSuppliesAction=da;exports.useUserSwaps=wn;exports.useWithdraw=Kn;exports.useWithdrawSwap=Bn;exports.useWithdrawSwapQuote=Cn;exports.useWithdrawSwapQuoteAction=In;Object.keys(client).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return client[k]}})});//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|