@exodus/ethereum-lib 5.2.1 → 5.4.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 CHANGED
@@ -3,6 +3,33 @@
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
+ ## [5.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.3.0...@exodus/ethereum-lib@5.4.0) (2024-09-11)
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
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * lint for EVM assets ([#2969](https://github.com/ExodusMovement/assets/issues/2969)) ([16ca272](https://github.com/ExodusMovement/assets/commit/16ca272524ab1530800ca84f1df045293c08a3aa))
17
+
18
+
19
+
20
+ ## [5.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.2.1...@exodus/ethereum-lib@5.3.0) (2024-06-23)
21
+
22
+
23
+ ### ⚠ BREAKING CHANGES
24
+
25
+ * remove assetType from ethereum-lib (#2415)
26
+
27
+ ### Bug Fixes
28
+
29
+ * remove assetType from ethereum-lib ([#2415](https://github.com/ExodusMovement/assets/issues/2415)) ([98c2c01](https://github.com/ExodusMovement/assets/commit/98c2c018aa6328b21035afee848f431b349ab6ae))
30
+
31
+
32
+
6
33
  ## [5.2.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.2.0...@exodus/ethereum-lib@5.2.1) (2024-06-10)
7
34
 
8
35
  **Note:** Version bump only for package @exodus/ethereum-lib
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "5.2.1",
3
+ "version": "5.4.0",
4
4
  "description": "Ethereum Library",
5
+ "type": "module",
5
6
  "main": "src/index.js",
6
7
  "files": [
7
8
  "src",
@@ -15,20 +16,19 @@
15
16
  "access": "restricted"
16
17
  },
17
18
  "scripts": {
18
- "test": "run -T jest",
19
- "lint": "run -T eslint .",
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-lib": "^4.1.0",
24
- "@exodus/basic-utils": "^0.7.0",
25
- "@exodus/currency": "^2.3.2",
26
- "@exodus/ethereum-meta": "^1.5.1",
24
+ "@exodus/basic-utils": "^3.0.1",
25
+ "@exodus/currency": "^5.0.2",
26
+ "@exodus/ethereum-meta": "^2.0.0",
27
27
  "@exodus/ethereumjs-common": "^2.4.0-exodus.6",
28
28
  "@exodus/ethereumjs-tx": "^3.3.0-exodus.7",
29
29
  "@exodus/ethereumjs-util": "^7.1.0-exodus.7",
30
30
  "@exodus/key-utils": "^3.1.0",
31
- "@exodus/models": "^11.0.0",
31
+ "@exodus/models": "^12.0.1",
32
32
  "@exodus/solidity-contract": "^1.1.3",
33
33
  "@metamask/eth-sig-util": "^4.0.1",
34
34
  "base-x": "^3.0.2",
@@ -39,13 +39,13 @@
39
39
  "reselect": "^3.0.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@exodus/assets": "^9.1.1",
43
- "@exodus/bitcoin-meta": "^1.0.2",
44
- "@exodus/bsc-meta": "^1.2.2",
42
+ "@exodus/assets": "^11.0.0",
43
+ "@exodus/bitcoin-meta": "^2.0.0",
44
+ "@exodus/bsc-meta": "^2.0.0",
45
45
  "@exodus/elliptic": "^6.5.4-precomputed",
46
- "@exodus/ethereumclassic-meta": "^1.0.3",
47
- "@exodus/fantommainnet-meta": "^1.1.2",
48
- "@exodus/matic-meta": "^1.3.0"
46
+ "@exodus/ethereumclassic-meta": "^2.0.0",
47
+ "@exodus/fantommainnet-meta": "^2.0.0",
48
+ "@exodus/matic-meta": "^2.0.0"
49
49
  },
50
50
  "bugs": {
51
51
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aethereum-lib"
@@ -54,5 +54,5 @@
54
54
  "type": "git",
55
55
  "url": "git+https://github.com/ExodusMovement/assets.git"
56
56
  },
57
- "gitHead": "42f5df2495567a687ee9903b581195d0ce4e0c07"
57
+ "gitHead": "f35119e354e7bf4555b3bb6b453293c61e44fdd9"
58
58
  }
package/src/abi/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import ant from './ant'
2
- import cdai from './cdai'
3
- import dai from './dai'
4
- import erc20 from './ierc20-extended'
5
- import erc20BytesParams from './ierc20-bytes-params'
6
- import erc721 from './erc721'
7
- import ethStakingAccounting from './eth-staking-accounting'
8
- import ethStakingPool from './eth-staking-pool'
9
- import gnt from './gnt'
1
+ import ant from './ant.js'
2
+ import cdai from './cdai.js'
3
+ import dai from './dai.js'
4
+ import ensRegistry from './ens-registry.js'
5
+ import ensResolver from './ens-resolver.js'
6
+ import erc721 from './erc721.js'
7
+ import ethStakingAccounting from './eth-staking-accounting.js'
8
+ import ethStakingPool from './eth-staking-pool.js'
9
+ import fantomSfc from './fantom-sfc.js'
10
+ import gnt from './gnt.js'
11
+ import erc20BytesParams from './ierc20-bytes-params.js'
12
+ import erc20 from './ierc20-extended.js'
10
13
  import kyberv2 from './kyberv2.js'
11
- import loomv2Swap from './loomv2-swap'
12
- import repv2 from './repv2'
13
- import scdMcdMigration from './scd-mcd-migration'
14
- import maticValidatorShare from './matic-validator-share'
15
- import maticStakingManager from './matic-staking-manager'
16
- import matic from './matic'
17
- import fantomSfc from './fantom-sfc'
18
- import ensRegistry from './ens-registry'
19
- import ensResolver from './ens-resolver'
20
- import optimismGasOracle from './optimism-gas-oracle'
14
+ import loomv2Swap from './loomv2-swap.js'
15
+ import matic from './matic.js'
16
+ import maticStakingManager from './matic-staking-manager.js'
17
+ import maticValidatorShare from './matic-validator-share.js'
18
+ import optimismGasOracle from './optimism-gas-oracle.js'
19
+ import repv2 from './repv2.js'
20
+ import scdMcdMigration from './scd-mcd-migration.js'
21
21
 
22
22
  const index = {
23
23
  ant,
@@ -1,6 +1,6 @@
1
1
  import { AccountState } from '@exodus/models'
2
2
 
3
- import { parseLegacyBalances } from './parse-legacy-balances'
3
+ import { parseLegacyBalances } from './parse-legacy-balances.js'
4
4
 
5
5
  // `assets` are only needed for chains that may need legacy parsing and staking support
6
6
  export default function createEthereumLikeAccountState({ asset, extraData = {}, assets = {} }) {
@@ -1,5 +1,7 @@
1
1
  import { isNumberUnit } from '@exodus/currency'
2
- import { isNumber, isString } from 'lodash'
2
+ import lodash from 'lodash'
3
+
4
+ const { isNumber, isString } = lodash
3
5
 
4
6
  function parseBalance({ asset, balance }) {
5
7
  const currency = asset.currency
package/src/constants.js CHANGED
@@ -1,35 +1,31 @@
1
1
  import { mapValues } from '@exodus/basic-utils'
2
2
 
3
+ /* @deprecated */
3
4
  const CHAIN_DATA = {
4
5
  ethereum: {
5
6
  chainId: 1,
6
7
  serverUrl: 'https://geth.a.exodus.io/wallet/v1/',
7
8
  confirmationsNumber: 30,
8
- tokenType: 'ETHEREUM_ERC20',
9
9
  },
10
10
  ethereumclassic: {
11
11
  chainId: 61,
12
12
  serverUrl: 'https://getc.a.exodus.io/wallet/v1/',
13
13
  confirmationsNumber: 5000,
14
- // tokenType: // we do not support tokens
15
14
  },
16
15
  ethereumgoerli: {
17
16
  chainId: 5,
18
17
  serverUrl: 'https://geth-goerli-testnet-d.a.exodus.io/wallet/v1/',
19
18
  confirmationsNumber: 30,
20
- tokenType: 'ETHEREUM_GOERLI_ERC20',
21
19
  },
22
20
  ethereumholesky: {
23
21
  chainId: 17_000,
24
22
  serverUrl: 'https://geth-holesky-testnet-d.a.exodus.io/wallet/v1/',
25
23
  confirmationsNumber: 30,
26
- tokenType: 'ETHEREUM_HOLESKY_ERC20',
27
24
  },
28
25
  ethereumsepolia: {
29
26
  chainId: 11_155_111,
30
27
  serverUrl: 'https://geth-sepolia-testnet-d.a.exodus.io/wallet/v1/',
31
28
  confirmationsNumber: 30,
32
- tokenType: 'ETHEREUM_SEPOLIA_ERC20',
33
29
  },
34
30
  bsc: {
35
31
  chainId: 56,
@@ -42,7 +38,6 @@ const CHAIN_DATA = {
42
38
  chainId: 137,
43
39
  serverUrl: 'https://polygon.a.exodus.io/wallet/v1/',
44
40
  confirmationsNumber: 50,
45
- tokenType: 'MATIC_ERC20',
46
41
  },
47
42
  avalanchec: {
48
43
  chainId: 43_114,
@@ -54,27 +49,23 @@ const CHAIN_DATA = {
54
49
  chainId: 250,
55
50
  serverUrl: 'https://fantom.a.exodus.io/wallet/v1/',
56
51
  confirmationsNumber: 3,
57
- tokenType: 'FTM_ERC20',
58
52
  },
59
53
  harmonymainnet: {
60
54
  chainId: 1_666_600_000,
61
55
  serverUrl: 'https://harmony.a.exodus.io/wallet/v1/',
62
56
  confirmationsNumber: 6,
63
- // tokenType: // we do not support tokens yet
64
57
  },
65
58
  ethereumarbnova: {
66
59
  chainId: 42_170,
67
60
  serverUrl: 'https://arbitrum-nova-clarity.a.exodus.io',
68
61
  confirmationsNumber: 3,
69
62
  monitorType: 'clarity',
70
- tokenType: 'ETHEREUM_ARBONE_ERC20',
71
63
  },
72
64
  ethereumarbone: {
73
65
  chainId: 42_161,
74
66
  serverUrl: 'https://arbitrum-one-clarity.a.exodus.io',
75
67
  confirmationsNumber: 3,
76
68
  monitorType: 'clarity',
77
- tokenType: 'ETHEREUM_ARBNOVA_ERC20',
78
69
  },
79
70
  optimism: {
80
71
  chainId: 10,
@@ -88,77 +79,73 @@ const CHAIN_DATA = {
88
79
  serverUrl: 'https://rsk.a.exodus.io',
89
80
  confirmationsNumber: 3,
90
81
  monitorType: 'no-history',
91
- tokenType: 'RSK_ERC20',
92
82
  },
93
83
  flare: {
94
84
  chainId: 14,
95
85
  serverUrl: 'https://flare-nn.a.exodus.io/ext/C/rpc',
96
86
  confirmationsNumber: 30,
97
87
  monitorType: 'no-history',
98
- tokenType: 'FLR_ERC20',
99
88
  },
100
89
  aurora: {
101
90
  chainId: 1_313_161_554,
102
91
  serverUrl: 'https://aurora.a.exodus.io',
103
92
  confirmationsNumber: 3,
104
93
  monitorType: 'no-history',
105
- tokenType: 'AURORA_ERC20',
106
94
  },
107
95
  basemainnet: {
108
96
  chainId: 8453,
109
97
  serverUrl: 'https://base-qn.a.exodus.io',
110
98
  confirmationsNumber: 30,
111
99
  monitorType: 'no-history',
112
- tokenType: 'BASE_ERC20',
113
100
  },
114
101
  cronos: {
115
102
  chainId: 25,
116
103
  serverUrl: 'https://cronos.a.exodus.io',
117
104
  confirmationsNumber: 6,
118
105
  monitorType: 'no-history',
119
- tokenType: 'CRC20',
120
106
  },
121
107
  mantle: {
122
108
  chainId: 5000,
123
109
  serverUrl: 'https://mantle-qn.a.exodus.io',
124
110
  confirmationsNumber: 30,
125
111
  monitorType: 'no-history',
126
- tokenType: 'MNT_20',
127
112
  },
128
113
  mantlesepolia: {
129
114
  chainId: 5003,
130
115
  serverUrl: 'https://mantle-sepolia-qn.a.exodus.io',
131
116
  confirmationsNumber: 30,
132
117
  monitorType: 'no-history',
133
- tokenType: 'SPMNT_20',
134
118
  },
135
119
  ethereumarbonesepolia: {
136
120
  chainId: 421_614,
137
121
  serverUrl: 'https://arbitrum-sepolia-qn.a.exodus.io',
138
122
  confirmationsNumber: 3,
139
123
  monitorType: 'no-history',
140
- tokenType: 'ETHEREUM_ARBONE_SEPOLIA_ERC20',
141
124
  },
142
125
  }
143
126
 
127
+ /* @deprecated */
144
128
  export const DEFAULT_SERVER_URLS = mapValues(CHAIN_DATA, ({ serverUrl }) => serverUrl)
129
+ /* @deprecated */
145
130
  export const ETHEREUM_LIKE_MONITOR_TYPES = mapValues(
146
131
  CHAIN_DATA,
147
132
  ({ monitorType }) => monitorType || 'magnifier'
148
133
  )
134
+ /* @deprecated */
149
135
  export const CHAIN_IDS = mapValues(CHAIN_DATA, ({ chainId }) => chainId)
150
136
 
151
137
  export const MIN_GASPRICE = 1e9 // 1 gwei
152
138
  export const DEFAULT_FEE_MONITOR_INTERVAL = '1m'
139
+ /* @deprecated */
153
140
  export const CONFIRMATIONS_NUMBER = mapValues(
154
141
  CHAIN_DATA,
155
142
  ({ confirmationsNumber }) => confirmationsNumber
156
143
  )
144
+ /* @deprecated */
157
145
  export const ETHEREUM_LIKE_ASSETS = Object.keys(CHAIN_DATA)
158
- export const ETHEREUM_LIKE_TOKEN_TYPES = Object.values(CHAIN_DATA)
159
- .filter(({ tokenType }) => tokenType)
160
- .map(({ tokenType }) => tokenType)
146
+
161
147
  export const BUMP_RATE = 1.2
148
+ /* @deprecated */
162
149
  export const ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES = Object.keys(CHAIN_DATA).filter(
163
150
  (key) => CHAIN_DATA[key].monitorType === 'no-history'
164
151
  )
@@ -1,5 +1,6 @@
1
1
  import SolidityContract from '@exodus/solidity-contract'
2
- import ABI from '../abi'
2
+
3
+ import ABI from '../abi/index.js'
3
4
 
4
5
  export default function createContract(address, contractName) {
5
6
  // keep switch logic in anticipation of support for ERC721
package/src/index.js CHANGED
@@ -1,12 +1,12 @@
1
- export * from './encode'
2
- export * from './unsigned-tx'
3
- export * from './utils'
4
- export * from './constants'
5
- export * from './selectors'
6
- export { signMessage, signMessageWithSigner } from './sign-message'
7
- export { default as createGetKeyIdentifier } from './key-identifier'
8
- export { default as createEthereumLikeAccountState } from './account-state'
1
+ export * from './encode.js'
2
+ export * from './unsigned-tx/index.js'
3
+ export * from './utils/index.js'
4
+ export * from './constants.js'
5
+ export * from './selectors/index.js'
6
+ export { signMessage, signMessageWithSigner } from './sign-message.js'
7
+ export { default as createGetKeyIdentifier } from './key-identifier.js'
8
+ export { default as createEthereumLikeAccountState } from './account-state/index.js'
9
9
 
10
- export { default as createContract } from './create-contract'
11
- export { default as ABI } from './abi'
12
- export { ethStakeAccountState } from './account-state/staking-data'
10
+ export { default as createContract } from './create-contract/index.js'
11
+ export { default as ABI } from './abi/index.js'
12
+ export { ethStakeAccountState } from './account-state/staking-data.js'
@@ -1,5 +1,5 @@
1
- import assert from 'minimalistic-assert'
2
1
  import { createGetKeyIdentifier, unhardenDerivationIndex } from '@exodus/key-utils'
2
+ import assert from 'minimalistic-assert'
3
3
 
4
4
  const createEthereumGetKeyIdentifier =
5
5
  ({ bip44, assetName, keyType = 'secp256k1', allowMetaMaskCompat = false } = {}) =>
@@ -1,7 +1,8 @@
1
- import { createSelector } from 'reselect'
2
1
  import ms from 'ms'
3
- import { isEthereumLike } from '../utils'
4
- import { BUMP_RATE } from '../constants'
2
+ import { createSelector } from 'reselect'
3
+
4
+ import { BUMP_RATE } from '../constants.js'
5
+ import { isEthereumLike } from '../utils/index.js'
5
6
 
6
7
  const MINUTE = ms('1m')
7
8
  const BumpType = {
@@ -3,6 +3,6 @@ export {
3
3
  calculateBumpedGasPrice,
4
4
  getPendingNonExchangeTxs,
5
5
  getAssetPendingNonExchangeTxs,
6
- } from './get-can-accelerate-tx-factory'
6
+ } from './get-can-accelerate-tx-factory.js'
7
7
 
8
- export { default as getIsEnoughBalanceToAccelerateSelectorFactory } from './get-is-enough-balance-to-accelerate-factory'
8
+ export { default as getIsEnoughBalanceToAccelerateSelectorFactory } from './get-is-enough-balance-to-accelerate-factory.js'
@@ -1,14 +1,15 @@
1
- import assert from 'minimalistic-assert'
1
+ import { hashPersonalMessage, toBuffer } from '@exodus/ethereumjs-util'
2
2
  import {
3
- SignTypedDataVersion,
4
- typedSignatureHash,
5
- TypedDataUtils,
3
+ concatSig,
6
4
  personalSign,
7
5
  signTypedData,
8
- concatSig,
6
+ SignTypedDataVersion,
7
+ TypedDataUtils,
8
+ typedSignatureHash,
9
9
  } from '@metamask/eth-sig-util'
10
- import { hashPersonalMessage, toBuffer } from '@exodus/ethereumjs-util'
11
- import { normalizeRecoveryParam } from './utils/ecdsa'
10
+ import assert from 'minimalistic-assert'
11
+
12
+ import { normalizeRecoveryParam } from './utils/ecdsa.js'
12
13
 
13
14
  function hex0xStringToBuffer(hex) {
14
15
  // Remove the 0x
@@ -68,7 +69,7 @@ export const signMessage = async ({ privateKey, message }) => {
68
69
  * @param {object} params
69
70
  * @param {{rawMessage: Buffer, EIP712Message: any}} params.message
70
71
  * @param {Signer} signer
71
- * @return {Promise<string>}
72
+ * @returns {Promise<string>}
72
73
  */
73
74
  export async function signMessageWithSigner({ message, signer }) {
74
75
  const { rawMessage, EIP712Message } = message
@@ -1,5 +1,5 @@
1
- import createUnsignedTxFactory from './create-unsigned-tx'
2
- import signUnsignedTx from './sign-unsigned-tx'
1
+ import createUnsignedTxFactory from './create-unsigned-tx.js'
2
+ import signUnsignedTx from './sign-unsigned-tx.js'
3
3
 
4
4
  export default function createAndSignTxFactory({ chainId }) {
5
5
  return (input, privateKey) => {
@@ -1,5 +1,7 @@
1
- import { Transaction, FeeMarketEIP1559Transaction } from '@exodus/ethereumjs-tx'
2
- import Common, { Hardfork } from '@exodus/ethereumjs-common'
1
+ import CommonCJS, { Hardfork } from '@exodus/ethereumjs-common'
2
+ import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs-tx'
3
+
4
+ const Common = CommonCJS.default || CommonCJS
3
5
 
4
6
  export default function createEthereumJsTx(unsignedTx) {
5
7
  const {
@@ -1,9 +1,9 @@
1
1
  import { toBuffer } from '@exodus/ethereumjs-util'
2
2
  import { intToBuffer } from 'ethjs-util'
3
-
4
- import { isToken, currency2buffer } from '../utils'
5
3
  import assert from 'minimalistic-assert'
6
4
 
5
+ import { currency2buffer, isToken } from '../utils/index.js'
6
+
7
7
  export default function createUnsignedTxFactory({ chainId }) {
8
8
  assert(typeof chainId === 'number', 'chainId is required')
9
9
  return ({
@@ -1,6 +1,6 @@
1
- export { default as createUnsignedTxFactory } from './create-unsigned-tx'
2
- export { default as parseUnsignedTx } from './parse-unsigned-tx'
3
- export { default as signUnsignedTx, signUnsignedTxWithSigner } from './sign-unsigned-tx'
4
- export { default as createAndSignTxFactory } from './create-and-sign-tx'
5
- export { default as createEthereumJsTx } from './create-ethereumjs-tx'
6
- export { signHardwareFactory } from './sign-hardware'
1
+ export { default as createUnsignedTxFactory } from './create-unsigned-tx.js'
2
+ export { default as parseUnsignedTx } from './parse-unsigned-tx.js'
3
+ export { default as signUnsignedTx, signUnsignedTxWithSigner } from './sign-unsigned-tx.js'
4
+ export { default as createAndSignTxFactory } from './create-and-sign-tx.js'
5
+ export { default as createEthereumJsTx } from './create-ethereumjs-tx.js'
6
+ export { signHardwareFactory } from './sign-hardware.js'
@@ -1,5 +1,6 @@
1
1
  import * as ethUtil from '@exodus/ethereumjs-util'
2
- import { isToken, buffer2currency } from '../utils'
2
+
3
+ import { buffer2currency, isToken } from '../utils/index.js'
3
4
 
4
5
  export default function parseUnsignedTx(asset, unsignedTx) {
5
6
  const { txData } = unsignedTx
@@ -1,5 +1,6 @@
1
1
  import assert from 'minimalistic-assert'
2
- import createEthereumJsTx from './create-ethereumjs-tx'
2
+
3
+ import createEthereumJsTx from './create-ethereumjs-tx.js'
3
4
 
4
5
  export const signHardwareFactory =
5
6
  ({ baseAssetName }) =>
@@ -1,4 +1,4 @@
1
- import createEthereumJsTx from './create-ethereumjs-tx'
1
+ import createEthereumJsTx from './create-ethereumjs-tx.js'
2
2
 
3
3
  function prepareRawTx(signedTx) {
4
4
  // serialize and get txId
@@ -1,50 +1,63 @@
1
- import baseX from 'base-x'
2
- import * as ethUtil from '@exodus/ethereumjs-util'
3
- import {
4
- ETHEREUM_LIKE_ASSETS,
5
- ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES,
6
- ETHEREUM_LIKE_TOKEN_TYPES,
7
- } from '../constants'
8
1
  import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs-tx'
9
- import { uniq } from 'lodash'
2
+ import * as ethUtil from '@exodus/ethereumjs-util'
3
+ import baseX from 'base-x'
4
+ import lodash from 'lodash'
5
+
6
+ // eslint-disable-next-line @exodus/import/no-deprecated
7
+ import { ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES } from '../constants.js'
10
8
 
11
- export { default as calculateExtraEth } from './calculate-extra-eth'
9
+ const { uniq } = lodash
10
+
11
+ export { default as calculateExtraEth } from './calculate-extra-eth.js'
12
12
 
13
13
  const base10 = baseX('0123456789')
14
14
  const base16 = baseX('0123456789abcdef')
15
15
 
16
+ /* @deprecated */
16
17
  export const isEthereumToken = (asset) => asset.assetType === 'ETHEREUM_ERC20'
18
+ /* @deprecated */
17
19
  export const isEthereumGoerliToken = (asset) => asset.assetType === 'ETHEREUM_GOERLI_ERC20'
20
+ /* @deprecated */
18
21
  export const isEthereumHoleskyToken = (asset) => asset.assetType === 'ETHEREUM_HOLESKY_ERC20'
22
+ /* @deprecated */
19
23
  export const isEthereumSepoliaToken = (asset) => asset.assetType === 'ETHEREUM_SEPOLIA_ERC20'
24
+ /* @deprecated */
20
25
  export const isBscToken = (asset) => asset.assetType === 'BSC_BEP20'
26
+ /* @deprecated */
21
27
  export const isPolygonToken = (asset) => asset.assetType === 'MATIC_ERC20'
28
+ /* @deprecated */
22
29
  export const isAvalancheToken = (asset) => asset.assetType === 'AVAX_ERC20'
30
+ /* @deprecated */
23
31
  export const isFantomToken = (asset) => asset.assetType === 'FTM_ERC20'
32
+ /* @deprecated */
24
33
  export const isArbitrumNovaToken = (asset) => asset.assetType === 'ETHEREUM_ARBNOVA_ERC20'
34
+ /* @deprecated */
25
35
  export const isArbitrumOneToken = (asset) => asset.assetType === 'ETHEREUM_ARBONE_ERC20'
36
+ /* @deprecated */
26
37
  export const isRootstockToken = (asset) => asset.assetType === 'RSK_ERC20'
38
+ /* @deprecated */
27
39
  export const isOptimismToken = (asset) => asset.assetType === 'OPT_ERC20'
40
+ /* @deprecated */
28
41
  export const isFlareToken = (asset) => asset.assetType === 'FLR_ERC20'
42
+ /* @deprecated */
29
43
  export const isAuroraToken = (asset) => asset.assetType === 'AURORA_ERC20'
44
+ /* @deprecated */
30
45
  export const isCronosToken = (asset) => asset.assetType === 'CRC20'
46
+ /* @deprecated */
31
47
  export const isBaseMainnetToken = (asset) => asset.assetType === 'BASE_ERC20'
32
48
 
33
49
  // All ethereum-like tokens
34
- export const isEthereumLikeToken = (asset) => ETHEREUM_LIKE_TOKEN_TYPES.includes(asset.assetType)
35
- // @deprecated
36
- export const isEthereumLikeTokenByName = (assetName) => {
37
- throw new Error('Please use isEthereumLikeToken() instead')
38
- }
50
+ export const isEthereumLikeToken = (asset) =>
51
+ isEthereumLikeAsset(asset.baseAsset) && asset.baseAsset.name !== asset.name
39
52
 
53
+ // @deprecated
40
54
  export const isToken = isEthereumLikeToken
41
55
 
42
56
  // All ethereum-like assets (native coins)
43
- export const isEthereumLikeAsset = (asset) => isEthereumLikeAssetByName(asset.name)
44
- export const isEthereumLikeAssetByName = (assetName) => ETHEREUM_LIKE_ASSETS.includes(assetName)
57
+ export const isEthereumLikeAsset = (asset) => asset.assetType === 'ETHEREUM_LIKE'
45
58
 
46
59
  // All ethereum-like assets and tokens
47
- export const isEthereumLike = (asset) => ETHEREUM_LIKE_ASSETS.includes(asset.baseAsset.name)
60
+ export const isEthereumLike = (asset) => isEthereumLikeAsset(asset.baseAsset)
48
61
  // @deprecated
49
62
  export const isEthereumLikeByName = (assetName) => {
50
63
  throw new Error('Please use isEthereumLike() instead')
@@ -150,6 +163,7 @@ export const isRpcBalanceAsset = (asset) =>
150
163
  'steth',
151
164
  'weth',
152
165
  ...customTokensWithRpcBalance,
166
+ // eslint-disable-next-line @exodus/import/no-deprecated
153
167
  ].includes(asset.name) || ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES.includes(asset.baseAsset.name)
154
168
 
155
169
  export const getAssetAddresses = (asset) => {