Commit 93077c98 authored by Péter Szilágyi's avatar Péter Szilágyi Committed by Felix Lange

internal: update web3.js to 0.18.1, embed deps with go-bindata (#3545)

parent 3dab3038
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package jsre
const BigNumber_JS = `/* bignumber.js v2.0.3 https://github.com/MikeMcl/bignumber.js/LICENCE */
/* bignumber.js v2.0.3 https://github.com/MikeMcl/bignumber.js/LICENCE */
/* modified by zelig to fix https://github.com/robertkrimen/otto#regular-expression-incompatibility */
!function(e){"use strict";function n(e){function a(e,n){var t,r,i,o,u,s,f=this;if(!(f instanceof a))return j&&L(26,"constructor call without new",e),new a(e,n);if(null!=n&&H(n,2,64,M,"base")){if(n=0|n,s=e+"",10==n)return f=new a(e instanceof a?e:s),U(f,P+f.e+1,k);if((o="number"==typeof e)&&0*e!=0||!new RegExp("^-?"+(t="["+O.slice(0,n)+"]+")+"(?:\\."+t+")?$",37>n?"i":"").test(s))return g(f,s,o,n);o?(f.s=0>1/e?(s=s.slice(1),-1):1,j&&s.replace(/^0\.0*|\./,"").length>15&&L(M,b,e),o=!1):f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=D(s,10,n,f.s)}else{if(e instanceof a)return f.s=e.s,f.e=e.e,f.c=(e=e.c)?e.slice():e,void(M=0);if((o="number"==typeof e)&&0*e==0){if(f.s=0>1/e?(e=-e,-1):1,e===~~e){for(r=0,i=e;i>=10;i/=10,r++);return f.e=r,f.c=[e],void(M=0)}s=e+""}else{if(!p.test(s=e+""))return g(f,s,o);f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1}}for((r=s.indexOf("."))>-1&&(s=s.replace(".","")),(i=s.search(/e/i))>0?(0>r&&(r=i),r+=+s.slice(i+1),s=s.substring(0,i)):0>r&&(r=s.length),i=0;48===s.charCodeAt(i);i++);for(u=s.length;48===s.charCodeAt(--u););if(s=s.slice(i,u+1))if(u=s.length,o&&j&&u>15&&L(M,b,f.s*e),r=r-i-1,r>z)f.c=f.e=null;else if(G>r)f.c=[f.e=0];else{if(f.e=r,f.c=[],i=(r+1)%y,0>r&&(i+=y),u>i){for(i&&f.c.push(+s.slice(0,i)),u-=y;u>i;)f.c.push(+s.slice(i,i+=y));s=s.slice(i),i=y-s.length}else i-=u;for(;i--;s+="0");f.c.push(+s)}else f.c=[f.e=0];M=0}function D(e,n,t,i){var o,u,f,c,h,g,p,d=e.indexOf("."),m=P,w=k;for(37>t&&(e=e.toLowerCase()),d>=0&&(f=J,J=0,e=e.replace(".",""),p=new a(t),h=p.pow(e.length-d),J=f,p.c=s(l(r(h.c),h.e),10,n),p.e=p.c.length),g=s(e,t,n),u=f=g.length;0==g[--f];g.pop());if(!g[0])return"0";if(0>d?--u:(h.c=g,h.e=u,h.s=i,h=C(h,p,m,w,n),g=h.c,c=h.r,u=h.e),o=u+m+1,d=g[o],f=n/2,c=c||0>o||null!=g[o+1],c=4>w?(null!=d||c)&&(0==w||w==(h.s<0?3:2)):d>f||d==f&&(4==w||c||6==w&&1&g[o-1]||w==(h.s<0?8:7)),1>o||!g[0])e=c?l("1",-m):"0";else{if(g.length=o,c)for(--n;++g[--o]>n;)g[o]=0,o||(++u,g.unshift(1));for(f=g.length;!g[--f];);for(d=0,e="";f>=d;e+=O.charAt(g[d++]));e=l(e,u)}return e}function _(e,n,t,i){var o,u,s,c,h;if(t=null!=t&&H(t,0,8,i,v)?0|t:k,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)h=r(e.c),h=19==i||24==i&&B>=s?f(h,s):l(h,s);else if(e=U(new a(e),n,t),u=e.e,h=r(e.c),c=h.length,19==i||24==i&&(u>=n||B>=u)){for(;n>c;h+="0",c++);h=f(h,u)}else if(n-=s,h=l(h,u),u+1>c){if(--n>0)for(h+=".";n--;h+="0");}else if(n+=u-c,n>0)for(u+1==c&&(h+=".");n--;h+="0");return e.s<0&&o?"-"+h:h}function x(e,n){var t,r,i=0;for(u(e[0])&&(e=e[0]),t=new a(e[0]);++i<e.length;){if(r=new a(e[i]),!r.s){t=r;break}n.call(t,r)&&(t=r)}return t}function F(e,n,t,r,i){return(n>e||e>t||e!=c(e))&&L(r,(i||"decimal places")+(n>e||e>t?" out of range":" not an integer"),e),!0}function I(e,n,t){for(var r=1,i=n.length;!n[--i];n.pop());for(i=n[0];i>=10;i/=10,r++);return(t=r+t*y-1)>z?e.c=e.e=null:G>t?e.c=[e.e=0]:(e.e=t,e.c=n),e}function L(e,n,t){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"][e]+"() "+n+": "+t);throw r.name="BigNumber Error",M=0,r}function U(e,n,t,r){var i,o,u,s,f,l,c,a=e.c,h=R;if(a){e:{for(i=1,s=a[0];s>=10;s/=10,i++);if(o=n-i,0>o)o+=y,u=n,f=a[l=0],c=f/h[i-u-1]%10|0;else if(l=d((o+1)/y),l>=a.length){if(!r)break e;for(;a.length<=l;a.push(0));f=c=0,i=1,o%=y,u=o-y+1}else{for(f=s=a[l],i=1;s>=10;s/=10,i++);o%=y,u=o-y+i,c=0>u?0:f/h[i-u-1]%10|0}if(r=r||0>n||null!=a[l+1]||(0>u?f:f%h[i-u-1]),r=4>t?(c||r)&&(0==t||t==(e.s<0?3:2)):c>5||5==c&&(4==t||r||6==t&&(o>0?u>0?f/h[i-u]:0:a[l-1])%10&1||t==(e.s<0?8:7)),1>n||!a[0])return a.length=0,r?(n-=e.e+1,a[0]=h[n%y],e.e=-n||0):a[0]=e.e=0,e;if(0==o?(a.length=l,s=1,l--):(a.length=l+1,s=h[y-o],a[l]=u>0?m(f/h[i-u]%h[u])*s:0),r)for(;;){if(0==l){for(o=1,u=a[0];u>=10;u/=10,o++);for(u=a[0]+=s,s=1;u>=10;u/=10,s++);o!=s&&(e.e++,a[0]==N&&(a[0]=1));break}if(a[l]+=s,a[l]!=N)break;a[l--]=0,s=1}for(o=a.length;0===a[--o];a.pop());}e.e>z?e.c=e.e=null:e.e<G&&(e.c=[e.e=0])}return e}var C,M=0,T=a.prototype,q=new a(1),P=20,k=4,B=-7,$=21,G=-1e7,z=1e7,j=!0,H=F,V=!1,W=1,J=100,X={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0};return a.another=n,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=function(){var e,n,t=0,r={},i=arguments,s=i[0],f=s&&"object"==typeof s?function(){return s.hasOwnProperty(n)?null!=(e=s[n]):void 0}:function(){return i.length>t?null!=(e=i[t++]):void 0};return f(n="DECIMAL_PLACES")&&H(e,0,E,2,n)&&(P=0|e),r[n]=P,f(n="ROUNDING_MODE")&&H(e,0,8,2,n)&&(k=0|e),r[n]=k,f(n="EXPONENTIAL_AT")&&(u(e)?H(e[0],-E,0,2,n)&&H(e[1],0,E,2,n)&&(B=0|e[0],$=0|e[1]):H(e,-E,E,2,n)&&(B=-($=0|(0>e?-e:e)))),r[n]=[B,$],f(n="RANGE")&&(u(e)?H(e[0],-E,-1,2,n)&&H(e[1],1,E,2,n)&&(G=0|e[0],z=0|e[1]):H(e,-E,E,2,n)&&(0|e?G=-(z=0|(0>e?-e:e)):j&&L(2,n+" cannot be zero",e))),r[n]=[G,z],f(n="ERRORS")&&(e===!!e||1===e||0===e?(M=0,H=(j=!!e)?F:o):j&&L(2,n+w,e)),r[n]=j,f(n="CRYPTO")&&(e===!!e||1===e||0===e?(V=!(!e||!h||"object"!=typeof h),e&&!V&&j&&L(2,"crypto unavailable",h)):j&&L(2,n+w,e)),r[n]=V,f(n="MODULO_MODE")&&H(e,0,9,2,n)&&(W=0|e),r[n]=W,f(n="POW_PRECISION")&&H(e,0,E,2,n)&&(J=0|e),r[n]=J,f(n="FORMAT")&&("object"==typeof e?X=e:j&&L(2,n+" not an object",e)),r[n]=X,r},a.max=function(){return x(arguments,T.lt)},a.min=function(){return x(arguments,T.gt)},a.random=function(){var e=9007199254740992,n=Math.random()*e&2097151?function(){return m(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var t,r,i,o,u,s=0,f=[],l=new a(q);if(e=null!=e&&H(e,0,E,14)?0|e:P,o=d(e/y),V)if(h&&h.getRandomValues){for(t=h.getRandomValues(new Uint32Array(o*=2));o>s;)u=131072*t[s]+(t[s+1]>>>11),u>=9e15?(r=h.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(u%1e14),s+=2);s=o/2}else if(h&&h.randomBytes){for(t=h.randomBytes(o*=7);o>s;)u=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],u>=9e15?h.randomBytes(7).copy(t,s):(f.push(u%1e14),s+=7);s=o/7}else j&&L(14,"crypto unavailable",h);if(!s)for(;o>s;)u=n(),9e15>u&&(f[s++]=u%1e14);for(o=f[--s],e%=y,o&&e&&(u=R[y-e],f[s]=m(o/u)*u);0===f[s];f.pop(),s--);if(0>s)f=[i=0];else{for(i=-1;0===f[0];f.shift(),i-=y);for(s=1,u=f[0];u>=10;u/=10,s++);y>s&&(i-=y-s)}return l.e=i,l.c=f,l}}(),C=function(){function e(e,n,t){var r,i,o,u,s=0,f=e.length,l=n%A,c=n/A|0;for(e=e.slice();f--;)o=e[f]%A,u=e[f]/A|0,r=c*o+u*l,i=l*o+r%A*A+s,s=(i/t|0)+(r/A|0)+c*u,e[f]=i%t;return s&&e.unshift(s),e}function n(e,n,t,r){var i,o;if(t!=r)o=t>r?1:-1;else for(i=o=0;t>i;i++)if(e[i]!=n[i]){o=e[i]>n[i]?1:-1;break}return o}function r(e,n,t,r){for(var i=0;t--;)e[t]-=i,i=e[t]<n[t]?1:0,e[t]=i*r+e[t]-n[t];for(;!e[0]&&e.length>1;e.shift());}return function(i,o,u,s,f){var l,c,h,g,p,d,w,v,b,O,S,R,A,E,D,_,x,F=i.s==o.s?1:-1,I=i.c,L=o.c;if(!(I&&I[0]&&L&&L[0]))return new a(i.s&&o.s&&(I?!L||I[0]!=L[0]:L)?I&&0==I[0]||!L?0*F:F/0:0/0);for(v=new a(F),b=v.c=[],c=i.e-o.e,F=u+c+1,f||(f=N,c=t(i.e/y)-t(o.e/y),F=F/y|0),h=0;L[h]==(I[h]||0);h++);if(L[h]>(I[h]||0)&&c--,0>F)b.push(1),g=!0;else{for(E=I.length,_=L.length,h=0,F+=2,p=m(f/(L[0]+1)),p>1&&(L=e(L,p,f),I=e(I,p,f),_=L.length,E=I.length),A=_,O=I.slice(0,_),S=O.length;_>S;O[S++]=0);x=L.slice(),x.unshift(0),D=L[0],L[1]>=f/2&&D++;do p=0,l=n(L,O,_,S),0>l?(R=O[0],_!=S&&(R=R*f+(O[1]||0)),p=m(R/D),p>1?(p>=f&&(p=f-1),d=e(L,p,f),w=d.length,S=O.length,l=n(d,O,w,S),1==l&&(p--,r(d,w>_?x:L,w,f))):(0==p&&(l=p=1),d=L.slice()),w=d.length,S>w&&d.unshift(0),r(O,d,S,f),-1==l&&(S=O.length,l=n(L,O,_,S),1>l&&(p++,r(O,S>_?x:L,S,f))),S=O.length):0===l&&(p++,O=[0]),b[h++]=p,l&&O[0]?O[S++]=I[A]||0:(O=[I[A]],S=1);while((A++<E||null!=O[0])&&F--);g=null!=O[0],b[0]||b.shift()}if(f==N){for(h=1,F=b[0];F>=10;F/=10,h++);U(v,u+(v.e=h+c*y-1)+1,s,g)}else v.e=c,v.r=+g;return v}}(),g=function(){var e=/^(-?)0([xbo])(\w[\w.]*$)/i,n=/^([^.]+)\.$/,t=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+([\w.])|^\s+|\s+$/g;return function(o,u,s,f){var l,c=s?u:u.replace(i,"$1");if(r.test(c))o.s=isNaN(c)?null:0>c?-1:1;else{if(!s&&(c=c.replace(e,function(e,n,t){return l="x"==(t=t.toLowerCase())?16:"b"==t?2:8,f&&f!=l?e:n}),f&&(l=f,c=c.replace(n,"$1").replace(t,"0.$1")),u!=c))return new a(c,l);j&&L(M,"not a"+(f?" base "+f:"")+" number",u),o.s=null}o.c=o.e=null,M=0}}(),T.absoluteValue=T.abs=function(){var e=new a(this);return e.s<0&&(e.s=1),e},T.ceil=function(){return U(new a(this),this.e+1,2)},T.comparedTo=T.cmp=function(e,n){return M=1,i(this,new a(e,n))},T.decimalPlaces=T.dp=function(){var e,n,r=this.c;if(!r)return null;if(e=((n=r.length-1)-t(this.e/y))*y,n=r[n])for(;n%10==0;n/=10,e--);return 0>e&&(e=0),e},T.dividedBy=T.div=function(e,n){return M=3,C(this,new a(e,n),P,k)},T.dividedToIntegerBy=T.divToInt=function(e,n){return M=4,C(this,new a(e,n),0,1)},T.equals=T.eq=function(e,n){return M=5,0===i(this,new a(e,n))},T.floor=function(){return U(new a(this),this.e+1,3)},T.greaterThan=T.gt=function(e,n){return M=6,i(this,new a(e,n))>0},T.greaterThanOrEqualTo=T.gte=function(e,n){return M=7,1===(n=i(this,new a(e,n)))||0===n},T.isFinite=function(){return!!this.c},T.isInteger=T.isInt=function(){return!!this.c&&t(this.e/y)>this.c.length-2},T.isNaN=function(){return!this.s},T.isNegative=T.isNeg=function(){return this.s<0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.lessThan=T.lt=function(e,n){return M=8,i(this,new a(e,n))<0},T.lessThanOrEqualTo=T.lte=function(e,n){return M=9,-1===(n=i(this,new a(e,n)))||0===n},T.minus=T.sub=function(e,n){var r,i,o,u,s=this,f=s.s;if(M=10,e=new a(e,n),n=e.s,!f||!n)return new a(0/0);if(f!=n)return e.s=-n,s.plus(e);var l=s.e/y,c=e.e/y,h=s.c,g=e.c;if(!l||!c){if(!h||!g)return h?(e.s=-n,e):new a(g?s:0/0);if(!h[0]||!g[0])return g[0]?(e.s=-n,e):new a(h[0]?s:3==k?-0:0)}if(l=t(l),c=t(c),h=h.slice(),f=l-c){for((u=0>f)?(f=-f,o=h):(c=l,o=g),o.reverse(),n=f;n--;o.push(0));o.reverse()}else for(i=(u=(f=h.length)<(n=g.length))?f:n,f=n=0;i>n;n++)if(h[n]!=g[n]){u=h[n]<g[n];break}if(u&&(o=h,h=g,g=o,e.s=-e.s),n=(i=g.length)-(r=h.length),n>0)for(;n--;h[r++]=0);for(n=N-1;i>f;){if(h[--i]<g[i]){for(r=i;r&&!h[--r];h[r]=n);--h[r],h[i]+=N}h[i]-=g[i]}for(;0==h[0];h.shift(),--c);return h[0]?I(e,h,c):(e.s=3==k?-1:1,e.c=[e.e=0],e)},T.modulo=T.mod=function(e,n){var t,r,i=this;return M=11,e=new a(e,n),!i.c||!e.s||e.c&&!e.c[0]?new a(0/0):!e.c||i.c&&!i.c[0]?new a(i):(9==W?(r=e.s,e.s=1,t=C(i,e,0,3),e.s=r,t.s*=r):t=C(i,e,0,W),i.minus(t.times(e)))},T.negated=T.neg=function(){var e=new a(this);return e.s=-e.s||null,e},T.plus=T.add=function(e,n){var r,i=this,o=i.s;if(M=12,e=new a(e,n),n=e.s,!o||!n)return new a(0/0);if(o!=n)return e.s=-n,i.minus(e);var u=i.e/y,s=e.e/y,f=i.c,l=e.c;if(!u||!s){if(!f||!l)return new a(o/0);if(!f[0]||!l[0])return l[0]?e:new a(f[0]?i:0*o)}if(u=t(u),s=t(s),f=f.slice(),o=u-s){for(o>0?(s=u,r=l):(o=-o,r=f),r.reverse();o--;r.push(0));r.reverse()}for(o=f.length,n=l.length,0>o-n&&(r=l,l=f,f=r,n=o),o=0;n;)o=(f[--n]=f[n]+l[n]+o)/N|0,f[n]%=N;return o&&(f.unshift(o),++s),I(e,f,s)},T.precision=T.sd=function(e){var n,t,r=this,i=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(j&&L(13,"argument"+w,e),e!=!!e&&(e=null)),!i)return null;if(t=i.length-1,n=t*y+1,t=i[t]){for(;t%10==0;t/=10,n--);for(t=i[0];t>=10;t/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},T.round=function(e,n){var t=new a(this);return(null==e||H(e,0,E,15))&&U(t,~~e+this.e+1,null!=n&&H(n,0,8,15,v)?0|n:k),t},T.shift=function(e){var n=this;return H(e,-S,S,16,"argument")?n.times("1e"+c(e)):new a(n.c&&n.c[0]&&(-S>e||e>S)?n.s*(0>e?0:1/0):n)},T.squareRoot=T.sqrt=function(){var e,n,i,o,u,s=this,f=s.c,l=s.s,c=s.e,h=P+4,g=new a("0.5");if(1!==l||!f||!f[0])return new a(!l||0>l&&(!f||f[0])?0/0:f?s:1/0);if(l=Math.sqrt(+s),0==l||l==1/0?(n=r(f),(n.length+c)%2==0&&(n+="0"),l=Math.sqrt(n),c=t((c+1)/2)-(0>c||c%2),l==1/0?n="1e"+c:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+c),i=new a(n)):i=new a(l+""),i.c[0])for(c=i.e,l=c+h,3>l&&(l=0);;)if(u=i,i=g.times(u.plus(C(s,u,h,1))),r(u.c).slice(0,l)===(n=r(i.c)).slice(0,l)){if(i.e<c&&--l,n=n.slice(l-3,l+1),"9999"!=n&&(o||"4999"!=n)){(!+n||!+n.slice(1)&&"5"==n.charAt(0))&&(U(i,i.e+P+2,1),e=!i.times(i).eq(s));break}if(!o&&(U(u,u.e+P+2,0),u.times(u).eq(s))){i=u;break}h+=4,l+=4,o=1}return U(i,i.e+P+1,k,e)},T.times=T.mul=function(e,n){var r,i,o,u,s,f,l,c,h,g,p,d,m,w,v,b=this,O=b.c,S=(M=17,e=new a(e,n)).c;if(!(O&&S&&O[0]&&S[0]))return!b.s||!e.s||O&&!O[0]&&!S||S&&!S[0]&&!O?e.c=e.e=e.s=null:(e.s*=b.s,O&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=t(b.e/y)+t(e.e/y),e.s*=b.s,l=O.length,g=S.length,g>l&&(m=O,O=S,S=m,o=l,l=g,g=o),o=l+g,m=[];o--;m.push(0));for(w=N,v=A,o=g;--o>=0;){for(r=0,p=S[o]%v,d=S[o]/v|0,s=l,u=o+s;u>o;)c=O[--s]%v,h=O[s]/v|0,f=d*c+h*p,c=p*c+f%v*v+m[u]+r,r=(c/w|0)+(f/v|0)+d*h,m[u--]=c%w;m[u]=r}return r?++i:m.shift(),I(e,m,i)},T.toDigits=function(e,n){var t=new a(this);return e=null!=e&&H(e,1,E,18,"precision")?0|e:null,n=null!=n&&H(n,0,8,18,v)?0|n:k,e?U(t,e,n):t},T.toExponential=function(e,n){return _(this,null!=e&&H(e,0,E,19)?~~e+1:null,n,19)},T.toFixed=function(e,n){return _(this,null!=e&&H(e,0,E,20)?~~e+this.e+1:null,n,20)},T.toFormat=function(e,n){var t=_(this,null!=e&&H(e,0,E,21)?~~e+this.e+1:null,n,21);if(this.c){var r,i=t.split("."),o=+X.groupSize,u=+X.secondaryGroupSize,s=X.groupSeparator,f=i[0],l=i[1],c=this.s<0,a=c?f.slice(1):f,h=a.length;if(u&&(r=o,o=u,u=r,h-=r),o>0&&h>0){for(r=h%o||o,f=a.substr(0,r);h>r;r+=o)f+=s+a.substr(r,o);u>0&&(f+=s+a.slice(r)),c&&(f="-"+f)}t=l?f+X.decimalSeparator+((u=+X.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+X.fractionGroupSeparator):l):f}return t},T.toFraction=function(e){var n,t,i,o,u,s,f,l,c,h=j,g=this,p=g.c,d=new a(q),m=t=new a(q),w=f=new a(q);if(null!=e&&(j=!1,s=new a(e),j=h,(!(h=s.isInt())||s.lt(q))&&(j&&L(22,"max denominator "+(h?"out of range":"not an integer"),e),e=!h&&s.c&&U(s,s.e+1,1).gte(q)?s:null)),!p)return g.toString();for(c=r(p),o=d.e=c.length-g.e-1,d.c[0]=R[(u=o%y)<0?y+u:u],e=!e||s.cmp(d)>0?o>0?d:m:s,u=z,z=1/0,s=new a(c),f.c[0]=0;l=C(s,d,0,1),i=t.plus(l.times(w)),1!=i.cmp(e);)t=w,w=i,m=f.plus(l.times(i=m)),f=i,d=s.minus(l.times(i=d)),s=i;return i=C(e.minus(t),w,0,1),f=f.plus(i.times(m)),t=t.plus(i.times(w)),f.s=m.s=g.s,o*=2,n=C(m,w,o,k).minus(g).abs().cmp(C(f,t,o,k).minus(g).abs())<1?[m.toString(),w.toString()]:[f.toString(),t.toString()],z=u,n},T.toNumber=function(){var e=this;return+e||(e.s?0*e.s:0/0)},T.toPower=T.pow=function(e){var n,t,r=m(0>e?-e:+e),i=this;if(!H(e,-S,S,23,"exponent")&&(!isFinite(e)||r>S&&(e/=0)||parseFloat(e)!=e&&!(e=0/0)))return new a(Math.pow(+i,e));for(n=J?d(J/y+2):0,t=new a(q);;){if(r%2){if(t=t.times(i),!t.c)break;n&&t.c.length>n&&(t.c.length=n)}if(r=m(r/2),!r)break;i=i.times(i),n&&i.c&&i.c.length>n&&(i.c.length=n)}return 0>e&&(t=q.div(t)),n?U(t,J,k):t},T.toPrecision=function(e,n){return _(this,null!=e&&H(e,1,E,24,"precision")?0|e:null,n,24)},T.toString=function(e){var n,t=this,i=t.s,o=t.e;return null===o?i?(n="Infinity",0>i&&(n="-"+n)):n="NaN":(n=r(t.c),n=null!=e&&H(e,2,64,25,"base")?D(l(n,o),0|e,10,i):B>=o||o>=$?f(n,o):l(n,o),0>i&&t.c[0]&&(n="-"+n)),n},T.truncated=T.trunc=function(){return U(new a(this),this.e+1,1)},T.valueOf=T.toJSON=function(){return this.toString()},null!=e&&a.config(e),a}function t(e){var n=0|e;return e>0||e===n?n:n-1}function r(e){for(var n,t,r=1,i=e.length,o=e[0]+"";i>r;){for(n=e[r++]+"",t=y-n.length;t--;n="0"+n);o+=n}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,n){var t,r,i=e.c,o=n.c,u=e.s,s=n.s,f=e.e,l=n.e;if(!u||!s)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-s:u;if(u!=s)return u;if(t=0>u,r=f==l,!i||!o)return r?0:!i^t?1:-1;if(!r)return f>l^t?1:-1;for(s=(f=i.length)<(l=o.length)?f:l,u=0;s>u;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return f==l?0:f>l^t?1:-1}function o(e,n,t){return(e=c(e))>=n&&t>=e}function u(e){return"[object Array]"==Object.prototype.toString.call(e)}function s(e,n,t){for(var r,i,o=[0],u=0,s=e.length;s>u;){for(i=o.length;i--;o[i]*=n);for(o[r=0]+=O.indexOf(e.charAt(u++));r<o.length;r++)o[r]>t-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function f(e,n){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>n?"e":"e+")+n}function l(e,n){var t,r;if(0>n){for(r="0.";++n;r+="0");e=r+e}else if(t=e.length,++n>t){for(r="0",n-=t;--n;r+="0");e+=r}else t>n&&(e=e.slice(0,n)+"."+e.slice(n));return e}function c(e){return e=parseFloat(e),0>e?d(e):m(e)}var a,h,g,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=Math.ceil,m=Math.floor,w=" not a boolean or binary digit",v="rounding mode",b="number type has more than 15 significant digits",O="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",N=1e14,y=14,S=9007199254740991,R=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],A=1e7,E=1e9;if(a=n(),"function"==typeof define&&define.amd)define(function(){return a});else if("undefined"!=typeof module&&module.exports){if(module.exports=a,!h)try{h=require("crypto")}catch(D){}}else e.BigNumber=a}(this);
//# sourceMappingURL=doc/bignumber.js.map`
//# sourceMappingURL=doc/bignumber.js.map
This source diff could not be displayed because it is too large. You can view the blob instead.
// Copyright 2017 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// Package deps contains the console JavaScript dependencies Go embedded.
package deps
//go:generate go-bindata -o bindata.go bignumber.js web3.js
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package jsre
const Web3_JS = `
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
module.exports=[
{
......@@ -439,6 +420,7 @@ module.exports=[
],
"name": "deposit",
"outputs": [],
"payable": true,
"type": "function"
},
{
......@@ -557,13 +539,8 @@ SolidityTypeAddress.prototype.isType = function (name) {
return !!name.match(/address(\[([0-9]*)\])?/);
};
SolidityTypeAddress.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
module.exports = SolidityTypeAddress;
},{"./formatters":9,"./type":14}],5:[function(require,module,exports){
var f = require('./formatters');
var SolidityType = require('./type');
......@@ -590,10 +567,6 @@ SolidityTypeBool.prototype.isType = function (name) {
return !!name.match(/^bool(\[([0-9]*)\])*$/);
};
SolidityTypeBool.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
module.exports = SolidityTypeBool;
},{"./formatters":9,"./type":14}],6:[function(require,module,exports){
......@@ -601,7 +574,7 @@ var f = require('./formatters');
var SolidityType = require('./type');
/**
* SolidityTypeBytes is a prootype that represents bytes type
* SolidityTypeBytes is a prototype that represents the bytes type.
* It matches:
* bytes
* bytes[]
......@@ -610,11 +583,8 @@ var SolidityType = require('./type');
* bytes[3][]
* bytes[][6][], ...
* bytes32
* bytes64[]
* bytes8[4]
* bytes256[][]
* bytes[3][]
* bytes64[][6][], ...
*/
var SolidityTypeBytes = function () {
this._inputFormatter = f.formatInputBytes;
......@@ -628,12 +598,6 @@ SolidityTypeBytes.prototype.isType = function (name) {
return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/);
};
SolidityTypeBytes.prototype.staticPartLength = function (name) {
var matches = name.match(/^bytes([0-9]*)/);
var size = parseInt(matches[1]);
return size * this.staticArrayLength(name);
};
module.exports = SolidityTypeBytes;
},{"./formatters":9,"./type":14}],7:[function(require,module,exports){
......@@ -671,6 +635,11 @@ var SolidityTypeReal = require('./real');
var SolidityTypeUReal = require('./ureal');
var SolidityTypeBytes = require('./bytes');
var isDynamic = function (solidityType, type) {
return solidityType.isDynamicType(type) ||
solidityType.isDynamicArray(type);
};
/**
* SolidityCoder prototype should be used to encode/decode solidity params of any type
*/
......@@ -728,7 +697,10 @@ SolidityCoder.prototype.encodeParams = function (types, params) {
var dynamicOffset = solidityTypes.reduce(function (acc, solidityType, index) {
var staticPartLength = solidityType.staticPartLength(types[index]);
var roundedStaticPartLength = Math.floor((staticPartLength + 31) / 32) * 32;
return acc + roundedStaticPartLength;
return acc + (isDynamic(solidityTypes[index], types[index]) ?
32 :
roundedStaticPartLength);
}, 0);
var result = this.encodeMultiWithOffset(types, solidityTypes, encodeds, dynamicOffset);
......@@ -740,12 +712,8 @@ SolidityCoder.prototype.encodeMultiWithOffset = function (types, solidityTypes,
var result = "";
var self = this;
var isDynamic = function (i) {
return solidityTypes[i].isDynamicArray(types[i]) || solidityTypes[i].isDynamicType(types[i]);
};
types.forEach(function (type, i) {
if (isDynamic(i)) {
if (isDynamic(solidityTypes[i], types[i])) {
result += f.formatInputInt(dynamicOffset).encode();
var e = self.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
dynamicOffset += e.length / 2;
......@@ -758,7 +726,7 @@ SolidityCoder.prototype.encodeMultiWithOffset = function (types, solidityTypes,
});
types.forEach(function (type, i) {
if (isDynamic(i)) {
if (isDynamic(solidityTypes[i], types[i])) {
var e = self.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
dynamicOffset += e.length / 2;
result += e;
......@@ -897,7 +865,6 @@ var coder = new SolidityCoder([
module.exports = coder;
},{"./address":4,"./bool":5,"./bytes":6,"./dynamicbytes":8,"./formatters":9,"./int":10,"./real":12,"./string":13,"./uint":15,"./ureal":16}],8:[function(require,module,exports){
var f = require('./formatters');
var SolidityType = require('./type');
......@@ -914,17 +881,12 @@ SolidityTypeDynamicBytes.prototype.isType = function (name) {
return !!name.match(/^bytes(\[([0-9]*)\])*$/);
};
SolidityTypeDynamicBytes.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
SolidityTypeDynamicBytes.prototype.isDynamicType = function () {
return true;
};
module.exports = SolidityTypeDynamicBytes;
},{"./formatters":9,"./type":14}],9:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -965,7 +927,7 @@ var SolidityParam = require('./param');
*/
var formatInputInt = function (value) {
BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE);
var result = utils.padLeft(utils.toTwosComplement(value).round().toString(16), 64);
var result = utils.padLeft(utils.toTwosComplement(value).toString(16), 64);
return new SolidityParam(result);
};
......@@ -1116,10 +1078,13 @@ var formatOutputBool = function (param) {
*
* @method formatOutputBytes
* @param {SolidityParam} left-aligned hex representation of string
* @param {String} name type name
* @returns {String} hex string
*/
var formatOutputBytes = function (param) {
return '0x' + param.staticPart();
var formatOutputBytes = function (param, name) {
var matches = name.match(/^bytes([0-9]*)/);
var size = parseInt(matches[1]);
return '0x' + param.staticPart().slice(0, 2 * size);
};
/**
......@@ -1176,7 +1141,6 @@ module.exports = {
formatOutputAddress: formatOutputAddress
};
},{"../utils/config":18,"../utils/utils":20,"./param":11,"bignumber.js":"bignumber.js"}],10:[function(require,module,exports){
var f = require('./formatters');
var SolidityType = require('./type');
......@@ -1209,10 +1173,6 @@ SolidityTypeInt.prototype.isType = function (name) {
return !!name.match(/^int([0-9]*)?(\[([0-9]*)\])*$/);
};
SolidityTypeInt.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
module.exports = SolidityTypeInt;
},{"./formatters":9,"./type":14}],11:[function(require,module,exports){
......@@ -1401,10 +1361,6 @@ SolidityTypeReal.prototype.isType = function (name) {
return !!name.match(/real([0-9]*)?(\[([0-9]*)\])?/);
};
SolidityTypeReal.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
module.exports = SolidityTypeReal;
},{"./formatters":9,"./type":14}],13:[function(require,module,exports){
......@@ -1423,17 +1379,12 @@ SolidityTypeString.prototype.isType = function (name) {
return !!name.match(/^string(\[([0-9]*)\])*$/);
};
SolidityTypeString.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
SolidityTypeString.prototype.isDynamicType = function () {
return true;
};
module.exports = SolidityTypeString;
},{"./formatters":9,"./type":14}],14:[function(require,module,exports){
var f = require('./formatters');
var SolidityParam = require('./param');
......@@ -1465,7 +1416,16 @@ SolidityType.prototype.isType = function (name) {
* @return {Number} length of static part in bytes
*/
SolidityType.prototype.staticPartLength = function (name) {
throw "this method should be overrwritten for type: " + name;
// If name isn't an array then treat it like a single element array.
return (this.nestedTypes(name) || ['[1]'])
.map(function (type) {
// the length of the nested array
return parseInt(type.slice(1, -1), 10) || 1;
})
.reduce(function (previous, current) {
return previous * current;
// all basic types are 32 bytes long
}, 32);
};
/**
......@@ -1670,13 +1630,14 @@ SolidityType.prototype.decode = function (bytes, offset, name) {
var dynamicOffset = parseInt('0x' + bytes.substr(offset * 2, 64)); // in bytes
var length = parseInt('0x' + bytes.substr(dynamicOffset * 2, 64)); // in bytes
var roundedLength = Math.floor((length + 31) / 32); // in int
return self._outputFormatter(new SolidityParam(bytes.substr(dynamicOffset * 2, ( 1 + roundedLength) * 64), 0));
var param = new SolidityParam(bytes.substr(dynamicOffset * 2, ( 1 + roundedLength) * 64), 0);
return self._outputFormatter(param, name);
})();
}
var length = this.staticPartLength(name);
return this._outputFormatter(new SolidityParam(bytes.substr(offset * 2, length * 2)));
var param = new SolidityParam(bytes.substr(offset * 2, length * 2));
return this._outputFormatter(param, name);
};
module.exports = SolidityType;
......@@ -1713,10 +1674,6 @@ SolidityTypeUInt.prototype.isType = function (name) {
return !!name.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/);
};
SolidityTypeUInt.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
module.exports = SolidityTypeUInt;
},{"./formatters":9,"./type":14}],16:[function(require,module,exports){
......@@ -1751,10 +1708,6 @@ SolidityTypeUReal.prototype.isType = function (name) {
return !!name.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/);
};
SolidityTypeUReal.prototype.staticPartLength = function (name) {
return 32 * this.staticArrayLength(name);
};
module.exports = SolidityTypeUReal;
},{"./formatters":9,"./type":14}],17:[function(require,module,exports){
......@@ -1889,7 +1842,7 @@ module.exports = function (value, options) {
};
},{"crypto-js":58,"crypto-js/sha3":79}],20:[function(require,module,exports){
},{"crypto-js":59,"crypto-js/sha3":80}],20:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -1987,7 +1940,7 @@ var padRight = function (string, chars, sign) {
};
/**
* Should be called to get utf8 from its hex representation
* Should be called to get utf8 from it's hex representation
*
* @method toUtf8
* @param {String} string in hex
......@@ -2011,7 +1964,7 @@ var toUtf8 = function(hex) {
};
/**
* Should be called to get ascii from its hex representation
* Should be called to get ascii from it's hex representation
*
* @method toAscii
* @param {String} string in hex
......@@ -2109,7 +2062,7 @@ var extractTypeName = function (name) {
};
/**
* Converts value to its decimal representation in string
* Converts value to it's decimal representation in string
*
* @method toDecimal
* @param {String|Number|BigNumber}
......@@ -2120,7 +2073,7 @@ var toDecimal = function (value) {
};
/**
* Converts value to its hex representation
* Converts value to it's hex representation
*
* @method fromDecimal
* @param {String|Number|BigNumber}
......@@ -2134,7 +2087,7 @@ var fromDecimal = function (value) {
};
/**
* Auto converts any given value into its hex representation.
* Auto converts any given value into it's hex representation.
*
* And even stringifys objects before.
*
......@@ -2267,7 +2220,7 @@ var toBigNumber = function(number) {
* @return {BigNumber}
*/
var toTwosComplement = function (number) {
var bigNumber = toBigNumber(number);
var bigNumber = toBigNumber(number).round();
if (bigNumber.lessThan(0)) {
return new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).plus(bigNumber).plus(1);
}
......@@ -2278,7 +2231,7 @@ var toTwosComplement = function (number) {
* Checks if the given string is strictly an address
*
* @method isStrictAddress
* @param {String} address the given HEX address
* @param {String} address the given HEX adress
* @return {Boolean}
*/
var isStrictAddress = function (address) {
......@@ -2289,7 +2242,7 @@ var isStrictAddress = function (address) {
* Checks if the given string is an address
*
* @method isAddress
* @param {String} address the given HEX address
* @param {String} address the given HEX adress
* @return {Boolean}
*/
var isAddress = function (address) {
......@@ -2311,7 +2264,7 @@ var isAddress = function (address) {
* Checks if the given string is a checksummed address
*
* @method isChecksumAddress
* @param {String} address the given HEX address
* @param {String} address the given HEX adress
* @return {Boolean}
*/
var isChecksumAddress = function (address) {
......@@ -2334,7 +2287,7 @@ var isChecksumAddress = function (address) {
* Makes a checksum address
*
* @method toChecksumAddress
* @param {String} address the given HEX address
* @param {String} address the given HEX adress
* @return {String}
*/
var toChecksumAddress = function (address) {
......@@ -2356,7 +2309,7 @@ var toChecksumAddress = function (address) {
};
/**
* Transforms given string to valid 20 bytes-length address with 0x prefix
* Transforms given string to valid 20 bytes-length addres with 0x prefix
*
* @method toAddress
* @param {String} address
......@@ -2488,9 +2441,9 @@ module.exports = {
isJson: isJson
};
},{"./sha3.js":19,"bignumber.js":"bignumber.js","utf8":84}],21:[function(require,module,exports){
},{"./sha3.js":19,"bignumber.js":"bignumber.js","utf8":85}],21:[function(require,module,exports){
module.exports={
"version": "0.15.3"
"version": "0.18.1"
}
},{}],22:[function(require,module,exports){
......@@ -2528,6 +2481,7 @@ var DB = require('./web3/methods/db');
var Shh = require('./web3/methods/shh');
var Net = require('./web3/methods/net');
var Personal = require('./web3/methods/personal');
var Swarm = require('./web3/methods/swarm');
var Settings = require('./web3/settings');
var version = require('./version.json');
var utils = require('./utils/utils');
......@@ -2537,6 +2491,7 @@ var Batch = require('./web3/batch');
var Property = require('./web3/property');
var HttpProvider = require('./web3/httpprovider');
var IpcProvider = require('./web3/ipcprovider');
var BigNumber = require('bignumber.js');
......@@ -2548,6 +2503,7 @@ function Web3 (provider) {
this.shh = new Shh(this);
this.net = new Net(this);
this.personal = new Personal(this);
this.bzz = new Swarm(this);
this.settings = new Settings();
this.version = {
api: version.version
......@@ -2578,6 +2534,7 @@ Web3.prototype.reset = function (keepIsSyncing) {
this.settings = new Settings();
};
Web3.prototype.BigNumber = BigNumber;
Web3.prototype.toHex = utils.toHex;
Web3.prototype.toAscii = utils.toAscii;
Web3.prototype.toUtf8 = utils.toUtf8;
......@@ -2641,7 +2598,7 @@ Web3.prototype.createBatch = function () {
module.exports = Web3;
},{"./utils/sha3":19,"./utils/utils":20,"./version.json":21,"./web3/batch":24,"./web3/extend":28,"./web3/httpprovider":32,"./web3/iban":33,"./web3/ipcprovider":34,"./web3/methods/db":37,"./web3/methods/eth":38,"./web3/methods/net":39,"./web3/methods/personal":40,"./web3/methods/shh":41,"./web3/property":44,"./web3/requestmanager":45,"./web3/settings":46}],23:[function(require,module,exports){
},{"./utils/sha3":19,"./utils/utils":20,"./version.json":21,"./web3/batch":24,"./web3/extend":28,"./web3/httpprovider":32,"./web3/iban":33,"./web3/ipcprovider":34,"./web3/methods/db":37,"./web3/methods/eth":38,"./web3/methods/net":39,"./web3/methods/personal":40,"./web3/methods/shh":41,"./web3/methods/swarm":42,"./web3/property":45,"./web3/requestmanager":46,"./web3/settings":47,"bignumber.js":"bignumber.js"}],23:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -2731,7 +2688,7 @@ AllSolidityEvents.prototype.attachToContract = function (contract) {
module.exports = AllSolidityEvents;
},{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":29,"./formatters":30,"./methods/watches":42}],24:[function(require,module,exports){
},{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":29,"./formatters":30,"./methods/watches":43}],24:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -2786,7 +2743,7 @@ Batch.prototype.execute = function () {
}).forEach(function (result, index) {
if (requests[index].callback) {
if (!Jsonrpc.getInstance().isValidResponse(result)) {
if (!Jsonrpc.isValidResponse(result)) {
return requests[index].callback(errors.InvalidResponse(result));
}
......@@ -2907,7 +2864,7 @@ var checkForContractAddress = function(contract, callback){
// stop watching after 50 blocks (timeout)
if (count > 50) {
filter.stopWatching();
filter.stopWatching(function() {});
callbackFired = true;
if (callback)
......@@ -2927,10 +2884,10 @@ var checkForContractAddress = function(contract, callback){
if(callbackFired || !code)
return;
filter.stopWatching();
filter.stopWatching(function() {});
callbackFired = true;
if(code.length > 2) {
if(code.length > 3) {
// console.log('Contract code deployed!');
......@@ -2995,12 +2952,22 @@ var ContractFactory = function (eth, abi) {
options = args.pop();
}
if (options.value > 0) {
var constructorAbi = abi.filter(function (json) {
return json.type === 'constructor' && json.inputs.length === args.length;
})[0] || {};
if (!constructorAbi.payable) {
throw new Error('Cannot send value to non-payable constructor');
}
}
var bytes = encodeConstructorParams(this.abi, args);
options.data += bytes;
if (callback) {
// wait for the contract address and check if the code was deployed
// wait for the contract address adn check if the code was deployed
this.eth.sendTransaction(options, function (err, hash) {
if (err) {
callback(err);
......@@ -3135,10 +3102,12 @@ module.exports = {
InvalidResponse: function (result){
var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response: ' + JSON.stringify(result);
return new Error(message);
},
ConnectionTimeout: function (ms){
return new Error('CONNECTION TIMEOUT: timeout of ' + ms + ' ms achived');
}
};
},{}],27:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -3349,7 +3318,7 @@ SolidityEvent.prototype.attachToContract = function (contract) {
module.exports = SolidityEvent;
},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":29,"./formatters":30,"./methods/watches":42}],28:[function(require,module,exports){
},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":29,"./formatters":30,"./methods/watches":43}],28:[function(require,module,exports){
var formatters = require('./formatters');
var utils = require('./../utils/utils');
var Method = require('./method');
......@@ -3399,7 +3368,7 @@ var extend = function (web3) {
module.exports = extend;
},{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":44}],29:[function(require,module,exports){
},{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":45}],29:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -3480,7 +3449,7 @@ Adds the callback and sets up the methods, to iterate over the results.
@method getLogsAtStart
@param {Object} self
@param {function}
@param {funciton}
*/
var getLogsAtStart = function(self, callback){
// call getFilterLogs for the first watch callback start
......@@ -3532,7 +3501,7 @@ var pollFilter = function(self) {
};
var Filter = function (requestManager, options, methods, formatter, callback) {
var Filter = function (requestManager, options, methods, formatter, callback, filterCreationErrorCallback) {
var self = this;
var implementation = {};
methods.forEach(function (method) {
......@@ -3552,6 +3521,7 @@ var Filter = function (requestManager, options, methods, formatter, callback) {
self.callbacks.forEach(function(cb){
cb(error);
});
filterCreationErrorCallback(error);
} else {
self.filterId = id;
......@@ -3590,11 +3560,15 @@ Filter.prototype.watch = function (callback) {
return this;
};
Filter.prototype.stopWatching = function () {
Filter.prototype.stopWatching = function (callback) {
this.requestManager.stopPolling(this.filterId);
// remove filter async
this.implementation.uninstallFilter(this.filterId, function(){});
this.callbacks = [];
// remove filter async
if (callback) {
this.implementation.uninstallFilter(this.filterId, callback);
} else {
return this.implementation.uninstallFilter(this.filterId);
}
};
Filter.prototype.get = function (callback) {
......@@ -3911,12 +3885,11 @@ var outputSyncingFormatter = function(result) {
result.startingBlock = utils.toDecimal(result.startingBlock);
result.currentBlock = utils.toDecimal(result.currentBlock);
result.highestBlock = utils.toDecimal(result.highestBlock);
if (result.knownStates !== undefined) {
if (result.knownStates) {
result.knownStates = utils.toDecimal(result.knownStates);
}
if (result.pulledStates !== undefined) {
result.pulledStates = utils.toDecimal(result.pulledStates);
}
return result;
};
......@@ -3977,6 +3950,7 @@ var SolidityFunction = function (eth, json, address) {
return i.type;
});
this._constant = json.constant;
this._payable = json.payable;
this._name = utils.transformToFullName(json);
this._address = address;
};
......@@ -4055,7 +4029,17 @@ SolidityFunction.prototype.call = function () {
var self = this;
this._eth.call(payload, defaultBlock, function (error, output) {
callback(error, self.unpackOutput(output));
if (error) return callback(error, null);
var unpacked = null;
try {
unpacked = self.unpackOutput(output);
}
catch (e) {
error = e;
}
callback(error, unpacked);
});
};
......@@ -4069,6 +4053,10 @@ SolidityFunction.prototype.sendTransaction = function () {
var callback = this.extractCallback(args);
var payload = this.toPayload(args);
if (payload.value > 0 && !this._payable) {
throw new Error('Cannot send value to non-payable function');
}
if (!callback) {
return this._eth.sendTransaction(payload);
}
......@@ -4216,26 +4204,24 @@ module.exports = SolidityFunction;
var errors = require('./errors');
// workaround to use httpprovider in different envs
var XMLHttpRequest; // jshint ignore: line
// meteor server environment
if (typeof Meteor !== 'undefined' && Meteor.isServer) { // jshint ignore: line
XMLHttpRequest = Npm.require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line
// var XMLHttpRequest; // jshint ignore: line
// browser
} else if (typeof window !== 'undefined' && window.XMLHttpRequest) {
if (typeof window !== 'undefined' && window.XMLHttpRequest) {
XMLHttpRequest = window.XMLHttpRequest; // jshint ignore: line
// node
} else {
XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line
}
var XHR2 = require('xhr2'); // jshint ignore: line
/**
* HttpProvider should be used to send rpc calls over http
*/
var HttpProvider = function (host) {
var HttpProvider = function (host, timeout) {
this.host = host || 'http://localhost:8545';
this.timeout = timeout || 0;
};
/**
......@@ -4246,7 +4232,15 @@ var HttpProvider = function (host) {
* @return {XMLHttpRequest} object
*/
HttpProvider.prototype.prepareRequest = function (async) {
var request = new XMLHttpRequest();
var request;
if (async) {
request = new XHR2();
request.timeout = this.timeout;
}else {
request = new XMLHttpRequest();
}
request.open('POST', this.host, async);
request.setRequestHeader('Content-Type','application/json');
return request;
......@@ -4290,7 +4284,7 @@ HttpProvider.prototype.sendAsync = function (payload, callback) {
var request = this.prepareRequest(true);
request.onreadystatechange = function() {
if (request.readyState === 4) {
if (request.readyState === 4 && request.timeout !== 1) {
var result = request.responseText;
var error = null;
......@@ -4304,6 +4298,10 @@ HttpProvider.prototype.sendAsync = function (payload, callback) {
}
};
request.ontimeout = function() {
callback(errors.ConnectionTimeout(this.timeout));
};
try {
request.send(JSON.stringify(payload));
} catch(error) {
......@@ -4333,8 +4331,7 @@ HttpProvider.prototype.isConnected = function() {
module.exports = HttpProvider;
},{"./errors":26,"xmlhttprequest":17}],33:[function(require,module,exports){
},{"./errors":26,"xhr2":86,"xmlhttprequest":17}],33:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -4362,7 +4359,7 @@ var BigNumber = require('bignumber.js');
var padLeft = function (string, bytes) {
var result = string;
while (result.length < bytes * 2) {
result = '00' + result;
result = '0' + result;
}
return result;
};
......@@ -4792,25 +4789,13 @@ module.exports = IpcProvider;
/** @file jsonrpc.js
* @authors:
* Marek Kotewicz <marek@ethdev.com>
* Aaron Kumavis <aaron@kumavis.me>
* @date 2015
*/
var Jsonrpc = function () {
// singleton pattern
if (arguments.callee._singletonInstance) {
return arguments.callee._singletonInstance;
}
arguments.callee._singletonInstance = this;
this.messageId = 1;
};
/**
* @return {Jsonrpc} singleton
*/
Jsonrpc.getInstance = function () {
var instance = new Jsonrpc();
return instance;
// Initialize Jsonrpc as a simple object with utility functions.
var Jsonrpc = {
messageId: 0
};
/**
......@@ -4821,15 +4806,18 @@ Jsonrpc.getInstance = function () {
* @param {Array} params, an array of method params, optional
* @returns {Object} valid jsonrpc payload object
*/
Jsonrpc.prototype.toPayload = function (method, params) {
Jsonrpc.toPayload = function (method, params) {
if (!method)
console.error('jsonrpc method should be specified!');
// advance message ID
Jsonrpc.messageId++;
return {
jsonrpc: '2.0',
id: Jsonrpc.messageId,
method: method,
params: params || [],
id: this.messageId++
params: params || []
};
};
......@@ -4840,12 +4828,16 @@ Jsonrpc.prototype.toPayload = function (method, params) {
* @param {Object}
* @returns {Boolean} true if response is valid, otherwise false
*/
Jsonrpc.prototype.isValidResponse = function (response) {
return !!response &&
!response.error &&
response.jsonrpc === '2.0' &&
typeof response.id === 'number' &&
response.result !== undefined; // only undefined is not valid json object
Jsonrpc.isValidResponse = function (response) {
return Array.isArray(response) ? response.every(validateSingleMessage) : validateSingleMessage(response);
function validateSingleMessage(message){
return !!message &&
!message.error &&
message.jsonrpc === '2.0' &&
typeof message.id === 'number' &&
message.result !== undefined; // only undefined is not valid json object
}
};
/**
......@@ -4855,10 +4847,9 @@ Jsonrpc.prototype.isValidResponse = function (response) {
* @param {Array} messages, an array of objects with method (required) and params (optional) fields
* @returns {Array} batch payload
*/
Jsonrpc.prototype.toBatchPayload = function (messages) {
var self = this;
Jsonrpc.toBatchPayload = function (messages) {
return messages.map(function (message) {
return self.toPayload(message.method, message.params);
return Jsonrpc.toPayload(message.method, message.params);
});
};
......@@ -5417,6 +5408,10 @@ var properties = function () {
name: 'blockNumber',
getter: 'eth_blockNumber',
outputFormatter: utils.toDecimal
}),
new Property({
name: 'protocolVersion',
getter: 'eth_protocolVersion'
})
];
};
......@@ -5445,7 +5440,7 @@ Eth.prototype.isSyncing = function (callback) {
module.exports = Eth;
},{"../../utils/config":18,"../../utils/utils":20,"../contract":25,"../filter":29,"../formatters":30,"../iban":33,"../method":36,"../namereg":43,"../property":44,"../syncing":47,"../transfer":48,"./watches":42}],39:[function(require,module,exports){
},{"../../utils/config":18,"../../utils/utils":20,"../contract":25,"../filter":29,"../formatters":30,"../iban":33,"../method":36,"../namereg":44,"../property":45,"../syncing":48,"../transfer":49,"./watches":43}],39:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -5499,7 +5494,7 @@ var properties = function () {
module.exports = Net;
},{"../../utils/utils":20,"../property":44}],40:[function(require,module,exports){
},{"../../utils/utils":20,"../property":45}],40:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -5560,6 +5555,13 @@ var methods = function () {
inputFormatter: [formatters.inputAddressFormatter, null, null]
});
var sendTransaction = new Method({
name: 'sendTransaction',
call: 'personal_sendTransaction',
params: 2,
inputFormatter: [formatters.inputTransactionFormatter, null]
});
var lockAccount = new Method({
name: 'lockAccount',
call: 'personal_lockAccount',
......@@ -5570,6 +5572,7 @@ var methods = function () {
return [
newAccount,
unlockAccount,
sendTransaction,
lockAccount
];
};
......@@ -5586,7 +5589,7 @@ var properties = function () {
module.exports = Personal;
},{"../formatters":30,"../method":36,"../property":44}],41:[function(require,module,exports){
},{"../formatters":30,"../method":36,"../property":45}],41:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -5674,7 +5677,154 @@ var methods = function () {
module.exports = Shh;
},{"../filter":29,"../formatters":30,"../method":36,"./watches":42}],42:[function(require,module,exports){
},{"../filter":29,"../formatters":30,"../method":36,"./watches":43}],42:[function(require,module,exports){
/*
This file is part of web3.js.
web3.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
web3.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file bzz.js
* @author Alex Beregszaszi <alex@rtfs.hu>
* @date 2016
*
* Reference: https://github.com/ethereum/go-ethereum/blob/swarm/internal/web3ext/web3ext.go#L33
*/
"use strict";
var Method = require('../method');
var Property = require('../property');
function Swarm(web3) {
this._requestManager = web3._requestManager;
var self = this;
methods().forEach(function(method) {
method.attachToObject(self);
method.setRequestManager(self._requestManager);
});
properties().forEach(function(p) {
p.attachToObject(self);
p.setRequestManager(self._requestManager);
});
}
var methods = function () {
var blockNetworkRead = new Method({
name: 'blockNetworkRead',
call: 'bzz_blockNetworkRead',
params: 1,
inputFormatter: [null]
});
var syncEnabled = new Method({
name: 'syncEnabled',
call: 'bzz_syncEnabled',
params: 1,
inputFormatter: [null]
});
var swapEnabled = new Method({
name: 'swapEnabled',
call: 'bzz_swapEnabled',
params: 1,
inputFormatter: [null]
});
var download = new Method({
name: 'download',
call: 'bzz_download',
params: 2,
inputFormatter: [null, null]
});
var upload = new Method({
name: 'upload',
call: 'bzz_upload',
params: 2,
inputFormatter: [null, null]
});
var retrieve = new Method({
name: 'retrieve',
call: 'bzz_retrieve',
params: 1,
inputFormatter: [null]
});
var store = new Method({
name: 'store',
call: 'bzz_store',
params: 2,
inputFormatter: [null, null]
});
var get = new Method({
name: 'get',
call: 'bzz_get',
params: 1,
inputFormatter: [null]
});
var put = new Method({
name: 'put',
call: 'bzz_put',
params: 2,
inputFormatter: [null, null]
});
var modify = new Method({
name: 'modify',
call: 'bzz_modify',
params: 4,
inputFormatter: [null, null, null, null]
});
return [
blockNetworkRead,
syncEnabled,
swapEnabled,
download,
upload,
retrieve,
store,
get,
put,
modify
];
};
var properties = function () {
return [
new Property({
name: 'hive',
getter: 'bzz_hive'
}),
new Property({
name: 'info',
getter: 'bzz_info'
})
];
};
module.exports = Swarm;
},{"../method":36,"../property":45}],43:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -5790,7 +5940,7 @@ module.exports = {
};
},{"../method":36}],43:[function(require,module,exports){
},{"../method":36}],44:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -5831,7 +5981,7 @@ module.exports = {
};
},{"../contracts/GlobalRegistrar.json":1,"../contracts/ICAPRegistrar.json":2}],44:[function(require,module,exports){
},{"../contracts/GlobalRegistrar.json":1,"../contracts/ICAPRegistrar.json":2}],45:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -5889,7 +6039,7 @@ Property.prototype.formatInput = function (arg) {
* @return {Object}
*/
Property.prototype.formatOutput = function (result) {
return this.outputFormatter && result !== null ? this.outputFormatter(result) : result;
return this.outputFormatter && result !== null && result !== undefined ? this.outputFormatter(result) : result;
};
/**
......@@ -5977,7 +6127,7 @@ Property.prototype.request = function () {
module.exports = Property;
},{"../utils/utils":20}],45:[function(require,module,exports){
},{"../utils/utils":20}],46:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -6034,10 +6184,10 @@ RequestManager.prototype.send = function (data) {
return null;
}
var payload = Jsonrpc.getInstance().toPayload(data.method, data.params);
var payload = Jsonrpc.toPayload(data.method, data.params);
var result = this.provider.send(payload);
if (!Jsonrpc.getInstance().isValidResponse(result)) {
if (!Jsonrpc.isValidResponse(result)) {
throw errors.InvalidResponse(result);
}
......@@ -6056,13 +6206,13 @@ RequestManager.prototype.sendAsync = function (data, callback) {
return callback(errors.InvalidProvider());
}
var payload = Jsonrpc.getInstance().toPayload(data.method, data.params);
var payload = Jsonrpc.toPayload(data.method, data.params);
this.provider.sendAsync(payload, function (err, result) {
if (err) {
return callback(err);
}
if (!Jsonrpc.getInstance().isValidResponse(result)) {
if (!Jsonrpc.isValidResponse(result)) {
return callback(errors.InvalidResponse(result));
}
......@@ -6082,7 +6232,7 @@ RequestManager.prototype.sendBatch = function (data, callback) {
return callback(errors.InvalidProvider());
}
var payload = Jsonrpc.getInstance().toBatchPayload(data);
var payload = Jsonrpc.toBatchPayload(data);
this.provider.sendAsync(payload, function (err, results) {
if (err) {
......@@ -6197,7 +6347,7 @@ RequestManager.prototype.poll = function () {
return;
}
var payload = Jsonrpc.getInstance().toBatchPayload(pollsData);
var payload = Jsonrpc.toBatchPayload(pollsData);
// map the request id to they poll id
var pollsIdMap = {};
......@@ -6230,7 +6380,7 @@ RequestManager.prototype.poll = function () {
}).filter(function (result) {
return !!result;
}).filter(function (result) {
var valid = Jsonrpc.getInstance().isValidResponse(result);
var valid = Jsonrpc.isValidResponse(result);
if (!valid) {
result.callback(errors.InvalidResponse(result));
}
......@@ -6244,7 +6394,7 @@ RequestManager.prototype.poll = function () {
module.exports = RequestManager;
},{"../utils/config":18,"../utils/utils":20,"./errors":26,"./jsonrpc":35}],46:[function(require,module,exports){
},{"../utils/config":18,"../utils/utils":20,"./errors":26,"./jsonrpc":35}],47:[function(require,module,exports){
var Settings = function () {
......@@ -6255,7 +6405,7 @@ var Settings = function () {
module.exports = Settings;
},{}],47:[function(require,module,exports){
},{}],48:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -6350,7 +6500,7 @@ IsSyncing.prototype.stopWatching = function () {
module.exports = IsSyncing;
},{"../utils/utils":20,"./formatters":30}],48:[function(require,module,exports){
},{"../utils/utils":20,"./formatters":30}],49:[function(require,module,exports){
/*
This file is part of web3.js.
......@@ -6429,7 +6579,7 @@ var transferToAddress = function (eth, from, to, value, callback) {
* @method deposit
* @param {String} from
* @param {String} to
* @param {Value} value to be transferred
* @param {Value} value to be transfered
* @param {String} client unique identifier
* @param {Function} callback, callback
*/
......@@ -6444,9 +6594,9 @@ var deposit = function (eth, from, to, value, client, callback) {
module.exports = transfer;
},{"../contracts/SmartExchange.json":3,"./iban":33}],49:[function(require,module,exports){
},{"../contracts/SmartExchange.json":3,"./iban":33}],50:[function(require,module,exports){
},{}],50:[function(require,module,exports){
},{}],51:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -6540,13 +6690,18 @@ module.exports = transfer;
*/
var AES = C_algo.AES = BlockCipher.extend({
_doReset: function () {
// Skip reset of nRounds has been set before and key did not change
if (this._nRounds && this._keyPriorReset === this._key) {
return;
}
// Shortcuts
var key = this._key;
var key = this._keyPriorReset = this._key;
var keyWords = key.words;
var keySize = key.sigBytes / 4;
// Compute number of rounds
var nRounds = this._nRounds = keySize + 6
var nRounds = this._nRounds = keySize + 6;
// Compute number of key schedule rows
var ksRows = (nRounds + 1) * 4;
......@@ -6674,7 +6829,7 @@ module.exports = transfer;
return CryptoJS.AES;
}));
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],51:[function(require,module,exports){
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],52:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -7550,7 +7705,7 @@ module.exports = transfer;
}));
},{"./core":52}],52:[function(require,module,exports){
},{"./core":53}],53:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -7570,6 +7725,25 @@ module.exports = transfer;
* CryptoJS core components.
*/
var CryptoJS = CryptoJS || (function (Math, undefined) {
/*
* Local polyfil of Object.create
*/
var create = Object.create || (function () {
function F() {};
return function (obj) {
var subtype;
F.prototype = obj;
subtype = new F();
F.prototype = null;
return subtype;
};
}())
/**
* CryptoJS namespace.
*/
......@@ -7584,7 +7758,7 @@ module.exports = transfer;
* Base object for prototypal inheritance.
*/
var Base = C_lib.Base = (function () {
function F() {}
return {
/**
......@@ -7607,8 +7781,7 @@ module.exports = transfer;
*/
extend: function (overrides) {
// Spawn
F.prototype = this;
var subtype = new F();
var subtype = create(this);
// Augment
if (overrides) {
......@@ -7616,7 +7789,7 @@ module.exports = transfer;
}
// Create default initializer
if (!subtype.hasOwnProperty('init')) {
if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
subtype.init = function () {
subtype.$super.init.apply(this, arguments);
};
......@@ -8293,7 +8466,7 @@ module.exports = transfer;
return CryptoJS;
}));
},{}],53:[function(require,module,exports){
},{}],54:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -8384,40 +8557,52 @@ module.exports = transfer;
// Shortcuts
var base64StrLength = base64Str.length;
var map = this._map;
var reverseMap = this._reverseMap;
if (!reverseMap) {
reverseMap = this._reverseMap = [];
for (var j = 0; j < map.length; j++) {
reverseMap[map.charCodeAt(j)] = j;
}
}
// Ignore padding
var paddingChar = map.charAt(64);
if (paddingChar) {
var paddingIndex = base64Str.indexOf(paddingChar);
if (paddingIndex != -1) {
if (paddingIndex !== -1) {
base64StrLength = paddingIndex;
}
}
// Convert
return parseLoop(base64Str, base64StrLength, reverseMap);
},
_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
};
function parseLoop(base64Str, base64StrLength, reverseMap) {
var words = [];
var nBytes = 0;
for (var i = 0; i < base64StrLength; i++) {
if (i % 4) {
var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2);
var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2);
var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
nBytes++;
}
}
return WordArray.create(words, nBytes);
},
_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
};
}
}());
return CryptoJS.enc.Base64;
}));
},{"./core":52}],54:[function(require,module,exports){
},{"./core":53}],55:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -8567,7 +8752,7 @@ module.exports = transfer;
return CryptoJS.enc.Utf16;
}));
},{"./core":52}],55:[function(require,module,exports){
},{"./core":53}],56:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -8700,7 +8885,7 @@ module.exports = transfer;
return CryptoJS.EvpKDF;
}));
},{"./core":52,"./hmac":57,"./sha1":76}],56:[function(require,module,exports){
},{"./core":53,"./hmac":58,"./sha1":77}],57:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -8767,7 +8952,7 @@ module.exports = transfer;
return CryptoJS.format.Hex;
}));
},{"./cipher-core":51,"./core":52}],57:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],58:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -8911,7 +9096,7 @@ module.exports = transfer;
}));
},{"./core":52}],58:[function(require,module,exports){
},{"./core":53}],59:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -8930,7 +9115,7 @@ module.exports = transfer;
return CryptoJS;
}));
},{"./aes":50,"./cipher-core":51,"./core":52,"./enc-base64":53,"./enc-utf16":54,"./evpkdf":55,"./format-hex":56,"./hmac":57,"./lib-typedarrays":59,"./md5":60,"./mode-cfb":61,"./mode-ctr":63,"./mode-ctr-gladman":62,"./mode-ecb":64,"./mode-ofb":65,"./pad-ansix923":66,"./pad-iso10126":67,"./pad-iso97971":68,"./pad-nopadding":69,"./pad-zeropadding":70,"./pbkdf2":71,"./rabbit":73,"./rabbit-legacy":72,"./rc4":74,"./ripemd160":75,"./sha1":76,"./sha224":77,"./sha256":78,"./sha3":79,"./sha384":80,"./sha512":81,"./tripledes":82,"./x64-core":83}],59:[function(require,module,exports){
},{"./aes":51,"./cipher-core":52,"./core":53,"./enc-base64":54,"./enc-utf16":55,"./evpkdf":56,"./format-hex":57,"./hmac":58,"./lib-typedarrays":60,"./md5":61,"./mode-cfb":62,"./mode-ctr":64,"./mode-ctr-gladman":63,"./mode-ecb":65,"./mode-ofb":66,"./pad-ansix923":67,"./pad-iso10126":68,"./pad-iso97971":69,"./pad-nopadding":70,"./pad-zeropadding":71,"./pbkdf2":72,"./rabbit":74,"./rabbit-legacy":73,"./rc4":75,"./ripemd160":76,"./sha1":77,"./sha224":78,"./sha256":79,"./sha3":80,"./sha384":81,"./sha512":82,"./tripledes":83,"./x64-core":84}],60:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -9007,7 +9192,7 @@ module.exports = transfer;
return CryptoJS.lib.WordArray;
}));
},{"./core":52}],60:[function(require,module,exports){
},{"./core":53}],61:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -9276,7 +9461,7 @@ module.exports = transfer;
return CryptoJS.MD5;
}));
},{"./core":52}],61:[function(require,module,exports){
},{"./core":53}],62:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9355,7 +9540,7 @@ module.exports = transfer;
return CryptoJS.mode.CFB;
}));
},{"./cipher-core":51,"./core":52}],62:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],63:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9472,7 +9657,7 @@ module.exports = transfer;
return CryptoJS.mode.CTRGladman;
}));
},{"./cipher-core":51,"./core":52}],63:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],64:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9531,7 +9716,7 @@ module.exports = transfer;
return CryptoJS.mode.CTR;
}));
},{"./cipher-core":51,"./core":52}],64:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],65:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9572,7 +9757,7 @@ module.exports = transfer;
return CryptoJS.mode.ECB;
}));
},{"./cipher-core":51,"./core":52}],65:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],66:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9627,7 +9812,7 @@ module.exports = transfer;
return CryptoJS.mode.OFB;
}));
},{"./cipher-core":51,"./core":52}],66:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],67:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9677,7 +9862,7 @@ module.exports = transfer;
return CryptoJS.pad.Ansix923;
}));
},{"./cipher-core":51,"./core":52}],67:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],68:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9722,7 +9907,7 @@ module.exports = transfer;
return CryptoJS.pad.Iso10126;
}));
},{"./cipher-core":51,"./core":52}],68:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],69:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9763,7 +9948,7 @@ module.exports = transfer;
return CryptoJS.pad.Iso97971;
}));
},{"./cipher-core":51,"./core":52}],69:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],70:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9794,7 +9979,7 @@ module.exports = transfer;
return CryptoJS.pad.NoPadding;
}));
},{"./cipher-core":51,"./core":52}],70:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],71:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9840,7 +10025,7 @@ module.exports = transfer;
return CryptoJS.pad.ZeroPadding;
}));
},{"./cipher-core":51,"./core":52}],71:[function(require,module,exports){
},{"./cipher-core":52,"./core":53}],72:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -9986,7 +10171,7 @@ module.exports = transfer;
return CryptoJS.PBKDF2;
}));
},{"./core":52,"./hmac":57,"./sha1":76}],72:[function(require,module,exports){
},{"./core":53,"./hmac":58,"./sha1":77}],73:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -10177,7 +10362,7 @@ module.exports = transfer;
return CryptoJS.RabbitLegacy;
}));
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],73:[function(require,module,exports){
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],74:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -10370,7 +10555,7 @@ module.exports = transfer;
return CryptoJS.Rabbit;
}));
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],74:[function(require,module,exports){
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],75:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -10510,7 +10695,7 @@ module.exports = transfer;
return CryptoJS.RC4;
}));
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],75:[function(require,module,exports){
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],76:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -10778,7 +10963,7 @@ module.exports = transfer;
return CryptoJS.RIPEMD160;
}));
},{"./core":52}],76:[function(require,module,exports){
},{"./core":53}],77:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -10929,7 +11114,7 @@ module.exports = transfer;
return CryptoJS.SHA1;
}));
},{"./core":52}],77:[function(require,module,exports){
},{"./core":53}],78:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -11010,7 +11195,7 @@ module.exports = transfer;
return CryptoJS.SHA224;
}));
},{"./core":52,"./sha256":78}],78:[function(require,module,exports){
},{"./core":53,"./sha256":79}],79:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -11210,7 +11395,7 @@ module.exports = transfer;
return CryptoJS.SHA256;
}));
},{"./core":52}],79:[function(require,module,exports){
},{"./core":53}],80:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -11534,7 +11719,7 @@ module.exports = transfer;
return CryptoJS.SHA3;
}));
},{"./core":52,"./x64-core":83}],80:[function(require,module,exports){
},{"./core":53,"./x64-core":84}],81:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -11618,7 +11803,7 @@ module.exports = transfer;
return CryptoJS.SHA384;
}));
},{"./core":52,"./sha512":81,"./x64-core":83}],81:[function(require,module,exports){
},{"./core":53,"./sha512":82,"./x64-core":84}],82:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -11942,7 +12127,7 @@ module.exports = transfer;
return CryptoJS.SHA512;
}));
},{"./core":52,"./x64-core":83}],82:[function(require,module,exports){
},{"./core":53,"./x64-core":84}],83:[function(require,module,exports){
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
......@@ -12713,7 +12898,7 @@ module.exports = transfer;
return CryptoJS.TripleDES;
}));
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],83:[function(require,module,exports){
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],84:[function(require,module,exports){
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
......@@ -13018,19 +13203,19 @@ module.exports = transfer;
return CryptoJS;
}));
},{"./core":52}],84:[function(require,module,exports){
/*! https://mths.be/utf8js v2.0.0 by @mathias */
},{"./core":53}],85:[function(require,module,exports){
/*! https://mths.be/utf8js v2.1.2 by @mathias */
;(function(root) {
// Detect free variables exports
// Detect free variables `exports`
var freeExports = typeof exports == 'object' && exports;
// Detect free variable module
// Detect free variable `module`
var freeModule = typeof module == 'object' && module &&
module.exports == freeExports && module;
// Detect free variable global, from Node.js or Browserified code,
// and use it as root
// Detect free variable `global`, from Node.js or Browserified code,
// and use it as `root`
var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
root = freeGlobal;
......@@ -13178,7 +13363,7 @@ module.exports = transfer;
// 2-byte sequence
if ((byte1 & 0xE0) == 0xC0) {
var byte2 = readContinuationByte();
byte2 = readContinuationByte();
codePoint = ((byte1 & 0x1F) << 6) | byte2;
if (codePoint >= 0x80) {
return codePoint;
......@@ -13205,7 +13390,7 @@ module.exports = transfer;
byte2 = readContinuationByte();
byte3 = readContinuationByte();
byte4 = readContinuationByte();
codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |
codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
(byte3 << 0x06) | byte4;
if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
return codePoint;
......@@ -13233,7 +13418,7 @@ module.exports = transfer;
/*--------------------------------------------------------------------------*/
var utf8 = {
'version': '2.0.0',
'version': '2.1.2',
'encode': utf8encode,
'decode': utf8decode
};
......@@ -13264,6 +13449,9 @@ module.exports = transfer;
}(this));
},{}],86:[function(require,module,exports){
module.exports = XMLHttpRequest;
},{}],"bignumber.js":[function(require,module,exports){
/*! bignumber.js v2.0.7 https://github.com/MikeMcl/bignumber.js/LICENCE */
......@@ -13381,10 +13569,10 @@ module.exports = transfer;
* equivalent to (a % n) in JavaScript.
* FLOOR 3 The remainder has the same sign as the divisor (Python %).
* HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.
* EUCLID 9 Euclidean division. q = sign(n) * floor(a / abs(n)).
* EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).
* The remainder is always positive.
*
* The truncated division, floored division, Euclidean division and IEEE 754 remainder
* The truncated division, floored division, Euclidian division and IEEE 754 remainder
* modes are commonly used for the modulus operation.
* Although the other rounding modes can also be used, they may not give useful results.
*/
......@@ -15002,7 +15190,7 @@ module.exports = transfer;
if ( MODULO_MODE == 9 ) {
// Euclidean division: q = sign(y) * floor(x / abs(y))
// Euclidian division: q = sign(y) * floor(x / abs(y))
// r = x - qy where 0 <= r < abs(y)
s = y.s;
y.s = 1;
......@@ -15949,7 +16137,7 @@ module.exports = transfer;
}
})(this);
},{"crypto":49}],"web3":[function(require,module,exports){
},{"crypto":50}],"web3":[function(require,module,exports){
var Web3 = require('./lib/web3');
// dont override global variable
......@@ -15961,4 +16149,3 @@ module.exports = Web3;
},{"./lib/web3":22}]},{},["web3"])
//# sourceMappingURL=web3.js.map
`
......@@ -27,9 +27,15 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/internal/jsre/deps"
"github.com/robertkrimen/otto"
)
var (
BigNumber_JS = deps.MustAsset("bignumber.js")
Web3_JS = deps.MustAsset("web3.js")
)
/*
JSRE is a generic JS runtime environment embedding the otto JS interpreter.
It provides some helper functions to
......
......@@ -535,12 +535,6 @@ web3._extend({
call: 'personal_importRawKey',
params: 2
}),
new web3._extend.Method({
name: 'sendTransaction',
call: 'personal_sendTransaction',
params: 2,
inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
}),
new web3._extend.Method({
name: 'sign',
call: 'personal_sign',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment