UNPKG

@sofaws/dapp-core

Version:

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

1 lines 73.8 kB
"use strict";var Ha=Object.create;var nt=Object.defineProperty,ja=Object.defineProperties,qa=Object.getOwnPropertyDescriptor,za=Object.getOwnPropertyDescriptors,Ka=Object.getOwnPropertyNames,kt=Object.getOwnPropertySymbols,Ya=Object.getPrototypeOf,wr=Object.prototype.hasOwnProperty,Gn=Object.prototype.propertyIsEnumerable;var $n=(e,t,r)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))wr.call(t,r)&&$n(e,r,t[r]);if(kt)for(var r of kt(t))Gn.call(t,r)&&$n(e,r,t[r]);return e},k=(e,t)=>ja(e,za(t));var Dt=(e,t)=>{var r={};for(var o in e)wr.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&kt)for(var o of kt(e))t.indexOf(o)<0&&Gn.call(e,o)&&(r[o]=e[o]);return r};var w=(e,t)=>()=>(e&&(t=e(e=0)),t);var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),be=(e,t)=>{for(var r in t)nt(e,r,{get:t[r],enumerable:!0})},Vn=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ka(t))!wr.call(e,i)&&i!==r&&nt(e,i,{get:()=>t[i],enumerable:!(o=qa(t,i))||o.enumerable});return e};var E=(e,t,r)=>(r=e!=null?Ha(Ya(e)):{},Vn(t||!e||!e.__esModule?nt(r,"default",{value:e,enumerable:!0}):r,e)),ot=e=>Vn(nt({},"__esModule",{value:!0}),e);var b=(e,t,r)=>new Promise((o,i)=>{var p=m=>{try{d(r.next(m))}catch(g){i(g)}},l=m=>{try{d(r.throw(m))}catch(g){i(g)}},d=m=>m.done?o(m.value):Promise.resolve(m.value).then(p,l);d((r=r.apply(e,t)).next())});var jn=Pt(Lt=>{"use strict";n();Lt.byteLength=Xa;Lt.toByteArray=Qa;Lt.fromByteArray=rs;var J=[],K=[],Za=typeof Uint8Array!="undefined"?Uint8Array:Array,vr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ae=0,Wn=vr.length;Ae<Wn;++Ae)J[Ae]=vr[Ae],K[vr.charCodeAt(Ae)]=Ae;var Ae,Wn;K["-".charCodeAt(0)]=62;K["_".charCodeAt(0)]=63;function Hn(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 Xa(e){var t=Hn(e),r=t[0],o=t[1];return(r+o)*3/4-o}function Ja(e,t,r){return(t+r)*3/4-r}function Qa(e){var t,r=Hn(e),o=r[0],i=r[1],p=new Za(Ja(e,o,i)),l=0,d=i>0?o-4:o,m;for(m=0;m<d;m+=4)t=K[e.charCodeAt(m)]<<18|K[e.charCodeAt(m+1)]<<12|K[e.charCodeAt(m+2)]<<6|K[e.charCodeAt(m+3)],p[l++]=t>>16&255,p[l++]=t>>8&255,p[l++]=t&255;return i===2&&(t=K[e.charCodeAt(m)]<<2|K[e.charCodeAt(m+1)]>>4,p[l++]=t&255),i===1&&(t=K[e.charCodeAt(m)]<<10|K[e.charCodeAt(m+1)]<<4|K[e.charCodeAt(m+2)]>>2,p[l++]=t>>8&255,p[l++]=t&255),p}function es(e){return J[e>>18&63]+J[e>>12&63]+J[e>>6&63]+J[e&63]}function ts(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(es(o));return i.join("")}function rs(e){for(var t,r=e.length,o=r%3,i=[],p=16383,l=0,d=r-o;l<d;l+=p)i.push(ts(e,l,l+p>d?d:l+p));return o===1?(t=e[r-1],i.push(J[t>>2]+J[t<<4&63]+"==")):o===2&&(t=(e[r-2]<<8)+e[r-1],i.push(J[t>>10]+J[t>>4&63]+J[t<<2&63]+"=")),i.join("")}});var qn=Pt(br=>{n();br.read=function(e,t,r,o,i){var p,l,d=i*8-o-1,m=(1<<d)-1,g=m>>1,T=-7,f=r?i-1:0,S=r?-1:1,y=e[t+f];for(f+=S,p=y&(1<<-T)-1,y>>=-T,T+=d;T>0;p=p*256+e[t+f],f+=S,T-=8);for(l=p&(1<<-T)-1,p>>=-T,T+=o;T>0;l=l*256+e[t+f],f+=S,T-=8);if(p===0)p=1-g;else{if(p===m)return l?NaN:(y?-1:1)*(1/0);l=l+Math.pow(2,o),p=p-g}return(y?-1:1)*l*Math.pow(2,p-o)};br.write=function(e,t,r,o,i,p){var l,d,m,g=p*8-i-1,T=(1<<g)-1,f=T>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=o?0:p-1,D=o?1:-1,N=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(d=isNaN(t)?1:0,l=T):(l=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-l))<1&&(l--,m*=2),l+f>=1?t+=S/m:t+=S*Math.pow(2,1-f),t*m>=2&&(l++,m/=2),l+f>=T?(d=0,l=T):l+f>=1?(d=(t*m-1)*Math.pow(2,i),l=l+f):(d=t*Math.pow(2,f-1)*Math.pow(2,i),l=0));i>=8;e[r+y]=d&255,y+=D,d/=256,i-=8);for(l=l<<i|d,g+=i;g>0;e[r+y]=l&255,y+=D,l/=256,g-=8);e[r+y-D]|=N*128}});var io=Pt(Oe=>{"use strict";n();var Ar=jn(),_e=qn(),zn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=u;Oe.SlowBuffer=cs;Oe.INSPECT_MAX_BYTES=50;var Nt=2147483647;Oe.kMaxLength=Nt;u.TYPED_ARRAY_SUPPORT=ns();!u.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ns(){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(u.prototype,"parent",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.buffer}});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.byteOffset}});function le(e){if(e>Nt)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(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 Dr(e)}return Zn(e,t,r)}u.poolSize=8192;function Zn(e,t,r){if(typeof e=="string")return is(e,t);if(ArrayBuffer.isView(e))return as(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(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return Er(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 u.from(o,t,r);var i=ss(e);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return u.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)}u.from=function(e,t,r){return Zn(e,t,r)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function Xn(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 os(e,t,r){return Xn(e),e<=0?le(e):t!==void 0?typeof r=="string"?le(e).fill(t,r):le(e).fill(t):le(e)}u.alloc=function(e,t,r){return os(e,t,r)};function Dr(e){return Xn(e),le(e<0?0:Pr(e)|0)}u.allocUnsafe=function(e){return Dr(e)};u.allocUnsafeSlow=function(e){return Dr(e)};function is(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=Jn(e,t)|0,o=le(r),i=o.write(e,t);return i!==r&&(o=o.slice(0,i)),o}function Ir(e){for(var t=e.length<0?0:Pr(e.length)|0,r=le(t),o=0;o<t;o+=1)r[o]=e[o]&255;return r}function as(e){if(Q(e,Uint8Array)){var t=new Uint8Array(e);return Er(t.buffer,t.byteOffset,t.byteLength)}return Ir(e)}function Er(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,u.prototype),o}function ss(e){if(u.isBuffer(e)){var t=Pr(e.length)|0,r=le(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||Lr(e.length)?le(0):Ir(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Ir(e.data)}function Pr(e){if(e>=Nt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Nt.toString(16)+" bytes");return e|0}function cs(e){return+e!=e&&(e=0),u.alloc(+e)}u.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==u.prototype};u.compare=function(t,r){if(Q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),Q(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(t)||!u.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,l=Math.min(o,i);p<l;++p)if(t[p]!==r[p]){o=t[p],i=r[p];break}return o<i?-1:i<o?1:0};u.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}};u.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return u.alloc(0);var o;if(r===void 0)for(r=0,o=0;o<t.length;++o)r+=t[o].length;var i=u.allocUnsafe(r),p=0;for(o=0;o<t.length;++o){var l=t[o];if(Q(l,Uint8Array))p+l.length>i.length?u.from(l).copy(i,p):Uint8Array.prototype.set.call(i,l,p);else if(u.isBuffer(l))l.copy(i,p);else throw new TypeError('"list" argument must be an Array of Buffers');p+=l.length}return i};function Jn(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(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 kr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oo(e).length;default:if(i)return o?-1:kr(e).length;t=(""+t).toLowerCase(),i=!0}}u.byteLength=Jn;function ls(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 Ss(this,t,r);case"utf8":case"utf-8":return eo(this,t,r);case"ascii":return ys(this,t,r);case"latin1":case"binary":return hs(this,t,r);case"base64":return fs(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xs(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}u.prototype._isBuffer=!0;function Ie(e,t,r){var o=e[t];e[t]=e[r],e[r]=o}u.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)Ie(this,r,r+1);return this};u.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)Ie(this,r,r+3),Ie(this,r+1,r+2);return this};u.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)Ie(this,r,r+7),Ie(this,r+1,r+6),Ie(this,r+2,r+5),Ie(this,r+3,r+4);return this};u.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?eo(this,0,t):ls.apply(this,arguments)};u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:u.compare(this,t)===0};u.prototype.inspect=function(){var t="",r=Oe.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};zn&&(u.prototype[zn]=u.prototype.inspect);u.prototype.compare=function(t,r,o,i,p){if(Q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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 l=p-i,d=o-r,m=Math.min(l,d),g=this.slice(i,p),T=t.slice(r,o),f=0;f<m;++f)if(g[f]!==T[f]){l=g[f],d=T[f];break}return l<d?-1:d<l?1:0};function Qn(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,Lr(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=u.from(t,o)),u.isBuffer(t))return t.length===0?-1:Kn(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):Kn(e,[t],r,o,i);throw new TypeError("val must be string, number or Buffer")}function Kn(e,t,r,o,i){var p=1,l=e.length,d=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,l/=2,d/=2,r/=2}function m(y,D){return p===1?y[D]:y.readUInt16BE(D*p)}var g;if(i){var T=-1;for(g=r;g<l;g++)if(m(e,g)===m(t,T===-1?0:g-T)){if(T===-1&&(T=g),g-T+1===d)return T*p}else T!==-1&&(g-=g-T),T=-1}else for(r+d>l&&(r=l-d),g=r;g>=0;g--){for(var f=!0,S=0;S<d;S++)if(m(e,g+S)!==m(t,S)){f=!1;break}if(f)return g}return-1}u.prototype.includes=function(t,r,o){return this.indexOf(t,r,o)!==-1};u.prototype.indexOf=function(t,r,o){return Qn(this,t,r,o,!0)};u.prototype.lastIndexOf=function(t,r,o){return Qn(this,t,r,o,!1)};function ps(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 l=0;l<o;++l){var d=parseInt(t.substr(l*2,2),16);if(Lr(d))return l;e[r+l]=d}return l}function us(e,t,r,o){return Ct(kr(t,e.length-r),e,r,o)}function ds(e,t,r,o){return Ct(bs(t),e,r,o)}function ms(e,t,r,o){return Ct(oo(t),e,r,o)}function gs(e,t,r,o){return Ct(As(t,e.length-r),e,r,o)}u.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 l=!1;;)switch(i){case"hex":return ps(this,t,r,o);case"utf8":case"utf-8":return us(this,t,r,o);case"ascii":case"latin1":case"binary":return ds(this,t,r,o);case"base64":return ms(this,t,r,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gs(this,t,r,o);default:if(l)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),l=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fs(e,t,r){return t===0&&r===e.length?Ar.fromByteArray(e):Ar.fromByteArray(e.slice(t,r))}function eo(e,t,r){r=Math.min(e.length,r);for(var o=[],i=t;i<r;){var p=e[i],l=null,d=p>239?4:p>223?3:p>191?2:1;if(i+d<=r){var m,g,T,f;switch(d){case 1:p<128&&(l=p);break;case 2:m=e[i+1],(m&192)===128&&(f=(p&31)<<6|m&63,f>127&&(l=f));break;case 3:m=e[i+1],g=e[i+2],(m&192)===128&&(g&192)===128&&(f=(p&15)<<12|(m&63)<<6|g&63,f>2047&&(f<55296||f>57343)&&(l=f));break;case 4:m=e[i+1],g=e[i+2],T=e[i+3],(m&192)===128&&(g&192)===128&&(T&192)===128&&(f=(p&15)<<18|(m&63)<<12|(g&63)<<6|T&63,f>65535&&f<1114112&&(l=f))}}l===null?(l=65533,d=1):l>65535&&(l-=65536,o.push(l>>>10&1023|55296),l=56320|l&1023),o.push(l),i+=d}return Ts(o)}var Yn=4096;function Ts(e){var t=e.length;if(t<=Yn)return String.fromCharCode.apply(String,e);for(var r="",o=0;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=Yn));return r}function ys(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 hs(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 Ss(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+=Is[e[p]];return i}function xs(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}u.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,u.prototype),i};function O(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")}u.prototype.readUintLE=u.prototype.readUIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||O(t,r,this.length);for(var i=this[t],p=1,l=0;++l<r&&(p*=256);)i+=this[t+l]*p;return i};u.prototype.readUintBE=u.prototype.readUIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||O(t,r,this.length);for(var i=this[t+--r],p=1;r>0&&(p*=256);)i+=this[t+--r]*p;return i};u.prototype.readUint8=u.prototype.readUInt8=function(t,r){return t=t>>>0,r||O(t,1,this.length),this[t]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||O(t,2,this.length),this[t]|this[t+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||O(t,2,this.length),this[t]<<8|this[t+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||O(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};u.prototype.readIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||O(t,r,this.length);for(var i=this[t],p=1,l=0;++l<r&&(p*=256);)i+=this[t+l]*p;return p*=128,i>=p&&(i-=Math.pow(2,8*r)),i};u.prototype.readIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||O(t,r,this.length);for(var i=r,p=1,l=this[t+--i];i>0&&(p*=256);)l+=this[t+--i]*p;return p*=128,l>=p&&(l-=Math.pow(2,8*r)),l};u.prototype.readInt8=function(t,r){return t=t>>>0,r||O(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};u.prototype.readInt16LE=function(t,r){t=t>>>0,r||O(t,2,this.length);var o=this[t]|this[t+1]<<8;return o&32768?o|4294901760:o};u.prototype.readInt16BE=function(t,r){t=t>>>0,r||O(t,2,this.length);var o=this[t+1]|this[t]<<8;return o&32768?o|4294901760:o};u.prototype.readInt32LE=function(t,r){return t=t>>>0,r||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};u.prototype.readInt32BE=function(t,r){return t=t>>>0,r||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};u.prototype.readFloatLE=function(t,r){return t=t>>>0,r||O(t,4,this.length),_e.read(this,t,!0,23,4)};u.prototype.readFloatBE=function(t,r){return t=t>>>0,r||O(t,4,this.length),_e.read(this,t,!1,23,4)};u.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||O(t,8,this.length),_e.read(this,t,!0,52,8)};u.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||O(t,8,this.length),_e.read(this,t,!1,52,8)};function H(e,t,r,o,i,p){if(!u.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")}u.prototype.writeUintLE=u.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;H(this,t,r,o,p,0)}var l=1,d=0;for(this[r]=t&255;++d<o&&(l*=256);)this[r+d]=t/l&255;return r+o};u.prototype.writeUintBE=u.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;H(this,t,r,o,p,0)}var l=o-1,d=1;for(this[r+l]=t&255;--l>=0&&(d*=256);)this[r+l]=t/d&255;return r+o};u.prototype.writeUint8=u.prototype.writeUInt8=function(t,r,o){return t=+t,r=r>>>0,o||H(this,t,r,1,255,0),this[r]=t&255,r+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||H(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||H(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||H(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};u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||H(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};u.prototype.writeIntLE=function(t,r,o,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*o-1);H(this,t,r,o,p-1,-p)}var l=0,d=1,m=0;for(this[r]=t&255;++l<o&&(d*=256);)t<0&&m===0&&this[r+l-1]!==0&&(m=1),this[r+l]=(t/d>>0)-m&255;return r+o};u.prototype.writeIntBE=function(t,r,o,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*o-1);H(this,t,r,o,p-1,-p)}var l=o-1,d=1,m=0;for(this[r+l]=t&255;--l>=0&&(d*=256);)t<0&&m===0&&this[r+l+1]!==0&&(m=1),this[r+l]=(t/d>>0)-m&255;return r+o};u.prototype.writeInt8=function(t,r,o){return t=+t,r=r>>>0,o||H(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};u.prototype.writeInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||H(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};u.prototype.writeInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||H(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};u.prototype.writeInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||H(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};u.prototype.writeInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||H(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 to(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 ro(e,t,r,o,i){return t=+t,r=r>>>0,i||to(e,t,r,4,34028234663852886e22,-34028234663852886e22),_e.write(e,t,r,o,23,4),r+4}u.prototype.writeFloatLE=function(t,r,o){return ro(this,t,r,!0,o)};u.prototype.writeFloatBE=function(t,r,o){return ro(this,t,r,!1,o)};function no(e,t,r,o,i){return t=+t,r=r>>>0,i||to(e,t,r,8,17976931348623157e292,-17976931348623157e292),_e.write(e,t,r,o,52,8),r+8}u.prototype.writeDoubleLE=function(t,r,o){return no(this,t,r,!0,o)};u.prototype.writeDoubleBE=function(t,r,o){return no(this,t,r,!1,o)};u.prototype.copy=function(t,r,o,i){if(!u.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};u.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"&&!u.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 l;if(typeof t=="number")for(l=r;l<o;++l)this[l]=t;else{var d=u.isBuffer(t)?t:u.from(t,i),m=d.length;if(m===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(l=0;l<o-r;++l)this[l+r]=d[l%m]}return this};var ws=/[^+/0-9A-Za-z-_]/g;function vs(e){if(e=e.split("=")[0],e=e.trim().replace(ws,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function kr(e,t){t=t||1/0;for(var r,o=e.length,i=null,p=[],l=0;l<o;++l){if(r=e.charCodeAt(l),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&p.push(239,191,189);continue}else if(l+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 bs(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function As(e,t){for(var r,o,i,p=[],l=0;l<e.length&&!((t-=2)<0);++l)r=e.charCodeAt(l),o=r>>8,i=r%256,p.push(i),p.push(o);return p}function oo(e){return Ar.toByteArray(vs(e))}function Ct(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 Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Lr(e){return e!==e}var Is=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 po=Pt((Rl,lo)=>{n();var C=lo.exports={},ee,te;function Nr(){throw new Error("setTimeout has not been defined")}function Cr(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ee=setTimeout:ee=Nr}catch(e){ee=Nr}try{typeof clearTimeout=="function"?te=clearTimeout:te=Cr}catch(e){te=Cr}})();function ao(e){if(ee===setTimeout)return setTimeout(e,0);if((ee===Nr||!ee)&&setTimeout)return ee=setTimeout,setTimeout(e,0);try{return ee(e,0)}catch(t){try{return ee.call(null,e,0)}catch(r){return ee.call(this,e,0)}}}function Es(e){if(te===clearTimeout)return clearTimeout(e);if((te===Cr||!te)&&clearTimeout)return te=clearTimeout,clearTimeout(e);try{return te(e)}catch(t){try{return te.call(null,e)}catch(r){return te.call(this,e)}}}var pe=[],Be=!1,Ee,Rt=-1;function ks(){!Be||!Ee||(Be=!1,Ee.length?pe=Ee.concat(pe):Rt=-1,pe.length&&so())}function so(){if(!Be){var e=ao(ks);Be=!0;for(var t=pe.length;t;){for(Ee=pe,pe=[];++Rt<t;)Ee&&Ee[Rt].run();Rt=-1,t=pe.length}Ee=null,Be=!1,Es(e)}}C.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];pe.push(new co(e,t)),pe.length===1&&!Be&&ao(so)};function co(e,t){this.fun=e,this.array=t}co.prototype.run=function(){this.fun.apply(null,this.array)};C.title="browser";C.browser=!0;C.env={};C.argv=[];C.version="";C.versions={};function ue(){}C.on=ue;C.addListener=ue;C.once=ue;C.off=ue;C.removeListener=ue;C.removeAllListeners=ue;C.emit=ue;C.prependListener=ue;C.prependOnceListener=ue;C.listeners=function(e){return[]};C.binding=function(e){throw new Error("process.binding is not supported")};C.cwd=function(){return"/"};C.chdir=function(e){throw new Error("process.chdir is not supported")};C.umask=function(){return 0}});var a,s,Ml,n=w(()=>{a=E(io()),s=E(po()),Ml=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 Mt,Rr=w(()=>{"use strict";n();Mt=()=>Date.now()/1e3});var uo=w(()=>{"use strict";n()});var mo=w(()=>{"use strict";n()});var Mr=w(()=>{"use strict";n();Rr();uo();mo()});var _r={};be(_r,{getItem:()=>Ps,localStorageKeys:()=>Te,removeItem:()=>Ls,setItem:()=>Ds});var Te,Fr,Ds,Ps,Ls,Ue=w(()=>{"use strict";n();Mr();Te={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},Fr=typeof localStorage!="undefined",Ds=({key:e,data:t,expires:r})=>{!Fr||localStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},Ps=e=>{if(!Fr)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:Mt()>=r.expires?(localStorage.removeItem(String(e)),null):r.data},Ls=e=>{!Fr||localStorage.removeItem(String(e))}});var Or={};be(Or,{clear:()=>yo,getItem:()=>fo,removeItem:()=>To,setItem:()=>go,storage:()=>Ns});var go,fo,To,yo,Ns,ho=w(()=>{"use strict";n();go=({key:e,data:t,expires:r})=>{sessionStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},fo=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},To=e=>sessionStorage.removeItem(String(e)),yo=()=>sessionStorage.clear(),Ns={setItem:go,getItem:fo,removeItem:To,clear:yo}});var ke,$e=w(()=>{"use strict";n();Ue();ho();ke={session:Or,local:_r}});function it(){return new Date().setHours(new Date().getHours()+24)}function at(e){ke.local.setItem({key:Te.loginExpiresAt,data:e,expires:e})}var Br=w(()=>{"use strict";n();$e();Ue()});var B=w(()=>{"use strict";n()});var So,Ge,xo,wo,vo,Ur=w(()=>{"use strict";n();So="error when signing",Ge="Transaction canceled",xo="error signing transaction",wo="provider not initialized",vo="You need a signer/valid signer to send a transaction,use either WalletProvider, LedgerProvider or WalletConnect"});var bo=w(()=>{"use strict";n()});var V=w(()=>{"use strict";n()});var Ao=w(()=>{"use strict";n()});var Io=w(()=>{"use strict";n()});var Eo=w(()=>{"use strict";n()});var ko=w(()=>{"use strict";n()});var q=w(()=>{"use strict";n();bo();V();B();Ao();Io();Eo();ko()});var $r,Do,cp,Po,lp,Lo,pp,up,dp,No=w(()=>{"use strict";n();q();$r={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:Do,egldLabel:cp}=$r["devnet"],{chainId:Po,egldLabel:lp}=$r["testnet"],{chainId:Lo,egldLabel:pp}=$r["mainnet"],up={["devnet"]:Do,["testnet"]:Po,["mainnet"]:Lo},dp={[Do]:"devnet",[Po]:"testnet",[Lo]:"mainnet"}});var Gr,Vr=w(()=>{"use strict";n();Gr={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 Co=w(()=>{"use strict";n()});var Ve,Wr=w(()=>{"use strict";n();Ve="transaction-status-toast-id"});var st,Ft,Ro,Mo,ct,_t,Fo,We,L=w(()=>{"use strict";n();Ur();No();Vr();Co();Wr();st=5e4,Ft=1e9,Ro=1,Mo="/dapp/init",ct="signSession",_t="logout",Fo="login",We="0"});var Hr,W,lt,re=w(()=>{"use strict";n();Hr=require("@reduxjs/toolkit");L();W=(0,Hr.createAction)(_t),lt=(0,Hr.createAction)(Fo,e=>({payload:e}))});var Oo,_o,Bo,Lp,Np,Cp,Rp,Mp,Fp,Uo,$o,jr=w(()=>{"use strict";n();Oo=require("@reduxjs/toolkit");Br();B();re();_o={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},Bo=(0,Oo.createSlice)({name:"loginInfoSlice",initialState:_o,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(W,()=>_o),e.addCase(lt,(t,r)=>{t.loginMethod=r.payload.loginMethod,at(it())})}}),{setLoginMethod:Lp,setWalletConnectLogin:Np,setLedgerLogin:Cp,setTokenLogin:Rp,setTokenLoginSignature:Mp,setWalletLogin:Fp,invalidateLoginSession:Uo}=Bo.actions,$o=Bo.reducer});var Cs,Ot,pt=w(()=>{"use strict";n();Cs=!1,Ot=(e,t=0)=>{Cs||setTimeout(()=>{window.location.href=e},t)}});var Go=w(()=>{"use strict";n();pt()});function qr(e){return e[Math.floor(Math.random()*e.length)]}var Vo=w(()=>{"use strict";n()});function Ho(e){let t=null;if((e==null?void 0:e.statusCode)in Gr){let r=e==null?void 0:e.statusCode,{message:o}=Gr[r];t=Fs.includes(r)?Wo:o}return{errorMessage:t,defaultErrorMessage:Wo}}var Wo,Rs,Ms,Fs,zr=w(()=>{"use strict";n();Vr();Wo="Check if Elrond app is open on Ledger",Rs=28161,Ms=28160,Fs=[Rs,Ms]});var jo=w(()=>{"use strict";n();Go();Vo();zr()});var qo,zo,Kr,_s,Ko,Yp,Zp,Yo,Yr=w(()=>{"use strict";n();qo=require("@reduxjs/toolkit"),zo=E(require("lodash.omit"));jo();Kr={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},_s={network:Kr,chainID:"-1"},Ko=(0,qo.createSlice)({name:"appConfig",initialState:_s,reducers:{initializeNetworkConfig:(e,t)=>{let r=qr(t.payload.walletConnectBridgeAddresses),o=qr(t.payload.walletConnectV2RelayAddresses),i=(0,zo.default)(t.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");e.network=k(h(h({},e.network),i),{walletConnectBridgeAddress:r,walletConnectV2RelayAddress:o})},setChainID:(e,t)=>{e.chainID=t.payload}}}),{initializeNetworkConfig:Yp,setChainID:Zp}=Ko.actions,Yo=Ko.reducer});var Xr,Zo,Xo,Bt,Zr,Jo,Ut,ou,Jr,iu,au,su,cu,lu,pu,uu,Qo,Qr=w(()=>{"use strict";n();Xr=require("@elrondnetwork/erdjs"),Zo=require("@reduxjs/toolkit"),Xo=require("redux-persist");L();$e();Ue();re();Bt={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:We},Zr={address:"",websocketEvent:null,accounts:{"":Bt},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},Jo=(0,Zo.createSlice)({name:"accountInfoSlice",initialState:Zr,reducers:{setAddress:(e,t)=>{let r=t.payload;e.address=r,e.publicKey=new Xr.Address(r).hex()},setAccount:(e,t)=>{let r=e.address===t.payload.address;e.accounts={[e.address]:r?t.payload:Bt},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(W,()=>(ke.local.removeItem(Te.loginExpiresAt),Zr)),e.addCase(lt,(t,r)=>{let{address:o}=r.payload;t.address=o,t.publicKey=new Xr.Address(o).hex()}),e.addCase(Xo.REHYDRATE,(t,r)=>{var g;if(!((g=r.payload)!=null&&g.account))return;let{account:o}=r.payload,{address:i,shard:p,accounts:l,publicKey:d}=o;t.address=i,t.shard=p;let m=l&&i in l;t.accounts=m?l:Zr.accounts,t.publicKey=d})}}),{setAccount:Ut,setAddress:ou,setAccountNonce:Jr,setAccountShard:iu,setLedgerAccount:au,updateLedgerAccount:su,setWalletConnectAccount:cu,setIsAccountLoading:lu,setAccountLoadingError:pu,setWebsocketEvent:uu}=Jo.actions,Qo=Jo.reducer});function ne(e){return e!=null&&(Hs(e)||Ks(e))}function he(e){return e!=null&&(js(e)||Ys(e))}function Se(e){return e!=null&&(qs(e)||Zs(e))}function $t(e){return e!=null&&zs(e)}function Hs(e){return e!=null&&Os.includes(e)}function js(e){return e!=null&&Bs.includes(e)}function qs(e){return e!=null&&Us.includes(e)}function zs(e){return e!=null&&$s.includes(e)}function Ks(e){return e!=null&&Gs.includes(e)}function Ys(e){return e!=null&&Vs.includes(e)}function Zs(e){return e!=null&&Ws.includes(e)}var Os,Bs,Us,$s,Gs,Vs,Ws,He=w(()=>{"use strict";n();B();Os=["sent"],Bs=["success"],Us=["fail","cancelled","timedOut"],$s=["timedOut"],Gs=["pending"],Vs=["success"],Ws=["fail","invalid"]});var ei,ti,dt,Xs,ri,mt,Gt,Js,xe,ni,Qs,xu,oi,Pe,de,Vt,Wt=w(()=>{"use strict";n();ei=require("@reduxjs/toolkit"),ti=require("redux-persist");B();He();re();dt={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},Xs={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},ri=(0,ei.createSlice)({name:"transactionsSlice",initialState:dt,reducers:{moveTransactionsToSignedState:(e,t)=>{var m,g;let{sessionId:r,transactions:o,errorMessage:i,status:p,redirectRoute:l}=t.payload,d=((m=e.customTransactionInformationForSessionId)==null?void 0:m[r])||Xs;e.signedTransactions[r]={transactions:o,status:p,errorMessage:i,redirectRoute:l,customTransactionInformation:d},((g=e==null?void 0:e.transactionsToSign)==null?void 0:g.sessionId)===r&&(e.transactionsToSign=dt.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=h(h({},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 d,m,g,T,f,S;let{sessionId:r,status:o,errorMessage:i,transactionHash:p}=t.payload,l=(m=(d=e.signedTransactions)==null?void 0:d[r])==null?void 0:m.transactions;if(l!=null){e.signedTransactions[r].transactions=l.map(N=>N.hash===p?k(h({},N),{status:o,errorMessage:i}):N);let y=(T=(g=e.signedTransactions[r])==null?void 0:g.transactions)==null?void 0:T.every(N=>he(N.status)),D=(S=(f=e.signedTransactions[r])==null?void 0:f.transactions)==null?void 0:S.every(N=>Se(N.status));y&&(e.signedTransactions[r].status="success"),D&&(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=dt.transactionsToSign,e.signTransactionsError=null},clearAllSignedTransactions:e=>{e.signedTransactions=dt.signedTransactions},setSignTransactionsError:(e,t)=>{e.signTransactionsError=t.payload},setSignTransactionsCancelMessage:(e,t)=>{e.signTransactionsCancelMessage=t.payload}},extraReducers:e=>{e.addCase(W,()=>dt),e.addCase(ti.REHYDRATE,(t,r)=>{var l;if(t.signTransactionsCancelMessage=null,!((l=r.payload)!=null&&l.transactions))return;let{signedTransactions:o,customTransactionInformationForSessionId:i}=r.payload.transactions,p=Object.entries(o).reduce((d,[m,g])=>{let T=new Date(m),f=new Date;return f.setHours(f.getHours()+5),f-T>0||(d[m]=g),d},{});i!=null&&(t.customTransactionInformationForSessionId=i),o!=null&&(t.signedTransactions=p)})}}),{updateSignedTransactionStatus:mt,updateSignedTransactions:Gt,setTransactionsToSign:Js,clearAllTransactionsToSign:xe,clearAllSignedTransactions:ni,clearSignedTransaction:Qs,clearTransactionToSign:xu,setSignTransactionsError:oi,setSignTransactionsCancelMessage:Pe,moveTransactionsToSignedState:de}=ri.actions,Vt=ri.reducer});var ii,tn,rn,nn,ec,en,ai,Au,tc,je,Ht,jt=w(()=>{"use strict";n();ii=require("@reduxjs/toolkit");re();tn="Transaction failed",rn="Transaction successful",nn="Processing transaction",ec="Transaction submitted",en={},ai=(0,ii.createSlice)({name:"transactionsInfo",initialState:en,reducers:{setTransactionsDisplayInfo(e,t){let{sessionId:r,transactionsDisplayInfo:o}=t.payload;r!=null&&(e[r]={errorMessage:(o==null?void 0:o.errorMessage)||tn,successMessage:(o==null?void 0:o.successMessage)||rn,processingMessage:(o==null?void 0:o.processingMessage)||nn,submittedMessage:(o==null?void 0:o.submittedMessage)||ec,transactionDuration:o==null?void 0:o.transactionDuration})},clearTransactionsInfoForSessionId(e,t){t.payload!=null&&delete e[t.payload]},clearTransactionsInfo:()=>en},extraReducers:e=>{e.addCase(W,()=>en)}}),{clearTransactionsInfo:Au,setTransactionsDisplayInfo:tc,clearTransactionsInfoForSessionId:je}=ai.actions,Ht=ai.reducer});var ci,si,li,Du,rc,Pu,Lu,pi,on=w(()=>{"use strict";n();ci=require("@reduxjs/toolkit");re();si={},li=(0,ci.createSlice)({name:"modalsSlice",initialState:si,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(W,()=>si)}}),{setTxSubmittedModal:Du,setNotificationModal:rc,clearTxSubmittedModal:Pu,clearNotificationModal:Lu}=li.actions,pi=li.reducer});var di,mi,ui,gi,nc,gt,Bu,Uu,$u,Gu,qt,zt=w(()=>{"use strict";n();di=require("@reduxjs/toolkit"),mi=require("redux-persist");Wr();q();Rr();re();ui={customToasts:[],transactionToasts:[],failTransactionToast:null},gi=(0,di.createSlice)({name:"toastsSlice",initialState:ui,reducers:{addCustomToast:(e,t)=>{e.customToasts.push(k(h({},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:Mt(),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=k(h({},t.payload),{toastId:Ve})},removeFailTransactionToast:e=>{e.failTransactionToast=null}},extraReducers:e=>{e.addCase(W,()=>ui),e.addCase(mi.REHYDRATE,(t,r)=>{var i,p;let o=(p=(i=r.customToasts)==null?void 0:i.filter(l=>!("component"in l)))!=null?p:[];t.customToasts=o})}}),{addCustomToast:nc,removeCustomToast:gt,addTransactionToast:Bu,removeTransactionToast:Uu,addFailTransactionToast:$u,removeFailTransactionToast:Gu}=gi.actions,qt=gi.reducer});var _=w(()=>{"use strict";n();jr();Yr();Qr();Wt();jt();on();zt()});var an=w(()=>{"use strict";n()});var hi,yi,Si,sd,cd,ld,pd,ud,dd,xi,wi=w(()=>{"use strict";n();hi=require("@reduxjs/toolkit");re();yi={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},Si=(0,hi.createSlice)({name:"dappModalsSlice",initialState:yi,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=h({},t.payload)}},extraReducers:e=>{e.addCase(W,()=>yi)}}),{setDappModalVisibility:sd,setDappModalHeaderVisibility:cd,setDappModalFooterVisibility:ld,setDappModalHeaderText:pd,setDappModalFooterText:ud,setDappModalConfig:dd}=Si.actions,xi=Si.reducer});var vi,sc,cc,qe,Yt=w(()=>{"use strict";n();vi=require("@reduxjs/toolkit");an();Qr();wi();jr();on();Yr();zt();jt();Wt();sc={["account"]:Qo,["networkConfig"]:Yo,["loginInfo"]:$o,["modals"]:pi,["dappModal"]:xi,["toasts"]:qt,["transactions"]:Vt,["transactionsInfo"]:Ht},cc=(e={})=>(0,vi.combineReducers)(h(h({},sc),e)),qe=cc});var Ii={};be(Ii,{default:()=>fc});function sn(e,t=[]){return{key:e,version:1,storage:Ai.default,blacklist:t}}var Le,bi,Ai,lc,pc,uc,dc,mc,gc,fc,Ei=w(()=>{"use strict";n();Le=require("redux-persist"),bi=E(require("redux-persist/lib/storage")),Ai=E(require("redux-persist/lib/storage/session"));Yt();_();zt();jt();Wt();an();lc={2:e=>k(h({},e),{networkConfig:Kr})};pc=sn("dapp-core-transactionsInfo"),uc=sn("dapp-core-transactions",["transactionsToSign"]),dc=sn("dapp-core-toasts"),mc={key:"dapp-core-store",version:2,storage:bi.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,Le.createMigrate)(lc,{debug:!1})},gc={["toasts"]:(0,Le.persistReducer)(dc,qt),["transactions"]:(0,Le.persistReducer)(uc,Vt),["transactionsInfo"]:(0,Le.persistReducer)(pc,Ht)},fc=(0,Le.persistReducer)(mc,qe(gc))});var ki={};be(ki,{default:()=>Tc});var Tc,Di=w(()=>{"use strict";n();Yt();Tc=qe()});var Pi={};be(Pi,{default:()=>hc});var Y,yc,hc,Li=w(()=>{"use strict";n();Y=require("redux-persist"),yc=[Y.FLUSH,Y.REHYDRATE,Y.PAUSE,Y.PERSIST,Y.PURGE,Y.REGISTER],hc=yc});var Ri={};be(Ri,{default:()=>Ci});function Ci(e){return(0,Ni.persistStore)(e)}var Ni,Mi=w(()=>{"use strict";n();Ni=require("redux-persist")});var Dl={};be(Dl,{useCheckTransactionStatus:()=>hl,useGetActiveTransactionsStatus:()=>kl,useGetFailedTransactions:()=>Il,useGetPendingTransactions:()=>Rn,useGetSignTransactionsError:()=>ul,useGetSignedTransactions:()=>Pn,useGetSuccessfulTransactions:()=>El,useGetTokenDetails:()=>ll,useGetTransactionDisplayInfo:()=>rl,useParseMultiEsdtTransferData:()=>Ln,useParseSignedTransactions:()=>St,useSignMultipleTransactions:()=>Nn,useSignTransactions:()=>sl,useSignTransactionsCommonData:()=>wt,useSignTransactionsWithDevice:()=>Cn,useSignTransactionsWithLedger:()=>pl,useTrackTransactionStatus:()=>Al});module.exports=ot(Dl);n();n();n();var $i=require("react"),ze=require("react-redux");n();var cn=require("@reduxjs/toolkit"),Bi=require("react-redux/es/utils/Subscription");_();n();var fi=E(require("lodash.throttle"));L();_();Br();$e();Ue();var oc=[_t],ic=(0,fi.default)(()=>{at(it())},5e3),Ti=e=>t=>r=>{var m;if(oc.includes(r.type))return t(r);let o=e.getState(),i=ke.local.getItem(Te.loginExpiresAt);if(!((m=o==null?void 0:o.loginInfo)==null?void 0:m.isLoggedIn))return t(r);if(i==null)return at(it());let l=Date.now();return i-l<0?setTimeout(()=>b(void 0,null,function*(){console.log("session expired");try{e.dispatch(Uo())}catch(g){console.error("error logging out",g)}}),1e3):(ic(),t(r))};n();n();function Kt(){return typeof sessionStorage!="undefined"}var Fi=Kt()?(Ei(),ot(Ii)).default:(Di(),ot(ki)).default,_i=Kt()?(Li(),ot(Pi)).default:[],Oi=Kt()?(Mi(),ot(Ri)).default:e=>e;Yt();var v=(0,cn.configureStore)({reducer:Fi,middleware:e=>e({serializableCheck:{ignoredActions:[..._i,Jr.type,Ut.type],ignoredPaths:["payload.nonce","account.account.nonce","providers.accountProvider"]}}).concat(Ti)}),Ui=(0,Bi.createSubscription)(v),Od=Oi(v),Bd=(0,cn.configureStore)({reducer:qe});var Sc={store:v,subscription:Ui},ln=(0,$i.createContext)(Sc),Vd=(0,ze.createStoreHook)(ln),oe=(0,ze.createDispatchHook)(ln),A=(0,ze.createSelectorHook)(ln);n();n();_();n();var Gi=E(require("lodash.isequal")),Zt=require("reselect"),x=(0,Zt.createSelectorCreator)(Zt.defaultMemoize,Gi.default);var me=e=>e.account,we=x(me,e=>e.address),Ke=x(me,we,(e,t)=>t in e.accounts?e.accounts[t]:Bt),Vi=x(me,Ke,(e,t)=>{let i=e,{accounts:r}=i,o=Dt(i,["accounts"]);return k(h({},o),{account:t})}),xc=x(Ke,e=>e.balance),Wi=x(Ke,e=>{var t;return((t=e==null?void 0:e.nonce)==null?void 0:t.valueOf())||0}),zd=x(me,e=>e.shard),Kd=x(me,e=>e.ledgerAccount),Yd=x(me,e=>e.walletConnectAccount),Zd=x(me,e=>e.isAccountLoading),Xd=x(me,e=>e.accountLoadingError),wc=x(me,e=>e.websocketEvent);n();var ie=e=>e.networkConfig,pn=x(ie,e=>e.chainID),em=x(ie,e=>e.network.walletConnectBridgeAddress),tm=x(ie,e=>e.network.walletConnectV2RelayAddress),rm=x(ie,e=>e.network.walletConnectV2ProjectId),nm=x(ie,e=>e.network.walletConnectDeepLink),Ne=x(ie,e=>e.network),Xt=x(Ne,e=>e.apiAddress),Hi=x(Ne,e=>e.explorerAddress),un=x(Ne,e=>e.egldLabel);n();B();var Ce=e=>e.loginInfo,cm=x(Ce,e=>e.loginMethod),ft=x(Ce,we,(e,t)=>e.loginMethod!=""&&Boolean(t)),lm=x(Ce,e=>e.walletConnectLogin),pm=x(Ce,e=>e.ledgerLogin),ji=x(Ce,e