"use strict";functionplaceHoldersCount(o){varr=o.length;if(r%4>0)thrownewError("Invalid string. Length must be a multiple of 4");return"="===o[r-2]?2:"="===o[r-1]?1:0}functionbyteLength(o){return3*o.length/4-placeHoldersCount(o)}functiontoByteArray(o){varr,e,t,u,n,p=o.length;u=placeHoldersCount(o),n=newArr(3*p/4-u),e=u>0?p-4:p;vara=0;for(r=0;r<e;r+=4)t=revLookup[o.charCodeAt(r)]<<18|revLookup[o.charCodeAt(r+1)]<<12|revLookup[o.charCodeAt(r+2)]<<6|revLookup[o.charCodeAt(r+3)],n[a++]=t>>16&255,n[a++]=t>>8&255,n[a++]=255&t;return2===u?(t=revLookup[o.charCodeAt(r)]<<2|revLookup[o.charCodeAt(r+1)]>>4,n[a++]=255&t):1===u&&(t=revLookup[o.charCodeAt(r)]<<10|revLookup[o.charCodeAt(r+1)]<<4|revLookup[o.charCodeAt(r+2)]>>2,n[a++]=t>>8&255,n[a++]=255&t),n}functiontripletToBase64(o){returnlookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}functionencodeChunk(o,r,e){for(vart,u=[],n=r;n<e;n+=3)t=(o[n]<<16)+(o[n+1]<<8)+o[n+2],u.push(tripletToBase64(t));returnu.join("")}functionfromByteArray(o){for(varr,e=o.length,t=e%3,u="",n=[],p=0,a=e-t;p<a;p+=16383)n.push(encodeChunk(o,p,p+16383>a?a:p+16383));return1===t?(r=o[e-1],u+=lookup[r>>2],u+=lookup[r<<4&63],u+="=="):2===t&&(r=(o[e-2]<<8)+o[e-1],u+=lookup[r>>10],u+=lookup[r>>4&63],u+=lookup[r<<2&63],u+="="),n.push(u),n.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(varlookup=[],revLookup=[],Arr="undefined"!=typeofUint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;
},{}],3:[function(require,module,exports){
functioncheck(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;varr=e[3];if(0===r)return!1;if(5+r>=e.length)return!1;if(2!==e[4+r])return!1;varn=e[5+r];return0!==n&&(6+r+n===e.length&&(!(128&e[4])&&(!(r>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[r+6])&&!(n>1&&0===e[r+6]&&!(128&e[r+7]))))))}functiondecode(e){if(e.length<8)thrownewError("DER sequence length is too short");if(e.length>72)thrownewError("DER sequence length is too long");if(48!==e[0])thrownewError("Expected DER sequence");if(e[1]!==e.length-2)thrownewError("DER sequence length is invalid");if(2!==e[2])thrownewError("Expected DER integer");varr=e[3];if(0===r)thrownewError("R length is zero");if(5+r>=e.length)thrownewError("R length is too long");if(2!==e[4+r])thrownewError("Expected DER integer (2)");varn=e[5+r];if(0===n)thrownewError("S length is zero");if(6+r+n!==e.length)thrownewError("S length is invalid");if(128&e[4])thrownewError("R value is negative");if(r>1&&0===e[4]&&!(128&e[5]))thrownewError("R value excessively padded");if(128&e[r+6])thrownewError("S value is negative");if(n>1&&0===e[r+6]&&!(128&e[r+7]))thrownewError("S value excessively padded");return{r:e.slice(4,4+r),s:e.slice(6+r)}}functionencode(e,r){varn=e.length,t=r.length;if(0===n)thrownewError("R length is zero");if(0===t)thrownewError("S length is zero");if(n>33)thrownewError("R length is too long");if(t>33)thrownewError("S length is too long");if(128&e[0])thrownewError("R value is negative");if(128&r[0])thrownewError("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))thrownewError("R value excessively padded");if(t>1&&0===r[0]&&!(128&r[1]))thrownewError("S value excessively padded");varo=Buffer.allocUnsafe(6+n+t);returno[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=r.length,r.copy(o,6+n),o}varBuffer=require("safe-buffer").Buffer;module.exports={check:check,decode:decode,encode:encode};
constSha3=require("js-sha3"),hashLengths=[224,256,384,512];varhash=function(t){if(void0!==t&&-1==hashLengths.indexOf(t))thrownewError("Unsupported hash length");this.content=[],this.bitcount=t?"keccak_"+t:"keccak_512"};hash.prototype.update=function(t){if(Buffer.isBuffer(t))this.content.push(t);else{if("string"!=typeoft)thrownewError("Unsupported argument to update");this.content.push(newBuffer(t))}returnthis},hash.prototype.digest=function(t){vare=Sha3[this.bitcount](Buffer.concat(this.content));if("hex"===t)returne;if("binary"===t||void0===t)returnnewBuffer(e,"hex").toString("binary");thrownewError("Unsupported encoding for digest: "+t)},module.exports={SHA3Hash:hash};
"use strict";functiontypedArraySupport(){try{vare=newUint8Array(1);returne.__proto__={__proto__:Uint8Array.prototype,foo:function(){return42}},42===e.foo()}catch(e){return!1}}functioncreateBuffer(e){if(e>K_MAX_LENGTH)thrownewRangeError("Invalid typed array length");vart=newUint8Array(e);returnt.__proto__=Buffer.prototype,t}functionBuffer(e,t,r){if("number"==typeofe){if("string"==typeoft)thrownewError("If encoding is specified then the first argument must be a string");returnallocUnsafe(e)}returnfrom(e,t,r)}functionfrom(e,t,r){if("number"==typeofe)thrownewTypeError('"value" argument must not be a number');returnisArrayBuffer(e)?fromArrayBuffer(e,t,r):"string"==typeofe?fromString(e,t):fromObject(e)}functionassertSize(e){if("number"!=typeofe)thrownewTypeError('"size" argument must be a number');if(e<0)thrownewRangeError('"size" argument must not be negative')}functionalloc(e,t,r){returnassertSize(e),e<=0?createBuffer(e):void0!==t?"string"==typeofr?createBuffer(e).fill(t,r):createBuffer(e).fill(t):createBuffer(e)}functionallocUnsafe(e){returnassertSize(e),createBuffer(e<0?0:0|checked(e))}functionfromString(e,t){if("string"==typeoft&&""!==t||(t="utf8"),!Buffer.isEncoding(t))thrownewTypeError('"encoding" must be a valid string encoding');varr=0|byteLength(e,t),n=createBuffer(r),f=n.write(e,t);returnf!==r&&(n=n.slice(0,f)),n}functionfromArrayLike(e){for(vart=e.length<0?0:0|checked(e.length),r=createBuffer(t),n=0;n<t;n+=1)r[n]=255&e[n];returnr}functionfromArrayBuffer(e,t,r){if(t<0||e.byteLength<t)thrownewRangeError("'offset' is out of bounds");if(e.byteLength<t+(r||0))thrownewRangeError("'length' is out of bounds");varn;returnn=void0===t&&void0===r?newUint8Array(e):void0===r?newUint8Array(e,t):newUint8Array(e,t,r),n.__proto__=Buffer.prototype,n}functionfromObject(e){if(Buffer.isBuffer(e)){vart=0|checked(e.length),r=createBuffer(t);return0===r.length?r:(e.copy(r,0,0,t),r)}if(e){if(isArrayBufferView(e)||"length"ine)return"number"!=typeofe.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))returnfromArrayLike(e.data)}thrownewTypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}functionchecked(e){if(e>=K_MAX_LENGTH)thrownewRangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return0|e}functionSlowBuffer(e){return+e!=e&&(e=0),Buffer.alloc(+e)}functionbyteLength(e,t){if(Buffer.isBuffer(e))returne.length;if(isArrayBufferView(e)||isArrayBuffer(e))returne.byteLength;"string"!=typeofe&&(e=""+e);varr=e.length;if(0===r)return0;for(varn=!1;;)switch(t){case"ascii":case"latin1":case"binary":returnr;case"utf8":case"utf-8":casevoid0:returnutf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return2*r;case"hex":returnr>>>1;case"base64":returnbase64ToBytes(e).length;default:if(n)returnutf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}functionslowToString(e,t,r){varn=!1;if((void0===t||t<0)&&(t=0),t>this.length)return"";if((void0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":returnhexSlice(this,t,r);case"utf8":case"utf-8":returnutf8Slice(this,t,r);case"ascii":returnasciiSlice(this,t,r);case"latin1":case"binary":returnlatin1Slice(this,t,r);case"base64":returnbase64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":returnutf16leSlice(this,t,r);default:if(n)thrownewTypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}functionswap(e,t,r){varn=e[t];e[t]=e[r],e[r]=n}functionbidirectionalIndexOf(e,t,r,n,f){if(0===e.length)return-1;if("string"==typeofr?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,numberIsNaN(r)&&(r=f?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(f)return-1;r=e.length-1}elseif(r<0){if(!f)return-1;r=0}if("string"==typeoft&&(t=Buffer.from(t,n)),Buffer.isBuffer(t))return0===t.length?-1:arrayIndexOf(e,t,r,n,f);if("number"==typeoft)returnt
functionCipherBase(t){Transform.call(this),this.hashMode="string"==typeoft,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}varBuffer=require("safe-buffer").Buffer,Transform=require("stream").Transform,StringDecoder=require("string_decoder").StringDecoder,inherits=require("inherits");inherits(CipherBase,Transform),CipherBase.prototype.update=function(t,e,r){"string"==typeoft&&(t=Buffer.from(t,e));vari=this._update(t);returnthis.hashMode?this:(r&&(i=this._toString(i,r)),i)},CipherBase.prototype.setAutoPadding=function(){},CipherBase.prototype.getAuthTag=function(){thrownewError("trying to get auth tag in unsupported state")},CipherBase.prototype.setAuthTag=function(){thrownewError("trying to set auth tag in unsupported state")},CipherBase.prototype.setAAD=function(){thrownewError("trying to set aad in unsupported state")},CipherBase.prototype._transform=function(t,e,r){vari;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},CipherBase.prototype._flush=function(t){vare;try{this.push(this.__final())}catch(t){e=t}t(e)},CipherBase.prototype._finalOrDigest=function(t){vare=this.__final()||Buffer.alloc(0);returnt&&(e=this._toString(e,t,!0)),e},CipherBase.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=newStringDecoder(e),this._encoding=e),this._encoding!==e)thrownewError("can't switch encodings");vari=this._decoder.write(t);returnr&&(i+=this._decoder.end()),i},module.exports=CipherBase;
"use strict";functionMontCurve(t){Base.call(this,"mont",t),this.a=newBN(t.a,16).toRed(this.red),this.b=newBN(t.b,16).toRed(this.red),this.i4=newBN(4).toRed(this.red).redInvm(),this.two=newBN(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}functionPoint(t,r,e){Base.BasePoint.call(this,t,"projective"),null===r&&null===e?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=newBN(r,16),this.z=newBN(e,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}varcurve=require("../curve"),BN=require("bn.js"),inherits=require("inherits"),Base=curve.base,elliptic=require("../../elliptic"),utils=elliptic.utils;inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.validate=function(t){varr=t.normalize().x,e=r.redSqr(),i=e.redMul(r).redAdd(e.redMul(this.a)).redAdd(r);return0===i.redSqrt().redSqr().cmp(i)},inherits(Point,Base.BasePoint),MontCurve.prototype.decodePoint=function(t,r){returnthis.point(utils.toArray(t,r),1)},MontCurve.prototype.point=function(t,r){returnnewPoint(this,t,r)},MontCurve.prototype.pointFromJSON=function(t){returnPoint.fromJSON(this,t)},Point.prototype.precompute=function(){},Point.prototype._encode=function(){returnthis.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function(t,r){returnnewPoint(t,r[0],r[1]||t.one)},Point.prototype.inspect=function(){returnthis.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function(){return0===this.z.cmpn(0)},Point.prototype.dbl=function(){vart=this.x.redAdd(this.z).redSqr(),r=this.x.redSub(this.z).redSqr(),e=t.redSub(r),i=t.redMul(r),o=e.redMul(r.redAdd(this.curve.a24.redMul(e)));returnthis.curve.point(i,o)},Point.prototype.add=function(){thrownewError("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(t,r){vare=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),n=t.x.redSub(t.z).redMul(e),u=o.redMul(i),d=r.z.redMul(n.redAdd(u).redSqr()),s=r.x.redMul(n.redISub(u).redSqr());returnthis.curve.point(d,s)},Point.prototype.mul=function(t){for(varr=t.clone(),e=this,i=this.curve.point(null,null),o=this,n=[];0!==r.cmpn(0);r.iushrn(1))n.push(r.andln(1));for(varu=n.length-1;u>=0;u--)0===n[u]?(e=e.diffAdd(i,o),i=i.dbl()):(i=e.diffAdd(i,o),e=e.dbl());returni},Point.prototype.mulAdd=function(){thrownewError("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function(){thrownewError("Not supported on Montgomery curve")},Point.prototype.eq=function(t){return0===this.getX().cmp(t.getX())},Point.prototype.normalize=function(){returnthis.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){returnthis.normalize(),this.x.fromRed()};
"use strict";functionEC(e){if(!(thisinstanceofEC))returnnewEC(e);"string"==typeofe&&(assert(elliptic.curves.hasOwnProperty(e),"Unknown curve "+e),e=elliptic.curves[e]),einstanceofelliptic.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}varBN=require("bn.js"),HmacDRBG=require("hmac-drbg"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,KeyPair=require("./key"),Signature=require("./signature");module.exports=EC,EC.prototype.keyPair=function(e){returnnewKeyPair(this,e)},EC.prototype.keyFromPrivate=function(e,t){returnKeyPair.fromPrivate(this,e,t)},EC.prototype.keyFromPublic=function(e,t){returnKeyPair.fromPublic(this,e,t)},EC.prototype.genKeyPair=function(e){e||(e={});for(vart=newHmacDRBG({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||elliptic.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(newBN(2));;){vari=newBN(t.generate(r));if(!(i.cmp(n)>0))returni.iaddn(1),this.keyFromPrivate(i)}},EC.prototype._truncateToN=function(e,t){varr=8*e.byteLength()-this.n.bitLength();returnr>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},EC.prototype.sign=function(e,t,r,n){"object"==typeofr&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(newBN(e,16));for(vari=this.n.byteLength(),s=t.getPrivate().toArray("be",i),u=e.toArray("be",i),o=newHmacDRBG({hash:this.hash,entropy:s,nonce:u,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(newBN(1)),h=0;!0;h++){vara=n.k?n.k(h):newBN(o.generate(this.n.byteLength()));if(!((a=this._truncateToN(a,!0)).cmpn(1)<=0||a.cmp(c)>=0)){varp=this.g.mul(a);if(!p.isInfinity()){varm=p.getX(),v=m.umod(this.n);if(0!==v.cmpn(0)){vary=a.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){varl=(p.getY().isOdd()?1:0)|(0!==m.cmp(v)?2:0);returnn.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),l^=1),newSignature({r:v,s:y,recoveryParam:l})}}}}}},EC.prototype.verify=function(e,t,r,n){e=this._truncateToN(newBN(e,16)),r=this.keyFromPublic(r,n);vari=(t=newSignature(t,"hex")).r,s=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;varu=s.invm(this.n),o=u.mul(e).umod(this.n),c=u.mul(i).umod(this.n);if(!this.curve._maxwellTrick)return!(h=this.g.mulAdd(o,r.getPublic(),c)).isInfinity()&&0===h.getX().umod(this.n).cmp(i);varh=this.g.jmulAdd(o,r.getPublic(),c);return!h.isInfinity()&&h.eqXToP(i)},EC.prototype.recoverPubKey=function(e,t,r,n){assert((3&r)===r,"The recovery param is more than two bits"),t=newSignature(t,n);vari=this.n,s=newBN(e),u=t.r,o=t.s,c=1&r,h=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&h)thrownewError("Unable to find sencond key candinate");u=h?this.curve.pointFromX(u.add(this.curve.n),c):this.curve.pointFromX(u,c);vara=t.r.invm(i),p=i.sub(s).mul(a).umod(i),m=o.mul(a).umod(i);returnthis.g.mulAdd(p,u,m)},EC.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=newSignature(t,n)).recoveryParam)returnt.recoveryParam;for(vari=0;i<4;i++){vars;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(r))returni}thrownewError("Unable to find valid recovery factor")};
"use strict";functionKeyPair(i,t){this.ec=i,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}varBN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=KeyPair,KeyPair.fromPublic=function(i,t,e){returntinstanceofKeyPair?t:newKeyPair(i,{pub:t,pubEnc:e})},KeyPair.fromPrivate=function(i,t,e){returntinstanceofKeyPair?t:newKeyPair(i,{priv:t,privEnc:e})},KeyPair.prototype.validate=function(){vari=this.getPublic();returni.isInfinity()?{result:!1,reason:"Invalid public key"}:i.validate()?i.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(i,t){return"string"==typeofi&&(t=i,i=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,i):this.pub},KeyPair.prototype.getPrivate=function(i){return"hex"===i?this.priv.toString(16,2):this.priv},KeyPair.prototype._importPrivate=function(i,t){this.priv=newBN(i,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(i,t){if(i.x||i.y)return"mont"===this.ec.curve.type?assert(i.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert(i.x&&i.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(i.x,i.y));this.pub=this.ec.curve.decodePoint(i,t)},KeyPair.prototype.derive=function(i){returni.mul(this.priv).getX()},KeyPair.prototype.sign=function(i,t,e){returnthis.ec.sign(i,this,t,e)},KeyPair.prototype.verify=function(i,t){returnthis.ec.verify(i,t,this)},KeyPair.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};
"use strict";functionSignature(t,r){if(tinstanceofSignature)returnt;this._importDER(t,r)||(assert(t.r&&t.s,"Signature without r or s"),this.r=newBN(t.r,16),this.s=newBN(t.s,16),void0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}functionPosition(){this.place=0}functiongetLength(t,r){vare=t[r.place++];if(!(128&e))returne;for(varn=15&e,i=0,a=0,c=r.place;a<n;a++,c++)i<<=8,i|=t[c];returnr.place=c,i}functionrmPadding(t){for(varr=0,e=t.length-1;!t[r]&&!(128&t[r+1])&&r<e;)r++;return0===r?t:t.slice(r)}functionconstructLength(t,r){if(r<128)t.push(r);else{vare=1+(Math.log(r)/Math.LN2>>>3);for(t.push(128|e);--e;)t.push(r>>>(e<<3)&255);t.push(r)}}varBN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert;module.exports=Signature,Signature.prototype._importDER=function(t,r){t=utils.toArray(t,r);vare=newPosition;if(48!==t[e.place++])return!1;if(getLength(t,e)+e.place!==t.length)return!1;if(2!==t[e.place++])return!1;varn=getLength(t,e),i=t.slice(e.place,n+e.place);if(e.place+=n,2!==t[e.place++])return!1;vara=getLength(t,e);if(t.length!==a+e.place)return!1;varc=t.slice(e.place,a+e.place);return0===i[0]&&128&i[1]&&(i=i.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=newBN(i),this.s=newBN(c),this.recoveryParam=null,!0},Signature.prototype.toDER=function(t){varr=this.r.toArray(),e=this.s.toArray();for(128&r[0]&&(r=[0].concat(r)),128&e[0]&&(e=[0].concat(e)),r=rmPadding(r),e=rmPadding(e);!(e[0]||128&e[1]);)e=e.slice(1);varn=[2];constructLength(n,r.length),(n=n.concat(r)).push(2),constructLength(n,e.length);vari=n.concat(e),a=[48];returnconstructLength(a,i.length),a=a.concat(i),utils.encode(a,t)};
"use strict";functionEDDSA(t){if(assert("ed25519"===t,"only tested with ed25519 so far"),!(thisinstanceofEDDSA))returnnewEDDSA(t);vart=elliptic.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=hash.sha512}varhash=require("hash.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=require("./key"),Signature=require("./signature");module.exports=EDDSA,EDDSA.prototype.sign=function(t,e){t=parseBytes(t);vari=this.keyFromSecret(e),r=this.hashInt(i.messagePrefix(),t),n=this.g.mul(r),s=this.encodePoint(n),o=this.hashInt(s,i.pubBytes(),t).mul(i.priv()),u=r.add(o).umod(this.curve.n);returnthis.makeSignature({R:n,S:u,Rencoded:s})},EDDSA.prototype.verify=function(t,e,i){t=parseBytes(t),e=this.makeSignature(e);varr=this.keyFromPublic(i),n=this.hashInt(e.Rencoded(),r.pubBytes(),t),s=this.g.mul(e.S());returne.R().add(r.pub().mul(n)).eq(s)},EDDSA.prototype.hashInt=function(){for(vart=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);returnutils.intFromLE(t.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function(t){returnKeyPair.fromPublic(this,t)},EDDSA.prototype.keyFromSecret=function(t){returnKeyPair.fromSecret(this,t)},EDDSA.prototype.makeSignature=function(t){returntinstanceofSignature?t:newSignature(this,t)},EDDSA.prototype.encodePoint=function(t){vare=t.getY().toArray("le",this.encodingLength);returne[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},EDDSA.prototype.decodePoint=function(t){vare=(t=utils.parseBytes(t)).length-1,i=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),n=utils.intFromLE(i);returnthis.curve.pointFromY(n,r)},EDDSA.prototype.encodeInt=function(t){returnt.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function(t){returnutils.intFromLE(t)},EDDSA.prototype.isPoint=function(t){returntinstanceofthis.pointClass};
"use strict";functionKeyPair(e,t){this.eddsa=e,this._secret=parseBytes(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes(t.pub)}varelliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,parseBytes=utils.parseBytes,cachedProperty=utils.cachedProperty;KeyPair.fromPublic=function(e,t){returntinstanceofKeyPair?t:newKeyPair(e,{pub:t})},KeyPair.fromSecret=function(e,t){returntinstanceofKeyPair?t:newKeyPair(e,{secret:t})},KeyPair.prototype.secret=function(){returnthis._secret},cachedProperty(KeyPair,"pubBytes",function(){returnthis.eddsa.encodePoint(this.pub())}),cachedProperty(KeyPair,"pub",function(){returnthis._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),cachedProperty(KeyPair,"privBytes",function(){vare=this.eddsa,t=this.hash(),i=e.encodingLength-1,r=t.slice(0,e.encodingLength);returnr[0]&=248,r[i]&=127,r[i]|=64,r}),cachedProperty(KeyPair,"priv",function(){returnthis.eddsa.decodeInt(this.privBytes())}),cachedProperty(KeyPair,"hash",function(){returnthis.eddsa.hash().update(this.secret()).digest()}),cachedProperty(KeyPair,"messagePrefix",function(){returnthis.hash().slice(this.eddsa.encodingLength)}),KeyPair.prototype.sign=function(e){returnassert(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},KeyPair.prototype.verify=function(e,t){returnthis.eddsa.verify(e,t,this)},KeyPair.prototype.getSecret=function(e){returnassert(this._secret,"KeyPair is public only"),utils.encode(this.secret(),e)},KeyPair.prototype.getPublic=function(e){returnutils.encode(this.pubBytes(),e)},module.exports=KeyPair;
"use strict";functionSignature(e,t){this.eddsa=e,"object"!=typeoft&&(t=parseBytes(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.SinstanceofBN&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}varBN=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils,assert=utils.assert,cachedProperty=utils.cachedProperty,parseBytes=utils.parseBytes;cachedProperty(Signature,"S",function(){returnthis.eddsa.decodeInt(this.Sencoded())}),cachedProperty(Signature,"R",function(){returnthis.eddsa.decodePoint(this.Rencoded())}),cachedProperty(Signature,"Rencoded",function(){returnthis.eddsa.encodePoint(this.R())}),cachedProperty(Signature,"Sencoded",function(){returnthis.eddsa.encodeInt(this.S())}),Signature.prototype.toBytes=function(){returnthis.Rencoded().concat(this.Sencoded())},Signature.prototype.toHex=function(){returnutils.encode(this.toBytes(),"hex").toUpperCase()},module.exports=Signature;
"d":"The bound divisor of the gas limit, used in update calculations."
},
"minimumDifficulty":{
"v":131072,
"d":"The minimum that the difficulty may ever be."
},
"difficultyBoundDivisor":{
"v":2048,
"d":"The bound divisor of the difficulty, used in the update calculations."
},
"durationLimit":{
"v":13,
"d":"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."
},
"maximumExtraDataSize":{
"v":32,
"d":"Maximum size extra data may be after Genesis."
},
"epochDuration":{
"v":30000,
"d":"Duration between proof-of-work epochs."
},
"stackLimit":{
"v":1024,
"d":"Maximum size of VM stack allowed."
},
"callCreateDepth":{
"v":1024,
"d":"Maximum depth of call/create stack."
},
"tierStepGas":{
"v":[0,2,3,5,8,10,20],
"d":"Once per operation, for a selection of them."
},
"expGas":{
"v":10,
"d":"Once per EXP instuction."
},
"expByteGas":{
"v":10,
"d":"Times ceil(log256(exponent)) for the EXP instruction."
},
"sha3Gas":{
"v":30,
"d":"Once per SHA3 operation."
},
"sha3WordGas":{
"v":6,
"d":"Once per word of the SHA3 operation's data."
},
"sloadGas":{
"v":50,
"d":"Once per SLOAD operation."
},
"sstoreSetGas":{
"v":20000,
"d":"Once per SSTORE operation if the zeroness changes from zero."
},
"sstoreResetGas":{
"v":5000,
"d":"Once per SSTORE operation if the zeroness does not change from zero."
},
"sstoreRefundGas":{
"v":15000,
"d":"Once per SSTORE operation if the zeroness changes to zero."
},
"jumpdestGas":{
"v":1,
"d":"Refunded gas, once per SSTORE operation if the zeroness changes to zero."
},
"logGas":{
"v":375,
"d":"Per LOG* operation."
},
"logDataGas":{
"v":8,
"d":"Per byte in a LOG* operation's data."
},
"logTopicGas":{
"v":375,
"d":"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."
},
"createGas":{
"v":32000,
"d":"Once per CREATE operation & contract-creation transaction."
},
"callGas":{
"v":40,
"d":"Once per CALL operation & message call transaction."
},
"callStipend":{
"v":2300,
"d":"Free gas given at beginning of call."
},
"callValueTransferGas":{
"v":9000,
"d":"Paid for CALL when the value transfor is non-zero."
},
"callNewAccountGas":{
"v":25000,
"d":"Paid for CALL when the destination address didn't exist prior."
},
"suicideRefundGas":{
"v":24000,
"d":"Refunded following a suicide operation."
},
"memoryGas":{
"v":3,
"d":"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."
},
"quadCoeffDiv":{
"v":512,
"d":"Divisor for the quadratic particle of the memory cost equation."
},
"createDataGas":{
"v":200,
"d":""
},
"txGas":{
"v":21000,
"d":"Per transaction. NOTE: Not payable on data of calls between transactions."
},
"txCreation":{
"v":32000,
"d":"the cost of creating a contract via tx"
},
"txDataZeroGas":{
"v":4,
"d":"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."
},
"txDataNonZeroGas":{
"v":68,
"d":"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."
},
"copyGas":{
"v":3,
"d":"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."
},
"ecrecoverGas":{
"v":3000,
"d":""
},
"sha256Gas":{
"v":60,
"d":""
},
"sha256WordGas":{
"v":12,
"d":""
},
"ripemd160Gas":{
"v":600,
"d":""
},
"ripemd160WordGas":{
"v":120,
"d":""
},
"identityGas":{
"v":15,
"d":""
},
"identityWordGas":{
"v":3,
"d":""
},
"minerReward":{
"v":"5000000000000000000",
"d":"the amount a miner get rewarded for mining a block"
},
"ommerReward":{
"v":"625000000000000000",
"d":"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"
},
"niblingReward":{
"v":"156250000000000000",
"d":"the amount a miner gets for inculding a uncle"
},
"homeSteadForkNumber":{
"v":1150000,
"d":"the block that the Homestead fork started at"
},
"homesteadRepriceForkNumber":{
"v":2463000,
"d":"the block that the Homestead Reprice (EIP150) fork started at"
},
"timebombPeriod":{
"v":100000,
"d":"Exponential difficulty timebomb period"
},
"freeBlockPeriod":{
"v":2
}
}
},{}],31:[function(require,module,exports){
(function(Buffer){
"use strict";function_classCallCheck(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}varethUtil=require("ethereumjs-util"),fees=require("ethereum-common/params.json"),BN=ethUtil.BN,N_DIV_2=newBN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),Transaction=function(){functione(t){_classCallCheck(this,e),t=t||{};vari=[{name:"nonce",length:32,allowLess:!0,default:newBuffer([])},{name:"gasPrice",length:32,allowLess:!0,default:newBuffer([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:newBuffer([])},{name:"to",allowZero:!0,length:20,default:newBuffer([])},{name:"value",length:32,allowLess:!0,default:newBuffer([])},{name:"data",alias:"input",allowZero:!0,default:newBuffer([])},{name:"v",allowZero:!0,default:newBuffer([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:newBuffer([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:newBuffer([])}];ethUtil.defineProperties(this,i,t),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});varr=ethUtil.bufferToInt(this.v),s=Math.floor((r-35)/2);s<0&&(s=0),this._chainId=s||t.chainId||0,this._homestead=!0}returne.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},e.prototype.hash=function(e){void0===e&&(e=!0);vart=void0;if(e)t=this.raw;elseif(this._chainId>0){vari=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,t=this.raw,this.raw=i}elset=this.raw.slice(0,6);returnethUtil.rlphash(t)},e.prototype.getChainId=function(){returnthis._chainId},e.prototype.getSenderAddress=function(){if(this._from)returnthis._from;vare=this.getSenderPublicKey();returnthis._from=ethUtil.publicToAddress(e),this._from},e.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))thrownewError("Invalid Signature");returnthis._senderPubKey},e.prototype.verifySignature=function(){vare=this.hash(!1);if(this._homestead&&1===newBN(this.s).cmp(N_DIV_2))return!1;try{vart=ethUtil.bufferToInt(this.v);this._chainId>0&&(t-=2*this._chainId+8),this._senderPubKey=ethUtil.ecrecover(e,t,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function(e){vart=this.hash(!1),i=ethUtil.ecsign(t,e);this._chainId>0&&(i.v+=2*this._chainId+8),Object.assign(this,i)},e.prototype.getDataFee=function(){for(vare=this.raw[5],t=newBN(0),i=0;i<e.length;i++)0===e[i]?t.iaddn(fees.txDataZeroGas.v):t.iaddn(fees.txDataNonZeroGas.v);returnt},e.prototype.getBaseFee=function(){vare=this.getDataFee().iaddn(fees.txGas.v);returnthis._homestead&&this.toCreationAddress()&&e.iaddn(fees.txCreation.v),e},e.prototype.getUpfrontCost=function(){returnnewBN(this.gasLimit).imul(newBN(this.gasPrice)).iadd(newBN(this.value))},e.prototype.validate=function(e){vart=[];returnthis.verifySignature()||t.push("Invalid Signature"),this.getBaseFee().cmp(newBN(this.gasLimit))>0&&t.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void0===e||!1===e?0===t.length:t.join(" ")},e}();module.exports=Transaction;
"use strict";var_typeof="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(e){returntypeofe}:function(e){returne&&"function"==typeofSymbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeofe},createKeccakHash=require("keccak"),secp256k1=require("secp256k1"),assert=require("assert"),rlp=require("rlp"),BN=require("bn.js"),createHash=require("create-hash");Object.assign(exports,require("ethjs-util")),exports.MAX_INTEGER=newBN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),exports.TWO_POW256=newBN("10000000000000000000000000000000000000000000000000000000000000000",16),exports.SHA3_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",exports.SHA3_NULL=Buffer.from(exports.SHA3_NULL_S,"hex"),exports.SHA3_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",exports.SHA3_RLP_ARRAY=Buffer.from(exports.SHA3_RLP_ARRAY_S,"hex"),exports.SHA3_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",exports.SHA3_RLP=Buffer.from(exports.SHA3_RLP_S,"hex"),exports.BN=BN,exports.rlp=rlp,exports.secp256k1=secp256k1,exports.zeros=function(e){returnBuffer.allocUnsafe(e).fill(0)},exports.setLengthLeft=exports.setLength=function(e,r,t){varf=exports.zeros(r);returne=exports.toBuffer(e),t?e.length<r?(e.copy(f),f):e.slice(0,r):e.length<r?(e.copy(f,r-e.length),f):e.slice(-r)},exports.setLengthRight=function(e,r){returnexports.setLength(e,r,!0)},exports.unpad=exports.stripZeros=function(e){for(varr=(e=exports.stripHexPrefix(e))[0];e.length>0&&"0"===r.toString();)r=(e=e.slice(1))[0];returne},exports.toBuffer=function(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);elseif("string"==typeofe)e=exports.isHexString(e)?Buffer.from(exports.padToEven(exports.stripHexPrefix(e)),"hex"):Buffer.from(e);elseif("number"==typeofe)e=exports.intToBuffer(e);elseif(null===e||void0===e)e=Buffer.allocUnsafe(0);else{if(!e.toArray)thrownewError("invalid type");e=Buffer.from(e.toArray())}returne},exports.bufferToInt=function(e){returnnewBN(exports.toBuffer(e)).toNumber()},exports.bufferToHex=function(e){return"0x"+(e=exports.toBuffer(e)).toString("hex")},exports.fromSigned=function(e){returnnewBN(e).fromTwos(256)},exports.toUnsigned=function(e){returnBuffer.from(e.toTwos(256).toArray())},exports.sha3=function(e,r){returne=exports.toBuffer(e),r||(r=256),createKeccakHash("keccak"+r).update(e).digest()},exports.sha256=function(e){returne=exports.toBuffer(e),createHash("sha256").update(e).digest()},exports.ripemd160=function(e,r){e=exports.toBuffer(e);vart=createHash("rmd160").update(e).digest();return!0===r?exports.setLength(t,32):t},exports.rlphash=function(e){returnexports.sha3(rlp.encode(e))},exports.isValidPrivate=function(e){returnsecp256k1.privateKeyVerify(e)},exports.isValidPublic=function(e,r){return64===e.length?secp256k1.publicKeyVerify(Buffer.concat([Buffer.from([4]),e])):!!r&&secp256k1.publicKeyVerify(e)},exports.pubToAddress=exports.publicToAddress=function(e,r){returne=exports.toBuffer(e),r&&64!==e.length&&(e=secp256k1.publicKeyConvert(e,!1).slice(1)),assert(64===e.length),exports.sha3(e).slice(-20)};varprivateToPublic=exports.privateToPublic=function(e){returne=exports.toBuffer(e),secp256k1.publicKeyCreate(e,!1).slice(1)};exports.importPublic=function(e){return64!==(e=exports.toBuffer(e)).length&&(e=secp256k1.publicKeyConvert(e,!1).slice(1)),e},exports.ecsign=function(e,r){vart=secp256k1.sign(e,r),f={};returnf.r=t.signature.slice(0,32),f.s=t.signature.slice(32,64),f.v=t.recovery+27,f},exports.hashPersonalMessage=function(e){varr=exports.toBuffer("Ethereum Signed Message:\n"+e.length.toString());returnexports.sha3(Buffer.concat([r,e]))},exports.ecrecover=function(e,r,t,f){varo=Buffer.concat([exports.setLength(t,32),exports.setLength(f,32)],64),s=r-27;if(0!==s&&1!==s)thrownewError("Invalid signature v value");varn=secp256k1.recover(e,o,s);returnsecp256k1.publicKeyConvert(n,!1).slice(1)},exports.toRpcSig=function(e,r,t){if(27!==e&&28!==e)thrownewError("Invalid recovery id");returnexport
constSHA3=require("keccakjs"),secp256k1=require("secp256k1"),assert=require("assert"),rlp=require("rlp"),BN=require("bn.js"),createHash=require("create-hash");exports.MAX_INTEGER=newBN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),exports.TWO_POW256=newBN("10000000000000000000000000000000000000000000000000000000000000000",16),exports.SHA3_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",exports.SHA3_NULL=newBuffer(exports.SHA3_NULL_S,"hex"),exports.SHA3_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",exports.SHA3_RLP_ARRAY=newBuffer(exports.SHA3_RLP_ARRAY_S,"hex"),exports.SHA3_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",exports.SHA3_RLP=newBuffer(exports.SHA3_RLP_S,"hex"),exports.BN=BN,exports.rlp=rlp,exports.secp256k1=secp256k1,exports.zeros=function(e){varr=newBuffer(e);returnr.fill(0),r},exports.setLengthLeft=exports.setLength=function(e,r,t){varf=exports.zeros(r);returne=exports.toBuffer(e),t?e.length<r?(e.copy(f),f):e.slice(0,r):e.length<r?(e.copy(f,r-e.length),f):e.slice(-r)},exports.setLengthRight=function(e,r){returnexports.setLength(e,r,!0)},exports.unpad=exports.stripZeros=function(e){for(varr=(e=exports.stripHexPrefix(e))[0];e.length>0&&"0"===r.toString();)r=(e=e.slice(1))[0];returne},exports.toBuffer=function(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=newBuffer(e);elseif("string"==typeofe)e=exports.isHexPrefixed(e)?newBuffer(exports.padToEven(exports.stripHexPrefix(e)),"hex"):newBuffer(e);elseif("number"==typeofe)e=exports.intToBuffer(e);elseif(null===e||void0===e)e=newBuffer([]);else{if(!e.toArray)thrownewError("invalid type");e=newBuffer(e.toArray())}returne},exports.intToHex=function(e){assert(e%1==0,"number is not a integer"),assert(e>=0,"number must be positive");varr=e.toString(16);returnr.length%2&&(r="0"+r),"0x"+r},exports.intToBuffer=function(e){varr=exports.intToHex(e);returnnewBuffer(r.slice(2),"hex")},exports.bufferToInt=function(e){returnparseInt(exports.bufferToHex(e),16)},exports.bufferToHex=function(e){return0===(e=exports.toBuffer(e)).length?0:"0x"+e.toString("hex")},exports.fromSigned=function(e){returnnewBN(e).fromTwos(256)},exports.toUnsigned=function(e){returnnewBuffer(e.toTwos(256).toArray())},exports.sha3=function(e,r){e=exports.toBuffer(e),r||(r=256);vart=newSHA3(r);returne&&t.update(e),newBuffer(t.digest("hex"),"hex")},exports.sha256=function(e){returne=exports.toBuffer(e),createHash("sha256").update(e).digest()},exports.ripemd160=function(e,r){e=exports.toBuffer(e);vart=createHash("rmd160").update(e).digest();return!0===r?exports.setLength(t,32):t},exports.rlphash=function(e){returnexports.sha3(rlp.encode(e))},exports.isValidPrivate=function(e){returnsecp256k1.privateKeyVerify(e)},exports.isValidPublic=function(e,r){return64===e.length?secp256k1.publicKeyVerify(Buffer.concat([newBuffer([4]),e])):!!r&&secp256k1.publicKeyVerify(e)},exports.pubToAddress=exports.publicToAddress=function(e,r){returne=exports.toBuffer(e),r&&64!==e.length&&(e=secp256k1.publicKeyConvert(e,!1).slice(1)),assert(64===e.length),exports.sha3(e).slice(-20)};varprivateToPublic=exports.privateToPublic=function(e){returne=exports.toBuffer(e),secp256k1.publicKeyCreate(e,!1).slice(1)};exports.importPublic=function(e){return64!==(e=exports.toBuffer(e)).length&&(e=secp256k1.publicKeyConvert(e,!1).slice(1)),e},exports.ecsign=function(e,r){vart=secp256k1.sign(e,r),f={};returnf.r=t.signature.slice(0,32),f.s=t.signature.slice(32,64),f.v=t.recovery+27,f},exports.ecrecover=function(e,r,t,f){vars=Buffer.concat([exports.setLength(t,32),exports.setLength(f,32)],64),o=exports.bufferToInt(r)-27;if(0!==o&&1!==o)thrownewError("Invalid signature v value");varn=secp256k1.recover(e,s,o);returnsecp256k1.publicKeyConvert(n,!1).slice(1)},exports.toRpcSig=function(e,r,t){returnexports.bufferToHex(Buffer.concat([r,t,exports.toBuffer(e-27)]))},exports.fromRpcSig=function(e){varr=(e=exports.toBuffer(e))[64];returnr<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},e
"use strict";functionpadToEven(r){vare=r;if("string"!=typeofe)thrownewError("[ethjs-util] while padding to even, value must be string, is currently "+typeofe+", while padToEven.");returne.length%2&&(e="0"+e),e}functionintToHex(r){return"0x"+padToEven(r.toString(16))}functionintToBuffer(r){vare=intToHex(r);returnnewBuffer(e.slice(2),"hex")}functiongetBinarySize(r){if("string"!=typeofr)thrownewError("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeofr+"'.");returnBuffer.byteLength(r,"utf8")}functionarrayContainsArray(r,e,t){if(!0!==Array.isArray(r))thrownewError("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeofr+"'");if(!0!==Array.isArray(e))thrownewError("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeofe+"'");returne[Boolean(t)&&"some"||"every"](function(e){returnr.indexOf(e)>=0})}functiontoUtf8(r){returnnewBuffer(padToEven(stripHexPrefix(r).replace(/^0+|0+$/g,"")),"hex").toString("utf8")}functiontoAscii(r){vare="",t=0,i=r.length;for("0x"===r.substring(0,2)&&(t=2);t<i;t+=2){varn=parseInt(r.substr(t,2),16);e+=String.fromCharCode(n)}returne}functionfromUtf8(r){return"0x"+padToEven(newBuffer(r,"utf8").toString("hex")).replace(/^0+|0+$/g,"")}functionfromAscii(r){for(vare="",t=0;t<r.length;t++){vari=r.charCodeAt(t).toString(16);e+=i.length<2?"0"+i:i}return"0x"+e}functiongetKeys(r,e,t){if(!Array.isArray(r))thrownewError("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeofr+"'");if("string"!=typeofe)thrownewError("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeofe+"'.");for(vari=[],n=0;n<r.length;n++){varo=r[n][e];if(t&&!o)o="";elseif("string"!=typeofo)thrownewError("invalid abi");i.push(o)}returni}functionisHexString(r,e){return!("string"!=typeofr||!r.match(/^0x[0-9A-Fa-f]*$/))&&(!e||r.length===2+2*e)}varisHexPrefixed=require("is-hex-prefixed"),stripHexPrefix=require("strip-hex-prefix");module.exports={arrayContainsArray:arrayContainsArray,intToBuffer:intToBuffer,getBinarySize:getBinarySize,isHexPrefixed:isHexPrefixed,stripHexPrefix:stripHexPrefix,padToEven:padToEven,intToHex:intToHex,fromAscii:fromAscii,fromUtf8:fromUtf8,toAscii:toAscii,toUtf8:toUtf8,getKeys:getKeys,isHexString:isHexString};
functionEventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void0}functionisFunction(e){return"function"==typeofe}functionisNumber(e){return"number"==typeofe}functionisObject(e){return"object"==typeofe&&null!==e}functionisUndefined(e){returnvoid0===e}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void0,EventEmitter.prototype._maxListeners=void0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||e<0||isNaN(e))throwTypeError("n must be a positive number");returnthis._maxListeners=e,this},EventEmitter.prototype.emit=function(e){vart,i,n,s,r,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceofError)throwt;varh=newError('Uncaught, unspecified "error" event. ('+t+")");throwh.context=t,h}if(i=this._events[e],isUndefined(i))return!1;if(isFunction(i))switch(arguments.length){case1:i.call(this);break;case2:i.call(this,arguments[1]);break;case3:i.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),i.apply(this,s)}elseif(isObject(i))for(s=Array.prototype.slice.call(arguments,1),n=(o=i.slice()).length,r=0;r<n;r++)o[r].apply(this,s);return!0},EventEmitter.prototype.addListener=function(e,t){vari;if(!isFunction(t))throwTypeError("listener must be a function");returnthis._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,isFunction(t.listener)?t.listener:t),this._events[e]?isObject(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,isObject(this._events[e])&&!this._events[e].warned&&(i=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeofconsole.trace&&console.trace()),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){functioni(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}if(!isFunction(t))throwTypeError("listener must be a function");varn=!1;returni.listener=t,this.on(e,i),this},EventEmitter.prototype.removeListener=function(e,t){vari,n,s,r;if(!isFunction(t))throwTypeError("listener must be a function");if(!this._events||!this._events[e])returnthis;if(i=this._events[e],s=i.length,n=-1,i===t||isFunction(i.listener)&&i.listener===t)deletethis._events[e],this._events.removeListener&&this.emit("removeListener",e,t);elseif(isObject(i)){for(r=s;r-->0;)if(i[r]===t||i[r].listener&&i[r].listener===t){n=r;break}if(n<0)returnthis;1===i.length?(i.length=0,deletethis._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}returnthis},EventEmitter.prototype.removeAllListeners=function(e){vart,i;if(!this._events)returnthis;if(!this._events.removeListener)return0===arguments.length?this._events={}:this._events[e]&&deletethis._events[e],this;if(0===arguments.length){for(tinthis._events)"removeListener"!==t&&this.removeAllListeners(t);returnthis.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],isFunction(i))this.removeListener(e,i);elseif(i)for(;i.length;)this.removeListener(e,i[i.length-1]);returndeletethis._events[e],this},EventEmitter.prototype.listeners=function(e){returnthis._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.prototype.listenerCount=function(e){if(this._events){vart=this._events[e];if(isFunction(t))return1;if(t)returnt.length}return0},EventEmitter.listenerCount=function(e,t){returne.listenerCount(t)};
},{}],36:[function(require,module,exports){
(function(Buffer){
"use strict";functionHashBase(t){Transform.call(this),this._block=newBuffer(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}varTransform=require("stream").Transform,inherits=require("inherits");inherits(HashBase,Transform),HashBase.prototype._transform=function(t,e,r){vars=null;try{"buffer"!==e&&(t=newBuffer(t,e)),this.update(t)}catch(t){s=t}r(s)},HashBase.prototype._flush=function(t){vare=null;try{this.push(this._digest())}catch(t){e=t}t(e)},HashBase.prototype.update=function(t,e){if(!Buffer.isBuffer(t)&&"string"!=typeoft)thrownewTypeError("Data must be a string or a buffer");if(this._finalized)thrownewError("Digest already called");Buffer.isBuffer(t)||(t=newBuffer(t,e||"binary"));for(varr=this._block,s=0;this._blockOffset+t.length-s>=this._blockSize;){for(vari=this._blockOffset;i<this._blockSize;)r[i++]=t[s++];this._update(),this._blockOffset=0}for(;s<t.length;)r[this._blockOffset++]=t[s++];for(varo=0,a=8*t.length;a>0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);returnthis},HashBase.prototype._update=function(t){thrownewError("_update is not implemented")},HashBase.prototype.digest=function(t){if(this._finalized)thrownewError("Digest already called");this._finalized=!0;vare=this._digest();returnvoid0!==t&&(e=e.toString(t)),e},HashBase.prototype._digest=function(){thrownewError("_digest is not implemented")},module.exports=HashBase;
module.exports=function(e){if("string"!=typeofe)thrownewError("[is-hex-prefixed] value must be type 'string', is currently type "+typeofe+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)};
"use strict";varBuffer=require("safe-buffer").Buffer,Transform=require("stream").Transform,inherits=require("inherits");module.exports=function(t){functioni(i,e,r,s,a){Transform.call(this,a),this._rate=i,this._capacity=e,this._delimitedSuffix=r,this._hashBitLength=s,this._options=a,this._state=newt,this._state.initialize(i,e),this._finalized=!1}returninherits(i,Transform),i.prototype._transform=function(t,i,e){varr=null;try{this.update(t,i)}catch(t){r=t}e(r)},i.prototype._flush=function(t){vari=null;try{this.push(this.digest())}catch(t){i=t}t(i)},i.prototype.update=function(t,i){if(!Buffer.isBuffer(t)&&"string"!=typeoft)thrownewTypeError("Data must be a string or a buffer");if(this._finalized)thrownewError("Digest already called");returnBuffer.isBuffer(t)||(t=Buffer.from(t,i)),this._state.absorb(t),this},i.prototype.digest=function(t){if(this._finalized)thrownewError("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);vari=this._state.squeeze(this._hashBitLength/8);returnvoid0!==t&&(i=i.toString(t)),this._resetState(),i},i.prototype._resetState=function(){returnthis._state.initialize(this._rate,this._capacity),this},i.prototype._clone=function(){vart=newi(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);returnthis._state.copy(t._state),t._finalized=this._finalized,t},i};
"use strict";varBuffer=require("safe-buffer").Buffer,Transform=require("stream").Transform,inherits=require("inherits");module.exports=function(t){functioni(i,e,r,s){Transform.call(this,s),this._rate=i,this._capacity=e,this._delimitedSuffix=r,this._options=s,this._state=newt,this._state.initialize(i,e),this._finalized=!1}returninherits(i,Transform),i.prototype._transform=function(t,i,e){varr=null;try{this.update(t,i)}catch(t){r=t}e(r)},i.prototype._flush=function(){},i.prototype._read=function(t){this.push(this.squeeze(t))},i.prototype.update=function(t,i){if(!Buffer.isBuffer(t)&&"string"!=typeoft)thrownewTypeError("Data must be a string or a buffer");if(this._finalized)thrownewError("Squeeze already called");returnBuffer.isBuffer(t)||(t=Buffer.from(t,i)),this._state.absorb(t),this},i.prototype.squeeze=function(t,i){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));vare=this._state.squeeze(t);returnvoid0!==i&&(e=e.toString(i)),e},i.prototype._resetState=function(){returnthis._state.initialize(this._rate,this._capacity),this},i.prototype._clone=function(){vart=newi(this._rate,this._capacity,this._delimitedSuffix,this._options);returnthis._state.copy(t._state),t._finalized=this._finalized,t},i};
"use strict";functionnextTick(e,n,c,r){if("function"!=typeofe)thrownewTypeError('"callback" argument must be a function');vars,t,o=arguments.length;switch(o){case0:case1:returnprocess.nextTick(e);case2:returnprocess.nextTick(function(){e.call(null,n)});case3:returnprocess.nextTick(function(){e.call(null,n,c)});case4:returnprocess.nextTick(function(){e.call(null,n,c,r)});default:for(s=newArray(o-1),t=0;t<s.length;)s[t++]=arguments[t];returnprocess.nextTick(function(){e.apply(null,s)})}}!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?module.exports=nextTick:module.exports=process.nextTick;
functiondefaultSetTimout(){thrownewError("setTimeout has not been defined")}functiondefaultClearTimeout(){thrownewError("clearTimeout has not been defined")}functionrunTimeout(e){if(cachedSetTimeout===setTimeout)returnsetTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)returncachedSetTimeout=setTimeout,setTimeout(e,0);try{returncachedSetTimeout(e,0)}catch(t){try{returncachedSetTimeout.call(null,e,0)}catch(t){returncachedSetTimeout.call(this,e,0)}}}functionrunClearTimeout(e){if(cachedClearTimeout===clearTimeout)returnclearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)returncachedClearTimeout=clearTimeout,clearTimeout(e);try{returncachedClearTimeout(e)}catch(t){try{returncachedClearTimeout.call(null,e)}catch(t){returncachedClearTimeout.call(this,e)}}}functioncleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}functiondrainQueue(){if(!draining){vare=runTimeout(cleanUpNextTick);draining=!0;for(vart=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}functionItem(e,t){this.fun=e,this.array=t}functionnoop(){}varprocess=module.exports={},cachedSetTimeout,cachedClearTimeout;!function(){try{cachedSetTimeout="function"==typeofsetTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeofclearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();varqueue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){vart=newArray(arguments.length-1);if(arguments.length>1)for(varr=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(newItem(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){thrownewError("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){thrownewError("process.chdir is not supported")},process.umask=function(){return0};
"use strict";function_uint8ArrayToBuffer(e){returnBuffer.from(e)}function_isUint8Array(e){returnBuffer.isBuffer(e)||einstanceofOurUint8Array}functionprependListener(e,t,r){if("function"==typeofe.prependListener)returne.prependListener(t,r);e._events&&e._events[t]?isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}functionReadableState(e,t){Duplex=Duplex||require("./_stream_duplex"),e=e||{},this.objectMode=!!e.objectMode,tinstanceofDuplex&&(this.objectMode=this.objectMode||!!e.readableObjectMode);varr=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=newBufferList,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(StringDecoder||(StringDecoder=require("string_decoder/").StringDecoder),this.decoder=newStringDecoder(e.encoding),this.encoding=e.encoding)}functionReadable(e){if(Duplex=Duplex||require("./_stream_duplex"),!(thisinstanceofReadable))returnnewReadable(e);this._readableState=newReadableState(e,this),this.readable=!0,e&&("function"==typeofe.read&&(this._read=e.read),"function"==typeofe.destroy&&(this._destroy=e.destroy)),Stream.call(this)}functionreadableAddChunk(e,t,r,n,a){vari=e._readableState;if(null===t)i.reading=!1,onEofChunk(e,i);else{vard;a||(d=chunkInvalid(i,t)),d?e.emit("error",d):i.objectMode||t&&t.length>0?("string"==typeoft||i.objectMode||Object.getPrototypeOf(t)===Buffer.prototype||(t=_uint8ArrayToBuffer(t)),n?i.endEmitted?e.emit("error",newError("stream.unshift() after end event")):addChunk(e,i,t,!0):i.ended?e.emit("error",newError("stream.push() after EOF")):(i.reading=!1,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?addChunk(e,i,t,!1):maybeReadMore(e,i)):addChunk(e,i,t,!1))):n||(i.reading=!1)}returnneedMoreData(i)}functionaddChunk(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&emitReadable(e)),maybeReadMore(e,t)}functionchunkInvalid(e,t){varr;return_isUint8Array(t)||"string"==typeoft||void0===t||e.objectMode||(r=newTypeError("Invalid non-string/buffer chunk")),r}functionneedMoreData(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}functioncomputeNewHighWaterMark(e){returne>=MAX_HWM?e=MAX_HWM:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}functionhowMuchToRead(e,t){returne<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=computeNewHighWaterMark(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}functiononEofChunk(e,t){if(!t.ended){if(t.decoder){varr=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,emitReadable(e)}}functionemitReadable(e){vart=e._readableState;t.needReadable=!1,t.emittedReadable||(debug("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?processNextTick(emitReadable_,e):emitReadable_(e))}functionemitReadable_(e){debug("emit readable"),e.emit("readable"),flow(e)}functionmaybeReadMore(e,t){t.readingMore||(t.readingMore=!0,processNextTick(maybeReadMore_,e,t))}functionmaybeReadMore_(e,t){for(varr=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(debug("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}functionpipeOnDrain(e){returnfunction(){vart=e._readableState;debug("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&EElistenerCount(e,"data")&&(t.flowing=!0,flow(e))}}functionnReadingNextTick(e){debug("readable nexttick read 0"),e.read(0)}functionresume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,processNextTick(resum
"use strict";functionTransformState(r){this.afterTransform=function(t,n){returnafterTransform(r,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}functionafterTransform(r,t,n){vare=r._transformState;e.transforming=!1;vari=e.writecb;if(!i)returnr.emit("error",newError("write callback called multiple times"));e.writechunk=null,e.writecb=null,null!==n&&void0!==n&&r.push(n),i(t);vara=r._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&r._read(a.highWaterMark)}functionTransform(r){if(!(thisinstanceofTransform))returnnewTransform(r);Duplex.call(this,r),this._transformState=newTransformState(this);vart=this;this._readableState.needReadable=!0,this._readableState.sync=!1,r&&("function"==typeofr.transform&&(this._transform=r.transform),"function"==typeofr.flush&&(this._flush=r.flush)),this.once("prefinish",function(){"function"==typeofthis._flush?this._flush(function(r,n){done(t,r,n)}):done(t)})}functiondone(r,t,n){if(t)returnr.emit("error",t);null!==n&&void0!==n&&r.push(n);vare=r._writableState,i=r._transformState;if(e.length)thrownewError("Calling transform done when ws.length != 0");if(i.transforming)thrownewError("Calling transform done when still transforming");returnr.push(null)}module.exports=Transform;varDuplex=require("./_stream_duplex"),util=require("core-util-is");util.inherits=require("inherits"),util.inherits(Transform,Duplex),Transform.prototype.push=function(r,t){returnthis._transformState.needTransform=!1,Duplex.prototype.push.call(this,r,t)},Transform.prototype._transform=function(r,t,n){thrownewError("_transform() is not implemented")},Transform.prototype._write=function(r,t,n){vare=this._transformState;if(e.writecb=n,e.writechunk=r,e.writeencoding=t,!e.transforming){vari=this._readableState;(e.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Transform.prototype._read=function(r){vart=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},Transform.prototype._destroy=function(r,t){varn=this;Duplex.prototype._destroy.call(this,r,function(r){t(r),n.emit("close")})};
"use strict";functionWriteReq(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}functionCorkedRequest(e){vart=this;this.next=null,this.entry=null,this.finish=function(){onCorkedFinish(t,e)}}function_uint8ArrayToBuffer(e){returnBuffer.from(e)}function_isUint8Array(e){returnBuffer.isBuffer(e)||einstanceofOurUint8Array}functionnop(){}functionWritableState(e,t){Duplex=Duplex||require("./_stream_duplex"),e=e||{},this.objectMode=!!e.objectMode,tinstanceofDuplex&&(this.objectMode=this.objectMode||!!e.writableObjectMode);varr=e.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;varn=!1===e.decodeStrings;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){onwrite(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=newCorkedRequest(this)}functionWritable(e){if(Duplex=Duplex||require("./_stream_duplex"),!(realHasInstance.call(Writable,this)||thisinstanceofDuplex))returnnewWritable(e);this._writableState=newWritableState(e,this),this.writable=!0,e&&("function"==typeofe.write&&(this._write=e.write),"function"==typeofe.writev&&(this._writev=e.writev),"function"==typeofe.destroy&&(this._destroy=e.destroy),"function"==typeofe.final&&(this._final=e.final)),Stream.call(this)}functionwriteAfterEnd(e,t){varr=newError("write after end");e.emit("error",r),processNextTick(t,r)}functionvalidChunk(e,t,r,i){varn=!0,o=!1;returnnull===r?o=newTypeError("May not write null values to stream"):"string"==typeofr||void0===r||t.objectMode||(o=newTypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),processNextTick(i,o),n=!1),n}functiondecodeChunk(e,t,r){returne.objectMode||!1===e.decodeStrings||"string"!=typeoft||(t=Buffer.from(t,r)),t}functionwriteOrBuffer(e,t,r,i,n,o){if(!r){vars=decodeChunk(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}vara=t.objectMode?1:i.length;t.length+=a;varf=t.length<t.highWaterMark;if(f||(t.needDrain=!0),t.writing||t.corked){varu=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}elsedoWrite(e,t,!1,a,i,n,o);returnf}functiondoWrite(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}functiononwriteError(e,t,r,i,n){--t.pendingcb,r?(processNextTick(n,i),processNextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),finishMaybe(e,t))}functiononwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}functiononwrite(e,t){varr=e._writableState,i=r.sync,n=r.writecb;if(onwriteStateUpdate(r),t)onwriteError(e,r,i,t,n);else{varo=needFinish(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),i?asyncWrite(afterWrite,e,r,o,n):afterWrite(e,r,o,n)}}functionafterWrite(e,t,r,i){r||onwriteDrain(e,t),t.pendingcb--,i(),finishMaybe(e,t)}functiononwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}functionclearBuffer(e,t){t.bufferProcessing=!0;varr=t.bufferedRequest;if(e._writev&&r&&r.next){vari=t.bufferedRequestCount,n=newArray(i),o=t.corkedRequestsFree;o.entry=r;for(vars=0,a=!0;r;)n[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;n.allBuffers=a,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=newCorkedRequest(t)}else{for(;r;){varf=r.chunk,u=r.encoding,l=r.callback;if(doWrite(e,t,!1,t.objectMode?1:f.length,f,u,l),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.buffered
"use strict";function_classCallCheck(t,e){if(!(tinstanceofe))thrownewTypeError("Cannot call a class as a function")}functioncopyBuffer(t,e,h){t.copy(e,h)}varBuffer=require("safe-buffer").Buffer;module.exports=function(){functiont(){_classCallCheck(this,t),this.head=null,this.tail=null,this.length=0}returnt.prototype.push=function(t){vare={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){vare={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){vart=this.head.data;return1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(vare=this.head,h=""+e.data;e=e.next;)h+=t+e.data;returnh},t.prototype.concat=function(t){if(0===this.length)returnBuffer.alloc(0);if(1===this.length)returnthis.head.data;for(vare=Buffer.allocUnsafe(t>>>0),h=this.head,n=0;h;)copyBuffer(h.data,e,n),n+=h.data.length,h=h.next;returne},t}();
functionsafeParseInt(e,r){if("00"===e.slice(0,2))thrownewError("invalid RLP: extra zeros");returnparseInt(e,r)}functionencodeLength(e,r){if(e<56)returnnewBuffer([e+r]);varn=intToHex(e),t=intToHex(r+55+n.length/2);returnnewBuffer(t+n,"hex")}function_decode(e){varr,n,t,i,f,a=[],o=e[0];if(o<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(o<=183){if(r=o-127,t=128===o?newBuffer([]):e.slice(1,r),2===r&&t[0]<128)thrownewError("invalid rlp encoding: byte must be less 0x80");return{data:t,remainder:e.slice(r)}}if(o<=191){if(n=o-182,r=safeParseInt(e.slice(1,n).toString("hex"),16),(t=e.slice(n,r+n)).length<r)thrownewError("invalid RLP");return{data:t,remainder:e.slice(r+n)}}if(o<=247){for(r=o-191,i=e.slice(1,r);i.length;)f=_decode(i),a.push(f.data),i=f.remainder;return{data:a,remainder:e.slice(r)}}varu=(n=o-246)+(r=safeParseInt(e.slice(1,n).toString("hex"),16));if(u>e.length)thrownewError("invalid rlp: total length is larger than the data");if(0===(i=e.slice(n,u)).length)thrownewError("invalid rlp, List has a invalid length");for(;i.length;)f=_decode(i),a.push(f.data),i=f.remainder;return{data:a,remainder:e.slice(u)}}functionisHexPrefixed(e){return"0x"===e.slice(0,2)}functionstripHexPrefix(e){return"string"!=typeofe?e:isHexPrefixed(e)?e.slice(2):e}functionintToHex(e){varr=e.toString(16);returnr.length%2&&(r="0"+r),r}functionpadToEven(e){returne.length%2&&(e="0"+e),e}functionintToBuffer(e){varr=intToHex(e);returnnewBuffer(r,"hex")}functiontoBuffer(e){if(!Buffer.isBuffer(e))if("string"==typeofe)e=isHexPrefixed(e)?newBuffer(padToEven(stripHexPrefix(e)),"hex"):newBuffer(e);elseif("number"==typeofe)e=e?intToBuffer(e):newBuffer([]);elseif(null===e||void0===e)e=newBuffer([]);else{if(!e.toArray)thrownewError("invalid type");e=newBuffer(e.toArray())}returne}constassert=require("assert");exports.encode=function(e){if(einstanceofArray){for(varr=[],n=0;n<e.length;n++)r.push(exports.encode(e[n]));vart=Buffer.concat(r);returnBuffer.concat([encodeLength(t.length,192),t])}return1===(e=toBuffer(e)).length&&e[0]<128?e:Buffer.concat([encodeLength(e.length,128),e])},exports.decode=function(e,r){if(!e||0===e.length)returnnewBuffer([]);varn=_decode(e=toBuffer(e));returnr?n:(assert.equal(n.remainder.length,0,"invalid remainder"),n.data)},exports.getLength=function(e){if(!e||0===e.length)returnnewBuffer([]);varr=(e=toBuffer(e))[0];if(r<=127)returne.length;if(r<=183)returnr-127;if(r<=191)returnr-182;if(r<=247)returnr-191;varn=r-246;returnn+safeParseInt(e.slice(1,n).toString("hex"),16)};
functioncopyProps(f,r){for(vareinf)r[e]=f[e]}functionSafeBuffer(f,r,e){returnBuffer(f,r,e)}varbuffer=require("buffer"),Buffer=buffer.Buffer;Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?module.exports=buffer:(copyProps(buffer,exports),exports.Buffer=SafeBuffer),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(f,r,e){if("number"==typeoff)thrownewTypeError("Argument must not be a number");returnBuffer(f,r,e)},SafeBuffer.alloc=function(f,r,e){if("number"!=typeoff)thrownewTypeError("Argument must be a number");varu=Buffer(f);returnvoid0!==r?"string"==typeofe?u.fill(r,e):u.fill(r):u.fill(0),u},SafeBuffer.allocUnsafe=function(f){if("number"!=typeoff)thrownewTypeError("Argument must be a number");returnBuffer(f)},SafeBuffer.allocUnsafeSlow=function(f){if("number"!=typeoff)thrownewTypeError("Argument must be a number");returnbuffer.SlowBuffer(f)};
"use strict";varBuffer=require("safe-buffer").Buffer,bip66=require("bip66"),EC_PRIVKEY_EXPORT_DER_COMPRESSED=Buffer.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED=Buffer.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),ZERO_BUFFER_32=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);exports.privateKeyExport=function(r,f,e){varo=Buffer.from(e?EC_PRIVKEY_EXPORT_DER_COMPRESSED:EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED);returnr.copy(o,e?8:9),f.copy(o,e?181:214),o},exports.privateKeyImport=function(r){varf=r.length,e=0;if(!(f<e+1||48!==r[e])&&(e+=1,!(f<e+1)&&128&r[e])){varo=127&r[e];if(e+=1,!(o<1||o>2||f<e+o)){vart=r[e+o-1]|(o>1?r[e+o-2]<<8:0);if(e+=o,!(f<e+t||f<e+3||2!==r[e]||1!==r[e+1]||1!==r[e+2]||(e+=3,f<e+2||4!==r[e]||r[e+1]>32||f<e+2+r[e+1])))returnr.slice(e+2,e+2+r[e+1])}}},exports.signatureExport=function(r){for(varf=Buffer.concat([Buffer.from([0]),r.r]),e=33,o=0;e>1&&0===f[o]&&!(128&f[o+1]);--e,++o);for(vart=Buffer.concat([Buffer.from([0]),r.s]),i=33,n=0;i>1&&0===t[n]&&!(128&t[n+1]);--i,++n);returnbip66.encode(f.slice(o),t.slice(n))},exports.signatureImport=function(r){varf=Buffer.from(ZERO_BUFFER_32),e=Buffer.from(ZERO_BUFFER_32);try{varo=bip66.decode(r);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)thrownewError("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)thrownewError("S length is too long")}catch(r){return}returno.r.copy(f,32-o.r.length),o.s.copy(e,32-o.s.length),{r:f,s:e}},exports.signatureImportLax=function(r){varf=Buffer.from(ZERO_BUFFER_32),e=Buffer.from(ZERO_BUFFER_32),o=r.length,t=0;if(48===r[t++]){vari=r[t++];if(!(128&i&&(t+=i-128)>o)&&2===r[t++]){varn=r[t++];if(128&n){if(i=n-128,t+i>o)return;for(;i>0&&0===r[t];t+=1,i-=1);for(n=0;i>0;t+=1,i-=1)n=(n<<8)+r[t]}if(!(n>o-t)){varE=t;if(t+=n,2===r[t++]){varu=r[t++];if(128&u){if(i=u-128,t+i>o)return;for(;i>0&&0===r[t];t+=1,i-=1);for(u=0;i>0;t+=1,i-=1)u=(u<<8)+r[t]}if(!(u>o-t)){vars=t;for(t+=u;n>0&&0===r[E];n-=1,E+=1);if(!(n>32)){vara=r.slice(E,E+n);for(a.copy(f,32-a.length);u>0&&0===r[s];u-=1,s+=1);if(!(u>32)){varc=r.slice(s,s+u);returnc.copy(e,32-c.length),{r:f,s:e}}}}}}}}};
"ECDSA_SIGNATURE_PARSE_DER_FAIL":"couldn't parse DER signature",
"ECDSA_SIGNATURE_SERIALIZE_DER_FAIL":"couldn't serialize signature to DER format",
"ECDSA_SIGN_FAIL":"nonce generation function failed or private key is invalid",
"ECDSA_RECOVER_FAIL":"couldn't recover public key from signature",
"MSG32_TYPE_INVALID":"message should be a Buffer",
"MSG32_LENGTH_INVALID":"message length is invalid",
"OPTIONS_TYPE_INVALID":"options should be an Object",
"OPTIONS_DATA_TYPE_INVALID":"options.data should be a Buffer",
"OPTIONS_DATA_LENGTH_INVALID":"options.data length is invalid",
"OPTIONS_NONCEFN_TYPE_INVALID":"options.noncefn should be a Function",
"RECOVERY_ID_TYPE_INVALID":"recovery should be a Number",
"RECOVERY_ID_VALUE_INVALID":"recovery should have value between -1 and 4",
"TWEAK_TYPE_INVALID":"tweak should be a Buffer",
"TWEAK_LENGTH_INVALID":"tweak length is invalid"
}
},{}],89:[function(require,module,exports){
functionHash(t,i){this._block=Buffer.alloc(t),this._finalSize=i,this._blockSize=t,this._len=0}varBuffer=require("safe-buffer").Buffer;Hash.prototype.update=function(t,i){"string"==typeoft&&(i=i||"utf8",t=Buffer.from(t,i));for(vare=this._block,s=this._blockSize,h=t.length,o=this._len,l=0;l<h;){for(varr=o%s,_=Math.min(h-l,s-r),n=0;n<_;n++)e[r+n]=t[l+n];l+=_,(o+=_)%s==0&&this._update(e)}returnthis._len+=h,this},Hash.prototype.digest=function(t){vari=this._len%this._blockSize;this._block[i]=128,this._block.fill(0,i+1),i>=this._finalSize&&(this._update(this._block),this._block.fill(0));vare=8*this._len;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{vars=4294967295&e,h=(e-s)/4294967296;this._block.writeUInt32BE(h,this._blockSize-8),this._block.writeUInt32BE(s,this._blockSize-4)}this._update(this._block);varo=this._hash();returnt?o.toString(t):o},Hash.prototype._update=function(){thrownewError("_update must be implemented by subclass")},module.exports=Hash;
varexports=module.exports=function(e){e=e.toLowerCase();varr=exports[e];if(!r)thrownewError(e+" is not supported (we accept pull requests)");returnnewr};exports.sha=require("./sha"),exports.sha1=require("./sha1"),exports.sha224=require("./sha224"),exports.sha256=require("./sha256"),exports.sha384=require("./sha384"),exports.sha512=require("./sha512");