UNPKG

tronweb

Version:

JavaScript SDK that encapsulates the TRON HTTP API

1 lines 686 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TronWeb",[],t):"object"==typeof exports?exports.TronWeb=t():e.TronWeb=t()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}([function(e,t,r){"use strict";var n={};r.r(n),r.d(n,"byte2hexStr",function(){return m}),r.d(n,"bytesToString",function(){return b}),r.d(n,"hextoString",function(){return g}),r.d(n,"byteArray2hexStr",function(){return y}),r.d(n,"base64DecodeFromString",function(){return w}),r.d(n,"base64EncodeToString",function(){return _});var i={};r.r(i),r.d(i,"bin2String",function(){return S}),r.d(i,"arrayEquals",function(){return k}),r.d(i,"stringToBytes",function(){return E}),r.d(i,"byte2hexStr",function(){return m}),r.d(i,"bytesToString",function(){return b}),r.d(i,"hextoString",function(){return g}),r.d(i,"byteArray2hexStr",function(){return y}),r.d(i,"base64DecodeFromString",function(){return w}),r.d(i,"base64EncodeToString",function(){return _}),r.d(i,"hexChar2byte",function(){return I}),r.d(i,"isHexChar",function(){return P}),r.d(i,"hexStr2byteArray",function(){return N}),r.d(i,"strToDate",function(){return T}),r.d(i,"isNumber",function(){return R}),r.d(i,"getStringType",function(){return O});var o={};r.r(o),r.d(o,"encode58",function(){return F}),r.d(o,"decode58",function(){return D});var a={};r.r(a),r.d(a,"getBase58CheckAddress",function(){return z}),r.d(a,"decodeBase58Address",function(){return q}),r.d(a,"signTransaction",function(){return H}),r.d(a,"arrayToBase64String",function(){return G}),r.d(a,"signBytes",function(){return K}),r.d(a,"getRowBytesFromTransactionBase64",function(){return V}),r.d(a,"genPriKey",function(){return $}),r.d(a,"computeAddress",function(){return Z}),r.d(a,"getAddressFromPriKey",function(){return J}),r.d(a,"decode58Check",function(){return Y}),r.d(a,"isAddressValid",function(){return X}),r.d(a,"getBase58CheckAddressFromPriKeyBase64String",function(){return Q}),r.d(a,"getHexStrAddressFromPriKeyBase64String",function(){return ee}),r.d(a,"getAddressFromPriKeyBase64String",function(){return te}),r.d(a,"getPubKeyFromPriKey",function(){return re}),r.d(a,"ECKeySign",function(){return ne}),r.d(a,"SHA256",function(){return ie}),r.d(a,"passwordToAddress",function(){return oe}),r.d(a,"pkToAddress",function(){return ae});var s={};r.r(s),r.d(s,"generateAccount",function(){return se});var u={};r.r(u),r.d(u,"decodeParams",function(){return ce}),r.d(u,"encodeParams",function(){return de});var f=r(11),c=r.n(f),d=r(2),l=r.n(d),h=r(3),p=r.n(h);function v(){var e=this;this._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",this.encode=function(t){for(var r,n,i,o,a,s,u,f="",c=0;c<t.length;)o=(r=t.charCodeAt(c++))>>2,a=(3&r)<<4|(n=t.charCodeAt(c++))>>4,s=(15&n)<<2|(i=t.charCodeAt(c++))>>6,u=63&i,isNaN(n)?s=u=64:isNaN(i)&&(u=64),f=f+e._keyStr.charAt(o)+e._keyStr.charAt(a)+e._keyStr.charAt(s)+e._keyStr.charAt(u);return f},this.encodeIgnoreUtf8=function(t){for(var r,n,i,o,a,s,u,f="",c=0;c<t.length;)o=(r=t[c++])>>2,a=(3&r)<<4|(n=t[c++])>>4,s=(15&n)<<2|(i=t[c++])>>6,u=63&i,isNaN(n)?s=u=64:isNaN(i)&&(u=64),f=f+e._keyStr.charAt(o)+e._keyStr.charAt(a)+e._keyStr.charAt(s)+e._keyStr.charAt(u);return f},this.decode=function(t){var r,n,i,o,a,s,u="",f=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");f<t.length;)r=e._keyStr.indexOf(t.charAt(f++))<<2|(o=e._keyStr.indexOf(t.charAt(f++)))>>4,n=(15&o)<<4|(a=e._keyStr.indexOf(t.charAt(f++)))>>2,i=(3&a)<<6|(s=e._keyStr.indexOf(t.charAt(f++))),u+=String.fromCharCode(r),64!=a&&(u+=String.fromCharCode(n)),64!=s&&(u+=String.fromCharCode(i));return e._utf8_decode(u)},this.decodeToByteArray=function(t){var r,n,i,o,a,s,u="",f=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");f<t.length;)r=e._keyStr.indexOf(t.charAt(f++))<<2|(o=e._keyStr.indexOf(t.charAt(f++)))>>4,n=(15&o)<<4|(a=e._keyStr.indexOf(t.charAt(f++)))>>2,i=(3&a)<<6|(s=e._keyStr.indexOf(t.charAt(f++))),u+=String.fromCharCode(r),64!=a&&(u+=String.fromCharCode(n)),64!=s&&(u+=String.fromCharCode(i));return e._out2ByteArray(u)},this._out2ByteArray=function(e){for(var t=new Array(e.length),r=0,n=0;r<e.length;)n=e.charCodeAt(r),t[r]=n,r++;return t},this._utf8_encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):n>127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t},this._utf8_decode=function(e){for(var t="",r=0,n=0,i=0,o=0;r<e.length;)(n=e.charCodeAt(r))<128?(t+=String.fromCharCode(n),r++):n>191&&n<224?(i=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&i),r+=2):(i=e.charCodeAt(r+1),o=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),r+=3);return t}}function m(e){if("number"!=typeof e)throw new Error("Input must be a number");if(e<0||e>255)throw new Error("Input must be a byte");var t="";return t+="0123456789ABCDEF".charAt(e>>4),t+="0123456789ABCDEF".charAt(15&e)}function b(e){if("string"==typeof e)return e;for(var t="",r=0;r<e.length;r++){var n=e[r].toString(2),i=n.match(/^1+?(?=0)/);if(i&&8===n.length){for(var o=i[0].length,a=e[r].toString(2).slice(7-o),s=1;s<o;s++)a+=e[s+r].toString(2).slice(2);t+=String.fromCharCode(parseInt(a,2)),r+=o-1}else t+=String.fromCharCode(e[r])}return t}function g(e){for(var t=e.replace(/^0x/,"").split(""),r="",n=0;n<t.length/2;n++){var i="0x".concat(t[2*n]).concat(t[2*n+1]);r+=String.fromCharCode(i)}return r}function y(e){for(var t="",r=0;r<e.length;r++)t+=m(e[r]);return t}function w(e){return(new v).decodeToByteArray(e)}function _(e){return(new v).encodeIgnoreUtf8(e)}var M=r(17),A=r.n(M),x=r(4);function S(e){return b(e)}function k(e,t,r){if(e.length!=t.length)return!1;var n;for(n=0;n<e.length;n++)if(r){if(e[n]!=t[n])return!1}else if(JSON.stringify(e[n])!=JSON.stringify(t[n]))return!1;return!0}function E(e){if("string"!=typeof e)throw new Error("The passed string is not a string");var t,r,n=new Array;t=e.length;for(var i=0;i<t;i++)(r=e.charCodeAt(i))>=65536&&r<=1114111?(n.push(r>>18&7|240),n.push(r>>12&63|128),n.push(r>>6&63|128),n.push(63&r|128)):r>=2048&&r<=65535?(n.push(r>>12&15|224),n.push(r>>6&63|128),n.push(63&r|128)):r>=128&&r<=2047?(n.push(r>>6&31|192),n.push(63&r|128)):n.push(255&r);return n}function I(e){var t;if(e>="A"&&e<="F"?t=e.charCodeAt(0)-"A".charCodeAt(0)+10:e>="a"&&e<="f"?t=e.charCodeAt(0)-"a".charCodeAt(0)+10:e>="0"&&e<="9"&&(t=e.charCodeAt(0)-"0".charCodeAt(0)),"number"==typeof t)return t;throw new Error("The passed hex char is not a valid hex char")}function P(e){return e>="A"&&e<="F"||e>="a"&&e<="f"||e>="0"&&e<="9"?1:0}function N(e){if("string"!=typeof e)throw new Error("The passed string is not a string");for(var t=Array(),r=0,n=0,i=0,o=0;o<e.length;o++){var a=e.charAt(o);if(!P(a))throw new Error("The passed hex char is not a valid hex string");r<<=4,r+=I(a),0==++n%2&&(t[i++]=r,r=0)}return t}function T(e){if(!/^\d{4}-\d{2}-\d{2}( \d{2}-\d{2}-\d{2}|)/.test(e))throw new Error("The passed date string is not valid");var t=e.split(" "),r=t[0].split("-"),n=parseInt(r[0],10),i=parseInt(r[1],10)-1,o=parseInt(r[2],10);if(t.length>1){var a=t[1].split("-"),s=parseInt(a[0],10),u=parseInt(a[1],10),f=parseInt(a[2],10);return new Date(n,i,o,s,u,f)}return new Date(n,i,o)}function R(e){return e>="0"&&e<="9"?1:0}function O(e){if(null==e)return-1;if("string"!=typeof e)return-1;if(0==e.length||""==e)return-1;var t=0;if(40==e.length)for(;t<40;t++){if(!P(e.charAt(t)))break}if(40==t)return 1;for(t=0;t<e.length;t++){if(!R(e.charAt(t)))break}if(t==e.length)return 2;for(t=0;t<e.length;t++){if(e.charAt(t)>" ")return 3}return-1}for(var C="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",B={},j=0;j<C.length;j++)B[C.charAt(j)]=j;var L=58;function F(e){if(0===e.length)return"";var t,r,n=[0];for(t=0;t<e.length;t++){for(r=0;r<n.length;r++)n[r]<<=8;n[0]+=e[t];var i=0;for(r=0;r<n.length;++r)n[r]+=i,i=n[r]/L|0,n[r]%=L;for(;i;)n.push(i%L),i=i/L|0}for(t=0;0===e[t]&&t<e.length-1;t++)n.push(0);return n.reverse().map(function(e){return C[e]}).join("")}function D(e){if(0===e.length)return[];var t,r,n=[0];for(t=0;t<e.length;t++){var i=e[t];if(!(i in B))throw new Error("Non-base58 character");for(r=0;r<n.length;r++)n[r]*=L;n[0]+=B[i];var o=0;for(r=0;r<n.length;++r)n[r]+=o,o=n[r]>>8,n[r]&=255;for(;o;)n.push(255&o),o>>=8}for(t=0;"1"===e[t]&&t<e.length-1;t++)n.push(0);return n.reverse()}var U=r(9),W=r(8);function z(e){var t=ie(e),r=ie(t).slice(0,4);return F(r=e.concat(r))}function q(e){if("string"!=typeof e)return!1;if(e.length<=4)return!1;var t=D(e);if(e.length<=4)return!1;var r=t.length-4,n=t.slice(r),i=ie(t=t.slice(0,r)),o=ie(i).slice(0,4);if(n[0]==o[0]&&n[1]==o[1]&&n[2]==o[2]&&n[3]==o[3])return t;throw new Error("Invalid address provided")}function H(e,t){"string"==typeof e&&(e=N(e));var r=ne(N(t.txID),e);return Array.isArray(t.signature)?t.signature.includes(r)||t.signature.push(r):t.signature=[r],t}function G(e){return btoa(String.fromCharCode.apply(String,A()(e)))}function K(e,t){return"string"==typeof e&&(e=N(e)),ne(ie(t),e)}function V(e){var t=w(e);return proto.protocol.Transaction.deserializeBinary(t).getRawData().serializeBinary()}function $(){for(var e=new U.ec("secp256k1").genKeyPair().getPrivate().toString("hex");e.length<64;)e="0".concat(e);return N(e)}function Z(e){65===e.length&&(e=e.slice(1));var t=Object(W.c)(e).toString().substring(2);return N(x.a+t.substring(24))}function J(e){return Z(re(e))}function Y(e){var t=D(e);if(t.length<=4)return!1;var r=t.slice(0,t.length-4),n=ie(r),i=ie(n);return i[0]===t[r.length]&&i[1]===t[r.length+1]&&i[2]===t[r.length+2]&&i[3]===t[r.length+3]&&r}function X(e){if("string"!=typeof e)return!1;if(e.length!==x.d)return!1;var t=D(e);if(25!==t.length)return!1;if(t[0]!==x.b)return!1;var r=t.slice(21),n=ie(t=t.slice(0,21)),i=ie(n).slice(0,4);return r[0]==i[0]&&r[1]==i[1]&&r[2]==i[2]&&r[3]==i[3]}function Q(e){return z(Z(re(w(e))))}function ee(e){return y(Z(re(w(e))))}function te(e){return _(Z(re(w(e))))}function re(e){for(var t=new U.ec("secp256k1").keyFromPrivate(e,"bytes").getPublic(),r=t.x,n=t.y,i=r.toString("hex");i.length<64;)i="0".concat(i);for(var o=n.toString("hex");o.length<64;)o="0".concat(o);return N("04".concat(i).concat(o))}function ne(e,t){for(var r=new U.ec("secp256k1").keyFromPrivate(t,"bytes").sign(e),n=r.r,i=r.s,o=r.recoveryParam,a=n.toString("hex");a.length<64;)a="0".concat(a);for(var s=i.toString("hex");s.length<64;)s="0".concat(s);return a+s+m(o)}function ie(e){var t=y(e);return N(Object(W.e)("0x"+t).replace(/^0x/,""))}function oe(e){return z(J(w(e)))}function ae(e){return z(J(N(e)))}function se(){var e=$(),t=re(e),r=J(e);return{privateKey:y(e),publicKey:y(t),address:{base58:z(r),hex:y(r)}}}var ue=r(7),fe=new W.a;function ce(e,t,r,n){if(r&&"boolean"!=typeof r||(n=r,r=t,t=e,e=[]),n&&r.replace(/^0x/,"").length%64==8&&(r="0x"+r.replace(/^0x/,"").substring(8)),r.replace(/^0x/,"").length%64)throw new Error("The encoded string is not valid. Its length must be a multiple of 64.");return fe.decode(t,r).reduce(function(r,n,i){return"address"==t[i]&&(n=x.a+n.substr(2).toLowerCase()),e.length?r[e[i]]=n:r.push(n),r},e.length?{}:[])}function de(e,t){for(var r=0;r<e.length;r++)"address"===e[r]&&(t[r]=ue.default.address.toHex(t[r]).replace(x.c,"0x"));return fe.encode(e,t)}var le=r(68),he=r.n(le),pe=r(22),ve=r.n(pe),me={isValidURL:function(e){return"string"==typeof e&&he.a.isURL(e.toString(),{protocols:["http","https"],require_tld:!1})},isObject:function(e){return e===Object(e)&&"[object Array]"!==Object.prototype.toString.call(e)},isArray:function(e){return Array.isArray(e)},isJson:function(e){try{return!!JSON.parse(e)}catch(e){return!1}},isBoolean:function(e){return"boolean"==typeof e},isBigNumber:function(e){return e&&(e instanceof ve.a||e.constructor&&"BigNumber"===e.constructor.name)},isString:function(e){return"string"==typeof e||e&&e.constructor&&"String"===e.constructor.name},isFunction:function(e){return"function"==typeof e},isHex:function(e){return"string"==typeof e&&!isNaN(parseInt(e,16))&&/^(0x|)[a-fA-F0-9]+$/.test(e)},isInteger:function(e){return null!==e&&Number.isInteger(Number(e))},hasProperty:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},hasProperties:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.length&&!n.map(function(r){return t.hasProperty(e,r)}).includes(!1)},injectPromise:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new Promise(function(t,n){e.apply(void 0,r.concat([function(e,r){e?n(e):t(r)}]))})},promiseInjector:function(e){var t=this;return function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.injectPromise.apply(t,[r.bind(e)].concat(i))}},mapEvent:function(e){var t={block:e.block_number,timestamp:e.block_timestamp,contract:e.contract_address,name:e.event_name,transaction:e.transaction_id,result:e.result,resourceNode:e.resource_Node||(e._unconfirmed?"fullNode":"solidityNode")};return e._unconfirmed&&(t.unconfirmed=e._unconfirmed),e._fingerprint&&(t.fingerprint=e._fingerprint),t},parseEvent:function(e,t){var r=t.inputs;if(!e.result)return e;if(this.isObject(e.result))for(var n=0;n<r.length;n++){var i=r[n];"address"==i.type&&i.name in e.result&&(e.result[i.name]=x.a+e.result[i.name].substr(2).toLowerCase())}else this.isArray(e.result)&&(e.result=e.result.reduce(function(e,t,n){var i=r[n],o=i.name;return"address"==i.type&&(t=x.a+t.substr(2).toLowerCase()),e[o]=t,e},{}));return e},padLeft:function(e,t,r){for(var n=e.toString();n.length<r;)n=t+n;return n},isNotNullOrUndefined:function(e){return null!=e},sleep:function(){var e=p()(l.a.mark(function e(){var t,r=arguments;return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:1e3,e.abrupt("return",new Promise(function(e){return setTimeout(e,t)}));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()};t.a=c()({},me,{code:i,accounts:s,base58:o,bytes:n,crypto:a,abi:u})},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!("string"==typeof e||e instanceof String)){var t;throw t=null===e?"null":"object"===(t=n(e))&&e.constructor&&e.constructor.hasOwnProperty("name")?e.constructor.name:"a ".concat(t),new TypeError("Expected string but received ".concat(t,"."))}},e.exports=t.default,e.exports.default=t.default},function(e,t,r){e.exports=r(76)},function(e,t){function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise(function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)})}}},function(e,t,r){"use strict";r.d(t,"d",function(){return n}),r.d(t,"a",function(){return i}),r.d(t,"b",function(){return o}),r.d(t,"c",function(){return a});var n=34,i="41",o=65,a=/^(41)/},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"default",function(){return U});var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(16),u=r.n(s),f=r(5),c=r.n(f),d=r(6),l=r.n(d),h=r(64),p=r.n(h),v=r(65),m=r.n(v),b=r(21),g=r.n(b),y=r(66),w=r.n(y),_=r(12),M=r.n(_),A=r(13),x=r(0),S=r(22),k=r.n(S),E=r(69),I=r.n(E),P=r(70),N=r(29),T=r.n(N),R=r(36),O=r(37),C=r(40),B=r(38),j=r(39),L=r(8),F=r(4),D="3.5.0",U=function(t){function r(){var e,t,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return c()(this,r),e=p()(this,m()(r).call(this)),"object"===u()(n)&&(n.fullNode||n.fullHost)?(t=n.fullNode||n.fullHost,i=n.solidityNode||n.fullHost,o=n.eventServer||n.fullHost,a=n.privateKey):t=n,x.a.isString(t)&&(t=new A.a.HttpProvider(t)),x.a.isString(i)&&(i=new A.a.HttpProvider(i)),x.a.isString(o)&&(o=new A.a.HttpProvider(o)),e.event=new j.a(g()(e)),e.transactionBuilder=new R.a(g()(e)),e.trx=new O.a(g()(e)),e.plugin=new B.a(g()(e)),e.utils=x.a,e.setFullNode(t),e.setSolidityNode(i),e.setEventServer(o),e.providers=A.a,e.BigNumber=k.a,e.defaultBlock=!1,e.defaultPrivateKey=!1,e.defaultAddress={hex:!1,base58:!1},["sha3","toHex","toUtf8","fromUtf8","toAscii","fromAscii","toDecimal","fromDecimal","toSun","fromSun","toBigNumber","isAddress","createAccount","address","version"].forEach(function(t){e[t]=r[t]}),a&&e.setPrivateKey(a),e.fullnodeVersion=D,e.injectPromise=x.a.promiseInjector(g()(e)),e}return w()(r,t),l()(r,[{key:"getFullnodeVersion",value:function(){var e=a()(i.a.mark(function e(){var t;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.trx.getNodeInfo();case 3:t=e.sent,this.fullnodeVersion=t.configNodeInfo.codeVersion,2===this.fullnodeVersion.split(".").length&&(this.fullnodeVersion+=".0"),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.fullnodeVersion=D;case 11:case"end":return e.stop()}},e,this,[[0,8]])}));return function(){return e.apply(this,arguments)}}()},{key:"setDefaultBlock",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if([!1,"latest","earliest",0].includes(e))return this.defaultBlock=e;if(!x.a.isInteger(e)||!e)throw new Error("Invalid block ID provided");this.defaultBlock=Math.abs(e)}},{key:"setPrivateKey",value:function(e){try{this.setAddress(this.address.fromPrivateKey(e))}catch(e){throw new Error("Invalid private key provided")}this.defaultPrivateKey=e,this.emit("privateKeyChanged",e)}},{key:"setAddress",value:function(e){if(!this.isAddress(e))throw new Error("Invalid address provided");var t=this.address.toHex(e),r=this.address.fromHex(e);this.defaultPrivateKey&&this.address.fromPrivateKey(this.defaultPrivateKey)!==r&&(this.defaultPrivateKey=!1),this.defaultAddress={hex:t,base58:r},this.emit("addressChanged",{hex:t,base58:r})}},{key:"fullnodeSatisfies",value:function(e){return T.a.satisfies(this.fullnodeVersion,e)}},{key:"isValidProvider",value:function(e){return Object.values(A.a).some(function(t){return e instanceof t})}},{key:"setFullNode",value:function(e){if(x.a.isString(e)&&(e=new A.a.HttpProvider(e)),!this.isValidProvider(e))throw new Error("Invalid full node provided");this.fullNode=e,this.fullNode.setStatusPage("wallet/getnowblock"),this.getFullnodeVersion()}},{key:"setSolidityNode",value:function(e){if(x.a.isString(e)&&(e=new A.a.HttpProvider(e)),!this.isValidProvider(e))throw new Error("Invalid solidity node provided");this.solidityNode=e,this.solidityNode.setStatusPage("walletsolidity/getnowblock")}},{key:"setEventServer",value:function(){var e;(e=this.event).setServer.apply(e,arguments)}},{key:"currentProviders",value:function(){return{fullNode:this.fullNode,solidityNode:this.solidityNode,eventServer:this.eventServer}}},{key:"currentProvider",value:function(){return this.currentProviders()}},{key:"getEventResult",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return"object"!==u()(r[1])&&(r[1]={sinceTimestamp:r[1]||0,eventName:r[2]||!1,blockNumber:r[3]||!1,size:r[4]||20,page:r[5]||1},r.splice(2,4),x.a.isFunction(r[2])||(x.a.isFunction(r[1].page)?(r[2]=r[1].page,r[1].page=1):x.a.isFunction(r[1].size)&&(r[2]=r[1].size,r[1].size=20,r[1].page=1))),(e=this.event).getEventsByContractAddress.apply(e,r)}},{key:"getEventByTransactionID",value:function(){var e;return(e=this.event).getEventsByTransactionID.apply(e,arguments)}},{key:"contract",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new C.a(this,e,t)}},{key:"isConnected",value:function(){var e=a()(i.a.mark(function e(){var t,r=arguments;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.length>0&&void 0!==r[0]&&r[0]){e.next=3;break}return e.abrupt("return",this.injectPromise(this.isConnected));case 3:return e.t0=t,e.next=6,this.fullNode.isConnected();case 6:return e.t1=e.sent,e.next=9,this.solidityNode.isConnected();case 9:if(e.t2=e.sent,e.t3=this.eventServer,!e.t3){e.next=15;break}return e.next=14,this.eventServer.isConnected();case 14:e.t3=e.sent;case 15:return e.t4=e.t3,e.t5={fullNode:e.t1,solidityNode:e.t2,eventServer:e.t4},e.abrupt("return",(0,e.t0)(null,e.t5));case 18:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}],[{key:"sha3",value:function(t){return(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?"0x":"")+Object(L.c)(e.from(t,"utf-8")).toString().substring(2)}},{key:"toHex",value:function(e){if(x.a.isBoolean(e))return r.fromDecimal(+e);if(x.a.isBigNumber(e))return r.fromDecimal(e);if("object"===u()(e))return r.fromUtf8(JSON.stringify(e));if(x.a.isString(e)){if(/^(-|)0x/.test(e))return e;if(!isFinite(e))return r.fromUtf8(e)}var t=r.fromDecimal(e);if("0xNaN"===t)throw new Error("The passed value is not convertible to a hex string");return t}},{key:"toUtf8",value:function(t){if(x.a.isHex(t))return t=t.replace(/^0x/,""),e.from(t,"hex").toString("utf8");throw new Error("The passed value is not a valid hex string")}},{key:"fromUtf8",value:function(t){if(!x.a.isString(t))throw new Error("The passed value is not a valid utf-8 string");return"0x"+e.from(t,"utf8").toString("hex")}},{key:"toAscii",value:function(e){if(x.a.isHex(e)){var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){var i=parseInt(e.substr(r,2),16);t+=String.fromCharCode(i)}return t}throw new Error("The passed value is not a valid hex string")}},{key:"fromAscii",value:function(t,r){if(!x.a.isString(t))throw new Error("The passed value is not a valid utf-8 string");return"0x"+e.from(t,"ascii").toString("hex").padEnd(r,"0")}},{key:"toDecimal",value:function(e){return r.toBigNumber(e).toNumber()}},{key:"fromDecimal",value:function(e){var t=r.toBigNumber(e),n=t.toString(16);return t.isLessThan(0)?"-0x"+n.substr(1):"0x"+n}},{key:"fromSun",value:function(e){var t=r.toBigNumber(e).div(1e6);return x.a.isBigNumber(e)?t:t.toString(10)}},{key:"toSun",value:function(e){var t=r.toBigNumber(e).times(1e6);return x.a.isBigNumber(e)?t:t.toString(10)}},{key:"toBigNumber",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return x.a.isBigNumber(e)?e:x.a.isString(e)&&/^(-|)0x/.test(e)?new k.a(e.replace("0x",""),16):new k.a(e.toString(10),10)}},{key:"isAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!x.a.isString(e))return!1;if(42===e.length)try{return r.isAddress(x.a.crypto.getBase58CheckAddress(x.a.code.hexStr2byteArray(e)))}catch(e){return!1}try{return x.a.crypto.isAddressValid(e)}catch(e){return!1}}},{key:"createAccount",value:function(){var e=a()(i.a.mark(function e(){var t;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=x.a.accounts.generateAccount(),e.abrupt("return",t);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"address",get:function(){return{fromHex:function(e){return x.a.isHex(e)?x.a.crypto.getBase58CheckAddress(x.a.code.hexStr2byteArray(e.replace(/^0x/,F.a))):e},toHex:function(e){return x.a.isHex(e)?e.toLowerCase().replace(/^0x/,F.a):x.a.code.byteArray2hexStr(x.a.crypto.decodeBase58Address(e)).toLowerCase()},fromPrivateKey:function(e){try{return x.a.crypto.pkToAddress(e)}catch(e){return!1}}}}}]),r}(I.a);M()(U,"providers",A.a),M()(U,"BigNumber",k.a),M()(U,"TransactionBuilder",R.a),M()(U,"Trx",O.a),M()(U,"Contract",C.a),M()(U,"Plugin",B.a),M()(U,"Event",j.a),M()(U,"version",P.a),M()(U,"utils",x.a)}.call(this,r(72).Buffer)},function(e,t,r){"use strict";r.d(t,"c",function(){return i}),r.d(t,"e",function(){return o}),r.d(t,"f",function(){return a}),r.d(t,"d",function(){return s}),r.d(t,"b",function(){return u}),r.d(t,"a",function(){return f});var n=r(23),i=n.utils.keccak256,o=n.utils.sha256,a=n.utils.toUtf8Bytes,s=n.utils.recoverAddress,u=n.utils.SigningKey,f=n.utils.AbiCoder},function(e,t,r){"use strict";var n=t;n.version=r(97).version,n.utils=r(98),n.rand=r(101),n.curve=r(25),n.curves=r(107),n.ec=r(115),n.eddsa=r(119)},function(e,t,r){"use strict";var n=r(42),i=r(79),o=Object.prototype.toString;function a(e){return"[object Array]"===o.call(e)}function s(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===o.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:a,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:i,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:s,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:u,isStream:function(e){return s(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:f,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,i=arguments.length;n<i;n++)f(arguments[n],r);return t},deepMerge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]="object"==typeof r?e({},r):r}for(var n=0,i=arguments.length;n<i;n++)f(arguments[n],r);return t},extend:function(e,t,r){return f(t,function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,r){var n=r(12);e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),i.forEach(function(t){n(e,t,r[t])})}return e}},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";var n=r(2),i=r.n(n),o=r(3),a=r.n(o),s=r(5),u=r.n(s),f=r(6),c=r.n(f),d=r(67),l=r.n(d),h=r(0),p=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e4,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"/";if(u()(this,e),!h.a.isValidURL(t))throw new Error("Invalid URL provided to HttpProvider");if(isNaN(r)||r<0)throw new Error("Invalid timeout duration provided");if(!h.a.isObject(o))throw new Error("Invalid headers object provided");t=t.replace(/\/+$/,""),this.host=t,this.timeout=r,this.user=n,this.password=i,this.headers=o,this.statusPage=a,this.instance=l.a.create({baseURL:t,timeout:r,headers:o,auth:n&&{user:n,password:i}})}return c()(e,[{key:"setStatusPage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";this.statusPage=e}},{key:"isConnected",value:function(){var e=a()(i.a.mark(function e(){var t,r=arguments;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:this.statusPage,e.abrupt("return",this.request(t).then(function(e){return h.a.hasProperties(e,"blockID","block_header")}).catch(function(){return!1}));case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"request",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"get";return r=r.toLowerCase(),this.instance.request({data:"post"==r&&Object.keys(t).length?t:null,params:"get"==r&&t,url:e,method:r}).then(function(e){return e.data})}}]),e}();t.a={HttpProvider:p}},function(e,t,r){"use strict";var n=r(19),i=r(26);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var a=e.charCodeAt(i);a<128?r[n++]=a:a<2048?(r[n++]=a>>6|192,r[n++]=63&a|128):o(e,i)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i<e.length;i++)r[i]=0|e[i];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=a,t.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=a(i)),r+=u(i.toString(16))}return r},t.zero2=s,t.zero8=u,t.join32=function(e,t,r,i){var o=r-t;n(o%4==0);for(var a=new Array(o/4),s=0,u=t;s<a.length;s++,u+=4){var f;f="big"===i?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],a[s]=f>>>0}return a},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];"big"===t?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o<n?1:0)+r+i;e[t]=a>>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,f=t;return u+=(f=f+n>>>0)<t?1:0,u+=(f=f+o>>>0)<o?1:0,e+r+i+a+(u+=(f=f+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,f){var c=0,d=t;return c+=(d=d+n>>>0)<t?1:0,c+=(d=d+o>>>0)<o?1:0,c+=(d=d+s>>>0)<s?1:0,e+r+i+a+u+(c+=(d=d+f>>>0)<f?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,f){return t+n+o+s+f>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a=r(100).Buffer}catch(e){}function s(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o<i;o++){var a=e.charCodeAt(o)-48;n<<=4,n|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,o=0;for(r=e.length-6,n=0;r>=t;r-=6)i=s(e,r,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,c=r;c<s;c+=n)f=u(e,c,c+n,t),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==a){var d=1;for(f=u(e,c,e.length,t),c=0;c<a;c++)d*=t;this.imuln(d),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var f=1;f<n;f++){for(var c=u>>>26,d=67108863&u,l=Math.min(f,t.length-1),h=Math.max(0,f-e.length+1);h<=l;h++){var p=f-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[f]=0|d,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=c[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var v=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?v+r:f[l-v.length]+v+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,f=new e(o),c=this.clone();if(u){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),f[s]=a;for(;s<o;s++)f[s]=0}else{for(s=0;s<o-i;s++)f[s]=0;for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),f[o-s-1]=a}return f},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a<n.length;a++)o=(t=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,i,o,a=e.words,s=t.words,u=r.words,f=0,c=0|a[0],d=8191&c,l=c>>>13,h=0|a[1],p=8191&h,v=h>>>13,m=0|a[2],b=8191&m,g=m>>>13,y=0|a[3],w=8191&y,_=y>>>13,M=0|a[4],A=8191&M,x=M>>>13,S=0|a[5],k=8191&S,E=S>>>13,I=0|a[6],P=8191&I,N=I>>>13,T=0|a[7],R=8191&T,O=T>>>13,C=0|a[8],B=8191&C,j=C>>>13,L=0|a[9],F=8191&L,D=L>>>13,U=0|s[0],W=8191&U,z=U>>>13,q=0|s[1],H=8191&q,G=q>>>13,K=0|s[2],V=8191&K,$=K>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,fe=se>>>13,ce=0|s[8],de=8191&ce,le=ce>>>13,he=0|s[9],pe=8191&he,ve=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(f+(n=Math.imul(d,W))|0)+((8191&(i=(i=Math.imul(d,z))+Math.imul(l,W)|0))<<13)|0;f=((o=Math.imul(l,z))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,W),i=(i=Math.imul(p,z))+Math.imul(v,W)|0,o=Math.imul(v,z);var be=(f+(n=n+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,G)|0)+Math.imul(l,H)|0))<<13)|0;f=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(b,W),i=(i=Math.imul(b,z))+Math.imul(g,W)|0,o=Math.imul(g,z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,G)|0;var ge=(f+(n=n+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,$)|0)+Math.imul(l,V)|0))<<13)|0;f=((o=o+Math.imul(l,$)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,W),i=(i=Math.imul(w,z))+Math.imul(_,W)|0,o=Math.imul(_,z),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,G)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,$)|0;var ye=(f+(n=n+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(A,W),i=(i=Math.imul(A,z))+Math.imul(x,W)|0,o=Math.imul(x,z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,$)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Y)|0;var we=(f+(n=n+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,W),i=(i=Math.imul(k,z))+Math.imul(E,W)|0,o=Math.imul(E,z),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(x,H)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(g,J)|0,o=o+Math.imul(g,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0;var _e=(f+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;f=((o=o+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(P,W),i=(i=Math.imul(P,z))+Math.imul(N,W)|0,o=Math.imul(N,z),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0;var Me=(f+(n=n+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(l,oe)|0))<<13)|0;f=((o=o+Math.imul(l,ae)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(R,W),i=(i=Math.imul(R,z))+Math.imul(O,W)|0,o=Math.imul(O,z),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(k,V)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,$)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0;var Ae=(f+(n=n+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(l,ue)|0))<<13)|0;f=((o=o+Math.imul(l,fe)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(B,W),i=(i=Math.imul(B,z))+Math.imul(j,W)|0,o=Math.imul(j,z),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(O,H)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,fe)|0;var xe=(f+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;f=((o=o+Math.imul(l,le)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(F,W),i=(i=Math.imul(F,z))+Math.imul(D,W)|0,o=Math.imul(D,z),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(j,H)|0,o=o+Math.imul(j,G)|0,n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,fe)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(v,de)|0,o=o+Math.imul(v,le)|0;var Se=(f+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ve)|0)+Math.imul(l,pe)