@exodus/ethereum-api 3.2.1 → 3.2.2
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 +2 -2
- package/src/eth-like-util.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@exodus/models": "^8.10.4"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "1377dedb12a5a4bf64f860f041ff73d722ffa308"
|
|
38
38
|
}
|
package/src/eth-like-util.js
CHANGED
|
@@ -38,6 +38,14 @@ export async function getBalance({ asset, address }) {
|
|
|
38
38
|
return balances?.confirmed?.value || '0'
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// Only base assets, not tokens
|
|
42
|
+
export async function getBalanceProxied({ asset, address, tag = 'latest' }) {
|
|
43
|
+
if (!isEthereumLikeAsset(asset)) throw new Error(`unsupported asset ${asset.name}`)
|
|
44
|
+
const server = getServer(asset)
|
|
45
|
+
const balanceHex = await server.getBalanceProxied(address, tag)
|
|
46
|
+
return parseInt(balanceHex, 16)
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
// Only ETH-like assets with token support
|
|
42
50
|
export async function getTokenBalance({ asset, address }) {
|
|
43
51
|
if (!isEthereumLikeToken(asset)) throw new Error(`unsupported ETH-like token ${asset.name}`)
|