diff options
author | frankiebee <frankie.diamond@gmail.com> | 2018-04-14 04:18:45 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2018-04-14 04:18:45 +0800 |
commit | 943eea043cc40ea42ffe757a7115ccbc5585b37b (patch) | |
tree | f3023b8e6dc29bd3349e66f0a57744551e3444b5 /app/scripts/controllers/transactions/lib | |
parent | 88f4212363601b2bb3778f4090235a0a0740b4c9 (diff) | |
download | tangerine-wallet-browser-943eea043cc40ea42ffe757a7115ccbc5585b37b.tar tangerine-wallet-browser-943eea043cc40ea42ffe757a7115ccbc5585b37b.tar.gz tangerine-wallet-browser-943eea043cc40ea42ffe757a7115ccbc5585b37b.tar.bz2 tangerine-wallet-browser-943eea043cc40ea42ffe757a7115ccbc5585b37b.tar.lz tangerine-wallet-browser-943eea043cc40ea42ffe757a7115ccbc5585b37b.tar.xz tangerine-wallet-browser-943eea043cc40ea42ffe757a7115ccbc5585b37b.tar.zst tangerine-wallet-browser-943eea043cc40ea42ffe757a7115ccbc5585b37b.zip |
fix up - more docs
Diffstat (limited to 'app/scripts/controllers/transactions/lib')
-rw-r--r-- | app/scripts/controllers/transactions/lib/util.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/app/scripts/controllers/transactions/lib/util.js b/app/scripts/controllers/transactions/lib/util.js index 5d5e63c59..b18283997 100644 --- a/app/scripts/controllers/transactions/lib/util.js +++ b/app/scripts/controllers/transactions/lib/util.js @@ -11,24 +11,24 @@ module.exports = { } +// functions that handle normalizing of that key in txParams +const normalizers = { + from: from => addHexPrefix(from).toLowerCase(), + to: to => addHexPrefix(to).toLowerCase(), + nonce: nonce => addHexPrefix(nonce), + value: value => value ? addHexPrefix(value) : '0x0', + data: data => addHexPrefix(data), + gas: gas => addHexPrefix(gas), + gasPrice: gasPrice => addHexPrefix(gasPrice), +} + /** + */ function normalizeTxParams (txParams) { - // functions that handle normalizing of that key in txParams - const whiteList = { - from: from => addHexPrefix(from).toLowerCase(), - to: to => addHexPrefix(txParams.to).toLowerCase(), - nonce: nonce => addHexPrefix(nonce), - value: value => addHexPrefix(value), - data: data => addHexPrefix(data), - gas: gas => addHexPrefix(gas), - gasPrice: gasPrice => addHexPrefix(gasPrice), - } - - // apply only keys in the whiteList + // apply only keys in the normalizers const normalizedTxParams = {} - Object.keys(whiteList).forEach((key) => { - if (txParams[key]) normalizedTxParams[key] = whiteList[key](txParams[key]) - }) - + for (let key in normalizers) { + if (txParams[key]) normalizedTxParams[key] = normalizers[key](txParams[key]) + } return normalizedTxParams } |