@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
1 lines • 88.2 kB
JavaScript
"use strict";var Za=Object.create;var Dt=Object.defineProperty,Xa=Object.defineProperties,Ja=Object.getOwnPropertyDescriptor,Qa=Object.getOwnPropertyDescriptors,ec=Object.getOwnPropertyNames,rr=Object.getOwnPropertySymbols,tc=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty,vo=Object.prototype.propertyIsEnumerable;var wo=(e,t,r)=>t in e?Dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w=(e,t)=>{for(var r in t||(t={}))Qr.call(t,r)&&wo(e,r,t[r]);if(rr)for(var r of rr(t))vo.call(t,r)&&wo(e,r,t[r]);return e},N=(e,t)=>Xa(e,Qa(t));var nr=(e,t)=>{var r={};for(var o in e)Qr.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&rr)for(var o of rr(e))t.indexOf(o)<0&&vo.call(e,o)&&(r[o]=e[o]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var or=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qe=(e,t)=>{for(var r in t)Dt(e,r,{get:t[r],enumerable:!0})},bo=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ec(t))!Qr.call(e,i)&&i!==r&&Dt(e,i,{get:()=>t[i],enumerable:!(o=Ja(t,i))||o.enumerable});return e};var O=(e,t,r)=>(r=e!=null?Za(tc(e)):{},bo(t||!e||!e.__esModule?Dt(r,"default",{value:e,enumerable:!0}):r,e)),Pt=e=>bo(Dt({},"__esModule",{value:!0}),e);var S=(e,t,r)=>new Promise((o,i)=>{var p=d=>{try{u(r.next(d))}catch(g){i(g)}},s=d=>{try{u(r.throw(d))}catch(g){i(g)}},u=d=>d.done?o(d.value):Promise.resolve(d.value).then(p,s);u((r=r.apply(e,t)).next())});var Eo=or(ir=>{"use strict";n();ir.byteLength=nc;ir.toByteArray=ic;ir.fromByteArray=cc;var he=[],de=[],rc=typeof Uint8Array!="undefined"?Uint8Array:Array,en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ke=0,Io=en.length;Ke<Io;++Ke)he[Ke]=en[Ke],de[en.charCodeAt(Ke)]=Ke;var Ke,Io;de["-".charCodeAt(0)]=62;de["_".charCodeAt(0)]=63;function Ao(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var o=r===t?0:4-r%4;return[r,o]}function nc(e){var t=Ao(e),r=t[0],o=t[1];return(r+o)*3/4-o}function oc(e,t,r){return(t+r)*3/4-r}function ic(e){var t,r=Ao(e),o=r[0],i=r[1],p=new rc(oc(e,o,i)),s=0,u=i>0?o-4:o,d;for(d=0;d<u;d+=4)t=de[e.charCodeAt(d)]<<18|de[e.charCodeAt(d+1)]<<12|de[e.charCodeAt(d+2)]<<6|de[e.charCodeAt(d+3)],p[s++]=t>>16&255,p[s++]=t>>8&255,p[s++]=t&255;return i===2&&(t=de[e.charCodeAt(d)]<<2|de[e.charCodeAt(d+1)]>>4,p[s++]=t&255),i===1&&(t=de[e.charCodeAt(d)]<<10|de[e.charCodeAt(d+1)]<<4|de[e.charCodeAt(d+2)]>>2,p[s++]=t>>8&255,p[s++]=t&255),p}function sc(e){return he[e>>18&63]+he[e>>12&63]+he[e>>6&63]+he[e&63]}function ac(e,t,r){for(var o,i=[],p=t;p<r;p+=3)o=(e[p]<<16&16711680)+(e[p+1]<<8&65280)+(e[p+2]&255),i.push(sc(o));return i.join("")}function cc(e){for(var t,r=e.length,o=r%3,i=[],p=16383,s=0,u=r-o;s<u;s+=p)i.push(ac(e,s,s+p>u?u:s+p));return o===1?(t=e[r-1],i.push(he[t>>2]+he[t<<4&63]+"==")):o===2&&(t=(e[r-2]<<8)+e[r-1],i.push(he[t>>10]+he[t>>4&63]+he[t<<2&63]+"=")),i.join("")}});var ko=or(tn=>{n();tn.read=function(e,t,r,o,i){var p,s,u=i*8-o-1,d=(1<<u)-1,g=d>>1,f=-7,T=r?i-1:0,h=r?-1:1,y=e[t+T];for(T+=h,p=y&(1<<-f)-1,y>>=-f,f+=u;f>0;p=p*256+e[t+T],T+=h,f-=8);for(s=p&(1<<-f)-1,p>>=-f,f+=o;f>0;s=s*256+e[t+T],T+=h,f-=8);if(p===0)p=1-g;else{if(p===d)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,o),p=p-g}return(y?-1:1)*s*Math.pow(2,p-o)};tn.write=function(e,t,r,o,i,p){var s,u,d,g=p*8-i-1,f=(1<<g)-1,T=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=o?0:p-1,A=o?1:-1,M=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-s))<1&&(s--,d*=2),s+T>=1?t+=h/d:t+=h*Math.pow(2,1-T),t*d>=2&&(s++,d/=2),s+T>=f?(u=0,s=f):s+T>=1?(u=(t*d-1)*Math.pow(2,i),s=s+T):(u=t*Math.pow(2,T-1)*Math.pow(2,i),s=0));i>=8;e[r+y]=u&255,y+=A,u/=256,i-=8);for(s=s<<i|u,g+=i;g>0;e[r+y]=s&255,y+=A,s/=256,g-=8);e[r+y-A]|=M*128}});var Wo=or(at=>{"use strict";n();var rn=Eo(),st=ko(),Lo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;at.Buffer=m;at.SlowBuffer=gc;at.INSPECT_MAX_BYTES=50;var sr=2147483647;at.kMaxLength=sr;m.TYPED_ARRAY_SUPPORT=lc();!m.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 lc(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(r){return!1}}Object.defineProperty(m.prototype,"parent",{enumerable:!0,get:function(){if(!!m.isBuffer(this))return this.buffer}});Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(!!m.isBuffer(this))return this.byteOffset}});function Ae(e){if(e>sr)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,m.prototype),t}function m(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return an(e)}return Co(e,t,r)}m.poolSize=8192;function Co(e,t,r){if(typeof e=="string")return uc(e,t);if(ArrayBuffer.isView(e))return dc(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Se(e,ArrayBuffer)||e&&Se(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Se(e,SharedArrayBuffer)||e&&Se(e.buffer,SharedArrayBuffer)))return on(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return m.from(o,t,r);var i=mc(e);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return m.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}m.from=function(e,t,r){return Co(e,t,r)};Object.setPrototypeOf(m.prototype,Uint8Array.prototype);Object.setPrototypeOf(m,Uint8Array);function No(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function pc(e,t,r){return No(e),e<=0?Ae(e):t!==void 0?typeof r=="string"?Ae(e).fill(t,r):Ae(e).fill(t):Ae(e)}m.alloc=function(e,t,r){return pc(e,t,r)};function an(e){return No(e),Ae(e<0?0:cn(e)|0)}m.allocUnsafe=function(e){return an(e)};m.allocUnsafeSlow=function(e){return an(e)};function uc(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!m.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=Ro(e,t)|0,o=Ae(r),i=o.write(e,t);return i!==r&&(o=o.slice(0,i)),o}function nn(e){for(var t=e.length<0?0:cn(e.length)|0,r=Ae(t),o=0;o<t;o+=1)r[o]=e[o]&255;return r}function dc(e){if(Se(e,Uint8Array)){var t=new Uint8Array(e);return on(t.buffer,t.byteOffset,t.byteLength)}return nn(e)}function on(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var o;return t===void 0&&r===void 0?o=new Uint8Array(e):r===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,r),Object.setPrototypeOf(o,m.prototype),o}function mc(e){if(m.isBuffer(e)){var t=cn(e.length)|0,r=Ae(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||ln(e.length)?Ae(0):nn(e);if(e.type==="Buffer"&&Array.isArray(e.data))return nn(e.data)}function cn(e){if(e>=sr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+sr.toString(16)+" bytes");return e|0}function gc(e){return+e!=e&&(e=0),m.alloc(+e)}m.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==m.prototype};m.compare=function(t,r){if(Se(t,Uint8Array)&&(t=m.from(t,t.offset,t.byteLength)),Se(r,Uint8Array)&&(r=m.from(r,r.offset,r.byteLength)),!m.isBuffer(t)||!m.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var o=t.length,i=r.length,p=0,s=Math.min(o,i);p<s;++p)if(t[p]!==r[p]){o=t[p],i=r[p];break}return o<i?-1:i<o?1:0};m.isEncoding=function(t){switch(String(t).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}};m.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return m.alloc(0);var o;if(r===void 0)for(r=0,o=0;o<t.length;++o)r+=t[o].length;var i=m.allocUnsafe(r),p=0;for(o=0;o<t.length;++o){var s=t[o];if(Se(s,Uint8Array))p+s.length>i.length?m.from(s).copy(i,p):Uint8Array.prototype.set.call(i,s,p);else if(m.isBuffer(s))s.copy(i,p);else throw new TypeError('"list" argument must be an Array of Buffers');p+=s.length}return i};function Ro(e,t){if(m.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Se(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&r===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return sn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Bo(e).length;default:if(i)return o?-1:sn(e).length;t=(""+t).toLowerCase(),i=!0}}m.byteLength=Ro;function fc(e,t,r){var o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return Ac(this,t,r);case"utf8":case"utf-8":return Oo(this,t,r);case"ascii":return bc(this,t,r);case"latin1":case"binary":return Ic(this,t,r);case"base64":return wc(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ec(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}m.prototype._isBuffer=!0;function Ye(e,t,r){var o=e[t];e[t]=e[r],e[r]=o}m.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)Ye(this,r,r+1);return this};m.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)Ye(this,r,r+3),Ye(this,r+1,r+2);return this};m.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)Ye(this,r,r+7),Ye(this,r+1,r+6),Ye(this,r+2,r+5),Ye(this,r+3,r+4);return this};m.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?Oo(this,0,t):fc.apply(this,arguments)};m.prototype.toLocaleString=m.prototype.toString;m.prototype.equals=function(t){if(!m.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:m.compare(this,t)===0};m.prototype.inspect=function(){var t="",r=at.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Lo&&(m.prototype[Lo]=m.prototype.inspect);m.prototype.compare=function(t,r,o,i,p){if(Se(t,Uint8Array)&&(t=m.from(t,t.offset,t.byteLength)),!m.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),o===void 0&&(o=t?t.length:0),i===void 0&&(i=0),p===void 0&&(p=this.length),r<0||o>t.length||i<0||p>this.length)throw new RangeError("out of range index");if(i>=p&&r>=o)return 0;if(i>=p)return-1;if(r>=o)return 1;if(r>>>=0,o>>>=0,i>>>=0,p>>>=0,this===t)return 0;for(var s=p-i,u=o-r,d=Math.min(s,u),g=this.slice(i,p),f=t.slice(r,o),T=0;T<d;++T)if(g[T]!==f[T]){s=g[T],u=f[T];break}return s<u?-1:u<s?1:0};function Mo(e,t,r,o,i){if(e.length===0)return-1;if(typeof r=="string"?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ln(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=m.from(t,o)),m.isBuffer(t))return t.length===0?-1:Do(e,t,r,o,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Do(e,[t],r,o,i);throw new TypeError("val must be string, number or Buffer")}function Do(e,t,r,o,i){var p=1,s=e.length,u=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return-1;p=2,s/=2,u/=2,r/=2}function d(y,A){return p===1?y[A]:y.readUInt16BE(A*p)}var g;if(i){var f=-1;for(g=r;g<s;g++)if(d(e,g)===d(t,f===-1?0:g-f)){if(f===-1&&(f=g),g-f+1===u)return f*p}else f!==-1&&(g-=g-f),f=-1}else for(r+u>s&&(r=s-u),g=r;g>=0;g--){for(var T=!0,h=0;h<u;h++)if(d(e,g+h)!==d(t,h)){T=!1;break}if(T)return g}return-1}m.prototype.includes=function(t,r,o){return this.indexOf(t,r,o)!==-1};m.prototype.indexOf=function(t,r,o){return Mo(this,t,r,o,!0)};m.prototype.lastIndexOf=function(t,r,o){return Mo(this,t,r,o,!1)};function Tc(e,t,r,o){r=Number(r)||0;var i=e.length-r;o?(o=Number(o),o>i&&(o=i)):o=i;var p=t.length;o>p/2&&(o=p/2);for(var s=0;s<o;++s){var u=parseInt(t.substr(s*2,2),16);if(ln(u))return s;e[r+s]=u}return s}function yc(e,t,r,o){return ar(sn(t,e.length-r),e,r,o)}function hc(e,t,r,o){return ar(Dc(t),e,r,o)}function Sc(e,t,r,o){return ar(Bo(t),e,r,o)}function xc(e,t,r,o){return ar(Pc(t,e.length-r),e,r,o)}m.prototype.write=function(t,r,o,i){if(r===void 0)i="utf8",o=this.length,r=0;else if(o===void 0&&typeof r=="string")i=r,o=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(o)?(o=o>>>0,i===void 0&&(i="utf8")):(i=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var p=this.length-r;if((o===void 0||o>p)&&(o=p),t.length>0&&(o<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return Tc(this,t,r,o);case"utf8":case"utf-8":return yc(this,t,r,o);case"ascii":case"latin1":case"binary":return hc(this,t,r,o);case"base64":return Sc(this,t,r,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xc(this,t,r,o);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wc(e,t,r){return t===0&&r===e.length?rn.fromByteArray(e):rn.fromByteArray(e.slice(t,r))}function Oo(e,t,r){r=Math.min(e.length,r);for(var o=[],i=t;i<r;){var p=e[i],s=null,u=p>239?4:p>223?3:p>191?2:1;if(i+u<=r){var d,g,f,T;switch(u){case 1:p<128&&(s=p);break;case 2:d=e[i+1],(d&192)===128&&(T=(p&31)<<6|d&63,T>127&&(s=T));break;case 3:d=e[i+1],g=e[i+2],(d&192)===128&&(g&192)===128&&(T=(p&15)<<12|(d&63)<<6|g&63,T>2047&&(T<55296||T>57343)&&(s=T));break;case 4:d=e[i+1],g=e[i+2],f=e[i+3],(d&192)===128&&(g&192)===128&&(f&192)===128&&(T=(p&15)<<18|(d&63)<<12|(g&63)<<6|f&63,T>65535&&T<1114112&&(s=T))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,o.push(s>>>10&1023|55296),s=56320|s&1023),o.push(s),i+=u}return vc(o)}var Po=4096;function vc(e){var t=e.length;if(t<=Po)return String.fromCharCode.apply(String,e);for(var r="",o=0;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=Po));return r}function bc(e,t,r){var o="";r=Math.min(e.length,r);for(var i=t;i<r;++i)o+=String.fromCharCode(e[i]&127);return o}function Ic(e,t,r){var o="";r=Math.min(e.length,r);for(var i=t;i<r;++i)o+=String.fromCharCode(e[i]);return o}function Ac(e,t,r){var o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);for(var i="",p=t;p<r;++p)i+=Cc[e[p]];return i}function Ec(e,t,r){for(var o=e.slice(t,r),i="",p=0;p<o.length-1;p+=2)i+=String.fromCharCode(o[p]+o[p+1]*256);return i}m.prototype.slice=function(t,r){var o=this.length;t=~~t,r=r===void 0?o:~~r,t<0?(t+=o,t<0&&(t=0)):t>o&&(t=o),r<0?(r+=o,r<0&&(r=0)):r>o&&(r=o),r<t&&(r=t);var i=this.subarray(t,r);return Object.setPrototypeOf(i,m.prototype),i};function Z(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||Z(t,r,this.length);for(var i=this[t],p=1,s=0;++s<r&&(p*=256);)i+=this[t+s]*p;return i};m.prototype.readUintBE=m.prototype.readUIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||Z(t,r,this.length);for(var i=this[t+--r],p=1;r>0&&(p*=256);)i+=this[t+--r]*p;return i};m.prototype.readUint8=m.prototype.readUInt8=function(t,r){return t=t>>>0,r||Z(t,1,this.length),this[t]};m.prototype.readUint16LE=m.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Z(t,2,this.length),this[t]|this[t+1]<<8};m.prototype.readUint16BE=m.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Z(t,2,this.length),this[t]<<8|this[t+1]};m.prototype.readUint32LE=m.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};m.prototype.readUint32BE=m.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Z(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};m.prototype.readIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||Z(t,r,this.length);for(var i=this[t],p=1,s=0;++s<r&&(p*=256);)i+=this[t+s]*p;return p*=128,i>=p&&(i-=Math.pow(2,8*r)),i};m.prototype.readIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||Z(t,r,this.length);for(var i=r,p=1,s=this[t+--i];i>0&&(p*=256);)s+=this[t+--i]*p;return p*=128,s>=p&&(s-=Math.pow(2,8*r)),s};m.prototype.readInt8=function(t,r){return t=t>>>0,r||Z(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};m.prototype.readInt16LE=function(t,r){t=t>>>0,r||Z(t,2,this.length);var o=this[t]|this[t+1]<<8;return o&32768?o|4294901760:o};m.prototype.readInt16BE=function(t,r){t=t>>>0,r||Z(t,2,this.length);var o=this[t+1]|this[t]<<8;return o&32768?o|4294901760:o};m.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};m.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};m.prototype.readFloatLE=function(t,r){return t=t>>>0,r||Z(t,4,this.length),st.read(this,t,!0,23,4)};m.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Z(t,4,this.length),st.read(this,t,!1,23,4)};m.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Z(t,8,this.length),st.read(this,t,!0,52,8)};m.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Z(t,8,this.length),st.read(this,t,!1,52,8)};function re(e,t,r,o,i,p){if(!m.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<p)throw new RangeError('"value" argument is out of bounds');if(r+o>e.length)throw new RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(t,r,o,i){if(t=+t,r=r>>>0,o=o>>>0,!i){var p=Math.pow(2,8*o)-1;re(this,t,r,o,p,0)}var s=1,u=0;for(this[r]=t&255;++u<o&&(s*=256);)this[r+u]=t/s&255;return r+o};m.prototype.writeUintBE=m.prototype.writeUIntBE=function(t,r,o,i){if(t=+t,r=r>>>0,o=o>>>0,!i){var p=Math.pow(2,8*o)-1;re(this,t,r,o,p,0)}var s=o-1,u=1;for(this[r+s]=t&255;--s>=0&&(u*=256);)this[r+s]=t/u&255;return r+o};m.prototype.writeUint8=m.prototype.writeUInt8=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,1,255,0),this[r]=t&255,r+1};m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};m.prototype.writeIntLE=function(t,r,o,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*o-1);re(this,t,r,o,p-1,-p)}var s=0,u=1,d=0;for(this[r]=t&255;++s<o&&(u*=256);)t<0&&d===0&&this[r+s-1]!==0&&(d=1),this[r+s]=(t/u>>0)-d&255;return r+o};m.prototype.writeIntBE=function(t,r,o,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*o-1);re(this,t,r,o,p-1,-p)}var s=o-1,u=1,d=0;for(this[r+s]=t&255;--s>=0&&(u*=256);)t<0&&d===0&&this[r+s+1]!==0&&(d=1),this[r+s]=(t/u>>0)-d&255;return r+o};m.prototype.writeInt8=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};m.prototype.writeInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};m.prototype.writeInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};m.prototype.writeInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};m.prototype.writeInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||re(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function Fo(e,t,r,o,i,p){if(r+o>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _o(e,t,r,o,i){return t=+t,r=r>>>0,i||Fo(e,t,r,4,34028234663852886e22,-34028234663852886e22),st.write(e,t,r,o,23,4),r+4}m.prototype.writeFloatLE=function(t,r,o){return _o(this,t,r,!0,o)};m.prototype.writeFloatBE=function(t,r,o){return _o(this,t,r,!1,o)};function Uo(e,t,r,o,i){return t=+t,r=r>>>0,i||Fo(e,t,r,8,17976931348623157e292,-17976931348623157e292),st.write(e,t,r,o,52,8),r+8}m.prototype.writeDoubleLE=function(t,r,o){return Uo(this,t,r,!0,o)};m.prototype.writeDoubleBE=function(t,r,o){return Uo(this,t,r,!1,o)};m.prototype.copy=function(t,r,o,i){if(!m.isBuffer(t))throw new TypeError("argument should be a Buffer");if(o||(o=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<o&&(i=o),i===o||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-o&&(i=t.length-r+o);var p=i-o;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,o,i):Uint8Array.prototype.set.call(t,this.subarray(o,i),r),p};m.prototype.fill=function(t,r,o,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,o=this.length):typeof o=="string"&&(i=o,o=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!m.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){var p=t.charCodeAt(0);(i==="utf8"&&p<128||i==="latin1")&&(t=p)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<o)throw new RangeError("Out of range index");if(o<=r)return this;r=r>>>0,o=o===void 0?this.length:o>>>0,t||(t=0);var s;if(typeof t=="number")for(s=r;s<o;++s)this[s]=t;else{var u=m.isBuffer(t)?t:m.from(t,i),d=u.length;if(d===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<o-r;++s)this[s+r]=u[s%d]}return this};var kc=/[^+/0-9A-Za-z-_]/g;function Lc(e){if(e=e.split("=")[0],e=e.trim().replace(kc,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function sn(e,t){t=t||1/0;for(var r,o=e.length,i=null,p=[],s=0;s<o;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&p.push(239,191,189);continue}else if(s+1===o){(t-=3)>-1&&p.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&p.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&p.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;p.push(r)}else if(r<2048){if((t-=2)<0)break;p.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;p.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;p.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return p}function Dc(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function Pc(e,t){for(var r,o,i,p=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),o=r>>8,i=r%256,p.push(i),p.push(o);return p}function Bo(e){return rn.toByteArray(Lc(e))}function ar(e,t,r,o){for(var i=0;i<o&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Se(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ln(e){return e!==e}var Cc=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var o=r*16,i=0;i<16;++i)t[o+i]=e[r]+e[i];return t}()});var jo=or((Xp,Ho)=>{n();var q=Ho.exports={},xe,we;function pn(){throw new Error("setTimeout has not been defined")}function un(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?xe=setTimeout:xe=pn}catch(e){xe=pn}try{typeof clearTimeout=="function"?we=clearTimeout:we=un}catch(e){we=un}})();function Go(e){if(xe===setTimeout)return setTimeout(e,0);if((xe===pn||!xe)&&setTimeout)return xe=setTimeout,setTimeout(e,0);try{return xe(e,0)}catch(t){try{return xe.call(null,e,0)}catch(r){return xe.call(this,e,0)}}}function Nc(e){if(we===clearTimeout)return clearTimeout(e);if((we===un||!we)&&clearTimeout)return we=clearTimeout,clearTimeout(e);try{return we(e)}catch(t){try{return we.call(null,e)}catch(r){return we.call(this,e)}}}var Ee=[],ct=!1,Ze,cr=-1;function Rc(){!ct||!Ze||(ct=!1,Ze.length?Ee=Ze.concat(Ee):cr=-1,Ee.length&&$o())}function $o(){if(!ct){var e=Go(Rc);ct=!0;for(var t=Ee.length;t;){for(Ze=Ee,Ee=[];++cr<t;)Ze&&Ze[cr].run();cr=-1,t=Ee.length}Ze=null,ct=!1,Nc(e)}}q.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Ee.push(new Vo(e,t)),Ee.length===1&&!ct&&Go($o)};function Vo(e,t){this.fun=e,this.array=t}Vo.prototype.run=function(){this.fun.apply(null,this.array)};q.title="browser";q.browser=!0;q.env={};q.argv=[];q.version="";q.versions={};function ke(){}q.on=ke;q.addListener=ke;q.once=ke;q.off=ke;q.removeListener=ke;q.removeAllListeners=ke;q.emit=ke;q.prependListener=ke;q.prependOnceListener=ke;q.listeners=function(e){return[]};q.binding=function(e){throw new Error("process.binding is not supported")};q.cwd=function(){return"/"};q.chdir=function(e){throw new Error("process.chdir is not supported")};q.umask=function(){return 0}});var a,c,Jp,n=k(()=>{a=O(Wo()),c=O(jo()),Jp=function(e){function t(){var o=this||self;return delete e.prototype.__magic__,o}if(typeof globalThis=="object")return globalThis;if(this)return t();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:t});var r=__magic__;return r}(Object)});var lr,dn=k(()=>{"use strict";n();lr=()=>Date.now()/1e3});var zo=k(()=>{"use strict";n()});var qo=k(()=>{"use strict";n()});var mn=k(()=>{"use strict";n();dn();zo();qo()});var fn={};qe(fn,{getItem:()=>Oc,localStorageKeys:()=>ve,removeItem:()=>Fc,setItem:()=>Mc});var ve,gn,Mc,Oc,Fc,lt=k(()=>{"use strict";n();mn();ve={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},gn=typeof localStorage!="undefined",Mc=({key:e,data:t,expires:r})=>{!gn||localStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},Oc=e=>{if(!gn)return;let t=localStorage.getItem(String(e));if(!t)return null;let r=JSON.parse(t);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:lr()>=r.expires?(localStorage.removeItem(String(e)),null):r.data},Fc=e=>{!gn||localStorage.removeItem(String(e))}});var Tn={};qe(Tn,{clear:()=>Xo,getItem:()=>Yo,removeItem:()=>Zo,setItem:()=>Ko,storage:()=>_c});var Ko,Yo,Zo,Xo,_c,Jo=k(()=>{"use strict";n();Ko=({key:e,data:t,expires:r})=>{sessionStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},Yo=e=>{let t=sessionStorage.getItem(String(e));if(!t)return null;let r=JSON.parse(t);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:Date.now()>=r.expires?(sessionStorage.removeItem(String(e)),null):r.data},Zo=e=>sessionStorage.removeItem(String(e)),Xo=()=>sessionStorage.clear(),_c={setItem:Ko,getItem:Yo,removeItem:Zo,clear:Xo}});var Le,pt=k(()=>{"use strict";n();lt();Jo();Le={session:Tn,local:fn}});function Ct(){return new Date().setHours(new Date().getHours()+24)}function Nt(e){Le.local.setItem({key:ve.loginExpiresAt,data:e,expires:e})}var yn=k(()=>{"use strict";n();pt();lt()});var z=k(()=>{"use strict";n()});var Qo,ut,ei,ti,ri,dt,mt=k(()=>{"use strict";n();Qo="error when signing",ut="Transaction canceled",ei="error signing transaction",ti="provider not initialized",ri="You need a signer/valid signer to send a transaction,use either WalletProvider, LedgerProvider or WalletConnect",dt="Action not allowed. User is logged in. Call logout() first"});var ni=k(()=>{"use strict";n()});var te=k(()=>{"use strict";n()});var oi=k(()=>{"use strict";n()});var ii=k(()=>{"use strict";n()});var si=k(()=>{"use strict";n()});var ai=k(()=>{"use strict";n()});var le=k(()=>{"use strict";n();ni();te();z();oi();ii();si();ai()});var hn,ci,Eu,li,ku,pi,Lu,Du,Pu,ui=k(()=>{"use strict";n();le();hn={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:ci,egldLabel:Eu}=hn["devnet"],{chainId:li,egldLabel:ku}=hn["testnet"],{chainId:pi,egldLabel:Lu}=hn["mainnet"],Du={["devnet"]:ci,["testnet"]:li,["mainnet"]:pi},Pu={[ci]:"devnet",[li]:"testnet",[pi]:"mainnet"}});var Sn,xn=k(()=>{"use strict";n();Sn={36864:{code:"codeSuccess",message:"Success"},27013:{code:"ERR_USER_DENIED",message:"Rejected by user"},27904:{code:"ERR_UNKNOWN_INSTRUCTION",message:"Unknown instruction"},28160:{code:"ERR_WRONG_CLA",message:"Wrong CLA"},28161:{code:"ERR_INVALID_ARGUMENTS",message:"Invalid arguments"},28162:{code:"ERR_INVALID_MESSAGE",message:"Invalid message"},28163:{code:"ERR_INVALID_P1",message:"Invalid P1"},28164:{code:"ERR_MESSAGE_TOO_LONG",message:"Message too long"},28165:{code:"ERR_RECEIVER_TOO_LONG",message:"Receiver too long"},28166:{code:"ERR_AMOUNT_TOO_LONG",message:"Amount too long"},28167:{code:"ERR_CONTRACT_DATA_DISABLED",message:"Contract data disabled in app options"},28168:{code:"ERR_MESSAGE_INCOMPLETE",message:"Message incomplete"},28176:{code:"ERR_SIGNATURE_FAILED",message:"Signature failed"},28169:{code:"ERR_WRONG_TX_VERSION",message:"Wrong TX version"},28170:{code:"ERR_NONCE_TOO_LONG",message:"Nonce too long"},28171:{code:"ERR_INVALID_AMOUNT",message:"Invalid amount"},28172:{code:"ERR_INVALID_FEE",message:"Invalid fee"},28173:{code:"ERR_PRETTY_FAILED",message:"Pretty failed"},28174:{code:"ERR_DATA_TOO_LONG",message:"Data too long"},28175:{code:"ERR_WRONG_TX_OPTIONS",message:"Invalid transaction options"},28177:{code:"ERR_SIGN_TX_DEPRECATED",message:"Regular transaction signing is deprecated in this version. Use hash signing."}}});var di=k(()=>{"use strict";n()});var gt,wn=k(()=>{"use strict";n();gt="transaction-status-toast-id"});var Rt,pr,mi,gi,fi,Mt,ur,Ti,ft,G=k(()=>{"use strict";n();mt();ui();xn();di();wn();Rt=5e4,pr=1e9,mi=1,gi=1,fi="/dapp/init",Mt="signSession",ur="logout",Ti="login",ft="0"});var vn,J,ne,oe=k(()=>{"use strict";n();vn=require("@reduxjs/toolkit");G();J=(0,vn.createAction)(ur),ne=(0,vn.createAction)(Ti,e=>({payload:e}))});var hi,yi,Si,Ku,Tt,xi,Te,dr,wi,vi,bi,bn=k(()=>{"use strict";n();hi=require("@reduxjs/toolkit");yn();z();oe();yi={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},Si=(0,hi.createSlice)({name:"loginInfoSlice",initialState:yi,reducers:{setLoginMethod:(e,t)=>{e.loginMethod=t.payload},setTokenLogin:(e,t)=>{e.tokenLogin=t.payload},setTokenLoginSignature:(e,t)=>{(e==null?void 0:e.tokenLogin)!=null&&(e.tokenLogin.signature=t.payload)},setWalletLogin:(e,t)=>{e.walletLogin=t.payload},setWalletConnectLogin:(e,t)=>{e.walletConnectLogin=t.payload},setLedgerLogin:(e,t)=>{e.ledgerLogin=t.payload},invalidateLoginSession:e=>{e.isLoginSessionInvalid=!0}},extraReducers:e=>{e.addCase(J,()=>yi),e.addCase(ne,(t,r)=>{t.loginMethod=r.payload.loginMethod,Nt(Ct())})}}),{setLoginMethod:Ku,setWalletConnectLogin:Tt,setLedgerLogin:xi,setTokenLogin:Te,setTokenLoginSignature:dr,setWalletLogin:wi,invalidateLoginSession:vi}=Si.actions,bi=Si.reducer});var Ii,Ai,yt,Ot=k(()=>{"use strict";n();Ii=!1,Ai=(e=!0)=>{Ii=e},yt=(e,t=0)=>{Ii||setTimeout(()=>{window.location.href=e},t)}});function De({callbackRoute:e,onLoginRedirect:t,options:r}){let o=Boolean(e),i=typeof t=="function",p=i?0:Uc;o&&e!=null&&setTimeout(()=>{if(i)return t(e,r);window.location.pathname.includes(e)||yt(e)},p)}var Uc,Ei=k(()=>{"use strict";n();Ot();Uc=200});function In(e){return e[Math.floor(Math.random()*e.length)]}var ki=k(()=>{"use strict";n()});function Xe(e){let t=null;if((e==null?void 0:e.statusCode)in Sn){let r=e==null?void 0:e.statusCode,{message:o}=Sn[r];t=Gc.includes(r)?Li:o}return{errorMessage:t,defaultErrorMessage:Li}}var Li,Bc,Wc,Gc,An=k(()=>{"use strict";n();xn();Li="Check if Elrond app is open on Ledger",Bc=28161,Wc=28160,Gc=[Bc,Wc]});var ht=k(()=>{"use strict";n();Ei();ki();An()});var Di,Pi,En,$c,Ci,cd,ld,Ni,kn=k(()=>{"use strict";n();Di=require("@reduxjs/toolkit"),Pi=O(require("lodash.omit"));ht();En={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},$c={network:En,chainID:"-1"},Ci=(0,Di.createSlice)({name:"appConfig",initialState:$c,reducers:{initializeNetworkConfig:(e,t)=>{let r=In(t.payload.walletConnectBridgeAddresses),o=In(t.payload.walletConnectV2RelayAddresses),i=(0,Pi.default)(t.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");e.network=N(w(w({},e.network),i),{walletConnectBridgeAddress:r,walletConnectV2RelayAddress:o})},setChainID:(e,t)=>{e.chainID=t.payload}}}),{initializeNetworkConfig:cd,setChainID:ld}=Ci.actions,Ni=Ci.reducer});var Dn,Ri,Mi,mr,Ln,Oi,gr,yd,Pn,hd,Cn,Fi,Sd,xd,wd,_i,Ui,Nn=k(()=>{"use strict";n();Dn=require("@elrondnetwork/erdjs"),Ri=require("@reduxjs/toolkit"),Mi=require("redux-persist");G();pt();lt();oe();mr={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:ft},Ln={address:"",websocketEvent:null,accounts:{"":mr},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},Oi=(0,Ri.createSlice)({name:"accountInfoSlice",initialState:Ln,reducers:{setAddress:(e,t)=>{let r=t.payload;e.address=r,e.publicKey=new Dn.Address(r).hex()},setAccount:(e,t)=>{let r=e.address===t.payload.address;e.accounts={[e.address]:r?t.payload:mr},e.isAccountLoading=!1,e.accountLoadingError=null},setAccountNonce:(e,t)=>{let{address:r}=e;e.accounts[r].nonce=t.payload},setAccountShard:(e,t)=>{e.shard=t.payload},setLedgerAccount:(e,t)=>{e.ledgerAccount=t.payload},updateLedgerAccount:(e,t)=>{e.ledgerAccount!=null&&(e.ledgerAccount.index=t.payload.index,e.ledgerAccount.address=t.payload.address)},setWalletConnectAccount:(e,t)=>{e.walletConnectAccount=t.payload},setIsAccountLoading:(e,t)=>{e.isAccountLoading=t.payload,e.accountLoadingError=null},setAccountLoadingError:(e,t)=>{e.accountLoadingError=t.payload,e.isAccountLoading=!1},setWebsocketEvent:(e,t)=>{e.websocketEvent={timestamp:Date.now(),message:t.payload}}},extraReducers:e=>{e.addCase(J,()=>(Le.local.removeItem(ve.loginExpiresAt),Ln)),e.addCase(ne,(t,r)=>{let{address:o}=r.payload;t.address=o,t.publicKey=new Dn.Address(o).hex()}),e.addCase(Mi.REHYDRATE,(t,r)=>{var g;if(!((g=r.payload)!=null&&g.account))return;let{account:o}=r.payload,{address:i,shard:p,accounts:s,publicKey:u}=o;t.address=i,t.shard=p;let d=s&&i in s;t.accounts=d?s:Ln.accounts,t.publicKey=u})}}),{setAccount:gr,setAddress:yd,setAccountNonce:Pn,setAccountShard:hd,setLedgerAccount:Cn,updateLedgerAccount:Fi,setWalletConnectAccount:Sd,setIsAccountLoading:xd,setAccountLoadingError:wd,setWebsocketEvent:_i}=Oi.actions,Ui=Oi.reducer});function be(e){return e!=null&&(Zc(e)||el(e))}function Ue(e){return e!=null&&(Xc(e)||tl(e))}function Be(e){return e!=null&&(Jc(e)||rl(e))}function fr(e){return e!=null&&Qc(e)}function Zc(e){return e!=null&&Vc.includes(e)}function Xc(e){return e!=null&&Hc.includes(e)}function Jc(e){return e!=null&&jc.includes(e)}function Qc(e){return e!=null&&zc.includes(e)}function el(e){return e!=null&&qc.includes(e)}function tl(e){return e!=null&&Kc.includes(e)}function rl(e){return e!=null&&Yc.includes(e)}var Vc,Hc,jc,zc,qc,Kc,Yc,St=k(()=>{"use strict";n();z();Vc=["sent"],Hc=["success"],jc=["fail","cancelled","timedOut"],zc=["timedOut"],qc=["pending"],Kc=["success"],Yc=["fail","invalid"]});var Bi,Wi,_t,nl,Gi,Ut,Tr,ol,We,$i,il,Pd,Vi,Qe,Pe,yr,hr=k(()=>{"use strict";n();Bi=require("@reduxjs/toolkit"),Wi=require("redux-persist");z();St();oe();_t={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},nl={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},Gi=(0,Bi.createSlice)({name:"transactionsSlice",initialState:_t,reducers:{moveTransactionsToSignedState:(e,t)=>{var d,g;let{sessionId:r,transactions:o,errorMessage:i,status:p,redirectRoute:s}=t.payload,u=((d=e.customTransactionInformationForSessionId)==null?void 0:d[r])||nl;e.signedTransactions[r]={transactions:o,status:p,errorMessage:i,redirectRoute:s,customTransactionInformation:u},((g=e==null?void 0:e.transactionsToSign)==null?void 0:g.sessionId)===r&&(e.transactionsToSign=_t.transactionsToSign)},clearSignedTransaction:(e,t)=>{e.signedTransactions[t.payload]&&delete e.signedTransactions[t.payload]},clearTransactionToSign:e=>{e!=null&&e.transactionsToSign&&(e.transactionsToSign=null)},updateSignedTransaction:(e,t)=>{e.signedTransactions=w(w({},e.signedTransactions),t.payload)},updateSignedTransactions:(e,t)=>{let{sessionId:r,status:o,errorMessage:i,transactions:p}=t.payload;e.signedTransactions[r]!=null&&(e.signedTransactions[r].status=o,i!=null&&(e.signedTransactions[r].errorMessage=i),p!=null&&(e.signedTransactions[r].transactions=p))},updateSignedTransactionStatus:(e,t)=>{var u,d,g,f,T,h;let{sessionId:r,status:o,errorMessage:i,transactionHash:p}=t.payload,s=(d=(u=e.signedTransactions)==null?void 0:u[r])==null?void 0:d.transactions;if(s!=null){e.signedTransactions[r].transactions=s.map(M=>M.hash===p?N(w({},M),{status:o,errorMessage:i}):M);let y=(f=(g=e.signedTransactions[r])==null?void 0:g.transactions)==null?void 0:f.every(M=>Ue(M.status)),A=(h=(T=e.signedTransactions[r])==null?void 0:T.transactions)==null?void 0:h.every(M=>Be(M.status));y&&(e.signedTransactions[r].status="success"),A&&(e.signedTransactions[r].status="fail")}},setTransactionsToSign:(e,t)=>{e.transactionsToSign=t.payload;let{sessionId:r,customTransactionInformation:o}=t.payload;e.customTransactionInformationForSessionId[r]=o,e.signTransactionsError=null},clearAllTransactionsToSign:e=>{e.transactionsToSign=_t.transactionsToSign,e.signTransactionsError=null},clearAllSignedTransactions:e=>{e.signedTransactions=_t.signedTransactions},setSignTransactionsError:(e,t)=>{e.signTransactionsError=t.payload},setSignTransactionsCancelMessage:(e,t)=>{e.signTransactionsCancelMessage=t.payload}},extraReducers:e=>{e.addCase(J,()=>_t),e.addCase(Wi.REHYDRATE,(t,r)=>{var s;if(t.signTransactionsCancelMessage=null,!((s=r.payload)!=null&&s.transactions))return;let{signedTransactions:o,customTransactionInformationForSessionId:i}=r.payload.transactions,p=Object.entries(o).reduce((u,[d,g])=>{let f=new Date(d),T=new Date;return T.setHours(T.getHours()+5),T-f>0||(u[d]=g),u},{});i!=null&&(t.customTransactionInformationForSessionId=i),o!=null&&(t.signedTransactions=p)})}}),{updateSignedTransactionStatus:Ut,updateSignedTransactions:Tr,setTransactionsToSign:ol,clearAllTransactionsToSign:We,clearAllSignedTransactions:$i,clearSignedTransaction:il,clearTransactionToSign:Pd,setSignTransactionsError:Vi,setSignTransactionsCancelMessage:Qe,moveTransactionsToSignedState:Pe}=Gi.actions,yr=Gi.reducer});var Hi,Mn,On,Fn,sl,Rn,ji,Md,al,xt,Sr,xr=k(()=>{"use strict";n();Hi=require("@reduxjs/toolkit");oe();Mn="Transaction failed",On="Transaction successful",Fn="Processing transaction",sl="Transaction submitted",Rn={},ji=(0,Hi.createSlice)({name:"transactionsInfo",initialState:Rn,reducers:{setTransactionsDisplayInfo(e,t){let{sessionId:r,transactionsDisplayInfo:o}=t.payload;r!=null&&(e[r]={errorMessage:(o==null?void 0:o.errorMessage)||Mn,successMessage:(o==null?void 0:o.successMessage)||On,processingMessage:(o==null?void 0:o.processingMessage)||Fn,submittedMessage:(o==null?void 0:o.submittedMessage)||sl,transactionDuration:o==null?void 0:o.transactionDuration})},clearTransactionsInfoForSessionId(e,t){t.payload!=null&&delete e[t.payload]},clearTransactionsInfo:()=>Rn},extraReducers:e=>{e.addCase(J,()=>Rn)}}),{clearTransactionsInfo:Md,setTransactionsDisplayInfo:al,clearTransactionsInfoForSessionId:xt}=ji.actions,Sr=ji.reducer});var qi,zi,Ki,Ud,cl,Bd,Yi,Zi,_n=k(()=>{"use strict";n();qi=require("@reduxjs/toolkit");oe();zi={},Ki=(0,qi.createSlice)({name:"modalsSlice",initialState:zi,reducers:{setTxSubmittedModal:(e,t)=>{e.txSubmittedModal=t.payload},setNotificationModal:(e,t)=>{e.notificationModal=t.payload},clearTxSubmittedModal:e=>{e.txSubmittedModal=void 0},clearNotificationModal:e=>{e.notificationModal=void 0}},extraReducers:e=>{e.addCase(J,()=>zi)}}),{setTxSubmittedModal:Ud,setNotificationModal:cl,clearTxSubmittedModal:Bd,clearNotificationModal:Yi}=Ki.actions,Zi=Ki.reducer});var Ji,Qi,Xi,es,ll,Bt,qd,Kd,Yd,Zd,wr,vr=k(()=>{"use strict";n();Ji=require("@reduxjs/toolkit"),Qi=require("redux-persist");wn();le();dn();oe();Xi={customToasts:[],transactionToasts:[],failTransactionToast:null},es=(0,Ji.createSlice)({name:"toastsSlice",initialState:Xi,reducers:{addCustomToast:(e,t)=>{e.customToasts.push(N(w({},t.payload),{type:"custom",toastId:t.payload.toastId||`custom-toast-${e.customToasts.length+1}`}))},removeCustomToast:(e,t)=>{e.customToasts=e.customToasts.filter(r=>r.toastId!==t.payload)},addTransactionToast:(e,t)=>{e.transactionToasts.push({type:"transaction",startTimestamp:lr(),toastId:t.payload||`custom-toast-${e.transactionToasts.length+1}`})},removeTransactionToast:(e,t)=>{e.transactionToasts=e.transactionToasts.filter(r=>r.toastId!==t.payload)},addFailTransactionToast:(e,t)=>{e.failTransactionToast=N(w({},t.payload),{toastId:gt})},removeFailTransactionToast:e=>{e.failTransactionToast=null}},extraReducers:e=>{e.addCase(J,()=>Xi),e.addCase(Qi.REHYDRATE,(t,r)=>{var i,p;let o=(p=(i=r.customToasts)==null?void 0:i.filter(s=>!("component"in s)))!=null?p:[];t.customToasts=o})}}),{addCustomToast:ll,removeCustomToast:Bt,addTransactionToast:qd,removeTransactionToast:Kd,addFailTransactionToast:Yd,removeFailTransactionToast:Zd}=es.actions,wr=es.reducer});var $=k(()=>{"use strict";n();bn();kn();Nn();hr();xr();_n();vr()});var Un=k(()=>{"use strict";n()});var os,ns,is,Tm,ym,hm,Sm,xm,wm,ss,as=k(()=>{"use strict";n();os=require("@reduxjs/toolkit");oe();ns={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},is=(0,os.createSlice)({name:"dappModalsSlice",initialState:ns,reducers:{setDappModalVisibility:(e,t)=>{e.visible=t.payload},setDappModalHeaderVisibility:(e,t)=>{e.modal.showHeader=t.payload},setDappModalFooterVisibility:(e,t)=>{e.modal.showFooter=t.payload},setDappModalHeaderText:(e,t)=>{e.modal.headerText=t.payload},setDappModalFooterText:(e,t)=>{e.modal.footerText=t.payload},setDappModalConfig:(e,t)=>{e.modal=w({},t.payload)}},extraReducers:e=>{e.addCase(J,()=>ns)}}),{setDappModalVisibility:Tm,setDappModalHeaderVisibility:ym,setDappModalFooterVisibility:hm,setDappModalHeaderText:Sm,setDappModalFooterText:xm,setDappModalConfig:wm}=is.actions,ss=is.reducer});var cs,ml,gl,wt,Ir=k(()=>{"use strict";n();cs=require("@reduxjs/toolkit");Un();Nn();as();bn();_n();kn();vr();xr();hr();ml={["account"]:Ui,["networkConfig"]:Ni,["loginInfo"]:bi,["modals"]:Zi,["dappModal"]:ss,["toasts"]:wr,["transactions"]:yr,["transactionsInfo"]:Sr},gl=(e={})=>(0,cs.combineReducers)(w(w({},ml),e)),wt=gl});var us={};qe(us,{default:()=>wl});function Bn(e,t=[]){return{key:e,version:1,storage:ps.default,blacklist:t}}var et,ls,ps,fl,Tl,yl,hl,Sl,xl,wl,ds=k(()=>{"use strict";n();et=require("redux-persist"),ls=O(require("redux-persist/lib/storage")),ps=O(require("redux-persist/lib/storage/session"));Ir();$();vr();xr();hr();Un();fl={2:e=>N(w({},e),{networkConfig:En})};Tl=Bn("dapp-core-transactionsInfo"),yl=Bn("dapp-core-transactions",["transactionsToSign"]),hl=Bn("dapp-core-toasts"),Sl={key:"dapp-core-store",version:2,storage:ls.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,et.createMigrate)(fl,{debug:!1})},xl={["toasts"]:(0,et.persistReducer)(hl,wr),["transactions"]:(0,et.persistReducer)(yl,yr),["transactionsInfo"]:(0,et.persistReducer)(Tl,Sr)},wl=(0,et.persistReducer)(Sl,wt(xl))});var ms={};qe(ms,{default:()=>vl});var vl,gs=k(()=>{"use strict";n();Ir();vl=wt()});var fs={};qe(fs,{default:()=>Il});var ge,bl,Il,Ts=k(()=>{"use strict";n();ge=require("redux-persist"),bl=[ge.FLUSH,ge.REHYDRATE,ge.PAUSE,ge.PERSIST,ge.PURGE,ge.REGISTER],Il=bl});var Ss={};qe(Ss,{default:()=>hs});function hs(e){return(0,ys.persistStore)(e)}var ys,xs=k(()=>{"use strict";n();ys=require("redux-persist")});var zp={};qe(zp,{useCheckTransactionStatus:()=>kp,useDebounce:()=>_p,useExtensionLogin:()=>Fa,useGetAccount:()=>Kt,useGetAccountInfo:()=>so,useGetAccountProvider:()=>Oe,useGetActiveTransactionsStatus:()=>Fp,useGetFailedTransactions:()=>Mp,useGetIsLoggedIn:()=>gp,useGetLoginInfo:()=>mp,useGetNetworkConfig:()=>Ht,useGetNotification:()=>ap,useGetPendingTransactions:()=>go,useGetSignTransactionsError:()=>xp,useGetSignedTransactions:()=>lo,useGetSuccessfulTransactions:()=>Op,useGetTokenDetails:()=>hp,useGetTransactionDisplayInfo:()=>cp,useGetWebsocketEvent:()=>fp,useGetWebsocketUrl:()=>Bp,useIsDappModalVisible:()=>jp,useLedgerLogin:()=>Ua,useParseMultiEsdtTransferData:()=>po,useParseSignedTransactions:()=>jt,useRegisterWebsocketListener:()=>Hp,useSignMultipleTransactions:()=>uo,useSignTransactions:()=>Tp,useSignTransactionsCommonData:()=>Yt,useSignTransactionsWithDevice:()=>mo,useSignTransactionsWithLedger:()=>Sp,useTrackTransactionStatus:()=>Rp,useUpdateEffect:()=>rt,useWalletConnectLogin:()=>Wa,useWalletConnectV2Login:()=>$a,useWebWalletLogin:()=>_a});module.exports=Pt(zp);n();n();n();var Es=require("react"),vt=require("react-redux");n();var Wn=require("@reduxjs/toolkit"),Is=require("react-redux/es/utils/Subscription");$();n();var ts=O(require("lodash.throttle"));G();$();yn();pt();lt();var pl=[ur],ul=(0,ts.default)(()=>{Nt(Ct())},5e3),rs=e=>t=>r=>{var d;if(pl.includes(r.type))return t(r);let o=e.getState(),i=Le.local.getItem(ve.loginExpiresAt);if(!((d=o==null?void 0:o.loginInfo)==null?void 0:d.isLoggedIn))return t(r);if(i==null)return Nt(Ct());let s=Date.now();return i-s<0?setTimeout(()=>S(void 0,null,function*(){console.log("session expired");try{e.dispatch(vi())}catch(g){console.error("error logging out",g)}}),1e3):(ul(),t(r))};n();n();function br(){return typeof sessionStorage!="undefined"}var ws=br()?(ds(),Pt(us)).default:(gs(),Pt(ms)).default,vs=br()?(Ts(),Pt(fs)).default:[],bs=br()?(xs(),Pt(Ss)).default:e=>e;Ir();var L=(0,Wn.configureStore)({reducer:ws,middleware:e=>e({serializableCheck:{ignoredActions:[...vs,Pn.type,gr.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(rs)}),As=(0,Is.createSubscription)(L),zm=bs(L),qm=(0,Wn.configureStore)({reducer:wt});var Al={store:L,subscription:As},Gn=(0,Es.createContext)(Al),Xm=(0,vt.createStoreHook)(Gn),H=(0,vt.createDispatchHook)(Gn),v=(0,vt.createSelectorHook)(Gn);n();n();$();n();var ks=O(require("lodash.isequal")),Ar=require("reselect"),b=(0,Ar.createSelectorCreator)(Ar.defaultMemoize,ks.default);var Ce=e=>e.account,Ge=b(Ce,e=>e.address),bt=b(Ce,Ge,(e,t)=>t in e.accounts?e.accounts[t]:mr),Ls=b(Ce,bt,(e,t)=>{let i=e,{accounts:r}=i,o=nr(i,["acc