aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio B <kandinsky454@protonmail.ch>2018-12-09 05:57:06 +0800
committerGitHub <noreply@github.com>2018-12-09 05:57:06 +0800
commita286228b2005c33cc4ca8e17772a9bd259eeb1ce (patch)
tree582f3fef57a3a3be0c7e8d44ffd5bdde958c541d /packages
parentaa4fcebdc71fa58b12dc12ab03d7697444416c09 (diff)
parent1a44d86c59fea7b08a8f30b078d8e2c9b730b1b3 (diff)
downloaddexon-sol-tools-a286228b2005c33cc4ca8e17772a9bd259eeb1ce.tar
dexon-sol-tools-a286228b2005c33cc4ca8e17772a9bd259eeb1ce.tar.gz
dexon-sol-tools-a286228b2005c33cc4ca8e17772a9bd259eeb1ce.tar.bz2
dexon-sol-tools-a286228b2005c33cc4ca8e17772a9bd259eeb1ce.tar.lz
dexon-sol-tools-a286228b2005c33cc4ca8e17772a9bd259eeb1ce.tar.xz
dexon-sol-tools-a286228b2005c33cc4ca8e17772a9bd259eeb1ce.tar.zst
dexon-sol-tools-a286228b2005c33cc4ca8e17772a9bd259eeb1ce.zip
Merge pull request #1402 from 0xProject/web3-wrapper/numberBigNumberMixup
Fix `value` and `gasPrice` precision bug by returning them as BigNumbers
Diffstat (limited to 'packages')
-rw-r--r--packages/web3-wrapper/CHANGELOG.json9
-rw-r--r--packages/web3-wrapper/src/marshaller.ts6
2 files changed, 13 insertions, 2 deletions
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json
index 9f5194e0d..ed484c8e8 100644
--- a/packages/web3-wrapper/CHANGELOG.json
+++ b/packages/web3-wrapper/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.2.0",
+ "changes": [
+ {
+ "note": "Return `value` and `gasPrice` as BigNumbers to avoid loss of precision errors",
+ "pr": 1402
+ }
+ ]
+ },
+ {
"version": "3.1.6",
"changes": [
{
diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts
index 7bd274c85..4230f8eab 100644
--- a/packages/web3-wrapper/src/marshaller.ts
+++ b/packages/web3-wrapper/src/marshaller.ts
@@ -120,9 +120,11 @@ 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,
+ gasPrice: !_.isUndefined(txDataRpc.gasPrice)
+ ? utils.convertAmountToBigNumber(txDataRpc.gasPrice)
+ : undefined,
nonce: !_.isUndefined(txDataRpc.nonce) ? utils.convertHexToNumber(txDataRpc.nonce) : undefined,
};
return txData;