ethers.js/packages/ethers/dist/ethers.esm.min.js

11 lines
359 KiB
JavaScript
Raw Normal View History

2020-10-23 04:55:40 +03:00
var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t,e){return t(e={exports:{}},e.exports),e.exports}for(var n=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},i=function(t){var e,r,n=f(t),i=n[0],o=n[1],s=new u(function(t,e,r){return 3*(e+r)/4-r}(0,i,o)),h=0,l=o>0?i-4:i;for(r=0;r<l;r+=4)e=a[t.charCodeAt(r)]<<18|a[t.charCodeAt(r+1)]<<12|a[t.charCodeAt(r+2)]<<6|a[t.charCodeAt(r+3)],s[h++]=e>>16&255,s[h++]=e>>8&255,s[h++]=255&e;2===o&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,s[h++]=255&e);1===o&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,s[h++]=e>>8&255,s[h++]=255&e);return s},o=function(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,u=r-n;a<u;a+=o)i.push(d(t,a,a+o>u?u:a+o));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"="));return i.join("")},s=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,c=h.length;l<c;++l)s[l]=h[l],a[h.charCodeAt(l)]=l;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function d(t,e,r){for(var n,i,o=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(s[(i=n)>>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63;var p={byteLength:n,toByteArray:i,fromByteArray:o},m=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,h=u>>1,l=-7,c=r?i-1:0,f=r?-1:1,d=t[e+c];for(c+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+c],c+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+c],c+=f,l-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=h}return(d?-1:1)*s*Math.pow(2,o-n)},g=function(t,e,r,n,i,o){var s,a,u,h=8*o-i-1,l=(1<<h)-1,c=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?f/u:f*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[r+d]=255&s,d+=p,s/=256,h-=8);t[r+d-p]|=128*m},y=r((function(t,e){var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},e.INSPECT_MAX_BYTES=50;var n=2147483647;function i(t){if(t>n)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|f(t,e),n=i(r),s=n.write(t,e);s!==r&&(n=n.slice(0,s));return n}(t,e);if(ArrayBuffer.isView(t))return h(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(K(t,ArrayBuffer)||t&&K(t.buffer,ArrayBuffer))return l(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(K(t,SharedArrayBuffer)||t&&K(t.buffer,SharedArrayBuffer)))return l(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return o.from(n,e,r);var s=function(t){if(o.isBuffer(t)){var e=0|c(t.length),r=i(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||q(t.length
2019-10-16 19:12:03 +03:00
/**
* [js-sha3]{@link https://github.com/emn178/js-sha3}
*
* @version 0.5.7
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2015-2016
* @license MIT
*/
2020-10-23 04:55:40 +03:00
!function(){var r="object"==typeof window?window:{};!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node&&(r=t);for(var n=!r.JS_SHA3_NO_COMMON_JS&&e.exports,i="0123456789abcdef".split(""),o=[0,8,16,24],s=[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],a=[224,256,384,512],u=["hex","buffer","arrayBuffer","array"],h=function(t,e,r){return function(n){return new b(t,e,t).update(n)[r]()}},l=function(t,e,r){return function(n,i){return new b(t,e,i).update(n)[r]()}},c=function(t,e){var r=h(t,e,"hex");r.create=function(){return new b(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n<u.length;++n){var i=u[n];r[i]=h(t,e,i)}return r},f=[{name:"keccak",padding:[1,256,65536,16777216],bits:a,createMethod:c},{name:"sha3",padding:[6,1536,393216,100663296],bits:a,createMethod:c},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,e){var r=l(t,e,"hex");r.create=function(r){return new b(t,e,r)},r.update=function(t,e){return r.create(e).update(t)};for(var n=0;n<u.length;++n){var i=u[n];r[i]=l(t,e,i)}return r}}],d={},p=[],m=0;m<f.length;++m)for(var g=f[m],y=g.bits,v=0;v<y.length;++v){var w=g.name+"_"+y[v];p.push(w),d[w]=g.createMethod(y[v],g.padding)}function b(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}b.prototype.update=function(t){var e="string"!=typeof t;e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));for(var r,n,i=t.length,s=this.blocks,a=this.byteCount,u=this.blockCount,h=0,l=this.s;h<i;){if(this.reset)for(this.reset=!1,s[0]=this.block,r=1;r<u+1;++r)s[r]=0;if(e)for(r=this.start;h<i&&r<a;++h)s[r>>2]|=t[h]<<o[3&r++];else for(r=this.start;h<i&&r<a;++h)(n=t.charCodeAt(h))<128?s[r>>2]|=n<<o[3&r++]:n<2048?(s[r>>2]|=(192|n>>6)<<o[3&r++],s[r>>2]|=(128|63&n)<<o[3&r++]):n<55296||n>=57344?(s[r>>2]|=(224|n>>12)<<o[3&r++],s[r>>2]|=(128|n>>6&63)<<o[3&r++],s[r>>2]|=(128|63&n)<<o[3&r++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++h)),s[r>>2]|=(240|n>>18)<<o[3&r++],s[r>>2]|=(128|n>>12&63)<<o[3&r++],s[r>>2]|=(128|n>>6&63)<<o[3&r++],s[r>>2]|=(128|63&n)<<o[3&r++]);if(this.lastByteIndex=r,r>=a){for(this.start=r-a,this.block=s[u],r=0;r<u;++r)l[r]^=s[r];E(l),this.reset=!0}else this.start=r}return this},b.prototype.finalize=function(){var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];E(n)},b.prototype.toString=b.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,o=this.extraBytes,s=0,a=0,u="";a<n;){for(s=0;s<e&&a<n;++s,++a)t=r[s],u+=i[t>>4&15]+i[15&t]+i[t>>12&15]+i[t>>8&15]+i[t>>20&15]+i[t>>16&15]+i[t>>28&15]+i[t>>24&15];a%e==0&&(E(r),s=0)}return o&&(t=r[s],o>0&&(u+=i[t>>4&15]+i[15&t]),o>1&&(u+=i[t>>12&15]+i[t>>8&15]),o>2&&(u+=i[t>>20&15]+i[t>>16&15])),u},b.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s<n;){for(o=0;o<e&&s<n;++o,++s)u[s]=r[o];s%e==0&&E(r)}return i&&(u[o]=r[o],t=t.slice(0,a)),t},b.prototype.buffer=b.prototype.arrayBuffer,b.prototype.digest=b.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)t=a<<2,e=n[s],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&E(n)}return o&&(t=a<<2,e=n[s],o>0&&(u[t]=255&e),o>1&&(u[t+1]=e>>8&255),o>2&&(u[t