@cobaltx/sdk-v2
Version:
An SDK for building applications on top of CobaltX.
1 lines • 398 kB
JavaScript
import{PublicKey as jc}from"@solana/web3.js";import ma,{isBN as da}from"bn.js";import{bits as Dc,BitStructure as Wp,blob as Fc,Blob as qp,cstr as Up,f32 as Gp,f32be as Xp,f64 as Hp,f64be as Qp,greedy as zp,Layout as Wc,ns64 as Yp,ns64be as jp,nu64 as qc,nu64be as Zp,offset as $p,s16 as Jp,s16be as ef,s24 as tf,s24be as nf,s32 as Uc,s32be as of,s40 as rf,s40be as sf,s48 as af,s48be as uf,s8 as cf,seq as Gc,struct as lf,Structure as Xc,u16 as Hc,u16be as mf,u24 as df,u24be as pf,u32 as Qc,u32be as ff,u40 as bf,u40be as yf,u48 as gf,u48be as wf,u8 as zc,UInt as Yc,union as Af,Union as kf,unionLayoutDiscriminator as Pf,utf8 as hf}from"@solana/buffer-layout";var mi=Wc,aa=Xc;var kr=Yc;var ua=zc,Ht=Hc;var Pr=Qc;var ca=qc;var Se=Uc;var la=Gc;var be=Fc;var hr=Dc;var In=class extends mi{constructor(e,n,o){super(e,o);this.blob=be(e),this.signed=n}decode(e,n=0){let o=new ma(this.blob.decode(e,n),10,"le");return this.signed?o.fromTwos(this.span*8).clone():o}encode(e,n,o=0){return typeof e=="number"&&(e=new ma(e)),this.signed&&(e=e.toTwos(this.span*8)),this.blob.encode(e.toArrayLike(Buffer,"le",this.span),n,o)}},di=class extends mi{constructor(e){super(8,e);this._lower=hr(Pr(),!1),this._upper=hr(Pr(),!1)}addBoolean(e){this._lower.fields.length<32?this._lower.addBoolean(e):this._upper.addBoolean(e)}decode(e,n=0){let o=this._lower.decode(e,n),r=this._upper.decode(e,n+this._lower.span);return{...o,...r}}encode(e,n,o=0){return this._lower.encode(e,n,o)+this._upper.encode(e,n,o+this._lower.span)}};function q(i){return new kr(1,i)}function Ze(i){return new kr(4,i)}function P(i){return new In(8,!1,i)}function j(i){return new In(16,!1,i)}function pa(i){return new In(1,!0,i)}function Fn(i){return new In(8,!0,i)}function fa(i){return new In(16,!0,i)}var pi=class extends mi{constructor(e,n,o,r){super(e.span,r);this.layout=e,this.decoder=n,this.encoder=o}decode(e,n){return this.decoder(this.layout.decode(e,n))}encode(e,n,o){return this.layout.encode(this.encoder(e),n,o)}getSpan(e,n){return this.layout.getSpan(e,n)}};function O(i){return new pi(be(32),t=>new jc(t),t=>t.toBuffer(),i)}function Oe(i){return new pi(ua(),Zc,$c,i)}function Zc(i){if(i===0)return!1;if(i===1)return!0;throw new Error("Invalid bool: "+i)}function $c(i){return i?1:0}var Tr=class extends aa{decode(t,e){return super.decode(t,e)}};function _(i,t,e){return new Tr(i,t,e)}function Q(i,t,e){let n,o=typeof t=="number"?t:da(t)?t.toNumber():new Proxy(t,{get(r,s){if(!n){let a=Reflect.get(r,"count");n=da(a)?a.toNumber():a,Reflect.set(r,"count",n)}return Reflect.get(r,s)},set(r,s,a){return s==="count"&&(n=a),Reflect.set(r,s,a)}});return la(i,o,e)}var un=_([O("mint"),O("owner"),P("amount"),Ze("delegateOption"),O("delegate"),q("state"),Ze("isNativeOption"),P("isNative"),P("delegatedAmount"),Ze("closeAuthorityOption"),O("closeAuthority")]);function Jc(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Ir(i,...t){if(!Jc(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function Br(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function ba(i,t){Ir(i);let e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function bi(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function Ot(i,t){return i<<32-t|i>>>t}function el(i){if(typeof i!="string")throw new Error("utf8ToBytes expected string, got "+typeof i);return new Uint8Array(new TextEncoder().encode(i))}function Sr(i){return typeof i=="string"&&(i=el(i)),Ir(i),i}var fi=class{clone(){return this._cloneInto()}};function ya(i){let t=n=>i().update(Sr(n)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function tl(i,t,e,n){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,n);let o=BigInt(32),r=BigInt(4294967295),s=Number(e>>o&r),a=Number(e&r),c=n?4:0,u=n?0:4;i.setUint32(t+c,s,n),i.setUint32(t+u,a,n)}function ga(i,t,e){return i&t^~i&e}function wa(i,t,e){return i&t^i&e^t&e}var yi=class extends fi{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=bi(this.buffer)}update(t){Br(this);let{view:e,buffer:n,blockLen:o}=this;t=Sr(t);let r=t.length;for(let s=0;s<r;){let a=Math.min(o-this.pos,r-s);if(a===o){let c=bi(t);for(;o<=r-s;s+=o)this.process(c,s);continue}n.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Br(this),ba(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:r}=this,{pos:s}=this;e[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(n,0),s=0);for(let d=s;d<o;d++)e[d]=0;tl(n,o-8,BigInt(this.length*8),r),this.process(n,0);let a=bi(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],r)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:r,destroyed:s,pos:a}=this;return t.length=o,t.pos=a,t.finished=r,t.destroyed=s,o%e&&t.buffer.set(n),t}};var nl=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),cn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ln=new Uint32Array(64),xr=class extends yi{constructor(){super(64,32,8,!1),this.A=cn[0]|0,this.B=cn[1]|0,this.C=cn[2]|0,this.D=cn[3]|0,this.E=cn[4]|0,this.F=cn[5]|0,this.G=cn[6]|0,this.H=cn[7]|0}get(){let{A:t,B:e,C:n,D:o,E:r,F:s,G:a,H:c}=this;return[t,e,n,o,r,s,a,c]}set(t,e,n,o,r,s,a,c){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=r|0,this.F=s|0,this.G=a|0,this.H=c|0}process(t,e){for(let d=0;d<16;d++,e+=4)ln[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){let m=ln[d-15],p=ln[d-2],b=Ot(m,7)^Ot(m,18)^m>>>3,f=Ot(p,17)^Ot(p,19)^p>>>10;ln[d]=f+ln[d-7]+b+ln[d-16]|0}let{A:n,B:o,C:r,D:s,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){let m=Ot(a,6)^Ot(a,11)^Ot(a,25),p=l+m+ga(a,c,u)+nl[d]+ln[d]|0,f=(Ot(n,2)^Ot(n,13)^Ot(n,22))+wa(n,o,r)|0;l=u,u=c,c=a,a=s+p|0,s=r,r=o,o=n,n=p+f|0}n=n+this.A|0,o=o+this.B|0,r=r+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,o,r,s,a,c,u,l)}roundClean(){ln.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Aa=ya(()=>new xr);import{TOKEN_PROGRAM_ID as Wm}from"@solana/spl-token";import{Keypair as qm,PublicKey as ou}from"@solana/web3.js";import Um from"bn.js";import{MINT_SIZE as rl,TOKEN_PROGRAM_ID as sl,getTransferFeeConfig as al,unpackMint as ul}from"@solana/spl-token";import{PublicKey as ha}from"@solana/web3.js";import{get as ka,set as ol}from"lodash";var Kr=class{constructor(t){this.logLevel=t.logLevel!==void 0?t.logLevel:0,this.name=t.name}set level(t){this.logLevel=t}get time(){return Date.now().toString()}get moduleName(){return this.name}isLogLevel(t){return t<=this.logLevel}error(...t){return this.isLogLevel(0)?(console.error(this.time,this.name,"sdk logger error",...t),this):this}logWithError(...t){let e=t.map(n=>typeof n=="object"?JSON.stringify(n):n).join(", ");throw new Error(e)}warning(...t){return this.isLogLevel(1)?(console.warn(this.time,this.name,"sdk logger warning",...t),this):this}info(...t){return this.isLogLevel(2)?(console.info(this.time,this.name,"sdk logger info",...t),this):this}debug(...t){return this.isLogLevel(3)?(console.debug(this.time,this.name,"sdk logger debug",...t),this):this}},Pa={},il={};function ue(i){let t=ka(Pa,i);if(!t){let e=ka(il,i);t=new Kr({name:i,logLevel:e}),ol(Pa,i,t)}return t}var Cr=ue("CobaltX_accountInfo_util");async function Rt(i,t,e){let{batchRequest:n,commitment:o="confirmed",chunkCount:r=100}={batchRequest:!1,...e},s=Lr(t,r),a=new Array(s.length).fill([]);if(n){let c=s.map(d=>{let m=i._buildArgs([d.map(p=>p.toBase58())],o,"base64");return{methodName:"getMultipleAccounts",args:m}}),u=Lr(c,10);a=(await(await Promise.all(u.map(async d=>await i._rpcBatchRequest(d)))).flat()).map(d=>(d.error&&Cr.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${d.error.message}`),d.result.value.map(m=>{if(m){let{data:p,executable:b,lamports:f,owner:g,rentEpoch:y}=m;return p.length!==2&&p[1]!=="base64"&&Cr.logWithError("info must be base64 encoded, RPC_ERROR"),{data:Buffer.from(p[0],"base64"),executable:b,lamports:f,owner:new ha(g),rentEpoch:y}}return null})))}else try{a=await Promise.all(s.map(c=>i.getMultipleAccountsInfo(c,o)))}catch(c){c instanceof Error&&Cr.logWithError(`failed to get info for multiple accounts, RPC_ERROR, ${c.message}`)}return a.flat()}async function We(i,t,e){let n=await Rt(i,t.map(o=>o.pubkey),e);return t.map((o,r)=>({...o,accountInfo:n[r]}))}async function Wn({connection:i,mints:t,network:e,config:n}){var s,a,c;if(t.length===0)return{};let o=await We(i,t.map(u=>({pubkey:tt(u,e)})),n),r={};for(let u of o){if(!u.accountInfo||u.accountInfo.data.length<rl){console.log("invalid mint account",u.pubkey.toBase58());continue}let l=ul(u.pubkey,u.accountInfo,(s=u.accountInfo)==null?void 0:s.owner);r[u.pubkey.toString()]={...l,programId:((a=u.accountInfo)==null?void 0:a.owner)||sl,feeConfig:(c=al(l))!=null?c:void 0}}return r[ha.default.toBase58()]=r[$(e).WSOLMint.toBase58()],r}import Zt from"bn.js";var qn=9e15,fn=1e9,Or="0123456789abcdef",Ai="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ki="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Rr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-qn,maxE:qn,crypto:!1},Sa,Qt,ie=!0,hi="[DecimalError] ",pn=hi+"Invalid argument: ",xa=hi+"Precision limit exceeded",Ka=hi+"crypto unavailable",Ca="[object Decimal]",nt=Math.floor,Ge=Math.pow,cl=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ll=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,ml=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,La=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Nt=1e7,te=7,dl=9007199254740991,pl=Ai.length-1,Nr=ki.length-1,D={toStringTag:Ca};D.absoluteValue=D.abs=function(){var i=new this.constructor(this);return i.s<0&&(i.s=1),Z(i)};D.ceil=function(){return Z(new this.constructor(this),this.e+1,2)};D.clampedTo=D.clamp=function(i,t){var e,n=this,o=n.constructor;if(i=new o(i),t=new o(t),!i.s||!t.s)return new o(NaN);if(i.gt(t))throw Error(pn+t);return e=n.cmp(i),e<0?i:n.cmp(t)>0?t:new o(n)};D.comparedTo=D.cmp=function(i){var t,e,n,o,r=this,s=r.d,a=(i=new r.constructor(i)).d,c=r.s,u=i.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(r.e!==i.e)return r.e>i.e^c<0?1:-1;for(n=s.length,o=a.length,t=0,e=n<o?n:o;t<e;++t)if(s[t]!==a[t])return s[t]>a[t]^c<0?1:-1;return n===o?0:n>o^c<0?1:-1};D.cosine=D.cos=function(){var i,t,e=this,n=e.constructor;return e.d?e.d[0]?(i=n.precision,t=n.rounding,n.precision=i+Math.max(e.e,e.sd())+te,n.rounding=1,e=fl(n,_a(n,e)),n.precision=i,n.rounding=t,Z(Qt==2||Qt==3?e.neg():e,i,t,!0)):new n(1):new n(NaN)};D.cubeRoot=D.cbrt=function(){var i,t,e,n,o,r,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(ie=!1,r=l.s*Ge(l.s*l,1/3),!r||Math.abs(r)==1/0?(e=$e(l.d),i=l.e,(r=(i-e.length+1)%3)&&(e+=r==1||r==-2?"0":"00"),r=Ge(e,1/3),i=nt((i+1)/3)-(i%3==(i<0?-1:2)),r==1/0?e="5e"+i:(e=r.toExponential(),e=e.slice(0,e.indexOf("e")+1)+i),n=new d(e),n.s=l.s):n=new d(r.toString()),s=(i=d.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Pe(u.plus(l).times(a),u.plus(c),s+2,1),$e(a.d).slice(0,s)===(e=$e(n.d)).slice(0,s))if(e=e.slice(s-3,s+1),e=="9999"||!o&&e=="4999"){if(!o&&(Z(a,i+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,o=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Z(n,i+1,1),t=!n.times(n).times(n).eq(l));break}return ie=!0,Z(n,i,d.rounding,t)};D.decimalPlaces=D.dp=function(){var i,t=this.d,e=NaN;if(t){if(i=t.length-1,e=(i-nt(this.e/te))*te,i=t[i],i)for(;i%10==0;i/=10)e--;e<0&&(e=0)}return e};D.dividedBy=D.div=function(i){return Pe(this,new this.constructor(i))};D.dividedToIntegerBy=D.divToInt=function(i){var t=this,e=t.constructor;return Z(Pe(t,new e(i),0,1,1),e.precision,e.rounding)};D.equals=D.eq=function(i){return this.cmp(i)===0};D.floor=function(){return Z(new this.constructor(this),this.e+1,3)};D.greaterThan=D.gt=function(i){return this.cmp(i)>0};D.greaterThanOrEqualTo=D.gte=function(i){var t=this.cmp(i);return t==1||t===0};D.hyperbolicCosine=D.cosh=function(){var i,t,e,n,o,r=this,s=r.constructor,a=new s(1);if(!r.isFinite())return new s(r.s?1/0:NaN);if(r.isZero())return a;e=s.precision,n=s.rounding,s.precision=e+Math.max(r.e,r.sd())+4,s.rounding=1,o=r.d.length,o<32?(i=Math.ceil(o/3),t=(1/Ii(4,i)).toString()):(i=16,t="2.3283064365386962890625e-10"),r=Un(s,1,r.times(t),new s(1),!0);for(var c,u=i,l=new s(8);u--;)c=r.times(r),r=a.minus(c.times(l.minus(c.times(l))));return Z(r,s.precision=e,s.rounding=n,!0)};D.hyperbolicSine=D.sinh=function(){var i,t,e,n,o=this,r=o.constructor;if(!o.isFinite()||o.isZero())return new r(o);if(t=r.precision,e=r.rounding,r.precision=t+Math.max(o.e,o.sd())+4,r.rounding=1,n=o.d.length,n<3)o=Un(r,2,o,o,!0);else{i=1.4*Math.sqrt(n),i=i>16?16:i|0,o=o.times(1/Ii(5,i)),o=Un(r,2,o,o,!0);for(var s,a=new r(5),c=new r(16),u=new r(20);i--;)s=o.times(o),o=o.times(a.plus(s.times(c.times(s).plus(u))))}return r.precision=t,r.rounding=e,Z(o,t,e,!0)};D.hyperbolicTangent=D.tanh=function(){var i,t,e=this,n=e.constructor;return e.isFinite()?e.isZero()?new n(e):(i=n.precision,t=n.rounding,n.precision=i+7,n.rounding=1,Pe(e.sinh(),e.cosh(),n.precision=i,n.rounding=t)):new n(e.s)};D.inverseCosine=D.acos=function(){var i=this,t=i.constructor,e=i.abs().cmp(1),n=t.precision,o=t.rounding;return e!==-1?e===0?i.isNeg()?Wt(t,n,o):new t(0):new t(NaN):i.isZero()?Wt(t,n+4,o).times(.5):(t.precision=n+6,t.rounding=1,i=new t(1).minus(i).div(i.plus(1)).sqrt().atan(),t.precision=n,t.rounding=o,i.times(2))};D.inverseHyperbolicCosine=D.acosh=function(){var i,t,e=this,n=e.constructor;return e.lte(1)?new n(e.eq(1)?0:NaN):e.isFinite()?(i=n.precision,t=n.rounding,n.precision=i+Math.max(Math.abs(e.e),e.sd())+4,n.rounding=1,ie=!1,e=e.times(e).minus(1).sqrt().plus(e),ie=!0,n.precision=i,n.rounding=t,e.ln()):new n(e)};D.inverseHyperbolicSine=D.asinh=function(){var i,t,e=this,n=e.constructor;return!e.isFinite()||e.isZero()?new n(e):(i=n.precision,t=n.rounding,n.precision=i+2*Math.max(Math.abs(e.e),e.sd())+6,n.rounding=1,ie=!1,e=e.times(e).plus(1).sqrt().plus(e),ie=!0,n.precision=i,n.rounding=t,e.ln())};D.inverseHyperbolicTangent=D.atanh=function(){var i,t,e,n,o=this,r=o.constructor;return o.isFinite()?o.e>=0?new r(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN):(i=r.precision,t=r.rounding,n=o.sd(),Math.max(n,i)<2*-o.e-1?Z(new r(o),i,t,!0):(r.precision=e=n-o.e,o=Pe(o.plus(1),new r(1).minus(o),e+i,1),r.precision=i+4,r.rounding=1,o=o.ln(),r.precision=i,r.rounding=t,o.times(.5))):new r(NaN)};D.inverseSine=D.asin=function(){var i,t,e,n,o=this,r=o.constructor;return o.isZero()?new r(o):(t=o.abs().cmp(1),e=r.precision,n=r.rounding,t!==-1?t===0?(i=Wt(r,e+4,n).times(.5),i.s=o.s,i):new r(NaN):(r.precision=e+6,r.rounding=1,o=o.div(new r(1).minus(o.times(o)).sqrt().plus(1)).atan(),r.precision=e,r.rounding=n,o.times(2)))};D.inverseTangent=D.atan=function(){var i,t,e,n,o,r,s,a,c,u=this,l=u.constructor,d=l.precision,m=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=Nr)return s=Wt(l,d+4,m).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=Nr)return s=Wt(l,d+4,m).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,e=Math.min(28,a/te+2|0),i=e;i;--i)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ie=!1,t=Math.ceil(a/te),n=1,c=u.times(u),s=new l(u),o=u;i!==-1;)if(o=o.times(c),r=s.minus(o.div(n+=2)),o=o.times(c),s=r.plus(o.div(n+=2)),s.d[t]!==void 0)for(i=t;s.d[i]===r.d[i]&&i--;);return e&&(s=s.times(2<<e-1)),ie=!0,Z(s,l.precision=d,l.rounding=m,!0)};D.isFinite=function(){return!!this.d};D.isInteger=D.isInt=function(){return!!this.d&&nt(this.e/te)>this.d.length-2};D.isNaN=function(){return!this.s};D.isNegative=D.isNeg=function(){return this.s<0};D.isPositive=D.isPos=function(){return this.s>0};D.isZero=function(){return!!this.d&&this.d[0]===0};D.lessThan=D.lt=function(i){return this.cmp(i)<0};D.lessThanOrEqualTo=D.lte=function(i){return this.cmp(i)<1};D.logarithm=D.log=function(i){var t,e,n,o,r,s,a,c,u=this,l=u.constructor,d=l.precision,m=l.rounding,p=5;if(i==null)i=new l(10),t=!0;else{if(i=new l(i),e=i.d,i.s<0||!e||!e[0]||i.eq(1))return new l(NaN);t=i.eq(10)}if(e=u.d,u.s<0||!e||!e[0]||u.eq(1))return new l(e&&!e[0]?-1/0:u.s!=1?NaN:e?0:1/0);if(t)if(e.length>1)r=!0;else{for(o=e[0];o%10===0;)o/=10;r=o!==1}if(ie=!1,a=d+p,s=dn(u,a),n=t?Pi(l,a+10):dn(i,a),c=Pe(s,n,a,1),ro(c.d,o=d,m))do if(a+=10,s=dn(u,a),n=t?Pi(l,a+10):dn(i,a),c=Pe(s,n,a,1),!r){+$e(c.d).slice(o+1,o+15)+1==1e14&&(c=Z(c,d+1,0));break}while(ro(c.d,o+=10,m));return ie=!0,Z(c,d,m)};D.minus=D.sub=function(i){var t,e,n,o,r,s,a,c,u,l,d,m,p=this,b=p.constructor;if(i=new b(i),!p.d||!i.d)return!p.s||!i.s?i=new b(NaN):p.d?i.s=-i.s:i=new b(i.d||p.s!==i.s?p:NaN),i;if(p.s!=i.s)return i.s=-i.s,p.plus(i);if(u=p.d,m=i.d,a=b.precision,c=b.rounding,!u[0]||!m[0]){if(m[0])i.s=-i.s;else if(u[0])i=new b(p);else return new b(c===3?-0:0);return ie?Z(i,a,c):i}if(e=nt(i.e/te),l=nt(p.e/te),u=u.slice(),r=l-e,r){for(d=r<0,d?(t=u,r=-r,s=m.length):(t=m,e=l,s=u.length),n=Math.max(Math.ceil(a/te),s)+2,r>n&&(r=n,t.length=1),t.reverse(),n=r;n--;)t.push(0);t.reverse()}else{for(n=u.length,s=m.length,d=n<s,d&&(s=n),n=0;n<s;n++)if(u[n]!=m[n]){d=u[n]<m[n];break}r=0}for(d&&(t=u,u=m,m=t,i.s=-i.s),s=u.length,n=m.length-s;n>0;--n)u[s++]=0;for(n=m.length;n>r;){if(u[--n]<m[n]){for(o=n;o&&u[--o]===0;)u[o]=Nt-1;--u[o],u[n]+=Nt}u[n]-=m[n]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--e;return u[0]?(i.d=u,i.e=Ti(u,e),ie?Z(i,a,c):i):new b(c===3?-0:0)};D.modulo=D.mod=function(i){var t,e=this,n=e.constructor;return i=new n(i),!e.d||!i.s||i.d&&!i.d[0]?new n(NaN):!i.d||e.d&&!e.d[0]?Z(new n(e),n.precision,n.rounding):(ie=!1,n.modulo==9?(t=Pe(e,i.abs(),0,3,1),t.s*=i.s):t=Pe(e,i,0,n.modulo,1),t=t.times(i),ie=!0,e.minus(t))};D.naturalExponential=D.exp=function(){return Mr(this)};D.naturalLogarithm=D.ln=function(){return dn(this)};D.negated=D.neg=function(){var i=new this.constructor(this);return i.s=-i.s,Z(i)};D.plus=D.add=function(i){var t,e,n,o,r,s,a,c,u,l,d=this,m=d.constructor;if(i=new m(i),!d.d||!i.d)return!d.s||!i.s?i=new m(NaN):d.d||(i=new m(i.d||d.s===i.s?d:NaN)),i;if(d.s!=i.s)return i.s=-i.s,d.minus(i);if(u=d.d,l=i.d,a=m.precision,c=m.rounding,!u[0]||!l[0])return l[0]||(i=new m(d)),ie?Z(i,a,c):i;if(r=nt(d.e/te),n=nt(i.e/te),u=u.slice(),o=r-n,o){for(o<0?(e=u,o=-o,s=l.length):(e=l,n=r,s=u.length),r=Math.ceil(a/te),s=r>s?r+1:s+1,o>s&&(o=s,e.length=1),e.reverse();o--;)e.push(0);e.reverse()}for(s=u.length,o=l.length,s-o<0&&(o=s,e=l,l=u,u=e),t=0;o;)t=(u[--o]=u[o]+l[o]+t)/Nt|0,u[o]%=Nt;for(t&&(u.unshift(t),++n),s=u.length;u[--s]==0;)u.pop();return i.d=u,i.e=Ti(u,n),ie?Z(i,a,c):i};D.precision=D.sd=function(i){var t,e=this;if(i!==void 0&&i!==!!i&&i!==1&&i!==0)throw Error(pn+i);return e.d?(t=Oa(e.d),i&&e.e+1>t&&(t=e.e+1)):t=NaN,t};D.round=function(){var i=this,t=i.constructor;return Z(new t(i),i.e+1,t.rounding)};D.sine=D.sin=function(){var i,t,e=this,n=e.constructor;return e.isFinite()?e.isZero()?new n(e):(i=n.precision,t=n.rounding,n.precision=i+Math.max(e.e,e.sd())+te,n.rounding=1,e=yl(n,_a(n,e)),n.precision=i,n.rounding=t,Z(Qt>2?e.neg():e,i,t,!0)):new n(NaN)};D.squareRoot=D.sqrt=function(){var i,t,e,n,o,r,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(ie=!1,u=Math.sqrt(+s),u==0||u==1/0?(t=$e(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=nt((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),e=(c=l.precision)+3;;)if(r=n,n=r.plus(Pe(s,r,e+2,1)).times(.5),$e(r.d).slice(0,e)===(t=$e(n.d)).slice(0,e))if(t=t.slice(e-3,e+1),t=="9999"||!o&&t=="4999"){if(!o&&(Z(r,c+1,0),r.times(r).eq(s))){n=r;break}e+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Z(n,c+1,1),i=!n.times(n).eq(s));break}return ie=!0,Z(n,c,l.rounding,i)};D.tangent=D.tan=function(){var i,t,e=this,n=e.constructor;return e.isFinite()?e.isZero()?new n(e):(i=n.precision,t=n.rounding,n.precision=i+10,n.rounding=1,e=e.sin(),e.s=1,e=Pe(e,new n(1).minus(e.times(e)).sqrt(),i+10,0),n.precision=i,n.rounding=t,Z(Qt==2||Qt==4?e.neg():e,i,t,!0)):new n(NaN)};D.times=D.mul=function(i){var t,e,n,o,r,s,a,c,u,l=this,d=l.constructor,m=l.d,p=(i=new d(i)).d;if(i.s*=l.s,!m||!m[0]||!p||!p[0])return new d(!i.s||m&&!m[0]&&!p||p&&!p[0]&&!m?NaN:!m||!p?i.s/0:i.s*0);for(e=nt(l.e/te)+nt(i.e/te),c=m.length,u=p.length,c<u&&(r=m,m=p,p=r,s=c,c=u,u=s),r=[],s=c+u,n=s;n--;)r.push(0);for(n=u;--n>=0;){for(t=0,o=c+n;o>n;)a=r[o]+p[n]*m[o-n-1]+t,r[o--]=a%Nt|0,t=a/Nt|0;r[o]=(r[o]+t)%Nt|0}for(;!r[--s];)r.pop();return t?++e:r.shift(),i.d=r,i.e=Ti(r,e),ie?Z(i,d.precision,d.rounding):i};D.toBinary=function(i,t){return _r(this,2,i,t)};D.toDecimalPlaces=D.toDP=function(i,t){var e=this,n=e.constructor;return e=new n(e),i===void 0?e:(dt(i,0,fn),t===void 0?t=n.rounding:dt(t,0,8),Z(e,i+e.e+1,t))};D.toExponential=function(i,t){var e,n=this,o=n.constructor;return i===void 0?e=qt(n,!0):(dt(i,0,fn),t===void 0?t=o.rounding:dt(t,0,8),n=Z(new o(n),i+1,t),e=qt(n,!0,i+1)),n.isNeg()&&!n.isZero()?"-"+e:e};D.toFixed=function(i,t){var e,n,o=this,r=o.constructor;return i===void 0?e=qt(o):(dt(i,0,fn),t===void 0?t=r.rounding:dt(t,0,8),n=Z(new r(o),i+o.e+1,t),e=qt(n,!1,i+n.e+1)),o.isNeg()&&!o.isZero()?"-"+e:e};D.toFraction=function(i){var t,e,n,o,r,s,a,c,u,l,d,m,p=this,b=p.d,f=p.constructor;if(!b)return new f(p);if(u=e=new f(1),n=c=new f(0),t=new f(n),r=t.e=Oa(b)-p.e-1,s=r%te,t.d[0]=Ge(10,s<0?te+s:s),i==null)i=r>0?t:u;else{if(a=new f(i),!a.isInt()||a.lt(u))throw Error(pn+a);i=a.gt(t)?r>0?t:u:a}for(ie=!1,a=new f($e(b)),l=f.precision,f.precision=r=b.length*te*2;d=Pe(a,t,0,1,1),o=e.plus(d.times(n)),o.cmp(i)!=1;)e=n,n=o,o=u,u=c.plus(d.times(o)),c=o,o=t,t=a.minus(d.times(o)),a=o;return o=Pe(i.minus(e),n,0,1,1),c=c.plus(o.times(u)),e=e.plus(o.times(n)),c.s=u.s=p.s,m=Pe(u,n,r,1).minus(p).abs().cmp(Pe(c,e,r,1).minus(p).abs())<1?[u,n]:[c,e],f.precision=l,ie=!0,m};D.toHexadecimal=D.toHex=function(i,t){return _r(this,16,i,t)};D.toNearest=function(i,t){var e=this,n=e.constructor;if(e=new n(e),i==null){if(!e.d)return e;i=new n(1),t=n.rounding}else{if(i=new n(i),t===void 0?t=n.rounding:dt(t,0,8),!e.d)return i.s?e:i;if(!i.d)return i.s&&(i.s=e.s),i}return i.d[0]?(ie=!1,e=Pe(e,i,0,t,1).times(i),ie=!0,Z(e)):(i.s=e.s,e=i),e};D.toNumber=function(){return+this};D.toOctal=function(i,t){return _r(this,8,i,t)};D.toPower=D.pow=function(i){var t,e,n,o,r,s,a=this,c=a.constructor,u=+(i=new c(i));if(!a.d||!i.d||!a.d[0]||!i.d[0])return new c(Ge(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,r=c.rounding,i.eq(1))return Z(a,n,r);if(t=nt(i.e/te),t>=i.d.length-1&&(e=u<0?-u:u)<=dl)return o=Ra(c,a,e,n),i.s<0?new c(1).div(o):Z(o,n,r);if(s=a.s,s<0){if(t<i.d.length-1)return new c(NaN);if((i.d[t]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return e=Ge(+a,u),t=e==0||!isFinite(e)?nt(u*(Math.log("0."+$e(a.d))/Math.LN10+a.e+1)):new c(e+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?s/0:0):(ie=!1,c.rounding=a.s=1,e=Math.min(12,(t+"").length),o=Mr(i.times(dn(a,n+e)),n),o.d&&(o=Z(o,n+5,1),ro(o.d,n,r)&&(t=n+10,o=Z(Mr(i.times(dn(a,t+e)),t),t+5,1),+$e(o.d).slice(n+1,n+15)+1==1e14&&(o=Z(o,n+1,0)))),o.s=s,ie=!0,c.rounding=r,Z(o,n,r))};D.toPrecision=function(i,t){var e,n=this,o=n.constructor;return i===void 0?e=qt(n,n.e<=o.toExpNeg||n.e>=o.toExpPos):(dt(i,1,fn),t===void 0?t=o.rounding:dt(t,0,8),n=Z(new o(n),i,t),e=qt(n,i<=n.e||n.e<=o.toExpNeg,i)),n.isNeg()&&!n.isZero()?"-"+e:e};D.toSignificantDigits=D.toSD=function(i,t){var e=this,n=e.constructor;return i===void 0?(i=n.precision,t=n.rounding):(dt(i,1,fn),t===void 0?t=n.rounding:dt(t,0,8)),Z(new n(e),i,t)};D.toString=function(){var i=this,t=i.constructor,e=qt(i,i.e<=t.toExpNeg||i.e>=t.toExpPos);return i.isNeg()&&!i.isZero()?"-"+e:e};D.truncated=D.trunc=function(){return Z(new this.constructor(this),this.e+1,1)};D.valueOf=D.toJSON=function(){var i=this,t=i.constructor,e=qt(i,i.e<=t.toExpNeg||i.e>=t.toExpPos);return i.isNeg()?"-"+e:e};function $e(i){var t,e,n,o=i.length-1,r="",s=i[0];if(o>0){for(r+=s,t=1;t<o;t++)n=i[t]+"",e=te-n.length,e&&(r+=mn(e)),r+=n;s=i[t],n=s+"",e=te-n.length,e&&(r+=mn(e))}else if(s===0)return"0";for(;s%10===0;)s/=10;return r+s}function dt(i,t,e){if(i!==~~i||i<t||i>e)throw Error(pn+i)}function ro(i,t,e,n){var o,r,s,a;for(r=i[0];r>=10;r/=10)--t;return--t<0?(t+=te,o=0):(o=Math.ceil((t+1)/te),t%=te),r=Ge(10,te-t),a=i[o]%r|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),s=e<4&&a==99999||e>3&&a==49999||a==5e4||a==0):s=(e<4&&a+1==r||e>3&&a+1==r/2)&&(i[o+1]/r/100|0)==Ge(10,t-2)-1||(a==r/2||a==0)&&(i[o+1]/r/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),s=(n||e<4)&&a==9999||!n&&e>3&&a==4999):s=((n||e<4)&&a+1==r||!n&&e>3&&a+1==r/2)&&(i[o+1]/r/1e3|0)==Ge(10,t-3)-1,s}function gi(i,t,e){for(var n,o=[0],r,s=0,a=i.length;s<a;){for(r=o.length;r--;)o[r]*=t;for(o[0]+=Or.indexOf(i.charAt(s++)),n=0;n<o.length;n++)o[n]>e-1&&(o[n+1]===void 0&&(o[n+1]=0),o[n+1]+=o[n]/e|0,o[n]%=e)}return o.reverse()}function fl(i,t){var e,n,o;if(t.isZero())return t;n=t.d.length,n<32?(e=Math.ceil(n/3),o=(1/Ii(4,e)).toString()):(e=16,o="2.3283064365386962890625e-10"),i.precision+=e,t=Un(i,1,t.times(o),new i(1));for(var r=e;r--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return i.precision-=e,t}var Pe=function(){function i(n,o,r){var s,a=0,c=n.length;for(n=n.slice();c--;)s=n[c]*o+a,n[c]=s%r|0,a=s/r|0;return a&&n.unshift(a),n}function t(n,o,r,s){var a,c;if(r!=s)c=r>s?1:-1;else for(a=c=0;a<r;a++)if(n[a]!=o[a]){c=n[a]>o[a]?1:-1;break}return c}function e(n,o,r,s){for(var a=0;r--;)n[r]-=a,a=n[r]<o[r]?1:0,n[r]=a*s+n[r]-o[r];for(;!n[0]&&n.length>1;)n.shift()}return function(n,o,r,s,a,c){var u,l,d,m,p,b,f,g,y,A,k,h,I,T,S,B,C,x,K,M,R=n.constructor,V=n.s==o.s?1:-1,U=n.d,W=o.d;if(!U||!U[0]||!W||!W[0])return new R(!n.s||!o.s||(U?W&&U[0]==W[0]:!W)?NaN:U&&U[0]==0||!W?V*0:V/0);for(c?(p=1,l=n.e-o.e):(c=Nt,p=te,l=nt(n.e/p)-nt(o.e/p)),K=W.length,C=U.length,y=new R(V),A=y.d=[],d=0;W[d]==(U[d]||0);d++);if(W[d]>(U[d]||0)&&l--,r==null?(T=r=R.precision,s=R.rounding):a?T=r+(n.e-o.e)+1:T=r,T<0)A.push(1),b=!0;else{if(T=T/p+2|0,d=0,K==1){for(m=0,W=W[0],T++;(d<C||m)&&T--;d++)S=m*c+(U[d]||0),A[d]=S/W|0,m=S%W|0;b=m||d<C}else{for(m=c/(W[0]+1)|0,m>1&&(W=i(W,m,c),U=i(U,m,c),K=W.length,C=U.length),B=K,k=U.slice(0,K),h=k.length;h<K;)k[h++]=0;M=W.slice(),M.unshift(0),x=W[0],W[1]>=c/2&&++x;do m=0,u=t(W,k,K,h),u<0?(I=k[0],K!=h&&(I=I*c+(k[1]||0)),m=I/x|0,m>1?(m>=c&&(m=c-1),f=i(W,m,c),g=f.length,h=k.length,u=t(f,k,g,h),u==1&&(m--,e(f,K<g?M:W,g,c))):(m==0&&(u=m=1),f=W.slice()),g=f.length,g<h&&f.unshift(0),e(k,f,h,c),u==-1&&(h=k.length,u=t(W,k,K,h),u<1&&(m++,e(k,K<h?M:W,h,c))),h=k.length):u===0&&(m++,k=[0]),A[d++]=m,u&&k[0]?k[h++]=U[B]||0:(k=[U[B]],h=1);while((B++<C||k[0]!==void 0)&&T--);b=k[0]!==void 0}A[0]||A.shift()}if(p==1)y.e=l,Sa=b;else{for(d=1,m=A[0];m>=10;m/=10)d++;y.e=d+l*p-1,Z(y,a?r+y.e+1:r,s,b)}return y}}();function Z(i,t,e,n){var o,r,s,a,c,u,l,d,m,p=i.constructor;e:if(t!=null){if(d=i.d,!d)return i;for(o=1,a=d[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=te,s=t,l=d[m=0],c=l/Ge(10,o-s-1)%10|0;else if(m=Math.ceil((r+1)/te),a=d.length,m>=a)if(n){for(;a++<=m;)d.push(0);l=c=0,o=1,r%=te,s=r-te+1}else break e;else{for(l=a=d[m],o=1;a>=10;a/=10)o++;r%=te,s=r-te+o,c=s<0?0:l/Ge(10,o-s-1)%10|0}if(n=n||t<0||d[m+1]!==void 0||(s<0?l:l%Ge(10,o-s-1)),u=e<4?(c||n)&&(e==0||e==(i.s<0?3:2)):c>5||c==5&&(e==4||n||e==6&&(r>0?s>0?l/Ge(10,o-s):0:d[m-1])%10&1||e==(i.s<0?8:7)),t<1||!d[0])return d.length=0,u?(t-=i.e+1,d[0]=Ge(10,(te-t%te)%te),i.e=-t||0):d[0]=i.e=0,i;if(r==0?(d.length=m,a=1,m--):(d.length=m+1,a=Ge(10,te-r),d[m]=s>0?(l/Ge(10,o-s)%Ge(10,s)|0)*a:0),u)for(;;)if(m==0){for(r=1,s=d[0];s>=10;s/=10)r++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;r!=a&&(i.e++,d[0]==Nt&&(d[0]=1));break}else{if(d[m]+=a,d[m]!=Nt)break;d[m--]=0,a=1}for(r=d.length;d[--r]===0;)d.pop()}return ie&&(i.e>p.maxE?(i.d=null,i.e=NaN):i.e<p.minE&&(i.e=0,i.d=[0])),i}function qt(i,t,e){if(!i.isFinite())return Ma(i);var n,o=i.e,r=$e(i.d),s=r.length;return t?(e&&(n=e-s)>0?r=r.charAt(0)+"."+r.slice(1)+mn(n):s>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(i.e<0?"e":"e+")+i.e):o<0?(r="0."+mn(-o-1)+r,e&&(n=e-s)>0&&(r+=mn(n))):o>=s?(r+=mn(o+1-s),e&&(n=e-o-1)>0&&(r=r+"."+mn(n))):((n=o+1)<s&&(r=r.slice(0,n)+"."+r.slice(n)),e&&(n=e-s)>0&&(o+1===s&&(r+="."),r+=mn(n))),r}function Ti(i,t){var e=i[0];for(t*=te;e>=10;e/=10)t++;return t}function Pi(i,t,e){if(t>pl)throw ie=!0,e&&(i.precision=e),Error(xa);return Z(new i(Ai),t,1,!0)}function Wt(i,t,e){if(t>Nr)throw Error(xa);return Z(new i(ki),t,e,!0)}function Oa(i){var t=i.length-1,e=t*te+1;if(t=i[t],t){for(;t%10==0;t/=10)e--;for(t=i[0];t>=10;t/=10)e++}return e}function mn(i){for(var t="";i--;)t+="0";return t}function Ra(i,t,e,n){var o,r=new i(1),s=Math.ceil(n/te+4);for(ie=!1;;){if(e%2&&(r=r.times(t),Ia(r.d,s)&&(o=!0)),e=nt(e/2),e===0){e=r.d.length-1,o&&r.d[e]===0&&++r.d[e];break}t=t.times(t),Ia(t.d,s)}return ie=!0,r}function Ta(i){return i.d[i.d.length-1]&1}function Na(i,t,e){for(var n,o,r=new i(t[0]),s=0;++s<t.length;){if(o=new i(t[s]),!o.s){r=o;break}n=r.cmp(o),(n===e||n===0&&r.s===e)&&(r=o)}return r}function Mr(i,t){var e,n,o,r,s,a,c,u=0,l=0,d=0,m=i.constructor,p=m.rounding,b=m.precision;if(!i.d||!i.d[0]||i.e>17)return new m(i.d?i.d[0]?i.s<0?0:1/0:1:i.s?i.s<0?0:i:0/0);for(t==null?(ie=!1,c=b):c=t,a=new m(.03125);i.e>-2;)i=i.times(a),d+=5;for(n=Math.log(Ge(2,d))/Math.LN10*2+5|0,c+=n,e=r=s=new m(1),m.precision=c;;){if(r=Z(r.times(i),c,1),e=e.times(++l),a=s.plus(Pe(r,e,c,1)),$e(a.d).slice(0,c)===$e(s.d).slice(0,c)){for(o=d;o--;)s=Z(s.times(s),c,1);if(t==null)if(u<3&&ro(s.d,c-n,p,u))m.precision=c+=10,e=r=a=new m(1),l=0,u++;else return Z(s,m.precision=b,p,ie=!0);else return m.precision=b,s}s=a}}function dn(i,t){var e,n,o,r,s,a,c,u,l,d,m,p=1,b=10,f=i,g=f.d,y=f.constructor,A=y.rounding,k=y.precision;if(f.s<0||!g||!g[0]||!f.e&&g[0]==1&&g.length==1)return new y(g&&!g[0]?-1/0:f.s!=1?NaN:g?0:f);if(t==null?(ie=!1,l=k):l=t,y.precision=l+=b,e=$e(g),n=e.charAt(0),Math.abs(r=f.e)<15e14){for(;n<7&&n!=1||n==1&&e.charAt(1)>3;)f=f.times(i),e=$e(f.d),n=e.charAt(0),p++;r=f.e,n>1?(f=new y("0."+e),r++):f=new y(n+"."+e.slice(1))}else return u=Pi(y,l+2,k).times(r+""),f=dn(new y(n+"."+e.slice(1)),l-b).plus(u),y.precision=k,t==null?Z(f,k,A,ie=!0):f;for(d=f,c=s=f=Pe(f.minus(1),f.plus(1),l,1),m=Z(f.times(f),l,1),o=3;;){if(s=Z(s.times(m),l,1),u=c.plus(Pe(s,new y(o),l,1)),$e(u.d).slice(0,l)===$e(c.d).slice(0,l))if(c=c.times(2),r!==0&&(c=c.plus(Pi(y,l+2,k).times(r+""))),c=Pe(c,new y(p),l,1),t==null)if(ro(c.d,l-b,A,a))y.precision=l+=b,u=s=f=Pe(d.minus(1),d.plus(1),l,1),m=Z(f.times(f),l,1),o=a=1;else return Z(c,y.precision=k,A,ie=!0);else return y.precision=k,c;c=u,o+=2}}function Ma(i){return String(i.s*i.s/0)}function wi(i,t){var e,n,o;for((e=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(e<0&&(e=n),e+=+t.slice(n+1),t=t.substring(0,n)):e<0&&(e=t.length),n=0;t.charCodeAt(n)===48;n++);for(o=t.length;t.charCodeAt(o-1)===48;--o);if(t=t.slice(n,o),t){if(o-=n,i.e=e=e-n-1,i.d=[],n=(e+1)%te,e<0&&(n+=te),n<o){for(n&&i.d.push(+t.slice(0,n)),o-=te;n<o;)i.d.push(+t.slice(n,n+=te));t=t.slice(n),n=te-t.length}else n-=o;for(;n--;)t+="0";i.d.push(+t),ie&&(i.e>i.constructor.maxE?(i.d=null,i.e=NaN):i.e<i.constructor.minE&&(i.e=0,i.d=[0]))}else i.e=0,i.d=[0];return i}function bl(i,t){var e,n,o,r,s,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),La.test(t))return wi(i,t)}else if(t==="Infinity"||t==="NaN")return+t||(i.s=NaN),i.e=NaN,i.d=null,i;if(ll.test(t))e=16,t=t.toLowerCase();else if(cl.test(t))e=2;else if(ml.test(t))e=8;else throw Error(pn+t);for(r=t.search(/p/i),r>0?(c=+t.slice(r+1),t=t.substring(2,r)):t=t.slice(2),r=t.indexOf("."),s=r>=0,n=i.constructor,s&&(t=t.replace(".",""),a=t.length,r=a-r,o=Ra(n,new n(e),r,r*2)),u=gi(t,e,Nt),l=u.length-1,r=l;u[r]===0;--r)u.pop();return r<0?new n(i.s*0):(i.e=Ti(u,l),i.d=u,ie=!1,s&&(i=Pe(i,o,a*4)),c&&(i=i.times(Math.abs(c)<54?Ge(2,c):so.pow(2,c))),ie=!0,i)}function yl(i,t){var e,n=t.d.length;if(n<3)return t.isZero()?t:Un(i,2,t,t);e=1.4*Math.sqrt(n),e=e>16?16:e|0,t=t.times(1/Ii(5,e)),t=Un(i,2,t,t);for(var o,r=new i(5),s=new i(16),a=new i(20);e--;)o=t.times(t),t=t.times(r.plus(o.times(s.times(o).minus(a))));return t}function Un(i,t,e,n,o){var r,s,a,c,u=1,l=i.precision,d=Math.ceil(l/te);for(ie=!1,c=e.times(e),a=new i(n);;){if(s=Pe(a.times(c),new i(t++*t++),l,1),a=o?n.plus(s):n.minus(s),n=Pe(s.times(c),new i(t++*t++),l,1),s=a.plus(n),s.d[d]!==void 0){for(r=d;s.d[r]===a.d[r]&&r--;);if(r==-1)break}r=a,a=n,n=s,s=r,u++}return ie=!0,s.d.length=d+1,s}function Ii(i,t){for(var e=i;--t;)e*=i;return e}function _a(i,t){var e,n=t.s<0,o=Wt(i,i.precision,1),r=o.times(.5);if(t=t.abs(),t.lte(r))return Qt=n?4:1,t;if(e=t.divToInt(o),e.isZero())Qt=n?3:2;else{if(t=t.minus(e.times(o)),t.lte(r))return Qt=Ta(e)?n?2:3:n?4:1,t;Qt=Ta(e)?n?1:4:n?3:2}return t.minus(o).abs()}function _r(i,t,e,n){var o,r,s,a,c,u,l,d,m,p=i.constructor,b=e!==void 0;if(b?(dt(e,1,fn),n===void 0?n=p.rounding:dt(n,0,8)):(e=p.precision,n=p.rounding),!i.isFinite())l=Ma(i);else{for(l=qt(i),s=l.indexOf("."),b?(o=2,t==16?e=e*4-3:t==8&&(e=e*3-2)):o=t,s>=0&&(l=l.replace(".",""),m=new p(1),m.e=l.length-s,m.d=gi(qt(m),10,o),m.e=m.d.length),d=gi(l,10,o),r=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=b?"0p+0":"0";else{if(s<0?r--:(i=new p(i),i.d=d,i.e=r,i=Pe(i,m,e,n,0,o),d=i.d,r=i.e,u=Sa),s=d[e],a=o/2,u=u||d[e+1]!==void 0,u=n<4?(s!==void 0||u)&&(n===0||n===(i.s<0?3:2)):s>a||s===a&&(n===4||u||n===6&&d[e-1]&1||n===(i.s<0?8:7)),d.length=e,u)for(;++d[--e]>o-1;)d[e]=0,e||(++r,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=Or.charAt(d[s]);if(b){if(c>1)if(t==16||t==8){for(s=t==16?4:3,--c;c%s;c++)l+="0";for(d=gi(l,o,t),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Or.charAt(d[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(r<0?"p":"p+")+r}else if(r<0){for(;++r;)l="0"+l;l="0."+l}else if(++r>c)for(r-=c;r--;)l+="0";else r<c&&(l=l.slice(0,r)+"."+l.slice(r))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return i.s<0?"-"+l:l}function Ia(i,t){if(i.length>t)return i.length=t,!0}function gl(i){return new this(i).abs()}function wl(i){return new this(i).acos()}function Al(i){return new this(i).acosh()}function kl(i,t){return new this(i).plus(t)}function Pl(i){return new this(i).asin()}function hl(i){return new this(i).asinh()}function Tl(i){return new this(i).atan()}function Il(i){return new this(i).atanh()}function Bl(i,t){i=new this(i),t=new this(t);var e,n=this.precision,o=this.rounding,r=n+4;return!i.s||!t.s?e=new this(NaN):!i.d&&!t.d?(e=Wt(this,r,1).times(t.s>0?.25:.75),e.s=i.s):!t.d||i.isZero()?(e=t.s<0?Wt(this,n,o):new this(0),e.s=i.s):!i.d||t.isZero()?(e=Wt(this,r,1).times(.5),e.s=i.s):t.s<0?(this.precision=r,this.rounding=1,e=this.atan(Pe(i,t,r,1)),t=Wt(this,r,1),this.precision=n,this.rounding=o,e=i.s<0?e.minus(t):e.plus(t)):e=this.atan(Pe(i,t,r,1)),e}function Sl(i){return new this(i).cbrt()}function xl(i){return Z(i=new this(i),i.e+1,2)}function Kl(i,t,e){return new this(i).clamp(t,e)}function Cl(i){if(!i||typeof i!="object")throw Error(hi+"Object expected");var t,e,n,o=i.defaults===!0,r=["precision",1,fn,"rounding",0,8,"toExpNeg",-qn,0,"toExpPos",0,qn,"maxE",0,qn,"minE",-qn,0,"modulo",0,9];for(t=0;t<r.length;t+=3)if(e=r[t],o&&(this[e]=Rr[e]),(n=i[e])!==void 0)if(nt(n)===n&&n>=r[t+1]&&n<=r[t+2])this[e]=n;else throw Error(pn+e+": "+n);if(e="crypto",o&&(this[e]=Rr[e]),(n=i[e])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[e]=!0;else throw Error(Ka);else this[e]=!1;else throw Error(pn+e+": "+n);return this}function Ll(i){return new this(i).cos()}function Ol(i){return new this(i).cosh()}function Ea(i){var t,e,n;function o(r){var s,a,c,u=this;if(!(u instanceof o))return new o(r);if(u.constructor=o,Ba(r)){u.s=r.s,ie?!r.d||r.e>o.maxE?(u.e=NaN,u.d=null):r.e<o.minE?(u.e=0,u.d=[0]):(u.e=r.e,u.d=r.d.slice()):(u.e=r.e,u.d=r.d?r.d.slice():r.d);return}if(c=typeof r,c==="number"){if(r===0){u.s=1/r<0?-1:1,u.e=0,u.d=[0];return}if(r<0?(r=-r,u.s=-1):u.s=1,r===~~r&&r<1e7){for(s=0,a=r;a>=10;a/=10)s++;ie?s>o.maxE?(u.e=NaN,u.d=null):s<o.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[r]):(u.e=s,u.d=[r]);return}if(r*0!==0){r||(u.s=NaN),u.e=NaN,u.d=null;return}return wi(u,r.toString())}if(c==="string")return(a=r.charCodeAt(0))===45?(r=r.slice(1),u.s=-1):(a===43&&(r=r.slice(1)),u.s=1),La.test(r)?wi(u,r):bl(u,r);if(c==="bigint")return r<0?(r=-r,u.s=-1):u.s=1,wi(u,r.toString());throw Error(pn+r)}if(o.prototype=D,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=Cl,o.clone=Ea,o.isDecimal=Ba,o.abs=gl,o.acos=wl,o.acosh=Al,o.add=kl,o.asin=Pl,o.asinh=hl,o.atan=Tl,o.atanh=Il,o.atan2=Bl,o.cbrt=Sl,o.ceil=xl,o.clamp=Kl,o.cos=Ll,o.cosh=Ol,o.div=Rl,o.exp=Nl,o.floor=Ml,o.hypot=_l,o.ln=El,o.log=vl,o.log10=Dl,o.log2=Vl,o.max=Fl,o.min=Wl,o.mod=ql,o.mul=Ul,o.pow=Gl,o.random=Xl,o.round=Hl,o.sign=Ql,o.sin=zl,o.sinh=Yl,o.sqrt=jl,o.sub=Zl,o.sum=$l,o.tan=Jl,o.tanh=em,o.trunc=tm,i===void 0&&(i={}),i&&i.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)i.hasOwnProperty(e=n[t++])||(i[e]=this[e]);return o.config(i),o}function Rl(i,t){return new this(i).div(t)}function Nl(i){return new this(i).exp()}function Ml(i){return Z(i=new this(i),i.e+1,3)}function _l(){var i,t,e=new this(0);for(ie=!1,i=0;i<arguments.length;)if(t=new this(arguments[i++]),t.d)e.d&&(e=e.plus(t.times(t)));else{if(t.s)return ie=!0,new this(1/0);e=t}return ie=!0,e.sqrt()}function Ba(i){return i instanceof so||i&&i.toStringTag===Ca||!1}function El(i){return new this(i).ln()}function vl(i,t){return new this(i).log(t)}function Vl(i){return new this(i).log(2)}function Dl(i){return new this(i).log(10)}function Fl(){return Na(this,arguments,-1)}function Wl(){return Na(this,arguments,1)}function ql(i,t){return new this(i).mod(t)}function Ul(i,t){return new this(i).mul(t)}function Gl(i,t){return new this(i).pow(t)}function Xl(i){var t,e,n,o,r=0,s=new this(1),a=[];if(i===void 0?i=this.precision:dt(i,1,fn),n=Math.ceil(i/te),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));r<n;)o=t[r],o>=429e7?t[r]=crypto.getRandomValues(new Uint32Array(1))[0]:a[r++]=o%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);r<n;)o=t[r]+(t[r+1]<<8)+(t[r+2]<<16)+((t[r+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(t,r):(a.push(o%1e7),r+=4);r=n/4}else throw Error(Ka);else for(;r<n;)a[r++]=Math.random()*1e7|0;for(n=a[--r],i%=te,n&&i&&(o=Ge(10,te-i),a[r]=(n/o|0)*o);a[r]===0;r--)a.pop();if(r<0)e=0,a=[0];else{for(e=-1;a[0]===0;e-=te)a.shift();for(n=1,o=a[0];o>=10;o/=10)n++;n<te&&(e-=te-n)}return s.e=e,s.d=a,s}function Hl(i){return Z(i=new this(i),i.e+1,this.rounding)}function Ql(i){return i=new this(i),i.d?i.d[0]?i.s:0*i.s:i.s||NaN}function zl(i){return new this(i).sin()}function Yl(i){return new this(i).sinh()}function jl(i){return new this(i).sqrt()}function Zl(i,t){return new this(i).sub(t)}function $l(){var i=0,t=arguments,e=new this(t[i]);for(ie=!1;e.s&&++i<t.length;)e=e.plus(t[i]);return ie=!0,Z(e,this.precision,this.rounding)}function Jl(i){return new this(i).tan()}function em(i){return new this(i).tanh()}function tm(i){return Z(i=new this(i),i.e+1,1)}D[Symbol.for("nodejs.util.inspect.custom")]=D.toString;D[Symbol.toStringTag]="Decimal";var so=D.constructor=Ea(Rr);Ai=new so(Ai);ki=new so(ki);var N=so;import cm from"big.js";import xi from"bn.js";import nm from"toformat";var om=nm,ao=om;import Si from"big.js";import rm from"bn.js";import sm from"decimal.js-light";import uo from"bn.js";var va=9007199254740991;function Y(i){let t=ue("CobaltX_parseBigNumberish");if(i instanceof uo)return i;if(typeof i=="string"){if(i.match(/^-?[0-9]+$/))return new uo(i);t.logWithError(`invalid BigNumberish string: ${i}`)}return typeof i=="number"?(i%1&&t.logWithError(`BigNumberish number underflow: ${i}`),(i>=va||i<=-va)&&t.logWithError(`BigNumberish number overflow: ${i}`),new uo(String(i))):typeof i=="bigint"?new uo(i.toString()):(t.error(`invalid BigNumberish value: ${i}`),new uo(0))}var Bi=ue("module/fraction"),Er=ao(Si),co=ao(sm),am={[0]:co.ROUND_DOWN,[1]:co.ROUND_HALF_UP,[2]:co.ROUND_UP},um={[0]:Si.roundDown,[1]:Si.roundHalfUp,[2]:Si.roundUp},pe=class{constructor(t,e=new rm(1)){this.numerator=Y(t),this.denominator=Y(e)}get quotient(){return this.numerator.div(this.denominator)}invert(){return new pe(this.denominator,this.numerator)}add(t){let e=t instanceof pe?t:new pe(Y(t));return this.denominator.eq(e.denominator)?new pe(this.numerator.add(e.numerator),this.denominator):new pe(this.numerator.mul(e.denominator).add(e.numerator.mul(this.denominator)),this.denominator.mul(e.denominator))}sub(t){let e=t instanceof pe?t:new pe(Y(t));return this.denominator.eq(e.denominator)?new pe(this.numerator.sub(e.numerator),this.denominator):new pe(this.numerator.mul(e.denominator).sub(e.numerator.mul(this.denominator)),this.denominator.mul(e.denominator))}mul(t){let e=t instanceof pe?t:new pe(Y(t));return new pe(this.numerator.mul(e.numerator),this.denominator.mul(e.denominator))}div(t){let e=t instanceof pe?t:new pe(Y(t));return new pe(this.numerator.mul(e.denominator),this.denominator.mul(e.numerator))}toSignificant(t,e={groupSeparator:""},n=1){Number.isInteger(t)||Bi.logWithError(`${t} is not an integer.`),t<=0&&Bi.logWithError(`${t} is not positive.`),co.set({precision:t+1,rounding:am[n]});let o=new co(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return o.toFormat(o.decimalPlaces(),e)}toFixed(t,e={groupSeparator:""},n=1){return Number.isInteger(t)||Bi.logWithError(`${t} is not an integer.`),t<0&&Bi.logWithError(`${t} is negative.`),Er.DP=t,Er.RM=um[n]||1,new Er(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,e)}isZero(){return this.numerator.isZero()}};var lm=ue("CobaltX_amount"),Va=ao(cm);function mm(i,t){let e="0",n="0";if(i.includes(".")){let o=i.split(".");o.length===2?([e,n]=o,n=n.padEnd(t,"0")):lm.logWithError(`invalid number string, num: ${i}`)}else e=i;return[e,n.slice(0,t)||n]}var ye=class extends pe{constructor(e,n,o=!0,r){let s=new xi(0),a=vr.pow(new xi(e.decimals));if(o)s=Y(n);else{let c=new xi(0),u=new xi(0);if(typeof n=="string"||typeof n=="number"||typeof n=="bigint"){let[l,d]=mm(n.toString(),e.decimals);c=Y(l),u=Y(d)}c=c.mul(a),s=c.add(u)}super(s,a);this.logger=ue(r||"TokenAmount"),this.token=e}get raw(){return this.numerator}isZero(){return this.raw.isZero()}gt(e){return this.token.equals(e.token)||this.logger.logWithError("gt token not equals"),this.raw.gt(e.raw)}lt(e){return this.token.equals(e.token)||this.logger.logWithError("lt token not equals"),this.raw.lt(e.raw)}add(e){return this.token.equals(e.token)||this.logger.logWithError("add token not equals"),new ye(this.token,this.raw.add(e.raw))}subtract(e){return this.token.equals(e.token)||this.logger.logWithError("sub token not equals"),new ye(this.token,this.raw.sub(e.raw))}toSignificant(e=this.token.decimals,n,o=0){return super.toSignificant(e,n,o)}toFixed(e=this.token.decimals,n,o=0){return e>this.token.decimals&&this.logger.logWithError("decimals overflow"),super.toFixed(e,n,o)}toExact(e={groupSeparator:""}){return Va.DP=this.token.decimals,new Va(this.numerator.toString()).div(this.denominator.toString()).toFormat(e)}};import{TOKEN_PROGRAM_ID as Da}from"@solana/spl-token";import{PublicKey as pm}from"@solana/web3.js";import{PublicKey as zt}from"@solana/web3.js";var dm={["sooneth"]:{NATIVE_TOKEN_SYMBOL:"ETH",SWAP_HOST:"https://trade-api.cobaltx.io",BASE_HOST:"https://api.cobaltx.io",OWNER_BASE_HOST:"https://api.cobaltx.io",SERVICE_BASE_HOST:"https://api.cobaltx.io",MONITOR_BASE_HOST:"https://api.cobaltx.io",SERVICE_1_BASE_HOST:"https://api.cobaltx.io",ANALYTICS_BASE_HOST:"https://api.cobaltx.io",GITHUB_TOKEN_LIST_URL:"https://raw.githubusercontent.com/cobaltx-io/tokens/main/tokens.json",WSOL_MINT_ADDRESS:"So11111111111111111111111111111111111111112",GITHUB_LOGO_URL:"https://raw.githubusercontent.com/cobaltx-io/tokens/main/logo/So11111111111111111111111111111111111111112.png",LOOKUP_TABLE_CACHE:"6fa5xTGwoYJPMLMXaQ4tQFKMoYvXuvsJFLigMJ9a5QeB",CLMM_PROGRAMM_ID:"2TnjBuwqyBB9to5jURagDT7jLmBPefGRiKL2yh1zPZ4V",BONK_MINT_ADDRESS:"71kRXzJMvSeArtXYNEWa8KAjpRJosdMQ7Dpgy5Jt5zfd",SOL_MINT_ADDRESS:"ERFzpDteGNo8LTDKW1WwVGrkRMmA2y9WZHXNHxMA6BSV",USDC_MINT_ADDRESS:"ExYxyorY2x3h8gLcuypnHFQV3F36rmMkQVn7HHV8mUy9",USDT_MINT_ADDRESS:"742wcXVzkhNuEePAot7L3GvPseh93pvYFPgyHLX8mUy9",FULL_TOKEN_NAME:"Wrapped Ethereum",ETH_MINT_ADDRESS:"71kRXzJMvSeArtXYNEWa8KAjpRJosdMQ7Dpgy5Jt5zfd",WRAPPED_TOKEN_SYMBOL:"WETH",INPUT_MINT_ADDRESS:zt.default.toString(),OUTPUT_MINT_ADDRESS:"742wcXVzkhNuEePAot7L3GvPseh93pvYFPgyHLX8mUy9",POPULAR_TOKENS:{SOL:zt.default.toString(),ETH:"71kRXzJMvSeArtXYNEWa8KAjpRJosdMQ7Dpgy5Jt5zfd",USDC:"ExYxyorY2x3h8gLcuypnHFQV3F36rmMkQVn7HHV8KjtA",USDT:"742wcXVzkhNuEePAot7L3GvPseh93pvYFPgyHLX8mUy9"},WSOL_DECIMALS:9},["svmbnb"]:{NATIVE_TOKEN_SYMBOL:"BNB",SWAP_HOST:"https://trade-api.svmbnb.cobaltx.io",BASE_HOST:"https://api.svmbnb.cobaltx.io",OWNER_BASE_HOST:"https://api.svmbnb.cobaltx.io",SERVICE_BASE_HOST:"https://api.svmbnb.cobaltx.io",MONITOR_BASE_HOST:"https://api.svmbnb.cobaltx.io",SERVICE_1_BASE_HOST:"https://api.svmbnb.cobaltx.io",ANALYTICS_BASE_HOST:"https://api.svmbnb.cobaltx.io",GITHUB_TOKEN_LIST_URL:"https://raw.githubusercontent.com/cobaltx-io/svmbnb-tokens/main/tokens.json",WSOL_MINT_ADDRESS:"So11111111111111111111111111111111111111112",GITHUB_LOGO_URL:"https://raw.githubusercontent.com/cobaltx-io/svmbnb-tokens/main/logo/So11111111111111111111111111111111111111112.svg",LOOKUP_TABLE_CACHE:"GSR5XQGWhpzV9TTduBJR6qPNjYsepMQSGkpaqfrbrW9w",CLMM_PROGRAMM_ID:"6f1b3xyVZbnWMHXBjgW1KPwxmPAgXcRdrvKNn4Nmf1Cn",ETH_MINT_ADDRESS:"H3xpFH1yN5E1zFdAoBrC9Y7m7RfJUeQNLvkHi8kNf9Qu",USDC_MINT_ADDRESS:"5odzAHDpDETYhupMkc6kjiYen3K2nrf8oPmvqmsoNW4L",USDT_MINT_ADDRESS:"s8cRDxnp3VxjB6khRnGDdxv6QbCUPyY9Vn1bgSQQsnG",SOL_MINT_ADDRESS:"So11111111111111111111111111111111111111112",FULL_TOKEN_NAME:"Wrapped BNB",WRAPPED_TOKEN_SYMBOL:"WBNB",INPUT_MINT_ADDRESS:zt.default.toBase58(),OUTPUT_MINT_ADDRESS:"ABoT7umUXnx8RtJTeRqKB6myebVjP2wdJGQuV23jVVH3",POPULAR_TOKENS:{SOL:zt.default.toString(),ETH:"H3xpFH1yN5E1zFdAoBrC9Y7m7RfJUeQNLvkHi8kNf9Qu",USDC:"5odzAHDpDETYhupMkc6kjiYen3K2nrf8oPmvqmsoNW4L",USDT:"s8cRDxnp3VxjB6khRnGDdxv6QbCUPyY9Vn1bgSQQsnG"},WSOL_DECIMALS:9},["svmbnb_testnet"]:{NATIVE_TOKEN_SYMBOL:"BNB",SWAP_HOST:"https://trade-api.svmbnb.cobaltx.io",BASE_HOST:"https://api.testnet.svmbnb.cobaltx.io",OWNER_BASE_HOST:"https://api.testnet.svmbnb.cobaltx.io",SERVICE_BASE_HOST:"https://api.testnet.svmbnb.cobaltx.io",MONITOR_BASE_HOST:"https://api.testnet.svmbnb.cobaltx.io",SERVICE_1_BASE_HOST:"https://api.testnet.svmbnb.cobaltx.io",ANALYTICS_BASE_HOST:"https://api.testnet.svmbnb.coba