UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

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