diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-16 23:46:14 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-16 23:46:14 +0800 |
commit | e94da808cb2a9f0493b42e5e572f6aed78de5ee3 (patch) | |
tree | b39faefff3f7d981afaad79c0543992a113303d1 /dist/ethereum.js | |
parent | a1c0bb68ddd7a032843d16ed083a951588281278 (diff) | |
download | go-tangerine-e94da808cb2a9f0493b42e5e572f6aed78de5ee3.tar go-tangerine-e94da808cb2a9f0493b42e5e572f6aed78de5ee3.tar.gz go-tangerine-e94da808cb2a9f0493b42e5e572f6aed78de5ee3.tar.bz2 go-tangerine-e94da808cb2a9f0493b42e5e572f6aed78de5ee3.tar.lz go-tangerine-e94da808cb2a9f0493b42e5e572f6aed78de5ee3.tar.xz go-tangerine-e94da808cb2a9f0493b42e5e572f6aed78de5ee3.tar.zst go-tangerine-e94da808cb2a9f0493b42e5e572f6aed78de5ee3.zip |
default padding set to 32, separated to one variable
Diffstat (limited to 'dist/ethereum.js')
-rw-r--r-- | dist/ethereum.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js index 3421f76d8..e7e96d472 100644 --- a/dist/ethereum.js +++ b/dist/ethereum.js @@ -31,6 +31,8 @@ var web3 = require('./web3'); // jshint ignore:line BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_DOWN }); +var ETH_PADDING = 32; + // TODO: make these be actually accurate instead of falling back onto JS's doubles. var hexToDec = function (hex) { return parseInt(hex, 16).toString(); @@ -93,7 +95,7 @@ var setupInputTypes = function () { /// If the value is floating point, round it down /// @returns right-aligned byte representation of int var formatInt = function (value) { - var padding = 32 * 2; + var padding = ETH_PADDING * 2; if (value instanceof BigNumber || typeof value === 'number') { if (typeof value === 'number') value = new BigNumber(value); @@ -115,7 +117,7 @@ var setupInputTypes = function () { /// Formats input value to byte representation of string /// @returns left-algined byte representation of string var formatString = function (value) { - return web3.fromAscii(value, 32).substr(2); + return web3.fromAscii(value, ETH_PADDING).substr(2); }; /// Formats input value to byte representation of bool @@ -152,7 +154,7 @@ var toAbiInput = function (json, methodName, params) { } var method = json[index]; - var padding = 32 * 2; + var padding = ETH_PADDING * 2; for (var i = 0; i < method.inputs.length; i++) { var typeMatch = false; @@ -241,7 +243,7 @@ var fromAbiOutput = function (json, methodName, output) { var result = []; var method = json[index]; - var padding = 32 * 2; + var padding = ETH_PADDING * 2; for (var i = 0; i < method.outputs.length; i++) { var typeMatch = false; for (var j = 0; j < outputTypes.length && !typeMatch; j++) { |