toAscii && fromAscii moved to utils

This commit is contained in:
Marek Kotewicz
2015-01-31 13:54:39 +01:00
parent 0b82a05a75
commit 4bdf52fc1e
7 changed files with 123 additions and 147 deletions

View File

@ -24,8 +24,7 @@ if (process.env.NODE_ENV !== 'build') {
var BigNumber = require('bignumber.js'); // jshint ignore:line
}
// TODO: remove web3 dependency from here!
var web3 = require('./web3');
var utils = require('./utils');
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_DOWN });
@ -66,7 +65,7 @@ var formatInputInt = function (value) {
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var formatInputString = function (value) {
return web3.fromAscii(value, ETH_PADDING).substr(2);
return utils.fromAscii(value, ETH_PADDING).substr(2);
};
/// Formats input value to byte representation of bool
@ -131,7 +130,7 @@ var formatOutputBool = function (value) {
/// @returns left-aligned input bytes formatted to ascii string
var formatOutputString = function (value) {
return web3.toAscii(value);
return utils.toAscii(value);
};
/// @returns right-aligned input bytes formatted to address