ethers.js/dist/ethers.min.js

7 lines
227 KiB
JavaScript
Raw Normal View History

!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}({1:[function(a,b,c){"use strict";var d=a("ethers-contracts"),e=a("ethers-providers"),f=a("ethers-utils"),g=a("ethers-wallet");b.exports={SigningKey:g.SigningKey,Wallet:g.Wallet,HDNode:g.HDNode,Contract:d.Contract,Interface:d.Interface,networks:e.networks,providers:e,utils:f,_SigningKey:g.SigningKey},a("ethers-utils/standalone.js")(b.exports)},{"ethers-contracts":22,"ethers-providers":27,"ethers-utils":40,"ethers-utils/standalone.js":47,"ethers-wallet":52}],2:[function(a,b,c){"use strict";!function(a){function d(a){return parseInt(a)===a}function e(a){if(!d(a.length))return!1;for(var b=0;b<a.length;b++)if(!d(a[b])||a[b]<0||a[b]>255)return!1;return!0}function f(a,b){if(a.buffer&&ArrayBuffer.isView(a)&&"Uint8Array"===a.name)return b&&(a=a.slice?a.slice():Array.prototype.slice.call(a)),a;if(Array.isArray(a)){if(!e(a))throw new Error("Array contains invalid value: "+a);return new Uint8Array(a)}if(d(a.length)&&e(a))return new Uint8Array(a);throw new Error("unsupported array-like object")}function g(a){return new Uint8Array(a)}function h(a,b,c,d,e){null==d&&null==e||(a=a.slice?a.slice(d,e):Array.prototype.slice.call(a,d,e)),b.set(a,c)}function i(a){for(var b=[],c=0;c<a.length;c+=4)b.push(a[c]<<24|a[c+1]<<16|a[c+2]<<8|a[c+3]);return b}function j(a){a=f(a,!0);var b=16-a.length%16,c=g(a.length+b);h(a,c);for(var d=a.length;d<c.length;d++)c[d]=b;return c}function k(a){if(a=f(a,!0),a.length<16)throw new Error("PKCS#7 invalid length");var b=a[a.length-1];if(b>16)throw new Error("PKCS#7 padding byte out of range");for(var c=a.length-b,d=0;d<b;d++)if(a[c+d]!==b)throw new Error("PKCS#7 invalid padding byte");var e=g(c);return h(a,e,0,0,c),e}var l=function(){function a(a){var b=[],c=0;for(a=encodeURI(a);c<a.length;){var d=a.charCodeAt(c++);37===d?(b.push(parseInt(a.substr(c,2),16)),c+=2):b.push(d)}return f(b)}function b(a){for(var b=[],c=0;c<a.length;){var d=a[c];d<128?(b.push(String.fromCharCode(d)),c++):d>191&&d<224?(b.push(String.fromCharCode((31&d)<<6|63&a[c+1])),c+=2):(b.push(String.fromCharCode((15&d)<<12|(63&a[c+1])<<6|63&a[c+2])),c+=3)}return b.join("")}return{toBytes:a,fromBytes:b}}(),m=function(){function a(a){for(var b=[],c=0;c<a.length;c+=2)b.push(parseInt(a.substr(c,2),16));return b}function b(a){for(var b=[],d=0;d<a.length;d++){var e=a[d];b.push(c[(240&e)>>4]+c[15&e])}return b.join("")}var c="0123456789abcdef";return{toBytes:a,fromBytes:b}}(),n={16:10,24:12,32:14},o=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],p=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],q=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37
if(!(this instanceof D))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:f(a,!0)}),this._prepare()};D.prototype._prepare=function(){var a=n[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=i(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,j=e;j<d;){if(g=f[e-1],f[0]^=p[g>>16&255]<<24^p[g>>8&255]<<16^p[255&g]<<8^p[g>>24&255]^o[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]^=p[255&g]^p[g>>8&255]<<8^p[g>>16&255]<<16^p[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&&j<d;)k=j>>2,l=j%4,this._Ke[k][l]=f[b],this._Kd[a-k][l]=f[b++],j++}for(var k=1;k<a;k++)for(var l=0;l<4;l++)g=this._Kd[k][l],this._Kd[k][l]=z[g>>24&255]^A[g>>16&255]^B[g>>8&255]^C[255&g]},D.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=i(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]=r[d[e]>>24&255]^s[d[(e+1)%4]>>16&255]^t[d[(e+2)%4]>>8&255]^u[255&d[(e+3)%4]]^this._Ke[f][e];d=c.slice()}for(var h,j=g(16),e=0;e<4;e++)h=this._Ke[b][e],j[4*e]=255&(p[d[e]>>24&255]^h>>24),j[4*e+1]=255&(p[d[(e+1)%4]>>16&255]^h>>16),j[4*e+2]=255&(p[d[(e+2)%4]>>8&255]^h>>8),j[4*e+3]=255&(p[255&d[(e+3)%4]]^h);return j},D.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=i(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]=v[d[e]>>24&255]^w[d[(e+3)%4]>>16&255]^x[d[(e+2)%4]>>8&255]^y[255&d[(e+1)%4]]^this._Kd[f][e];d=c.slice()}for(var h,j=g(16),e=0;e<4;e++)h=this._Kd[b][e],j[4*e]=255&(q[d[e]>>24&255]^h>>24),j[4*e+1]=255&(q[d[(e+3)%4]>>16&255]^h>>16),j[4*e+2]=255&(q[d[(e+2)%4]>>8&255]^h>>8),j[4*e+3]=255&(q[255&d[(e+1)%4]]^h);return j};var E=function(a){if(!(this instanceof E))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new D(a)};E.prototype.encrypt=function(a){if(a=f(a),a.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var b=g(a.length),c=g(16),d=0;d<a.length;d+=16)h(a,c,0,d,d+16),c=this._aes.encrypt(c),h(c,b,d);return b},E.prototype.decrypt=function(a){if(a=f(a),a.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var b=g(a.length),c=g(16),d=0;d<a.length;d+=16)h(a,c,0,d,d+16),c=this._aes.decrypt(c),h(c,b,d);return b};var F=function(a,b){if(!(this instanceof F))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=g(16);this._lastCipherblock=f(b,!0),this._aes=new D(a)};F.prototype.encrypt=function(a){if(a=f(a),a.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var b=g(a.length),c=g(16),d=0;d<a.length;d+=16){h(a,c,0,d,d+16);for(var e=0;e<16;e++)c[e]^=this._lastCipherblock[e];this._lastCipherblock=this._aes.encrypt(c),h(this._lastCipherblock,b,d)}return b},F.prototype.decrypt=function(a){if(a=f(a),a.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var b=g(a.length),c=g(16),d=0;d<a.length;d+=16){h(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];h(a,this._lastCipherblock,0,d,d+16)}return b};var G=function(a,b,c){if(!(this instanceof G))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=g(16);c||(c=1),this.segmentSize=c,this._shiftRegister=f(b,!0),this._aes=new D(a)};G.prototype.encrypt=function(a){if(a.length%
c[2*g]=8191&f,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 thi
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
2017-11-19 02:58:53 +03:00
"ethers-utils/keccak256.js":41,"ethers-utils/properties.js":44,"ethers-utils/throw-error":48,"ethers-utils/utf8.js":50}],24:[function(a,b,c){"use strict";try{b.exports.XMLHttpRequest=XMLHttpRequest}catch(d){console.log("Warning: XMLHttpRequest is not defined"),b.exports.XMLHttpRequest=null}},{}],25:[function(a,b,c){"use strict";function d(a){for(;a.length>3&&"0x0"===a.substring(0,3);)a="0x"+a.substring(3);return a}function e(a){var b=[];for(var c in a)if(null!=a[c]){var e=k.hexlify(a[c]);({gasLimit:!0,gasPrice:!0,nonce:!0,value:!0})[c]&&(e=d(e)),b.push(c+"="+e)}return b.join("&")}function f(a,b){j.call(this,a);var c=null;switch(this.name){case"homestead":c="https://api.etherscan.io";break;case"ropsten":c="https://ropsten.etherscan.io";break;case"rinkeby":c="https://rinkeby.etherscan.io";break;case"kovan":c="https://kovan.etherscan.io";break;default:throw new Error("unsupported network")}k.defineProperty(this,"baseUrl",c),k.defineProperty(this,"apiKey",b||null)}function g(a){if(0==a.status&&"No records found"===a.message)return a.result;if(1!=a.status||"OK"!=a.message){var b=new Error("invalid response");throw b.result=JSON.stringify(a),b}return a.result}function h(a){if("2.0"!=a.jsonrpc){var b=new Error("invalid response");throw b.result=JSON.stringify(a),b}if(a.error){var b=new Error(a.error.message||"unknown error");throw a.error.code&&(b.code=a.error.code),a.error.data&&(b.data=a.error.data),b}return a.result}function i(a){if("pending"===a)throw new Error("pending not supported");return"latest"===a?a:parseInt(a.substring(2),16)}var j=a("./provider.js"),k=function(){var b=a("ethers-utils/convert.js");return{defineProperty:a("ethers-utils/properties.js").defineProperty,hexlify:b.hexlify}}();j.inherits(f),k.defineProperty(f.prototype,"_call",function(){}),k.defineProperty(f.prototype,"_callProxy",function(){}),k.defineProperty(f.prototype,"perform",function(a,b){b||(b={});var c=this.baseUrl,f="";switch(this.apiKey&&(f+="&apikey="+this.apiKey),a){case"getBlockNumber":return c+="/api?module=proxy&action=eth_blockNumber"+f,j.fetchJSON(c,null,h);case"getGasPrice":return c+="/api?module=proxy&action=eth_gasPrice"+f,j.fetchJSON(c,null,h);case"getBalance":return c+="/api?module=account&action=balance&address="+b.address,c+="&tag="+b.blockTag+f,j.fetchJSON(c,null,g);case"getTransactionCount":return c+="/api?module=proxy&action=eth_getTransactionCount&address="+b.address,c+="&tag="+b.blockTag+f,j.fetchJSON(c,null,h);case"getCode":return c+="/api?module=proxy&action=eth_getCode&address="+b.address,c+="&tag="+b.blockTag+f,j.fetchJSON(c,null,h);case"getStorageAt":return c+="/api?module=proxy&action=eth_getStorageAt&address="+b.address,c+="&position="+d(b.position),c+="&tag="+d(b.blockTag)+f,j.fetchJSON(c,null,h);case"sendTransaction":return c+="/api?module=proxy&action=eth_sendRawTransaction&hex="+b.signedTransaction,c+=f,j.fetchJSON(c,null,h);case"getBlock":if(b.blockTag)return c+="/api?module=proxy&action=eth_getBlockByNumber&tag="+d(b.blockTag),c+="&boolean=false",c+=f,j.fetchJSON(c,null,h);throw new Error("getBlock by blockHash not implmeneted");case"getTransaction":return c+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+b.transactionHash,c+=f,j.fetchJSON(c,null,h);case"getTransactionReceipt":return c+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+b.transactionHash,c+=f,j.fetchJSON(c,null,h);case"call":var k=e(b.transaction);return k&&(k="&"+k),c+="/api?module=proxy&action=eth_call"+k,c+=f,j.fetchJSON(c,null,h);case"estimateGas":var k=e(b.transaction);return k&&(k="&"+k),c+="/api?module=proxy&action=eth_estimateGas&"+k,c+=f,j.fetchJSON(c,null,h);case"getLogs":c+="/api?module=logs&action=getLogs";try{if(b.filter.fromBlock&&(c+="&fromBlock="+i(b.filter.fromBlock)),b.filter.toBlock&&(c+="&toBlock="+i(b.filter.toBlock)),b.filter.address&&(c+="&address="+b.filter.address),b.filter.topics&&b.filter.topics.length>0){if(b.filter.topics.length>1)throw new Error("unsupported topic format");var l=b.filter.topics[0];if("string"!=typeof l||66!==l.length)throw new Error("unsupported topic0 format");c+="&topic0="+
RLP:n,defineProperty:m.defineProperty,etherSymbol:"Ξ",arrayify:g.arrayify,concat:g.concat,padZeros:g.padZeros,stripZeros:g.stripZeros,bigNumberify:e.bigNumberify,hexlify:g.hexlify,toUtf8Bytes:o.toUtf8Bytes,toUtf8String:o.toUtf8String,namehash:j,id:h,getAddress:d.getAddress,getContractAddress:f.getContractAddress,formatEther:p.formatEther,parseEther:p.parseEther,keccak256:i,sha256:k,randomBytes:l},a("./standalone")({utils:b.exports})},{"./address":33,"./bignumber":34,"./contract-address":36,"./convert":37,"./id":39,"./keccak256":41,"./namehash":42,"./properties":44,"./random-bytes":35,"./rlp":45,"./sha2":46,"./standalone":47,"./units":49,"./utf8":50}],41:[function(a,b,c){"use strict";function d(a){return a=f.arrayify(a),"0x"+e.keccak_256(a)}var e=a("js-sha3"),f=a("./convert.js");b.exports=d},{"./convert.js":37,"js-sha3":70}],42:[function(a,b,c){"use strict";function d(a,b){if(a=a.toLowerCase(),!a.match(j))throw new Error("contains invalid UseSTD3ASCIIRules characters");for(var c=h,d=0;a.length&&(!b||d<b);){var k=a.match(i),l=f.toUtf8Bytes(k[3]);c=g(e.concat([c,g(l)])),a=k[2]||"",d++}return e.hexlify(c)}var e=a("./convert"),f=a("./utf8"),g=a("./keccak256"),h=[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],i=new RegExp("^((.*)\\.)?([^.]+)$"),j=new RegExp("^[a-z0-9.-]*$");b.exports=d},{"./convert":37,"./keccak256":41,"./utf8":50}],43:[function(a,b,c){"use strict";function d(a,b,c,d,f){var g,h=1,i=new Uint8Array(d),j=new Uint8Array(b.length+4);j.set(b);for(var k,l,m=1;m<=h;m++){j[b.length]=m>>24&255,j[b.length+1]=m>>16&255,j[b.length+2]=m>>8&255,j[b.length+3]=255&m;var n=f(a).update(j).digest();g||(g=n.length,l=new Uint8Array(g),h=Math.ceil(d/g),k=d-(h-1)*g),l.set(n);for(var o=1;o<c;o++){n=f(a).update(n).digest();for(var p=0;p<g;p++)l[p]^=n[p]}var q=(m-1)*g,r=m===h?k:g;i.set(e.arrayify(l).slice(0,r),q)}return e.arrayify(i)}var e=a("./convert");b.exports=d},{"./convert":37}],44:[function(a,b,c){function d(a,b,c){Object.defineProperty(a,b,{enumerable:!0,value:c,writable:!1})}b.exports={defineProperty:d}},{}],45:[function(a,b,c){function d(a){for(var b=[];a;)b.unshift(255&a),a>>=8;return b}function e(a,b,c){for(var d=0,e=0;e<c;e++)d=256*d+a[b+e];return d}function f(a){if(Array.isArray(a)){var b=[];if(a.forEach(function(a){b=b.concat(f(a))}),b.length<=55)return b.unshift(192+b.length),b;var c=d(b.length);return c.unshift(247+c.length),c.concat(b)}if(a=[].slice.call(k.arrayify(a)),1===a.length&&a[0]<=127)return a;if(a.length<=55)return a.unshift(128+a.length),a;var c=d(a.length);return c.unshift(183+c.length),c.concat(a)}function g(a){return k.hexlify(f(a))}function h(a,b,c,d){for(var e=[];c<b+1+d;){var f=i(a,c);if(e.push(f.result),c+=f.consumed,c>b+1+d)throw new Error("invalid rlp")}return{consumed:1+d,result:e}}function i(a,b){if(0===a.length)throw new Error("invalid rlp data");if(a[b]>=248){var c=a[b]-247;if(b+1+c>a.length)throw new Error("too short");var d=e(a,b+1,c);if(b+1+c+d>a.length)throw new Error("to short");return h(a,b,b+1+c,c+d)}if(a[b]>=192){var d=a[b]-192;if(b+1+d>a.length)throw new Error("invalid rlp data");return h(a,b,b+1,d)}if(a[b]>=184){var c=a[b]-183;if(b+1+c>a.length)throw new Error("invalid rlp data");var d=e(a,b+1,c);if(b+1+c+d>a.length)throw new Error("invalid rlp data");var f=k.hexlify(a.slice(b+1+c,b+1+c+d));return{consumed:1+c+d,result:f}}if(a[b]>=128){var d=a[b]-128;if(b+1+d>a.offset)throw new Error("invlaid rlp data");var f=k.hexlify(a.slice(b+1,b+1+d));return{consumed:1+d,result:f}}return{consumed:1,result:k.hexlify(a[b])}}function j(a){a=k.arrayify(a);var b=i(a,0);if(b.consumed!==a.length)throw new Error("invalid rlp data");return b.result}var k=a("./convert.js");b.exports={encode:g,decode:j}},{"./convert.js":37}],46:[function(a,b,c){"use strict";function d(a){return a=g.arrayify(a),"0x"+f.sha256().update(a).digest("hex")}function e(a){return a=g.arrayify(a),"0x"+f.sha512().update(a).digest("hex")}var f=a("hash.js"),g=a("./convert.js");b.exports={sha256:d,sha512:e,createSha256:f.sha256,createSha512:f.sha512}},{"./convert.js":37,"hash.js":57}],47:[function(a,b,c){(function(c){func
},{}],57:[function(a,b,c){var d=c;d.utils=a("./hash/utils"),d.common=a("./hash/common"),d.sha=a("./hash/sha"),d.ripemd=a("./hash/ripemd"),d.hmac=a("./hash/hmac"),d.sha1=d.sha.sha1,d.sha256=d.sha.sha256,d.sha224=d.sha.sha224,d.sha384=d.sha.sha384,d.sha512=d.sha.sha512,d.ripemd160=d.ripemd.ripemd160},{"./hash/common":58,"./hash/hmac":59,"./hash/ripemd":60,"./hash/sha":61,"./hash/utils":68}],58:[function(a,b,c){"use strict";function d(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var e=a("./utils"),f=a("minimalistic-assert");c.BlockHash=d,d.prototype.update=function(a,b){if(a=e.toArray(a,b),this.pending?this.pending=this.pending.concat(a):this.pending=a,this.pendingTotal+=a.length,this.pending.length>=this._delta8){a=this.pending;var c=a.length%this._delta8;this.pending=a.slice(a.length-c,a.length),0===this.pending.length&&(this.pending=null),a=e.join32(a,0,a.length-c,this.endian);for(var d=0;d<a.length;d+=this._delta32)this._update(a,d,d+this._delta32)}return this},d.prototype.digest=function(a){return this.update(this._pad()),f(null===this.pending),this._digest(a)},d.prototype._pad=function(){var a=this.pendingTotal,b=this._delta8,c=b-(a+this.padLength)%b,d=new Array(c+this.padLength);d[0]=128;for(var e=1;e<c;e++)d[e]=0;if(a<<=3,"big"===this.endian){for(var f=8;f<this.padLength;f++)d[e++]=0;d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=a>>>24&255,d[e++]=a>>>16&255,d[e++]=a>>>8&255,d[e++]=255&a}else for(d[e++]=255&a,d[e++]=a>>>8&255,d[e++]=a>>>16&255,d[e++]=a>>>24&255,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=0,f=8;f<this.padLength;f++)d[e++]=0;return d}},{"./utils":68,"minimalistic-assert":71}],59:[function(a,b,c){"use strict";function d(a,b,c){return this instanceof d?(this.Hash=a,this.blockSize=a.blockSize/8,this.outSize=a.outSize/8,this.inner=null,this.outer=null,void this._init(e.toArray(b,c))):new d(a,b,c)}var e=a("./utils"),f=a("minimalistic-assert");b.exports=d,d.prototype._init=function(a){a.length>this.blockSize&&(a=(new this.Hash).update(a).digest()),f(a.length<=this.blockSize);for(var b=a.length;b<this.blockSize;b++)a.push(0);for(b=0;b<a.length;b++)a[b]^=54;for(this.inner=(new this.Hash).update(a),b=0;b<a.length;b++)a[b]^=106;this.outer=(new this.Hash).update(a)},d.prototype.update=function(a,b){return this.inner.update(a,b),this},d.prototype.digest=function(a){return this.outer.update(this.inner.digest()),this.outer.digest(a)}},{"./utils":68,"minimalistic-assert":71}],60:[function(a,b,c){b.exports={ripemd160:null}},{}],61:[function(a,b,c){"use strict";c.sha1=a("./sha/1"),c.sha224=a("./sha/224"),c.sha256=a("./sha/256"),c.sha384=a("./sha/384"),c.sha512=a("./sha/512")},{"./sha/1":62,"./sha/224":63,"./sha/256":64,"./sha/384":65,"./sha/512":66}],62:[function(a,b,c){"use strict";function d(){return this instanceof d?(l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=new Array(80))):new d}var e=a("../utils"),f=a("../common"),g=a("./common"),h=e.rotl32,i=e.sum32,j=e.sum32_5,k=g.ft_1,l=f.BlockHash,m=[1518500249,1859775393,2400959708,3395469782];e.inherits(d,l),b.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(a,b){for(var c=this.W,d=0;d<16;d++)c[d]=a[b+d];for(;d<c.length;d++)c[d]=h(c[d-3]^c[d-8]^c[d-14]^c[d-16],1);var e=this.h[0],f=this.h[1],g=this.h[2],l=this.h[3],n=this.h[4];for(d=0;d<c.length;d++){var o=~~(d/20),p=j(h(e,5),k(o,f,g,l),n,c[d],m[o]);n=l,l=g,g=h(f,30),f=e,e=p}this.h[0]=i(this.h[0],e),this.h[1]=i(this.h[1],f),this.h[2]=i(this.h[2],g),this.h[3]=i(this.h[3],l),this.h[4]=i(this.h[4],n)},d.prototype._digest=function(a){return"hex"===a?e.toHex32(this.h,"big"):e.split32(this.h,"big")}},{"../common":58,"../utils":68,"./common":67}],63:[function(a,b,c){"use strict";function d(){return this instanceof d?(f.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,175060302