@cobaltx/sdk-v2
Version:
An SDK for building applications on top of CobaltX.
2 lines • 2.97 kB
JavaScript
import{TOKEN_PROGRAM_ID as f}from"@solana/spl-token";import{PublicKey as h}from"@solana/web3.js";var d={chainId:101,address:h.default.toBase58(),programId:f.toBase58(),decimals:9,symbol:"ETH",name:"Ethereum",logoURI:"https://raw.githubusercontent.com/cobaltx-io/tokens/main/logo/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"cobaltx",extensions:{coingeckoId:"solana"}},i={chainId:101,address:"So11111111111111111111111111111111111111112",programId:f.toBase58(),decimals:9,symbol:"WETH",name:"Wrapped ETH",logoURI:"https://raw.githubusercontent.com/cobaltx-io/tokens/main/logo/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"cobaltx",extensions:{coingeckoId:"solana"}};import{PublicKey as b}from"@solana/web3.js";import{PublicKey as t,SystemProgram as x,SYSVAR_RENT_PUBKEY as O}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as R}from"@solana/spl-token";function u({pubkey:n,isSigner:e=!1,isWritable:o=!0}){return{pubkey:n,isWritable:o,isSigner:e}}var _=[u({pubkey:R,isWritable:!1}),u({pubkey:x.programId,isWritable:!1}),u({pubkey:O,isWritable:!1})];function P({publicKey:n,transformSol:e}){let o=T(n.toString());if(o instanceof t)return e&&o.equals(s)?g:o;if(e&&o.toString()===s.toBase58())return g;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 T(n){try{return new t(n)}catch{return n}}var E=new t("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),q=new t("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),D=new t("SysvarRent111111111111111111111111111111111"),L=new t("SysvarC1ock11111111111111111111111111111111"),G=new t("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),C=new t("Sysvar1nstructions1111111111111111111111111"),H=x.programId,U=new t("a2Gt18uJC8puJT9JRYQLU6rPi6okxQb4WqCjwtYshZB"),B=new t("bXSKiFqYrALF9gJy1KqHm8tv4QXk8nCgbLN8WRsGEbh"),g=new t("So11111111111111111111111111111111111111112"),s=t.default,X=new t("71kRXzJMvSeArtXYNEWa8KAjpRJosdMQ7Dpgy5Jt5zfd"),v=new t("ERFzpDteGNo8LTDKW1WwVGrkRMmA2y9WZHXNHxMA6BSV");var p=class{constructor({mint:e,decimals:o,symbol:a,name:S,skipMint:K=!1,isToken2022:M=!1}){if(e===s.toBase58()||e instanceof b&&s.equals(e)){this.decimals=i.decimals,this.symbol=i.symbol,this.name=i.name,this.mint=new b(i.address),this.isToken2022=!1;return}this.decimals=o,this.symbol=a||e.toString().substring(0,6),this.name=S||e.toString().substring(0,6),this.mint=K?b.default:P({publicKey:e}),this.isToken2022=M}equals(e){return this===e?!0:this.mint.equals(e.mint)}},r=p;r.WSOL=new p({...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 $(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,$ as currencyEquals};
//# sourceMappingURL=currency.mjs.map