UNPKG

@sofaws/dapp-core

Version:

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

10 lines (9 loc) 43.3 kB
"use strict";var Br=Object.create;var z=Object.defineProperty,Pr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptor,Dr=Object.getOwnPropertyDescriptors,Ur=Object.getOwnPropertyNames,Le=Object.getOwnPropertySymbols,Or=Object.getPrototypeOf,_e=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable;var Re=(t,e,r)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e||(e={}))_e.call(e,r)&&Re(t,r,e[r]);if(Le)for(var r of Le(e))Gr.call(e,r)&&Re(t,r,e[r]);return t},B=(t,e)=>Pr(t,Dr(e));var zr=(t,e)=>()=>(t&&(e=t(t=0)),e);var W=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Z=(t,e)=>{for(var r in e)z(t,r,{get:e[r],enumerable:!0})},Ce=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ur(e))!_e.call(t,o)&&o!==r&&z(t,o,{get:()=>e[o],enumerable:!(n=Mr(e,o))||n.enumerable});return t};var $=(t,e,r)=>(r=t!=null?Br(Or(t)):{},Ce(e||!t||!t.__esModule?z(r,"default",{value:t,enumerable:!0}):r,t)),qr=t=>Ce(z({},"__esModule",{value:!0}),t);var Be=W(j=>{"use strict";c();j.byteLength=Wr;j.toByteArray=Vr;j.fromByteArray=Xr;var I=[],b=[],Hr=typeof Uint8Array!="undefined"?Uint8Array:Array,ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(P=0,Fe=ee.length;P<Fe;++P)I[P]=ee[P],b[ee.charCodeAt(P)]=P;var P,Fe;b["-".charCodeAt(0)]=62;b["_".charCodeAt(0)]=63;function Ne(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 Wr(t){var e=Ne(t),r=e[0],n=e[1];return(r+n)*3/4-n}function jr(t,e,r){return(e+r)*3/4-r}function Vr(t){var e,r=Ne(t),n=r[0],o=r[1],a=new Hr(jr(t,n,o)),i=0,u=o>0?n-4:n,l;for(l=0;l<u;l+=4)e=b[t.charCodeAt(l)]<<18|b[t.charCodeAt(l+1)]<<12|b[t.charCodeAt(l+2)]<<6|b[t.charCodeAt(l+3)],a[i++]=e>>16&255,a[i++]=e>>8&255,a[i++]=e&255;return o===2&&(e=b[t.charCodeAt(l)]<<2|b[t.charCodeAt(l+1)]>>4,a[i++]=e&255),o===1&&(e=b[t.charCodeAt(l)]<<10|b[t.charCodeAt(l+1)]<<4|b[t.charCodeAt(l+2)]>>2,a[i++]=e>>8&255,a[i++]=e&255),a}function Kr(t){return I[t>>18&63]+I[t>>12&63]+I[t>>6&63]+I[t&63]}function Yr(t,e,r){for(var n,o=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),o.push(Kr(n));return o.join("")}function Xr(t){for(var e,r=t.length,n=r%3,o=[],a=16383,i=0,u=r-n;i<u;i+=a)o.push(Yr(t,i,i+a>u?u:i+a));return n===1?(e=t[r-1],o.push(I[e>>2]+I[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(I[e>>10]+I[e>>4&63]+I[e<<2&63]+"=")),o.join("")}});var Pe=W(re=>{c();re.read=function(t,e,r,n,o){var a,i,u=o*8-n-1,l=(1<<u)-1,p=l>>1,y=-7,d=r?o-1:0,x=r?-1:1,w=t[e+d];for(d+=x,a=w&(1<<-y)-1,w>>=-y,y+=u;y>0;a=a*256+t[e+d],d+=x,y-=8);for(i=a&(1<<-y)-1,a>>=-y,y+=n;y>0;i=i*256+t[e+d],d+=x,y-=8);if(a===0)a=1-p;else{if(a===l)return i?NaN:(w?-1:1)*(1/0);i=i+Math.pow(2,n),a=a-p}return(w?-1:1)*i*Math.pow(2,a-n)};re.write=function(t,e,r,n,o,a){var i,u,l,p=a*8-o-1,y=(1<<p)-1,d=y>>1,x=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:a-1,N=n?1:-1,R=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,i=y):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+d>=1?e+=x/l:e+=x*Math.pow(2,1-d),e*l>=2&&(i++,l/=2),i+d>=y?(u=0,i=y):i+d>=1?(u=(e*l-1)*Math.pow(2,o),i=i+d):(u=e*Math.pow(2,d-1)*Math.pow(2,o),i=0));o>=8;t[r+w]=u&255,w+=N,u/=256,o-=8);for(i=i<<o|u,p+=o;p>0;t[r+w]=i&255,w+=N,i/=256,p-=8);t[r+w-N]|=R*128}});var Ye=W(O=>{"use strict";c();var te=Be(),U=Pe(),Me=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;O.Buffer=s;O.SlowBuffer=rt;O.INSPECT_MAX_BYTES=50;var V=2147483647;O.kMaxLength=V;s.TYPED_ARRAY_SUPPORT=Jr();!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 Jr(){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 _(t){if(t>V)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 ie(t)}return Oe(t,e,r)}s.poolSize=8192;function Oe(t,e,r){if(typeof t=="string")return Zr(t,e);if(ArrayBuffer.isView(t))return $r(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(k(t,ArrayBuffer)||t&&k(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(k(t,SharedArrayBuffer)||t&&k(t.buffer,SharedArrayBuffer)))return oe(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 o=et(t);if(o)return o;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 Oe(t,e,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function Ge(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 Qr(t,e,r){return Ge(t),t<=0?_(t):e!==void 0?typeof r=="string"?_(t).fill(e,r):_(t).fill(e):_(t)}s.alloc=function(t,e,r){return Qr(t,e,r)};function ie(t){return Ge(t),_(t<0?0:se(t)|0)}s.allocUnsafe=function(t){return ie(t)};s.allocUnsafeSlow=function(t){return ie(t)};function Zr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=ze(t,e)|0,n=_(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function ne(t){for(var e=t.length<0?0:se(t.length)|0,r=_(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function $r(t){if(k(t,Uint8Array)){var e=new Uint8Array(t);return oe(e.buffer,e.byteOffset,e.byteLength)}return ne(t)}function oe(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 et(t){if(s.isBuffer(t)){var e=se(t.length)|0,r=_(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ce(t.length)?_(0):ne(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ne(t.data)}function se(t){if(t>=V)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V.toString(16)+" bytes");return t|0}function rt(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(k(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),k(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,o=r.length,a=0,i=Math.min(n,o);a<i;++a)if(e[a]!==r[a]){n=e[a],o=r[a];break}return n<o?-1:o<n?1:0};s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(e,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 o=s.allocUnsafe(r),a=0;for(n=0;n<e.length;++n){var i=e[n];if(k(i,Uint8Array))a+i.length>o.length?s.from(i).copy(o,a):Uint8Array.prototype.set.call(o,i,a);else if(s.isBuffer(i))i.copy(o,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=i.length}return o};function ze(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||k(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 o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ae(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Ke(t).length;default:if(o)return n?-1:ae(t).length;e=(""+e).toLowerCase(),o=!0}}s.byteLength=ze;function tt(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 dt(this,e,r);case"utf8":case"utf-8":return He(this,e,r);case"ascii":return ut(this,e,r);case"latin1":case"binary":return pt(this,e,r);case"base64":return ct(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gt(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function M(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)M(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)M(this,r,r+3),M(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)M(this,r,r+7),M(this,r+1,r+6),M(this,r+2,r+5),M(this,r+3,r+4);return this};s.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?He(this,0,e):tt.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=O.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,o,a){if(k(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),o===void 0&&(o=0),a===void 0&&(a=this.length),r<0||n>e.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&r>=n)return 0;if(o>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,a>>>=0,this===e)return 0;for(var i=a-o,u=n-r,l=Math.min(i,u),p=this.slice(o,a),y=e.slice(r,n),d=0;d<l;++d)if(p[d]!==y[d]){i=p[d],u=y[d];break}return i<u?-1:u<i?1:0};function qe(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ce(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:De(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):De(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function De(t,e,r,n,o){var a=1,i=t.length,u=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;a=2,i/=2,u/=2,r/=2}function l(w,N){return a===1?w[N]:w.readUInt16BE(N*a)}var p;if(o){var y=-1;for(p=r;p<i;p++)if(l(t,p)===l(e,y===-1?0:p-y)){if(y===-1&&(y=p),p-y+1===u)return y*a}else y!==-1&&(p-=p-y),y=-1}else for(r+u>i&&(r=i-u),p=r;p>=0;p--){for(var d=!0,x=0;x<u;x++)if(l(t,p+x)!==l(e,x)){d=!1;break}if(d)return p}return-1}s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return qe(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return qe(this,e,r,n,!1)};function nt(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var a=e.length;n>a/2&&(n=a/2);for(var i=0;i<n;++i){var u=parseInt(e.substr(i*2,2),16);if(ce(u))return i;t[r+i]=u}return i}function ot(t,e,r,n){return K(ae(e,t.length-r),t,r,n)}function at(t,e,r,n){return K(yt(e),t,r,n)}function it(t,e,r,n){return K(Ke(e),t,r,n)}function st(t,e,r,n){return K(ht(e,t.length-r),t,r,n)}s.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-r;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return nt(this,e,r,n);case"utf8":case"utf-8":return ot(this,e,r,n);case"ascii":case"latin1":case"binary":return at(this,e,r,n);case"base64":return it(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return st(this,e,r,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ct(t,e,r){return e===0&&r===t.length?te.fromByteArray(t):te.fromByteArray(t.slice(e,r))}function He(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var a=t[o],i=null,u=a>239?4:a>223?3:a>191?2:1;if(o+u<=r){var l,p,y,d;switch(u){case 1:a<128&&(i=a);break;case 2:l=t[o+1],(l&192)===128&&(d=(a&31)<<6|l&63,d>127&&(i=d));break;case 3:l=t[o+1],p=t[o+2],(l&192)===128&&(p&192)===128&&(d=(a&15)<<12|(l&63)<<6|p&63,d>2047&&(d<55296||d>57343)&&(i=d));break;case 4:l=t[o+1],p=t[o+2],y=t[o+3],(l&192)===128&&(p&192)===128&&(y&192)===128&&(d=(a&15)<<18|(l&63)<<12|(p&63)<<6|y&63,d>65535&&d<1114112&&(i=d))}}i===null?(i=65533,u=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),o+=u}return lt(n)}var Ue=4096;function lt(t){var e=t.length;if(e<=Ue)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Ue));return r}function ut(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function pt(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function dt(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",a=e;a<r;++a)o+=Tt[t[a]];return o}function gt(t,e,r){for(var n=t.slice(e,r),o="",a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}s.prototype.slice=function(e,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 o=this.subarray(e,r);return Object.setPrototypeOf(o,s.prototype),o};function T(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||T(e,r,this.length);for(var o=this[e],a=1,i=0;++i<r&&(a*=256);)o+=this[e+i]*a;return o};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||T(e,r,this.length);for(var o=this[e+--r],a=1;r>0&&(a*=256);)o+=this[e+--r]*a;return o};s.prototype.readUint8=s.prototype.readUInt8=function(e,r){return e=e>>>0,r||T(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||T(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||T(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||T(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||T(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||T(e,r,this.length);for(var o=this[e],a=1,i=0;++i<r&&(a*=256);)o+=this[e+i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*r)),o};s.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||T(e,r,this.length);for(var o=r,a=1,i=this[e+--o];o>0&&(a*=256);)i+=this[e+--o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*r)),i};s.prototype.readInt8=function(e,r){return e=e>>>0,r||T(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){e=e>>>0,r||T(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||T(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||T(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||T(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||T(e,4,this.length),U.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return e=e>>>0,r||T(e,4,this.length),U.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||T(e,8,this.length),U.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||T(e,8,this.length),U.read(this,e,!1,52,8)};function S(t,e,r,n,o,a){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<a)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var a=Math.pow(2,8*n)-1;S(this,e,r,n,a,0)}var i=1,u=0;for(this[r]=e&255;++u<n&&(i*=256);)this[r+u]=e/i&255;return r+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var a=Math.pow(2,8*n)-1;S(this,e,r,n,a,0)}var i=n-1,u=1;for(this[r+i]=e&255;--i>=0&&(u*=256);)this[r+i]=e/u&255;return r+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||S(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||S(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||S(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||S(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||S(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,o){if(e=+e,r=r>>>0,!o){var a=Math.pow(2,8*n-1);S(this,e,r,n,a-1,-a)}var i=0,u=1,l=0;for(this[r]=e&255;++i<n&&(u*=256);)e<0&&l===0&&this[r+i-1]!==0&&(l=1),this[r+i]=(e/u>>0)-l&255;return r+n};s.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){var a=Math.pow(2,8*n-1);S(this,e,r,n,a-1,-a)}var i=n-1,u=1,l=0;for(this[r+i]=e&255;--i>=0&&(u*=256);)e<0&&l===0&&this[r+i+1]!==0&&(l=1),this[r+i]=(e/u>>0)-l&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||S(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||S(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||S(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||S(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||S(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 We(t,e,r,n,o,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function je(t,e,r,n,o){return e=+e,r=r>>>0,o||We(t,e,r,4,34028234663852886e22,-34028234663852886e22),U.write(t,e,r,n,23,4),r+4}s.prototype.writeFloatLE=function(e,r,n){return je(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return je(this,e,r,!1,n)};function Ve(t,e,r,n,o){return e=+e,r=r>>>0,o||We(t,e,r,8,17976931348623157e292,-17976931348623157e292),U.write(t,e,r,n,52,8),r+8}s.prototype.writeDoubleLE=function(e,r,n){return Ve(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return Ve(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,o){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===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(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);var a=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),a};s.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){var a=e.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(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 i;if(typeof e=="number")for(i=r;i<n;++i)this[i]=e;else{var u=s.isBuffer(e)?e:s.from(e,o),l=u.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=u[i%l]}return this};var mt=/[^+/0-9A-Za-z-_]/g;function ft(t){if(t=t.split("=")[0],t=t.trim().replace(mt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ae(t,e){e=e||1/0;for(var r,n=t.length,o=null,a=[],i=0;i<n;++i){if(r=t.charCodeAt(i),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(i+1===n){(e-=3)>-1&&a.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&a.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function yt(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function ht(t,e){for(var r,n,o,a=[],i=0;i<t.length&&!((e-=2)<0);++i)r=t.charCodeAt(i),n=r>>8,o=r%256,a.push(o),a.push(n);return a}function Ke(t){return te.toByteArray(ft(t))}function K(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function k(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ce(t){return t!==t}var Tt=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()});var $e=W((_n,Ze)=>{c();var h=Ze.exports={},E,L;function le(){throw new Error("setTimeout has not been defined")}function ue(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?E=setTimeout:E=le}catch(t){E=le}try{typeof clearTimeout=="function"?L=clearTimeout:L=ue}catch(t){L=ue}})();function Xe(t){if(E===setTimeout)return setTimeout(t,0);if((E===le||!E)&&setTimeout)return E=setTimeout,setTimeout(t,0);try{return E(t,0)}catch(e){try{return E.call(null,t,0)}catch(r){return E.call(this,t,0)}}}function xt(t){if(L===clearTimeout)return clearTimeout(t);if((L===ue||!L)&&clearTimeout)return L=clearTimeout,clearTimeout(t);try{return L(t)}catch(e){try{return L.call(null,t)}catch(r){return L.call(this,t)}}}var C=[],G=!1,D,Y=-1;function wt(){!G||!D||(G=!1,D.length?C=D.concat(C):Y=-1,C.length&&Je())}function Je(){if(!G){var t=Xe(wt);G=!0;for(var e=C.length;e;){for(D=C,C=[];++Y<e;)D&&D[Y].run();Y=-1,e=C.length}D=null,G=!1,xt(t)}}h.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];C.push(new Qe(t,e)),C.length===1&&!G&&Xe(Je)};function Qe(t,e){this.fun=t,this.array=e}Qe.prototype.run=function(){this.fun.apply(null,this.array)};h.title="browser";h.browser=!0;h.env={};h.argv=[];h.version="";h.versions={};function F(){}h.on=F;h.addListener=F;h.once=F;h.off=F;h.removeListener=F;h.removeAllListeners=F;h.emit=F;h.prependListener=F;h.prependOnceListener=F;h.listeners=function(t){return[]};h.binding=function(t){throw new Error("process.binding is not supported")};h.cwd=function(){return"/"};h.chdir=function(t){throw new Error("process.chdir is not supported")};h.umask=function(){return 0}});var g,m,Cn,c=zr(()=>{g=$(Ye()),m=$($e()),Cn=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 In={};Z(In,{accountInfoSlice:()=>be,addCustomToast:()=>xn,addFailTransactionToast:()=>vn,addTransactionToast:()=>Sn,clearAllSignedTransactions:()=>an,clearAllTransactionsToSign:()=>on,clearNotificationModal:()=>Tn,clearSignedTransaction:()=>sn,clearTransactionToSign:()=>cn,clearTransactionsInfo:()=>dn,clearTransactionsInfoForSessionId:()=>mn,clearTxSubmittedModal:()=>hn,defaultNetwork:()=>hr,defaultTransactionErrorMessage:()=>Ir,defaultTransactionProcessingMessage:()=>Er,defaultTransactionSubmittedMessage:()=>Lr,defaultTransactionSuccessMessage:()=>kr,emptyAccount:()=>Se,initializeNetworkConfig:()=>Nt,invalidateLoginSession:()=>Ct,loginInfoSlice:()=>ye,modalsSlice:()=>ke,moveTransactionsToSignedState:()=>pn,networkConfigSlice:()=>Te,removeCustomToast:()=>wn,removeFailTransactionToast:()=>An,removeTransactionToast:()=>bn,setAccount:()=>Pt,setAccountLoadingError:()=>Ht,setAccountNonce:()=>Dt,setAccountShard:()=>Ut,setAddress:()=>Mt,setChainID:()=>Bt,setIsAccountLoading:()=>qt,setLedgerAccount:()=>Ot,setLedgerLogin:()=>Et,setLoginMethod:()=>It,setNotificationModal:()=>yn,setSignTransactionsCancelMessage:()=>un,setSignTransactionsError:()=>ln,setTokenLogin:()=>Lt,setTokenLoginSignature:()=>Rt,setTransactionsDisplayInfo:()=>gn,setTransactionsToSign:()=>nn,setTxSubmittedModal:()=>fn,setWalletConnectAccount:()=>zt,setWalletConnectLogin:()=>kt,setWalletLogin:()=>_t,setWebsocketEvent:()=>Wt,signTransactionsSlice:()=>Ie,toastsSlice:()=>Ee,transactionsSlice:()=>ve,updateLedgerAccount:()=>Gt,updateSignedTransactionStatus:()=>rn,updateSignedTransactions:()=>tn});module.exports=qr(In);c();c();var mr=require("@reduxjs/toolkit");c();c();var de={};Z(de,{getItem:()=>bt,localStorageKeys:()=>q,removeItem:()=>vt,setItem:()=>St});c();c();c();var X=()=>Date.now()/1e3;c();c();var q={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},pe=typeof localStorage!="undefined",St=({key:t,data:e,expires:r})=>{!pe||localStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},bt=t=>{if(!pe)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:X()>=r.expires?(localStorage.removeItem(String(t)),null):r.data},vt=t=>{!pe||localStorage.removeItem(String(t))};var ge={};Z(ge,{clear:()=>nr,getItem:()=>rr,removeItem:()=>tr,setItem:()=>er,storage:()=>At});c();var er=({key:t,data:e,expires:r})=>{sessionStorage.setItem(String(t),JSON.stringify({expires:r,data:e}))},rr=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},tr=t=>sessionStorage.removeItem(String(t)),nr=()=>sessionStorage.clear(),At={setItem:er,getItem:rr,removeItem:tr,clear:nr};var J={session:ge,local:de};function or(){return new Date().setHours(new Date().getHours()+24)}function ar(t){J.local.setItem({key:q.loginExpiresAt,data:t,expires:t})}c();c();var fe=require("@reduxjs/toolkit");c();c();c();c();c();c();c();c();c();c();var me={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:ir,egldLabel:ao}=me["devnet"],{chainId:sr,egldLabel:io}=me["testnet"],{chainId:cr,egldLabel:so}=me["mainnet"];var co={["devnet"]:ir,["testnet"]:sr,["mainnet"]:cr},lo={[ir]:"devnet",[sr]:"testnet",[cr]:"mainnet"};c();c();c();var lr="transaction-status-toast-id";var ur="logout",pr="login";var dr="0";var v=(0,fe.createAction)(ur),Q=(0,fe.createAction)(pr,t=>({payload:t}));var gr={loginMethod:"",walletConnectLogin:null,ledgerLogin:null,tokenLogin:null,walletLogin:null,extensionLogin:null,isLoginSessionInvalid:!1},ye=(0,mr.createSlice)({name:"loginInfoSlice",initialState:gr,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(v,()=>gr),t.addCase(Q,(e,r)=>{e.loginMethod=r.payload.loginMethod,ar(or())})}}),{setLoginMethod:It,setWalletConnectLogin:kt,setLedgerLogin:Et,setTokenLogin:Lt,setTokenLoginSignature:Rt,setWalletLogin:_t,invalidateLoginSession:Ct}=ye.actions,Ro=ye.reducer;c();var fr=require("@reduxjs/toolkit"),yr=$(require("lodash.omit"));c();c();c();c();function he(t){return t[Math.floor(Math.random()*t.length)]}c();var hr={id:"not-configured",chainId:"",name:"NOT CONFIGURED",egldLabel:"",decimals:"18",digits:"4",gasPerDataByte:"1500",walletConnectDeepLink:"",walletConnectBridgeAddress:"",walletConnectV2RelayAddress:"",walletConnectV2ProjectId:"",walletAddress:"",apiAddress:"",explorerAddress:"",apiTimeout:"4000"},Ft={network:hr,chainID:"-1"},Te=(0,fr.createSlice)({name:"appConfig",initialState:Ft,reducers:{initializeNetworkConfig:(t,e)=>{let r=he(e.payload.walletConnectBridgeAddresses),n=he(e.payload.walletConnectV2RelayAddresses),o=(0,yr.default)(e.payload,"walletConnectBridgeAddresses","walletConnectV2RelayAddresses");t.network=B(A(A({},t.network),o),{walletConnectBridgeAddress:r,walletConnectV2RelayAddress:n})},setChainID:(t,e)=>{t.chainID=e.payload}}}),{initializeNetworkConfig:Nt,setChainID:Bt}=Te.actions,jo=Te.reducer;c();var we=require("@elrondnetwork/erdjs"),Tr=require("@reduxjs/toolkit"),xr=require("redux-persist");var Se={balance:"...",address:"",nonce:0,txCount:0,scrCount:0,claimableRewards:dr},xe={address:"",websocketEvent:null,accounts:{"":Se},ledgerAccount:null,publicKey:"",walletConnectAccount:null,isAccountLoading:!0,accountLoadingError:null},be=(0,Tr.createSlice)({name:"accountInfoSlice",initialState:xe,reducers:{setAddress:(t,e)=>{let r=e.payload;t.address=r,t.publicKey=new we.Address(r).hex()},setAccount:(t,e)=>{let r=t.address===e.payload.address;t.accounts={[t.address]:r?e.payload:Se},t.isAccountLoading=!1,t.accountLoadingError=null},setAccountNonce:(t,e)=>{let{address:r}=t;t.accounts[r].nonce=e.payload},setAccountShard:(t,e)=>{t.shard=e.payload},setLedgerAccount:(t,e)=>{t.ledgerAccount=e.payload},updateLedgerAccount:(t,e)=>{t.ledgerAccount!=null&&(t.ledgerAccount.index=e.payload.index,t.ledgerAccount.address=e.payload.address)},setWalletConnectAccount:(t,e)=>{t.walletConnectAccount=e.payload},setIsAccountLoading:(t,e)=>{t.isAccountLoading=e.payload,t.accountLoadingError=null},setAccountLoadingError:(t,e)=>{t.accountLoadingError=e.payload,t.isAccountLoading=!1},setWebsocketEvent:(t,e)=>{t.websocketEvent={timestamp:Date.now(),message:e.payload}}},extraReducers:t=>{t.addCase(v,()=>(J.local.removeItem(q.loginExpiresAt),xe)),t.addCase(Q,(e,r)=>{let{address:n}=r.payload;e.address=n,e.publicKey=new we.Address(n).hex()}),t.addCase(xr.REHYDRATE,(e,r)=>{var p;if(!((p=r.payload)!=null&&p.account))return;let{account:n}=r.payload,{address:o,shard:a,accounts:i,publicKey:u}=n;e.address=o,e.shard=a;let l=i&&o in i;e.accounts=l?i:xe.accounts,e.publicKey=u})}}),{setAccount:Pt,setAddress:Mt,setAccountNonce:Dt,setAccountShard:Ut,setLedgerAccount:Ot,updateLedgerAccount:Gt,setWalletConnectAccount:zt,setIsAccountLoading:qt,setAccountLoadingError:Ht,setWebsocketEvent:Wt}=be.actions,$o=be.reducer;c();var br=require("@reduxjs/toolkit"),vr=require("redux-persist");c();var na=["sent"],Vt=["success"],Kt=["fail","cancelled","timedOut"],oa=["timedOut"],aa=["pending"],Yt=["success"],Xt=["fail","invalid"];function wr(t){return t!=null&&(Jt(t)||Zt(t))}function Sr(t){return t!=null&&(Qt(t)||$t(t))}function Jt(t){return t!=null&&Vt.includes(t)}function Qt(t){return t!=null&&Kt.includes(t)}function Zt(t){return t!=null&&Yt.includes(t)}function $t(t){return t!=null&&Xt.includes(t)}var H={signedTransactions:{},transactionsToSign:null,signTransactionsError:null,signTransactionsCancelMessage:null,customTransactionInformationForSessionId:{}},en={signWithoutSending:!1,sessionInformation:null,redirectAfterSign:!1},ve=(0,br.createSlice)({name:"transactionsSlice",initialState:H,reducers:{moveTransactionsToSignedState:(t,e)=>{var l,p;let{sessionId:r,transactions:n,errorMessage:o,status:a,redirectRoute:i}=e.payload,u=((l=t.customTransactionInformationForSessionId)==null?void 0:l[r])||en;t.signedTransactions[r]={transactions:n,status:a,errorMessage:o,redirectRoute:i,customTransactionInformation:u},((p=t==null?void 0:t.transactionsToSign)==null?void 0:p.sessionId)===r&&(t.transactionsToSign=H.transactionsToSign)},clearSignedTransaction:(t,e)=>{t.signedTransactions[e.payload]&&delete t.signedTransactions[e.payload]},clearTransactionToSign:t=>{t!=null&&t.transactionsToSign&&(t.transactionsToSign=null)},updateSignedTransaction:(t,e)=>{t.signedTransactions=A(A({},t.signedTransactions),e.payload)},updateSignedTransactions:(t,e)=>{let{sessionId:r,status:n,errorMessage:o,transactions:a}=e.payload;t.signedTransactions[r]!=null&&(t.signedTransactions[r].status=n,o!=null&&(t.signedTransactions[r].errorMessage=o),a!=null&&(t.signedTransactions[r].transactions=a))},updateSignedTransactionStatus:(t,e)=>{var u,l,p,y,d,x;let{sessionId:r,status:n,errorMessage:o,transactionHash:a}=e.payload,i=(l=(u=t.signedTransactions)==null?void 0:u[r])==null?void 0:l.transactions;if(i!=null){t.signedTransactions[r].transactions=i.map(R=>R.hash===a?B(A({},R),{status:n,errorMessage:o}):R);let w=(y=(p=t.signedTransactions[r])==null?void 0:p.transactions)==null?void 0:y.every(R=>wr(R.status)),N=(x=(d=t.signedTransactions[r])==null?void 0:d.transactions)==null?void 0:x.every(R=>Sr(R.status));w&&(t.signedTransactions[r].status="success"),N&&(t.signedTransactions[r].status="fail")}},setTransactionsToSign:(t,e)=>{t.transactionsToSign=e.payload;let{sessionId:r,customTransactionInformation:n}=e.payload;t.customTransactionInformationForSessionId[r]=n,t.signTransactionsError=null},clearAllTransactionsToSign:t=>{t.transactionsToSign=H.transactionsToSign,t.signTransactionsError=null},clearAllSignedTransactions:t=>{t.signedTransactions=H.signedTransactions},setSignTransactionsError:(t,e)=>{t.signTransactionsError=e.payload},setSignTransactionsCancelMessage:(t,e)=>{t.signTransactionsCancelMessage=e.payload}},extraReducers:t=>{t.addCase(v,()=>H),t.addCase(vr.REHYDRATE,(e,r)=>{var i;if(e.signTransactionsCancelMessage=null,!((i=r.payload)!=null&&i.transactions))return;let{signedTransactions:n,customTransactionInformationForSessionId:o}=r.payload.transactions,a=Object.entries(n).reduce((u,[l,p])=>{let y=new Date(l),d=new Date;return d.setHours(d.getHours()+5),d-y>0||(u[l]=p),u},{});o!=null&&(e.customTransactionInformationForSessionId=o),n!=null&&(e.signedTransactions=a)})}}),{updateSignedTransactionStatus:rn,updateSignedTransactions:tn,setTransactionsToSign:nn,clearAllTransactionsToSign:on,clearAllSignedTransactions:an,clearSignedTransaction:sn,clearTransactionToSign:cn,setSignTransactionsError:ln,setSignTransactionsCancelMessage:un,moveTransactionsToSignedState:pn}=ve.actions,da=ve.reducer;c();var Ar=require("@reduxjs/toolkit");var Ir="Transaction failed",kr="Transaction successful",Er="Processing transaction",Lr="Transaction submitted",Ae={},Ie=(0,Ar.createSlice)({name:"transactionsInfo",initialState:Ae,reducers:{setTransactionsDisplayInfo(t,e){let{sessionId:r,transactionsDisplayInfo:n}=e.payload;r!=null&&(t[r]={errorMessage:(n==null?void 0:n.errorMessage)||Ir,successMessage:(n==null?void 0:n.successMessage)||kr,processingMessage:(n==null?void 0:n.processingMessage)||Er,submittedMessage:(n==null?void 0:n.submittedMessage)||Lr,transactionDuration:n==null?void 0:n.transactionDuration})},clearTransactionsInfoForSessionId(t,e){e.payload!=null&&delete t[e.payload]},clearTransactionsInfo:()=>Ae},extraReducers:t=>{t.addCase(v,()=>Ae)}}),{clearTransactionsInfo:dn,setTransactionsDisplayInfo:gn,clearTransactionsInfoForSessionId:mn}=Ie.actions,ya=Ie.reducer;c();var _r=require("@reduxjs/toolkit");var Rr={},ke=(0,_r.createSlice)({name:"modalsSlice",initialState:Rr,reducers:{setTxSubmittedModal:(t,e)=>{t.txSubmittedModal=e.payload},setNotificationModal:(t,e)=>{t.notificationModal=e.payload},clearTxSubmittedModal:t=>{t.txSubmittedModal=void 0},clearNotificationModal:t=>{t.notificationModal=void 0}},extraReducers:t=>{t.addCase(v,()=>Rr)}}),{setTxSubmittedModal:fn,setNotificationModal:yn,clearTxSubmittedModal:hn,clearNotificationModal:Tn}=ke.actions,wa=ke.reducer;c();var Fr=require("@reduxjs/toolkit"),Nr=require("redux-persist");var Cr={customToasts:[],transactionToasts:[],failTransactionToast:null},Ee=(0,Fr.createSlice)({name:"toastsSlice",initialState:Cr,reducers:{addCustomToast:(t,e)=>{t.customToasts.push(B(A({},e.payload),{type:"custom",toastId:e.payload.toastId||`custom-toast-${t.customToasts.length+1}`}))},removeCustomToast:(t,e)=>{t.customToasts=t.customToasts.filter(r=>r.toastId!==e.payload)},addTransactionToast:(t,e)=>{t.transactionToasts.push({type:"transaction",startTimestamp:X(),toastId:e.payload||`custom-toast-${t.transactionToasts.length+1}`})},removeTransactionToast:(t,e)=>{t.transactionToasts=t.transactionToasts.filter(r=>r.toastId!==e.payload)},addFailTransactionToast:(t,e)=>{t.failTransactionToast=B(A({},e.payload),{toastId:lr})},removeFailTransactionToast:t=>{t.failTransactionToast=null}},extraReducers:t=>{t.addCase(v,()=>Cr),t.addCase(Nr.REHYDRATE,(e,r)=>{var o,a;let n=(a=(o=r.customToasts)==null?void 0:o.filter(i=>!("component"in i)))!=null?a:[];e.customToasts=n})}}),{addCustomToast:xn,removeCustomToast:wn,addTransactionToast:Sn,removeTransactionToast:bn,addFailTransactionToast:vn,removeFailTransactionToast:An}=Ee.actions,La=Ee.reducer;0&&(module.exports={accountInfoSlice,addCustomToast,addFailTransactionToast,addTransactionToast,clearAllSignedTransactions,clearAllTransactionsToSign,clearNotificationModal,clearSignedTransaction,clearTransactionToSign,clearTransactionsInfo,clearTransactionsInfoForSessionId,clearTxSubmittedModal,defaultNetwork,defaultTransactionErrorMessage,defaultTransactionProcessingMessage,defaultTransactionSubmittedMessage,defaultTransactionSuccessMessage,emptyAccount,initializeNetworkConfig,invalidateLoginSession,loginInfoSlice,modalsSlice,moveTransactionsToSignedState,networkConfigSlice,removeCustomToast,removeFailTransactionToast,removeTransactionToast,setAccount,setAccountLoadingError,setAccountNonce,setAccountShard,setAddress,setChainID,setIsAccountLoading,setLedgerAccount,setLedgerLogin,setLoginMethod,setNotificationModal,setSignTransactionsCancelMessage,setSignTransactionsError,setTokenLogin,setTokenLoginSignature,setTransactionsDisplayInfo,setTransactionsToSign,setTxSubmittedModal,setWalletConnectAccount,setWalletConnectLogin,setWalletLogin,setWebsocketEvent,signTransactionsSlice,toastsSlice,transactionsSlice,updateLedgerAccount,updateSignedTransactionStatus,updateSignedTransactions}); /*! * 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=index.js.map