UNPKG

@powrldgr/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

2 lines 2.46 kB
import{ComputeBudgetProgram as W,Keypair as z,PublicKey as L,Transaction as H,TransactionMessage as j,VersionedTransaction as G}from"@solana/web3.js";import{get as m,set as P}from"lodash";var a=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 r=e.map(i=>typeof i=="object"?JSON.stringify(i):i).join(", ");throw new Error(r)}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}},l={},C={};function f(t){let e=m(l,t);if(!e){let r=m(C,t);e=new a({name:t,logLevel:r}),P(l,t,e)}return e}import{TOKEN_PROGRAM_ID as X}from"@solana/spl-token";var Z=f("Raydium_txUtil");function o(t,e){let[r,i]=L.findProgramAddressSync(t,e);return{publicKey:r,nonce:i}}var w=Buffer.from("vault_and_lp_mint_auth_seed","utf8"),S=Buffer.from("amm_config","utf8"),A=Buffer.from("pool","utf8"),B=Buffer.from("pool_lp_mint","utf8"),K=Buffer.from("pool_vault","utf8"),V=Buffer.from("observation","utf8");function T(t){return o([w],t)}function re(t,e){return o([S,R(e)],t)}function I(t,e,r,i){return o([A,e.toBuffer(),r.toBuffer(),i.toBuffer()],t)}function v(t,e){return o([B,e.toBuffer()],t)}function g(t,e,r){return o([K,e.toBuffer(),r.toBuffer()],t)}function E(t,e){return o([V,e.toBuffer()],t)}function R(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t,!1),new Uint8Array(e)}function ie({poolId:t,programId:e,configId:r,mintA:i,mintB:c}){let p=T(e).publicKey,n=t||I(e,r,i,c).publicKey,d=v(e,n).publicKey,y=g(e,n,i).publicKey,h=g(e,n,c).publicKey,b=E(e,n).publicKey;return{poolId:n,configId:r,authority:p,lpMint:d,vaultA:y,vaultB:h,observationId:b}}var x=Buffer.from("locked_liquidity","utf8");function oe(t,e){return o([x,e.toBuffer()],t)}export{x as LOCK_LIQUIDITY_SEED,oe as getCpLockPda,re as getCpmmPdaAmmConfigId,I as getCpmmPdaPoolId,ie as getCreatePoolKeys,v as getPdaLpMint,E as getPdaObservationId,T as getPdaPoolAuthority,g as getPdaVault}; //# sourceMappingURL=pda.mjs.map