UNPKG

@cobaltx/sdk-v2

Version:

An SDK for building applications on top of CobaltX.

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