@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
10 lines (9 loc) • 31.3 kB
JavaScript
"use strict";var Je=Object.create;var P=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var $e=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var rr=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),j=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},le=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ze(e))!er.call(t,i)&&i!==r&&P(t,i,{get:()=>e[i],enumerable:!(n=Qe(e,i))||n.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?Je($e(t)):{},le(e||!t||!t.__esModule?P(r,"default",{value:t,enumerable:!0}):r,t)),tr=t=>le(P({},"__esModule",{value:!0}),t);var de=M(O=>{"use strict";l();O.byteLength=ir;O.toByteArray=ar;O.fromByteArray=cr;var k=[],T=[],nr=typeof Uint8Array!="undefined"?Uint8Array:Array,H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(R=0,ue=H.length;R<ue;++R)k[R]=H[R],T[H.charCodeAt(R)]=R;var R,ue;T["-".charCodeAt(0)]=62;T["_".charCodeAt(0)]=63;function pe(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function ir(t){var e=pe(t),r=e[0],n=e[1];return(r+n)*3/4-n}function or(t,e,r){return(e+r)*3/4-r}function ar(t){var e,r=pe(t),n=r[0],i=r[1],o=new nr(or(t,n,i)),a=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=T[t.charCodeAt(u)]<<18|T[t.charCodeAt(u+1)]<<12|T[t.charCodeAt(u+2)]<<6|T[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=T[t.charCodeAt(u)]<<2|T[t.charCodeAt(u+1)]>>4,o[a++]=e&255),i===1&&(e=T[t.charCodeAt(u)]<<10|T[t.charCodeAt(u+1)]<<4|T[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function sr(t){return k[t>>18&63]+k[t>>12&63]+k[t>>6&63]+k[t&63]}function lr(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(sr(n));return i.join("")}function cr(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,c=r-n;a<c;a+=o)i.push(lr(t,a,a+o>c?c:a+o));return n===1?(e=t[r-1],i.push(k[e>>2]+k[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(k[e>>10]+k[e>>4&63]+k[e<<2&63]+"=")),i.join("")}});var ge=M(W=>{l();W.read=function(t,e,r,n,i){var o,a,c=i*8-n-1,u=(1<<c)-1,d=u>>1,g=-7,p=r?i-1:0,v=r?-1:1,b=t[e+p];for(p+=v,o=b&(1<<-g)-1,b>>=-g,g+=c;g>0;o=o*256+t[e+p],p+=v,g-=8);for(a=o&(1<<-g)-1,o>>=-g,g+=n;g>0;a=a*256+t[e+p],p+=v,g-=8);if(o===0)o=1-d;else{if(o===u)return a?NaN:(b?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-d}return(b?-1:1)*a*Math.pow(2,o-n)};W.write=function(t,e,r,n,i,o){var a,c,u,d=o*8-i-1,g=(1<<d)-1,p=g>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:o-1,C=n?1:-1,Xe=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,a=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+p>=1?e+=v/u:e+=v*Math.pow(2,1-p),e*u>=2&&(a++,u/=2),a+p>=g?(c=0,a=g):a+p>=1?(c=(e*u-1)*Math.pow(2,i),a=a+p):(c=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+b]=c&255,b+=C,c/=256,i-=8);for(a=a<<i|c,d+=i;d>0;t[r+b]=a&255,b+=C,a/=256,d-=8);t[r+b-C]|=Xe*128}});var Ee=M(B=>{"use strict";l();var V=de(),D=ge(),me=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=s;B.SlowBuffer=fr;B.INSPECT_MAX_BYTES=50;var G=2147483647;B.kMaxLength=G;s.TYPED_ARRAY_SUPPORT=ur();!s.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ur(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(r){return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.byteOffset}});function A(t){if(t>G)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return J(t)}return ye(t,e,r)}s.poolSize=8192;function ye(t,e,r){if(typeof t=="string")return dr(t,e);if(ArrayBuffer.isView(t))return gr(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(I(t,ArrayBuffer)||t&&I(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(I(t,SharedArrayBuffer)||t&&I(t.buffer,SharedArrayBuffer)))return Y(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return s.from(n,e,r);var i=mr(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s.from=function(t,e,r){return ye(t,e,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function xe(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function pr(t,e,r){return xe(t),t<=0?A(t):e!==void 0?typeof r=="string"?A(t).fill(e,r):A(t).fill(e):A(t)}s.alloc=function(t,e,r){return pr(t,e,r)};function J(t){return xe(t),A(t<0?0:Q(t)|0)}s.allocUnsafe=function(t){return J(t)};s.allocUnsafeSlow=function(t){return J(t)};function dr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=we(t,e)|0,n=A(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function K(t){for(var e=t.length<0?0:Q(t.length)|0,r=A(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function gr(t){if(I(t,Uint8Array)){var e=new Uint8Array(t);return Y(e.buffer,e.byteOffset,e.byteLength)}return K(t)}function Y(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function mr(t){if(s.isBuffer(t)){var e=Q(t.length)|0,r=A(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Z(t.length)?A(0):K(t);if(t.type==="Buffer"&&Array.isArray(t.data))return K(t.data)}function Q(t){if(t>=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return t|0}function fr(t){return+t!=t&&(t=0),s.alloc(+t)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,r){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),I(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(e)||!s.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=s.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(I(a,Uint8Array))o+a.length>i.length?s.from(a).copy(i,o):Uint8Array.prototype.set.call(i,a,o);else if(s.isBuffer(a))a.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return i};function we(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||I(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return X(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Le(t).length;default:if(i)return n?-1:X(t).length;e=(""+e).toLowerCase(),i=!0}}s.byteLength=we;function hr(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Er(this,e,r);case"utf8":case"utf-8":return Te(this,e,r);case"ascii":return Ir(this,e,r);case"latin1":case"binary":return Lr(this,e,r);case"base64":return vr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ar(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function F(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)F(this,r,r+1);return this};s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)F(this,r,r+3),F(this,r+1,r+2);return this};s.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)F(this,r,r+7),F(this,r+1,r+6),F(this,r+2,r+5),F(this,r+3,r+4);return this};s.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?Te(this,0,e):hr.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){var e="",r=B.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};me&&(s.prototype[me]=s.prototype.inspect);s.prototype.compare=function(e,r,n,i,o){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,c=n-r,u=Math.min(a,c),d=this.slice(i,o),g=e.slice(r,n),p=0;p<u;++p)if(d[p]!==g[p]){a=d[p],c=g[p];break}return a<c?-1:c<a?1:0};function be(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Z(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:fe(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):fe(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function fe(t,e,r,n,i){var o=1,a=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,r/=2}function u(b,C){return o===1?b[C]:b.readUInt16BE(C*o)}var d;if(i){var g=-1;for(d=r;d<a;d++)if(u(t,d)===u(e,g===-1?0:d-g)){if(g===-1&&(g=d),d-g+1===c)return g*o}else g!==-1&&(d-=d-g),g=-1}else for(r+c>a&&(r=a-c),d=r;d>=0;d--){for(var p=!0,v=0;v<c;v++)if(u(t,d+v)!==u(e,v)){p=!1;break}if(p)return d}return-1}s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return be(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return be(this,e,r,n,!1)};function yr(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var c=parseInt(e.substr(a*2,2),16);if(Z(c))return a;t[r+a]=c}return a}function xr(t,e,r,n){return z(X(e,t.length-r),t,r,n)}function wr(t,e,r,n){return z(Rr(e),t,r,n)}function br(t,e,r,n){return z(Le(e),t,r,n)}function Tr(t,e,r,n){return z(Fr(e,t.length-r),t,r,n)}s.prototype.write=function(e,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 o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return yr(this,e,r,n);case"utf8":case"utf-8":return xr(this,e,r,n);case"ascii":case"latin1":case"binary":return wr(this,e,r,n);case"base64":return br(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tr(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vr(t,e,r){return e===0&&r===t.length?V.fromByteArray(t):V.fromByteArray(t.slice(e,r))}function Te(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){var u,d,g,p;switch(c){case 1:o<128&&(a=o);break;case 2:u=t[i+1],(u&192)===128&&(p=(o&31)<<6|u&63,p>127&&(a=p));break;case 3:u=t[i+1],d=t[i+2],(u&192)===128&&(d&192)===128&&(p=(o&15)<<12|(u&63)<<6|d&63,p>2047&&(p<55296||p>57343)&&(a=p));break;case 4:u=t[i+1],d=t[i+2],g=t[i+3],(u&192)===128&&(d&192)===128&&(g&192)===128&&(p=(o&15)<<18|(u&63)<<12|(d&63)<<6|g&63,p>65535&&p<1114112&&(a=p))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return kr(n)}var he=4096;function kr(t){var e=t.length;if(e<=he)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=he));return r}function Ir(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Lr(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Er(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Nr[t[o]];return i}function Ar(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i=this.subarray(e,r);return Object.setPrototypeOf(i,s.prototype),i};function x(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return i};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(e,r){return e=e>>>0,r||x(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||x(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||x(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||x(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};s.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var i=r,o=1,a=this[e+--i];i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*r)),a};s.prototype.readInt8=function(e,r){return e=e>>>0,r||x(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){e=e>>>0,r||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,r){e=e>>>0,r||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,r){return e=e>>>0,r||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,r){return e=e>>>0,r||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readFloatLE=function(e,r){return e=e>>>0,r||x(e,4,this.length),D.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return e=e>>>0,r||x(e,4,this.length),D.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||x(e,8,this.length),D.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||x(e,8,this.length),D.read(this,e,!1,52,8)};function w(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,e,r,n,o,0)}var a=1,c=0;for(this[r]=e&255;++c<n&&(a*=256);)this[r+c]=e/a&255;return r+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;w(this,e,r,n,o,0)}var a=n-1,c=1;for(this[r+a]=e&255;--a>=0&&(c*=256);)this[r+a]=e/c&255;return r+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,255,0),this[r]=e&255,r+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};s.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);w(this,e,r,n,o-1,-o)}var a=0,c=1,u=0;for(this[r]=e&255;++a<n&&(c*=256);)e<0&&u===0&&this[r+a-1]!==0&&(u=1),this[r+a]=(e/c>>0)-u&255;return r+n};s.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);w(this,e,r,n,o-1,-o)}var a=n-1,c=1,u=0;for(this[r+a]=e&255;--a>=0&&(c*=256);)e<0&&u===0&&this[r+a+1]!==0&&(u=1),this[r+a]=(e/c>>0)-u&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};s.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};s.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function ve(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ke(t,e,r,n,i){return e=+e,r=r>>>0,i||ve(t,e,r,4,34028234663852886e22,-34028234663852886e22),D.write(t,e,r,n,23,4),r+4}s.prototype.writeFloatLE=function(e,r,n){return ke(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return ke(this,e,r,!1,n)};function Ie(t,e,r,n,i){return e=+e,r=r>>>0,i||ve(t,e,r,8,17976931348623157e292,-17976931348623157e292),D.write(t,e,r,n,52,8),r+8}s.prototype.writeDoubleLE=function(e,r,n){return Ie(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return Ie(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,i){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};s.prototype.fill=function(e,r,n,i){if(typeof e=="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"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){var o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var c=s.isBuffer(e)?e:s.from(e,i),u=c.length;if(u===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=c[a%u]}return this};var _r=/[^+/0-9A-Za-z-_]/g;function Sr(t){if(t=t.split("=")[0],t=t.trim().replace(_r,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function X(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function Rr(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Fr(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Le(t){return V.toByteArray(Sr(t))}function z(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function I(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Z(t){return t!==t}var Nr=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var Fe=M((Zr,Re)=>{l();var y=Re.exports={},L,E;function $(){throw new Error("setTimeout has not been defined")}function ee(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?L=setTimeout:L=$}catch(t){L=$}try{typeof clearTimeout=="function"?E=clearTimeout:E=ee}catch(t){E=ee}})();function Ae(t){if(L===setTimeout)return setTimeout(t,0);if((L===$||!L)&&setTimeout)return L=setTimeout,setTimeout(t,0);try{return L(t,0)}catch(e){try{return L.call(null,t,0)}catch(r){return L.call(this,t,0)}}}function Cr(t){if(E===clearTimeout)return clearTimeout(t);if((E===ee||!E)&&clearTimeout)return E=clearTimeout,clearTimeout(t);try{return E(t)}catch(e){try{return E.call(null,t)}catch(r){return E.call(this,t)}}}var _=[],U=!1,N,q=-1;function Dr(){!U||!N||(U=!1,N.length?_=N.concat(_):q=-1,_.length&&_e())}function _e(){if(!U){var t=Ae(Dr);U=!0;for(var e=_.length;e;){for(N=_,_=[];++q<e;)N&&N[q].run();q=-1,e=_.length}N=null,U=!1,Cr(t)}}y.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];_.push(new Se(t,e)),_.length===1&&!U&&Ae(_e)};function Se(t,e){this.fun=t,this.array=e}Se.prototype.run=function(){this.fun.apply(null,this.array)};y.title="browser";y.browser=!0;y.env={};y.argv=[];y.version="";y.versions={};function S(){}y.on=S;y.addListener=S;y.once=S;y.off=S;y.removeListener=S;y.removeAllListeners=S;y.emit=S;y.prependListener=S;y.prependOnceListener=S;y.listeners=function(t){return[]};y.binding=function(t){throw new Error("process.binding is not supported")};y.cwd=function(){return"/"};y.chdir=function(t){throw new Error("process.chdir is not supported")};y.umask=function(){return 0}});var m,f,$r,l=rr(()=>{m=ce(Ee()),f=ce(Fe()),$r=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object)});var Kr={};j(Kr,{default:()=>Vr,invalidateLoginSession:()=>Wr,loginInfoSlice:()=>se,setLedgerLogin:()=>zr,setLoginMethod:()=>Or,setTokenLogin:()=>qr,setTokenLoginSignature:()=>jr,setWalletConnectLogin:()=>Gr,setWalletLogin:()=>Hr});module.exports=tr(Kr);l();var Ye=require("@reduxjs/toolkit");l();l();var ne={};j(ne,{getItem:()=>Ur,localStorageKeys:()=>re,removeItem:()=>Pr,setItem:()=>Br});l();l();l();var Ne=()=>Date.now()/1e3;l();l();var re={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},te=typeof localStorage!="undefined",Br=({key:t,data:e,expires:r})=>{!te||localStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},Ur=t=>{if(!te)return;let e=localStorage.getItem(String(t));if(!e)return null;let r=JSON.parse(e);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:Ne()>=r.expires?(localStorage.removeItem(String(t)),null):r.data},Pr=t=>{!te||localStorage.removeItem(String(t))};var ie={};j(ie,{clear:()=>Ue,getItem:()=>De,removeItem:()=>Be,setItem:()=>Ce,storage:()=>Mr});l();var Ce=({key:t,data:e,expires:r})=>{sessionStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},De=t=>{let e=sessionStorage.getItem(String(t));if(!e)return null;let r=JSON.parse(e);return!r||!r.hasOwnProperty("expires")||!r.hasOwnProperty("data")?null:Date.now()>=r.expires?(sessionStorage.removeItem(String(t)),null):r.data},Be=t=>sessionStorage.removeItem(String(t)),Ue=()=>sessionStorage.clear(),Mr={setItem:Ce,getItem:De,removeItem:Be,clear:Ue};var Pe={session:ie,local:ne};function Me(){return new Date().setHours(new Date().getHours()+24)}function Oe(t){Pe.local.setItem({key:re.loginExpiresAt,data:t,expires:t})}l();l();var ae=require("@reduxjs/toolkit");l();l();l();l();l();l();l();l();l();l();var oe={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:Ge,egldLabel:At}=oe["devnet"],{chainId:ze,egldLabel:_t}=oe["testnet"],{chainId:qe,egldLabel:St}=oe["mainnet"];var Rt={["devnet"]:Ge,["testnet"]:ze,["mainnet"]:qe},Ft={[Ge]:"devnet",[ze]:"testnet",[qe]:"mainnet"};l();l();l();var je="logout",He="login";var We=(0,ae.createAction)(je),Ve=(0,ae.createAction)(He,t=>({payload:t}));var Ke={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},se=(0,Ye.createSlice)({name:"loginInfoSlice",initialState:Ke,reducers:{setLoginMethod:(t,e)=>{t.loginMethod=e.payload},setTokenLogin:(t,e)=>{t.tokenLogin=e.payload},setTokenLoginSignature:(t,e)=>{(t==null?void 0:t.tokenLogin)!=null&&(t.tokenLogin.signature=e.payload)},setWalletLogin:(t,e)=>{t.walletLogin=e.payload},setWalletConnectLogin:(t,e)=>{t.walletConnectLogin=e.payload},setLedgerLogin:(t,e)=>{t.ledgerLogin=e.payload},invalidateLoginSession:t=>{t.isLoginSessionInvalid=!0}},extraReducers:t=>{t.addCase(We,()=>Ke),t.addCase(Ve,(e,r)=>{e.loginMethod=r.payload.loginMethod,Oe(Me())})}}),{setLoginMethod:Or,setWalletConnectLogin:Gr,setLedgerLogin:zr,setTokenLogin:qr,setTokenLoginSignature:jr,setWalletLogin:Hr,invalidateLoginSession:Wr}=se.actions,Vr=se.reducer;0&&(module.exports={invalidateLoginSession,loginInfoSlice,setLedgerLogin,setLoginMethod,setTokenLogin,setTokenLoginSignature,setWalletConnectLogin,setWalletLogin});
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
//# sourceMappingURL=loginInfoSlice.js.map