@exodus/ethereum-api 2.4.5 → 2.5.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.5.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.8.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": "a9971be6cc00557bc1581c6801c90ae8702b4712"
|
|
24
24
|
}
|
package/src/eth-like-util.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { get } from 'lodash'
|
|
2
|
-
import { normalizeTxId } from '@exodus/ethereum-lib'
|
|
2
|
+
import { normalizeTxId, isEthereumLikeAsset, isEthereumLikeToken } from '@exodus/ethereum-lib'
|
|
3
3
|
import { eth, serverMap, getServer } from './exodus-eth-server'
|
|
4
4
|
|
|
5
5
|
// Mobile only.
|
|
@@ -34,8 +34,7 @@ export async function estimateGas({ asset, ...args }) {
|
|
|
34
34
|
|
|
35
35
|
// Only base assets, not tokens
|
|
36
36
|
export async function getBalance({ asset, address }) {
|
|
37
|
-
if (!
|
|
38
|
-
throw new Error(`unsupported asset ${asset.name}`)
|
|
37
|
+
if (!isEthereumLikeAsset(asset)) throw new Error(`unsupported asset ${asset.name}`)
|
|
39
38
|
const server = getServer(asset)
|
|
40
39
|
const balances = await server.getBalance(address)
|
|
41
40
|
return get(balances, ['confirmed', 'value'], '0')
|
|
@@ -43,8 +42,7 @@ export async function getBalance({ asset, address }) {
|
|
|
43
42
|
|
|
44
43
|
// Only ETH-like assets with token support
|
|
45
44
|
export async function getTokenBalance({ asset, address }) {
|
|
46
|
-
if (!
|
|
47
|
-
throw new Error(`unsupported base asset ${asset.baseAsset.name}`)
|
|
45
|
+
if (!isEthereumLikeToken(asset)) throw new Error(`unsupported ETH-like token ${asset.name}`)
|
|
48
46
|
const server = getServer(asset)
|
|
49
47
|
const balances = await server.getBalance(address)
|
|
50
48
|
return get(balances, ['confirmed', asset.contract.address.toLowerCase()], '0')
|
|
@@ -144,6 +144,14 @@ export function create(defaultURL) {
|
|
|
144
144
|
})
|
|
145
145
|
},
|
|
146
146
|
|
|
147
|
+
async getBaseFee() {
|
|
148
|
+
const { baseFeePerGas } = await requestWithRetry('proxy', {
|
|
149
|
+
method: 'eth_getBlockByNumber',
|
|
150
|
+
number: 'latest',
|
|
151
|
+
})
|
|
152
|
+
return baseFeePerGas
|
|
153
|
+
},
|
|
154
|
+
|
|
147
155
|
async getLogs(params) {
|
|
148
156
|
return requestWithRetry('proxy', { method: 'eth_getLogs', ...params })
|
|
149
157
|
},
|
|
@@ -2,21 +2,18 @@ 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/'
|
|
6
5
|
const EXODUS_BSC_SERVER_URL = 'https://bsc.a.exodus.io/wallet/v1/'
|
|
7
6
|
|
|
8
7
|
// allow self-signed certs
|
|
9
8
|
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
|
10
9
|
export const eth = create(EXODUS_ETH_SERVER_URL)
|
|
11
10
|
export const etc = create(EXODUS_ETC_SERVER_URL)
|
|
12
|
-
export const quorum = create(EXODUS_QUORUM_SERVER_URL)
|
|
13
11
|
export const bsc = create(EXODUS_BSC_SERVER_URL)
|
|
14
12
|
|
|
15
13
|
// exported for in-library use only.
|
|
16
14
|
export const serverMap = {
|
|
17
15
|
ethereum: eth,
|
|
18
16
|
ethereumclassic: etc,
|
|
19
|
-
quorum,
|
|
20
17
|
bsc,
|
|
21
18
|
}
|
|
22
19
|
|
|
@@ -2,11 +2,13 @@ import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
|
|
|
2
2
|
import { eth as ethServer } from '../exodus-eth-server'
|
|
3
3
|
|
|
4
4
|
export class EthereumFeeMonitor extends EthereumLikeFeeMonitor {
|
|
5
|
-
constructor({ updateFee }) {
|
|
5
|
+
constructor({ updateFee, eip1559Enabled }) {
|
|
6
6
|
super({
|
|
7
7
|
updateFee,
|
|
8
8
|
assetName: 'ethereum',
|
|
9
9
|
getGasPrice: ethServer.gasPrice,
|
|
10
|
+
getBaseFee: ethServer.getBaseFee,
|
|
11
|
+
eip1559Enabled,
|
|
10
12
|
})
|
|
11
13
|
}
|
|
12
14
|
}
|