@hyperionxyz/sdk
Version:
This SDK allows you to interact with the Hyperion API. You can use it to request data, create pools/positions and more.
163 lines (162 loc) • 22.4 kB
JavaScript
;var X=Object.defineProperty;var J=(n,t,e)=>t in n?X(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var u=(n,t,e)=>J(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@aptos-labs/ts-sdk"),T=require("aptos-tool"),a=require("bignumber.js"),y=require("graphql-request"),Z=require("long"),k=require("@aptos-labs/script-composer-sdk"),v=`
assetType
bridge
coinMarketcapId
coinType
coingeckoId
decimals
faType
hyperfluidSymbol
logoUrl
name
symbol
isBanned
websiteUrl`,E=`
currentTick
feeRate
feeTier
poolId
senderAddress
sqrtPrice
token1
token2
token1Info {
${v}
}
token2Info {
${v}
}
`,F=`
id
dailyVolumeUSD
feesUSD
tvlUSD
feeAPR
farmAPR
pool {
${E}
}
`,tt=y.gql`
query queryAllPools {
api {
getPoolStat {
${F}
}
}
}
`,et=y.gql`
query queryPoolById($poolId: String = "") {
api {
getPoolStat(poolId: $poolId) {
${F}
}
}
}
`,nt=y.gql`
query queryTickChart($poolId: String = "") {
api {
getLiquidityAccumulation(poolId: $poolId) {
price0
price1
tick
totalAmount
}
}
}
`,G=`
amount
amountUSD
token
`,L=`
claimed {
${G}
}
`,M=`
unclaimed {
${G}
}
`,ot=y.gql`
query queryAllPositionByAddress($address: String = "") {
api {
getPositionStatsByAddress(address: $address) {
isActive
value
farm {
${L}
${M}
}
fees {
${L}
${M}
}
position {
objectId
poolId
tickLower
tickUpper
createdAt
pool {
${E}
}
}
}
}
}
`,rt=y.gql`
query queryPoolInfoByObjectId($ownerAddress: String = "", $objectId: String = "") {
objectOwnership(
where: {
ownerAddress: { _eq: $ownerAddress }
isDelete: { _eq: false }
objectId: { _eq: $objectId }
}
) {
objectId
poolId
txnTimestamp
currentAmount
position {
tickLower
tickUpper
}
pool {
${E}
}
}
}
`,st=y.gql`
query queryPoolByTokenPair(
$token1: String = ""
$token2: String = ""
$feeTier: Float = 1.5
) {
api {
getPoolByTokenPair(feeTier: $feeTier, token1: $token1, token2: $token2) {
currentTick
token1
token2
poolId
}
}
}
`;a.config({EXPONENTIAL_AT:1e9});const p=n=>Z.fromInt(a(n).dp(0).toNumber()).toUnsigned().toInt(),B=1.0001,H=n=>Math.log(new a(n).toNumber())/Math.log(B),I=()=>Math.floor(100*365*24*60*60+Date.now()/1e3),D="-443636",K="443636";var W=(n=>(n[n["PER_0.01_SPACING_1"]=0]="PER_0.01_SPACING_1",n[n["PER_0.05_SPACING_5"]=1]="PER_0.05_SPACING_5",n[n["PER_0.3_SPACING_60"]=2]="PER_0.3_SPACING_60",n[n.PER_1_SPACING_200=3]="PER_1_SPACING_200",n[n["PER_0.1_SPACING_20"]=4]="PER_0.1_SPACING_20",n[n["PER_0.25_SPACING_50"]=5]="PER_0.25_SPACING_50",n))(W||{});const it=["1","5","30","100","10","25"],Q=[1,10,60,200,20,50],at=[-443636,-443630,-443580,-443600,-443620,-443600],ct=[443636,443630,443580,443600,443620,443600],ut=0x28f5c28f5c28f60,g=(n,t)=>{const e=Q[t];return new a(n).div(e).dp(0,a.ROUND_HALF_UP).times(e).toString()},dt=({price:n,feeTierIndex:t,decimalsRatio:e})=>{const o=H(new a(n).div(e));return isNaN(o)?null:a(o).lt(0)?a.max(g(o,t),g(D,t)):a.min(g(o,t),g(K,t))},pt=({tick:n,decimalsRatio:t})=>new a(Math.pow(B,new a(n).dp(0).toNumber())).times(t).toString(),O=!1,f=n=>{if(!n.currencyA||!n.currencyB)throw new Error("currencyA and currencyB are required and can not be empty");if(!n.currencyA.startsWith("0x")||!n.currencyB.startsWith("0x"))throw new Error("currencyA and currencyB must be valid aptos account/token address")},w=n=>{if((!n.slippage||a(n.slippage).isNaN())&&(n.slippage=.5),a(n.slippage).lt(0))throw new Error("slippage must be greater than 0");if(a(n.slippage).gt(20))throw new Error("slippage must be less than 20")},h=(n,t)=>new a(n).minus(a(n).times(t).div(100)).dp(0).toNumber();a.config({EXPONENTIAL_AT:1e9});class lt{constructor(t){u(this,"_sdk");this._sdk=t}async fetchAllPools(){var e;const t=await this._sdk.requestModule.queryIndexer({document:tt});return((e=t==null?void 0:t.api)==null?void 0:e.getPoolStat)||[]}async fetchPoolById({poolId:t}){var o;const e=await this._sdk.requestModule.queryIndexer({document:et,variables:{poolId:t}});return((o=e==null?void 0:e.api)==null?void 0:o.getPoolStat)||[]}async getPoolByTokenPairAndFeeTier({token1:t,token2:e,feeTier:o}){const s=await this._sdk.requestModule.queryIndexer({document:st,variables:{token1:t,token2:e,feeTier:o}});return(s==null?void 0:s.api.getPoolByTokenPair)||{}}async createPoolTransactionPayload(t){f(t),w(t);const e=[t.currencyA,t.currencyB],o=[a(t.currencyAAmount).toNumber(),a(t.currencyBAmount).toNumber()],s=o.map(c=>h(c,t.slippage)),i=[a(t.feeTierIndex).toNumber(),O,p(t.tickLower),p(t.tickUpper),p(t.currentPriceTick),...o,...s,I()],r=[...i];return[r[5],r[6]]=[r[6],r[5]],[r[7],r[8]]=[r[8],r[7]],[r[2],r[3],r[4]]=[p(a(t.tickUpper).times(-1).toNumber()),p(a(t.tickLower).times(-1).toNumber()),p(a(t.currentPriceTick).times(-1).toNumber())],T.TokenPairs.TokenPairTypeCheck(e,[{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::create_liquidity_entry`,typeArguments:[],functionArguments:[...e,...i]},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::create_liquidity_both_coin_entry`,typeArguments:[...e],functionArguments:[...i]},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::create_liquidity_coin_entry`,typeArguments:[e[0]],functionArguments:[e[1],...i]},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::create_liquidity_coin_entry`,typeArguments:[e[1]],functionArguments:[e[0],...r]}])}async fetchTicks({poolId:t}){var o;const e=await this._sdk.requestModule.queryIndexer({document:nt,variables:{poolId:t}});return((o=e==null?void 0:e.api)==null?void 0:o.getLiquidityAccumulation)||[]}async estCurrencyAAmountFromB(t){const e={function:`${this._sdk.sdkOptions.contractAddress}::router_v3::optimal_liquidity_amounts_from_b`,typeArguments:[],functionArguments:[p(t.tickLower),p(t.tickUpper),p(t.currentPriceTick),t.currencyA,t.currencyB,t.feeTierIndex,t.currencyBAmount,0,0]};return console.log(e),await this._sdk.AptosClient.view({payload:e})}async estCurrencyBAmountFromA(t){const e={function:`${this._sdk.sdkOptions.contractAddress}::router_v3::optimal_liquidity_amounts_from_a`,typeArguments:[],functionArguments:[p(t.tickLower),p(t.tickUpper),p(t.currentPriceTick),t.currencyA,t.currencyB,t.feeTierIndex,t.currencyAAmount,0,0]};return await this._sdk.AptosClient.view({payload:e})}}const Y=`
amount
objectId
poolId
senderAddress
ownerAddress
token
type
`,yt=y.gql`
query queryClaimedFee($objectId: String = "", $ownerAddress:String = "") {
rewardStatement(where: { objectId: { _eq: $objectId }, ownerAddress: {_eq: $ownerAddress}, type: { _eq: ${0} } }) {
${Y}
}
}
`,mt=y.gql`
query queryClaimedRewards($objectId: String = "", $ownerAddress:String = "") {
rewardStatement(where: { objectId: { _eq: $objectId }, ownerAddress: {_eq: $ownerAddress}, type: { _eq: ${1} } }) {
${Y}
}
}
`;a.config({EXPONENTIAL_AT:1e9});class At{constructor(t){u(this,"_sdk");this._sdk=t}async fetchAllPositionsByAddress({address:t}){var o;const e=await this._sdk.requestModule.queryIndexer({document:ot,variables:{address:t}});return((o=e==null?void 0:e.api)==null?void 0:o.getPositionStatsByAddress)||[]}async fetchPositionById(t){const e=await this._sdk.requestModule.queryIndexer({document:rt,variables:{objectId:t.positionId,ownerAddress:t.address}});return(e==null?void 0:e.objectOwnership)||[]}async fetchFeeHistory(t){var o;return(o=(await this._sdk.requestModule.queryIndexer({document:yt,variables:{objectId:t.positionId,ownerAddress:t.address}})).rewardStatement)==null?void 0:o.filter(s=>!new a(s.amount).isEqualTo(0))}async addLiquidityTransactionPayload(t){f(t),w(t);const e=[t.currencyA,t.currencyB],o=[a(t.currencyAAmount).toNumber(),a(t.currencyBAmount).toNumber()],s=o.map(c=>h(c,t.slippage)),i=[a(t.feeTierIndex).toNumber(),O,...o,...s,I()],r=[...i];return[r[2],r[3]]=[r[3],r[2]],[r[4],r[5]]=[r[5],r[4]],T.TokenPairs.TokenPairTypeCheck(e,[{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::add_liquidity_entry`,typeArguments:[],functionArguments:[t.positionId,...e,...i]},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::add_liquidity_both_coin_entry`,typeArguments:[...e],functionArguments:[t.positionId,...i]},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::add_liquidity_coin_entry`,typeArguments:[e[0]],functionArguments:[t.positionId,e[1],...i]},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::add_liquidity_coin_entry`,typeArguments:[e[1]],functionArguments:[t.positionId,e[0],...r]}])}removeLiquidityTransactionPayload(t){if(console.log(t),f(t),w(t),!A.AccountAddress.isValid({input:t.recipient,strict:!0}).valid)throw new Error("Invalid recipient address");const e=[t.currencyA,t.currencyB],s=[a(t.currencyAAmount).toNumber(),a(t.currencyBAmount).toNumber()].map(r=>h(r,t.slippage)),i=[t.positionId,a(t.deltaLiquidity).dp(0).toNumber(),...s,t.recipient,I()];return T.TokenPairs.TokenPairTypeCheck(e,[{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::remove_liquidity_entry_v2`,typeArguments:[],functionArguments:i},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::remove_liquidity_both_coins_entry_v2`,typeArguments:[...e],functionArguments:i},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::remove_liquidity_coin_entry_v2`,typeArguments:[e[0]],functionArguments:i},{function:`${this._sdk.sdkOptions.contractAddress}::router_adapter::remove_liquidity_coin_entry_v2`,typeArguments:[e[1]],functionArguments:i}])}claimFeeTransactionPayload({positionId:t,recipient:e}){return{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::claim_fees`,typeArguments:[],functionArguments:[[t],e]}}claimRewardTransactionPayload({positionId:t,recipient:e}){return{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::claim_rewards`,typeArguments:[],functionArguments:[t,e]}}claimAllRewardsTransactionPayload({positionId:t,recipient:e}){return{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::claim_fees_and_rewards`,typeArguments:[],functionArguments:[[t],e]}}async fetchTokensAmountByPositionId({positionId:t}){const e={function:`${this._sdk.sdkOptions.contractAddress}::router_v3::get_amount_by_liquidity`,typeArguments:[],functionArguments:[t]};return await this._sdk.AptosClient.view({payload:e})}}class _t{constructor(t){u(this,"_indexerURL");u(this,"_officialIndexerURL");this._indexerURL=t.indexerURL,this._officialIndexerURL=t.officialIndexerURL}async queryIndexer({document:t,variables:e={}}){return await y({url:this._indexerURL,document:t,variables:e})}async queryOfficialIndexer({document:t,variables:e={}}){return await y({url:this._officialIndexerURL,document:t,variables:e})}get indexerURL(){return this._indexerURL}}a.config({EXPONENTIAL_AT:1e9});class ft{constructor(t){u(this,"_sdk");this._sdk=t}fetchRewardsPayload({positionId:t}){return{function:`${this._sdk.sdkOptions.contractAddress}::pool_v3::get_pending_rewards`,typeArguments:[],functionArguments:[t]}}async fetchRewardHistory(t){var o;return(o=(await this._sdk.requestModule.queryIndexer({document:mt,variables:{objectId:t.positionId,ownerAddress:t.address}})).rewardStatement)==null?void 0:o.filter(s=>!new a(s.amount).isEqualTo(0))}claimRewardPayload({positionId:t,recipient:e}){return{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::claim_rewards`,typeArguments:[],functionArguments:[t,e]}}}const S="0xc3290d98d622b9ab354277e0b1c5e66552f9784d2d4fb473ff321b9338485117",wt="hyperion-aggregator";async function C(n,t){let e=await b(n,"0x1::fungible_asset::Metadata",t);return(await n.addBatchedCalls({function:"0x1::fungible_asset::zero",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[e]}))[0]}async function ht(n,t,e){return(await n.addBatchedCalls({function:"0x1::fungible_asset::extract",typeArguments:[],functionArguments:[t.borrowMut(),e]}))[0]}async function N(n,t,e){await n.addBatchedCalls({function:"0x1::fungible_asset::merge",typeArguments:[],functionArguments:[t.borrowMut(),e]})}async function kt(n,t,e){return(await n.addBatchedCalls({function:"0x1::primary_fungible_store::withdraw",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[k.CallArgument.newSigner(0),t,e]}))[0]}async function _(n,t,e){await n.addBatchedCalls({function:"0x1::primary_fungible_store::deposit",typeArguments:[],functionArguments:[t,e]})}async function $(n,t){return(await n.addBatchedCalls({function:"0x1::fungible_asset::amount",typeArguments:[],functionArguments:[t.borrow()]}))[0]}async function b(n,t,e){return(await n.addBatchedCalls({function:"0x1::object::address_to_object",typeArguments:[t],functionArguments:[e]}))[0]}async function gt(n,t,e,o){return(await n.addBatchedCalls({function:`${S}::tool::split_fa_proportionlly`,typeArguments:[],functionArguments:[t.borrowMut(),e,o*100]}))[0]}async function U(n,t,e){await n.addBatchedCalls({function:`${S}::tool::fa_amount_check`,typeArguments:[],functionArguments:[t.borrow(),e]})}async function Tt(n,t,e,o){await n.addBatchedCalls({function:`${S}::tool::deposit_fa_exact`,typeArguments:[],functionArguments:[t,e.borrowMut(),o]})}async function St(n){return(await n.addBatchedCalls({function:`${S}::tool::get_signer_address`,typeArguments:[],functionArguments:[k.CallArgument.newSigner(0)]}))[0]}const Pt="0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1";async function It(n,t,e,o){return(await n.addBatchedCalls({function:`${Pt}::router::swap`,typeArguments:[],functionArguments:[t,0,e,o]}))[0]}async function bt(n,t,e,o,s,i,r,c,d){let l=await $(n,i),m=await n.addBatchedCalls({function:`${c.contractAddress}::partnership::swap`,typeArguments:[],functionArguments:[e,o,s,l,i,r,d||wt]});return await _(n,t,m[1]),m[2]}const x="0x7730cd28ee1cdc9e999336cbc430f99e7c44397c0aa77516f6f23a78559bb5";async function qt(n,t,e,o){let s=await b(n,"0x1::fungible_asset::Metadata",o);return(await n.addBatchedCalls({function:`${x}::pool::swap_exact_in_stable`,typeArguments:[],functionArguments:[k.CallArgument.newSigner(0),t,e,s]}))[0]}async function Ct(n,t,e,o){let s=await b(n,"0x1::fungible_asset::Metadata",o);return(await n.addBatchedCalls({function:`${x}::pool::swap_exact_in_metastable`,typeArguments:[],functionArguments:[k.CallArgument.newSigner(0),t,e,s]}))[0]}async function Nt(n,t,e,o){return(await n.addBatchedCalls({function:`${x}::pool::swap_exact_in_weighted`,typeArguments:[],functionArguments:[k.CallArgument.newSigner(0),t,e,o]}))[0]}async function $t(n,t,e,o,s,i,r,c){return(await n.addBatchedCalls({function:`${S}::tool::swap_in_emoji`,typeArguments:[t,e],functionArguments:[k.CallArgument.newSigner(0),s,i,r,c,o]}))[1]}async function Et(n,t,e,o,s,i){let r;return r=await bt(n,o.copy(),t.poolId,t.a2b,!0,e,t.sqrtPriceLimit,s,i),r}async function Bt(n,t,e){let o;if(t.poolType=="stable")o=!0;else if(t.poolType=="unstable")o=!1;else throw"pool type mismatch";return await It(n,e,t.toToken.tokenType,o)}async function Ot(n,t,e){let o;if(t.poolType=="stable")o=await qt(n,t.poolId,e,t.toToken.tokenType);else if(t.poolType=="weighted")o=await Nt(n,t.poolId,e,t.toToken.tokenType);else if(t.poolType=="meta")o=await Ct(n,t.poolId,e,t.toToken.tokenType);else throw"type mismatch";return o}async function xt(n,t,e){return await $t(n,t.firstType,t.secondType,e,t.poolId,t.isSell,t.integrator,t.integratorFee)}async function Rt(n,t,e,o,s,i){let r;if(t.dexName=="Hyperion")r=await Et(n,t,e,o.copy(),s,i);else if(t.dexName=="Cellana")r=await Bt(n,t,e);else if(t.dexName=="ThalaSwapV2")r=await Ot(n,t,e);else if(t.dexName=="EmojiCoin")r=await xt(n,t,e);else throw"Dex Not Supported";return r}async function j(n,t,e,o,s,i){for(const r of t){let c;c=await C(n,r.toToken.tokenType);let d=await Rt(n,r,e,o.copy(),s,i);await N(n,c,d),e=c}return e}class vt{constructor(t){u(this,"_sdk");this._sdk=t}async fetchAggregateSwapRoute(t){const e=new URLSearchParams({slippage:t.slippage.toString(),amount:t.amount.toString(),from:t.from,input:t.input,to:t.to}),o=await fetch(`${this._sdk.sdkOptions.hyperionAPIHost}/base/aggregator/getAggRoute?${e.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`Failed to fetch aggregate swap route: ${o.statusText}`);return await o.json()}async generateAggregateSwapTransactionScript(t){const{builder:e}=t;let o=await St(e),s;t.exactIn?s=Number(t.fromTokenAmount):s=Number(t.maxFromTokenAmount);let i,r,c=await b(e,"0x1::fungible_asset::Metadata",t.fromToken.address);r=await kt(e,c,s),i=await $(e,r);const d=await C(e,t.toToken.address);for(const l of t.quotes.route){let m;m=await ht(e,r,l.amountIn);let P=await j(e,l.routeTaken,m,o.copy(),this._sdk.sdkOptions,t.partnershipId);await N(e,d,P)}if(t.exactIn)await U(e,d,Number(t.minToTokenAmount)),await _(e,o.copy(),d),await _(e,o.copy(),r);else{let l=0;await U(e,d,Number(t.toTokenAmount)),await Tt(e,o.copy(),d,Number(t.toTokenAmount));let m;m=await C(e,t.fromToken.address),i=await $(e,d);for(const P of t.quotes.refundRoute){let R,q=P.percentage;l+=q,l==100&&(q=100),R=await gt(e,d,i.copy(),q);let V=await j(e,P.routeTaken,R,o.copy(),this._sdk.sdkOptions,t.partnershipId);await N(e,m,V)}if(await _(e,o.copy(),d),await _(e,o.copy(),r),await _(e,o.copy(),m),l!=100)throw"not 100% refund"}}}class Lt{constructor(t){u(this,"_sdk");u(this,"_aggregateSwapHelper");this._sdk=t,this._aggregateSwapHelper=new vt(t)}swapTransactionPayload(t){f(t),w(t);const e=[t.currencyA,t.currencyB],o=[t.currencyAAmount,t.currencyBAmount],s=[o[0],h(o[1],t.slippage)],i=[...e];i.forEach((c,d)=>{if((c==null?void 0:c.indexOf("::"))>-1){const l=new T.Token({coinType:c,name:"token",symbol:"token",decimals:5,assetType:""});l.faTypeCalculate(),l.faType&&(i[d]=l.faType)}});const r=[t.poolRoute,...i,...s,t.recipient];return T.TokenPairs.TokenPairTypeCheck(e,[{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::swap_batch`,typeArguments:[],functionArguments:[...r]},{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::swap_batch_coin_entry`,typeArguments:[e[0]],functionArguments:[...r]},{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::swap_batch_coin_entry`,typeArguments:[e[0]],functionArguments:[...r]},{function:`${this._sdk.sdkOptions.contractAddress}::router_v3::swap_batch`,typeArguments:[],functionArguments:[...r]}])}swapWithPartnershipTransactionPayload(t){if(f(t),w(t),!t.partnership||t.partnership.length===0)throw new Error("partnership is required");const e=[t.currencyA,t.currencyB],o=[t.currencyAAmount,t.currencyBAmount],s=[o[0],h(o[1],t.slippage)];return{function:`${this._sdk.sdkOptions.contractAddress}::partnership::swap_batch_directly_deposit`,typeArguments:[],functionArguments:[t.poolRoute,e[0],e[1],...s,t.partnership]}}async estFromAmount(t){const e=new URLSearchParams({amount:t.amount.toString(),from:t.from,to:t.to,safeMode:t.safeMode?"true":"false",flag:"out"});return await(await fetch(`${this._sdk.sdkOptions.hyperionAPIHost}/base/rate/getSwapInfo?${e.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async estToAmount(t){const e=new URLSearchParams({amount:t.amount.toString(),from:t.from,to:t.to,safeMode:t.safeMode?"true":"false",flag:"in"});return await(await fetch(`${this._sdk.sdkOptions.hyperionAPIHost}/base/rate/getSwapInfo?${e.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async estAmountByAggregateSwap(t){if(this._sdk.sdkOptions.network!==A.Network.MAINNET)throw new Error("Aggregate swap is only supported on MAINNET");return await this._aggregateSwapHelper.fetchAggregateSwapRoute(t)}async generateAggregateSwapTransactionScript(t){if(this._sdk.sdkOptions.network!==A.Network.MAINNET)throw new Error("Aggregate swap is only supported on MAINNET");return await this._aggregateSwapHelper.generateAggregateSwapTransactionScript(t)}}const Mt={network:A.Network.TESTNET,contractAddress:"0x69faed94da99abb7316cb3ec2eeaa1b961a47349fad8c584f67a930b0d14fec7",hyperionFullNodeIndexerURL:"https://api-testnet.hyperion.xyz/v1/graphql",hyperionAPIHost:"https://api-testnet.hyperion.xyz",officialFullNodeIndexerURL:"https://api.testnet.aptoslabs.com/v1/graphql",APTOS_API_KEY:""},Ut={network:A.Network.MAINNET,contractAddress:"0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22e05c",hyperionFullNodeIndexerURL:"https://api.hyperion.xyz/v1/graphql",hyperionAPIHost:"https://api.hyperion.xyz",officialFullNodeIndexerURL:"https://api.mainnet.aptoslabs.com/v1/graphql",APTOS_API_KEY:""};function jt(n){const{network:t,APTOS_API_KEY:e}=n;return new z({...t==A.Network.MAINNET?Ut:Mt,APTOS_API_KEY:e})}class z{constructor(t){u(this,"_options");u(this,"_requestModule");u(this,"_pool");u(this,"_position");u(this,"_swap");u(this,"_reward");u(this,"_aptosClient");this._options=t,this._requestModule=new _t({indexerURL:this._options.hyperionFullNodeIndexerURL,officialIndexerURL:this._options.officialFullNodeIndexerURL}),this._pool=new lt(this),this._position=new At(this),this._swap=new Lt(this),this._reward=new ft(this);const e={API_KEY:this._options.APTOS_API_KEY};this._aptosClient=new A.Aptos(new A.AptosConfig({network:this._options.network,clientConfig:e}))}get Pool(){return this._pool}get Position(){return this._position}get Swap(){return this._swap}get Reward(){return this._reward}get AptosClient(){return this._aptosClient}get sdkOptions(){return this._options}get requestModule(){return this._requestModule}}exports.BASE=B;exports.FeeTierIndex=W;exports.FeeTierItems=it;exports.FeeTierStep=Q;exports.HIGHEST_TICK=K;exports.HighestTickByStep=ct;exports.HyperionSDK=z;exports.LOWEST_TICK=D;exports.LowestTickByStep=at;exports.POOL_STABLE_TYPE=O;exports.currencyCheck=f;exports.initHyperionSDK=jt;exports.logBase=H;exports.poolDeadline=I;exports.priceToTick=dt;exports.roundTickBySpacing=g;exports.slippageCalculator=h;exports.slippageCheck=w;exports.tickComplement=p;exports.tickToPrice=pt;exports.u64Max=ut;