web3.js/dist/web3.min.js

2 lines
49 KiB
JavaScript
Raw Normal View History

2015-05-08 00:55:14 -07:00
require=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};e[a][0].call(f.exports,function(t){var n=e[a][1][t];return i(n?n:t)},f,f.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("./coder"),o=t("./utils"),a=function(t,e){var n=t.map(function(t){return t.type});return i.encodeParams(n,e)},s=function(t,e){var n=t.map(function(t){return t.type});return i.decodeParams(n,e)},u=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 a(t.inputs,e)};void 0===e[n]&&(e[n]=o),e[n][i]=o}),e},c=function(t){var e={};return t.forEach(function(t){var n=r.extractDisplayName(t.name),i=r.extractTypeName(t.name),o=function(e){return s(t.outputs,e)};void 0===e[n]&&(e[n]=o),e[n][i]=o}),e},f=function(t,e){var n=o.getConstructor(t,e.length);return n?a(n.inputs,e):(e.length>0&&console.warn("didn't found matching constructor, using default one"),"")};e.exports={inputParser:u,outputParser:c,formatInput:a,formatOutput:s,formatConstructorParams:f}},{"../utils/utils":8,"./coder":2,"./utils":5}],2:[function(t,e,n){var r=t("bignumber.js"),i=t("../utils/utils"),o=t("./formatters"),a=t("./param"),s=function(t){return"[]"===t.slice(-2)},u=function(t){this._name=t.name,this._match=t.match,this._mode=t.mode,this._inputFormatter=t.inputFormatter,this._outputFormatter=t.outputFormatter};u.prototype.isType=function(t){return"strict"===this._match?this._name===t||0===t.indexOf(this._name)&&"[]"===t.slice(this._name.length):"prefix"===this._match?0===t.indexOf(this._name):void 0},u.prototype.formatInput=function(t,e){if(i.isArray(t)&&e){var n=this;return t.map(function(t){return n._inputFormatter(t)}).reduce(function(t,e){return t.appendArrayElement(e),t},o.formatInputInt(t.length).swap())}return this._inputFormatter(t)},u.prototype.formatOutput=function(t,e){if(e){for(var n=[],i=new r(t.prefix,16),o=0;64*i>o;o+=64)n.push(this._outputFormatter(new a("",t.suffix.slice(o,o+64))));return n}return this._outputFormatter(t)},u.prototype.isVariadicType=function(t){return s(t)||"bytes"===this._mode},u.prototype.shiftParam=function(t,e){if("bytes"===this._mode)return e.shiftBytes();if(s(t)){var n=new r(e.prefix.slice(0,64),16);return e.shiftArray(n)}return e.shiftValue()};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._bytesToParam=function(t,e){var n=this,r=t.filter(function(t){return n._requireType(t).isVariadicType(t)}).length,i=e.slice(0,64*r),o=e.slice(64*r);return new a(i,o)},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this;return t.map(function(t,r){return n._formatInput(t,e[r])}).reduce(function(t,e){return t.append(e),t},new a).encode()},c.prototype._formatOutput=function(t,e){return this._requireType(t).formatOutput(e,s(t))},c.prototype.decodeParam=function(t,e){return this._formatOutput(t,this._bytesToParam([t],e))},c.prototype.decodeParams=function(t,e){var n=this,r=this._bytesToParam(t,e);return t.map(function(t){var e=n._requireType(t),i=e.shiftParam(t,r);return e.formatOutput(i,s(t))})};var f=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:o.formatInputBool,outputFormatter:o.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:o.for
name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,i,o]},o=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),i=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,i]};e.exports={eth:i,shh:o}},{"./method":21}],28:[function(t,e,n){},{}],"bignumber.js":[function(t,e,n){!function(n){"use strict";function r(t){function e(t,r){var i,o,a,s,u,c,f=this;if(!(f instanceof e))return V&&k(26,"constructor call without new",t),new e(t,r);if(null!=r&&J(r,2,64,R,"base")){if(r=0|r,c=t+"",10==r)return f=new e(t instanceof e?t:c),E(f,j+f.e+1,U);if((s="number"==typeof t)&&0*t!=0||!new RegExp("^-?"+(i="["+_.slice(0,r)+"]+")+"(?:\\."+i+")?$",37>r?"i":"").test(c))return d(f,c,s,r);s?(f.s=0>1/t?(c=c.slice(1),-1):1,V&&c.replace(/^0\.0*|\./,"").length>15&&k(R,x,t),s=!1):f.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,f.s)}else{if(t instanceof e)return f.s=t.s,f.e=t.e,f.c=(t=t.c)?t.slice():t,void(R=0);if((s="number"==typeof t)&&0*t==0){if(f.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,a=t;a>=10;a/=10,o++);return f.e=o,f.c=[t],void(R=0)}c=t+""}else{if(!g.test(c=t+""))return d(f,c,s);f.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(a=c.search(/e/i))>0?(0>o&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):0>o&&(o=c.length),a=0;48===c.charCodeAt(a);a++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(a,u+1))if(u=c.length,s&&V&&u>15&&k(R,x,f.s*t),o=o-a-1,o>G)f.c=f.e=null;else if(M>o)f.c=[f.e=0];else{if(f.e=o,f.c=[],a=(o+1)%N,0>o&&(a+=N),u>a){for(a&&f.c.push(+c.slice(0,a)),u-=N;u>a;)f.c.push(+c.slice(a,a+=N));c=c.slice(a),a=N-c.length}else a-=u;for(;a--;c+="0");f.c.push(+c)}else f.c=[f.e=0];R=0}function n(t,n,r,i){var a,s,u,f,p,m,h,d=t.indexOf("."),g=j,y=U;for(37>r&&(t=t.toLowerCase()),d>=0&&(u=z,z=0,t=t.replace(".",""),h=new e(r),p=h.pow(t.length-d),z=u,h.c=c(l(o(p.c),p.e),10,n),h.e=h.c.length),m=c(t,r,n),s=u=m.length;0==m[--u];m.pop());if(!m[0])return"0";if(0>d?--s:(p.c=m,p.e=s,p.s=i,p=S(p,h,g,y,n),m=p.c,f=p.r,s=p.e),a=s+g+1,d=m[a],u=n/2,f=f||0>a||null!=m[a+1],f=4>y?(null!=d||f)&&(0==y||y==(p.s<0?3:2)):d>u||d==u&&(4==y||f||6==y&&1&m[a-1]||y==(p.s<0?8:7)),1>a||!m[0])t=f?l("1",-g):"0";else{if(m.length=a,f)for(--n;++m[--a]>n;)m[a]=0,a||(++s,m.unshift(1));for(u=m.length;!m[--u];);for(d=0,t="";u>=d;t+=_.charAt(m[d++]));t=l(t,s)}return t}function m(t,n,r,i){var a,s,u,c,p;if(r=null!=r&&J(r,0,8,i,b)?0|r:U,!t.c)return t.toString();if(a=t.c[0],u=t.e,null==n)p=o(t.c),p=19==i||24==i&&H>=u?f(p,u):l(p,u);else if(t=E(new e(t),n,r),s=t.e,p=o(t.c),c=p.length,19==i||24==i&&(s>=n||H>=s)){for(;n>c;p+="0",c++);p=f(p,s)}else if(n-=u,p=l(p,s),s+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=s-c,n>0)for(s+1==c&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function A(t,n){var r,i,o=0;for(u(t[0])&&(t=t[0]),r=new e(t[0]);++o<t.length;){if(i=new e(t[o]),!i.s){r=i;break}n.call(r,i)&&(r=i)}return r}function D(t,e,n,r,i){return(e>t||t>n||t!=p(t))&&k(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function P(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*N-1)>G?t.c=t.e=null:M>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function k(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 E(t,e,n,r){var i,o,a,s,u,c,f,l=t.c,p=O;if(l){t:{for(i=1,s=l[0];s>=10;s/=10,i++);if(o=e-i,0>o)o+=N,a=e,u=l[c=0],f=u/p[i-a-1]%10|0;else if(c=y((o+1)/N),c>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));u=f=0,i=1,o%=N,a=o-N+1}else{for(u=s=l[c],i=1;s>=10;s/=10,i++);o%=N,a=o-N+i,f=0>a?0:u/p[i-a-1]%10|0}if(r=r||0>e||null!=l[c+1]||(0>a?u:u%p[i-a-1]),r=4>n?(f||r)&&(0==n||n==(t.s<0?3:2)):f>5||5==f&&(4==n||r||6==n&&(o>0?a>0?u/p[i-a]:0:l[c-1])%10&1||n==(t.