@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
1 lines • 57 kB
JavaScript
"use strict";var si=Object.create;var Ae=Object.defineProperty,ci=Object.defineProperties,li=Object.getOwnPropertyDescriptor,pi=Object.getOwnPropertyDescriptors,ui=Object.getOwnPropertyNames,Me=Object.getOwnPropertySymbols,di=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty,vr=Object.prototype.propertyIsEnumerable;var br=(e,t,r)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>{for(var r in t||(t={}))Tt.call(t,r)&&br(e,r,t[r]);if(Me)for(var r of Me(t))vr.call(t,r)&&br(e,r,t[r]);return e},A=(e,t)=>ci(e,pi(t));var Ar=(e,t)=>{var r={};for(var o in e)Tt.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&Me)for(var o of Me(e))t.indexOf(o)<0&&vr.call(e,o)&&(r[o]=e[o]);return r};var y=(e,t)=>()=>(e&&(t=e(e=0)),t);var _e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),se=(e,t)=>{for(var r in t)Ae(e,r,{get:t[r],enumerable:!0})},Ir=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ui(t))!Tt.call(e,i)&&i!==r&&Ae(e,i,{get:()=>t[i],enumerable:!(o=li(t,i))||o.enumerable});return e};var b=(e,t,r)=>(r=e!=null?si(di(e)):{},Ir(t||!e||!e.__esModule?Ae(r,"default",{value:e,enumerable:!0}):r,e)),Ie=e=>Ir(Ae({},"__esModule",{value:!0}),e);var D=(e,t,r)=>new Promise((o,i)=>{var p=d=>{try{m(r.next(d))}catch(g){i(g)}},l=d=>{try{m(r.throw(d))}catch(g){i(g)}},m=d=>d.done?o(d.value):Promise.resolve(d.value).then(p,l);m((r=r.apply(e,t)).next())});var Lr=_e(Oe=>{"use strict";n();Oe.byteLength=gi;Oe.toByteArray=Ti;Oe.fromByteArray=xi;var G=[],B=[],mi=typeof Uint8Array!="undefined"?Uint8Array:Array,yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ce=0,Er=yt.length;ce<Er;++ce)G[ce]=yt[ce],B[yt.charCodeAt(ce)]=ce;var ce,Er;B["-".charCodeAt(0)]=62;B["_".charCodeAt(0)]=63;function kr(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var o=r===t?0:4-r%4;return[r,o]}function gi(e){var t=kr(e),r=t[0],o=t[1];return(r+o)*3/4-o}function fi(e,t,r){return(t+r)*3/4-r}function Ti(e){var t,r=kr(e),o=r[0],i=r[1],p=new mi(fi(e,o,i)),l=0,m=i>0?o-4:o,d;for(d=0;d<m;d+=4)t=B[e.charCodeAt(d)]<<18|B[e.charCodeAt(d+1)]<<12|B[e.charCodeAt(d+2)]<<6|B[e.charCodeAt(d+3)],p[l++]=t>>16&255,p[l++]=t>>8&255,p[l++]=t&255;return i===2&&(t=B[e.charCodeAt(d)]<<2|B[e.charCodeAt(d+1)]>>4,p[l++]=t&255),i===1&&(t=B[e.charCodeAt(d)]<<10|B[e.charCodeAt(d+1)]<<4|B[e.charCodeAt(d+2)]>>2,p[l++]=t>>8&255,p[l++]=t&255),p}function yi(e){return G[e>>18&63]+G[e>>12&63]+G[e>>6&63]+G[e&63]}function hi(e,t,r){for(var o,i=[],p=t;p<r;p+=3)o=(e[p]<<16&16711680)+(e[p+1]<<8&65280)+(e[p+2]&255),i.push(yi(o));return i.join("")}function xi(e){for(var t,r=e.length,o=r%3,i=[],p=16383,l=0,m=r-o;l<m;l+=p)i.push(hi(e,l,l+p>m?m:l+p));return o===1?(t=e[r-1],i.push(G[t>>2]+G[t<<4&63]+"==")):o===2&&(t=(e[r-2]<<8)+e[r-1],i.push(G[t>>10]+G[t>>4&63]+G[t<<2&63]+"=")),i.join("")}});var Dr=_e(ht=>{n();ht.read=function(e,t,r,o,i){var p,l,m=i*8-o-1,d=(1<<m)-1,g=d>>1,h=-7,T=r?i-1:0,k=r?-1:1,S=e[t+T];for(T+=k,p=S&(1<<-h)-1,S>>=-h,h+=m;h>0;p=p*256+e[t+T],T+=k,h-=8);for(l=p&(1<<-h)-1,p>>=-h,h+=o;h>0;l=l*256+e[t+T],T+=k,h-=8);if(p===0)p=1-g;else{if(p===d)return l?NaN:(S?-1:1)*(1/0);l=l+Math.pow(2,o),p=p-g}return(S?-1:1)*l*Math.pow(2,p-o)};ht.write=function(e,t,r,o,i,p){var l,m,d,g=p*8-i-1,h=(1<<g)-1,T=h>>1,k=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=o?0:p-1,_=o?1:-1,R=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,l=h):(l=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-l))<1&&(l--,d*=2),l+T>=1?t+=k/d:t+=k*Math.pow(2,1-T),t*d>=2&&(l++,d/=2),l+T>=h?(m=0,l=h):l+T>=1?(m=(t*d-1)*Math.pow(2,i),l=l+T):(m=t*Math.pow(2,T-1)*Math.pow(2,i),l=0));i>=8;e[r+S]=m&255,S+=_,m/=256,i-=8);for(l=l<<i|m,g+=i;g>0;e[r+S]=l&255,S+=_,l/=256,g-=8);e[r+S-_]|=R*128}});var Wr=_e(ge=>{"use strict";n();var xt=Lr(),me=Dr(),Cr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ge.Buffer=u;ge.SlowBuffer=Ii;ge.INSPECT_MAX_BYTES=50;var Be=2147483647;ge.kMaxLength=Be;u.TYPED_ARRAY_SUPPORT=Si();!u.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Si(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(r){return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.buffer}});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.byteOffset}});function Z(e){if(e>Be)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return vt(e)}return Rr(e,t,r)}u.poolSize=8192;function Rr(e,t,r){if(typeof e=="string")return bi(e,t);if(ArrayBuffer.isView(e))return vi(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(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return wt(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return u.from(o,t,r);var i=Ai(e);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}u.from=function(e,t,r){return Rr(e,t,r)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function Fr(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 wi(e,t,r){return Fr(e),e<=0?Z(e):t!==void 0?typeof r=="string"?Z(e).fill(t,r):Z(e).fill(t):Z(e)}u.alloc=function(e,t,r){return wi(e,t,r)};function vt(e){return Fr(e),Z(e<0?0:At(e)|0)}u.allocUnsafe=function(e){return vt(e)};u.allocUnsafeSlow=function(e){return vt(e)};function bi(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=Mr(e,t)|0,o=Z(r),i=o.write(e,t);return i!==r&&(o=o.slice(0,i)),o}function St(e){for(var t=e.length<0?0:At(e.length)|0,r=Z(t),o=0;o<t;o+=1)r[o]=e[o]&255;return r}function vi(e){if(q(e,Uint8Array)){var t=new Uint8Array(e);return wt(t.buffer,t.byteOffset,t.byteLength)}return St(e)}function wt(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var o;return t===void 0&&r===void 0?o=new Uint8Array(e):r===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,r),Object.setPrototypeOf(o,u.prototype),o}function Ai(e){if(u.isBuffer(e)){var t=At(e.length)|0,r=Z(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||It(e.length)?Z(0):St(e);if(e.type==="Buffer"&&Array.isArray(e.data))return St(e.data)}function At(e){if(e>=Be)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Be.toString(16)+" bytes");return e|0}function Ii(e){return+e!=e&&(e=0),u.alloc(+e)}u.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==u.prototype};u.compare=function(t,r){if(q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),q(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(t)||!u.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var o=t.length,i=r.length,p=0,l=Math.min(o,i);p<l;++p)if(t[p]!==r[p]){o=t[p],i=r[p];break}return o<i?-1:i<o?1:0};u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return u.alloc(0);var o;if(r===void 0)for(r=0,o=0;o<t.length;++o)r+=t[o].length;var i=u.allocUnsafe(r),p=0;for(o=0;o<t.length;++o){var l=t[o];if(q(l,Uint8Array))p+l.length>i.length?u.from(l).copy(i,p):Uint8Array.prototype.set.call(i,l,p);else if(u.isBuffer(l))l.copy(i,p);else throw new TypeError('"list" argument must be an Array of Buffers');p+=l.length}return i};function Mr(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(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 r=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&r===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return bt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Vr(e).length;default:if(i)return o?-1:bt(e).length;t=(""+t).toLowerCase(),i=!0}}u.byteLength=Mr;function Ei(e,t,r){var o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return _i(this,t,r);case"utf8":case"utf-8":return Or(this,t,r);case"ascii":return Fi(this,t,r);case"latin1":case"binary":return Mi(this,t,r);case"base64":return Pi(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oi(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}u.prototype._isBuffer=!0;function le(e,t,r){var o=e[t];e[t]=e[r],e[r]=o}u.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)le(this,r,r+1);return this};u.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)le(this,r,r+3),le(this,r+1,r+2);return this};u.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)le(this,r,r+7),le(this,r+1,r+6),le(this,r+2,r+5),le(this,r+3,r+4);return this};u.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?Or(this,0,t):Ei.apply(this,arguments)};u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:u.compare(this,t)===0};u.prototype.inspect=function(){var t="",r=ge.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Cr&&(u.prototype[Cr]=u.prototype.inspect);u.prototype.compare=function(t,r,o,i,p){if(q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),o===void 0&&(o=t?t.length:0),i===void 0&&(i=0),p===void 0&&(p=this.length),r<0||o>t.length||i<0||p>this.length)throw new RangeError("out of range index");if(i>=p&&r>=o)return 0;if(i>=p)return-1;if(r>=o)return 1;if(r>>>=0,o>>>=0,i>>>=0,p>>>=0,this===t)return 0;for(var l=p-i,m=o-r,d=Math.min(l,m),g=this.slice(i,p),h=t.slice(r,o),T=0;T<d;++T)if(g[T]!==h[T]){l=g[T],m=h[T];break}return l<m?-1:m<l?1:0};function _r(e,t,r,o,i){if(e.length===0)return-1;if(typeof r=="string"?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,It(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=u.from(t,o)),u.isBuffer(t))return t.length===0?-1:Nr(e,t,r,o,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Nr(e,[t],r,o,i);throw new TypeError("val must be string, number or Buffer")}function Nr(e,t,r,o,i){var p=1,l=e.length,m=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return-1;p=2,l/=2,m/=2,r/=2}function d(S,_){return p===1?S[_]:S.readUInt16BE(_*p)}var g;if(i){var h=-1;for(g=r;g<l;g++)if(d(e,g)===d(t,h===-1?0:g-h)){if(h===-1&&(h=g),g-h+1===m)return h*p}else h!==-1&&(g-=g-h),h=-1}else for(r+m>l&&(r=l-m),g=r;g>=0;g--){for(var T=!0,k=0;k<m;k++)if(d(e,g+k)!==d(t,k)){T=!1;break}if(T)return g}return-1}u.prototype.includes=function(t,r,o){return this.indexOf(t,r,o)!==-1};u.prototype.indexOf=function(t,r,o){return _r(this,t,r,o,!0)};u.prototype.lastIndexOf=function(t,r,o){return _r(this,t,r,o,!1)};function ki(e,t,r,o){r=Number(r)||0;var i=e.length-r;o?(o=Number(o),o>i&&(o=i)):o=i;var p=t.length;o>p/2&&(o=p/2);for(var l=0;l<o;++l){var m=parseInt(t.substr(l*2,2),16);if(It(m))return l;e[r+l]=m}return l}function Li(e,t,r,o){return Ue(bt(t,e.length-r),e,r,o)}function Di(e,t,r,o){return Ue($i(t),e,r,o)}function Ci(e,t,r,o){return Ue(Vr(t),e,r,o)}function Ni(e,t,r,o){return Ue(Vi(t,e.length-r),e,r,o)}u.prototype.write=function(t,r,o,i){if(r===void 0)i="utf8",o=this.length,r=0;else if(o===void 0&&typeof r=="string")i=r,o=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(o)?(o=o>>>0,i===void 0&&(i="utf8")):(i=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var p=this.length-r;if((o===void 0||o>p)&&(o=p),t.length>0&&(o<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var l=!1;;)switch(i){case"hex":return ki(this,t,r,o);case"utf8":case"utf-8":return Li(this,t,r,o);case"ascii":case"latin1":case"binary":return Di(this,t,r,o);case"base64":return Ci(this,t,r,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ni(this,t,r,o);default:if(l)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),l=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pi(e,t,r){return t===0&&r===e.length?xt.fromByteArray(e):xt.fromByteArray(e.slice(t,r))}function Or(e,t,r){r=Math.min(e.length,r);for(var o=[],i=t;i<r;){var p=e[i],l=null,m=p>239?4:p>223?3:p>191?2:1;if(i+m<=r){var d,g,h,T;switch(m){case 1:p<128&&(l=p);break;case 2:d=e[i+1],(d&192)===128&&(T=(p&31)<<6|d&63,T>127&&(l=T));break;case 3:d=e[i+1],g=e[i+2],(d&192)===128&&(g&192)===128&&(T=(p&15)<<12|(d&63)<<6|g&63,T>2047&&(T<55296||T>57343)&&(l=T));break;case 4:d=e[i+1],g=e[i+2],h=e[i+3],(d&192)===128&&(g&192)===128&&(h&192)===128&&(T=(p&15)<<18|(d&63)<<12|(g&63)<<6|h&63,T>65535&&T<1114112&&(l=T))}}l===null?(l=65533,m=1):l>65535&&(l-=65536,o.push(l>>>10&1023|55296),l=56320|l&1023),o.push(l),i+=m}return Ri(o)}var Pr=4096;function Ri(e){var t=e.length;if(t<=Pr)return String.fromCharCode.apply(String,e);for(var r="",o=0;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=Pr));return r}function Fi(e,t,r){var o="";r=Math.min(e.length,r);for(var i=t;i<r;++i)o+=String.fromCharCode(e[i]&127);return o}function Mi(e,t,r){var o="";r=Math.min(e.length,r);for(var i=t;i<r;++i)o+=String.fromCharCode(e[i]);return o}function _i(e,t,r){var o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);for(var i="",p=t;p<r;++p)i+=Wi[e[p]];return i}function Oi(e,t,r){for(var o=e.slice(t,r),i="",p=0;p<o.length-1;p+=2)i+=String.fromCharCode(o[p]+o[p+1]*256);return i}u.prototype.slice=function(t,r){var o=this.length;t=~~t,r=r===void 0?o:~~r,t<0?(t+=o,t<0&&(t=0)):t>o&&(t=o),r<0?(r+=o,r<0&&(r=0)):r>o&&(r=o),r<t&&(r=t);var i=this.subarray(t,r);return Object.setPrototypeOf(i,u.prototype),i};function I(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||I(t,r,this.length);for(var i=this[t],p=1,l=0;++l<r&&(p*=256);)i+=this[t+l]*p;return i};u.prototype.readUintBE=u.prototype.readUIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||I(t,r,this.length);for(var i=this[t+--r],p=1;r>0&&(p*=256);)i+=this[t+--r]*p;return i};u.prototype.readUint8=u.prototype.readUInt8=function(t,r){return t=t>>>0,r||I(t,1,this.length),this[t]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||I(t,2,this.length),this[t]|this[t+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||I(t,2,this.length),this[t]<<8|this[t+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||I(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};u.prototype.readIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||I(t,r,this.length);for(var i=this[t],p=1,l=0;++l<r&&(p*=256);)i+=this[t+l]*p;return p*=128,i>=p&&(i-=Math.pow(2,8*r)),i};u.prototype.readIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||I(t,r,this.length);for(var i=r,p=1,l=this[t+--i];i>0&&(p*=256);)l+=this[t+--i]*p;return p*=128,l>=p&&(l-=Math.pow(2,8*r)),l};u.prototype.readInt8=function(t,r){return t=t>>>0,r||I(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};u.prototype.readInt16LE=function(t,r){t=t>>>0,r||I(t,2,this.length);var o=this[t]|this[t+1]<<8;return o&32768?o|4294901760:o};u.prototype.readInt16BE=function(t,r){t=t>>>0,r||I(t,2,this.length);var o=this[t+1]|this[t]<<8;return o&32768?o|4294901760:o};u.prototype.readInt32LE=function(t,r){return t=t>>>0,r||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};u.prototype.readInt32BE=function(t,r){return t=t>>>0,r||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};u.prototype.readFloatLE=function(t,r){return t=t>>>0,r||I(t,4,this.length),me.read(this,t,!0,23,4)};u.prototype.readFloatBE=function(t,r){return t=t>>>0,r||I(t,4,this.length),me.read(this,t,!1,23,4)};u.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||I(t,8,this.length),me.read(this,t,!0,52,8)};u.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||I(t,8,this.length),me.read(this,t,!1,52,8)};function N(e,t,r,o,i,p){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<p)throw new RangeError('"value" argument is out of bounds');if(r+o>e.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,r,o,i){if(t=+t,r=r>>>0,o=o>>>0,!i){var p=Math.pow(2,8*o)-1;N(this,t,r,o,p,0)}var l=1,m=0;for(this[r]=t&255;++m<o&&(l*=256);)this[r+m]=t/l&255;return r+o};u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,r,o,i){if(t=+t,r=r>>>0,o=o>>>0,!i){var p=Math.pow(2,8*o)-1;N(this,t,r,o,p,0)}var l=o-1,m=1;for(this[r+l]=t&255;--l>=0&&(m*=256);)this[r+l]=t/m&255;return r+o};u.prototype.writeUint8=u.prototype.writeUInt8=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,1,255,0),this[r]=t&255,r+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};u.prototype.writeIntLE=function(t,r,o,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*o-1);N(this,t,r,o,p-1,-p)}var l=0,m=1,d=0;for(this[r]=t&255;++l<o&&(m*=256);)t<0&&d===0&&this[r+l-1]!==0&&(d=1),this[r+l]=(t/m>>0)-d&255;return r+o};u.prototype.writeIntBE=function(t,r,o,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*o-1);N(this,t,r,o,p-1,-p)}var l=o-1,m=1,d=0;for(this[r+l]=t&255;--l>=0&&(m*=256);)t<0&&d===0&&this[r+l+1]!==0&&(d=1),this[r+l]=(t/m>>0)-d&255;return r+o};u.prototype.writeInt8=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};u.prototype.writeInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};u.prototype.writeInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};u.prototype.writeInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};u.prototype.writeInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||N(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function Br(e,t,r,o,i,p){if(r+o>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Ur(e,t,r,o,i){return t=+t,r=r>>>0,i||Br(e,t,r,4,34028234663852886e22,-34028234663852886e22),me.write(e,t,r,o,23,4),r+4}u.prototype.writeFloatLE=function(t,r,o){return Ur(this,t,r,!0,o)};u.prototype.writeFloatBE=function(t,r,o){return Ur(this,t,r,!1,o)};function $r(e,t,r,o,i){return t=+t,r=r>>>0,i||Br(e,t,r,8,17976931348623157e292,-17976931348623157e292),me.write(e,t,r,o,52,8),r+8}u.prototype.writeDoubleLE=function(t,r,o){return $r(this,t,r,!0,o)};u.prototype.writeDoubleBE=function(t,r,o){return $r(this,t,r,!1,o)};u.prototype.copy=function(t,r,o,i){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(o||(o=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<o&&(i=o),i===o||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-o&&(i=t.length-r+o);var p=i-o;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,o,i):Uint8Array.prototype.set.call(t,this.subarray(o,i),r),p};u.prototype.fill=function(t,r,o,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,o=this.length):typeof o=="string"&&(i=o,o=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){var p=t.charCodeAt(0);(i==="utf8"&&p<128||i==="latin1")&&(t=p)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<o)throw new RangeError("Out of range index");if(o<=r)return this;r=r>>>0,o=o===void 0?this.length:o>>>0,t||(t=0);var l;if(typeof t=="number")for(l=r;l<o;++l)this[l]=t;else{var m=u.isBuffer(t)?t:u.from(t,i),d=m.length;if(d===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(l=0;l<o-r;++l)this[l+r]=m[l%d]}return this};var Bi=/[^+/0-9A-Za-z-_]/g;function Ui(e){if(e=e.split("=")[0],e=e.trim().replace(Bi,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function bt(e,t){t=t||1/0;for(var r,o=e.length,i=null,p=[],l=0;l<o;++l){if(r=e.charCodeAt(l),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&p.push(239,191,189);continue}else if(l+1===o){(t-=3)>-1&&p.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&p.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&p.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;p.push(r)}else if(r<2048){if((t-=2)<0)break;p.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;p.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;p.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return p}function $i(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function Vi(e,t){for(var r,o,i,p=[],l=0;l<e.length&&!((t-=2)<0);++l)r=e.charCodeAt(l),o=r>>8,i=r%256,p.push(i),p.push(o);return p}function Vr(e){return xt.toByteArray(Ui(e))}function Ue(e,t,r,o){for(var i=0;i<o&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function It(e){return e!==e}var Wi=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var o=r*16,i=0;i<16;++i)t[o+i]=e[r]+e[i];return t}()});var jr=_e((As,zr)=>{n();var w=zr.exports={},z,j;function Et(){throw new Error("setTimeout has not been defined")}function kt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?z=setTimeout:z=Et}catch(e){z=Et}try{typeof clearTimeout=="function"?j=clearTimeout:j=kt}catch(e){j=kt}})();function Hr(e){if(z===setTimeout)return setTimeout(e,0);if((z===Et||!z)&&setTimeout)return z=setTimeout,setTimeout(e,0);try{return z(e,0)}catch(t){try{return z.call(null,e,0)}catch(r){return z.call(this,e,0)}}}function Hi(e){if(j===clearTimeout)return clearTimeout(e);if((j===kt||!j)&&clearTimeout)return j=clearTimeout,clearTimeout(e);try{return j(e)}catch(t){try{return j.call(null,e)}catch(r){return j.call(this,e)}}}var X=[],fe=!1,pe,$e=-1;function Gi(){!fe||!pe||(fe=!1,pe.length?X=pe.concat(X):$e=-1,X.length&&Gr())}function Gr(){if(!fe){var e=Hr(Gi);fe=!0;for(var t=X.length;t;){for(pe=X,X=[];++$e<t;)pe&&pe[$e].run();$e=-1,t=X.length}pe=null,fe=!1,Hi(e)}}w.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];X.push(new qr(e,t)),X.length===1&&!fe&&Hr(Gr)};function qr(e,t){this.fun=e,this.array=t}qr.prototype.run=function(){this.fun.apply(null,this.array)};w.title="browser";w.browser=!0;w.env={};w.argv=[];w.version="";w.versions={};function J(){}w.on=J;w.addListener=J;w.once=J;w.off=J;w.removeListener=J;w.removeAllListeners=J;w.emit=J;w.prependListener=J;w.prependOnceListener=J;w.listeners=function(e){return[]};w.binding=function(e){throw new Error("process.binding is not supported")};w.cwd=function(){return"/"};w.chdir=function(e){throw new Error("process.chdir is not supported")};w.umask=function(){return 0}});var a,s,Is,n=y(()=>{a=b(Wr()),s=b(jr()),Is=function(e){function t(){var o=this||self;return delete e.prototype.__magic__,o}if(typeof globalThis=="object")return globalThis;if(this)return t();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:t});var r=__magic__;return r}(Object)});var Kr=y(()=>{"use strict";n()});var Yr=y(()=>{"use strict";n()});var C=y(()=>{"use strict";n()});var P=y(()=>{"use strict";n()});var Zr=y(()=>{"use strict";n()});var Xr=y(()=>{"use strict";n()});var Jr=y(()=>{"use strict";n()});var Qr=y(()=>{"use strict";n()});var K=y(()=>{"use strict";n();Yr();C();P();Zr();Xr();Jr();Qr()});var Lt,en,Vs,tn,Ws,rn,Hs,Gs,qs,nn=y(()=>{"use strict";n();K();Lt={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:en,egldLabel:Vs}=Lt["devnet"],{chainId:tn,egldLabel:Ws}=Lt["testnet"],{chainId:rn,egldLabel:Hs}=Lt["mainnet"],Gs={["devnet"]:en,["testnet"]:tn,["mainnet"]:rn},qs={[en]:"devnet",[tn]:"testnet",[rn]:"mainnet"}});var Dt=y(()=>{"use strict";n()});var on=y(()=>{"use strict";n()});var an,Ct=y(()=>{"use strict";n();an="transaction-status-toast-id"});var Nt,Pt,sn,Ve,cn,Te,v=y(()=>{"use strict";n();Kr();nn();Dt();on();Ct();Nt=5e4,Pt=1e9,sn=1,Ve="logout",cn="login",Te="0"});var Mt,L,ue,W=y(()=>{"use strict";n();Mt=require("@reduxjs/toolkit");v();L=(0,Mt.createAction)(Ve),ue=(0,Mt.createAction)(cn,e=>({payload:e}))});var qe,_t=y(()=>{"use strict";n();qe=()=>Date.now()/1e3});var fn=y(()=>{"use strict";n()});var Tn=y(()=>{"use strict";n()});var yn=y(()=>{"use strict";n();_t();fn();Tn()});var Bt={};se(Bt,{getItem:()=>zi,localStorageKeys:()=>Y,removeItem:()=>ji,setItem:()=>qi});var Y,Ot,qi,zi,ji,xe=y(()=>{"use strict";n();yn();Y={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},Ot=typeof localStorage!="undefined",qi=({key:e,data:t,expires:r})=>{!Ot||localStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},zi=e=>{if(!Ot)return;let t=localStorage.getItem(String(e));if(!t)return null;let r=JSON.parse(t);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:qe()>=r.expires?(localStorage.removeItem(String(e)),null):r.data},ji=e=>{!Ot||localStorage.removeItem(String(e))}});var Ut={};se(Ut,{clear:()=>wn,getItem:()=>xn,removeItem:()=>Sn,setItem:()=>hn,storage:()=>Ki});var hn,xn,Sn,wn,Ki,bn=y(()=>{"use strict";n();hn=({key:e,data:t,expires:r})=>{sessionStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},xn=e=>{let t=sessionStorage.getItem(String(e));if(!t)return null;let r=JSON.parse(t);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:Date.now()>=r.expires?(sessionStorage.removeItem(String(e)),null):r.data},Sn=e=>sessionStorage.removeItem(String(e)),wn=()=>sessionStorage.clear(),Ki={setItem:hn,getItem:xn,removeItem:Sn,clear:wn}});var ee,Ee=y(()=>{"use strict";n();xe();bn();ee={session:Ut,local:Bt}});function ke(){return new Date().setHours(new Date().getHours()+24)}function Le(e){ee.local.setItem({key:Y.loginExpiresAt,data:e,expires:e})}var $t=y(()=>{"use strict";n();Ee();xe()});var An,vn,In,Mc,Vt,_c,En,kn,Oc,Ln,Dn,Wt=y(()=>{"use strict";n();An=require("@reduxjs/toolkit");$t();P();W();vn={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},In=(0,An.createSlice)({name:"loginInfoSlice",initialState:vn,reducers:{setLoginMethod:(e,t)=>{e.loginMethod=t.payload},setTokenLogin:(e,t)=>{e.tokenLogin=t.payload},setTokenLoginSignature:(e,t)=>{(e==null?void 0:e.tokenLogin)!=null&&(e.tokenLogin.signature=t.payload)},setWalletLogin:(e,t)=>{e.walletLogin=t.payload},setWalletConnectLogin:(e,t)=>{e.walletConnectLogin=t.payload},setLedgerLogin:(e,t)=>{e.ledgerLogin=t.payload},invalidateLoginSession:e=>{e.isLoginSessionInvalid=!0}},extraReducers:e=>{e.addCase(L,()=>vn),e.addCase(ue,(t,r)=>{t.loginMethod=r.payload.loginMethod,Le(ke())})}}),{setLoginMethod:Mc,setWalletConnectLogin:Vt,setLedgerLogin:_c,setTokenLogin:En,setTokenLoginSignature:kn,setWalletLogin:Oc,invalidateLoginSession:Ln}=In.actions,Dn=In.reducer});var Cn,Nn,ze,Ht=y(()=>{"use strict";n();Cn=!1,Nn=(e=!0)=>{Cn=e},ze=(e,t=0)=>{Cn||setTimeout(()=>{window.location.href=e},t)}});function Pn({callbackRoute:e,onLoginRedirect:t,options:r}){let o=Boolean(e),i=typeof t=="function",p=i?0:Yi;o&&e!=null&&setTimeout(()=>{if(i)return t(e,r);window.location.pathname.includes(e)||ze(e)},p)}var Yi,Rn=y(()=>{"use strict";n();Ht();Yi=200});function Gt(e){return e[Math.floor(Math.random()*e.length)]}var Fn=y(()=>{"use strict";n()});var Mn=y(()=>{"use strict";n();Dt()});var qt=y(()=>{"use strict";n();Rn();Fn();Mn()});var _n,On,zt,Zi,Bn,Jc,Qc,Un,jt=y(()=>{"use strict";n();_n=require("@reduxjs/toolkit"),On=b(require("lodash.omit"));qt();zt={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},Zi={network:zt,chainID:"-1"},Bn=(0,_n.createSlice)({name:"appConfig",initialState:Zi,reducers:{initializeNetworkConfig:(e,t)=>{let r=Gt(t.payload.walletConnectBridgeAddresses),o=Gt(t.payload.walletConnectV2RelayAddresses),i=(0,On.default)(t.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");e.network=A(x(x({},e.network),i),{walletConnectBridgeAddress:r,walletConnectV2RelayAddress:o})},setChainID:(e,t)=>{e.chainID=t.payload}}}),{initializeNetworkConfig:Jc,setChainID:Qc}=Bn.actions,Un=Bn.reducer});var Yt,$n,Vn,je,Kt,Wn,Zt,sl,Xt,cl,ll,pl,ul,dl,ml,gl,Hn,Jt=y(()=>{"use strict";n();Yt=require("@elrondnetwork/erdjs"),$n=require("@reduxjs/toolkit"),Vn=require("redux-persist");v();Ee();xe();W();je={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:Te},Kt={address:"",websocketEvent:null,accounts:{"":je},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},Wn=(0,$n.createSlice)({name:"accountInfoSlice",initialState:Kt,reducers:{setAddress:(e,t)=>{let r=t.payload;e.address=r,e.publicKey=new Yt.Address(r).hex()},setAccount:(e,t)=>{let r=e.address===t.payload.address;e.accounts={[e.address]:r?t.payload:je},e.isAccountLoading=!1,e.accountLoadingError=null},setAccountNonce:(e,t)=>{let{address:r}=e;e.accounts[r].nonce=t.payload},setAccountShard:(e,t)=>{e.shard=t.payload},setLedgerAccount:(e,t)=>{e.ledgerAccount=t.payload},updateLedgerAccount:(e,t)=>{e.ledgerAccount!=null&&(e.ledgerAccount.index=t.payload.index,e.ledgerAccount.address=t.payload.address)},setWalletConnectAccount:(e,t)=>{e.walletConnectAccount=t.payload},setIsAccountLoading:(e,t)=>{e.isAccountLoading=t.payload,e.accountLoadingError=null},setAccountLoadingError:(e,t)=>{e.accountLoadingError=t.payload,e.isAccountLoading=!1},setWebsocketEvent:(e,t)=>{e.websocketEvent={timestamp:Date.now(),message:t.payload}}},extraReducers:e=>{e.addCase(L,()=>(ee.local.removeItem(Y.loginExpiresAt),Kt)),e.addCase(ue,(t,r)=>{let{address:o}=r.payload;t.address=o,t.publicKey=new Yt.Address(o).hex()}),e.addCase(Vn.REHYDRATE,(t,r)=>{var g;if(!((g=r.payload)!=null&&g.account))return;let{account:o}=r.payload,{address:i,shard:p,accounts:l,publicKey:m}=o;t.address=i,t.shard=p;let d=l&&i in l;t.accounts=d?l:Kt.accounts,t.publicKey=m})}}),{setAccount:Zt,setAddress:sl,setAccountNonce:Xt,setAccountShard:cl,setLedgerAccount:ll,updateLedgerAccount:pl,setWalletConnectAccount:ul,setIsAccountLoading:dl,setAccountLoadingError:ml,setWebsocketEvent:gl}=Wn.actions,Hn=Wn.reducer});function Gn(e){return e!=null&&(ia(e)||la(e))}function Ke(e){return e!=null&&(aa(e)||pa(e))}function Ye(e){return e!=null&&(sa(e)||ua(e))}function qn(e){return e!=null&&ca(e)}function ia(e){return e!=null&&Ji.includes(e)}function aa(e){return e!=null&&Qi.includes(e)}function sa(e){return e!=null&&ea.includes(e)}function ca(e){return e!=null&&ta.includes(e)}function la(e){return e!=null&&ra.includes(e)}function pa(e){return e!=null&&na.includes(e)}function ua(e){return e!=null&&oa.includes(e)}var Ji,Qi,ea,ta,ra,na,oa,er=y(()=>{"use strict";n();P();Ji=["sent"],Qi=["success"],ea=["fail","cancelled","timedOut"],ta=["timedOut"],ra=["pending"],na=["success"],oa=["fail","invalid"]});var zn,jn,De,da,Kn,vl,Al,Il,El,kl,Ll,Dl,Cl,Nl,Pl,Ze,Xe=y(()=>{"use strict";n();zn=require("@reduxjs/toolkit"),jn=require("redux-persist");P();er();W();De={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},da={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Kn=(0,zn.createSlice)({name:"transactionsSlice",initialState:De,reducers:{moveTransactionsToSignedState:(e,t)=>{var d,g;let{sessionId:r,transactions:o,errorMessage:i,status:p,redirectRoute:l}=t.payload,m=((d=e.customTransactionInformationForSessionId)==null?void 0:d[r])||da;e.signedTransactions[r]={transactions:o,status:p,errorMessage:i,redirectRoute:l,customTransactionInformation:m},((g=e==null?void 0:e.transactionsToSign)==null?void 0:g.sessionId)===r&&(e.transactionsToSign=De.transactionsToSign)},clearSignedTransaction:(e,t)=>{e.signedTransactions[t.payload]&&delete e.signedTransactions[t.payload]},clearTransactionToSign:e=>{e!=null&&e.transactionsToSign&&(e.transactionsToSign=null)},updateSignedTransaction:(e,t)=>{e.signedTransactions=x(x({},e.signedTransactions),t.payload)},updateSignedTransactions:(e,t)=>{let{sessionId:r,status:o,errorMessage:i,transactions:p}=t.payload;e.signedTransactions[r]!=null&&(e.signedTransactions[r].status=o,i!=null&&(e.signedTransactions[r].errorMessage=i),p!=null&&(e.signedTransactions[r].transactions=p))},updateSignedTransactionStatus:(e,t)=>{var m,d,g,h,T,k;let{sessionId:r,status:o,errorMessage:i,transactionHash:p}=t.payload,l=(d=(m=e.signedTransactions)==null?void 0:m[r])==null?void 0:d.transactions;if(l!=null){e.signedTransactions[r].transactions=l.map(R=>R.hash===p?A(x({},R),{status:o,errorMessage:i}):R);let S=(h=(g=e.signedTransactions[r])==null?void 0:g.transactions)==null?void 0:h.every(R=>Ke(R.status)),_=(k=(T=e.signedTransactions[r])==null?void 0:T.transactions)==null?void 0:k.every(R=>Ye(R.status));S&&(e.signedTransactions[r].status="success"),_&&(e.signedTransactions[r].status="fail")}},setTransactionsToSign:(e,t)=>{e.transactionsToSign=t.payload;let{sessionId:r,customTransactionInformation:o}=t.payload;e.customTransactionInformationForSessionId[r]=o,e.signTransactionsError=null},clearAllTransactionsToSign:e=>{e.transactionsToSign=De.transactionsToSign,e.signTransactionsError=null},clearAllSignedTransactions:e=>{e.signedTransactions=De.signedTransactions},setSignTransactionsError:(e,t)=>{e.signTransactionsError=t.payload},setSignTransactionsCancelMessage:(e,t)=>{e.signTransactionsCancelMessage=t.payload}},extraReducers:e=>{e.addCase(L,()=>De),e.addCase(jn.REHYDRATE,(t,r)=>{var l;if(t.signTransactionsCancelMessage=null,!((l=r.payload)!=null&&l.transactions))return;let{signedTransactions:o,customTransactionInformationForSessionId:i}=r.payload.transactions,p=Object.entries(o).reduce((m,[d,g])=>{let h=new Date(d),T=new Date;return T.setHours(T.getHours()+5),T-h>0||(m[d]=g),m},{});i!=null&&(t.customTransactionInformationForSessionId=i),o!=null&&(t.signedTransactions=p)})}}),{updateSignedTransactionStatus:vl,updateSignedTransactions:Al,setTransactionsToSign:Il,clearAllTransactionsToSign:El,clearAllSignedTransactions:kl,clearSignedTransaction:Ll,clearTransactionToSign:Dl,setSignTransactionsError:Cl,setSignTransactionsCancelMessage:Nl,moveTransactionsToSignedState:Pl}=Kn.actions,Ze=Kn.reducer});var Yn,rr,nr,or,ma,tr,Zn,_l,Ol,Bl,Je,Qe=y(()=>{"use strict";n();Yn=require("@reduxjs/toolkit");W();rr="Transaction failed",nr="Transaction successful",or="Processing transaction",ma="Transaction submitted",tr={},Zn=(0,Yn.createSlice)({name:"transactionsInfo",initialState:tr,reducers:{setTransactionsDisplayInfo(e,t){let{sessionId:r,transactionsDisplayInfo:o}=t.payload;r!=null&&(e[r]={errorMessage:(o==null?void 0:o.errorMessage)||rr,successMessage:(o==null?void 0:o.successMessage)||nr,processingMessage:(o==null?void 0:o.processingMessage)||or,submittedMessage:(o==null?void 0:o.submittedMessage)||ma,transactionDuration:o==null?void 0:o.transactionDuration})},clearTransactionsInfoForSessionId(e,t){t.payload!=null&&delete e[t.payload]},clearTransactionsInfo:()=>tr},extraReducers:e=>{e.addCase(L,()=>tr)}}),{clearTransactionsInfo:_l,setTransactionsDisplayInfo:Ol,clearTransactionsInfoForSessionId:Bl}=Zn.actions,Je=Zn.reducer});var Jn,Xn,Qn,Wl,Hl,Gl,ql,eo,ir=y(()=>{"use strict";n();Jn=require("@reduxjs/toolkit");W();Xn={},Qn=(0,Jn.createSlice)({name:"modalsSlice",initialState:Xn,reducers:{setTxSubmittedModal:(e,t)=>{e.txSubmittedModal=t.payload},setNotificationModal:(e,t)=>{e.notificationModal=t.payload},clearTxSubmittedModal:e=>{e.txSubmittedModal=void 0},clearNotificationModal:e=>{e.notificationModal=void 0}},extraReducers:e=>{e.addCase(L,()=>Xn)}}),{setTxSubmittedModal:Wl,setNotificationModal:Hl,clearTxSubmittedModal:Gl,clearNotificationModal:ql}=Qn.actions,eo=Qn.reducer});var ro,no,to,oo,Ql,ep,tp,rp,np,op,et,tt=y(()=>{"use strict";n();ro=require("@reduxjs/toolkit"),no=require("redux-persist");Ct();K();_t();W();to={customToasts:[],transactionToasts:[],failTransactionToast:null},oo=(0,ro.createSlice)({name:"toastsSlice",initialState:to,reducers:{addCustomToast:(e,t)=>{e.customToasts.push(A(x({},t.payload),{type:"custom",toastId:t.payload.toastId||`custom-toast-${e.customToasts.length+1}`}))},removeCustomToast:(e,t)=>{e.customToasts=e.customToasts.filter(r=>r.toastId!==t.payload)},addTransactionToast:(e,t)=>{e.transactionToasts.push({type:"transaction",startTimestamp:qe(),toastId:t.payload||`custom-toast-${e.transactionToasts.length+1}`})},removeTransactionToast:(e,t)=>{e.transactionToasts=e.transactionToasts.filter(r=>r.toastId!==t.payload)},addFailTransactionToast:(e,t)=>{e.failTransactionToast=A(x({},t.payload),{toastId:an})},removeFailTransactionToast:e=>{e.failTransactionToast=null}},extraReducers:e=>{e.addCase(L,()=>to),e.addCase(no.REHYDRATE,(t,r)=>{var i,p;let o=(p=(i=r.customToasts)==null?void 0:i.filter(l=>!("component"in l)))!=null?p:[];t.customToasts=o})}}),{addCustomToast:Ql,removeCustomToast:ep,addTransactionToast:tp,removeTransactionToast:rp,addFailTransactionToast:np,removeFailTransactionToast:op}=oo.actions,et=oo.reducer});var te=y(()=>{"use strict";n();Wt();jt();Jt();Xe();Qe();ir();tt()});var ar=y(()=>{"use strict";n()});var co,so,lo,Ap,Ip,Ep,kp,Lp,Dp,po,uo=y(()=>{"use strict";n();co=require("@reduxjs/toolkit");W();so={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},lo=(0,co.createSlice)({name:"dappModalsSlice",initialState:so,reducers:{setDappModalVisibility:(e,t)=>{e.visible=t.payload},setDappModalHeaderVisibility:(e,t)=>{e.modal.showHeader=t.payload},setDappModalFooterVisibility:(e,t)=>{e.modal.showFooter=t.payload},setDappModalHeaderText:(e,t)=>{e.modal.headerText=t.payload},setDappModalFooterText:(e,t)=>{e.modal.footerText=t.payload},setDappModalConfig:(e,t)=>{e.modal=x({},t.payload)}},extraReducers:e=>{e.addCase(L,()=>so)}}),{setDappModalVisibility:Ap,setDappModalHeaderVisibility:Ip,setDappModalFooterVisibility:Ep,setDappModalHeaderText:kp,setDappModalFooterText:Lp,setDappModalConfig:Dp}=lo.actions,po=lo.reducer});var mo,ya,ha,Se,nt=y(()=>{"use strict";n();mo=require("@reduxjs/toolkit");ar();Jt();uo();Wt();ir();jt();tt();Qe();Xe();ya={["account"]:Hn,["networkConfig"]:Un,["loginInfo"]:Dn,["modals"]:eo,["dappModal"]:po,["toasts"]:et,["transactions"]:Ze,["transactionsInfo"]:Je},ha=(e={})=>(0,mo.combineReducers)(x(x({},ya),e)),Se=ha});var To={};se(To,{default:()=>Ia});function sr(e,t=[]){return{key:e,version:1,storage:fo.default,blacklist:t}}var de,go,fo,xa,Sa,wa,ba,va,Aa,Ia,yo=y(()=>{"use strict";n();de=require("redux-persist"),go=b(require("redux-persist/lib/storage")),fo=b(require("redux-persist/lib/storage/session"));nt();te();tt();Qe();Xe();ar();xa={2:e=>A(x({},e),{networkConfig:zt})};Sa=sr("dapp-core-transactionsInfo"),wa=sr("dapp-core-transactions",["transactionsToSign"]),ba=sr("dapp-core-toasts"),va={key:"dapp-core-store",version:2,storage:go.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,de.createMigrate)(xa,{debug:!1})},Aa={["toasts"]:(0,de.persistReducer)(ba,et),["transactions"]:(0,de.persistReducer)(wa,Ze),["transactionsInfo"]:(0,de.persistReducer)(Sa,Je)},Ia=(0,de.persistReducer)(va,Se(Aa))});var ho={};se(ho,{default:()=>Ea});var Ea,xo=y(()=>{"use strict";n();nt();Ea=Se()});var So={};se(So,{default:()=>La});var U,ka,La,wo=y(()=>{"use strict";n();U=require("redux-persist"),ka=[U.FLUSH,U.REHYDRATE,U.PAUSE,U.PERSIST,U.PURGE,U.REGISTER],La=ka});var Ao={};se(Ao,{default:()=>vo});function vo(e){return(0,bo.persistStore)(e)}var bo,Io=y(()=>{"use strict";n();bo=require("redux-persist")});var hs={};se(hs,{useWalletConnectLogin:()=>ys});module.exports=Ie(hs);n();var ie=require("react"),Qo=require("@elrondnetwork/erdjs-wallet-connect-provider");n();n();n();n();var ln=require("@elrondnetwork/erdjs-extension-provider"),pn=require("@elrondnetwork/erdjs-hw-provider"),He=require("@elrondnetwork/erdjs-wallet-connect-provider"),un=require("@elrondnetwork/erdjs-web-wallet-provider");v();P();var he=e=>{switch(e==null?void 0:e.constructor){case un.WalletProvider:return"wallet";case He.WalletConnectProvider:return"walletconnect";case He.WalletConnectV2Provider:return"walletconnectv2";case pn.HWProvider:return"ledger";case ln.ExtensionProvider:return"extension";case We:return"";default:return"extra"}};var Q=e=>`Unable to perform ${e}, Provider not initialized`,We=class{init(){return Promise.resolve(!1)}login(t){throw new Error(Q(`login with options: ${t}`))}logout(t){throw new Error(Q(`logout with options: ${t}`))}getAddress(){throw new Error(Q("getAddress"))}isInitialized(){return!1}isConnected(){return Promise.resolve(!1)}sendTransaction(t,r){throw new Error(Q(`sendTransaction with transactions: ${t} options: ${r}`))}signTransaction(t,r){throw new Error(Q(`signTransaction with transactions: ${t} options: ${r}`))}signTransactions(t,r){throw new Error(Q(`signTransactions with transactions: ${t} options: ${r}`))}signMessage(t,r){throw new Error(Q(`signTransactions with ${t} and options ${r}`))}sendCustomMessage({method:t,params:r}){throw new Error(Q(`sendCustomMessage with method: ${t} params: ${r}`))}sendCustomRequest(t){throw new Error(Q(`sendSessionEvent with options: ${t}`))}ping(){return Promise.resolve(!1)}},Rt=new We;var dn=Rt;function mn(e){dn=e}function V(){return dn||Rt}var gn=()=>{let e=V(),t=he(e);return{provider:e,providerType:t}};n();var Ge=require("react");function Ft(e,t=[]){let r=(0,Ge.useRef)(!0);(0,Ge.useEffect)(()=>{r.current?r.current=!1:e()},t)}W();n();var No=require("react"),we=require("react-redux");n();var cr=require("@reduxjs/toolkit"),Do=require("react-redux/es/utils/Subscription");te();n();var io=b(require("lodash.throttle"));v();te();$t();Ee();xe();var ga=[Ve],fa=(0,io.default)(()=>{Le(ke())},5e3),ao=e=>t=>r=>{var d;if(ga.includes(r.type))return t(r);let o=e.getState(),i=ee.local.getItem(Y.loginExpiresAt);if(!((d=o==null?void 0:o.loginInfo)==null?void 0:d.isLoggedIn))return t(r);if(i==null)return Le(ke());let l=Date.now();return i-l<0?setTimeout(()=>D(void 0,null,function*(){console.log("session expired");try{e.dispatch(Ln())}catch(g){console.error("error logging out",g)}}),1e3):(fa(),t(r))};n();n();function rt(){return typeof sessionStorage!="undefined"}var Eo=rt()?(yo(),Ie(To)).default:(xo(),Ie(ho)).default,ko=rt()?(wo(),Ie(So)).default:[],Lo=rt()?(Io(),Ie(Ao)).default:e=>e;nt();var E=(0,cr.configureStore)({reducer:Eo,middleware:e=>e({serializableCheck:{ignoredActions:[...ko,Xt.type,Zt.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(ao)}),Co=(0,Do.createSubscription)(E),eu=Lo(E),tu=(0,cr.configureStore)({reducer:Se});var Da={store:E,subscription:Co},lr=(0,No.createContext)(Da),iu=(0,we.createStoreHook)(lr),Po=(0,we.createDispatchHook)(lr),pr=(0,we.createSelectorHook)(lr);n();n();te();n();var Ro=b(require("lodash.isequal")),ot=require("reselect"),f=(0,ot.createSelectorCreator)(ot.defaultMemoize,Ro.default);var re=e=>e.account,Ce=f(re,e=>e.address),it=f(re,Ce,(e,t)=>t in e.accounts?e.accounts[t]:je),pu=f(re,it,(e,t)=>{let i=e,{accounts:r}=i,o=Ar(i,["accounts"]);return A(x({},o),{account:t})}),uu=f(it,e=>e.balance),Ca=f(it,e=>{var t;return((t=e==null?void 0:e.nonce)==null?void 0:t.valueOf())||0}),du=f(re,e=>e.shard),mu=f(re,e=>e.ledgerAccount),gu=f(re,e=>e.walletConnectAccount),fu=f(re,e=>e.isAccountLoading),Tu=f(re,e=>e.accountLoadingError),yu=f(re,e=>e.websocketEvent);n();var be=e=>e.networkConfig,Su=f(be,e=>e.chainID),Fo=f(be,e=>e.network.walletConnectBridgeAddress),wu=f(be,e=>e.network.walletConnectV2RelayAddress),bu=f(be,e=>e.network.walletConnectV2ProjectId),Mo=f(be,e=>e.network.walletConnectDeepLink),ur=f(be,e=>e.network),Na=f(ur,e=>e.apiAddress),_o=f(ur,e=>e.explorerAddress),vu=f(ur,e=>e.egldLabel);n();P();var ve=e=>e.loginInfo,Lu=f(ve,e=>e.loginMethod),at=f(ve,Ce,(e,t)=>e.loginMethod!=""&&Boolean(t)),Du=f(ve,e=>e.walletConnectLogin),Cu=f(ve,e=>e.ledgerLogin),Oo=f(ve,e=>e.walletLogin),Nu=f(ve,e=>e.isLoginSessionInvalid);n();n();var M=require("@elrondnetwork/erdjs");v();n();function dr(e){try{return a.Buffer.from(e,"base64").toString()===atob(e)}catch(t){return!1}}function mr(e){var i,p,l;let{data:t}=e,r=dr(t!=null?t:"")?M.TransactionPayload.fromEncoded(t):new M.TransactionPayload(t),o=new M.Transaction(x({value:e.value.valueOf(),data:r,nonce:e.nonce.valueOf(),receiver:new M.Address(e.receiver),sender:new M.Address(e.sende