UNPKG

@sofaws/dapp-core

Version:

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

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