ethers.js/dist/ethers.min.js

8 lines
250 KiB
JavaScript
Raw Normal View History

2018-06-04 03:50:21 +03:00
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.ethers=a()}}(function(){var a;return function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}return a}()({1:[function(a,b,c){"use strict";function d(a){var b={};for(var c in a)b[c]=a[c];return b}function e(a,b,c){function j(c,e){return function(){var f={},j=Array.prototype.slice.call(arguments);if(j.length===c.inputs.types.length+1&&"object"==typeof j[j.length-1]){f=d(j.pop());for(var m in f)if(!i[m])throw new Error("unknown transaction override "+m)}["data","to"].forEach(function(a){if(null!=f[a])throw new Error("cannot override "+a)});var n=c.apply(b,j);switch(f.to=a,f.data=n.data,n.type){case"call":if(e)return Promise.resolve(new g.bigNumberify(0));["gasLimit","gasPrice","value"].forEach(function(a){if(null!=f[a])throw new Error("call cannot override "+a)});var o=null;return null==f.from&&k&&k.getAddress?(o=k.getAddress(),o instanceof Promise||(o=Promise.resolve(o))):o=Promise.resolve(null),o.then(function(a){return a&&(f.from=g.getAddress(a)),l.call(f)}).then(function(b){try{var d=n.parse(b)}catch(e){throw"0x"===b&&c.inputs.types.length>0&&h.throwError("call exception",h.CALL_EXCEPTION,{address:a,method:n.signature,value:j}),e}return 1===c.outputs.types.length&&(d=d[0]),d});case"transaction":if(!k)return Promise.reject(new Error("missing signer"));if(null!=f.from)throw new Error("transaction cannot override from");if(e)return k&&k.estimateGas?k.estimateGas(f):l.estimateGas(f);if(k.sendTransaction)return k.sendTransaction(f);if(!k.sign)return Promise.reject(new Error("custom signer does not support signing"));null==f.gasLimit&&(f.gasLimit=k.defaultGasLimit||2e6);var p=null;if(f.nonce)p=Promise.resolve(f.nonce);else if(k.getTransactionCount)p=k.getTransactionCount(),p instanceof Promise||(p=Promise.resolve(p));else{var q=k.getAddress();q instanceof Promise||(q=Promise.resolve(q)),p=q.then(function(a){return l.getTransactionCount(a,"pending")})}var r=null;return r=f.gasPrice?Promise.resolve(f.gasPrice):l.getGasPrice(),Promise.all([p,r]).then(function(a){return f.nonce=a[0],f.gasPrice=a[1],k.sign(f)}).then(function(a){return l.sendTransaction(a)})}}}if(!(this instanceof e))throw new Error("missing new");if(b instanceof f||(b=new f(b)),!c)throw new Error("missing signer or provider");var k=c,l=null;c.provider?l=c.provider:(l=c,k=null),g.defineProperty(this,"address",a),g.defineProperty(this,"interface",b),g.defineProperty(this,"signer",k),g.defineProperty(this,"provider",l);var m=l.resolveName(a),n={};g.defineProperty(this,"estimate",n);var o={};g.defineProperty(this,"functions",o);var p={};g.defineProperty(this,"events",p),Object.keys(b.functions).forEach(function(a){var c=b.functions[a],d=j(c,!1);null==this[a]?g.defineProperty(this,a,d):console.log("WARNING: Multiple definitions for "+c),null==o[c]&&(g.defineProperty(o,a,d),g.defineProperty(n,a,j(c,!0)))},this),Object.keys(b.events).forEach(function(a){function c(b){m.then(function(f){if(f==b.address)try{var g=d.parse(b.topics,b.data);b.args=g,b.event=a,b.parse=d.parse,b.removeListener=function(){l.removeListener(d.topics,c)},b.getBlock=function(){return l.getBlock(b.blockHash)},b.getTransaction=function(){return l.getTransaction(b.transactionHash)},b.getTransactionReceipt=function(){return l.getTransactionReceipt(b.transactionHash)},b.eventSignature=d.signature,e.apply(b,Array.prototype.slice.call(g))}catch(h){console.log(h)}})}var d=b.events[a],e=null,f={enumerable:!0,get:function(){return e},set:function(a){a||(a=null),!a&
if(!(this instanceof E))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:g(a,!0)}),this._prepare()};E.prototype._prepare=function(){var a=o[this.key.length];if(null==a)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var b=0;b<=a;b++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var c,d=4*(a+1),e=this.key.length/4,f=j(this.key),b=0;b<e;b++)c=b>>2,this._Ke[c][b%4]=f[b],this._Kd[a-c][b%4]=f[b];for(var g,h=0,i=e;i<d;){if(g=f[e-1],f[0]^=q[g>>16&255]<<24^q[g>>8&255]<<16^q[255&g]<<8^q[g>>24&255]^p[h]<<24,h+=1,8!=e)for(var b=1;b<e;b++)f[b]^=f[b-1];else{for(var b=1;b<e/2;b++)f[b]^=f[b-1];g=f[e/2-1],f[e/2]^=q[255&g]^q[g>>8&255]<<8^q[g>>16&255]<<16^q[g>>24&255]<<24;for(var b=e/2+1;b<e;b++)f[b]^=f[b-1]}for(var k,l,b=0;b<e&&i<d;)k=i>>2,l=i%4,this._Ke[k][l]=f[b],this._Kd[a-k][l]=f[b++],i++}for(var k=1;k<a;k++)for(var l=0;l<4;l++)g=this._Kd[k][l],this._Kd[k][l]=A[g>>24&255]^B[g>>16&255]^C[g>>8&255]^D[255&g]},E.prototype.encrypt=function(a){if(16!=a.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var b=this._Ke.length-1,c=[0,0,0,0],d=j(a),e=0;e<4;e++)d[e]^=this._Ke[0][e];for(var f=1;f<b;f++){for(var e=0;e<4;e++)c[e]=s[d[e]>>24&255]^t[d[(e+1)%4]>>16&255]^u[d[(e+2)%4]>>8&255]^v[255&d[(e+3)%4]]^this._Ke[f][e];d=c.slice()}for(var g,i=h(16),e=0;e<4;e++)g=this._Ke[b][e],i[4*e]=255&(q[d[e]>>24&255]^g>>24),i[4*e+1]=255&(q[d[(e+1)%4]>>16&255]^g>>16),i[4*e+2]=255&(q[d[(e+2)%4]>>8&255]^g>>8),i[4*e+3]=255&(q[255&d[(e+3)%4]]^g);return i},E.prototype.decrypt=function(a){if(16!=a.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var b=this._Kd.length-1,c=[0,0,0,0],d=j(a),e=0;e<4;e++)d[e]^=this._Kd[0][e];for(var f=1;f<b;f++){for(var e=0;e<4;e++)c[e]=w[d[e]>>24&255]^x[d[(e+3)%4]>>16&255]^y[d[(e+2)%4]>>8&255]^z[255&d[(e+1)%4]]^this._Kd[f][e];d=c.slice()}for(var g,i=h(16),e=0;e<4;e++)g=this._Kd[b][e],i[4*e]=255&(r[d[e]>>24&255]^g>>24),i[4*e+1]=255&(r[d[(e+3)%4]>>16&255]^g>>16),i[4*e+2]=255&(r[d[(e+2)%4]>>8&255]^g>>8),i[4*e+3]=255&(r[255&d[(e+1)%4]]^g);return i};var F=function(a){if(!(this instanceof F))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new E(a)};F.prototype.encrypt=function(a){if(a=g(a),a.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var b=h(a.length),c=h(16),d=0;d<a.length;d+=16)i(a,c,0,d,d+16),c=this._aes.encrypt(c),i(c,b,d);return b},F.prototype.decrypt=function(a){if(a=g(a),a.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var b=h(a.length),c=h(16),d=0;d<a.length;d+=16)i(a,c,0,d,d+16),c=this._aes.decrypt(c),i(c,b,d);return b};var G=function(a,b){if(!(this instanceof G))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",b){if(16!=b.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else b=h(16);this._lastCipherblock=g(b,!0),this._aes=new E(a)};G.prototype.encrypt=function(a){if(a=g(a),a.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var b=h(a.length),c=h(16),d=0;d<a.length;d+=16){i(a,c,0,d,d+16);for(var e=0;e<16;e++)c[e]^=this._lastCipherblock[e];this._lastCipherblock=this._aes.encrypt(c),i(this._lastCipherblock,b,d)}return b},G.prototype.decrypt=function(a){if(a=g(a),a.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var b=h(a.length),c=h(16),d=0;d<a.length;d+=16){i(a,c,0,d,d+16),c=this._aes.decrypt(c);for(var e=0;e<16;e++)b[d+e]=c[e]^this._lastCipherblock[e];i(a,this._lastCipherblock,0,d,d+16)}return b};var H=function(a,b,c){if(!(this instanceof H))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",b){if(16!=b.length)throw new Error("invalid initialation vector size (must be 16 size)")}else b=h(16);c||(c=1),this.segmentSize=c,this._shiftRegister=g(b,!0),this._aes=new E(a)};H.prototype.encrypt=function(a){if(a.length%
2018-06-04 03:50:21 +03:00
f>>>=13,c[2*g+1]=8191&f,f>>>=13;for(g=2*b;g<e;++g)c[g]=0;d(0===f),d(0===(f&-8192))},m.prototype.stub=function(a){for(var b=new Array(a),c=0;c<a;c++)b[c]=0;return b},m.prototype.mulp=function(a,b,c){var d=2*this.guessLen13b(a.length,b.length),e=this.makeRBT(d),f=this.stub(d),g=new Array(d),h=new Array(d),i=new Array(d),j=new Array(d),k=new Array(d),l=new Array(d),m=c.words;m.length=d,this.convert13b(a.words,a.length,g,d),this.convert13b(b.words,b.length,j,d),this.transform(g,f,h,i,d,e),this.transform(j,f,k,l,d,e);for(var n=0;n<d;n++){var o=h[n]*k[n]-i[n]*l[n];i[n]=h[n]*l[n]+i[n]*k[n],h[n]=o}return this.conjugate(h,i,d),this.transform(h,i,m,f,d,e),this.conjugate(m,f,d),this.normalize13b(m,d),c.negative=a.negative^b.negative,c.length=a.length+b.length,c.strip()},f.prototype.mul=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),this.mulTo(a,b)},f.prototype.mulf=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),l(this,a,b)},f.prototype.imul=function(a){return this.clone().mulTo(a,this)},f.prototype.imuln=function(a){d("number"==typeof a),d(a<67108864);for(var b=0,c=0;c<this.length;c++){var e=(0|this.words[c])*a,f=(67108863&e)+(67108863&b);b>>=26,b+=e/67108864|0,b+=f>>>26,this.words[c]=67108863&f}return 0!==b&&(this.words[c]=b,this.length++),this},f.prototype.muln=function(a){return this.clone().imuln(a)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(a){var b=i(a);if(0===b.length)return new f(1);for(var c=this,d=0;d<b.length&&0===b[d];d++,c=c.sqr());if(++d<b.length)for(var e=c.sqr();d<b.length;d++,e=e.sqr())0!==b[d]&&(c=c.mul(e));return c},f.prototype.iushln=function(a){d("number"==typeof a&&a>=0);var b,c=a%26,e=(a-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){var g=0;for(b=0;b<this.length;b++){var h=this.words[b]&f,i=(0|this.words[b])-h<<c;this.words[b]=i|g,g=h>>>26-c}g&&(this.words[b]=g,this.length++)}if(0!==e){for(b=this.length-1;b>=0;b--)this.words[b+e]=this.words[b];for(b=0;b<e;b++)this.words[b]=0;this.length+=e}return this.strip()},f.prototype.ishln=function(a){return d(0===this.negative),this.iushln(a)},f.prototype.iushrn=function(a,b,c){d("number"==typeof a&&a>=0);var e;e=b?(b-b%26)/26:0;var f=a%26,g=Math.min((a-f)/26,this.length),h=67108863^67108863>>>f<<f,i=c;if(e-=g,e=Math.max(0,e),i){for(var j=0;j<g;j++)i.words[j]=this.words[j];i.length=g}if(0===g);else if(this.length>g)for(this.length-=g,j=0;j<this.length;j++)this.words[j]=this.words[j+g];else this.words[0]=0,this.length=1;var k=0;for(j=this.length-1;j>=0&&(0!==k||j>=e);j--){var l=0|this.words[j];this.words[j]=k<<26-f|l>>>f,k=l&h}return i&&0!==k&&(i.words[i.length++]=k),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(a,b,c){return d(0===this.negative),this.iushrn(a,b,c)},f.prototype.shln=function(a){return this.clone().ishln(a)},f.prototype.ushln=function(a){return this.clone().iushln(a)},f.prototype.shrn=function(a){return this.clone().ishrn(a)},f.prototype.ushrn=function(a){return this.clone().iushrn(a)},f.prototype.testn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26,e=1<<b;if(this.length<=c)return!1;var f=this.words[c];return!!(f&e)},f.prototype.imaskn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26;if(d(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==b&&c++,this.length=Math.min(c,this.length),0!==b){var e=67108863^67108863>>>b<<b;this.words[this.length-1]&=e}return this.strip()},f.prototype.maskn=function(a){return this.clone().imaskn(a)},f.prototype.iaddn=function(a){return d("number"==typeof a),d(a<67108864),a<0?this.isubn(-a):0!==this.negative?1===this.length&&(0|this.words[0])<a?(this.words[0]=a-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},f.prototype._iaddn=function(a){this.words[0]+=a;for(var b=0;b<this.length&&this.words[b]>=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.
return this.curve.jpoint(l,m,n)},f.prototype.dblp=function(a){if(0===a)return this;if(this.isInfinity())return this;if(!a)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var b=this,c=0;c<a;c++)b=b.dbl();return b}for(var d=this.curve.a,e=this.curve.tinv,f=this.x,g=this.y,h=this.z,i=h.redSqr().redSqr(),j=g.redAdd(g),c=0;c<a;c++){var k=f.redSqr(),l=j.redSqr(),m=l.redSqr(),n=k.redAdd(k).redIAdd(k).redIAdd(d.redMul(i)),o=f.redMul(l),p=n.redSqr().redISub(o.redAdd(o)),q=o.redISub(p),r=n.redMul(q);r=r.redIAdd(r).redISub(m);var s=j.redMul(h);c+1<a&&(i=i.redMul(m)),f=p,h=s,j=r}return this.curve.jpoint(f,j.redMul(e),h)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var a,b,c;if(this.zOne){var d=this.x.redSqr(),e=this.y.redSqr(),f=e.redSqr(),g=this.x.redAdd(e).redSqr().redISub(d).redISub(f);g=g.redIAdd(g);var h=d.redAdd(d).redIAdd(d),i=h.redSqr().redISub(g).redISub(g),j=f.redIAdd(f);j=j.redIAdd(j),j=j.redIAdd(j),a=i,b=h.redMul(g.redISub(i)).redISub(j),c=this.y.redAdd(this.y)}else{var k=this.x.redSqr(),l=this.y.redSqr(),m=l.redSqr(),n=this.x.redAdd(l).redSqr().redISub(k).redISub(m);n=n.redIAdd(n);var o=k.redAdd(k).redIAdd(k),p=o.redSqr(),q=m.redIAdd(m);q=q.redIAdd(q),q=q.redIAdd(q),a=p.redISub(n).redISub(n),b=o.redMul(n.redISub(a)).redISub(q),c=this.y.redMul(this.z),c=c.redIAdd(c)}return this.curve.jpoint(a,b,c)},f.prototype._threeDbl=function(){var a,b,c;if(this.zOne){var d=this.x.redSqr(),e=this.y.redSqr(),f=e.redSqr(),g=this.x.redAdd(e).redSqr().redISub(d).redISub(f);g=g.redIAdd(g);var h=d.redAdd(d).redIAdd(d).redIAdd(this.curve.a),i=h.redSqr().redISub(g).redISub(g);a=i;var j=f.redIAdd(f);j=j.redIAdd(j),j=j.redIAdd(j),b=h.redMul(g.redISub(i)).redISub(j),c=this.y.redAdd(this.y)}else{var k=this.z.redSqr(),l=this.y.redSqr(),m=this.x.redMul(l),n=this.x.redSub(k).redMul(this.x.redAdd(k));n=n.redAdd(n).redIAdd(n);var o=m.redIAdd(m);o=o.redIAdd(o);var p=o.redAdd(o);a=n.redSqr().redISub(p),c=this.y.redAdd(this.z).redSqr().redISub(l).redISub(k);var q=l.redSqr();q=q.redIAdd(q),q=q.redIAdd(q),q=q.redIAdd(q),b=n.redMul(o.redISub(a)).redISub(q)}return this.curve.jpoint(a,b,c)},f.prototype._dbl=function(){var a=this.curve.a,b=this.x,c=this.y,d=this.z,e=d.redSqr().redSqr(),f=b.redSqr(),g=c.redSqr(),h=f.redAdd(f).redIAdd(f).redIAdd(a.redMul(e)),i=b.redAdd(b);i=i.redIAdd(i);var j=i.redMul(g),k=h.redSqr().redISub(j.redAdd(j)),l=j.redISub(k),m=g.redSqr();m=m.redIAdd(m),m=m.redIAdd(m),m=m.redIAdd(m);var n=h.redMul(l).redISub(m),o=c.redAdd(c).redMul(d);return this.curve.jpoint(k,n,o)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr(),d=b.redSqr(),e=a.redAdd(a).redIAdd(a),f=e.redSqr(),g=this.x.redAdd(b).redSqr().redISub(a).redISub(d);g=g.redIAdd(g),g=g.redAdd(g).redIAdd(g),g=g.redISub(f);var h=g.redSqr(),i=d.redIAdd(d);i=i.redIAdd(i),i=i.redIAdd(i),i=i.redIAdd(i);var j=e.redIAdd(g).redSqr().redISub(f).redISub(h).redISub(i),k=b.redMul(j);k=k.redIAdd(k),k=k.redIAdd(k);var l=this.x.redMul(h).redISub(k);l=l.redIAdd(l),l=l.redIAdd(l);var m=this.y.redMul(j.redMul(i.redISub(j)).redISub(g.redMul(h)));m=m.redIAdd(m),m=m.redIAdd(m),m=m.redIAdd(m);var n=this.z.redAdd(g).redSqr().redISub(c).redISub(h);return this.curve.jpoint(l,m,n)},f.prototype.mul=function(a,b){return a=new i(a,b),this.curve._wnafMul(this,a)},f.prototype.eq=function(a){if("affine"===a.type)return this.eq(a.toJ());if(this===a)return!0;var b=this.z.redSqr(),c=a.z.redSqr();if(0!==this.x.redMul(c).redISub(a.x.redMul(b)).cmpn(0))return!1;var d=b.redMul(this.z),e=c.redMul(a.z);return 0===this.y.redMul(e).redISub(a.y.redMul(d)).cmpn(0)},f.prototype.eqXToP=function(a){var b=this.z.redSqr(),c=a.toRed(this.curve.red).redMul(b);if(0===this.x.cmp(c))return!0;for(var d=a.clone(),e=this.curve.redN.redMul(b);;){if(d.iadd(this.curve.n),d.cmp(this.curve.p)>=0)return!1;if(c.redIAdd(e),0===this.x.cmp(c))return!0}return!1},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infin
2018-06-04 03:50:21 +03:00
}function z(a,b,c){var d=a<<32-c|b>>>c;return d>>>0}function A(a,b,c){return a>>>c}function B(a,b,c){var d=a<<32-c|b>>>c;return d>>>0}var C=a("minimalistic-assert"),D=a("inherits");c.inherits=D,c.toArray=d,c.toHex=e,c.htonl=f,c.toHex32=g,c.zero2=h,c.zero8=i,c.join32=j,c.split32=k,c.rotr32=l,c.rotl32=m,c.sum32=n,c.sum32_3=o,c.sum32_4=p,c.sum32_5=q,c.sum64=r,c.sum64_hi=s,c.sum64_lo=t,c.sum64_4_hi=u,c.sum64_4_lo=v,c.sum64_5_hi=w,c.sum64_5_lo=x,c.rotr64_hi=y,c.rotr64_lo=z,c.shr64_hi=A,c.shr64_lo=B},{inherits:36,"minimalistic-assert":39}],36:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],37:[function(a,b,c){arguments[4][36][0].apply(c,arguments)},{dup:36}],38:[function(a,b,c){(function(a,c){!function(){"use strict";function d(a,b,c){this.blocks=[],this.s=[],this.padding=b,this.outputBits=c,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(a<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=c>>5,this.extraBytes=(31&c)>>3;for(var d=0;d<50;++d)this.s[d]=0}var e="object"==typeof window?window:{},f=!e.JS_SHA3_NO_NODE_JS&&"object"==typeof a&&a.versions&&a.versions.node;f&&(e=c);for(var g=!e.JS_SHA3_NO_COMMON_JS&&"object"==typeof b&&b.exports,h="0123456789abcdef".split(""),i=[31,7936,2031616,520093696],j=[1,256,65536,16777216],k=[6,1536,393216,100663296],l=[0,8,16,24],m=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],n=[224,256,384,512],o=[128,256],p=["hex","buffer","arrayBuffer","array"],q=function(a,b,c){return function(e){return new d(a,b,a).update(e)[c]()}},r=function(a,b,c){return function(e,f){return new d(a,b,f).update(e)[c]()}},s=function(a,b){var c=q(a,b,"hex");c.create=function(){return new d(a,b,a)},c.update=function(a){return c.create().update(a)};for(var e=0;e<p.length;++e){var f=p[e];c[f]=q(a,b,f)}return c},t=function(a,b){var c=r(a,b,"hex");c.create=function(c){return new d(a,b,c)},c.update=function(a,b){return c.create(b).update(a)};for(var e=0;e<p.length;++e){var f=p[e];c[f]=r(a,b,f)}return c},u=[{name:"keccak",padding:j,bits:n,createMethod:s},{name:"sha3",padding:k,bits:n,createMethod:s},{name:"shake",padding:i,bits:o,createMethod:t}],v={},w=[],x=0;x<u.length;++x)for(var y=u[x],z=y.bits,A=0;A<z.length;++A){var B=y.name+"_"+z[A];w.push(B),v[B]=y.createMethod(z[A],y.padding)}d.prototype.update=function(a){var b="string"!=typeof a;b&&a.constructor===ArrayBuffer&&(a=new Uint8Array(a));for(var c,d,e=a.length,f=this.blocks,g=this.byteCount,h=this.blockCount,i=0,j=this.s;i<e;){if(this.reset)for(this.reset=!1,f[0]=this.block,c=1;c<h+1;++c)f[c]=0;if(b)for(c=this.start;i<e&&c<g;++i)f[c>>2]|=a[i]<<l[3&c++];else for(c=this.start;i<e&&c<g;++i)d=a.charCodeAt(i),d<128?f[c>>2]|=d<<l[3&c++]:d<2048?(f[c>>2]|=(192|d>>6)<<l[3&c++],f[c>>2]|=(128|63&d)<<l[3&c++]):d<55296||d>=57344?(f[c>>2]|=(224|d>>12)<<l[3&c++],f[c>>2]|=(128|d>>6&63)<<l[3&c++],f[c>>2]|=(128|63&d)<<l[3&c++]):(d=65536+((1023&d)<<10|1023&a.charCodeAt(++i)),f[c>>2]|=(240|d>>18)<<l[3&c++],f[c>>2]|=(128|d>>12&63)<<l[3&c++],f[c>>2]|=(128|d>>6&63)<<l[3&c++],f[c>>2]|=(128|63&d)<<l[3&c++]);if(this.lastByteIndex=c,c>=g){for(this.start=c-g,this.block=f[h],c=0;c<h;++c)j[c]^=f[c];C(j),this.reset=!0}else this.start=c}return this},d.prototype.finalize=function(){var a=this.blocks,b=this.lastByteIndex,c=this.blockCount,d=this.s;if(a[b>>2]|=this.padding[3&b],this.lastByteIndex===this.byteCount)for(a[0]=a[c],b=1;b<c+1;++b)a[b]=0;for(a[c-1]|=2147483648,b=0;b<c;++b)d[b]^=a[b];C(d)},d.prototype.toString=d.prototype.hex=function(){this.finalize();for(var a,b=this.blockCount,c=this.s,d=this.outputBlocks,e=thi
var a=this,b=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=b,b.then(function(c){function e(){a.send("eth_getFilterChanges",[c]).then(function(c){if(a._pendingFilter==b){var e=Promise.resolve();return c.forEach(function(b){a._emitted["t:"+b.toLowerCase()]="pending",e=e.then(function(){return a.getTransaction(b).then(function(b){a.emit("pending",b)})})}),e.then(function(){return d(1e3)})}}).then(function(){return a._pendingFilter!=b?void a.send("eth_uninstallFilter",[filterIf]):void setTimeout(function(){e()},0)})}return e(),c})}}),k.defineProperty(i.prototype,"_stopPending",function(){this._pendingFilter=null}),k.defineProperty(i,"_hexlifyTransaction",function(a){return f(a)}),b.exports=i},{"../utils/address":56,"../utils/convert":61,"../utils/errors":63,"../utils/properties":70,"../utils/utf8":76,"./provider.js":53}],52:[function(a,b,c){b.exports={unspecified:{chainId:0,name:"unspecified"},homestead:{chainId:1,ensAddress:"0x314159265dd8dbb310642f98f50c066173c1259b",name:"homestead"},mainnet:{chainId:1,ensAddress:"0x314159265dd8dbb310642f98f50c066173c1259b",name:"homestead"},morden:{chainId:2,name:"morden"},ropsten:{chainId:3,ensAddress:"0x112234455c3a32fd11230c42e7bccd4a84e02010",name:"ropsten"},testnet:{chainId:3,ensAddress:"0x112234455c3a32fd11230c42e7bccd4a84e02010",name:"ropsten"},rinkeby:{chainId:4,name:"rinkeby"},kovan:{chainId:42,name:"kovan"},classic:{chainId:61,name:"classic"}}},{}],53:[function(a,b,c){"use strict";function d(a){var b={};for(var c in a)b[c]=a[c];return b}function e(a,b){var c={};for(var d in a)try{var e=a[d](b[d]);void 0!==e&&(c[d]=e)}catch(f){throw f.checkKey=d,f.checkValue=b[d],f}return c}function f(a,b){return function(c){return null==c?b:a(c)}}function g(a,b){return function(c){return c?a(c):b}}function h(a){return function(b){if(!Array.isArray(b))throw new Error("not an array");var c=[];return b.forEach(function(b){c.push(a(b))}),c}}function i(a){if(!F.isHexString(a)||66!==a.length)throw new Error("invalid hash - "+a);return a}function j(a){return F.bigNumberify(a).toNumber()}function k(a){var b=F.bigNumberify(a);try{b=b.toNumber()}catch(c){b=null}return b}function l(a){if("boolean"==typeof a)return a;if("string"==typeof a){if("true"===a)return!0;if("false"===a)return!1}throw new Error("invaid boolean - "+a)}function m(a){if(!F.isHexString(a))throw new Error("invalid uint256");for(;a.length<66;)a="0x0"+a.substring(2);return a}function n(a){if(null==a)return"latest";if("earliest"===a)return"0x0";if("latest"===a||"pending"===a)return a;if("number"==typeof a)return F.hexStripZeros(F.hexlify(a));if(F.isHexString(a))return F.hexStripZeros(a);throw new Error("invalid blockTag")}function o(a){return null!=a.author&&null==a.miner&&(a.miner=a.author),e(H,a)}function p(a){if(null!=a.gas&&null==a.gasLimit&&(a.gasLimit=a.gas),a.to&&F.bigNumberify(a.to).isZero()&&(a.to="0x0000000000000000000000000000000000000000"),null!=a.input&&null==a.data&&(a.data=a.input),null==a.to&&null==a.creates&&(a.creates=F.getContractAddress(a)),!a.raw&&a.v&&a.r&&a.s){var b=[F.stripZeros(F.hexlify(a.nonce)),F.stripZeros(F.hexlify(a.gasPrice)),F.stripZeros(F.hexlify(a.gasLimit)),a.to||"0x",F.stripZeros(F.hexlify(a.value||"0x")),F.hexlify(a.data||"0x"),F.stripZeros(F.hexlify(a.v||"0x")),F.stripZeros(F.hexlify(a.r)),F.stripZeros(F.hexlify(a.s))];a.raw=F.RLP.encode(b)}var c=e(I,a),d=a.networkId;return F.isHexString(d)&&(d=F.bigNumberify(d).toNumber()),"number"!=typeof d&&null!=c.v&&(d=(c.v-35)/2,d<0&&(d=0),d=parseInt(d)),"number"!=typeof d&&(d=0),c.networkId=d,c.blockHash&&"x"===c.blockHash.replace(/0/g,"")&&(c.blockHash=null),c}function q(a){return e(J,a)}function r(a){return e(K,a)}function s(a){var b=(a.status,a.root,e(L,a));return b.logs.forEach(function(a,b){null==a.transactionLogIndex&&(a.transactionLogIndex=b)}),null!=a.status&&(b.byzantium=!0),b}function t(a){return Array.isArray(a)?a.forEach(function(a){t(a)}):null!=a&&i(a),a}function u(a){return e(M,a)}function v(a){return e(N,a)}function w(a){function b(){e.getBlockNumber().then(function(a){if(a!==f){null===f&&(f=a-1);for(var b=f+1;b<=a;b++)e._em
var c=Math.floor(e(k));return function(b){b=b.toUpperCase(),b=b.substring(4)+b.substring(0,2)+"00";for(var d=b.split(""),e=0;e<d.length;e++)d[e]=a[d[e]];for(d=d.join("");d.length>=c;){var f=d.substring(0,c);d=parseInt(f,10)%97+d.substring(f.length)}for(var g=String(98-parseInt(d,10)%97);g.length<2;)g="0"+g;return g}}();b.exports={getAddress:f}},{"./convert":61,"./keccak256":67,"./throw-error":74,"bn.js":6}],57:[function(a,b,c){function d(a){if(!(this instanceof d))throw new Error("missing new");i.isHexString(a)?("0x"==a&&(a="0x0"),a=new g(a.substring(2),16)):"string"==typeof a&&"-"===a[0]&&i.isHexString(a.substring(1))?a=new g(a.substring(3),16).mul(d.constantNegativeOne._bn):"string"==typeof a&&a.match(/^-?[0-9]*$/)?(""==a&&(a="0"),a=new g(a)):"number"==typeof a&&parseInt(a)==a?a=new g(a):g.isBN(a)||(e(a)?a=a._bn:i.isArrayish(a)?a=new g(i.hexlify(a).substring(2),16):j("invalid BigNumber value",{input:a})),h(this,"_bn",a)}function e(a){return a._bn&&a._bn.mod}function f(a){return e(a)?a:new d(a)}var g=a("bn.js"),h=a("./properties").defineProperty,i=a("./convert"),j=a("./throw-error");h(d,"constantNegativeOne",f(-1)),h(d,"constantZero",f(0)),h(d,"constantOne",f(1)),h(d,"constantTwo",f(2)),h(d,"constantWeiPerEther",f(new g("1000000000000000000"))),h(d.prototype,"fromTwos",function(a){return new d(this._bn.fromTwos(a))}),h(d.prototype,"toTwos",function(a){return new d(this._bn.toTwos(a))}),h(d.prototype,"add",function(a){return new d(this._bn.add(f(a)._bn))}),h(d.prototype,"sub",function(a){return new d(this._bn.sub(f(a)._bn))}),h(d.prototype,"div",function(a){return new d(this._bn.div(f(a)._bn))}),h(d.prototype,"mul",function(a){return new d(this._bn.mul(f(a)._bn))}),h(d.prototype,"mod",function(a){return new d(this._bn.mod(f(a)._bn))}),h(d.prototype,"pow",function(a){return new d(this._bn.pow(f(a)._bn))}),h(d.prototype,"maskn",function(a){return new d(this._bn.maskn(a))}),h(d.prototype,"eq",function(a){return this._bn.eq(f(a)._bn)}),h(d.prototype,"lt",function(a){return this._bn.lt(f(a)._bn)}),h(d.prototype,"lte",function(a){return this._bn.lte(f(a)._bn)}),h(d.prototype,"gt",function(a){return this._bn.gt(f(a)._bn)}),h(d.prototype,"gte",function(a){return this._bn.gte(f(a)._bn)}),h(d.prototype,"isZero",function(){return this._bn.isZero()}),h(d.prototype,"toNumber",function(a){return this._bn.toNumber()}),h(d.prototype,"toString",function(){return this._bn.toString(10)}),h(d.prototype,"toHexString",function(){var a=this._bn.toString(16);return a.length%2&&(a="0"+a),"0x"+a}),b.exports={isBigNumber:e,bigNumberify:f,BigNumber:d}},{"./convert":61,"./properties":70,"./throw-error":74,"bn.js":6}],58:[function(a,b,c){"use strict";var d=a("./convert");b.exports={decode:function(a){a=atob(a);for(var b=[],c=0;c<a.length;c++)b.push(a.charCodeAt(c));return d.arrayify(b)},encode:function(a){a=d.arrayify(a);for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return btoa(b)}}},{"./convert":61}],59:[function(a,b,c){(function(c){"use strict";function d(a){if(a<=0||a>1024||parseInt(a)!=a)throw new Error("invalid length");var b=new Uint8Array(a);return g.getRandomValues(b),e.arrayify(b)}var e=a("./convert"),f=a("./properties").defineProperty,g=c.crypto||c.msCrypto;g&&g.getRandomValues||(console.log("WARNING: Missing strong random number source; using weak randomBytes"),g={getRandomValues:function(a){for(var b=0;b<20;b++)for(var c=0;c<a.length;c++)b?a[c]^=parseInt(256*Math.random()):a[c]=parseInt(256*Math.random());return a},_weakCrypto:!0}),g._weakCrypto===!0&&f(d,"_weakCrypto",!0),b.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./convert":61,"./properties":70}],60:[function(a,b,c){function d(a){if(!a.from)throw new Error("missing from address");var b=a.nonce;return e("0x"+g(h.encode([e(a.from),f.stripZeros(f.hexlify(b,"nonce"))])).substring(26))}var e=a("./address").getAddress,f=a("./convert"),g=a("./keccak256"),h=a("./rlp");b.exports={getContractAddress:d}},{"./address":56,"./convert":61,"./keccak256":67,"./rlp":71}],61:[function(a,b,c){function d(a)
if(!this.provider)throw new Error("missing provider");return this.provider.getBalance(this.address,a)}),f.defineProperty(d.prototype,"getTransactionCount",function(a){if(!this.provider)throw new Error("missing provider");return this.provider.getTransactionCount(this.address,a)}),f.defineProperty(d.prototype,"estimateGas",function(a){if(!this.provider)throw new Error("missing provider");var b={};return["from","to","data","value"].forEach(function(c){null!=a[c]&&(b[c]=a[c])}),null==a.from&&(b.from=this.address),this.provider.estimateGas(b)}),f.defineProperty(d.prototype,"sendTransaction",function(a){if(!this.provider)throw new Error("missing provider");if(!a||"object"!=typeof a)throw new Error("invalid transaction object");var b=a.gasLimit;null==b&&(b=this.defaultGasLimit);var c=this,e=null;e=a.gasPrice?Promise.resolve(a.gasPrice):this.provider.getGasPrice();var g=null;g=a.nonce?Promise.resolve(a.nonce):this.provider.getTransactionCount(c.address,"pending");var h=this.provider.chainId,i=null;i=a.to?this.provider.resolveName(a.to):Promise.resolve(void 0);var j=f.hexlify(a.data||"0x"),k=f.hexlify(a.value||0);return Promise.all([e,g,i]).then(function(a){var e=c.sign({to:a[2],data:j,gasLimit:b,gasPrice:a[0],nonce:a[1],value:k,chainId:h});return c.provider.sendTransaction(e).then(function(a){var b=d.parseTransaction(e);return b.hash=a,b.wait=function(){return c.provider.waitForTransaction(a)},b})})}),f.defineProperty(d.prototype,"send",function(a,b,c){return c||(c={}),this.sendTransaction({to:a,gasLimit:c.gasLimit,gasPrice:c.gasPrice,nonce:c.nonce,value:b})}),f.defineProperty(d,"hashMessage",function(a){var b=f.concat([f.toUtf8Bytes("Ethereum Signed Message:\n"),f.toUtf8Bytes(String(a.length)),"string"==typeof a?f.toUtf8Bytes(a):a]);return f.keccak256(b)}),f.defineProperty(d.prototype,"signMessage",function(a){var b=new j(this.privateKey),c=b.signDigest(d.hashMessage(a));return f.hexZeroPad(c.r,32)+f.hexZeroPad(c.s,32).substring(2)+(c.recoveryParam?"1c":"1b")}),f.defineProperty(d,"verifyMessage",function(a,b){if(b=f.hexlify(b),132!=b.length)throw new Error("invalid signature");var c=d.hashMessage(a),e=parseInt(b.substring(130),16);if(e>=27&&(e-=27),e<0)throw new Error("invalid signature");return j.recover(c,b.substring(0,66),"0x"+b.substring(66,130),e)}),f.defineProperty(d.prototype,"encrypt",function(a,b,c){if("function"!=typeof b||c||(c=b,b={}),c&&"function"!=typeof c)throw new Error("invalid callback");if(b||(b={}),this.mnemonic){var d={};for(var e in b)d[e]=b[e];b=d,b.mnemonic=this.mnemonic,b.path=this.path}return i.encrypt(this.privateKey,a,b,c)}),f.defineProperty(d,"isEncryptedWallet",function(a){return i.isValidWallet(a)||i.isCrowdsaleWallet(a)}),f.defineProperty(d,"createRandom",function(a){var b=f.randomBytes(16);a||(a={}),a.extraEntropy&&(b=f.keccak256(f.concat([b,a.extraEntropy])).substring(0,34));var c=h.entropyToMnemonic(b);return d.fromMnemonic(c,a.path)}),f.defineProperty(d,"fromEncryptedWallet",function(a,b,c){if(c&&"function"!=typeof c)throw new Error("invalid callback");return new Promise(function(e,g){if(i.isCrowdsaleWallet(a))try{var h=i.decryptCrowdsale(a,b);e(new d(h))}catch(j){g(j)}else i.isValidWallet(a)?i.decrypt(a,b,c).then(function(a){var b=new d(a);a.mnemonic&&a.path&&(f.defineProperty(b,"mnemonic",a.mnemonic),f.defineProperty(b,"path",a.path)),e(b)},function(a){g(a)}):g("invalid wallet JSON")})}),f.defineProperty(d,"fromMnemonic",function(a,b){b||(b=k);var c=h.fromMnemonic(a).derivePath(b),e=new d(c.privateKey);return f.defineProperty(e,"mnemonic",a),f.defineProperty(e,"path",b),e}),f.defineProperty(d,"fromBrainWallet",function(a,b,c){if(c&&"function"!=typeof c)throw new Error("invalid callback");return a="string"==typeof a?f.toUtf8Bytes(a,"NFKC"):f.arrayify(a,"password"),b="string"==typeof b?f.toUtf8Bytes(b,"NFKC"):f.arrayify(b,"password"),new Promise(function(g,h){e(b,a,1<<18,8,1,32,function(a,b,e){if(a)h(a);else if(e)g(new d(f.hexlify(e)));else if(c)return c(b)})})}),b.exports=d},{"../utils":66,"../utils/address":56,"../utils/bignumber":57,"../utils/convert":61,"../utils/errors":63,"../utils/ke