aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-12-07 23:21:55 +0800
committerFabio Berger <me@fabioberger.com>2018-12-07 23:24:01 +0800
commit84f1d1107ab5b723d4dc176945d6778a6c91dafd (patch)
tree6e747cd44aa2a2b25f89e67aa5ad31d629df7675 /packages
parentc0637a744b0cdd4bc13771d5c23760854f43cf44 (diff)
downloaddexon-sol-tools-84f1d1107ab5b723d4dc176945d6778a6c91dafd.tar
dexon-sol-tools-84f1d1107ab5b723d4dc176945d6778a6c91dafd.tar.gz
dexon-sol-tools-84f1d1107ab5b723d4dc176945d6778a6c91dafd.tar.bz2
dexon-sol-tools-84f1d1107ab5b723d4dc176945d6778a6c91dafd.tar.lz
dexon-sol-tools-84f1d1107ab5b723d4dc176945d6778a6c91dafd.tar.xz
dexon-sol-tools-84f1d1107ab5b723d4dc176945d6778a6c91dafd.tar.zst
dexon-sol-tools-84f1d1107ab5b723d4dc176945d6778a6c91dafd.zip
fix: txData returned so that `value` and `gasPrice` are BigNumbers to avoid precision errors
Diffstat (limited to 'packages')
-rw-r--r--packages/web3-wrapper/CHANGELOG.json8
-rw-r--r--packages/web3-wrapper/src/marshaller.ts8
2 files changed, 12 insertions, 4 deletions
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json
index 9f5194e0d..cb7cc16e5 100644
--- a/packages/web3-wrapper/CHANGELOG.json
+++ b/packages/web3-wrapper/CHANGELOG.json
@@ -1,5 +1,13 @@
[
{
+ "version": "3.2.0",
+ "changes": [
+ {
+ "note": "Return `value` and `gasPrice` as BigNumbers to avoid loss of precision errors"
+ }
+ ]
+ },
+ {
"version": "3.1.6",
"changes": [
{
diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts
index 7bd274c85..b368695bd 100644
--- a/packages/web3-wrapper/src/marshaller.ts
+++ b/packages/web3-wrapper/src/marshaller.ts
@@ -1,4 +1,4 @@
-import { addressUtils } from '@0x/utils';
+import { addressUtils, BigNumber } from '@0x/utils';
import {
BlockParam,
BlockParamLiteral,
@@ -120,10 +120,10 @@ export const marshaller = {
}
const txData = {
...txDataRpc,
- value: !_.isUndefined(txDataRpc.value) ? utils.convertHexToNumber(txDataRpc.value) : undefined,
+ value: !_.isUndefined(txDataRpc.value) ? utils.convertAmountToBigNumber(txDataRpc.value) : undefined,
gas: !_.isUndefined(txDataRpc.gas) ? utils.convertHexToNumber(txDataRpc.gas) : undefined,
- gasPrice: !_.isUndefined(txDataRpc.gasPrice) ? utils.convertHexToNumber(txDataRpc.gasPrice) : undefined,
- nonce: !_.isUndefined(txDataRpc.nonce) ? utils.convertHexToNumber(txDataRpc.nonce) : undefined,
+ gasPrice: !_.isUndefined(txDataRpc.gasPrice) ? utils.convertAmountToBigNumber(txDataRpc.gasPrice) : undefined,
+ nonce: !_.isUndefined(txDataRpc.nonce) ? utils.convertHexToNumber(txDataRpc.nonce) : undefined, , , , , , , ,
};
return txData;
},