UNPKG

@sofaws/dapp-core

Version:

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

1 lines 53.1 kB
"use strict";var fo=Object.create;var pe=Object.defineProperty,To=Object.defineProperties,yo=Object.getOwnPropertyDescriptor,ho=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertyNames,we=Object.getOwnPropertySymbols,So=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var zt=(t,e,r)=>e in t?pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e||(e={}))Xe.call(e,r)&&zt(t,r,e[r]);if(we)for(var r of we(e))Kt.call(e,r)&&zt(t,r,e[r]);return t},A=(t,e)=>To(t,ho(e));var Yt=(t,e)=>{var r={};for(var n in t)Xe.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&we)for(var n of we(t))e.indexOf(n)<0&&Kt.call(t,n)&&(r[n]=t[n]);return r};var T=(t,e)=>()=>(t&&(e=t(t=0)),e);var be=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),K=(t,e)=>{for(var r in e)pe(t,r,{get:e[r],enumerable:!0})},Zt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xo(e))!Xe.call(t,i)&&i!==r&&pe(t,i,{get:()=>e[i],enumerable:!(n=yo(e,i))||n.enumerable});return t};var b=(t,e,r)=>(r=t!=null?fo(So(t)):{},Zt(e||!t||!t.__esModule?pe(r,"default",{value:t,enumerable:!0}):r,t)),ue=t=>Zt(pe({},"__esModule",{value:!0}),t);var Je=(t,e,r)=>new Promise((n,i)=>{var p=d=>{try{m(r.next(d))}catch(g){i(g)}},l=d=>{try{m(r.throw(d))}catch(g){i(g)}},m=d=>d.done?n(d.value):Promise.resolve(d.value).then(p,l);m((r=r.apply(t,e)).next())});var Qt=be(ve=>{"use strict";o();ve.byteLength=bo;ve.toByteArray=Ao;ve.fromByteArray=ko;var F=[],C=[],wo=typeof Uint8Array!="undefined"?Uint8Array:Array,Qe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Y=0,Xt=Qe.length;Y<Xt;++Y)F[Y]=Qe[Y],C[Qe.charCodeAt(Y)]=Y;var Y,Xt;C["-".charCodeAt(0)]=62;C["_".charCodeAt(0)]=63;function Jt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function bo(t){var e=Jt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function vo(t,e,r){return(e+r)*3/4-r}function Ao(t){var e,r=Jt(t),n=r[0],i=r[1],p=new wo(vo(t,n,i)),l=0,m=i>0?n-4:n,d;for(d=0;d<m;d+=4)e=C[t.charCodeAt(d)]<<18|C[t.charCodeAt(d+1)]<<12|C[t.charCodeAt(d+2)]<<6|C[t.charCodeAt(d+3)],p[l++]=e>>16&255,p[l++]=e>>8&255,p[l++]=e&255;return i===2&&(e=C[t.charCodeAt(d)]<<2|C[t.charCodeAt(d+1)]>>4,p[l++]=e&255),i===1&&(e=C[t.charCodeAt(d)]<<10|C[t.charCodeAt(d+1)]<<4|C[t.charCodeAt(d+2)]>>2,p[l++]=e>>8&255,p[l++]=e&255),p}function Io(t){return F[t>>18&63]+F[t>>12&63]+F[t>>6&63]+F[t&63]}function Eo(t,e,r){for(var n,i=[],p=e;p<r;p+=3)n=(t[p]<<16&16711680)+(t[p+1]<<8&65280)+(t[p+2]&255),i.push(Io(n));return i.join("")}function ko(t){for(var e,r=t.length,n=r%3,i=[],p=16383,l=0,m=r-n;l<m;l+=p)i.push(Eo(t,l,l+p>m?m:l+p));return n===1?(e=t[r-1],i.push(F[e>>2]+F[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(F[e>>10]+F[e>>4&63]+F[e<<2&63]+"=")),i.join("")}});var er=be(et=>{o();et.read=function(t,e,r,n,i){var p,l,m=i*8-n-1,d=(1<<m)-1,g=d>>1,h=-7,y=r?i-1:0,I=r?-1:1,E=t[e+y];for(y+=I,p=E&(1<<-h)-1,E>>=-h,h+=m;h>0;p=p*256+t[e+y],y+=I,h-=8);for(l=p&(1<<-h)-1,p>>=-h,h+=n;h>0;l=l*256+t[e+y],y+=I,h-=8);if(p===0)p=1-g;else{if(p===d)return l?NaN:(E?-1:1)*(1/0);l=l+Math.pow(2,n),p=p-g}return(E?-1:1)*l*Math.pow(2,p-n)};et.write=function(t,e,r,n,i,p){var l,m,d,g=p*8-i-1,h=(1<<g)-1,y=h>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:p-1,G=n?1:-1,B=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,l=h):(l=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-l))<1&&(l--,d*=2),l+y>=1?e+=I/d:e+=I*Math.pow(2,1-y),e*d>=2&&(l++,d/=2),l+y>=h?(m=0,l=h):l+y>=1?(m=(e*d-1)*Math.pow(2,i),l=l+y):(m=e*Math.pow(2,y-1)*Math.pow(2,i),l=0));i>=8;t[r+E]=m&255,E+=G,m/=256,i-=8);for(l=l<<i|m,g+=i;g>0;t[r+E]=l&255,E+=G,l/=256,g-=8);t[r+E-G]|=B*128}});var mr=be(te=>{"use strict";o();var tt=Qt(),ee=er(),tr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;te.Buffer=u;te.SlowBuffer=Ro;te.INSPECT_MAX_BYTES=50;var Ae=2147483647;te.kMaxLength=Ae;u.TYPED_ARRAY_SUPPORT=Lo();!u.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Lo(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(r){return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.buffer}});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.byteOffset}});function U(t){if(t>Ae)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return it(t)}return or(t,e,r)}u.poolSize=8192;function or(t,e,r){if(typeof t=="string")return No(t,e);if(ArrayBuffer.isView(t))return Po(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(_(t,ArrayBuffer)||t&&_(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(_(t,SharedArrayBuffer)||t&&_(t.buffer,SharedArrayBuffer)))return nt(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return u.from(n,e,r);var i=Co(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}u.from=function(t,e,r){return or(t,e,r)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function ir(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Do(t,e,r){return ir(t),t<=0?U(t):e!==void 0?typeof r=="string"?U(t).fill(e,r):U(t).fill(e):U(t)}u.alloc=function(t,e,r){return Do(t,e,r)};function it(t){return ir(t),U(t<0?0:at(t)|0)}u.allocUnsafe=function(t){return it(t)};u.allocUnsafeSlow=function(t){return it(t)};function No(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=ar(t,e)|0,n=U(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function rt(t){for(var e=t.length<0?0:at(t.length)|0,r=U(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Po(t){if(_(t,Uint8Array)){var e=new Uint8Array(t);return nt(e.buffer,e.byteOffset,e.byteLength)}return rt(t)}function nt(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function Co(t){if(u.isBuffer(t)){var e=at(t.length)|0,r=U(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||st(t.length)?U(0):rt(t);if(t.type==="Buffer"&&Array.isArray(t.data))return rt(t.data)}function at(t){if(t>=Ae)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ae.toString(16)+" bytes");return t|0}function Ro(t){return+t!=t&&(t=0),u.alloc(+t)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype};u.compare=function(e,r){if(_(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),_(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(e)||!u.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,p=0,l=Math.min(n,i);p<l;++p)if(e[p]!==r[p]){n=e[p],i=r[p];break}return n<i?-1:i<n?1:0};u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return u.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=u.allocUnsafe(r),p=0;for(n=0;n<e.length;++n){var l=e[n];if(_(l,Uint8Array))p+l.length>i.length?u.from(l).copy(i,p):Uint8Array.prototype.set.call(i,l,p);else if(u.isBuffer(l))l.copy(i,p);else throw new TypeError('"list" argument must be an Array of Buffers');p+=l.length}return i};function ar(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||_(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ot(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return dr(t).length;default:if(i)return n?-1:ot(t).length;e=(""+e).toLowerCase(),i=!0}}u.byteLength=ar;function Fo(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Go(this,e,r);case"utf8":case"utf-8":return cr(this,e,r);case"ascii":return Ho(this,e,r);case"latin1":case"binary":return Wo(this,e,r);case"base64":return $o(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qo(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function Z(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}u.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)Z(this,r,r+1);return this};u.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)Z(this,r,r+3),Z(this,r+1,r+2);return this};u.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)Z(this,r,r+7),Z(this,r+1,r+6),Z(this,r+2,r+5),Z(this,r+3,r+4);return this};u.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?cr(this,0,e):Fo.apply(this,arguments)};u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:u.compare(this,e)===0};u.prototype.inspect=function(){var e="",r=te.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};tr&&(u.prototype[tr]=u.prototype.inspect);u.prototype.compare=function(e,r,n,i,p){if(_(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),p===void 0&&(p=this.length),r<0||n>e.length||i<0||p>this.length)throw new RangeError("out of range index");if(i>=p&&r>=n)return 0;if(i>=p)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,p>>>=0,this===e)return 0;for(var l=p-i,m=n-r,d=Math.min(l,m),g=this.slice(i,p),h=e.slice(r,n),y=0;y<d;++y)if(g[y]!==h[y]){l=g[y],m=h[y];break}return l<m?-1:m<l?1:0};function sr(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,st(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=u.from(e,n)),u.isBuffer(e))return e.length===0?-1:rr(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):rr(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function rr(t,e,r,n,i){var p=1,l=t.length,m=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;p=2,l/=2,m/=2,r/=2}function d(E,G){return p===1?E[G]:E.readUInt16BE(G*p)}var g;if(i){var h=-1;for(g=r;g<l;g++)if(d(t,g)===d(e,h===-1?0:g-h)){if(h===-1&&(h=g),g-h+1===m)return h*p}else h!==-1&&(g-=g-h),h=-1}else for(r+m>l&&(r=l-m),g=r;g>=0;g--){for(var y=!0,I=0;I<m;I++)if(d(t,g+I)!==d(e,I)){y=!1;break}if(y)return g}return-1}u.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};u.prototype.indexOf=function(e,r,n){return sr(this,e,r,n,!0)};u.prototype.lastIndexOf=function(e,r,n){return sr(this,e,r,n,!1)};function _o(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var p=e.length;n>p/2&&(n=p/2);for(var l=0;l<n;++l){var m=parseInt(e.substr(l*2,2),16);if(st(m))return l;t[r+l]=m}return l}function Mo(t,e,r,n){return Ie(ot(e,t.length-r),t,r,n)}function Oo(t,e,r,n){return Ie(Ko(e),t,r,n)}function Bo(t,e,r,n){return Ie(dr(e),t,r,n)}function Uo(t,e,r,n){return Ie(Yo(e,t.length-r),t,r,n)}u.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var p=this.length-r;if((n===void 0||n>p)&&(n=p),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var l=!1;;)switch(i){case"hex":return _o(this,e,r,n);case"utf8":case"utf-8":return Mo(this,e,r,n);case"ascii":case"latin1":case"binary":return Oo(this,e,r,n);case"base64":return Bo(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Uo(this,e,r,n);default:if(l)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),l=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $o(t,e,r){return e===0&&r===t.length?tt.fromByteArray(t):tt.fromByteArray(t.slice(e,r))}function cr(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var p=t[i],l=null,m=p>239?4:p>223?3:p>191?2:1;if(i+m<=r){var d,g,h,y;switch(m){case 1:p<128&&(l=p);break;case 2:d=t[i+1],(d&192)===128&&(y=(p&31)<<6|d&63,y>127&&(l=y));break;case 3:d=t[i+1],g=t[i+2],(d&192)===128&&(g&192)===128&&(y=(p&15)<<12|(d&63)<<6|g&63,y>2047&&(y<55296||y>57343)&&(l=y));break;case 4:d=t[i+1],g=t[i+2],h=t[i+3],(d&192)===128&&(g&192)===128&&(h&192)===128&&(y=(p&15)<<18|(d&63)<<12|(g&63)<<6|h&63,y>65535&&y<1114112&&(l=y))}}l===null?(l=65533,m=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l),i+=m}return Vo(n)}var nr=4096;function Vo(t){var e=t.length;if(e<=nr)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=nr));return r}function Ho(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Wo(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Go(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",p=e;p<r;++p)i+=Zo[t[p]];return i}function qo(t,e,r){for(var n=t.slice(e,r),i="",p=0;p<n.length-1;p+=2)i+=String.fromCharCode(n[p]+n[p+1]*256);return i}u.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i=this.subarray(e,r);return Object.setPrototypeOf(i,u.prototype),i};function v(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var i=this[e],p=1,l=0;++l<r&&(p*=256);)i+=this[e+l]*p;return i};u.prototype.readUintBE=u.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var i=this[e+--r],p=1;r>0&&(p*=256);)i+=this[e+--r]*p;return i};u.prototype.readUint8=u.prototype.readUInt8=function(e,r){return e=e>>>0,r||v(e,1,this.length),this[e]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||v(e,2,this.length),this[e]|this[e+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||v(e,2,this.length),this[e]<<8|this[e+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||v(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};u.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var i=this[e],p=1,l=0;++l<r&&(p*=256);)i+=this[e+l]*p;return p*=128,i>=p&&(i-=Math.pow(2,8*r)),i};u.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var i=r,p=1,l=this[e+--i];i>0&&(p*=256);)l+=this[e+--i]*p;return p*=128,l>=p&&(l-=Math.pow(2,8*r)),l};u.prototype.readInt8=function(e,r){return e=e>>>0,r||v(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};u.prototype.readInt16LE=function(e,r){e=e>>>0,r||v(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(e,r){e=e>>>0,r||v(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(e,r){return e=e>>>0,r||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};u.prototype.readInt32BE=function(e,r){return e=e>>>0,r||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};u.prototype.readFloatLE=function(e,r){return e=e>>>0,r||v(e,4,this.length),ee.read(this,e,!0,23,4)};u.prototype.readFloatBE=function(e,r){return e=e>>>0,r||v(e,4,this.length),ee.read(this,e,!1,23,4)};u.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||v(e,8,this.length),ee.read(this,e,!0,52,8)};u.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||v(e,8,this.length),ee.read(this,e,!1,52,8)};function L(t,e,r,n,i,p){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<p)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var p=Math.pow(2,8*n)-1;L(this,e,r,n,p,0)}var l=1,m=0;for(this[r]=e&255;++m<n&&(l*=256);)this[r+m]=e/l&255;return r+n};u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var p=Math.pow(2,8*n)-1;L(this,e,r,n,p,0)}var l=n-1,m=1;for(this[r+l]=e&255;--l>=0&&(m*=256);)this[r+l]=e/m&255;return r+n};u.prototype.writeUint8=u.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,1,255,0),this[r]=e&255,r+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};u.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var p=Math.pow(2,8*n-1);L(this,e,r,n,p-1,-p)}var l=0,m=1,d=0;for(this[r]=e&255;++l<n&&(m*=256);)e<0&&d===0&&this[r+l-1]!==0&&(d=1),this[r+l]=(e/m>>0)-d&255;return r+n};u.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var p=Math.pow(2,8*n-1);L(this,e,r,n,p-1,-p)}var l=n-1,m=1,d=0;for(this[r+l]=e&255;--l>=0&&(m*=256);)e<0&&d===0&&this[r+l+1]!==0&&(d=1),this[r+l]=(e/m>>0)-d&255;return r+n};u.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};u.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};u.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};u.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};u.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||L(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function lr(t,e,r,n,i,p){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function pr(t,e,r,n,i){return e=+e,r=r>>>0,i||lr(t,e,r,4,34028234663852886e22,-34028234663852886e22),ee.write(t,e,r,n,23,4),r+4}u.prototype.writeFloatLE=function(e,r,n){return pr(this,e,r,!0,n)};u.prototype.writeFloatBE=function(e,r,n){return pr(this,e,r,!1,n)};function ur(t,e,r,n,i){return e=+e,r=r>>>0,i||lr(t,e,r,8,17976931348623157e292,-17976931348623157e292),ee.write(t,e,r,n,52,8),r+8}u.prototype.writeDoubleLE=function(e,r,n){return ur(this,e,r,!0,n)};u.prototype.writeDoubleBE=function(e,r,n){return ur(this,e,r,!1,n)};u.prototype.copy=function(e,r,n,i){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var p=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),p};u.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){var p=e.charCodeAt(0);(i==="utf8"&&p<128||i==="latin1")&&(e=p)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var l;if(typeof e=="number")for(l=r;l<n;++l)this[l]=e;else{var m=u.isBuffer(e)?e:u.from(e,i),d=m.length;if(d===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(l=0;l<n-r;++l)this[l+r]=m[l%d]}return this};var jo=/[^+/0-9A-Za-z-_]/g;function zo(t){if(t=t.split("=")[0],t=t.trim().replace(jo,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ot(t,e){e=e||1/0;for(var r,n=t.length,i=null,p=[],l=0;l<n;++l){if(r=t.charCodeAt(l),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&p.push(239,191,189);continue}else if(l+1===n){(e-=3)>-1&&p.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&p.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&p.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;p.push(r)}else if(r<2048){if((e-=2)<0)break;p.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;p.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;p.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return p}function Ko(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Yo(t,e){for(var r,n,i,p=[],l=0;l<t.length&&!((e-=2)<0);++l)r=t.charCodeAt(l),n=r>>8,i=r%256,p.push(i),p.push(n);return p}function dr(t){return tt.toByteArray(zo(t))}function Ie(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function _(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function st(t){return t!==t}var Zo=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var hr=be((Aa,yr)=>{o();var S=yr.exports={},M,O;function ct(){throw new Error("setTimeout has not been defined")}function lt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?M=setTimeout:M=ct}catch(t){M=ct}try{typeof clearTimeout=="function"?O=clearTimeout:O=lt}catch(t){O=lt}})();function gr(t){if(M===setTimeout)return setTimeout(t,0);if((M===ct||!M)&&setTimeout)return M=setTimeout,setTimeout(t,0);try{return M(t,0)}catch(e){try{return M.call(null,t,0)}catch(r){return M.call(this,t,0)}}}function Xo(t){if(O===clearTimeout)return clearTimeout(t);if((O===lt||!O)&&clearTimeout)return O=clearTimeout,clearTimeout(t);try{return O(t)}catch(e){try{return O.call(null,t)}catch(r){return O.call(this,t)}}}var $=[],re=!1,X,Ee=-1;function Jo(){!re||!X||(re=!1,X.length?$=X.concat($):Ee=-1,$.length&&fr())}function fr(){if(!re){var t=gr(Jo);re=!0;for(var e=$.length;e;){for(X=$,$=[];++Ee<e;)X&&X[Ee].run();Ee=-1,e=$.length}X=null,re=!1,Xo(t)}}S.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];$.push(new Tr(t,e)),$.length===1&&!re&&gr(fr)};function Tr(t,e){this.fun=t,this.array=e}Tr.prototype.run=function(){this.fun.apply(null,this.array)};S.title="browser";S.browser=!0;S.env={};S.argv=[];S.version="";S.versions={};function V(){}S.on=V;S.addListener=V;S.once=V;S.off=V;S.removeListener=V;S.removeAllListeners=V;S.emit=V;S.prependListener=V;S.prependOnceListener=V;S.listeners=function(t){return[]};S.binding=function(t){throw new Error("process.binding is not supported")};S.cwd=function(){return"/"};S.chdir=function(t){throw new Error("process.chdir is not supported")};S.umask=function(){return 0}});var a,s,Ia,o=T(()=>{a=b(mr()),s=b(hr()),Ia=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object)});var xr=T(()=>{"use strict";o()});var Sr=T(()=>{"use strict";o()});var k=T(()=>{"use strict";o()});var N=T(()=>{"use strict";o()});var wr=T(()=>{"use strict";o()});var br=T(()=>{"use strict";o()});var vr=T(()=>{"use strict";o()});var Ar=T(()=>{"use strict";o()});var q=T(()=>{"use strict";o();Sr();k();N();wr();br();vr();Ar()});var pt,Ir,Va,Er,Ha,kr,Wa,Ga,qa,Lr=T(()=>{"use strict";o();q();pt={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:Ir,egldLabel:Va}=pt["devnet"],{chainId:Er,egldLabel:Ha}=pt["testnet"],{chainId:kr,egldLabel:Wa}=pt["mainnet"],Ga={["devnet"]:Ir,["testnet"]:Er,["mainnet"]:kr},qa={[Ir]:"devnet",[Er]:"testnet",[kr]:"mainnet"}});var ut=T(()=>{"use strict";o()});var Dr=T(()=>{"use strict";o()});var Nr,dt=T(()=>{"use strict";o();Nr="transaction-status-toast-id"});var mt,gt,Pr,ke,Cr,ne,w=T(()=>{"use strict";o();xr();Lr();ut();Dr();dt();mt=5e4,gt=1e9,Pr=1,ke="logout",Cr="login",ne="0"});var Ne,yt=T(()=>{"use strict";o();Ne=()=>Date.now()/1e3});var Or=T(()=>{"use strict";o()});var Br=T(()=>{"use strict";o()});var Ur=T(()=>{"use strict";o();yt();Or();Br()});var xt={};K(xt,{getItem:()=>ti,localStorageKeys:()=>J,removeItem:()=>ri,setItem:()=>ei});var J,ht,ei,ti,ri,me=T(()=>{"use strict";o();Ur();J={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},ht=typeof localStorage!="undefined",ei=({key:t,data:e,expires:r})=>{!ht||localStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},ti=t=>{if(!ht)return;let e=localStorage.getItem(String(t));if(!e)return null;let r=JSON.parse(e);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:Ne()>=r.expires?(localStorage.removeItem(String(t)),null):r.data},ri=t=>{!ht||localStorage.removeItem(String(t))}});var St={};K(St,{clear:()=>Wr,getItem:()=>Vr,removeItem:()=>Hr,setItem:()=>$r,storage:()=>ni});var $r,Vr,Hr,Wr,ni,Gr=T(()=>{"use strict";o();$r=({key:t,data:e,expires:r})=>{sessionStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},Vr=t=>{let e=sessionStorage.getItem(String(t));if(!e)return null;let r=JSON.parse(e);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:Date.now()>=r.expires?(sessionStorage.removeItem(String(t)),null):r.data},Hr=t=>sessionStorage.removeItem(String(t)),Wr=()=>sessionStorage.clear(),ni={setItem:$r,getItem:Vr,removeItem:Hr,clear:Wr}});var oe,Pe=T(()=>{"use strict";o();me();Gr();oe={session:St,local:xt}});function ge(){return new Date().setHours(new Date().getHours()+24)}function fe(t){oe.local.setItem({key:J.loginExpiresAt,data:t,expires:t})}var wt=T(()=>{"use strict";o();Pe();me()});var bt,D,Ce,j=T(()=>{"use strict";o();bt=require("@reduxjs/toolkit");w();D=(0,bt.createAction)(ke),Ce=(0,bt.createAction)(Cr,t=>({payload:t}))});var jr,qr,zr,Cs,Rs,Fs,_s,Ms,Os,Kr,Yr,vt=T(()=>{"use strict";o();jr=require("@reduxjs/toolkit");wt();N();j();qr={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},zr=(0,jr.createSlice)({name:"loginInfoSlice",initialState:qr,reducers:{setLoginMethod:(t,e)=>{t.loginMethod=e.payload},setTokenLogin:(t,e)=>{t.tokenLogin=e.payload},setTokenLoginSignature:(t,e)=>{(t==null?void 0:t.tokenLogin)!=null&&(t.tokenLogin.signature=e.payload)},setWalletLogin:(t,e)=>{t.walletLogin=e.payload},setWalletConnectLogin:(t,e)=>{t.walletConnectLogin=e.payload},setLedgerLogin:(t,e)=>{t.ledgerLogin=e.payload},invalidateLoginSession:t=>{t.isLoginSessionInvalid=!0}},extraReducers:t=>{t.addCase(D,()=>qr),t.addCase(Ce,(e,r)=>{e.loginMethod=r.payload.loginMethod,fe(ge())})}}),{setLoginMethod:Cs,setWalletConnectLogin:Rs,setLedgerLogin:Fs,setTokenLogin:_s,setTokenLoginSignature:Ms,setWalletLogin:Os,invalidateLoginSession:Kr}=zr.actions,Yr=zr.reducer});var Zr=T(()=>{"use strict";o()});var Xr=T(()=>{"use strict";o();Zr()});function At(t){return t[Math.floor(Math.random()*t.length)]}var Jr=T(()=>{"use strict";o()});var Qr=T(()=>{"use strict";o();ut()});var en=T(()=>{"use strict";o();Xr();Jr();Qr()});var tn,rn,It,oi,nn,Qs,ec,on,Et=T(()=>{"use strict";o();tn=require("@reduxjs/toolkit"),rn=b(require("lodash.omit"));en();It={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},oi={network:It,chainID:"-1"},nn=(0,tn.createSlice)({name:"appConfig",initialState:oi,reducers:{initializeNetworkConfig:(t,e)=>{let r=At(e.payload.walletConnectBridgeAddresses),n=At(e.payload.walletConnectV2RelayAddresses),i=(0,rn.default)(e.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");t.network=A(x(x({},t.network),i),{walletConnectBridgeAddress:r,walletConnectV2RelayAddress:n})},setChainID:(t,e)=>{t.chainID=e.payload}}}),{initializeNetworkConfig:Qs,setChainID:ec}=nn.actions,on=nn.reducer});var Lt,an,sn,Re,kt,cn,ln,cc,pn,lc,pc,uc,dc,mc,gc,fc,un,Dt=T(()=>{"use strict";o();Lt=require("@elrondnetwork/erdjs"),an=require("@reduxjs/toolkit"),sn=require("redux-persist");w();Pe();me();j();Re={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:ne},kt={address:"",websocketEvent:null,accounts:{"":Re},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},cn=(0,an.createSlice)({name:"accountInfoSlice",initialState:kt,reducers:{setAddress:(t,e)=>{let r=e.payload;t.address=r,t.publicKey=new Lt.Address(r).hex()},setAccount:(t,e)=>{let r=t.address===e.payload.address;t.accounts={[t.address]:r?e.payload:Re},t.isAccountLoading=!1,t.accountLoadingError=null},setAccountNonce:(t,e)=>{let{address:r}=t;t.accounts[r].nonce=e.payload},setAccountShard:(t,e)=>{t.shard=e.payload},setLedgerAccount:(t,e)=>{t.ledgerAccount=e.payload},updateLedgerAccount:(t,e)=>{t.ledgerAccount!=null&&(t.ledgerAccount.index=e.payload.index,t.ledgerAccount.address=e.payload.address)},setWalletConnectAccount:(t,e)=>{t.walletConnectAccount=e.payload},setIsAccountLoading:(t,e)=>{t.isAccountLoading=e.payload,t.accountLoadingError=null},setAccountLoadingError:(t,e)=>{t.accountLoadingError=e.payload,t.isAccountLoading=!1},setWebsocketEvent:(t,e)=>{t.websocketEvent={timestamp:Date.now(),message:e.payload}}},extraReducers:t=>{t.addCase(D,()=>(oe.local.removeItem(J.loginExpiresAt),kt)),t.addCase(Ce,(e,r)=>{let{address:n}=r.payload;e.address=n,e.publicKey=new Lt.Address(n).hex()}),t.addCase(sn.REHYDRATE,(e,r)=>{var g;if(!((g=r.payload)!=null&&g.account))return;let{account:n}=r.payload,{address:i,shard:p,accounts:l,publicKey:m}=n;e.address=i,e.shard=p;let d=l&&i in l;e.accounts=d?l:kt.accounts,e.publicKey=m})}}),{setAccount:ln,setAddress:cc,setAccountNonce:pn,setAccountShard:lc,setLedgerAccount:pc,updateLedgerAccount:uc,setWalletConnectAccount:dc,setIsAccountLoading:mc,setAccountLoadingError:gc,setWebsocketEvent:fc}=cn.actions,un=cn.reducer});function dn(t){return t!=null&&(mi(t)||yi(t))}function Fe(t){return t!=null&&(gi(t)||hi(t))}function _e(t){return t!=null&&(fi(t)||xi(t))}function mn(t){return t!=null&&Ti(t)}function mi(t){return t!=null&&ai.includes(t)}function gi(t){return t!=null&&si.includes(t)}function fi(t){return t!=null&&ci.includes(t)}function Ti(t){return t!=null&&li.includes(t)}function yi(t){return t!=null&&pi.includes(t)}function hi(t){return t!=null&&ui.includes(t)}function xi(t){return t!=null&&di.includes(t)}var ai,si,ci,li,pi,ui,di,Pt=T(()=>{"use strict";o();N();ai=["sent"],si=["success"],ci=["fail","cancelled","timedOut"],li=["timedOut"],pi=["pending"],ui=["success"],di=["fail","invalid"]});var gn,fn,Te,Si,Tn,Ac,Ic,Ec,kc,Lc,Dc,Nc,Pc,Cc,Rc,Me,Oe=T(()=>{"use strict";o();gn=require("@reduxjs/toolkit"),fn=require("redux-persist");N();Pt();j();Te={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},Si={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Tn=(0,gn.createSlice)({name:"transactionsSlice",initialState:Te,reducers:{moveTransactionsToSignedState:(t,e)=>{var d,g;let{sessionId:r,transactions:n,errorMessage:i,status:p,redirectRoute:l}=e.payload,m=((d=t.customTransactionInformationForSessionId)==null?void 0:d[r])||Si;t.signedTransactions[r]={transactions:n,status:p,errorMessage:i,redirectRoute:l,customTransactionInformation:m},((g=t==null?void 0:t.transactionsToSign)==null?void 0:g.sessionId)===r&&(t.transactionsToSign=Te.transactionsToSign)},clearSignedTransaction:(t,e)=>{t.signedTransactions[e.payload]&&delete t.signedTransactions[e.payload]},clearTransactionToSign:t=>{t!=null&&t.transactionsToSign&&(t.transactionsToSign=null)},updateSignedTransaction:(t,e)=>{t.signedTransactions=x(x({},t.signedTransactions),e.payload)},updateSignedTransactions:(t,e)=>{let{sessionId:r,status:n,errorMessage:i,transactions:p}=e.payload;t.signedTransactions[r]!=null&&(t.signedTransactions[r].status=n,i!=null&&(t.signedTransactions[r].errorMessage=i),p!=null&&(t.signedTransactions[r].transactions=p))},updateSignedTransactionStatus:(t,e)=>{var m,d,g,h,y,I;let{sessionId:r,status:n,errorMessage:i,transactionHash:p}=e.payload,l=(d=(m=t.signedTransactions)==null?void 0:m[r])==null?void 0:d.transactions;if(l!=null){t.signedTransactions[r].transactions=l.map(B=>B.hash===p?A(x({},B),{status:n,errorMessage:i}):B);let E=(h=(g=t.signedTransactions[r])==null?void 0:g.transactions)==null?void 0:h.every(B=>Fe(B.status)),G=(I=(y=t.signedTransactions[r])==null?void 0:y.transactions)==null?void 0:I.every(B=>_e(B.status));E&&(t.signedTransactions[r].status="success"),G&&(t.signedTransactions[r].status="fail")}},setTransactionsToSign:(t,e)=>{t.transactionsToSign=e.payload;let{sessionId:r,customTransactionInformation:n}=e.payload;t.customTransactionInformationForSessionId[r]=n,t.signTransactionsError=null},clearAllTransactionsToSign:t=>{t.transactionsToSign=Te.transactionsToSign,t.signTransactionsError=null},clearAllSignedTransactions:t=>{t.signedTransactions=Te.signedTransactions},setSignTransactionsError:(t,e)=>{t.signTransactionsError=e.payload},setSignTransactionsCancelMessage:(t,e)=>{t.signTransactionsCancelMessage=e.payload}},extraReducers:t=>{t.addCase(D,()=>Te),t.addCase(fn.REHYDRATE,(e,r)=>{var l;if(e.signTransactionsCancelMessage=null,!((l=r.payload)!=null&&l.transactions))return;let{signedTransactions:n,customTransactionInformationForSessionId:i}=r.payload.transactions,p=Object.entries(n).reduce((m,[d,g])=>{let h=new Date(d),y=new Date;return y.setHours(y.getHours()+5),y-h>0||(m[d]=g),m},{});i!=null&&(e.customTransactionInformationForSessionId=i),n!=null&&(e.signedTransactions=p)})}}),{updateSignedTransactionStatus:Ac,updateSignedTransactions:Ic,setTransactionsToSign:Ec,clearAllTransactionsToSign:kc,clearAllSignedTransactions:Lc,clearSignedTransaction:Dc,clearTransactionToSign:Nc,setSignTransactionsError:Pc,setSignTransactionsCancelMessage:Cc,moveTransactionsToSignedState:Rc}=Tn.actions,Me=Tn.reducer});var yn,Rt,Ft,_t,wi,Ct,hn,Oc,Bc,Uc,Be,Ue=T(()=>{"use strict";o();yn=require("@reduxjs/toolkit");j();Rt="Transaction failed",Ft="Transaction successful",_t="Processing transaction",wi="Transaction submitted",Ct={},hn=(0,yn.createSlice)({name:"transactionsInfo",initialState:Ct,reducers:{setTransactionsDisplayInfo(t,e){let{sessionId:r,transactionsDisplayInfo:n}=e.payload;r!=null&&(t[r]={errorMessage:(n==null?void 0:n.errorMessage)||Rt,successMessage:(n==null?void 0:n.successMessage)||Ft,processingMessage:(n==null?void 0:n.processingMessage)||_t,submittedMessage:(n==null?void 0:n.submittedMessage)||wi,transactionDuration:n==null?void 0:n.transactionDuration})},clearTransactionsInfoForSessionId(t,e){e.payload!=null&&delete t[e.payload]},clearTransactionsInfo:()=>Ct},extraReducers:t=>{t.addCase(D,()=>Ct)}}),{clearTransactionsInfo:Oc,setTransactionsDisplayInfo:Bc,clearTransactionsInfoForSessionId:Uc}=hn.actions,Be=hn.reducer});var Sn,xn,wn,Wc,Gc,qc,jc,bn,Mt=T(()=>{"use strict";o();Sn=require("@reduxjs/toolkit");j();xn={},wn=(0,Sn.createSlice)({name:"modalsSlice",initialState:xn,reducers:{setTxSubmittedModal:(t,e)=>{t.txSubmittedModal=e.payload},setNotificationModal:(t,e)=>{t.notificationModal=e.payload},clearTxSubmittedModal:t=>{t.txSubmittedModal=void 0},clearNotificationModal:t=>{t.notificationModal=void 0}},extraReducers:t=>{t.addCase(D,()=>xn)}}),{setTxSubmittedModal:Wc,setNotificationModal:Gc,clearTxSubmittedModal:qc,clearNotificationModal:jc}=wn.actions,bn=wn.reducer});var An,In,vn,En,el,tl,rl,nl,ol,il,$e,Ve=T(()=>{"use strict";o();An=require("@reduxjs/toolkit"),In=require("redux-persist");dt();q();yt();j();vn={customToasts:[],transactionToasts:[],failTransactionToast:null},En=(0,An.createSlice)({name:"toastsSlice",initialState:vn,reducers:{addCustomToast:(t,e)=>{t.customToasts.push(A(x({},e.payload),{type:"custom",toastId:e.payload.toastId||`custom-toast-${t.customToasts.length+1}`}))},removeCustomToast:(t,e)=>{t.customToasts=t.customToasts.filter(r=>r.toastId!==e.payload)},addTransactionToast:(t,e)=>{t.transactionToasts.push({type:"transaction",startTimestamp:Ne(),toastId:e.payload||`custom-toast-${t.transactionToasts.length+1}`})},removeTransactionToast:(t,e)=>{t.transactionToasts=t.transactionToasts.filter(r=>r.toastId!==e.payload)},addFailTransactionToast:(t,e)=>{t.failTransactionToast=A(x({},e.payload),{toastId:Nr})},removeFailTransactionToast:t=>{t.failTransactionToast=null}},extraReducers:t=>{t.addCase(D,()=>vn),t.addCase(In.REHYDRATE,(e,r)=>{var i,p;let n=(p=(i=r.customToasts)==null?void 0:i.filter(l=>!("component"in l)))!=null?p:[];e.customToasts=n})}}),{addCustomToast:el,removeCustomToast:tl,addTransactionToast:rl,removeTransactionToast:nl,addFailTransactionToast:ol,removeFailTransactionToast:il}=En.actions,$e=En.reducer});var ie=T(()=>{"use strict";o();vt();Et();Dt();Oe();Ue();Mt();Ve()});var Vt=T(()=>{"use strict";o()});var Bn,On,Un,Gp,qp,jp,zp,Kp,Yp,$n,Vn=T(()=>{"use strict";o();Bn=require("@reduxjs/toolkit");j();On={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},Un=(0,Bn.createSlice)({name:"dappModalsSlice",initialState:On,reducers:{setDappModalVisibility:(t,e)=>{t.visible=e.payload},setDappModalHeaderVisibility:(t,e)=>{t.modal.showHeader=e.payload},setDappModalFooterVisibility:(t,e)=>{t.modal.showFooter=e.payload},setDappModalHeaderText:(t,e)=>{t.modal.headerText=e.payload},setDappModalFooterText:(t,e)=>{t.modal.footerText=e.payload},setDappModalConfig:(t,e)=>{t.modal=x({},e.payload)}},extraReducers:t=>{t.addCase(D,()=>On)}}),{setDappModalVisibility:Gp,setDappModalHeaderVisibility:qp,setDappModalFooterVisibility:jp,setDappModalHeaderText:zp,setDappModalFooterText:Kp,setDappModalConfig:Yp}=Un.actions,$n=Un.reducer});var Hn,Ci,Ri,ce,Ge=T(()=>{"use strict";o();Hn=require("@reduxjs/toolkit");Vt();Dt();Vn();vt();Mt();Et();Ve();Ue();Oe();Ci={["account"]:un,["networkConfig"]:on,["loginInfo"]:Yr,["modals"]:bn,["dappModal"]:$n,["toasts"]:$e,["transactions"]:Me,["transactionsInfo"]:Be},Ri=(t={})=>(0,Hn.combineReducers)(x(x({},Ci),t)),ce=Ri});var qn={};K(qn,{default:()=>$i});function Ht(t,e=[]){return{key:t,version:1,storage:Gn.default,blacklist:e}}var Q,Wn,Gn,Fi,_i,Mi,Oi,Bi,Ui,$i,jn=T(()=>{"use strict";o();Q=require("redux-persist"),Wn=b(require("redux-persist/lib/storage")),Gn=b(require("redux-persist/lib/storage/session"));Ge();ie();Ve();Ue();Oe();Vt();Fi={2:t=>A(x({},t),{networkConfig:It})};_i=Ht("dapp-core-transactionsInfo"),Mi=Ht("dapp-core-transactions",["transactionsToSign"]),Oi=Ht("dapp-core-toasts"),Bi={key:"dapp-core-store",version:2,storage:Wn.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,Q.createMigrate)(Fi,{debug:!1})},Ui={["toasts"]:(0,Q.persistReducer)(Oi,$e),["transactions"]:(0,Q.persistReducer)(Mi,Me),["transactionsInfo"]:(0,Q.persistReducer)(_i,Be)},$i=(0,Q.persistReducer)(Bi,ce(Ui))});var zn={};K(zn,{default:()=>Vi});var Vi,Kn=T(()=>{"use strict";o();Ge();Vi=ce()});var Yn={};K(Yn,{default:()=>Wi});var R,Hi,Wi,Zn=T(()=>{"use strict";o();R=require("redux-persist"),Hi=[R.FLUSH,R.REHYDRATE,R.PAUSE,R.PERSIST,R.PURGE,R.REGISTER],Wi=Hi});var Qn={};K(Qn,{default:()=>Jn});function Jn(t){return(0,Xn.persistStore)(t)}var Xn,eo=T(()=>{"use strict";o();Xn=require("redux-persist")});var xa={};K(xa,{getAddress:()=>ha});module.exports=ue(xa);o();o();o();o();var Rr=require("@elrondnetwork/erdjs-extension-provider"),Fr=require("@elrondnetwork/erdjs-hw-provider"),De=require("@elrondnetwork/erdjs-wallet-connect-provider"),_r=require("@elrondnetwork/erdjs-web-wallet-provider");w();N();var Mr=t=>{switch(t==null?void 0:t.constructor){case _r.WalletProvider:return"wallet";case De.WalletConnectProvider:return"walletconnect";case De.WalletConnectV2Provider:return"walletconnectv2";case Fr.HWProvider:return"ledger";case Rr.ExtensionProvider:return"extension";case Le:return"";default:return"extra"}};var H=t=>`Unable to perform ${t}, Provider not initialized`,Le=class{init(){return Promise.resolve(!1)}login(e){throw new Error(H(`login with options: ${e}`))}logout(e){throw new Error(H(`logout with options: ${e}`))}getAddress(){throw new Error(H("getAddress"))}isInitialized(){return!1}isConnected(){return Promise.resolve(!1)}sendTransaction(e,r){throw new Error(H(`sendTransaction with transactions: ${e} options: ${r}`))}signTransaction(e,r){throw new Error(H(`signTransaction with transactions: ${e} options: ${r}`))}signTransactions(e,r){throw new Error(H(`signTransactions with transactions: ${e} options: ${r}`))}signMessage(e,r){throw new Error(H(`signTransactions with ${e} and options ${r}`))}sendCustomMessage({method:e,params:r}){throw new Error(H(`sendCustomMessage with method: ${e} params: ${r}`))}sendCustomRequest(e){throw new Error(H(`sendSessionEvent with options: ${e}`))}ping(){return Promise.resolve(!1)}},Tt=new Le;var Qo=Tt;function de(){return Qo||Tt}o();o();ie();o();var kn=b(require("lodash.isequal")),He=require("reselect"),f=(0,He.createSelectorCreator)(He.defaultMemoize,kn.default);var W=t=>t.account,ye=f(W,t=>t.address),Ot=f(W,ye,(t,e)=>e in t.accounts?t.accounts[e]:Re),hl=f(W,Ot,(t,e)=>{let i=t,{accounts:r}=i,n=Yt(i,["accounts"]);return A(x({},n),{account:e})}),xl=f(Ot,t=>t.balance),Sl=f(Ot,t=>{var e;return((e=t==null?void 0:t.nonce)==null?void 0:e.valueOf())||0}),wl=f(W,t=>t.shard),bl=f(W,t=>t.ledgerAccount),vl=f(W,t=>t.walletConnectAccount),Al=f(W,t=>t.isAccountLoading),Il=f(W,t=>t.accountLoadingError),El=f(W,t=>t.websocketEvent);o();var ae=t=>t.networkConfig,Dl=f(ae,t=>t.chainID),Nl=f(ae,t=>t.network.walletConnectBridgeAddress),Pl=f(ae,t=>t.network.walletConnectV2RelayAddress),Cl=f(ae,t=>t.network.walletConnectV2ProjectId),Rl=f(ae,t=>t.network.walletConnectDeepLink),Bt=f(ae,t=>t.network),Fl=f(Bt,t=>t.apiAddress),Ln=f(Bt,t=>t.explorerAddress),_l=f(Bt,t=>t.egldLabel);o();N();var se=t=>t.loginInfo,$l=f(se,t=>t.loginMethod),Dn=f(se,ye,(t,e)=>t.loginMethod!=""&&Boolean(e)),Vl=f(se,t=>t.walletConnectLogin),Hl=f(se,t=>t.ledgerLogin),Nn=f(se,t=>t.walletLogin),Wl=f(se,t=>t.isLoginSessionInvalid);o();o();var P=require("@elrondnetwork/erdjs");w();o();function Ut(t){try{return a.Buffer.from(t,"base64").toString()===atob(t)}catch(e){return!1}}function $t(t){var i,p,l;let{data:e}=t,r=Ut(e!=null?e:"")?P.TransactionPayload.fromEncoded(e):new P.TransactionPayload(e),n=new P.Transaction(x({value:t.value.valueOf(),data:r,nonce:t.nonce.valueOf(),receiver:new P.Address(t.receiver),sender:new P.Address(t.sender),gasLimit:(i=t.gasLimit.valueOf())!=null?i:mt,gasPrice:(p=t.gasPrice.valueOf())!=null?p:gt,chainID:t.chainID.valueOf(),version:new P.TransactionVersion((l=t.version)!=null?l:Pr)},t.options?{options:new P.TransactionOptions(t.options)}:{}));return n.applySignature({hex:()=>t.signature||""},new P.Address(t.sender)),n}o();Pt();o();var vi=b(require("bignumber.js"));q();o();o();o();o();var Ii=require("@elrondnetwork/erdjs"),Ei=b(require("bignumber.js"));N();o();var Rn=require("@elrondnetwork/erdjs");function Ai(t){try{let e=new Rn.Address(t);return Boolean(e.bech32())}catch(e){return!1}}function he(t){return(t==null?void 0:t.startsWith("erd"))&&t.length===62&&/^\w+$/.test(t)&&Ai(t)}o();o();o();var Li=require("@elrondnetwork/erdjs/out");o();w();o();var Fn=require("@elrondnetwork/erdjs");q();o();o();o();o();N();o();o();var Wt=require("@reduxjs/toolkit"),oo=require("react-redux/es/utils/Subscription");ie();o();var _n=b(require("lodash.throttle"));w();ie();wt();Pe();me();var Di=[ke],Ni=(0,_n.default)(()=>{fe(ge())},5e3),Mn=t=>e=>r=>{var d;if(Di.includes(r.type))return e(r);let n=t.getState(),i=oe.local.getItem(J.loginExpiresAt);if(!((d=n==null?void 0:n.loginInfo)==null?void 0:d.isLoggedIn))return e(r);if(i==null)return fe(ge());let l=Date.now();return i-l<0?setTimeout(()=>Je(void 0,null,function*(){console.log("session expired");try{t.dispatch(Kr())}catch(g){console.error("error logging out",g)}}),1e3):(Ni(),e(r))};o();o();function We(){return typeof sessionStorage!="undefined"}var to=We()?(jn(),ue(qn)).default:(Kn(),ue(zn)).default,ro=We()?(Zn(),ue(Yn)).default:[],no=We()?(eo(),ue(Qn)).default:t=>t;Ge();var le=(0,Wt.configureStore)({reducer:to,middleware:t=>t({serializableCheck:{ignoredActions:[...ro,pn.type,ln.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(Mn)}),Su=(0,oo.createSubscription)(le),wu=no(le),bu=(0,Wt.configureStore)({reducer:ce});o();o();o();o();o();o();o();o();o();o();k();o();o()