@sofaws/dapp-core
Version:
A library to hold the main logic for a dapp on the Elrond Network
10 lines (9 loc) • 40.2 kB
JavaScript
"use strict";var Ur=Object.create;var se=Object.defineProperty,qr=Object.defineProperties,$r=Object.getOwnPropertyDescriptor,Mr=Object.getOwnPropertyDescriptors,Vr=Object.getOwnPropertyNames,Ve=Object.getOwnPropertySymbols,Gr=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty,Hr=Object.prototype.propertyIsEnumerable;var Ge=(t,e,r)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e||(e={}))He.call(e,r)&&Ge(t,r,e[r]);if(Ve)for(var r of Ve(e))Hr.call(e,r)&&Ge(t,r,e[r]);return t},I=(t,e)=>qr(t,Mr(e));var zr=(t,e)=>()=>(t&&(e=t(t=0)),e);var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var jr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vr(e))!He.call(t,i)&&i!==r&&se(t,i,{get:()=>e[i],enumerable:!(n=$r(e,i))||n.enumerable});return t};var F=(t,e,r)=>(r=t!=null?Ur(Gr(t)):{},jr(e||!t||!t.__esModule?se(r,"default",{value:t,enumerable:!0}):r,t));var We=K(X=>{"use strict";s();X.byteLength=Yr;X.toByteArray=Kr;X.fromByteArray=Jr;var A=[],E=[],Wr=typeof Uint8Array!="undefined"?Uint8Array:Array,ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(U=0,ze=ce.length;U<ze;++U)A[U]=ce[U],E[ce.charCodeAt(U)]=U;var U,ze;E["-".charCodeAt(0)]=62;E["_".charCodeAt(0)]=63;function je(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 Yr(t){var e=je(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Zr(t,e,r){return(e+r)*3/4-r}function Kr(t){var e,r=je(t),n=r[0],i=r[1],o=new Wr(Zr(t,n,i)),a=0,m=i>0?n-4:n,d;for(d=0;d<m;d+=4)e=E[t.charCodeAt(d)]<<18|E[t.charCodeAt(d+1)]<<12|E[t.charCodeAt(d+2)]<<6|E[t.charCodeAt(d+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=E[t.charCodeAt(d)]<<2|E[t.charCodeAt(d+1)]>>4,o[a++]=e&255),i===1&&(e=E[t.charCodeAt(d)]<<10|E[t.charCodeAt(d+1)]<<4|E[t.charCodeAt(d+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function Xr(t){return A[t>>18&63]+A[t>>12&63]+A[t>>6&63]+A[t&63]}function Qr(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(Xr(n));return i.join("")}function Jr(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,m=r-n;a<m;a+=o)i.push(Qr(t,a,a+o>m?m:a+o));return n===1?(e=t[r-1],i.push(A[e>>2]+A[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(A[e>>10]+A[e>>4&63]+A[e<<2&63]+"=")),i.join("")}});var Ye=K(le=>{s();le.read=function(t,e,r,n,i){var o,a,m=i*8-n-1,d=(1<<m)-1,g=d>>1,h=-7,f=r?i-1:0,b=r?-1:1,x=t[e+f];for(f+=b,o=x&(1<<-h)-1,x>>=-h,h+=m;h>0;o=o*256+t[e+f],f+=b,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=a*256+t[e+f],f+=b,h-=8);if(o===0)o=1-g;else{if(o===d)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-g}return(x?-1:1)*a*Math.pow(2,o-n)};le.write=function(t,e,r,n,i,o){var a,m,d,g=o*8-i-1,h=(1<<g)-1,f=h>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,S=n?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+f>=1?e+=b/d:e+=b*Math.pow(2,1-f),e*d>=2&&(a++,d/=2),a+f>=h?(m=0,a=h):a+f>=1?(m=(e*d-1)*Math.pow(2,i),a=a+f):(m=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[r+x]=m&255,x+=S,m/=256,i-=8);for(a=a<<i|m,g+=i;g>0;t[r+x]=a&255,x+=S,a/=256,g-=8);t[r+x-S]|=P*128}});var sr=K(H=>{"use strict";s();var ue=We(),G=Ye(),Ze=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;H.Buffer=c;H.SlowBuffer=at;H.INSPECT_MAX_BYTES=50;var Q=2147483647;H.kMaxLength=Q;c.TYPED_ARRAY_SUPPORT=et();!c.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 et(){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(c.prototype,"parent",{enumerable:!0,get:function(){if(!!c.isBuffer(this))return this.buffer}});Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(!!c.isBuffer(this))return this.byteOffset}});function L(t){if(t>Q)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(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 ge(t)}return Qe(t,e,r)}c.poolSize=8192;function Qe(t,e,r){if(typeof t=="string")return tt(t,e);if(ArrayBuffer.isView(t))return nt(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(D(t,ArrayBuffer)||t&&D(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(D(t,SharedArrayBuffer)||t&&D(t.buffer,SharedArrayBuffer)))return me(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 c.from(n,e,r);var i=ot(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return c.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)}c.from=function(t,e,r){return Qe(t,e,r)};Object.setPrototypeOf(c.prototype,Uint8Array.prototype);Object.setPrototypeOf(c,Uint8Array);function Je(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 rt(t,e,r){return Je(t),t<=0?L(t):e!==void 0?typeof r=="string"?L(t).fill(e,r):L(t).fill(e):L(t)}c.alloc=function(t,e,r){return rt(t,e,r)};function ge(t){return Je(t),L(t<0?0:fe(t)|0)}c.allocUnsafe=function(t){return ge(t)};c.allocUnsafeSlow=function(t){return ge(t)};function tt(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=er(t,e)|0,n=L(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function pe(t){for(var e=t.length<0?0:fe(t.length)|0,r=L(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function nt(t){if(D(t,Uint8Array)){var e=new Uint8Array(t);return me(e.buffer,e.byteOffset,e.byteLength)}return pe(t)}function me(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,c.prototype),n}function ot(t){if(c.isBuffer(t)){var e=fe(t.length)|0,r=L(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||he(t.length)?L(0):pe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return pe(t.data)}function fe(t){if(t>=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return t|0}function at(t){return+t!=t&&(t=0),c.alloc(+t)}c.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==c.prototype};c.compare=function(e,r){if(D(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),D(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(e)||!c.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};c.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}};c.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return c.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=c.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var a=e[n];if(D(a,Uint8Array))o+a.length>i.length?c.from(a).copy(i,o):Uint8Array.prototype.set.call(i,a,o);else if(c.isBuffer(a))a.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return i};function er(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||D(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 de(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ar(t).length;default:if(i)return n?-1:de(t).length;e=(""+e).toLowerCase(),i=!0}}c.byteLength=er;function st(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 Tt(this,e,r);case"utf8":case"utf-8":return tr(this,e,r);case"ascii":return ft(this,e,r);case"latin1":case"binary":return ht(this,e,r);case"base64":return dt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yt(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function q(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}c.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)q(this,r,r+1);return this};c.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)q(this,r,r+3),q(this,r+1,r+2);return this};c.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)q(this,r,r+7),q(this,r+1,r+6),q(this,r+2,r+5),q(this,r+3,r+4);return this};c.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?tr(this,0,e):st.apply(this,arguments)};c.prototype.toLocaleString=c.prototype.toString;c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:c.compare(this,e)===0};c.prototype.inspect=function(){var e="",r=H.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Ze&&(c.prototype[Ze]=c.prototype.inspect);c.prototype.compare=function(e,r,n,i,o){if(D(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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,m=n-r,d=Math.min(a,m),g=this.slice(i,o),h=e.slice(r,n),f=0;f<d;++f)if(g[f]!==h[f]){a=g[f],m=h[f];break}return a<m?-1:m<a?1:0};function rr(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,he(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=c.from(e,n)),c.isBuffer(e))return e.length===0?-1:Ke(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):Ke(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Ke(t,e,r,n,i){var o=1,a=t.length,m=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,m/=2,r/=2}function d(x,S){return o===1?x[S]:x.readUInt16BE(S*o)}var g;if(i){var h=-1;for(g=r;g<a;g++)if(d(t,g)===d(e,h===-1?0:g-h)){if(h===-1&&(h=g),g-h+1===m)return h*o}else h!==-1&&(g-=g-h),h=-1}else for(r+m>a&&(r=a-m),g=r;g>=0;g--){for(var f=!0,b=0;b<m;b++)if(d(t,g+b)!==d(e,b)){f=!1;break}if(f)return g}return-1}c.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};c.prototype.indexOf=function(e,r,n){return rr(this,e,r,n,!0)};c.prototype.lastIndexOf=function(e,r,n){return rr(this,e,r,n,!1)};function ct(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 m=parseInt(e.substr(a*2,2),16);if(he(m))return a;t[r+a]=m}return a}function lt(t,e,r,n){return J(de(e,t.length-r),t,r,n)}function ut(t,e,r,n){return J(bt(e),t,r,n)}function pt(t,e,r,n){return J(ar(e),t,r,n)}function mt(t,e,r,n){return J(vt(e,t.length-r),t,r,n)}c.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 ct(this,e,r,n);case"utf8":case"utf-8":return lt(this,e,r,n);case"ascii":case"latin1":case"binary":return ut(this,e,r,n);case"base64":return pt(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mt(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(t,e,r){return e===0&&r===t.length?ue.fromByteArray(t):ue.fromByteArray(t.slice(e,r))}function tr(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,m=o>239?4:o>223?3:o>191?2:1;if(i+m<=r){var d,g,h,f;switch(m){case 1:o<128&&(a=o);break;case 2:d=t[i+1],(d&192)===128&&(f=(o&31)<<6|d&63,f>127&&(a=f));break;case 3:d=t[i+1],g=t[i+2],(d&192)===128&&(g&192)===128&&(f=(o&15)<<12|(d&63)<<6|g&63,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:d=t[i+1],g=t[i+2],h=t[i+3],(d&192)===128&&(g&192)===128&&(h&192)===128&&(f=(o&15)<<18|(d&63)<<12|(g&63)<<6|h&63,f>65535&&f<1114112&&(a=f))}}a===null?(a=65533,m=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=m}return gt(n)}var Xe=4096;function gt(t){var e=t.length;if(e<=Xe)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Xe));return r}function ft(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 ht(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 Tt(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+=kt[t[o]];return i}function yt(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}c.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,c.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")}c.prototype.readUintLE=c.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};c.prototype.readUintBE=c.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};c.prototype.readUint8=c.prototype.readUInt8=function(e,r){return e=e>>>0,r||w(e,1,this.length),this[e]};c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||w(e,2,this.length),this[e]|this[e+1]<<8};c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||w(e,2,this.length),this[e]<<8|this[e+1]};c.prototype.readUint32LE=c.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};c.prototype.readUint32BE=c.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])};c.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};c.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};c.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]};c.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};c.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};c.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};c.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]};c.prototype.readFloatLE=function(e,r){return e=e>>>0,r||w(e,4,this.length),G.read(this,e,!0,23,4)};c.prototype.readFloatBE=function(e,r){return e=e>>>0,r||w(e,4,this.length),G.read(this,e,!1,23,4)};c.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||w(e,8,this.length),G.read(this,e,!0,52,8)};c.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||w(e,8,this.length),G.read(this,e,!1,52,8)};function v(t,e,r,n,i,o){if(!c.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")}c.prototype.writeUintLE=c.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,m=0;for(this[r]=e&255;++m<n&&(a*=256);)this[r+m]=e/a&255;return r+n};c.prototype.writeUintBE=c.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,m=1;for(this[r+a]=e&255;--a>=0&&(m*=256);)this[r+a]=e/m&255;return r+n};c.prototype.writeUint8=c.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};c.prototype.writeUint16LE=c.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};c.prototype.writeUint16BE=c.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};c.prototype.writeUint32LE=c.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};c.prototype.writeUint32BE=c.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};c.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,m=1,d=0;for(this[r]=e&255;++a<n&&(m*=256);)e<0&&d===0&&this[r+a-1]!==0&&(d=1),this[r+a]=(e/m>>0)-d&255;return r+n};c.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,m=1,d=0;for(this[r+a]=e&255;--a>=0&&(m*=256);)e<0&&d===0&&this[r+a+1]!==0&&(d=1),this[r+a]=(e/m>>0)-d&255;return r+n};c.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};c.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};c.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};c.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};c.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 nr(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 ir(t,e,r,n,i){return e=+e,r=r>>>0,i||nr(t,e,r,4,34028234663852886e22,-34028234663852886e22),G.write(t,e,r,n,23,4),r+4}c.prototype.writeFloatLE=function(e,r,n){return ir(this,e,r,!0,n)};c.prototype.writeFloatBE=function(e,r,n){return ir(this,e,r,!1,n)};function or(t,e,r,n,i){return e=+e,r=r>>>0,i||nr(t,e,r,8,17976931348623157e292,-17976931348623157e292),G.write(t,e,r,n,52,8),r+8}c.prototype.writeDoubleLE=function(e,r,n){return or(this,e,r,!0,n)};c.prototype.writeDoubleBE=function(e,r,n){return or(this,e,r,!1,n)};c.prototype.copy=function(e,r,n,i){if(!c.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};c.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"&&!c.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 m=c.isBuffer(e)?e:c.from(e,i),d=m.length;if(d===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=m[a%d]}return this};var xt=/[^+/0-9A-Za-z-_]/g;function wt(t){if(t=t.split("=")[0],t=t.trim().replace(xt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function de(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 bt(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function vt(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 ar(t){return ue.toByteArray(wt(t))}function J(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 D(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function he(t){return t!==t}var kt=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 mr=K((an,pr)=>{s();var y=pr.exports={},N,_;function Te(){throw new Error("setTimeout has not been defined")}function ye(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?N=setTimeout:N=Te}catch(t){N=Te}try{typeof clearTimeout=="function"?_=clearTimeout:_=ye}catch(t){_=ye}})();function cr(t){if(N===setTimeout)return setTimeout(t,0);if((N===Te||!N)&&setTimeout)return N=setTimeout,setTimeout(t,0);try{return N(t,0)}catch(e){try{return N.call(null,t,0)}catch(r){return N.call(this,t,0)}}}function It(t){if(_===clearTimeout)return clearTimeout(t);if((_===ye||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(t);try{return _(t)}catch(e){try{return _.call(null,t)}catch(r){return _.call(this,t)}}}var R=[],z=!1,$,ee=-1;function Et(){!z||!$||(z=!1,$.length?R=$.concat(R):ee=-1,R.length&&lr())}function lr(){if(!z){var t=cr(Et);z=!0;for(var e=R.length;e;){for($=R,R=[];++ee<e;)$&&$[ee].run();ee=-1,e=R.length}$=null,z=!1,It(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];R.push(new ur(t,e)),R.length===1&&!z&&cr(lr)};function ur(t,e){this.fun=t,this.array=e}ur.prototype.run=function(){this.fun.apply(null,this.array)};y.title="browser";y.browser=!0;y.env={};y.argv=[];y.version="";y.versions={};function C(){}y.on=C;y.addListener=C;y.once=C;y.off=C;y.removeListener=C;y.removeAllListeners=C;y.emit=C;y.prependListener=C;y.prependOnceListener=C;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 l,u,sn,s=zr(()=>{l=F(sr()),u=F(mr()),sn=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)});s();s();s();s();var Z=require("@elrondnetwork/erdjs");s();s();s();s();s();s();s();s();var dr=require("@elrondnetwork/erdjs");function St(t){try{let e=new dr.Address(t);return Boolean(e.bech32())}catch(e){return!1}}function re(t){return(t==null?void 0:t.startsWith("erd"))&&t.length===62&&/^\w+$/.test(t)&&St(t)}s();function gr(t){try{return l.Buffer.from(t,"base64").toString()===atob(t)}catch(e){return!1}}var At=["ESDTNFTTransfer","ESDTNFTBurn","ESDTNFTAddQuantity","ESDTNFTCreate","MultiESDTNFTTransfer","ESDTTransfer","ESDTBurn","ESDTLocalMint","ESDTLocalBurn","ESDTWipe","ESDTFreeze"];function fr(t,e,r=""){if(!re(t))return!1;if(new Z.Address(t).isContractAddress())return!0;let o=Ft({receiver:t,data:r});return o?new Z.Address(o).isContractAddress()||_t(t,e,r):!1}var Dt=t=>t.toLowerCase().match(/[0-9a-f]/g),Nt=t=>t.length%2===0;function _t(t,e,r){let n=r==null?void 0:r.split("@");if(n==null)return!1;let[i,...o]=n,a=e!=null&&t!=null&&t===e,m=At.includes(i),d=o.every(g=>Dt(g)&&Nt(g));return a&&m&&d}function Ft({receiver:t,data:e}){try{if(!e)return t;let r=gr(e)?Z.TransactionPayload.fromEncoded(e).toString():e,n=Lt(r),i=r.split("@");return n>-1?i[n]:t}catch(r){console.log(r);return}}function Lt(t){return t.includes("MultiESDTNFTTransfer")?1:t.includes("ESDTNFTTransfer")?4:-1}s();var we=require("@elrondnetwork/erdjs"),be=F(require("bignumber.js"));s();s();function hr(t){for(let e=0;e<t.length;e++)if(t.charCodeAt(e)>127)return!1;return!0}function Tr(t){let e=t;try{let r=l.Buffer.from(t,"hex").toString();hr(r)&&r.length>1&&(e=r)}catch(r){}return e}var xe={tokenId:"",amount:""},Rt=t=>t.split("@").map((o,a)=>[2,3].includes(a)?o:Tr(o));function yr(t){if(!t)return xe;let e=t.startsWith("ESDTTransfer"),r=t.startsWith("ESDTNFTTransfer")&&t.includes("@");if(e){let[,n,i]=t.split("@");try{let o=l.Buffer.from(n,"hex").toString("ascii");if(!o)return xe;let a=new be.default("0x"+i.replace("0x","")).toString(10);return{tokenId:o,amount:a}}catch(o){console.error("Error getting token from transaction data",o)}}if(r)try{let[,n,i,o,a]=Rt(t);if([n,i,o,a].every(m=>Boolean(m))&&re(new we.Address(a).bech32()))return{tokenId:`${n}-${i}`,amount:new be.default(o,16).toString(10),collection:n,nonce:i,receiver:new we.Address(a).bech32()}}catch(n){}return xe}s();s();s();var O="accounts",M="transactions";var j="tokens",xr="blocks";var wr="nodes",br="identities",vr="collections",ve="nfts",ke="providers",Ie="sc-results",kr="contracts",Ir="logs",Er="code",Sr="locked-accounts",Ar="roles";var T={shard:t=>`/${xr}?shard=${t}`,receiverShard:t=>`/${M}?receivershard=${t}`,senderShard:t=>`/${M}?sendershard=${t}`,transactionDetails:t=>`/${M}/${t}`,transactionDetailsScResults:t=>`/${M}/${t}/${Ie}`,transactionDetailsLogs:t=>`/${M}/${t}/${Ir}`,nodeDetails:t=>`/${wr}/${t}`,accountDetails:t=>`/${O}/${t}`,accountDetailsContractCode:t=>`/${O}/${t}/${Er}`,accountDetailsTokens:t=>`/${O}/${t}/${j}`,accountDetailsNfts:t=>`/${O}/${t}/${ve}`,accountDetailsScResults:t=>`/${O}/${t}/${Ie}`,accountDetailsContracts:t=>`/${O}/${t}/${kr}`,identityDetails:t=>`/${br}/${t}`,tokenDetails:t=>`/${j}/${t}`,tokenDetailsAccounts:t=>`/${j}/${t}/${O}`,tokenDetailsLockedAccounts:t=>`/${j}/${t}/${Sr}`,tokenDetailsRoles:t=>`/${j}/${t}/${Ar}`,collectionDetails:t=>`/${vr}/${t}`,nftDetails:t=>`/${ve}/${t}`,providerDetails:t=>`/${ke}/${t}`,providerDetailsTransactions:t=>`/${ke}/${t}/${M}`};s();var Ee=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(m=>m!=null);return[].concat(...o)}return[]};s();s();function te(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 Dr(t){let e=te(t);return t.receiver===e?t.receiverAssets:void 0}s();var Nr=t=>{var n,i,o,a,m,d;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),(d=(m=t.action)==null?void 0:m.arguments)!=null&&d.functionName&&(e=t.action.arguments.functionName)),e};s();var _r=!1;function Ot(t){_r||(console.error(t),_r=!0)}function W({explorerAddress:t,to:e}){try{return new URL(e).href}catch(r){return e.startsWith("/")||(Ot(`Link not prepended by / : ${e}`),e=`/${e}`),t?`${t}${e}`:e}}s();function Fr(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();s();s();var $t=F(require("bignumber.js"));s();s();s();var Se={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:Lr,egldLabel:ri}=Se["devnet"],{chainId:Rr,egldLabel:ti}=Se["testnet"],{chainId:Cr,egldLabel:ni}=Se["mainnet"];var ii={["devnet"]:Lr,["testnet"]:Rr,["mainnet"]:Cr},oi={[Lr]:"devnet",[Rr]:"testnet",[Cr]:"mainnet"};s();s();s();s();var qt=require("@elrondnetwork/erdjs"),Ae=F(require("bignumber.js"));s();var Pt=F(require("bignumber.js"));s();Ae.default.config({ROUNDING_MODE:Ae.default.ROUND_FLOOR});s();s();s();s();s();s();s();s();s();var Mt=require("@elrondnetwork/erdjs");s();var oe=require("@elrondnetwork/erdjs"),Gt=require("@elrondnetwork/erdjs"),Ht=require("@elrondnetwork/erdjs-network-providers");s();s();var Vt=F(require("bignumber.js"));s();s();s();s();s();s();s();var jt=["reDelegateRewards","claimRewards","unBond"],Wt=["wrapEgld","unwrapEgld"],Yt=["unStake"],Zt=["unDelegate"];s();s();s();s();var Qt=F(require("bignumber.js"));s();s();s();s();var en=F(require("bignumber.js"));function Ne({transaction:t,address:e,explorerAddress:r}){var P;let n=(P=t.tokenIdentifier)!=null?P:yr(t.data).tokenId,i=te(t),o=Dr(t),a=Fr(e,t,i),m=Nr(t),d=Ee(t),g=W({explorerAddress:r,to:T.accountDetails(t.sender)}),h=W({explorerAddress:r,to:T.accountDetails(i)}),f=W({explorerAddress:r,to:T.senderShard(t.senderShard)}),b=W({explorerAddress:r,to:T.receiverShard(t.receiverShard)}),x=t.originalTxHash?`${t.originalTxHash}#${t.txHash}`:t.txHash,S=W({explorerAddress:r,to:T.transactionDetails(x)});return I(k({},t),{tokenIdentifier:n,receiver:i,receiverAssets:o,transactionDetails:{direction:a,method:m,transactionTokens:d,isContract:fr(t.sender)},links:{senderLink:g,receiverLink:h,senderShardLink:f,receiverShardLink:b,transactionLink:S}})}s();s();var Pr={blockHash:"",price:60,txHash:"c747f6ea467fb68e2f152a5baa57edbc7e04d297954878084363cbdb961eed7e",gasLimit:6e7,gasPrice:1e9,gasUsed:6e7,miniBlockHash:"d7ad7c1f8f57e3a370b12092604c42157cb5228ab598e9bbca641ee2e4ee7bd2",nonce:965,receiver:"erd1qqqqqqqqqqqqqpgq4gdcg0k83u7lpv4s4532w3au9y9h0vm70eqq6m8qk2",receiverShard:0,round:2044988,sender:"erd1wh9c0sjr2xn8hzf02lwwcr4jk2s84tat9ud2kaq6zr7xzpvl9l5q8awmex",senderShard:0,signature:"transaction-signature-hash",status:"fail",value:"1234",fee:"655440000000000",timestamp:1660821528,data:"cGluZw==",action:{category:"scCall",name:"ping"}};var ae=I(k({},Pr),{action:{name:"transfer",category:"scCall",arguments:{token:"token",token1:"token1",token2:"token2",transfers:"transfers",null:null,undefined:void 0}},receiverAssets:{name:"john doe",description:"description",iconPng:"icon.png",iconSvg:"icon.svg",tags:["@tag1","@tag2"]},operations:[{name:"send",type:"egld",action:"transfer",esdtType:"FungibleESDT",receiver:"erd1qqqqqqqqqqqqqpgq4gdcg0k83u7lpv4s4532w3au9y9h0vm70eqq6m8qk2",sender:"erd1wh9c0sjr2xn8hzf02lwwcr4jk2s84tat9ud2kaq6zr7xzpvl9l5q8awmex",value:"1",decimals:4,identifier:"EGLD",message:"message 0"},{name:"send",type:"egld",action:"transfer",esdtType:"FungibleESDT",receiver:"erd1qqqqqqqqqqqqqpgq4gdcg0k83u7lpv4s4532w3au9y9h0vm70eqq6m8qk2",sender:"erd1wh9c0sjr2xn8hzf02lwwcr4jk2s84tat9ud2kaq6zr7xzpvl9l5q8awmex",value:"1",decimals:4,identifier:"EGLD",message:"message 1"}],results:[{callType:"",value:"1",gasLimit:100,gasPrice:.001,hash:"tx-hash",nonce:0,sender:"sender-hash",originalTxHash:"original-tx-hash",prevTxHash:"prev-tx-hash",returnMessage:"message 0"},{callType:"",value:"1",gasLimit:100,gasPrice:.001,hash:"tx-hash",nonce:0,sender:"sender-hash",originalTxHash:"original-tx-hash",prevTxHash:"prev-tx-hash",returnMessage:"message 1"}],receipt:{data:"@some-data",value:"1000",sender:"sender-hash"}});var V="https://testing.devnet.com";describe("transaction interpreter",()=>{describe("interpretServerTransaction",()=>{it("creates an extended model of the existing transaction, containing all the needed information necessary to build the UI without processing inside the components",()=>{var n,i,o,a,m,d,g,h;let t=I(k({},ae),{tokenIdentifier:"token-id"}),e=I(k({},t),{links:{senderLink:`${V}${T.accountDetails(t.sender)}`,receiverLink:`${V}${T.accountDetails(t.receiver)}`,receiverShardLink:`${V}${T.receiverShard(t.receiverShard)}`,senderShardLink:`${V}${T.senderShard(t.senderShard)}`,transactionLink:`${V}${T.transactionDetails(t.txHash)}`},transactionDetails:{transactionTokens:[(i=(n=t==null?void 0:t.action)==null?void 0:n.arguments)==null?void 0:i.token,(a=(o=t==null?void 0:t.action)==null?void 0:o.arguments)==null?void 0:a.token1,(d=(m=t==null?void 0:t.action)==null?void 0:m.arguments)==null?void 0:d.token2,(h=(g=t==null?void 0:t.action)==null?void 0:g.arguments)==null?void 0:h.transfers].filter(f=>f!=null),direction:"Out",isContract:!1,method:"transfer"}}),r=Ne({transaction:t,address:"erd1-my-address-hash",explorerAddress:V});expect(r).toEqual(e)})}),describe("interpretServerTransactions",()=>{it("parse all the transactions and creates transactions extended models, containing all the needed information necessary to build the UI without processing inside the components",()=>{var i,o,a,m,d,g,h,f,b,x,S,P,_e,Fe,Le,Re,Ce,Oe,Be,Pe,Ue,qe,$e,Me;let t="https://testing.devnet.com",e=[I(k({},ae),{tokenIdentifier:"token-id"}),I(k({},ae),{tokenIdentifier:"token-id-2",sender:"erd1qqqqqqqqqqqqqpgq4gdcg0k83u7lpv4s4532w3au9y9h0vm70eqq6m8qk2",receiver:"erd1qqqqqqqqqqqqqpgq4gdcg0k83u7lpv4s4532w3au9y9h0vm70eqq6m8qk2",senderShard:2,receiverShard:3})],r=[I(k({},e[0]),{links:{senderLink:`${t}${T.accountDetails(e[0].sender)}`,receiverLink:`${t}${T.accountDetails(e[0].receiver)}`,receiverShardLink:`${t}${T.receiverShard(e[0].receiverShard)}`,senderShardLink:`${t}${T.senderShard(e[0].senderShard)}`,transactionLink:`${t}${T.transactionDetails(e[0].txHash)}`},transactionDetails:{transactionTokens:[(a=(o=(i=e[0])==null?void 0:i.action)==null?void 0:o.arguments)==null?void 0:a.token,(g=(d=(m=e[0])==null?void 0:m.action)==null?void 0:d.arguments)==null?void 0:g.token1,(b=(f=(h=e[0])==null?void 0:h.action)==null?void 0:f.arguments)==null?void 0:b.token2,(P=(S=(x=e[0])==null?void 0:x.action)==null?void 0:S.arguments)==null?void 0:P.transfers].filter(Y=>Y!=null),direction:"In",isContract:!1,method:"transfer"}}),I(k({},e[1]),{links:{senderLink:`${t}${T.accountDetails(e[1].sender)}`,receiverLink:`${t}${T.accountDetails(e[1].receiver)}`,receiverShardLink:`${t}${T.receiverShard(e[1].receiverShard)}`,senderShardLink:`${t}${T.senderShard(e[1].senderShard)}`,transactionLink:`${t}${T.transactionDetails(e[1].txHash)}`},transactionDetails:{transactionTokens:[(Le=(Fe=(_e=e[1])==null?void 0:_e.action)==null?void 0:Fe.arguments)==null?void 0:Le.token,(Oe=(Ce=(Re=e[1])==null?void 0:Re.action)==null?void 0:Ce.arguments)==null?void 0:Oe.token1,(Ue=(Pe=(Be=e[1])==null?void 0:Be.action)==null?void 0:Pe.arguments)==null?void 0:Ue.token2,(Me=($e=(qe=e[1])==null?void 0:qe.action)==null?void 0:$e.arguments)==null?void 0:Me.transfers].filter(Y=>Y!=null),direction:"Self",isContract:!0,method:"transfer"}})],n=e.map(Y=>Ne({transaction:Y,address:"erd1qqqqqqqqqqqqqpgq4gdcg0k83u7lpv4s4532w3au9y9h0vm70eqq6m8qk2",explorerAddress:V}));expect(n).toEqual(r)})})});
/*!
* 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=getInterpretedTransaction.test.js.map