UNPKG

@sofaws/dapp-core

Version:

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

11 lines (10 loc) 38.7 kB
"use strict";var Gr=Object.create;var Z=Object.defineProperty,Hr=Object.defineProperties,zr=Object.getOwnPropertyDescriptor,jr=Object.getOwnPropertyDescriptors,qr=Object.getOwnPropertyNames,Ce=Object.getOwnPropertySymbols,Wr=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty,Yr=Object.prototype.propertyIsEnumerable;var Oe=(t,e,r)=>e in t?Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,te=(t,e)=>{for(var r in e||(e={}))Be.call(e,r)&&Oe(t,r,e[r]);if(Ce)for(var r of Ce(e))Yr.call(e,r)&&Oe(t,r,e[r]);return t},ne=(t,e)=>Hr(t,jr(e));var Zr=(t,e)=>()=>(t&&(e=t(t=0)),e);var ie=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Kr=(t,e)=>{for(var r in e)Z(t,r,{get:e[r],enumerable:!0})},Ue=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of qr(e))!Be.call(t,i)&&i!==r&&Z(t,i,{get:()=>e[i],enumerable:!(n=zr(e,i))||n.enumerable});return t};var U=(t,e,r)=>(r=t!=null?Gr(Wr(t)):{},Ue(e||!t||!t.__esModule?Z(r,"default",{value:t,enumerable:!0}):r,t)),Xr=t=>Ue(Z({},"__esModule",{value:!0}),t);var $e=ie(oe=>{"use strict";s();oe.byteLength=Jr;oe.toByteArray=rt;oe.fromByteArray=it;var N=[],I=[],Qr=typeof Uint8Array!="undefined"?Uint8Array:Array,de="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($=0,Pe=de.length;$<Pe;++$)N[$]=de[$],I[de.charCodeAt($)]=$;var $,Pe;I["-".charCodeAt(0)]=62;I["_".charCodeAt(0)]=63;function Me(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 Jr(t){var e=Me(t),r=e[0],n=e[1];return(r+n)*3/4-n}function et(t,e,r){return(e+r)*3/4-r}function rt(t){var e,r=Me(t),n=r[0],i=r[1],o=new Qr(et(t,n,i)),a=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=I[t.charCodeAt(u)]<<18|I[t.charCodeAt(u+1)]<<12|I[t.charCodeAt(u+2)]<<6|I[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=I[t.charCodeAt(u)]<<2|I[t.charCodeAt(u+1)]>>4,o[a++]=e&255),i===1&&(e=I[t.charCodeAt(u)]<<10|I[t.charCodeAt(u+1)]<<4|I[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function tt(t){return N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[t&63]}function nt(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(tt(n));return i.join("")}function it(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,c=r-n;a<c;a+=o)i.push(nt(t,a,a+o>c?c:a+o));return n===1?(e=t[r-1],i.push(N[e>>2]+N[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(N[e>>10]+N[e>>4&63]+N[e<<2&63]+"=")),i.join("")}});var Ve=ie(fe=>{s();fe.read=function(t,e,r,n,i){var o,a,c=i*8-n-1,u=(1<<c)-1,d=u>>1,h=-7,f=r?i-1:0,y=r?-1:1,T=t[e+f];for(f+=y,o=T&(1<<-h)-1,T>>=-h,h+=c;h>0;o=o*256+t[e+f],f+=y,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[e+f],f+=y,h-=8);if(o===0)o=1-d;else{if(o===u)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-d}return(T?-1:1)*a*Math.pow(2,o-n)};fe.write=function(t,e,r,n,i,o){var a,c,u,d=o*8-i-1,h=(1<<d)-1,f=h>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=n?0:o-1,b=n?1:-1,B=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=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+f>=1?e+=y/u:e+=y*Math.pow(2,1-f),e*u>=2&&(a++,u/=2),a+f>=h?(c=0,a=h):a+f>=1?(c=(e*u-1)*Math.pow(2,i),a=a+f):(c=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[r+T]=c&255,T+=b,c/=256,i-=8);for(a=a<<i|c,d+=i;d>0;t[r+T]=a&255,T+=b,a/=256,d-=8);t[r+T-b]|=B*128}});var er=ie(j=>{"use strict";s();var he=$e(),z=Ve(),Ge=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j.Buffer=l;j.SlowBuffer=ut;j.INSPECT_MAX_BYTES=50;var ae=2147483647;j.kMaxLength=ae;l.TYPED_ARRAY_SUPPORT=ot();!l.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 ot(){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(l.prototype,"parent",{enumerable:!0,get:function(){if(!!l.isBuffer(this))return this.buffer}});Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(!!l.isBuffer(this))return this.byteOffset}});function R(t){if(t>ae)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(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 we(t)}return je(t,e,r)}l.poolSize=8192;function je(t,e,r){if(typeof t=="string")return st(t,e);if(ArrayBuffer.isView(t))return lt(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(S(t,ArrayBuffer)||t&&S(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(S(t,SharedArrayBuffer)||t&&S(t.buffer,SharedArrayBuffer)))return Te(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 l.from(n,e,r);var i=ct(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return l.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)}l.from=function(t,e,r){return je(t,e,r)};Object.setPrototypeOf(l.prototype,Uint8Array.prototype);Object.setPrototypeOf(l,Uint8Array);function qe(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 at(t,e,r){return qe(t),t<=0?R(t):e!==void 0?typeof r=="string"?R(t).fill(e,r):R(t).fill(e):R(t)}l.alloc=function(t,e,r){return at(t,e,r)};function we(t){return qe(t),R(t<0?0:be(t)|0)}l.allocUnsafe=function(t){return we(t)};l.allocUnsafeSlow=function(t){return we(t)};function st(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=We(t,e)|0,n=R(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function ye(t){for(var e=t.length<0?0:be(t.length)|0,r=R(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function lt(t){if(S(t,Uint8Array)){var e=new Uint8Array(t);return Te(e.buffer,e.byteOffset,e.byteLength)}return ye(t)}function Te(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,l.prototype),n}function ct(t){if(l.isBuffer(t)){var e=be(t.length)|0,r=R(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ve(t.length)?R(0):ye(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ye(t.data)}function be(t){if(t>=ae)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ae.toString(16)+" bytes");return t|0}function ut(t){return+t!=t&&(t=0),l.alloc(+t)}l.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==l.prototype};l.compare=function(e,r){if(S(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),S(r,Uint8Array)&&(r=l.from(r,r.offset,r.byteLength)),!l.isBuffer(e)||!l.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};l.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}};l.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return l.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=l.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(S(a,Uint8Array))o+a.length>i.length?l.from(a).copy(i,o):Uint8Array.prototype.set.call(i,a,o);else if(l.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(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||S(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 xe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Je(t).length;default:if(i)return n?-1:xe(t).length;e=(""+e).toLowerCase(),i=!0}}l.byteLength=We;function pt(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 bt(this,e,r);case"utf8":case"utf-8":return Ze(this,e,r);case"ascii":return xt(this,e,r);case"latin1":case"binary":return wt(this,e,r);case"base64":return yt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vt(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}l.prototype._isBuffer=!0;function V(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}l.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)V(this,r,r+1);return this};l.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)V(this,r,r+3),V(this,r+1,r+2);return this};l.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)V(this,r,r+7),V(this,r+1,r+6),V(this,r+2,r+5),V(this,r+3,r+4);return this};l.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?Ze(this,0,e):pt.apply(this,arguments)};l.prototype.toLocaleString=l.prototype.toString;l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:l.compare(this,e)===0};l.prototype.inspect=function(){var e="",r=j.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Ge&&(l.prototype[Ge]=l.prototype.inspect);l.prototype.compare=function(e,r,n,i,o){if(S(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.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),h=e.slice(r,n),f=0;f<u;++f)if(d[f]!==h[f]){a=d[f],c=h[f];break}return a<c?-1:c<a?1:0};function Ye(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,ve(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=l.from(e,n)),l.isBuffer(e))return e.length===0?-1:He(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):He(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function He(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(T,b){return o===1?T[b]:T.readUInt16BE(b*o)}var d;if(i){var h=-1;for(d=r;d<a;d++)if(u(t,d)===u(e,h===-1?0:d-h)){if(h===-1&&(h=d),d-h+1===c)return h*o}else h!==-1&&(d-=d-h),h=-1}else for(r+c>a&&(r=a-c),d=r;d>=0;d--){for(var f=!0,y=0;y<c;y++)if(u(t,d+y)!==u(e,y)){f=!1;break}if(f)return d}return-1}l.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};l.prototype.indexOf=function(e,r,n){return Ye(this,e,r,n,!0)};l.prototype.lastIndexOf=function(e,r,n){return Ye(this,e,r,n,!1)};function mt(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(ve(c))return a;t[r+a]=c}return a}function gt(t,e,r,n){return se(xe(e,t.length-r),t,r,n)}function dt(t,e,r,n){return se(Et(e),t,r,n)}function ft(t,e,r,n){return se(Je(e),t,r,n)}function ht(t,e,r,n){return se(At(e,t.length-r),t,r,n)}l.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 mt(this,e,r,n);case"utf8":case"utf-8":return gt(this,e,r,n);case"ascii":case"latin1":case"binary":return dt(this,e,r,n);case"base64":return ft(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function yt(t,e,r){return e===0&&r===t.length?he.fromByteArray(t):he.fromByteArray(t.slice(e,r))}function Ze(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,h,f;switch(c){case 1:o<128&&(a=o);break;case 2:u=t[i+1],(u&192)===128&&(f=(o&31)<<6|u&63,f>127&&(a=f));break;case 3:u=t[i+1],d=t[i+2],(u&192)===128&&(d&192)===128&&(f=(o&15)<<12|(u&63)<<6|d&63,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:u=t[i+1],d=t[i+2],h=t[i+3],(u&192)===128&&(d&192)===128&&(h&192)===128&&(f=(o&15)<<18|(u&63)<<12|(d&63)<<6|h&63,f>65535&&f<1114112&&(a=f))}}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 Tt(n)}var ze=4096;function Tt(t){var e=t.length;if(e<=ze)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=ze));return r}function xt(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 wt(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 bt(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+=Nt[t[o]];return i}function vt(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}l.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,l.prototype),i};function w(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")}l.prototype.readUintLE=l.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||w(e,r,this.length);for(var i=this[e],o=1,a=0;++a<r&&(o*=256);)i+=this[e+a]*o;return i};l.prototype.readUintBE=l.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||w(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};l.prototype.readUint8=l.prototype.readUInt8=function(e,r){return e=e>>>0,r||w(e,1,this.length),this[e]};l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||w(e,2,this.length),this[e]|this[e+1]<<8};l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||w(e,2,this.length),this[e]<<8|this[e+1]};l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||w(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};l.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||w(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};l.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||w(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};l.prototype.readInt8=function(e,r){return e=e>>>0,r||w(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};l.prototype.readInt16LE=function(e,r){e=e>>>0,r||w(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};l.prototype.readInt16BE=function(e,r){e=e>>>0,r||w(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};l.prototype.readInt32LE=function(e,r){return e=e>>>0,r||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};l.prototype.readInt32BE=function(e,r){return e=e>>>0,r||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};l.prototype.readFloatLE=function(e,r){return e=e>>>0,r||w(e,4,this.length),z.read(this,e,!0,23,4)};l.prototype.readFloatBE=function(e,r){return e=e>>>0,r||w(e,4,this.length),z.read(this,e,!1,23,4)};l.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||w(e,8,this.length),z.read(this,e,!0,52,8)};l.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||w(e,8,this.length),z.read(this,e,!1,52,8)};function v(t,e,r,n,i,o){if(!l.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")}l.prototype.writeUintLE=l.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;v(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};l.prototype.writeUintBE=l.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;v(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};l.prototype.writeUint8=l.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||v(this,e,r,1,255,0),this[r]=e&255,r+1};l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||v(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||v(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||v(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};l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||v(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};l.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);v(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};l.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);v(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};l.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||v(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};l.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||v(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};l.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||v(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};l.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||v(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};l.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||v(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 Ke(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 Xe(t,e,r,n,i){return e=+e,r=r>>>0,i||Ke(t,e,r,4,34028234663852886e22,-34028234663852886e22),z.write(t,e,r,n,23,4),r+4}l.prototype.writeFloatLE=function(e,r,n){return Xe(this,e,r,!0,n)};l.prototype.writeFloatBE=function(e,r,n){return Xe(this,e,r,!1,n)};function Qe(t,e,r,n,i){return e=+e,r=r>>>0,i||Ke(t,e,r,8,17976931348623157e292,-17976931348623157e292),z.write(t,e,r,n,52,8),r+8}l.prototype.writeDoubleLE=function(e,r,n){return Qe(this,e,r,!0,n)};l.prototype.writeDoubleBE=function(e,r,n){return Qe(this,e,r,!1,n)};l.prototype.copy=function(e,r,n,i){if(!l.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};l.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"&&!l.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=l.isBuffer(e)?e:l.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 kt=/[^+/0-9A-Za-z-_]/g;function It(t){if(t=t.split("=")[0],t=t.trim().replace(kt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function xe(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 Et(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function At(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 Je(t){return he.toByteArray(It(t))}function se(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 S(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ve(t){return t!==t}var Nt=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 or=ie((Xt,ir)=>{s();var x=ir.exports={},D,_;function ke(){throw new Error("setTimeout has not been defined")}function Ie(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?D=setTimeout:D=ke}catch(t){D=ke}try{typeof clearTimeout=="function"?_=clearTimeout:_=Ie}catch(t){_=Ie}})();function rr(t){if(D===setTimeout)return setTimeout(t,0);if((D===ke||!D)&&setTimeout)return D=setTimeout,setTimeout(t,0);try{return D(t,0)}catch(e){try{return D.call(null,t,0)}catch(r){return D.call(this,t,0)}}}function St(t){if(_===clearTimeout)return clearTimeout(t);if((_===Ie||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(t);try{return _(t)}catch(e){try{return _.call(null,t)}catch(r){return _.call(this,t)}}}var F=[],q=!1,G,le=-1;function Dt(){!q||!G||(q=!1,G.length?F=G.concat(F):le=-1,F.length&&tr())}function tr(){if(!q){var t=rr(Dt);q=!0;for(var e=F.length;e;){for(G=F,F=[];++le<e;)G&&G[le].run();le=-1,e=F.length}G=null,q=!1,St(t)}}x.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];F.push(new nr(t,e)),F.length===1&&!q&&rr(tr)};function nr(t,e){this.fun=t,this.array=e}nr.prototype.run=function(){this.fun.apply(null,this.array)};x.title="browser";x.browser=!0;x.env={};x.argv=[];x.version="";x.versions={};function L(){}x.on=L;x.addListener=L;x.once=L;x.off=L;x.removeListener=L;x.removeAllListeners=L;x.emit=L;x.prependListener=L;x.prependOnceListener=L;x.listeners=function(t){return[]};x.binding=function(t){throw new Error("process.binding is not supported")};x.cwd=function(){return"/"};x.chdir=function(t){throw new Error("process.chdir is not supported")};x.umask=function(){return 0}});var p,m,Qt,s=Zr(()=>{p=U(er()),m=U(or()),Qt=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 jt={};Kr(jt,{explorerUrlBuilder:()=>K,getExplorerLink:()=>Ct,getHumanReadableTimeFormat:()=>Bt,getOperationsMessages:()=>Ut,getReceiptMessage:()=>Mt,getTransactionMethod:()=>Ft,getTransactionReceiver:()=>De,getTransactionReceiverAssets:()=>_t,getTransactionTokens:()=>Se,getTransactionTransferType:()=>Ot,getTransactionValue:()=>zt});module.exports=Xr(jt);s();s();s();var P="accounts",H="transactions";var W="tokens",ar="blocks";var sr="nodes",lr="identities",cr="collections",Ee="nfts",Ae="providers",Ne="sc-results",ur="contracts",pr="logs",mr="code",gr="locked-accounts",dr="roles";var K={shard:t=>`/${ar}?shard=${t}`,receiverShard:t=>`/${H}?receivershard=${t}`,senderShard:t=>`/${H}?sendershard=${t}`,transactionDetails:t=>`/${H}/${t}`,transactionDetailsScResults:t=>`/${H}/${t}/${Ne}`,transactionDetailsLogs:t=>`/${H}/${t}/${pr}`,nodeDetails:t=>`/${sr}/${t}`,accountDetails:t=>`/${P}/${t}`,accountDetailsContractCode:t=>`/${P}/${t}/${mr}`,accountDetailsTokens:t=>`/${P}/${t}/${W}`,accountDetailsNfts:t=>`/${P}/${t}/${Ee}`,accountDetailsScResults:t=>`/${P}/${t}/${Ne}`,accountDetailsContracts:t=>`/${P}/${t}/${ur}`,identityDetails:t=>`/${lr}/${t}`,tokenDetails:t=>`/${W}/${t}`,tokenDetailsAccounts:t=>`/${W}/${t}/${P}`,tokenDetailsLockedAccounts:t=>`/${W}/${t}/${gr}`,tokenDetailsRoles:t=>`/${W}/${t}/${dr}`,collectionDetails:t=>`/${cr}/${t}`,nftDetails:t=>`/${Ee}/${t}`,providerDetails:t=>`/${Ae}/${t}`,providerDetailsTransactions:t=>`/${Ae}/${t}/${H}`};s();var Se=t=>{var e,r,n,i;if(t.action){let o=[(e=t.action.arguments)==null?void 0:e.token,(r=t.action.arguments)==null?void 0:r.token1,(n=t.action.arguments)==null?void 0:n.token2,(i=t.action.arguments)==null?void 0:i.transfers].filter(c=>c!=null);return[].concat(...o)}return[]};s();s();function De(t){var r,n;let e=t.receiver;return(n=(r=t.action)==null?void 0:r.arguments)!=null&&n.receiver&&(e=t.action.arguments.receiver),e}function _t(t){let e=De(t);return t.receiver===e?t.receiverAssets:void 0}s();s();var _e=(n=>(n.nft="nft",n.esdt="esdt",n.egld="egld",n))(_e||{});var Ft=t=>{var n,i,o,a,c,u;let e="Transaction";return((n=t.action)==null?void 0:n.name)&&((i=t.action)==null?void 0:i.category)&&(((o=t.action)==null?void 0:o.category)==="esdtNft"&&((a=t.action)==null?void 0:a.name)==="transfer"?e="Transaction":t.action&&(e=t.action.name),(u=(c=t.action)==null?void 0:c.arguments)!=null&&u.functionName&&(e=t.action.arguments.functionName)),e};s();var fr=!1;function Lt(t){fr||(console.error(t),fr=!0)}function Ct({explorerAddress:t,to:e}){try{return new URL(e).href}catch(r){return e.startsWith("/")||(Lt(`Link not prepended by / : ${e}`),e=`/${e}`),t?`${t}${e}`:e}}s();function Ot(t,e,r){let n=t===e.sender,i=t===r,o=n&&i,a=(e==null?void 0:e.type)==="SmartContractResult";switch(!0){case a:return"Internal";case o:return"Self";case i:return"In";case n:default:return"Out"}}s();function Bt({value:t,noSeconds:e,utc:r}){let n=new Date(t*1e3),[,i]=n.toLocaleString("en-US",{hour:"numeric",hour12:!0}).split(" "),o=n.toUTCString(),[,a]=o.split(","),[c,u,d,h]=a.trim().split(" "),[f,y,T]=h.split(":"),b=`:${T}`,B=`${f}:${y}${e?"":b}`;return`${u} ${c}, ${d} ${B} ${i}${r?" UTC":""}`}s();function Ut(t){var e,r;return(r=(e=t==null?void 0:t.operations)==null?void 0:e.map(n=>n.message).filter(n=>Boolean(n)))!=null?r:[]}s();var vr=U(require("bignumber.js"));s();s();s();s();s();s();s();s();s();s();var Re={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:hr,egldLabel:Cn}=Re["devnet"],{chainId:yr,egldLabel:On}=Re["testnet"],{chainId:Tr,egldLabel:Bn}=Re["mainnet"];var Un={["devnet"]:hr,["testnet"]:yr,["mainnet"]:Tr},Pn={[hr]:"devnet",[yr]:"testnet",[Tr]:"mainnet"};s();s();s();var k=18,X=4;var xr="refundedGas";var ce="0";s();var br=require("@elrondnetwork/erdjs"),M=U(require("bignumber.js"));s();var wr=U(require("bignumber.js")),Fe=(t,e=!0)=>{let r=String(t);if(!r.match(/^[-]?\d+$/))return!1;let n=new wr.default(r),i=e?0:-1;return n.toString(10)===r&&n.comparedTo(0)>=i};s();function C(t){return{if:function(e){return e?{then:r=>r instanceof Function?C(r(t)):C(r)}:{then:()=>C(t)}},then:e=>e instanceof Function?C(e(t)):C(e),valueOf:function(){return t}}}M.default.config({ROUNDING_MODE:M.default.ROUND_FLOOR});function O({input:t,decimals:e=k,digits:r=X,showLastNonZeroDecimal:n=!0,showIsLessThanDecimalsLabel:i=!1,addCommas:o=!1}){if(!Fe(t,!1))throw new Error("Invalid input");let a=new M.default(t).isNegative(),c=t;return a&&(c=t.substring(1)),C(c).then(()=>br.TokenPayment.fungibleFromBigInteger("",c,e).toRationalNumber()).then(u=>{let d=new M.default(u);if(d.isZero())return ce;let h=d.toString(10),[f,y]=h.split("."),T=new M.default(y||0),b=C(0).if(Boolean(y&&n)).then(()=>Math.max(y.length,r)).if(T.isZero()&&!n).then(0).if(Boolean(y&&!n)).then(()=>Math.min(y.length,r)).valueOf(),B=y&&r>=1&&r<=y.length&&T.isGreaterThan(0)&&new M.default(y.substring(0,r)).isZero(),Q=d.toFormat(b);return C(h).if(o).then(Q).if(Boolean(B)).then(J=>{let Y=new M.default(f).isZero(),[A,ee]=J.split("."),re=new Array(r-1).fill(0),$r=[...re,0].join(""),Vr=[...re,1].join("");return Y?i?`<${A}.${Vr}`:n?`${A}.${ee}`:A:`${A}.${$r}`}).if(Boolean(!B&&y)).then(J=>{let[Y]=J.split("."),A=y.substring(0,b);if(n){let ee=r-A.length;if(ee>0){let re=Array(ee).fill(0).join("");return A=`${A}${re}`,`${Y}.${A}`}return J}return A?`${Y}.${A}`:Y}).valueOf()}).if(a).then(u=>`-${u}`).valueOf()}var Pt=t=>{var e,r;if(!((e=t.receipt)!=null&&e.value))return"";if(((r=t.receipt)==null?void 0:r.data)===xr){let n=O({input:t.receipt.value,decimals:k,digits:X,showLastNonZeroDecimal:!0});return new vr.default(n).times(t.gasPrice).times(100).toFixed()}return t.receipt.value};function Mt(t){var i;let e=(i=t.receipt)==null?void 0:i.data;if(!e)return"";let r=Pt(t),n=r?`: ${r}`:"";return`${e}${n}`}s();s();s();s();var ue=(n=>(n.NonFungibleESDT="NonFungibleESDT",n.SemiFungibleESDT="SemiFungibleESDT",n.MetaESDT="MetaESDT",n))(ue||{});s();s();s();s();s();var $t=require("@elrondnetwork/erdjs");s();var pe=require("@elrondnetwork/erdjs"),Gt=require("@elrondnetwork/erdjs"),Ht=require("@elrondnetwork/erdjs-network-providers");s();s();var Vt=U(require("bignumber.js"));s();s();var Le={isEsdt:!1,isNft:!1,isEgld:!1};function kr(t){let e=t==null?void 0:t.split("-").length;return e===2?ne(te({},Le),{isEsdt:!0}):e===3?ne(te({},Le),{isNft:!0}):ne(te({},Le),{isEgld:!0})}s();s();s();function me({token:t,noValue:e,showLastNonZeroDecimal:r}){var d;let n=!e&&t.value&&t.type!=="NonFungibleESDT",i=t.decimals!=null,o="";t.type==="NonFungibleESDT"&&(o="NFT"),t.type==="SemiFungibleESDT"&&(o="SFT"),t.type==="MetaESDT"&&(o="Meta-ESDT");let a="";n&&i&&(a=i?O({input:t.value,decimals:t.decimals,digits:2,showLastNonZeroDecimal:r}):Number(t.value).toLocaleString("en"));let c=K.nftDetails(String(t.identifier)),u=t.ticker===t.collection&&(d=t.identifier)!=null?d:t.ticker;return{badgeText:o,tokenFormattedAmount:n?a:null,tokenExplorerLink:c,tokenLinkText:u,token:t,noValue:e,showLastNonZeroDecimal:r}}s();function ge({token:t,noValue:e,showLastNonZeroDecimal:r}){var c;let n=Boolean(!e&&t.value),i=n?O({input:t.value,decimals:(c=t.decimals)!=null?c:k,digits:2,showLastNonZeroDecimal:r,addCommas:!0}):null,o=K.tokenDetails(String(t.token)),a=t.ticker;return{tokenExplorerLink:o,tokenFormattedAmount:i,showFormattedAmount:n,tokenLinkText:a,token:t,showLastNonZeroDecimal:r}}s();var Ir=["reDelegateRewards","claimRewards","unBond"],Er=["wrapEgld","unwrapEgld"],Ar=["unStake"],Nr=["unDelegate"];s();s();var Sr=t=>{let e=t.map(n=>{let{isNft:i}=kr(n.type);if(i){let{badgeText:h,tokenFormattedAmount:f,tokenLinkText:y}=me({token:n});return`${h!=null?`(${h}) `:""}${f} ${y}`}let{tokenFormattedAmount:o,tokenLinkText:a,token:c}=ge({token:n}),u=c.collection?c.identifier:c.token;return`${o} ${a} (${u})`});return decodeURI(e.join("%0A"))};s();var E=t=>({egldValueData:{value:t,formattedValue:O({input:t}),decimals:k}});s();var Rr=U(require("bignumber.js"));s();s();s();s();function Dr(t){return atob(t)}var _r=!1;function Fr(t){var e;try{let n=Dr(t.data).replace(`${(e=t.action)==null?void 0:e.name}@`,""),i=new Rr.default(n,16);if(!i.isNaN())return E(i.toString(10))}catch(r){_r||(console.error(`Unable to extract value for txHash: ${t.txHash}`),_r=!0)}return E(t.value)}s();s();var Lr=t=>{var r,n;return(n=(r=t==null?void 0:t.operations)==null?void 0:r.filter(i=>Object.values(_e).includes(i.type)))!=null?n:[]};var Cr=!1,Or=t=>{Cr||(console.error(`Operations field missing for txHash: ${t}. Unable to compute value field.`),Cr=!0)};function Br(t){try{if(t.operations){let[e]=Lr(t);return E(e==null?void 0:e.value)}else Or(t.txHash)}catch(e){Or(t.txHash)}return E(t.value)}s();var Pr=U(require("bignumber.js"));var Ur=!1;function Mr(t){var r,n,i,o,a;return new Pr.default((n=(r=t.action)==null?void 0:r.arguments)==null?void 0:n.value).isNaN()?(Ur||(console.error(`Unable to interpret ${(a=t.action)==null?void 0:a.name} data for txHash: ${t.txHash}`),Ur=!0),E(t.value)):E((o=(i=t.action)==null?void 0:i.arguments)==null?void 0:o.value)}var zt=({transaction:t,hideMultipleBadge:e})=>{var r;if(t.action){if(Er.includes(t.action.name))return E(t.value);if(Ar.includes(t.action.name))return Fr(t);if(Ir.includes(t.action.name))return Br(t);if(Nr.includes(t.action.name))return Mr(t);let n=Se(t);if(n.length){let i=n[0],o=Object.values(ue).includes(i.type),c=!e&&n.length>1?Sr(n):"";if(o){let{badgeText:T,tokenFormattedAmount:b,tokenExplorerLink:B,tokenLinkText:Q}=me({token:i});return{nftValueData:{badgeText:T,tokenFormattedAmount:b,tokenExplorerLink:B,tokenLinkText:Q,transactionTokens:n,token:i,value:b!=null?i.value:null,decimals:b!=null?i.decimals:null,titleText:c}}}let{tokenExplorerLink:u,showFormattedAmount:d,tokenFormattedAmount:h,tokenLinkText:f,token:y}=ge({token:i});return{tokenValueData:{tokenExplorerLink:u,showFormattedAmount:d,tokenFormattedAmount:h,tokenLinkText:f,transactionTokens:n,token:y,value:i.value,decimals:(r=i.decimals)!=null?r:k,titleText:c}}}}return E(t.value)};0&&(module.exports={explorerUrlBuilder,getExplorerLink,getHumanReadableTimeFormat,getOperationsMessages,getReceiptMessage,getTransactionMethod,getTransactionReceiver,getTransactionReceiverAssets,getTransactionTokens,getTransactionTransferType,getTransactionValue}); /*! * 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