web3.js/dist/web3.min.js

2 lines
46 KiB
JavaScript
Raw Normal View History

require=function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){var r=t("../utils/utils"),i=t("../utils/config"),o=t("./types"),a=t("./formatters"),u=t("./utils"),s=function(t){throw new Error("parser does not support type: "+t)},c=function(t){return"[]"===t.slice(-2)},l=function(t,e){return c(t)||"bytes"===t?a.formatInputInt(e.length):""},f=o.inputTypes(),p=function(t,e){var n="",r="",i="";return t.forEach(function(t,r){n+=l(t.type,e[r])}),t.forEach(function(n,o){for(var a=!1,u=0;u<f.length&&!a;u++)a=f[u].type(t[o].type,e[o]);a||s(t[o].type);var l=f[u-1].format;c(t[o].type)?i+=e[o].reduce(function(t,e){return t+l(e)},""):"bytes"===t[o].type?i+=l(e[o]):r+=l(e[o])}),n+=r+i},m=function(t){return c(t)||"bytes"===t?2*i.ETH_PADDING:0},h=o.outputTypes(),d=function(t,e){e=e.slice(2);var n=[],r=2*i.ETH_PADDING,u=t.reduce(function(t,e){return t+m(e.type)},0),l=e.slice(0,u);return e=e.slice(u),t.forEach(function(i,u){for(var f=!1,p=0;p<h.length&&!f;p++)f=h[p].type(t[u].type);f||s(t[u].type);var m=h[p-1].format;if(c(t[u].type)){var d=a.formatOutputUInt(l.slice(0,r));l=l.slice(r);for(var g=[],v=0;d>v;v++)g.push(m(e.slice(0,r))),e=e.slice(r);n.push(g)}else o.prefixedType("bytes")(t[u].type)?(l=l.slice(r),n.push(m(e.slice(0,r))),e=e.slice(r)):(n.push(m(e.slice(0,r))),e=e.slice(r))}),n},g=function(t){var e={};return t.forEach(function(t){var n=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return p(t.inputs,e)};void 0===e[n]&&(e[n]=o),e[n][i]=o}),e},v=function(t){var e={};return t.forEach(function(t){var n=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(e){return d(t.outputs,e)};void 0===e[n]&&(e[n]=o),e[n][i]=o}),e},b=function(t,e){var n=u.getConstructor(t,e.length);return n?p(n.inputs,e):(e.length>0&&console.warn("didn't found matching constructor, using default one"),"")};e.exports={inputParser:g,outputParser:v,formatInput:p,formatOutput:d,formatConstructorParams:b}},{"../utils/config":6,"../utils/utils":7,"./formatters":2,"./types":3,"./utils":4}],2:[function(t,e,n){var r=t("bignumber.js"),i=t("../utils/utils"),o=t("../utils/config"),a=function(t){var e=2*o.ETH_PADDING;return r.config(o.ETH_BIGNUMBER_ROUNDING_MODE),i.padLeft(i.toTwosComplement(t).round().toString(16),e)},u=function(t){return i.fromAscii(t,o.ETH_PADDING).substr(2)},s=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},c=function(t){return a(new r(t).times(new r(2).pow(128)))},l=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},f=function(t){return t=t||"0",l(t)?new r(t,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(t,16)},p=function(t){return t=t||"0",new r(t,16)},m=function(t){return f(t).dividedBy(new r(2).pow(128))},h=function(t){return p(t).dividedBy(new r(2).pow(128))},d=function(t){return"0x"+t},g=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},v=function(t){return i.toAscii(t)},b=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:a,formatInputString:u,formatInputBool:s,formatInputReal:c,formatOutputInt:f,formatOutputUInt:p,formatOutputReal:m,formatOutputUReal:h,formatOutputHash:d,formatOutputBool:g,formatOutputString:v,formatOutputAddress:b}},{"../utils/config":6,"../utils/utils":7,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("./formatters"),i=function(t){return function(e){return 0===e.indexOf(t)}},o=function(t){return function(e){return t===e}},a=function(){return[{type:i("uint"),format:r.formatInputInt},{type:i("int"),format:r.formatInputInt},{type:i("bytes"),format
r++);return(n=r+n*F-1)>M?t.c=t.e=null:G>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function S(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",R=0,r}function k(t,e,n,r){var i,o,a,u,s,c,l,f=t.c,p=_;if(f){t:{for(i=1,u=f[0];u>=10;u/=10,i++);if(o=e-i,0>o)o+=F,a=e,s=f[c=0],l=s/p[i-a-1]%10|0;else if(c=v((o+1)/F),c>=f.length){if(!r)break t;for(;f.length<=c;f.push(0));s=l=0,i=1,o%=F,a=o-F+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);o%=F,a=o-F+i,l=0>a?0:s/p[i-a-1]%10|0}if(r=r||0>e||null!=f[c+1]||(0>a?s:s%p[i-a-1]),r=4>n?(l||r)&&(0==n||n==(t.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?a>0?s/p[i-a]:0:f[c-1])%10&1||n==(t.s<0?8:7)),1>e||!f[0])return f.length=0,r?(e-=t.e+1,f[0]=p[e%F],t.e=-e||0):f[0]=t.e=0,t;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=p[F-o],f[c]=a>0?b(s/p[i-a]%p[a])*u:0),r)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(t.e++,f[0]==N&&(f[0]=1));break}if(f[c]+=u,f[c]!=N)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}t.e>M?t.c=t.e=null:t.e<G&&(t.c=[t.e=0])}return t}var P,R=0,C=e.prototype,H=new e(1),U=20,L=4,j=-7,q=21,G=-1e7,M=1e7,J=!0,W=D,V=!1,$=1,z=100,X={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0};return e.another=r,e.ROUND_UP=0,e.ROUND_DOWN=1,e.ROUND_CEIL=2,e.ROUND_FLOOR=3,e.ROUND_HALF_UP=4,e.ROUND_HALF_DOWN=5,e.ROUND_HALF_EVEN=6,e.ROUND_HALF_CEIL=7,e.ROUND_HALF_FLOOR=8,e.EUCLID=9,e.config=function(){var t,e,n=0,r={},i=arguments,o=i[0],a=o&&"object"==typeof o?function(){return o.hasOwnProperty(e)?null!=(t=o[e]):void 0}:function(){return i.length>n?null!=(t=i[n++]):void 0};return a(e="DECIMAL_PLACES")&&W(t,0,A,2,e)&&(U=0|t),r[e]=U,a(e="ROUNDING_MODE")&&W(t,0,8,2,e)&&(L=0|t),r[e]=L,a(e="EXPONENTIAL_AT")&&(s(t)?W(t[0],-A,0,2,e)&&W(t[1],0,A,2,e)&&(j=0|t[0],q=0|t[1]):W(t,-A,A,2,e)&&(j=-(q=0|(0>t?-t:t)))),r[e]=[j,q],a(e="RANGE")&&(s(t)?W(t[0],-A,-1,2,e)&&W(t[1],1,A,2,e)&&(G=0|t[0],M=0|t[1]):W(t,-A,A,2,e)&&(0|t?G=-(M=0|(0>t?-t:t)):J&&S(2,e+" cannot be zero",t))),r[e]=[G,M],a(e="ERRORS")&&(t===!!t||1===t||0===t?(R=0,W=(J=!!t)?D:u):J&&S(2,e+y,t)),r[e]=J,a(e="CRYPTO")&&(t===!!t||1===t||0===t?(V=!(!t||!h||"object"!=typeof h),t&&!V&&J&&S(2,"crypto unavailable",h)):J&&S(2,e+y,t)),r[e]=V,a(e="MODULO_MODE")&&W(t,0,9,2,e)&&($=0|t),r[e]=$,a(e="POW_PRECISION")&&W(t,0,A,2,e)&&(z=0|t),r[e]=z,a(e="FORMAT")&&("object"==typeof t?X=t:J&&S(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return B(arguments,C.lt)},e.min=function(){return B(arguments,C.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return b(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,a,u,s=0,c=[],l=new e(H);if(t=null!=t&&W(t,0,A,14)?0|t:U,a=v(t/F),V)if(h&&h.getRandomValues){for(r=h.getRandomValues(new Uint32Array(a*=2));a>s;)u=131072*r[s]+(r[s+1]>>>11),u>=9e15?(i=h.getRandomValues(new Uint32Array(2)),r[s]=i[0],r[s+1]=i[1]):(c.push(u%1e14),s+=2);s=a/2}else if(h&&h.randomBytes){for(r=h.randomBytes(a*=7);a>s;)u=281474976710656*(31&r[s])+1099511627776*r[s+1]+4294967296*r[s+2]+16777216*r[s+3]+(r[s+4]<<16)+(r[s+5]<<8)+r[s+6],u>=9e15?h.randomBytes(7).copy(r,s):(c.push(u%1e14),s+=7);s=a/7}else J&&S(14,"crypto unavailable",h);if(!s)for(;a>s;)u=n(),9e15>u&&(c[s++]=u%1e14);for(a=c[--s],t%=F,a&&t&&(u=_[F-t],c[s]=b(a/u)*u);0===c[s];c.pop(),s--);if(0>s)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=F);for(s=1,u=c[0];u>=10;u/=10,s++);F>s&&(o-=F-s)}return l.e=o,l.c=c,l}}(),P=function(){function t(t,e,n){var r,i,o,a,u=0,s=t.length,c=e%T,l=e/T|0;for(t=t.slice();s--;)o=t[s]%T,a=t[s]/T|0,r=l*o+a*c,i=c*o+r%T*T+u,u=(i/n|0)+(r/T|0)+l*a,t[s]=i%n;return u&&t.unshift(u),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n