UNPKG

@multiversx/sdk-dapp-swap

Version:

A library to hold the main logic for swapping between tokens on the MultiversX blockchain

249 lines (243 loc) 37.1 kB
"use strict";var jr=Object.create;var oe=Object.defineProperty,Kr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptor,Yr=Object.getOwnPropertyDescriptors,Zr=Object.getOwnPropertyNames,pe=Object.getOwnPropertySymbols,Jr=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable;var je=(t,e,r)=>e in t?oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,O=(t,e)=>{for(var r in e||(e={}))Se.call(e,r)&&je(t,r,e[r]);if(pe)for(var r of pe(e))Ke.call(e,r)&&je(t,r,e[r]);return t},j=(t,e)=>Kr(t,Yr(e));var Xe=(t,e)=>{var r={};for(var n in t)Se.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&pe)for(var n of pe(t))e.indexOf(n)<0&&Ke.call(t,n)&&(r[n]=t[n]);return r};var et=(t,e)=>()=>(t&&(e=t(t=0)),e);var ce=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),rt=(t,e)=>{for(var r in e)oe(t,r,{get:e[r],enumerable:!0})},Ye=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zr(e))!Se.call(t,o)&&o!==r&&oe(t,o,{get:()=>e[o],enumerable:!(n=Xr(e,o))||n.enumerable});return t};var U=(t,e,r)=>(r=t!=null?jr(Jr(t)):{},Ye(e||!t||!t.__esModule?oe(r,"default",{value:t,enumerable:!0}):r,t)),tt=t=>Ye(oe({},"__esModule",{value:!0}),t);var ke=(t,e,r)=>new Promise((n,o)=>{var s=l=>{try{m(r.next(l))}catch(y){o(y)}},a=l=>{try{m(r.throw(l))}catch(y){o(y)}},m=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,a);m((r=r.apply(t,e)).next())});var er=ce(fe=>{"use strict";i();fe.byteLength=ot;fe.toByteArray=st;fe.fromByteArray=pt;var C=[],b=[],nt=typeof Uint8Array!="undefined"?Uint8Array:Array,Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(V=0,Ze=Fe.length;V<Ze;++V)C[V]=Fe[V],b[Fe.charCodeAt(V)]=V;var V,Ze;b["-".charCodeAt(0)]=62;b["_".charCodeAt(0)]=63;function Je(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function ot(t){var e=Je(t),r=e[0],n=e[1];return(r+n)*3/4-n}function it(t,e,r){return(e+r)*3/4-r}function st(t){var e,r=Je(t),n=r[0],o=r[1],s=new nt(it(t,n,o)),a=0,m=o>0?n-4:n,l;for(l=0;l<m;l+=4)e=b[t.charCodeAt(l)]<<18|b[t.charCodeAt(l+1)]<<12|b[t.charCodeAt(l+2)]<<6|b[t.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return o===2&&(e=b[t.charCodeAt(l)]<<2|b[t.charCodeAt(l+1)]>>4,s[a++]=e&255),o===1&&(e=b[t.charCodeAt(l)]<<10|b[t.charCodeAt(l+1)]<<4|b[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function at(t){return C[t>>18&63]+C[t>>12&63]+C[t>>6&63]+C[t&63]}function ut(t,e,r){for(var n,o=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),o.push(at(n));return o.join("")}function pt(t){for(var e,r=t.length,n=r%3,o=[],s=16383,a=0,m=r-n;a<m;a+=s)o.push(ut(t,a,a+s>m?m:a+s));return n===1?(e=t[r-1],o.push(C[e>>2]+C[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(C[e>>10]+C[e>>4&63]+C[e<<2&63]+"=")),o.join("")}});var rr=ce(be=>{i();be.read=function(t,e,r,n,o){var s,a,m=o*8-n-1,l=(1<<m)-1,y=l>>1,h=-7,d=r?o-1:0,w=r?-1:1,g=t[e+d];for(d+=w,s=g&(1<<-h)-1,g>>=-h,h+=m;h>0;s=s*256+t[e+d],d+=w,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+t[e+d],d+=w,h-=8);if(s===0)s=1-y;else{if(s===l)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-y}return(g?-1:1)*a*Math.pow(2,s-n)};be.write=function(t,e,r,n,o,s){var a,m,l,y=s*8-o-1,h=(1<<y)-1,d=h>>1,w=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,A=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+d>=1?e+=w/l:e+=w*Math.pow(2,1-d),e*l>=2&&(a++,l/=2),a+d>=h?(m=0,a=h):a+d>=1?(m=(e*l-1)*Math.pow(2,o),a=a+d):(m=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+g]=m&255,g+=A,m/=256,o-=8);for(a=a<<o|m,y+=o;y>0;t[r+g]=a&255,g+=A,a/=256,y-=8);t[r+g-A]|=E*128}});var hr=ce(X=>{"use strict";i();var De=er(),K=rr(),tr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;X.Buffer=u;X.SlowBuffer=dt;X.INSPECT_MAX_BYTES=50;var le=2147483647;X.kMaxLength=le;u.TYPED_ARRAY_SUPPORT=ct();!u.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ct(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(r){return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.buffer}});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.byteOffset}});function $(t){if(t>le)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ve(t)}return ir(t,e,r)}u.poolSize=8192;function ir(t,e,r){if(typeof t=="string")return lt(t,e);if(ArrayBuffer.isView(t))return mt(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(R(t,ArrayBuffer)||t&&R(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(R(t,SharedArrayBuffer)||t&&R(t.buffer,SharedArrayBuffer)))return Ue(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return u.from(n,e,r);var o=ht(t);if(o)return o;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}u.from=function(t,e,r){return ir(t,e,r)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function sr(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function ft(t,e,r){return sr(t),t<=0?$(t):e!==void 0?typeof r=="string"?$(t).fill(e,r):$(t).fill(e):$(t)}u.alloc=function(t,e,r){return ft(t,e,r)};function ve(t){return sr(t),$(t<0?0:Oe(t)|0)}u.allocUnsafe=function(t){return ve(t)};u.allocUnsafeSlow=function(t){return ve(t)};function lt(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=ar(t,e)|0,n=$(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function Pe(t){for(var e=t.length<0?0:Oe(t.length)|0,r=$(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function mt(t){if(R(t,Uint8Array)){var e=new Uint8Array(t);return Ue(e.buffer,e.byteOffset,e.byteLength)}return Pe(t)}function Ue(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function ht(t){if(u.isBuffer(t)){var e=Oe(t.length)|0,r=$(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Ce(t.length)?$(0):Pe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Pe(t.data)}function Oe(t){if(t>=le)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+le.toString(16)+" bytes");return t|0}function dt(t){return+t!=t&&(t=0),u.alloc(+t)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype};u.compare=function(e,r){if(R(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),R(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(e)||!u.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,o=r.length,s=0,a=Math.min(n,o);s<a;++s)if(e[s]!==r[s]){n=e[s],o=r[s];break}return n<o?-1:o<n?1:0};u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return u.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var o=u.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){var a=e[n];if(R(a,Uint8Array))s+a.length>o.length?u.from(a).copy(o,s):Uint8Array.prototype.set.call(o,a,s);else if(u.isBuffer(a))a.copy(o,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return o};function ar(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||R(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Be(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return mr(t).length;default:if(o)return n?-1:Be(t).length;e=(""+e).toLowerCase(),o=!0}}u.byteLength=ar;function yt(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ft(this,e,r);case"utf8":case"utf-8":return pr(this,e,r);case"ascii":return St(this,e,r);case"latin1":case"binary":return kt(this,e,r);case"base64":return Et(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bt(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function z(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}u.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)z(this,r,r+1);return this};u.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)z(this,r,r+3),z(this,r+1,r+2);return this};u.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)z(this,r,r+7),z(this,r+1,r+6),z(this,r+2,r+5),z(this,r+3,r+4);return this};u.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?pr(this,0,e):yt.apply(this,arguments)};u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:u.compare(this,e)===0};u.prototype.inspect=function(){var e="",r=X.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};tr&&(u.prototype[tr]=u.prototype.inspect);u.prototype.compare=function(e,r,n,o,s){if(R(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),s===void 0&&(s=this.length),r<0||n>e.length||o<0||s>this.length)throw new RangeError("out of range index");if(o>=s&&r>=n)return 0;if(o>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,s>>>=0,this===e)return 0;for(var a=s-o,m=n-r,l=Math.min(a,m),y=this.slice(o,s),h=e.slice(r,n),d=0;d<l;++d)if(y[d]!==h[d]){a=y[d],m=h[d];break}return a<m?-1:m<a?1:0};function ur(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ce(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=u.from(e,n)),u.isBuffer(e))return e.length===0?-1:nr(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):nr(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function nr(t,e,r,n,o){var s=1,a=t.length,m=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,m/=2,r/=2}function l(g,A){return s===1?g[A]:g.readUInt16BE(A*s)}var y;if(o){var h=-1;for(y=r;y<a;y++)if(l(t,y)===l(e,h===-1?0:y-h)){if(h===-1&&(h=y),y-h+1===m)return h*s}else h!==-1&&(y-=y-h),h=-1}else for(r+m>a&&(r=a-m),y=r;y>=0;y--){for(var d=!0,w=0;w<m;w++)if(l(t,y+w)!==l(e,w)){d=!1;break}if(d)return y}return-1}u.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};u.prototype.indexOf=function(e,r,n){return ur(this,e,r,n,!0)};u.prototype.lastIndexOf=function(e,r,n){return ur(this,e,r,n,!1)};function Tt(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var s=e.length;n>s/2&&(n=s/2);for(var a=0;a<n;++a){var m=parseInt(e.substr(a*2,2),16);if(Ce(m))return a;t[r+a]=m}return a}function gt(t,e,r,n){return me(Be(e,t.length-r),t,r,n)}function xt(t,e,r,n){return me(Ut(e),t,r,n)}function wt(t,e,r,n){return me(mr(e),t,r,n)}function It(t,e,r,n){return me(Bt(e,t.length-r),t,r,n)}u.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var a=!1;;)switch(o){case"hex":return Tt(this,e,r,n);case"utf8":case"utf-8":return gt(this,e,r,n);case"ascii":case"latin1":case"binary":return xt(this,e,r,n);case"base64":return wt(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return It(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Et(t,e,r){return e===0&&r===t.length?De.fromByteArray(t):De.fromByteArray(t.slice(e,r))}function pr(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var s=t[o],a=null,m=s>239?4:s>223?3:s>191?2:1;if(o+m<=r){var l,y,h,d;switch(m){case 1:s<128&&(a=s);break;case 2:l=t[o+1],(l&192)===128&&(d=(s&31)<<6|l&63,d>127&&(a=d));break;case 3:l=t[o+1],y=t[o+2],(l&192)===128&&(y&192)===128&&(d=(s&15)<<12|(l&63)<<6|y&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:l=t[o+1],y=t[o+2],h=t[o+3],(l&192)===128&&(y&192)===128&&(h&192)===128&&(d=(s&15)<<18|(l&63)<<12|(y&63)<<6|h&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,m=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=m}return At(n)}var or=4096;function At(t){var e=t.length;if(e<=or)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=or));return r}function St(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function kt(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function Ft(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",s=e;s<r;++s)o+=vt[t[s]];return o}function bt(t,e,r){for(var n=t.slice(e,r),o="",s=0;s<n.length-1;s+=2)o+=String.fromCharCode(n[s]+n[s+1]*256);return o}u.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var o=this.subarray(e,r);return Object.setPrototypeOf(o,u.prototype),o};function I(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||I(e,r,this.length);for(var o=this[e],s=1,a=0;++a<r&&(s*=256);)o+=this[e+a]*s;return o};u.prototype.readUintBE=u.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||I(e,r,this.length);for(var o=this[e+--r],s=1;r>0&&(s*=256);)o+=this[e+--r]*s;return o};u.prototype.readUint8=u.prototype.readUInt8=function(e,r){return e=e>>>0,r||I(e,1,this.length),this[e]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||I(e,2,this.length),this[e]|this[e+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||I(e,2,this.length),this[e]<<8|this[e+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};u.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||I(e,r,this.length);for(var o=this[e],s=1,a=0;++a<r&&(s*=256);)o+=this[e+a]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};u.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||I(e,r,this.length);for(var o=r,s=1,a=this[e+--o];o>0&&(s*=256);)a+=this[e+--o]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a};u.prototype.readInt8=function(e,r){return e=e>>>0,r||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};u.prototype.readInt16LE=function(e,r){e=e>>>0,r||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(e,r){e=e>>>0,r||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(e,r){return e=e>>>0,r||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};u.prototype.readInt32BE=function(e,r){return e=e>>>0,r||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};u.prototype.readFloatLE=function(e,r){return e=e>>>0,r||I(e,4,this.length),K.read(this,e,!0,23,4)};u.prototype.readFloatBE=function(e,r){return e=e>>>0,r||I(e,4,this.length),K.read(this,e,!1,23,4)};u.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||I(e,8,this.length),K.read(this,e,!0,52,8)};u.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||I(e,8,this.length),K.read(this,e,!1,52,8)};function S(t,e,r,n,o,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var s=Math.pow(2,8*n)-1;S(this,e,r,n,s,0)}var a=1,m=0;for(this[r]=e&255;++m<n&&(a*=256);)this[r+m]=e/a&255;return r+n};u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var s=Math.pow(2,8*n)-1;S(this,e,r,n,s,0)}var a=n-1,m=1;for(this[r+a]=e&255;--a>=0&&(m*=256);)this[r+a]=e/m&255;return r+n};u.prototype.writeUint8=u.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,1,255,0),this[r]=e&255,r+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};u.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){var s=Math.pow(2,8*n-1);S(this,e,r,n,s-1,-s)}var a=0,m=1,l=0;for(this[r]=e&255;++a<n&&(m*=256);)e<0&&l===0&&this[r+a-1]!==0&&(l=1),this[r+a]=(e/m>>0)-l&255;return r+n};u.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){var s=Math.pow(2,8*n-1);S(this,e,r,n,s-1,-s)}var a=n-1,m=1,l=0;for(this[r+a]=e&255;--a>=0&&(m*=256);)e<0&&l===0&&this[r+a+1]!==0&&(l=1),this[r+a]=(e/m>>0)-l&255;return r+n};u.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};u.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};u.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};u.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};u.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||S(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function cr(t,e,r,n,o,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function fr(t,e,r,n,o){return e=+e,r=r>>>0,o||cr(t,e,r,4,34028234663852886e22,-34028234663852886e22),K.write(t,e,r,n,23,4),r+4}u.prototype.writeFloatLE=function(e,r,n){return fr(this,e,r,!0,n)};u.prototype.writeFloatBE=function(e,r,n){return fr(this,e,r,!1,n)};function lr(t,e,r,n,o){return e=+e,r=r>>>0,o||cr(t,e,r,8,17976931348623157e292,-17976931348623157e292),K.write(t,e,r,n,52,8),r+8}u.prototype.writeDoubleLE=function(e,r,n){return lr(this,e,r,!0,n)};u.prototype.writeDoubleBE=function(e,r,n){return lr(this,e,r,!1,n)};u.prototype.copy=function(e,r,n,o){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);var s=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),s};u.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){var s=e.charCodeAt(0);(o==="utf8"&&s<128||o==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var m=u.isBuffer(e)?e:u.from(e,o),l=m.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=m[a%l]}return this};var Dt=/[^+/0-9A-Za-z-_]/g;function Pt(t){if(t=t.split("=")[0],t=t.trim().replace(Dt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Be(t,e){e=e||1/0;for(var r,n=t.length,o=null,s=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&s.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&s.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Ut(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Bt(t,e){for(var r,n,o,s=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,s.push(o),s.push(n);return s}function mr(t){return De.toByteArray(Pt(t))}function me(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function R(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ce(t){return t!==t}var vt=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()});var xr=ce((xn,gr)=>{i();var T=gr.exports={},L,N;function Re(){throw new Error("setTimeout has not been defined")}function Le(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?L=setTimeout:L=Re}catch(t){L=Re}try{typeof clearTimeout=="function"?N=clearTimeout:N=Le}catch(t){N=Le}})();function dr(t){if(L===setTimeout)return setTimeout(t,0);if((L===Re||!L)&&setTimeout)return L=setTimeout,setTimeout(t,0);try{return L(t,0)}catch(e){try{return L.call(null,t,0)}catch(r){return L.call(this,t,0)}}}function Ot(t){if(N===clearTimeout)return clearTimeout(t);if((N===Le||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(t);try{return N(t)}catch(e){try{return N.call(null,t)}catch(r){return N.call(this,t)}}}var M=[],Y=!1,q,he=-1;function Ct(){!Y||!q||(Y=!1,q.length?M=q.concat(M):he=-1,M.length&&yr())}function yr(){if(!Y){var t=dr(Ct);Y=!0;for(var e=M.length;e;){for(q=M,M=[];++he<e;)q&&q[he].run();he=-1,e=M.length}q=null,Y=!1,Ot(t)}}T.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];M.push(new Tr(t,e)),M.length===1&&!Y&&dr(yr)};function Tr(t,e){this.fun=t,this.array=e}Tr.prototype.run=function(){this.fun.apply(null,this.array)};T.title="browser";T.browser=!0;T.env={};T.argv=[];T.version="";T.versions={};function G(){}T.on=G;T.addListener=G;T.once=G;T.off=G;T.removeListener=G;T.removeAllListeners=G;T.emit=G;T.prependListener=G;T.prependOnceListener=G;T.listeners=function(t){return[]};T.binding=function(t){throw new Error("process.binding is not supported")};T.cwd=function(){return"/"};T.chdir=function(t){throw new Error("process.chdir is not supported")};T.umask=function(){return 0}});var p,c,wn,i=et(()=>{p=U(hr()),c=U(xr()),wn=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object)});var hn={};rt(hn,{useTokens:()=>mn});module.exports=tt(hn);i();var re=require("react");i();i();var Rt=U(require("react")),ye=require("@apollo/client"),Lt=require("@apollo/client/link/context"),Nt=require("@apollo/client/link/error"),_t=require("graphql");i();i();var de=require("react"),wr=(0,de.createContext)({accessToken:"",isAuthenticated:!1}),B=()=>{let t=(0,de.useContext)(wr);if(t==null)throw new Error("useAuthorizationContext must be used within a AuthorizationProvider");return t};i();i();i();var k=` balance decimals name identifier ticker owner assets { website description status pngUrl svgUrl } price type previous24hPrice previous7dPrice `;i();i();i();var Te=` assets { website description status pngUrl svgUrl } decimals name collection ticker `;var Ir=` address lockedToken { ${Te} } lpProxyToken { ${Te} } farmProxyToken { ${Te} } intermediatedPairs intermediatedFarms `;var Er=` address firstToken { ${k} } secondToken { ${k} } type feesAPR totalFeePercent specialFeePercent lockedTokensInfo { lockingSC { ${Ir} } unlockEpoch } `;i();var Z=` value receiver gasPrice gasLimit data chainID version `;i();var ie=` defaultSlippage slippageValues minSlippage maxSlippage minSwapAmount `;i();var $t=` __typename valueUSD `,Ne=` ${k} ${$t} `;i();i();var _e=require("@apollo/client");var $e="TRANSACTIONS_PLACEHOLDER",Mt=` transactions { ${Z} } `,Ar=` query swapPackageSwapRoute ( $amountIn: String $amountOut: String $tokenInID: String! $tokenOutID: String! $tolerance: Float! ) { swap( amountIn: $amountIn amountOut: $amountOut tokenInID: $tokenInID tokenOutID: $tokenOutID tolerance: $tolerance ) { amountIn tokenInID tokenInPriceUSD tokenInExchangeRateDenom amountOut tokenOutID tokenOutPriceUSD tokenOutExchangeRateDenom fees swapType tokenRoute pricesImpact maxPriceDeviationPercent tokensPriceDeviationPercent intermediaryAmounts pairs { ${Er} } ${$e} } } `,Gt=_e.gql` ${Ar.replace($e,Mt)} `,Qt=_e.gql` ${Ar.replace($e,"")} `;i();i();var se=require("@apollo/client");var Sr=se.gql` query swapPackageTokens ($identifiers: [String!], $enabledSwaps: Boolean) { tokens(identifiers: $identifiers, enabledSwaps: $enabledSwaps) { ${k} } wrappingInfo { wrappedToken { ${k} } } factory { ${ie} } } `,Wt=se.gql` query swapPackageFilteredTokens ($enabledSwaps: Boolean, $pagination: ConnectionArgs, $searchInput: String, $identifiers: [String!]) { filteredTokens (pagination: $pagination, filters: {searchToken: $searchInput, enabledSwaps: $enabledSwaps, identifiers: $identifiers}) { edges { node { ${k} } cursor } pageInfo { hasNextPage } pageData { count } } wrappingInfo { wrappedToken { ${k} } } factory { ${ie} } } `,kr=se.gql` query swapPackageTokensWithBalance ($identifiers: [String!], $offset: Int, $limit: Int, $enabledSwaps: Boolean) { tokens(identifiers: $identifiers, enabledSwaps: $enabledSwaps) { ${k} } userTokens (offset: $offset, limit: $limit) { ${Ne} } wrappingInfo { wrappedToken { ${k} } } factory { ${ie} } } `,Vt=se.gql` query swapPackageFilteredTokensWithBalance ($identifiers: [String!], $pagination: ConnectionArgs, $searchInput: String, $offset: Int, $limit: Int, $enabledSwaps: Boolean) { filteredTokens (pagination: $pagination, filters: {searchToken: $searchInput, enabledSwaps: $enabledSwaps, identifiers: $identifiers}) { edges { node { ${k} } cursor } pageInfo { hasNextPage } pageData { count } } userTokens (offset: $offset, limit: $limit) { ${Ne} } wrappingInfo { wrappedToken { ${k} } } factory { ${ie} } } `;i();i();var Fr=require("@apollo/client");var br=Fr.gql` query swapPackageWrapEgld ($wrappingAmount: String!) { wrapEgld(amount: $wrappingAmount) { ${Z} } } `;i();var Dr=require("@apollo/client");var Pr=Dr.gql` query swapPackageUnwrapEgld ($wrappingAmount: String!) { unwrapEgld(amount: $wrappingAmount) { ${Z} } } `;i();i();var Ur=require("@apollo/client"),zt=Ur.gql` query swapPackageMaintenance { factory { maintenance } } `;i();i();var jt=U(require("bignumber.js"));i();i();var J="EGLD";i();i();var F=require("@multiversx/sdk-core");i();i();var D=require("@multiversx/sdk-dapp/out/constants");i();var qt=require("@multiversx/sdk-dapp/out/types/enums.types");i();var Br=require("@multiversx/sdk-dapp/out/utils/decoders/base64Utils");i();var vr=require("@multiversx/sdk-dapp/out/store/store"),Or=require("@multiversx/sdk-dapp/out/store/selectors/accountSelectors");i();var Me=require("@multiversx/sdk-dapp-utils/out/constants"),ge=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount"),xe=require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount"),Ge=require("@multiversx/sdk-dapp-utils/out/helpers/stringIsFloat"),Cr=require("@multiversx/sdk-dapp-utils/out/helpers/stringIsInteger");i();i();i();i();i();var Kt=U(require("bignumber.js"));i();i();i();i();i();i();i();i();i();i();i();i();i();i();i();var Xt=U(require("bignumber.js"));i();i();var Yt=U(require("bignumber.js"));i();var Lr=U(require("bignumber.js"));var Qe=({tokens:t,wrappedEgld:e})=>t.sort((r,n)=>r.identifier===J?-1:n.identifier===J?1:r.identifier===(e==null?void 0:e.identifier)?-1:n.identifier===(e==null?void 0:e.identifier)?1:new Lr.default(n.valueUSD).minus(r.valueUSD).toNumber());i();var Zt=U(require("bignumber.js"));i();i();var Vr=require("@apollo/client");i();i();i();var we=require("react");var ae=({query:t,queryOptions:e})=>{let{client:r}=B(),[n,o]=(0,we.useState)(),[s,a]=(0,we.useState)(),[m,l]=(0,we.useState)();return{isLoading:n,isError:s,error:m,execute:h=>ke(void 0,null,function*(){var g,A;let d=(g=h==null?void 0:h.onCompleted)!=null?g:e==null?void 0:e.onCompleted,w=(A=h==null?void 0:h.variables)!=null?A:e==null?void 0:e.variables;try{o(!0);let E=yield r==null?void 0:r.query({query:t,variables:w}),W=E==null?void 0:E.data,_=E==null?void 0:E.errors;return _&&_.length>0&&(a(!0),l(_[0].message)),W&&(a(!1),l(void 0),d==null||d(W)),o(!1),W}catch(E){o(!1),a(!0),console.error(E);return}})}};i();var We=require("react"),en=U(require("bignumber.js"));i();var _r=require("react");i();var Ee=require("react");i();var ue=require("react"),$r=require("@apollo/client");var Ie=({query:t,queryOptions:e,refetchTrigger:r,isPollingEnabled:n=!1,isRefetchEnabled:o=!1})=>{let s=Mr(),{client:a}=B(),P=(0,$r.useQuery)(t,O({client:a,notifyOnNetworkStatusChange:!0,fetchPolicy:"no-cache",nextFetchPolicy:"no-cache"},e)),{error:m,loading:l,previousData:y,data:h=y,refetch:d,stopPolling:w,startPolling:g}=P,A=Xe(P,["error","loading","previousData","data","refetch","stopPolling","startPolling"]),E=(0,ue.useCallback)(()=>{s&&n&&!m?g(6e3):w()},[s,n,m,e]);(0,ue.useEffect)(()=>(E(),()=>{w()}),[E]),(0,ue.useEffect)(()=>{!o||r===0||(d(),E())},[r,o]);let W=h==null&&l,_=Boolean(m);return O({data:_?void 0:h,error:m,isError:_,isLoading:W,isRefetching:l,refetch:d},A)};i();i();var ee=require("react"),Gr=()=>typeof document===void 0?!0:document.visibilityState==="visible",Mr=()=>{let[t,e]=(0,ee.useState)(Gr()),r=(0,ee.useCallback)(()=>{e(Gr())},[e]);return(0,ee.useEffect)(()=>{if(typeof document!==void 0)return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},[r]),t};i();var Ae=require("react");i();var nn=require("react");i();var Wr=require("react");i();var on=require("react"),sn=U(require("bignumber.js"));i();var Qr=require("react");i();var an=require("react");var Ve=({skip:t=!1,isPollingEnabled:e=!1})=>{let r=Vr.gql` query swapPackageTokenPrices { tokens(enabledSwaps: true) { price identifier } } `,{data:n,isError:o,isLoading:s}=Ie({isPollingEnabled:e,query:r,queryOptions:{skip:t}});return{tokenPrices:n==null?void 0:n.tokens,isTokenPricesError:o,isTokenPricesLoading:s}};var un=0,pn=500,cn=!0,fn=!1,ln=[],mn=t=>{var _;let{client:e,isAuthenticated:r}=B();if(!e)throw new Error("Swap GraphQL client not initialized");let n=(_=t==null?void 0:t.pricePolling)!=null?_:fn,[o,s]=(0,re.useState)([]),[a,m]=(0,re.useState)(),[l,y]=(0,re.useState)(),{tokenPrices:h}=Ve({isPollingEnabled:n}),d=x=>{if(!x)return;let{tokens:P,wrappingInfo:v,userTokens:Q,factory:te}=x;te&&y(te);let ne=v&&v.length?v[0].wrappedToken:void 0;if(m(ne),!P){s([]);return}let zr=P.map(ze=>{var qe,He;let H=Q==null?void 0:Q.find(({identifier:Hr})=>Hr===ze.identifier);return j(O({},ze),{balance:(qe=H==null?void 0:H.balance)!=null?qe:"0",valueUSD:(He=H==null?void 0:H.valueUSD)!=null?He:"0"})}),qr=Qe({tokens:zr,wrappedEgld:ne});s(qr)},{isError:w,isLoading:g,execute:A}=ae({query:r?kr:Sr,queryOptions:{client:e,onCompleted:d}}),E=x=>{var v,Q,te,ne;let P={limit:(v=x==null?void 0:x.limit)!=null?v:pn,offset:(Q=x==null?void 0:x.offset)!=null?Q:un,identifiers:(te=x==null?void 0:x.identifiers)!=null?te:ln,enabledSwaps:(ne=x==null?void 0:x.enabledSwaps)!=null?ne:cn};A({variables:P})},W=(0,re.useMemo)(()=>o.map(x=>{var v;let P=(v=h==null?void 0:h.find(({identifier:Q})=>Q===x.identifier))==null?void 0:v.price;return j(O({},x),{price:P!=null?P:x.price})}),[o,h]);return{swapConfig:l,wrappedEgld:a,isTokensError:w,isTokensLoading:g,tokens:W,getTokens:E,refetch:A}};0&&(module.exports={useTokens}); /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ //# sourceMappingURL=useTokens.js.map