UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

2 lines 91.4 kB
var Xo=Object.defineProperty,Yo=Object.defineProperties;var Qo=Object.getOwnPropertyDescriptors;var yt=Object.getOwnPropertySymbols;var Nn=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable;var On=(n,e,t)=>e in n?Xo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,x=(n,e)=>{for(var t in e||(e={}))Nn.call(e,t)&&On(n,t,e[t]);if(yt)for(var t of yt(e))Mn.call(e,t)&&On(n,t,e[t]);return n},v=(n,e)=>Yo(n,Qo(e));var ge=(n,e)=>{var t={};for(var i in n)Nn.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&&Mn.call(n,i)&&(t[i]=n[i]);return t};import{PublicKey as Vn}from"@solana/web3.js";import{get as Wt,set as Fn}from"lodash";var Zo=(r=>(r[r.Error=0]="Error",r[r.Warning=1]="Warning",r[r.Info=2]="Info",r[r.Debug=3]="Debug",r))(Zo||{}),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={},vn={};function V(n){let e=Wt(Ut,n);if(!e){let t=Wt(vn,n);e=new qt({name:n,logLevel:t}),Fn(Ut,n,e)}return e}function ps(n,e){Fn(vn,n,e);let t=Wt(Ut,n);t&&(t.level=e)}import{MINT_SIZE as Ho,TOKEN_PROGRAM_ID as jo,getTransferFeeConfig as $o,unpackMint as Jo}from"@solana/spl-token";var Gt=V("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}}),p=zt(d,10);l=(await(await Promise.all(p.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 ei=(i=>(i[i.Uninitialized=0]="Uninitialized",i[i.Mint=1]="Mint",i[i.Account=2]="Account",i))(ei||{}),Ts=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<Ho){console.log("invalid mint account",d.pubkey.toBase58());continue}let p=Jo(d.pubkey,d.accountInfo,(c=d.accountInfo)==null?void 0:c.owner);r[d.pubkey.toString()]=v(x({},p),{programId:((m=d.accountInfo)==null?void 0:m.owner)||jo,feeConfig:(l=$o(p))!=null?l:void 0})}return r[Vn.default.toBase58()]=r[Ae.toBase58()],r}import j from"bn.js";import us from"decimal.js";import si from"big.js";import xe from"bn.js";import ti from"toformat";var ni=ti,Je=ni;import gt from"big.js";import oi from"bn.js";import ii 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||{}),_n=9007199254740991;function Z(n){let e=V("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>=_n||n<=-_n)&&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=V("module/fraction"),Qt=Je(gt),tt=Je(ii),ri={[0]:tt.ROUND_DOWN,[1]:tt.ROUND_HALF_UP,[2]:tt.ROUND_UP},ai={[0]:gt.roundDown,[1]:gt.roundHalfUp,[2]:gt.roundUp},L=class{constructor(e,t=new oi(1)){this.numerator=Z(e),this.denominator=Z(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(Z(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(Z(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(Z(e));return new L(this.numerator.mul(t.numerator),this.denominator.mul(t.denominator))}div(e){let t=e instanceof L?e:new L(Z(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:ri[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.`),Qt.DP=e,Qt.RM=ai[i]||1,new Qt(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)}isZero(){return this.numerator.isZero()}};var ui=V("Raydium_amount"),Pt=Je(si);function En(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")):ui.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=Z(i);else{let d=new xe(0),p=new xe(0);if(typeof i=="string"||typeof i=="number"||typeof i=="bigint"){let[b,A]=En(i.toString(),t.decimals);d=Z(b),p=Z(A)}d=d.mul(l),m=d.add(p)}super(m,l);this.logger=V(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=Z(i);else{let d=new xe(0),p=new xe(0);if(typeof i=="string"||typeof i=="number"||typeof i=="bigint"){let[b,A]=En(i.toString(),t.decimals);d=Z(b),p=Z(A)}d=d.mul(l),m=d.add(p)}super(m,l);this.logger=V(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 ci}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Dn}from"@solana/spl-token";var At={chainId:101,address:ci.default.toBase58(),programId:Dn.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:Dn.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 $t}from"@solana/web3.js";import{PublicKey as Y,SystemProgram as Wn,SYSVAR_RENT_PUBKEY as li}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as mi}from"@solana/spl-token";function Ee({pubkey:n,isSigner:e=!1,isWritable:t=!0}){return{pubkey:n,isWritable:t,isSigner:e}}var di=[Ee({pubkey:mi,isWritable:!1}),Ee({pubkey:Wn.programId,isWritable:!1}),Ee({pubkey:li,isWritable:!1})];function Zt({publicKey:n,transformSol:e}){let t=Ht(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 Ht(n){try{return new Y(n)}catch{return n}}var jt=new Y("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),nt=new Y("SysvarRent111111111111111111111111111111111"),eu=new Y("SysvarC1ock11111111111111111111111111111111"),wt=new Y("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),pi=new Y("Sysvar1nstructions1111111111111111111111111"),fi=Wn.programId,tu=new Y("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),nu=new Y("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),ou=new Y("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),iu=new Y("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),ru=new Y("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),au=new Y("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),su=new Y("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),uu=new Y("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),cu=new Y("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),lu=new Y("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),mu=new Y("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),Ae=new Y("So11111111111111111111111111111111111111112"),Me=Y.default;function Le(n){return Zt({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 $t&&Me.equals(e)){this.decimals=we.decimals,this.symbol=we.symbol,this.name=we.name,this.mint=new $t(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?$t.default:Zt({publicKey:e}),this.isToken2022=m}equals(e){return this===e?!0:this.mint.equals(e.mint)}},$=Jt;$.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 yi from"bn.js";var qn=new L(new yi(100)),me=class extends L{toSignificant(e=5,t,i){return this.mul(qn).toSignificant(e,t,i)}toFixed(e=2,t,i){return this.mul(qn).toFixed(e,t,i)}};var bi=V("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&&bi.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 xC}from"lodash";import Fu from"axios";var Un={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"},gi=v(x({},Un),{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 ic=V("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 Km,SystemProgram as xm}from"@solana/web3.js";import{AccountLayout as Nm,createAssociatedTokenAccountIdempotentInstruction as Mm,TOKEN_PROGRAM_ID as Fm,TOKEN_2022_PROGRAM_ID as vm}from"@solana/spl-token";import{PublicKey as Ge,sendAndConfirmTransaction as un,SystemProgram as hi,Transaction as at,TransactionMessage as st,VersionedTransaction as ut}from"@solana/web3.js";import Ii 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 Gn,Keypair as zn,PublicKey as Xn,Transaction as Tt,TransactionMessage as Ai,VersionedTransaction as sn}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as wi}from"@solana/spl-token";var Se=V("Raydium_txUtil"),Yn=1644;function ht(n){let e=[],t=[];return n.microLamports&&(e.push(Gn.setComputeUnitPrice({microLamports:n.microLamports})),t.push(te.SetComputeUnitPrice)),n.units&&(e.push(Gn.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<Yn}catch{return!1}}async function Kc(n,e,t,i=!0){let r=new Xn("RaydiumSimuLateTransaction11111111111111111"),c=[],m=new Tt;m.feePayer=r;for(let p of e)Bt([...m.instructions,p],[r])||(c.push(m),m=new Tt,m.feePayer=r),m.add(p);m.instructions.length>0&&c.push(m);let l=[];try{if(l=await ki(n,c,i),l.find(p=>p.err!==null))throw Error("rpc simulateTransaction error")}catch(p){p instanceof Error&&Se.logWithError("failed to simulate for instructions","RPC_ERROR",{message:p.message})}let d=[];for(let p of l)if(Se.debug("simulate result:",p),p.logs){let b=p.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 xc(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 Cc(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]=Xn.findProgramAddressSync(n,e);return{publicKey:t,nonce:i}}async function ki(n,e,t){let i=[];if(t){let r=await n.getLatestBlockhash(),c=[];for(let p of e){p.recentBlockhash=r.blockhash,p.lastValidBlockHeight=r.lastValidBlockHeight;let A=p._compile().serialize(),B=p._serialize(A).toString("base64");c.push(B)}let m=c.map(p=>{let b=n._buildArgs([p],void 0,"base64");return{methodName:"simulateTransaction",args:b}}),l=[],d=20;for(let p=0;p<Math.ceil(m.length/d);p++)l.push(m.slice(p*d,(p+1)*d));i=await(await Promise.all(l.map(async p=>(await n._rpcBatchRequest(p)).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=zn.generate().publicKey.toString()}){let c=new Ai({payerKey:e,recentBlockhash:i,instructions:n}).compileToV0Message(Object.values(t!=null?t:{}));try{return Buffer.from(new sn(c).serialize()).toString("base64").length<Yn}catch{return!1}}var kt={time:0,data:void 0};async function Rc(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),Ti=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=wi.toBase58()),t.feePayer||(t.feePayer=zn.generate().publicKey)),e.push(Ti(t))}),console.log("simulate tx string:",e),e}function Lc(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 Ii.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(hi.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||{},p=c!=null?c:await Ue(this.connection,this.blockhashCommitment);if(t.recentBlockhash=p,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 p;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(p=this.owner)!=null&&p.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,O=null,W=null,le=G=>{O!==null&&clearInterval(O),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&&(O=setInterval(async()=>{var G;if(R){clearInterval(O);return}try{let U=await this.connection.getTransaction(T,{commitment:"confirmed",maxSupportedTransactionVersion:0});U&&(R=!0,clearInterval(O),le({err:((G=U.meta)==null?void 0:G.err)||null}),console.log("tx status from getTransaction:",T))}catch(U){R=!0,clearInterval(O),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])),p=[];for(let I of d)l[I]===void 0&&p.push(new Ge(I));let b=await on({connection:this.connection,address:p});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 p;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(p=this.owner)!=null&&p.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=O=>{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=O.err?"error":"success"}C==null||C([...S]),O.err||E()};this.loopMultiTxStatus&&(k=setInterval(async()=>{var O;if(P){clearInterval(k);return}try{let W=await this.connection.getTransaction(D,{commitment:"confirmed",maxSupportedTransactionVersion:0});W&&(P=!0,clearInterval(k),R({err:((O=W.meta)==null?void 0:O.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,O=>{if(P){this.connection.removeSignatureListener(T);return}P=!0,R(O)},"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=[],p=[],b=0;if(this.allInstructions.forEach(B=>{let F=[...p,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]&&p.length<12&&(it({instructions:w,payer:this.feePayer,signers:K})||it({instructions:F,payer:this.feePayer,signers:K})))p.push(B);else{if(p.length===0)throw Error("item ins too big");b+=B===t[b]?1:0,it({instructions:i?[...c.instructions,...p]:[...p],payer:this.feePayer,signers:K})?l.push(new at().add(...c.instructions,...p)):l.push(new at().add(...p)),d.push(Array.from(new Set(p.map(S=>S.keys.filter(E=>E.isSigner).map(E=>E.pubkey.toString())).flat())).map(S=>m[S]).filter(S=>S!==void 0)),p=[B]}}),p.length>0){let F=[...new Set(p.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,...p]:[...p],payer:this.feePayer,signers:F.map(w=>w.publicKey)})?l.push(new at().add(...c.instructions,...p)):l.push(new at().add(...p)),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(O=>O.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=[],O=async()=>{if(!k[T])return;T<I&&(R.push({txId:"",status:"success",signedTx:k[T]}),w==null||w([...R]),T++,O());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||O()};this.loopMultiTxStatus&&(G=setInterval(async()=>{var X;if(le){clearInterval(G);return}try{let ae=await this.connection.getTransaction(W,{commitment:"confirmed",maxSupportedTransactionVersion:0});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 O(),{txIds:R.map(W=>W.txId),signedTxs:k}}else{let T=[];for(let R=0;R<k.length;R+=1){let O=await this.connection.sendRawTransaction(k[R].serialize(),{skipPreflight:S});T.push(O)}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),p=Array.from(new Set([...this.lookupTableAddress,...c])),b=[];for(let P of p)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 O of[...new Set(p)])d[O]!==void 0&&(R[O]=d[O]);if(t&&rt({instructions:[...C.instructions,...K],payer:this.feePayer,lookupTableAddressAccount:d,recentBlockhash:B})){let O=new st({payerKey:this.feePayer,recentBlockhash:B,instructions:[...C.instructions,...K]}).compileToV0Message(Object.values(d));w.push(new ut(O))}else{let O=new st({payerKey:this.feePayer,recentBlockhash:B,instructions:[...K]}).compileToV0Message(Object.values(d));w.push(new ut(O))}I.push(Array.from(new Set(K.map(O=>O.keys.filter(W=>W.isSigner).map(W=>W.pubkey.toString())).flat())).map(O=>F[O]).filter(O=>O!==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:O,skipPreflight:W=!0}=P||{};if(w.map(async(G,U)=>{I[U].length&&G.sign(I[U]),O&&(G.message.recentBlockhash=O)}),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 $e=!1,_e=null,ft=null,Ln=Re=>{_e!==null&&clearInterval(_e),ft!==null&&this.connection.removeSignatureListener(ft);let he=X.findIndex(zo=>zo.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&&(_e=setInterval(async()=>{var Re;if($e){clearInterval(_e);return}try{let he=await this.connection.getTransaction(Te,{commitment:"confirmed",maxSupportedTransactionVersion:0});he&&($e=!0,clearInterval(_e),Ln({err:((Re=he.meta)==null?void 0:Re.err)||null}),console.log("tx status from getTransaction:",Te))}catch(he){$e=!0,clearInterval(_e),console.error("getTransaction timeout:",he,Te)}},St)),ft=this.connection.onSignature(Te,Re=>{if($e){this.connection.removeSignatureListener(ft);return}$e=!0,Ln(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=V(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 im,SystemProgram as am}from"@solana/web3.js";import cm from"bn.js";import{createCloseAccountInstruction as pm,createInitializeAccountInstruction as fm,createTransferInstruction as ym,TOKEN_PROGRAM_ID as bm}from"@solana/spl-token";import{Keypair as zl,PublicKey as Xl}from"@solana/web3.js";import Zl from"bn.js";import{TOKEN_PROGRAM_ID as $l}from"@solana/spl-token";import{PublicKey as vi}from"@solana/web3.js";import Jn,{isBN as eo}from"bn.js";import{bits as Bi,BitStructure as Hc,blob as Si,Blob as jc,cstr as $c,f32 as Jc,f32be as el,f64 as tl,f64be as nl,greedy as ol,Layout as Ki,ns64 as il,ns64be as rl,nu64 as al,nu64be as sl,offset as xi,s16 as ul,s16be as cl,s24 as ll,s24be as ml,s32 as Ci,s32be as dl,s40 as pl,s40be as fl,s48 as yl,s48be as bl,s8 as gl,seq as Ri,struct as Pl,Structure as Li,u16 as Oi,u16be as Al,u24 as wl,u24be as kl,u32 as Ni,u32be as Tl,u40 as hl,u40be as Il,u48 as Bl,u48be as Sl,u8 as Mi,UInt as Fi,union as Kl,Union as xl,unionLayoutDiscriminator as Cl,utf8 as Rl}from"@solana/buffer-layout";var xt=Ki,Zn=Li;var ln=Fi;var Hn=Mi,J=Oi;var Ct=Ni;var fe=Ci;var jn=Ri;var M=Si;var mn=Bi,$n=xi;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 Jn(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 Jn(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 f(n){return new ln(1,n)}function Q(n){return new ln(4,n)}function o(n){return new ve(8,!1,n)}function N(n){return new ve(16,!1,n)}function to(n){return new ve(1,!0,n)}function ze(n){return new ve(8,!0,n)}function no(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 vi(e),e=>e.toBuffer(),n)}function de(n){return new ct(Hn(),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 oo(n,e){let t=Ct("length"),i=y([t,g(n,$n(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 y(n,e,t){return new dn(n,e,t)}function g(n,e,t){let i,r=typeof e=="number"?e:eo(e)?e.toNumber():new Proxy(e,{get(c,m){if(!i){let l=Reflect.get(c,"count");i=eo(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=y([a("mint"),a("owner"),o("amount"),Q("delegateOption"),a("delegate"),f("state"),Q("isNativeOption"),o("isNative"),o("delegatedAmount"),Q("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 Di}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as Wi}from"@solana/spl-token";function ye(n,e,t){return pe([n.toBuffer(),(t!=null?t:Wi).toBuffer(),e.toBuffer()],new Di("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"))}import{PublicKey as h}from"@solana/web3.js";var pn=new h("EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"),fn=new h("CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"),yn=new h("9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z"),Nt=new h("FarmqiPv5eAj3j1GMdMCMUGXqPUvmquZtMy86QH6rzhG"),qi=new h("CLaimxFqjHzgTJtAGHU47NPhg6qrc5sCnpC4tBLyABQS"),ro=new h("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),bn=new h("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),gn=new h("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),Ui=new h("5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h"),Gi=new h("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),Pn=new h("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),ao=new h("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),so=new h("kN1kEznaF5Xbd8LYuqtEFcxzWSBk5Fv6ygX6SqEGJVy"),An=new h("CDSr3ssLcRB6XYPJwAfFt18MZvEZp4LjHcvzBVZ45duo"),zi=new h("routeUGWgWzqBWFcrCfv8tritsqukccJPu3q5GPP3xS"),uo=new h("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5"),Mt=new h("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"),co=new h("GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL"),Xi=new h("DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"),lo=new h("LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE"),mo=new h("3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"),po=new h("LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"),Yi=new h("WLHv2UAZm6z4KyaaELi5pjdbJh6RESMva1Rnn8pJVVh"),Ym=new h("DRay6fNdQ5J82H7xV6uq2aV3mNrUZ1J4PgSKsWgptcm6"),Qm=new h("5xqNaZXX5eUi4p5HU4oz9i5QnwRNT2y6oN7yyn4qENeq"),Qi=new h("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),Zi=new h("6s1xP3hpbAfFoNtUNF8mfHsjr2Bd97JxFJRWLbL6aHuX"),Hi={AMM_V4:gn,AMM_STABLE:Ui,CLMM_PROGRAM_ID:Pn,CLMM_LOCK_PROGRAM_ID:ao,CLMM_LOCK_AUTH_ID:so,FARM_PROGRAM_ID_V3:pn,FARM_PROGRAM_ID_V4:fn,FARM_PROGRAM_ID_V5:yn,FARM_PROGRAM_ID_V6:Nt,OPEN_BOOK_PROGRAM:ro,SERUM_PROGRAM_ID_V3:bn,UTIL1216:qi,Router:zi,CREATE_CPMM_POOL_PROGRAM:Mt,CREATE_CPMM_POOL_AUTH:co,CREATE_CPMM_POOL_FEE_ACC:Xi,LOCK_CPMM_PROGRAM:lo,LOCK_CPMM_AUTH:mo,LAUNCHPAD_PROGRAM:po,LAUNCHPAD_AUTH:Yi,LAUNCHPAD_PLATFORM:Qi,LAUNCHPAD_CONFIG:Zi,FEE_DESTINATION_ID:uo,MODEL_DATA_PUBKEY:An},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 $y,TOKEN_2022_PROGRAM_ID as Jy,TOKEN_PROGRAM_ID as eb}from"@solana/spl-token";import{PublicKey as nb}from"@solana/web3.js";import ib from"bn.js";import ab from"decimal.js";import{TOKEN_PROGRAM_ID as ud}from"@solana/spl-token";import{PublicKey as dd}from"@solana/web3.js";var ji=y([Q("mintAuthorityOption"),a("mintAuthority"),o("supply"),f("decimals"),f("isInitialized"),Q("freezeAuthorityOption"),a("freezeAuthority")]);import{ASSOCIATED_TOKEN_PROGRAM_ID as wy,TOKEN_2022_PROGRAM_ID as ky,TOKEN_PROGRAM_ID as Ty}from"@solana/spl-token";import{Keypair as By,PublicKey as Sy,SystemProgram as xy,TransactionInstruction as Cy}from"@solana/web3.js";import Ly from"bn.js";import q from"bn.js";var Xe=new q(1).shln(64);var $i=new q(1).shln(128),wn=new q(1).shln(64).subn(1),Ji=new q(1).shln(128).subn(1);var Ye=new q("4295048016"),Qe=new q("79226673521066979257578248091"),er=new q("59543866431248"),tr=new q("184467440737095516"),nr=new q("15793534762490258745");var kn=60,Id=new q("18446743708227953217"),or=[{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),Ze=new q(1),Bd=new q(-1);var Sd=new q("18446744073700000000");var ir=y([M(8),f("bump"),J("index"),a("owner"),Q("protocolFeeRate"),Q("tradeFeeRate"),J("tickSpacing"),Q("fundFeeRate"),g(Q(),1),a("fundOwner"),g(o(),3)]),rr=y([Q("blockTimestamp"),ze("tickCumulative"),g(o(),4)]),go=y([M(8),de("initialized"),o("recentEpoch"),J("observationIndex"),a("poolId"),g(rr,fo,"observations"),g(o(),4)]),ar=y([J("filterPeriod"),J("decayPeriod"),J("reductionFactor"),Q("dynamicFeeControl"),Q("maxVolatilityAccumulator"),fe("tickSpacingIndexReference"),Q("volatilityReference"),Q("volatilityAccumulator"),o("lastUpdateTimestamp"),g(f(),46)]),sr=y([f("state"),o("openTime"),o("endTime"),o("lastUpdateTime"),N("emissionsPerSecondX64"),o("totalEmissioned"),o("claimed"),a("mint"),a("vault"),a("creator"),N("growthGlobalX64")]),Tn=y([M(8),f("bump"),a("configId"),a("creator"),a("mintA"),a("mintB"),a("vaultA"),a("vaultB"),a("observationId"),f("mintDecimalsA"),f("mintDecimalsB"),J("tickSpacing"),N("liquidity"),N("sqrtPriceX64"),fe("tickCurrent"),Q(),N("feeGrowthGlobalX64A"),N("feeGrowthGlobalX64B"),o("protocolFeesTokenA"),o("protocolFeesTokenB"),g(N(),4),f("status"),f("feeOn"),M(6),g(sr,lt,"rewardInfos"),M(8*16,"tickArrayBitmap"),g(o(),4),o("fundFeesTokenA"),o("fundFeesTokenB"),o("startTime"),o("recentEpoch"),ar.replicate("dynamicFeeInfo"),g(o(),46)]),ur=y([N("growthInsideLastX64"),o("rewardAmountOwed")]),cr=y([M(8),f("bump"),a("nftMint"),a("poolId"),fe("tickLower"),fe("tickUpper"),N("liquidity"),N("feeGrowthInsideLastX64A"),N("feeGrowthInsideLastX64B"),o("tokenFeesOwedA"),o("tokenFeesOwedB"),g(ur,lt,"rewardInfos"),o("recentEpoch"),g(o(),7)]),Rd=y([M(8),f("bump"),a("poolId"),fe("tickLower"),fe("tickUpper"),N("liquidity"),N("feeGrowthInsideLastX64A"),N("feeGrowthInsideLastX64B"),o("tokenFeesOwedA"),o("tokenFeesOwedB"),g(N(),lt,"rewardGrowthInside"),o("recentEpoch"),g(o(),7)]),lr=y([fe("tick"),no("liquidityNet"),N("liquidityGross"),N("feeGrowthOutsideX64A"),N("feeGrowthOutsideX64B"),g(N(),lt,"rewardGrowthsOutsideX64"),o("orderPhase"),o("ordersAmount"),o("partFilledOrdersRemaining"),N("unfilledRatioX64"),g(Q(),3)]),Po=y([M(8),a("poolId"),fe("startTickIndex"),g(lr,kn,"ticks"),f("initializedTickCount"),o("recentEpoch"),g(f(),107)]),mr=y([M(8),f("bump"),g(a(),yo,"operationOwners"),g(a(),bo,"whitelistMints")]),dr=y([M(8),a("poolId"),a("owner"),fe("tick"),de("zeroForOne"),o("orderPhase"),o("totalAmount"),o("filledAmount"),o("settleBase"),o("settleOutput"),o("openTime"),N("unfilledRatioX64"),g(o(),4)]),Ao=y([M(8),a("poolId"),M(8*8*Ft,"positiveTickArrayBitmap"),M(8*8*Ft,"negativeTickArrayBitmap")]),Ld=y([M(8),J("index"),J("filterPeriod"),J("decayPeriod"),J("reductionFactor"),Q("dynamicFeeControl"),Q("maxVolatilityAccumulator"),g(o(),8)]),pr=y([M(8),a("wallet"),f("nonceIndex"),o("orderNonce"),g(o(),4)]),Od=y([o(),f("bump"),a("owner"),a("poolId"),a("positionId"),a("nftAccount"),g(o(),8)]),fr=y([M(8),f("bump"),a("lockOwner"),a("poolId"),a("positionId"),a("nftAccount"),a("lockNftMint"),o("recentEpoch"),g(o(),8)]);import Fd from"bn.js";var Xd=Buffer.from("amm_config","utf8"),br=Buffer.from("pool","utf8"),gr=Buffer.from("pool_vault","utf8"),Yd=Buffer.from("pool_reward_vault","utf8"),Qd=Buffer.from("position","utf8"),Zd=Buffer.from("tick_array","utf8"),Hd=Buffer.from("operation","utf8"),jd=Buffer.from("pool_tick_array_bitmap_extension","utf8"),$d=Buffer.from("observation","utf8"),Jd=Buffer.from("support_mint","utf8"),ep=Buffer.from("dynamic_fee_config","utf8"),tp=Buffer.from("permission","utf8");var np=Buffer.from("locked_position","utf8");import{sha256 as Rr}from"js-sha256";import Pr from"bn.js";import ap from"decimal.js";var up=new Pr(1).shln(256).subn(1);import Sp from"bn.js";import yp from"bn.js";import gp from"decimal.js";import Lp from"bn.js";import Np from"decimal.js";import{PublicKey as wf}from"@solana/web3.js";import Tf from"bn.js";import{TOKEN_2022_PROGRAM_ID as Rf,TOKEN_PROGRAM_ID as Lf}from"@solana/spl-token";import Ff from"decimal.js";import cf from"bn.js";import Zp from"bn.js";import Xf from"bn.js";function ne(n){let e=`global:${n}`;return Buffer.from(Rr.digest(e)).slice(0,8)}go.span;var Ey=V("Raydium_Clmm"),Dy={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 Sn}from"@solana/web3.js";var Mr=y([f("instruction")]),Fr=y([f("instruction")]),vr=y([o("rewardState"),o("rewardOpenTime"),o("rewardEndTime"),o("rewardLastUpdateTime"),o("totalReward"),o("totalRewardEmissioned"),o("rewardClaimed"),o("rewardPerSecond"),N("accRewardPerShare"),a("rewardVault"),a("rewardMint"),a("rewardSender"),o("rewardType"),g(o(),15,"padding")]),Vr=y([o("state"),o("nonce"),a("lpVault"),a("rewardVault"),a(),a(),o(),o(),o("totalReward"),N("perShareReward"),o("lastSlot"),o("perSlotReward")]),_r=y([o("state"),o("nonce"),a("lpVault"),a("rewardVaultA"),o("totalRewardA"),N("perShareRewardA"),o("perSlotRewardA"),f("option"),a("rewardVaultB"),M(7),o("totalRewardB"),N("perShareRewardB"),o("perSlotRewardB"),o("lastSlot"),a()]),Er=y([o(),o("state"),o("nonce"),o("validRewardTokenNum"),N("rewardMultiplier"),o("rewardPeriodMax"),o("rewardPeriodMin"),o("rewardPeriodExtend"),a("lpMint"),a("lpVault"),g(vr,5,"rewardInfos"),a("creator"),a(),g(o(),32,"padding")]),Dr=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)}}),Wr=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(Er,{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)}}),qr=y([o("isSet"),o("rewardPerSecond"),o("rewardOpenTime"),o("rewardEndTime"),o("rewardType")]),Ur=y([f("instruction"),o("nonce"),g(qr,5,"rewardTimeInfo")]),Gr=y([f("instruction"),o("rewardReopenTime"),o("rewardEndTime"),o("rewardPerSecond")]),zr=y([f("instruction"),o("isSet"),o("rewardPerSecond"),o("rewardOpenTime"),o("rewardEndTime"),o("rewardType")]),Eb=y([o("state"),a("id"),a("owner"),o("deposited"),g(o(),1,"rewardDebts")]),xo=y([o("state"),a("id"),a("owner"),o("deposited"),g(N(),1,"rewardDebts"),o(""),o("voteLockedBalance"),g(o(),15)]),Db=y([o("state"),a("id"),a("owner"),o("deposited"),g(o(),2,"rewardDebts")]),Xr=y([o("state"),a("id"),a("owner"),o("deposited"),g(N(),2,"rewardDebts"),g(o(),17)]),Yr=y([o(),o("state"),a("id"),a("owner"),o("deposited"),g(N(),5,"rewardDebts"),g(o(),16)]),Qr=y([f("instruction"),o("amount")]),Zr=y([a("mint"),a("grantAuthority"),o("baselineVoteWeightScaledFactor"),o("maxExtraLockupVoteWeightScaledFactor"),o("lockupSaturationSecs"),to("digitShift"),g(f(),7,"reserved1"),g(o(),7,"reserved2")]),Hr=y([M(8),a("governanceProgramId"),a("realm"),a("realmGoverningTokenMint"),a("realmAuthority"),g(f(),32,"reserved1"),g(Zr,4,"votingMints"),ze("timeOffset"),f("bump"),g(f(),7,"reserved2"),g(o(),11,"reserved3")]),jr=y([ze("startTime"),ze("endTime"),f("kind"),g(f(),15,"reserved")]),$r=y([g(jr,1,"lockup"),o("amountDeposited_native"),o("amountInitiallyLockedNative"),de("isUsed"),de("allowClawback"),f("votingMintConfigIdx"),g(f(),29,"reserved")]),Jr=y([M(8),a("voterAuthority"),a("registrar"),g($r,32,"deposits"),f("voterBump"),f("voterWweightRecordBump"),g(f(),94,"reserved")]);import{NATIVE_MINT as Zb}from"@solana/spl-token";var Hb=V("Raydium_farm_config"),ea=new Sn("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),ta=new Sn("FrspKwj8i3pNmKwXreTveC4fu7KL5ZbGeXdZBe2XViu1");var jb=new Sn("3TRTX4dXUpp2eqxi3tvQDFYUV7SdDJjcPE3Y4mbtftaX");var dt={"Standard SPL":0,"Option tokens":1},Co={[pn.toString()]:3,[fn.toString()]:4,[yn.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 Vg,TransactionInstruction as _g}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 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 oa(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 ia}from"@solana/web3.js";import ra from"bn.js";async function Pi(n){new Promise(e=>setTimeout(e,n))}function sg(){return new Date().getTime()}function aa(n){return typeof n=="object"&&n!==null&&![$,ie,ia,L,ra,se,me].some(e=>typeof e=="object"&&n instanceof e)}function je(n){return typeof n=="string"?Ht(n):Array.isArray(n)?n.map(e=>je(e)):aa(n)?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,je(t)])):n}var hg=V("Raydium.farm.util");var tP=V("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 Hw}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 _ 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 _(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 _(r.maximumFee.toString());return{amount:n.add(l),fee:l,expirationTime:m}}else{let l=ke(n.mul(new _(ue)),new _(ue-r.transferFeeBasisPoints)),d=new _(r.maximumFee.toString()),p=l.sub(n).gt(d)?n.add(d):l,b=ke(p.mul(new _(r.transferFeeBasisPoints)),new _(ue)),A=b.gt(c)?c:b;return{amount:p,fee:A,expirationTime:m}}else{let l=ke(n.mul(new _(r.transferFeeBasisPoints)),new _(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 _(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 _(c.maximumFee.toString());return{amount:n.add(d),fee:d,expirationTime:l}}else{let d=ke(n.mul(new _(ue)),new _(ue-c.transferFeeBasisPoints)),p=new _(c.maximumFee.toString()),b=d.sub(n).gt(p)?n.add(p):d,A=ke(b.mul(new _(c.transferFeeBasisPoints)),new _(ue)),C=A.gt(m)?m:A;return{amount:b,fee:C,expirationTime:l}}else{let d=ke(n.mul(new _(c.transferFeeBasisPoints)),new _(ue)),p=d.gt(m)?m:d;return{amount:n,fee:p,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 _(0))?t.add(new _(1)):t}function Kn(n,e){if(n.isZero())return new _(0);let t=n.div(e);return t.isZero()?new _(1):n.mod(e).gt(new _(0))?t.add(new _(1)):t}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 _(r.maximumFee.toString()),m=i<e.newerTransferFee.epoch?(Number(e.newerTransferFee.epoch)*432e3-t)*400/1e3:void 0,l=ke(n.mul(new _(r.transferFeeBasisPoints)),new _(ue)),d=l.gt(c)?c:l;return{amount:n,fee:d,expirationTime:m}}function ya(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 _(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 _(r.maximumFee.toString());return{amount:n.add(l),fee:l,expirationTime:m}}else{let l=ke(n.mul(new _(ue)),new _(ue-r.transferFeeBasisPoints)),d=new _(r.maximumFee.toString()),p=l.sub(n).gt(d)?n.add(d):l,b=ke(p.mul(new _(r.transferFeeBasisPoints)),new _(ue)),A=b.gt(c)?c:b;return{amount:p,fee:A,expirationTime:m}}}import No from"bn.js";var ba=new No(25),ga=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 Pa=y([f("instruction"),o("amountIn"),o("minAmountOut")]),Aa=y([f("instruction"),o("maxAmountIn"),o("amountOut")]),lA=y([f("instruction"),f("nonce")]),wa=y([f("instruction"),f("nonce"),o("startTime")]),Mo=y([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"),N("swapBaseInAmount"),N("swapQuoteOutAmount"),o("swapBase2QuoteFee"),N("swapQuoteInAmount"),N("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=y([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"),N("swapBaseInAmount"),N("swapQuoteOutAmount"),N("swapQuoteInAmount"),N("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")]),ka=y([f("instruction"),o("baseAmountIn"),o("quoteAmountIn"),o("fixedSide"),o("otherAmountMin")]),Ta=y([f("instruction"),o("lpAmount"),o("baseAmountMin"),o("quoteAmountMin")]);var ha=y([o("fee")]);var LA=V("Raydium_liquidity_instruction");var Ia=5e4,Ba=y([o("x"),o("y"),o("price")]),FA=y([o("accountType"),o("status"),o("multiplier"),o("validDataCount"),g(Ba,Ia,"DataElement")]);import{PublicKey as YA}from"@solana/web3.js";import ZA from"decimal.js";import{TOKEN_PROGRAM_ID as jA}from"@solana/spl-token";import{PublicKey as EA}from"@solana/web3.js";var qA=V("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 Sa(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 Ka=y([M(5),Sa("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 QT}from"@solana/web3.js";import{AccountLayout as HT,NATIVE_MINT as jT,TOKEN_2022_PROGRAM_ID as $T,TOKEN_PROGRAM_ID as JT,createAssociatedTokenAccountIdempotentInstruction as eh}from"@solana/spl-token";import Yk from"bn.js";import Fa from"bn.js";var Mk=new Fa(0);import Dk from"bn.js";import va from"bn.js";var _t=new va(1e6);import uh from"bn.js";import lh from"decimal.js";import{PublicKey as mT,TransactionInstruction as dT,Keypair as fT,SystemProgram as yT}from"@solana/web3.js";import{ASSOCIATED_TOKEN_PROGRAM_ID as gT,TOKEN_2022_PROGRAM_ID as PT,TOKEN_PROGRAM_ID as AT}from"@solana/spl-token";var $k=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");var aT=Buffer.from("locked_liquidity","utf8");var ST=V("Raydium_cpmm"),KT={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 Ea=y([M(8),f("bump"),de("disableCreatePool"),J("index"),o("tradeFeeRate"),o("protocolFeeRate"),o("fundFeeRate"),o("createPoolFee"),a("protocolOwner"),a("fundOwner"),o("creatorFeeRate"),g(o(),15)]),vo=y([M(8),a("configId"),a("poolCreator"),a("vaultA"),a("vaultB"),a("mintLp"),a("mintA"),a("mintB"),a("mintProgramA"),a("mintProgramB"),a("observationId"),f("bump"),f("status"),f("lpDecimals"),f("mintDecimalA"),f("mintDecimalB"),o("lpAmount"),o("protocolFeesMintA"),o("protocolFeesMintB"),o("fundFeesMintA"),o("fundFeesMintB"),o("openTime"),o("epoch"),f("feeOn"),de("enableCreatorFee"),g(f(),6),o("creatorFeesMintA"),o("creatorFeesMintB"),g(o(),28)]),RT=y([M(8),a("configId"),g(o(),30)]);import{PublicKey as $K,SystemProgram as JK}from"@solana/web3.js";import{createTransferInstruction as tx,TOKEN_PROGRAM_ID as nx,TOKEN_2022_PROGRAM_ID as ox,createAssociatedTokenAccountIdempotentInstruction as ix,createSyncNativeInstruction as ax,createTransferCheckedInstruction as sx}from"@solana/spl-token";import ns from"bn.js";import lx from"decimal.js";import{ASSOCIATED_TOKEN_PROGRAM_ID as wI,TOKEN_2022_PROGRAM_ID as kI,TOKEN_PROGRAM_ID as TI}from"@solana/spl-token";import{SystemProgram as SI,TransactionInstruction as KI}from"@solana/web3.js";import Xa from"bn.js";var qa=y([o(),o("epoch"),f("curveType"),J("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=y([o("totalLockedAmount"),o("cliffPeriod"),o("unlockPeriod"),o("startTime"),o("totalAllocatedShare")]),Ga=y([o(),o("epoch"),f("bump"),f("status"),f("mintDecimalsA"),f("mintDecimalsB"),f("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"),f("mintProgramFlag"),f("cpmmCreatorFeeOn"),o("platformVestingShare"),g(f(),54)]),tI=y([o(),o("epoch"),a("poolId"),a("beneficiary"),o("claimedAmount"),o("tokenShareAmount"),g(o(),8)]),_o=y([f("migrateType"),f("migrateCpmmFeeOn"),o("supply"),o("totalSellA"),o("totalFundRaisingB"),o("totalLockedAmount"),o("cliffPeriod"),o("unlockPeriod")]),za=y([o("epoch"),f("index"),a("configId"),_o.replicate("bondingCurveParam"),g(o(),50)]),Eo=y([o(),o("epoch"),a("platformClaimFeeWallet"),a("platformLockNftWallet"),o("platformScale"),o("creatorScale"),o("burnScale"),o("feeRate"),g(f(),64,"name"),g(f(),256,"web"),g(f(),256,"img"),a("cpConfigId"),o("creatorFeeRate"),a("transferFeeExtensionAuth"),a("platformVestingWallet"),o("platformVestingScale"),a("platformCpCreator"),f("restrictGlobalConfig"),g(f(),107),oo(za,"platformCurve")]);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");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]),updatePlatformCurveParam:Buffer.from([138,144,138,250,220,128,4,57]),removePlatformCurveParam:Buffer.from([27,30,62,169,93,224,24,145]),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])};var OI=new Xa("18446744073709551615");import{TOKEN_2022_PROGRAM_ID as vI,TOKEN_PROGRAM_ID as VI}from"@solana/spl-token";import WI from"bn.js";import UI from"decimal.js";import AB from"bn.js";import kB from"decimal.js";import ZI from"bn.js";import jI from"decimal.js";import sB from"bn.js";import cB from"decimal.js";import Wo from"bn.js";import xn from"decimal.js";var Dt=class{static _multipler(e){return new xn(10).pow(e)}static getPrice({priceX64:e,decimalA:t,decimalB:i}){return new xn(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 Wo(r.mul(this._Q64).toFixed(0))}};Dt._Q64=new xn(new Wo(1).shln(64).toString());import{NATIVE_MINT as CS,TOKEN_2022_PROGRAM_ID as RS,TOKEN_PROGRAM_ID as LS,createAssociatedTokenAccountIdempotentInstruction as NS,createSyncNativeInstruction as MS,getTransferFeeConfig as FS,unpackMint as vS}from"@solana/spl-token";import ee from"bn.js";import{PublicKey as Ja,SystemProgram as ES}from"@solana/web3.js";import XS from"decimal.js";var YS={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 Ja("4Bu96XjU84XjPDSpveTVf6LYGCkfW5FK7SNkREWcEfV4"),vestingSchedule:{totalLockedAmount:new ee(0),cliffPeriod:new ee(0),unlockPeriod:new ee(0),startTime:new ee(0),totalAllocatedShare:new ee(0)}},QS=new ee(1e4);var es={[bn.toBase58()]:3};var ts=y([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 gK}from"@solana/web3.js";var TK=V("Serum");import{ASSOCIATED_TOKEN_PROGRAM_ID as RK,TOKEN_2022_PROGRAM_ID as LK,TOKEN_PROGRAM_ID as OK}from"@solana/spl-token";import{PublicKey as MK,SystemProgram as FK,TransactionInstruction as vK}from"@solana/web3.js";import _K from"bn.js";var Dx=new ns(0);import{PublicKey as os,Transaction as Cn,TransactionInstruction as is}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as rs}from"@solana/spl-token";import qo 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 qo(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]),p=[];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 qo(0))).filter(R=>!R).length!==3,k=c>E&&c<D&&K.status===1,T=P&&k;p.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,O)=>({mintAddress:R.mintAddress,mintVault:R.mintVault,mintDecimals:R.mintDecimals,perLpLoss:R.perLpLoss,debtAmount:S.tokenInfo[O].debtAmount.add(S.tokenInfo[O].claimedAmount)}))})}return p}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 p of e.tokenInfo){let{account:b,instructionParams:A}=await this.scope.account.getOrCreateTokenAccount({mint:p.mintAddress,owner:this.scope.ownerPubKey,notUseTokenAccount:p.mintAddress.equals($.WSOL.mint),createInfo:{payer:c,amount:0},skipCloseAccount:!p.mintAddress.equals($.WSOL.mint),associatedOnly:p.mintAddress.equals($.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($.WSOL.mint),createInfo:{payer:c,amount:0},skipCloseAccount:!C.mintAddress.equals($.WSOL.mint),associatedOnly:C.mintAddress.equals($.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(),p=r.allInstructions;return Bt(p,[c,...d.map(b=>b.publicKey)])?[{transaction:l,signer:d}]:[{transaction:new Cn().add(...p.slice(0,r.AllTxData.instructions.length-1)),signer:d},{transaction:new Cn().add(...p.slice(r.AllTxData.instructions.length-1)),signer:[]},{transaction:new Cn().add(...r.AllTxData.endInstructions),signer:[]}]}static makeClaimInstruction({programId:e,poolInfo:t,ownerInfo:i}){let r=y([]),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:rs,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 is({keys:c,programId:e,data:l})}},be=re;be.CLAIMED_NUM=3,be.POOL_LAYOUT=y([M(8),f("bump"),f("status"),o("openTime"),o("endTime"),a("ammId"),g(y([f("mintDecimals"),a("mintAddress"),a("mintVault"),o("perLpLoss"),o("totalClaimedAmount")]),re.CLAIMED_NUM,"tokenInfo"),g(o(),10,"padding")]),be.OWNER_LAYOUT=y([M(8),f("bump"),f("version"),a("poolId"),a("owner"),o("lpAmount"),g(y([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 os(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 oC}from"@solana/web3.js";import{getTransferFeeConfig as rC,MintLayout as aC,TOKEN_2022_PROGRAM_ID as sC,TOKEN_PROGRAM_ID as uC,unpackMint as cC}from"@solana/spl-token";function H(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 H(n.toExact())}catch{return new L(z)}if(n instanceof L)return n;let e=String(n),t=Ve(e);return new L(t.numerator,t.denominator)}function wR(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:H(n.toExact()),decimals:n.token.decimals};if(n instanceof L)return{fr:n};let e=String(n),t=Ve(e);return{fr:new L(t.numerator,t.denominator),decimals:(i=t.dec)==null?void 0:i.length}}function kR(n,e){if(n==null||e==null)return!1;let t=H(n),i=H(e);return t.sub(i).numerator,t.sub(i).numerator.lt(z)}function as(n,e){if(n==null||e==null)return!1;let t=H(n),i=H(e);return t.sub(i).numerator.gt(z)}function TR(n,e){if(n==null||e==null)return!1;let t=H(n),i=H(e);return t.sub(i).numerator.lte(z)}function hR(n,e){if(n==null||e==null)return!1;let t=H(n),i=H(e);return t.sub(i).numerator.gte(z)}function ss(n,e){if(n==null||e==null)return!1;let t=H(n),i=H(e);return t.sub(i).numerator.eq(z)}function IR(n,e){if(n==null||e==null)return;let t=H(n),i=H(e);try{return t.div(i)}catch{return t}}function BR(n,e){if(n==null||e==null)return;let t=H(n),i=H(e);return t.sub(i)}function SR(n){return n==null?!1:!ss(n,0)}function KR(n,e){return as(e,n)?e:n}function Rn(n,e){if(n==null||e==null)return;let t=H(n),i=H(e);return t.mul(i)}function xR(n,e){if(n==null||e==null)return;let t=H(n),i=H(e);return t.add(i)}var WR=new j(2),qR=new j(3),UR=new j(5),Ne=new j(10),GR=new j(100),zR=new j(1e3),XR=new j(1e4);function tn(n){return Ne.pow(Z(n))}function Ve(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 Ma(n,e){let t=n.divmod(e);return t.mod.isZero()?t.div:n.isNeg()===e.isNeg()?t.div.iaddn(1):t.div}function cs(n){var i;let[,e="",t=""]=(i=n.toFixed(2).match(/(-?)(\d*)\.?(\d*)/))!=null?i:[];return`${e}${t}`}function ls(n,e=0){return n instanceof j?n:new j(cs(Go(n).mul(Ne.pow(new j(String(e))))))}function Go(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 Go(n.toExact())}catch{return new L(z)}if(n instanceof L)return n;let e=String(n),t=Ve(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 YR(n,e){let{numerator:t,denominator:i}=Ve(n);return new me(new j(t),new j(i).mul(e!=null&&e.alreadyDecimaled?new j(100):new j(1)))}function QR(n){let{token:e,numberPrice:t,decimalDone:i}=n,r=new $({mint:"",decimals:6,symbol:"usd",name:"usd",skipMint:!0}),{numerator:c,denominator:m}=Ve(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 $(v(x({},e),{skipMint:!0,mint:""})),numerator:l.toString()})}function Uo(n){let e=new ot({decimals:6,symbol:"usd",name:"usd"}),t=ls(Rn(n,10**e.decimals));return new Oe(e,t)}function ZR(n,e){return Uo(!e||!n?0:Rn(n,e))}function HR(n){if(n==null)return;let{numerator:e,denominator:t}=Ve(n.toString());return new L(e,t)}function jR(n){return n instanceof us}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 JR(n,...e){return n.filter(t=>e.every(i=>i.includes(t)))}function eL(n,...e){return n.filter(t=>e.every(i=>!i.includes(t)))}function tL(n){return[...new Set(n)]}export{Ts as ACCOUNT_TYPE_SIZE,Hi as ALL_PROGRAM_ID,Ui as AMM_STABLE,gn as AMM_V4,lu as ANAMint,ei as AccountType,ke as BNDivCeil,GR as BN_100,zR as BN_1000,XR as BN_10000,UR as BN_FIVE,Ne as BN_TEN,qR as BN_THREE,WR as BN_TWO,so as CLMM_LOCK_AUTH_ID,ao as CLMM_LOCK_PROGRAM_ID,Pn as CLMM_PROGRAM_ID,eu as CLOCK_PROGRAM_ID,co as CREATE_CPMM_POOL_AUTH,Xi as CREATE_CPMM_POOL_FEE_ACC,Mt as CREATE_CPMM_POOL_PROGRAM,Ce as DEVNET_PROGRAM_ID,Qm as DEV_LAUNCHPAD_AUTH,Ym as DEV_LAUNCHPAD_PROGRAM,We as DEV_LOOKUP_TABLE_CACHE,mu as ETHMint,pn as FARM_PROGRAM_ID_V3,fn as FARM_PROGRAM_ID_V4,yn as FARM_PROGRAM_ID_V5,Nt as FARM_PROGRAM_ID_V6,uo as FEE_DESTINATION_ID,_t as FEE_RATE_DENOMINATOR_VALUE,pi as INSTRUCTION_PROGRAM_ID,te as InstructionType,Yi as LAUNCHPAD_AUTH,Zi as LAUNCHPAD_CONFIG,Qi as LAUNCHPAD_PLATFORM,po as LAUNCHPAD_PROGRAM,Gi as LIQUIDITY_POOL_PROGRAM_ID_V5_MODEL,mo as LOCK_CPMM_AUTH,lo as LOCK_CPMM_PROGRAM,De as LOOKUP_TABLE_CACHE,Zo as LogLevel,qt as Logger,Yn as MAX_BASE64_SIZE,jt as MEMO_PROGRAM_ID,wt as METADATA_PROGRAM_ID,An as MODEL_DATA_PUBKEY,cu as NRVMint,ro as OPEN_BOOK_PROGRAM,Ie as Owner,nu as PAIMint,tu as RAYMint,nt as RENT_PROGRAM_ID,Yt as Rounding,zi as Router,bn as SERUM_PROGRAM_ID_V3,Me as SOLMint,ou as SRMMint,fi as SYSTEM_PROGRAM_ID,Kt as TxBuilder,Be as TxVersion,iu as USDCMint,uu as USDHMint,ru as USDTMint,qi as UTIL1216,Ae as WSOLMint,Ee as accountMeta,xR as add,ht as addComputeBudget,Fo as ceilDiv,Kn as ceilDivBN,it as checkLegacyTxSize,rt as checkV0TxSize,zt as chunkArray,di as commonSystemAccountMeta,It as confirmTransaction,V as createLogger,HR as decimalToFraction,IR as div,Ma as divCeil,ss as eq,Xt as fetchMultipleMintInfos,pe as findProgramAddress,Va as floorDiv,Bt as forecastTransactionSize,ye as getATAAddress,Lo as getDate,an as getDevLookupTableCache,Rc as getEpochInfo,rn as getMainLookupTableCache,KR as getMax,Pe as getMultipleAccountsInfo,Ke as getMultipleAccountsInfoWithCustomFlags,on as getMultipleLookupTableInfo,Ue as getRecentBlockHash,pt as getTime,sg as getTimestamp,XP as getTransferAmountFee,ya as getTransferAmountFeeFromPost,fa as getTransferAmountFeeFromPre,ho as getTransferAmountFeeV2,as as gt,hR as gte,JR as intersection,oa as isDateAfter,na as isDateBefore,jR as isDecimal,SR as isMeaningfulNumber,Ro as isNumber,je as jsonInfo2PoolKeys,kR as lt,TR as lte,au as mSOLMint,Io as minExpirationTime,Rn as mul,aa as notInnerObject,tg as offsetDateTime,Z as parseBigNumberish,Ve as parseNumberInfo,xc as parseSimulateLogToJson,Cc as parseSimulateValue,Fe as printSimulate,ps as setLoggerLevel,cs as shakeFractionDecimal,Kc as simulateMultipleInstruction,ki as simulateTransaction,Pi as sleep,Le as solToWSol,su as stSOLMint,BR as sub,tn as tenExponential,ls as toBN,Qn as toBuffer,Go as toFraction,wR as toFractionWithDecimals,YR as toPercent,QR as toTokenPrice,ZR as toTotalPrice,Uo as toUsdCurrency,Lc as transformTxToBase64,Ht as tryParsePublicKey,Ti as txToBase64,tL as uniq,Zt as validateAndParsePublicKey,eL as xor};
//# sourceMappingURL=index.mjs.map