>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new g;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return m[t]=e,e},A.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),f=s.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,c).cmp(f);)u.redIAdd(f);for(var h=this.pow(u,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,m=0;0!==b.cmp(s);m++)b=b.redSqr();n(m=0;n--){for(var c=e.words[n],u=f-1;u>=0;u--){var h=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===n&&0===u)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}f=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,A),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(22)(t))},function(t,e,r){var n=r(1),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){(function(t,r){var n;!function(){var i="object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t||this||{},o=i._,a=Array.prototype,s=Object.prototype,f="undefined"!=typeof Symbol?Symbol.prototype:null,c=a.push,u=a.slice,h=s.toString,d=s.hasOwnProperty,l=Array.isArray,p=Object.keys,b=Object.create,m=function(){},y=function(t){return t instanceof y?t:this instanceof y?void(this._wrapped=t):new y(t)};e.nodeType?i._=y:(!r.nodeType&&r.exports&&(e=r.exports=y),e._=y),y.VERSION="1.9.1";var v,g=function(t,e,r){if(void 0===e)return t;switch(null==r?3:r){case 1:return function(r){return t.call(e,r)};case 3:return function(r,n,i){return t.call(e,r,n,i)};case 4:return function(r,n,i,o){return t.call(e,r,n,i,o)}}return function(){return t.apply(e,arguments)}},w=function(t,e,r){return y.iteratee!==v?y.iteratee(t,e):null==t?y.identity:y.isFunction(t)?g(t,e,r):y.isObject(t)&&!y.isArray(t)?y.matcher(t):y.property(t)};y.iteratee=v=function(t,e){return w(t,e,1/0)};var _=function(t,e){return e=null==e?t.length-1:+e,function(){for(var r=Math.max(arguments.length-e,0),n=Array(r),i=0;i=0&&e<=x};y.each=y.forEach=function(t,e,r){var n,i;if(e=g(e,r),I(t))for(n=0,i=t.length;n0?0:a-1;for(i||(n=e[o?o[s]:s],s+=t);s>=0&&s=3;return e(t,g(r,i,4),n,o)}};y.reduce=y.foldl=y.inject=T(1),y.reduceRight=y.foldr=T(-1),y.find=y.detect=function(t,e,r){var n=(I(t)?y.findIndex:y.findKey)(t,e,r);if(void 0!==n&&-1!==n)return t[n]},y.filter=y.select=function(t,e,r){var n=[];return e=w(e,r),y.each(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n},y.reject=function(t,e,r){return y.filter(t,y.negate(w(e)),r)},y.every=y.all=function(t,e,r){e=w(e,r);for(var n=!I(t)&&y.keys(t),i=(n||t).length,o=0;o=0},y.invoke=_((function(t,e,r){var n,i;return y.isFunction(e)?i=e:y.isArray(e)&&(n=e.slice(0,-1),e=e[e.length-1]),y.map(t,(function(t){var o=i;if(!o){if(n&&n.length&&(t=S(t,n)),null==t)return;o=t[e]}return null==o?o:o.apply(t,r)}))})),y.pluck=function(t,e){return y.map(t,y.property(e))},y.where=function(t,e){return y.filter(t,y.matcher(e))},y.findWhere=function(t,e){return y.find(t,y.matcher(e))},y.max=function(t,e,r){var n,i,o=-1/0,a=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var s=0,f=(t=I(t)?t:y.values(t)).length;so&&(o=n);else e=w(e,r),y.each(t,(function(t,r,n){((i=e(t,r,n))>a||i===-1/0&&o===-1/0)&&(o=t,a=i)}));return o},y.min=function(t,e,r){var n,i,o=1/0,a=1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var s=0,f=(t=I(t)?t:y.values(t)).length;sn||void 0===r)return 1;if(r0?0:i-1;o>=0&&o0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(r&&o&&s)return n[o=r(n,i)]===i?o:-1;if(i!=i)return(o=e(u.call(n,a,s),y.isNaN))>=0?o+a:-1;for(o=t>0?a:s-1;o>=0&&oe?(n&&(clearTimeout(n),n=null),s=c,a=t.apply(i,o),n||(i=o=null)):n||!1===r.trailing||(n=setTimeout(f,u)),a};return c.cancel=function(){clearTimeout(n),s=0,n=i=o=null},c},y.debounce=function(t,e,r){var n,i,o=function(e,r){n=null,r&&(i=t.apply(e,r))},a=_((function(a){if(n&&clearTimeout(n),r){var s=!n;n=setTimeout(o,e),s&&(i=t.apply(this,a))}else n=y.delay(o,e,this,a);return i}));return a.cancel=function(){clearTimeout(n),n=null},a},y.wrap=function(t,e){return y.partial(e,t)},y.negate=function(t){return function(){return!t.apply(this,arguments)}},y.compose=function(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}},y.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},y.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},y.once=y.partial(y.before,2),y.restArguments=_;var O=!{toString:null}.propertyIsEnumerable("toString"),L=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],j=function(t,e){var r=L.length,n=t.constructor,i=y.isFunction(n)&&n.prototype||s,o="constructor";for(E(t,o)&&!y.contains(e,o)&&e.push(o);r--;)(o=L[r])in t&&t[o]!==i[o]&&!y.contains(e,o)&&e.push(o)};y.keys=function(t){if(!y.isObject(t))return[];if(p)return p(t);var e=[];for(var r in t)E(t,r)&&e.push(r);return O&&j(t,e),e},y.allKeys=function(t){if(!y.isObject(t))return[];var e=[];for(var r in t)e.push(r);return O&&j(t,e),e},y.values=function(t){for(var e=y.keys(t),r=e.length,n=Array(r),i=0;i1&&(n=g(n,e[1])),e=y.allKeys(t)):(n=z,e=P(e,!1,!1),t=Object(t));for(var i=0,o=e.length;i1&&(r=e[1])):(e=y.map(P(e,!1,!1),String),n=function(t,r){return!y.contains(e,r)}),y.pick(t,n,r)})),y.defaults=D(y.allKeys,!0),y.create=function(t,e){var r=A(t);return e&&y.extendOwn(r,e),r},y.clone=function(t){return y.isObject(t)?y.isArray(t)?t.slice():y.extend({},t):t},y.tap=function(t,e){return e(t),t},y.isMatch=function(t,e){var r=y.keys(e),n=r.length;if(null==t)return!n;for(var i=Object(t),o=0;o":">",'"':""","'":"'","`":"`"},V=y.invert(K),G=function(t){var e=function(e){return t[e]},r="(?:"+y.keys(t).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(i,e):t}};y.escape=G(K),y.unescape=G(V),y.result=function(t,e,r){y.isArray(e)||(e=[e]);var n=e.length;if(!n)return y.isFunction(r)?r.call(t):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var W=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},X=/\\|'|\r|\n|\u2028|\u2029/g,Z=function(t){return"\\"+J[t]};y.template=function(t,e,r){!e&&r&&(e=r),e=y.defaults({},e,y.templateSettings);var n,i=RegExp([(e.escape||W).source,(e.interpolate||W).source,(e.evaluate||W).source].join("|")+"|$","g"),o=0,a="__p+='";t.replace(i,(function(e,r,n,i,s){return a+=t.slice(o,s).replace(X,Z),o=s+e.length,r?a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?a+="'+\n((__t=("+n+"))==null?'':__t)+\n'":i&&(a+="';\n"+i+"\n__p+='"),e})),a+="';\n",e.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{n=new Function(e.variable||"obj","_",a)}catch(t){throw t.source=a,t}var s=function(t){return n.call(this,t,y)},f=e.variable||"obj";return s.source="function("+f+"){\n"+a+"}",s},y.chain=function(t){var e=y(t);return e._chain=!0,e};var $=function(t,e){return t._chain?y(e).chain():e};y.mixin=function(t){return y.each(y.functions(t),(function(e){var r=y[e]=t[e];y.prototype[e]=function(){var t=[this._wrapped];return c.apply(t,arguments),$(this,r.apply(y,t))}})),y},y.mixin(y),y.each(["pop","push","reverse","shift","sort","splice","unshift"],(function(t){var e=a[t];y.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],$(this,r)}})),y.each(["concat","join","slice"],(function(t){var e=a[t];y.prototype[t]=function(){return $(this,e.apply(this._wrapped,arguments))}})),y.prototype.value=function(){return this._wrapped},y.prototype.valueOf=y.prototype.toJSON=y.prototype.value,y.prototype.toString=function(){return String(this._wrapped)},void 0===(n=function(){return y}.apply(e,[]))||(r.exports=n)}()}).call(this,r(4),r(22)(t))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var f,c=[],u=!1,h=-1;function d(){u&&f&&(u=!1,f.length?c=f.concat(c):h=-1,c.length&&l())}function l(){if(!u){var t=s(d);u=!0;for(var e=c.length;e;){for(f=c,c=[];++h1)for(var r=1;r(i>>1)-1?(i>>1)-f:f,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0;t.cmpn(-n)>0||e.cmpn(-i)>0;){var o,a,s,f=t.andln(3)+n&3,c=e.andln(3)+i&3;if(3===f&&(f=-1),3===c&&(c=-1),0==(1&f))o=0;else o=3!==(s=t.andln(7)+n&7)&&5!==s||2!==c?f:-f;if(r[0].push(o),0==(1&c))a=0;else a=3!==(s=e.andln(7)+i&7)&&5!==s||2!==f?c:-c;r[1].push(a),2*n===o+1&&(n=1-n),2*i===a+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){var n=r(5),i=r(143),o=r(70),a=r(153),s=r(154),f=function(t,e){var r=[];return e.forEach((function(e){if("object"==typeof e.components){if("tuple"!==e.type.substring(0,5))throw new Error("components found but type is not tuple; report on GitHub");var i="",o=e.type.indexOf("[");o>=0&&(i=e.type.substring(o));var a=f(t,e.components);n.isArray(a)&&t?r.push("tuple("+a.join(",")+")"+i):t?r.push("("+a+")"):r.push("("+a.join(",")+")"+i)}else r.push(e.type)})),r},c=function(t){if(!o.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r7?r+=t[n].toUpperCase():r+=t[n];return r},toHex:o.toHex,toBN:o.toBN,bytesToHex:o.bytesToHex,hexToBytes:o.hexToBytes,hexToNumberString:o.hexToNumberString,hexToNumber:o.hexToNumber,toDecimal:o.hexToNumber,numberToHex:o.numberToHex,fromDecimal:o.numberToHex,hexToUtf8:o.hexToUtf8,hexToString:o.hexToUtf8,toUtf8:o.hexToUtf8,utf8ToHex:o.utf8ToHex,stringToHex:o.utf8ToHex,fromUtf8:o.utf8ToHex,hexToAscii:c,toAscii:c,asciiToHex:u,fromAscii:u,unitMap:i.unitMap,toWei:function(t,e){if(e=h(e),!o.isBN(t)&&!n.isString(t))throw new Error("Please pass numbers as strings or BN objects to avoid precision errors.");return o.isBN(t)?i.toWei(t,e):i.toWei(t,e).toString(10)},fromWei:function(t,e){if(e=h(e),!o.isBN(t)&&!n.isString(t))throw new Error("Please pass numbers as strings or BN objects to avoid precision errors.");return o.isBN(t)?i.fromWei(t,e):i.fromWei(t,e).toString(10)},padLeft:o.leftPad,leftPad:o.leftPad,padRight:o.rightPad,rightPad:o.rightPad,toTwosComplement:o.toTwosComplement,isBloom:o.isBloom,isUserEthereumAddressInBloom:o.isUserEthereumAddressInBloom,isContractAddressInBloom:o.isContractAddressInBloom,isTopic:o.isTopic,isTopicInBloom:o.isTopicInBloom,isInBloom:o.isInBloom}},function(t,e,r){"use strict";var n=r(9),i=r(0);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function f(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.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>>0}return a},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>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},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,a,s){var f=0,c=e;return f+=(c=c+n>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,a,s,f,c){var u=0,h=e;return u+=(h=h+n>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,n,i,o,a,s,f,c){return e+n+o+s+c>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){var n=r(3).Buffer,i=r(26).Transform,o=r(49).StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(0)(a,i),a.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=a},function(t,e,r){"use strict";var n=r(140),i=r(185);t.exports={packageInit:function(t,e){if(e=Array.prototype.slice.call(e),!t)throw new Error('You need to instantiate using the "new" keyword.');Object.defineProperty(t,"currentProvider",{get:function(){return t._provider},set:function(e){return t.setProvider(e)},enumerable:!0,configurable:!0}),e[0]&&e[0]._requestManager?t._requestManager=new n.Manager(e[0].currentProvider):(t._requestManager=new n.Manager,t._requestManager.setProvider(e[0],e[1])),t.givenProvider=n.Manager.givenProvider,t.providers=n.Manager.providers,t._provider=t._requestManager.provider,t.setProvider||(t.setProvider=function(e,r){return t._requestManager.setProvider(e,r),t._provider=t._requestManager.provider,!0}),t.BatchRequest=n.BatchManager.bind(null,t._requestManager),t.extend=i(t)},addProviders:function(t){t.givenProvider=n.Manager.givenProvider,t.providers=n.Manager.providers}}},function(t,e,r){"use strict";var n=r(34),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var o=r(25);o.inherits=r(0);var a=r(76),s=r(48);o.inherits(h,a);for(var f=i(s.prototype),c=0;c1?(t[r[0]]=t[r[0]]||{},t[r[0]][r[1]]=e):t[r[0]]=e},c.prototype.getCall=function(t){return n.isFunction(this.call)?this.call(t):this.call},c.prototype.extractCallback=function(t){if(n.isFunction(t[t.length-1]))return t.pop()},c.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams(t.length,this.params,this.name)},c.prototype.formatInput=function(t){var e=this;return this.inputFormatter?this.inputFormatter.map((function(r,n){return r?r.call(e,t[n]):t[n]})):t},c.prototype.formatOutput=function(t){var e=this;return n.isArray(t)?t.map((function(t){return e.outputFormatter&&t?e.outputFormatter(t):t})):this.outputFormatter&&t?this.outputFormatter(t):t},c.prototype.toPayload=function(t){var e=this.getCall(t),r=this.extractCallback(t),n=this.formatInput(t);this.validateArgs(n);var i={method:e,params:n,callback:r};return this.transformPayload&&(i=this.transformPayload(i)),i},c.prototype._confirmTransaction=function(t,e,r){var u=this,h=!1,d=!0,l=0,p=0,b=null,m=null,y=n.isObject(r.params[0])&&r.params[0].gas?r.params[0].gas:null,v=n.isObject(r.params[0])&&r.params[0].data&&r.params[0].from&&!r.params[0].to,g=v&&r.params[0].data.length>2,w=[new c({name:"getBlockByNumber",call:"eth_getBlockByNumber",params:2,inputFormatter:[o.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:o.outputBlockFormatter}),new c({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,inputFormatter:[null],outputFormatter:o.outputTransactionReceiptFormatter}),new c({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[o.inputAddressFormatter,o.inputDefaultBlockNumberFormatter]}),new f({name:"subscribe",type:"eth",subscriptions:{newBlockHeaders:{subscriptionName:"newHeads",params:0,outputFormatter:o.outputBlockFormatter}}})],_={};n.each(w,(function(t){t.attachToObject(_),t.requestManager=u.requestManager}));var A=function(n,o,f,c,w){if(!f)return w||(w={unsubscribe:function(){clearInterval(b)}}),(n?s.resolve(n):_.getTransactionReceipt(e)).catch((function(e){w.unsubscribe(),h=!0,a._fireError({message:"Failed to check for transaction receipt:",data:e},t.eventEmitter,t.reject)})).then((async function(e){if(!e||!e.blockHash)throw new Error("Receipt missing or blockHash null");var r;(u.extraFormatters&&u.extraFormatters.receiptFormatter&&(e=u.extraFormatters.receiptFormatter(e)),t.eventEmitter.listeners("confirmation").length>0)&&(void 0!==n&&0===p||(o?m?(r=await _.getBlockByNumber(m.number+1))&&(m=r,t.eventEmitter.emit("confirmation",p,e)):(r=await _.getBlockByNumber(e.blockNumber),m=r,t.eventEmitter.emit("confirmation",p,e)):t.eventEmitter.emit("confirmation",p,e)),(o&&r||!o)&&p++,d=!1,p===u.transactionConfirmationBlocks+1&&(w.unsubscribe(),t.eventEmitter.removeAllListeners()));return e})).then((async function(e){if(v&&!h){if(!e.contractAddress)return d&&(w.unsubscribe(),h=!0),void a._fireError(i.NoContractAddressFoundError(e),t.eventEmitter,t.reject,null,e);var r;try{r=await _.getCode(e.contractAddress)}catch(t){}if(!r)return;!0===e.status&&g||r.length>2?(t.eventEmitter.emit("receipt",e),u.extraFormatters&&u.extraFormatters.contractDeployFormatter?t.resolve(u.extraFormatters.contractDeployFormatter(e)):t.resolve(e),d&&t.eventEmitter.removeAllListeners()):a._fireError(i.ContractCodeNotStoredError(e),t.eventEmitter,t.reject,null,e),d&&w.unsubscribe(),h=!0}return e})).then((async function(e){if(!v&&!h){if(e.outOfGas||y&&y===e.gasUsed||!0!==e.status&&"0x1"!==e.status&&void 0!==e.status)if(JSON.stringify(e,null,2),!1===e.status||"0x0"===e.status)try{var n=null;if(!u.handleRevert||"eth_sendTransaction"!==u.call)throw!1;if(!(n=await u.getRevertReason(r.params[0],e.blockNumber)))throw!1;a._fireError(i.TransactionRevertInstructionError(n.reason,n.signature,e),t.eventEmitter,t.reject,null,e)}catch(r){a._fireError(i.TransactionRevertedWithoutReasonError(e),t.eventEmitter,t.reject,null,e)}else a._fireError(i.TransactionOutOfGasError(e),t.eventEmitter,t.reject,null,e);else t.eventEmitter.emit("receipt",e),t.resolve(e),d&&t.eventEmitter.removeAllListeners();d&&w.unsubscribe(),h=!0}})).catch((function(){l++,o?l-1>=u.transactionPollingTimeout&&(w.unsubscribe(),h=!0,a._fireError(i.TransactionError("Transaction was not mined within "+u.transactionPollingTimeout+" seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!"),t.eventEmitter,t.reject)):l-1>=u.transactionBlockTimeout&&(w.unsubscribe(),h=!0,a._fireError(i.TransactionError("Transaction was not mined within "+u.transactionBlockTimeout+" blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!"),t.eventEmitter,t.reject))}));w.unsubscribe(),h=!0,a._fireError({message:"Failed to subscribe to new newBlockHeaders to confirm the transaction receipts.",data:f},t.eventEmitter,t.reject)},M=function(t){n.isFunction(this.requestManager.provider.on)?_.subscribe("newBlockHeaders",A.bind(null,t,!1)):b=setInterval(A.bind(null,t,!0),1e3)}.bind(this);_.getTransactionReceipt(e).then((function(e){e&&e.blockHash?(t.eventEmitter.listeners("confirmation").length>0&&M(e),A(e,!1)):h||M()})).catch((function(){h||M()}))};var u=function(t,e){return n.isNumber(t)?e.wallet[t]:n.isObject(t)&&t.address&&t.privateKey?t:e.wallet[t.toLowerCase()]};c.prototype.buildCall=function(){var t=this,e="eth_sendTransaction"===t.call||"eth_sendRawTransaction"===t.call,r="eth_call"===t.call,o=function(){var o=s(!e),f=t.toPayload(Array.prototype.slice.call(arguments)),h=function(n,s){if(t.handleRevert&&!n&&r&&t.isRevertReasonString(s)&&t.abiCoder){var c=t.abiCoder.decodeParameter("string","0x"+s.substring(10));a._fireError(i.RevertInstructionError(c,"Error(String)"),o.eventEmitter,o.reject,f.callback,{reason:c,signature:"Error(String)"})}else{try{s=t.formatOutput(s)}catch(t){n=t}if(s instanceof Error&&(n=s),n)return n.error&&(n=n.error),a._fireError(n,o.eventEmitter,o.reject,f.callback);f.callback&&f.callback(null,s),e?(o.eventEmitter.emit("transactionHash",s),t._confirmTransaction(o,s,f)):n||o.resolve(s)}},d=function(e){var r=n.extend({},f,{method:"eth_sendRawTransaction",params:[e.rawTransaction]});t.requestManager.send(r,h)},l=function(t,e){var r;if(e&&e.accounts&&e.accounts.wallet&&e.accounts.wallet.length)if("eth_sendTransaction"===t.method){var i=t.params[0];if((r=u(n.isObject(i)?i.from:null,e.accounts))&&r.privateKey){var a=n.omit(i,"from");return e.defaultChain&&!a.chain&&(a.chain=e.defaultChain),e.defaultHardfork&&!a.hardfork&&(a.hardfork=e.defaultHardfork),e.defaultCommon&&!a.common&&(a.common=e.defaultCommon),e.accounts.signTransaction(a,r.privateKey).then(d).catch((function(t){n.isFunction(o.eventEmitter.listeners)&&o.eventEmitter.listeners("error").length&&(o.eventEmitter.emit("error",t),o.eventEmitter.removeAllListeners(),o.eventEmitter.catch((function(){}))),o.reject(t)}))}}else if("eth_sign"===t.method){var s=t.params[1];if((r=u(t.params[0],e.accounts))&&r.privateKey){var f=e.accounts.sign(s,r.privateKey);return t.callback&&t.callback(null,f.signature),void o.resolve(f.signature)}}return e.requestManager.send(t,h)};if(e&&n.isObject(f.params[0])&&void 0===f.params[0].gasPrice){var p=new c({name:"getGasPrice",call:"eth_gasPrice",params:0}).createFunction(t.requestManager);p((function(e,r){r&&(f.params[0].gasPrice=r),l(f,t)}))}else l(f,t);return o.eventEmitter};return o.method=t,o.request=this.request.bind(this),o},c.prototype.getRevertReason=function(t,e){var r=this;return new Promise((function(n,i){new c({name:"call",call:"eth_call",params:2,abiCoder:r.abiCoder,handleRevert:!0}).createFunction(r.requestManager)(t,a.numberToHex(e)).then((function(){n(!1)})).catch((function(t){t.reason?n({reason:t.reason,signature:t.signature}):i(t)}))}))},c.prototype.isRevertReasonString=function(t){return n.isString(t)&&(t.length-2)/2%32==4&&"0x08c379a0"===t.substring(0,10)},c.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},t.exports=c},function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(20),e.createHash=e.Hash=r(18),e.createHmac=e.Hmac=r(94);var n=r(219),i=Object.keys(n),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var a=r(97);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync;var s=r(221);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var f=r(238);e.DiffieHellmanGroup=f.DiffieHellmanGroup,e.createDiffieHellmanGroup=f.createDiffieHellmanGroup,e.getDiffieHellman=f.getDiffieHellman,e.createDiffieHellman=f.createDiffieHellman,e.DiffieHellman=f.DiffieHellman;var c=r(242);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=r(278);var u=r(279);e.publicEncrypt=u.publicEncrypt,e.privateEncrypt=u.privateEncrypt,e.publicDecrypt=u.publicDecrypt,e.privateDecrypt=u.privateDecrypt;var h=r(282);e.randomFill=h.randomFill,e.randomFillSync=h.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){"use strict";var n=r(0),i=r(52),o=r(53),a=r(54),s=r(13);function f(t){s.call(this,"digest"),this._hash=t}n(f,s),f.prototype._update=function(t){this._hash.update(t)},f.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new f(a(t))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(87),i=r(38);function o(t){return t instanceof n.BigNumber}function a(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return new Uint8Array(Array.prototype.slice.apply(t,e))}),t}function s(t){if(!t||parseInt(String(t.length))!=t.length||"string"==typeof t)return!1;for(var e=0;e=256||parseInt(String(r))!=r)return!1}return!0}function f(t){if(null==t&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:t}),o(t)&&(t=t.toHexString()),"string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);e||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==e[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;n>4]+"0123456789abcdef"[15&f])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function d(t,e){for(u(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});t.length<2*e+2;)t="0x0"+t.substring(2);return t}function l(t){var e,r=0,n="0x",o="0x";if((e=t)&&null!=e.r&&null!=e.s){null==t.v&&null==t.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:t}),n=d(t.r,32),o=d(t.s,32),"string"==typeof(r=t.v)&&(r=parseInt(r,16));var a=t.recoveryParam;null==a&&null!=t.v&&(a=1-r%2),r=27+a}else{var s=f(t);if(65!==s.length)throw new Error("invalid signature");n=h(s.slice(0,32)),o=h(s.slice(32,64)),27!==(r=s[64])&&28!==r&&(r=27+r%2)}return{r:n,s:o,recoveryParam:r-27,v:r}}e.hexlify=h,e.hexDataLength=function(t){return u(t)&&t.length%2==0?(t.length-2)/2:null},e.hexDataSlice=function(t,e,r){return u(t)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,e+2*r):"0x"+t.substring(e)},e.hexStripZeros=function(t){for(u(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});t.length>3&&"0x0"===t.substring(0,3);)t="0x"+t.substring(3);return t},e.hexZeroPad=d,e.splitSignature=l,e.joinSignature=function(t){return h(c([(t=l(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},function(t,e,r){"use strict";(function(e,n){var i=r(3).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,r){if(t>65536)throw new Error("requested too many random bytes");var a=new e.Uint8Array(t);t>0&&o.getRandomValues(a);var s=i.from(a.buffer);if("function"==typeof r)return n.nextTick((function(){r(null,s)}));return s}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(4),r(6))},function(t,e,r){var n=r(3).Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";var n=r(73),i=r(162);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=g,e.resolve=function(t,e){return g(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?g(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=g(t));return t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),h=["%","/","?",";","#"].concat(u),d=["/","?","#"],l=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(163);function g(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o127?B+="x":B+=P[R];if(!B.match(l)){var O=U.slice(0,k),L=U.slice(k+1),j=P.match(p);j&&(O.push(j[1]),L.unshift(j[2])),L.length&&(g="/"+L.join(".")+g),this.hostname=O.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=n.toASCII(this.hostname));var D=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+D,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==g[0]&&(g="/"+g))}if(!b[A])for(k=0,C=u.length;k0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!M.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=M.slice(-1)[0],x=(r.host||t.host||M.length>1)&&("."===S||".."===S)||""===S,k=0,I=M.length;I>=0;I--)"."===(S=M[I])?M.splice(I,1):".."===S?(M.splice(I,1),k++):k&&(M.splice(I,1),k--);if(!_&&!A)for(;k--;k)M.unshift("..");!_||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),x&&"/"!==M.join("/").substr(-1)&&M.push("");var T,U=""===M[0]||M[0]&&"/"===M[0].charAt(0);E&&(r.hostname=r.host=U?"":M.length?M.shift():"",(T=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift()));return(_=_||r.host&&M.length)&&!U&&M.unshift(""),M.length?r.pathname=M.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){(e=t.exports=r(76)).Stream=e,e.Readable=e,e.Writable=r(48),e.Duplex=r(15),e.Transform=r(80),e.PassThrough=r(175)},function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(1).Buffer)},function(t,e,r){t.exports=i;var n=r(47).EventEmitter;function i(){n.call(this)}r(0)(i,n),i.Readable=r(24),i.Writable=r(210),i.Duplex=r(211),i.Transform=r(212),i.PassThrough=r(213),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",f));var a=!1;function s(){a||(a=!0,t.end())}function f(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(u(),0===n.listenerCount(this,"error"))throw t}function u(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",f),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("error",c),t.on("error",c),r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t}},function(t,e,r){(function(e){t.exports=function(t,r){for(var n=Math.min(t.length,r.length),i=new e(n),o=0;o=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o=0}))},intToBuffer:function(t){var r=a(t);return new e(o(r.slice(2)),"hex")},getBinarySize:function(t){if("string"!=typeof t)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof t+"'.");return e.byteLength(t,"utf8")},isHexPrefixed:n,stripHexPrefix:i,padToEven:o,intToHex:a,fromAscii:function(t){for(var e="",r=0;r0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t},e.stripZeros=e.unpad,e.toBuffer=function(e){if(!t.isBuffer(e))if(Array.isArray(e))e=t.from(e);else if("string"==typeof e){if(!n.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);e=t.from(n.padToEven(n.stripHexPrefix(e)),"hex")}else if("number"==typeof e)e=n.intToBuffer(e);else if(null==e)e=t.allocUnsafe(0);else if(i.isBN(e))e=e.toArrayLike(t);else{if(!e.toArray)throw new Error("invalid type");e=t.from(e.toArray())}return e},e.bufferToInt=function(t){return new i(e.toBuffer(t)).toNumber()},e.bufferToHex=function(t){return"0x"+(t=e.toBuffer(t)).toString("hex")},e.fromSigned=function(t){return new i(t).fromTwos(256)},e.toUnsigned=function(e){return t.from(e.toTwos(256).toArray())},e.addHexPrefix=function(t){return"string"!=typeof t||n.isHexPrefixed(t)?t:"0x"+t},e.baToJSON=function(r){if(t.isBuffer(r))return"0x"+r.toString("hex");if(r instanceof Array){for(var n=[],i=0;i1?(t[r[0]]=t[r[0]]||{},t[r[0]][r[1]]=e):t[r[0]]=e},i.prototype.buildCall=function(){var t=this;return function(){t.subscriptions[arguments[0]]||console.warn("Subscription "+JSON.stringify(arguments[0])+" doesn't exist. Subscribing anyway.");var e=new n({subscription:t.subscriptions[arguments[0]],requestManager:t.requestManager,type:t.type});return e.subscribe.apply(e,arguments)}},t.exports={subscriptions:i,subscription:n}},function(t,e,r){"use strict";var n=r(14),i=r(16),o=r(11),a=function(){var t=this;n.packageInit(this,arguments),[new i({name:"getId",call:"net_version",params:0,outputFormatter:parseInt}),new i({name:"isListening",call:"net_listening",params:0}),new i({name:"getPeerCount",call:"net_peerCount",params:0,outputFormatter:o.hexToNumber})].forEach((function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)}))};n.addProviders(a),t.exports=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.MISSING_NEW="MISSING_NEW",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.NUMERIC_FAULT="NUMERIC_FAULT",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION";var n=!1,i=!1;function o(t,r,n){if(i)throw new Error("unknown error");r||(r=e.UNKNOWN_ERROR),n||(n={});var o=[];Object.keys(n).forEach((function(t){try{o.push(t+"="+JSON.stringify(n[t]))}catch(e){o.push(t+"="+JSON.stringify(n[t].toString()))}}));var a=t;o.length&&(t+=" ("+o.join(", ")+")");var s=new Error(t);throw s.reason=a,s.code=r,Object.keys(n).forEach((function(t){s[t]=n[t]})),s}e.throwError=o,e.checkNew=function(t,r){t instanceof r||o("missing new",e.MISSING_NEW,{name:r.name})},e.checkArgumentCount=function(t,r,n){n||(n=""),tr&&o("too many arguments"+n,e.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})},e.setCensorship=function(t,r){n&&o("error censorship permanent",e.UNSUPPORTED_OPERATION,{operation:"setCersorship"}),i=!!t,n=!!r}},function(t,e,r){var n=r(3).Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i>>24]^u[p>>>16&255]^h[b>>>8&255]^d[255&m]^e[y++],a=c[p>>>24]^u[b>>>16&255]^h[m>>>8&255]^d[255&l]^e[y++],s=c[b>>>24]^u[m>>>16&255]^h[l>>>8&255]^d[255&p]^e[y++],f=c[m>>>24]^u[l>>>16&255]^h[p>>>8&255]^d[255&b]^e[y++],l=o,p=a,b=s,m=f;return o=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&m])^e[y++],a=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[m>>>8&255]<<8|n[255&l])^e[y++],s=(n[b>>>24]<<24|n[m>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[y++],f=(n[m>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^e[y++],[o>>>=0,a>>>=0,s>>>=0,f>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],f=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,f=0;f<256;++f){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,r[a]=c,n[c]=a;var u=t[a],h=t[u],d=t[h],l=257*t[c]^16843008*c;i[0][a]=l<<24|l>>>8,i[1][a]=l<<16|l>>>16,i[2][a]=l<<8|l>>>24,i[3][a]=l,l=16843009*d^65537*h^257*u^16843008*a,o[0][c]=l<<24|l>>>8,o[1][c]=l<<16|l>>>16,o[2][c]=l<<8|l>>>24,o[3][c]=l,0===a?a=s=1:(a=u^t[t[t[d^u]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o>>24,a=f.SBOX[a>>>24]<<24|f.SBOX[a>>>16&255]<<16|f.SBOX[a>>>8&255]<<8|f.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=f.SBOX[a>>>24]<<24|f.SBOX[a>>>16&255]<<16|f.SBOX[a>>>8&255]<<8|f.SBOX[255&a]),i[o]=i[o-e]^a}for(var c=[],u=0;u>>24]]^f.INV_SUB_MIX[1][f.SBOX[d>>>16&255]]^f.INV_SUB_MIX[2][f.SBOX[d>>>8&255]]^f.INV_SUB_MIX[3][f.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,f.SUB_MIX,f.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=a(t,this._invKeySchedule,f.INV_SUB_MIX,f.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},function(t,e,r){var n=r(3).Buffer,i=r(52);t.exports=function(t,e,r,o){if(n.isBuffer(t)||(t=n.from(t,"binary")),e&&(n.isBuffer(e)||(e=n.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=r/8,s=n.alloc(a),f=n.alloc(o||0),c=n.alloc(0);a>0||o>0;){var u=new i;u.update(c),u.update(t),e&&u.update(e),c=u.digest();var h=0;if(a>0){var d=s.length-a;h=Math.min(a,c.length),c.copy(s,d,0,h),a-=h}if(h0){var l=f.length-o,p=Math.min(o,c.length-h);c.copy(f,l,h,h+p),o-=p}}return c.fill(0),{key:s,iv:f}}},function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=f,f.prototype.point=function(){throw new Error("Not implemented")},f.prototype.validate=function(){throw new Error("Not implemented")},f.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<=f;e--)c=(c<<1)+n[e];a.push(c)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(f=0;f=0;c--){for(e=0;c>=0&&0===a[c];c--)e++;if(c>=0&&e++,f=f.dblp(e),c<0)break;var u=a[c];s(0!==u),f="affine"===t.type?u>0?f.mixedAdd(i[u-1>>1]):f.mixedAdd(i[-u-1>>1].neg()):u>0?f.add(i[u-1>>1]):f.add(i[-u-1>>1].neg())}return"affine"===t.type?f.toP():f},f.prototype._wnafMulAdd=function(t,e,r,n,i){for(var s=this._wnafT1,f=this._wnafT2,c=this._wnafT3,u=0,h=0;h=1;h-=2){var l=h-1,p=h;if(1===s[l]&&1===s[p]){var b=[e[l],null,null,e[p]];0===e[l].y.cmp(e[p].y)?(b[1]=e[l].add(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg())):0===e[l].y.cmp(e[p].y.redNeg())?(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].add(e[p].neg())):(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=a(r[l],r[p]);u=Math.max(y[0].length,u),c[l]=new Array(u),c[p]=new Array(u);for(var v=0;v