test-raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
2 lines • 2.03 kB
JavaScript
import{PublicKey as h,ComputeBudgetProgram as B,Transaction as S,TransactionMessage as I,Keypair as R,VersionedTransaction as v}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as k}from"@solana/spl-token";import{get as u,set as f}from"lodash";import c from"dayjs";import g from"dayjs/plugin/utc";c.extend(g);var n=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 c().utc().format("YYYY/MM/DD HH:mm:ss UTC")}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={},p={};function l(t){let e=u(m,t);if(!e){let r=u(p,t);e=new n({name:t,logLevel:r}),f(m,t,e)}return e}var M=l("Raydium_txUtil");function i(t,e){let[r,o]=h.findProgramAddressSync(t,e);return{publicKey:r,nonce:o}}function D(t,e,r){return i([e.toBuffer(),Buffer.from("registrar","utf8"),r.toBuffer()],t)}function U(t,e){return i([e.toBuffer(),Buffer.from("voting_mint_seed","utf8")],t)}function _(t,e){return i([e.toBuffer()],t)}function q(t,e,r){return i([e.toBuffer(),Buffer.from("voter","utf8"),r.toBuffer()],t)}function z(t,e,r){return i([e.toBuffer(),Buffer.from("voter-weight-record","utf8"),r.toBuffer()],t)}function j(t,e,r,o){return i([Buffer.from("governance","utf8"),e.toBuffer(),r.toBuffer(),o.toBuffer()],t)}export{D as getRegistrarAddress,j as getTokenOwnerRecordAddress,q as getVoterAddress,z as getVoterWeightRecordAddress,_ as getVotingMintAuthority,U as getVotingTokenMint};
//# sourceMappingURL=pda.mjs.map