@exodus/ethereum-api 3.2.3 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@exodus/fetch": "^1.2.1",
|
|
22
22
|
"@exodus/simple-retry": "^0.0.6",
|
|
23
23
|
"@exodus/solidity-contract": "^1.1.3",
|
|
24
|
+
"bn.js": "^5.2.1",
|
|
24
25
|
"events": "^1.1.1",
|
|
25
26
|
"idna-uts46-hx": "^2.3.1",
|
|
26
27
|
"js-sha3": "^0.8.0",
|
|
@@ -34,5 +35,5 @@
|
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@exodus/models": "^8.10.4"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "a7b9df6bad230ca4fb0c16abdc7f91210198d648"
|
|
38
39
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import urlJoin from 'url-join'
|
|
2
2
|
import url from 'url'
|
|
3
3
|
import ms from 'ms'
|
|
4
|
+
import BN from 'bn.js'
|
|
4
5
|
import createWebSocket from './ws'
|
|
5
6
|
import { fetchival } from '@exodus/fetch'
|
|
6
7
|
import { retry } from '@exodus/simple-retry'
|
|
@@ -83,9 +84,11 @@ export function create(defaultURL, ensAssetName) {
|
|
|
83
84
|
tag,
|
|
84
85
|
}
|
|
85
86
|
const result = await retry(this.ethCall, { delayTimesMs: RETRY_DELAYS })(data)
|
|
87
|
+
const hex = result.startsWith('0x') ? result.slice(2) : result
|
|
88
|
+
const balance = new BN(hex, 'hex').toString()
|
|
86
89
|
return {
|
|
87
90
|
confirmed: {
|
|
88
|
-
[tokenAddress]:
|
|
91
|
+
[tokenAddress]: balance,
|
|
89
92
|
},
|
|
90
93
|
}
|
|
91
94
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
+
import BN from 'bn.js'
|
|
2
3
|
import { getServer } from '@exodus/ethereum-api'
|
|
3
4
|
import { isRpcBalanceAsset, getAssetAddresses } from '@exodus/ethereum-lib'
|
|
4
5
|
|
|
@@ -222,8 +223,9 @@ export class EthereumMonitor extends BaseMonitor {
|
|
|
222
223
|
const newAccountState = {}
|
|
223
224
|
const server = this.server
|
|
224
225
|
if (isRpcBalanceAsset(asset)) {
|
|
225
|
-
const
|
|
226
|
-
const
|
|
226
|
+
const result = await server.getBalanceProxied(ourWalletAddress)
|
|
227
|
+
const hex = result.startsWith('0x') ? result.slice(2) : result
|
|
228
|
+
const balance = new BN(hex, 'hex').toString()
|
|
227
229
|
newAccountState.balance = asset.currency.baseUnit(balance)
|
|
228
230
|
}
|
|
229
231
|
const tokenBalancePairs = await Promise.all(
|