@exodus/ethereum-api 2.2.1 → 2.3.0
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": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Exodus Movement, Inc.",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"access": "restricted"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@exodus/ethereum-lib": "^2.
|
|
13
|
+
"@exodus/ethereum-lib": "^2.5.0",
|
|
14
14
|
"@exodus/simple-retry": "^0.0.6",
|
|
15
15
|
"fetchival": "0.3.3",
|
|
16
16
|
"lodash": "^4.17.11",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"url-join": "4.0.0",
|
|
21
21
|
"ws": "6.1.0"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "20021e426b0554c029a3c223cb5a2e06711358e3"
|
|
24
24
|
}
|
package/src/eth-like-util.js
CHANGED
|
@@ -32,18 +32,18 @@ export async function estimateGas({ asset, ...args }) {
|
|
|
32
32
|
return getServer(asset).estimateGas(args)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// Only
|
|
35
|
+
// Only base assets, not tokens
|
|
36
36
|
export async function getBalance({ asset, address }) {
|
|
37
|
-
if (!['ethereum', 'ethereumclassic', 'quorum'].includes(asset.name))
|
|
37
|
+
if (!['ethereum', 'ethereumclassic', 'quorum', 'bsc'].includes(asset.name))
|
|
38
38
|
throw new Error(`unsupported asset ${asset.name}`)
|
|
39
39
|
const server = getServer(asset)
|
|
40
40
|
const balances = await server.getBalance(address)
|
|
41
41
|
return get(balances, ['confirmed', 'value'], '0')
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// Only
|
|
44
|
+
// Only ETH-like assets with token support
|
|
45
45
|
export async function getTokenBalance({ asset, address }) {
|
|
46
|
-
if (!['ethereum', 'quorum'].includes(asset.baseAsset.name))
|
|
46
|
+
if (!['ethereum', 'quorum', 'bsc'].includes(asset.baseAsset.name))
|
|
47
47
|
throw new Error(`unsupported base asset ${asset.baseAsset.name}`)
|
|
48
48
|
const server = getServer(asset)
|
|
49
49
|
const balances = await server.getBalance(address)
|
|
@@ -2,19 +2,22 @@ import { create } from './api'
|
|
|
2
2
|
|
|
3
3
|
const EXODUS_ETH_SERVER_URL = 'https://geth.a.exodus.io/wallet/v1/'
|
|
4
4
|
const EXODUS_ETC_SERVER_URL = 'https://getc.a.exodus.io/wallet/v1/'
|
|
5
|
-
const EXODUS_QUORUM_SERVER_URL = 'https://geth-quorum.a.exodus.io/wallet/v1'
|
|
5
|
+
const EXODUS_QUORUM_SERVER_URL = 'https://geth-quorum.a.exodus.io/wallet/v1/'
|
|
6
|
+
const EXODUS_BSC_SERVER_URL = 'http://localhost:8000/wallet/v1/'
|
|
6
7
|
|
|
7
8
|
// allow self-signed certs
|
|
8
9
|
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
|
9
10
|
export const eth = create(EXODUS_ETH_SERVER_URL)
|
|
10
11
|
export const etc = create(EXODUS_ETC_SERVER_URL)
|
|
11
12
|
export const quorum = create(EXODUS_QUORUM_SERVER_URL)
|
|
13
|
+
export const bsc = create(EXODUS_BSC_SERVER_URL)
|
|
12
14
|
|
|
13
15
|
// exported for in-library use only.
|
|
14
16
|
export const serverMap = {
|
|
15
17
|
ethereum: eth,
|
|
16
18
|
ethereumclassic: etc,
|
|
17
19
|
quorum,
|
|
20
|
+
bsc,
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export function getServer(asset) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
|
|
2
|
+
import { bsc } from '../exodus-eth-server'
|
|
3
|
+
|
|
4
|
+
export class BscFeeMonitor extends EthereumLikeFeeMonitor {
|
|
5
|
+
constructor({ updateFee }) {
|
|
6
|
+
super({
|
|
7
|
+
updateFee,
|
|
8
|
+
assetName: 'bsc',
|
|
9
|
+
getGasPrice: bsc.gasPrice,
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/fee-monitor/index.js
CHANGED