UNPKG

goosefx-amm-sdk

Version:

SDK for the GooseFx AMM

2 lines 3.1 kB
import{TOKEN_PROGRAM_ID as f}from"@solana/spl-token";var d={address:"So11111111111111111111111111111111111111112",programId:f.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"",tags:[],priority:2,type:"goose-fx",extensions:{coingeckoId:"solana"}},i={address:"So11111111111111111111111111111111111111112",programId:f.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"",tags:[],priority:2,type:"goose-fx",extensions:{coingeckoId:"solana"}};import{PublicKey as p}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as K}from"@solana/spl-token";import{PublicKey as t,SystemProgram as M,SYSVAR_RENT_PUBKEY as R}from"@solana/web3.js";function u({pubkey:n,isSigner:e=!1,isWritable:o=!0}){return{pubkey:n,isWritable:o,isSigner:e}}var h=[u({pubkey:K,isWritable:!1}),u({pubkey:M.programId,isWritable:!1}),u({pubkey:R,isWritable:!1})];function x({publicKey:n,transformSol:e}){let o=A(n.toString());if(o instanceof t)return e&&o.equals(s)?S:o;if(e&&o.toString()===s.toBase58())return S;if(typeof o=="string"){if(o===t.default.toBase58())return t.default;try{return new t(o)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function A(n){try{return new t(n)}catch{return n}}var I=new t("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),q=new t("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),D=new t("SysvarRent111111111111111111111111111111111"),L=new t("SysvarC1ock11111111111111111111111111111111"),E=new t("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),C=new t("Sysvar1nstructions1111111111111111111111111"),U=M.programId,_=new t("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"),Y=new t("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),G=new t("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),X=new t("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),v=new t("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),j=new t("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),B=new t("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),H=new t("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),z=new t("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),F=new t("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),J=new t("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),S=new t("So11111111111111111111111111111111111111112"),s=t.default;var b=class{constructor({mint:e,decimals:o,symbol:a,name:g,skipMint:P=!1,isToken2022:k=!1}){if(e===s.toBase58()||e instanceof p&&s.equals(e)){this.decimals=i.decimals,this.symbol=i.symbol,this.name=i.name,this.mint=new p(i.address),this.isToken2022=!1;return}this.decimals=o,this.symbol=a||e.toString().substring(0,6),this.name=g||e.toString().substring(0,6),this.mint=P?p.default:x({publicKey:e}),this.isToken2022=k}equals(e){return this===e?!0:this.mint.equals(e.mint)}},r=b;r.WSOL=new b({...i,mint:i.address});var y=class{constructor({decimals:e,symbol:o="UNKNOWN",name:a="UNKNOWN"}){this.decimals=e,this.symbol=o,this.name=a}equals(e){return this===e}},m=y;m.SOL=new y(d);function re(n,e){return n instanceof r&&e instanceof r?n.equals(e):n instanceof r||e instanceof r?!1:n===e}export{m as Currency,re as currencyEquals}; //# sourceMappingURL=currency.mjs.map