@exodus/ethereum-api 8.2.0 → 8.2.1
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": "8.2.
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"cross-fetch": "^3.1.5",
|
|
59
59
|
"delay": "4.0.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "06c5fcd1e337817d38ea3d5d4eaf0235b1d5b686"
|
|
62
62
|
}
|
|
@@ -4,7 +4,17 @@ export const createGetBalanceForAddress = ({ asset, server }) => {
|
|
|
4
4
|
assert(asset, 'asset is required')
|
|
5
5
|
assert(server, 'server is required')
|
|
6
6
|
return async (address) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const balance = await server.getBalance(address)
|
|
8
|
+
if (typeof balance === 'string') {
|
|
9
|
+
// hex-response from eth_getBalance node
|
|
10
|
+
return asset.currency.baseUnit(balance)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (balance && typeof balance === 'object' && typeof balance.confirmed?.value === 'string') {
|
|
14
|
+
// Magnifier/Clarity reponse
|
|
15
|
+
return asset.currency.baseUnit(balance.confirmed.value)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
throw new Error('unable to parse server response for getBalance')
|
|
9
19
|
}
|
|
10
20
|
}
|