@cobaltx/sdk-v2
Version:
An SDK for building applications on top of CobaltX.
2 lines • 2.68 kB
JavaScript
import{PublicKey as a}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as y}from"@solana/spl-token";import{PublicKey as P}from"@solana/web3.js";var T={chainId:101,address:P.default.toBase58(),programId:y.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"}},n={chainId:101,address:"So11111111111111111111111111111111111111112",programId:y.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 e,SystemProgram as d,SYSVAR_RENT_PUBKEY as S}from"@solana/web3.js";import{TOKEN_PROGRAM_ID as K}from"@solana/spl-token";function s({pubkey:r,isSigner:t=!1,isWritable:o=!0}){return{pubkey:r,isWritable:o,isSigner:t}}var _=[s({pubkey:K,isWritable:!1}),s({pubkey:d.programId,isWritable:!1}),s({pubkey:S,isWritable:!1})];function f({publicKey:r,transformSol:t}){let o=R(r.toString());if(o instanceof e)return t&&o.equals(i)?m:o;if(t&&o.toString()===i.toBase58())return m;if(typeof o=="string"){if(o===e.default.toBase58())return e.default;try{return new e(o)}catch{throw new Error("invalid public key")}}throw new Error("invalid public key")}function R(r){try{return new e(r)}catch{return r}}var W=new e("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),E=new e("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),q=new e("SysvarRent111111111111111111111111111111111"),D=new e("SysvarC1ock11111111111111111111111111111111"),N=new e("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),G=new e("Sysvar1nstructions1111111111111111111111111"),L=d.programId,B=new e("a2Gt18uJC8puJT9JRYQLU6rPi6okxQb4WqCjwtYshZB"),C=new e("bXSKiFqYrALF9gJy1KqHm8tv4QXk8nCgbLN8WRsGEbh"),m=new e("So11111111111111111111111111111111111111112"),i=e.default,H=new e("71kRXzJMvSeArtXYNEWa8KAjpRJosdMQ7Dpgy5Jt5zfd"),X=new e("ERFzpDteGNo8LTDKW1WwVGrkRMmA2y9WZHXNHxMA6BSV");var l=class{constructor({mint:t,decimals:o,symbol:u,name:g,skipMint:M=!1,isToken2022:x=!1}){if(t===i.toBase58()||t instanceof a&&i.equals(t)){this.decimals=n.decimals,this.symbol=n.symbol,this.name=n.name,this.mint=new a(n.address),this.isToken2022=!1;return}this.decimals=o,this.symbol=u||t.toString().substring(0,6),this.name=g||t.toString().substring(0,6),this.mint=M?a.default:f({publicKey:t}),this.isToken2022=x}equals(t){return this===t?!0:this.mint.equals(t.mint)}},c=l;c.WSOL=new l({...n,mint:n.address});export{c as Token};
//# sourceMappingURL=token.mjs.map