commit
6c160adab3
6
dist/ethereum.js
vendored
6
dist/ethereum.js
vendored
File diff suppressed because one or more lines are too long
4
dist/ethereum.js.map
vendored
4
dist/ethereum.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/ethereum.min.js
vendored
2
dist/ethereum.min.js
vendored
File diff suppressed because one or more lines are too long
@ -46,7 +46,7 @@ var findMethodIndex = function (json, methodName) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var padLeft = function (string, chars) {
|
var padLeft = function (string, chars) {
|
||||||
return Array(chars - string.length + 1).join("0") + string;
|
return new Array(chars - string.length + 1).join("0") + string;
|
||||||
};
|
};
|
||||||
|
|
||||||
var setupInputTypes = function () {
|
var setupInputTypes = function () {
|
||||||
|
@ -27,12 +27,11 @@
|
|||||||
* if it fails, it uses HttpRpcProvider
|
* if it fails, it uses HttpRpcProvider
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: work out which of the following two lines it is supposed to be...
|
// TODO: is these line is supposed to be here?
|
||||||
//if (process.env.NODE_ENV !== 'build') {
|
if (process.env.NODE_ENV !== 'build') {
|
||||||
if ("build" !== 'build') {/*
|
|
||||||
var WebSocket = require('ws'); // jshint ignore:line
|
var WebSocket = require('ws'); // jshint ignore:line
|
||||||
var web3 = require('./main.js'); // jshint ignore:line
|
var web3 = require('./main.js'); // jshint ignore:line
|
||||||
*/}
|
}
|
||||||
|
|
||||||
var AutoProvider = function (userOptions) {
|
var AutoProvider = function (userOptions) {
|
||||||
if (web3.haveProvider()) {
|
if (web3.haveProvider()) {
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
* @date 2014
|
* @date 2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: work out which of the following two lines it is supposed to be...
|
// TODO: is these line is supposed to be here?
|
||||||
//if (process.env.NODE_ENV !== 'build') {
|
if (process.env.NODE_ENV !== 'build') {
|
||||||
if ("build" !== 'build') {/*
|
|
||||||
var web3 = require('./web3'); // jshint ignore:line
|
var web3 = require('./web3'); // jshint ignore:line
|
||||||
*/}
|
}
|
||||||
|
|
||||||
var abi = require('./abi');
|
var abi = require('./abi');
|
||||||
|
|
||||||
var contract = function (address, desc) {
|
var contract = function (address, desc) {
|
||||||
|
@ -21,11 +21,10 @@
|
|||||||
* @date 2014
|
* @date 2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: work out which of the following two lines it is supposed to be...
|
// TODO: is these line is supposed to be here?
|
||||||
//if (process.env.NODE_ENV !== 'build') {
|
if (process.env.NODE_ENV !== 'build') {
|
||||||
if ("build" !== "build") {/*
|
|
||||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
||||||
*/}
|
}
|
||||||
|
|
||||||
var HttpRpcProvider = function (host) {
|
var HttpRpcProvider = function (host) {
|
||||||
this.handlers = [];
|
this.handlers = [];
|
||||||
|
10
lib/main.js
10
lib/main.js
@ -272,7 +272,7 @@ var web3 = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
toEth: function(str) {
|
toEth: function(str) {
|
||||||
var val = typeof str === "string" ? str.indexOf('0x') == 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
|
var val = typeof str === "string" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
|
||||||
var unit = 0;
|
var unit = 0;
|
||||||
var units = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ];
|
var units = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ];
|
||||||
while (val > 3000 && unit < units.length - 1)
|
while (val > 3000 && unit < units.length - 1)
|
||||||
@ -281,10 +281,14 @@ var web3 = {
|
|||||||
unit++;
|
unit++;
|
||||||
}
|
}
|
||||||
var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);
|
var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);
|
||||||
|
var replaceFunction = function($0, $1, $2) {
|
||||||
|
return $1 + ',' + $2;
|
||||||
|
};
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
var o = s;
|
var o = s;
|
||||||
s = s.replace(/(\d)(\d\d\d[\.\,])/, function($0, $1, $2) { return $1 + ',' + $2; });
|
s = s.replace(/(\d)(\d\d\d[\.\,])/, replaceFunction);
|
||||||
if (o == s)
|
if (o === s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return s + ' ' + units[unit];
|
return s + ' ' + units[unit];
|
||||||
|
@ -22,11 +22,10 @@
|
|||||||
* @date 2014
|
* @date 2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: work out which of the following two lines it is supposed to be...
|
// TODO: is these line is supposed to be here?
|
||||||
//if (process.env.NODE_ENV !== 'build') {
|
if (process.env.NODE_ENV !== 'build') {
|
||||||
if ("build" !== "build") {/*
|
|
||||||
var WebSocket = require('ws'); // jshint ignore:line
|
var WebSocket = require('ws'); // jshint ignore:line
|
||||||
*/}
|
}
|
||||||
|
|
||||||
var WebSocketProvider = function(host) {
|
var WebSocketProvider = function(host) {
|
||||||
// onmessage handlers
|
// onmessage handlers
|
||||||
|
Loading…
Reference in New Issue
Block a user