@exodus/ethereum-api 7.1.0 → 7.2.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 +10 -6
- package/src/eth-like-util.js +4 -3
- package/src/fee-monitor/ethereumsepolia.js +18 -0
- package/src/fee-monitor/index.js +1 -0
- package/src/get-balances.js +1 -1
- package/src/staking/ethereum/service.js +2 -2
- package/src/staking/matic/service.js +2 -2
- package/src/staking/staking-provider-client.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"lint:fix": "yarn lint --fix"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@exodus/asset-lib": "^
|
|
22
|
+
"@exodus/asset-lib": "^4.1.0",
|
|
23
23
|
"@exodus/crypto": "^1.0.0-rc.0",
|
|
24
24
|
"@exodus/currency": "^2.1.3",
|
|
25
25
|
"@exodus/ethereum-lib": "^4.2.7",
|
|
26
26
|
"@exodus/ethereum-meta": "^1.2.0",
|
|
27
|
-
"@exodus/ethereumjs-util": "^7.1.0-exodus.
|
|
27
|
+
"@exodus/ethereumjs-util": "^7.1.0-exodus.7",
|
|
28
28
|
"@exodus/fetch": "^1.3.0-beta.4",
|
|
29
29
|
"@exodus/models": "^11.0.0",
|
|
30
30
|
"@exodus/simple-retry": "^0.0.6",
|
|
@@ -41,12 +41,16 @@
|
|
|
41
41
|
"ws": "^6.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@exodus/assets": "9.1.
|
|
45
|
-
"@exodus/assets-base": "^8.1.14",
|
|
44
|
+
"@exodus/assets": "^9.1.1",
|
|
46
45
|
"@exodus/assets-testing": "^1.0.0",
|
|
46
|
+
"@exodus/bsc-meta": "^1.1.2",
|
|
47
|
+
"@exodus/ethereumarbone-meta": "^1.1.5",
|
|
48
|
+
"@exodus/ethereumgoerli-meta": "^1.0.3",
|
|
49
|
+
"@exodus/fantommainnet-meta": "^1.0.5",
|
|
50
|
+
"@exodus/rootstock-meta": "^1.0.5",
|
|
47
51
|
"bignumber.js": "9.0.1",
|
|
48
52
|
"cross-fetch": "^3.1.5",
|
|
49
53
|
"delay": "4.0.1"
|
|
50
54
|
},
|
|
51
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "4c4d7567f9c6d24acf3b48d2b23e0c23b15b45aa"
|
|
52
56
|
}
|
package/src/eth-like-util.js
CHANGED
|
@@ -3,6 +3,7 @@ import { normalizeTxId, isEthereumLikeAsset, isEthereumLikeToken, ABI } from '@e
|
|
|
3
3
|
import { memoizeLruCache } from '@exodus/asset-lib'
|
|
4
4
|
import SolidityContract from '@exodus/solidity-contract'
|
|
5
5
|
import { getServerByName, getServer } from './exodus-eth-server'
|
|
6
|
+
import BN from 'bn.js'
|
|
6
7
|
|
|
7
8
|
export async function isContract(baseAssetName, address) {
|
|
8
9
|
return getServerByName(baseAssetName).isContract(address)
|
|
@@ -41,9 +42,9 @@ export async function getBalance({ asset, address }) {
|
|
|
41
42
|
// Only base assets, not tokens
|
|
42
43
|
export async function getBalanceProxied({ asset, address, tag = 'latest' }) {
|
|
43
44
|
if (!isEthereumLikeAsset(asset)) throw new Error(`unsupported asset ${asset.name}`)
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
return
|
|
45
|
+
const result = await getServer(asset).getBalanceProxied(address)
|
|
46
|
+
const hex = result.startsWith('0x') ? result.slice(2) : result
|
|
47
|
+
return new BN(hex, 'hex').toString()
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
// Only ETH-like assets with token support
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
|
|
2
|
+
import { getServerByName } from '../exodus-eth-server'
|
|
3
|
+
|
|
4
|
+
const assetName = 'ethereumsepolia'
|
|
5
|
+
|
|
6
|
+
// @deprecated use ./server-based-fee-monitor.js
|
|
7
|
+
export class EthereumSepoliaFeeMonitor extends EthereumLikeFeeMonitor {
|
|
8
|
+
constructor({ updateFee, interval }) {
|
|
9
|
+
const server = getServerByName(assetName)
|
|
10
|
+
const getGasPrice = (...args) => server.gasPrice(...args)
|
|
11
|
+
super({
|
|
12
|
+
updateFee,
|
|
13
|
+
assetName,
|
|
14
|
+
getGasPrice,
|
|
15
|
+
interval,
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/fee-monitor/index.js
CHANGED
package/src/get-balances.js
CHANGED
|
@@ -37,7 +37,7 @@ const getBalance = ({ asset, accountState, txLog }) => {
|
|
|
37
37
|
|
|
38
38
|
const shouldFixBalance = isRpcBalanceAsset(asset)
|
|
39
39
|
|
|
40
|
-
if (['ethereum', 'ethereumgoerli', 'ethereumholesky'].includes(asset.name)) {
|
|
40
|
+
if (['ethereum', 'ethereumgoerli', 'ethereumholesky', 'ethereumsepolia'].includes(asset.name)) {
|
|
41
41
|
const { balance: ethereumBalance } = getEthereumBalances({
|
|
42
42
|
asset,
|
|
43
43
|
liquidBalance: balance,
|
|
@@ -11,10 +11,10 @@ export function createEthereumStakingService({
|
|
|
11
11
|
asset,
|
|
12
12
|
assetClientInterface,
|
|
13
13
|
createAndBroadcastTX,
|
|
14
|
-
|
|
14
|
+
getTelemetryId,
|
|
15
15
|
}) {
|
|
16
16
|
const staking = new EthereumStaking(asset)
|
|
17
|
-
const stakingProvider = stakingProviderClientFactory({
|
|
17
|
+
const stakingProvider = stakingProviderClientFactory({ getTelemetryId })
|
|
18
18
|
|
|
19
19
|
function amountToCurrency({ asset, amount }) {
|
|
20
20
|
return isNumberUnit(amount) ? amount : asset.currency.parse(amount)
|
|
@@ -8,11 +8,11 @@ import { isNumberUnit } from '@exodus/currency'
|
|
|
8
8
|
export function createPolygonStakingService({
|
|
9
9
|
assetClientInterface,
|
|
10
10
|
createAndBroadcastTX,
|
|
11
|
-
|
|
11
|
+
getTelemetryId,
|
|
12
12
|
}) {
|
|
13
13
|
const stakingApi = new MaticStakingApi()
|
|
14
14
|
const assetName = 'ethereum'
|
|
15
|
-
const stakingProvider = stakingProviderClientFactory({
|
|
15
|
+
const stakingProvider = stakingProviderClientFactory({ getTelemetryId })
|
|
16
16
|
|
|
17
17
|
async function getStakeAssets() {
|
|
18
18
|
const { polygon: asset, ethereum: feeAsset } = await assetClientInterface.getAssetsForNetwork({
|
|
@@ -7,7 +7,7 @@ const HTTP_POST_TIMEOUT = ms('30s')
|
|
|
7
7
|
|
|
8
8
|
export const stakingProviderClientFactory = ({
|
|
9
9
|
defaultStakingUrl = DEFAULT_STAKING_URL,
|
|
10
|
-
|
|
10
|
+
getTelemetryId,
|
|
11
11
|
} = {}) => {
|
|
12
12
|
assert(defaultStakingUrl, '"defaultStakingUrl" must be provided')
|
|
13
13
|
|
|
@@ -22,9 +22,9 @@ export const stakingProviderClientFactory = ({
|
|
|
22
22
|
stakingUrl = new URL(newStakingUrl || defaultStakingUrl)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const stakingRequest = ({ asset, data }) => {
|
|
25
|
+
const stakingRequest = async ({ asset, data }) => {
|
|
26
26
|
const headers = {}
|
|
27
|
-
if (
|
|
27
|
+
if (typeof getTelemetryId === 'function') headers.telemetryId = await getTelemetryId()
|
|
28
28
|
return fetchival(stakingUrl, {
|
|
29
29
|
timeout: HTTP_POST_TIMEOUT,
|
|
30
30
|
headers,
|