UNPKG

@sofaws/dapp-core

Version:

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

1 lines 56.3 kB
"use strict";var Po=Object.create;var fe=Object.defineProperty,Co=Object.defineProperties,Ro=Object.getOwnPropertyDescriptor,Fo=Object.getOwnPropertyDescriptors,_o=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,Mo=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable;var or=(e,t,r)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>{for(var r in t||(t={}))at.call(t,r)&&or(e,r,t[r]);if(ke)for(var r of ke(t))ir.call(t,r)&&or(e,r,t[r]);return e},v=(e,t)=>Co(e,Fo(t));var ar=(e,t)=>{var r={};for(var n in e)at.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ke)for(var n of ke(e))t.indexOf(n)<0&&ir.call(e,n)&&(r[n]=e[n]);return r};var T=(e,t)=>()=>(e&&(t=e(e=0)),t);var Le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),J=(e,t)=>{for(var r in t)fe(e,r,{get:t[r],enumerable:!0})},sr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _o(t))!at.call(e,i)&&i!==r&&fe(e,i,{get:()=>t[i],enumerable:!(n=Ro(t,i))||n.enumerable});return e};var w=(e,t,r)=>(r=e!=null?Po(Mo(e)):{},sr(t||!e||!e.__esModule?fe(r,"default",{value:e,enumerable:!0}):r,e)),Te=e=>sr(fe({},"__esModule",{value:!0}),e);var L=(e,t,r)=>new Promise((n,i)=>{var p=d=>{try{m(r.next(d))}catch(g){i(g)}},l=d=>{try{m(r.throw(d))}catch(g){i(g)}},m=d=>d.done?n(d.value):Promise.resolve(d.value).then(p,l);m((r=r.apply(e,t)).next())});var pr=Le(De=>{"use strict";o();De.byteLength=Bo;De.toByteArray=$o;De.fromByteArray=Wo;var M=[],F=[],Oo=typeof Uint8Array!="undefined"?Uint8Array:Array,st="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Q=0,cr=st.length;Q<cr;++Q)M[Q]=st[Q],F[st.charCodeAt(Q)]=Q;var Q,cr;F["-".charCodeAt(0)]=62;F["_".charCodeAt(0)]=63;function lr(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 n=r===t?0:4-r%4;return[r,n]}function Bo(e){var t=lr(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Uo(e,t,r){return(t+r)*3/4-r}function $o(e){var t,r=lr(e),n=r[0],i=r[1],p=new Oo(Uo(e,n,i)),l=0,m=i>0?n-4:n,d;for(d=0;d<m;d+=4)t=F[e.charCodeAt(d)]<<18|F[e.charCodeAt(d+1)]<<12|F[e.charCodeAt(d+2)]<<6|F[e.charCodeAt(d+3)],p[l++]=t>>16&255,p[l++]=t>>8&255,p[l++]=t&255;return i===2&&(t=F[e.charCodeAt(d)]<<2|F[e.charCodeAt(d+1)]>>4,p[l++]=t&255),i===1&&(t=F[e.charCodeAt(d)]<<10|F[e.charCodeAt(d+1)]<<4|F[e.charCodeAt(d+2)]>>2,p[l++]=t>>8&255,p[l++]=t&255),p}function Vo(e){return M[e>>18&63]+M[e>>12&63]+M[e>>6&63]+M[e&63]}function Ho(e,t,r){for(var n,i=[],p=t;p<r;p+=3)n=(e[p]<<16&16711680)+(e[p+1]<<8&65280)+(e[p+2]&255),i.push(Vo(n));return i.join("")}function Wo(e){for(var t,r=e.length,n=r%3,i=[],p=16383,l=0,m=r-n;l<m;l+=p)i.push(Ho(e,l,l+p>m?m:l+p));return n===1?(t=e[r-1],i.push(M[t>>2]+M[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(M[t>>10]+M[t>>4&63]+M[t<<2&63]+"=")),i.join("")}});var ur=Le(ct=>{o();ct.read=function(e,t,r,n,i){var p,l,m=i*8-n-1,d=(1<<m)-1,g=d>>1,h=-7,y=r?i-1:0,E=r?-1:1,k=e[t+y];for(y+=E,p=k&(1<<-h)-1,k>>=-h,h+=m;h>0;p=p*256+e[t+y],y+=E,h-=8);for(l=p&(1<<-h)-1,p>>=-h,h+=n;h>0;l=l*256+e[t+y],y+=E,h-=8);if(p===0)p=1-g;else{if(p===d)return l?NaN:(k?-1:1)*(1/0);l=l+Math.pow(2,n),p=p-g}return(k?-1:1)*l*Math.pow(2,p-n)};ct.write=function(e,t,r,n,i,p){var l,m,d,g=p*8-i-1,h=(1<<g)-1,y=h>>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=n?0:p-1,Y=n?1:-1,V=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,l=h):(l=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-l))<1&&(l--,d*=2),l+y>=1?t+=E/d:t+=E*Math.pow(2,1-y),t*d>=2&&(l++,d/=2),l+y>=h?(m=0,l=h):l+y>=1?(m=(t*d-1)*Math.pow(2,i),l=l+y):(m=t*Math.pow(2,y-1)*Math.pow(2,i),l=0));i>=8;e[r+k]=m&255,k+=Y,m/=256,i-=8);for(l=l<<i|m,g+=i;g>0;e[r+k]=l&255,k+=Y,l/=256,g-=8);e[r+k-Y]|=V*128}});var Ar=Le(ie=>{"use strict";o();var lt=pr(),oe=ur(),dr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ie.Buffer=u;ie.SlowBuffer=Yo;ie.INSPECT_MAX_BYTES=50;var Ne=2147483647;ie.kMaxLength=Ne;u.TYPED_ARRAY_SUPPORT=Go();!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 Go(){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 H(e){if(e>Ne)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 mt(e)}return fr(e,t,r)}u.poolSize=8192;function fr(e,t,r){if(typeof e=="string")return zo(e,t);if(ArrayBuffer.isView(e))return jo(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(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(O(e,SharedArrayBuffer)||e&&O(e.buffer,SharedArrayBuffer)))return ut(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return u.from(n,t,r);var i=Ko(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 fr(e,t,r)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function Tr(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 qo(e,t,r){return Tr(e),e<=0?H(e):t!==void 0?typeof r=="string"?H(e).fill(t,r):H(e).fill(t):H(e)}u.alloc=function(e,t,r){return qo(e,t,r)};function mt(e){return Tr(e),H(e<0?0:gt(e)|0)}u.allocUnsafe=function(e){return mt(e)};u.allocUnsafeSlow=function(e){return mt(e)};function zo(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=yr(e,t)|0,n=H(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function pt(e){for(var t=e.length<0?0:gt(e.length)|0,r=H(t),n=0;n<t;n+=1)r[n]=e[n]&255;return r}function jo(e){if(O(e,Uint8Array)){var t=new Uint8Array(e);return ut(t.buffer,t.byteOffset,t.byteLength)}return pt(e)}function ut(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 n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,u.prototype),n}function Ko(e){if(u.isBuffer(e)){var t=gt(e.length)|0,r=H(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||ft(e.length)?H(0):pt(e);if(e.type==="Buffer"&&Array.isArray(e.data))return pt(e.data)}function gt(e){if(e>=Ne)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ne.toString(16)+" bytes");return e|0}function Yo(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(O(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),O(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 n=t.length,i=r.length,p=0,l=Math.min(n,i);p<l;++p)if(t[p]!==r[p]){n=t[p],i=r[p];break}return n<i?-1:i<n?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 n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;var i=u.allocUnsafe(r),p=0;for(n=0;n<t.length;++n){var l=t[n];if(O(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 yr(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return dt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return vr(e).length;default:if(i)return n?-1:dt(e).length;t=(""+t).toLowerCase(),i=!0}}u.byteLength=yr;function Zo(e,t,r){var n=!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 ai(this,t,r);case"utf8":case"utf-8":return xr(this,t,r);case"ascii":return oi(this,t,r);case"latin1":case"binary":return ii(this,t,r);case"base64":return ri(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return si(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function ee(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}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)ee(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)ee(this,r,r+3),ee(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)ee(this,r,r+7),ee(this,r+1,r+6),ee(this,r+2,r+5),ee(this,r+3,r+4);return this};u.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?xr(this,0,t):Zo.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=ie.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};dr&&(u.prototype[dr]=u.prototype.inspect);u.prototype.compare=function(t,r,n,i,p){if(O(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),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),p===void 0&&(p=this.length),r<0||n>t.length||i<0||p>this.length)throw new RangeError("out of range index");if(i>=p&&r>=n)return 0;if(i>=p)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,p>>>=0,this===t)return 0;for(var l=p-i,m=n-r,d=Math.min(l,m),g=this.slice(i,p),h=t.slice(r,n),y=0;y<d;++y)if(g[y]!==h[y]){l=g[y],m=h[y];break}return l<m?-1:m<l?1:0};function hr(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ft(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,n)),u.isBuffer(t))return t.length===0?-1:mr(e,t,r,n,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):mr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function mr(e,t,r,n,i){var p=1,l=e.length,m=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;p=2,l/=2,m/=2,r/=2}function d(k,Y){return p===1?k[Y]:k.readUInt16BE(Y*p)}var g;if(i){var h=-1;for(g=r;g<l;g++)if(d(e,g)===d(t,h===-1?0:g-h)){if(h===-1&&(h=g),g-h+1===m)return h*p}else h!==-1&&(g-=g-h),h=-1}else for(r+m>l&&(r=l-m),g=r;g>=0;g--){for(var y=!0,E=0;E<m;E++)if(d(e,g+E)!==d(t,E)){y=!1;break}if(y)return g}return-1}u.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};u.prototype.indexOf=function(t,r,n){return hr(this,t,r,n,!0)};u.prototype.lastIndexOf=function(t,r,n){return hr(this,t,r,n,!1)};function Xo(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var p=t.length;n>p/2&&(n=p/2);for(var l=0;l<n;++l){var m=parseInt(t.substr(l*2,2),16);if(ft(m))return l;e[r+l]=m}return l}function Jo(e,t,r,n){return Pe(dt(t,e.length-r),e,r,n)}function Qo(e,t,r,n){return Pe(pi(t),e,r,n)}function ei(e,t,r,n){return Pe(vr(t),e,r,n)}function ti(e,t,r,n){return Pe(ui(t,e.length-r),e,r,n)}u.prototype.write=function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var p=this.length-r;if((n===void 0||n>p)&&(n=p),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var l=!1;;)switch(i){case"hex":return Xo(this,t,r,n);case"utf8":case"utf-8":return Jo(this,t,r,n);case"ascii":case"latin1":case"binary":return Qo(this,t,r,n);case"base64":return ei(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ti(this,t,r,n);default:if(l)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),l=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ri(e,t,r){return t===0&&r===e.length?lt.fromByteArray(e):lt.fromByteArray(e.slice(t,r))}function xr(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var p=e[i],l=null,m=p>239?4:p>223?3:p>191?2:1;if(i+m<=r){var d,g,h,y;switch(m){case 1:p<128&&(l=p);break;case 2:d=e[i+1],(d&192)===128&&(y=(p&31)<<6|d&63,y>127&&(l=y));break;case 3:d=e[i+1],g=e[i+2],(d&192)===128&&(g&192)===128&&(y=(p&15)<<12|(d&63)<<6|g&63,y>2047&&(y<55296||y>57343)&&(l=y));break;case 4:d=e[i+1],g=e[i+2],h=e[i+3],(d&192)===128&&(g&192)===128&&(h&192)===128&&(y=(p&15)<<18|(d&63)<<12|(g&63)<<6|h&63,y>65535&&y<1114112&&(l=y))}}l===null?(l=65533,m=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l),i+=m}return ni(n)}var gr=4096;function ni(e){var t=e.length;if(t<=gr)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=gr));return r}function oi(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}function ii(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function ai(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",p=t;p<r;++p)i+=di[e[p]];return i}function si(e,t,r){for(var n=e.slice(t,r),i="",p=0;p<n.length-1;p+=2)i+=String.fromCharCode(n[p]+n[p+1]*256);return i}u.prototype.slice=function(t,r){var n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);var i=this.subarray(t,r);return Object.setPrototypeOf(i,u.prototype),i};function A(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,n){t=t>>>0,r=r>>>0,n||A(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,n){t=t>>>0,r=r>>>0,n||A(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||A(t,1,this.length),this[t]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||A(t,2,this.length),this[t]|this[t+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||A(t,2,this.length),this[t]<<8|this[t+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||A(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||A(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};u.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||A(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,n){t=t>>>0,r=r>>>0,n||A(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||A(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};u.prototype.readInt16LE=function(t,r){t=t>>>0,r||A(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(t,r){t=t>>>0,r||A(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(t,r){return t=t>>>0,r||A(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||A(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||A(t,4,this.length),oe.read(this,t,!0,23,4)};u.prototype.readFloatBE=function(t,r){return t=t>>>0,r||A(t,4,this.length),oe.read(this,t,!1,23,4)};u.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||A(t,8,this.length),oe.read(this,t,!0,52,8)};u.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||A(t,8,this.length),oe.read(this,t,!1,52,8)};function N(e,t,r,n,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+n>e.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){var p=Math.pow(2,8*n)-1;N(this,t,r,n,p,0)}var l=1,m=0;for(this[r]=t&255;++m<n&&(l*=256);)this[r+m]=t/l&255;return r+n};u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){var p=Math.pow(2,8*n)-1;N(this,t,r,n,p,0)}var l=n-1,m=1;for(this[r+l]=t&255;--l>=0&&(m*=256);)this[r+l]=t/m&255;return r+n};u.prototype.writeUint8=u.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||N(this,t,r,1,255,0),this[r]=t&255,r+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||N(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,n){return t=+t,r=r>>>0,n||N(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,n){return t=+t,r=r>>>0,n||N(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,n){return t=+t,r=r>>>0,n||N(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,n,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*n-1);N(this,t,r,n,p-1,-p)}var l=0,m=1,d=0;for(this[r]=t&255;++l<n&&(m*=256);)t<0&&d===0&&this[r+l-1]!==0&&(d=1),this[r+l]=(t/m>>0)-d&255;return r+n};u.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){var p=Math.pow(2,8*n-1);N(this,t,r,n,p-1,-p)}var l=n-1,m=1,d=0;for(this[r+l]=t&255;--l>=0&&(m*=256);)t<0&&d===0&&this[r+l+1]!==0&&(d=1),this[r+l]=(t/m>>0)-d&255;return r+n};u.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||N(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};u.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||N(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};u.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||N(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};u.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||N(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,n){return t=+t,r=r>>>0,n||N(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 Sr(e,t,r,n,i,p){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function wr(e,t,r,n,i){return t=+t,r=r>>>0,i||Sr(e,t,r,4,34028234663852886e22,-34028234663852886e22),oe.write(e,t,r,n,23,4),r+4}u.prototype.writeFloatLE=function(t,r,n){return wr(this,t,r,!0,n)};u.prototype.writeFloatBE=function(t,r,n){return wr(this,t,r,!1,n)};function br(e,t,r,n,i){return t=+t,r=r>>>0,i||Sr(e,t,r,8,17976931348623157e292,-17976931348623157e292),oe.write(e,t,r,n,52,8),r+8}u.prototype.writeDoubleLE=function(t,r,n){return br(this,t,r,!0,n)};u.prototype.writeDoubleBE=function(t,r,n){return br(this,t,r,!1,n)};u.prototype.copy=function(t,r,n,i){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);var p=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),p};u.prototype.fill=function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(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<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var l;if(typeof t=="number")for(l=r;l<n;++l)this[l]=t;else{var m=u.isBuffer(t)?t:u.from(t,i),d=m.length;if(d===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(l=0;l<n-r;++l)this[l+r]=m[l%d]}return this};var ci=/[^+/0-9A-Za-z-_]/g;function li(e){if(e=e.split("=")[0],e=e.trim().replace(ci,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function dt(e,t){t=t||1/0;for(var r,n=e.length,i=null,p=[],l=0;l<n;++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===n){(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 pi(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function ui(e,t){for(var r,n,i,p=[],l=0;l<e.length&&!((t-=2)<0);++l)r=e.charCodeAt(l),n=r>>8,i=r%256,p.push(i),p.push(n);return p}function vr(e){return lt.toByteArray(li(e))}function Pe(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function O(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ft(e){return e!==e}var di=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()});var Dr=Le((ja,Lr)=>{o();var S=Lr.exports={},B,U;function Tt(){throw new Error("setTimeout has not been defined")}function yt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?B=setTimeout:B=Tt}catch(e){B=Tt}try{typeof clearTimeout=="function"?U=clearTimeout:U=yt}catch(e){U=yt}})();function Ir(e){if(B===setTimeout)return setTimeout(e,0);if((B===Tt||!B)&&setTimeout)return B=setTimeout,setTimeout(e,0);try{return B(e,0)}catch(t){try{return B.call(null,e,0)}catch(r){return B.call(this,e,0)}}}function mi(e){if(U===clearTimeout)return clearTimeout(e);if((U===yt||!U)&&clearTimeout)return U=clearTimeout,clearTimeout(e);try{return U(e)}catch(t){try{return U.call(null,e)}catch(r){return U.call(this,e)}}}var W=[],ae=!1,te,Ce=-1;function gi(){!ae||!te||(ae=!1,te.length?W=te.concat(W):Ce=-1,W.length&&Er())}function Er(){if(!ae){var e=Ir(gi);ae=!0;for(var t=W.length;t;){for(te=W,W=[];++Ce<t;)te&&te[Ce].run();Ce=-1,t=W.length}te=null,ae=!1,mi(e)}}S.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];W.push(new kr(e,t)),W.length===1&&!ae&&Ir(Er)};function kr(e,t){this.fun=e,this.array=t}kr.prototype.run=function(){this.fun.apply(null,this.array)};S.title="browser";S.browser=!0;S.env={};S.argv=[];S.version="";S.versions={};function G(){}S.on=G;S.addListener=G;S.once=G;S.off=G;S.removeListener=G;S.removeAllListeners=G;S.emit=G;S.prependListener=G;S.prependOnceListener=G;S.listeners=function(e){return[]};S.binding=function(e){throw new Error("process.binding is not supported")};S.cwd=function(){return"/"};S.chdir=function(e){throw new Error("process.chdir is not supported")};S.umask=function(){return 0}});var a,s,Ka,o=T(()=>{a=w(Ar()),s=w(Dr()),Ka=function(e){function t(){var n=this||self;return delete e.prototype.__magic__,n}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 Pr=T(()=>{"use strict";o()});var Cr=T(()=>{"use strict";o()});var D=T(()=>{"use strict";o()});var C=T(()=>{"use strict";o()});var Rr=T(()=>{"use strict";o()});var Fr=T(()=>{"use strict";o()});var _r=T(()=>{"use strict";o()});var Mr=T(()=>{"use strict";o()});var q=T(()=>{"use strict";o();Cr();D();C();Rr();Fr();_r();Mr()});var ht,Or,us,Br,ds,Ur,ms,gs,fs,$r=T(()=>{"use strict";o();q();ht={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:Or,egldLabel:us}=ht["devnet"],{chainId:Br,egldLabel:ds}=ht["testnet"],{chainId:Ur,egldLabel:ms}=ht["mainnet"],gs={["devnet"]:Or,["testnet"]:Br,["mainnet"]:Ur},fs={[Or]:"devnet",[Br]:"testnet",[Ur]:"mainnet"}});var xt=T(()=>{"use strict";o()});var Vr=T(()=>{"use strict";o()});var Hr,St=T(()=>{"use strict";o();Hr="transaction-status-toast-id"});var wt,bt,Wr,Gr,vt,Re,qr,ce,b=T(()=>{"use strict";o();Pr();$r();xt();Vr();St();wt=5e4,bt=1e9,Wr=1,Gr=1,vt=4294967295,Re="logout",qr="login",ce="0"});var Oe,Et=T(()=>{"use strict";o();Oe=()=>Date.now()/1e3});var Zr=T(()=>{"use strict";o()});var Xr=T(()=>{"use strict";o()});var Jr=T(()=>{"use strict";o();Et();Zr();Xr()});var Lt={};J(Lt,{getItem:()=>wi,localStorageKeys:()=>re,removeItem:()=>bi,setItem:()=>Si});var re,kt,Si,wi,bi,he=T(()=>{"use strict";o();Jr();re={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},kt=typeof localStorage!="undefined",Si=({key:e,data:t,expires:r})=>{!kt||localStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},wi=e=>{if(!kt)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:Oe()>=r.expires?(localStorage.removeItem(String(e)),null):r.data},bi=e=>{!kt||localStorage.removeItem(String(e))}});var Dt={};J(Dt,{clear:()=>rn,getItem:()=>en,removeItem:()=>tn,setItem:()=>Qr,storage:()=>vi});var Qr,en,tn,rn,vi,nn=T(()=>{"use strict";o();Qr=({key:e,data:t,expires:r})=>{sessionStorage.setItem(String(e),JSON.stringify({expires:r,data:t}))},en=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},tn=e=>sessionStorage.removeItem(String(e)),rn=()=>sessionStorage.clear(),vi={setItem:Qr,getItem:en,removeItem:tn,clear:rn}});var le,Be=T(()=>{"use strict";o();he();nn();le={session:Dt,local:Lt}});function xe(){return new Date().setHours(new Date().getHours()+24)}function Se(e){le.local.setItem({key:re.loginExpiresAt,data:e,expires:e})}var Nt=T(()=>{"use strict";o();Be();he()});var Pt,P,pe,j=T(()=>{"use strict";o();Pt=require("@reduxjs/toolkit");b();P=(0,Pt.createAction)(Re),pe=(0,Pt.createAction)(qr,e=>({payload:e}))});var an,on,sn,ec,tc,rc,nc,oc,ic,cn,ln,Ct=T(()=>{"use strict";o();an=require("@reduxjs/toolkit");Nt();C();j();on={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},sn=(0,an.createSlice)({name:"loginInfoSlice",initialState:on,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(P,()=>on),e.addCase(pe,(t,r)=>{t.loginMethod=r.payload.loginMethod,Se(xe())})}}),{setLoginMethod:ec,setWalletConnectLogin:tc,setLedgerLogin:rc,setTokenLogin:nc,setTokenLoginSignature:oc,setWalletLogin:ic,invalidateLoginSession:cn}=sn.actions,ln=sn.reducer});var pn=T(()=>{"use strict";o()});var un=T(()=>{"use strict";o();pn()});function Rt(e){return e[Math.floor(Math.random()*e.length)]}var dn=T(()=>{"use strict";o()});var mn=T(()=>{"use strict";o();xt()});var gn=T(()=>{"use strict";o();un();dn();mn()});var fn,Tn,Ft,Ai,yn,wc,bc,hn,_t=T(()=>{"use strict";o();fn=require("@reduxjs/toolkit"),Tn=w(require("lodash.omit"));gn();Ft={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},Ai={network:Ft,chainID:"-1"},yn=(0,fn.createSlice)({name:"appConfig",initialState:Ai,reducers:{initializeNetworkConfig:(e,t)=>{let r=Rt(t.payload.walletConnectBridgeAddresses),n=Rt(t.payload.walletConnectV2RelayAddresses),i=(0,Tn.default)(t.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");e.network=v(x(x({},e.network),i),{walletConnectBridgeAddress:r,walletConnectV2RelayAddress:n})},setChainID:(e,t)=>{e.chainID=t.payload}}}),{initializeNetworkConfig:wc,setChainID:bc}=yn.actions,hn=yn.reducer});var Ot,xn,Sn,Ue,Mt,wn,$e,Nc,Ve,Pc,Cc,Rc,Fc,_c,Mc,Oc,bn,Bt=T(()=>{"use strict";o();Ot=require("@elrondnetwork/erdjs"),xn=require("@reduxjs/toolkit"),Sn=require("redux-persist");b();Be();he();j();Ue={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:ce},Mt={address:"",websocketEvent:null,accounts:{"":Ue},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},wn=(0,xn.createSlice)({name:"accountInfoSlice",initialState:Mt,reducers:{setAddress:(e,t)=>{let r=t.payload;e.address=r,e.publicKey=new Ot.Address(r).hex()},setAccount:(e,t)=>{let r=e.address===t.payload.address;e.accounts={[e.address]:r?t.payload:Ue},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(P,()=>(le.local.removeItem(re.loginExpiresAt),Mt)),e.addCase(pe,(t,r)=>{let{address:n}=r.payload;t.address=n,t.publicKey=new Ot.Address(n).hex()}),e.addCase(Sn.REHYDRATE,(t,r)=>{var g;if(!((g=r.payload)!=null&&g.account))return;let{account:n}=r.payload,{address:i,shard:p,accounts:l,publicKey:m}=n;t.address=i,t.shard=p;let d=l&&i in l;t.accounts=d?l:Mt.accounts,t.publicKey=m})}}),{setAccount:$e,setAddress:Nc,setAccountNonce:Ve,setAccountShard:Pc,setLedgerAccount:Cc,updateLedgerAccount:Rc,setWalletConnectAccount:Fc,setIsAccountLoading:_c,setAccountLoadingError:Mc,setWebsocketEvent:Oc}=wn.actions,bn=wn.reducer});function vn(e){return e!=null&&(Ri(e)||Oi(e))}function He(e){return e!=null&&(Fi(e)||Bi(e))}function We(e){return e!=null&&(_i(e)||Ui(e))}function An(e){return e!=null&&Mi(e)}function Ri(e){return e!=null&&Ei.includes(e)}function Fi(e){return e!=null&&ki.includes(e)}function _i(e){return e!=null&&Li.includes(e)}function Mi(e){return e!=null&&Di.includes(e)}function Oi(e){return e!=null&&Ni.includes(e)}function Bi(e){return e!=null&&Pi.includes(e)}function Ui(e){return e!=null&&Ci.includes(e)}var Ei,ki,Li,Di,Ni,Pi,Ci,$t=T(()=>{"use strict";o();C();Ei=["sent"],ki=["success"],Li=["fail","cancelled","timedOut"],Di=["timedOut"],Ni=["pending"],Pi=["success"],Ci=["fail","invalid"]});var In,En,we,$i,kn,zc,jc,Kc,Yc,Zc,Xc,Jc,Qc,el,tl,Ge,qe=T(()=>{"use strict";o();In=require("@reduxjs/toolkit"),En=require("redux-persist");C();$t();j();we={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},$i={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},kn=(0,In.createSlice)({name:"transactionsSlice",initialState:we,reducers:{moveTransactionsToSignedState:(e,t)=>{var d,g;let{sessionId:r,transactions:n,errorMessage:i,status:p,redirectRoute:l}=t.payload,m=((d=e.customTransactionInformationForSessionId)==null?void 0:d[r])||$i;e.signedTransactions[r]={transactions:n,status:p,errorMessage:i,redirectRoute:l,customTransactionInformation:m},((g=e==null?void 0:e.transactionsToSign)==null?void 0:g.sessionId)===r&&(e.transactionsToSign=we.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=x(x({},e.signedTransactions),t.payload)},updateSignedTransactions:(e,t)=>{let{sessionId:r,status:n,errorMessage:i,transactions:p}=t.payload;e.signedTransactions[r]!=null&&(e.signedTransactions[r].status=n,i!=null&&(e.signedTransactions[r].errorMessage=i),p!=null&&(e.signedTransactions[r].transactions=p))},updateSignedTransactionStatus:(e,t)=>{var m,d,g,h,y,E;let{sessionId:r,status:n,errorMessage:i,transactionHash:p}=t.payload,l=(d=(m=e.signedTransactions)==null?void 0:m[r])==null?void 0:d.transactions;if(l!=null){e.signedTransactions[r].transactions=l.map(V=>V.hash===p?v(x({},V),{status:n,errorMessage:i}):V);let k=(h=(g=e.signedTransactions[r])==null?void 0:g.transactions)==null?void 0:h.every(V=>He(V.status)),Y=(E=(y=e.signedTransactions[r])==null?void 0:y.transactions)==null?void 0:E.every(V=>We(V.status));k&&(e.signedTransactions[r].status="success"),Y&&(e.signedTransactions[r].status="fail")}},setTransactionsToSign:(e,t)=>{e.transactionsToSign=t.payload;let{sessionId:r,customTransactionInformation:n}=t.payload;e.customTransactionInformationForSessionId[r]=n,e.signTransactionsError=null},clearAllTransactionsToSign:e=>{e.transactionsToSign=we.transactionsToSign,e.signTransactionsError=null},clearAllSignedTransactions:e=>{e.signedTransactions=we.signedTransactions},setSignTransactionsError:(e,t)=>{e.signTransactionsError=t.payload},setSignTransactionsCancelMessage:(e,t)=>{e.signTransactionsCancelMessage=t.payload}},extraReducers:e=>{e.addCase(P,()=>we),e.addCase(En.REHYDRATE,(t,r)=>{var l;if(t.signTransactionsCancelMessage=null,!((l=r.payload)!=null&&l.transactions))return;let{signedTransactions:n,customTransactionInformationForSessionId:i}=r.payload.transactions,p=Object.entries(n).reduce((m,[d,g])=>{let h=new Date(d),y=new Date;return y.setHours(y.getHours()+5),y-h>0||(m[d]=g),m},{});i!=null&&(t.customTransactionInformationForSessionId=i),n!=null&&(t.signedTransactions=p)})}}),{updateSignedTransactionStatus:zc,updateSignedTransactions:jc,setTransactionsToSign:Kc,clearAllTransactionsToSign:Yc,clearAllSignedTransactions:Zc,clearSignedTransaction:Xc,clearTransactionToSign:Jc,setSignTransactionsError:Qc,setSignTransactionsCancelMessage:el,moveTransactionsToSignedState:tl}=kn.actions,Ge=kn.reducer});var Ln,Ht,Wt,Gt,Vi,Vt,Dn,il,al,sl,ze,je=T(()=>{"use strict";o();Ln=require("@reduxjs/toolkit");j();Ht="Transaction failed",Wt="Transaction successful",Gt="Processing transaction",Vi="Transaction submitted",Vt={},Dn=(0,Ln.createSlice)({name:"transactionsInfo",initialState:Vt,reducers:{setTransactionsDisplayInfo(e,t){let{sessionId:r,transactionsDisplayInfo:n}=t.payload;r!=null&&(e[r]={errorMessage:(n==null?void 0:n.errorMessage)||Ht,successMessage:(n==null?void 0:n.successMessage)||Wt,processingMessage:(n==null?void 0:n.processingMessage)||Gt,submittedMessage:(n==null?void 0:n.submittedMessage)||Vi,transactionDuration:n==null?void 0:n.transactionDuration})},clearTransactionsInfoForSessionId(e,t){t.payload!=null&&delete e[t.payload]},clearTransactionsInfo:()=>Vt},extraReducers:e=>{e.addCase(P,()=>Vt)}}),{clearTransactionsInfo:il,setTransactionsDisplayInfo:al,clearTransactionsInfoForSessionId:sl}=Dn.actions,ze=Dn.reducer});var Pn,Nn,Cn,ul,dl,ml,gl,Rn,qt=T(()=>{"use strict";o();Pn=require("@reduxjs/toolkit");j();Nn={},Cn=(0,Pn.createSlice)({name:"modalsSlice",initialState:Nn,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(P,()=>Nn)}}),{setTxSubmittedModal:ul,setNotificationModal:dl,clearTxSubmittedModal:ml,clearNotificationModal:gl}=Cn.actions,Rn=Cn.reducer});var _n,Mn,Fn,On,bl,vl,Al,Il,El,kl,Ke,Ye=T(()=>{"use strict";o();_n=require("@reduxjs/toolkit"),Mn=require("redux-persist");St();q();Et();j();Fn={customToasts:[],transactionToasts:[],failTransactionToast:null},On=(0,_n.createSlice)({name:"toastsSlice",initialState:Fn,reducers:{addCustomToast:(e,t)=>{e.customToasts.push(v(x({},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:Oe(),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=v(x({},t.payload),{toastId:Hr})},removeFailTransactionToast:e=>{e.failTransactionToast=null}},extraReducers:e=>{e.addCase(P,()=>Fn),e.addCase(Mn.REHYDRATE,(t,r)=>{var i,p;let n=(p=(i=r.customToasts)==null?void 0:i.filter(l=>!("component"in l)))!=null?p:[];t.customToasts=n})}}),{addCustomToast:bl,removeCustomToast:vl,addTransactionToast:Al,removeTransactionToast:Il,addFailTransactionToast:El,removeFailTransactionToast:kl}=On.actions,Ke=On.reducer});var Z=T(()=>{"use strict";o();Ct();_t();Bt();qe();je();qt();Ye()});var Yt=T(()=>{"use strict";o()});var Xn,Zn,Jn,cu,lu,pu,uu,du,mu,Qn,eo=T(()=>{"use strict";o();Xn=require("@reduxjs/toolkit");j();Zn={visible:!1,modal:{showHeader:!0,showFooter:!1,headerText:"",footerText:""}},Jn=(0,Xn.createSlice)({name:"dappModalsSlice",initialState:Zn,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=x({},t.payload)}},extraReducers:e=>{e.addCase(P,()=>Zn)}}),{setDappModalVisibility:cu,setDappModalHeaderVisibility:lu,setDappModalFooterVisibility:pu,setDappModalHeaderText:uu,setDappModalFooterText:du,setDappModalConfig:mu}=Jn.actions,Qn=Jn.reducer});var to,Xi,Ji,me,Je=T(()=>{"use strict";o();to=require("@reduxjs/toolkit");Yt();Bt();eo();Ct();qt();_t();Ye();je();qe();Xi={["account"]:bn,["networkConfig"]:hn,["loginInfo"]:ln,["modals"]:Rn,["dappModal"]:Qn,["toasts"]:Ke,["transactions"]:Ge,["transactionsInfo"]:ze},Ji=(e={})=>(0,to.combineReducers)(x(x({},Xi),e)),me=Ji});var oo={};J(oo,{default:()=>ia});function Zt(e,t=[]){return{key:e,version:1,storage:no.default,blacklist:t}}var ne,ro,no,Qi,ea,ta,ra,na,oa,ia,io=T(()=>{"use strict";o();ne=require("redux-persist"),ro=w(require("redux-persist/lib/storage")),no=w(require("redux-persist/lib/storage/session"));Je();Z();Ye();je();qe();Yt();Qi={2:e=>v(x({},e),{networkConfig:Ft})};ea=Zt("dapp-core-transactionsInfo"),ta=Zt("dapp-core-transactions",["transactionsToSign"]),ra=Zt("dapp-core-toasts"),na={key:"dapp-core-store",version:2,storage:ro.default,whitelist:["account","loginInfo","modals","networkConfig"],migrate:(0,ne.createMigrate)(Qi,{debug:!1})},oa={["toasts"]:(0,ne.persistReducer)(ra,Ke),["transactions"]:(0,ne.persistReducer)(ta,Ge),["transactionsInfo"]:(0,ne.persistReducer)(ea,ze)},ia=(0,ne.persistReducer)(na,me(oa))});var ao={};J(ao,{default:()=>aa});var aa,so=T(()=>{"use strict";o();Je();aa=me()});var co={};J(co,{default:()=>ca});var _,sa,ca,lo=T(()=>{"use strict";o();_=require("redux-persist"),sa=[_.FLUSH,_.REHYDRATE,_.PAUSE,_.PERSIST,_.PURGE,_.REGISTER],ca=sa});var mo={};J(mo,{default:()=>uo});function uo(e){return(0,po.persistStore)(e)}var po,go=T(()=>{"use strict";o();po=require("redux-persist")});var Ha={};J(Ha,{DAPP_INIT_ROUTE:()=>Kr,EmptyProvider:()=>ye,addressIsValid:()=>se,emptyProvider:()=>Me,getAccount:()=>Ee,getAccountBalance:()=>Ba,getAccountProvider:()=>$,getAccountProviderType:()=>rr,getAddress:()=>Ie,getExternalProvider:()=>Yr,getIsProviderEqualTo:()=>ge,getLatestNonce:()=>nr,getLedgerConfiguration:()=>yi,getProviderType:()=>It,getShardOfAddress:()=>zn,loginWithExternalProvider:()=>Va,newWalletProvider:()=>Ti,refreshAccount:()=>Ua,setNonce:()=>Oa,signMessage:()=>$a});module.exports=Te(Ha);o();o();var Nr=require("@elrondnetwork/erdjs");function fi(e){try{let t=new Nr.Address(e);return Boolean(t.bech32())}catch(t){return!1}}function se(e){return(e==null?void 0:e.startsWith("erd"))&&e.length===62&&/^\w+$/.test(e)&&fi(e)}o();o();o();o();var zr=require("@elrondnetwork/erdjs-extension-provider"),jr=require("@elrondnetwork/erdjs-hw-provider"),_e=require("@elrondnetwork/erdjs-wallet-connect-provider"),At=require("@elrondnetwork/erdjs-web-wallet-provider");b();C();var Kr="/dapp/init",It=e=>{switch(e==null?void 0:e.constructor){case At.WalletProvider:return"wallet";case _e.WalletConnectProvider:return"walletconnect";case _e.WalletConnectV2Provider:return"walletconnectv2";case jr.HWProvider:return"ledger";case zr.ExtensionProvider:return"extension";case ye:return"";default:return"extra"}},Ti=e=>new At.WalletProvider(`${e}${Kr}`),yi=e=>L(void 0,null,function*(){if(!e.isInitialized())throw new Error("Unable to get version. Provider not initialized");let t=e.hwApp,{contractData:r,version:n}=yield t.getAppConfiguration();return{version:n,dataEnabled:r===Gr}}),z=e=>`Unable to perform ${e}, Provider not initialized`,ye=class{init(){return Promise.resolve(!1)}login(t){throw new Error(z(`login with options: ${t}`))}logout(t){throw new Error(z(`logout with options: ${t}`))}getAddress(){throw new Error(z("getAddress"))}isInitialized(){return!1}isConnected(){return Promise.resolve(!1)}sendTransaction(t,r){throw new Error(z(`sendTransaction with transactions: ${t} options: ${r}`))}signTransaction(t,r){throw new Error(z(`signTransaction with transactions: ${t} options: ${r}`))}signTransactions(t,r){throw new Error(z(`signTransactions with transactions: ${t} options: ${r}`))}signMessage(t,r){throw new Error(z(`signTransactions with ${t} and options ${r}`))}sendCustomMessage({method:t,params:r}){throw new Error(z(`sendCustomMessage with method: ${t} params: ${r}`))}sendCustomRequest(t){throw new Error(z(`sendSessionEvent with options: ${t}`))}ping(){return Promise.resolve(!1)}},Me=new ye;var hi=Me,xi=null;function $(){return hi||Me}function Yr(){return xi}o();o();Z();o();var Bn=w(require("lodash.isequal")),Ze=require("reselect"),f=(0,Ze.createSelectorCreator)(Ze.defaultMemoize,Bn.default);var K=e=>e.account,be=f(K,e=>e.address),ve=f(K,be,(e,t)=>t in e.accounts?e.accounts[t]:Ue),$l=f(K,ve,(e,t)=>{let i=e,{accounts:r}=i,n=ar(i,["accounts"]);return v(x({},n),{account:t})}),Vl=f(ve,e=>e.balance),Un=f(ve,e=>{var t;return((t=e==null?void 0:e.nonce)==null?void 0:t.valueOf())||0}),Hl=f(K,e=>e.shard),Wl=f(K,e=>e.ledgerAccount),Gl=f(K,e=>e.walletConnectAccount),ql=f(K,e=>e.isAccountLoading),zl=f(K,e=>e.accountLoadingError),jl=f(K,e=>e.websocketEvent);o();var ue=e=>e.networkConfig,Zl=f(ue,e=>e.chainID),Xl=f(ue,e=>e.network.walletConnectBridgeAddress),Jl=f(ue,e=>e.network.walletConnectV2RelayAddress),Ql=f(ue,e=>e.network.walletConnectV2ProjectId),ep=f(ue,e=>e.network.walletConnectDeepLink),zt=f(ue,e=>e.network),$n=f(zt,e=>e.apiAddress),Vn=f(zt,e=>e.explorerAddress),tp=f(zt,e=>e.egldLabel);o();C();var de=e=>e.loginInfo,ap=f(de,e=>e.loginMethod),Hn=f(de,be,(e,t)=>e.loginMethod!=""&&Boolean(t)),sp=f(de,e=>e.walletConnectLogin),cp=f(de,e=>e.ledgerLogin),Wn=f(de,e=>e.walletLogin),lp=f(de,e=>e.isLoginSessionInvalid);o();o();var R=require("@elrondnetwork/erdjs");b();o();function jt(e){try{return a.Buffer.from(e,"base64").toString()===atob(e)}catch(t){return!1}}function Kt(e){var i,p,l;let{data:t}=e,r=jt(t!=null?t:"")?R.TransactionPayload.fromEncoded(t):new R.TransactionPayload(t),n=new R.Transaction(x({value:e.value.valueOf(),data:r,nonce:e.nonce.valueOf(),receiver:new R.Address(e.receiver),sender:new R.Address(e.sender),gasLimit:(i=e.gasLimit.valueOf())!=null?i:wt,gasPrice:(p=e.gasPrice.valueOf())!=null?p:bt,chainID:e.chainID.valueOf(),version:new R.TransactionVersion((l=e.version)!=null?l:Wr)},e.options?{options:new R.TransactionOptions(e.options)}:{}));return n.applySignature({hex:()=>e.signature||""},new R.Address(e.sender)),n}o();$t();o();var Wi=w(require("bignumber.js"));q();o();o();o();o();var Gi=require("@elrondnetwork/erdjs"),qi=w(require("bignumber.js"));C();o();o();o();var ji=require("@elrondnetwork/erdjs/out");o();b();var zi=e=>{let t=a.Buffer.from([0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);if(e.slice(0,t.length).equals(t))return!0;let n=a.Buffer.alloc(32).fill(0);return e.equals(n)},zn=e=>{try{let r=parseInt("11",2),n=parseInt("01",2),i=a.Buffer.from(e,"hex"),p=i[31];if(zi(i))return vt;let l=p&r;return l>3-1&&(l=p&n),l}catch(t){return-1}};o();var jn=require("@elrondnetwork/erdjs");q();o();o();o();o(