@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
8 lines • 50.1 kB
JavaScript
"use strict";var Gn=Object.create;var ae=Object.defineProperty,qn=Object.defineProperties,Vn=Object.getOwnPropertyDescriptor,zn=Object.getOwnPropertyDescriptors,Hn=Object.getOwnPropertyNames,de=Object.getOwnPropertySymbols,jn=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable;var bt=(t,e,r)=>e in t?ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S=(t,e)=>{for(var r in e||(e={}))Be.call(e,r)&&bt(t,r,e[r]);if(de)for(var r of de(e))vt.call(e,r)&&bt(t,r,e[r]);return t},E=(t,e)=>qn(t,zn(e));var It=(t,e)=>{var r={};for(var n in t)Be.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&de)for(var n of de(t))e.indexOf(n)<0&&vt.call(t,n)&&(r[n]=t[n]);return r};var h=(t,e)=>()=>(t&&(e=t(t=0)),e);var ge=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),j=(t,e)=>{for(var r in e)ae(t,r,{get:e[r],enumerable:!0})},At=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Hn(e))!Be.call(t,o)&&o!==r&&ae(t,o,{get:()=>e[o],enumerable:!(n=Vn(e,o))||n.enumerable});return t};var L=(t,e,r)=>(r=t!=null?Gn(jn(t)):{},At(e||!t||!t.__esModule?ae(r,"default",{value:t,enumerable:!0}):r,t)),ie=t=>At(ae({},"__esModule",{value:!0}),t);var me=(t,e,r)=>new Promise((n,o)=>{var a=l=>{try{d(r.next(l))}catch(m){o(m)}},i=l=>{try{d(r.throw(l))}catch(m){o(m)}},d=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,i);d((r=r.apply(t,e)).next())});var Lt=ge(fe=>{"use strict";s();fe.byteLength=Kn;fe.toByteArray=Yn;fe.fromByteArray=Jn;var P=[],C=[],Wn=typeof Uint8Array!="undefined"?Uint8Array:Array,Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(W=0,kt=Ue.length;W<kt;++W)P[W]=Ue[W],C[Ue.charCodeAt(W)]=W;var W,kt;C["-".charCodeAt(0)]=62;C["_".charCodeAt(0)]=63;function Et(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 Kn(t){var e=Et(t),r=e[0],n=e[1];return(r+n)*3/4-n}function $n(t,e,r){return(e+r)*3/4-r}function Yn(t){var e,r=Et(t),n=r[0],o=r[1],a=new Wn($n(t,n,o)),i=0,d=o>0?n-4:n,l;for(l=0;l<d;l+=4)e=C[t.charCodeAt(l)]<<18|C[t.charCodeAt(l+1)]<<12|C[t.charCodeAt(l+2)]<<6|C[t.charCodeAt(l+3)],a[i++]=e>>16&255,a[i++]=e>>8&255,a[i++]=e&255;return o===2&&(e=C[t.charCodeAt(l)]<<2|C[t.charCodeAt(l+1)]>>4,a[i++]=e&255),o===1&&(e=C[t.charCodeAt(l)]<<10|C[t.charCodeAt(l+1)]<<4|C[t.charCodeAt(l+2)]>>2,a[i++]=e>>8&255,a[i++]=e&255),a}function Zn(t){return P[t>>18&63]+P[t>>12&63]+P[t>>6&63]+P[t&63]}function Xn(t,e,r){for(var n,o=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),o.push(Zn(n));return o.join("")}function Jn(t){for(var e,r=t.length,n=r%3,o=[],a=16383,i=0,d=r-n;i<d;i+=a)o.push(Xn(t,i,i+a>d?d:i+a));return n===1?(e=t[r-1],o.push(P[e>>2]+P[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(P[e>>10]+P[e>>4&63]+P[e<<2&63]+"=")),o.join("")}});var Ct=ge(Oe=>{s();Oe.read=function(t,e,r,n,o){var a,i,d=o*8-n-1,l=(1<<d)-1,m=l>>1,y=-7,f=r?o-1:0,x=r?-1:1,b=t[e+f];for(f+=x,a=b&(1<<-y)-1,b>>=-y,y+=d;y>0;a=a*256+t[e+f],f+=x,y-=8);for(i=a&(1<<-y)-1,a>>=-y,y+=n;y>0;i=i*256+t[e+f],f+=x,y-=8);if(a===0)a=1-m;else{if(a===l)return i?NaN:(b?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-m}return(b?-1:1)*i*Math.pow(2,a-n)};Oe.write=function(t,e,r,n,o,a){var i,d,l,m=a*8-o-1,y=(1<<m)-1,f=y>>1,x=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:a-1,_=n?1:-1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(d=isNaN(e)?1:0,i=y):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+f>=1?e+=x/l:e+=x*Math.pow(2,1-f),e*l>=2&&(i++,l/=2),i+f>=y?(d=0,i=y):i+f>=1?(d=(e*l-1)*Math.pow(2,o),i=i+f):(d=e*Math.pow(2,f-1)*Math.pow(2,o),i=0));o>=8;t[r+b]=d&255,b+=_,d/=256,o-=8);for(i=i<<o|d,m+=o;m>0;t[r+b]=i&255,b+=_,i/=256,m-=8);t[r+b-_]|=F*128}});var Vt=ge(Q=>{"use strict";s();var Ge=Lt(),J=Ct(),Rt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Q.Buffer=c;Q.SlowBuffer=oo;Q.INSPECT_MAX_BYTES=50;var ye=2147483647;Q.kMaxLength=ye;c.TYPED_ARRAY_SUPPORT=Qn();!c.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 Qn(){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(c.prototype,"parent",{enumerable:!0,get:function(){if(!!c.isBuffer(this))return this.buffer}});Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(!!c.isBuffer(this))return this.byteOffset}});function B(t){if(t>ye)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(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 He(t)}return Pt(t,e,r)}c.poolSize=8192;function Pt(t,e,r){if(typeof t=="string")return to(t,e);if(ArrayBuffer.isView(t))return ro(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(M(t,ArrayBuffer)||t&&M(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(M(t,SharedArrayBuffer)||t&&M(t.buffer,SharedArrayBuffer)))return Ve(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 c.from(n,e,r);var o=no(t);if(o)return o;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return c.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)}c.from=function(t,e,r){return Pt(t,e,r)};Object.setPrototypeOf(c.prototype,Uint8Array.prototype);Object.setPrototypeOf(c,Uint8Array);function Mt(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 eo(t,e,r){return Mt(t),t<=0?B(t):e!==void 0?typeof r=="string"?B(t).fill(e,r):B(t).fill(e):B(t)}c.alloc=function(t,e,r){return eo(t,e,r)};function He(t){return Mt(t),B(t<0?0:je(t)|0)}c.allocUnsafe=function(t){return He(t)};c.allocUnsafeSlow=function(t){return He(t)};function to(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=Dt(t,e)|0,n=B(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function qe(t){for(var e=t.length<0?0:je(t.length)|0,r=B(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function ro(t){if(M(t,Uint8Array)){var e=new Uint8Array(t);return Ve(e.buffer,e.byteOffset,e.byteLength)}return qe(t)}function Ve(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,c.prototype),n}function no(t){if(c.isBuffer(t)){var e=je(t.length)|0,r=B(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||We(t.length)?B(0):qe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return qe(t.data)}function je(t){if(t>=ye)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ye.toString(16)+" bytes");return t|0}function oo(t){return+t!=t&&(t=0),c.alloc(+t)}c.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==c.prototype};c.compare=function(e,r){if(M(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),M(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(e)||!c.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,o=r.length,a=0,i=Math.min(n,o);a<i;++a)if(e[a]!==r[a]){n=e[a],o=r[a];break}return n<o?-1:o<n?1:0};c.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}};c.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return c.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var o=c.allocUnsafe(r),a=0;for(n=0;n<e.length;++n){var i=e[n];if(M(i,Uint8Array))a+i.length>o.length?c.from(i).copy(o,a):Uint8Array.prototype.set.call(o,i,a);else if(c.isBuffer(i))i.copy(o,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=i.length}return o};function Dt(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||M(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 o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ze(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return qt(t).length;default:if(o)return n?-1:ze(t).length;e=(""+e).toLowerCase(),o=!0}}c.byteLength=Dt;function ao(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 yo(this,e,r);case"utf8":case"utf-8":return Bt(this,e,r);case"ascii":return mo(this,e,r);case"latin1":case"binary":return fo(this,e,r);case"base64":return po(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ho(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function K(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}c.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)K(this,r,r+1);return this};c.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)K(this,r,r+3),K(this,r+1,r+2);return this};c.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)K(this,r,r+7),K(this,r+1,r+6),K(this,r+2,r+5),K(this,r+3,r+4);return this};c.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?Bt(this,0,e):ao.apply(this,arguments)};c.prototype.toLocaleString=c.prototype.toString;c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:c.compare(this,e)===0};c.prototype.inspect=function(){var e="",r=Q.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Rt&&(c.prototype[Rt]=c.prototype.inspect);c.prototype.compare=function(e,r,n,o,a){if(M(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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),o===void 0&&(o=0),a===void 0&&(a=this.length),r<0||n>e.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&r>=n)return 0;if(o>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,a>>>=0,this===e)return 0;for(var i=a-o,d=n-r,l=Math.min(i,d),m=this.slice(o,a),y=e.slice(r,n),f=0;f<l;++f)if(m[f]!==y[f]){i=m[f],d=y[f];break}return i<d?-1:d<i?1:0};function Nt(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,We(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=c.from(e,n)),c.isBuffer(e))return e.length===0?-1:Ft(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ft(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Ft(t,e,r,n,o){var a=1,i=t.length,d=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;a=2,i/=2,d/=2,r/=2}function l(b,_){return a===1?b[_]:b.readUInt16BE(_*a)}var m;if(o){var y=-1;for(m=r;m<i;m++)if(l(t,m)===l(e,y===-1?0:m-y)){if(y===-1&&(y=m),m-y+1===d)return y*a}else y!==-1&&(m-=m-y),y=-1}else for(r+d>i&&(r=i-d),m=r;m>=0;m--){for(var f=!0,x=0;x<d;x++)if(l(t,m+x)!==l(e,x)){f=!1;break}if(f)return m}return-1}c.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};c.prototype.indexOf=function(e,r,n){return Nt(this,e,r,n,!0)};c.prototype.lastIndexOf=function(e,r,n){return Nt(this,e,r,n,!1)};function io(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var a=e.length;n>a/2&&(n=a/2);for(var i=0;i<n;++i){var d=parseInt(e.substr(i*2,2),16);if(We(d))return i;t[r+i]=d}return i}function so(t,e,r,n){return he(ze(e,t.length-r),t,r,n)}function co(t,e,r,n){return he(wo(e),t,r,n)}function lo(t,e,r,n){return he(qt(e),t,r,n)}function uo(t,e,r,n){return he(So(e,t.length-r),t,r,n)}c.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-r;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return io(this,e,r,n);case"utf8":case"utf-8":return so(this,e,r,n);case"ascii":case"latin1":case"binary":return co(this,e,r,n);case"base64":return lo(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return uo(this,e,r,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function po(t,e,r){return e===0&&r===t.length?Ge.fromByteArray(t):Ge.fromByteArray(t.slice(e,r))}function Bt(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var a=t[o],i=null,d=a>239?4:a>223?3:a>191?2:1;if(o+d<=r){var l,m,y,f;switch(d){case 1:a<128&&(i=a);break;case 2:l=t[o+1],(l&192)===128&&(f=(a&31)<<6|l&63,f>127&&(i=f));break;case 3:l=t[o+1],m=t[o+2],(l&192)===128&&(m&192)===128&&(f=(a&15)<<12|(l&63)<<6|m&63,f>2047&&(f<55296||f>57343)&&(i=f));break;case 4:l=t[o+1],m=t[o+2],y=t[o+3],(l&192)===128&&(m&192)===128&&(y&192)===128&&(f=(a&15)<<18|(l&63)<<12|(m&63)<<6|y&63,f>65535&&f<1114112&&(i=f))}}i===null?(i=65533,d=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=d}return go(n)}var _t=4096;function go(t){var e=t.length;if(e<=_t)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=_t));return r}function mo(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function fo(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function yo(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",a=e;a<r;++a)o+=bo[t[a]];return o}function ho(t,e,r){for(var n=t.slice(e,r),o="",a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}c.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 o=this.subarray(e,r);return Object.setPrototypeOf(o,c.prototype),o};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")}c.prototype.readUintLE=c.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var o=this[e],a=1,i=0;++i<r&&(a*=256);)o+=this[e+i]*a;return o};c.prototype.readUintBE=c.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var o=this[e+--r],a=1;r>0&&(a*=256);)o+=this[e+--r]*a;return o};c.prototype.readUint8=c.prototype.readUInt8=function(e,r){return e=e>>>0,r||v(e,1,this.length),this[e]};c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||v(e,2,this.length),this[e]|this[e+1]<<8};c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||v(e,2,this.length),this[e]<<8|this[e+1]};c.prototype.readUint32LE=c.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};c.prototype.readUint32BE=c.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])};c.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var o=this[e],a=1,i=0;++i<r&&(a*=256);)o+=this[e+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*r)),o};c.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||v(e,r,this.length);for(var o=r,a=1,i=this[e+--o];o>0&&(a*=256);)i+=this[e+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*r)),i};c.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]};c.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};c.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};c.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};c.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]};c.prototype.readFloatLE=function(e,r){return e=e>>>0,r||v(e,4,this.length),J.read(this,e,!0,23,4)};c.prototype.readFloatBE=function(e,r){return e=e>>>0,r||v(e,4,this.length),J.read(this,e,!1,23,4)};c.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||v(e,8,this.length),J.read(this,e,!0,52,8)};c.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||v(e,8,this.length),J.read(this,e,!1,52,8)};function I(t,e,r,n,o,a){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<a)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var a=Math.pow(2,8*n)-1;I(this,e,r,n,a,0)}var i=1,d=0;for(this[r]=e&255;++d<n&&(i*=256);)this[r+d]=e/i&255;return r+n};c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var a=Math.pow(2,8*n)-1;I(this,e,r,n,a,0)}var i=n-1,d=1;for(this[r+i]=e&255;--i>=0&&(d*=256);)this[r+i]=e/d&255;return r+n};c.prototype.writeUint8=c.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||I(this,e,r,1,255,0),this[r]=e&255,r+1};c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||I(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||I(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||I(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};c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||I(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};c.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){var a=Math.pow(2,8*n-1);I(this,e,r,n,a-1,-a)}var i=0,d=1,l=0;for(this[r]=e&255;++i<n&&(d*=256);)e<0&&l===0&&this[r+i-1]!==0&&(l=1),this[r+i]=(e/d>>0)-l&255;return r+n};c.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){var a=Math.pow(2,8*n-1);I(this,e,r,n,a-1,-a)}var i=n-1,d=1,l=0;for(this[r+i]=e&255;--i>=0&&(d*=256);)e<0&&l===0&&this[r+i+1]!==0&&(l=1),this[r+i]=(e/d>>0)-l&255;return r+n};c.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||I(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};c.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||I(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};c.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||I(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};c.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||I(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};c.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||I(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 Ut(t,e,r,n,o,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Ot(t,e,r,n,o){return e=+e,r=r>>>0,o||Ut(t,e,r,4,34028234663852886e22,-34028234663852886e22),J.write(t,e,r,n,23,4),r+4}c.prototype.writeFloatLE=function(e,r,n){return Ot(this,e,r,!0,n)};c.prototype.writeFloatBE=function(e,r,n){return Ot(this,e,r,!1,n)};function Gt(t,e,r,n,o){return e=+e,r=r>>>0,o||Ut(t,e,r,8,17976931348623157e292,-17976931348623157e292),J.write(t,e,r,n,52,8),r+8}c.prototype.writeDoubleLE=function(e,r,n){return Gt(this,e,r,!0,n)};c.prototype.writeDoubleBE=function(e,r,n){return Gt(this,e,r,!1,n)};c.prototype.copy=function(e,r,n,o){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);var a=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),a};c.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!c.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){var a=e.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(e=a)}}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 i;if(typeof e=="number")for(i=r;i<n;++i)this[i]=e;else{var d=c.isBuffer(e)?e:c.from(e,o),l=d.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=d[i%l]}return this};var To=/[^+/0-9A-Za-z-_]/g;function xo(t){if(t=t.split("=")[0],t=t.trim().replace(To,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ze(t,e){e=e||1/0;for(var r,n=t.length,o=null,a=[],i=0;i<n;++i){if(r=t.charCodeAt(i),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(e-=3)>-1&&a.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&a.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function wo(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function So(t,e){for(var r,n,o,a=[],i=0;i<t.length&&!((e-=2)<0);++i)r=t.charCodeAt(i),n=r>>8,o=r%256,a.push(o),a.push(n);return a}function qt(t){return Ge.toByteArray(xo(t))}function he(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function M(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function We(t){return t!==t}var bo=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()});var Kt=ge((fa,Wt)=>{s();var w=Wt.exports={},D,N;function Ke(){throw new Error("setTimeout has not been defined")}function $e(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?D=setTimeout:D=Ke}catch(t){D=Ke}try{typeof clearTimeout=="function"?N=clearTimeout:N=$e}catch(t){N=$e}})();function zt(t){if(D===setTimeout)return setTimeout(t,0);if((D===Ke||!D)&&setTimeout)return D=setTimeout,setTimeout(t,0);try{return D(t,0)}catch(e){try{return D.call(null,t,0)}catch(r){return D.call(this,t,0)}}}function vo(t){if(N===clearTimeout)return clearTimeout(t);if((N===$e||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(t);try{return N(t)}catch(e){try{return N.call(null,t)}catch(r){return N.call(this,t)}}}var U=[],ee=!1,$,Te=-1;function Io(){!ee||!$||(ee=!1,$.length?U=$.concat(U):Te=-1,U.length&&Ht())}function Ht(){if(!ee){var t=zt(Io);ee=!0;for(var e=U.length;e;){for($=U,U=[];++Te<e;)$&&$[Te].run();Te=-1,e=U.length}$=null,ee=!1,vo(t)}}w.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];U.push(new jt(t,e)),U.length===1&&!ee&&zt(Ht)};function jt(t,e){this.fun=t,this.array=e}jt.prototype.run=function(){this.fun.apply(null,this.array)};w.title="browser";w.browser=!0;w.env={};w.argv=[];w.version="";w.versions={};function O(){}w.on=O;w.addListener=O;w.once=O;w.off=O;w.removeListener=O;w.removeAllListeners=O;w.emit=O;w.prependListener=O;w.prependOnceListener=O;w.listeners=function(t){return[]};w.binding=function(t){throw new Error("process.binding is not supported")};w.cwd=function(){return"/"};w.chdir=function(t){throw new Error("process.chdir is not supported")};w.umask=function(){return 0}});var u,p,ya,s=h(()=>{u=L(Vt()),p=L(Kt()),ya=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 $t=h(()=>{"use strict";s()});var Yt=h(()=>{"use strict";s()});var Zt=h(()=>{"use strict";s()});var se=h(()=>{"use strict";s()});var Xt=h(()=>{"use strict";s()});var Jt=h(()=>{"use strict";s()});var Qt=h(()=>{"use strict";s()});var er=h(()=>{"use strict";s()});var xe=h(()=>{"use strict";s();Yt();Zt();se();Xt();Jt();Qt();er()});var Ye,tr,_a,rr,Pa,nr,Ma,Da,Na,or=h(()=>{"use strict";s();xe();Ye={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:tr,egldLabel:_a}=Ye["devnet"],{chainId:rr,egldLabel:Pa}=Ye["testnet"],{chainId:nr,egldLabel:Ma}=Ye["mainnet"],Da={["devnet"]:tr,["testnet"]:rr,["mainnet"]:nr},Na={[tr]:"devnet",[rr]:"testnet",[nr]:"mainnet"}});var Ze=h(()=>{"use strict";s()});var ar=h(()=>{"use strict";s()});var ir,Xe=h(()=>{"use strict";s();ir="transaction-status-toast-id"});var sr,cr,we,lr,Se,ur,Y,k=h(()=>{"use strict";s();$t();or();Ze();ar();Xe();sr=.01,cr=1500,we=5e4,lr=1e9,Se="logout",ur="login",Y="0"});var be,Je=h(()=>{"use strict";s();be=()=>Date.now()/1e3});var pr=h(()=>{"use strict";s()});var dr=h(()=>{"use strict";s()});var gr=h(()=>{"use strict";s();Je();pr();dr()});var et={};j(et,{getItem:()=>ko,localStorageKeys:()=>Z,removeItem:()=>Eo,setItem:()=>Ao});var Z,Qe,Ao,ko,Eo,ce=h(()=>{"use strict";s();gr();Z={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},Qe=typeof localStorage!="undefined",Ao=({key:t,data:e,expires:r})=>{!Qe||localStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},ko=t=>{if(!Qe)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:be()>=r.expires?(localStorage.removeItem(String(t)),null):r.data},Eo=t=>{!Qe||localStorage.removeItem(String(t))}});var tt={};j(tt,{clear:()=>hr,getItem:()=>fr,removeItem:()=>yr,setItem:()=>mr,storage:()=>Lo});var mr,fr,yr,hr,Lo,Tr=h(()=>{"use strict";s();mr=({key:t,data:e,expires:r})=>{sessionStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},fr=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},yr=t=>sessionStorage.removeItem(String(t)),hr=()=>sessionStorage.clear(),Lo={setItem:mr,getItem:fr,removeItem:yr,clear:hr}});var te,ve=h(()=>{"use strict";s();ce();Tr();te={session:tt,local:et}});function le(){return new Date().setHours(new Date().getHours()+24)}function ue(t){te.local.setItem({key:Z.loginExpiresAt,data:t,expires:t})}var rt=h(()=>{"use strict";s();ve();ce()});var nt,A,Ie,z=h(()=>{"use strict";s();nt=require("@reduxjs/toolkit");k();A=(0,nt.createAction)(Se),Ie=(0,nt.createAction)(ur,t=>({payload:t}))});var wr,xr,Sr,gi,mi,fi,yi,hi,Ti,br,vr,ot=h(()=>{"use strict";s();wr=require("@reduxjs/toolkit");rt();se();z();xr={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},Sr=(0,wr.createSlice)({name:"loginInfoSlice",initialState:xr,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(A,()=>xr),t.addCase(Ie,(e,r)=>{e.loginMethod=r.payload.loginMethod,ue(le())})}}),{setLoginMethod:gi,setWalletConnectLogin:mi,setLedgerLogin:fi,setTokenLogin:yi,setTokenLoginSignature:hi,setWalletLogin:Ti,invalidateLoginSession:br}=Sr.actions,vr=Sr.reducer});var Ir=h(()=>{"use strict";s()});var Ar=h(()=>{"use strict";s();Ir()});function at(t){return t[Math.floor(Math.random()*t.length)]}var kr=h(()=>{"use strict";s()});var Er=h(()=>{"use strict";s();Ze()});var Lr=h(()=>{"use strict";s();Ar();kr();Er()});var Cr,Rr,it,Co,Fr,Mi,Di,_r,st=h(()=>{"use strict";s();Cr=require("@reduxjs/toolkit"),Rr=L(require("lodash.omit"));Lr();it={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},Co={network:it,chainID:"-1"},Fr=(0,Cr.createSlice)({name:"appConfig",initialState:Co,reducers:{initializeNetworkConfig:(t,e)=>{let r=at(e.payload.walletConnectBridgeAddresses),n=at(e.payload.walletConnectV2RelayAddresses),o=(0,Rr.default)(e.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");t.network=E(S(S({},t.network),o),{walletConnectBridgeAddress:r,walletConnectV2RelayAddress:n})},setChainID:(t,e)=>{t.chainID=e.payload}}}),{initializeNetworkConfig:Mi,setChainID:Di}=Fr.actions,_r=Fr.reducer});var lt,Pr,Mr,Ae,ct,Dr,Nr,zi,Br,Hi,ji,Wi,Ki,$i,Yi,Zi,Ur,ut=h(()=>{"use strict";s();lt=require("@elrondnetwork/erdjs"),Pr=require("@reduxjs/toolkit"),Mr=require("redux-persist");k();ve();ce();z();Ae={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:Y},ct={address:"",websocketEvent:null,accounts:{"":Ae},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},Dr=(0,Pr.createSlice)({name:"accountInfoSlice",initialState:ct,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:Ae},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(A,()=>(te.local.removeItem(Z.loginExpiresAt),ct)),t.addCase(Ie,(e,r)=>{let{address:n}=r.payload;e.address=n,e.publicKey=new lt.Address(n).hex()}),t.addCase(Mr.REHYDRATE,(e,r)=>{var m;if(!((m=r.payload)!=null&&m.account))return;let{account:n}=r.payload,{address:o,shard:a,accounts:i,publicKey:d}=n;e.address=o,e.shard=a;let l=i&&o in i;e.accounts=l?i:ct.accounts,e.publicKey=d})}}),{setAccount:Nr,setAddress:zi,setAccountNonce:Br,setAccountShard:Hi,setLedgerAccount:ji,updateLedgerAccount:Wi,setWalletConnectAccount:Ki,setIsAccountLoading:$i,setAccountLoadingError:Yi,setWebsocketEvent:Zi}=Dr.actions,Ur=Dr.reducer});function Or(t){return t!=null&&(Do(t)||Bo(t))}function Gr(t){return t!=null&&(No(t)||Uo(t))}function Do(t){return t!=null&&Fo.includes(t)}function No(t){return t!=null&&_o.includes(t)}function Bo(t){return t!=null&&Po.includes(t)}function Uo(t){return t!=null&&Mo.includes(t)}var es,Fo,_o,ts,rs,Po,Mo,qr=h(()=>{"use strict";s();se();es=["sent"],Fo=["success"],_o=["fail","cancelled","timedOut"],ts=["timedOut"],rs=["pending"],Po=["success"],Mo=["fail","invalid"]});var Vr,zr,pe,Oo,Hr,ls,us,jr,ps,ds,gs,ms,fs,Wr,ys,ke,Ee=h(()=>{"use strict";s();Vr=require("@reduxjs/toolkit"),zr=require("redux-persist");se();qr();z();pe={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},Oo={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Hr=(0,Vr.createSlice)({name:"transactionsSlice",initialState:pe,reducers:{moveTransactionsToSignedState:(t,e)=>{var l,m;let{sessionId:r,transactions:n,errorMessage:o,status:a,redirectRoute:i}=e.payload,d=((l=t.customTransactionInformationForSessionId)==null?void 0:l[r])||Oo;t.signedTransactions[r]={transactions:n,status:a,errorMessage:o,redirectRoute:i,customTransactionInformation:d},((m=t==null?void 0:t.transactionsToSign)==null?void 0:m.sessionId)===r&&(t.transactionsToSign=pe.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=S(S({},t.signedTransactions),e.payload)},updateSignedTransactions:(t,e)=>{let{sessionId:r,status:n,errorMessage:o,transactions:a}=e.payload;t.signedTransactions[r]!=null&&(t.signedTransactions[r].status=n,o!=null&&(t.signedTransactions[r].errorMessage=o),a!=null&&(t.signedTransactions[r].transactions=a))},updateSignedTransactionStatus:(t,e)=>{var d,l,m,y,f,x;let{sessionId:r,status:n,errorMessage:o,transactionHash:a}=e.payload,i=(l=(d=t.signedTransactions)==null?void 0:d[r])==null?void 0:l.transactions;if(i!=null){t.signedTransactions[r].transactions=i.map(F=>F.hash===a?E(S({},F),{status:n,errorMessage:o}):F);let b=(y=(m=t.signedTransactions[r])==null?void 0:m.transactions)==null?void 0:y.every(F=>Or(F.status)),_=(x=(f=t.signedTransactions[r])==null?void 0:f.transactions)==null?void 0:x.every(F=>Gr(F.status));b&&(t.signedTransactions[r].status="success"),_&&(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=pe.transactionsToSign,t.signTransactionsError=null},clearAllSignedTransactions:t=>{t.signedTransactions=pe.signedTransactions},setSignTransactionsError:(t,e)=>{t.signTransactionsError=e.payload},setSignTransactionsCancelMessage:(t,e)=>{t.signTransactionsCancelMessage=e.payload}},extraReducers:t=>{t.addCase(A,()=>pe),t.addCase(zr.REHYDRATE,(e,r)=>{var i;if(e.signTransactionsCancelMessage=null,!((i=r.payload)!=null&&i.transactions))return;let{signedTransactions:n,customTransactionInformationForSessionId:o}=r.payload.transactions,a=Object.entries(n).reduce((d,[l,m])=>{let y=new Date(l),f=new Date;return f.setHours(f.getHours()+5),f-y>0||(d[l]=m),d},{});o!=null&&(e.customTransactionInformationForSessionId=o),n!=null&&(e.signedTransactions=a)})}}),{updateSignedTransactionStatus:ls,updateSignedTransactions:us,setTransactionsToSign:jr,clearAllTransactionsToSign:ps,clearAllSignedTransactions:ds,clearSignedTransaction:gs,clearTransactionToSign:ms,setSignTransactionsError:fs,setSignTransactionsCancelMessage:Wr,moveTransactionsToSignedState:ys}=Hr.actions,ke=Hr.reducer});var Kr,Go,qo,Vo,zo,pt,$r,ws,Yr,Ss,Le,Ce=h(()=>{"use strict";s();Kr=require("@reduxjs/toolkit");z();Go="Transaction failed",qo="Transaction successful",Vo="Processing transaction",zo="Transaction submitted",pt={},$r=(0,Kr.createSlice)({name:"transactionsInfo",initialState:pt,reducers:{setTransactionsDisplayInfo(t,e){let{sessionId:r,transactionsDisplayInfo:n}=e.payload;r!=null&&(t[r]={errorMessage:(n==null?void 0:n.errorMessage)||Go,successMessage:(n==null?void 0:n.successMessage)||qo,processingMessage:(n==null?void 0:n.processingMessage)||Vo,submittedMessage:(n==null?void 0:n.submittedMessage)||zo,transactionDuration:n==null?void 0:n.transactionDuration})},clearTransactionsInfoForSessionId(t,e){e.payload!=null&&delete t[e.payload]},clearTransactionsInfo:()=>pt},extraReducers:t=>{t.addCase(A,()=>pt)}}),{clearTransactionsInfo:ws,setTransactionsDisplayInfo:Yr,clearTransactionsInfoForSessionId:Ss}=$r.actions,Le=$r.reducer});var Xr,Zr,Jr,As,dt,ks,Es,Qr,gt=h(()=>{"use strict";s();Xr=require("@reduxjs/toolkit");z();Zr={},Jr=(0,Xr.createSlice)({name:"modalsSlice",initialState:Zr,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(A,()=>Zr)}}),{setTxSubmittedModal:As,setNotificationModal:dt,clearTxSubmittedModal:ks,clearNotificationModal:Es}=Jr.actions,Qr=Jr.reducer});var tn,rn,en,nn,Ds,Ns,Bs,Us,Os,Gs,Re,Fe=h(()=>{"use strict";s();tn=require("@reduxjs/toolkit"),rn=require("redux-persist");Xe();xe();Je();z();en={customToasts:[],transactionToasts:[],failTransactionToast:null},nn=(0,tn.createSlice)({name:"toastsSlice",initialState:en,reducers:{addCustomToast:(t,e)=>{t.customToasts.push(E(S({},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:be(),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=E(S({},e.payload),{toastId:ir})},removeFailTransactionToast:t=>{t.failTransactionToast=null}},extraReducers:t=>{t.addCase(A,()=>en),t.addCase(rn.REHYDRATE,(e,r)=>{var o,a;let n=(a=(o=r.customToasts)==null?void 0:o.filter(i=>!("component"in i)))!=null?a:[];e.customToasts=n})}}),{addCustomToast:Ds,removeCustomToast:Ns,addTransactionToast:Bs,removeTransactionToast:Us,addFailTransactionToast:Os,removeFailTransactionToast:Gs}=nn.actions,Re=nn.reducer});var re=h(()=>{"use strict";s();ot();st();ut();Ee();Ce();gt();Fe()});var yt=h(()=>{"use strict";s()});var pn,un,dn,Ec,Lc,Cc,Rc,Fc,_c,gn,mn=h(()=>{"use strict";s();pn=require("@reduxjs/toolkit");z();un={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},dn=(0,pn.createSlice)({name:"dappModalsSlice",initialState:un,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=S({},e.payload)}},extraReducers:t=>{t.addCase(A,()=>un)}}),{setDappModalVisibility:Ec,setDappModalHeaderVisibility:Lc,setDappModalFooterVisibility:Cc,setDappModalHeaderText:Rc,setDappModalFooterText:Fc,setDappModalConfig:_c}=dn.actions,gn=dn.reducer});var fn,$o,Yo,oe,Me=h(()=>{"use strict";s();fn=require("@reduxjs/toolkit");yt();ut();mn();ot();gt();st();Fe();Ce();Ee();$o={["account"]:Ur,["networkConfig"]:_r,["loginInfo"]:vr,["modals"]:Qr,["dappModal"]:gn,["toasts"]:Re,["transactions"]:ke,["transactionsInfo"]:Le},Yo=(t={})=>(0,fn.combineReducers)(S(S({},$o),t)),oe=Yo});var Tn={};j(Tn,{default:()=>ra});function ht(t,e=[]){return{key:t,version:1,storage:hn.default,blacklist:e}}var X,yn,hn,Zo,Xo,Jo,Qo,ea,ta,ra,xn=h(()=>{"use strict";s();X=require("redux-persist"),yn=L(require("redux-persist/lib/storage")),hn=L(require("redux-persist/lib/storage/session"));Me();re();Fe();Ce();Ee();yt();Zo={2:t=>E(S({},t),{networkConfig:it})};Xo=ht("dapp-core-transactionsInfo"),Jo=ht("dapp-core-transactions",["transactionsToSign"]),Qo=ht("dapp-core-toasts"),ea={key:"dapp-core-store",version:2,storage:yn.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,X.createMigrate)(Zo,{debug:!1})},ta={["toasts"]:(0,X.persistReducer)(Qo,Re),["transactions"]:(0,X.persistReducer)(Jo,ke),["transactionsInfo"]:(0,X.persistReducer)(Xo,Le)},ra=(0,X.persistReducer)(ea,oe(ta))});var wn={};j(wn,{default:()=>na});var na,Sn=h(()=>{"use strict";s();Me();na=oe()});var bn={};j(bn,{default:()=>aa});var R,oa,aa,vn=h(()=>{"use strict";s();R=require("redux-persist"),oa=[R.FLUSH,R.REHYDRATE,R.PAUSE,R.PERSIST,R.PURGE,R.REGISTER],aa=oa});var kn={};j(kn,{default:()=>An});function An(t){return(0,In.persistStore)(t)}var In,En=h(()=>{"use strict";s();In=require("redux-persist")});var ua={};j(ua,{signTransactions:()=>la});module.exports=ie(ua);s();var On=L(require("bignumber.js"));k();s();re();s();var on=L(require("lodash.isequal")),_e=require("reselect"),T=(0,_e.createSelectorCreator)(_e.defaultMemoize,on.default);var G=t=>t.account,Ho=T(G,t=>t.address),mt=T(G,Ho,(t,e)=>e in t.accounts?t.accounts[e]:Ae),Qs=T(G,mt,(t,e)=>{let o=t,{accounts:r}=o,n=It(o,["accounts"]);return E(S({},n),{account:e})}),an=T(mt,t=>t.balance),ec=T(mt,t=>{var e;return((e=t==null?void 0:t.nonce)==null?void 0:e.valueOf())||0}),tc=T(G,t=>t.shard),rc=T(G,t=>t.ledgerAccount),nc=T(G,t=>t.walletConnectAccount),oc=T(G,t=>t.isAccountLoading),ac=T(G,t=>t.accountLoadingError),ic=T(G,t=>t.websocketEvent);s();var ne=t=>t.networkConfig,sn=T(ne,t=>t.chainID),lc=T(ne,t=>t.network.walletConnectBridgeAddress),uc=T(ne,t=>t.network.walletConnectV2RelayAddress),pc=T(ne,t=>t.network.walletConnectV2ProjectId),dc=T(ne,t=>t.network.walletConnectDeepLink),ft=T(ne,t=>t.network),gc=T(ft,t=>t.apiAddress),mc=T(ft,t=>t.explorerAddress),fc=T(ft,t=>t.egldLabel);re();s();var Tt=require("@reduxjs/toolkit"),Fn=require("react-redux/es/utils/Subscription");re();s();var cn=L(require("lodash.throttle"));k();re();rt();ve();ce();var jo=[Se],Wo=(0,cn.default)(()=>{ue(le())},5e3),ln=t=>e=>r=>{var l;if(jo.includes(r.type))return e(r);let n=t.getState(),o=te.local.getItem(Z.loginExpiresAt);if(!((l=n==null?void 0:n.loginInfo)==null?void 0:l.isLoggedIn))return e(r);if(o==null)return ue(le());let i=Date.now();return o-i<0?setTimeout(()=>me(void 0,null,function*(){console.log("session expired");try{t.dispatch(br())}catch(m){console.error("error logging out",m)}}),1e3):(Wo(),e(r))};s();s();function Pe(){return typeof sessionStorage!="undefined"}var Ln=Pe()?(xn(),ie(Tn)).default:(Sn(),ie(wn)).default,Cn=Pe()?(vn(),ie(bn)).default:[],Rn=Pe()?(En(),ie(kn)).default:t=>t;Me();var q=(0,Tt.configureStore)({reducer:Ln,middleware:t=>t({serializableCheck:{ignoredActions:[...Cn,Br.type,Nr.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(ln)}),nl=(0,Fn.createSubscription)(q),ol=Rn(q),al=(0,Tt.configureStore)({reducer:oe});xe();s();var _n=L(require("bignumber.js"));k();var De=t=>{if(isNaN(t)||String(t).includes("Infinity"))return!1;let[e,r]=t.split(".");if(r)for(;r.charAt(r.length-1)===Y;)r=r.slice(0,-1);let n=r?[e,r].join("."):e,o=new _n.default(n);return o.toString(10)===n&&o.comparedTo(0)>=0};s();var St=L(require("bignumber.js"));k();s();s();k();s();var sa=require("@elrondnetwork/erdjs"),wt=L(require("bignumber.js"));k();s();var Pn=L(require("bignumber.js")),xt=(t,e=!0)=>{let r=String(t);if(!r.match(/^[-]?\d+$/))return!1;let n=new Pn.default(r),o=e?0:-1;return n.toString(10)===r&&n.comparedTo(0)>=o};s();wt.default.config({ROUNDING_MODE:wt.default.ROUND_FLOOR});s();k();s();var ca=require("@elrondnetwork/erdjs");k();s();var V=require("@elrondnetwork/erdjs"),Dn=require("@elrondnetwork/erdjs"),Nn=require("@elrondnetwork/erdjs-network-providers");k();s();s();k();s();var Mn={from:"erd12dnfhej64s6c56ka369gkyj3hwv5ms0y5rxgsk2k7hkd2vuk7rvqxkalsa",to:"erd12dnfhej64s6c56ka369gkyj3hwv5ms0y5rxgsk2k7hkd2vuk7rvqxkalsa"};function Bn({minGasLimit:t=String(we),gasLimit:e,gasPrice:r,data:n,gasPerDataByte:o,gasPriceModifier:a,defaultGasPrice:i=String(lr),chainId:d}){let l=n||"",m=xt(e)?e:t,y=De(r)?r:i,f=new V.Transaction({nonce:0,value:Dn.TokenPayment.egldFromAmount("0"),receiver:new V.Address(Mn.to),sender:new V.Address(Mn.to),gasPrice:parseInt(y),gasLimit:parseInt(m),data:new V.TransactionPayload(l.trim()),chainID:d,version:new V.TransactionVersion(1)}),x=new Nn.NetworkConfig;x.MinGasLimit=parseInt(t),x.GasPerDataByte=parseInt(o),x.GasPriceModifier=parseFloat(a);try{return f.computeFee(x).toString(10)}catch(b){return Y}}s();s();s();function Un(t,e){let r=new St.default(0);return t.forEach(n=>{let o=Bn({gasPerDataByte:String(cr),gasPriceModifier:String(sr),minGasLimit:String(e),gasLimit:n.getGasLimit().valueOf().toString(),gasPrice:n.getGasPrice().valueOf().toString(),data:n.getData().toString(),chainId:n.getChainID().valueOf()});r=r.plus(new St.default(o))}),r}function la(a){return me(this,arguments,function*({transactions:t,callbackRoute:e,minGasLimit:r=we,customTransactionInformation:n,transactionsDisplayInfo:o}){let i=q.getState(),d=Date.now().toString(),l=an(i),m=sn(i),y=Array.isArray(t)?t:[t],f=Un(y,r);if(!new On.default(De(l)?l:"0").minus(f).isGreaterThan(0)){let H={type:"warning",iconClassName:"text-warning",title:"Insufficient EGLD funds",description:"Current EGLD balance cannot cover the transaction fees."};return q.dispatch(dt(H)),{error:"insufficient funds",sessionId:null}}if(!(y==null?void 0:y.every(H=>H.getChainID().valueOf()===m.valueOf()))){let H={type:"warning",iconClassName:"text-warning",title:"Network change detected",description:"The application tried to change the transaction network"};return q.dispatch(dt(H)),{error:"Invalid ChainID",sessionId:null}}let F={sessionId:d,callbackRoute:e,customTransactionInformation:n,transactions:y.map(H=>H.toPlainObject())};return q.dispatch(Wr(null)),q.dispatch(jr(F)),q.dispatch(Yr({sessionId:d,transactionsDisplayInfo:o})),{sessionId:d}})}0&&(module.exports={signTransactions});
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Cla