@aave/client 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AaveClient-C-OkXfVz.d.ts +85 -0
- package/dist/AaveClient-PHUEzt7l.d.cts +85 -0
- package/dist/actions/index.cjs +2 -0
- package/dist/actions/index.cjs.map +1 -0
- package/dist/actions/index.d.cts +1117 -0
- package/dist/actions/index.d.ts +1117 -0
- package/dist/actions/index.js +2 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/chunk-BLZHGYNH.js +2 -0
- package/dist/chunk-BLZHGYNH.js.map +1 -0
- package/dist/chunk-FW4363Y4.js +2 -0
- package/dist/chunk-FW4363Y4.js.map +1 -0
- package/dist/chunk-QQSK6HIZ.js +3 -0
- package/dist/chunk-QQSK6HIZ.js.map +1 -0
- package/dist/chunk-V4DWF6LT.js +3 -0
- package/dist/chunk-V4DWF6LT.js.map +1 -0
- package/dist/ethers.cjs +2 -0
- package/dist/ethers.cjs.map +1 -0
- package/dist/ethers.d.cts +22 -0
- package/dist/ethers.d.ts +22 -0
- package/dist/ethers.js +2 -0
- package/dist/ethers.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/magic-string.es-PTUXR566.js +14 -0
- package/dist/magic-string.es-PTUXR566.js.map +1 -0
- package/dist/privy.cjs +3 -0
- package/dist/privy.cjs.map +1 -0
- package/dist/privy.d.cts +18 -0
- package/dist/privy.d.ts +18 -0
- package/dist/privy.js +2 -0
- package/dist/privy.js.map +1 -0
- package/dist/test-utils.cjs +450 -0
- package/dist/test-utils.cjs.map +1 -0
- package/dist/test-utils.d.cts +41 -0
- package/dist/test-utils.d.ts +41 -0
- package/dist/test-utils.js +438 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/thirdweb.cjs +3 -0
- package/dist/thirdweb.cjs.map +1 -0
- package/dist/thirdweb.d.cts +18 -0
- package/dist/thirdweb.d.ts +18 -0
- package/dist/thirdweb.js +3 -0
- package/dist/thirdweb.js.map +1 -0
- package/dist/types-ieyj0UmJ.d.cts +16 -0
- package/dist/types-ieyj0UmJ.d.ts +16 -0
- package/dist/viem.cjs +3 -0
- package/dist/viem.cjs.map +1 -0
- package/dist/viem.d.cts +30 -0
- package/dist/viem.d.ts +30 -0
- package/dist/viem.js +2 -0
- package/dist/viem.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{F as approveBorrowCreditDelegation,r as borrow,p as borrowAPYHistory,j as chains,D as collateralToggle,G as creditDelegateeAllowance,e as defaultMarketReservesRequestOrderBy,l as hasProcessedKnownTransaction,i as health,m as healthFactorPreview,E as liquidate,g as market,f as markets,n as permitTypedData,t as repay,o as reserve,a as savingsGhoBalance,c as savingsGhoDeposit,b as savingsGhoWithdraw,s as supply,q as supplyAPYHistory,k as usdExchangeRates,I as userBorrows,h as userMarketState,d as userMeritRewards,v as userSetEmode,H as userSupplies,J as userTransactionHistory,M as userVaults,K as vault,U as vaultCreateRecipientsConfiguration,y as vaultDeploy,w as vaultDeposit,C as vaultMintShares,N as vaultPreviewDeposit,O as vaultPreviewMint,Q as vaultPreviewRedeem,P as vaultPreviewWithdraw,V as vaultRecipientConfiguration,x as vaultRedeemShares,z as vaultSetFee,W as vaultSetRecipientsConfiguration,T as vaultTransferOwnership,S as vaultUserActivity,R as vaultUserTransactionHistory,B as vaultWithdraw,A as vaultWithdrawFees,L as vaults,u as withdraw}from'../chunk-BLZHGYNH.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {OrderDirection,ChainsFilter,SavingsGhoBalanceQuery,SavingsGhoWithdrawQuery,SavingsGhoDepositQuery,UserMeritRewardsQuery,MarketsQuery,MarketQuery,UserMarketStateQuery,HealthQuery,ChainsQuery,UsdExchangeRatesQuery,HasProcessedKnownTransactionQuery,HealthFactorPreviewQuery,PermitTypedDataQuery,ReserveQuery,BorrowAPYHistoryQuery,SupplyAPYHistoryQuery,BorrowQuery,SupplyQuery,RepayQuery,WithdrawQuery,UserSetEmodeQuery,VaultDepositQuery,VaultRedeemSharesQuery,VaultDeployQuery,VaultSetFeeQuery,VaultWithdrawFeesQuery,VaultWithdrawQuery,VaultMintSharesQuery,CollateralToggleQuery,LiquidateQuery,ApproveBorrowCreditDelegationQuery,CreditDelegateeAllowanceQuery,UserSuppliesQuery,UserBorrowsQuery,UserTransactionHistoryQuery,VaultQuery,VaultsQuery,UserVaultsQuery,VaultPreviewDepositQuery,VaultPreviewMintQuery,VaultPreviewWithdrawQuery,VaultPreviewRedeemQuery,VaultUserTransactionHistoryQuery,VaultUserActivityQuery,vaultTransferOwnershipQuery,vaultCreateRecipientsConfigurationQuery,vaultRecipientConfigurationQuery,vaultSetRecipientsConfigurationQuery}from'@aave/graphql';function ue(e,t){return e.query(SavingsGhoBalanceQuery,{request:t})}function se(e,t){return e.query(SavingsGhoWithdrawQuery,{request:t})}function oe(e,t){return e.query(SavingsGhoDepositQuery,{request:t})}function pe(e,t){return e.query(UserMeritRewardsQuery,{request:t})}var r={tokenName:OrderDirection.Asc};function ce(e,{chainIds:t,borrowsOrderBy:n=r,suppliesOrderBy:u=r,user:s}){return e.query(MarketsQuery,{request:{chainIds:t,user:s},borrowsOrderBy:n,suppliesOrderBy:u})}function Re(e,{address:t,chainId:n,user:u,borrowsOrderBy:s=r,suppliesOrderBy:o=r}){return e.query(MarketQuery,{request:{address:t,chainId:n,user:u},borrowsOrderBy:s,suppliesOrderBy:o})}function ve(e,t){return e.query(UserMarketStateQuery,{request:t})}function de(e){return e.query(HealthQuery,{})}function xe(e,t=ChainsFilter.ALL){return e.query(ChainsQuery,{filter:t})}function me(e,t){return e.query(UsdExchangeRatesQuery,{request:t})}function fe(e,t){return e.query(HasProcessedKnownTransactionQuery,{request:t})}function Ce(e,t){return e.query(HealthFactorPreviewQuery,{request:t})}function we(e,t){return e.query(PermitTypedDataQuery,{request:t})}function Pe(e,t){return e.query(ReserveQuery,{request:t})}function ge(e,t){return e.query(BorrowAPYHistoryQuery,{request:t})}function Te(e,t){return e.query(SupplyAPYHistoryQuery,{request:t})}function ke(e,t){return e.query(BorrowQuery,{request:t})}function Me(e,t){return e.query(SupplyQuery,{request:t})}function Be(e,t){return e.query(RepayQuery,{request:t})}function De(e,t){return e.query(WithdrawQuery,{request:t})}function He(e,t){return e.query(UserSetEmodeQuery,{request:t})}function We(e,t){return e.query(VaultDepositQuery,{request:t})}function Fe(e,t){return e.query(VaultRedeemSharesQuery,{request:t})}function Oe(e,t){return e.query(VaultDeployQuery,{request:t})}function Ge(e,t){return e.query(VaultSetFeeQuery,{request:t})}function Ye(e,t){return e.query(VaultWithdrawFeesQuery,{request:t})}function be(e,t){return e.query(VaultWithdrawQuery,{request:t})}function Ie(e,t){return e.query(VaultMintSharesQuery,{request:t})}function Le(e,t){return e.query(CollateralToggleQuery,{request:t})}function Ke(e,t){return e.query(LiquidateQuery,{request:t})}function Ne(e,t){return e.query(ApproveBorrowCreditDelegationQuery,{request:t})}function je(e,t){return e.query(CreditDelegateeAllowanceQuery,{request:t})}function Xe(e,t){return e.query(UserSuppliesQuery,{request:t})}function Ze(e,t){return e.query(UserBorrowsQuery,{request:t})}function _e(e,t){return e.query(UserTransactionHistoryQuery,{request:t})}function tt(e,t){return e.query(VaultQuery,{request:t})}function rt(e,t){return e.query(VaultsQuery,{request:t})}function nt(e,t){return e.query(UserVaultsQuery,{request:t})}function ut(e,t){return e.query(VaultPreviewDepositQuery,{request:t})}function st(e,t){return e.query(VaultPreviewMintQuery,{request:t})}function ot(e,t){return e.query(VaultPreviewWithdrawQuery,{request:t})}function at(e,t){return e.query(VaultPreviewRedeemQuery,{request:t})}function it(e,t){return e.query(VaultUserTransactionHistoryQuery,{request:t})}function pt(e,t){return e.query(VaultUserActivityQuery,{request:t})}function yt(e,t){return e.query(vaultTransferOwnershipQuery,{request:t})}function lt(e,t){return e.query(vaultCreateRecipientsConfigurationQuery,{request:t})}function ct(e,t){return e.query(vaultRecipientConfigurationQuery,{request:t})}function Rt(e,t){return e.query(vaultSetRecipientsConfigurationQuery,{request:t})}export{Ye as A,be as B,Ie as C,Le as D,Ke as E,Ne as F,je as G,Xe as H,Ze as I,_e as J,tt as K,rt as L,nt as M,ut as N,st as O,ot as P,at as Q,it as R,pt as S,yt as T,lt as U,ct as V,Rt as W,ue as a,se as b,oe as c,pe as d,r as e,ce as f,Re as g,ve as h,de as i,xe as j,me as k,fe as l,Ce as m,we as n,Pe as o,ge as p,Te as q,ke as r,Me as s,Be as t,De as u,He as v,We as w,Fe as x,Oe as y,Ge as z};//# sourceMappingURL=chunk-BLZHGYNH.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-BLZHGYNH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/actions/gho.ts","../src/actions/incentives.ts","../src/actions/markets.ts","../src/actions/misc.ts","../src/actions/permits.ts","../src/actions/reserve.ts","../src/actions/transactions.ts","../src/actions/user.ts","../src/actions/vaults.ts"],"names":["savingsGhoBalance","client","request","SavingsGhoBalanceQuery","savingsGhoWithdraw","SavingsGhoWithdrawQuery","savingsGhoDeposit","SavingsGhoDepositQuery","userMeritRewards","UserMeritRewardsQuery","defaultMarketReservesRequestOrderBy","OrderDirection","markets","chainIds","borrowsOrderBy","suppliesOrderBy","user","MarketsQuery","market","address","chainId","MarketQuery","userMarketState","UserMarketStateQuery","health","HealthQuery","chains","filter","ChainsFilter","ChainsQuery","usdExchangeRates","UsdExchangeRatesQuery","hasProcessedKnownTransaction","HasProcessedKnownTransactionQuery","healthFactorPreview","HealthFactorPreviewQuery","permitTypedData","PermitTypedDataQuery","reserve","ReserveQuery","borrowAPYHistory","BorrowAPYHistoryQuery","supplyAPYHistory","SupplyAPYHistoryQuery","borrow","BorrowQuery","supply","SupplyQuery","repay","RepayQuery","withdraw","WithdrawQuery","userSetEmode","UserSetEmodeQuery","vaultDeposit","VaultDepositQuery","vaultRedeemShares","VaultRedeemSharesQuery","vaultDeploy","VaultDeployQuery","vaultSetFee","VaultSetFeeQuery","vaultWithdrawFees","VaultWithdrawFeesQuery","vaultWithdraw","VaultWithdrawQuery","vaultMintShares","VaultMintSharesQuery","collateralToggle","CollateralToggleQuery","liquidate","LiquidateQuery","approveBorrowCreditDelegation","ApproveBorrowCreditDelegationQuery","creditDelegateeAllowance","CreditDelegateeAllowanceQuery","userSupplies","UserSuppliesQuery","userBorrows","UserBorrowsQuery","userTransactionHistory","UserTransactionHistoryQuery","vault","VaultQuery","vaults","VaultsQuery","userVaults","UserVaultsQuery","vaultPreviewDeposit","VaultPreviewDepositQuery","vaultPreviewMint","VaultPreviewMintQuery","vaultPreviewWithdraw","VaultPreviewWithdrawQuery","vaultPreviewRedeem","VaultPreviewRedeemQuery","vaultUserTransactionHistory","VaultUserTransactionHistoryQuery","vaultUserActivity","VaultUserActivityQuery","vaultTransferOwnership","vaultTransferOwnershipQuery","vaultCreateRecipientsConfiguration","vaultCreateRecipientsConfigurationQuery","vaultRecipientConfiguration","vaultRecipientConfigurationQuery","vaultSetRecipientsConfiguration","vaultSetRecipientsConfigurationQuery"],"mappings":"qjCA2BO,SAASA,EAAAA,CACdC,CAAAA,CACAC,CAAAA,CAC2C,CAC3C,OAAOD,CAAAA,CAAO,KAAA,CAAME,sBAAAA,CAAwB,CAAE,OAAA,CAAAD,CAAQ,CAAC,CACzD,CAyBO,SAASE,EAAAA,CACdH,CAAAA,CACAC,EAC6C,CAC7C,OAAOD,CAAAA,CAAO,KAAA,CAAMI,uBAAAA,CAAyB,CAAE,QAAAH,CAAQ,CAAC,CAC1D,CAyBO,SAASI,EAAAA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2C,CAC3C,OAAOD,CAAAA,CAAO,MAAM8F,uBAAAA,CAAyB,CAC3C,OAAA,CAAA7F,CACF,CAAC,CACH,CA4BO,SAAS8F,EAAAA,CACd/F,CAAAA,CACAC,CAAAA,CAC0E,CAC1E,OAAOD,EAAO,KAAA,CAAMgG,gCAAAA,CAAkC,CACpD,OAAA,CAAA/F,CACF,CAAC,CACH,CA2BO,SAASgG,EAAAA,CACdjG,CAAAA,CACAC,CAAAA,CACuD,CACvD,OAAOD,CAAAA,CAAO,KAAA,CAAMkG,sBAAAA,CAAwB,CAC1C,OAAA,CAAAjG,CACF,CAAC,CACH,CAiBO,SAASkG,EAAAA,CACdnG,CAAAA,CACAC,CAAAA,CACkD,CAClD,OAAOD,CAAAA,CAAO,KAAA,CAAMoG,2BAAAA,CAA6B,CAC/C,OAAA,CAAAnG,CACF,CAAC,CACH,CAKO,SAASoG,EAAAA,CACdrG,CAAAA,CACAC,EACkD,CAClD,OAAOD,CAAAA,CAAO,KAAA,CAAMsG,uCAAAA,CAAyC,CAC3D,QAAArG,CACF,CAAC,CACH,CAKO,SAASsG,EAAAA,CACdvG,EACAC,CAAAA,CACuE,CACvE,OAAOD,CAAAA,CAAO,KAAA,CAAMwG,gCAAAA,CAAkC,CACpD,OAAA,CAAAvG,CACF,CAAC,CACH,CAKO,SAASwG,GACdzG,CAAAA,CACAC,CAAAA,CACkD,CAClD,OAAOD,CAAAA,CAAO,KAAA,CAAM0G,qCAAsC,CACxD,OAAA,CAAAzG,CACF,CAAC,CACH","file":"chunk-BLZHGYNH.js","sourcesContent":["import type { UnexpectedError } from '@aave/core';\nimport {\n type ExecutionPlan,\n SavingsGhoBalanceQuery,\n type SavingsGhoBalanceRequest,\n SavingsGhoDepositQuery,\n type SavingsGhoDepositRequest,\n SavingsGhoWithdrawQuery,\n type SavingsGhoWithdrawRequest,\n type TokenAmount,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Fetches the current sGHO balance for a user.\n *\n * ```ts\n * const result = await savingsGhoBalance(client, {\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The sGHO balance request parameters.\n * @returns The user's sGHO balance.\n */\nexport function savingsGhoBalance(\n client: AaveClient,\n request: SavingsGhoBalanceRequest,\n): ResultAsync<TokenAmount, UnexpectedError> {\n return client.query(SavingsGhoBalanceQuery, { request });\n}\n\n/**\n * Creates a transaction to withdraw sGHO.\n *\n * ```ts\n * const result = await savingsGhoWithdraw(client, {\n * amount: {\n * exact: '1000',\n * },\n * sharesOwner: evmAddress('0x9abc…'),\n * }).andThen(sendWith(wallet))\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The sGHO withdraw request parameters.\n * @returns The transaction request data to withdraw sGHO.\n */\nexport function savingsGhoWithdraw(\n client: AaveClient,\n request: SavingsGhoWithdrawRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(SavingsGhoWithdrawQuery, { request });\n}\n\n/**\n * Creates a transaction to deposit GHO into sGHO.\n *\n * ```ts\n * const result = await savingsGhoDeposit(client, {\n * amount: {\n * value: '1000',\n * },\n * depositor: evmAddress('0x9abc…'),\n * }).andThen(sendWith(wallet))\n *\n * if (result.isErr()) {\n * // Handle error, e.g. insufficient balance, signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The sGHO deposit request parameters.\n * @returns The transaction data, approval requirements, or insufficient balance error.\n */\nexport function savingsGhoDeposit(\n client: AaveClient,\n request: SavingsGhoDepositRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(SavingsGhoDepositQuery, { request });\n}\n","import {\n UserMeritRewardsQuery,\n type UserMeritRewardsRequest,\n} from '@aave/graphql';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Fetches Merit rewards for a user with the transaction request to claim them.\n *\n * ```ts\n * const result = await userMeritRewards(client, {\n * user: evmAddress('0x742d35cc…'),\n * chainId: chainId(1),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The merit claim rewards request parameters.\n * @returns The rewards with the transaction request.\n */\nexport function userMeritRewards(\n client: AaveClient,\n request: UserMeritRewardsRequest,\n) {\n return client.query(UserMeritRewardsQuery, { request });\n}\n","import type { UnexpectedError } from '@aave/core';\nimport {\n type Market,\n MarketQuery,\n type MarketReservesRequestOrderBy,\n MarketsQuery,\n type MarketUserState,\n OrderDirection,\n UserMarketStateQuery,\n type UserMarketStateRequest,\n} from '@aave/graphql';\nimport type { ChainId, EvmAddress, ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\nexport const defaultMarketReservesRequestOrderBy: MarketReservesRequestOrderBy =\n {\n tokenName: OrderDirection.Asc,\n };\n\nexport type MarketsRequest = {\n /**\n * The markets you want to see based on the chain ids.\n */\n chainIds: ChainId[];\n /**\n * The user viewing the market (e.g., the connected wallet).\n *\n * If not provided, user fields will not be included.\n */\n user?: EvmAddress;\n /**\n * The order by clause for the borrow reserves in the market.\n *\n * @defaultValue { tokenName: OrderDirection.Asc }\n */\n borrowsOrderBy?: MarketReservesRequestOrderBy;\n /**\n * The order by clause for the supply reserves in the market.\n *\n * @defaultValue { tokenName: OrderDirection.Asc }\n */\n suppliesOrderBy?: MarketReservesRequestOrderBy;\n};\n\n/**\n * Fetches all markets for the specified chain IDs.\n *\n * ```ts\n * const result = await markets(client, {\n * chainIds: [chainId(1), chainId(8453)],\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The markets request parameters.\n * @returns The list of markets.\n */\nexport function markets(\n client: AaveClient,\n {\n chainIds,\n borrowsOrderBy = defaultMarketReservesRequestOrderBy,\n suppliesOrderBy = defaultMarketReservesRequestOrderBy,\n user,\n }: MarketsRequest,\n): ResultAsync<Market[], UnexpectedError> {\n return client.query(MarketsQuery, {\n request: { chainIds, user },\n borrowsOrderBy,\n suppliesOrderBy,\n });\n}\n\nexport type MarketRequest = {\n /**\n * The pool address for the market.\n */\n address: EvmAddress;\n\n /**\n * The chain id the market pool address is deployed on.\n */\n chainId: ChainId;\n /**\n * The user viewing the market (e.g., the connected wallet).\n *\n * If not provided, user fields will not be included.\n */\n user?: EvmAddress;\n /**\n * The order by clause for the borrow reserves in the market.\n *\n * @defaultValue { tokenName: OrderDirection.Asc }\n */\n borrowsOrderBy?: MarketReservesRequestOrderBy;\n /**\n * The order by clause for the supply reserves in the market.\n *\n * @defaultValue { tokenName: OrderDirection.Asc }\n */\n suppliesOrderBy?: MarketReservesRequestOrderBy;\n};\n\n/**\n * Fetches a specific market by address and chain ID.\n *\n * ```ts\n * const result = await market(client, {\n * address: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),\n * chainId: chainId(1),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The market request parameters.\n * @returns The market data, or null if not found.\n */\nexport function market(\n client: AaveClient,\n {\n address,\n chainId,\n user,\n borrowsOrderBy = defaultMarketReservesRequestOrderBy,\n suppliesOrderBy = defaultMarketReservesRequestOrderBy,\n }: MarketRequest,\n): ResultAsync<Market | null, UnexpectedError> {\n return client.query(MarketQuery, {\n request: { address, chainId, user },\n borrowsOrderBy,\n suppliesOrderBy,\n });\n}\n\n/**\n * Fetches user account market data across all reserves.\n *\n * ```ts\n * const result = await userMarketState(client, {\n * market: evmAddress('0x1234…'),\n * user: evmAddress('0x5678…'),\n * chainId: chainId(1)\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The user market state request parameters.\n * @returns The user's market state.\n */\nexport function userMarketState(\n client: AaveClient,\n request: UserMarketStateRequest,\n): ResultAsync<MarketUserState, UnexpectedError> {\n return client.query(UserMarketStateQuery, { request });\n}\n","import type { UnexpectedError } from '@aave/core';\nimport {\n type Chain,\n ChainsFilter,\n ChainsQuery,\n HasProcessedKnownTransactionQuery,\n type HasProcessedKnownTransactionRequest,\n HealthFactorPreviewQuery,\n type HealthFactorPreviewRequest,\n type HealthFactorPreviewResponse,\n HealthQuery,\n type UsdExchangeRate,\n UsdExchangeRatesQuery,\n type UsdExchangeRatesRequest,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Health check query.\n *\n * ```ts\n * const result = await health(client);\n * ```\n *\n * @param client - Aave client.\n * @returns True or false\n */\nexport function health(\n client: AaveClient,\n): ResultAsync<boolean, UnexpectedError> {\n return client.query(HealthQuery, {});\n}\n\n/**\n * Fetches the list of supported chains.\n *\n * ```ts\n * const result = await chains(client, ChainsFilter.MAINNET_ONLY);\n * ```\n *\n * @param client - Aave client.\n * @param filter - The filter for the chains.\n * @returns The list of supported chains.\n */\nexport function chains(\n client: AaveClient,\n filter: ChainsFilter = ChainsFilter.ALL,\n): ResultAsync<Chain[], UnexpectedError> {\n return client.query(ChainsQuery, { filter });\n}\n\n/**\n * Fetches USD exchange rates for different tokens on a given market.\n *\n * ```ts\n * const result = await usdExchangeRates(client, {\n * market: evmAddress('0x1234…'),\n * underlyingTokens: [evmAddress('0x5678…'), evmAddress('0x90ab…')],\n * chainId: chainId(1),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The USD exchange rates request parameters.\n * @returns The list of USD exchange rates.\n */\nexport function usdExchangeRates(\n client: AaveClient,\n request: UsdExchangeRatesRequest,\n): ResultAsync<UsdExchangeRate[], UnexpectedError> {\n return client.query(UsdExchangeRatesQuery, { request });\n}\n\n/**\n * Checks if the API has processed a known transaction hash.\n *\n * This is useful to know when cached data has been invalidated after\n * a transaction is complete, as the API uses caching and has an\n * invalidation task that may take 100-200ms longer.\n *\n * ```ts\n * const result = await borrow(client, request)\n * .andThen(sendWith(wallet))\n * .andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error\n * return;\n * }\n *\n * // Check if the transaction has been processed by the API\n * const processed = await hasProcessedKnownTransaction(client, {\n * txHash: result.value,\n * operation: OperationType.Borrow\n * });\n *\n * if (processed.isErr()) {\n * // Handle error\n * return;\n * }\n *\n * if (processed.value) {\n * // Transaction processed, cached data is up to date\n * console.log('Transaction processed, data is fresh');\n * } else {\n * // Transaction not yet processed, may need to wait\n * console.log('Transaction not yet processed');\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The request containing transaction hash and operation type to check.\n * @returns True if the transaction has been processed, false otherwise.\n */\nexport function hasProcessedKnownTransaction(\n client: AaveClient,\n request: HasProcessedKnownTransactionRequest,\n): ResultAsync<boolean, UnexpectedError> {\n return client.query(HasProcessedKnownTransactionQuery, { request });\n}\n\n/**\n * Fetches health factor preview for a given market action.\n *\n * ```ts\n * const result = await healthFactorPreview(client, {\n * action: {\n * borrow: {\n * market: market.address,\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * borrower: evmAddress('0x9abc…'),\n * chainId: market.chain.chainId,\n * },\n * },\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The health factor preview request parameters.\n * @returns The health factor preview response with before and after values.\n */\nexport function healthFactorPreview(\n client: AaveClient,\n request: HealthFactorPreviewRequest,\n): ResultAsync<HealthFactorPreviewResponse, UnexpectedError> {\n return client.query(HealthFactorPreviewQuery, { request });\n}\n","import type { UnexpectedError } from '@aave/core';\nimport {\n PermitTypedDataQuery,\n type PermitTypedDataRequest,\n type PermitTypedDataResponse,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Generates EIP-712 typed data for ERC-20 permit signature.\n *\n * ```ts\n * const result = await permitTypedData(client, {\n * market: evmAddress('0x87870bca...'),\n * underlyingToken: evmAddress('0xa0b86a33...'),\n * amount: '1.5',\n * chainId: chainId(1),\n * spender: evmAddress('0x123...'),\n * owner: evmAddress('0x456...'),\n * });\n *\n * if (result.isOk()) {\n * const typedData = result.value;\n * // Use typedData for permit signing\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The permit typed data request parameters.\n * @returns The EIP-712 typed data for permit signature.\n */\nexport function permitTypedData(\n client: AaveClient,\n request: PermitTypedDataRequest,\n): ResultAsync<PermitTypedDataResponse, UnexpectedError> {\n return client.query(PermitTypedDataQuery, { request });\n}\n","import type { UnexpectedError } from '@aave/core';\nimport {\n type APYSample,\n BorrowAPYHistoryQuery,\n type BorrowAPYHistoryRequest,\n type Reserve,\n ReserveQuery,\n type ReserveRequest,\n SupplyAPYHistoryQuery,\n type SupplyAPYHistoryRequest,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Fetches a specific reserve by market address, token address, and chain ID.\n *\n * ```ts\n * const result = await reserve(client, {\n * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),\n * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),\n * chainId: chainId(1),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The reserve request parameters.\n * @returns The reserve data, or null if not found.\n */\nexport function reserve(\n client: AaveClient,\n request: ReserveRequest,\n): ResultAsync<Reserve | null, UnexpectedError> {\n return client.query(ReserveQuery, {\n request,\n });\n}\n\n/**\n * Fetches historical borrow APY data for a given underlying asset on a specific market,\n * within a defined time window.\n *\n * The returned data represents APY samples over time, or `null` if unavailable.\n *\n * @param client - The Aave client instance used to perform the query.\n * @param request - The borrow APY history request parameters.\n * @returns A `ResultAsync` containing an array of APY samples, or `null` if not found.\n */\n\nexport function borrowAPYHistory(\n client: AaveClient,\n request: BorrowAPYHistoryRequest,\n): ResultAsync<APYSample[] | null, UnexpectedError> {\n return client.query(BorrowAPYHistoryQuery, {\n request,\n });\n}\n\n/**\n * Fetches historical supply APY data for a given underlying asset on a specific market,\n * within a defined time window.\n *\n * The returned data represents APY samples over time, or `null` if unavailable.\n *\n * @param client - The Aave client instance used to perform the query.\n * @param request - The supply APY history request parameters.\n * @returns A `ResultAsync` containing an array of APY samples, or `null` if not found.\n */\n\nexport function supplyAPYHistory(\n client: AaveClient,\n request: SupplyAPYHistoryRequest,\n): ResultAsync<APYSample[] | null, UnexpectedError> {\n return client.query(SupplyAPYHistoryQuery, {\n request,\n });\n}\n","import type { UnexpectedError } from '@aave/core';\nimport {\n ApproveBorrowCreditDelegationQuery,\n type ApproveBorrowCreditDelegatorRequest,\n BorrowQuery,\n type BorrowRequest,\n CollateralToggleQuery,\n type CollateralToggleRequest,\n CreditDelegateeAllowanceQuery,\n type CreditDelegateeAmountRequest,\n type ExecutionPlan,\n LiquidateQuery,\n type LiquidateRequest,\n RepayQuery,\n type RepayRequest,\n SupplyQuery,\n type SupplyRequest,\n type TokenAmount,\n type TransactionRequest,\n UserSetEmodeQuery,\n type UserSetEmodeRequest,\n VaultDeployQuery,\n type VaultDeployRequest,\n VaultDepositQuery,\n type VaultDepositRequest,\n VaultMintSharesQuery,\n type VaultMintSharesRequest,\n VaultRedeemSharesQuery,\n type VaultRedeemSharesRequest,\n VaultSetFeeQuery,\n type VaultSetFeeRequest,\n VaultWithdrawFeesQuery,\n type VaultWithdrawFeesRequest,\n VaultWithdrawQuery,\n type VaultWithdrawRequest,\n WithdrawQuery,\n type WithdrawRequest,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Creates a transaction to borrow from a market.\n *\n * ```ts\n * const result = await borrow(client, {\n * market: market.address,\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * borrower: evmAddress('0x9abc…'),\n * chainId: market.chain.chainId,\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The borrow request parameters.\n * @returns The transaction data, approval requirements, or insufficient balance error.\n */\nexport function borrow(\n client: AaveClient,\n request: BorrowRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(BorrowQuery, { request });\n}\n\n/**\n * Creates a transaction to supply to a market.\n *\n * ```ts\n * const result = await supply(client, {\n * market: market.address,\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * chainId: market.chain.chainId,\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. insufficient balance, signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The supply request parameters.\n * @returns The transaction data, approval requirements, or insufficient balance error.\n */\nexport function supply(\n client: AaveClient,\n request: SupplyRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(SupplyQuery, { request });\n}\n\n/**\n * Creates a transaction to repay to a market.\n *\n * ```ts\n * const result = await repay(client, {\n * market: market.address,\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: {\n * exact: '500',\n * },\n * },\n * },\n * borrower: evmAddress('0x9abc…'),\n * chainId: market.chain.chainId,\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. insufficient balance, signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The repay request parameters.\n * @returns The transaction data, approval requirements, or insufficient balance error.\n */\nexport function repay(\n client: AaveClient,\n request: RepayRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(RepayQuery, { request });\n}\n\n/**\n * Creates a transaction to withdraw from a market.\n *\n * ```ts\n * const result = await withdraw(client, {\n * market: market.address,\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: { exact: '750' },\n * },\n * },\n * supplier: evmAddress('0x9abc…'),\n * chainId: market.chain.chainId,\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. insufficient balance, signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The withdraw request parameters.\n * @returns The transaction data, approval requirements, or insufficient balance error.\n */\nexport function withdraw(\n client: AaveClient,\n request: WithdrawRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(WithdrawQuery, { request });\n}\n\n/**\n * Creates a transaction to enable/disable the user's eMode for a market.\n *\n * **Example: Enable a Specific eMode**\n * ```ts\n * const result = await userSetEmode(client, {\n * market: market.address,\n * user: evmAddress('0x5678…'),\n * categoryId: market.eModeCategories[0].id,\n * chainId: market.chain.chainId,\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * **Example: Disable eMode**\n * ```ts\n * const result = await userSetEmode(client, {\n * market: market.address,\n * user: evmAddress('0x5678…'),\n * categoryId: null,\n * chainId: market.chain.chainId,\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The user set eMode request parameters.\n * @returns The transaction request data to set eMode.\n */\nexport function userSetEmode(\n client: AaveClient,\n request: UserSetEmodeRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(UserSetEmodeQuery, { request });\n}\n\n/**\n * Creates a transaction to deposit assets into a vault and mint shares.\n *\n * ```ts\n * const result = await vaultDeposit(client, {\n * vault: evmAddress('0x1234…'),\n * amount: {\n * value: '1000',\n * },\n * depositor: evmAddress('0x9abc…'),\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. insufficient balance, signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault deposit request parameters.\n * @returns The transaction data, approval requirements, or insufficient balance error.\n */\nexport function vaultDeposit(\n client: AaveClient,\n request: VaultDepositRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(VaultDepositQuery, { request });\n}\n\n/**\n * Creates a transaction to redeem vault shares for underlying assets.\n *\n * ```ts\n * const result = await vaultRedeemShares(client, {\n * vault: evmAddress('0x1234…'),\n * shares: {\n * amount: '500',\n * asAToken: false,\n * },\n * sharesOwner: evmAddress('0x9abc…'),\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The redeem vault shares request parameters.\n * @returns The transaction request data to redeem shares.\n */\nexport function vaultRedeemShares(\n client: AaveClient,\n request: VaultRedeemSharesRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(VaultRedeemSharesQuery, { request });\n}\n\n/**\n * Creates an execution plan to deploy a new vault.\n *\n * ```ts\n * const result = await vaultDeploy(client, {\n * underlyingToken: evmAddress('0x1234…'),\n * market: evmAddress('0x5678…'),\n * deployer: evmAddress('0x9abc…'),\n * initialFee: '0.1',\n * shareName: 'Aave Vault Shares',\n * shareSymbol: 'avs',\n * initialLockDeposit: '1000',\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, insufficient balance, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The deploy vault request parameters.\n * @returns The execution plan data to deploy a vault. May require approval transactions.\n */\nexport function vaultDeploy(\n client: AaveClient,\n request: VaultDeployRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(VaultDeployQuery, { request });\n}\n\n/**\n * Creates a transaction to set the vault fee (owner only).\n *\n * ```ts\n * const result = await vaultSetFee(client, {\n * vault: evmAddress('0x1234…'),\n * newFee: '0.2',\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The set vault fee request parameters.\n * @returns The transaction request data to set vault fee.\n */\nexport function vaultSetFee(\n client: AaveClient,\n request: VaultSetFeeRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(VaultSetFeeQuery, { request });\n}\n\n/**\n * Creates a transaction to withdraw accumulated fees from a vault (owner only).\n *\n * ```ts\n * const result = await vaultWithdrawFees(client, {\n * vault: evmAddress('0x1234…'),\n * amount: '100',\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The withdraw vault fees request parameters.\n * @returns The transaction request data to withdraw vault fees.\n */\nexport function vaultWithdrawFees(\n client: AaveClient,\n request: VaultWithdrawFeesRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(VaultWithdrawFeesQuery, { request });\n}\n\n/**\n * Creates a transaction to withdraw assets from a vault, burning shares.\n *\n * ```ts\n * const result = await vaultWithdraw(client, {\n * vault: evmAddress('0x1234…'),\n * amount: {\n * value: '500',\n * },\n * sharesOwner: evmAddress('0x9abc…'),\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The withdraw vault request parameters.\n * @returns The transaction request data to withdraw from vault.\n */\nexport function vaultWithdraw(\n client: AaveClient,\n request: VaultWithdrawRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(VaultWithdrawQuery, { request });\n}\n\n/**\n * Creates a transaction to mint exact amount of vault shares by depositing calculated assets.\n *\n * ```ts\n * const result = await vaultMintShares(client, {\n * vault: evmAddress('0x1234…'),\n * shares: {\n * amount: '1000',\n * asAToken: false,\n * },\n * minter: evmAddress('0x9abc…'),\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. insufficient balance, signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The mint vault shares request parameters.\n * @returns The transaction data, approval requirements, or insufficient balance error.\n */\nexport function vaultMintShares(\n client: AaveClient,\n request: VaultMintSharesRequest,\n): ResultAsync<ExecutionPlan, UnexpectedError> {\n return client.query(VaultMintSharesQuery, { request });\n}\n\n/**\n * Creates a transaction to enable/disable a specific supplied asset as collateral.\n *\n * ```ts\n * const result = await collateralToggle(client, {\n * market: market.address,\n * underlyingToken: market.supplyReserves[n].underlyingToken.address,\n * user: evmAddress('0x9abc…'),\n * chainId: market.chain.chainId,\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The collateral toggle request parameters.\n * @returns The transaction request data to toggle collateral.\n */\nexport function collateralToggle(\n client: AaveClient,\n request: CollateralToggleRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(CollateralToggleQuery, { request });\n}\n\n/**\n * Creates a transaction to liquidate a non-healthy position with Health Factor below 1.\n *\n * ```ts\n * const result = await liquidate(client, {\n * collateralToken: evmAddress('0x1234…'),\n * debtToken: evmAddress('0x5678…'),\n * user: evmAddress('0x9abc…'),\n * debtToCover: { max: true },\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The liquidate request parameters.\n * @returns The transaction request data to liquidate position.\n */\nexport function liquidate(\n client: AaveClient,\n request: LiquidateRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(LiquidateQuery, { request });\n}\n\n/**\n * Creates a transaction to approve a credit borrow delegator to be able to borrow on your behalf.\n *\n * ```ts\n * const result = await approveBorrowCreditDelegation(client, {\n * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),\n * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),\n * amount: '1000',\n * user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),\n * delegatee: evmAddress('0x5678…'),\n * chainId: chainId(1),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error, e.g. signing error, etc.\n * return;\n * }\n *\n * // result.value: TxHash\n * ```\n *\n * @param client - Aave client.\n * @param request - The approve borrow credit delegation request parameters.\n * @returns The transaction request data to approve credit delegation.\n */\nexport function approveBorrowCreditDelegation(\n client: AaveClient,\n request: ApproveBorrowCreditDelegatorRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(ApproveBorrowCreditDelegationQuery, { request });\n}\n\n/**\n * Gets the amount delegated to the credit delegatee that can borrow on your behalf.\n *\n * ```ts\n * const result = await creditDelegateeAllowance(client, {\n * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),\n * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),\n * user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),\n * delegatee: evmAddress('0x5678…'),\n * chainId: chainId(1),\n * });\n *\n * if (result.isErr()) {\n * // Handle error\n * return;\n * }\n *\n * // result.value: TokenAmount with credit delegation allowance\n * ```\n *\n * @param client - Aave client.\n * @param request - The credit delegatee allowance request parameters.\n * @returns The token amount representing the credit delegation allowance.\n */\nexport function creditDelegateeAllowance(\n client: AaveClient,\n request: CreditDelegateeAmountRequest,\n): ResultAsync<TokenAmount, UnexpectedError> {\n return client.query(CreditDelegateeAllowanceQuery, { request });\n}\n","import type { UnexpectedError } from '@aave/core';\nimport {\n type MarketUserReserveBorrowPosition,\n type MarketUserReserveSupplyPosition,\n type PaginatedUserTransactionHistoryResult,\n UserBorrowsQuery,\n type UserBorrowsRequest,\n UserSuppliesQuery,\n type UserSuppliesRequest,\n UserTransactionHistoryQuery,\n type UserTransactionHistoryRequest,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Fetches all user supply positions across the specified markets.\n *\n * ```ts\n * const result = await userSupplies(client, {\n * markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The user supplies request parameters.\n * @returns The user's supply positions.\n */\nexport function userSupplies(\n client: AaveClient,\n request: UserSuppliesRequest,\n): ResultAsync<MarketUserReserveSupplyPosition[], UnexpectedError> {\n return client.query(UserSuppliesQuery, { request });\n}\n\n/**\n * Fetches all user borrow positions.\n *\n * ```ts\n * const result = await userBorrows(client, {\n * markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The user borrows request parameters.\n * @returns The user's borrow positions.\n */\nexport function userBorrows(\n client: AaveClient,\n request: UserBorrowsRequest,\n): ResultAsync<MarketUserReserveBorrowPosition[], UnexpectedError> {\n return client.query(UserBorrowsQuery, { request });\n}\n\n/**\n * Fetches the user's transaction history for a given market.\n *\n * ```ts\n * const result = await userTransactionHistory(client, {\n * chainId: chainId(1),\n * market: evmAddress('0x87870bca…'),\n * user: evmAddress('0x742d35cc…'),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The user transaction history request parameters.\n * @returns The user's paginated transaction history.\n */\nexport function userTransactionHistory(\n client: AaveClient,\n request: UserTransactionHistoryRequest,\n): ResultAsync<PaginatedUserTransactionHistoryResult, UnexpectedError> {\n return client.query(UserTransactionHistoryQuery, { request });\n}\n","import type { UnexpectedError } from '@aave/core';\nimport {\n type PaginatedVaultsResult,\n type PaginatedVaultUserTransactionHistoryResult,\n type TokenAmount,\n type TransactionRequest,\n UserVaultsQuery,\n type UserVaultsRequest,\n type Vault,\n type VaultCreateRecipientsConfigurationRequest,\n type VaultFeesRecipientsConfiguration,\n VaultPreviewDepositQuery,\n type VaultPreviewDepositRequest,\n VaultPreviewMintQuery,\n type VaultPreviewMintRequest,\n VaultPreviewRedeemQuery,\n type VaultPreviewRedeemRequest,\n VaultPreviewWithdrawQuery,\n type VaultPreviewWithdrawRequest,\n VaultQuery,\n type VaultRecipientConfigurationRequest,\n type VaultRequest,\n type VaultSetRecipientsConfigurationRequest,\n VaultsQuery,\n type VaultsRequest,\n type VaultTransferOwnershipRequest,\n VaultUserActivityQuery,\n type VaultUserActivityRequest,\n type VaultUserActivityResult,\n VaultUserTransactionHistoryQuery,\n type VaultUserTransactionHistoryRequest,\n vaultCreateRecipientsConfigurationQuery,\n vaultRecipientConfigurationQuery,\n vaultSetRecipientsConfigurationQuery,\n vaultTransferOwnershipQuery,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Fetches a specific vault by address and chain ID.\n *\n * **Example: By Address**\n * ```ts\n * const result = await vault(client, {\n * by: {\n * address: evmAddress('0x1234…'),\n * },\n * chainId: chainId(1),\n * user: evmAddress('0x5678…'),\n * });\n * ```\n *\n * **Example: Tx Hash**\n * ```ts\n * const result = await vault(client, {\n * by: {\n * txHash: txHash('0x1234…'),\n * },\n * chainId: chainId(1),\n * user: evmAddress('0x5678…'),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault request parameters.\n * @returns The vault data, or null if not found.\n */\nexport function vault(\n client: AaveClient,\n request: VaultRequest,\n): ResultAsync<Vault | null, UnexpectedError> {\n return client.query(VaultQuery, {\n request,\n });\n}\n\n/**\n * Fetches vaults based on filter criteria.\n *\n * ```ts\n * const result = await vaults(client, {\n * criteria: {\n * ownedBy: [evmAddress('0x1234…')]\n * },\n * pageSize: PageSize.Ten,\n * user: evmAddress('0x5678…'),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The vaults request parameters.\n * @returns The paginated vaults result.\n */\nexport function vaults(\n client: AaveClient,\n request: VaultsRequest,\n): ResultAsync<PaginatedVaultsResult, UnexpectedError> {\n return client.query(VaultsQuery, {\n request,\n });\n}\n\n/**\n * Fetches vaults that a user has shares in.\n *\n * ```ts\n * const result = await userVaults(client, {\n * user: evmAddress('0x1234…'),\n * filters: {\n * markets: [evmAddress('0x5678…')]\n * },\n * orderBy: { shares: OrderDirection.Desc },\n * pageSize: PageSize.Fifty,\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The user vaults request parameters.\n * @returns The paginated user vaults result.\n */\nexport function userVaults(\n client: AaveClient,\n request: UserVaultsRequest,\n): ResultAsync<PaginatedVaultsResult, UnexpectedError> {\n return client.query(UserVaultsQuery, {\n request,\n });\n}\n\n/**\n * Determines the amount of shares that would be received for a deposit.\n *\n * ```ts\n * const result = await vaultPreviewDeposit(client, {\n * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),\n * chainId: chainId(1),\n * amount: bigDecimal('1000'),\n * });\n *\n * if (result.isOk()) {\n * console.log('Shares to receive:', result.value.amount.value);\n * console.log('USD value:', result.value.usd);\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault preview deposit request parameters.\n * @returns The simulated shares amount that would be received.\n */\nexport function vaultPreviewDeposit(\n client: AaveClient,\n request: VaultPreviewDepositRequest,\n): ResultAsync<TokenAmount, UnexpectedError> {\n return client.query(VaultPreviewDepositQuery, {\n request,\n });\n}\n\n/**\n * Determines the amount of assets that would be required to mint a specific amount of vault shares.\n *\n * ```ts\n * const result = await vaultPreviewMint(client, {\n * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),\n * chainId: chainId(1),\n * amount: bigDecimal('500'),\n * });\n *\n * if (result.isOk()) {\n * console.log('Assets required:', result.value.amount.value);\n * console.log('USD value:', result.value.usd);\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault preview mint request parameters.\n * @returns The simulated assets amount that would be required.\n */\nexport function vaultPreviewMint(\n client: AaveClient,\n request: VaultPreviewMintRequest,\n): ResultAsync<TokenAmount, UnexpectedError> {\n return client.query(VaultPreviewMintQuery, {\n request,\n });\n}\n\n/**\n * Determines the amount of shares that would be burned for a withdrawal.\n *\n * ```ts\n * const result = await vaultPreviewWithdraw(client, {\n * vault: evmAddress('0x1234…'),\n * chainId: chainId(1),\n * amount: bigDecimal('750'),\n * });\n *\n * if (result.isOk()) {\n * console.log('Shares to burn:', result.value.amount.value);\n * console.log('USD value:', result.value.usd);\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault preview withdraw request parameters.\n * @returns The simulated shares amount that would be burned.\n */\nexport function vaultPreviewWithdraw(\n client: AaveClient,\n request: VaultPreviewWithdrawRequest,\n): ResultAsync<TokenAmount, UnexpectedError> {\n return client.query(VaultPreviewWithdrawQuery, {\n request,\n });\n}\n\n/**\n * Determines the amount of assets that would be received for redeeming a specific amount of vault shares.\n *\n * ```ts\n * const result = await vaultPreviewRedeem(client, {\n * vault: evmAddress('0x1234…'),\n * chainId: chainId(1),\n * amount: bigDecimal('200'),\n * });\n *\n * if (result.isOk()) {\n * console.log('Assets to receive:', result.value.amount.value);\n * console.log('USD value:', result.value.usd);\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault preview redeem request parameters.\n * @returns The simulated assets amount that would be received.\n */\nexport function vaultPreviewRedeem(\n client: AaveClient,\n request: VaultPreviewRedeemRequest,\n): ResultAsync<TokenAmount, UnexpectedError> {\n return client.query(VaultPreviewRedeemQuery, {\n request,\n });\n}\n\n/**\n * Fetches the user transaction history for a vault.\n *\n * ```ts\n * const result = await vaultUserTransactionHistory(client, {\n * vault: evmAddress('0x1234…'),\n * chainId: chainId(1),\n * user: evmAddress('0x5678…'),\n * });\n *\n * if (result.isOk()) {\n * console.log('Transaction count:', result.value.items.length);\n * result.value.items.forEach(tx => {\n * if (tx.__typename === 'VaultUserDepositItem') {\n * console.log('Deposit:', tx.asset.amount.value, 'shares:', tx.shares.amount.value);\n * } else if (tx.__typename === 'VaultUserWithdrawItem') {\n * console.log('Withdraw:', tx.asset.amount.value, 'shares:', tx.shares.amount.value);\n * }\n * });\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault user transaction history request parameters.\n * @returns The paginated vault user transaction history result.\n */\nexport function vaultUserTransactionHistory(\n client: AaveClient,\n request: VaultUserTransactionHistoryRequest,\n): ResultAsync<PaginatedVaultUserTransactionHistoryResult, UnexpectedError> {\n return client.query(VaultUserTransactionHistoryQuery, {\n request,\n });\n}\n\n/**\n * Fetches the user activity data for a vault, including earnings breakdown over time.\n *\n * ```ts\n * const result = await vaultUserActivity(client, {\n * vault: evmAddress('0x1234…'),\n * chainId: chainId(1),\n * user: evmAddress('0x5678…'),\n * });\n *\n * if (result.isOk()) {\n * console.log('Total earned:', result.value.earned.amount.value);\n * console.log('Activity breakdown count:', result.value.breakdown.length);\n * result.value.breakdown.forEach(activity => {\n * console.log('Date:', activity.date);\n * console.log('Balance:', activity.balance.amount.value);\n * console.log('Earned:', activity.earned.amount.value);\n * });\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault user activity request parameters.\n * @returns The vault user activity result.\n */\nexport function vaultUserActivity(\n client: AaveClient,\n request: VaultUserActivityRequest,\n): ResultAsync<VaultUserActivityResult, UnexpectedError> {\n return client.query(VaultUserActivityQuery, {\n request,\n });\n}\n\n/**\n * Creates a transaction to transfer ownership of a vault.\n *\n * ```ts\n * const result = await vaultTransferOwnership(client, {\n * vault: evmAddress('0x1234…'),\n * chainId: chainId(1),\n * newOwner: evmAddress('0x5678…'),\n * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);\n * ```\n *\n * @param client - Aave client.\n * @param request - The vault transfer ownership request parameters.\n * @returns The transaction data for transferring vault ownership.\n */\nexport function vaultTransferOwnership(\n client: AaveClient,\n request: VaultTransferOwnershipRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(vaultTransferOwnershipQuery, {\n request,\n });\n}\n\n/**\n * @internal\n */\nexport function vaultCreateRecipientsConfiguration(\n client: AaveClient,\n request: VaultCreateRecipientsConfigurationRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(vaultCreateRecipientsConfigurationQuery, {\n request,\n });\n}\n\n/**\n * @internal\n */\nexport function vaultRecipientConfiguration(\n client: AaveClient,\n request: VaultRecipientConfigurationRequest,\n): ResultAsync<VaultFeesRecipientsConfiguration | null, UnexpectedError> {\n return client.query(vaultRecipientConfigurationQuery, {\n request,\n });\n}\n\n/**\n * @internal\n */\nexport function vaultSetRecipientsConfiguration(\n client: AaveClient,\n request: VaultSetRecipientsConfigurationRequest,\n): ResultAsync<TransactionRequest, UnexpectedError> {\n return client.query(vaultSetRecipientsConfigurationQuery, {\n request,\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:true}):c,b));export{m as a,n as b};//# sourceMappingURL=chunk-FW4363Y4.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-FW4363Y4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-FW4363Y4.js"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {TransactionError,SigningError,ValidationError}from'@aave/core';import {chainId,ResultAsync,txHash,errAsync,okAsync,invariant,signatureFrom}from'@aave/types';import {defineChain}from'viem';import {waitForTransactionReceipt,signTypedData,sendTransaction}from'viem/actions';import {zksync,scroll,polygon,optimism,metis,linea,gnosis,celo,bsc,baseSepolia,base,avalanche,arbitrum,mainnet}from'viem/chains';var x=defineChain({id:146,name:"Sonic",nativeCurrency:{name:"Sonic",symbol:"S",decimals:18},rpcUrls:{default:{http:["https://sonicscan.org"]}},blockExplorers:{default:{name:"SonicScan",url:"https://sonicscan.org"}}}),R=defineChain({id:1868,name:"Soneium",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://soneium.blockscout.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://soneium.blockscout.com"}}}),j={[chainId(mainnet.id)]:mainnet,[chainId(arbitrum.id)]:arbitrum,[chainId(avalanche.id)]:avalanche,[chainId(base.id)]:base,[chainId(baseSepolia.id)]:baseSepolia,[chainId(bsc.id)]:bsc,[chainId(celo.id)]:celo,[chainId(gnosis.id)]:gnosis,[chainId(linea.id)]:linea,[chainId(metis.id)]:metis,[chainId(optimism.id)]:optimism,[chainId(polygon.id)]:polygon,[chainId(scroll.id)]:scroll,[chainId(zksync.id)]:zksync,[chainId(x.id)]:x,[chainId(R.id)]:R};async function $(a,n){return sendTransaction(a,{account:n.from,data:n.data,to:n.to,value:BigInt(n.value),chain:a.chain})}function F(a,n,e){let t=a?.blockExplorers?.default?.url,H=t&&`${t.replace(/\/+$/,"")}/tx/${n}`;return TransactionError.new({txHash:n,request:e,link:H})}function i(a,n){return ResultAsync.fromPromise($(a,n),e=>SigningError.from(e)).map(async e=>waitForTransactionReceipt(a,{hash:e,pollingInterval:100,retryCount:20,retryDelay:50})).andThen(e=>{let t=txHash(e.transactionHash);return e.status==="reverted"?errAsync(F(a.chain,t,n)):okAsync({txHash:t,operation:n.operation})})}function J(a){return n=>{switch(n.__typename){case "TransactionRequest":return i(a,n);case "ApprovalRequired":return i(a,n.approval).andThen(()=>i(a,n.originalTransaction));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}}function K(a){return n=>(invariant(a.account,"Wallet account is required"),ResultAsync.fromPromise(signTypedData(a,{account:a.account,domain:n.domain,types:n.types,primaryType:n.primaryType,message:n.message}),e=>SigningError.from(e)).map(e=>({deadline:n.message.deadline,value:signatureFrom(e)})))}
|
|
2
|
+
export{j as a,F as b,i as c,J as d,K as e};//# sourceMappingURL=chunk-QQSK6HIZ.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-QQSK6HIZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/viem.ts"],"names":["sonic","defineChain","soneium","supportedChains","chainId","mainnet","arbitrum","avalanche","base","baseSepolia","bsc","celo","gnosis","linea","metis","optimism","polygon","scroll","zksync","sendTransaction","walletClient","request","sendEip1559Transaction","transactionError","chain","txHash","baseUrl","link","TransactionError","sendTransactionAndWait","ResultAsync","err","SigningError","hash","waitForTransactionReceipt","receipt","errAsync","okAsync","sendWith","result","ValidationError","signERC20PermitWith","invariant","signTypedData","hex","signatureFrom"],"mappings":"wZAuDA,IAAMA,CAAAA,CAAeC,WAAAA,CAAY,CAC/B,EAAA,CAAI,GAAA,CACJ,IAAA,CAAM,OAAA,CACN,cAAA,CAAgB,CAAE,IAAA,CAAM,OAAA,CAAS,MAAA,CAAQ,GAAA,CAAK,QAAA,CAAU,EAAG,CAAA,CAC3D,OAAA,CAAS,CACP,OAAA,CAAS,CACP,IAAA,CAAM,CAAC,uBAAuB,CA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f,MAAOA,CAAAA,CAAO,KAAA,CACd,WAAA,CAAaA,CAAAA,CAAO,WAAA,CACpB,OAAA,CAASA,CAAAA,CAAO,OAClB,CAAC,CAAA,CACAR,CAAAA,EAAQC,YAAAA,CAAa,IAAA,CAAKD,CAAG,CAChC,CAAA,CAAE,GAAA,CAAKa,CAAAA,GAAS,CACd,QAAA,CAAUL,CAAAA,CAAO,OAAA,CAAQ,QAAA,CACzB,KAAA,CAAOM,aAAAA,CAAcD,CAAG,CAC1B,CAAA,CAAE,CAAA,CAEN","file":"chunk-QQSK6HIZ.js","sourcesContent":["import { SigningError, TransactionError, ValidationError } from '@aave/core';\nimport type {\n ExecutionPlan,\n InsufficientBalanceError,\n PermitTypedDataResponse,\n TransactionRequest,\n} from '@aave/graphql';\nimport {\n type ChainId,\n chainId,\n errAsync,\n invariant,\n okAsync,\n ResultAsync,\n signatureFrom,\n type TxHash,\n txHash,\n} from '@aave/types';\nimport {\n type Chain,\n defineChain,\n type Hash,\n type TypedData,\n type TypedDataDomain,\n type WalletClient,\n} from 'viem';\nimport {\n sendTransaction as sendEip1559Transaction,\n signTypedData,\n waitForTransactionReceipt,\n} from 'viem/actions';\n// chains.ts\nimport {\n arbitrum,\n avalanche,\n base,\n baseSepolia,\n bsc,\n celo,\n gnosis,\n linea,\n mainnet,\n metis,\n optimism,\n polygon,\n scroll,\n zksync,\n} from 'viem/chains';\nimport type {\n ExecutionPlanHandler,\n PermitHandler,\n TransactionExecutionResult,\n} from './types';\n\n// Other chains\nconst sonic: Chain = defineChain({\n id: 146,\n name: 'Sonic',\n nativeCurrency: { name: 'Sonic', symbol: 'S', decimals: 18 },\n rpcUrls: {\n default: {\n http: ['https://sonicscan.org'], // Replace with actual RPC URL if needed\n },\n },\n blockExplorers: {\n default: {\n name: 'SonicScan',\n url: 'https://sonicscan.org',\n },\n },\n});\n\nconst soneium: Chain = defineChain({\n id: 1868,\n name: 'Soneium',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n rpcUrls: {\n default: {\n http: ['https://soneium.blockscout.com'], // Replace with actual RPC URL if needed\n },\n },\n blockExplorers: {\n default: {\n name: 'Blockscout',\n url: 'https://soneium.blockscout.com',\n },\n },\n});\n\n/**\n * @internal\n */\nexport const supportedChains: Record<\n ChainId,\n ReturnType<typeof defineChain>\n> = {\n [chainId(mainnet.id)]: mainnet,\n [chainId(arbitrum.id)]: arbitrum,\n [chainId(avalanche.id)]: avalanche,\n [chainId(base.id)]: base,\n [chainId(baseSepolia.id)]: baseSepolia,\n [chainId(bsc.id)]: bsc,\n [chainId(celo.id)]: celo,\n [chainId(gnosis.id)]: gnosis,\n [chainId(linea.id)]: linea,\n [chainId(metis.id)]: metis,\n [chainId(optimism.id)]: optimism,\n [chainId(polygon.id)]: polygon,\n [chainId(scroll.id)]: scroll,\n [chainId(zksync.id)]: zksync,\n [chainId(sonic.id)]: sonic,\n [chainId(soneium.id)]: soneium,\n};\n\nasync function sendTransaction(\n walletClient: WalletClient,\n request: TransactionRequest,\n): Promise<Hash> {\n return sendEip1559Transaction(walletClient, {\n account: request.from,\n data: request.data,\n to: request.to,\n value: BigInt(request.value),\n chain: walletClient.chain,\n });\n}\n\n/**\n * @internal\n */\nexport function transactionError(\n chain: Chain | undefined,\n txHash: TxHash,\n request: TransactionRequest,\n): TransactionError {\n const baseUrl = chain?.blockExplorers?.default?.url;\n const link = baseUrl && `${baseUrl.replace(/\\/+$/, '')}/tx/${txHash}`;\n\n return TransactionError.new({ txHash, request, link });\n}\n\n/**\n * @internal\n */\nexport function sendTransactionAndWait(\n walletClient: WalletClient,\n request: TransactionRequest,\n): ResultAsync<TransactionExecutionResult, SigningError | TransactionError> {\n // TODO: verify it's on the correct chain, ask to switch if possible\n // TODO: verify if wallet account is correct, switch if possible\n\n return ResultAsync.fromPromise(\n sendTransaction(walletClient, request),\n (err) => SigningError.from(err),\n )\n .map(async (hash) =>\n waitForTransactionReceipt(walletClient, {\n hash,\n pollingInterval: 100,\n retryCount: 20,\n retryDelay: 50,\n }),\n )\n .andThen((receipt) => {\n const hash = txHash(receipt.transactionHash);\n\n if (receipt.status === 'reverted') {\n return errAsync(transactionError(walletClient.chain, hash, request));\n }\n return okAsync({\n txHash: hash,\n operation: request.operation,\n });\n });\n}\n\n/**\n * Sends transactions using the provided wallet client.\n *\n * Handles {@link TransactionRequest} by signing and sending, {@link ApprovalRequired} by sending both approval and original transactions, and returns validation errors for {@link InsufficientBalanceError}.\n */\nexport function sendWith(walletClient: WalletClient): ExecutionPlanHandler {\n return (\n result: ExecutionPlan,\n ): ResultAsync<\n TransactionExecutionResult,\n SigningError | TransactionError | ValidationError<InsufficientBalanceError>\n > => {\n switch (result.__typename) {\n case 'TransactionRequest':\n return sendTransactionAndWait(walletClient, result);\n\n case 'ApprovalRequired':\n return sendTransactionAndWait(walletClient, result.approval).andThen(\n () =>\n sendTransactionAndWait(walletClient, result.originalTransaction),\n );\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(result));\n }\n };\n}\n\n/**\n * Signs an ERC20 permit using the provided wallet client.\n */\nexport function signERC20PermitWith(walletClient: WalletClient): PermitHandler {\n return (result: PermitTypedDataResponse) => {\n invariant(walletClient.account, 'Wallet account is required');\n\n return ResultAsync.fromPromise(\n signTypedData(walletClient, {\n account: walletClient.account,\n domain: result.domain as TypedDataDomain,\n types: result.types as TypedData,\n primaryType: result.primaryType as keyof typeof result.types,\n message: result.message,\n }),\n (err) => SigningError.from(err),\n ).map((hex) => ({\n deadline: result.message.deadline,\n value: signatureFrom(hex),\n }));\n };\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {l as l$1}from'./chunk-BLZHGYNH.js';import {GqlClient,UnexpectedError,TimeoutError,delay}from'@aave/core';import {okAsync,ResultAsync,invariant}from'@aave/types';var i={name:"production",backend:"https://api.v3.aave.com/graphql",indexingTimeout:6e4,pollingInterval:100},T={name:"staging",backend:"https://api.v3.staging.aave.com/graphql",indexingTimeout:6e4,pollingInterval:100},h={name:"local",backend:"http://localhost:3011/graphql",indexingTimeout:6e4,pollingInterval:1e3};function s(e){return {environment:e.environment??i,headers:e.headers,cache:e.cache??false,debug:e.debug??false,fragments:e.fragments??[]}}function r(e){return e.operation!==null}var l=class e extends GqlClient{static create(n){return new e(s(n??{}))}waitForSupportedTransaction=n=>r(n)?this.waitForTransaction(n):okAsync(n.txHash);waitForTransaction=n=>(invariant(r(n),"Received a transaction result for an untracked operation. Make sure you're following the instructions in the docs."),ResultAsync.fromPromise(this.pollTransactionStatus(n),t=>t instanceof TimeoutError||t instanceof UnexpectedError?t:UnexpectedError.from(t)));async pollTransactionStatus(n){let t=Date.now();for(;Date.now()-t<this.context.environment.indexingTimeout;){if(await l$1(this,n).match(o=>o,o=>{throw o}))return n.txHash;await delay(this.context.environment.pollingInterval);}throw TimeoutError.from(`Timeout waiting for transaction ${n.txHash} to be processed.`)}};
|
|
2
|
+
export{i as a,T as b,h as c,l as d};//# sourceMappingURL=chunk-V4DWF6LT.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-V4DWF6LT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/environments.ts","../src/config.ts","../src/types.ts","../src/AaveClient.ts"],"names":["production","staging","local","configureContext","from","isHasProcessedKnownTransactionRequest","result","AaveClient","_AaveClient","GqlClient","options","okAsync","invariant","ResultAsync","err","TimeoutError","UnexpectedError","request","startedAt","hasProcessedKnownTransaction","ok","delay"],"mappings":"yKAKO,IAAMA,CAAAA,CAAgC,CAC3C,IAAA,CAAM,YAAA,CACN,QAAS,iCAAA,CACT,eAAA,CAAiB,IACjB,eAAA,CAAiB,GACnB,EAKaC,CAAAA,CAA6B,CACxC,KAAM,SAAA,CACN,OAAA,CAAS,0CACT,eAAA,CAAiB,GAAA,CACjB,eAAA,CAAiB,GACnB,CAAA,CAKaC,CAAAA,CAA2B,CACtC,IAAA,CAAM,OAAA,CACN,QAAS,+BAAA,CACT,eAAA,CAAiB,IACjB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A,CACPN,CAAAA,EAAQ,CACP,MAAMA,CACR,CACF,CAAA,CAGE,OAAOG,EAAQ,MAAA,CAGjB,MAAMI,KAAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,WAAA,CAAY,eAAe,EACtD,CACA,MAAMN,YAAAA,CAAa,IAAA,CACjB,mCAAmCE,CAAAA,CAAQ,MAAM,CAAA,iBAAA,CACnD,CACF,CACF","file":"chunk-V4DWF6LT.js","sourcesContent":["import type { EnvironmentConfig } from '@aave/core';\n\n/**\n * The production environment configuration.\n */\nexport const production: EnvironmentConfig = {\n name: 'production',\n backend: 'https://api.v3.aave.com/graphql',\n indexingTimeout: 60_000,\n pollingInterval: 100,\n};\n\n/**\n * @internal\n */\nexport const staging: EnvironmentConfig = {\n name: 'staging',\n backend: 'https://api.v3.staging.aave.com/graphql',\n indexingTimeout: 60_000,\n pollingInterval: 100,\n};\n\n/**\n * @internal\n */\nexport const local: EnvironmentConfig = {\n name: 'local',\n backend: 'http://localhost:3011/graphql',\n indexingTimeout: 60_000,\n pollingInterval: 1000,\n};\n","import type { Context } from '@aave/core';\nimport type { TypedDocumentNode } from '@urql/core';\nimport type { EnvironmentConfig } from '../../core/src/types';\nimport { production } from './environments';\n\n/**\n * The client configuration.\n */\nexport type ClientConfig = {\n /**\n * @internal\n * @defaultValue `production`\n */\n environment?: EnvironmentConfig;\n /**\n * @internal\n */\n headers?: Record<string, string>;\n /**\n * Whether to enable caching.\n *\n * @defaultValue `false`\n */\n cache?: boolean;\n /**\n * Whether to enable debug mode.\n *\n * @defaultValue `false`\n */\n debug?: boolean;\n /**\n * The custom fragments to use.\n *\n * @experimental This is an experimental API and may be subject to breaking changes.\n */\n fragments?: TypedDocumentNode[];\n};\n\n/**\n * @internal\n */\nexport function configureContext(from: ClientConfig): Context {\n return {\n environment: from.environment ?? production,\n headers: from.headers,\n cache: from.cache ?? false,\n debug: from.debug ?? false,\n fragments: from.fragments ?? [],\n };\n}\n","import type {\n SigningError,\n TransactionError,\n ValidationError,\n} from '@aave/core';\nimport type {\n ERC712Signature,\n ExecutionPlan,\n HasProcessedKnownTransactionRequest,\n InsufficientBalanceError,\n OperationType,\n PermitTypedDataResponse,\n} from '@aave/graphql';\nimport type { ResultAsync, TxHash } from '@aave/types';\n\nexport type TransactionExecutionResult = {\n txHash: TxHash;\n operation: OperationType | null;\n};\n\n/**\n * @internal\n */\nexport function isHasProcessedKnownTransactionRequest(\n result: TransactionExecutionResult,\n): result is HasProcessedKnownTransactionRequest {\n return result.operation !== null;\n}\n\nexport type ExecutionPlanHandler<T extends ExecutionPlan = ExecutionPlan> = (\n result: T,\n) => ResultAsync<\n TransactionExecutionResult,\n SigningError | TransactionError | ValidationError<InsufficientBalanceError>\n>;\n\nexport type PermitHandler = (\n result: PermitTypedDataResponse,\n) => ResultAsync<ERC712Signature, SigningError>;\n","import { delay, GqlClient, TimeoutError, UnexpectedError } from '@aave/core';\nimport type { HasProcessedKnownTransactionRequest } from '@aave/graphql';\nimport { invariant, okAsync, ResultAsync, type TxHash } from '@aave/types';\nimport { hasProcessedKnownTransaction } from './actions';\nimport { type ClientConfig, configureContext } from './config';\nimport {\n isHasProcessedKnownTransactionRequest,\n type TransactionExecutionResult,\n} from './types';\n\nexport class AaveClient extends GqlClient {\n /**\n * Create a new instance of the {@link AaveClient}.\n *\n * ```ts\n * const client = AaveClient.create({\n * environment: production,\n * });\n * ```\n *\n * @param options - The options to configure the client.\n * @returns The new instance of the client.\n */\n static create(options?: ClientConfig): AaveClient {\n return new AaveClient(configureContext(options ?? {}));\n }\n\n /**\n * @internal\n */\n readonly waitForSupportedTransaction = (\n result: TransactionExecutionResult,\n ): ResultAsync<TxHash, TimeoutError | UnexpectedError> => {\n if (isHasProcessedKnownTransactionRequest(result)) {\n return this.waitForTransaction(result);\n }\n return okAsync(result.txHash);\n };\n\n /**\n * Given the transaction hash of an Aave protocol transaction, wait for the transaction to be\n * processed by the Aave v3 API.\n *\n * Returns a {@link TimeoutError} if the transaction is not processed within the expected timeout period.\n *\n * @param result - The transaction execution result to wait for.\n * @returns The transaction hash or a TimeoutError\n */\n readonly waitForTransaction = (\n result: TransactionExecutionResult,\n ): ResultAsync<TxHash, TimeoutError | UnexpectedError> => {\n invariant(\n isHasProcessedKnownTransactionRequest(result),\n `Received a transaction result for an untracked operation. Make sure you're following the instructions in the docs.`,\n );\n\n return ResultAsync.fromPromise(\n this.pollTransactionStatus(result),\n (err) => {\n if (err instanceof TimeoutError || err instanceof UnexpectedError) {\n return err;\n }\n return UnexpectedError.from(err);\n },\n );\n };\n\n protected async pollTransactionStatus(\n request: HasProcessedKnownTransactionRequest,\n ): Promise<TxHash> {\n const startedAt = Date.now();\n\n while (Date.now() - startedAt < this.context.environment.indexingTimeout) {\n const processed = await hasProcessedKnownTransaction(this, request).match(\n (ok) => ok,\n (err) => {\n throw err;\n },\n );\n\n if (processed) {\n return request.txHash;\n }\n\n await delay(this.context.environment.pollingInterval);\n }\n throw TimeoutError.from(\n `Timeout waiting for transaction ${request.txHash} to be processed.`,\n );\n }\n}\n"]}
|
package/dist/ethers.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var core=require('@aave/core'),types=require('@aave/types');async function f(a,n){return a.sendTransaction({to:n.to,data:n.data,value:n.value,from:n.from})}function e(a,n){return types.ResultAsync.fromPromise(f(a,n),r=>core.SigningError.from(r)).map(r=>r.wait()).andThen(r=>{let o=types.txHash(types.nonNullable(r?.hash));return r?.status===0?types.errAsync(core.TransactionError.new({txHash:o,request:n})):types.okAsync({txHash:o,operation:n.operation})})}function g(a){return n=>{switch(n.__typename){case "TransactionRequest":return e(a,n);case "ApprovalRequired":return e(a,n.approval).andThen(()=>e(a,n.originalTransaction));case "InsufficientBalanceError":return types.errAsync(core.ValidationError.fromGqlNode(n))}}}function R(a){return n=>types.ResultAsync.fromPromise(a.signTypedData(n.domain,n.types,n.message),r=>core.SigningError.from(r)).map(r=>({deadline:n.message.deadline,value:types.signatureFrom(r)}))}exports.sendTransactionAndWait=e;exports.sendWith=g;exports.signERC20PermitWith=R;//# sourceMappingURL=ethers.cjs.map
|
|
2
|
+
//# sourceMappingURL=ethers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ethers.ts"],"names":["sendTransaction","signer","request","sendTransactionAndWait","ResultAsync","err","SigningError","tx","receipt","hash","txHash","nonNullable","errAsync","TransactionError","okAsync","sendWith","result","ValidationError","signERC20PermitWith","signature","signatureFrom"],"mappings":"yEAsBA,eAAeA,EACbC,CAAAA,CACAC,CAAAA,CAC8B,CAC9B,OAAOD,CAAAA,CAAO,gBAAgB,CAC5B,EAAA,CAAIC,EAAQ,EAAA,CACZ,IAAA,CAAMA,EAAQ,IAAA,CACd,KAAA,CAAOA,EAAQ,KAAA,CACf,IAAA,CAAMA,EAAQ,IAChB,CAAC,CACH,CAKO,SAASC,EACdF,CAAAA,CACAC,CAAAA,CAC0E,CAC1E,OAAOE,iBAAAA,CAAY,YAAYJ,CAAAA,CAAgBC,CAAAA,CAAQC,CAAO,CAAA,CAAIG,CAAAA,EAChEC,kBAAa,IAAA,CAAKD,CAAG,CACvB,CAAA,CACG,GAAA,CAAKE,GAAOA,CAAAA,CAAG,IAAA,EAAM,CAAA,CACrB,OAAA,CAASC,GAAY,CACpB,IAAMC,EAAOC,YAAAA,CAAOC,iBAAAA,CAAYH,GAAS,IAAI,CAAC,EAE9C,OAAIA,CAAAA,EAAS,SAAW,CAAA,CACfI,cAAAA,CACLC,sBAAiB,GAAA,CAAI,CACnB,OAAQJ,CAAAA,CACR,OAAA,CAAAP,CACF,CAAC,CACH,EAEKY,aAAAA,CAAQ,CACb,OAAQL,CAAAA,CACR,SAAA,CAAWP,EAAQ,SACrB,CAAC,CACH,CAAC,CACL,CAOO,SAASa,CAAAA,CAASd,EAAsC,CAC7D,OACEe,GAIG,CACH,OAAQA,EAAO,UAAA,EACb,KAAK,oBAAA,CACH,OAAOb,EAAuBF,CAAAA,CAAQe,CAAM,EAE9C,KAAK,kBAAA,CACH,OAAOb,CAAAA,CAAuBF,CAAAA,CAAQe,EAAO,QAAQ,CAAA,CAAE,QAAQ,IAC7Db,CAAAA,CAAuBF,EAAQe,CAAAA,CAAO,mBAAmB,CAC3D,CAAA,CAEF,KAAK,2BACH,OAAOJ,cAAAA,CAASK,qBAAgB,WAAA,CAAYD,CAAM,CAAC,CACvD,CACF,CACF,CAKO,SAASE,EAAoBjB,CAAAA,CAA+B,CACjE,OAAQe,CAAAA,EACCZ,iBAAAA,CAAY,YACjBH,CAAAA,CAAO,aAAA,CAAce,EAAO,MAAA,CAAQA,CAAAA,CAAO,MAAOA,CAAAA,CAAO,OAAO,EAC/DX,CAAAA,EAAQC,iBAAAA,CAAa,KAAKD,CAAG,CAChC,EAAE,GAAA,CAAKc,CAAAA,GAAe,CACpB,QAAA,CAAUH,CAAAA,CAAO,QAAQ,QAAA,CACzB,KAAA,CAAOI,oBAAcD,CAAS,CAChC,EAAE,CAEN","file":"ethers.cjs","sourcesContent":["import { SigningError, TransactionError, ValidationError } from '@aave/core';\nimport type {\n ExecutionPlan,\n InsufficientBalanceError,\n PermitTypedDataResponse,\n TransactionRequest,\n} from '@aave/graphql';\nimport {\n errAsync,\n nonNullable,\n okAsync,\n ResultAsync,\n signatureFrom,\n txHash,\n} from '@aave/types';\nimport type { Signer, TransactionResponse } from 'ethers';\nimport type {\n ExecutionPlanHandler,\n PermitHandler,\n TransactionExecutionResult,\n} from './types';\n\nasync function sendTransaction(\n signer: Signer,\n request: TransactionRequest,\n): Promise<TransactionResponse> {\n return signer.sendTransaction({\n to: request.to,\n data: request.data,\n value: request.value,\n from: request.from,\n });\n}\n\n/**\n * @internal\n */\nexport function sendTransactionAndWait(\n signer: Signer,\n request: TransactionRequest,\n): ResultAsync<TransactionExecutionResult, SigningError | TransactionError> {\n return ResultAsync.fromPromise(sendTransaction(signer, request), (err) =>\n SigningError.from(err),\n )\n .map((tx) => tx.wait())\n .andThen((receipt) => {\n const hash = txHash(nonNullable(receipt?.hash));\n\n if (receipt?.status === 0) {\n return errAsync(\n TransactionError.new({\n txHash: hash,\n request,\n }),\n );\n }\n return okAsync({\n txHash: hash,\n operation: request.operation,\n });\n });\n}\n\n/**\n * Sends transactions using the provided ethers signer.\n *\n * Handles {@link TransactionRequest} by signing and sending, {@link ApprovalRequired} by sending both approval and original transactions, and returns validation errors for {@link InsufficientBalanceError}.\n */\nexport function sendWith(signer: Signer): ExecutionPlanHandler {\n return (\n result: ExecutionPlan,\n ): ResultAsync<\n TransactionExecutionResult,\n SigningError | TransactionError | ValidationError<InsufficientBalanceError>\n > => {\n switch (result.__typename) {\n case 'TransactionRequest':\n return sendTransactionAndWait(signer, result);\n\n case 'ApprovalRequired':\n return sendTransactionAndWait(signer, result.approval).andThen(() =>\n sendTransactionAndWait(signer, result.originalTransaction),\n );\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(result));\n }\n };\n}\n\n/**\n * Signs an ERC20 permit using the provided ethers signer.\n */\nexport function signERC20PermitWith(signer: Signer): PermitHandler {\n return (result: PermitTypedDataResponse) => {\n return ResultAsync.fromPromise(\n signer.signTypedData(result.domain, result.types, result.message),\n (err) => SigningError.from(err),\n ).map((signature) => ({\n deadline: result.message.deadline,\n value: signatureFrom(signature),\n }));\n };\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SigningError, TransactionError } from '@aave/core';
|
|
2
|
+
import { TransactionRequest } from '@aave/graphql';
|
|
3
|
+
import { ResultAsync } from '@aave/types';
|
|
4
|
+
import { Signer } from 'ethers';
|
|
5
|
+
import { T as TransactionExecutionResult, E as ExecutionPlanHandler, P as PermitHandler } from './types-ieyj0UmJ.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
declare function sendTransactionAndWait(signer: Signer, request: TransactionRequest): ResultAsync<TransactionExecutionResult, SigningError | TransactionError>;
|
|
11
|
+
/**
|
|
12
|
+
* Sends transactions using the provided ethers signer.
|
|
13
|
+
*
|
|
14
|
+
* Handles {@link TransactionRequest} by signing and sending, {@link ApprovalRequired} by sending both approval and original transactions, and returns validation errors for {@link InsufficientBalanceError}.
|
|
15
|
+
*/
|
|
16
|
+
declare function sendWith(signer: Signer): ExecutionPlanHandler;
|
|
17
|
+
/**
|
|
18
|
+
* Signs an ERC20 permit using the provided ethers signer.
|
|
19
|
+
*/
|
|
20
|
+
declare function signERC20PermitWith(signer: Signer): PermitHandler;
|
|
21
|
+
|
|
22
|
+
export { sendTransactionAndWait, sendWith, signERC20PermitWith };
|
package/dist/ethers.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SigningError, TransactionError } from '@aave/core';
|
|
2
|
+
import { TransactionRequest } from '@aave/graphql';
|
|
3
|
+
import { ResultAsync } from '@aave/types';
|
|
4
|
+
import { Signer } from 'ethers';
|
|
5
|
+
import { T as TransactionExecutionResult, E as ExecutionPlanHandler, P as PermitHandler } from './types-ieyj0UmJ.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
declare function sendTransactionAndWait(signer: Signer, request: TransactionRequest): ResultAsync<TransactionExecutionResult, SigningError | TransactionError>;
|
|
11
|
+
/**
|
|
12
|
+
* Sends transactions using the provided ethers signer.
|
|
13
|
+
*
|
|
14
|
+
* Handles {@link TransactionRequest} by signing and sending, {@link ApprovalRequired} by sending both approval and original transactions, and returns validation errors for {@link InsufficientBalanceError}.
|
|
15
|
+
*/
|
|
16
|
+
declare function sendWith(signer: Signer): ExecutionPlanHandler;
|
|
17
|
+
/**
|
|
18
|
+
* Signs an ERC20 permit using the provided ethers signer.
|
|
19
|
+
*/
|
|
20
|
+
declare function signERC20PermitWith(signer: Signer): PermitHandler;
|
|
21
|
+
|
|
22
|
+
export { sendTransactionAndWait, sendWith, signERC20PermitWith };
|
package/dist/ethers.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./chunk-FW4363Y4.js';import {SigningError,TransactionError,ValidationError}from'@aave/core';import {ResultAsync,txHash,nonNullable,errAsync,okAsync,signatureFrom}from'@aave/types';async function f(a,n){return a.sendTransaction({to:n.to,data:n.data,value:n.value,from:n.from})}function e(a,n){return ResultAsync.fromPromise(f(a,n),r=>SigningError.from(r)).map(r=>r.wait()).andThen(r=>{let o=txHash(nonNullable(r?.hash));return r?.status===0?errAsync(TransactionError.new({txHash:o,request:n})):okAsync({txHash:o,operation:n.operation})})}function g(a){return n=>{switch(n.__typename){case "TransactionRequest":return e(a,n);case "ApprovalRequired":return e(a,n.approval).andThen(()=>e(a,n.originalTransaction));case "InsufficientBalanceError":return errAsync(ValidationError.fromGqlNode(n))}}}function R(a){return n=>ResultAsync.fromPromise(a.signTypedData(n.domain,n.types,n.message),r=>SigningError.from(r)).map(r=>({deadline:n.message.deadline,value:signatureFrom(r)}))}export{e as sendTransactionAndWait,g as sendWith,R as signERC20PermitWith};//# sourceMappingURL=ethers.js.map
|
|
2
|
+
//# sourceMappingURL=ethers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ethers.ts"],"names":["sendTransaction","signer","request","sendTransactionAndWait","ResultAsync","err","SigningError","tx","receipt","hash","txHash","nonNullable","errAsync","TransactionError","okAsync","sendWith","result","ValidationError","signERC20PermitWith","signature","signatureFrom"],"mappings":"2LAsBA,eAAeA,EACbC,CAAAA,CACAC,CAAAA,CAC8B,CAC9B,OAAOD,CAAAA,CAAO,gBAAgB,CAC5B,EAAA,CAAIC,EAAQ,EAAA,CACZ,IAAA,CAAMA,EAAQ,IAAA,CACd,KAAA,CAAOA,EAAQ,KAAA,CACf,IAAA,CAAMA,EAAQ,IAChB,CAAC,CACH,CAKO,SAASC,EACdF,CAAAA,CACAC,CAAAA,CAC0E,CAC1E,OAAOE,WAAAA,CAAY,YAAYJ,CAAAA,CAAgBC,CAAAA,CAAQC,CAAO,CAAA,CAAIG,CAAAA,EAChEC,aAAa,IAAA,CAAKD,CAAG,CACvB,CAAA,CACG,GAAA,CAAKE,GAAOA,CAAAA,CAAG,IAAA,EAAM,CAAA,CACrB,OAAA,CAASC,GAAY,CACpB,IAAMC,EAAOC,MAAAA,CAAOC,WAAAA,CAAYH,GAAS,IAAI,CAAC,EAE9C,OAAIA,CAAAA,EAAS,SAAW,CAAA,CACfI,QAAAA,CACLC,iBAAiB,GAAA,CAAI,CACnB,OAAQJ,CAAAA,CACR,OAAA,CAAAP,CACF,CAAC,CACH,EAEKY,OAAAA,CAAQ,CACb,OAAQL,CAAAA,CACR,SAAA,CAAWP,EAAQ,SACrB,CAAC,CACH,CAAC,CACL,CAOO,SAASa,CAAAA,CAASd,EAAsC,CAC7D,OACEe,GAIG,CACH,OAAQA,EAAO,UAAA,EACb,KAAK,oBAAA,CACH,OAAOb,EAAuBF,CAAAA,CAAQe,CAAM,EAE9C,KAAK,kBAAA,CACH,OAAOb,CAAAA,CAAuBF,CAAAA,CAAQe,EAAO,QAAQ,CAAA,CAAE,QAAQ,IAC7Db,CAAAA,CAAuBF,EAAQe,CAAAA,CAAO,mBAAmB,CAC3D,CAAA,CAEF,KAAK,2BACH,OAAOJ,QAAAA,CAASK,gBAAgB,WAAA,CAAYD,CAAM,CAAC,CACvD,CACF,CACF,CAKO,SAASE,EAAoBjB,CAAAA,CAA+B,CACjE,OAAQe,CAAAA,EACCZ,WAAAA,CAAY,YACjBH,CAAAA,CAAO,aAAA,CAAce,EAAO,MAAA,CAAQA,CAAAA,CAAO,MAAOA,CAAAA,CAAO,OAAO,EAC/DX,CAAAA,EAAQC,YAAAA,CAAa,KAAKD,CAAG,CAChC,EAAE,GAAA,CAAKc,CAAAA,GAAe,CACpB,QAAA,CAAUH,CAAAA,CAAO,QAAQ,QAAA,CACzB,KAAA,CAAOI,cAAcD,CAAS,CAChC,EAAE,CAEN","file":"ethers.js","sourcesContent":["import { SigningError, TransactionError, ValidationError } from '@aave/core';\nimport type {\n ExecutionPlan,\n InsufficientBalanceError,\n PermitTypedDataResponse,\n TransactionRequest,\n} from '@aave/graphql';\nimport {\n errAsync,\n nonNullable,\n okAsync,\n ResultAsync,\n signatureFrom,\n txHash,\n} from '@aave/types';\nimport type { Signer, TransactionResponse } from 'ethers';\nimport type {\n ExecutionPlanHandler,\n PermitHandler,\n TransactionExecutionResult,\n} from './types';\n\nasync function sendTransaction(\n signer: Signer,\n request: TransactionRequest,\n): Promise<TransactionResponse> {\n return signer.sendTransaction({\n to: request.to,\n data: request.data,\n value: request.value,\n from: request.from,\n });\n}\n\n/**\n * @internal\n */\nexport function sendTransactionAndWait(\n signer: Signer,\n request: TransactionRequest,\n): ResultAsync<TransactionExecutionResult, SigningError | TransactionError> {\n return ResultAsync.fromPromise(sendTransaction(signer, request), (err) =>\n SigningError.from(err),\n )\n .map((tx) => tx.wait())\n .andThen((receipt) => {\n const hash = txHash(nonNullable(receipt?.hash));\n\n if (receipt?.status === 0) {\n return errAsync(\n TransactionError.new({\n txHash: hash,\n request,\n }),\n );\n }\n return okAsync({\n txHash: hash,\n operation: request.operation,\n });\n });\n}\n\n/**\n * Sends transactions using the provided ethers signer.\n *\n * Handles {@link TransactionRequest} by signing and sending, {@link ApprovalRequired} by sending both approval and original transactions, and returns validation errors for {@link InsufficientBalanceError}.\n */\nexport function sendWith(signer: Signer): ExecutionPlanHandler {\n return (\n result: ExecutionPlan,\n ): ResultAsync<\n TransactionExecutionResult,\n SigningError | TransactionError | ValidationError<InsufficientBalanceError>\n > => {\n switch (result.__typename) {\n case 'TransactionRequest':\n return sendTransactionAndWait(signer, result);\n\n case 'ApprovalRequired':\n return sendTransactionAndWait(signer, result.approval).andThen(() =>\n sendTransactionAndWait(signer, result.originalTransaction),\n );\n\n case 'InsufficientBalanceError':\n return errAsync(ValidationError.fromGqlNode(result));\n }\n };\n}\n\n/**\n * Signs an ERC20 permit using the provided ethers signer.\n */\nexport function signERC20PermitWith(signer: Signer): PermitHandler {\n return (result: PermitTypedDataResponse) => {\n return ResultAsync.fromPromise(\n signer.signTypedData(result.domain, result.types, result.message),\n (err) => SigningError.from(err),\n ).map((signature) => ({\n deadline: result.message.deadline,\n value: signatureFrom(signature),\n }));\n };\n}\n"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var core=require('@aave/core'),graphql=require('@aave/graphql'),types=require('@aave/types');function a(t,e){return t.query(graphql.HasProcessedKnownTransactionQuery,{request:e})}var i={name:"production",backend:"https://api.v3.aave.com/graphql",indexingTimeout:6e4,pollingInterval:100},H={name:"staging",backend:"https://api.v3.staging.aave.com/graphql",indexingTimeout:6e4,pollingInterval:100},P={name:"local",backend:"http://localhost:3011/graphql",indexingTimeout:6e4,pollingInterval:1e3};function s(t){return {environment:t.environment??i,headers:t.headers,cache:t.cache??false,debug:t.debug??false,fragments:t.fragments??[]}}function o(t){return t.operation!==null}var u=class t extends core.GqlClient{static create(e){return new t(s(e??{}))}waitForSupportedTransaction=e=>o(e)?this.waitForTransaction(e):types.okAsync(e.txHash);waitForTransaction=e=>(types.invariant(o(e),"Received a transaction result for an untracked operation. Make sure you're following the instructions in the docs."),types.ResultAsync.fromPromise(this.pollTransactionStatus(e),n=>n instanceof core.TimeoutError||n instanceof core.UnexpectedError?n:core.UnexpectedError.from(n)));async pollTransactionStatus(e){let n=Date.now();for(;Date.now()-n<this.context.environment.indexingTimeout;){if(await a(this,e).match(r=>r,r=>{throw r}))return e.txHash;await core.delay(this.context.environment.pollingInterval);}throw core.TimeoutError.from(`Timeout waiting for transaction ${e.txHash} to be processed.`)}};
|
|
2
|
+
exports.AaveClient=u;exports.local=P;exports.production=i;exports.staging=H;Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(graphql).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return graphql[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});//# sourceMappingURL=index.cjs.map
|
|
3
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/actions/misc.ts","../src/environments.ts","../src/config.ts","../src/types.ts","../src/AaveClient.ts"],"names":["hasProcessedKnownTransaction","client","request","HasProcessedKnownTransactionQuery","production","staging","local","configureContext","from","isHasProcessedKnownTransactionRequest","result","AaveClient","_AaveClient","GqlClient","options","okAsync","invariant","ResultAsync","err","TimeoutError","UnexpectedError","startedAt","ok","delay"],"mappings":"0GAmHO,SAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACuC,CACvC,OAAOD,CAAAA,CAAO,KAAA,CAAME,yCAAAA,CAAmC,CAAE,OAAA,CAAAD,CAAQ,CAAC,CACpE,CCnHO,IAAME,CAAAA,CAAgC,CAC3C,IAAA,CAAM,YAAA,CACN,QAAS,iCAAA,CACT,eAAA,CAAiB,GAAA,CACjB,eAAA,CAAiB,GACnB,CAAA,CAKaC,CAAAA,CAA6B,CACxC,IAAA,CAAM,SAAA,CACN,OAAA,CAAS,yCAAA,CACT,eAAA,CAAiB,GAAA,CACjB,gBAAiB,GACnB,CAAA,CAKaC,CAAAA,CAA2B,CACtC,IAAA,CAAM,OAAA,CACN,OAAA,CAAS,+BAAA,CACT,eAAA,CAAiB,GAAA,CACjB,eAAA,CAAiB,GACnB,ECWO,SAASC,EAAiBC,CAAAA,CAA6B,CAC5D,OAAO,CACL,WAAA,CAAaA,CAAAA,CAAK,WAAA,EAAeJ,CAAAA,CACjC,OAAA,CAASI,CAAAA,CAAK,OAAA,CACd,KAAA,CAAOA,CAAAA,CAAK,KAAA,EAAS,MACrB,KAAA,CAAOA,CAAAA,CAAK,KAAA,EAAS,KAAA,CACrB,SAAA,CAAWA,CAAAA,CAAK,SAAA,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,EAAmCjB,CAAAA,CAAQ,MAAM,CAAA,iBAAA,CACnD,CACF,CACF","file":"index.cjs","sourcesContent":["import type { UnexpectedError } from '@aave/core';\nimport {\n type Chain,\n ChainsFilter,\n ChainsQuery,\n HasProcessedKnownTransactionQuery,\n type HasProcessedKnownTransactionRequest,\n HealthFactorPreviewQuery,\n type HealthFactorPreviewRequest,\n type HealthFactorPreviewResponse,\n HealthQuery,\n type UsdExchangeRate,\n UsdExchangeRatesQuery,\n type UsdExchangeRatesRequest,\n} from '@aave/graphql';\nimport type { ResultAsync } from '@aave/types';\nimport type { AaveClient } from '../AaveClient';\n\n/**\n * Health check query.\n *\n * ```ts\n * const result = await health(client);\n * ```\n *\n * @param client - Aave client.\n * @returns True or false\n */\nexport function health(\n client: AaveClient,\n): ResultAsync<boolean, UnexpectedError> {\n return client.query(HealthQuery, {});\n}\n\n/**\n * Fetches the list of supported chains.\n *\n * ```ts\n * const result = await chains(client, ChainsFilter.MAINNET_ONLY);\n * ```\n *\n * @param client - Aave client.\n * @param filter - The filter for the chains.\n * @returns The list of supported chains.\n */\nexport function chains(\n client: AaveClient,\n filter: ChainsFilter = ChainsFilter.ALL,\n): ResultAsync<Chain[], UnexpectedError> {\n return client.query(ChainsQuery, { filter });\n}\n\n/**\n * Fetches USD exchange rates for different tokens on a given market.\n *\n * ```ts\n * const result = await usdExchangeRates(client, {\n * market: evmAddress('0x1234…'),\n * underlyingTokens: [evmAddress('0x5678…'), evmAddress('0x90ab…')],\n * chainId: chainId(1),\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The USD exchange rates request parameters.\n * @returns The list of USD exchange rates.\n */\nexport function usdExchangeRates(\n client: AaveClient,\n request: UsdExchangeRatesRequest,\n): ResultAsync<UsdExchangeRate[], UnexpectedError> {\n return client.query(UsdExchangeRatesQuery, { request });\n}\n\n/**\n * Checks if the API has processed a known transaction hash.\n *\n * This is useful to know when cached data has been invalidated after\n * a transaction is complete, as the API uses caching and has an\n * invalidation task that may take 100-200ms longer.\n *\n * ```ts\n * const result = await borrow(client, request)\n * .andThen(sendWith(wallet))\n * .andThen(client.waitForTransaction);\n *\n * if (result.isErr()) {\n * // Handle error\n * return;\n * }\n *\n * // Check if the transaction has been processed by the API\n * const processed = await hasProcessedKnownTransaction(client, {\n * txHash: result.value,\n * operation: OperationType.Borrow\n * });\n *\n * if (processed.isErr()) {\n * // Handle error\n * return;\n * }\n *\n * if (processed.value) {\n * // Transaction processed, cached data is up to date\n * console.log('Transaction processed, data is fresh');\n * } else {\n * // Transaction not yet processed, may need to wait\n * console.log('Transaction not yet processed');\n * }\n * ```\n *\n * @param client - Aave client.\n * @param request - The request containing transaction hash and operation type to check.\n * @returns True if the transaction has been processed, false otherwise.\n */\nexport function hasProcessedKnownTransaction(\n client: AaveClient,\n request: HasProcessedKnownTransactionRequest,\n): ResultAsync<boolean, UnexpectedError> {\n return client.query(HasProcessedKnownTransactionQuery, { request });\n}\n\n/**\n * Fetches health factor preview for a given market action.\n *\n * ```ts\n * const result = await healthFactorPreview(client, {\n * action: {\n * borrow: {\n * market: market.address,\n * amount: {\n * erc20: {\n * currency: evmAddress('0x5678…'),\n * value: '1000',\n * },\n * },\n * borrower: evmAddress('0x9abc…'),\n * chainId: market.chain.chainId,\n * },\n * },\n * });\n * ```\n *\n * @param client - Aave client.\n * @param request - The health factor preview request parameters.\n * @returns The health factor preview response with before and after values.\n */\nexport function healthFactorPreview(\n client: AaveClient,\n request: HealthFactorPreviewRequest,\n): ResultAsync<HealthFactorPreviewResponse, UnexpectedError> {\n return client.query(HealthFactorPreviewQuery, { request });\n}\n","import type { EnvironmentConfig } from '@aave/core';\n\n/**\n * The production environment configuration.\n */\nexport const production: EnvironmentConfig = {\n name: 'production',\n backend: 'https://api.v3.aave.com/graphql',\n indexingTimeout: 60_000,\n pollingInterval: 100,\n};\n\n/**\n * @internal\n */\nexport const staging: EnvironmentConfig = {\n name: 'staging',\n backend: 'https://api.v3.staging.aave.com/graphql',\n indexingTimeout: 60_000,\n pollingInterval: 100,\n};\n\n/**\n * @internal\n */\nexport const local: EnvironmentConfig = {\n name: 'local',\n backend: 'http://localhost:3011/graphql',\n indexingTimeout: 60_000,\n pollingInterval: 1000,\n};\n","import type { Context } from '@aave/core';\nimport type { TypedDocumentNode } from '@urql/core';\nimport type { EnvironmentConfig } from '../../core/src/types';\nimport { production } from './environments';\n\n/**\n * The client configuration.\n */\nexport type ClientConfig = {\n /**\n * @internal\n * @defaultValue `production`\n */\n environment?: EnvironmentConfig;\n /**\n * @internal\n */\n headers?: Record<string, string>;\n /**\n * Whether to enable caching.\n *\n * @defaultValue `false`\n */\n cache?: boolean;\n /**\n * Whether to enable debug mode.\n *\n * @defaultValue `false`\n */\n debug?: boolean;\n /**\n * The custom fragments to use.\n *\n * @experimental This is an experimental API and may be subject to breaking changes.\n */\n fragments?: TypedDocumentNode[];\n};\n\n/**\n * @internal\n */\nexport function configureContext(from: ClientConfig): Context {\n return {\n environment: from.environment ?? production,\n headers: from.headers,\n cache: from.cache ?? false,\n debug: from.debug ?? false,\n fragments: from.fragments ?? [],\n };\n}\n","import type {\n SigningError,\n TransactionError,\n ValidationError,\n} from '@aave/core';\nimport type {\n ERC712Signature,\n ExecutionPlan,\n HasProcessedKnownTransactionRequest,\n InsufficientBalanceError,\n OperationType,\n PermitTypedDataResponse,\n} from '@aave/graphql';\nimport type { ResultAsync, TxHash } from '@aave/types';\n\nexport type TransactionExecutionResult = {\n txHash: TxHash;\n operation: OperationType | null;\n};\n\n/**\n * @internal\n */\nexport function isHasProcessedKnownTransactionRequest(\n result: TransactionExecutionResult,\n): result is HasProcessedKnownTransactionRequest {\n return result.operation !== null;\n}\n\nexport type ExecutionPlanHandler<T extends ExecutionPlan = ExecutionPlan> = (\n result: T,\n) => ResultAsync<\n TransactionExecutionResult,\n SigningError | TransactionError | ValidationError<InsufficientBalanceError>\n>;\n\nexport type PermitHandler = (\n result: PermitTypedDataResponse,\n) => ResultAsync<ERC712Signature, SigningError>;\n","import { delay, GqlClient, TimeoutError, UnexpectedError } from '@aave/core';\nimport type { HasProcessedKnownTransactionRequest } from '@aave/graphql';\nimport { invariant, okAsync, ResultAsync, type TxHash } from '@aave/types';\nimport { hasProcessedKnownTransaction } from './actions';\nimport { type ClientConfig, configureContext } from './config';\nimport {\n isHasProcessedKnownTransactionRequest,\n type TransactionExecutionResult,\n} from './types';\n\nexport class AaveClient extends GqlClient {\n /**\n * Create a new instance of the {@link AaveClient}.\n *\n * ```ts\n * const client = AaveClient.create({\n * environment: production,\n * });\n * ```\n *\n * @param options - The options to configure the client.\n * @returns The new instance of the client.\n */\n static create(options?: ClientConfig): AaveClient {\n return new AaveClient(configureContext(options ?? {}));\n }\n\n /**\n * @internal\n */\n readonly waitForSupportedTransaction = (\n result: TransactionExecutionResult,\n ): ResultAsync<TxHash, TimeoutError | UnexpectedError> => {\n if (isHasProcessedKnownTransactionRequest(result)) {\n return this.waitForTransaction(result);\n }\n return okAsync(result.txHash);\n };\n\n /**\n * Given the transaction hash of an Aave protocol transaction, wait for the transaction to be\n * processed by the Aave v3 API.\n *\n * Returns a {@link TimeoutError} if the transaction is not processed within the expected timeout period.\n *\n * @param result - The transaction execution result to wait for.\n * @returns The transaction hash or a TimeoutError\n */\n readonly waitForTransaction = (\n result: TransactionExecutionResult,\n ): ResultAsync<TxHash, TimeoutError | UnexpectedError> => {\n invariant(\n isHasProcessedKnownTransactionRequest(result),\n `Received a transaction result for an untracked operation. Make sure you're following the instructions in the docs.`,\n );\n\n return ResultAsync.fromPromise(\n this.pollTransactionStatus(result),\n (err) => {\n if (err instanceof TimeoutError || err instanceof UnexpectedError) {\n return err;\n }\n return UnexpectedError.from(err);\n },\n );\n };\n\n protected async pollTransactionStatus(\n request: HasProcessedKnownTransactionRequest,\n ): Promise<TxHash> {\n const startedAt = Date.now();\n\n while (Date.now() - startedAt < this.context.environment.indexingTimeout) {\n const processed = await hasProcessedKnownTransaction(this, request).match(\n (ok) => ok,\n (err) => {\n throw err;\n },\n );\n\n if (processed) {\n return request.txHash;\n }\n\n await delay(this.context.environment.pollingInterval);\n }\n throw TimeoutError.from(\n `Timeout waiting for transaction ${request.txHash} to be processed.`,\n );\n }\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EnvironmentConfig } from '@aave/core';
|
|
2
|
+
export * from '@aave/core';
|
|
3
|
+
export * from '@aave/graphql';
|
|
4
|
+
export * from '@aave/types';
|
|
5
|
+
export { A as AaveClient, C as ClientConfig, c as configureContext } from './AaveClient-PHUEzt7l.cjs';
|
|
6
|
+
export { E as ExecutionPlanHandler, P as PermitHandler, T as TransactionExecutionResult, i as isHasProcessedKnownTransactionRequest } from './types-ieyj0UmJ.cjs';
|
|
7
|
+
import '@urql/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The production environment configuration.
|
|
11
|
+
*/
|
|
12
|
+
declare const production: EnvironmentConfig;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
declare const staging: EnvironmentConfig;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
declare const local: EnvironmentConfig;
|
|
21
|
+
|
|
22
|
+
export { local, production, staging };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EnvironmentConfig } from '@aave/core';
|
|
2
|
+
export * from '@aave/core';
|
|
3
|
+
export * from '@aave/graphql';
|
|
4
|
+
export * from '@aave/types';
|
|
5
|
+
export { A as AaveClient, C as ClientConfig, c as configureContext } from './AaveClient-C-OkXfVz.js';
|
|
6
|
+
export { E as ExecutionPlanHandler, P as PermitHandler, T as TransactionExecutionResult, i as isHasProcessedKnownTransactionRequest } from './types-ieyj0UmJ.js';
|
|
7
|
+
import '@urql/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The production environment configuration.
|
|
11
|
+
*/
|
|
12
|
+
declare const production: EnvironmentConfig;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
declare const staging: EnvironmentConfig;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
declare const local: EnvironmentConfig;
|
|
21
|
+
|
|
22
|
+
export { local, production, staging };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{d as AaveClient,c as local,a as production,b as staging}from'./chunk-V4DWF6LT.js';import'./chunk-BLZHGYNH.js';import'./chunk-FW4363Y4.js';export*from'@aave/core';export*from'@aave/graphql';export*from'@aave/types';//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import'./chunk-FW4363Y4.js';var _=44,N=59,x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E=new Uint8Array(64),A=new Uint8Array(128);for(let l=0;l<x.length;l++){let t=x.charCodeAt(l);E[l]=t,A[t]=l;}function d(l,t,e){let n=t-e;n=n<0?-n<<1|1:n<<1;do{let i=n&31;n>>>=5,n>0&&(i|=32),l.write(E[i]);}while(n>0);return t}var v=1024*16,y=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(l){return Buffer.from(l.buffer,l.byteOffset,l.byteLength).toString()}}:{decode(l){let t="";for(let e=0;e<l.length;e++)t+=String.fromCharCode(l[e]);return t}},j=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(v);}write(l){let{buffer:t}=this;t[this.pos++]=l,this.pos===v&&(this.out+=y.decode(t),this.pos=0);}flush(){let{buffer:l,out:t,pos:e}=this;return e>0?t+y.decode(l.subarray(0,e)):t}};function L(l){let t=new j,e=0,n=0,i=0,r=0;for(let s=0;s<l.length;s++){let h=l[s];if(s>0&&t.write(N),h.length===0)continue;let o=0;for(let u=0;u<h.length;u++){let a=h[u];u>0&&t.write(_),o=d(t,a[0],o),a.length!==1&&(e=d(t,a[1],e),n=d(t,a[2],n),i=d(t,a[3],i),a.length!==4&&(r=d(t,a[4],r)));}}return t.flush()}var p=class l{constructor(t){this.bits=t instanceof l?t.bits.slice():[];}add(t){this.bits[t>>5]|=1<<(t&31);}has(t){return !!(this.bits[t>>5]&1<<(t&31))}},m=class l{constructor(t,e,n){this.start=t,this.end=e,this.original=n,this.intro="",this.outro="",this.content=n,this.storeName=false,this.edited=false,this.previous=null,this.next=null;}appendLeft(t){this.outro+=t;}appendRight(t){this.intro=this.intro+t;}clone(){let t=new l(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(t){return this.start<t&&t<this.end}eachNext(t){let e=this;for(;e;)t(e),e=e.next;}eachPrevious(t){let e=this;for(;e;)t(e),e=e.previous;}edit(t,e,n){return this.content=t,n||(this.intro="",this.outro=""),this.storeName=e,this.edited=true,this}prependLeft(t){this.outro=t+this.outro;}prependRight(t){this.intro=t+this.intro;}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=false,this.edited=false);}split(t){let e=t-this.start,n=this.original.slice(0,e),i=this.original.slice(e);this.original=n;let r=new l(t,this.end,i);return r.outro=this.outro,this.outro="",this.end=t,this.edited?(r.edit("",false),this.content=""):this.content=n,r.next=this.next,r.next&&(r.next.previous=r),r.previous=this,this.next=r,r}toString(){return this.intro+this.content+this.outro}trimEnd(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return true;let e=this.content.replace(t,"");if(e.length)return e!==this.content&&(this.split(this.start+e.length).edit("",void 0,true),this.edited&&this.edit(e,this.storeName,true)),true;if(this.edit("",void 0,true),this.intro=this.intro.replace(t,""),this.intro.length)return true}trimStart(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return true;let e=this.content.replace(t,"");if(e.length){if(e!==this.content){let n=this.split(this.end-e.length);this.edited&&n.edit(e,this.storeName,true),this.edit("",void 0,true);}return true}else if(this.edit("",void 0,true),this.outro=this.outro.replace(t,""),this.outro.length)return true}};function $(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?l=>globalThis.btoa(unescape(encodeURIComponent(l))):typeof Buffer=="function"?l=>Buffer.from(l,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}var q=$(),w=class{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=L(t.mappings),typeof t.x_google_ignoreList<"u"&&(this.x_google_ignoreList=t.x_google_ignoreList),typeof t.debugId<"u"&&(this.debugId=t.debugId);}toString(){return JSON.stringify(this)}toUrl(){return "data:application/json;charset=utf-8;base64,"+q(this.toString())}};function T(l){let t=l.split(`
|
|
2
|
+
`),e=t.filter(r=>/^\t+/.test(r)),n=t.filter(r=>/^ {2,}/.test(r));if(e.length===0&&n.length===0)return null;if(e.length>=n.length)return " ";let i=n.reduce((r,s)=>{let h=/^ +/.exec(s)[0].length;return Math.min(h,r)},1/0);return new Array(i+1).join(" ")}function I(l,t){let e=l.split(/[/\\]/),n=t.split(/[/\\]/);for(e.pop();e[0]===n[0];)e.shift(),n.shift();if(e.length){let i=e.length;for(;i--;)e[i]="..";}return e.concat(n).join("/")}var B=Object.prototype.toString;function O(l){return B.call(l)==="[object Object]"}function S(l){let t=l.split(`
|
|
3
|
+
`),e=[];for(let n=0,i=0;n<t.length;n++)e.push(i),i+=t[n].length+1;return function(i){let r=0,s=e.length;for(;r<s;){let u=r+s>>1;i<e[u]?s=u:r=u+1;}let h=r-1,o=i-e[h];return {line:h,column:o}}}var U=/\w/,b=class{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null;}addEdit(t,e,n,i){if(e.length){let r=e.length-1,s=e.indexOf(`
|
|
4
|
+
`,0),h=-1;for(;s>=0&&r>s;){let u=[this.generatedCodeColumn,t,n.line,n.column];i>=0&&u.push(i),this.rawSegments.push(u),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,h=s,s=e.indexOf(`
|
|
5
|
+
`,s+1);}let o=[this.generatedCodeColumn,t,n.line,n.column];i>=0&&o.push(i),this.rawSegments.push(o),this.advance(e.slice(h+1));}else this.pending&&(this.rawSegments.push(this.pending),this.advance(e));this.pending=null;}addUneditedChunk(t,e,n,i,r){let s=e.start,h=true,o=false;for(;s<e.end;){if(n[s]===`
|
|
6
|
+
`)i.line+=1,i.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,h=true,o=false;else {if(this.hires||h||r.has(s)){let u=[this.generatedCodeColumn,t,i.line,i.column];this.hires==="boundary"?U.test(n[s])?o||(this.rawSegments.push(u),o=true):(this.rawSegments.push(u),o=false):this.rawSegments.push(u);}i.column+=1,this.generatedCodeColumn+=1,h=false;}s+=1;}this.pending=null;}advance(t){if(!t)return;let e=t.split(`
|
|
7
|
+
`);if(e.length>1){for(let n=0;n<e.length-1;n++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0;}this.generatedCodeColumn+=e[e.length-1].length;}},g=`
|
|
8
|
+
`,c={insertLeft:false,insertRight:false,storeName:false},C=class l{constructor(t,e={}){let n=new m(0,t.length,t);Object.defineProperties(this,{original:{writable:true,value:t},outro:{writable:true,value:""},intro:{writable:true,value:""},firstChunk:{writable:true,value:n},lastChunk:{writable:true,value:n},lastSearchedChunk:{writable:true,value:n},byStart:{writable:true,value:{}},byEnd:{writable:true,value:{}},filename:{writable:true,value:e.filename},indentExclusionRanges:{writable:true,value:e.indentExclusionRanges},sourcemapLocations:{writable:true,value:new p},storedNames:{writable:true,value:{}},indentStr:{writable:true,value:void 0},ignoreList:{writable:true,value:e.ignoreList},offset:{writable:true,value:e.offset||0}}),this.byStart[0]=n,this.byEnd[t.length]=n;}addSourcemapLocation(t){this.sourcemapLocations.add(t);}append(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.outro+=t,this}appendLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);let n=this.byEnd[t];return n?n.appendLeft(e):this.intro+=e,this}appendRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);let n=this.byStart[t];return n?n.appendRight(e):this.outro+=e,this}clone(){let t=new l(this.original,{filename:this.filename,offset:this.offset}),e=this.firstChunk,n=t.firstChunk=t.lastSearchedChunk=e.clone();for(;e;){t.byStart[n.start]=n,t.byEnd[n.end]=n;let i=e.next,r=i&&i.clone();r&&(n.next=r,r.previous=n,n=r),e=i;}return t.lastChunk=n,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new p(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(t){t=t||{};let e=0,n=Object.keys(this.storedNames),i=new b(t.hires),r=S(this.original);return this.intro&&i.advance(this.intro),this.firstChunk.eachNext(s=>{let h=r(s.start);s.intro.length&&i.advance(s.intro),s.edited?i.addEdit(e,s.content,h,s.storeName?n.indexOf(s.original):-1):i.addUneditedChunk(e,s,this.original,h,this.sourcemapLocations),s.outro.length&&i.advance(s.outro);}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?I(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:n,mappings:i.raw,x_google_ignoreList:this.ignoreList?[e]:void 0}}generateMap(t){return new w(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=T(this.original));}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,e){let n=/^[^\r\n]/gm;if(O(t)&&(e=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;e=e||{};let i={};e.exclude&&(typeof e.exclude[0]=="number"?[e.exclude]:e.exclude).forEach(a=>{for(let f=a[0];f<a[1];f+=1)i[f]=true;});let r=e.indentStart!==false,s=u=>r?`${t}${u}`:(r=true,u);this.intro=this.intro.replace(n,s);let h=0,o=this.firstChunk;for(;o;){let u=o.end;if(o.edited)i[h]||(o.content=o.content.replace(n,s),o.content.length&&(r=o.content[o.content.length-1]===`
|
|
9
|
+
`));else for(h=o.start;h<u;){if(!i[h]){let a=this.original[h];a===`
|
|
10
|
+
`?r=true:a!=="\r"&&r&&(r=false,h===o.start||(this._splitChunk(o,h),o=o.next),o.prependRight(t));}h+=1;}h=o.end,o=o.next;}return this.outro=this.outro.replace(n,s),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,e){return c.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),c.insertLeft=true),this.appendLeft(t,e)}insertRight(t,e){return c.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),c.insertRight=true),this.prependRight(t,e)}move(t,e,n){if(t=t+this.offset,e=e+this.offset,n=n+this.offset,n>=t&&n<=e)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(e),this._split(n);let i=this.byStart[t],r=this.byEnd[e],s=i.previous,h=r.next,o=this.byStart[n];if(!o&&r===this.lastChunk)return this;let u=o?o.previous:this.lastChunk;return s&&(s.next=h),h&&(h.previous=s),u&&(u.next=i),o&&(o.previous=r),i.previous||(this.firstChunk=r.next),r.next||(this.lastChunk=i.previous,this.lastChunk.next=null),i.previous=u,r.next=o||null,u||(this.firstChunk=i),o||(this.lastChunk=r),this}overwrite(t,e,n,i){return i=i||{},this.update(t,e,n,{...i,overwrite:!i.contentOnly})}update(t,e,n,i){if(t=t+this.offset,e=e+this.offset,typeof n!="string")throw new TypeError("replacement content must be a string");if(this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length;}if(e>this.original.length)throw new Error("end is out of bounds");if(t===e)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(t),this._split(e),i===true&&(c.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),c.storeName=true),i={storeName:true});let r=i!==void 0?i.storeName:false,s=i!==void 0?i.overwrite:false;if(r){let u=this.original.slice(t,e);Object.defineProperty(this.storedNames,u,{writable:true,value:true,enumerable:true});}let h=this.byStart[t],o=this.byEnd[e];if(h){let u=h;for(;u!==o;){if(u.next!==this.byStart[u.end])throw new Error("Cannot overwrite across a split point");u=u.next,u.edit("",false);}h.edit(n,r,!s);}else {let u=new m(t,e,"").edit(n,r);o.next=u,u.previous=o;}return this}prepend(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this}prependLeft(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);let n=this.byEnd[t];return n?n.prependLeft(e):this.intro=e+this.intro,this}prependRight(t,e){if(t=t+this.offset,typeof e!="string")throw new TypeError("inserted content must be a string");this._split(t);let n=this.byStart[t];return n?n.prependRight(e):this.outro=e+this.outro,this}remove(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length;}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let n=this.byStart[t];for(;n;)n.intro="",n.outro="",n.edit(""),n=e>n.end?this.byStart[n.end]:null;return this}reset(t,e){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length;}if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t),this._split(e);let n=this.byStart[t];for(;n;)n.reset(),n=e>n.end?this.byStart[n.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let t=this.outro.lastIndexOf(g);if(t!==-1)return this.outro.substr(t+1);let e=this.outro,n=this.lastChunk;do{if(n.outro.length>0){if(t=n.outro.lastIndexOf(g),t!==-1)return n.outro.substr(t+1)+e;e=n.outro+e;}if(n.content.length>0){if(t=n.content.lastIndexOf(g),t!==-1)return n.content.substr(t+1)+e;e=n.content+e;}if(n.intro.length>0){if(t=n.intro.lastIndexOf(g),t!==-1)return n.intro.substr(t+1)+e;e=n.intro+e;}}while(n=n.previous);return t=this.intro.lastIndexOf(g),t!==-1?this.intro.substr(t+1)+e:this.intro+e}slice(t=0,e=this.original.length-this.offset){if(t=t+this.offset,e=e+this.offset,this.original.length!==0){for(;t<0;)t+=this.original.length;for(;e<0;)e+=this.original.length;}let n="",i=this.firstChunk;for(;i&&(i.start>t||i.end<=t);){if(i.start<e&&i.end>=e)return n;i=i.next;}if(i&&i.edited&&i.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);let r=i;for(;i;){i.intro&&(r!==i||i.start===t)&&(n+=i.intro);let s=i.start<e&&i.end>=e;if(s&&i.edited&&i.end!==e)throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);let h=r===i?t-i.start:0,o=s?i.content.length+e-i.end:i.content.length;if(n+=i.content.slice(h,o),i.outro&&(!s||i.end===e)&&(n+=i.outro),s)break;i=i.next;}return n}snip(t,e){let n=this.clone();return n.remove(0,t),n.remove(e,n.original.length),n}_split(t){if(this.byStart[t]||this.byEnd[t])return;let e=this.lastSearchedChunk,n=t>e.end;for(;e;){if(e.contains(t))return this._splitChunk(e,t);e=n?this.byStart[e.end]:this.byEnd[e.start];}}_splitChunk(t,e){if(t.edited&&t.content.length){let i=S(this.original)(e);throw new Error(`Cannot split a chunk that has already been edited (${i.line}:${i.column} \u2013 "${t.original}")`)}let n=t.split(e);return this.byEnd[e]=t,this.byStart[e]=n,this.byEnd[n.end]=n,t===this.lastChunk&&(this.lastChunk=n),this.lastSearchedChunk=t,true}toString(){let t=this.intro,e=this.firstChunk;for(;e;)t+=e.toString(),e=e.next;return t+this.outro}isEmpty(){let t=this.firstChunk;do if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return false;while(t=t.next);return true}length(){let t=this.firstChunk,e=0;do e+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return e}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){let e=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(e,""),this.outro.length)return true;let n=this.lastChunk;do{let i=n.end,r=n.trimEnd(e);if(n.end!==i&&(this.lastChunk===n&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),r)return true;n=n.previous;}while(n);return false}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){let e=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(e,""),this.intro.length)return true;let n=this.firstChunk;do{let i=n.end,r=n.trimStart(e);if(n.end!==i&&(n===this.lastChunk&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),r)return true;n=n.next;}while(n);return false}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,e){function n(r,s){return typeof e=="string"?e.replace(/\$(\$|&|\d+)/g,(h,o)=>o==="$"?"$":o==="&"?r[0]:+o<r.length?r[+o]:`$${o}`):e(...r,r.index,s,r.groups)}function i(r,s){let h,o=[];for(;h=r.exec(s);)o.push(h);return o}if(t.global)i(t,this.original).forEach(s=>{if(s.index!=null){let h=n(s,this.original);h!==s[0]&&this.overwrite(s.index,s.index+s[0].length,h);}});else {let r=this.original.match(t);if(r&&r.index!=null){let s=n(r,this.original);s!==r[0]&&this.overwrite(r.index,r.index+r[0].length,s);}}return this}_replaceString(t,e){let{original:n}=this,i=n.indexOf(t);return i!==-1&&this.overwrite(i,i+t.length,e),this}replace(t,e){return typeof t=="string"?this._replaceString(t,e):this._replaceRegexp(t,e)}_replaceAllString(t,e){let{original:n}=this,i=t.length;for(let r=n.indexOf(t);r!==-1;r=n.indexOf(t,r+i))n.slice(r,r+i)!==e&&this.overwrite(r,r+i,e);return this}replaceAll(t,e){if(typeof t=="string")return this._replaceAllString(t,e);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,e)}},k=Object.prototype.hasOwnProperty,R=class l{constructor(t={}){this.intro=t.intro||"",this.separator=t.separator!==void 0?t.separator:`
|
|
11
|
+
`,this.sources=[],this.uniqueSources=[],this.uniqueSourceIndexByFilename={};}addSource(t){if(t instanceof C)return this.addSource({content:t,filename:t.filename,separator:this.separator});if(!O(t)||!t.content)throw new Error("bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`");if(["filename","ignoreList","indentExclusionRanges","separator"].forEach(e=>{k.call(t,e)||(t[e]=t.content[e]);}),t.separator===void 0&&(t.separator=this.separator),t.filename)if(!k.call(this.uniqueSourceIndexByFilename,t.filename))this.uniqueSourceIndexByFilename[t.filename]=this.uniqueSources.length,this.uniqueSources.push({filename:t.filename,content:t.content.original});else {let e=this.uniqueSources[this.uniqueSourceIndexByFilename[t.filename]];if(t.content.original!==e.content)throw new Error(`Illegal source: same filename (${t.filename}), different contents`)}return this.sources.push(t),this}append(t,e){return this.addSource({content:new C(t),separator:e&&e.separator||""}),this}clone(){let t=new l({intro:this.intro,separator:this.separator});return this.sources.forEach(e=>{t.addSource({filename:e.filename,content:e.content.clone(),separator:e.separator});}),t}generateDecodedMap(t={}){let e=[],n;this.sources.forEach(r=>{Object.keys(r.content.storedNames).forEach(s=>{~e.indexOf(s)||e.push(s);});});let i=new b(t.hires);return this.intro&&i.advance(this.intro),this.sources.forEach((r,s)=>{s>0&&i.advance(this.separator);let h=r.filename?this.uniqueSourceIndexByFilename[r.filename]:-1,o=r.content,u=S(o.original);o.intro&&i.advance(o.intro),o.firstChunk.eachNext(a=>{let f=u(a.start);a.intro.length&&i.advance(a.intro),r.filename?a.edited?i.addEdit(h,a.content,f,a.storeName?e.indexOf(a.original):-1):i.addUneditedChunk(h,a,o.original,f,o.sourcemapLocations):i.advance(a.content),a.outro.length&&i.advance(a.outro);}),o.outro&&i.advance(o.outro),r.ignoreList&&h!==-1&&(n===void 0&&(n=[]),n.push(h));}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:this.uniqueSources.map(r=>t.file?I(t.file,r.filename):r.filename),sourcesContent:this.uniqueSources.map(r=>t.includeContent?r.content:null),names:e,mappings:i.raw,x_google_ignoreList:n}}generateMap(t){return new w(this.generateDecodedMap(t))}getIndentString(){let t={};return this.sources.forEach(e=>{let n=e.content._getRawIndentString();n!==null&&(t[n]||(t[n]=0),t[n]+=1);}),Object.keys(t).sort((e,n)=>t[e]-t[n])[0]||" "}indent(t){if(arguments.length||(t=this.getIndentString()),t==="")return this;let e=!this.intro||this.intro.slice(-1)===`
|
|
12
|
+
`;return this.sources.forEach((n,i)=>{let r=n.separator!==void 0?n.separator:this.separator,s=e||i>0&&/\r?\n$/.test(r);n.content.indent(t,{exclude:n.indentExclusionRanges,indentStart:s}),e=n.content.lastChar()===`
|
|
13
|
+
`;}),this.intro&&(this.intro=t+this.intro.replace(/^[^\n]/gm,(n,i)=>i>0?t+n:n)),this}prepend(t){return this.intro=t+this.intro,this}toString(){let t=this.sources.map((e,n)=>{let i=e.separator!==void 0?e.separator:this.separator;return (n>0?i:"")+e.content.toString()}).join("");return this.intro+t}isEmpty(){return !(this.intro.length&&this.intro.trim()||this.sources.some(t=>!t.content.isEmpty()))}length(){return this.sources.reduce((t,e)=>t+e.content.length(),this.intro.length)}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimStart(t){let e=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(e,""),!this.intro){let n,i=0;do if(n=this.sources[i++],!n)break;while(!n.content.trimStartAborted(t))}return this}trimEnd(t){let e=new RegExp((t||"\\s")+"+$"),n,i=this.sources.length-1;do if(n=this.sources[i--],!n){this.intro=this.intro.replace(e,"");break}while(!n.content.trimEndAborted(t));return this}};export{R as Bundle,w as SourceMap,C as default};//# sourceMappingURL=magic-string.es-PTUXR566.js.map
|
|
14
|
+
//# sourceMappingURL=magic-string.es-PTUXR566.js.map
|