@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
10 lines (9 loc) • 46.4 kB
JavaScript
"use strict";var hn=Object.create;var Z=Object.defineProperty,Tn=Object.defineProperties,xn=Object.getOwnPropertyDescriptor,wn=Object.getOwnPropertyDescriptors,Sn=Object.getOwnPropertyNames,sr=Object.getOwnPropertySymbols,bn=Object.getPrototypeOf,lr=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable;var cr=(r,e,t)=>e in r?Z(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,w=(r,e)=>{for(var t in e||(e={}))lr.call(e,t)&&cr(r,t,e[t]);if(sr)for(var t of sr(e))vn.call(e,t)&&cr(r,t,e[t]);return r},F=(r,e)=>Tn(r,wn(e));var f=(r,e)=>()=>(r&&(e=r(r=0)),e);var ae=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),U=(r,e)=>{for(var t in e)Z(r,t,{get:e[t],enumerable:!0})},pr=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Sn(e))!lr.call(r,o)&&o!==t&&Z(r,o,{get:()=>e[o],enumerable:!(n=xn(e,o))||n.enumerable});return r};var O=(r,e,t)=>(t=r!=null?hn(bn(r)):{},pr(e||!r||!r.__esModule?Z(t,"default",{value:r,enumerable:!0}):t,r)),$=r=>pr(Z({},"__esModule",{value:!0}),r);var ur=(r,e,t)=>new Promise((n,o)=>{var a=l=>{try{p(t.next(l))}catch(m){o(m)}},i=l=>{try{p(t.throw(l))}catch(m){o(m)}},p=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,i);p((t=t.apply(r,e)).next())});var mr=ae(ie=>{"use strict";c();ie.byteLength=In;ie.toByteArray=En;ie.fromByteArray=Cn;var E=[],I=[],An=typeof Uint8Array!="undefined"?Uint8Array:Array,Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(G=0,dr=Ee.length;G<dr;++G)E[G]=Ee[G],I[Ee.charCodeAt(G)]=G;var G,dr;I["-".charCodeAt(0)]=62;I["_".charCodeAt(0)]=63;function gr(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function In(r){var e=gr(r),t=e[0],n=e[1];return(t+n)*3/4-n}function kn(r,e,t){return(e+t)*3/4-t}function En(r){var e,t=gr(r),n=t[0],o=t[1],a=new An(kn(r,n,o)),i=0,p=o>0?n-4:n,l;for(l=0;l<p;l+=4)e=I[r.charCodeAt(l)]<<18|I[r.charCodeAt(l+1)]<<12|I[r.charCodeAt(l+2)]<<6|I[r.charCodeAt(l+3)],a[i++]=e>>16&255,a[i++]=e>>8&255,a[i++]=e&255;return o===2&&(e=I[r.charCodeAt(l)]<<2|I[r.charCodeAt(l+1)]>>4,a[i++]=e&255),o===1&&(e=I[r.charCodeAt(l)]<<10|I[r.charCodeAt(l+1)]<<4|I[r.charCodeAt(l+2)]>>2,a[i++]=e>>8&255,a[i++]=e&255),a}function Ln(r){return E[r>>18&63]+E[r>>12&63]+E[r>>6&63]+E[r&63]}function Rn(r,e,t){for(var n,o=[],a=e;a<t;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),o.push(Ln(n));return o.join("")}function Cn(r){for(var e,t=r.length,n=t%3,o=[],a=16383,i=0,p=t-n;i<p;i+=a)o.push(Rn(r,i,i+a>p?p:i+a));return n===1?(e=r[t-1],o.push(E[e>>2]+E[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],o.push(E[e>>10]+E[e>>4&63]+E[e<<2&63]+"=")),o.join("")}});var fr=ae(Le=>{c();Le.read=function(r,e,t,n,o){var a,i,p=o*8-n-1,l=(1<<p)-1,m=l>>1,h=-7,y=t?o-1:0,S=t?-1:1,b=r[e+y];for(y+=S,a=b&(1<<-h)-1,b>>=-h,h+=p;h>0;a=a*256+r[e+y],y+=S,h-=8);for(i=a&(1<<-h)-1,a>>=-h,h+=n;h>0;i=i*256+r[e+y],y+=S,h-=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)};Le.write=function(r,e,t,n,o,a){var i,p,l,m=a*8-o-1,h=(1<<m)-1,y=h>>1,S=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:a-1,D=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,i=h):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+y>=1?e+=S/l:e+=S*Math.pow(2,1-y),e*l>=2&&(i++,l/=2),i+y>=h?(p=0,i=h):i+y>=1?(p=(e*l-1)*Math.pow(2,o),i=i+y):(p=e*Math.pow(2,y-1)*Math.pow(2,o),i=0));o>=8;r[t+b]=p&255,b+=D,p/=256,o-=8);for(i=i<<o|p,m+=o;m>0;r[t+b]=i&255,b+=D,i/=256,m-=8);r[t+b-D]|=_*128}});var Lr=ae(K=>{"use strict";c();var Re=mr(),j=fr(),yr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;K.Buffer=s;K.SlowBuffer=Dn;K.INSPECT_MAX_BYTES=50;var se=2147483647;K.kMaxLength=se;s.TYPED_ARRAY_SUPPORT=_n();!s.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 _n(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch(t){return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.byteOffset}});function M(r){if(r>se)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,s.prototype),e}function s(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Me(r)}return xr(r,e,t)}s.poolSize=8192;function xr(r,e,t){if(typeof r=="string")return Mn(r,e);if(ArrayBuffer.isView(r))return Pn(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(L(r,ArrayBuffer)||r&&L(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(L(r,SharedArrayBuffer)||r&&L(r.buffer,SharedArrayBuffer)))return _e(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return s.from(n,e,t);var o=Nn(r);if(o)return o;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return s.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}s.from=function(r,e,t){return xr(r,e,t)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function wr(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function Fn(r,e,t){return wr(r),r<=0?M(r):e!==void 0?typeof t=="string"?M(r).fill(e,t):M(r).fill(e):M(r)}s.alloc=function(r,e,t){return Fn(r,e,t)};function Me(r){return wr(r),M(r<0?0:Pe(r)|0)}s.allocUnsafe=function(r){return Me(r)};s.allocUnsafeSlow=function(r){return Me(r)};function Mn(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=Sr(r,e)|0,n=M(t),o=n.write(r,e);return o!==t&&(n=n.slice(0,o)),n}function Ce(r){for(var e=r.length<0?0:Pe(r.length)|0,t=M(e),n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Pn(r){if(L(r,Uint8Array)){var e=new Uint8Array(r);return _e(e.buffer,e.byteOffset,e.byteLength)}return Ce(r)}function _e(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,s.prototype),n}function Nn(r){if(s.isBuffer(r)){var e=Pe(r.length)|0,t=M(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||Ne(r.length)?M(0):Ce(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Ce(r.data)}function Pe(r){if(r>=se)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+se.toString(16)+" bytes");return r|0}function Dn(r){return+r!=r&&(r=0),s.alloc(+r)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,t){if(L(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),L(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,o=t.length,a=0,i=Math.min(n,o);a<i;++a)if(e[a]!==t[a]){n=e[a],o=t[a];break}return n<o?-1:o<n?1:0};s.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}};s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var o=s.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){var i=e[n];if(L(i,Uint8Array))a+i.length>o.length?s.from(i).copy(o,a):Uint8Array.prototype.set.call(o,i,a);else if(s.isBuffer(i))i.copy(o,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=i.length}return o};function Sr(r,e){if(s.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||L(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Fe(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Er(r).length;default:if(o)return n?-1:Fe(r).length;e=(""+e).toLowerCase(),o=!0}}s.byteLength=Sr;function Bn(r,e,t){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Kn(this,e,t);case"utf8":case"utf-8":return vr(this,e,t);case"ascii":return Wn(this,e,t);case"latin1":case"binary":return jn(this,e,t);case"base64":return zn(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Yn(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function H(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}s.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 t=0;t<e;t+=2)H(this,t,t+1);return this};s.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 t=0;t<e;t+=4)H(this,t,t+3),H(this,t+1,t+2);return this};s.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 t=0;t<e;t+=8)H(this,t,t+7),H(this,t+1,t+6),H(this,t+2,t+5),H(this,t+3,t+4);return this};s.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?vr(this,0,e):Bn.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){var e="",t=K.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};yr&&(s.prototype[yr]=s.prototype.inspect);s.prototype.compare=function(e,t,n,o,a){if(L(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),t<0||n>e.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&t>=n)return 0;if(o>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,a>>>=0,this===e)return 0;for(var i=a-o,p=n-t,l=Math.min(i,p),m=this.slice(o,a),h=e.slice(t,n),y=0;y<l;++y)if(m[y]!==h[y]){i=m[y],p=h[y];break}return i<p?-1:p<i?1:0};function br(r,e,t,n,o){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ne(t)&&(t=o?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(o)return-1;t=r.length-1}else if(t<0)if(o)t=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:hr(r,e,t,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):hr(r,[e],t,n,o);throw new TypeError("val must be string, number or Buffer")}function hr(r,e,t,n,o){var a=1,i=r.length,p=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;a=2,i/=2,p/=2,t/=2}function l(b,D){return a===1?b[D]:b.readUInt16BE(D*a)}var m;if(o){var h=-1;for(m=t;m<i;m++)if(l(r,m)===l(e,h===-1?0:m-h)){if(h===-1&&(h=m),m-h+1===p)return h*a}else h!==-1&&(m-=m-h),h=-1}else for(t+p>i&&(t=i-p),m=t;m>=0;m--){for(var y=!0,S=0;S<p;S++)if(l(r,m+S)!==l(e,S)){y=!1;break}if(y)return m}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};s.prototype.indexOf=function(e,t,n){return br(this,e,t,n,!0)};s.prototype.lastIndexOf=function(e,t,n){return br(this,e,t,n,!1)};function Un(r,e,t,n){t=Number(t)||0;var o=r.length-t;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 p=parseInt(e.substr(i*2,2),16);if(Ne(p))return i;r[t+i]=p}return i}function On(r,e,t,n){return ce(Fe(e,r.length-t),r,t,n)}function Gn(r,e,t,n){return ce(Qn(e),r,t,n)}function Hn(r,e,t,n){return ce(Er(e),r,t,n)}function qn(r,e,t,n){return ce(Zn(e,r.length-t),r,t,n)}s.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>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-t;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return Un(this,e,t,n);case"utf8":case"utf-8":return On(this,e,t,n);case"ascii":case"latin1":case"binary":return Gn(this,e,t,n);case"base64":return Hn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qn(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function zn(r,e,t){return e===0&&t===r.length?Re.fromByteArray(r):Re.fromByteArray(r.slice(e,t))}function vr(r,e,t){t=Math.min(r.length,t);for(var n=[],o=e;o<t;){var a=r[o],i=null,p=a>239?4:a>223?3:a>191?2:1;if(o+p<=t){var l,m,h,y;switch(p){case 1:a<128&&(i=a);break;case 2:l=r[o+1],(l&192)===128&&(y=(a&31)<<6|l&63,y>127&&(i=y));break;case 3:l=r[o+1],m=r[o+2],(l&192)===128&&(m&192)===128&&(y=(a&15)<<12|(l&63)<<6|m&63,y>2047&&(y<55296||y>57343)&&(i=y));break;case 4:l=r[o+1],m=r[o+2],h=r[o+3],(l&192)===128&&(m&192)===128&&(h&192)===128&&(y=(a&15)<<18|(l&63)<<12|(m&63)<<6|h&63,y>65535&&y<1114112&&(i=y))}}i===null?(i=65533,p=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=p}return Vn(n)}var Tr=4096;function Vn(r){var e=r.length;if(e<=Tr)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Tr));return t}function Wn(r,e,t){var n="";t=Math.min(r.length,t);for(var o=e;o<t;++o)n+=String.fromCharCode(r[o]&127);return n}function jn(r,e,t){var n="";t=Math.min(r.length,t);for(var o=e;o<t;++o)n+=String.fromCharCode(r[o]);return n}function Kn(r,e,t){var n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);for(var o="",a=e;a<t;++a)o+=$n[r[a]];return o}function Yn(r,e,t){for(var n=r.slice(e,t),o="",a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}s.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var o=this.subarray(e,t);return Object.setPrototypeOf(o,s.prototype),o};function x(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||x(e,t,this.length);for(var o=this[e],a=1,i=0;++i<t&&(a*=256);)o+=this[e+i]*a;return o};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||x(e,t,this.length);for(var o=this[e+--t],a=1;t>0&&(a*=256);)o+=this[e+--t]*a;return o};s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e=e>>>0,t||x(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||x(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||x(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||x(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||x(e,t,this.length);for(var o=this[e],a=1,i=0;++i<t&&(a*=256);)o+=this[e+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*t)),o};s.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||x(e,t,this.length);for(var o=t,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*t)),i};s.prototype.readInt8=function(e,t){return e=e>>>0,t||x(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,t){e=e>>>0,t||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,t){e=e>>>0,t||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,t){return e=e>>>0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,t){return e=e>>>0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readFloatLE=function(e,t){return e=e>>>0,t||x(e,4,this.length),j.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,t){return e=e>>>0,t||x(e,4,this.length),j.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||x(e,8,this.length),j.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||x(e,8,this.length),j.read(this,e,!1,52,8)};function v(r,e,t,n,o,a){if(!s.isBuffer(r))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(t+n>r.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){var a=Math.pow(2,8*n)-1;v(this,e,t,n,a,0)}var i=1,p=0;for(this[t]=e&255;++p<n&&(i*=256);)this[t+p]=e/i&255;return t+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){var a=Math.pow(2,8*n)-1;v(this,e,t,n,a,0)}var i=n-1,p=1;for(this[t+i]=e&255;--i>=0&&(p*=256);)this[t+i]=e/p&255;return t+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,1,255,0),this[t]=e&255,t+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};s.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){var a=Math.pow(2,8*n-1);v(this,e,t,n,a-1,-a)}var i=0,p=1,l=0;for(this[t]=e&255;++i<n&&(p*=256);)e<0&&l===0&&this[t+i-1]!==0&&(l=1),this[t+i]=(e/p>>0)-l&255;return t+n};s.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){var a=Math.pow(2,8*n-1);v(this,e,t,n,a-1,-a)}var i=n-1,p=1,l=0;for(this[t+i]=e&255;--i>=0&&(p*=256);)e<0&&l===0&&this[t+i+1]!==0&&(l=1),this[t+i]=(e/p>>0)-l&255;return t+n};s.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};s.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};s.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};s.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};s.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||v(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Ar(r,e,t,n,o,a){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ir(r,e,t,n,o){return e=+e,t=t>>>0,o||Ar(r,e,t,4,34028234663852886e22,-34028234663852886e22),j.write(r,e,t,n,23,4),t+4}s.prototype.writeFloatLE=function(e,t,n){return Ir(this,e,t,!0,n)};s.prototype.writeFloatBE=function(e,t,n){return Ir(this,e,t,!1,n)};function kr(r,e,t,n,o){return e=+e,t=t>>>0,o||Ar(r,e,t,8,17976931348623157e292,-17976931348623157e292),j.write(r,e,t,n,52,8),t+8}s.prototype.writeDoubleLE=function(e,t,n){return kr(this,e,t,!0,n)};s.prototype.writeDoubleBE=function(e,t,n){return kr(this,e,t,!1,n)};s.prototype.copy=function(e,t,n,o){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<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-t<o-n&&(o=e.length-t+n);var a=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),a};s.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=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"&&!s.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(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var i;if(typeof e=="number")for(i=t;i<n;++i)this[i]=e;else{var p=s.isBuffer(e)?e:s.from(e,o),l=p.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=p[i%l]}return this};var Xn=/[^+/0-9A-Za-z-_]/g;function Jn(r){if(r=r.split("=")[0],r=r.trim().replace(Xn,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Fe(r,e){e=e||1/0;for(var t,n=r.length,o=null,a=[],i=0;i<n;++i){if(t=r.charCodeAt(i),t>55295&&t<57344){if(!o){if(t>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=t;continue}if(t<56320){(e-=3)>-1&&a.push(239,191,189),o=t;continue}t=(o-55296<<10|t-56320)+65536}else o&&(e-=3)>-1&&a.push(239,191,189);if(o=null,t<128){if((e-=1)<0)break;a.push(t)}else if(t<2048){if((e-=2)<0)break;a.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;a.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;a.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return a}function Qn(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Zn(r,e){for(var t,n,o,a=[],i=0;i<r.length&&!((e-=2)<0);++i)t=r.charCodeAt(i),n=t>>8,o=t%256,a.push(o),a.push(n);return a}function Er(r){return Re.toByteArray(Jn(r))}function ce(r,e,t,n){for(var o=0;o<n&&!(o+t>=e.length||o>=r.length);++o)e[o+t]=r[o];return o}function L(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Ne(r){return r!==r}var $n=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var n=t*16,o=0;o<16;++o)e[n+o]=r[t]+r[o];return e}()});var Mr=ae((Vo,Fr)=>{c();var T=Fr.exports={},R,C;function De(){throw new Error("setTimeout has not been defined")}function Be(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?R=setTimeout:R=De}catch(r){R=De}try{typeof clearTimeout=="function"?C=clearTimeout:C=Be}catch(r){C=Be}})();function Rr(r){if(R===setTimeout)return setTimeout(r,0);if((R===De||!R)&&setTimeout)return R=setTimeout,setTimeout(r,0);try{return R(r,0)}catch(e){try{return R.call(null,r,0)}catch(t){return R.call(this,r,0)}}}function eo(r){if(C===clearTimeout)return clearTimeout(r);if((C===Be||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(r);try{return C(r)}catch(e){try{return C.call(null,r)}catch(t){return C.call(this,r)}}}var P=[],Y=!1,q,le=-1;function ro(){!Y||!q||(Y=!1,q.length?P=q.concat(P):le=-1,P.length&&Cr())}function Cr(){if(!Y){var r=Rr(ro);Y=!0;for(var e=P.length;e;){for(q=P,P=[];++le<e;)q&&q[le].run();le=-1,e=P.length}q=null,Y=!1,eo(r)}}T.nextTick=function(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];P.push(new _r(r,e)),P.length===1&&!Y&&Rr(Cr)};function _r(r,e){this.fun=r,this.array=e}_r.prototype.run=function(){this.fun.apply(null,this.array)};T.title="browser";T.browser=!0;T.env={};T.argv=[];T.version="";T.versions={};function N(){}T.on=N;T.addListener=N;T.once=N;T.off=N;T.removeListener=N;T.removeAllListeners=N;T.emit=N;T.prependListener=N;T.prependOnceListener=N;T.listeners=function(r){return[]};T.binding=function(r){throw new Error("process.binding is not supported")};T.cwd=function(){return"/"};T.chdir=function(r){throw new Error("process.chdir is not supported")};T.umask=function(){return 0}});var u,d,Wo,c=f(()=>{u=O(Lr()),d=O(Mr()),Wo=function(r){function e(){var n=this||self;return delete r.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:e});var t=__magic__;return t}(Object)});var pe,Ue=f(()=>{"use strict";c();pe=()=>Date.now()/1e3});var Pr=f(()=>{"use strict";c()});var Nr=f(()=>{"use strict";c()});var Dr=f(()=>{"use strict";c();Ue();Pr();Nr()});var Ge={};U(Ge,{getItem:()=>no,localStorageKeys:()=>z,removeItem:()=>oo,setItem:()=>to});var z,Oe,to,no,oo,ee=f(()=>{"use strict";c();Dr();z={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},Oe=typeof localStorage!="undefined",to=({key:r,data:e,expires:t})=>{!Oe||localStorage.setItem(String(r),JSON.stringify({expires:t,data:e}))},no=r=>{if(!Oe)return;let e=localStorage.getItem(String(r));if(!e)return null;let t=JSON.parse(e);return!t||!t.hasOwnProperty("expires")||!t.hasOwnProperty("data")?null:pe()>=t.expires?(localStorage.removeItem(String(r)),null):t.data},oo=r=>{!Oe||localStorage.removeItem(String(r))}});var He={};U(He,{clear:()=>Gr,getItem:()=>Ur,removeItem:()=>Or,setItem:()=>Br,storage:()=>ao});var Br,Ur,Or,Gr,ao,Hr=f(()=>{"use strict";c();Br=({key:r,data:e,expires:t})=>{sessionStorage.setItem(String(r),JSON.stringify({expires:t,data:e}))},Ur=r=>{let e=sessionStorage.getItem(String(r));if(!e)return null;let t=JSON.parse(e);return!t||!t.hasOwnProperty("expires")||!t.hasOwnProperty("data")?null:Date.now()>=t.expires?(sessionStorage.removeItem(String(r)),null):t.data},Or=r=>sessionStorage.removeItem(String(r)),Gr=()=>sessionStorage.clear(),ao={setItem:Br,getItem:Ur,removeItem:Or,clear:Gr}});var X,ue=f(()=>{"use strict";c();ee();Hr();X={session:He,local:Ge}});function re(){return new Date().setHours(new Date().getHours()+24)}function te(r){X.local.setItem({key:z.loginExpiresAt,data:r,expires:r})}var qe=f(()=>{"use strict";c();ue();ee()});var ne=f(()=>{"use strict";c()});var qr=f(()=>{"use strict";c()});var zr=f(()=>{"use strict";c()});var Vr=f(()=>{"use strict";c()});var Wr=f(()=>{"use strict";c()});var jr=f(()=>{"use strict";c()});var Kr=f(()=>{"use strict";c()});var Yr=f(()=>{"use strict";c()});var ze=f(()=>{"use strict";c();zr();Vr();ne();Wr();jr();Kr();Yr()});var Ve,Xr,xa,Jr,wa,Qr,Sa,ba,va,Zr=f(()=>{"use strict";c();ze();Ve={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:Xr,egldLabel:xa}=Ve["devnet"],{chainId:Jr,egldLabel:wa}=Ve["testnet"],{chainId:Qr,egldLabel:Sa}=Ve["mainnet"],ba={["devnet"]:Xr,["testnet"]:Jr,["mainnet"]:Qr},va={[Xr]:"devnet",[Jr]:"testnet",[Qr]:"mainnet"}});var We=f(()=>{"use strict";c()});var $r=f(()=>{"use strict";c()});var et,je=f(()=>{"use strict";c();et="transaction-status-toast-id"});var de,rt,tt,ge=f(()=>{"use strict";c();qr();Zr();We();$r();je();de="logout",rt="login",tt="0"});var Ke,A,me,B=f(()=>{"use strict";c();Ke=require("@reduxjs/toolkit");ge();A=(0,Ke.createAction)(de),me=(0,Ke.createAction)(rt,r=>({payload:r}))});var ot,nt,at,qa,za,Va,Wa,ja,Ka,it,st,Ye=f(()=>{"use strict";c();ot=require("@reduxjs/toolkit");qe();ne();B();nt={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},at=(0,ot.createSlice)({name:"loginInfoSlice",initialState:nt,reducers:{setLoginMethod:(r,e)=>{r.loginMethod=e.payload},setTokenLogin:(r,e)=>{r.tokenLogin=e.payload},setTokenLoginSignature:(r,e)=>{(r==null?void 0:r.tokenLogin)!=null&&(r.tokenLogin.signature=e.payload)},setWalletLogin:(r,e)=>{r.walletLogin=e.payload},setWalletConnectLogin:(r,e)=>{r.walletConnectLogin=e.payload},setLedgerLogin:(r,e)=>{r.ledgerLogin=e.payload},invalidateLoginSession:r=>{r.isLoginSessionInvalid=!0}},extraReducers:r=>{r.addCase(A,()=>nt),r.addCase(me,(e,t)=>{e.loginMethod=t.payload.loginMethod,te(re())})}}),{setLoginMethod:qa,setWalletConnectLogin:za,setLedgerLogin:Va,setTokenLogin:Wa,setTokenLoginSignature:ja,setWalletLogin:Ka,invalidateLoginSession:it}=at.actions,st=at.reducer});var ct=f(()=>{"use strict";c()});var lt=f(()=>{"use strict";c();ct()});function Xe(r){return r[Math.floor(Math.random()*r.length)]}var pt=f(()=>{"use strict";c()});var ut=f(()=>{"use strict";c();We()});var dt=f(()=>{"use strict";c();lt();pt();ut()});var gt,mt,Je,io,ft,li,pi,yt,Qe=f(()=>{"use strict";c();gt=require("@reduxjs/toolkit"),mt=O(require("lodash.omit"));dt();Je={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},io={network:Je,chainID:"-1"},ft=(0,gt.createSlice)({name:"appConfig",initialState:io,reducers:{initializeNetworkConfig:(r,e)=>{let t=Xe(e.payload.walletConnectBridgeAddresses),n=Xe(e.payload.walletConnectV2RelayAddresses),o=(0,mt.default)(e.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");r.network=F(w(w({},r.network),o),{walletConnectBridgeAddress:t,walletConnectV2RelayAddress:n})},setChainID:(r,e)=>{r.chainID=e.payload}}}),{initializeNetworkConfig:li,setChainID:pi}=ft.actions,yt=ft.reducer});var $e,ht,Tt,xt,Ze,wt,St,Ti,bt,xi,wi,Si,bi,vi,Ai,Ii,vt,er=f(()=>{"use strict";c();$e=require("@elrondnetwork/erdjs"),ht=require("@reduxjs/toolkit"),Tt=require("redux-persist");ge();ue();ee();B();xt={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:tt},Ze={address:"",websocketEvent:null,accounts:{"":xt},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},wt=(0,ht.createSlice)({name:"accountInfoSlice",initialState:Ze,reducers:{setAddress:(r,e)=>{let t=e.payload;r.address=t,r.publicKey=new $e.Address(t).hex()},setAccount:(r,e)=>{let t=r.address===e.payload.address;r.accounts={[r.address]:t?e.payload:xt},r.isAccountLoading=!1,r.accountLoadingError=null},setAccountNonce:(r,e)=>{let{address:t}=r;r.accounts[t].nonce=e.payload},setAccountShard:(r,e)=>{r.shard=e.payload},setLedgerAccount:(r,e)=>{r.ledgerAccount=e.payload},updateLedgerAccount:(r,e)=>{r.ledgerAccount!=null&&(r.ledgerAccount.index=e.payload.index,r.ledgerAccount.address=e.payload.address)},setWalletConnectAccount:(r,e)=>{r.walletConnectAccount=e.payload},setIsAccountLoading:(r,e)=>{r.isAccountLoading=e.payload,r.accountLoadingError=null},setAccountLoadingError:(r,e)=>{r.accountLoadingError=e.payload,r.isAccountLoading=!1},setWebsocketEvent:(r,e)=>{r.websocketEvent={timestamp:Date.now(),message:e.payload}}},extraReducers:r=>{r.addCase(A,()=>(X.local.removeItem(z.loginExpiresAt),Ze)),r.addCase(me,(e,t)=>{let{address:n}=t.payload;e.address=n,e.publicKey=new $e.Address(n).hex()}),r.addCase(Tt.REHYDRATE,(e,t)=>{var m;if(!((m=t.payload)!=null&&m.account))return;let{account:n}=t.payload,{address:o,shard:a,accounts:i,publicKey:p}=n;e.address=o,e.shard=a;let l=i&&o in i;e.accounts=l?i:Ze.accounts,e.publicKey=p})}}),{setAccount:St,setAddress:Ti,setAccountNonce:bt,setAccountShard:xi,setLedgerAccount:wi,updateLedgerAccount:Si,setWalletConnectAccount:bi,setIsAccountLoading:vi,setAccountLoadingError:Ai,setWebsocketEvent:Ii}=wt.actions,vt=wt.reducer});function At(r){return r!=null&&(go(r)||fo(r))}function It(r){return r!=null&&(mo(r)||yo(r))}function go(r){return r!=null&&co.includes(r)}function mo(r){return r!=null&&lo.includes(r)}function fo(r){return r!=null&&po.includes(r)}function yo(r){return r!=null&&uo.includes(r)}var Ri,co,lo,Ci,_i,po,uo,kt=f(()=>{"use strict";c();ne();Ri=["sent"],co=["success"],lo=["fail","cancelled","timedOut"],Ci=["timedOut"],_i=["pending"],po=["success"],uo=["fail","invalid"]});var Et,Lt,oe,ho,Rt,Ui,Oi,Gi,Hi,qi,zi,Vi,Wi,ji,Ki,fe,ye=f(()=>{"use strict";c();Et=require("@reduxjs/toolkit"),Lt=require("redux-persist");ne();kt();B();oe={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},ho={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Rt=(0,Et.createSlice)({name:"transactionsSlice",initialState:oe,reducers:{moveTransactionsToSignedState:(r,e)=>{var l,m;let{sessionId:t,transactions:n,errorMessage:o,status:a,redirectRoute:i}=e.payload,p=((l=r.customTransactionInformationForSessionId)==null?void 0:l[t])||ho;r.signedTransactions[t]={transactions:n,status:a,errorMessage:o,redirectRoute:i,customTransactionInformation:p},((m=r==null?void 0:r.transactionsToSign)==null?void 0:m.sessionId)===t&&(r.transactionsToSign=oe.transactionsToSign)},clearSignedTransaction:(r,e)=>{r.signedTransactions[e.payload]&&delete r.signedTransactions[e.payload]},clearTransactionToSign:r=>{r!=null&&r.transactionsToSign&&(r.transactionsToSign=null)},updateSignedTransaction:(r,e)=>{r.signedTransactions=w(w({},r.signedTransactions),e.payload)},updateSignedTransactions:(r,e)=>{let{sessionId:t,status:n,errorMessage:o,transactions:a}=e.payload;r.signedTransactions[t]!=null&&(r.signedTransactions[t].status=n,o!=null&&(r.signedTransactions[t].errorMessage=o),a!=null&&(r.signedTransactions[t].transactions=a))},updateSignedTransactionStatus:(r,e)=>{var p,l,m,h,y,S;let{sessionId:t,status:n,errorMessage:o,transactionHash:a}=e.payload,i=(l=(p=r.signedTransactions)==null?void 0:p[t])==null?void 0:l.transactions;if(i!=null){r.signedTransactions[t].transactions=i.map(_=>_.hash===a?F(w({},_),{status:n,errorMessage:o}):_);let b=(h=(m=r.signedTransactions[t])==null?void 0:m.transactions)==null?void 0:h.every(_=>At(_.status)),D=(S=(y=r.signedTransactions[t])==null?void 0:y.transactions)==null?void 0:S.every(_=>It(_.status));b&&(r.signedTransactions[t].status="success"),D&&(r.signedTransactions[t].status="fail")}},setTransactionsToSign:(r,e)=>{r.transactionsToSign=e.payload;let{sessionId:t,customTransactionInformation:n}=e.payload;r.customTransactionInformationForSessionId[t]=n,r.signTransactionsError=null},clearAllTransactionsToSign:r=>{r.transactionsToSign=oe.transactionsToSign,r.signTransactionsError=null},clearAllSignedTransactions:r=>{r.signedTransactions=oe.signedTransactions},setSignTransactionsError:(r,e)=>{r.signTransactionsError=e.payload},setSignTransactionsCancelMessage:(r,e)=>{r.signTransactionsCancelMessage=e.payload}},extraReducers:r=>{r.addCase(A,()=>oe),r.addCase(Lt.REHYDRATE,(e,t)=>{var i;if(e.signTransactionsCancelMessage=null,!((i=t.payload)!=null&&i.transactions))return;let{signedTransactions:n,customTransactionInformationForSessionId:o}=t.payload.transactions,a=Object.entries(n).reduce((p,[l,m])=>{let h=new Date(l),y=new Date;return y.setHours(y.getHours()+5),y-h>0||(p[l]=m),p},{});o!=null&&(e.customTransactionInformationForSessionId=o),n!=null&&(e.signedTransactions=a)})}}),{updateSignedTransactionStatus:Ui,updateSignedTransactions:Oi,setTransactionsToSign:Gi,clearAllTransactionsToSign:Hi,clearAllSignedTransactions:qi,clearSignedTransaction:zi,clearTransactionToSign:Vi,setSignTransactionsError:Wi,setSignTransactionsCancelMessage:ji,moveTransactionsToSignedState:Ki}=Rt.actions,fe=Rt.reducer});var Ct,To,xo,wo,So,rr,_t,Qi,Zi,$i,he,Te=f(()=>{"use strict";c();Ct=require("@reduxjs/toolkit");B();To="Transaction failed",xo="Transaction successful",wo="Processing transaction",So="Transaction submitted",rr={},_t=(0,Ct.createSlice)({name:"transactionsInfo",initialState:rr,reducers:{setTransactionsDisplayInfo(r,e){let{sessionId:t,transactionsDisplayInfo:n}=e.payload;t!=null&&(r[t]={errorMessage:(n==null?void 0:n.errorMessage)||To,successMessage:(n==null?void 0:n.successMessage)||xo,processingMessage:(n==null?void 0:n.processingMessage)||wo,submittedMessage:(n==null?void 0:n.submittedMessage)||So,transactionDuration:n==null?void 0:n.transactionDuration})},clearTransactionsInfoForSessionId(r,e){e.payload!=null&&delete r[e.payload]},clearTransactionsInfo:()=>rr},extraReducers:r=>{r.addCase(A,()=>rr)}}),{clearTransactionsInfo:Qi,setTransactionsDisplayInfo:Zi,clearTransactionsInfoForSessionId:$i}=_t.actions,he=_t.reducer});var Mt,Ft,Pt,ns,os,as,is,Nt,tr=f(()=>{"use strict";c();Mt=require("@reduxjs/toolkit");B();Ft={},Pt=(0,Mt.createSlice)({name:"modalsSlice",initialState:Ft,reducers:{setTxSubmittedModal:(r,e)=>{r.txSubmittedModal=e.payload},setNotificationModal:(r,e)=>{r.notificationModal=e.payload},clearTxSubmittedModal:r=>{r.txSubmittedModal=void 0},clearNotificationModal:r=>{r.notificationModal=void 0}},extraReducers:r=>{r.addCase(A,()=>Ft)}}),{setTxSubmittedModal:ns,setNotificationModal:os,clearTxSubmittedModal:as,clearNotificationModal:is}=Pt.actions,Nt=Pt.reducer});var Bt,Ut,Dt,Ot,ms,fs,ys,hs,Ts,xs,xe,we=f(()=>{"use strict";c();Bt=require("@reduxjs/toolkit"),Ut=require("redux-persist");je();ze();Ue();B();Dt={customToasts:[],transactionToasts:[],failTransactionToast:null},Ot=(0,Bt.createSlice)({name:"toastsSlice",initialState:Dt,reducers:{addCustomToast:(r,e)=>{r.customToasts.push(F(w({},e.payload),{type:"custom",toastId:e.payload.toastId||`custom-toast-${r.customToasts.length+1}`}))},removeCustomToast:(r,e)=>{r.customToasts=r.customToasts.filter(t=>t.toastId!==e.payload)},addTransactionToast:(r,e)=>{r.transactionToasts.push({type:"transaction",startTimestamp:pe(),toastId:e.payload||`custom-toast-${r.transactionToasts.length+1}`})},removeTransactionToast:(r,e)=>{r.transactionToasts=r.transactionToasts.filter(t=>t.toastId!==e.payload)},addFailTransactionToast:(r,e)=>{r.failTransactionToast=F(w({},e.payload),{toastId:et})},removeFailTransactionToast:r=>{r.failTransactionToast=null}},extraReducers:r=>{r.addCase(A,()=>Dt),r.addCase(Ut.REHYDRATE,(e,t)=>{var o,a;let n=(a=(o=t.customToasts)==null?void 0:o.filter(i=>!("component"in i)))!=null?a:[];e.customToasts=n})}}),{addCustomToast:ms,removeCustomToast:fs,addTransactionToast:ys,removeTransactionToast:hs,addFailTransactionToast:Ts,removeFailTransactionToast:xs}=Ot.actions,xe=Ot.reducer});var Se=f(()=>{"use strict";c();Ye();Qe();er();ye();Te();tr();we()});var nr=f(()=>{"use strict";c()});var zt,qt,Vt,Os,Gs,Hs,qs,zs,Vs,Wt,jt=f(()=>{"use strict";c();zt=require("@reduxjs/toolkit");B();qt={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},Vt=(0,zt.createSlice)({name:"dappModalsSlice",initialState:qt,reducers:{setDappModalVisibility:(r,e)=>{r.visible=e.payload},setDappModalHeaderVisibility:(r,e)=>{r.modal.showHeader=e.payload},setDappModalFooterVisibility:(r,e)=>{r.modal.showFooter=e.payload},setDappModalHeaderText:(r,e)=>{r.modal.headerText=e.payload},setDappModalFooterText:(r,e)=>{r.modal.footerText=e.payload},setDappModalConfig:(r,e)=>{r.modal=w({},e.payload)}},extraReducers:r=>{r.addCase(A,()=>qt)}}),{setDappModalVisibility:Os,setDappModalHeaderVisibility:Gs,setDappModalFooterVisibility:Hs,setDappModalHeaderText:qs,setDappModalFooterText:zs,setDappModalConfig:Vs}=Vt.actions,Wt=Vt.reducer});var Kt,Io,ko,J,ve=f(()=>{"use strict";c();Kt=require("@reduxjs/toolkit");nr();er();jt();Ye();tr();Qe();we();Te();ye();Io={["account"]:vt,["networkConfig"]:yt,["loginInfo"]:st,["modals"]:Nt,["dappModal"]:Wt,["toasts"]:xe,["transactions"]:fe,["transactionsInfo"]:he},ko=(r={})=>(0,Kt.combineReducers)(w(w({},Io),r)),J=ko});var Jt={};U(Jt,{default:()=>Mo});function or(r,e=[]){return{key:r,version:1,storage:Xt.default,blacklist:e}}var V,Yt,Xt,Eo,Lo,Ro,Co,_o,Fo,Mo,Qt=f(()=>{"use strict";c();V=require("redux-persist"),Yt=O(require("redux-persist/lib/storage")),Xt=O(require("redux-persist/lib/storage/session"));ve();Se();we();Te();ye();nr();Eo={2:r=>F(w({},r),{networkConfig:Je})};Lo=or("dapp-core-transactionsInfo"),Ro=or("dapp-core-transactions",["transactionsToSign"]),Co=or("dapp-core-toasts"),_o={key:"dapp-core-store",version:2,storage:Yt.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,V.createMigrate)(Eo,{debug:!1})},Fo={["toasts"]:(0,V.persistReducer)(Co,xe),["transactions"]:(0,V.persistReducer)(Ro,fe),["transactionsInfo"]:(0,V.persistReducer)(Lo,he)},Mo=(0,V.persistReducer)(_o,J(Fo))});var Zt={};U(Zt,{default:()=>Po});var Po,$t=f(()=>{"use strict";c();ve();Po=J()});var en={};U(en,{default:()=>Do});var k,No,Do,rn=f(()=>{"use strict";c();k=require("redux-persist"),No=[k.FLUSH,k.REHYDRATE,k.PAUSE,k.PERSIST,k.PURGE,k.REGISTER],Do=No});var on={};U(on,{default:()=>nn});function nn(r){return(0,tn.persistStore)(r)}var tn,an=f(()=>{"use strict";c();tn=require("redux-persist")});var Oo={};U(Oo,{useIsDappModalVisible:()=>Uo});module.exports=$(Oo);c();c();var dn=require("react"),Q=require("react-redux");c();var ar=require("@reduxjs/toolkit"),pn=require("react-redux/es/utils/Subscription");Se();c();var Gt=O(require("lodash.throttle"));ge();Se();qe();ue();ee();var bo=[de],vo=(0,Gt.default)(()=>{te(re())},5e3),Ht=r=>e=>t=>{var l;if(bo.includes(t.type))return e(t);let n=r.getState(),o=X.local.getItem(z.loginExpiresAt);if(!((l=n==null?void 0:n.loginInfo)==null?void 0:l.isLoggedIn))return e(t);if(o==null)return te(re());let i=Date.now();return o-i<0?setTimeout(()=>ur(void 0,null,function*(){console.log("session expired");try{r.dispatch(it())}catch(m){console.error("error logging out",m)}}),1e3):(vo(),e(t))};c();c();function be(){return typeof sessionStorage!="undefined"}var sn=be()?(Qt(),$(Jt)).default:($t(),$(Zt)).default,cn=be()?(rn(),$(en)).default:[],ln=be()?(an(),$(on)).default:r=>r;ve();var Ae=(0,ar.configureStore)({reducer:sn,middleware:r=>r({serializableCheck:{ignoredActions:[...cn,bt.type,St.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(Ht)}),un=(0,pn.createSubscription)(Ae),fc=ln(Ae),yc=(0,ar.configureStore)({reducer:J});var Bo={store:Ae,subscription:un},ir=(0,dn.createContext)(Bo),wc=(0,Q.createStoreHook)(ir),Sc=(0,Q.createDispatchHook)(ir),gn=(0,Q.createSelectorHook)(ir);c();c();var mn=O(require("lodash.isequal")),Ie=require("reselect"),W=(0,Ie.createSelectorCreator)(Ie.defaultMemoize,mn.default);var fn=r=>r.dappModal,yn=W(fn,r=>r.visible),ke=W(fn,r=>r.modal),Ic=W(ke,r=>r.showHeader),kc=W(ke,r=>r.showFooter),Ec=W(ke,r=>r.headerText),Lc=W(ke,r=>r.footerText);var Uo=()=>gn(yn);0&&(module.exports={useIsDappModalVisible});
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
//# sourceMappingURL=useIsDappModalVisible.js.map