snapper-sdk
Version:
An SDK for building applications on top of Snapper.
2 lines • 4.05 kB
JavaScript
;var p=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var w=(o,e)=>{for(var n in e)p(o,n,{get:e[n],enumerable:!0})},N=(o,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of O(e))!k.call(o,s)&&s!==n&&p(o,s,{get:()=>e[s],enumerable:!(r=R(e,s))||r.enumerable});return o};var T=o=>N(p({},"__esModule",{value:!0}),o);var I={};w(I,{Currency:()=>u,currencyEquals:()=>W});module.exports=T(I);var S=require("@solana/web3.js"),m=require("@solana/spl-token"),g={chainId:101,address:S.PublicKey.default.toBase58(),programId:m.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"SOL",name:"solana",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}},a={chainId:101,address:"So11111111111111111111111111111111111111112",programId:m.TOKEN_PROGRAM_ID.toBase58(),decimals:9,symbol:"WSOL",name:"Wrapped SOL",logoURI:"https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png",tags:[],priority:2,type:"raydium",extensions:{coingeckoId:"solana"}};var l=require("@solana/web3.js");var t=require("@solana/web3.js"),x=require("@solana/spl-token");function y({pubkey:o,isSigner:e=!1,isWritable:n=!0}){return{pubkey:o,isWritable:n,isSigner:e}}var E=[y({pubkey:x.TOKEN_PROGRAM_ID,isWritable:!1}),y({pubkey:t.SystemProgram.programId,isWritable:!1}),y({pubkey:t.SYSVAR_RENT_PUBKEY,isWritable:!1})];function P({publicKey:o,transformSol:e}){let n=h(o.toString());if(n instanceof t.PublicKey)return e&&n.equals(c)?M:n;if(e&&n.toString()===c.toBase58())return M;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 h(o){try{return new t.PublicKey(o)}catch{return o}}var U=new t.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),_=new t.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),C=new t.PublicKey("SysvarRent111111111111111111111111111111111"),G=new t.PublicKey("SysvarC1ock11111111111111111111111111111111"),Y=new t.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),X=new t.PublicKey("Sysvar1nstructions1111111111111111111111111"),v=t.SystemProgram.programId,j=new t.PublicKey("2cpMA1jNS4obgRz8XNg38QuSP83L1AXpUgfxPNcvnAGj"),B=new t.PublicKey("Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS"),H=new t.PublicKey("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt"),z=new t.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),F=new t.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),V=new t.PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),J=new t.PublicKey("7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj"),Q=new t.PublicKey("USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX"),Z=new t.PublicKey("NRVwhjBQiUPYtfDT5zRBVJajzFQHaBUNtC7SNVvqRFa"),$=new t.PublicKey("ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"),e1=new t.PublicKey("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),M=new t.PublicKey("So11111111111111111111111111111111111111112"),c=t.PublicKey.default;var d=class{constructor({mint:e,decimals:n,symbol:r,name:s,skipMint:K=!1,isToken2022:A=!1}){if(e===c.toBase58()||e instanceof l.PublicKey&&c.equals(e)){this.decimals=a.decimals,this.symbol=a.symbol,this.name=a.name,this.mint=new l.PublicKey(a.address),this.isToken2022=!1;return}this.decimals=n,this.symbol=r||e.toString().substring(0,6),this.name=s||e.toString().substring(0,6),this.mint=K?l.PublicKey.default:P({publicKey:e}),this.isToken2022=A}equals(e){return this===e?!0:this.mint.equals(e.mint)}},i=d;i.WSOL=new d({...a,mint:a.address});var f=class{constructor({decimals:e,symbol:n="UNKNOWN",name:r="UNKNOWN"}){this.decimals=e,this.symbol=n,this.name=r}equals(e){return this===e}},u=f;u.SOL=new f(g);function W(o,e){return o instanceof i&&e instanceof i?o.equals(e):o instanceof i||e instanceof i?!1:o===e}0&&(module.exports={Currency,currencyEquals});
//# sourceMappingURL=currency.js.map