UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

2 lines 92 kB
var zo=Object.defineProperty,Xo=Object.defineProperties;var Yo=Object.getOwnPropertyDescriptors;var yt=Object.getOwnPropertySymbols;var Mn=Object.prototype.hasOwnProperty,Fn=Object.prototype.propertyIsEnumerable;var Nn=(n,e,t)=>e in n?zo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,x=(n,e)=>{for(var t in e||(e={}))Mn.call(e,t)&&Nn(n,t,e[t]);if(yt)for(var t of yt(e))Fn.call(e,t)&&Nn(n,t,e[t]);return n},v=(n,e)=>Xo(n,Yo(e));var ge=(n,e)=>{var t={};for(var i in n)Mn.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&yt)for(var i of yt(n))e.indexOf(i)<0&&Fn.call(n,i)&&(t[i]=n[i]);return t};import{PublicKey as Vn}from"@solana/web3.js";import{get as Wt,set as vn}from"lodash";var Ho=(r=>(r[r.Error=0]="Error",r[r.Warning=1]="Warning",r[r.Info=2]="Info",r[r.Debug=3]="Debug",r))(Ho||{}),qt=class{constructor(e){this.logLevel=e.logLevel!==void 0?e.logLevel:0,this.name=e.name}set level(e){this.logLevel=e}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(e){return e<=this.logLevel}error(...e){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...e),this):this}logWithError(...e){let t=e.map(i=>typeof i=="object"?JSON.stringify(i):i).join(", ");throw new Error(t)}warning(...e){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...e),this):this}info(...e){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...e),this):this}debug(...e){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...e),this):this}},Ut={},_n={};function _(n){let e=Wt(Ut,n);if(!e){let t=Wt(_n,n);e=new qt({name:n,logLevel:t}),vn(Ut,n,e)}return e}function bs(n,e){vn(_n,n,e);let t=Wt(Ut,n);t&&(t.level=e)}import{MINT_SIZE as Qo,TOKEN_PROGRAM_ID as Zo,getTransferFeeConfig as $o,unpackMint as jo}from"@solana/spl-token";var Gt=_("Raydium_accountInfo_util");async function Pe(n,e,t){let{batchRequest:i,commitment:r="confirmed",chunkCount:c=100}=x({batchRequest:!1},t),m=zt(e,c),l=new Array(m.length).fill([]);if(i){let d=m.map(A=>{let C=n._buildArgs([A.map(B=>B.toBase58())],r,"base64");return{methodName:"getMultipleAccounts",args:C}}),y=zt(d,10);l=(await(await Promise.all(y.map(async A=>await n._rpcBatchRequest(A)))).flat()).map(A=>(A.error&&Gt.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${A.error.message}`),A.result.value.map(C=>{if(C){let{data:B,executable:F,lamports:w,owner:I,rentEpoch:K}=C;return B.length!==2&&B[1]!=="base64"&&Gt.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(B[0],"base64"),executable:F,lamports:w,owner:new Vn(I),rentEpoch:K}}return null})))}else try{l=await Promise.all(m.map(d=>n.getMultipleAccountsInfo(d,r)))}catch(d){d instanceof Error&&Gt.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${d.message}`)}return l.flat()}async function Ke(n,e,t){let i=await Pe(n,e.map(r=>r.pubkey),t);return e.map((r,c)=>v(x({},r),{accountInfo:i[c]}))}var Jo=(i=>(i[i.Uninitialized=0]="Uninitialized",i[i.Mint=1]="Mint",i[i.Account=2]="Account",i))(Jo||{}),Bs=1;async function Xt({connection:n,mints:e,config:t}){var c,m,l;if(e.length===0)return{};let i=await Ke(n,e.map(d=>({pubkey:Le(d)})),t),r={};for(let d of i){if(!d.accountInfo||d.accountInfo.data.length<Qo){console.log("invalid mint account",d.pubkey.toBase58());continue}let y=jo(d.pubkey,d.accountInfo,(c=d.accountInfo)==null?void 0:c.owner);r[d.pubkey.toString()]=v(x({},y),{programId:((m=d.accountInfo)==null?void 0:m.owner)||Zo,feeConfig:(l=$o(y))!=null?l:void 0})}return r[Vn.default.toBase58()]=r[Ae.toBase58()],r}import j from"bn.js";import ms from"decimal.js";import ai from"big.js";import xe from"bn.js";import ei from"toformat";var ti=ei,Je=ti;import gt from"big.js";import ni from"bn.js";import oi from"decimal.js-light";import et from"bn.js";var Yt=(i=>(i[i.ROUND_DOWN=0]="ROUND_DOWN",i[i.ROUND_HALF_UP=1]="ROUND_HALF_UP",i[i.ROUND_UP=2]="ROUND_UP",i))(Yt||{}),En=9007199254740991;function Q(n){let e=_("Raydium_parseBigNumberish");if(n instanceof et)return n;if(typeof n=="string"){if(n.match(/^-?[0-9]+$/))return new et(n);e.logWithError(`invalid BigNumberish string: ${n}`)}return typeof n=="number"?(n%1&&e.logWithError(`BigNumberish number underflow: ${n}`),(n>=En||n<=-En)&&e.logWithError(`BigNumberish number overflow: ${n}`),new et(String(n))):typeof n=="bigint"?new et(n.toString()):(e.error(`invalid BigNumberish value: ${n}`),new et(0))}var bt=_("module/fraction"),Ht=Je(gt),tt=Je(oi),ii={[0]:tt.ROUND_DOWN,[1]:tt.ROUND_HALF_UP,[2]:tt.ROUND_UP},ri={[0]:gt.roundDown,[1]:gt.roundHalfUp,[2]:gt.roundUp},L=class{constructor(e,t=new ni(1)){this.numerator=Q(e),this.denominator=Q(t)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new L(this.denominator,this.numerator)}add(e){let t=e instanceof L?e:new L(Q(e));return this.denominator.eq(t.denominator)?new L(this.numerator.add(t.numerator),this.denominator):new L(this.numerator.mul(t.denominator).add(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}sub(e){let t=e instanceof L?e:new L(Q(e));return this.denominator.eq(t.denominator)?new L(this.numerator.sub(t.numerator),this.denominator):new L(this.numerator.mul(t.denominator).sub(t.numerator.mul(this.denominator)),this.denominator.mul(t.denominator))}mul(e){let t=e instanceof L?e:new L(Q(e));return new L(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof L?e:new L(Q(e));return new L(this.numerator.mul(t.denominator),this.denominator.mul(t.numerator))}toSignificant(e,t={groupSeparator:""},i=1){Number.isInteger(e)||bt.logWithError(`${e} is not an integer.`),e<=0&&bt.logWithError(`${e} is not positive.`),tt.set({precision:e+1,rounding:ii[i]});let r=new tt(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)}toFixed(e,t={groupSeparator:""},i=1){return Number.isInteger(e)||bt.logWithError(`${e} is not an integer.`),e<0&&bt.logWithError(`${e} is negative.`),Ht.DP=e,Ht.RM=ri[i]||1,new Ht(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var si=_("Raydium_amount"),Pt=Je(ai);function Dn(n,e){let t="0",i="0";if(n.includes(".")){let r=n.split(".");r.length===2?([t,i]=r,i=i.padEnd(e,"0")):si.logWithError(`invalid number string, num: ${n}`)}else t=n;return[t,i.slice(0,e)||i]}var ie=class extends L{constructor(t,i,r=!0,c){let m=new xe(0),l=Ne.pow(new xe(t.decimals));if(r)m=Q(i);else{let d=new xe(0),y=new xe(0);if(typeof i=="string"||typeof i=="number"||typeof i=="bigint"){let[b,A]=Dn(i.toString(),t.decimals);d=Q(b),y=Q(A)}d=d.mul(l),m=d.add(y)}super(m,l);this.logger=_(c||"TokenAmount"),this.token=t}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(t){return this.token.equals(t.token)||this.logger.logWithError("gt token not equals"),this.raw.gt(t.raw)}lt(t){return this.token.equals(t.token)||this.logger.logWithError("lt token not equals"),this.raw.lt(t.raw)}add(t){return this.token.equals(t.token)||this.logger.logWithError("add token not equals"),new ie(this.token,this.raw.add(t.raw))}subtract(t){return this.token.equals(t.token)||this.logger.logWithError("sub token not equals"),new ie(this.token,this.raw.sub(t.raw))}toSignificant(t=this.token.decimals,i,r=0){return super.toSignificant(t,i,r)}toFixed(t=this.token.decimals,i,r=0){return t>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,i,r)}toExact(t={groupSeparator:""}){return Pt.DP=this.token.decimals,new Pt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}},Oe=class extends L{constructor(t,i,r=!0,c){let m=new xe(0),l=Ne.pow(new xe(t.decimals));if(r)m=Q(i);else{let d=new xe(0),y=new xe(0);if(typeof i=="string"||typeof i=="number"||typeof i=="bigint"){let[b,A]=Dn(i.toString(),t.decimals);d=Q(b),y=Q(A)}d=d.mul(l),m=d.add(y)}super(m,l);this.logger=_(c||"TokenAmount"),this.currency=t}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(t){return this.currency.equals(t.currency)||this.logger.logWithError("gt currency not equals"),this.raw.gt(t.raw)}lt(t){return this.currency.equals(t.currency)||this.logger.logWithError("lt currency not equals"),this.raw.lt(t.raw)}add(t){return this.currency.equals(t.currency)||this.logger.logWithError("add currency not equals"),new Oe(this.currency,this.raw.add(t.raw))}sub(t){return this.currency.equals(t.currency)||this.logger.logWithError("sub currency not equals"),new Oe(this.currency,this.raw.sub(t.raw))}toSignificant(t=this.currency.decimals,i,r=0){return super.toSignificant(t,i,r)}toFixed(t=this.currency.decimals,i,r=0){return t>this.currency.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(t,i,r)}toExact(t={groupSeparator:""}){return Pt.DP=this.currency.decimals,new Pt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)}};import{PublicKey as ui}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Wn}from"@solana/spl-token";var At={chainId:101,address:ui.default.toBase58(),programId:Wn.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},we={chainId:101,address:"So11111111111111111111111111111111111111112",programId:Wn.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img-v1.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};import{PublicKey as jt}from"@solana/web3.js";import{PublicKey as Y,SystemProgram as qn,SYSVAR_RENT_PUBKEY as ci}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as li}from"@solana/spl-token";function Ee({pubkey:n,isSigner:e=!1,isWritable:t=!0}){return{pubkey:n,isWritable:t,isSigner:e}}var mi=[Ee({pubkey:li,isWritable:!1}),Ee({pubkey:qn.programId,isWritable:!1}),Ee({pubkey:ci,isWritable:!1})];function Qt({publicKey:n,transformSol:e}){let t=Zt(n.toString());if(t instanceof Y)return e&&t.equals(Me)?Ae:t;if(e&&t.toString()===Me.toBase58())return Ae;if(typeof t=="string"){if(t===Y.default.toBase58())return Y.default;try{return new Y(t)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function Zt(n){try{return new Y(n)}catch{return n}}var $t=new Y("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),nt=new Y("SysvarRent111111111111111111111111111111111"),ou=new Y("SysvarC1ock11111111111111111111111111111111"),wt=new Y("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),di=new Y("Sysvar1nstructions1111111111111111111111111"),pi=qn.programId,iu=new Y("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),ru=new Y("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),au=new Y("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),su=new Y("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),uu=new Y("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),cu=new Y("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),lu=new Y("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),mu=new Y("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),du=new Y("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),pu=new Y("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),fu=new Y("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),Ae=new Y("So11111111111111111111111111111111111111112"),Me=Y.default;function Le(n){return Qt({publicKey:n,transformSol:!0})}var Jt=class{constructor({mint:e,decimals:t,symbol:i,name:r,skipMint:c=!1,isToken2022:m=!1}){if(e===Me.toBase58()||e instanceof jt&&Me.equals(e)){this.decimals=we.decimals,this.symbol=we.symbol,this.name=we.name,this.mint=new jt(we.address),this.isToken2022=!1;return}this.decimals=t,this.symbol=i||e.toString().substring(0,6),this.name=r||e.toString().substring(0,6),this.mint=c?jt.default:Qt({publicKey:e}),this.isToken2022=m}equals(e){return this===e?!0:this.mint.equals(e.mint)}},J=Jt;J.WSOL=new Jt(v(x({},we),{mint:we.address}));var en=class{constructor({decimals:e,symbol:t="UNKNOWN",name:i="UNKNOWN"}){this.decimals=e,this.symbol=t,this.name=i}equals(e){return this===e}},ot=en;ot.SOL=new en(At);import fi from"bn.js";var Un=new L(new fi(100)),me=class extends L{toSignificant(e=5,t,i){return this.mul(Un).toSignificant(e,t,i)}toFixed(e=2,t,i){return this.mul(Un).toFixed(e,t,i)}};var yi=_("Raydium_price"),se=class extends L{constructor(t){let{baseToken:i,quoteToken:r,numerator:c,denominator:m}=t;super(c,m);this.baseToken=i,this.quoteToken=r,this.scalar=new L(tn(i.decimals),tn(r.decimals))}get raw(){return new L(this.numerator,this.denominator)}get adjusted(){return super.mul(this.scalar)}invert(){return new se({baseToken:this.quoteToken,quoteToken:this.baseToken,denominator:this.numerator,numerator:this.denominator})}mul(t){this.quoteToken!==t.baseToken&&yi.logWithError("mul token not equals");let i=super.mul(t);return new se({baseToken:this.baseToken,quoteToken:t.quoteToken,denominator:i.denominator,numerator:i.numerator})}toSignificant(t=this.quoteToken.decimals,i,r){return this.adjusted.toSignificant(t,i,r)}toFixed(t=this.quoteToken.decimals,i,r){return this.adjusted.toFixed(t,i,r)}};import{merge as jC}from"lodash";import Vu from"axios";var Gn={BASE_HOST:"https://api-v3.raydium.io",OWNER_BASE_HOST:"https://owner-v1.raydium.io",SERVICE_BASE_HOST:"https://service.raydium.io",MONITOR_BASE_HOST:"https://monitor.raydium.io",SERVICE_1_BASE_HOST:"https://service-v1.raydium.io",TEMP_HOST:"https://temp-api-v1.raydium.io",SEND_TRANSACTION:"/send-transaction",FARM_ARP:"/main/farm/info",FARM_ARP_LINE:"/main/farm-apr-tv",CLMM_CONFIG:"/main/clmm-config",CPMM_CONFIG:"/main/cpmm-config",CLMM_DYNAMIC_CONFIG:"/main/clmm-dynamic-config",VERSION:"/main/version",CHECK_AVAILABILITY:"/v3/main/AvailabilityCheckAPI",RPCS:"/main/rpcs",INFO:"/main/info",STAKE_POOLS:"/main/stake-pools",CHAIN_TIME:"/main/chain-time",TOKEN_LIST:"/mint/list",MINT_INFO_ID:"/mint/ids",JUP_TOKEN_LIST:"https://lite-api.jup.ag/tokens/v2/tag?query=verified",POOL_LIST:"/pools/info/list-v2",POOL_SEARCH_BY_ID:"/pools/info/ids",POOL_SEARCH_MINT:"/pools/info/list-v2",POOL_SEARCH_LP:"/pools/info/lps",POOL_KEY_BY_ID:"/pools/key/ids",POOL_LIQUIDITY_LINE:"/pools/line/liquidity",POOL_POSITION_LINE:"/pools/line/position",FARM_INFO:"/farms/info/ids",FARM_LP_INFO:"/farms/info/lp",FARM_KEYS:"/farms/key/ids",OWNER_CREATED_FARM:"/create-pool/{owner}",OWNER_STAKE_FARMS:"/position/stake/{owner}",OWNER_LOCK_POSITION:"/position/clmm-lock/{owner}",SWAP_HOST:"https://transaction-v1.raydium.io",SWAP_COMPUTE:"/compute/",SWAP_TX:"/transaction/",MINT_PRICE:"/mint/price",MIGRATE_CONFIG:"/main/migrate-lp",PRIORITY_FEE:"/main/auto-fee",CPMM_LOCK:"https://dynamic-ipfs.raydium.io/lock/cpmm/position",LAUNCH_AUTH_HOST:"https://launch-auth-v1.raydium.io",LAUNCH_COMMENT_HOST:"hhttps://launch-forum-v1.raydium.io",LAUNCH_HISTORY_HOST:"https://launch-history-v1.raydium.io",LAUNCH_MINT_HOST:"https://launch-mint-v1.raydium.io"},bi=v(x({},Gn),{BASE_HOST:"https://api-v3-devnet.raydium.io",OWNER_BASE_HOST:"https://owner-v1-devnet.raydium.io",SWAP_HOST:"https://transaction-v1-devnet.raydium.io",CPMM_LOCK:"https://dynamic-ipfs-devnet.raydium.io/lock/cpmm/position",TEMP_HOST:"https://temp-api-v1-devnet.raydium.io",LAUNCH_AUTH_HOST:"https://launch-auth-v1-devnet.raydium.io",LAUNCH_COMMENT_HOST:"https://launch-forum-v1-devnet.raydium.io",LAUNCH_HISTORY_HOST:"https://launch-history-v1-devnet.raydium.io",LAUNCH_MINT_HOST:"https://launch-mint-v1-devnet.raydium.io"});var sc=_("Raydium_Api");var Ie=class{constructor(e){this._owner=e}get publicKey(){return Ie.isKeyPair(this._owner)?this._owner.publicKey:this._owner}get signer(){return Ie.isKeyPair(this._owner)?this._owner:void 0}get isKeyPair(){return Ie.isKeyPair(this._owner)}get isPublicKey(){return Ie.isPublicKey(this._owner)}static isKeyPair(e){return e.secretKey!==void 0}static isPublicKey(e){return!Ie.isKeyPair(e)}};import{PublicKey as Rm,SystemProgram as Lm}from"@solana/web3.js";import{AccountLayout as vm,createAssociatedTokenAccountIdempotentInstruction as _m,TOKEN_PROGRAM_ID as Vm,TOKEN_2022_PROGRAM_ID as Em}from"@solana/spl-token";import{PublicKey as Ge,sendAndConfirmTransaction as un,SystemProgram as Ti,Transaction as at,TransactionMessage as st,VersionedTransaction as ut}from"@solana/web3.js";import hi from"axios";import{PublicKey as nn,AddressLookupTableAccount as qe}from"@solana/web3.js";async function on({connection:n,address:e,cluster:t="mainnet"}){let i=await Pe(n,[...new Set(e.map(c=>c.toString()))].map(c=>new nn(c))),r={};for(let c=0;c<e.length;c++){let m=i[c],l=e[c];if(!m)continue;let d=new qe({key:l,state:qe.deserialize(m.data)});r[l.toString()]=d,t==="devnet"?We[l.toString()]=d:De[l.toString()]=d}return r}var De={},rn=async n=>{let e="AcL1Vo8oy1ULiavEcjSUcwfBSForXMudcZvDZy5nzJkU";if(De[e])return De;let t=new nn(e),i=await n.getAccountInfo(t);return i&&(De[e]=new qe({key:t,state:qe.deserialize(i.data)})),De},We={},an=async n=>{let e="EFhMuDw1PKEuckuFRW9PavNfTH4LKP5uKHgyXDmWpFCq";if(We[e])return We;let t=new nn(e),i=await n.getAccountInfo(t);return i&&(We[e]=new qe({key:t,state:qe.deserialize(i.data)})),We};var Be=(t=>(t[t.V0=0]="V0",t[t.LEGACY=1]="LEGACY",t))(Be||{}),te={CreateAccount:"CreateAccount",InitAccount:"InitAccount",CreateATA:"CreateATA",CloseAccount:"CloseAccount",TransferAmount:"TransferAmount",InitMint:"InitMint",MintTo:"MintTo",InitMarket:"InitMarket",Util1216OwnerClaim:"Util1216OwnerClaim",SetComputeUnitPrice:"SetComputeUnitPrice",SetComputeUnitLimit:"SetComputeUnitLimit",ClmmCreatePool:"ClmmCreatePool",ClmmOpenPosition:"ClmmOpenPosition",ClmmIncreasePosition:"ClmmIncreasePosition",ClmmDecreasePosition:"ClmmDecreasePosition",ClmmClosePosition:"ClmmClosePosition",ClmmSwapBaseIn:"ClmmSwapBaseIn",ClmmSwapBaseOut:"ClmmSwapBaseOut",ClmmInitReward:"ClmmInitReward",ClmmSetReward:"ClmmSetReward",ClmmCollectReward:"ClmmCollectReward",ClmmLockPosition:"ClmmLockPosition",ClmmHarvestLockPosition:"ClmmHarvestLockPosition",AmmV4Swap:"AmmV4Swap",AmmV4AddLiquidity:"AmmV4AddLiquidity",AmmV4RemoveLiquidity:"AmmV4RemoveLiquidity",AmmV4SimulatePoolInfo:"AmmV4SimulatePoolInfo",AmmV4SwapBaseIn:"AmmV4SwapBaseIn",AmmV4SwapBaseOut:"AmmV4SwapBaseOut",AmmV4CreatePool:"AmmV4CreatePool",AmmV4InitPool:"AmmV4InitPool",AmmV5AddLiquidity:"AmmV5AddLiquidity",AmmV5RemoveLiquidity:"AmmV5RemoveLiquidity",AmmV5SimulatePoolInfo:"AmmV5SimulatePoolInfo",AmmV5SwapBaseIn:"AmmV5SwapBaseIn",AmmV5SwapBaseOut:"AmmV5SwapBaseOut",RouteSwap:"RouteSwap",RouteSwap1:"RouteSwap1",RouteSwap2:"RouteSwap2",FarmV3Deposit:"FarmV3Deposit",FarmV3Withdraw:"FarmV3Withdraw",FarmV3CreateLedger:"FarmV3CreateLedger",FarmV4Withdraw:"FarmV4Withdraw",FarmV5Deposit:"FarmV5Deposit",FarmV5Withdraw:"FarmV5Withdraw",FarmV5CreateLedger:"FarmV5CreateLedger",FarmV6Deposit:"FarmV6Deposit",FarmV6Withdraw:"FarmV6Withdraw",FarmV6Create:"FarmV6Create",FarmV6Restart:"FarmV6Restart",FarmV6CreatorAddReward:"FarmV6CreatorAddReward",FarmV6CreatorWithdraw:"FarmV6CreatorWithdraw",CpmmCreatePool:"CpmmCreatePool",CpmmAddLiquidity:"CpmmAddLiquidity",CpmmWithdrawLiquidity:"CpmmWithdrawLiquidity",CpmmSwapBaseIn:"CpmmSwapBaseIn",CpmmSwapBaseOut:"CpmmSwapBaseOut",CpmmLockLp:"CpmmLockLp",CpmmCollectLockFee:"CpmmCollectLockFee",TransferTip:"TransferTip"};import{ComputeBudgetProgram as zn,Keypair as Xn,PublicKey as Yn,Transaction as Tt,TransactionMessage as Pi,VersionedTransaction as sn}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Ai}from"@solana/spl-token";var Se=_("Raydium_txUtil"),Hn=1644;function ht(n){let e=[],t=[];return n.microLamports&&(e.push(zn.setComputeUnitPrice({microLamports:n.microLamports})),t.push(te.SetComputeUnitPrice)),n.units&&(e.push(zn.setComputeUnitLimit({units:n.units})),t.push(te.SetComputeUnitLimit)),{instructions:e,instructionTypes:t}}async function Ue(n,e){var i,r;let t=e!=null?e:"confirmed";return(r=await((i=n.getLatestBlockhash)==null?void 0:i.call(n,{commitment:t})))==null?void 0:r.blockhash}async function It(n,e){return n.getSignatureStatuses([e]),new Promise((t,i)=>{let r=setTimeout(i,6e4);n.onSignature(e,c=>{if(clearTimeout(r),!c.err){t("");return}i(Object.assign(c.err,{txId:e}))},"confirmed")})}function Bt(n,e){n.length<1&&Se.logWithError(`no instructions provided: ${n.toString()}`),e.length<1&&Se.logWithError(`no signers provided:, ${e.toString()}`);let t=new Tt;t.recentBlockhash="11111111111111111111111111111111",t.feePayer=e[0],t.add(...n);try{return Buffer.from(t.serialize({verifySignatures:!1})).toString("base64").length<Hn}catch{return!1}}async function Rc(n,e,t,i=!0){let r=new Yn("RaydiumSimuLateTransaction11111111111111111"),c=[],m=new Tt;m.feePayer=r;for(let y of e)Bt([...m.instructions,y],[r])||(c.push(m),m=new Tt,m.feePayer=r),m.add(y);m.instructions.length>0&&c.push(m);let l=[];try{if(l=await wi(n,c,i),l.find(y=>y.err!==null))throw Error("rpc simulateTransaction error")}catch(y){y instanceof Error&&Se.logWithError("failed to simulate for instructions","RPC_ERROR",{message:y.message})}let d=[];for(let y of l)if(Se.debug("simulate result:",y),y.logs){let b=y.logs.filter(A=>A&&A.includes(t));Se.debug("filteredLog:",d),b.length||Se.logWithError("simulate log not match keyword","keyword",t),d.push(...b)}return d}function Lc(n,e){let t=n.match(/{["\w:,]+}/g);return!t||t.length!==1?Se.logWithError(`simulate log fail to match json, keyword: ${e}`):t[0]}function Oc(n,e){let i=new RegExp(`"${e}":(\\d+)`,"g").exec(n);return!i||i.length!==2?Se.logWithError(`simulate log fail to match key", key: ${e}`):i[1]}function pe(n,e){let[t,i]=Yn.findProgramAddressSync(n,e);return{publicKey:t,nonce:i}}async function wi(n,e,t){let i=[];if(t){let r=await n.getLatestBlockhash(),c=[];for(let y of e){y.recentBlockhash=r.blockhash,y.lastValidBlockHeight=r.lastValidBlockHeight;let A=y._compile().serialize(),B=y._serialize(A).toString("base64");c.push(B)}let m=c.map(y=>{let b=n._buildArgs([y],void 0,"base64");return{methodName:"simulateTransaction",args:b}}),l=[],d=20;for(let y=0;y<Math.ceil(m.length/d);y++)l.push(m.slice(y*d,(y+1)*d));i=await(await Promise.all(l.map(async y=>(await n._rpcBatchRequest(y)).map(b=>b.result.value)))).flat()}else try{i=await Promise.all(e.map(async r=>await(await n.simulateTransaction(r)).value))}catch(r){r instanceof Error&&Se.logWithError("failed to get info for multiple accounts","RPC_ERROR",{message:r.message})}return i}function it({instructions:n,payer:e,signers:t}){return Bt(n,[e,...t])}function rt({instructions:n,payer:e,lookupTableAddressAccount:t,recentBlockhash:i=Xn.generate().publicKey.toString()}){let c=new Pi({payerKey:e,recentBlockhash:i,instructions:n}).compileToV0Message(Object.values(t!=null?t:{}));try{return Buffer.from(new sn(c).serialize()).toString("base64").length<Hn}catch{return!1}}var kt={time:0,data:void 0};async function Nc(n){if(!kt.data||(Date.now()-kt.time)/1e3>30){let e=await n.getEpochInfo();return kt={time:Date.now(),data:e},e}else return kt.data}var Qn=n=>Buffer.isBuffer(n)?n:n instanceof Uint8Array?Buffer.from(n.buffer,n.byteOffset,n.byteLength):Buffer.from(n),ki=n=>{let e=n.serialize({requireAllSignatures:!1,verifySignatures:!1});n instanceof sn&&(e=Qn(e));try{return e instanceof Buffer?e.toString("base64"):Buffer.from(e).toString("base64")}catch{return e.toString("base64")}};function Fe(n){let e=[];return n.forEach(t=>{t instanceof Tt&&(t.recentBlockhash||(t.recentBlockhash=Ai.toBase58()),t.feePayer||(t.feePayer=Xn.generate().publicKey)),e.push(ki(t))}),console.log("simulate tx string:",e),e}function Mc(n){let e=n.serialize({requireAllSignatures:!1,verifySignatures:!1});return n instanceof sn&&(e=Qn(e)),e.toString("base64")}var St=2e3,Kt=class{constructor(e){this.instructions=[];this.endInstructions=[];this.lookupTableAddress=[];this.signers=[];this.instructionTypes=[];this.endInstructionTypes=[];this.connection=e.connection,this.feePayer=e.feePayer,this.signAllTransactions=e.signAllTransactions,this.owner=e.owner,this.cluster=e.cluster,this.blockhashCommitment=e.blockhashCommitment,this.loopMultiTxStatus=!!e.loopMultiTxStatus}get AllTxData(){return{instructions:this.instructions,endInstructions:this.endInstructions,signers:this.signers,instructionTypes:this.instructionTypes,endInstructionTypes:this.endInstructionTypes,lookupTableAddress:this.lookupTableAddress}}get allInstructions(){return[...this.instructions,...this.endInstructions]}async getComputeBudgetConfig(){var i;let e=(await hi.get(`https://solanacompass.com/api/fees?cacheFreshTime=${3e5}`)).data,{avg:t}=(i=e==null?void 0:e[15])!=null?i:{};if(!!t)return{units:6e5,microLamports:Math.min(Math.ceil(t*1e6/6e5),25e3)}}addCustomComputeBudget(e){if(e){let{instructions:t,instructionTypes:i}=ht(e);return this.instructions.unshift(...t),this.instructionTypes.unshift(...i),!0}return!1}addTipInstruction(e){var t;return e?(this.endInstructions.push(Ti.transfer({fromPubkey:(t=e.feePayer)!=null?t:this.feePayer,toPubkey:new Ge(e.address),lamports:BigInt(e.amount.toString())})),this.endInstructionTypes.push(te.TransferTip),!0):!1}async calComputeBudget({config:e,defaultIns:t}){try{let i=e||await this.getComputeBudgetConfig();if(this.addCustomComputeBudget(i))return;t&&this.instructions.unshift(...t)}catch{t&&this.instructions.unshift(...t)}}addInstruction({instructions:e=[],endInstructions:t=[],signers:i=[],instructionTypes:r=[],endInstructionTypes:c=[],lookupTableAddress:m=[]}){return this.instructions.push(...e),this.endInstructions.push(...t),this.signers.push(...i),this.instructionTypes.push(...r),this.endInstructionTypes.push(...c),this.lookupTableAddress.push(...m.filter(l=>l!==Ge.default.toString())),this}async versionBuild({txVersion:e,extInfo:t,lookupTableAddress:i}){return e===0?await this.buildV0(v(x({},t||{}),{lookupTableAddress:i})):this.build(t)}build(e){var i;let t=new at;return this.allInstructions.length&&t.add(...this.allInstructions),t.feePayer=this.feePayer,((i=this.owner)==null?void 0:i.signer)&&!this.signers.some(r=>r.publicKey.equals(this.owner.publicKey))&&this.signers.push(this.owner.signer),{builder:this,transaction:t,signers:this.signers,instructionTypes:[...this.instructionTypes,...this.endInstructionTypes],execute:async r=>{var b;let{recentBlockHash:c,skipPreflight:m=!0,sendAndConfirm:l,notSendToRpc:d}=r||{},y=c!=null?c:await Ue(this.connection,this.blockhashCommitment);if(t.recentBlockhash=y,this.signers.length&&t.sign(...this.signers),Fe([t]),(b=this.owner)!=null&&b.isKeyPair)return{txId:l?await un(this.connection,t,this.signers.find(C=>C.publicKey.equals(this.owner.publicKey))?this.signers:[...this.signers,this.owner.signer],{skipPreflight:m}):await this.connection.sendRawTransaction(t.serialize(),{skipPreflight:m}),signedTx:t};if(this.signAllTransactions){let A=await this.signAllTransactions([t]);if(this.signers.length)for(let C of A)try{C.sign(...this.signers)}catch{}return{txId:d?"":await this.connection.sendRawTransaction(A[0].serialize(),{skipPreflight:m}),signedTx:A[0]}}throw new Error("please provide owner in keypair format or signAllTransactions function")},extInfo:e||{}}}buildMultiTx(e){var y;let{extraPreBuildData:t=[],extInfo:i}=e,{transaction:r}=this.build(i),c=t.filter(b=>b.transaction.instructions.length>0),m=[r,...c.map(b=>b.transaction)],l=[this.signers,...c.map(b=>b.signers)],d=[...this.instructionTypes,...c.map(b=>b.instructionTypes).flat()];return(y=this.owner)!=null&&y.signer&&l.forEach(b=>{b.some(A=>A.publicKey.equals(this.owner.publicKey))||this.signers.push(this.owner.signer)}),{builder:this,transactions:m,signers:l,instructionTypes:d,execute:async b=>{var K;let{sequentially:A,onTxUpdate:C,skipTxCount:B=0,recentBlockHash:F,skipPreflight:w=!0}=b||{},I=F!=null?F:await Ue(this.connection,this.blockhashCommitment);if((K=this.owner)!=null&&K.isKeyPair){if(A){let S=[],E=0;for(let D of m){if(++E,E<=B)continue;let P=await un(this.connection,D,this.signers.find(k=>k.publicKey.equals(this.owner.publicKey))?this.signers:[...this.signers,this.owner.signer],{skipPreflight:w});S.push(P)}return{txIds:S,signedTxs:m}}return{txIds:await await Promise.all(m.map(async S=>(S.recentBlockhash=I,await this.connection.sendRawTransaction(S.serialize(),{skipPreflight:w})))),signedTxs:m}}if(this.signAllTransactions){let S=m.map((D,P)=>(D.recentBlockhash=I,l[P].length&&D.sign(...l[P]),D));Fe(S);let E=await this.signAllTransactions(S);if(A){let D=0,P=[],k=async()=>{if(!E[D])return;let T=await this.connection.sendRawTransaction(E[D].serialize(),{skipPreflight:w});P.push({txId:T,status:"sent",signedTx:E[D]}),C==null||C([...P]),D++;let R=!1,N=null,W=null,le=G=>{N!==null&&clearInterval(N),W!==null&&this.connection.removeSignatureListener(W);let U=P.findIndex(oe=>oe.txId===T);if(U>-1){if(P[U].status==="error"||P[U].status==="success")return;P[U].status=G.err?"error":"success"}C==null||C([...P]),G.err||k()};this.loopMultiTxStatus&&(N=setInterval(async()=>{var G;if(R){clearInterval(N);return}try{let U=await this.connection.getTransaction(T,{commitment:"confirmed",maxSupportedTransactionVersion:1});U&&(R=!0,clearInterval(N),le({err:((G=U.meta)==null?void 0:G.err)||null}),console.log("tx status from getTransaction:",T))}catch(U){R=!0,clearInterval(N),console.error("getTransaction timeout:",U,T)}},St)),W=this.connection.onSignature(T,G=>{if(R){this.connection.removeSignatureListener(W);return}R=!0,le(G)},"confirmed"),this.connection.getSignatureStatus(T)};return await k(),{txIds:P.map(T=>T.txId),signedTxs:E}}else{let D=[];for(let P=0;P<E.length;P+=1){let k=await this.connection.sendRawTransaction(E[P].serialize(),{skipPreflight:w});D.push(k)}return{txIds:D,signedTxs:E}}}throw new Error("please provide owner in keypair format or signAllTransactions function")},extInfo:i||{}}}async versionMultiBuild({extraPreBuildData:e,txVersion:t,extInfo:i}){return t===0?await this.buildV0MultiTx({extraPreBuildData:e,buildProps:i||{}}):this.buildMultiTx({extraPreBuildData:e,extInfo:i})}async buildV0(e){var w;let F=e||{},{lookupTableCache:t={},lookupTableAddress:i=[],forerunCreate:r,recentBlockhash:c}=F,m=ge(F,["lookupTableCache","lookupTableAddress","forerunCreate","recentBlockhash"]),l=x(x({},this.cluster==="devnet"?await an(this.connection):await rn(this.connection)),t),d=Array.from(new Set([...i,...this.lookupTableAddress])),y=[];for(let I of d)l[I]===void 0&&y.push(new Ge(I));let b=await on({connection:this.connection,address:y});for(let[I,K]of Object.entries(b))l[I]=K;let A=r?Ge.default.toBase58():c!=null?c:await Ue(this.connection,this.blockhashCommitment),C=new st({payerKey:this.feePayer,recentBlockhash:A,instructions:[...this.allInstructions]}).compileToV0Message(Object.values(l));((w=this.owner)==null?void 0:w.signer)&&!this.signers.some(I=>I.publicKey.equals(this.owner.publicKey))&&this.signers.push(this.owner.signer);let B=new ut(C);return B.sign(this.signers),{builder:this,transaction:B,signers:this.signers,instructionTypes:[...this.instructionTypes,...this.endInstructionTypes],execute:async I=>{var D;let{skipPreflight:K=!0,sendAndConfirm:S,notSendToRpc:E}=I||{};if(Fe([B]),(D=this.owner)!=null&&D.isKeyPair){let P=await this.connection.sendTransaction(B,{skipPreflight:K});return S&&await It(this.connection,P),{txId:P,signedTx:B}}if(this.signAllTransactions){let P=await this.signAllTransactions([B]);if(this.signers.length)for(let k of P)try{k.sign(this.signers)}catch{}return{txId:E?"":await this.connection.sendTransaction(P[0],{skipPreflight:K}),signedTx:P[0]}}throw new Error("please provide owner in keypair format or signAllTransactions function")},extInfo:m||{}}}async buildV0MultiTx(e){var y;let{extraPreBuildData:t=[],buildProps:i}=e,{transaction:r}=await this.buildV0(i),c=t.filter(b=>b.builder.instructions.length>0),m=[r,...c.map(b=>b.transaction)],l=[this.signers,...c.map(b=>b.signers)],d=[...this.instructionTypes,...c.map(b=>b.instructionTypes).flat()];return(y=this.owner)!=null&&y.signer&&l.forEach(b=>{b.some(A=>A.publicKey.equals(this.owner.publicKey))||this.signers.push(this.owner.signer)}),m.forEach(async(b,A)=>{b.sign(l[A])}),{builder:this,transactions:m,signers:l,instructionTypes:d,buildProps:i,execute:async b=>{var w;let{sequentially:A,onTxUpdate:C,recentBlockHash:B,skipPreflight:F=!0}=b||{};if(B&&m.forEach(I=>I.message.recentBlockhash=B),Fe(m),(w=this.owner)!=null&&w.isKeyPair){if(A){let I=[];for(let K of m){let S=await this.connection.sendTransaction(K,{skipPreflight:F});await It(this.connection,S),I.push(S)}return{txIds:I,signedTxs:m}}return{txIds:await Promise.all(m.map(async I=>await this.connection.sendTransaction(I,{skipPreflight:F}))),signedTxs:m}}if(this.signAllTransactions){let I=await this.signAllTransactions(m);if(A){let K=0,S=[],E=async()=>{if(!I[K])return;let D=await this.connection.sendTransaction(I[K],{skipPreflight:F});S.push({txId:D,status:"sent",signedTx:I[K]}),C==null||C([...S]),K++;let P=!1,k=null,T=null,R=N=>{k!==null&&clearInterval(k),T!==null&&this.connection.removeSignatureListener(T);let W=S.findIndex(le=>le.txId===D);if(W>-1){if(S[W].status==="error"||S[W].status==="success")return;S[W].status=N.err?"error":"success"}C==null||C([...S]),N.err||E()};this.loopMultiTxStatus&&(k=setInterval(async()=>{var N;if(P){clearInterval(k);return}try{let W=await this.connection.getTransaction(D,{commitment:"confirmed",maxSupportedTransactionVersion:1});W&&(P=!0,clearInterval(k),R({err:((N=W.meta)==null?void 0:N.err)||null}),console.log("tx status from getTransaction:",D))}catch(W){P=!0,clearInterval(k),console.error("getTransaction timeout:",W,D)}},St)),T=this.connection.onSignature(D,N=>{if(P){this.connection.removeSignatureListener(T);return}P=!0,R(N)},"confirmed"),this.connection.getSignatureStatus(D)};return E(),{txIds:[],signedTxs:I}}else{let K=[];for(let S=0;S<I.length;S+=1){let E=await this.connection.sendTransaction(I[S],{skipPreflight:F});K.push(E)}return{txIds:K,signedTxs:I}}}throw new Error("please provide owner in keypair format or signAllTransactions function")},extInfo:i||{}}}async sizeCheckBuild(e){var C;let A=e||{},{splitIns:t=[],computeBudgetConfig:i}=A,r=ge(A,["splitIns","computeBudgetConfig"]),c=i?ht(i):{instructions:[],instructionTypes:[]},m=this.signers.reduce((B,F)=>v(x({},B),{[F.publicKey.toBase58()]:F}),{}),l=[],d=[],y=[],b=0;if(this.allInstructions.forEach(B=>{let F=[...y,B],w=i?[...c.instructions,...F]:F,K=[...new Set(F.map(S=>S.keys.filter(E=>E.isSigner).map(E=>E.pubkey.toString())).flat()).values()].map(S=>new Ge(S));if(B!==t[b]&&y.length<12&&(it({instructions:w,payer:this.feePayer,signers:K})||it({instructions:F,payer:this.feePayer,signers:K})))y.push(B);else{if(y.length===0)throw Error("item ins too big");b+=B===t[b]?1:0,it({instructions:i?[...c.instructions,...y]:[...y],payer:this.feePayer,signers:K})?l.push(new at().add(...c.instructions,...y)):l.push(new at().add(...y)),d.push(Array.from(new Set(y.map(S=>S.keys.filter(E=>E.isSigner).map(E=>E.pubkey.toString())).flat())).map(S=>m[S]).filter(S=>S!==void 0)),y=[B]}}),y.length>0){let F=[...new Set(y.map(w=>w.keys.filter(I=>I.isSigner).map(I=>I.pubkey.toString())).flat()).values()].map(w=>m[w]).filter(w=>w!==void 0);it({instructions:i?[...c.instructions,...y]:[...y],payer:this.feePayer,signers:F.map(w=>w.publicKey)})?l.push(new at().add(...c.instructions,...y)):l.push(new at().add(...y)),d.push(F)}return l.forEach(B=>B.feePayer=this.feePayer),(C=this.owner)!=null&&C.signer&&d.forEach(B=>{B.some(F=>F.publicKey.equals(this.owner.publicKey))||B.push(this.owner.signer)}),{builder:this,transactions:l,signers:d,instructionTypes:this.instructionTypes,execute:async B=>{var D;let{sequentially:F,onTxUpdate:w,skipTxCount:I=0,recentBlockHash:K,skipPreflight:S=!0}=B||{},E=K!=null?K:await Ue(this.connection,this.blockhashCommitment);if(l.forEach(async(P,k)=>{P.recentBlockhash=E,d[k].length&&P.sign(...d[k])}),Fe(l),(D=this.owner)!=null&&D.isKeyPair){if(F){let P=0,k=[];for(let T of l){if(++P,P<=I){k.push("tx skipped");continue}let R=await un(this.connection,T,this.signers.find(N=>N.publicKey.equals(this.owner.publicKey))?this.signers:[...this.signers,this.owner.signer],{skipPreflight:S});k.push(R)}return{txIds:k,signedTxs:l}}return{txIds:await Promise.all(l.map(async P=>await this.connection.sendRawTransaction(P.serialize(),{skipPreflight:S}))),signedTxs:l}}if(this.signAllTransactions){let P=await this.signAllTransactions(l.slice(I,l.length)),k=[...l.slice(0,I),...P];if(F){let T=0,R=[],N=async()=>{if(!k[T])return;T<I&&(R.push({txId:"",status:"success",signedTx:k[T]}),w==null||w([...R]),T++,N());let W=await this.connection.sendRawTransaction(k[T].serialize(),{skipPreflight:S});R.push({txId:W,status:"sent",signedTx:k[T]}),w==null||w([...R]),T++;let le=!1,G=null,U=null,oe=X=>{G!==null&&clearInterval(G),U!==null&&this.connection.removeSignatureListener(U);let ae=R.findIndex(Te=>Te.txId===W);if(ae>-1){if(R[ae].status==="error"||R[ae].status==="success")return;R[ae].status=X.err?"error":"success"}w==null||w([...R]),X.err||N()};this.loopMultiTxStatus&&(G=setInterval(async()=>{var X;if(le){clearInterval(G);return}try{let ae=await this.connection.getTransaction(W,{commitment:"confirmed",maxSupportedTransactionVersion:1});ae&&(le=!0,clearInterval(G),oe({err:((X=ae.meta)==null?void 0:X.err)||null}),console.log("tx status from getTransaction:",W))}catch(ae){le=!0,clearInterval(G),console.error("getTransaction timeout:",ae,W)}},St)),U=this.connection.onSignature(W,X=>{if(le){this.connection.removeSignatureListener(U);return}le=!0,oe(X)},"confirmed"),this.connection.getSignatureStatus(W)};return await N(),{txIds:R.map(W=>W.txId),signedTxs:k}}else{let T=[];for(let R=0;R<k.length;R+=1){let N=await this.connection.sendRawTransaction(k[R].serialize(),{skipPreflight:S});T.push(N)}return{txIds:T,signedTxs:k}}}throw new Error("please provide owner in keypair format or signAllTransactions function")},extInfo:r||{}}}async sizeCheckBuildV0(e){var D;let E=e||{},{computeBudgetConfig:t,splitIns:i=[],lookupTableCache:r={},lookupTableAddress:c=[],insCountLimit:m=12}=E,l=ge(E,["computeBudgetConfig","splitIns","lookupTableCache","lookupTableAddress","insCountLimit"]),d=x(x({},this.cluster==="devnet"?await an(this.connection):await rn(this.connection)),r),y=Array.from(new Set([...this.lookupTableAddress,...c])),b=[];for(let P of y)d[P]===void 0&&b.push(new Ge(P));let A=await on({connection:this.connection,address:b});for(let[P,k]of Object.entries(A))d[P]=k;let C=t?ht(t):{instructions:[],instructionTypes:[]},B=await Ue(this.connection,this.blockhashCommitment),F=this.signers.reduce((P,k)=>v(x({},P),{[k.publicKey.toBase58()]:k}),{}),w=[],I=[],K=[],S=0;if(this.allInstructions.forEach(P=>{let k=[...K,P],T=t?[...C.instructions,...k]:k;if(P!==i[S]&&K.length<m&&(rt({instructions:T,payer:this.feePayer,lookupTableAddressAccount:d})||rt({instructions:k,payer:this.feePayer,lookupTableAddressAccount:d})))K.push(P);else{if(K.length===0)throw Error("item ins too big");S+=P===i[S]?1:0;let R={};for(let N of[...new Set(y)])d[N]!==void 0&&(R[N]=d[N]);if(t&&rt({instructions:[...C.instructions,...K],payer:this.feePayer,lookupTableAddressAccount:d,recentBlockhash:B})){let N=new st({payerKey:this.feePayer,recentBlockhash:B,instructions:[...C.instructions,...K]}).compileToV0Message(Object.values(d));w.push(new ut(N))}else{let N=new st({payerKey:this.feePayer,recentBlockhash:B,instructions:[...K]}).compileToV0Message(Object.values(d));w.push(new ut(N))}I.push(Array.from(new Set(K.map(N=>N.keys.filter(W=>W.isSigner).map(W=>W.pubkey.toString())).flat())).map(N=>F[N]).filter(N=>N!==void 0)),K=[P]}}),K.length>0){let k=[...new Set(K.map(T=>T.keys.filter(R=>R.isSigner).map(R=>R.pubkey.toString())).flat()).values()].map(T=>F[T]).filter(T=>T!==void 0);if(t&&rt({instructions:[...C.instructions,...K],payer:this.feePayer,lookupTableAddressAccount:d,recentBlockhash:B})){let T=new st({payerKey:this.feePayer,recentBlockhash:B,instructions:[...C.instructions,...K]}).compileToV0Message(Object.values(d));w.push(new ut(T))}else{let T=new st({payerKey:this.feePayer,recentBlockhash:B,instructions:[...K]}).compileToV0Message(Object.values(d));w.push(new ut(T))}I.push(k)}return(D=this.owner)!=null&&D.signer&&I.forEach(P=>{P.some(k=>k.publicKey.equals(this.owner.publicKey))||P.push(this.owner.signer)}),w.forEach((P,k)=>{P.sign(I[k])}),{builder:this,transactions:w,buildProps:e,signers:I,instructionTypes:this.instructionTypes,execute:async P=>{var le;let{sequentially:k,onTxUpdate:T,skipTxCount:R=0,recentBlockHash:N,skipPreflight:W=!0}=P||{};if(w.map(async(G,U)=>{I[U].length&&G.sign(I[U]),N&&(G.message.recentBlockhash=N)}),Fe(w),(le=this.owner)!=null&&le.isKeyPair){if(k){let G=0,U=[];for(let oe of w){if(++G,G<=R){console.log("skip tx: ",G),U.push("tx skipped");continue}let X=await this.connection.sendTransaction(oe,{skipPreflight:W});await It(this.connection,X),U.push(X)}return{txIds:U,signedTxs:w}}return{txIds:await Promise.all(w.map(async G=>await this.connection.sendTransaction(G,{skipPreflight:W}))),signedTxs:w}}if(this.signAllTransactions){let G=await this.signAllTransactions(w.slice(R,w.length)),U=[...w.slice(0,R),...G];if(k){let oe=0,X=[],ae=async()=>{if(!U[oe])return;if(oe<R){X.push({txId:"",status:"success",signedTx:U[oe]}),T==null||T([...X]),oe++,ae();return}let Te=await this.connection.sendTransaction(U[oe],{skipPreflight:W});X.push({txId:Te,status:"sent",signedTx:U[oe]}),T==null||T([...X]),oe++;let je=!1,Ve=null,ft=null,On=Re=>{Ve!==null&&clearInterval(Ve),ft!==null&&this.connection.removeSignatureListener(ft);let he=X.findIndex(Go=>Go.txId===Te);if(he>-1){if(X[he].status==="error"||X[he].status==="success")return;X[he].status=Re.err?"error":"success"}T==null||T([...X]),Re.err||ae()};this.loopMultiTxStatus&&(Ve=setInterval(async()=>{var Re;if(je){clearInterval(Ve);return}try{let he=await this.connection.getTransaction(Te,{commitment:"confirmed",maxSupportedTransactionVersion:1});he&&(je=!0,clearInterval(Ve),On({err:((Re=he.meta)==null?void 0:Re.err)||null}),console.log("tx status from getTransaction:",Te))}catch(he){je=!0,clearInterval(Ve),console.error("getTransaction timeout:",he,Te)}},St)),ft=this.connection.onSignature(Te,Re=>{if(je){this.connection.removeSignatureListener(ft);return}je=!0,On(Re)},"confirmed"),this.connection.getSignatureStatus(Te)};return ae(),{txIds:[],signedTxs:U}}else{let oe=[];for(let X=0;X<U.length;X+=1){let ae=await this.connection.sendTransaction(U[X],{skipPreflight:W});oe.push(ae)}return{txIds:oe,signedTxs:U}}}throw new Error("please provide owner in keypair format or signAllTransactions function")},extInfo:l||{}}}};var cn=(...n)=>n.map(e=>{try{return typeof e=="object"?JSON.stringify(e):e}catch{return e}}).join(", "),ce=class{constructor({scope:e,moduleName:t}){this.disabled=!1;this.scope=e,this.logger=_(t)}createTxBuilder(e){return this.scope.checkOwner(),new Kt({connection:this.scope.connection,feePayer:e||this.scope.ownerPubKey,cluster:this.scope.cluster,owner:this.scope.owner,blockhashCommitment:this.scope.blockhashCommitment,loopMultiTxStatus:this.scope.loopMultiTxStatus,api:this.scope.api,signAllTransactions:this.scope.signAllTransactions})}logDebug(...e){this.logger.debug(cn(e))}logInfo(...e){this.logger.info(cn(e))}logAndCreateError(...e){let t=cn(e);throw new Error(t)}checkDisabled(){(this.disabled||!this.scope)&&this.logAndCreateError("module not working")}};import{PublicKey as sm,SystemProgram as cm}from"@solana/web3.js";import dm from"bn.js";import{createCloseAccountInstruction as bm,createInitializeAccountInstruction as gm,createTransferInstruction as Pm,TOKEN_PROGRAM_ID as Am}from"@solana/spl-token";import{Keypair as Hl,PublicKey as Ql}from"@solana/web3.js";import jl from"bn.js";import{TOKEN_PROGRAM_ID as tm}from"@solana/spl-token";import{PublicKey as Fi}from"@solana/web3.js";import eo,{isBN as to}from"bn.js";import{bits as Ii,BitStructure as Jc,blob as Bi,Blob as el,cstr as tl,f32 as nl,f32be as ol,f64 as il,f64be as rl,greedy as al,Layout as Si,ns64 as sl,ns64be as ul,nu64 as cl,nu64be as ll,offset as Ki,s16 as ml,s16be as dl,s24 as pl,s24be as fl,s32 as xi,s32be as yl,s40 as bl,s40be as gl,s48 as Pl,s48be as Al,s8 as wl,seq as Ci,struct as kl,Structure as Ri,u16 as Li,u16be as Tl,u24 as hl,u24be as Il,u32 as Oi,u32be as Bl,u40 as Sl,u40be as Kl,u48 as xl,u48be as Cl,u8 as Ni,UInt as Mi,union as Rl,Union as Ll,unionLayoutDiscriminator as Ol,utf8 as Nl}from"@solana/buffer-layout";var xt=Si,Zn=Ri;var ln=Mi;var $n=Ni,$=Li;var Ct=Oi;var fe=xi;var jn=Ci;var M=Bi;var mn=Ii,Jn=Ki;var ve=class extends xt{constructor(t,i,r){super(t,r);this.blob=M(t),this.signed=i}decode(t,i=0){let r=new eo(this.blob.decode(t,i),10,"le");return this.signed?r.fromTwos(this.span*8).clone():r}encode(t,i,r=0){return typeof t=="number"&&(t=new eo(t)),this.signed&&(t=t.toTwos(this.span*8)),this.blob.encode(t.toArrayLike(Buffer,"le",this.span),i,r)}},Rt=class extends xt{constructor(t){super(8,t);this._lower=mn(Ct(),!1),this._upper=mn(Ct(),!1)}addBoolean(t){this._lower.fields.length<32?this._lower.addBoolean(t):this._upper.addBoolean(t)}decode(t,i=0){let r=this._lower.decode(t,i),c=this._upper.decode(t,i+this._lower.span);return x(x({},r),c)}encode(t,i,r=0){return this._lower.encode(t,i,r)+this._upper.encode(t,i,r+this._lower.span)}};function p(n){return new ln(1,n)}function H(n){return new ln(4,n)}function o(n){return new ve(8,!1,n)}function O(n){return new ve(16,!1,n)}function no(n){return new ve(1,!0,n)}function ze(n){return new ve(8,!0,n)}function oo(n){return new ve(16,!0,n)}var ct=class extends xt{constructor(t,i,r,c){super(t.span,c);this.layout=t,this.decoder=i,this.encoder=r}decode(t,i){return this.decoder(this.layout.decode(t,i))}encode(t,i,r){return this.layout.encode(this.encoder(t),i,r)}getSpan(t,i){return this.layout.getSpan(t,i)}};function a(n){return new ct(M(32),e=>new Fi(e),e=>e.toBuffer(),n)}function de(n){return new ct($n(),vi,_i,n)}function vi(n){if(n===0)return!1;if(n===1)return!0;throw new Error("Invalid bool: "+n)}function _i(n){return n?1:0}function pn(n,e){let t=Ct("length"),i=f([t,g(n,Jn(t,-t.span),"values")]);return new ct(i,({values:r})=>r,r=>({values:r}),e)}var dn=class extends Zn{decode(e,t){return super.decode(e,t)}};function f(n,e,t){return new dn(n,e,t)}function g(n,e,t){let i,r=typeof e=="number"?e:to(e)?e.toNumber():new Proxy(e,{get(c,m){if(!i){let l=Reflect.get(c,"count");i=to(l)?l.toNumber():l,Reflect.set(c,"count",i)}return Reflect.get(c,m)},set(c,m,l){return m==="count"&&(i=l),Reflect.set(c,m,l)}});return jn(n,r,t)}var Lt=f([a("mint"),a("owner"),o("amount"),H("delegateOption"),a("delegate"),p("state"),H("isNativeOption"),o("isNative"),o("delegatedAmount"),H("closeAuthorityOption"),a("closeAuthority")]);import{PublicKey as AP,SystemProgram as wP}from"@solana/web3.js";import{createAssociatedTokenAccountIdempotentInstruction as TP}from"@solana/spl-token";import{PublicKey as Ei}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Di}from"@solana/spl-token";function ye(n,e,t){return pe([n.toBuffer(),(t!=null?t:Di).toBuffer(),e.toBuffer()],new Ei("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}import{PublicKey as h}from"@solana/web3.js";var fn=new h("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),yn=new h("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),bn=new h("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Nt=new h("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),Wi=new h("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),ro=new h("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),gn=new h("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),Pn=new h("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),qi=new h("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Ui=new h("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),An=new h("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),ao=new h("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),so=new h("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),wn=new h("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Gi=new h("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),uo=new h("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Mt=new h("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),co=new h("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),zi=new h("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),lo=new h("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),mo=new h("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),po=new h("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),Xi=new h("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),Zm=new h("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),$m=new h("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),Yi=new h("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),Hi=new h("6s1xP3hpbAfFoNtUNF8mfHsjr2Bd97JxFJRWLbL6aHuX"),Qi={AMM_V4:Pn,AMM_STABLE:qi,CLMM_PROGRAM_ID:An,CLMM_LOCK_PROGRAM_ID:ao,CLMM_LOCK_AUTH_ID:so,FARM_PROGRAM_ID_V3:fn,FARM_PROGRAM_ID_V4:yn,FARM_PROGRAM_ID_V5:bn,FARM_PROGRAM_ID_V6:Nt,OPEN_BOOK_PROGRAM:ro,SERUM_PROGRAM_ID_V3:gn,UTIL1216:Wi,Router:Gi,CREATE_CPMM_POOL_PROGRAM:Mt,CREATE_CPMM_POOL_AUTH:co,CREATE_CPMM_POOL_FEE_ACC:zi,LOCK_CPMM_PROGRAM:lo,LOCK_CPMM_AUTH:mo,LAUNCHPAD_PROGRAM:po,LAUNCHPAD_AUTH:Xi,LAUNCHPAD_PLATFORM:Yi,LAUNCHPAD_CONFIG:Hi,FEE_DESTINATION_ID:uo,MODEL_DATA_PUBKEY:wn},Ce={OPEN_BOOK_PROGRAM:new h("EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj"),SERUM_PROGRAM_ID_V3:new h("Ray1111111111111111111111111111111111111111"),AMM_V4:new h("DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav"),AMM_STABLE:new h("DRayDdXc1NZQ9C3hRWmoSf8zK4iapgMnjdNZWrfwsP8m"),CLMM_PROGRAM_ID:new h("DRayAUgENGQBKVaX8owNhgzkEDyoHTGVEGHVJT1E9pfH"),CLMM_LOCK_PROGRAM_ID:new h("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),CLMM_LOCK_AUTH_ID:new h("6Aoh8h2Lw2m5UGxYR8AdAL87jTWYeKoxM52mJRzfYwN"),CREATE_CPMM_POOL_PROGRAM:new h("DRaycpLY18LhpbydsBWbVJtxpNv9oXPgjRSfpF2bWpYb"),CREATE_CPMM_POOL_AUTH:new h("CXniRufdq5xL8t8jZAPxsPZDpuudwuJSPWnbcD5Y5Nxq"),CREATE_CPMM_POOL_FEE_ACC:new h("3oE58BKVt8KuYkGxx8zBojugnymWmBiyafWgMrnb6eYy"),LOCK_CPMM_PROGRAM:new h("DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX"),LOCK_CPMM_AUTH:new h("7qWVV8UY2bRJfDLP4s37YzBPKUkVB46DStYJBpYbQzu3"),UTIL1216:h.default,Router:new h("DRaybByLpbUL57LJARs3j8BitTxVfzBg351EaMr5UTCd"),FARM_PROGRAM_ID_V3:new h("DRayWyrLmEW5KEeqs8kdTMMaBabapqagaBC7KWpGtJeZ"),FARM_PROGRAM_ID_V4:new h("Ray1111111111111111111111111111111111111111"),FARM_PROGRAM_ID_V5:new h("DRayiCGSZgku1GTK6rXD6mVDdingXy6APAH1R6R5L2LC"),FARM_PROGRAM_ID_V6:new h("DRayzbYakXs45ELHkzH6vC3fuhQqTAnv5A68gdFuvZyZ"),LAUNCHPAD_PROGRAM:new h("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),LAUNCHPAD_AUTH:new h("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),LAUNCHPAD_PLATFORM:new h("2Jx4KTDrVSdWNazuGpcA8n3ZLTRGGBDxAWhuKe2Xcj2a"),LAUNCHPAD_CONFIG:new h("7ZR4zD7PYfY2XxoG1Gxcy2EgEeGYrpxrwzPuwdUBssEt"),FEE_DESTINATION_ID:new h("9y8ENuuZ3b19quffx9hQvRVygG5ky6snHfRvGpuSfeJy"),MODEL_DATA_PUBKEY:new h("Ray1111111111111111111111111111111111111111")};import OP from"decimal.js";import{createAssociatedTokenAccountIdempotentInstruction as nb,TOKEN_2022_PROGRAM_ID as ob,TOKEN_PROGRAM_ID as ib}from"@solana/spl-token";import{PublicKey as ab}from"@solana/web3.js";import ub from"bn.js";import lb from"decimal.js";import{TOKEN_PROGRAM_ID as md}from"@solana/spl-token";import{PublicKey as yd}from"@solana/web3.js";var Zi=f([H("mintAuthorityOption"),a("mintAuthority"),o("supply"),p("decimals"),p("isInitialized"),H("freezeAuthorityOption"),a("freezeAuthority")]);import{ASSOCIATED_TOKEN_PROGRAM_ID as hy,TOKEN_2022_PROGRAM_ID as Iy,TOKEN_PROGRAM_ID as By}from"@solana/spl-token";import{Keypair as xy,PublicKey as Cy,SystemProgram as Ly,TransactionInstruction as Oy}from"@solana/web3.js";import My from"bn.js";import q from"bn.js";var Xe=new q(1).shln(64);var $i=new q(1).shln(128),kn=new q(1).shln(64).subn(1),ji=new q(1).shln(128).subn(1);var Ye=new q("4295048016"),He=new q("79226673521066979257578248091"),Ji=new q("59543866431248"),er=new q("184467440737095516"),tr=new q("15793534762490258745");var Tn=60,Kd=new q("18446743708227953217"),nr=[{bit:0,factor:new q("fffcb933bd6fb800",16)},{bit:1,factor:new q("fff97272373d4000",16)},{bit:2,factor:new q("fff2e50f5f657000",16)},{bit:3,factor:new q("ffe5caca7e10f000",16)},{bit:4,factor:new q("ffcb9843d60f7000",16)},{bit:5,factor:new q("ff973b41fa98e800",16)},{bit:6,factor:new q("ff2ea16466c9b000",16)},{bit:7,factor:new q("fe5dee046a9a3800",16)},{bit:8,factor:new q("fcbe86c7900bb000",16)},{bit:9,factor:new q("f987a7253ac65800",16)},{bit:10,factor:new q("f3392b0822bb6000",16)},{bit:11,factor:new q("e7159475a2caf000",16)},{bit:12,factor:new q("d097f3bdfd2f2000",16)},{bit:13,factor:new q("a9f746462d9f8000",16)},{bit:14,factor:new q("70d869a156f31c00",16)},{bit:15,factor:new q("31be135f97ed3200",16)},{bit:16,factor:new q("9aa508b5b85a500",16)},{bit:17,factor:new q("5d6af8dedc582c",16)},{bit:18,factor:new q("2216e584f5fa",16)}];var lt=3,fo=100;var yo=10,bo=100,Ft=14;var z=new q(0),Qe=new q(1),xd=new q(-1);var Cd=new q("18446744073700000000");var or=f([M(8),p("bump"),$("index"),a("owner"),H("protocolFeeRate"),H("tradeFeeRate"),$("tickSpacing"),H("fundFeeRate"),g(H(),1),a("fundOwner"),g(o(),3)]),ir=f([H("blockTimestamp"),ze("tickCumulative"),g(o(),4)]),go=f([M(8),de("initialized"),o("recentEpoch"),$("observationIndex"),a("poolId"),g(ir,fo,"observations"),g(o(),4)]),rr=f([$("filterPeriod"),$("decayPeriod"),$("reductionFactor"),H("dynamicFeeControl"),H("maxVolatilityAccumulator"),fe("tickSpacingIndexReference"),H("volatilityReference"),H("volatilityAccumulator"),o("lastUpdateTimestamp"),g(p(),46)]),ar=f([p("state"),o("openTime"),o("endTime"),o("lastUpdateTime"),O("emissionsPerSecondX64"),o("totalEmissioned"),o("claimed"),a("mint"),a("vault"),a("creator"),O("growthGlobalX64")]),hn=f([M(8),p("bump"),a("configId"),a("creator"),a("mintA"),a("mintB"),a("vaultA"),a("vaultB"),a("observationId"),p("mintDecimalsA"),p("mintDecimalsB"),$("tickSpacing"),O("liquidity"),O("sqrtPriceX64"),fe("tickCurrent"),H(),O("feeGrowthGlobalX64A"),O("feeGrowthGlobalX64B"),o("protocolFeesTokenA"),o("protocolFeesTokenB"),g(O(),4),p("status"),p("feeOn"),M(6),g(ar,lt,"rewardInfos"),M(8*16,"tickArrayBitmap"),g(o(),4),o("fundFeesTokenA"),o("fundFeesTokenB"),o("startTime"),o("recentEpoch"),rr.replicate("dynamicFeeInfo"),g(o(),46)]),sr=f([O("growthInsideLastX64"),o("rewardAmountOwed")]),ur=f([M(8),p("bump"),a("nftMint"),a("poolId"),fe("tickLower"),fe("tickUpper"),O("liquidity"),O("feeGrowthInsideLastX64A"),O("feeGrowthInsideLastX64B"),o("tokenFeesOwedA"),o("tokenFeesOwedB"),g(sr,lt,"rewardInfos"),o("recentEpoch"),g(o(),7)]),Nd=f([M(8),p("bump"),a("poolId"),fe("tickLower"),fe("tickUpper"),O("liquidity"),O("feeGrowthInsideLastX64A"),O("feeGrowthInsideLastX64B"),o("tokenFeesOwedA"),o("tokenFeesOwedB"),g(O(),lt,"rewardGrowthInside"),o("recentEpoch"),g(o(),7)]),cr=f([fe("tick"),oo("liquidityNet"),O("liquidityGross"),O("feeGrowthOutsideX64A"),O("feeGrowthOutsideX64B"),g(O(),lt,"rewardGrowthsOutsideX64"),o("orderPhase"),o("ordersAmount"),o("partFilledOrdersRemaining"),O("unfilledRatioX64"),g(H(),3)]),Po=f([M(8),a("poolId"),fe("startTickIndex"),g(cr,Tn,"ticks"),p("initializedTickCount"),o("recentEpoch"),g(p(),107)]),lr=f([M(8),p("bump"),g(a(),yo,"operationOwners"),g(a(),bo,"whitelistMints")]),mr=f([M(8),a("poolId"),a("owner"),fe("tick"),de("zeroForOne"),o("orderPhase"),o("totalAmount"),o("filledAmount"),o("settleBase"),o("settleOutput"),o("openTime"),O("unfilledRatioX64"),g(o(),4)]),Ao=f([M(8),a("poolId"),M(8*8*Ft,"positiveTickArrayBitmap"),M(8*8*Ft,"negativeTickArrayBitmap")]),Md=f([M(8),$("index"),$("filterPeriod"),$("decayPeriod"),$("reductionFactor"),H("dynamicFeeControl"),H("maxVolatilityAccumulator"),g(o(),8)]),dr=f([M(8),a("wallet"),p("nonceIndex"),o("orderNonce"),g(o(),4)]),Fd=f([o(),p("bump"),a("owner"),a("poolId"),a("positionId"),a("nftAccount"),g(o(),8)]),pr=f([M(8),p("bump"),a("lockOwner"),a("poolId"),a("positionId"),a("nftAccount"),a("lockNftMint"),o("recentEpoch"),g(o(),8)]);import Vd from"bn.js";var Qd=Buffer.from("amm_config","utf8"),yr=Buffer.from("pool","utf8"),br=Buffer.from("pool_vault","utf8"),Zd=Buffer.from("pool_reward_vault","utf8"),$d=Buffer.from("position","utf8"),jd=Buffer.from("tick_array","utf8"),Jd=Buffer.from("operation","utf8"),ep=Buffer.from("pool_tick_array_bitmap_extension","utf8"),tp=Buffer.from("observation","utf8"),np=Buffer.from("support_mint","utf8"),op=Buffer.from("dynamic_fee_config","utf8"),ip=Buffer.from("permission","utf8");var rp=Buffer.from("locked_position","utf8");import{sha256 as Cr}from"js-sha256";import gr from"bn.js";import cp from"decimal.js";var mp=new gr(1).shln(256).subn(1);import Cp from"bn.js";import Pp from"bn.js";import wp from"decimal.js";import Mp from"bn.js";import vp from"decimal.js";import{PublicKey as hf}from"@solana/web3.js";import Bf from"bn.js";import{TOKEN_2022_PROGRAM_ID as Nf,TOKEN_PROGRAM_ID as Mf}from"@solana/spl-token";import Vf from"decimal.js";import df from"bn.js";import jp from"bn.js";import Qf from"bn.js";function ne(n){let e=`global:${n}`;return Buffer.from(Cr.digest(e)).slice(0,8)}go.span;var Uy=_("Raydium_Clmm"),Gy={createPool:ne("create_pool"),createCustomizablePool:ne("create_customizable_pool"),createPermissionedPool:ne("create_permissioned_pool"),openPositionV2:ne("open_position_v2"),openPositionWithToken22Nft:ne("open_position_with_token22_nft"),closePosition:ne("close_position"),increaseLiquidityV2:ne("increase_liquidity_v2"),decreaseLiquidityV2:ne("decrease_liquidity_v2"),initializeReward:ne("initialize_reward"),setRewardParams:ne("set_reward_params"),updateRewardInfos:ne("update_reward_infos"),collectRemainingRewards:ne("collect_remaining_rewards"),swapV2:ne("swap_v2"),openLimitOrder:ne("open_limit_order"),increaseLimitOrder:ne("increase_limit_order"),decreaseLimitOrder:ne("decrease_limit_order"),settleLimitOrder:ne("settle_limit_order"),closeLimitOrder:ne("close_limit_order")};import{PublicKey as Kn}from"@solana/web3.js";var Nr=f([p("instruction")]),Mr=f([p("instruction")]),Fr=f([o("rewardState"),o("rewardOpenTime"),o("rewardEndTime"),o("rewardLastUpdateTime"),o("totalReward"),o("totalRewardEmissioned"),o("rewardClaimed"),o("rewardPerSecond"),O("accRewardPerShare"),a("rewardVault"),a("rewardMint"),a("rewardSender"),o("rewardType"),g(o(),15,"padding")]),vr=f([o("state"),o("nonce"),a("lpVault"),a("rewardVault"),a(),a(),o(),o(),o("totalReward"),O("perShareReward"),o("lastSlot"),o("perSlotReward")]),_r=f([o("state"),o("nonce"),a("lpVault"),a("rewardVaultA"),o("totalRewardA"),O("perShareRewardA"),o("perSlotRewardA"),p("option"),a("rewardVaultB"),M(7),o("totalRewardB"),O("perShareRewardB"),o("perSlotRewardB"),o("lastSlot"),a()]),Vr=f([o(),o("state"),o("nonce"),o("validRewardTokenNum"),O("rewardMultiplier"),o("rewardPeriodMax"),o("rewardPeriodMin"),o("rewardPeriodExtend"),a("lpMint"),a("lpVault"),g(Fr,5,"rewardInfos"),a("creator"),a(),g(o(),32,"padding")]),Er=new Proxy(vr,{get(n,e,t){return e==="decode"?(...i)=>{let r=n.decode(...i);return v(x({},r),{version:3,rewardInfos:[{rewardVault:r.rewardVault,totalReward:r.totalReward,perSlotReward:r.perSlotReward,perShareReward:r.perShareReward}]})}:Reflect.get(n,e,t)}}),Dr=new Proxy(_r,{get(n,e,t){return e==="decode"?(...i)=>{let r=n.decode(...i);return v(x({},r),{version:5,rewardInfos:[{rewardVault:r.rewardVaultA,totalReward:r.totalRewardA,perSlotReward:r.perSlotRewardA,perShareReward:r.perShareRewardA},{rewardVault:r.rewardVaultB,totalReward:r.totalRewardB,perSlotReward:r.perSlotRewardB,perShareReward:r.perShareRewardB}]})}:Reflect.get(n,e,t)}}),Ko=new Proxy(Vr,{get(n,e,t){return e==="decode"?(...i)=>{let r=n.decode(...i);return v(x({},r),{version:6,rewardInfos:r.rewardInfos.map(c=>{var m;return v(x({},c),{rewardType:((m=Object.entries(dt).find(l=>String(l[1])===c.rewardType.toString()))!=null?m:["Standard SPL"])[0]})})})}:Reflect.get(n,e,t)}}),Wr=f([o("isSet"),o("rewardPerSecond"),o("rewardOpenTime"),o("rewardEndTime"),o("rewardType")]),qr=f([p("instruction"),o("nonce"),g(Wr,5,"rewardTimeInfo")]),Ur=f([p("instruction"),o("rewardReopenTime"),o("rewardEndTime"),o("rewardPerSecond")]),Gr=f([p("instruction"),o("isSet"),o("rewardPerSecond"),o("rewardOpenTime"),o("rewardEndTime"),o("rewardType")]),Eb=f([o("state"),a("id"),a("owner"),o("deposited"),g(o(),1,"rewardDebts")]),xo=f([o("state"),a("id"),a("owner"),o("deposited"),g(O(),1,"rewardDebts"),o(""),o("voteLockedBalance"),g(o(),15)]),Db=f([o("state"),a("id"),a("owner"),o("deposited"),g(o(),2,"rewardDebts")]),zr=f([o("state"),a("id"),a("owner"),o("deposited"),g(O(),2,"rewardDebts"),g(o(),17)]),Xr=f([o(),o("state"),a("id"),a("owner"),o("deposited"),g(O(),5,"rewardDebts"),g(o(),16)]),Yr=f([p("instruction"),o("amount")]),Hr=f([a("mint"),a("grantAuthority"),o("baselineVoteWeightScaledFactor"),o("maxExtraLockupVoteWeightScaledFactor"),o("lockupSaturationSecs"),no("digitShift"),g(p(),7,"reserved1"),g(o(),7,"reserved2")]),Qr=f([M(8),a("governanceProgramId"),a("realm"),a("realmGoverningTokenMint"),a("realmAuthority"),g(p(),32,"reserved1"),g(Hr,4,"votingMints"),ze("timeOffset"),p("bump"),g(p(),7,"reserved2"),g(o(),11,"reserved3")]),Zr=f([ze("startTime"),ze("endTime"),p("kind"),g(p(),15,"reserved")]),$r=f([g(Zr,1,"lockup"),o("amountDeposited_native"),o("amountInitiallyLockedNative"),de("isUsed"),de("allowClawback"),p("votingMintConfigIdx"),g(p(),29,"reserved")]),jr=f([M(8),a("voterAuthority"),a("registrar"),g($r,32,"deposits"),p("voterBump"),p("voterWweightRecordBump"),g(p(),94,"reserved")]);import{NATIVE_MINT as Qb}from"@solana/spl-token";var Zb=_("Raydium_farm_config"),Jr=new Kn("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),ea=new Kn("FrspKwj8i3pNmKwXreTveC4fu7KL5ZbGeXdZBe2XViu1");var $b=new Kn("3TRTX4dXUpp2eqxi3tvQDFYUV7SdDJjcPE3Y4mbtftaX");var dt={"Standard SPL":0,"Option tokens":1},Co={[fn.toString()]:3,[yn.toString()]:4,[bn.toString()]:5,[Nt.toString()]:6,[Ce.FARM_PROGRAM_ID_V3.toString()]:3,[Ce.FARM_PROGRAM_ID_V4.toString()]:4,[Ce.FARM_PROGRAM_ID_V5.toString()]:5,[Ce.FARM_PROGRAM_ID_V6.toString()]:6};import{PublicKey as Mg,SystemProgram as Fg,SYSVAR_CLOCK_PUBKEY as vg,SYSVAR_RENT_PUBKEY as _g,TransactionInstruction as Vg}from"@solana/web3.js";import Dg from"bn.js";import{ASSOCIATED_TOKEN_PROGRAM_ID as qg,createAssociatedTokenAccountIdempotentInstruction as Ug,TOKEN_PROGRAM_ID as Gg}from"@solana/spl-token";import lg from"bn.js";var Ro=n=>typeof n=="number",Lo=n=>n?new Date(n):new Date,pt=n=>Lo(n).getTime();function ta(n,e,t){let i=Ro(e)?e*((t==null?void 0:t.unit)==="s"?1e3:1):pt(e);return pt(n)<=i}function na(n,e,t){let i=Ro(e)?e*((t==null?void 0:t.unit)==="s"?1e3:1):pt(e);return pt(n)>i}function tg(n,e){var r,c,m,l,d;let i=pt(n)+((r=e.days)!=null?r:0)*24*60*60*1e3+((c=e.hours)!=null?c:0)*60*60*1e3+((m=e.minutes)!=null?m:0)*60*1e3+((l=e.seconds)!=null?l:0)*1e3+((d=e.milliseconds)!=null?d:0);return Lo(i)}import{PublicKey as oa}from"@solana/web3.js";import ia from"bn.js";async function gi(n){new Promise(e=>setTimeout(e,n))}function sg(){return new Date().getTime()}function ra(n){return typeof n=="object"&&n!==null&&![J,ie,oa,L,ia,se,me].some(e=>typeof e=="object"&&n instanceof e)}function $e(n){return typeof n=="string"?Zt(n):Array.isArray(n)?n.map(e=>$e(e)):ra(n)?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,$e(t)])):n}var hg=_("Raydium.farm.util");var tP=_("Raydium_farm_instruction"),nP={voterStakeRegistryCreateVoter:Buffer.from([6,24,245,52,243,255,148,25]),voterStakeRegistryCreateDepositEntry:Buffer.from([185,131,167,186,159,125,19,67]),voterStakeRegistryDeposit:Buffer.from([242,35,198,137,82,225,242,182]),voterStakeRegistryWithdraw:Buffer.from([183,18,70,156,148,109,161,34]),voterStakeRegistryUpdateVoterWeightRecord:Buffer.from([45,185,3,36,109,190,115,169])};import UP from"bn.js";import{PublicKey as Zw}from"@solana/web3.js";import{AccountLayout as Jw,MintLayout as ek,NATIVE_MINT as tk,TOKEN_PROGRAM_ID as ok}from"@solana/spl-token";import V from"bn.js";var ue=1e4;function XP(n,e,t,i){if(e===void 0)return{amount:n,fee:void 0,expirationTime:void 0};let r=t.epoch<e.newerTransferFee.epoch?e.olderTransferFee:e.newerTransferFee,c=new V(r.maximumFee.toString()),m=t.epoch<e.newerTransferFee.epoch?(Number(e.newerTransferFee.epoch)*t.slotsInEpoch-t.absoluteSlot)*400/1e3:void 0;if(i)if(r.transferFeeBasisPoints===ue){let l=new V(r.maximumFee.toString());return{amount:n.add(l),fee:l,expirationTime:m}}else{let l=ke(n.mul(new V(ue)),new V(ue-r.transferFeeBasisPoints)),d=new V(r.maximumFee.toString()),y=l.sub(n).gt(d)?n.add(d):l,b=ke(y.mul(new V(r.transferFeeBasisPoints)),new V(ue)),A=b.gt(c)?c:b;return{amount:y,fee:A,expirationTime:m}}else{let l=ke(n.mul(new V(r.transferFeeBasisPoints)),new V(ue)),d=l.gt(c)?c:l;return{amount:n,fee:d,expirationTime:m}}}function ho(n,e,t,i){if(e===void 0)return{amount:n,fee:void 0,expirationTime:void 0};let r=v(x({},e),{olderTransferFee:{epoch:BigInt(e.olderTransferFee.epoch),maximumFee:BigInt(e.olderTransferFee.maximumFee),transferFeeBasisPoints:e.olderTransferFee.transferFeeBasisPoints},newerTransferFee:{epoch:BigInt(e.newerTransferFee.epoch),maximumFee:BigInt(e.newerTransferFee.maximumFee),transferFeeBasisPoints:e.newerTransferFee.transferFeeBasisPoints}}),c=t.epoch<r.newerTransferFee.epoch?r.olderTransferFee:r.newerTransferFee,m=new V(c.maximumFee.toString()),l=t.epoch<r.newerTransferFee.epoch?(Number(r.newerTransferFee.epoch)*t.slotsInEpoch-t.absoluteSlot)*400/1e3:void 0;if(i)if(c.transferFeeBasisPoints===ue){let d=new V(c.maximumFee.toString());return{amount:n.add(d),fee:d,expirationTime:l}}else{let d=ke(n.mul(new V(ue)),new V(ue-c.transferFeeBasisPoints)),y=new V(c.maximumFee.toString()),b=d.sub(n).gt(y)?n.add(y):d,A=ke(b.mul(new V(c.transferFeeBasisPoints)),new V(ue)),C=A.gt(m)?m:A;return{amount:b,fee:C,expirationTime:l}}else{let d=ke(n.mul(new V(c.transferFeeBasisPoints)),new V(ue)),y=d.gt(m)?m:d;return{amount:n,fee:y,expirationTime:l}}}function Io(n,e){return n===void 0?e:e===void 0?n:Math.min(n,e)}function ke(n,e){let{div:t,mod:i}=n.divmod(e);return i.gt(new V(0))?t.add(new V(1)):t}function xn(n,e){if(n.isZero())return new V(0);let t=n.div(e);return t.isZero()?new V(1):n.mod(e).gt(new V(0))?t.add(new V(1)):t}function pa(n,e,t){if(e===void 0)return{amount:n,fee:void 0,expirationTime:void 0};let i=Math.floor(t/432e3),r=i<e.newerTransferFee.epoch?e.olderTransferFee:e.newerTransferFee,c=new V(r.maximumFee.toString()),m=i<e.newerTransferFee.epoch?(Number(e.newerTransferFee.epoch)*432e3-t)*400/1e3:void 0,l=ke(n.mul(new V(r.transferFeeBasisPoints)),new V(ue)),d=l.gt(c)?c:l;return{amount:n,fee:d,expirationTime:m}}function fa(n,e,t){if(e===void 0)return{amount:n,fee:void 0,expirationTime:void 0};let i=Math.floor(t/432e3),r=i<e.newerTransferFee.epoch?e.olderTransferFee:e.newerTransferFee,c=new V(r.maximumFee.toString()),m=i<e.newerTransferFee.epoch?(Number(e.newerTransferFee.epoch)*432e3-t)*400/1e3:void 0;if(r.transferFeeBasisPoints===ue){let l=new V(r.maximumFee.toString());return{amount:n.add(l),fee:l,expirationTime:m}}else{let l=ke(n.mul(new V(ue)),new V(ue-r.transferFeeBasisPoints)),d=new V(r.maximumFee.toString()),y=l.sub(n).gt(d)?n.add(d):l,b=ke(y.mul(new V(r.transferFeeBasisPoints)),new V(ue)),A=b.gt(c)?c:b;return{amount:y,fee:A,expirationTime:m}}}import No from"bn.js";var ya=new No(25),ba=new No(1e4);import{ASSOCIATED_TOKEN_PROGRAM_ID as fA,TOKEN_PROGRAM_ID as yA}from"@solana/spl-token";import{PublicKey as gA,SystemProgram as PA,SYSVAR_RENT_PUBKEY as AA,TransactionInstruction as wA}from"@solana/web3.js";import xA from"bn.js";var ga=f([p("instruction"),o("amountIn"),o("minAmountOut")]),Pa=f([p("instruction"),o("maxAmountIn"),o("amountOut")]),lA=f([p("instruction"),p("nonce")]),Aa=f([p("instruction"),p("nonce"),o("startTime")]),Mo=f([o("status"),o("nonce"),o("maxOrder"),o("depth"),o("baseDecimal"),o("quoteDecimal"),o("state"),o("resetFlag"),o("minSize"),o("volMaxCutRatio"),o("amountWaveRatio"),o("baseLotSize"),o("quoteLotSize"),o("minPriceMultiplier"),o("maxPriceMultiplier"),o("systemDecimalValue"),o("minSeparateNumerator"),o("minSeparateDenominator"),o("tradeFeeNumerator"),o("tradeFeeDenominator"),o("pnlNumerator"),o("pnlDenominator"),o("swapFeeNumerator"),o("swapFeeDenominator"),o("baseNeedTakePnl"),o("quoteNeedTakePnl"),o("quoteTotalPnl"),o("baseTotalPnl"),o("poolOpenTime"),o("punishPcAmount"),o("punishCoinAmount"),o("orderbookToInitTime"),O("swapBaseInAmount"),O("swapQuoteOutAmount"),o("swapBase2QuoteFee"),O("swapQuoteInAmount"),O("swapBaseOutAmount"),o("swapQuote2BaseFee"),a("baseVault"),a("quoteVault"),a("baseMint"),a("quoteMint"),a("lpMint"),a("openOrders"),a("marketId"),a("marketProgramId"),a("targetOrders"),a("withdrawQueue"),a("lpVault"),a("owner"),o("lpReserve"),g(o(),3,"padding")]),mA=f([o("accountType"),o("status"),o("nonce"),o("maxOrder"),o("depth"),o("baseDecimal"),o("quoteDecimal"),o("state"),o("resetFlag"),o("minSize"),o("volMaxCutRatio"),o("amountWaveRatio"),o("baseLotSize"),o("quoteLotSize"),o("minPriceMultiplier"),o("maxPriceMultiplier"),o("systemDecimalsValue"),o("abortTradeFactor"),o("priceTickMultiplier"),o("priceTick"),o("minSeparateNumerator"),o("minSeparateDenominator"),o("tradeFeeNumerator"),o("tradeFeeDenominator"),o("pnlNumerator"),o("pnlDenominator"),o("swapFeeNumerator"),o("swapFeeDenominator"),o("baseNeedTakePnl"),o("quoteNeedTakePnl"),o("quoteTotalPnl"),o("baseTotalPnl"),o("poolOpenTime"),o("punishPcAmount"),o("punishCoinAmount"),o("orderbookToInitTime"),O("swapBaseInAmount"),O("swapQuoteOutAmount"),O("swapQuoteInAmount"),O("swapBaseOutAmount"),o("swapQuote2BaseFee"),o("swapBase2QuoteFee"),a("baseVault"),a("quoteVault"),a("baseMint"),a("quoteMint"),a("lpMint"),a("modelDataAccount"),a("openOrders"),a("marketId"),a("marketProgramId"),a("targetOrders"),a("owner"),g(o(),64,"padding")]),wa=f([p("instruction"),o("baseAmountIn"),o("quoteAmountIn"),o("fixedSide"),o("otherAmountMin")]),ka=f([p("instruction"),o("lpAmount"),o("baseAmountMin"),o("quoteAmountMin")]);var Ta=f([o("fee")]);var LA=_("Raydium_liquidity_instruction");var ha=5e4,Ia=f([o("x"),o("y"),o("price")]),FA=f([o("accountType"),o("status"),o("multiplier"),o("validDataCount"),g(Ia,ha,"DataElement")]);import{PublicKey as YA}from"@solana/web3.js";import QA from"decimal.js";import{TOKEN_PROGRAM_ID as $A}from"@solana/spl-token";import{PublicKey as EA}from"@solana/web3.js";var qA=_("Raydium_liquidity_serum");import hk from"bn.js";import Bk from"decimal.js";import{TOKEN_PROGRAM_ID as Iw}from"@solana/spl-token";import{PublicKey as Sw}from"@solana/web3.js";import xw from"bn.js";import{SystemProgram as mw,SYSVAR_RENT_PUBKEY as dw,Transaction as pw,TransactionInstruction as fw}from"@solana/web3.js";import{createInitializeAccountInstruction as bw,TOKEN_PROGRAM_ID as gw}from"@solana/spl-token";function Ba(n="accountFlags"){let e=new Rt(n);return e.addBoolean("initialized"),e.addBoolean("market"),e.addBoolean("openOrders"),e.addBoolean("requestQueue"),e.addBoolean("eventQueue"),e.addBoolean("bids"),e.addBoolean("asks"),e}var Sa=f([M(5),Ba("accountFlags"),a("ownAddress"),o("vaultSignerNonce"),a("baseMint"),a("quoteMint"),a("baseVault"),o("baseDepositsTotal"),o("baseFeesAccrued"),a("quoteVault"),o("quoteDepositsTotal"),o("quoteFeesAccrued"),o("quoteDustThreshold"),a("requestQueue"),a("eventQueue"),a("bids"),a("asks"),o("baseLotSize"),o("quoteLotSize"),o("feeRateBps"),o("referrerRebatesAccrued"),M(7)]);import{PublicKey as $T}from"@solana/web3.js";import{AccountLayout as JT,NATIVE_MINT as eh,TOKEN_2022_PROGRAM_ID as th,TOKEN_PROGRAM_ID as nh,createAssociatedTokenAccountIdempotentInstruction as oh}from"@solana/spl-token";import Yk from"bn.js";import Ma from"bn.js";var Mk=new Ma(0);import Dk from"bn.js";import Fa from"bn.js";var Vt=new Fa(1e6);import mh from"bn.js";import ph from"decimal.js";import{PublicKey as pT,TransactionInstruction as fT,Keypair as bT,SystemProgram as gT}from"@solana/web3.js";import{ASSOCIATED_TOKEN_PROGRAM_ID as AT,TOKEN_2022_PROGRAM_ID as wT,TOKEN_PROGRAM_ID as kT}from"@solana/spl-token";var jk=Buffer.from("vault_and_lp_mint_auth_seed","utf8"),Jk=Buffer.from("amm_config","utf8"),eT=Buffer.from("pool","utf8"),tT=Buffer.from("pool_lp_mint","utf8"),nT=Buffer.from("pool_vault","utf8"),oT=Buffer.from("observation","utf8"),iT=Buffer.from("permission","utf8"),rT=Buffer.from("support_mint","utf8"),aT=Buffer.from("creator_fee_share","utf8");var sT=Buffer.from("locked_liquidity","utf8");var xT=_("Raydium_cpmm"),CT={initialize:[175,175,109,31,13,152,155,237],deposit:[242,35,198,137,82,225,242,182],withdraw:[183,18,70,156,148,109,161,34],swapBaseInput:[143,190,90,218,196,30,51,222],swapBaseOutput:[55,217,98,86,163,74,180,173],lockCpLiquidity:[216,157,29,78,38,51,31,26],collectCpFee:[8,30,51,199,209,184,247,133],createPermissionPda:Buffer.from([135,136,2,216,137,169,181,202]),closePermissionPda:Buffer.from([156,84,32,118,69,135,70,123]),initializeWithPermission:Buffer.from([63,55,254,65,49,178,89,121]),collectCreatorFee:Buffer.from([20,22,86,123,198,28,219,132]),collectCreatorFeePermissionless:Buffer.from([202,202,34,83,226,122,145,229])};var Va=f([M(8),p("bump"),de("disableCreatePool"),$("index"),o("tradeFeeRate"),o("protocolFeeRate"),o("fundFeeRate"),o("createPoolFee"),a("protocolOwner"),a("fundOwner"),o("creatorFeeRate"),o("creatorFeeShareRate"),g(o(),14)]),vo=f([M(8),a("configId"),a("poolCreator"),a("vaultA"),a("vaultB"),a("mintLp"),a("mintA"),a("mintB"),a("mintProgramA"),a("mintProgramB"),a("observationId"),p("bump"),p("status"),p("lpDecimals"),p("mintDecimalA"),p("mintDecimalB"),o("lpAmount"),o("protocolFeesMintA"),o("protocolFeesMintB"),o("fundFeesMintA"),o("fundFeesMintB"),o("openTime"),o("epoch"),p("feeOn"),de("enableCreatorFee"),g(p(),6),o("creatorFeesMintA"),o("creatorFeesMintB"),g(o(),28)]),OT=f([M(8),a("configId"),g(o(),30)]),NT=f([M(8),p("bump"),a("creator"),a("ammConfig"),o("shareRate"),g(o(),8)]);import{PublicKey as Tx,SystemProgram as hx}from"@solana/web3.js";import{createTransferInstruction as Bx,TOKEN_PROGRAM_ID as Sx,TOKEN_2022_PROGRAM_ID as Kx,createAssociatedTokenAccountIdempotentInstruction as xx,createSyncNativeInstruction as Rx,createTransferCheckedInstruction as Lx}from"@solana/spl-token";import rs from"bn.js";import Mx from"decimal.js";import{ASSOCIATED_TOKEN_PROGRAM_ID as kI,TOKEN_2022_PROGRAM_ID as TI,TOKEN_PROGRAM_ID as hI}from"@solana/spl-token";import{SystemProgram as KI,TransactionInstruction as xI}from"@solana/web3.js";import Wa from"bn.js";var aI=Buffer.from("vault_auth_seed","utf8"),sI=Buffer.from("global_config","utf8"),uI=Buffer.from("pool_vesting","utf8"),cI=Buffer.from("platform_config","utf8"),lI=Buffer.from("platform_fee_vault_auth_seed","utf8"),mI=Buffer.from("creator_fee_vault_auth_seed","utf8"),dI=Buffer.from("platform_global_access","utf8"),pI=Buffer.from("platform_allow_config","utf8"),fI=Buffer.from("platform_curve_rule","utf8");var LI={initialize:Buffer.from([175,175,109,31,13,152,155,237]),initializeV2:Buffer.from([67,153,175,39,218,16,38,32]),buyExactIn:Buffer.from([250,234,13,123,213,156,19,236]),buyExactOut:Buffer.from([24,211,116,40,105,3,153,56]),sellExactIn:Buffer.from([149,39,222,155,211,124,152,26]),sellExactOut:Buffer.from([95,200,71,34,8,9,11,166]),createVestingAccount:Buffer.from([129,178,2,13,217,172,230,218]),claimVestedToken:Buffer.from([49,33,104,30,189,157,79,35]),createPlatformConfig:Buffer.from([176,90,196,175,253,113,220,20]),claimPlatformFee:Buffer.from([156,39,208,135,76,237,61,72]),updatePlaformConfig:Buffer.from([195,60,76,129,146,45,67,143]),initializeWithToken2022:Buffer.from([37,190,126,222,44,154,171,17]),claimPlatformFeeFromVault:Buffer.from([117,241,198,168,248,218,80,29]),claimCreatorFee:Buffer.from([26,97,138,203,132,171,141,252]),createPlatformVestingAccount:Buffer.from([146,71,173,69,98,19,15,106]),createPlatformAllowConfig:Buffer.from([69,71,168,7,214,250,107,102]),closePlatformAllowConfig:Buffer.from([82,205,36,216,16,6,240,215]),createPlatformCurveRule:Buffer.from([148,71,180,136,122,144,59,21]),updatePlatformCurveRule:Buffer.from([90,100,206,196,54,117,120,139]),removePlatformCurveRule:Buffer.from([236,77,154,138,32,145,127,219]),closePlatformCurveRule:Buffer.from([194,114,82,45,136,88,169,159])};var OI=new Wa("18446744073709551615");var qa=f([o(),o("epoch"),p("curveType"),$("index"),o("migrateFee"),o("tradeFeeRate"),o("maxShareFeeRate"),o("minSupplyA"),o("maxLockRate"),o("minSellRateA"),o("minMigrateRateA"),o("minFundRaisingB"),a("mintB"),a("protocolFeeOwner"),a("migrateFeeOwner"),a("migrateToAmmWallet"),a("migrateToCpmmWallet"),g(o(),16)]),Ua=f([o("totalLockedAmount"),o("cliffPeriod"),o("unlockPeriod"),o("startTime"),o("totalAllocatedShare")]),Ga=f([o(),o("epoch"),p("bump"),p("status"),p("mintDecimalsA"),p("mintDecimalsB"),p("migrateType"),o("supply"),o("totalSellA"),o("virtualA"),o("virtualB"),o("realA"),o("realB"),o("totalFundRaisingB"),o("protocolFee"),o("platformFee"),o("migrateFee"),Ua.replicate("vestingSchedule"),a("configId"),a("platformId"),a("mintA"),a("mintB"),a("vaultA"),a("vaultB"),a("creator"),p("mintProgramFlag"),p("cpmmCreatorFeeOn"),o("platformVestingShare"),g(p(),54)]),vI=f([o(),o("epoch"),a("poolId"),a("beneficiary"),o("claimedAmount"),o("tokenShareAmount"),g(o(),8)]),za=f([p("migrateType"),p("migrateCpmmFeeOn"),o("supply"),o("totalSellA"),o("totalFundRaisingB"),o("totalLockedAmount"),o("cliffPeriod"),o("unlockPeriod")]),_I=f([o("epoch"),p("index"),a("configId"),za.replicate("bondingCurveParam"),g(o(),50)]),Vo=f([o(),o("epoch"),a("platformClaimFeeWallet"),a("platformLockNftWallet"),o("platformScale"),o("creatorScale"),o("burnScale"),o("feeRate"),g(p(),64,"name"),g(p(),256,"web"),g(p(),256,"img"),a("cpConfigId"),o("creatorFeeRate"),a("transferFeeExtensionAuth"),a("platformVestingWallet"),o("platformVestingScale"),a("platformCpCreator"),p("restrictGlobalConfig"),p("restrictCurveParam"),a("curveRuleManager"),g(p(),78)]),Xa=f([p("field"),p("op"),O("value")]),Ya=f([$("groupId"),o("epoch"),pn(Xa,"constraints")]),Ha=f([o(),p("bump"),p("version"),a("platformId"),a("configId"),o("epoch"),g(o(),8),pn(Ya,"groups")]);import{TOKEN_2022_PROGRAM_ID as DI,TOKEN_PROGRAM_ID as WI}from"@solana/spl-token";import Qa from"bn.js";var JI=new Qa(1e6);import oB from"bn.js";import rB from"decimal.js";import FB from"bn.js";import _B from"decimal.js";import mB from"bn.js";import pB from"decimal.js";import hB from"bn.js";import BB from"decimal.js";import Do from"bn.js";import Cn from"decimal.js";var Dt=class{static _multipler(e){return new Cn(10).pow(e)}static getPrice({priceX64:e,decimalA:t,decimalB:i}){return new Cn(e.toString()).div(this._Q64).mul(this._multipler(t)).div(this._multipler(i))}static getPriceX64({price:e,decimalA:t,decimalB:i}){let r=e.mul(this._multipler(i)).div(this._multipler(t));return new Do(r.mul(this._Q64).toFixed(0))}};Dt._Q64=new Cn(new Do(1).shln(64).toString());import{NATIVE_MINT as jS,TOKEN_2022_PROGRAM_ID as JS,TOKEN_PROGRAM_ID as eK,createAssociatedTokenAccountIdempotentInstruction as nK,createSyncNativeInstruction as oK,getTransferFeeConfig as iK,unpackMint as rK}from"@solana/spl-token";import ee from"bn.js";import{PublicKey as ns,SystemProgram as uK}from"@solana/web3.js";import yK from"decimal.js";var bK={initPriceX64:new ee("515752397214619"),supply:new ee(1e15),totalSellA:new ee(7931e11),totalFundRaisingB:new ee(85e9),totalFundRaisingBUSD:new ee(125e8),totalLockedAmount:new ee("0"),cliffPeriod:new ee("0"),unlockPeriod:new ee("0"),decimals:6,virtualA:new ee("1073471847374405"),virtualB:new ee("30050573465"),realA:new ee(0),realB:new ee(0),protocolFee:new ee(0),platformId:new ns("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),vestingSchedule:{totalLockedAmount:new ee(0),cliffPeriod:new ee(0),unlockPeriod:new ee(0),startTime:new ee(0),totalAllocatedShare:new ee(0)}},gK=new ee(1e4);var os={[gn.toBase58()]:3};var is=f([M(5),M(8),a("ownAddress"),o("vaultSignerNonce"),a("baseMint"),a("quoteMint"),a("baseVault"),o("baseDepositsTotal"),o("baseFeesAccrued"),a("quoteVault"),o("quoteDepositsTotal"),o("quoteFeesAccrued"),o("quoteDustThreshold"),a("requestQueue"),a("eventQueue"),a("bids"),a("asks"),o("baseLotSize"),o("quoteLotSize"),o("feeRateBps"),o("referrerRebatesAccrued"),M(7)]);import{PublicKey as WK}from"@solana/web3.js";var XK=_("Serum");import{ASSOCIATED_TOKEN_PROGRAM_ID as ex,TOKEN_2022_PROGRAM_ID as tx,TOKEN_PROGRAM_ID as nx}from"@solana/spl-token";import{PublicKey as ix,SystemProgram as rx,TransactionInstruction as ax}from"@solana/web3.js";import ux from"bn.js";var lC=new rs(0);import{PublicKey as as,Transaction as Rn,TransactionInstruction as ss}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as us}from"@solana/spl-token";import Wo from"bn.js";var re=class extends ce{static getPdaPoolId(e,t){return pe([re.SEED_CONFIG.pool.id,t.toBuffer()],e)}static getPdaOwnerId(e,t,i,r){return pe([re.SEED_CONFIG.owner.id,t.toBuffer(),i.toBuffer(),Buffer.from(new Wo(r).toArray())],e)}static async getAllInfo({connection:e,programId:t,poolIds:i,wallet:r,chainTime:c}){if(i.length===0)return[];let m=i.map(b=>re.getPdaPoolId(t,b).publicKey),l=[];for(let b=0;b<re.VERSION_PROJECT.length;b++)l.push(...m.map(A=>re.getPdaOwnerId(t,A,r,b).publicKey));let d=await Pe(e,[...m,...l]),y=[];for(let b=0;b<d.length;b++){let A=Math.floor(b/i.length),C=b%i.length,B=m[C],F=l[b],w=d[C],I=d[i.length+b];if(!(w&&I)||w.data.length!==re.POOL_LAYOUT.span||I.data.length!==re.OWNER_LAYOUT.span)continue;let K=re.POOL_LAYOUT.decode(w.data),S=re.OWNER_LAYOUT.decode(I.data),E=K.openTime.toNumber(),D=K.endTime.toNumber(),P=S.tokenInfo.map(R=>R.debtAmount.gt(new Wo(0))).filter(R=>!R).length!==3,k=c>E&&c<D&&K.status===1,T=P&&k;y.push({programId:t,poolId:B,ammId:K.ammId,ownerAccountId:F,snapshotLpAmount:S.lpAmount,project:re.VERSION_PROJECT[A],openTime:E,endTime:D,canClaim:T,canClaimErrorType:P?k?void 0:"outOfOperationalTime":"alreadyClaimIt",tokenInfo:K.tokenInfo.map((R,N)=>({mintAddress:R.mintAddress,mintVault:R.mintVault,mintDecimals:R.mintDecimals,perLpLoss:R.perLpLoss,debtAmount:S.tokenInfo[N].debtAmount.add(S.tokenInfo[N].claimedAmount)}))})}return y}async makeClaimTransaction({poolInfo:e,ownerInfo:t,feePayer:i}){t.wallet||this.scope.checkOwner();let r=this.createTxBuilder(i),c=t.wallet||this.scope.ownerPubKey,m=[];for(let y of e.tokenInfo){let{account:b,instructionParams:A}=await this.scope.account.getOrCreateTokenAccount({mint:y.mintAddress,owner:this.scope.ownerPubKey,notUseTokenAccount:y.mintAddress.equals(J.WSOL.mint),createInfo:{payer:c,amount:0},skipCloseAccount:!y.mintAddress.equals(J.WSOL.mint),associatedOnly:y.mintAddress.equals(J.WSOL.mint)?!1:t.associatedOnly});A&&r.addInstruction(A),m.push(b)}r.addInstruction({instructions:[re.makeClaimInstruction({programId:e.programId,poolInfo:e,ownerInfo:{wallet:c,ownerPda:e.ownerAccountId,claimAddress:m}})]});let{transaction:l,signers:d}=r.build();return[{transaction:l,signer:d}]}async makeClaimAllTransaction({poolInfos:e,ownerInfo:t,feePayer:i}){let r=this.createTxBuilder(i),c=t.wallet||this.scope.ownerPubKey,m={};for(let b of e){let A=[];for(let C of b.tokenInfo){let{account:B,instructionParams:F}=await this.scope.account.getOrCreateTokenAccount({mint:C.mintAddress,owner:this.scope.ownerPubKey,notUseTokenAccount:C.mintAddress.equals(J.WSOL.mint),createInfo:{payer:c,amount:0},skipCloseAccount:!C.mintAddress.equals(J.WSOL.mint),associatedOnly:C.mintAddress.equals(J.WSOL.mint)?!1:t.associatedOnly});F&&r.addInstruction(F),B&&(m[C.mintAddress.toString()]=B,A.push(B))}r.addInstruction({instructions:[re.makeClaimInstruction({programId:b.programId,poolInfo:b,ownerInfo:{wallet:c,ownerPda:b.ownerAccountId,claimAddress:A}})]})}let{transaction:l,signers:d}=r.build(),y=r.allInstructions;return Bt(y,[c,...d.map(b=>b.publicKey)])?[{transaction:l,signer:d}]:[{transaction:new Rn().add(...y.slice(0,r.AllTxData.instructions.length-1)),signer:d},{transaction:new Rn().add(...y.slice(r.AllTxData.instructions.length-1)),signer:[]},{transaction:new Rn().add(...r.AllTxData.endInstructions),signer:[]}]}static makeClaimInstruction({programId:e,poolInfo:t,ownerInfo:i}){let r=f([]),c=[{pubkey:i.wallet,isSigner:!0,isWritable:!0},{pubkey:t.poolId,isSigner:!1,isWritable:!0},{pubkey:i.ownerPda,isSigner:!1,isWritable:!0},...i.claimAddress.map(d=>({pubkey:d,isSigner:!1,isWritable:!0})),...t.tokenInfo.map(({mintVault:d})=>({pubkey:d,isSigner:!1,isWritable:!0})),{pubkey:us,isSigner:!1,isWritable:!1}],m=Buffer.alloc(r.span);r.encode({},m);let l=Buffer.from([10,66,208,184,161,6,191,98,...m]);return new ss({keys:c,programId:e,data:l})}},be=re;be.CLAIMED_NUM=3,be.POOL_LAYOUT=f([M(8),p("bump"),p("status"),o("openTime"),o("endTime"),a("ammId"),g(f([p("mintDecimals"),a("mintAddress"),a("mintVault"),o("perLpLoss"),o("totalClaimedAmount")]),re.CLAIMED_NUM,"tokenInfo"),g(o(),10,"padding")]),be.OWNER_LAYOUT=f([M(8),p("bump"),p("version"),a("poolId"),a("owner"),o("lpAmount"),g(f([a("mintAddress"),o("debtAmount"),o("claimedAmount")]),re.CLAIMED_NUM,"tokenInfo"),g(o(),4,"padding")]),be.DEFAULT_POOL_ID=["58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2","6UmmUiYoBjSrhakAobJw8BvkmJtDVxaeBtbt7rxWo1mg","AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA","DVa7Qmb5ct9RCpaU7UTpSaf3GVMYz17vNVU67XpdCRut","7XawhbbxtsRcQA8KTkHT9f9nc6d69UwqCDh6U5EEbEmX","6a1CsrpeZubDjEJE9s1CMVheB6HWM5d7m1cj2jkhyXhj","EoNrn8iUhwgJySD1pHu8Qxm5gSQqLK3za4m8xzD2RuEb","AceAyRTWt4PyB2pHqf2qhDgNZDtKVNaxgL8Ru3V4aN1P","6tmFJbMk5yVHFcFy7X2K8RwHjKLr6KVFLYXpgpBNeAxB"].map(e=>new as(e)),be.SEED_CONFIG={pool:{id:Buffer.from("pool_seed","utf8")},owner:{id:Buffer.from("user_claim_seed","utf8")}},be.VERSION_PROJECT=[void 0,"Francium","Tulip","Larix"];import{PublicKey as KC}from"@solana/web3.js";import{getTransferFeeConfig as CC,MintLayout as RC,TOKEN_2022_PROGRAM_ID as LC,TOKEN_PROGRAM_ID as OC,unpackMint as NC}from"@solana/spl-token";function Z(n){if(n instanceof me)return new L(n.numerator,n.denominator);if(n instanceof se)return n.adjusted;if(n instanceof ie)try{return Z(n.toExact())}catch{return new L(z)}if(n instanceof L)return n;let e=String(n),t=_e(e);return new L(t.numerator,t.denominator)}function GR(n){var i;if(n instanceof me)return{fr:new L(n.numerator,n.denominator)};if(n instanceof se)return{fr:n.adjusted};if(n instanceof ie)return{fr:Z(n.toExact()),decimals:n.token.decimals};if(n instanceof L)return{fr:n};let e=String(n),t=_e(e);return{fr:new L(t.numerator,t.denominator),decimals:(i=t.dec)==null?void 0:i.length}}function zR(n,e){if(n==null||e==null)return!1;let t=Z(n),i=Z(e);return t.sub(i).numerator,t.sub(i).numerator.lt(z)}function cs(n,e){if(n==null||e==null)return!1;let t=Z(n),i=Z(e);return t.sub(i).numerator.gt(z)}function XR(n,e){if(n==null||e==null)return!1;let t=Z(n),i=Z(e);return t.sub(i).numerator.lte(z)}function YR(n,e){if(n==null||e==null)return!1;let t=Z(n),i=Z(e);return t.sub(i).numerator.gte(z)}function ls(n,e){if(n==null||e==null)return!1;let t=Z(n),i=Z(e);return t.sub(i).numerator.eq(z)}function HR(n,e){if(n==null||e==null)return;let t=Z(n),i=Z(e);try{return t.div(i)}catch{return t}}function QR(n,e){if(n==null||e==null)return;let t=Z(n),i=Z(e);return t.sub(i)}function ZR(n){return n==null?!1:!ls(n,0)}function $R(n,e){return cs(e,n)?e:n}function Ln(n,e){if(n==null||e==null)return;let t=Z(n),i=Z(e);return t.mul(i)}function jR(n,e){if(n==null||e==null)return;let t=Z(n),i=Z(e);return t.add(i)}var mL=new j(2),dL=new j(3),pL=new j(5),Ne=new j(10),fL=new j(100),yL=new j(1e3),bL=new j(1e4);function tn(n){return Ne.pow(Q(n))}function _e(n){var l;if(n===void 0)return{denominator:"1",numerator:"0"};if(n instanceof j)return{numerator:n.toString(),denominator:"1"};if(n instanceof L)return{denominator:n.denominator.toString(),numerator:n.numerator.toString()};let e=String(n),[,t="",i="",r=""]=(l=e.replace(",","").match(/(-?)(\d*)\.?(\d*)/))!=null?l:[],c="1"+"0".repeat(r.length),m=t+(i==="0"?"":i)+r||"0";return{denominator:c,numerator:m,sign:t,int:i,dec:r}}function Na(n,e){let t=n.divmod(e);return t.mod.isZero()?t.div:n.isNeg()===e.isNeg()?t.div.iaddn(1):t.div}function ds(n){var i;let[,e="",t=""]=(i=n.toFixed(2).match(/(-?)(\d*)\.?(\d*)/))!=null?i:[];return`${e}${t}`}function ps(n,e=0){return n instanceof j?n:new j(ds(Uo(n).mul(Ne.pow(new j(String(e))))))}function Uo(n){if(n instanceof me)return new L(n.numerator,n.denominator);if(n instanceof se)return n.adjusted;if(n instanceof ie)try{return Uo(n.toExact())}catch{return new L(z)}if(n instanceof L)return n;let e=String(n),t=_e(e);return new L(t.numerator,t.denominator)}function Fo(n,e,t){return n.mul(e).add(t).sub(new j(1)).div(t)}function va(n,e,t){return n.mul(e).div(t)}function gL(n,e){let{numerator:t,denominator:i}=_e(n);return new me(new j(t),new j(i).mul(e!=null&&e.alreadyDecimaled?new j(100):new j(1)))}function PL(n){let{token:e,numberPrice:t,decimalDone:i}=n,r=new J({mint:"",decimals:6,symbol:"usd",name:"usd",skipMint:!0}),{numerator:c,denominator:m}=_e(t),l=i?new j(c).mul(Ne.pow(new j(e.decimals))):c,d=new j(m).mul(Ne.pow(new j(r.decimals)));return new se({baseToken:r,denominator:d.toString(),quoteToken:new J(v(x({},e),{skipMint:!0,mint:""})),numerator:l.toString()})}function qo(n){let e=new ot({decimals:6,symbol:"usd",name:"usd"}),t=ps(Ln(n,10**e.decimals));return new Oe(e,t)}function AL(n,e){return qo(!e||!n?0:Ln(n,e))}function wL(n){if(n==null)return;let{numerator:e,denominator:t}=_e(n.toString());return new L(e,t)}function kL(n){return n instanceof ms}function zt(n,e=1,t=[]){let i=[...n];if(e<=0)return t;for(;i.length;)t.push(i.splice(0,e));return t}function hL(n,...e){return n.filter(t=>e.every(i=>i.includes(t)))}function IL(n,...e){return n.filter(t=>e.every(i=>!i.includes(t)))}function BL(n){return[...new Set(n)]}export{Bs as ACCOUNT_TYPE_SIZE,Qi as ALL_PROGRAM_ID,qi as AMM_STABLE,Pn as AMM_V4,pu as ANAMint,Jo as AccountType,ke as BNDivCeil,fL as BN_100,yL as BN_1000,bL as BN_10000,pL as BN_FIVE,Ne as BN_TEN,dL as BN_THREE,mL as BN_TWO,so as CLMM_LOCK_AUTH_ID,ao as CLMM_LOCK_PROGRAM_ID,An as CLMM_PROGRAM_ID,ou as CLOCK_PROGRAM_ID,co as CREATE_CPMM_POOL_AUTH,zi as CREATE_CPMM_POOL_FEE_ACC,Mt as CREATE_CPMM_POOL_PROGRAM,Ce as DEVNET_PROGRAM_ID,$m as DEV_LAUNCHPAD_AUTH,Zm as DEV_LAUNCHPAD_PROGRAM,We as DEV_LOOKUP_TABLE_CACHE,fu as ETHMint,fn as FARM_PROGRAM_ID_V3,yn as FARM_PROGRAM_ID_V4,bn as FARM_PROGRAM_ID_V5,Nt as FARM_PROGRAM_ID_V6,uo as FEE_DESTINATION_ID,Vt as FEE_RATE_DENOMINATOR_VALUE,di as INSTRUCTION_PROGRAM_ID,te as InstructionType,Xi as LAUNCHPAD_AUTH,Hi as LAUNCHPAD_CONFIG,Yi as LAUNCHPAD_PLATFORM,po as LAUNCHPAD_PROGRAM,Ui as LIQUIDITY_POOL_PROGRAM_ID_V5_MODEL,mo as LOCK_CPMM_AUTH,lo as LOCK_CPMM_PROGRAM,De as LOOKUP_TABLE_CACHE,Ho as LogLevel,qt as Logger,Hn as MAX_BASE64_SIZE,$t as MEMO_PROGRAM_ID,wt as METADATA_PROGRAM_ID,wn as MODEL_DATA_PUBKEY,du as NRVMint,ro as OPEN_BOOK_PROGRAM,Ie as Owner,ru as PAIMint,iu as RAYMint,nt as RENT_PROGRAM_ID,Yt as Rounding,Gi as Router,gn as SERUM_PROGRAM_ID_V3,Me as SOLMint,au as SRMMint,pi as SYSTEM_PROGRAM_ID,Kt as TxBuilder,Be as TxVersion,su as USDCMint,mu as USDHMint,uu as USDTMint,Wi as UTIL1216,Ae as WSOLMint,Ee as accountMeta,jR as add,ht as addComputeBudget,Fo as ceilDiv,xn as ceilDivBN,it as checkLegacyTxSize,rt as checkV0TxSize,zt as chunkArray,mi as commonSystemAccountMeta,It as confirmTransaction,_ as createLogger,wL as decimalToFraction,HR as div,Na as divCeil,ls as eq,Xt as fetchMultipleMintInfos,pe as findProgramAddress,va as floorDiv,Bt as forecastTransactionSize,ye as getATAAddress,Lo as getDate,an as getDevLookupTableCache,Nc as getEpochInfo,rn as getMainLookupTableCache,$R as getMax,Pe as getMultipleAccountsInfo,Ke as getMultipleAccountsInfoWithCustomFlags,on as getMultipleLookupTableInfo,Ue as getRecentBlockHash,pt as getTime,sg as getTimestamp,XP as getTransferAmountFee,fa as getTransferAmountFeeFromPost,pa as getTransferAmountFeeFromPre,ho as getTransferAmountFeeV2,cs as gt,YR as gte,hL as intersection,na as isDateAfter,ta as isDateBefore,kL as isDecimal,ZR as isMeaningfulNumber,Ro as isNumber,$e as jsonInfo2PoolKeys,zR as lt,XR as lte,cu as mSOLMint,Io as minExpirationTime,Ln as mul,ra as notInnerObject,tg as offsetDateTime,Q as parseBigNumberish,_e as parseNumberInfo,Lc as parseSimulateLogToJson,Oc as parseSimulateValue,Fe as printSimulate,bs as setLoggerLevel,ds as shakeFractionDecimal,Rc as simulateMultipleInstruction,wi as simulateTransaction,gi as sleep,Le as solToWSol,lu as stSOLMint,QR as sub,tn as tenExponential,ps as toBN,Qn as toBuffer,Uo as toFraction,GR as toFractionWithDecimals,gL as toPercent,PL as toTokenPrice,AL as toTotalPrice,qo as toUsdCurrency,Mc as transformTxToBase64,Zt as tryParsePublicKey,ki as txToBase64,BL as uniq,Qt as validateAndParsePublicKey,IL as xor};
//# sourceMappingURL=index.mjs.map