ethers.js/dist/ethers-providers.min.js

4 lines
109 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){!function(b,c){"use strict";function d(a,b){if(!a)throw new Error(b||"Assertion failed")}function e(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}function f(a,b,c){return f.isBN(a)?a:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==a&&("le"!==b&&"be"!==b||(c=b,b=10),this._init(a||0,b||10,c||"be"))))}function g(a,b,c){for(var d=0,e=Math.min(a.length,c),f=b;f<e;f++){var g=a.charCodeAt(f)-48;d<<=4,d|=g>=49&&g<=54?g-49+10:g>=17&&g<=22?g-17+10:15&g}return d}function h(a,b,c,d){for(var e=0,f=Math.min(a.length,c),g=b;g<f;g++){var h=a.charCodeAt(g)-48;e*=d,e+=h>=49?h-49+10:h>=17?h-17+10:h}return e}function i(a){for(var b=new Array(a.bitLength()),c=0;c<b.length;c++){var d=c/26|0,e=c%26;b[c]=(a.words[d]&1<<e)>>>e}return b}function j(a,b,c){c.negative=b.negative^a.negative;var d=a.length+b.length|0;c.length=d,d=d-1|0;var e=0|a.words[0],f=0|b.words[0],g=e*f,h=67108863&g,i=g/67108864|0;c.words[0]=h;for(var j=1;j<d;j++){for(var k=i>>>26,l=67108863&i,m=Math.min(j,b.length-1),n=Math.max(0,j-a.length+1);n<=m;n++){var o=j-n|0;e=0|a.words[o],f=0|b.words[n],g=e*f+l,k+=g/67108864|0,l=67108863&g}c.words[j]=0|l,i=0|k}return 0!==i?c.words[j]=0|i:c.length--,c.strip()}function k(a,b,c){c.negative=b.negative^a.negative,c.length=a.length+b.length;for(var d=0,e=0,f=0;f<c.length-1;f++){var g=e;e=0;for(var h=67108863&d,i=Math.min(f,b.length-1),j=Math.max(0,f-a.length+1);j<=i;j++){var k=f-j,l=0|a.words[k],m=0|b.words[j],n=l*m,o=67108863&n;g=g+(n/67108864|0)|0,o=o+h|0,h=67108863&o,g=g+(o>>>26)|0,e+=g>>>26,g&=67108863}c.words[f]=h,d=g,g=e}return 0!==d?c.words[f]=d:c.length--,c.strip()}function l(a,b,c){var d=new m;return d.mulp(a,b,c)}function m(a,b){this.x=a,this.y=b}function n(a,b){this.name=a,this.p=new f(b,16),this.n=this.p.bitLength(),this.k=new f(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function o(){n.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){n.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function q(){n.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function r(){n.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function s(a){if("string"==typeof a){var b=f._prime(a);this.m=b.p,this.prime=b}else d(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}function t(a){s.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new f(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof b?b.exports=f:c.BN=f,f.BN=f,f.wordSize=26;var u;try{u=a("buffer").Buffer}catch(v){}f.isBN=function(a){return a instanceof f||null!==a&&"object"==typeof a&&a.constructor.wordSize===f.wordSize&&Array.isArray(a.words)},f.max=function(a,b){return a.cmp(b)>0?a:b},f.min=function(a,b){return a.cmp(b)<0?a:b},f.prototype._init=function(a,b,c){if("number"==typeof a)return this._initNumber(a,b,c);if("object"==typeof a)return this._initArray(a,b,c);"hex"===b&&(b=16),d(b===(0|b)&&b>=2&&b<=36),a=a.toString().replace(/\s+/g,"");var e=0;"-"===a[0]&&e++,16===b?this._parseHex(a,e):this._parseBase(a,b,e),"-"===a[0]&&(this.negative=1),this.strip(),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initNumber=function(a,b,c){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[67108863&a],this.length=1):a<4503599627370496?(this.words=[67108863&a,a/67108864&6710
2018-01-17 10:51:36 +03:00
mod:new f(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new f(this.modn(a.words[0]))}:this._wordDiv(a,b)},f.prototype.div=function(a){return this.divmod(a,"div",!1).div},f.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},f.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},f.prototype.divRound=function(a){var b=this.divmod(a);if(b.mod.isZero())return b.div;var c=0!==b.div.negative?b.mod.isub(a):b.mod,d=a.ushrn(1),e=a.andln(1),f=c.cmp(d);return f<0||1===e&&0===f?b.div:0!==b.div.negative?b.div.isubn(1):b.div.iaddn(1)},f.prototype.modn=function(a){d(a<=67108863);for(var b=(1<<26)%a,c=0,e=this.length-1;e>=0;e--)c=(b*c+(0|this.words[e]))%a;return c},f.prototype.idivn=function(a){d(a<=67108863);for(var b=0,c=this.length-1;c>=0;c--){var e=(0|this.words[c])+67108864*b;this.words[c]=e/a|0,b=e%a}return this.strip()},f.prototype.divn=function(a){return this.clone().idivn(a)},f.prototype.egcd=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=new f(0),i=new f(1),j=0;b.isEven()&&c.isEven();)b.iushrn(1),c.iushrn(1),++j;for(var k=c.clone(),l=b.clone();!b.isZero();){for(var m=0,n=1;0===(b.words[0]&n)&&m<26;++m,n<<=1);if(m>0)for(b.iushrn(m);m-- >0;)(e.isOdd()||g.isOdd())&&(e.iadd(k),g.isub(l)),e.iushrn(1),g.iushrn(1);for(var o=0,p=1;0===(c.words[0]&p)&&o<26;++o,p<<=1);if(o>0)for(c.iushrn(o);o-- >0;)(h.isOdd()||i.isOdd())&&(h.iadd(k),i.isub(l)),h.iushrn(1),i.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(h),g.isub(i)):(c.isub(b),h.isub(e),i.isub(g))}return{a:h,b:i,gcd:c.iushln(j)}},f.prototype._invmp=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=c.clone();b.cmpn(1)>0&&c.cmpn(1)>0;){for(var i=0,j=1;0===(b.words[0]&j)&&i<26;++i,j<<=1);if(i>0)for(b.iushrn(i);i-- >0;)e.isOdd()&&e.iadd(h),e.iushrn(1);for(var k=0,l=1;0===(c.words[0]&l)&&k<26;++k,l<<=1);if(k>0)for(c.iushrn(k);k-- >0;)g.isOdd()&&g.iadd(h),g.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(g)):(c.isub(b),g.isub(e))}var m;return m=0===b.cmpn(1)?e:g,m.cmpn(0)<0&&m.iadd(a),m},f.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var b=this.clone(),c=a.clone();b.negative=0,c.negative=0;for(var d=0;b.isEven()&&c.isEven();d++)b.iushrn(1),c.iushrn(1);for(;;){for(;b.isEven();)b.iushrn(1);for(;c.isEven();)c.iushrn(1);var e=b.cmp(c);if(e<0){var f=b;b=c,c=f}else if(0===e||0===c.cmpn(1))break;b.isub(c)}return c.iushln(d)},f.prototype.invm=function(a){return this.egcd(a).a.umod(a)},f.prototype.isEven=function(){return 0===(1&this.words[0])},f.prototype.isOdd=function(){return 1===(1&this.words[0])},f.prototype.andln=function(a){return this.words[0]&a},f.prototype.bincn=function(a){d("number"==typeof a);var b=a%26,c=(a-b)/26,e=1<<b;if(this.length<=c)return this._expand(c+1),this.words[c]|=e,this;for(var f=e,g=c;0!==f&&g<this.length;g++){var h=0|this.words[g];h+=f,f=h>>>26,h&=67108863,this.words[g]=h}return 0!==f&&(this.words[g]=f,this.length++),this},f.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},f.prototype.cmpn=function(a){var b=a<0;if(0!==this.negative&&!b)return-1;if(0===this.negative&&b)return 1;this.strip();var c;if(this.length>1)c=1;else{b&&(a=-a),d(a<=67108863,"Number is too big");var e=0|this.words[0];c=e===a?0:e<a?-1:1}return 0!==this.negative?0|-c:c},f.prototype.cmp=function(a){if(0!==this.negative&&0===a.negative)return-1;if(0===this.negative&&0!==a.negative)return 1;var b=this.ucmp(a);return 0!==this.negative?0|-b:b},f.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var b=0,c=this.length-1;c>=0;c--){var d=0|this.words[c],e=0|a.words[c];if(d!==e){d<e?b=-1:d>e&&(b=1);break}}return b},f.prototype.gtn=function(a){return 1===this.cmpn(a)},f.prototype.gt=function(a){return 1===this.cmp(a)},f.prototype.gten=function(a){return this.cmpn(a)>=0},f.prototype.gte=function(a){return this.cmp(a)>=0},f.prototype.ltn=function(a){return this.cmpn(a)===-1},f.prototype.lt=function(a){return this.c
e.inherits(d,r),b.exports=d,d.blockSize=512,d.outSize=256,d.hmacStrength=192,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]=j(q(c[d-2]),c[d-7],p(c[d-15]),c[d-16]);var e=this.h[0],f=this.h[1],g=this.h[2],r=this.h[3],s=this.h[4],t=this.h[5],u=this.h[6],v=this.h[7];for(h(this.k.length===c.length),d=0;d<c.length;d++){var w=k(v,o(s),l(s,t,u),this.k[d],c[d]),x=i(n(e),m(e,f,g));v=u,u=t,t=s,s=i(r,w),r=g,g=f,f=e,e=i(w,x)}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],r),this.h[4]=i(this.h[4],s),this.h[5]=i(this.h[5],t),this.h[6]=i(this.h[6],u),this.h[7]=i(this.h[7],v)},d.prototype._digest=function(a){return"hex"===a?e.toHex32(this.h,"big"):e.split32(this.h,"big")}},{"../common":21,"../utils":31,"./common":30,"minimalistic-assert":34}],28:[function(a,b,c){"use strict";function d(){return this instanceof d?(f.call(this),void(this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])):new d}var e=a("../utils"),f=a("./512");e.inherits(d,f),b.exports=d,d.blockSize=1024,d.outSize=384,d.hmacStrength=192,d.padLength=128,d.prototype._digest=function(a){return"hex"===a?e.toHex32(this.h.slice(0,12),"big"):e.split32(this.h.slice(0,12),"big")}},{"../utils":31,"./512":29}],29:[function(a,b,c){"use strict";function d(){return this instanceof d?(E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=F,void(this.W=new Array(160))):new d}function e(a,b,c,d,e){var f=a&c^~a&e;return f<0&&(f+=4294967296),f}function f(a,b,c,d,e,f){var g=b&d^~b&f;return g<0&&(g+=4294967296),g}function g(a,b,c,d,e){var f=a&c^a&e^c&e;return f<0&&(f+=4294967296),f}function h(a,b,c,d,e,f){var g=b&d^b&f^d&f;return g<0&&(g+=4294967296),g}function i(a,b){var c=t(a,b,28),d=t(b,a,2),e=t(b,a,7),f=c^d^e;return f<0&&(f+=4294967296),f}function j(a,b){var c=u(a,b,28),d=u(b,a,2),e=u(b,a,7),f=c^d^e;return f<0&&(f+=4294967296),f}function k(a,b){var c=t(a,b,14),d=t(a,b,18),e=t(b,a,9),f=c^d^e;return f<0&&(f+=4294967296),f}function l(a,b){var c=u(a,b,14),d=u(a,b,18),e=u(b,a,9),f=c^d^e;return f<0&&(f+=4294967296),f}function m(a,b){var c=t(a,b,1),d=t(a,b,8),e=v(a,b,7),f=c^d^e;return f<0&&(f+=4294967296),f}function n(a,b){var c=u(a,b,1),d=u(a,b,8),e=w(a,b,7),f=c^d^e;return f<0&&(f+=4294967296),f}function o(a,b){var c=t(a,b,19),d=t(b,a,29),e=v(a,b,6),f=c^d^e;return f<0&&(f+=4294967296),f}function p(a,b){var c=u(a,b,19),d=u(b,a,29),e=w(a,b,6),f=c^d^e;return f<0&&(f+=4294967296),f}var q=a("../utils"),r=a("../common"),s=a("minimalistic-assert"),t=q.rotr64_hi,u=q.rotr64_lo,v=q.shr64_hi,w=q.shr64_lo,x=q.sum64,y=q.sum64_hi,z=q.sum64_lo,A=q.sum64_4_hi,B=q.sum64_4_lo,C=q.sum64_5_hi,D=q.sum64_5_lo,E=r.BlockHash,F=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,95813
E.defineProperty(this,"chainId",a.chainId),E.defineProperty(this,"ensAddress",c),E.defineProperty(this,"name",a.name),E.defineProperty(this,"testnet","homestead"!==a.name);var d={};E.defineProperty(this,"_events",d);var e=this,f=null,g={};E.defineProperty(this,"resetEventsBlock",function(a){f=a,e.doPoll()});var h=null;Object.defineProperty(this,"polling",{get:function(){return null!=h},set:function(a){setTimeout(function(){a&&!h?h=setInterval(b,4e3):!a&&h&&(clearInterval(h),h=null)},0)}})}function x(a){return function(b){B(b,a),E.defineProperty(b,"inherits",x(b))}}function y(a,b){if(Array.isArray(a)){var c=[];return a.forEach(function(a){c.push(y(a,b))}),c}return b(a)}function z(a){try{return"address:"+E.getAddress(a)}catch(b){}if("block"===a)return"block";if("pending"===a)return"pending";if(E.isHexString(a)){if(66===a.length)return"tx:"+a}else if(Array.isArray(a)){a=y(a,function(a){return null==a&&(a="0x"),a});try{return"topic:"+E.RLP.encode(a)}catch(b){console.log(b)}}throw new Error("invalid event - "+a)}function A(a){if("tx:"===a.substring(0,3))return{type:"transaction",hash:a.substring(3)};if("block"===a)return{type:"block"};if("pending"===a)return{type:"pending"};if("address:"===a.substring(0,8))return{type:"address",address:a.substring(8)};if("topic:"===a.substring(0,6))try{var b=E.RLP.decode(a.substring(6));return b=y(b,function(a){return"0x"===a&&(a=null),a}),{type:"topic",topic:b}}catch(c){console.log(c)}throw new Error("invalid event string")}var B=a("inherits"),C=a("xmlhttprequest").XMLHttpRequest,D=a("./networks.json"),E=function(){var b=a("ethers-utils/convert");return{defineProperty:a("ethers-utils/properties").defineProperty,getAddress:a("ethers-utils/address").getAddress,getContractAddress:a("ethers-utils/contract-address").getContractAddress,bigNumberify:a("ethers-utils/bignumber").bigNumberify,arrayify:b.arrayify,hexlify:b.hexlify,isHexString:b.isHexString,concat:b.concat,stripZeros:b.stripZeros,namehash:a("ethers-utils/namehash"),toUtf8String:a("ethers-utils/utf8").toUtf8String,RLP:a("ethers-utils/rlp")}}(),F={hash:i,parentHash:i,number:j,timestamp:j,nonce:f(E.hexlify),difficulty:f(j),gasLimit:E.bigNumberify,gasUsed:E.bigNumberify,miner:E.getAddress,extraData:E.hexlify,transactions:f(h(i))},G={hash:i,blockHash:f(i,null),blockNumber:f(j,null),transactionIndex:f(j,null),from:E.getAddress,gasPrice:E.bigNumberify,gasLimit:E.bigNumberify,to:f(E.getAddress,null),value:E.bigNumberify,nonce:j,data:E.hexlify,r:f(l),s:f(l),v:f(j),creates:f(E.getAddress,null),raw:f(E.hexlify)},H={from:f(E.getAddress),nonce:f(j),gasLimit:f(E.bigNumberify),gasPrice:f(E.bigNumberify),to:f(E.getAddress),value:f(E.bigNumberify),data:f(E.hexlify)},I={transactionLogIndex:f(j),transactionIndex:j,blockNumber:j,transactionHash:i,address:E.getAddress,type:f(m),topics:h(i),data:E.hexlify,logIndex:j,blockHash:i},J={contractAddress:f(E.getAddress,null),transactionIndex:j,root:f(i),gasUsed:E.bigNumberify,logsBloom:E.hexlify,blockHash:i,transactionHash:i,logs:h(r),blockNumber:j,cumulativeGasUsed:E.bigNumberify,status:f(j)},K={fromBlock:f(n,void 0),toBlock:f(n,void 0),address:f(E.getAddress,void 0),topics:f(t,void 0)},L={blockNumber:f(j),blockHash:f(i),transactionIndex:j,removed:f(k),address:E.getAddress,data:g(E.hexlify,"0x"),topics:h(i),transactionHash:i,logIndex:j};E.defineProperty(w,"inherits",x(w)),E.defineProperty(w,"_legacyConstructor",function(a,b,c,d){if("boolean"==typeof c||2===b){var e=!!c,f=d;a=D[e?"ropsten":"homestead"],2===b&&null!=f&&(a={chainId:f,ensAddress:a.ensAddress,name:a.name})}else if("string"==typeof a){if(a=D[a],!a)throw new Error("unknown network")}else null==a&&(a=D.homestead);if("number"!=typeof a.chainId)throw new Error("invalid chainId");return a}),E.defineProperty(w,"chainId",{homestead:1,morden:2,ropsten:3,rinkeby:4,kovan:42}),E.defineProperty(w,"networks",D),E.defineProperty(w,"fetchJSON",function(a,b,c){return new Promise(function(d,e){var f=new C;b?(f.open("POST",a,!0),f.setRequestHeader("Content-Type","application/json")):f.open("GET",a,!0),f.onreadystatechange=function(){if(4===f.readyState){try{var g=JSON.p