UNPKG

@sofaws/dapp-core

Version:

A library to hold the main logic for a dapp on the Elrond Network

1 lines 209 kB
"use strict";var zc=Object.create;var So=Object.defineProperty,jc=Object.defineProperties,qc=Object.getOwnPropertyDescriptor,Kc=Object.getOwnPropertyDescriptors,Xc=Object.getOwnPropertyNames,Ko=Object.getOwnPropertySymbols,Zc=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty,br=Object.prototype.propertyIsEnumerable;var xr=(e,o,n)=>o in e?So(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,f=(e,o)=>{for(var n in o||(o={}))qn.call(o,n)&&xr(e,n,o[n]);if(Ko)for(var n of Ko(o))br.call(o,n)&&xr(e,n,o[n]);return e},w=(e,o)=>jc(e,Kc(o));var Ue=(e,o)=>{var n={};for(var r in e)qn.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ko)for(var r of Ko(e))o.indexOf(r)<0&&br.call(e,r)&&(n[r]=e[r]);return n};var b=(e,o)=>()=>(e&&(o=e(e=0)),o);var Xo=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports),We=(e,o)=>{for(var n in o)So(e,n,{get:o[n],enumerable:!0})},wr=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of Xc(o))!qn.call(e,a)&&a!==n&&So(e,a,{get:()=>o[a],enumerable:!(r=qc(o,a))||r.enumerable});return e};var g=(e,o,n)=>(n=e!=null?zc(Zc(e)):{},wr(o||!e||!e.__esModule?So(n,"default",{value:e,enumerable:!0}):n,e)),vo=e=>wr(So({},"__esModule",{value:!0}),e);var v=(e,o,n)=>new Promise((r,a)=>{var p=l=>{try{_(n.next(l))}catch(u){a(u)}},m=l=>{try{_(n.throw(l))}catch(u){a(u)}},_=l=>l.done?r(l.value):Promise.resolve(l.value).then(p,m);_((n=n.apply(e,o)).next())});var kr=Xo(Zo=>{"use strict";t();Zo.byteLength=Jc;Zo.toByteArray=ep;Zo.fromByteArray=tp;var me=[],J=[],Yc=typeof Uint8Array!="undefined"?Uint8Array:Array,Kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ge=0,Sr=Kn.length;Ge<Sr;++Ge)me[Ge]=Kn[Ge],J[Kn.charCodeAt(Ge)]=Ge;var Ge,Sr;J["-".charCodeAt(0)]=62;J["_".charCodeAt(0)]=63;function vr(e){var o=e.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=o);var r=n===o?0:4-n%4;return[n,r]}function Jc(e){var o=vr(e),n=o[0],r=o[1];return(n+r)*3/4-r}function Qc(e,o,n){return(o+n)*3/4-n}function ep(e){var o,n=vr(e),r=n[0],a=n[1],p=new Yc(Qc(e,r,a)),m=0,_=a>0?r-4:r,l;for(l=0;l<_;l+=4)o=J[e.charCodeAt(l)]<<18|J[e.charCodeAt(l+1)]<<12|J[e.charCodeAt(l+2)]<<6|J[e.charCodeAt(l+3)],p[m++]=o>>16&255,p[m++]=o>>8&255,p[m++]=o&255;return a===2&&(o=J[e.charCodeAt(l)]<<2|J[e.charCodeAt(l+1)]>>4,p[m++]=o&255),a===1&&(o=J[e.charCodeAt(l)]<<10|J[e.charCodeAt(l+1)]<<4|J[e.charCodeAt(l+2)]>>2,p[m++]=o>>8&255,p[m++]=o&255),p}function op(e){return me[e>>18&63]+me[e>>12&63]+me[e>>6&63]+me[e&63]}function np(e,o,n){for(var r,a=[],p=o;p<n;p+=3)r=(e[p]<<16&16711680)+(e[p+1]<<8&65280)+(e[p+2]&255),a.push(op(r));return a.join("")}function tp(e){for(var o,n=e.length,r=n%3,a=[],p=16383,m=0,_=n-r;m<_;m+=p)a.push(np(e,m,m+p>_?_:m+p));return r===1?(o=e[n-1],a.push(me[o>>2]+me[o<<4&63]+"==")):r===2&&(o=(e[n-2]<<8)+e[n-1],a.push(me[o>>10]+me[o>>4&63]+me[o<<2&63]+"=")),a.join("")}});var Ar=Xo(Xn=>{t();Xn.read=function(e,o,n,r,a){var p,m,_=a*8-r-1,l=(1<<_)-1,u=l>>1,T=-7,h=n?a-1:0,x=n?-1:1,k=e[o+h];for(h+=x,p=k&(1<<-T)-1,k>>=-T,T+=_;T>0;p=p*256+e[o+h],h+=x,T-=8);for(m=p&(1<<-T)-1,p>>=-T,T+=r;T>0;m=m*256+e[o+h],h+=x,T-=8);if(p===0)p=1-u;else{if(p===l)return m?NaN:(k?-1:1)*(1/0);m=m+Math.pow(2,r),p=p-u}return(k?-1:1)*m*Math.pow(2,p-r)};Xn.write=function(e,o,n,r,a,p){var m,_,l,u=p*8-a-1,T=(1<<u)-1,h=T>>1,x=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=r?0:p-1,N=r?1:-1,R=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(_=isNaN(o)?1:0,m=T):(m=Math.floor(Math.log(o)/Math.LN2),o*(l=Math.pow(2,-m))<1&&(m--,l*=2),m+h>=1?o+=x/l:o+=x*Math.pow(2,1-h),o*l>=2&&(m++,l/=2),m+h>=T?(_=0,m=T):m+h>=1?(_=(o*l-1)*Math.pow(2,a),m=m+h):(_=o*Math.pow(2,h-1)*Math.pow(2,a),m=0));a>=8;e[n+k]=_&255,k+=N,_/=256,a-=8);for(m=m<<a|_,u+=a;u>0;e[n+k]=m&255,k+=N,m/=256,u-=8);e[n+k-N]|=R*128}});var Ur=Xo(no=>{"use strict";t();var Zn=kr(),oo=Ar(),Ir=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;no.Buffer=d;no.SlowBuffer=pp;no.INSPECT_MAX_BYTES=50;var Yo=2147483647;no.kMaxLength=Yo;d.TYPED_ARRAY_SUPPORT=rp();!d.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 rp(){try{var e=new Uint8Array(1),o={foo:function(){return 42}};return Object.setPrototypeOf(o,Uint8Array.prototype),Object.setPrototypeOf(e,o),e.foo()===42}catch(n){return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(!!d.isBuffer(this))return this.buffer}});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(!!d.isBuffer(this))return this.byteOffset}});function xe(e){if(e>Yo)throw new RangeError('The value "'+e+'" is invalid for option "size"');var o=new Uint8Array(e);return Object.setPrototypeOf(o,d.prototype),o}function d(e,o,n){if(typeof e=="number"){if(typeof o=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return et(e)}return Lr(e,o,n)}d.poolSize=8192;function Lr(e,o,n){if(typeof e=="string")return ip(e,o);if(ArrayBuffer.isView(e))return sp(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(_e(e,ArrayBuffer)||e&&_e(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(_e(e,SharedArrayBuffer)||e&&_e(e.buffer,SharedArrayBuffer)))return Jn(e,o,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,o,n);var a=cp(e);if(a)return a;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return d.from(e[Symbol.toPrimitive]("string"),o,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}d.from=function(e,o,n){return Lr(e,o,n)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function Nr(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function ap(e,o,n){return Nr(e),e<=0?xe(e):o!==void 0?typeof n=="string"?xe(e).fill(o,n):xe(e).fill(o):xe(e)}d.alloc=function(e,o,n){return ap(e,o,n)};function et(e){return Nr(e),xe(e<0?0:ot(e)|0)}d.allocUnsafe=function(e){return et(e)};d.allocUnsafeSlow=function(e){return et(e)};function ip(e,o){if((typeof o!="string"||o==="")&&(o="utf8"),!d.isEncoding(o))throw new TypeError("Unknown encoding: "+o);var n=Dr(e,o)|0,r=xe(n),a=r.write(e,o);return a!==n&&(r=r.slice(0,a)),r}function Yn(e){for(var o=e.length<0?0:ot(e.length)|0,n=xe(o),r=0;r<o;r+=1)n[r]=e[r]&255;return n}function sp(e){if(_e(e,Uint8Array)){var o=new Uint8Array(e);return Jn(o.buffer,o.byteOffset,o.byteLength)}return Yn(e)}function Jn(e,o,n){if(o<0||e.byteLength<o)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<o+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return o===void 0&&n===void 0?r=new Uint8Array(e):n===void 0?r=new Uint8Array(e,o):r=new Uint8Array(e,o,n),Object.setPrototypeOf(r,d.prototype),r}function cp(e){if(d.isBuffer(e)){var o=ot(e.length)|0,n=xe(o);return n.length===0||e.copy(n,0,0,o),n}if(e.length!==void 0)return typeof e.length!="number"||nt(e.length)?xe(0):Yn(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Yn(e.data)}function ot(e){if(e>=Yo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yo.toString(16)+" bytes");return e|0}function pp(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==d.prototype};d.compare=function(o,n){if(_e(o,Uint8Array)&&(o=d.from(o,o.offset,o.byteLength)),_e(n,Uint8Array)&&(n=d.from(n,n.offset,n.byteLength)),!d.isBuffer(o)||!d.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===n)return 0;for(var r=o.length,a=n.length,p=0,m=Math.min(r,a);p<m;++p)if(o[p]!==n[p]){r=o[p],a=n[p];break}return r<a?-1:a<r?1:0};d.isEncoding=function(o){switch(String(o).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}};d.concat=function(o,n){if(!Array.isArray(o))throw new TypeError('"list" argument must be an Array of Buffers');if(o.length===0)return d.alloc(0);var r;if(n===void 0)for(n=0,r=0;r<o.length;++r)n+=o[r].length;var a=d.allocUnsafe(n),p=0;for(r=0;r<o.length;++r){var m=o[r];if(_e(m,Uint8Array))p+m.length>a.length?d.from(m).copy(a,p):Uint8Array.prototype.set.call(a,m,p);else if(d.isBuffer(m))m.copy(a,p);else throw new TypeError('"list" argument must be an Array of Buffers');p+=m.length}return a};function Dr(e,o){if(d.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||_e(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;for(var a=!1;;)switch(o){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Qn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Br(e).length;default:if(a)return r?-1:Qn(e).length;o=(""+o).toLowerCase(),a=!0}}d.byteLength=Dr;function mp(e,o,n){var r=!1;if((o===void 0||o<0)&&(o=0),o>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,o>>>=0,n<=o))return"";for(e||(e="utf8");;)switch(e){case"hex":return xp(this,o,n);case"utf8":case"utf-8":return Rr(this,o,n);case"ascii":return hp(this,o,n);case"latin1":case"binary":return yp(this,o,n);case"base64":return fp(this,o,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bp(this,o,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function Ve(e,o,n){var r=e[o];e[o]=e[n],e[n]=r}d.prototype.swap16=function(){var o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<o;n+=2)Ve(this,n,n+1);return this};d.prototype.swap32=function(){var o=this.length;if(o%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<o;n+=4)Ve(this,n,n+3),Ve(this,n+1,n+2);return this};d.prototype.swap64=function(){var o=this.length;if(o%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<o;n+=8)Ve(this,n,n+7),Ve(this,n+1,n+6),Ve(this,n+2,n+5),Ve(this,n+3,n+4);return this};d.prototype.toString=function(){var o=this.length;return o===0?"":arguments.length===0?Rr(this,0,o):mp.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(o){if(!d.isBuffer(o))throw new TypeError("Argument must be a Buffer");return this===o?!0:d.compare(this,o)===0};d.prototype.inspect=function(){var o="",n=no.INSPECT_MAX_BYTES;return o=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(o+=" ... "),"<Buffer "+o+">"};Ir&&(d.prototype[Ir]=d.prototype.inspect);d.prototype.compare=function(o,n,r,a,p){if(_e(o,Uint8Array)&&(o=d.from(o,o.offset,o.byteLength)),!d.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(n===void 0&&(n=0),r===void 0&&(r=o?o.length:0),a===void 0&&(a=0),p===void 0&&(p=this.length),n<0||r>o.length||a<0||p>this.length)throw new RangeError("out of range index");if(a>=p&&n>=r)return 0;if(a>=p)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,a>>>=0,p>>>=0,this===o)return 0;for(var m=p-a,_=r-n,l=Math.min(m,_),u=this.slice(a,p),T=o.slice(n,r),h=0;h<l;++h)if(u[h]!==T[h]){m=u[h],_=T[h];break}return m<_?-1:_<m?1:0};function Pr(e,o,n,r,a){if(e.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,nt(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0)if(a)n=0;else return-1;if(typeof o=="string"&&(o=d.from(o,r)),d.isBuffer(o))return o.length===0?-1:Er(e,o,n,r,a);if(typeof o=="number")return o=o&255,typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(e,o,n):Uint8Array.prototype.lastIndexOf.call(e,o,n):Er(e,[o],n,r,a);throw new TypeError("val must be string, number or Buffer")}function Er(e,o,n,r,a){var p=1,m=e.length,_=o.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(e.length<2||o.length<2)return-1;p=2,m/=2,_/=2,n/=2}function l(k,N){return p===1?k[N]:k.readUInt16BE(N*p)}var u;if(a){var T=-1;for(u=n;u<m;u++)if(l(e,u)===l(o,T===-1?0:u-T)){if(T===-1&&(T=u),u-T+1===_)return T*p}else T!==-1&&(u-=u-T),T=-1}else for(n+_>m&&(n=m-_),u=n;u>=0;u--){for(var h=!0,x=0;x<_;x++)if(l(e,u+x)!==l(o,x)){h=!1;break}if(h)return u}return-1}d.prototype.includes=function(o,n,r){return this.indexOf(o,n,r)!==-1};d.prototype.indexOf=function(o,n,r){return Pr(this,o,n,r,!0)};d.prototype.lastIndexOf=function(o,n,r){return Pr(this,o,n,r,!1)};function _p(e,o,n,r){n=Number(n)||0;var a=e.length-n;r?(r=Number(r),r>a&&(r=a)):r=a;var p=o.length;r>p/2&&(r=p/2);for(var m=0;m<r;++m){var _=parseInt(o.substr(m*2,2),16);if(nt(_))return m;e[n+m]=_}return m}function lp(e,o,n,r){return Jo(Qn(o,e.length-n),e,n,r)}function dp(e,o,n,r){return Jo(vp(o),e,n,r)}function up(e,o,n,r){return Jo(Br(o),e,n,r)}function gp(e,o,n,r){return Jo(kp(o,e.length-n),e,n,r)}d.prototype.write=function(o,n,r,a){if(n===void 0)a="utf8",r=this.length,n=0;else if(r===void 0&&typeof n=="string")a=n,r=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(r)?(r=r>>>0,a===void 0&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var p=this.length-n;if((r===void 0||r>p)&&(r=p),o.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var m=!1;;)switch(a){case"hex":return _p(this,o,n,r);case"utf8":case"utf-8":return lp(this,o,n,r);case"ascii":case"latin1":case"binary":return dp(this,o,n,r);case"base64":return up(this,o,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gp(this,o,n,r);default:if(m)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),m=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fp(e,o,n){return o===0&&n===e.length?Zn.fromByteArray(e):Zn.fromByteArray(e.slice(o,n))}function Rr(e,o,n){n=Math.min(e.length,n);for(var r=[],a=o;a<n;){var p=e[a],m=null,_=p>239?4:p>223?3:p>191?2:1;if(a+_<=n){var l,u,T,h;switch(_){case 1:p<128&&(m=p);break;case 2:l=e[a+1],(l&192)===128&&(h=(p&31)<<6|l&63,h>127&&(m=h));break;case 3:l=e[a+1],u=e[a+2],(l&192)===128&&(u&192)===128&&(h=(p&15)<<12|(l&63)<<6|u&63,h>2047&&(h<55296||h>57343)&&(m=h));break;case 4:l=e[a+1],u=e[a+2],T=e[a+3],(l&192)===128&&(u&192)===128&&(T&192)===128&&(h=(p&15)<<18|(l&63)<<12|(u&63)<<6|T&63,h>65535&&h<1114112&&(m=h))}}m===null?(m=65533,_=1):m>65535&&(m-=65536,r.push(m>>>10&1023|55296),m=56320|m&1023),r.push(m),a+=_}return Tp(r)}var Cr=4096;function Tp(e){var o=e.length;if(o<=Cr)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<o;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Cr));return n}function hp(e,o,n){var r="";n=Math.min(e.length,n);for(var a=o;a<n;++a)r+=String.fromCharCode(e[a]&127);return r}function yp(e,o,n){var r="";n=Math.min(e.length,n);for(var a=o;a<n;++a)r+=String.fromCharCode(e[a]);return r}function xp(e,o,n){var r=e.length;(!o||o<0)&&(o=0),(!n||n<0||n>r)&&(n=r);for(var a="",p=o;p<n;++p)a+=Ap[e[p]];return a}function bp(e,o,n){for(var r=e.slice(o,n),a="",p=0;p<r.length-1;p+=2)a+=String.fromCharCode(r[p]+r[p+1]*256);return a}d.prototype.slice=function(o,n){var r=this.length;o=~~o,n=n===void 0?r:~~n,o<0?(o+=r,o<0&&(o=0)):o>r&&(o=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n<o&&(n=o);var a=this.subarray(o,n);return Object.setPrototypeOf(a,d.prototype),a};function B(e,o,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+o>n)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(o,n,r){o=o>>>0,n=n>>>0,r||B(o,n,this.length);for(var a=this[o],p=1,m=0;++m<n&&(p*=256);)a+=this[o+m]*p;return a};d.prototype.readUintBE=d.prototype.readUIntBE=function(o,n,r){o=o>>>0,n=n>>>0,r||B(o,n,this.length);for(var a=this[o+--n],p=1;n>0&&(p*=256);)a+=this[o+--n]*p;return a};d.prototype.readUint8=d.prototype.readUInt8=function(o,n){return o=o>>>0,n||B(o,1,this.length),this[o]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(o,n){return o=o>>>0,n||B(o,2,this.length),this[o]|this[o+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(o,n){return o=o>>>0,n||B(o,2,this.length),this[o]<<8|this[o+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(o,n){return o=o>>>0,n||B(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(o,n){return o=o>>>0,n||B(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])};d.prototype.readIntLE=function(o,n,r){o=o>>>0,n=n>>>0,r||B(o,n,this.length);for(var a=this[o],p=1,m=0;++m<n&&(p*=256);)a+=this[o+m]*p;return p*=128,a>=p&&(a-=Math.pow(2,8*n)),a};d.prototype.readIntBE=function(o,n,r){o=o>>>0,n=n>>>0,r||B(o,n,this.length);for(var a=n,p=1,m=this[o+--a];a>0&&(p*=256);)m+=this[o+--a]*p;return p*=128,m>=p&&(m-=Math.pow(2,8*n)),m};d.prototype.readInt8=function(o,n){return o=o>>>0,n||B(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]};d.prototype.readInt16LE=function(o,n){o=o>>>0,n||B(o,2,this.length);var r=this[o]|this[o+1]<<8;return r&32768?r|4294901760:r};d.prototype.readInt16BE=function(o,n){o=o>>>0,n||B(o,2,this.length);var r=this[o+1]|this[o]<<8;return r&32768?r|4294901760:r};d.prototype.readInt32LE=function(o,n){return o=o>>>0,n||B(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24};d.prototype.readInt32BE=function(o,n){return o=o>>>0,n||B(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]};d.prototype.readFloatLE=function(o,n){return o=o>>>0,n||B(o,4,this.length),oo.read(this,o,!0,23,4)};d.prototype.readFloatBE=function(o,n){return o=o>>>0,n||B(o,4,this.length),oo.read(this,o,!1,23,4)};d.prototype.readDoubleLE=function(o,n){return o=o>>>0,n||B(o,8,this.length),oo.read(this,o,!0,52,8)};d.prototype.readDoubleBE=function(o,n){return o=o>>>0,n||B(o,8,this.length),oo.read(this,o,!1,52,8)};function H(e,o,n,r,a,p){if(!d.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(o>a||o<p)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(o,n,r,a){if(o=+o,n=n>>>0,r=r>>>0,!a){var p=Math.pow(2,8*r)-1;H(this,o,n,r,p,0)}var m=1,_=0;for(this[n]=o&255;++_<r&&(m*=256);)this[n+_]=o/m&255;return n+r};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(o,n,r,a){if(o=+o,n=n>>>0,r=r>>>0,!a){var p=Math.pow(2,8*r)-1;H(this,o,n,r,p,0)}var m=r-1,_=1;for(this[n+m]=o&255;--m>=0&&(_*=256);)this[n+m]=o/_&255;return n+r};d.prototype.writeUint8=d.prototype.writeUInt8=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,1,255,0),this[n]=o&255,n+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,2,65535,0),this[n]=o&255,this[n+1]=o>>>8,n+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,2,65535,0),this[n]=o>>>8,this[n+1]=o&255,n+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,4,4294967295,0),this[n+3]=o>>>24,this[n+2]=o>>>16,this[n+1]=o>>>8,this[n]=o&255,n+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,4,4294967295,0),this[n]=o>>>24,this[n+1]=o>>>16,this[n+2]=o>>>8,this[n+3]=o&255,n+4};d.prototype.writeIntLE=function(o,n,r,a){if(o=+o,n=n>>>0,!a){var p=Math.pow(2,8*r-1);H(this,o,n,r,p-1,-p)}var m=0,_=1,l=0;for(this[n]=o&255;++m<r&&(_*=256);)o<0&&l===0&&this[n+m-1]!==0&&(l=1),this[n+m]=(o/_>>0)-l&255;return n+r};d.prototype.writeIntBE=function(o,n,r,a){if(o=+o,n=n>>>0,!a){var p=Math.pow(2,8*r-1);H(this,o,n,r,p-1,-p)}var m=r-1,_=1,l=0;for(this[n+m]=o&255;--m>=0&&(_*=256);)o<0&&l===0&&this[n+m+1]!==0&&(l=1),this[n+m]=(o/_>>0)-l&255;return n+r};d.prototype.writeInt8=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,1,127,-128),o<0&&(o=255+o+1),this[n]=o&255,n+1};d.prototype.writeInt16LE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,2,32767,-32768),this[n]=o&255,this[n+1]=o>>>8,n+2};d.prototype.writeInt16BE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,2,32767,-32768),this[n]=o>>>8,this[n+1]=o&255,n+2};d.prototype.writeInt32LE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,4,2147483647,-2147483648),this[n]=o&255,this[n+1]=o>>>8,this[n+2]=o>>>16,this[n+3]=o>>>24,n+4};d.prototype.writeInt32BE=function(o,n,r){return o=+o,n=n>>>0,r||H(this,o,n,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[n]=o>>>24,this[n+1]=o>>>16,this[n+2]=o>>>8,this[n+3]=o&255,n+4};function Mr(e,o,n,r,a,p){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Fr(e,o,n,r,a){return o=+o,n=n>>>0,a||Mr(e,o,n,4,34028234663852886e22,-34028234663852886e22),oo.write(e,o,n,r,23,4),n+4}d.prototype.writeFloatLE=function(o,n,r){return Fr(this,o,n,!0,r)};d.prototype.writeFloatBE=function(o,n,r){return Fr(this,o,n,!1,r)};function Or(e,o,n,r,a){return o=+o,n=n>>>0,a||Mr(e,o,n,8,17976931348623157e292,-17976931348623157e292),oo.write(e,o,n,r,52,8),n+8}d.prototype.writeDoubleLE=function(o,n,r){return Or(this,o,n,!0,r)};d.prototype.writeDoubleBE=function(o,n,r){return Or(this,o,n,!1,r)};d.prototype.copy=function(o,n,r,a){if(!d.isBuffer(o))throw new TypeError("argument should be a Buffer");if(r||(r=0),!a&&a!==0&&(a=this.length),n>=o.length&&(n=o.length),n||(n=0),a>0&&a<r&&(a=r),a===r||o.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),o.length-n<a-r&&(a=o.length-n+r);var p=a-r;return this===o&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,r,a):Uint8Array.prototype.set.call(o,this.subarray(r,a),n),p};d.prototype.fill=function(o,n,r,a){if(typeof o=="string"){if(typeof n=="string"?(a=n,n=0,r=this.length):typeof r=="string"&&(a=r,r=this.length),a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!d.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(o.length===1){var p=o.charCodeAt(0);(a==="utf8"&&p<128||a==="latin1")&&(o=p)}}else typeof o=="number"?o=o&255:typeof o=="boolean"&&(o=Number(o));if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;n=n>>>0,r=r===void 0?this.length:r>>>0,o||(o=0);var m;if(typeof o=="number")for(m=n;m<r;++m)this[m]=o;else{var _=d.isBuffer(o)?o:d.from(o,a),l=_.length;if(l===0)throw new TypeError('The value "'+o+'" is invalid for argument "value"');for(m=0;m<r-n;++m)this[m+n]=_[m%l]}return this};var wp=/[^+/0-9A-Za-z-_]/g;function Sp(e){if(e=e.split("=")[0],e=e.trim().replace(wp,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Qn(e,o){o=o||1/0;for(var n,r=e.length,a=null,p=[],m=0;m<r;++m){if(n=e.charCodeAt(m),n>55295&&n<57344){if(!a){if(n>56319){(o-=3)>-1&&p.push(239,191,189);continue}else if(m+1===r){(o-=3)>-1&&p.push(239,191,189);continue}a=n;continue}if(n<56320){(o-=3)>-1&&p.push(239,191,189),a=n;continue}n=(a-55296<<10|n-56320)+65536}else a&&(o-=3)>-1&&p.push(239,191,189);if(a=null,n<128){if((o-=1)<0)break;p.push(n)}else if(n<2048){if((o-=2)<0)break;p.push(n>>6|192,n&63|128)}else if(n<65536){if((o-=3)<0)break;p.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((o-=4)<0)break;p.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return p}function vp(e){for(var o=[],n=0;n<e.length;++n)o.push(e.charCodeAt(n)&255);return o}function kp(e,o){for(var n,r,a,p=[],m=0;m<e.length&&!((o-=2)<0);++m)n=e.charCodeAt(m),r=n>>8,a=n%256,p.push(a),p.push(r);return p}function Br(e){return Zn.toByteArray(Sp(e))}function Jo(e,o,n,r){for(var a=0;a<r&&!(a+n>=o.length||a>=e.length);++a)o[a+n]=e[a];return a}function _e(e,o){return e instanceof o||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===o.name}function nt(e){return e!==e}var Ap=function(){for(var e="0123456789abcdef",o=new Array(256),n=0;n<16;++n)for(var r=n*16,a=0;a<16;++a)o[r+a]=e[n]+e[a];return o}()});var Hr=Xo((Ll,$r)=>{t();var F=$r.exports={},le,de;function tt(){throw new Error("setTimeout has not been defined")}function rt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?le=setTimeout:le=tt}catch(e){le=tt}try{typeof clearTimeout=="function"?de=clearTimeout:de=rt}catch(e){de=rt}})();function Wr(e){if(le===setTimeout)return setTimeout(e,0);if((le===tt||!le)&&setTimeout)return le=setTimeout,setTimeout(e,0);try{return le(e,0)}catch(o){try{return le.call(null,e,0)}catch(n){return le.call(this,e,0)}}}function Ip(e){if(de===clearTimeout)return clearTimeout(e);if((de===rt||!de)&&clearTimeout)return de=clearTimeout,clearTimeout(e);try{return de(e)}catch(o){try{return de.call(null,e)}catch(n){return de.call(this,e)}}}var be=[],to=!1,$e,Qo=-1;function Ep(){!to||!$e||(to=!1,$e.length?be=$e.concat(be):Qo=-1,be.length&&Gr())}function Gr(){if(!to){var e=Wr(Ep);to=!0;for(var o=be.length;o;){for($e=be,be=[];++Qo<o;)$e&&$e[Qo].run();Qo=-1,o=be.length}$e=null,to=!1,Ip(e)}}F.nextTick=function(e){var o=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)o[n-1]=arguments[n];be.push(new Vr(e,o)),be.length===1&&!to&&Wr(Gr)};function Vr(e,o){this.fun=e,this.array=o}Vr.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function we(){}F.on=we;F.addListener=we;F.once=we;F.off=we;F.removeListener=we;F.removeAllListeners=we;F.emit=we;F.prependListener=we;F.prependOnceListener=we;F.listeners=function(e){return[]};F.binding=function(e){throw new Error("process.binding is not supported")};F.cwd=function(){return"/"};F.chdir=function(e){throw new Error("process.chdir is not supported")};F.umask=function(){return 0}});var i,s,Nl,t=b(()=>{i=g(Ur()),s=g(Hr()),Nl=function(e){function o(){var r=this||self;return delete e.prototype.__magic__,r}if(typeof globalThis=="object")return globalThis;if(this)return o();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:o});var n=__magic__;return n}(Object)});var ro,en=b(()=>{"use strict";t();ro=()=>Date.now()/1e3});var zr,at=b(()=>{"use strict";t();zr=e=>new Date().setMilliseconds(new Date().getMilliseconds()+e)/1e3});var jr,qr=b(()=>{"use strict";t();jr=e=>new Date().setSeconds(new Date().getSeconds()+e)/1e3});var on=b(()=>{"use strict";t();en();at();qr()});var st={};We(st,{getItem:()=>Lp,localStorageKeys:()=>Ne,removeItem:()=>Np,setItem:()=>Cp});var Ne,it,Cp,Lp,Np,ao=b(()=>{"use strict";t();on();Ne={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},it=typeof localStorage!="undefined",Cp=({key:e,data:o,expires:n})=>{!it||localStorage.setItem(String(e),JSON.stringify({expires:n,data:o}))},Lp=e=>{if(!it)return;let o=localStorage.getItem(String(e));if(!o)return null;let n=JSON.parse(o);return!n||!n.hasOwnProperty("expires")||!n.hasOwnProperty("data")?null:ro()>=n.expires?(localStorage.removeItem(String(e)),null):n.data},Np=e=>{!it||localStorage.removeItem(String(e))}});var ct={};We(ct,{clear:()=>Yr,getItem:()=>Xr,removeItem:()=>Zr,setItem:()=>Kr,storage:()=>Dp});var Kr,Xr,Zr,Yr,Dp,Jr=b(()=>{"use strict";t();Kr=({key:e,data:o,expires:n})=>{sessionStorage.setItem(String(e),JSON.stringify({expires:n,data:o}))},Xr=e=>{let o=sessionStorage.getItem(String(e));if(!o)return null;let n=JSON.parse(o);return!n||!n.hasOwnProperty("expires")||!n.hasOwnProperty("data")?null:Date.now()>=n.expires?(sessionStorage.removeItem(String(e)),null):n.data},Zr=e=>sessionStorage.removeItem(String(e)),Yr=()=>sessionStorage.clear(),Dp={setItem:Kr,getItem:Xr,removeItem:Zr,clear:Yr}});var Q,He=b(()=>{"use strict";t();ao();Jr();Q={session:ct,local:st}});function ko(){return new Date().setHours(new Date().getHours()+24)}function Ao(e){Q.local.setItem({key:Ne.loginExpiresAt,data:e,expires:e})}var pt=b(()=>{"use strict";t();He();ao()});var M=b(()=>{"use strict";t()});var io=b(()=>{"use strict";t()});var Qr=b(()=>{"use strict";t()});var mt,G=b(()=>{"use strict";t();mt=(r=>(r.nft="nft",r.esdt="esdt",r.egld="egld",r))(mt||{})});var ea=b(()=>{"use strict";t()});var oa=b(()=>{"use strict";t()});var na=b(()=>{"use strict";t()});var ta=b(()=>{"use strict";t()});var V=b(()=>{"use strict";t();Qr();G();M();ea();oa();na();ta()});var Io,ra,ad,aa,id,ia,sa,sd,Pp,Eo=b(()=>{"use strict";t();V();Io={devnet:{id:"devnet",chainId:"D",name:"Devnet",egldLabel:"xEGLD",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/",walletConnectBridgeAddresses:["https://bridge.walletconnect.org"],walletConnectV2RelayAddresses:["wss://relay.walletconnect.com"],walletAddress:"https://devnet-wallet.elrond.com",apiAddress:"https://devnet-api.elrond.com",explorerAddress:"http://devnet-explorer.elrond.com",apiTimeout:"4000"},testnet:{id:"testnet",chainId:"T",name:"Testnet",egldLabel:"xEGLD",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/",walletConnectBridgeAddresses:["https://bridge.walletconnect.org"],walletConnectV2RelayAddresses:["wss://relay.walletconnect.com"],walletAddress:"https://testnet-wallet.elrond.com",apiAddress:"https://testnet-api.elrond.com",explorerAddress:"http://testnet-explorer.elrond.com",apiTimeout:"4000"},mainnet:{id:"mainnet",chainId:"1",name:"Mainnet",egldLabel:"xEGLD",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://maiar.com/",walletConnectBridgeAddresses:["https://bridge.walletconnect.org"],walletConnectV2RelayAddresses:["wss://relay.walletconnect.com"],walletAddress:"https://wallet.elrond.com",apiAddress:"https://api.elrond.com",explorerAddress:"https://explorer.elrond.com",apiTimeout:"4000"}},{chainId:ra,egldLabel:ad}=Io["devnet"],{chainId:aa,egldLabel:id}=Io["testnet"],{chainId:ia,egldLabel:sa}=Io["mainnet"],sd={["devnet"]:ra,["testnet"]:aa,["mainnet"]:ia},Pp={[ra]:"devnet",[aa]:"testnet",[ia]:"mainnet"}});var _t=b(()=>{"use strict";t()});var ca=b(()=>{"use strict";t()});var nn,lt=b(()=>{"use strict";t();nn="transaction-status-toast-id"});var Co,tn,U,so,pa,dt,rn,ma,ue,L=b(()=>{"use strict";t();io();Eo();_t();ca();lt();Co=5e4,tn=1e9,U=18,so=4,pa=1,dt=4294967295,rn="logout",ma="login",ue="0"});var ut,$,Se,z=b(()=>{"use strict";t();ut=require("@reduxjs/toolkit");L();$=(0,ut.createAction)(rn),Se=(0,ut.createAction)(ma,e=>({payload:e}))});var la,_a,da,kd,ua,Rp,Lo,ga,Mp,fa,Ta,gt=b(()=>{"use strict";t();la=require("@reduxjs/toolkit");pt();M();z();_a={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},da=(0,la.createSlice)({name:"loginInfoSlice",initialState:_a,reducers:{setLoginMethod:(e,o)=>{e.loginMethod=o.payload},setTokenLogin:(e,o)=>{e.tokenLogin=o.payload},setTokenLoginSignature:(e,o)=>{(e==null?void 0:e.tokenLogin)!=null&&(e.tokenLogin.signature=o.payload)},setWalletLogin:(e,o)=>{e.walletLogin=o.payload},setWalletConnectLogin:(e,o)=>{e.walletConnectLogin=o.payload},setLedgerLogin:(e,o)=>{e.ledgerLogin=o.payload},invalidateLoginSession:e=>{e.isLoginSessionInvalid=!0}},extraReducers:e=>{e.addCase($,()=>_a),e.addCase(Se,(o,n)=>{o.loginMethod=n.payload.loginMethod,Ao(ko())})}}),{setLoginMethod:kd,setWalletConnectLogin:ua,setLedgerLogin:Rp,setTokenLogin:Lo,setTokenLoginSignature:ga,setWalletLogin:Mp,invalidateLoginSession:fa}=da.actions,Ta=da.reducer});var No=b(()=>{"use strict";t()});var ya=b(()=>{"use strict";t();No()});function ft(e){return e[Math.floor(Math.random()*e.length)]}var xa=b(()=>{"use strict";t()});var Tt=b(()=>{"use strict";t();_t()});var co=b(()=>{"use strict";t();ya();xa();Tt()});var ba,wa,ht,Fp,Sa,Wd,Gd,va,yt=b(()=>{"use strict";t();ba=require("@reduxjs/toolkit"),wa=g(require("lodash.omit"));co();ht={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},Fp={network:ht,chainID:"-1"},Sa=(0,ba.createSlice)({name:"appConfig",initialState:Fp,reducers:{initializeNetworkConfig:(e,o)=>{let n=ft(o.payload.walletConnectBridgeAddresses),r=ft(o.payload.walletConnectV2RelayAddresses),a=(0,wa.default)(o.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");e.network=w(f(f({},e.network),a),{walletConnectBridgeAddress:n,walletConnectV2RelayAddress:r})},setChainID:(e,o)=>{e.chainID=o.payload}}}),{initializeNetworkConfig:Wd,setChainID:Gd}=Sa.actions,va=Sa.reducer});var bt,ka,Aa,an,xt,Ia,wt,Xd,St,Zd,Op,Bp,Yd,Jd,Qd,Up,Ea,vt=b(()=>{"use strict";t();bt=require("@elrondnetwork/erdjs"),ka=require("@reduxjs/toolkit"),Aa=require("redux-persist");L();He();ao();z();an={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:ue},xt={address:"",websocketEvent:null,accounts:{"":an},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},Ia=(0,ka.createSlice)({name:"accountInfoSlice",initialState:xt,reducers:{setAddress:(e,o)=>{let n=o.payload;e.address=n,e.publicKey=new bt.Address(n).hex()},setAccount:(e,o)=>{let n=e.address===o.payload.address;e.accounts={[e.address]:n?o.payload:an},e.isAccountLoading=!1,e.accountLoadingError=null},setAccountNonce:(e,o)=>{let{address:n}=e;e.accounts[n].nonce=o.payload},setAccountShard:(e,o)=>{e.shard=o.payload},setLedgerAccount:(e,o)=>{e.ledgerAccount=o.payload},updateLedgerAccount:(e,o)=>{e.ledgerAccount!=null&&(e.ledgerAccount.index=o.payload.index,e.ledgerAccount.address=o.payload.address)},setWalletConnectAccount:(e,o)=>{e.walletConnectAccount=o.payload},setIsAccountLoading:(e,o)=>{e.isAccountLoading=o.payload,e.accountLoadingError=null},setAccountLoadingError:(e,o)=>{e.accountLoadingError=o.payload,e.isAccountLoading=!1},setWebsocketEvent:(e,o)=>{e.websocketEvent={timestamp:Date.now(),message:o.payload}}},extraReducers:e=>{e.addCase($,()=>(Q.local.removeItem(Ne.loginExpiresAt),xt)),e.addCase(Se,(o,n)=>{let{address:r}=n.payload;o.address=r,o.publicKey=new bt.Address(r).hex()}),e.addCase(Aa.REHYDRATE,(o,n)=>{var u;if(!((u=n.payload)!=null&&u.account))return;let{account:r}=n.payload,{address:a,shard:p,accounts:m,publicKey:_}=r;o.address=a,o.shard=p;let l=m&&a in m;o.accounts=l?m:xt.accounts,o.publicKey=_})}}),{setAccount:wt,setAddress:Xd,setAccountNonce:St,setAccountShard:Zd,setLedgerAccount:Op,updateLedgerAccount:Bp,setWalletConnectAccount:Yd,setIsAccountLoading:Jd,setAccountLoadingError:Qd,setWebsocketEvent:Up}=Ia.actions,Ea=Ia.reducer});function ge(e){return e!=null&&(qp(e)||Ro(e))}function po(e){return e!=null&&(Kp(e)||Yp(e))}function mo(e){return e!=null&&(Xp(e)||Jp(e))}function Po(e){return e!=null&&Zp(e)}function qp(e){return e!=null&&Wp.includes(e)}function Kp(e){return e!=null&&Gp.includes(e)}function Xp(e){return e!=null&&Vp.includes(e)}function Zp(e){return e!=null&&$p.includes(e)}function Ro(e){return e!=null&&Hp.includes(e)}function Yp(e){return e!=null&&zp.includes(e)}function Jp(e){return e!=null&&jp.includes(e)}var Wp,Gp,Vp,$p,Hp,zp,jp,fe=b(()=>{"use strict";t();M();Wp=["sent"],Gp=["success"],Vp=["fail","cancelled","timedOut"],$p=["timedOut"],Hp=["pending"],zp=["success"],jp=["fail","invalid"]});var Ca,La,Mo,Qp,Na,Da,Pa,em,sn,om,Ra,cu,nm,cn,kt,pn,mn=b(()=>{"use strict";t();Ca=require("@reduxjs/toolkit"),La=require("redux-persist");M();fe();z();Mo={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},Qp={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Na=(0,Ca.createSlice)({name:"transactionsSlice",initialState:Mo,reducers:{moveTransactionsToSignedState:(e,o)=>{var l,u;let{sessionId:n,transactions:r,errorMessage:a,status:p,redirectRoute:m}=o.payload,_=((l=e.customTransactionInformationForSessionId)==null?void 0:l[n])||Qp;e.signedTransactions[n]={transactions:r,status:p,errorMessage:a,redirectRoute:m,customTransactionInformation:_},((u=e==null?void 0:e.transactionsToSign)==null?void 0:u.sessionId)===n&&(e.transactionsToSign=Mo.transactionsToSign)},clearSignedTransaction:(e,o)=>{e.signedTransactions[o.payload]&&delete e.signedTransactions[o.payload]},clearTransactionToSign:e=>{e!=null&&e.transactionsToSign&&(e.transactionsToSign=null)},updateSignedTransaction:(e,o)=>{e.signedTransactions=f(f({},e.signedTransactions),o.payload)},updateSignedTransactions:(e,o)=>{let{sessionId:n,status:r,errorMessage:a,transactions:p}=o.payload;e.signedTransactions[n]!=null&&(e.signedTransactions[n].status=r,a!=null&&(e.signedTransactions[n].errorMessage=a),p!=null&&(e.signedTransactions[n].transactions=p))},updateSignedTransactionStatus:(e,o)=>{var _,l,u,T,h,x;let{sessionId:n,status:r,errorMessage:a,transactionHash:p}=o.payload,m=(l=(_=e.signedTransactions)==null?void 0:_[n])==null?void 0:l.transactions;if(m!=null){e.signedTransactions[n].transactions=m.map(R=>R.hash===p?w(f({},R),{status:r,errorMessage:a}):R);let k=(T=(u=e.signedTransactions[n])==null?void 0:u.transactions)==null?void 0:T.every(R=>po(R.status)),N=(x=(h=e.signedTransactions[n])==null?void 0:h.transactions)==null?void 0:x.every(R=>mo(R.status));k&&(e.signedTransactions[n].status="success"),N&&(e.signedTransactions[n].status="fail")}},setTransactionsToSign:(e,o)=>{e.transactionsToSign=o.payload;let{sessionId:n,customTransactionInformation:r}=o.payload;e.customTransactionInformationForSessionId[n]=r,e.signTransactionsError=null},clearAllTransactionsToSign:e=>{e.transactionsToSign=Mo.transactionsToSign,e.signTransactionsError=null},clearAllSignedTransactions:e=>{e.signedTransactions=Mo.signedTransactions},setSignTransactionsError:(e,o)=>{e.signTransactionsError=o.payload},setSignTransactionsCancelMessage:(e,o)=>{e.signTransactionsCancelMessage=o.payload}},extraReducers:e=>{e.addCase($,()=>Mo),e.addCase(La.REHYDRATE,(o,n)=>{var m;if(o.signTransactionsCancelMessage=null,!((m=n.payload)!=null&&m.transactions))return;let{signedTransactions:r,customTransactionInformationForSessionId:a}=n.payload.transactions,p=Object.entries(r).reduce((_,[l,u])=>{let T=new Date(l),h=new Date;return h.setHours(h.getHours()+5),h-T>0||(_[l]=u),_},{});a!=null&&(o.customTransactionInformationForSessionId=a),r!=null&&(o.signedTransactions=p)})}}),{updateSignedTransactionStatus:Da,updateSignedTransactions:Pa,setTransactionsToSign:em,clearAllTransactionsToSign:sn,clearAllSignedTransactions:om,clearSignedTransaction:Ra,clearTransactionToSign:cu,setSignTransactionsError:nm,setSignTransactionsCancelMessage:cn,moveTransactionsToSignedState:kt}=Na.actions,pn=Na.reducer});var Ma,It,Et,Ct,tm,At,Fa,lu,rm,Lt,_n,ln=b(()=>{"use strict";t();Ma=require("@reduxjs/toolkit");z();It="Transaction failed",Et="Transaction successful",Ct="Processing transaction",tm="Transaction submitted",At={},Fa=(0,Ma.createSlice)({name:"transactionsInfo",initialState:At,reducers:{setTransactionsDisplayInfo(e,o){let{sessionId:n,transactionsDisplayInfo:r}=o.payload;n!=null&&(e[n]={errorMessage:(r==null?void 0:r.errorMessage)||It,successMessage:(r==null?void 0:r.successMessage)||Et,processingMessage:(r==null?void 0:r.processingMessage)||Ct,submittedMessage:(r==null?void 0:r.submittedMessage)||tm,transactionDuration:r==null?void 0:r.transactionDuration})},clearTransactionsInfoForSessionId(e,o){o.payload!=null&&delete e[o.payload]},clearTransactionsInfo:()=>At},extraReducers:e=>{e.addCase($,()=>At)}}),{clearTransactionsInfo:lu,setTransactionsDisplayInfo:rm,clearTransactionsInfoForSessionId:Lt}=Fa.actions,_n=Fa.reducer});var Ba,Oa,Ua,fu,am,Tu,im,Wa,Nt=b(()=>{"use strict";t();Ba=require("@reduxjs/toolkit");z();Oa={},Ua=(0,Ba.createSlice)({name:"modalsSlice",initialState:Oa,reducers:{setTxSubmittedModal:(e,o)=>{e.txSubmittedModal=o.payload},setNotificationModal:(e,o)=>{e.notificationModal=o.payload},clearTxSubmittedModal:e=>{e.txSubmittedModal=void 0},clearNotificationModal:e=>{e.notificationModal=void 0}},extraReducers:e=>{e.addCase($,()=>Oa)}}),{setTxSubmittedModal:fu,setNotificationModal:am,clearTxSubmittedModal:Tu,clearNotificationModal:im}=Ua.actions,Wa=Ua.reducer});var Va,$a,Ga,Ha,sm,dn,za,ja,ku,Au,un,gn=b(()=>{"use strict";t();Va=require("@reduxjs/toolkit"),$a=require("redux-persist");lt();V();en();z();Ga={customToasts:[],transactionToasts:[],failTransactionToast:null},Ha=(0,Va.createSlice)({name:"toastsSlice",initialState:Ga,reducers:{addCustomToast:(e,o)=>{e.customToasts.push(w(f({},o.payload),{type:"custom",toastId:o.payload.toastId||`custom-toast-${e.customToasts.length+1}`}))},removeCustomToast:(e,o)=>{e.customToasts=e.customToasts.filter(n=>n.toastId!==o.payload)},addTransactionToast:(e,o)=>{e.transactionToasts.push({type:"transaction",startTimestamp:ro(),toastId:o.payload||`custom-toast-${e.transactionToasts.length+1}`})},removeTransactionToast:(e,o)=>{e.transactionToasts=e.transactionToasts.filter(n=>n.toastId!==o.payload)},addFailTransactionToast:(e,o)=>{e.failTransactionToast=w(f({},o.payload),{toastId:nn})},removeFailTransactionToast:e=>{e.failTransactionToast=null}},extraReducers:e=>{e.addCase($,()=>Ga),e.addCase($a.REHYDRATE,(o,n)=>{var a,p;let r=(p=(a=n.customToasts)==null?void 0:a.filter(m=>!("component"in m)))!=null?p:[];o.customToasts=r})}}),{addCustomToast:sm,removeCustomToast:dn,addTransactionToast:za,removeTransactionToast:ja,addFailTransactionToast:ku,removeFailTransactionToast:Au}=Ha.actions,un=Ha.reducer});var P=b(()=>{"use strict";t();gt();yt();vt();mn();ln();Nt();gn()});var Dt=b(()=>{"use strict";t()});var Za,Xa,Ya,ju,qu,Ku,Xu,Zu,Yu,Ja,Qa=b(()=>{"use strict";t();Za=require("@reduxjs/toolkit");z();Xa={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},Ya=(0,Za.createSlice)({name:"dappModalsSlice",initialState:Xa,reducers:{setDappModalVisibility:(e,o)=>{e.visible=o.payload},setDappModalHeaderVisibility:(e,o)=>{e.modal.showHeader=o.payload},setDappModalFooterVisibility:(e,o)=>{e.modal.showFooter=o.payload},setDappModalHeaderText:(e,o)=>{e.modal.headerText=o.payload},setDappModalFooterText:(e,o)=>{e.modal.footerText=o.payload},setDappModalConfig:(e,o)=>{e.modal=f({},o.payload)}},extraReducers:e=>{e.addCase($,()=>Xa)}}),{setDappModalVisibility:ju,setDappModalHeaderVisibility:qu,setDappModalFooterVisibility:Ku,setDappModalHeaderText:Xu,setDappModalFooterText:Zu,setDappModalConfig:Yu}=Ya.actions,Ja=Ya.reducer});var ei,_m,lm,_o,Tn=b(()=>{"use strict";t();ei=require("@reduxjs/toolkit");Dt();vt();Qa();gt();Nt();yt();gn();ln();mn();_m={["account"]:Ea,["networkConfig"]:va,["loginInfo"]:Ta,["modals"]:Wa,["dappModal"]:Ja,["toasts"]:un,["transactions"]:pn,["transactionsInfo"]:_n},lm=(e={})=>(0,ei.combineReducers)(f(f({},_m),e)),_o=lm});var ti={};We(ti,{default:()=>ym});function Pt(e,o=[]){return{key:e,version:1,storage:ni.default,blacklist:o}}var ze,oi,ni,dm,um,gm,fm,Tm,hm,ym,ri=b(()=>{"use strict";t();ze=require("redux-persist"),oi=g(require("redux-persist/lib/storage")),ni=g(require("redux-persist/lib/storage/session"));Tn();P();gn();ln();mn();Dt();dm={2:e=>w(f({},e),{networkConfig:ht})};um=Pt("dapp-core-transactionsInfo"),gm=Pt("dapp-core-transactions",["transactionsToSign"]),fm=Pt("dapp-core-toasts"),Tm={key:"dapp-core-store",version:2,storage:oi.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,ze.createMigrate)(dm,{debug:!1})},hm={["toasts"]:(0,ze.persistReducer)(fm,un),["transactions"]:(0,ze.persistReducer)(gm,pn),["transactionsInfo"]:(0,ze.persistReducer)(um,_n)},ym=(0,ze.persistReducer)(Tm,_o(hm))});var ai={};We(ai,{default:()=>xm});var xm,ii=b(()=>{"use strict";t();Tn();xm=_o()});var si={};We(si,{default:()=>wm});var oe,bm,wm,ci=b(()=>{"use strict";t();oe=require("redux-persist"),bm=[oe.FLUSH,oe.REHYDRATE,oe.PAUSE,oe.PERSIST,oe.PURGE,oe.REGISTER],wm=bm});var _i={};We(_i,{default:()=>mi});function mi(e){return(0,pi.persistStore)(e)}var pi,li=b(()=>{"use strict";t();pi=require("redux-persist")});var kl={};We(kl,{TransactionsToastList:()=>vl});module.exports=vo(kl);t();var ae=g(require("react")),$c=g(require("classnames")),Hc=require("react-dom");t();t();var hi=require("react"),lo=require("react-redux");t();var Rt=require("@reduxjs/toolkit"),fi=require("react-redux/es/utils/Subscription");P();t();var qa=g(require("lodash.throttle"));L();P();pt();He();ao();var cm=[rn],pm=(0,qa.default)(()=>{Ao(ko())},5e3),Ka=e=>o=>n=>{var l;if(cm.includes(n.type))return o(n);let r=e.getState(),a=Q.local.getItem(Ne.loginExpiresAt);if(!((l=r==null?void 0:r.loginInfo)==null?void 0:l.isLoggedIn))return o(n);if(a==null)return Ao(ko());let m=Date.now();return a-m<0?setTimeout(()=>v(void 0,null,function*(){console.log("session expired");try{e.dispatch(fa())}catch(u){console.error("error logging out",u)}}),1e3):(pm(),o(n))};t();t();function fn(){return typeof sessionStorage!="undefined"}var di=fn()?(ri(),vo(ti)).default:(ii(),vo(ai)).default,ui=fn()?(ci(),vo(si)).default:[],gi=fn()?(li(),vo(_i)).default:e=>e;Tn();var C=(0,Rt.configureStore)({reducer:di,middleware:e=>e({serializableCheck:{ignoredActions:[...ui,St.type,wt.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(Ka)}),Ti=(0,fi.createSubscription)(C),wg=gi(C),Sg=(0,Rt.configureStore)({reducer:_o});var Sm={store:C,subscription:Ti},Mt=(0,hi.createContext)(Sm),Ig=(0,lo.createStoreHook)(Mt),j=(0,lo.createDispatchHook)(Mt),E=(0,lo.createSelectorHook)(Mt);t();t();P();t();var yi=g(require("lodash.isequal")),hn=require("reselect"),y=(0,hn.createSelectorCreator)(hn.defaultMemoize,yi.default);var ke=e=>e.account,uo=y(ke,e=>e.address),go=y(ke,uo,(e,o)=>o in e.accounts?e.accounts[o]:an),vm=y(ke,go,(e,o)=>{let a=e,{accounts:n}=a,r=Ue(a,["accounts"]);return w(f({},r),{account:o})}),km=y(go,e=>e.balance),Am=y(go,e=>{var o;return((o=e==null?void 0:e.nonce)==null?void 0:o.valueOf())||0}),xi=y(ke,e=>e.shard),Im=y(ke,e=>e.ledgerAccount),Dg=y(ke,e=>e.walletConnectAccount),Pg=y(ke,e=>e.isAccountLoading),Rg=y(ke,e=>e.accountLoadingError),bi=y(ke,e=>e.websocketEvent);t();var Ae=e=>e.networkConfig,yn=y(Ae,e=>e.chainID),Em=y(Ae,e=>e.network.walletConnectBridgeAddress),Cm=y(Ae,e=>e.network.walletConnectV2RelayAddress),Lm=y(Ae,e=>e.network.walletConnectV2ProjectId),wi=y(Ae,e=>e.network.walletConnectDeepLink),je=y(Ae,e=>e.network),Si=y(je,e=>e.apiAddress),vi=y(je,e=>e.explorerAddress),ki=y(je,e=>e.egldLabel);t();M();var qe=e=>e.loginInfo,Gg=y(qe,e=>e.loginMethod),xn=y(qe,uo,(e,o)=>e.loginMethod!=""&&Boolean(o)),Vg=y(qe,e=>e.walletConnectLogin),$g=y(qe,e=>e.ledgerLogin),Nm=y(qe,e=>e.walletLogin),Hg=y(qe,e=>e.isLoginSessionInvalid);t();t();var q=require("@elrondnetwork/erdjs");L();t();function bn(e){try{return i.Buffer.from(e,"base64").toString()===atob(e)}catch(o){return!1}}function Ai(e){return atob(e)}function fo(e){var a,p,m;let{data:o}=e,n=bn(o!=null?o:"")?q.TransactionPayload.fromEncoded(o):new q.TransactionPayload(o),r=new q.Transaction(f({value:e.value.valueOf(),data:n,nonce:e.nonce.valueOf(),receiver:new q.Address(e.receiver),sender:new q.Address(e.sender),gasLimit:(a=e.gasLimit.valueOf())!=null?a:Co,gasPrice:(p=e.gasPrice.valueOf())!=null?p:tn,chainID:e.chainID.valueOf(),version:new q.TransactionVersion((m=e.version)!=null?m:pa)},e.options?{options:new q.TransactionOptions(e.options)}:{}));return r.applySignature({hex:()=>e.signature||""},new q.Address(e.sender)),r}t();fe();t();var Dm=g(require("bignumber.js"));V();t();t();function Ft(e){for(let o=0;o<e.length;o++)if(e.charCodeAt(o)>127)return!1;return!0}function wn(e){let o=e;try{let n=i.Buffer.from(e,"hex").toString();Ft(n)&&n.length>1&&(o=n)}catch(n){}return o}t();t();var Bt=require("@elrondnetwork/erdjs"),Ut=g(require("bignumber.js"));M();t();var Ei=require("@elrondnetwork/erdjs");function Pm(e){try{let o=new Ei.Address(e);return Boolean(o.bech32())}catch(o){return!1}}function To(e){return(e==null?void 0:e.startsWith("erd"))&&e.length===62&&/^\w+$/.test(e)&&Pm(e)}var Ot={tokenId:"",amount:""},Rm=e=>e.split("@").map((p,m)=>[2,3].includes(m)?p:wn(p));function Wt(e){if(!e)return Ot;let o=e.startsWith("ESDTTransfer"),n=e.startsWith("ESDTNFTTransfer")&&e.includes("@");if(o){let[,r,a]=e.split("@");try{let p=i.Buffer.from(r,"hex").toString("ascii");if(!p)return Ot;let m=new Ut.default("0x"+a.replace("0x","")).toString(10);return{tokenId:p,amount:m}}catch(p){console.error("Error getting token from transaction data",p)}}if(n)try{let[,r,a,p,m]=Rm(e);if([r,a,p,m].every(_=>Boolean(_))&&To(new Bt.Address(m).bech32()))return{tokenId:`${r}-${a}`,amount:new Ut.default(p,16).toString(10),collection:r,nonce:a,receiver:new Bt.Address(m).bech32()}}catch(r){}return Ot}t();t();t();var Vt=require("@elrondnetwork/erdjs/out");t();L();var Mm=e=>{let o=i.Buffer.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,