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