@exodus/ethereum-api 8.16.0 → 8.18.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/CHANGELOG.md +19 -0
- package/package.json +18 -17
- package/src/allowance/index.js +4 -4
- package/src/create-asset-plugin-factory.js +1 -1
- package/src/create-asset.js +19 -17
- package/src/create-token-factory.js +6 -2
- package/src/ens/index.js +6 -3
- package/src/eth-like-util.js +3 -3
- package/src/etherscan/account.js +1 -1
- package/src/etherscan/index.js +5 -5
- package/src/etherscan/logs.js +1 -1
- package/src/etherscan/proxy.js +1 -1
- package/src/etherscan/ws.js +2 -2
- package/src/exodus-eth-server/api-coin-nodes.js +4 -2
- package/src/exodus-eth-server/api.js +2 -2
- package/src/exodus-eth-server/clarity-v2.js +26 -1
- package/src/exodus-eth-server/clarity.js +1 -1
- package/src/exodus-eth-server/index.js +4 -4
- package/src/exodus-eth-server/ws.js +2 -2
- package/src/gas-estimation.js +1 -1
- package/src/get-balances.js +3 -1
- package/src/get-fee-async.js +4 -4
- package/src/hooks/index.js +1 -1
- package/src/hooks/monitor.js +2 -2
- package/src/index.js +14 -14
- package/src/nft-utils.js +2 -2
- package/src/optimism-gas/index.js +1 -1
- package/src/server-based-fee-monitor.js +1 -1
- package/src/simulate-tx/index.js +2 -2
- package/src/simulate-tx/simulate-eth-tx.js +2 -2
- package/src/staking/api/index.js +34 -0
- package/src/staking/ethereum/api.js +1 -1
- package/src/staking/ethereum/index.js +3 -3
- package/src/staking/ethereum/service.js +130 -86
- package/src/staking/ethereum/staking-utils.js +1 -1
- package/src/staking/index.js +4 -4
- package/src/staking/matic/api.js +1 -1
- package/src/staking/matic/index.js +3 -3
- package/src/staking/matic/matic-staking-utils.js +1 -1
- package/src/staking/matic/service.js +4 -4
- package/src/tx-log/clarity-monitor.js +10 -4
- package/src/tx-log/clarity-utils/get-log-items-from-server-tx.js +7 -7
- package/src/tx-log/clarity-utils/get-names-of-tokens-transferred-by-server-tx.js +1 -1
- package/src/tx-log/clarity-utils/index.js +3 -3
- package/src/tx-log/ethereum-monitor.js +6 -4
- package/src/tx-log/ethereum-no-history-monitor.js +6 -4
- package/src/tx-log/index.js +3 -3
- package/src/tx-log/monitor-utils/check-pending-transactions.js +2 -2
- package/src/tx-log/monitor-utils/get-derive-transactions-to-check.js +1 -1
- package/src/tx-log/monitor-utils/get-history-from-server.js +1 -1
- package/src/tx-log/monitor-utils/get-log-items-from-server-tx.js +6 -6
- package/src/tx-log/monitor-utils/get-names-of-tokens-transferred-by-server-tx.js +1 -1
- package/src/tx-log/monitor-utils/index.js +7 -7
- package/src/tx-log-staking-processor/asset-staking-tx-data.js +6 -2
- package/src/tx-log-staking-processor/index.js +1 -1
- package/src/tx-log-staking-processor/utils.js +1 -1
- package/src/tx-send/get-fee-info.js +1 -1
- package/src/tx-send/index.js +2 -2
- package/src/tx-send/tx-send.js +4 -4
- package/src/web3/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.18.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.17.0...@exodus/ethereum-api@8.18.0) (2024-09-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* evm staking api factory ([#2473](https://github.com/ExodusMovement/assets/issues/2473)) ([3159264](https://github.com/ExodusMovement/assets/commit/315926414cfa99cb51fde2bcb44bbea478275d79))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [8.17.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.16.0...@exodus/ethereum-api@8.17.0) (2024-08-30)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* switch ethereum to ESM ([#3374](https://github.com/ExodusMovement/assets/issues/3374)) ([d3a86c3](https://github.com/ExodusMovement/assets/commit/d3a86c3202754a0e6ab988d454d3e006ec11d9e4))
|
|
21
|
+
* Update clarity v2 to use rest api for rpc calls ([#3172](https://github.com/ExodusMovement/assets/issues/3172)) ([e5aa45c](https://github.com/ExodusMovement/assets/commit/e5aa45cd5e87c11360d79a026037cfe7e3b7d2a7))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [8.16.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.15.0...@exodus/ethereum-api@8.16.0) (2024-08-27)
|
|
7
26
|
|
|
8
27
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.18.0",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "src/index.js",
|
|
6
7
|
"files": [
|
|
7
8
|
"src",
|
|
@@ -15,24 +16,24 @@
|
|
|
15
16
|
"access": "restricted"
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
18
|
-
"test": "run -T exodus-test --jest
|
|
19
|
-
"lint": "run -T
|
|
19
|
+
"test": "run -T exodus-test --jest",
|
|
20
|
+
"lint": "run -T eslintc .",
|
|
20
21
|
"lint:fix": "yarn lint --fix"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@exodus/asset": "^
|
|
24
|
-
"@exodus/asset-lib": "^
|
|
24
|
+
"@exodus/asset": "^2.0.0",
|
|
25
|
+
"@exodus/asset-lib": "^5.0.0",
|
|
25
26
|
"@exodus/assets": "^11.0.0",
|
|
26
|
-
"@exodus/basic-utils": "^
|
|
27
|
+
"@exodus/basic-utils": "^3.0.1",
|
|
27
28
|
"@exodus/bip44-constants": "^195.0.0",
|
|
28
29
|
"@exodus/crypto": "^1.0.0-rc.0",
|
|
29
|
-
"@exodus/currency": "^
|
|
30
|
+
"@exodus/currency": "^5.0.2",
|
|
30
31
|
"@exodus/ethereum-lib": "^5.0.0",
|
|
31
|
-
"@exodus/ethereum-meta": "^
|
|
32
|
-
"@exodus/ethereumholesky-meta": "^
|
|
32
|
+
"@exodus/ethereum-meta": "^2.0.0",
|
|
33
|
+
"@exodus/ethereumholesky-meta": "^2.0.0",
|
|
33
34
|
"@exodus/ethereumjs-util": "^7.1.0-exodus.7",
|
|
34
35
|
"@exodus/fetch": "^1.3.0",
|
|
35
|
-
"@exodus/models": "^
|
|
36
|
+
"@exodus/models": "^12.0.1",
|
|
36
37
|
"@exodus/simple-retry": "^0.0.6",
|
|
37
38
|
"@exodus/solidity-contract": "^1.1.3",
|
|
38
39
|
"@exodus/web3-ethereum-utils": "^3.27.1",
|
|
@@ -49,12 +50,12 @@
|
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@exodus/assets-testing": "^1.0.0",
|
|
52
|
-
"@exodus/bsc-meta": "^
|
|
53
|
-
"@exodus/ethereumarbone-meta": "^
|
|
54
|
-
"@exodus/ethereumgoerli-meta": "^
|
|
55
|
-
"@exodus/ethereumsepolia-meta": "^
|
|
56
|
-
"@exodus/fantommainnet-meta": "^
|
|
57
|
-
"@exodus/rootstock-meta": "^
|
|
53
|
+
"@exodus/bsc-meta": "^2.0.0",
|
|
54
|
+
"@exodus/ethereumarbone-meta": "^2.0.0",
|
|
55
|
+
"@exodus/ethereumgoerli-meta": "^2.0.0",
|
|
56
|
+
"@exodus/ethereumsepolia-meta": "^2.0.0",
|
|
57
|
+
"@exodus/fantommainnet-meta": "^2.0.0",
|
|
58
|
+
"@exodus/rootstock-meta": "^2.0.0",
|
|
58
59
|
"delay": "4.0.1"
|
|
59
60
|
},
|
|
60
61
|
"bugs": {
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
"type": "git",
|
|
65
66
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "b03f9102b0401e40f0484c2195061a907eae9b47"
|
|
68
69
|
}
|
package/src/allowance/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getServer } from '../exodus-eth-server'
|
|
2
|
-
import { fetchGasLimit } from '../gas-estimation'
|
|
3
|
-
import { ALLOWANCE_TX_TIMEOUT, APPROVAL_GAS_LIMIT, ZERO_ALLOWANCE_ASSETS } from './constants'
|
|
1
|
+
import { getServer } from '../exodus-eth-server/index.js'
|
|
2
|
+
import { fetchGasLimit } from '../gas-estimation.js'
|
|
3
|
+
import { ALLOWANCE_TX_TIMEOUT, APPROVAL_GAS_LIMIT, ZERO_ALLOWANCE_ASSETS } from './constants.js'
|
|
4
4
|
|
|
5
5
|
export const isZeroAllowanceAsset = (assetName) => ZERO_ALLOWANCE_ASSETS.includes(assetName)
|
|
6
6
|
|
|
@@ -123,4 +123,4 @@ export const createApproveSpendingTokens =
|
|
|
123
123
|
return txIds
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export { APPROVAL_GAS_LIMIT, ZERO_ALLOWANCE_ASSETS } from './constants'
|
|
126
|
+
export { APPROVAL_GAS_LIMIT, ZERO_ALLOWANCE_ASSETS } from './constants.js'
|
|
@@ -3,7 +3,7 @@ import { FeeData } from '@exodus/asset-lib'
|
|
|
3
3
|
import { UnitType } from '@exodus/currency'
|
|
4
4
|
import assert from 'minimalistic-assert'
|
|
5
5
|
|
|
6
|
-
import { createAssetFactory } from './create-asset'
|
|
6
|
+
import { createAssetFactory } from './create-asset.js'
|
|
7
7
|
|
|
8
8
|
// Move to ethereum-api for config base evm
|
|
9
9
|
export const createAssetPluginFactory = (config) => {
|
package/src/create-asset.js
CHANGED
|
@@ -16,26 +16,28 @@ import {
|
|
|
16
16
|
signUnsignedTxWithSigner,
|
|
17
17
|
validateFactory,
|
|
18
18
|
} from '@exodus/ethereum-lib'
|
|
19
|
-
import
|
|
19
|
+
import lodash from 'lodash'
|
|
20
20
|
import assert from 'minimalistic-assert'
|
|
21
21
|
import ms from 'ms'
|
|
22
22
|
|
|
23
|
-
import { addressHasHistoryFactory } from './address-has-history'
|
|
24
|
-
import { createTokenFactory } from './create-token-factory'
|
|
25
|
-
import { createEvmServer } from './exodus-eth-server'
|
|
26
|
-
import { createGetBalanceForAddress } from './get-balance-for-address'
|
|
27
|
-
import { getBalancesFactory } from './get-balances'
|
|
28
|
-
import { getEffectiveGasPrice, getFeeFactory } from './get-fee'
|
|
29
|
-
import getFeeAsyncFactory from './get-fee-async'
|
|
30
|
-
import { createEthereumHooks } from './hooks'
|
|
31
|
-
import { estimateL1DataFeeFactory, getL1GetFeeFactory } from './optimism-gas'
|
|
32
|
-
import { serverBasedFeeMonitorFactoryFactory } from './server-based-fee-monitor'
|
|
33
|
-
import { createStakingApi } from './staking-api'
|
|
34
|
-
import { ClarityMonitor } from './tx-log/clarity-monitor'
|
|
35
|
-
import { EthereumMonitor } from './tx-log/ethereum-monitor'
|
|
36
|
-
import { EthereumNoHistoryMonitor } from './tx-log/ethereum-no-history-monitor'
|
|
37
|
-
import { txSendFactory } from './tx-send'
|
|
38
|
-
import { createWeb3API } from './web3'
|
|
23
|
+
import { addressHasHistoryFactory } from './address-has-history.js'
|
|
24
|
+
import { createTokenFactory } from './create-token-factory.js'
|
|
25
|
+
import { createEvmServer } from './exodus-eth-server/index.js'
|
|
26
|
+
import { createGetBalanceForAddress } from './get-balance-for-address.js'
|
|
27
|
+
import { getBalancesFactory } from './get-balances.js'
|
|
28
|
+
import { getEffectiveGasPrice, getFeeFactory } from './get-fee.js'
|
|
29
|
+
import getFeeAsyncFactory from './get-fee-async.js'
|
|
30
|
+
import { createEthereumHooks } from './hooks/index.js'
|
|
31
|
+
import { estimateL1DataFeeFactory, getL1GetFeeFactory } from './optimism-gas/index.js'
|
|
32
|
+
import { serverBasedFeeMonitorFactoryFactory } from './server-based-fee-monitor.js'
|
|
33
|
+
import { createStakingApi } from './staking-api.js'
|
|
34
|
+
import { ClarityMonitor } from './tx-log/clarity-monitor.js'
|
|
35
|
+
import { EthereumMonitor } from './tx-log/ethereum-monitor.js'
|
|
36
|
+
import { EthereumNoHistoryMonitor } from './tx-log/ethereum-no-history-monitor.js'
|
|
37
|
+
import { txSendFactory } from './tx-send/index.js'
|
|
38
|
+
import { createWeb3API } from './web3/index.js'
|
|
39
|
+
|
|
40
|
+
const { mapValues } = lodash
|
|
39
41
|
|
|
40
42
|
export const createAssetFactory = ({
|
|
41
43
|
AccountState: CustomAccountState,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { createContract } from '@exodus/ethereum-lib'
|
|
2
2
|
import assert from 'minimalistic-assert'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
isPolygonClaimUndelegate,
|
|
6
|
+
isPolygonDelegate,
|
|
7
|
+
isPolygonUndelegate,
|
|
8
|
+
} from './staking/matic/index.js'
|
|
9
|
+
import { createStakingApi } from './staking-api.js'
|
|
6
10
|
|
|
7
11
|
const defaultTokenFeatures = {
|
|
8
12
|
isMaxFeeAsset: true,
|
package/src/ens/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ABI } from '@exodus/ethereum-lib'
|
|
2
2
|
import SolidityContract from '@exodus/solidity-contract'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import idna from 'idna-uts46-hx'
|
|
4
|
+
import jsSha3 from 'js-sha3'
|
|
5
5
|
|
|
6
|
-
import ENS_REGISTRY_ADDRESSES from './addresses'
|
|
6
|
+
import ENS_REGISTRY_ADDRESSES from './addresses.js'
|
|
7
|
+
|
|
8
|
+
const { toUnicode } = idna
|
|
9
|
+
const { keccak256 } = jsSha3
|
|
7
10
|
|
|
8
11
|
const registry = new SolidityContract(ABI.ensRegistry)
|
|
9
12
|
const resolver = new SolidityContract(ABI.ensResolver)
|
package/src/eth-like-util.js
CHANGED
|
@@ -3,9 +3,9 @@ import { ABI, isEthereumLikeAsset, isEthereumLikeToken, normalizeTxId } from '@e
|
|
|
3
3
|
import SolidityContract from '@exodus/solidity-contract'
|
|
4
4
|
import assert from 'minimalistic-assert'
|
|
5
5
|
|
|
6
|
-
import * as ErrorWrapper from './error-wrapper'
|
|
7
|
-
import { getServer, getServerByName } from './exodus-eth-server'
|
|
8
|
-
import { fromHexToString } from './number-utils'
|
|
6
|
+
import * as ErrorWrapper from './error-wrapper.js'
|
|
7
|
+
import { getServer, getServerByName } from './exodus-eth-server/index.js'
|
|
8
|
+
import { fromHexToString } from './number-utils.js'
|
|
9
9
|
|
|
10
10
|
export async function isContract(baseAssetName, address) {
|
|
11
11
|
return getServerByName(baseAssetName).isContract(address)
|
package/src/etherscan/account.js
CHANGED
package/src/etherscan/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import createWebSocket from './ws'
|
|
1
|
+
import createWebSocket from './ws.js'
|
|
2
2
|
|
|
3
3
|
export const ETHERSCAN_WS_URL = 'wss://socket.etherscan.io/wshandler'
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ export function filterTxsReceived(addr, etherscanTxs) {
|
|
|
12
12
|
return etherscanTxs.filter((tx) => tx.to.toLowerCase() === addr.toLowerCase())
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export { fetchBalance, fetchTxlistinternal, fetchTxlist, tokenBalance } from './account'
|
|
15
|
+
export { fetchBalance, fetchTxlistinternal, fetchTxlist, tokenBalance } from './account.js'
|
|
16
16
|
export {
|
|
17
17
|
sendRawTransaction,
|
|
18
18
|
getTransactionCount,
|
|
@@ -21,8 +21,8 @@ export {
|
|
|
21
21
|
getCode,
|
|
22
22
|
ethCall,
|
|
23
23
|
gasPrice,
|
|
24
|
-
} from './proxy'
|
|
24
|
+
} from './proxy.js'
|
|
25
25
|
|
|
26
|
-
export { setEtherscanApiKey as setApiKey } from './request'
|
|
26
|
+
export { setEtherscanApiKey as setApiKey } from './request.js'
|
|
27
27
|
|
|
28
|
-
export { getLogs } from './logs'
|
|
28
|
+
export { getLogs } from './logs.js'
|
package/src/etherscan/logs.js
CHANGED
package/src/etherscan/proxy.js
CHANGED
package/src/etherscan/ws.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import EventEmitter from 'events/' //
|
|
1
|
+
import EventEmitter from 'events/events.js' // forces it to use the module from node_modules
|
|
2
2
|
import ms from 'ms'
|
|
3
3
|
|
|
4
|
-
import WebSocket from '../websocket'
|
|
4
|
+
import WebSocket from '../websocket/index.js'
|
|
5
5
|
|
|
6
6
|
const RECONNECT_INTERVAL = ms('10s')
|
|
7
7
|
const PING_INTERVAL = ms('20s')
|
|
@@ -2,9 +2,11 @@ import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
|
2
2
|
import { fetch } from '@exodus/fetch'
|
|
3
3
|
import SolidityContract from '@exodus/solidity-contract'
|
|
4
4
|
import EventEmitter from 'events'
|
|
5
|
-
import
|
|
5
|
+
import lodash from 'lodash'
|
|
6
6
|
|
|
7
|
-
import { fromHexToString } from '../number-utils'
|
|
7
|
+
import { fromHexToString } from '../number-utils.js'
|
|
8
|
+
|
|
9
|
+
const { isEmpty } = lodash
|
|
8
10
|
|
|
9
11
|
export default class ApiCoinNodesServer extends EventEmitter {
|
|
10
12
|
constructor({ uri }) {
|
|
@@ -5,8 +5,8 @@ import { retry } from '@exodus/simple-retry'
|
|
|
5
5
|
import SolidityContract from '@exodus/solidity-contract'
|
|
6
6
|
import ms from 'ms'
|
|
7
7
|
|
|
8
|
-
import { fromHexToString } from '../number-utils'
|
|
9
|
-
import createWebSocket from './ws'
|
|
8
|
+
import { fromHexToString } from '../number-utils.js'
|
|
9
|
+
import createWebSocket from './ws.js'
|
|
10
10
|
|
|
11
11
|
const RETRY_DELAYS = ['10s']
|
|
12
12
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fetch } from '@exodus/fetch'
|
|
2
2
|
import { retry } from '@exodus/simple-retry'
|
|
3
3
|
|
|
4
|
-
import ClarityServer from './clarity'
|
|
4
|
+
import ClarityServer from './clarity.js'
|
|
5
5
|
|
|
6
6
|
const getTextFromResponse = async (response) => {
|
|
7
7
|
try {
|
|
@@ -87,4 +87,29 @@ export default class ClarityServerV2 extends ClarityServer {
|
|
|
87
87
|
// Doesn't match any known format, return default
|
|
88
88
|
return { blockNumber: BigInt(0) }
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
async sendHttpRequest({ path, method, body }) {
|
|
92
|
+
const url = new URL(`${this.baseApiPath}${path}`)
|
|
93
|
+
const fetchOptions = {
|
|
94
|
+
method,
|
|
95
|
+
headers: {
|
|
96
|
+
'Content-Type': 'application/json',
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (body) {
|
|
101
|
+
fetchOptions.body = JSON.stringify(body)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return fetchJson(url, fetchOptions)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async sendRawTransaction(...params) {
|
|
108
|
+
const request = this.sendRawTransactionRequest(...params)
|
|
109
|
+
return this.sendHttpRequest({
|
|
110
|
+
path: '/rpc',
|
|
111
|
+
method: 'POST',
|
|
112
|
+
body: request,
|
|
113
|
+
})
|
|
114
|
+
}
|
|
90
115
|
}
|
|
@@ -3,7 +3,7 @@ import SolidityContract from '@exodus/solidity-contract'
|
|
|
3
3
|
import EventEmitter from 'events'
|
|
4
4
|
import io from 'socket.io-client'
|
|
5
5
|
|
|
6
|
-
import { fromHexToString } from '../number-utils'
|
|
6
|
+
import { fromHexToString } from '../number-utils.js'
|
|
7
7
|
|
|
8
8
|
export default class ClarityServer extends EventEmitter {
|
|
9
9
|
constructor({ baseAssetName, uri }) {
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
} from '@exodus/ethereum-lib'
|
|
9
9
|
import assert from 'minimalistic-assert'
|
|
10
10
|
|
|
11
|
-
import { create } from './api'
|
|
12
|
-
import ApiCoinNodesServer from './api-coin-nodes'
|
|
13
|
-
import ClarityServer from './clarity'
|
|
14
|
-
import ClarityServerV2 from './clarity-v2'
|
|
11
|
+
import { create } from './api.js'
|
|
12
|
+
import ApiCoinNodesServer from './api-coin-nodes.js'
|
|
13
|
+
import ClarityServer from './clarity.js'
|
|
14
|
+
import ClarityServerV2 from './clarity-v2.js'
|
|
15
15
|
|
|
16
16
|
export function createEvmServer({ assetName, serverUrl, monitorType }) {
|
|
17
17
|
assert(assetName, 'assetName is required')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import EventEmitter from 'events/' //
|
|
1
|
+
import EventEmitter from 'events/events.js' // forces it to use the module from node_modules
|
|
2
2
|
import ms from 'ms'
|
|
3
3
|
|
|
4
|
-
import WebSocket from '../websocket'
|
|
4
|
+
import WebSocket from '../websocket/index.js'
|
|
5
5
|
|
|
6
6
|
const RECONNECT_INTERVAL = ms('10s')
|
|
7
7
|
const PING_INTERVAL = ms('10s')
|
package/src/gas-estimation.js
CHANGED
|
@@ -2,7 +2,7 @@ import { currency2buffer, isEthereumLikeToken } from '@exodus/ethereum-lib'
|
|
|
2
2
|
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
3
|
import BN from 'bn.js'
|
|
4
4
|
|
|
5
|
-
import { estimateGas, isContractAddressCached } from './eth-like-util'
|
|
5
|
+
import { estimateGas, isContractAddressCached } from './eth-like-util.js'
|
|
6
6
|
|
|
7
7
|
const EXTRA_PERCENTAGE = 20
|
|
8
8
|
|
package/src/get-balances.js
CHANGED
|
@@ -5,9 +5,11 @@ import {
|
|
|
5
5
|
getUnconfirmedSentBalance,
|
|
6
6
|
} from '@exodus/asset-lib'
|
|
7
7
|
import { isRpcBalanceAsset } from '@exodus/ethereum-lib'
|
|
8
|
-
import
|
|
8
|
+
import lodash from 'lodash'
|
|
9
9
|
import assert from 'minimalistic-assert'
|
|
10
10
|
|
|
11
|
+
const { get } = lodash
|
|
12
|
+
|
|
11
13
|
const getStaked = ({ accountState, asset }) => {
|
|
12
14
|
return get(accountState, ['staking', asset.name, 'delegatedBalance']) || asset.currency.ZERO
|
|
13
15
|
}
|
package/src/get-fee-async.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert'
|
|
2
2
|
|
|
3
|
-
import { isForwarderContractCached } from './eth-like-util'
|
|
4
|
-
import { fetchGasLimit, resolveDefaultTxInput } from './gas-estimation'
|
|
5
|
-
import { getFeeFactory } from './get-fee'
|
|
6
|
-
import { getNftArguments } from './nft-utils'
|
|
3
|
+
import { isForwarderContractCached } from './eth-like-util.js'
|
|
4
|
+
import { fetchGasLimit, resolveDefaultTxInput } from './gas-estimation.js'
|
|
5
|
+
import { getFeeFactory } from './get-fee.js'
|
|
6
|
+
import { getNftArguments } from './nft-utils.js'
|
|
7
7
|
|
|
8
8
|
const FIXED_TRANSFER_GAS_LIMIT_ASSETS = new Set([
|
|
9
9
|
'amp',
|
package/src/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createEthereumHooks } from './monitor'
|
|
1
|
+
export { createEthereumHooks } from './monitor.js'
|
package/src/hooks/monitor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert'
|
|
2
2
|
|
|
3
|
-
import { getEthereumStakingInfo, getPolygonStakingInfo } from '../staking'
|
|
4
|
-
import processTxLog from '../tx-log-staking-processor'
|
|
3
|
+
import { getEthereumStakingInfo, getPolygonStakingInfo } from '../staking/index.js'
|
|
4
|
+
import processTxLog from '../tx-log-staking-processor/index.js'
|
|
5
5
|
|
|
6
6
|
export const createEthereumHooks = ({
|
|
7
7
|
assetClientInterface,
|
package/src/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// Ideally, we should reduce the exports to just api.
|
|
2
2
|
// If the client is importing one module specifically,
|
|
3
3
|
// it's breaking the encapsulation
|
|
4
|
-
export * from './eth-like-util'
|
|
5
|
-
export * from './gas-estimation'
|
|
6
|
-
export * from './exodus-eth-server'
|
|
7
|
-
export * from './tx-log'
|
|
8
|
-
export * from './get-balances'
|
|
9
|
-
export * from './staking'
|
|
10
|
-
export * from './simulate-tx'
|
|
11
|
-
export * from './allowance'
|
|
12
|
-
export * from './optimism-gas'
|
|
13
|
-
export * from './number-utils'
|
|
14
|
-
export { reasons as errorReasons, withErrorReason, EthLikeError } from './error-wrapper'
|
|
15
|
-
export { txSendFactory, getFeeInfo } from './tx-send'
|
|
16
|
-
export { createAssetFactory } from './create-asset'
|
|
4
|
+
export * from './eth-like-util.js'
|
|
5
|
+
export * from './gas-estimation.js'
|
|
6
|
+
export * from './exodus-eth-server/index.js'
|
|
7
|
+
export * from './tx-log/index.js'
|
|
8
|
+
export * from './get-balances.js'
|
|
9
|
+
export * from './staking/index.js'
|
|
10
|
+
export * from './simulate-tx/index.js'
|
|
11
|
+
export * from './allowance/index.js'
|
|
12
|
+
export * from './optimism-gas/index.js'
|
|
13
|
+
export * from './number-utils.js'
|
|
14
|
+
export { reasons as errorReasons, withErrorReason, EthLikeError } from './error-wrapper.js'
|
|
15
|
+
export { txSendFactory, getFeeInfo } from './tx-send/index.js'
|
|
16
|
+
export { createAssetFactory } from './create-asset.js'
|
|
17
17
|
export {
|
|
18
18
|
createAssetPluginFactory,
|
|
19
19
|
fromAddEthereumChainParameterToFactoryParams,
|
|
20
|
-
} from './create-asset-plugin-factory'
|
|
20
|
+
} from './create-asset-plugin-factory.js'
|
package/src/nft-utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import SolidityContract from '@exodus/solidity-contract'
|
|
2
2
|
import assert from 'minimalistic-assert'
|
|
3
3
|
|
|
4
|
-
import * as ErrorWrapper from './error-wrapper'
|
|
5
|
-
import { fetchGasLimit } from './gas-estimation'
|
|
4
|
+
import * as ErrorWrapper from './error-wrapper.js'
|
|
5
|
+
import { fetchGasLimit } from './gas-estimation.js'
|
|
6
6
|
|
|
7
7
|
export const getNftArguments = async ({ asset, nft, fromAddress, toAddress }) => {
|
|
8
8
|
assert(asset, 'asset is required')
|
|
@@ -2,7 +2,7 @@ import { createContract, createEthereumJsTx } from '@exodus/ethereum-lib'
|
|
|
2
2
|
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
3
|
import assert from 'minimalistic-assert'
|
|
4
4
|
|
|
5
|
-
import { fromHexToBigInt } from '../number-utils'
|
|
5
|
+
import { fromHexToBigInt } from '../number-utils.js'
|
|
6
6
|
|
|
7
7
|
export const estimateL1DataFeeFactory = ({ l1GasOracleAddress, server }) => {
|
|
8
8
|
assert(l1GasOracleAddress, 'l1GasOracleAddress is required')
|
|
@@ -2,7 +2,7 @@ import { FeeMonitor } from '@exodus/asset-lib'
|
|
|
2
2
|
import { DEFAULT_FEE_MONITOR_INTERVAL } from '@exodus/ethereum-lib'
|
|
3
3
|
import assert from 'minimalistic-assert'
|
|
4
4
|
|
|
5
|
-
import { fromHexToString } from './number-utils'
|
|
5
|
+
import { fromHexToString } from './number-utils.js'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Generic eth server based fee monitor.
|
package/src/simulate-tx/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './fetch-tx-preview'
|
|
2
|
-
export * from './simulate-eth-tx'
|
|
1
|
+
export * from './fetch-tx-preview.js'
|
|
2
|
+
export * from './simulate-eth-tx.js'
|
|
@@ -7,8 +7,8 @@ import { asset as ethereum } from '@exodus/ethereum-meta'
|
|
|
7
7
|
import SolidityContract from '@exodus/solidity-contract'
|
|
8
8
|
import assert from 'minimalistic-assert'
|
|
9
9
|
|
|
10
|
-
import { getERC20Params } from '../eth-like-util'
|
|
11
|
-
import { fetchTxPreview } from './fetch-tx-preview'
|
|
10
|
+
import { getERC20Params } from '../eth-like-util.js'
|
|
11
|
+
import { fetchTxPreview } from './fetch-tx-preview.js'
|
|
12
12
|
|
|
13
13
|
const ethDecimals = ethereum.units.ETH
|
|
14
14
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { pick } from '@exodus/basic-utils'
|
|
2
|
+
import assert from 'minimalistic-assert'
|
|
3
|
+
|
|
4
|
+
export const stakingApiFactory = ({
|
|
5
|
+
asset,
|
|
6
|
+
assetClientInterface,
|
|
7
|
+
server, // coin node server
|
|
8
|
+
stakingConfiguration,
|
|
9
|
+
stakingDependencies,
|
|
10
|
+
}) => {
|
|
11
|
+
assert(asset, '"asset" is required')
|
|
12
|
+
assert(assetClientInterface, '"assetClientInterface" is required')
|
|
13
|
+
assert(server, '"server" is required')
|
|
14
|
+
assert(stakingConfiguration, '"stakingConfiguration" is required')
|
|
15
|
+
assert(stakingDependencies, '"stakingDependencies" is required')
|
|
16
|
+
|
|
17
|
+
const { contracts, minAmount } = stakingConfiguration
|
|
18
|
+
const { stakingServerFactory, stakingServiceFactory } = stakingDependencies
|
|
19
|
+
|
|
20
|
+
const stakingServer = stakingServerFactory({ asset, server, minAmount, contracts })
|
|
21
|
+
|
|
22
|
+
const stakingService = stakingServiceFactory({
|
|
23
|
+
assetClientInterface,
|
|
24
|
+
server,
|
|
25
|
+
stakingServer,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
isStaking: async ({ isDelegating }) => isDelegating,
|
|
30
|
+
isUnstaking: async ({ isUndelegateInProgress }) => isUndelegateInProgress,
|
|
31
|
+
isUnstaked: async ({ canClaimUndelegateBalance }) => canClaimUndelegateBalance,
|
|
32
|
+
...pick(stakingService, ['approveStake', 'stake', 'unstake', 'claimUnstaked', 'claimRewards']),
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -2,7 +2,7 @@ import { createContract } from '@exodus/ethereum-lib'
|
|
|
2
2
|
import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
3
3
|
import { retry } from '@exodus/simple-retry'
|
|
4
4
|
|
|
5
|
-
import { getServerByName } from '../../exodus-eth-server'
|
|
5
|
+
import { getServerByName } from '../../exodus-eth-server/index.js'
|
|
6
6
|
|
|
7
7
|
const MIN_AMOUNT = '0.1'
|
|
8
8
|
const RETRY_DELAYS = ['10s']
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './staking-utils'
|
|
2
|
-
export * from './api'
|
|
3
|
-
export * from './service'
|
|
1
|
+
export * from './staking-utils.js'
|
|
2
|
+
export * from './api.js'
|
|
3
|
+
export * from './service.js'
|