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

11 lines
443 KiB
JavaScript
Raw Normal View History

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