UNPKG

@sofaws/dapp-core

Version:

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

1 lines 205 kB
"use strict";var ra=Object.create;var xe=Object.defineProperty,aa=Object.defineProperties,ia=Object.getOwnPropertyDescriptor,ca=Object.getOwnPropertyDescriptors,pa=Object.getOwnPropertyNames,Ne=Object.getOwnPropertySymbols,sa=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable;var uo=(e,n,o)=>n in e?xe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,x=(e,n)=>{for(var o in n||(n={}))pn.call(n,o)&&uo(e,o,n[o]);if(Ne)for(var o of Ne(n))ho.call(n,o)&&uo(e,o,n[o]);return e},q=(e,n)=>aa(e,ca(n));var ae=(e,n)=>{var o={};for(var t in e)pn.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&Ne)for(var t of Ne(e))n.indexOf(t)<0&&ho.call(e,t)&&(o[t]=e[t]);return o};var h=(e,n)=>()=>(e&&(n=e(e=0)),n);var De=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),ie=(e,n)=>{for(var o in n)xe(e,o,{get:n[o],enumerable:!0})},bo=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of pa(n))!pn.call(e,a)&&a!==o&&xe(e,a,{get:()=>n[a],enumerable:!(t=ia(n,a))||t.enumerable});return e};var y=(e,n,o)=>(o=e!=null?ra(sa(e)):{},bo(n||!e||!e.__esModule?xe(o,"default",{value:e,enumerable:!0}):o,e)),Me=e=>bo(xe({},"__esModule",{value:!0}),e);var xo=(e,n,o)=>new Promise((t,a)=>{var i=_=>{try{l(o.next(_))}catch(g){a(g)}},c=_=>{try{l(o.throw(_))}catch(g){a(g)}},l=_=>_.done?t(_.value):Promise.resolve(_.value).then(i,c);l((o=o.apply(e,n)).next())});var wo=De(Ie=>{"use strict";r();Ie.byteLength=da;Ie.toByteArray=la;Ie.fromByteArray=ua;var F=[],I=[],ma=typeof Uint8Array!="undefined"?Uint8Array:Array,sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(X=0,yo=sn.length;X<yo;++X)F[X]=sn[X],I[sn.charCodeAt(X)]=X;var X,yo;I["-".charCodeAt(0)]=62;I["_".charCodeAt(0)]=63;function To(e){var n=e.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var o=e.indexOf("=");o===-1&&(o=n);var t=o===n?0:4-o%4;return[o,t]}function da(e){var n=To(e),o=n[0],t=n[1];return(o+t)*3/4-t}function _a(e,n,o){return(n+o)*3/4-o}function la(e){var n,o=To(e),t=o[0],a=o[1],i=new ma(_a(e,t,a)),c=0,l=a>0?t-4:t,_;for(_=0;_<l;_+=4)n=I[e.charCodeAt(_)]<<18|I[e.charCodeAt(_+1)]<<12|I[e.charCodeAt(_+2)]<<6|I[e.charCodeAt(_+3)],i[c++]=n>>16&255,i[c++]=n>>8&255,i[c++]=n&255;return a===2&&(n=I[e.charCodeAt(_)]<<2|I[e.charCodeAt(_+1)]>>4,i[c++]=n&255),a===1&&(n=I[e.charCodeAt(_)]<<10|I[e.charCodeAt(_+1)]<<4|I[e.charCodeAt(_+2)]>>2,i[c++]=n>>8&255,i[c++]=n&255),i}function ga(e){return F[e>>18&63]+F[e>>12&63]+F[e>>6&63]+F[e&63]}function fa(e,n,o){for(var t,a=[],i=n;i<o;i+=3)t=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),a.push(ga(t));return a.join("")}function ua(e){for(var n,o=e.length,t=o%3,a=[],i=16383,c=0,l=o-t;c<l;c+=i)a.push(fa(e,c,c+i>l?l:c+i));return t===1?(n=e[o-1],a.push(F[n>>2]+F[n<<4&63]+"==")):t===2&&(n=(e[o-2]<<8)+e[o-1],a.push(F[n>>10]+F[n>>4&63]+F[n<<2&63]+"=")),a.join("")}});var qo=De(mn=>{r();mn.read=function(e,n,o,t,a){var i,c,l=a*8-t-1,_=(1<<l)-1,g=_>>1,b=-7,u=o?a-1:0,S=o?-1:1,v=e[n+u];for(u+=S,i=v&(1<<-b)-1,v>>=-b,b+=l;b>0;i=i*256+e[n+u],u+=S,b-=8);for(c=i&(1<<-b)-1,i>>=-b,b+=t;b>0;c=c*256+e[n+u],u+=S,b-=8);if(i===0)i=1-g;else{if(i===_)return c?NaN:(v?-1:1)*(1/0);c=c+Math.pow(2,t),i=i-g}return(v?-1:1)*c*Math.pow(2,i-t)};mn.write=function(e,n,o,t,a,i){var c,l,_,g=i*8-a-1,b=(1<<g)-1,u=b>>1,S=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=t?0:i-1,C=t?1:-1,M=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(l=isNaN(n)?1:0,c=b):(c=Math.floor(Math.log(n)/Math.LN2),n*(_=Math.pow(2,-c))<1&&(c--,_*=2),c+u>=1?n+=S/_:n+=S*Math.pow(2,1-u),n*_>=2&&(c++,_/=2),c+u>=b?(l=0,c=b):c+u>=1?(l=(n*_-1)*Math.pow(2,a),c=c+u):(l=n*Math.pow(2,u-1)*Math.pow(2,a),c=0));a>=8;e[o+v]=l&255,v+=C,l/=256,a-=8);for(c=c<<a|l,g+=a;g>0;e[o+v]=c&255,v+=C,c/=256,g-=8);e[o+v-C]|=M*128}});var Fo=De(pe=>{"use strict";r();var dn=wo(),ce=qo(),ko=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;pe.Buffer=d;pe.SlowBuffer=wa;pe.INSPECT_MAX_BYTES=50;var Le=2147483647;pe.kMaxLength=Le;d.TYPED_ARRAY_SUPPORT=ha();!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 ha(){try{var e=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(e,n),e.foo()===42}catch(o){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 U(e){if(e>Le)throw new RangeError('The value "'+e+'" is invalid for option "size"');var n=new Uint8Array(e);return Object.setPrototypeOf(n,d.prototype),n}function d(e,n,o){if(typeof e=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return fn(e)}return Ao(e,n,o)}d.poolSize=8192;function Ao(e,n,o){if(typeof e=="string")return xa(e,n);if(ArrayBuffer.isView(e))return ya(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(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(P(e,SharedArrayBuffer)||e&&P(e.buffer,SharedArrayBuffer)))return ln(e,n,o);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var t=e.valueOf&&e.valueOf();if(t!=null&&t!==e)return d.from(t,n,o);var a=Ta(e);if(a)return a;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return d.from(e[Symbol.toPrimitive]("string"),n,o);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,n,o){return Ao(e,n,o)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function Eo(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 ba(e,n,o){return Eo(e),e<=0?U(e):n!==void 0?typeof o=="string"?U(e).fill(n,o):U(e).fill(n):U(e)}d.alloc=function(e,n,o){return ba(e,n,o)};function fn(e){return Eo(e),U(e<0?0:un(e)|0)}d.allocUnsafe=function(e){return fn(e)};d.allocUnsafeSlow=function(e){return fn(e)};function xa(e,n){if((typeof n!="string"||n==="")&&(n="utf8"),!d.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=No(e,n)|0,t=U(o),a=t.write(e,n);return a!==o&&(t=t.slice(0,a)),t}function _n(e){for(var n=e.length<0?0:un(e.length)|0,o=U(n),t=0;t<n;t+=1)o[t]=e[t]&255;return o}function ya(e){if(P(e,Uint8Array)){var n=new Uint8Array(e);return ln(n.buffer,n.byteOffset,n.byteLength)}return _n(e)}function ln(e,n,o){if(n<0||e.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');var t;return n===void 0&&o===void 0?t=new Uint8Array(e):o===void 0?t=new Uint8Array(e,n):t=new Uint8Array(e,n,o),Object.setPrototypeOf(t,d.prototype),t}function Ta(e){if(d.isBuffer(e)){var n=un(e.length)|0,o=U(n);return o.length===0||e.copy(o,0,0,n),o}if(e.length!==void 0)return typeof e.length!="number"||hn(e.length)?U(0):_n(e);if(e.type==="Buffer"&&Array.isArray(e.data))return _n(e.data)}function un(e){if(e>=Le)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Le.toString(16)+" bytes");return e|0}function wa(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==d.prototype};d.compare=function(n,o){if(P(n,Uint8Array)&&(n=d.from(n,n.offset,n.byteLength)),P(o,Uint8Array)&&(o=d.from(o,o.offset,o.byteLength)),!d.isBuffer(n)||!d.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;for(var t=n.length,a=o.length,i=0,c=Math.min(t,a);i<c;++i)if(n[i]!==o[i]){t=n[i],a=o[i];break}return t<a?-1:a<t?1:0};d.isEncoding=function(n){switch(String(n).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(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return d.alloc(0);var t;if(o===void 0)for(o=0,t=0;t<n.length;++t)o+=n[t].length;var a=d.allocUnsafe(o),i=0;for(t=0;t<n.length;++t){var c=n[t];if(P(c,Uint8Array))i+c.length>a.length?d.from(c).copy(a,i):Uint8Array.prototype.set.call(a,c,i);else if(d.isBuffer(c))c.copy(a,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=c.length}return a};function No(e,n){if(d.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||P(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 o=e.length,t=arguments.length>2&&arguments[2]===!0;if(!t&&o===0)return 0;for(var a=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return gn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Co(e).length;default:if(a)return t?-1:gn(e).length;n=(""+n).toLowerCase(),a=!0}}d.byteLength=No;function qa(e,n,o){var t=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(e||(e="utf8");;)switch(e){case"hex":return La(this,n,o);case"utf8":case"utf-8":return Mo(this,n,o);case"ascii":return Ma(this,n,o);case"latin1":case"binary":return Ia(this,n,o);case"base64":return Na(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ra(this,n,o);default:if(t)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),t=!0}}d.prototype._isBuffer=!0;function K(e,n,o){var t=e[n];e[n]=e[o],e[o]=t}d.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)K(this,o,o+1);return this};d.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)K(this,o,o+3),K(this,o+1,o+2);return this};d.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)K(this,o,o+7),K(this,o+1,o+6),K(this,o+2,o+5),K(this,o+3,o+4);return this};d.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?Mo(this,0,n):qa.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(n){if(!d.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:d.compare(this,n)===0};d.prototype.inspect=function(){var n="",o=pe.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"};ko&&(d.prototype[ko]=d.prototype.inspect);d.prototype.compare=function(n,o,t,a,i){if(P(n,Uint8Array)&&(n=d.from(n,n.offset,n.byteLength)),!d.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),t===void 0&&(t=n?n.length:0),a===void 0&&(a=0),i===void 0&&(i=this.length),o<0||t>n.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&o>=t)return 0;if(a>=i)return-1;if(o>=t)return 1;if(o>>>=0,t>>>=0,a>>>=0,i>>>=0,this===n)return 0;for(var c=i-a,l=t-o,_=Math.min(c,l),g=this.slice(a,i),b=n.slice(o,t),u=0;u<_;++u)if(g[u]!==b[u]){c=g[u],l=b[u];break}return c<l?-1:l<c?1:0};function Do(e,n,o,t,a){if(e.length===0)return-1;if(typeof o=="string"?(t=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,hn(o)&&(o=a?0:e.length-1),o<0&&(o=e.length+o),o>=e.length){if(a)return-1;o=e.length-1}else if(o<0)if(a)o=0;else return-1;if(typeof n=="string"&&(n=d.from(n,t)),d.isBuffer(n))return n.length===0?-1:So(e,n,o,t,a);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(e,n,o):Uint8Array.prototype.lastIndexOf.call(e,n,o):So(e,[n],o,t,a);throw new TypeError("val must be string, number or Buffer")}function So(e,n,o,t,a){var i=1,c=e.length,l=n.length;if(t!==void 0&&(t=String(t).toLowerCase(),t==="ucs2"||t==="ucs-2"||t==="utf16le"||t==="utf-16le")){if(e.length<2||n.length<2)return-1;i=2,c/=2,l/=2,o/=2}function _(v,C){return i===1?v[C]:v.readUInt16BE(C*i)}var g;if(a){var b=-1;for(g=o;g<c;g++)if(_(e,g)===_(n,b===-1?0:g-b)){if(b===-1&&(b=g),g-b+1===l)return b*i}else b!==-1&&(g-=g-b),b=-1}else for(o+l>c&&(o=c-l),g=o;g>=0;g--){for(var u=!0,S=0;S<l;S++)if(_(e,g+S)!==_(n,S)){u=!1;break}if(u)return g}return-1}d.prototype.includes=function(n,o,t){return this.indexOf(n,o,t)!==-1};d.prototype.indexOf=function(n,o,t){return Do(this,n,o,t,!0)};d.prototype.lastIndexOf=function(n,o,t){return Do(this,n,o,t,!1)};function ka(e,n,o,t){o=Number(o)||0;var a=e.length-o;t?(t=Number(t),t>a&&(t=a)):t=a;var i=n.length;t>i/2&&(t=i/2);for(var c=0;c<t;++c){var l=parseInt(n.substr(c*2,2),16);if(hn(l))return c;e[o+c]=l}return c}function Sa(e,n,o,t){return Re(gn(n,e.length-o),e,o,t)}function va(e,n,o,t){return Re(Pa(n),e,o,t)}function Aa(e,n,o,t){return Re(Co(n),e,o,t)}function Ea(e,n,o,t){return Re(ja(n,e.length-o),e,o,t)}d.prototype.write=function(n,o,t,a){if(o===void 0)a="utf8",t=this.length,o=0;else if(t===void 0&&typeof o=="string")a=o,t=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(t)?(t=t>>>0,a===void 0&&(a="utf8")):(a=t,t=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-o;if((t===void 0||t>i)&&(t=i),n.length>0&&(t<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var c=!1;;)switch(a){case"hex":return ka(this,n,o,t);case"utf8":case"utf-8":return Sa(this,n,o,t);case"ascii":case"latin1":case"binary":return va(this,n,o,t);case"base64":return Aa(this,n,o,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ea(this,n,o,t);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),c=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Na(e,n,o){return n===0&&o===e.length?dn.fromByteArray(e):dn.fromByteArray(e.slice(n,o))}function Mo(e,n,o){o=Math.min(e.length,o);for(var t=[],a=n;a<o;){var i=e[a],c=null,l=i>239?4:i>223?3:i>191?2:1;if(a+l<=o){var _,g,b,u;switch(l){case 1:i<128&&(c=i);break;case 2:_=e[a+1],(_&192)===128&&(u=(i&31)<<6|_&63,u>127&&(c=u));break;case 3:_=e[a+1],g=e[a+2],(_&192)===128&&(g&192)===128&&(u=(i&15)<<12|(_&63)<<6|g&63,u>2047&&(u<55296||u>57343)&&(c=u));break;case 4:_=e[a+1],g=e[a+2],b=e[a+3],(_&192)===128&&(g&192)===128&&(b&192)===128&&(u=(i&15)<<18|(_&63)<<12|(g&63)<<6|b&63,u>65535&&u<1114112&&(c=u))}}c===null?(c=65533,l=1):c>65535&&(c-=65536,t.push(c>>>10&1023|55296),c=56320|c&1023),t.push(c),a+=l}return Da(t)}var vo=4096;function Da(e){var n=e.length;if(n<=vo)return String.fromCharCode.apply(String,e);for(var o="",t=0;t<n;)o+=String.fromCharCode.apply(String,e.slice(t,t+=vo));return o}function Ma(e,n,o){var t="";o=Math.min(e.length,o);for(var a=n;a<o;++a)t+=String.fromCharCode(e[a]&127);return t}function Ia(e,n,o){var t="";o=Math.min(e.length,o);for(var a=n;a<o;++a)t+=String.fromCharCode(e[a]);return t}function La(e,n,o){var t=e.length;(!n||n<0)&&(n=0),(!o||o<0||o>t)&&(o=t);for(var a="",i=n;i<o;++i)a+=za[e[i]];return a}function Ra(e,n,o){for(var t=e.slice(n,o),a="",i=0;i<t.length-1;i+=2)a+=String.fromCharCode(t[i]+t[i+1]*256);return a}d.prototype.slice=function(n,o){var t=this.length;n=~~n,o=o===void 0?t:~~o,n<0?(n+=t,n<0&&(n=0)):n>t&&(n=t),o<0?(o+=t,o<0&&(o=0)):o>t&&(o=t),o<n&&(o=n);var a=this.subarray(n,o);return Object.setPrototypeOf(a,d.prototype),a};function k(e,n,o){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+n>o)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(n,o,t){n=n>>>0,o=o>>>0,t||k(n,o,this.length);for(var a=this[n],i=1,c=0;++c<o&&(i*=256);)a+=this[n+c]*i;return a};d.prototype.readUintBE=d.prototype.readUIntBE=function(n,o,t){n=n>>>0,o=o>>>0,t||k(n,o,this.length);for(var a=this[n+--o],i=1;o>0&&(i*=256);)a+=this[n+--o]*i;return a};d.prototype.readUint8=d.prototype.readUInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]|this[n+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]<<8|this[n+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])};d.prototype.readIntLE=function(n,o,t){n=n>>>0,o=o>>>0,t||k(n,o,this.length);for(var a=this[n],i=1,c=0;++c<o&&(i*=256);)a+=this[n+c]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*o)),a};d.prototype.readIntBE=function(n,o,t){n=n>>>0,o=o>>>0,t||k(n,o,this.length);for(var a=o,i=1,c=this[n+--a];a>0&&(i*=256);)c+=this[n+--a]*i;return i*=128,c>=i&&(c-=Math.pow(2,8*o)),c};d.prototype.readInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]};d.prototype.readInt16LE=function(n,o){n=n>>>0,o||k(n,2,this.length);var t=this[n]|this[n+1]<<8;return t&32768?t|4294901760:t};d.prototype.readInt16BE=function(n,o){n=n>>>0,o||k(n,2,this.length);var t=this[n+1]|this[n]<<8;return t&32768?t|4294901760:t};d.prototype.readInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24};d.prototype.readInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]};d.prototype.readFloatLE=function(n,o){return n=n>>>0,o||k(n,4,this.length),ce.read(this,n,!0,23,4)};d.prototype.readFloatBE=function(n,o){return n=n>>>0,o||k(n,4,this.length),ce.read(this,n,!1,23,4)};d.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||k(n,8,this.length),ce.read(this,n,!0,52,8)};d.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||k(n,8,this.length),ce.read(this,n,!1,52,8)};function E(e,n,o,t,a,i){if(!d.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>a||n<i)throw new RangeError('"value" argument is out of bounds');if(o+t>e.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(n,o,t,a){if(n=+n,o=o>>>0,t=t>>>0,!a){var i=Math.pow(2,8*t)-1;E(this,n,o,t,i,0)}var c=1,l=0;for(this[o]=n&255;++l<t&&(c*=256);)this[o+l]=n/c&255;return o+t};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(n,o,t,a){if(n=+n,o=o>>>0,t=t>>>0,!a){var i=Math.pow(2,8*t)-1;E(this,n,o,t,i,0)}var c=t-1,l=1;for(this[o+c]=n&255;--c>=0&&(l*=256);)this[o+c]=n/l&255;return o+t};d.prototype.writeUint8=d.prototype.writeUInt8=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,1,255,0),this[o]=n&255,o+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};d.prototype.writeIntLE=function(n,o,t,a){if(n=+n,o=o>>>0,!a){var i=Math.pow(2,8*t-1);E(this,n,o,t,i-1,-i)}var c=0,l=1,_=0;for(this[o]=n&255;++c<t&&(l*=256);)n<0&&_===0&&this[o+c-1]!==0&&(_=1),this[o+c]=(n/l>>0)-_&255;return o+t};d.prototype.writeIntBE=function(n,o,t,a){if(n=+n,o=o>>>0,!a){var i=Math.pow(2,8*t-1);E(this,n,o,t,i-1,-i)}var c=t-1,l=1,_=0;for(this[o+c]=n&255;--c>=0&&(l*=256);)n<0&&_===0&&this[o+c+1]!==0&&(_=1),this[o+c]=(n/l>>0)-_&255;return o+t};d.prototype.writeInt8=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1};d.prototype.writeInt16LE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2};d.prototype.writeInt16BE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2};d.prototype.writeInt32LE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4};d.prototype.writeInt32BE=function(n,o,t){return n=+n,o=o>>>0,t||E(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function Io(e,n,o,t,a,i){if(o+t>e.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Lo(e,n,o,t,a){return n=+n,o=o>>>0,a||Io(e,n,o,4,34028234663852886e22,-34028234663852886e22),ce.write(e,n,o,t,23,4),o+4}d.prototype.writeFloatLE=function(n,o,t){return Lo(this,n,o,!0,t)};d.prototype.writeFloatBE=function(n,o,t){return Lo(this,n,o,!1,t)};function Ro(e,n,o,t,a){return n=+n,o=o>>>0,a||Io(e,n,o,8,17976931348623157e292,-17976931348623157e292),ce.write(e,n,o,t,52,8),o+8}d.prototype.writeDoubleLE=function(n,o,t){return Ro(this,n,o,!0,t)};d.prototype.writeDoubleBE=function(n,o,t){return Ro(this,n,o,!1,t)};d.prototype.copy=function(n,o,t,a){if(!d.isBuffer(n))throw new TypeError("argument should be a Buffer");if(t||(t=0),!a&&a!==0&&(a=this.length),o>=n.length&&(o=n.length),o||(o=0),a>0&&a<t&&(a=t),a===t||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(t<0||t>=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),n.length-o<a-t&&(a=n.length-o+t);var i=a-t;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,t,a):Uint8Array.prototype.set.call(n,this.subarray(t,a),o),i};d.prototype.fill=function(n,o,t,a){if(typeof n=="string"){if(typeof o=="string"?(a=o,o=0,t=this.length):typeof t=="string"&&(a=t,t=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(n.length===1){var i=n.charCodeAt(0);(a==="utf8"&&i<128||a==="latin1")&&(n=i)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<t)throw new RangeError("Out of range index");if(t<=o)return this;o=o>>>0,t=t===void 0?this.length:t>>>0,n||(n=0);var c;if(typeof n=="number")for(c=o;c<t;++c)this[c]=n;else{var l=d.isBuffer(n)?n:d.from(n,a),_=l.length;if(_===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(c=0;c<t-o;++c)this[c+o]=l[c%_]}return this};var Ca=/[^+/0-9A-Za-z-_]/g;function Fa(e){if(e=e.split("=")[0],e=e.trim().replace(Ca,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function gn(e,n){n=n||1/0;for(var o,t=e.length,a=null,i=[],c=0;c<t;++c){if(o=e.charCodeAt(c),o>55295&&o<57344){if(!a){if(o>56319){(n-=3)>-1&&i.push(239,191,189);continue}else if(c+1===t){(n-=3)>-1&&i.push(239,191,189);continue}a=o;continue}if(o<56320){(n-=3)>-1&&i.push(239,191,189),a=o;continue}o=(a-55296<<10|o-56320)+65536}else a&&(n-=3)>-1&&i.push(239,191,189);if(a=null,o<128){if((n-=1)<0)break;i.push(o)}else if(o<2048){if((n-=2)<0)break;i.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;i.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;i.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return i}function Pa(e){for(var n=[],o=0;o<e.length;++o)n.push(e.charCodeAt(o)&255);return n}function ja(e,n){for(var o,t,a,i=[],c=0;c<e.length&&!((n-=2)<0);++c)o=e.charCodeAt(c),t=o>>8,a=o%256,i.push(a),i.push(t);return i}function Co(e){return dn.toByteArray(Fa(e))}function Re(e,n,o,t){for(var a=0;a<t&&!(a+o>=n.length||a>=e.length);++a)n[a+o]=e[a];return a}function P(e,n){return e instanceof n||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===n.name}function hn(e){return e!==e}var za=function(){for(var e="0123456789abcdef",n=new Array(256),o=0;o<16;++o)for(var t=o*16,a=0;a<16;++a)n[t+a]=e[o]+e[a];return n}()});var Oo=De((uc,Uo)=>{r();var T=Uo.exports={},j,z;function bn(){throw new Error("setTimeout has not been defined")}function xn(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?j=setTimeout:j=bn}catch(e){j=bn}try{typeof clearTimeout=="function"?z=clearTimeout:z=xn}catch(e){z=xn}})();function Po(e){if(j===setTimeout)return setTimeout(e,0);if((j===bn||!j)&&setTimeout)return j=setTimeout,setTimeout(e,0);try{return j(e,0)}catch(n){try{return j.call(null,e,0)}catch(o){return j.call(this,e,0)}}}function Ua(e){if(z===clearTimeout)return clearTimeout(e);if((z===xn||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(e);try{return z(e)}catch(n){try{return z.call(null,e)}catch(o){return z.call(this,e)}}}var O=[],se=!1,J,Ce=-1;function Oa(){!se||!J||(se=!1,J.length?O=J.concat(O):Ce=-1,O.length&&jo())}function jo(){if(!se){var e=Po(Oa);se=!0;for(var n=O.length;n;){for(J=O,O=[];++Ce<n;)J&&J[Ce].run();Ce=-1,n=O.length}J=null,se=!1,Ua(e)}}T.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)n[o-1]=arguments[o];O.push(new zo(e,n)),O.length===1&&!se&&Po(jo)};function zo(e,n){this.fun=e,this.array=n}zo.prototype.run=function(){this.fun.apply(null,this.array)};T.title="browser";T.browser=!0;T.env={};T.argv=[];T.version="";T.versions={};function B(){}T.on=B;T.addListener=B;T.once=B;T.off=B;T.removeListener=B;T.removeAllListeners=B;T.emit=B;T.prependListener=B;T.prependOnceListener=B;T.listeners=function(e){return[]};T.binding=function(e){throw new Error("process.binding is not supported")};T.cwd=function(){return"/"};T.chdir=function(e){throw new Error("process.chdir is not supported")};T.umask=function(){return 0}});var p,s,hc,r=h(()=>{p=y(Fo()),s=y(Oo()),hc=function(e){function n(){var t=this||self;return delete e.prototype.__magic__,t}if(typeof globalThis=="object")return globalThis;if(this)return n();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:n});var o=__magic__;return o}(Object)});var Fe,yn=h(()=>{"use strict";r();Fe=()=>Date.now()/1e3});var Bo=h(()=>{"use strict";r()});var Go=h(()=>{"use strict";r()});var Vo=h(()=>{"use strict";r();yn();Bo();Go()});var wn={};ie(wn,{getItem:()=>Ga,localStorageKeys:()=>ee,removeItem:()=>Va,setItem:()=>Ba});var ee,Tn,Ba,Ga,Va,ye=h(()=>{"use strict";r();Vo();ee={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},Tn=typeof localStorage!="undefined",Ba=({key:e,data:n,expires:o})=>{!Tn||localStorage.setItem(String(e),JSON.stringify({expires:o,data:n}))},Ga=e=>{if(!Tn)return;let n=localStorage.getItem(String(e));if(!n)return null;let o=JSON.parse(n);return!o||!o.hasOwnProperty("expires")||!o.hasOwnProperty("data")?null:Fe()>=o.expires?(localStorage.removeItem(String(e)),null):o.data},Va=e=>{!Tn||localStorage.removeItem(String(e))}});var qn={};ie(qn,{clear:()=>Yo,getItem:()=>Ho,removeItem:()=>Zo,setItem:()=>Wo,storage:()=>Wa});var Wo,Ho,Zo,Yo,Wa,$o=h(()=>{"use strict";r();Wo=({key:e,data:n,expires:o})=>{sessionStorage.setItem(String(e),JSON.stringify({expires:o,data:n}))},Ho=e=>{let n=sessionStorage.getItem(String(e));if(!n)return null;let o=JSON.parse(n);return!o||!o.hasOwnProperty("expires")||!o.hasOwnProperty("data")?null:Date.now()>=o.expires?(sessionStorage.removeItem(String(e)),null):o.data},Zo=e=>sessionStorage.removeItem(String(e)),Yo=()=>sessionStorage.clear(),Wa={setItem:Wo,getItem:Ho,removeItem:Zo,clear:Yo}});var me,Pe=h(()=>{"use strict";r();ye();$o();me={session:qn,local:wn}});function Te(){return new Date().setHours(new Date().getHours()+24)}function we(e){me.local.setItem({key:ee.loginExpiresAt,data:e,expires:e})}var kn=h(()=>{"use strict";r();Pe();ye()});var R=h(()=>{"use strict";r()});var Qo=h(()=>{"use strict";r()});var Xo=h(()=>{"use strict";r()});var A=h(()=>{"use strict";r()});var Ko=h(()=>{"use strict";r()});var Jo=h(()=>{"use strict";r()});var et=h(()=>{"use strict";r()});var nt=h(()=>{"use strict";r()});var V=h(()=>{"use strict";r();Xo();A();R();Ko();Jo();et();nt()});var qe,ot,Wc,tt,Hc,rt,Zc,Yc,$c,at=h(()=>{"use strict";r();V();qe={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:ot,egldLabel:Wc}=qe["devnet"],{chainId:tt,egldLabel:Hc}=qe["testnet"],{chainId:rt,egldLabel:Zc}=qe["mainnet"],Yc={["devnet"]:ot,["testnet"]:tt,["mainnet"]:rt},$c={[ot]:"devnet",[tt]:"testnet",[rt]:"mainnet"}});var Sn=h(()=>{"use strict";r()});var ct=h(()=>{"use strict";r()});var pt,vn=h(()=>{"use strict";r();pt="transaction-status-toast-id"});var An,En,st,Nn,mt,je,dt,de,w=h(()=>{"use strict";r();Qo();at();Sn();ct();vn();An=5e4,En=1e9,st=1,Nn=4294967295,mt=4294967280,je="logout",dt="login",de="0"});var Dn,N,ze,W=h(()=>{"use strict";r();Dn=require("@reduxjs/toolkit");w();N=(0,Dn.createAction)(je),ze=(0,Dn.createAction)(dt,e=>({payload:e}))});var lt,_t,gt,lp,gp,fp,up,hp,bp,ft,ut,Mn=h(()=>{"use strict";r();lt=require("@reduxjs/toolkit");kn();R();W();_t={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},gt=(0,lt.createSlice)({name:"loginInfoSlice",initialState:_t,reducers:{setLoginMethod:(e,n)=>{e.loginMethod=n.payload},setTokenLogin:(e,n)=>{e.tokenLogin=n.payload},setTokenLoginSignature:(e,n)=>{(e==null?void 0:e.tokenLogin)!=null&&(e.tokenLogin.signature=n.payload)},setWalletLogin:(e,n)=>{e.walletLogin=n.payload},setWalletConnectLogin:(e,n)=>{e.walletConnectLogin=n.payload},setLedgerLogin:(e,n)=>{e.ledgerLogin=n.payload},invalidateLoginSession:e=>{e.isLoginSessionInvalid=!0}},extraReducers:e=>{e.addCase(N,()=>_t),e.addCase(ze,(n,o)=>{n.loginMethod=o.payload.loginMethod,we(Te())})}}),{setLoginMethod:lp,setWalletConnectLogin:gp,setLedgerLogin:fp,setTokenLogin:up,setTokenLoginSignature:hp,setWalletLogin:bp,invalidateLoginSession:ft}=gt.actions,ut=gt.reducer});var ht=h(()=>{"use strict";r()});var bt=h(()=>{"use strict";r();ht()});function In(e){return e[Math.floor(Math.random()*e.length)]}var xt=h(()=>{"use strict";r()});var yt=h(()=>{"use strict";r();Sn()});var Tt=h(()=>{"use strict";r();bt();xt();yt()});var wt,qt,Ln,Za,kt,Rp,Cp,St,Rn=h(()=>{"use strict";r();wt=require("@reduxjs/toolkit"),qt=y(require("lodash.omit"));Tt();Ln={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},Za={network:Ln,chainID:"-1"},kt=(0,wt.createSlice)({name:"appConfig",initialState:Za,reducers:{initializeNetworkConfig:(e,n)=>{let o=In(n.payload.walletConnectBridgeAddresses),t=In(n.payload.walletConnectV2RelayAddresses),a=(0,qt.default)(n.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");e.network=q(x(x({},e.network),a),{walletConnectBridgeAddress:o,walletConnectV2RelayAddress:t})},setChainID:(e,n)=>{e.chainID=n.payload}}}),{initializeNetworkConfig:Rp,setChainID:Cp}=kt.actions,St=kt.reducer});var Fn,vt,At,Ue,Cn,Et,Nt,Gp,Dt,Vp,Wp,Hp,Zp,Yp,$p,Qp,Mt,Pn=h(()=>{"use strict";r();Fn=require("@elrondnetwork/erdjs"),vt=require("@reduxjs/toolkit"),At=require("redux-persist");w();Pe();ye();W();Ue={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:de},Cn={address:"",websocketEvent:null,accounts:{"":Ue},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},Et=(0,vt.createSlice)({name:"accountInfoSlice",initialState:Cn,reducers:{setAddress:(e,n)=>{let o=n.payload;e.address=o,e.publicKey=new Fn.Address(o).hex()},setAccount:(e,n)=>{let o=e.address===n.payload.address;e.accounts={[e.address]:o?n.payload:Ue},e.isAccountLoading=!1,e.accountLoadingError=null},setAccountNonce:(e,n)=>{let{address:o}=e;e.accounts[o].nonce=n.payload},setAccountShard:(e,n)=>{e.shard=n.payload},setLedgerAccount:(e,n)=>{e.ledgerAccount=n.payload},updateLedgerAccount:(e,n)=>{e.ledgerAccount!=null&&(e.ledgerAccount.index=n.payload.index,e.ledgerAccount.address=n.payload.address)},setWalletConnectAccount:(e,n)=>{e.walletConnectAccount=n.payload},setIsAccountLoading:(e,n)=>{e.isAccountLoading=n.payload,e.accountLoadingError=null},setAccountLoadingError:(e,n)=>{e.accountLoadingError=n.payload,e.isAccountLoading=!1},setWebsocketEvent:(e,n)=>{e.websocketEvent={timestamp:Date.now(),message:n.payload}}},extraReducers:e=>{e.addCase(N,()=>(me.local.removeItem(ee.loginExpiresAt),Cn)),e.addCase(ze,(n,o)=>{let{address:t}=o.payload;n.address=t,n.publicKey=new Fn.Address(t).hex()}),e.addCase(At.REHYDRATE,(n,o)=>{var g;if(!((g=o.payload)!=null&&g.account))return;let{account:t}=o.payload,{address:a,shard:i,accounts:c,publicKey:l}=t;n.address=a,n.shard=i;let _=c&&a in c;n.accounts=_?c:Cn.accounts,n.publicKey=l})}}),{setAccount:Nt,setAddress:Gp,setAccountNonce:Dt,setAccountShard:Vp,setLedgerAccount:Wp,updateLedgerAccount:Hp,setWalletConnectAccount:Zp,setIsAccountLoading:Yp,setAccountLoadingError:$p,setWebsocketEvent:Qp}=Et.actions,Mt=Et.reducer});function It(e){return e!=null&&(oi(e)||ii(e))}function Oe(e){return e!=null&&(ti(e)||ci(e))}function Be(e){return e!=null&&(ri(e)||pi(e))}function Lt(e){return e!=null&&ai(e)}function oi(e){return e!=null&&$a.includes(e)}function ti(e){return e!=null&&Qa.includes(e)}function ri(e){return e!=null&&Xa.includes(e)}function ai(e){return e!=null&&Ka.includes(e)}function ii(e){return e!=null&&Ja.includes(e)}function ci(e){return e!=null&&ei.includes(e)}function pi(e){return e!=null&&ni.includes(e)}var $a,Qa,Xa,Ka,Ja,ei,ni,zn=h(()=>{"use strict";r();R();$a=["sent"],Qa=["success"],Xa=["fail","cancelled","timedOut"],Ka=["timedOut"],Ja=["pending"],ei=["success"],ni=["fail","invalid"]});var Rt,Ct,ke,si,Ft,as,is,cs,ps,ss,ms,ds,_s,ls,gs,Ge,Ve=h(()=>{"use strict";r();Rt=require("@reduxjs/toolkit"),Ct=require("redux-persist");R();zn();W();ke={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},si={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Ft=(0,Rt.createSlice)({name:"transactionsSlice",initialState:ke,reducers:{moveTransactionsToSignedState:(e,n)=>{var _,g;let{sessionId:o,transactions:t,errorMessage:a,status:i,redirectRoute:c}=n.payload,l=((_=e.customTransactionInformationForSessionId)==null?void 0:_[o])||si;e.signedTransactions[o]={transactions:t,status:i,errorMessage:a,redirectRoute:c,customTransactionInformation:l},((g=e==null?void 0:e.transactionsToSign)==null?void 0:g.sessionId)===o&&(e.transactionsToSign=ke.transactionsToSign)},clearSignedTransaction:(e,n)=>{e.signedTransactions[n.payload]&&delete e.signedTransactions[n.payload]},clearTransactionToSign:e=>{e!=null&&e.transactionsToSign&&(e.transactionsToSign=null)},updateSignedTransaction:(e,n)=>{e.signedTransactions=x(x({},e.signedTransactions),n.payload)},updateSignedTransactions:(e,n)=>{let{sessionId:o,status:t,errorMessage:a,transactions:i}=n.payload;e.signedTransactions[o]!=null&&(e.signedTransactions[o].status=t,a!=null&&(e.signedTransactions[o].errorMessage=a),i!=null&&(e.signedTransactions[o].transactions=i))},updateSignedTransactionStatus:(e,n)=>{var l,_,g,b,u,S;let{sessionId:o,status:t,errorMessage:a,transactionHash:i}=n.payload,c=(_=(l=e.signedTransactions)==null?void 0:l[o])==null?void 0:_.transactions;if(c!=null){e.signedTransactions[o].transactions=c.map(M=>M.hash===i?q(x({},M),{status:t,errorMessage:a}):M);let v=(b=(g=e.signedTransactions[o])==null?void 0:g.transactions)==null?void 0:b.every(M=>Oe(M.status)),C=(S=(u=e.signedTransactions[o])==null?void 0:u.transactions)==null?void 0:S.every(M=>Be(M.status));v&&(e.signedTransactions[o].status="success"),C&&(e.signedTransactions[o].status="fail")}},setTransactionsToSign:(e,n)=>{e.transactionsToSign=n.payload;let{sessionId:o,customTransactionInformation:t}=n.payload;e.customTransactionInformationForSessionId[o]=t,e.signTransactionsError=null},clearAllTransactionsToSign:e=>{e.transactionsToSign=ke.transactionsToSign,e.signTransactionsError=null},clearAllSignedTransactions:e=>{e.signedTransactions=ke.signedTransactions},setSignTransactionsError:(e,n)=>{e.signTransactionsError=n.payload},setSignTransactionsCancelMessage:(e,n)=>{e.signTransactionsCancelMessage=n.payload}},extraReducers:e=>{e.addCase(N,()=>ke),e.addCase(Ct.REHYDRATE,(n,o)=>{var c;if(n.signTransactionsCancelMessage=null,!((c=o.payload)!=null&&c.transactions))return;let{signedTransactions:t,customTransactionInformationForSessionId:a}=o.payload.transactions,i=Object.entries(t).reduce((l,[_,g])=>{let b=new Date(_),u=new Date;return u.setHours(u.getHours()+5),u-b>0||(l[_]=g),l},{});a!=null&&(n.customTransactionInformationForSessionId=a),t!=null&&(n.signedTransactions=i)})}}),{updateSignedTransactionStatus:as,updateSignedTransactions:is,setTransactionsToSign:cs,clearAllTransactionsToSign:ps,clearAllSignedTransactions:ss,clearSignedTransaction:ms,clearTransactionToSign:ds,setSignTransactionsError:_s,setSignTransactionsCancelMessage:ls,moveTransactionsToSignedState:gs}=Ft.actions,Ge=Ft.reducer});var Pt,On,Bn,Gn,mi,Un,jt,bs,xs,ys,We,He=h(()=>{"use strict";r();Pt=require("@reduxjs/toolkit");W();On="Transaction failed",Bn="Transaction successful",Gn="Processing transaction",mi="Transaction submitted",Un={},jt=(0,Pt.createSlice)({name:"transactionsInfo",initialState:Un,reducers:{setTransactionsDisplayInfo(e,n){let{sessionId:o,transactionsDisplayInfo:t}=n.payload;o!=null&&(e[o]={errorMessage:(t==null?void 0:t.errorMessage)||On,successMessage:(t==null?void 0:t.successMessage)||Bn,processingMessage:(t==null?void 0:t.processingMessage)||Gn,submittedMessage:(t==null?void 0:t.submittedMessage)||mi,transactionDuration:t==null?void 0:t.transactionDuration})},clearTransactionsInfoForSessionId(e,n){n.payload!=null&&delete e[n.payload]},clearTransactionsInfo:()=>Un},extraReducers:e=>{e.addCase(N,()=>Un)}}),{clearTransactionsInfo:bs,setTransactionsDisplayInfo:xs,clearTransactionsInfoForSessionId:ys}=jt.actions,We=jt.reducer});var Ut,zt,Ot,ks,Ss,vs,As,Bt,Vn=h(()=>{"use strict";r();Ut=require("@reduxjs/toolkit");W();zt={},Ot=(0,Ut.createSlice)({name:"modalsSlice",initialState:zt,reducers:{setTxSubmittedModal:(e,n)=>{e.txSubmittedModal=n.payload},setNotificationModal:(e,n)=>{e.notificationModal=n.payload},clearTxSubmittedModal:e=>{e.txSubmittedModal=void 0},clearNotificationModal:e=>{e.notificationModal=void 0}},extraReducers:e=>{e.addCase(N,()=>zt)}}),{setTxSubmittedModal:ks,setNotificationModal:Ss,clearTxSubmittedModal:vs,clearNotificationModal:As}=Ot.actions,Bt=Ot.reducer});var Vt,Wt,Gt,Ht,Cs,Fs,Ps,js,zs,Us,Ze,Ye=h(()=>{"use strict";r();Vt=require("@reduxjs/toolkit"),Wt=require("redux-persist");vn();V();yn();W();Gt={customToasts:[],transactionToasts:[],failTransactionToast:null},Ht=(0,Vt.createSlice)({name:"toastsSlice",initialState:Gt,reducers:{addCustomToast:(e,n)=>{e.customToasts.push(q(x({},n.payload),{type:"custom",toastId:n.payload.toastId||`custom-toast-${e.customToasts.length+1}`}))},removeCustomToast:(e,n)=>{e.customToasts=e.customToasts.filter(o=>o.toastId!==n.payload)},addTransactionToast:(e,n)=>{e.transactionToasts.push({type:"transaction",startTimestamp:Fe(),toastId:n.payload||`custom-toast-${e.transactionToasts.length+1}`})},removeTransactionToast:(e,n)=>{e.transactionToasts=e.transactionToasts.filter(o=>o.toastId!==n.payload)},addFailTransactionToast:(e,n)=>{e.failTransactionToast=q(x({},n.payload),{toastId:pt})},removeFailTransactionToast:e=>{e.failTransactionToast=null}},extraReducers:e=>{e.addCase(N,()=>Gt),e.addCase(Wt.REHYDRATE,(n,o)=>{var a,i;let t=(i=(a=o.customToasts)==null?void 0:a.filter(c=>!("component"in c)))!=null?i:[];n.customToasts=t})}}),{addCustomToast:Cs,removeCustomToast:Fs,addTransactionToast:Ps,removeTransactionToast:js,addFailTransactionToast:zs,removeFailTransactionToast:Us}=Ht.actions,Ze=Ht.reducer});var _e=h(()=>{"use strict";r();Mn();Rn();Pn();Ve();He();Vn();Ye()});var Wn=h(()=>{"use strict";r()});var Qt,$t,Xt,im,cm,pm,sm,mm,dm,Kt,Jt=h(()=>{"use strict";r();Qt=require("@reduxjs/toolkit");W();$t={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},Xt=(0,Qt.createSlice)({name:"dappModalsSlice",initialState:$t,reducers:{setDappModalVisibility:(e,n)=>{e.visible=n.payload},setDappModalHeaderVisibility:(e,n)=>{e.modal.showHeader=n.payload},setDappModalFooterVisibility:(e,n)=>{e.modal.showFooter=n.payload},setDappModalHeaderText:(e,n)=>{e.modal.headerText=n.payload},setDappModalFooterText:(e,n)=>{e.modal.footerText=n.payload},setDappModalConfig:(e,n)=>{e.modal=x({},n.payload)}},extraReducers:e=>{e.addCase(N,()=>$t)}}),{setDappModalVisibility:im,setDappModalHeaderVisibility:cm,setDappModalFooterVisibility:pm,setDappModalHeaderText:sm,setDappModalFooterText:mm,setDappModalConfig:dm}=Xt.actions,Kt=Xt.reducer});var er,gi,fi,le,Qe=h(()=>{"use strict";r();er=require("@reduxjs/toolkit");Wn();Pn();Jt();Mn();Vn();Rn();Ye();He();Ve();gi={["account"]:Mt,["networkConfig"]:St,["loginInfo"]:ut,["modals"]:Bt,["dappModal"]:Kt,["toasts"]:Ze,["transactions"]:Ge,["transactionsInfo"]:We},fi=(e={})=>(0,er.combineReducers)(x(x({},gi),e)),le=fi});var tr={};ie(tr,{default:()=>wi});function Hn(e,n=[]){return{key:e,version:1,storage:or.default,blacklist:n}}var ne,nr,or,ui,hi,bi,xi,yi,Ti,wi,rr=h(()=>{"use strict";r();ne=require("redux-persist"),nr=y(require("redux-persist/lib/storage")),or=y(require("redux-persist/lib/storage/session"));Qe();_e();Ye();He();Ve();Wn();ui={2:e=>q(x({},e),{networkConfig:Ln})};hi=Hn("dapp-core-transactionsInfo"),bi=Hn("dapp-core-transactions",["transactionsToSign"]),xi=Hn("dapp-core-toasts"),yi={key:"dapp-core-store",version:2,storage:nr.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,ne.createMigrate)(ui,{debug:!1})},Ti={["toasts"]:(0,ne.persistReducer)(xi,Ze),["transactions"]:(0,ne.persistReducer)(bi,Ge),["transactionsInfo"]:(0,ne.persistReducer)(hi,We)},wi=(0,ne.persistReducer)(yi,le(Ti))});var ar={};ie(ar,{default:()=>qi});var qi,ir=h(()=>{"use strict";r();Qe();qi=le()});var cr={};ie(cr,{default:()=>Si});var L,ki,Si,pr=h(()=>{"use strict";r();L=require("redux-persist"),ki=[L.FLUSH,L.REHYDRATE,L.PAUSE,L.PERSIST,L.PURGE,L.REGISTER],Si=ki});var dr={};ie(dr,{default:()=>mr});function mr(e){return(0,sr.persistStore)(e)}var sr,_r=h(()=>{"use strict";r();sr=require("redux-persist")});r();var oa=y(require("react")),ta=require("@testing-library/react");r();var re=y(require("react")),Ee=y(require("classnames"));r();r();var _o=y(require("react")),Qr=require("@fortawesome/free-solid-svg-icons"),Xr=require("@fortawesome/react-fontawesome"),Kr=y(require("classnames"));r();r();var br=require("react"),fe=require("react-redux");r();var Zn=require("@reduxjs/toolkit"),ur=require("react-redux/es/utils/Subscription");_e();r();var Zt=y(require("lodash.throttle"));w();_e();kn();Pe();ye();var di=[je],_i=(0,Zt.default)(()=>{we(Te())},5e3),Yt=e=>n=>o=>{var _;if(di.includes(o.type))return n(o);let t=e.getState(),a=me.local.getItem(ee.loginExpiresAt);if(!((_=t==null?void 0:t.loginInfo)==null?void 0:_.isLoggedIn))return n(o);if(a==null)return we(Te());let c=Date.now();return a-c<0?setTimeout(()=>xo(void 0,null,function*(){console.log("session expired");try{e.dispatch(ft())}catch(g){console.error("error logging out",g)}}),1e3):(_i(),n(o))};r();r();function $e(){return typeof sessionStorage!="undefined"}var lr=$e()?(rr(),Me(tr)).default:(ir(),Me(ar)).default,gr=$e()?(pr(),Me(cr)).default:[],fr=$e()?(_r(),Me(dr)).default:e=>e;Qe();var ge=(0,Zn.configureStore)({reducer:lr,middleware:e=>e({serializableCheck:{ignoredActions:[...gr,Dt.type,Nt.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(Yt)}),hr=(0,ur.createSubscription)(ge),Fm=fr(ge),Pm=(0,Zn.configureStore)({reducer:le});var vi={store:ge,subscription:hr},Yn=(0,br.createContext)(vi),Om=(0,fe.createStoreHook)(Yn),Bm=(0,fe.createDispatchHook)(Yn),xr=(0,fe.createSelectorHook)(Yn);r();r();_e();r();var yr=y(require("lodash.isequal")),Xe=require("reselect"),f=(0,Xe.createSelectorCreator)(Xe.defaultMemoize,yr.default);var G=e=>e.account,$n=f(G,e=>e.address),Qn=f(G,$n,(e,n)=>n in e.accounts?e.accounts[n]:Ue),Zm=f(G,Qn,(e,n)=>{let a=e,{accounts:o}=a,t=ae(a,["accounts"]);return q(x({},t),{account:n})}),Ym=f(Qn,e=>e.balance),$m=f(Qn,e=>{var n;return((n=e==null?void 0:e.nonce)==null?void 0:n.valueOf())||0}),Qm=f(G,e=>e.shard),Xm=f(G,e=>e.ledgerAccount),Km=f(G,e=>e.walletConnectAccount),Jm=f(G,e=>e.isAccountLoading),ed=f(G,e=>e.accountLoadingError),nd=f(G,e=>e.websocketEvent);r();var H=e=>e.networkConfig,rd=f(H,e=>e.chainID),ad=f(H,e=>e.network.walletConnectBridgeAddress),id=f(H,e=>e.network.walletConnectV2RelayAddress),cd=f(H,e=>e.network.walletConnectV2ProjectId),pd=f(H,e=>e.network.walletConnectDeepLink),Xn=f(H,e=>e.network),sd=f(Xn,e=>e.apiAddress),Tr=f(Xn,e=>e.explorerAddress),md=f(Xn,e=>e.egldLabel);r();R();var ue=e=>e.loginInfo,fd=f(ue,e=>e.loginMethod),ud=f(ue,$n,(e,n)=>e.loginMethod!=""&&Boolean(n)),hd=f(ue,e=>e.walletConnectLogin),bd=f(ue,e=>e.ledgerLogin),xd=f(ue,e=>e.walletLogin),yd=f(ue,e=>e.isLoginSessionInvalid);r();r();var D=require("@elrondnetwork/erdjs");w();r();function Ke(e){try{return p.Buffer.from(e,"base64").toString()===atob(e)}catch(n){return!1}}function Kn(e){var a,i,c;let{data:n}=e,o=Ke(n!=null?n:"")?D.TransactionPayload.fromEncoded(n):new D.TransactionPayload(n),t=new D.Transaction(x({value:e.value.valueOf(),data:o,nonce:e.nonce.valueOf(),receiver:new D.Address(e.receiver),sender:new D.Address(e.sender),gasLimit:(a=e.gasLimit.valueOf())!=null?a:An,gasPrice:(i=e.gasPrice.valueOf())!=null?i:En,chainID:e.chainID.valueOf(),version:new D.TransactionVersion((c=e.version)!=null?c:st)},e.options?{options:new D.TransactionOptions(e.options)}:{}));return t.applySignature({hex:()=>e.signature||""},new D.Address(e.sender)),t}r();zn();r();var Ai=y(require("bignumber.js"));V();r();r();function Jn(e){for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>127)return!1;return!0}function Je(e){let n=e;try{let o=p.Buffer.from(e,"hex").toString();Jn(o)&&o.length>1&&(n=o)}catch(o){}return n}r();r();var no=require("@elrondnetwork/erdjs"),oo=y(require("bignumber.js"));R();r();var qr=require("@elrondnetwork/erdjs");function Ei(e){try{let n=new qr.Address(e);return Boolean(n.bech32())}catch(n){return!1}}function Se(e){return(e==null?void 0:e.startsWith("erd"))&&e.length===62&&/^\w+$/.test(e)&&Ei(e)}var eo={tokenId:"",amount:""},Ni=e=>e.split("@").map((i,c)=>[2,3].includes(c)?i:Je(i));function kr(e){if(!e)return eo;let n=e.startsWith("ESDTTransfer"),o=e.startsWith("ESDTNFTTransfer")&&e.includes("@");if(n){let[,t,a]=e.split("@");try{let i=p.Buffer.from(t,"hex").toString("ascii");if(!i)return eo;let c=new oo.default("0x"+a.replace("0x","")).toString(10);return{tokenId:i,amount:c}}catch(i){console.error("Error getting token from transaction data",i)}}if(o)try{let[,t,a,i,c]=Ni(e);if([t,a,i,c].every(l=>Boolean(l))&&Se(new no.Address(c).bech32()))return{tokenId:`${t}-${a}`,amount:new oo.default(i,16).toString(10),collection:t,nonce:a,receiver:new no.Address(c).bech32()}}catch(t){}return eo}r();r();r();var Di=require("@elrondnetwork/erdjs/out");r();w();r();var ve=require("@elrondnetwork/erdjs");V();var Mi=["ESDTNFTTransfer","ESDTNFTBurn","ESDTNFTAddQuantity","ESDTNFTCreate","MultiESDTNFTTransfer","ESDTTransfer","ESDTBurn","ESDTLocalMint","ESDTLocalBurn","ESDTWipe","ESDTFreeze"];function Sr(e,n,o=""){if(!Se(e))return!1;if(ne