@exodus/ethereum-api 8.16.0 → 8.17.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/package.json +17 -16
  3. package/src/allowance/index.js +4 -4
  4. package/src/create-asset-plugin-factory.js +1 -1
  5. package/src/create-asset.js +19 -17
  6. package/src/create-token-factory.js +6 -2
  7. package/src/ens/index.js +6 -3
  8. package/src/eth-like-util.js +3 -3
  9. package/src/etherscan/account.js +1 -1
  10. package/src/etherscan/index.js +5 -5
  11. package/src/etherscan/logs.js +1 -1
  12. package/src/etherscan/proxy.js +1 -1
  13. package/src/etherscan/ws.js +2 -2
  14. package/src/exodus-eth-server/api-coin-nodes.js +4 -2
  15. package/src/exodus-eth-server/api.js +2 -2
  16. package/src/exodus-eth-server/clarity-v2.js +26 -1
  17. package/src/exodus-eth-server/clarity.js +1 -1
  18. package/src/exodus-eth-server/index.js +4 -4
  19. package/src/exodus-eth-server/ws.js +2 -2
  20. package/src/gas-estimation.js +1 -1
  21. package/src/get-balances.js +3 -1
  22. package/src/get-fee-async.js +4 -4
  23. package/src/hooks/index.js +1 -1
  24. package/src/hooks/monitor.js +2 -2
  25. package/src/index.js +14 -14
  26. package/src/nft-utils.js +2 -2
  27. package/src/optimism-gas/index.js +1 -1
  28. package/src/server-based-fee-monitor.js +1 -1
  29. package/src/simulate-tx/index.js +2 -2
  30. package/src/simulate-tx/simulate-eth-tx.js +2 -2
  31. package/src/staking/ethereum/api.js +1 -1
  32. package/src/staking/ethereum/index.js +3 -3
  33. package/src/staking/ethereum/service.js +5 -5
  34. package/src/staking/ethereum/staking-utils.js +1 -1
  35. package/src/staking/index.js +4 -4
  36. package/src/staking/matic/api.js +1 -1
  37. package/src/staking/matic/index.js +3 -3
  38. package/src/staking/matic/matic-staking-utils.js +1 -1
  39. package/src/staking/matic/service.js +4 -4
  40. package/src/tx-log/clarity-monitor.js +10 -4
  41. package/src/tx-log/clarity-utils/get-log-items-from-server-tx.js +7 -7
  42. package/src/tx-log/clarity-utils/get-names-of-tokens-transferred-by-server-tx.js +1 -1
  43. package/src/tx-log/clarity-utils/index.js +3 -3
  44. package/src/tx-log/ethereum-monitor.js +6 -4
  45. package/src/tx-log/ethereum-no-history-monitor.js +6 -4
  46. package/src/tx-log/index.js +3 -3
  47. package/src/tx-log/monitor-utils/check-pending-transactions.js +2 -2
  48. package/src/tx-log/monitor-utils/get-derive-transactions-to-check.js +1 -1
  49. package/src/tx-log/monitor-utils/get-history-from-server.js +1 -1
  50. package/src/tx-log/monitor-utils/get-log-items-from-server-tx.js +6 -6
  51. package/src/tx-log/monitor-utils/get-names-of-tokens-transferred-by-server-tx.js +1 -1
  52. package/src/tx-log/monitor-utils/index.js +7 -7
  53. package/src/tx-log-staking-processor/asset-staking-tx-data.js +6 -2
  54. package/src/tx-log-staking-processor/index.js +1 -1
  55. package/src/tx-log-staking-processor/utils.js +1 -1
  56. package/src/tx-send/get-fee-info.js +1 -1
  57. package/src/tx-send/index.js +2 -2
  58. package/src/tx-send/tx-send.js +4 -4
  59. package/src/web3/index.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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.17.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.16.0...@exodus/ethereum-api@8.17.0) (2024-08-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * switch ethereum to ESM ([#3374](https://github.com/ExodusMovement/assets/issues/3374)) ([d3a86c3](https://github.com/ExodusMovement/assets/commit/d3a86c3202754a0e6ab988d454d3e006ec11d9e4))
12
+ * 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))
13
+
14
+
15
+
6
16
  ## [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
17
 
8
18
 
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.16.0",
3
+ "version": "8.17.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 --esbuild",
19
+ "test": "run -T exodus-test --jest",
19
20
  "lint": "run -T eslint .",
20
21
  "lint:fix": "yarn lint --fix"
21
22
  },
22
23
  "dependencies": {
23
- "@exodus/asset": "^1.2.0",
24
- "@exodus/asset-lib": "^4.2.2",
24
+ "@exodus/asset": "^2.0.0",
25
+ "@exodus/asset-lib": "^5.0.0",
25
26
  "@exodus/assets": "^11.0.0",
26
- "@exodus/basic-utils": "^2.1.0",
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": "^2.1.3",
30
+ "@exodus/currency": "^5.0.2",
30
31
  "@exodus/ethereum-lib": "^5.0.0",
31
- "@exodus/ethereum-meta": "^1.5.1",
32
- "@exodus/ethereumholesky-meta": "^1.0.3",
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": "^11.0.0",
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": "^1.2.2",
53
- "@exodus/ethereumarbone-meta": "^1.2.0",
54
- "@exodus/ethereumgoerli-meta": "^1.0.5",
55
- "@exodus/ethereumsepolia-meta": "^1.0.3",
56
- "@exodus/fantommainnet-meta": "^1.1.2",
57
- "@exodus/rootstock-meta": "^1.0.7",
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": "acd3513f5e5defeb1a1e181a4655f431e1b1289f"
68
+ "gitHead": "ea79042fc0d7ec1f4c87d3b0b511840b910ffa48"
68
69
  }
@@ -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) => {
@@ -16,26 +16,28 @@ import {
16
16
  signUnsignedTxWithSigner,
17
17
  validateFactory,
18
18
  } from '@exodus/ethereum-lib'
19
- import { mapValues } from 'lodash'
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 { isPolygonClaimUndelegate, isPolygonDelegate, isPolygonUndelegate } from './staking/matic'
5
- import { createStakingApi } from './staking-api'
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 { toUnicode } from 'idna-uts46-hx'
4
- import { keccak256 } from 'js-sha3'
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)
@@ -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)
@@ -1,6 +1,6 @@
1
1
  import assert from 'minimalistic-assert'
2
2
 
3
- import request from './request'
3
+ import request from './request.js'
4
4
 
5
5
  const isValidResponseCheck = (x) =>
6
6
  (x.status === '1' && x.message === 'OK') || x.message === 'No transactions found'
@@ -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'
@@ -1,6 +1,6 @@
1
1
  import assert from 'minimalistic-assert'
2
2
 
3
- import request from './request'
3
+ import request from './request.js'
4
4
 
5
5
  const isValidResponseCheck = (x) =>
6
6
  (x.status === '1' && x.message === 'OK') || x.message === 'No records found'
@@ -1,4 +1,4 @@
1
- import request from './request'
1
+ import request from './request.js'
2
2
 
3
3
  const isValidResponseCheck = (x) => x.result !== undefined
4
4
  const _request = async (...args) => request(isValidResponseCheck, 'proxy', ...args)
@@ -1,7 +1,7 @@
1
- import EventEmitter from 'events/' // '/' forces it to use the module from node_modules
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 { isEmpty } from 'lodash'
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/' // '/' forces it to use the module from node_modules
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')
@@ -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
 
@@ -5,9 +5,11 @@ import {
5
5
  getUnconfirmedSentBalance,
6
6
  } from '@exodus/asset-lib'
7
7
  import { isRpcBalanceAsset } from '@exodus/ethereum-lib'
8
- import { get } from 'lodash'
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
  }
@@ -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',
@@ -1 +1 @@
1
- export { createEthereumHooks } from './monitor'
1
+ export { createEthereumHooks } from './monitor.js'
@@ -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.
@@ -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
 
@@ -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'
@@ -1,10 +1,10 @@
1
1
  import { isNumberUnit } from '@exodus/currency'
2
2
 
3
- import { getServer } from '../../exodus-eth-server'
4
- import { estimateGasLimit } from '../../gas-estimation'
5
- import { fromHexToBigInt } from '../../number-utils'
6
- import { stakingProviderClientFactory } from '../staking-provider-client'
7
- import { EthereumStaking } from './api'
3
+ import { getServer } from '../../exodus-eth-server/index.js'
4
+ import { estimateGasLimit } from '../../gas-estimation.js'
5
+ import { fromHexToBigInt } from '../../number-utils.js'
6
+ import { stakingProviderClientFactory } from '../staking-provider-client.js'
7
+ import { EthereumStaking } from './api.js'
8
8
 
9
9
  const extraGasLimit = 20_000 // extra gas Limit to prevent tx failing if something change on pool state (till tx is in mempool)
10
10
 
@@ -1,4 +1,4 @@
1
- import { EthereumStaking } from './api'
1
+ import { EthereumStaking } from './api.js'
2
2
 
3
3
  const { DELEGATE, UNSTAKE, UNSTAKE_PENDING, CLAIM_UNSTAKE } = EthereumStaking.METHODS_IDS
4
4
 
@@ -1,4 +1,4 @@
1
- export { FantomStaking } from './fantom-staking'
2
- export { stakingProviderClientFactory } from './staking-provider-client'
3
- export * from './ethereum'
4
- export * from './matic'
1
+ export { FantomStaking } from './fantom-staking.js'
2
+ export { stakingProviderClientFactory } from './staking-provider-client.js'
3
+ export * from './ethereum/index.js'
4
+ export * from './matic/index.js'
@@ -4,7 +4,7 @@ import { bufferToHex } from '@exodus/ethereumjs-util'
4
4
  import { retry } from '@exodus/simple-retry'
5
5
  import BN from 'bn.js'
6
6
 
7
- import { getServerByName } from '../../exodus-eth-server'
7
+ import { getServerByName } from '../../exodus-eth-server/index.js'
8
8
 
9
9
  const polygonEthToken = ethAssets.find(({ name: tokenName }) => tokenName === 'polygon')
10
10
 
@@ -1,9 +1,9 @@
1
- export { MaticStakingApi } from './api'
2
- export { createPolygonStakingService, getPolygonStakingInfo } from './service'
1
+ export { MaticStakingApi } from './api.js'
2
+ export { createPolygonStakingService, getPolygonStakingInfo } from './service.js'
3
3
  export {
4
4
  isPolygonTx,
5
5
  isPolygonDelegate,
6
6
  isPolygonUndelegate,
7
7
  isPolygonReward,
8
8
  isPolygonClaimUndelegate,
9
- } from './matic-staking-utils'
9
+ } from './matic-staking-utils.js'
@@ -1,4 +1,4 @@
1
- import { MaticStakingApi } from './api'
1
+ import { MaticStakingApi } from './api.js'
2
2
 
3
3
  // function selector for buyVoucher(uint256 _amount, uint256 _minSharesToMint)
4
4
  const DELEGATE = '0x6ab15071'
@@ -1,10 +1,10 @@
1
1
  import { isNumberUnit } from '@exodus/currency'
2
2
  import BN from 'bn.js'
3
3
 
4
- import { getServer } from '../../exodus-eth-server'
5
- import { estimateGasLimit } from '../../gas-estimation'
6
- import { stakingProviderClientFactory } from '../staking-provider-client'
7
- import { MaticStakingApi } from './api'
4
+ import { getServer } from '../../exodus-eth-server/index.js'
5
+ import { estimateGasLimit } from '../../gas-estimation.js'
6
+ import { stakingProviderClientFactory } from '../staking-provider-client.js'
7
+ import { MaticStakingApi } from './api.js'
8
8
 
9
9
  export function createPolygonStakingService({ assetClientInterface, createAndBroadcastTX }) {
10
10
  const stakingApi = new MaticStakingApi()
@@ -1,15 +1,21 @@
1
1
  import { BaseMonitor } from '@exodus/asset-lib'
2
2
  import { getAssetAddresses, isRpcBalanceAsset } from '@exodus/ethereum-lib'
3
- import { isEmpty } from 'lodash'
3
+ import lodash from 'lodash'
4
4
 
5
- import { fromHexToString } from '../number-utils'
6
- import { filterEffects, getDeriveDataNeededForTick, getLogItemsFromServerTx } from './clarity-utils'
5
+ import { fromHexToString } from '../number-utils.js'
6
+ import {
7
+ filterEffects,
8
+ getDeriveDataNeededForTick,
9
+ getLogItemsFromServerTx,
10
+ } from './clarity-utils/index.js'
7
11
  import {
8
12
  checkPendingTransactions,
9
13
  excludeUnchangedTokenBalances,
10
14
  getAllLogItemsByAsset,
11
15
  getDeriveTransactionsToCheck,
12
- } from './monitor-utils'
16
+ } from './monitor-utils/index.js'
17
+
18
+ const { isEmpty } = lodash
13
19
 
14
20
  export class ClarityMonitor extends BaseMonitor {
15
21
  constructor({ server, config, ...args }) {
@@ -1,12 +1,12 @@
1
1
  import lodash from 'lodash'
2
2
 
3
- import getFeeAmount from '../monitor-utils/get-fee-amount'
4
- import getTransfersByTokenName from '../monitor-utils/get-transfers-by-token-name'
5
- import getValueOfTransfers from '../monitor-utils/get-value-of-transfers'
6
- import isConfirmedServerTx from '../monitor-utils/is-confirmed-server-tx'
7
- import isConsideredSentTokenTx from '../monitor-utils/is-considered-sent-token-tx'
8
- import filterEffects from './filter-effects'
9
- import getNamesOfTokensTransferredByServerTx from './get-names-of-tokens-transferred-by-server-tx'
3
+ import getFeeAmount from '../monitor-utils/get-fee-amount.js'
4
+ import getTransfersByTokenName from '../monitor-utils/get-transfers-by-token-name.js'
5
+ import getValueOfTransfers from '../monitor-utils/get-value-of-transfers.js'
6
+ import isConfirmedServerTx from '../monitor-utils/is-confirmed-server-tx.js'
7
+ import isConsideredSentTokenTx from '../monitor-utils/is-considered-sent-token-tx.js'
8
+ import filterEffects from './filter-effects.js'
9
+ import getNamesOfTokensTransferredByServerTx from './get-names-of-tokens-transferred-by-server-tx.js'
10
10
 
11
11
  // This function takes a server transaction object fetched from magnifier,
12
12
  // and transforms it into Tx models to update the exodus state.
@@ -1,7 +1,7 @@
1
1
  import { FEE_PAYMENT_PREFIX } from '@exodus/ethereum-lib'
2
2
  import lodash from 'lodash'
3
3
 
4
- import getValueOfTransfers from '../monitor-utils/get-value-of-transfers'
4
+ import getValueOfTransfers from '../monitor-utils/get-value-of-transfers.js'
5
5
 
6
6
  // For ETH transactions, we store an array of token names inside
7
7
  // the TX model. This array is used to display text in the UI for
@@ -1,3 +1,3 @@
1
- export { default as getDeriveDataNeededForTick } from './get-derive-data-needed-for-tick'
2
- export { default as getLogItemsFromServerTx } from './get-log-items-from-server-tx'
3
- export { default as filterEffects } from './filter-effects'
1
+ export { default as getDeriveDataNeededForTick } from './get-derive-data-needed-for-tick.js'
2
+ export { default as getLogItemsFromServerTx } from './get-log-items-from-server-tx.js'
3
+ export { default as filterEffects } from './filter-effects.js'
@@ -1,8 +1,8 @@
1
1
  import { BaseMonitor } from '@exodus/asset-lib'
2
2
  import { getAssetAddresses, isRpcBalanceAsset } from '@exodus/ethereum-lib'
3
- import { isEmpty } from 'lodash'
3
+ import lodash from 'lodash'
4
4
 
5
- import { fromHexToString } from '../number-utils'
5
+ import { fromHexToString } from '../number-utils.js'
6
6
  import {
7
7
  checkPendingTransactions,
8
8
  excludeUnchangedTokenBalances,
@@ -11,12 +11,14 @@ import {
11
11
  getDeriveTransactionsToCheck,
12
12
  getHistoryFromServer,
13
13
  getLogItemsFromServerTx,
14
- } from './monitor-utils'
14
+ } from './monitor-utils/index.js'
15
15
  import {
16
16
  enableWSUpdates,
17
17
  subscribeToGasPriceNotifications,
18
18
  subscribeToWSNotifications,
19
- } from './ws-updates'
19
+ } from './ws-updates.js'
20
+
21
+ const { isEmpty } = lodash
20
22
 
21
23
  // The base ethereum monitor class handles listening for, fetching,
22
24
  // formatting, and populating-to-state all ETH/ETC/ERC20 transactions.
@@ -1,15 +1,17 @@
1
1
  import { BaseMonitor } from '@exodus/asset-lib'
2
2
  import { SynchronizedTime } from '@exodus/basic-utils'
3
3
  import { Tx } from '@exodus/models'
4
- import { isEmpty, unionBy, zipObject } from 'lodash'
4
+ import lodash from 'lodash'
5
5
 
6
- import { fromHexToString } from '../number-utils'
6
+ import { fromHexToString } from '../number-utils.js'
7
+ import { UNCONFIRMED_TX_LIMIT } from './monitor-utils/get-derive-transactions-to-check.js'
7
8
  import {
8
9
  excludeUnchangedTokenBalances,
9
10
  getDeriveDataNeededForTick,
10
11
  getDeriveTransactionsToCheck,
11
- } from './monitor-utils'
12
- import { UNCONFIRMED_TX_LIMIT } from './monitor-utils/get-derive-transactions-to-check'
12
+ } from './monitor-utils/index.js'
13
+
14
+ const { isEmpty, unionBy, zipObject } = lodash
13
15
 
14
16
  // The base ethereum monitor no history class handles listening for assets with no history
15
17
 
@@ -1,3 +1,3 @@
1
- export * from './ethereum-monitor'
2
- export * from './ethereum-no-history-monitor'
3
- export { ClarityMonitor } from './clarity-monitor'
1
+ export * from './ethereum-monitor.js'
2
+ export * from './ethereum-no-history-monitor.js'
3
+ export { ClarityMonitor } from './clarity-monitor.js'
@@ -1,5 +1,5 @@
1
- import getFeeAmount from './get-fee-amount'
2
- import getSenderNonceKey from './get-sender-nonce-key'
1
+ import getFeeAmount from './get-fee-amount.js'
2
+ import getSenderNonceKey from './get-sender-nonce-key.js'
3
3
 
4
4
  export default function checkPendingTransactions({
5
5
  pendingTransactionsGroupedByAddressAndNonce = {},
@@ -1,7 +1,7 @@
1
1
  import { SynchronizedTime } from '@exodus/basic-utils'
2
2
  import ms from 'ms'
3
3
 
4
- import getSenderNonceKey from './get-sender-nonce-key'
4
+ import getSenderNonceKey from './get-sender-nonce-key.js'
5
5
 
6
6
  export const UNCONFIRMED_TX_LIMIT = ms('5m')
7
7
 
@@ -1,4 +1,4 @@
1
- import isConfirmedServerTx from './is-confirmed-server-tx'
1
+ import isConfirmedServerTx from './is-confirmed-server-tx.js'
2
2
 
3
3
  // Fetches JSON transaction history from the given Ethereum server
4
4
  // object (from @exodus/ethereum-api). Starts fetching from the given
@@ -1,11 +1,11 @@
1
1
  import lodash from 'lodash'
2
2
 
3
- import getFeeAmount from './get-fee-amount'
4
- import getNamesOfTokensTransferredByServerTx from './get-names-of-tokens-transferred-by-server-tx'
5
- import getTransfersByTokenName from './get-transfers-by-token-name'
6
- import getValueOfTransfers from './get-value-of-transfers'
7
- import isConfirmedServerTx from './is-confirmed-server-tx'
8
- import isConsideredSentTokenTx from './is-considered-sent-token-tx'
3
+ import getFeeAmount from './get-fee-amount.js'
4
+ import getNamesOfTokensTransferredByServerTx from './get-names-of-tokens-transferred-by-server-tx.js'
5
+ import getTransfersByTokenName from './get-transfers-by-token-name.js'
6
+ import getValueOfTransfers from './get-value-of-transfers.js'
7
+ import isConfirmedServerTx from './is-confirmed-server-tx.js'
8
+ import isConsideredSentTokenTx from './is-considered-sent-token-tx.js'
9
9
 
10
10
  // This function takes a server transaction object fetched from magnifier,
11
11
  // and transforms it into Tx models to update the exodus state.
@@ -1,7 +1,7 @@
1
1
  import { FEE_PAYMENT_PREFIX } from '@exodus/ethereum-lib'
2
2
  import lodash from 'lodash'
3
3
 
4
- import getValueOfTransfers from './get-value-of-transfers'
4
+ import getValueOfTransfers from './get-value-of-transfers.js'
5
5
 
6
6
  // For ETH transactions, we store an array of token names inside
7
7
  // the TX model. This array is used to display text in the UI for
@@ -1,8 +1,8 @@
1
- export { default as getDeriveDataNeededForTick } from './get-derive-data-needed-for-tick'
1
+ export { default as getDeriveDataNeededForTick } from './get-derive-data-needed-for-tick.js'
2
2
 
3
- export { default as getAllLogItemsByAsset } from './get-all-log-items-by-asset'
4
- export { default as getLogItemsFromServerTx } from './get-log-items-from-server-tx'
5
- export { default as getHistoryFromServer } from './get-history-from-server'
6
- export { default as checkPendingTransactions } from './check-pending-transactions'
7
- export { default as getDeriveTransactionsToCheck } from './get-derive-transactions-to-check'
8
- export * from './exclude-unchanged-token-balances'
3
+ export { default as getAllLogItemsByAsset } from './get-all-log-items-by-asset.js'
4
+ export { default as getLogItemsFromServerTx } from './get-log-items-from-server-tx.js'
5
+ export { default as getHistoryFromServer } from './get-history-from-server.js'
6
+ export { default as checkPendingTransactions } from './check-pending-transactions.js'
7
+ export { default as getDeriveTransactionsToCheck } from './get-derive-transactions-to-check.js'
8
+ export * from './exclude-unchanged-token-balances.js'
@@ -3,8 +3,12 @@ import {
3
3
  isEthereumDelegate,
4
4
  isEthereumUndelegate,
5
5
  isEthereumUndelegatePending,
6
- } from '../staking/ethereum/staking-utils'
7
- import { isPolygonClaimUndelegate, isPolygonDelegate, isPolygonUndelegate } from '../staking/matic'
6
+ } from '../staking/ethereum/staking-utils.js'
7
+ import {
8
+ isPolygonClaimUndelegate,
9
+ isPolygonDelegate,
10
+ isPolygonUndelegate,
11
+ } from '../staking/matic/index.js'
8
12
  import {
9
13
  calculateRewardsFromStakeTx,
10
14
  decodeEthLikeStakingTxInputAmount,
@@ -1,4 +1,4 @@
1
- import { assetStakingTxData } from './asset-staking-tx-data'
1
+ import { assetStakingTxData } from './asset-staking-tx-data.js'
2
2
 
3
3
  const getTxStakingData = ({ assetName, currency, tx }) => {
4
4
  return assetStakingTxData[assetName]({ tx, currency })
@@ -1,7 +1,7 @@
1
1
  import { asset as ethereum } from '@exodus/ethereum-meta'
2
2
  import { asset as ethereumholesky } from '@exodus/ethereumholesky-meta'
3
3
 
4
- import { EthereumStaking, isEthereumStakingTx, MaticStakingApi } from '../staking'
4
+ import { EthereumStaking, isEthereumStakingTx, MaticStakingApi } from '../staking/index.js'
5
5
 
6
6
  const polygonStakingApi = new MaticStakingApi()
7
7
  const ethereumStakingApi = new EthereumStaking(ethereum)
@@ -1,4 +1,4 @@
1
- import { fetchGasLimit } from '../gas-estimation'
1
+ import { fetchGasLimit } from '../gas-estimation.js'
2
2
 
3
3
  const getFeeInfo = async function getFeeInfo({
4
4
  assetClientInterface,
@@ -1,2 +1,2 @@
1
- export { default as txSendFactory } from './tx-send'
2
- export { default as getFeeInfo } from './get-fee-info'
1
+ export { default as txSendFactory } from './tx-send.js'
2
+ export { default as getFeeInfo } from './get-fee-info.js'
@@ -3,10 +3,10 @@
3
3
  import { calculateBumpedGasPrice, isEthereumLikeToken, normalizeTxId } from '@exodus/ethereum-lib'
4
4
  import assert from 'minimalistic-assert'
5
5
 
6
- import * as ErrorWrapper from '../error-wrapper'
7
- import { getNonce, transactionExists } from '../eth-like-util'
8
- import { getNftArguments } from '../nft-utils'
9
- import getFeeInfo from './get-fee-info'
6
+ import * as ErrorWrapper from '../error-wrapper.js'
7
+ import { getNonce, transactionExists } from '../eth-like-util.js'
8
+ import { getNftArguments } from '../nft-utils.js'
9
+ import getFeeInfo from './get-fee-info.js'
10
10
 
11
11
  const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
12
12
  assert(assetClientInterface, 'assetClientInterface is required')
package/src/web3/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createSimulateMessage } from './createSimulateMessage'
1
+ import { createSimulateMessage } from './createSimulateMessage.js'
2
2
 
3
3
  export const createWeb3API = (deps) => {
4
4
  return {