@raydium-io/raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
2 lines • 2.31 kB
JavaScript
import{PublicKey as C,ComputeBudgetProgram as D,Transaction as W,TransactionMessage as q,Keypair as z,VersionedTransaction as $}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as G}from"@solana/spl-token";import{get as l,set as b}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}},c={},P={};function m(t){let e=l(c,t);if(!e){let r=l(P,t);e=new a({name:t,logLevel:r}),b(c,t,e)}return e}var Y=m("Raydium_txUtil");function n(t,e){let[r,i]=C.findProgramAddressSync(t,e);return{publicKey:r,nonce:i}}var w=Buffer.from("vault_and_lp_mint_auth_seed","utf8"),L=Buffer.from("amm_config","utf8"),S=Buffer.from("pool","utf8"),A=Buffer.from("pool_lp_mint","utf8"),B=Buffer.from("pool_vault","utf8"),V=Buffer.from("observation","utf8");function K(t){return n([w],t)}function ee(t,e){return n([L,E(e)],t)}function I(t,e,r,i){return n([S,e.toBuffer(),r.toBuffer(),i.toBuffer()],t)}function T(t,e){return n([A,e.toBuffer()],t)}function f(t,e,r){return n([B,e.toBuffer(),r.toBuffer()],t)}function v(t,e){return n([V,e.toBuffer()],t)}function E(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t,!1),new Uint8Array(e)}function te({programId:t,configId:e,mintA:r,mintB:i}){let g=K(t).publicKey,o=I(t,e,r,i).publicKey,p=T(t,o).publicKey,d=f(t,o,r).publicKey,y=f(t,o,i).publicKey,h=v(t,o).publicKey;return{poolId:o,configId:e,authority:g,lpMint:p,vaultA:d,vaultB:y,observationId:h}}export{ee as getCpmmPdaAmmConfigId,I as getCpmmPdaPoolId,te as getCreatePoolKeys,T as getPdaLpMint,v as getPdaObservationId,K as getPdaPoolAuthority,f as getPdaVault};
//# sourceMappingURL=pda.mjs.map