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 ap=Object.create;var Lo=Object.defineProperty,ip=Object.defineProperties,cp=Object.getOwnPropertyDescriptor,sp=Object.getOwnPropertyDescriptors,pp=Object.getOwnPropertyNames,pn=Object.getOwnPropertySymbols,mp=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable;var Fr=(e,o,n)=>o in e?Lo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,u=(e,o)=>{for(var n in o||(o={}))st.call(o,n)&&Fr(e,n,o[n]);if(pn)for(var n of pn(o))Or.call(o,n)&&Fr(e,n,o[n]);return e},v=(e,o)=>ip(e,sp(o));var Be=(e,o)=>{var n={};for(var r in e)st.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pn)for(var r of pn(e))o.indexOf(r)<0&&Or.call(e,r)&&(n[r]=e[r]);return n};var S=(e,o)=>()=>(e&&(o=e(e=0)),o);var mn=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports),Ue=(e,o)=>{for(var n in o)Lo(e,n,{get:o[n],enumerable:!0})},Br=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of pp(o))!st.call(e,a)&&a!==n&&Lo(e,a,{get:()=>o[a],enumerable:!(r=cp(o,a))||r.enumerable});return e};var g=(e,o,n)=>(n=e!=null?ap(mp(e)):{},Br(o||!e||!e.__esModule?Lo(n,"default",{value:e,enumerable:!0}):n,e)),No=e=>Br(Lo({},"__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 Gr=mn(_n=>{"use strict";t();_n.byteLength=lp;_n.toByteArray=up;_n.fromByteArray=Tp;var se=[],Y=[],_p=typeof Uint8Array!="undefined"?Uint8Array:Array,pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(We=0,Ur=pt.length;We<Ur;++We)se[We]=pt[We],Y[pt.charCodeAt(We)]=We;var We,Ur;Y["-".charCodeAt(0)]=62;Y["_".charCodeAt(0)]=63;function Wr(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 lp(e){var o=Wr(e),n=o[0],r=o[1];return(n+r)*3/4-r}function dp(e,o,n){return(o+n)*3/4-n}function up(e){var o,n=Wr(e),r=n[0],a=n[1],p=new _p(dp(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 gp(e){return se[e>>18&63]+se[e>>12&63]+se[e>>6&63]+se[e&63]}function fp(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(gp(r));return a.join("")}function Tp(e){for(var o,n=e.length,r=n%3,a=[],p=16383,m=0,_=n-r;m<_;m+=p)a.push(fp(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 Vr=mn(mt=>{t();mt.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,x=n?-1:1,k=e[o+h];for(h+=x,p=k&(1<<-T)-1,k>>=-T,T+=_;T>0;p=p*256+e[o+h],h+=x,T-=8);for(m=p&(1<<-T)-1,p>>=-T,T+=r;T>0;m=m*256+e[o+h],h+=x,T-=8);if(p===0)p=1-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)};mt.write=function(e,o,n,r,a,p){var m,_,d,f=p*8-a-1,T=(1<<f)-1,h=T>>1,x=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=r?0:p-1,E=r?1:-1,D=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+=x/d:o+=x*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+=E,_/=256,a-=8);for(m=m<<a|_,f+=a;f>0;e[n+k]=m&255,k+=E,m/=256,f-=8);e[n+k-E]|=D*128}});var oa=mn(no=>{"use strict";t();var _t=Gr(),oo=Vr(),$r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;no.Buffer=l;no.SlowBuffer=wp;no.INSPECT_MAX_BYTES=50;var ln=2147483647;no.kMaxLength=ln;l.TYPED_ARRAY_SUPPORT=hp();!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 hp(){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 Te(e){if(e>ln)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 gt(e)}return jr(e,o,n)}l.poolSize=8192;function jr(e,o,n){if(typeof e=="string")return xp(e,o);if(ArrayBuffer.isView(e))return bp(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 dt(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=Sp(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 jr(e,o,n)};Object.setPrototypeOf(l.prototype,Uint8Array.prototype);Object.setPrototypeOf(l,Uint8Array);function qr(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 yp(e,o,n){return qr(e),e<=0?Te(e):o!==void 0?typeof n=="string"?Te(e).fill(o,n):Te(e).fill(o):Te(e)}l.alloc=function(e,o,n){return yp(e,o,n)};function gt(e){return qr(e),Te(e<0?0:ft(e)|0)}l.allocUnsafe=function(e){return gt(e)};l.allocUnsafeSlow=function(e){return gt(e)};function xp(e,o){if((typeof o!="string"||o==="")&&(o="utf8"),!l.isEncoding(o))throw new TypeError("Unknown encoding: "+o);var n=Kr(e,o)|0,r=Te(n),a=r.write(e,o);return a!==n&&(r=r.slice(0,a)),r}function lt(e){for(var o=e.length<0?0:ft(e.length)|0,n=Te(o),r=0;r<o;r+=1)n[r]=e[r]&255;return n}function bp(e){if(pe(e,Uint8Array)){var o=new Uint8Array(e);return dt(o.buffer,o.byteOffset,o.byteLength)}return lt(e)}function dt(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 Sp(e){if(l.isBuffer(e)){var o=ft(e.length)|0,n=Te(o);return n.length===0||e.copy(n,0,0,o),n}if(e.length!==void 0)return typeof e.length!="number"||Tt(e.length)?Te(0):lt(e);if(e.type==="Buffer"&&Array.isArray(e.data))return lt(e.data)}function ft(e){if(e>=ln)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ln.toString(16)+" bytes");return e|0}function wp(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 Kr(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 ut(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return ea(e).length;default:if(a)return r?-1:ut(e).length;o=(""+o).toLowerCase(),a=!0}}l.byteLength=Kr;function vp(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 Rp(this,o,n);case"utf8":case"utf-8":return Zr(this,o,n);case"ascii":return Dp(this,o,n);case"latin1":case"binary":return Pp(this,o,n);case"base64":return Lp(this,o,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mp(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?Zr(this,0,o):vp.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+">"};$r&&(l.prototype[$r]=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 Xr(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,Tt(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:Hr(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):Hr(e,[o],n,r,a);throw new TypeError("val must be string, number or Buffer")}function Hr(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,E){return p===1?k[E]:k.readUInt16BE(E*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,x=0;x<_;x++)if(d(e,f+x)!==d(o,x)){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 Xr(this,o,n,r,!0)};l.prototype.lastIndexOf=function(o,n,r){return Xr(this,o,n,r,!1)};function kp(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(Tt(_))return m;e[n+m]=_}return m}function Ip(e,o,n,r){return dn(ut(o,e.length-n),e,n,r)}function Ap(e,o,n,r){return dn(Bp(o),e,n,r)}function Ep(e,o,n,r){return dn(ea(o),e,n,r)}function Cp(e,o,n,r){return dn(Up(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 kp(this,o,n,r);case"utf8":case"utf-8":return Ip(this,o,n,r);case"ascii":case"latin1":case"binary":return Ap(this,o,n,r);case"base64":return Ep(this,o,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Cp(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?_t.fromByteArray(e):_t.fromByteArray(e.slice(o,n))}function Zr(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 Np(r)}var zr=4096;function Np(e){var o=e.length;if(o<=zr)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<o;)n+=String.fromCharCode.apply(String,e.slice(r,r+=zr));return n}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]&127);return r}function Pp(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 Rp(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+=Wp[e[p]];return a}function Mp(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 Yr(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 Jr(e,o,n,r,a){return o=+o,n=n>>>0,a||Yr(e,o,n,4,34028234663852886e22,-34028234663852886e22),oo.write(e,o,n,r,23,4),n+4}l.prototype.writeFloatLE=function(o,n,r){return Jr(this,o,n,!0,r)};l.prototype.writeFloatBE=function(o,n,r){return Jr(this,o,n,!1,r)};function Qr(e,o,n,r,a){return o=+o,n=n>>>0,a||Yr(e,o,n,8,17976931348623157e292,-17976931348623157e292),oo.write(e,o,n,r,52,8),n+8}l.prototype.writeDoubleLE=function(o,n,r){return Qr(this,o,n,!0,r)};l.prototype.writeDoubleBE=function(o,n,r){return Qr(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 Fp=/[^+/0-9A-Za-z-_]/g;function Op(e){if(e=e.split("=")[0],e=e.trim().replace(Fp,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function ut(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 Bp(e){for(var o=[],n=0;n<e.length;++n)o.push(e.charCodeAt(n)&255);return o}function Up(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 ea(e){return _t.toByteArray(Op(e))}function dn(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 Tt(e){return e!==e}var Wp=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 ia=mn((Rl,aa)=>{t();var M=aa.exports={},me,_e;function ht(){throw new Error("setTimeout has not been defined")}function yt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?me=setTimeout:me=ht}catch(e){me=ht}try{typeof clearTimeout=="function"?_e=clearTimeout:_e=yt}catch(e){_e=yt}})();function na(e){if(me===setTimeout)return setTimeout(e,0);if((me===ht||!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 Gp(e){if(_e===clearTimeout)return clearTimeout(e);if((_e===yt||!_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 he=[],to=!1,Ve,un=-1;function Vp(){!to||!Ve||(to=!1,Ve.length?he=Ve.concat(he):un=-1,he.length&&ta())}function ta(){if(!to){var e=na(Vp);to=!0;for(var o=he.length;o;){for(Ve=he,he=[];++un<o;)Ve&&Ve[un].run();un=-1,o=he.length}Ve=null,to=!1,Gp(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];he.push(new ra(e,o)),he.length===1&&!to&&na(ta)};function ra(e,o){this.fun=e,this.array=o}ra.prototype.run=function(){this.fun.apply(null,this.array)};M.title="browser";M.browser=!0;M.env={};M.argv=[];M.version="";M.versions={};function ye(){}M.on=ye;M.addListener=ye;M.once=ye;M.off=ye;M.removeListener=ye;M.removeAllListeners=ye;M.emit=ye;M.prependListener=ye;M.prependOnceListener=ye;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,Ml,t=S(()=>{i=g(oa()),c=g(ia()),Ml=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 gn,xt=S(()=>{"use strict";t();gn=()=>Date.now()/1e3});var ca=S(()=>{"use strict";t()});var sa=S(()=>{"use strict";t()});var bt=S(()=>{"use strict";t();xt();ca();sa()});var wt={};Ue(wt,{getItem:()=>Hp,localStorageKeys:()=>Ee,removeItem:()=>zp,setItem:()=>$p});var Ee,St,$p,Hp,zp,ro=S(()=>{"use strict";t();bt();Ee={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},St=typeof localStorage!="undefined",$p=({key:e,data:o,expires:n})=>{!St||localStorage.setItem(String(e),JSON.stringify({expires:n,data:o}))},Hp=e=>{if(!St)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:gn()>=n.expires?(localStorage.removeItem(String(e)),null):n.data},zp=e=>{!St||localStorage.removeItem(String(e))}});var vt={};Ue(vt,{clear:()=>la,getItem:()=>ma,removeItem:()=>_a,setItem:()=>pa,storage:()=>jp});var pa,ma,_a,la,jp,da=S(()=>{"use strict";t();pa=({key:e,data:o,expires:n})=>{sessionStorage.setItem(String(e),JSON.stringify({expires:n,data:o}))},ma=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},_a=e=>sessionStorage.removeItem(String(e)),la=()=>sessionStorage.clear(),jp={setItem:pa,getItem:ma,removeItem:_a,clear:la}});var $e,ao=S(()=>{"use strict";t();ro();da();$e={session:vt,local:wt}});function Do(){return new Date().setHours(new Date().getHours()+24)}function Po(e){$e.local.setItem({key:Ee.loginExpiresAt,data:e,expires:e})}var kt=S(()=>{"use strict";t();ao();ro()});var R=S(()=>{"use strict";t()});var ua,Ro,ga,fa,Ta,ha,io=S(()=>{"use strict";t();ua="error when signing",Ro="Transaction canceled",ga="error signing transaction",fa="provider not initialized",Ta="You need a signer/valid signer to send a transaction,use either WalletProvider, LedgerProvider or WalletConnect",ha="Undefined transaction status"});var ya=S(()=>{"use strict";t()});var It,$=S(()=>{"use strict";t();It=(r=>(r.nft="nft",r.esdt="esdt",r.egld="egld",r))(It||{})});var xa=S(()=>{"use strict";t()});var ba=S(()=>{"use strict";t()});var Sa=S(()=>{"use strict";t()});var wa=S(()=>{"use strict";t()});var K=S(()=>{"use strict";t();ya();$();R();xa();ba();Sa();wa()});var Mo,va,pd,ka,md,Ia,Aa,_d,qp,Fo=S(()=>{"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:va,egldLabel:pd}=Mo["devnet"],{chainId:ka,egldLabel:md}=Mo["testnet"],{chainId:Ia,egldLabel:Aa}=Mo["mainnet"],_d={["devnet"]:va,["testnet"]:ka,["mainnet"]:Ia},qp={[va]:"devnet",[ka]:"testnet",[Ia]:"mainnet"}});var At=S(()=>{"use strict";t()});var Ea=S(()=>{"use strict";t()});var co,Et=S(()=>{"use strict";t();co="transaction-status-toast-id"});var Oo,fn,W,so,Ca,La,Bo,Tn,Na,le,C=S(()=>{"use strict";t();io();Fo();At();Ea();Et();Oo=5e4,fn=1e9,W=18,so=4,Ca=1,La="/dapp/init",Bo="signSession",Tn="logout",Na="login",le="0"});var Ct,H,xe,j=S(()=>{"use strict";t();Ct=require("@reduxjs/toolkit");C();H=(0,Ct.createAction)(Tn),xe=(0,Ct.createAction)(Na,e=>({payload:e}))});var Pa,Da,Ra,Cd,Ma,Kp,Uo,Fa,Xp,Oa,Ba,Lt=S(()=>{"use strict";t();Pa=require("@reduxjs/toolkit");kt();R();j();Da={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},Ra=(0,Pa.createSlice)({name:"loginInfoSlice",initialState:Da,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,()=>Da),e.addCase(xe,(o,n)=>{o.loginMethod=n.payload.loginMethod,Po(Do())})}}),{setLoginMethod:Cd,setWalletConnectLogin:Ma,setLedgerLogin:Kp,setTokenLogin:Uo,setTokenLoginSignature:Fa,setWalletLogin:Xp,invalidateLoginSession:Oa}=Ra.actions,Ba=Ra.reducer});var Wo=S(()=>{"use strict";t()});var Wa=S(()=>{"use strict";t();Wo()});function Nt(e){return e[Math.floor(Math.random()*e.length)]}var Ga=S(()=>{"use strict";t()});var Dt=S(()=>{"use strict";t();At()});var po=S(()=>{"use strict";t();Wa();Ga();Dt()});var Va,$a,Pt,Zp,Ha,Hd,zd,za,Rt=S(()=>{"use strict";t();Va=require("@reduxjs/toolkit"),$a=g(require("lodash.omit"));po();Pt={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},Zp={network:Pt,chainID:"-1"},Ha=(0,Va.createSlice)({name:"appConfig",initialState:Zp,reducers:{initializeNetworkConfig:(e,o)=>{let n=Nt(o.payload.walletConnectBridgeAddresses),r=Nt(o.payload.walletConnectV2RelayAddresses),a=(0,$a.default)(o.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");e.network=v(u(u({},e.network),a),{walletConnectBridgeAddress:n,walletConnectV2RelayAddress:r})},setChainID:(e,o)=>{e.chainID=o.payload}}}),{initializeNetworkConfig:Hd,setChainID:zd}=Ha.actions,za=Ha.reducer});var Ft,ja,qa,hn,Mt,Ka,Ot,Qd,Bt,eu,Yp,Jp,ou,nu,tu,Qp,Xa,Ut=S(()=>{"use strict";t();Ft=require("@elrondnetwork/erdjs"),ja=require("@reduxjs/toolkit"),qa=require("redux-persist");C();ao();ro();j();hn={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:le},Mt={address:"",websocketEvent:null,accounts:{"":hn},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},Ka=(0,ja.createSlice)({name:"accountInfoSlice",initialState:Mt,reducers:{setAddress:(e,o)=>{let n=o.payload;e.address=n,e.publicKey=new Ft.Address(n).hex()},setAccount:(e,o)=>{let n=e.address===o.payload.address;e.accounts={[e.address]:n?o.payload:hn},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(Ee.loginExpiresAt),Mt)),e.addCase(xe,(o,n)=>{let{address:r}=n.payload;o.address=r,o.publicKey=new Ft.Address(r).hex()}),e.addCase(qa.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:Mt.accounts,o.publicKey=_})}}),{setAccount:Ot,setAddress:Qd,setAccountNonce:Bt,setAccountShard:eu,setLedgerAccount:Yp,updateLedgerAccount:Jp,setWalletConnectAccount:ou,setIsAccountLoading:nu,setAccountLoadingError:tu,setWebsocketEvent:Qp}=Ka.actions,Xa=Ka.reducer});function mo(e){return e!=null&&(cm(e)||yn(e))}function _o(e){return e!=null&&(sm(e)||_m(e))}function lo(e){return e!=null&&(pm(e)||lm(e))}function Wt(e){return e!=null&&mm(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 mm(e){return e!=null&&tm.includes(e)}function yn(e){return e!=null&&rm.includes(e)}function _m(e){return e!=null&&am.includes(e)}function lm(e){return e!=null&&im.includes(e)}var em,om,nm,tm,rm,am,im,Ce=S(()=>{"use strict";t();R();em=["sent"],om=["success"],nm=["fail","cancelled","timedOut"],tm=["timedOut"],rm=["pending"],am=["success"],im=["fail","invalid"]});var Za,Ya,Vo,dm,Ja,Qa,ei,um,uo,gm,fm,lu,Tm,go,Le,xn,bn=S(()=>{"use strict";t();Za=require("@reduxjs/toolkit"),Ya=require("redux-persist");R();Ce();j();Vo={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},dm={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Ja=(0,Za.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])||dm;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=u(u({},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,x;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(D=>D.hash===p?v(u({},D),{status:r,errorMessage:a}):D);let k=(T=(f=e.signedTransactions[n])==null?void 0:f.transactions)==null?void 0:T.every(D=>_o(D.status)),E=(x=(h=e.signedTransactions[n])==null?void 0:h.transactions)==null?void 0:x.every(D=>lo(D.status));k&&(e.signedTransactions[n].status="success"),E&&(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(Ya.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:Qa,updateSignedTransactions:ei,setTransactionsToSign:um,clearAllTransactionsToSign:uo,clearAllSignedTransactions:gm,clearSignedTransaction:fm,clearTransactionToSign:lu,setSignTransactionsError:Tm,setSignTransactionsCancelMessage:go,moveTransactionsToSignedState:Le}=Ja.actions,xn=Ja.reducer});var oi,Vt,$t,Ht,hm,Gt,ni,fu,ym,$o,Sn,wn=S(()=>{"use strict";t();oi=require("@reduxjs/toolkit");j();Vt="Transaction failed",$t="Transaction successful",Ht="Processing transaction",hm="Transaction submitted",Gt={},ni=(0,oi.createSlice)({name:"transactionsInfo",initialState:Gt,reducers:{setTransactionsDisplayInfo(e,o){let{sessionId:n,transactionsDisplayInfo:r}=o.payload;n!=null&&(e[n]={errorMessage:(r==null?void 0:r.errorMessage)||Vt,successMessage:(r==null?void 0:r.successMessage)||$t,processingMessage:(r==null?void 0:r.processingMessage)||Ht,submittedMessage:(r==null?void 0:r.submittedMessage)||hm,transactionDuration:r==null?void 0:r.transactionDuration})},clearTransactionsInfoForSessionId(e,o){o.payload!=null&&delete e[o.payload]},clearTransactionsInfo:()=>Gt},extraReducers:e=>{e.addCase(H,()=>Gt)}}),{clearTransactionsInfo:fu,setTransactionsDisplayInfo:ym,clearTransactionsInfoForSessionId:$o}=ni.actions,Sn=ni.reducer});var ri,ti,ai,xu,xm,bu,bm,ii,zt=S(()=>{"use strict";t();ri=require("@reduxjs/toolkit");j();ti={},ai=(0,ri.createSlice)({name:"modalsSlice",initialState:ti,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,()=>ti)}}),{setTxSubmittedModal:xu,setNotificationModal:xm,clearTxSubmittedModal:bu,clearNotificationModal:bm}=ai.actions,ii=ai.reducer});var si,pi,ci,mi,Sm,Ho,Cu,Lu,_i,li,vn,kn=S(()=>{"use strict";t();si=require("@reduxjs/toolkit"),pi=require("redux-persist");Et();K();xt();j();ci={customToasts:[],transactionToasts:[],failTransactionToast:null},mi=(0,si.createSlice)({name:"toastsSlice",initialState:ci,reducers:{addCustomToast:(e,o)=>{e.customToasts.push(v(u({},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:gn(),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(u({},o.payload),{toastId:co})},removeFailTransactionToast:e=>{e.failTransactionToast=null}},extraReducers:e=>{e.addCase(H,()=>ci),e.addCase(pi.REHYDRATE,(o,n)=>{var a,p;let r=(p=(a=n.customToasts)==null?void 0:a.filter(m=>!("component"in m)))!=null?p:[];o.customToasts=r})}}),{addCustomToast:Sm,removeCustomToast:Ho,addTransactionToast:Cu,removeTransactionToast:Lu,addFailTransactionToast:_i,removeFailTransactionToast:li}=mi.actions,vn=mi.reducer});var N=S(()=>{"use strict";t();Lt();Rt();Ut();bn();wn();zt();kn()});var jt=S(()=>{"use strict";t()});var fi,gi,Ti,Zu,Yu,Ju,Qu,eg,og,hi,yi=S(()=>{"use strict";t();fi=require("@reduxjs/toolkit");j();gi={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},Ti=(0,fi.createSlice)({name:"dappModalsSlice",initialState:gi,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=u({},o.payload)}},extraReducers:e=>{e.addCase(H,()=>gi)}}),{setDappModalVisibility:Zu,setDappModalHeaderVisibility:Yu,setDappModalFooterVisibility:Ju,setDappModalHeaderText:Qu,setDappModalFooterText:eg,setDappModalConfig:og}=Ti.actions,hi=Ti.reducer});var xi,Im,Am,fo,An=S(()=>{"use strict";t();xi=require("@reduxjs/toolkit");jt();Ut();yi();Lt();zt();Rt();kn();wn();bn();Im={["account"]:Xa,["networkConfig"]:za,["loginInfo"]:Ba,["modals"]:ii,["dappModal"]:hi,["toasts"]:vn,["transactions"]:xn,["transactionsInfo"]:Sn},Am=(e={})=>(0,xi.combineReducers)(u(u({},Im),e)),fo=Am});var wi={};Ue(wi,{default:()=>Rm});function qt(e,o=[]){return{key:e,version:1,storage:Si.default,blacklist:o}}var ze,bi,Si,Em,Cm,Lm,Nm,Dm,Pm,Rm,vi=S(()=>{"use strict";t();ze=require("redux-persist"),bi=g(require("redux-persist/lib/storage")),Si=g(require("redux-persist/lib/storage/session"));An();N();kn();wn();bn();jt();Em={2:e=>v(u({},e),{networkConfig:Pt})};Cm=qt("dapp-core-transactionsInfo"),Lm=qt("dapp-core-transactions",["transactionsToSign"]),Nm=qt("dapp-core-toasts"),Dm={key:"dapp-core-store",version:2,storage:bi.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,ze.createMigrate)(Em,{debug:!1})},Pm={["toasts"]:(0,ze.persistReducer)(Nm,vn),["transactions"]:(0,ze.persistReducer)(Lm,xn),["transactionsInfo"]:(0,ze.persistReducer)(Cm,Sn)},Rm=(0,ze.persistReducer)(Dm,fo(Pm))});var ki={};Ue(ki,{default:()=>Mm});var Mm,Ii=S(()=>{"use strict";t();An();Mm=fo()});var Ai={};Ue(Ai,{default:()=>Om});var Q,Fm,Om,Ei=S(()=>{"use strict";t();Q=require("redux-persist"),Fm=[Q.FLUSH,Q.REHYDRATE,Q.PAUSE,Q.PERSIST,Q.PURGE,Q.REGISTER],Om=Fm});var Ni={};Ue(Ni,{default:()=>Li});function Li(e){return(0,Ci.persistStore)(e)}var Ci,Di=S(()=>{"use strict";t();Ci=require("redux-persist")});var Cl={};Ue(Cl,{ConfirmationScreen:()=>Al,DeviceConfirmationScreen:()=>El,TransactionStatusToast:()=>sn});module.exports=No(Cl);t();t();var Dr=g(require("react"));t();t();t();var Bi=require("react"),To=require("react-redux");t();var Kt=require("@reduxjs/toolkit"),Fi=require("react-redux/es/utils/Subscription");N();t();var di=g(require("lodash.throttle"));C();N();kt();ao();ro();var wm=[Tn],vm=(0,di.default)(()=>{Po(Do())},5e3),ui=e=>o=>n=>{var d;if(wm.includes(n.type))return o(n);let r=e.getState(),a=$e.local.getItem(Ee.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(Oa())}catch(f){console.error("error logging out",f)}}),1e3):(vm(),o(n))};t();t();function In(){return typeof sessionStorage!="undefined"}var Pi=In()?(vi(),No(wi)).default:(Ii(),No(ki)).default,Ri=In()?(Ei(),No(Ai)).default:[],Mi=In()?(Di(),No(Ni)).default:e=>e;An();var A=(0,Kt.configureStore)({reducer:Pi,middleware:e=>e({serializableCheck:{ignoredActions:[...Ri,Bt.type,Ot.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(ui)}),Oi=(0,Fi.createSubscription)(A),Ig=Mi(A),Ag=(0,Kt.configureStore)({reducer:fo});var Bm={store:A,subscription:Oi},Xt=(0,Bi.createContext)(Bm),Ng=(0,To.createStoreHook)(Xt),G=(0,To.createDispatchHook)(Xt),I=(0,To.createSelectorHook)(Xt);t();t();N();t();var Ui=g(require("lodash.isequal")),En=require("reselect"),y=(0,En.createSelectorCreator)(En.defaultMemoize,Ui.default);var be=e=>e.account,je=y(be,e=>e.address),ho=y(be,je,(e,o)=>o in e.accounts?e.accounts[o]:hn),Um=y(be,ho,(e,o)=>{let a=e,{accounts:n}=a,r=Be(a,["accounts"]);return v(u({},r),{account:o})}),Wm=y(ho,e=>e.balance),Wi=y(ho,e=>{var o;return((o=e==null?void 0:e.nonce)==null?void 0:o.valueOf())||0}),Fg=y(be,e=>e.shard),Gm=y(be,e=>e.ledgerAccount),Og=y(be,e=>e.walletConnectAccount),Bg=y(be,e=>e.isAccountLoading),Ug=y(be,e=>e.accountLoadingError),Gi=y(be,e=>e.websocketEvent);t();var Se=e=>e.networkConfig,Cn=y(Se,e=>e.chainID),Vm=y(Se,e=>e.network.walletConnectBridgeAddress),$m=y(Se,e=>e.network.walletConnectV2RelayAddress),Hm=y(Se,e=>e.network.walletConnectV2ProjectId),Vi=y(Se,e=>e.network.walletConnectDeepLink),Ne=y(Se,e=>e.network),Zt=y(Ne,e=>e.apiAddress),$i=y(Ne,e=>e.explorerAddress),Hi=y(Ne,e=>e.egldLabel);t();R();var qe=e=>e.loginInfo,jg=y(qe,e=>e.loginMethod),Ln=y(qe,je,(e,o)=>e.loginMethod!=""&&Boolean(o)),qg=y(qe,e=>e.walletConnectLogin),Kg=y(qe,e=>e.ledgerLogin),zm=y(qe,e=>e.walletLogin),Xg=y(qe,e=>e.isLoginSessionInvalid);t();t();var X=require("@elrondnetwork/erdjs");C();t();function Nn(e){try{return i.Buffer.from(e,"base64").toString()===atob(e)}catch(o){return!1}}function zi(e){return atob(e)}function Ke(e){var a,p,m;let{data:o}=e,n=Nn(o!=null?o:"")?X.TransactionPayload.fromEncoded(o):new X.TransactionPayload(o),r=new X.Transaction(u({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:fn,chainID:e.chainID.valueOf(),version:new X.TransactionVersion((m=e.version)!=null?m:Ca)},e.options?{options:new X.TransactionOptions(e.options)}:{}));return r.applySignature({hex:()=>e.signature||""},new X.Address(e.sender)),r}t();Ce();t();var jm=g(require("bignumber.js"));K();t();t();function Yt(e){for(let o=0;o<e.length;o++)if(e.charCodeAt(o)>127)return!1;return!0}function Dn(e){let o=e;try{let n=i.Buffer.from(e,"hex").toString();Yt(n)&&n.length>1&&(o=n)}catch(n){}return o}t();t();var Qt=require("@elrondnetwork/erdjs"),er=g(require("bignumber.js"));R();t();var qi=require("@elrondnetwork/erdjs");function qm(e){try{let o=new qi.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)&&qm(e)}var Jt={tokenId:"",amount:""},Km=e=>e.split("@").map((p,m)=>[2,3].includes(m)?p:Dn(p));function or(e){if(!e)return Jt;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 Jt;let m=new er.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]=Km(e);if([r,a,p,m].every(_=>Boolean(_))&&yo(new Qt.Address(m).bech32()))return{tokenId:`${r}-${a}`,amount:new er.default(p,16).toString(10),collection:r,nonce:a,receiver:new Qt.