@exodus/ethereum-lib 5.2.0 → 5.3.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 ADDED
@@ -0,0 +1,182 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [5.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.2.1...@exodus/ethereum-lib@5.3.0) (2024-06-23)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * remove assetType from ethereum-lib (#2415)
12
+
13
+ ### Bug Fixes
14
+
15
+ * remove assetType from ethereum-lib ([#2415](https://github.com/ExodusMovement/assets/issues/2415)) ([98c2c01](https://github.com/ExodusMovement/assets/commit/98c2c018aa6328b21035afee848f431b349ab6ae))
16
+
17
+
18
+
19
+ ## [5.2.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.2.0...@exodus/ethereum-lib@5.2.1) (2024-06-10)
20
+
21
+ **Note:** Version bump only for package @exodus/ethereum-lib
22
+
23
+
24
+
25
+
26
+
27
+ ## [5.2.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.1.1...@exodus/ethereum-lib@5.2.0) (2024-05-23)
28
+
29
+
30
+ ### Features
31
+
32
+ * add arbone sepolia ([#2359](https://github.com/ExodusMovement/assets/issues/2359)) ([3056882](https://github.com/ExodusMovement/assets/commit/3056882cad08722fdad14ffdb2149208af469cdf))
33
+ * Mantle Sepolia support ([#2355](https://github.com/ExodusMovement/assets/issues/2355)) ([fff6710](https://github.com/ExodusMovement/assets/commit/fff6710a76cbac3f218a018090c210e03882439a))
34
+
35
+
36
+
37
+ ## [5.1.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.1.0...@exodus/ethereum-lib@5.1.1) (2024-05-21)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * remove unused ethereum-lib prod deps ([#2339](https://github.com/ExodusMovement/assets/issues/2339)) ([3f02d06](https://github.com/ExodusMovement/assets/commit/3f02d06f34881bdbec8f7de9fbb2dd52d0e20547))
43
+
44
+
45
+
46
+ ## [5.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.0.1...@exodus/ethereum-lib@5.1.0) (2024-05-20)
47
+
48
+
49
+ ### Features
50
+
51
+ * add Mantle EVM ([#2320](https://github.com/ExodusMovement/assets/issues/2320)) ([14ca748](https://github.com/ExodusMovement/assets/commit/14ca7486703bf4b1a16fa6af522e82a9e1309156))
52
+
53
+
54
+
55
+ ## [5.0.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.0.0...@exodus/ethereum-lib@5.0.1) (2024-05-20)
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * gracefully handle different recovery param notations ([#2326](https://github.com/ExodusMovement/assets/issues/2326)) ([e7d0fbf](https://github.com/ExodusMovement/assets/commit/e7d0fbf389ace17b36e8792116df33b98fb872de))
61
+
62
+
63
+
64
+ ## [5.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.9.0...@exodus/ethereum-lib@5.0.0) (2024-05-17)
65
+
66
+
67
+ ### ⚠ BREAKING CHANGES
68
+
69
+ * evm chain data to be factory params (#2115)
70
+ * chain id param in create and sign tx (#2282)
71
+ * moved fee data to each EVM plugin (#2233)
72
+ * evm useEip1191ChainIdChecksum param (#2110)
73
+ * clean up evms fee data monitors (#2230)
74
+
75
+ ### Features
76
+
77
+ * demote USDC.e tokens ([#2300](https://github.com/ExodusMovement/assets/issues/2300)) ([17a51b3](https://github.com/ExodusMovement/assets/commit/17a51b3b2d42e70f55d41e8eb581e89cba19daed))
78
+ * evm chain data to be factory params ([#2115](https://github.com/ExodusMovement/assets/issues/2115)) ([a2aeec1](https://github.com/ExodusMovement/assets/commit/a2aeec1b4da177b1e1bb85f92e93115fc97d5377))
79
+
80
+
81
+ ### Code Refactoring
82
+
83
+ * chain id param in create and sign tx ([#2282](https://github.com/ExodusMovement/assets/issues/2282)) ([4d915ac](https://github.com/ExodusMovement/assets/commit/4d915ac60e49ebe9d4e36d2fcecf7c17777f13b9))
84
+ * clean up evms fee data monitors ([#2230](https://github.com/ExodusMovement/assets/issues/2230)) ([4e7a18f](https://github.com/ExodusMovement/assets/commit/4e7a18f799e0800c01e07ca83ddaf6778ada23ce))
85
+ * evm useEip1191ChainIdChecksum param ([#2110](https://github.com/ExodusMovement/assets/issues/2110)) ([2169686](https://github.com/ExodusMovement/assets/commit/2169686cb4c11bb8f0691196b25002b6cf462e1e))
86
+ * moved fee data to each EVM plugin ([#2233](https://github.com/ExodusMovement/assets/issues/2233)) ([ec066c0](https://github.com/ExodusMovement/assets/commit/ec066c076bc36a4c7c05810e83cdd47a7a25384b))
87
+
88
+
89
+
90
+ ## [4.9.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.8.0...@exodus/ethereum-lib@4.9.0) (2024-05-10)
91
+
92
+
93
+ ### Features
94
+
95
+ * pass `signatureType` to external signer for ethereum likes ([#2245](https://github.com/ExodusMovement/assets/issues/2245)) ([690593e](https://github.com/ExodusMovement/assets/commit/690593e3a17d8465a10d3b3b0f669742d60f7b15))
96
+
97
+
98
+ ### Bug Fixes
99
+
100
+ * enable Base eip1559 ([#2210](https://github.com/ExodusMovement/assets/issues/2210)) ([8b7e807](https://github.com/ExodusMovement/assets/commit/8b7e807907e961aae47d3beb50cd69502e5a04e2))
101
+
102
+
103
+
104
+ ## [4.8.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.8.0...@exodus/ethereum-lib@4.8.1) (2024-05-04)
105
+
106
+
107
+ ### Bug Fixes
108
+
109
+ * enable Base eip1559 ([#2210](https://github.com/ExodusMovement/assets/issues/2210)) ([8b7e807](https://github.com/ExodusMovement/assets/commit/8b7e807907e961aae47d3beb50cd69502e5a04e2))
110
+
111
+
112
+
113
+ ## [4.8.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.7.0...@exodus/ethereum-lib@4.8.0) (2024-05-02)
114
+
115
+
116
+ ### Features
117
+
118
+ * export signMessageWithSigner from index ([#2162](https://github.com/ExodusMovement/assets/issues/2162)) ([5849688](https://github.com/ExodusMovement/assets/commit/5849688c64761dbfe00c3d47f0654dd23e1e9167))
119
+
120
+
121
+
122
+ ## [4.7.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.6.0...@exodus/ethereum-lib@4.7.0) (2024-04-22)
123
+
124
+
125
+ ### Features
126
+
127
+ * allowXPUB in ethereum key-identifier ([#2136](https://github.com/ExodusMovement/assets/issues/2136)) ([308181c](https://github.com/ExodusMovement/assets/commit/308181cf602e433aa2ae1944663a01fc6c524b1a))
128
+
129
+
130
+
131
+ ## [4.6.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.5.0...@exodus/ethereum-lib@4.6.0) (2024-04-17)
132
+
133
+
134
+ ### Features
135
+
136
+ * **ethereum:** add `fromAddress` in `txMeta` ([#2106](https://github.com/ExodusMovement/assets/issues/2106)) ([451753e](https://github.com/ExodusMovement/assets/commit/451753ea85625c6ef4e17dcde8ed47186fe92a3e))
137
+ * expose signMessage & signHardware ([#2103](https://github.com/ExodusMovement/assets/issues/2103)) ([60ea167](https://github.com/ExodusMovement/assets/commit/60ea167283e2e4b82a69530ba156c56dead8812c))
138
+ * support signing messages with external signer ([#2105](https://github.com/ExodusMovement/assets/issues/2105)) ([88669f6](https://github.com/ExodusMovement/assets/commit/88669f6608b72eda2d16397ce808684ec07407e0))
139
+
140
+
141
+
142
+ ## [4.5.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.4.0...@exodus/ethereum-lib@4.5.0) (2024-04-11)
143
+
144
+
145
+ ### Features
146
+
147
+ * **ethereum:** add signMessage ([#1974](https://github.com/ExodusMovement/assets/issues/1974)) ([63c20f4](https://github.com/ExodusMovement/assets/commit/63c20f44b2348860687af01d81e27b5868c1a21a))
148
+ * new eth balances (EVM 1) ([#2013](https://github.com/ExodusMovement/assets/issues/2013)) ([5fa2375](https://github.com/ExodusMovement/assets/commit/5fa2375caccf957d2f10c76f279aa1fdc7597df1))
149
+
150
+
151
+ ### Bug Fixes
152
+
153
+ * increase default Base gasPrice ([#2034](https://github.com/ExodusMovement/assets/issues/2034)) ([141960f](https://github.com/ExodusMovement/assets/commit/141960f2ec41d78720587e4e02f5b71bb48ddf0a))
154
+
155
+
156
+
157
+ ## [4.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.3.0...@exodus/ethereum-lib@4.4.0) (2024-03-22)
158
+
159
+
160
+ ### Features
161
+
162
+ * **ETH:** add Sepolia testnet ([#1855](https://github.com/ExodusMovement/assets/issues/1855)) ([a2f7c07](https://github.com/ExodusMovement/assets/commit/a2f7c07a1068c8ee0c3646f4eda3b133266f518f))
163
+
164
+
165
+ ### Bug Fixes
166
+
167
+ * ethereum Sepolia yarn ([#1872](https://github.com/ExodusMovement/assets/issues/1872)) ([96831f7](https://github.com/ExodusMovement/assets/commit/96831f747df3c5f13d08f20bce0050c99849fcfe))
168
+
169
+
170
+
171
+ # [4.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.2.7...@exodus/ethereum-lib@4.3.0) (2024-03-18)
172
+
173
+
174
+ ### Features
175
+
176
+ * add support for external signer for ETH ([#1607](https://github.com/ExodusMovement/assets/issues/1607)) ([0323765](https://github.com/ExodusMovement/assets/commit/032376510205417cbbfe3ac0ea14ef203aa3823c))
177
+ * **ethereum:** ethereum tokens cleanup - part 2 ([#1573](https://github.com/ExodusMovement/assets/issues/1573)) ([85b5a10](https://github.com/ExodusMovement/assets/commit/85b5a10e958ba883dd9fbbfc521909a27ea05a12))
178
+
179
+
180
+ ### Reverts
181
+
182
+ * Revert "Publish" ([adb8015](https://github.com/ExodusMovement/assets/commit/adb8015efd51a4fa36ad0c86c28cb2d94c52a578))
package/package.json CHANGED
@@ -1,21 +1,22 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "files": [
7
7
  "src",
8
+ "CHANGELOG.md",
8
9
  "!src/**/__tests__"
9
10
  ],
10
11
  "author": "Exodus Movement, Inc.",
11
12
  "license": "UNLICENSED",
12
- "homepage": "https://github.com/ExodusMovement/assets/tree/main/ethereum",
13
+ "homepage": "https://github.com/ExodusMovement/assets/tree/master/ethereum/ethereum-lib",
13
14
  "publishConfig": {
14
15
  "access": "restricted"
15
16
  },
16
17
  "scripts": {
17
18
  "test": "run -T jest",
18
- "lint": "run -T eslint src",
19
+ "lint": "run -T eslint .",
19
20
  "lint:fix": "yarn lint --fix"
20
21
  },
21
22
  "dependencies": {
@@ -31,11 +32,11 @@
31
32
  "@exodus/solidity-contract": "^1.1.3",
32
33
  "@metamask/eth-sig-util": "^4.0.1",
33
34
  "base-x": "^3.0.2",
34
- "ethjs-util": "0.1.6",
35
+ "ethjs-util": "^0.1.6",
35
36
  "lodash": "^4.17.15",
36
37
  "minimalistic-assert": "^1.0.1",
37
38
  "ms": "^2.1.1",
38
- "reselect": "~3.0.1"
39
+ "reselect": "^3.0.1"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@exodus/assets": "^9.1.1",
@@ -46,5 +47,12 @@
46
47
  "@exodus/fantommainnet-meta": "^1.1.2",
47
48
  "@exodus/matic-meta": "^1.3.0"
48
49
  },
49
- "gitHead": "90afbc608cbc88d2b713aa89b5633362be253aeb"
50
+ "bugs": {
51
+ "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aethereum-lib"
52
+ },
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/ExodusMovement/assets.git"
56
+ },
57
+ "gitHead": "bd817012efdb2bfa6e74308f213ed9030e9661b8"
50
58
  }
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
  )
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export * from './balances'
2
1
  export * from './encode'
3
2
  export * from './unsigned-tx'
4
3
  export * from './utils'
@@ -1,10 +1,7 @@
1
1
  import baseX from 'base-x'
2
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'
3
+ // eslint-disable-next-line import/no-deprecated
4
+ import { ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES } from '../constants'
8
5
  import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs-tx'
9
6
  import { uniq } from 'lodash'
10
7
 
@@ -13,38 +10,51 @@ export { default as calculateExtraEth } from './calculate-extra-eth'
13
10
  const base10 = baseX('0123456789')
14
11
  const base16 = baseX('0123456789abcdef')
15
12
 
13
+ /* @deprecated */
16
14
  export const isEthereumToken = (asset) => asset.assetType === 'ETHEREUM_ERC20'
15
+ /* @deprecated */
17
16
  export const isEthereumGoerliToken = (asset) => asset.assetType === 'ETHEREUM_GOERLI_ERC20'
17
+ /* @deprecated */
18
18
  export const isEthereumHoleskyToken = (asset) => asset.assetType === 'ETHEREUM_HOLESKY_ERC20'
19
+ /* @deprecated */
19
20
  export const isEthereumSepoliaToken = (asset) => asset.assetType === 'ETHEREUM_SEPOLIA_ERC20'
21
+ /* @deprecated */
20
22
  export const isBscToken = (asset) => asset.assetType === 'BSC_BEP20'
23
+ /* @deprecated */
21
24
  export const isPolygonToken = (asset) => asset.assetType === 'MATIC_ERC20'
25
+ /* @deprecated */
22
26
  export const isAvalancheToken = (asset) => asset.assetType === 'AVAX_ERC20'
27
+ /* @deprecated */
23
28
  export const isFantomToken = (asset) => asset.assetType === 'FTM_ERC20'
29
+ /* @deprecated */
24
30
  export const isArbitrumNovaToken = (asset) => asset.assetType === 'ETHEREUM_ARBNOVA_ERC20'
31
+ /* @deprecated */
25
32
  export const isArbitrumOneToken = (asset) => asset.assetType === 'ETHEREUM_ARBONE_ERC20'
33
+ /* @deprecated */
26
34
  export const isRootstockToken = (asset) => asset.assetType === 'RSK_ERC20'
35
+ /* @deprecated */
27
36
  export const isOptimismToken = (asset) => asset.assetType === 'OPT_ERC20'
37
+ /* @deprecated */
28
38
  export const isFlareToken = (asset) => asset.assetType === 'FLR_ERC20'
39
+ /* @deprecated */
29
40
  export const isAuroraToken = (asset) => asset.assetType === 'AURORA_ERC20'
41
+ /* @deprecated */
30
42
  export const isCronosToken = (asset) => asset.assetType === 'CRC20'
43
+ /* @deprecated */
31
44
  export const isBaseMainnetToken = (asset) => asset.assetType === 'BASE_ERC20'
32
45
 
33
46
  // 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
- }
47
+ export const isEthereumLikeToken = (asset) =>
48
+ isEthereumLikeAsset(asset.baseAsset) && asset.baseAsset.name !== asset.name
39
49
 
50
+ // @deprecated
40
51
  export const isToken = isEthereumLikeToken
41
52
 
42
53
  // All ethereum-like assets (native coins)
43
- export const isEthereumLikeAsset = (asset) => isEthereumLikeAssetByName(asset.name)
44
- export const isEthereumLikeAssetByName = (assetName) => ETHEREUM_LIKE_ASSETS.includes(assetName)
54
+ export const isEthereumLikeAsset = (asset) => asset.assetType === 'ETHEREUM_LIKE'
45
55
 
46
56
  // All ethereum-like assets and tokens
47
- export const isEthereumLike = (asset) => ETHEREUM_LIKE_ASSETS.includes(asset.baseAsset.name)
57
+ export const isEthereumLike = (asset) => isEthereumLikeAsset(asset.baseAsset)
48
58
  // @deprecated
49
59
  export const isEthereumLikeByName = (assetName) => {
50
60
  throw new Error('Please use isEthereumLike() instead')
@@ -150,6 +160,7 @@ export const isRpcBalanceAsset = (asset) =>
150
160
  'steth',
151
161
  'weth',
152
162
  ...customTokensWithRpcBalance,
163
+ // eslint-disable-next-line import/no-deprecated
153
164
  ].includes(asset.name) || ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES.includes(asset.baseAsset.name)
154
165
 
155
166
  export const getAssetAddresses = (asset) => {
@@ -1,29 +0,0 @@
1
- import { get } from 'lodash'
2
-
3
- // @deprecated to be removed. Use balances!
4
- export const getEthereumBalances = ({ asset, liquidBalance, accountState }) => {
5
- // asset = ethereum or ethereumgoerli or ethereumholesky
6
- const delegatedBalance = get(
7
- accountState,
8
- ['staking', asset.name, 'delegatedBalance'],
9
- asset.currency.ZERO
10
- )
11
- const undelegatedBalance = get(
12
- accountState,
13
- ['staking', asset.name, 'unclaimedUndelegatedBalance'],
14
- asset.currency.ZERO
15
- )
16
- const rewardsReceived = get(
17
- accountState,
18
- ['staking', asset.name, 'totalRewardsReceived'],
19
- asset.currency.ZERO
20
- )
21
- const totalBalance = liquidBalance
22
- .add(delegatedBalance)
23
- .add(undelegatedBalance)
24
- .add(rewardsReceived)
25
- return {
26
- balance: totalBalance,
27
- liquidBalance: liquidBalance.add(rewardsReceived),
28
- }
29
- }
@@ -1,3 +0,0 @@
1
- // @deprecated to be removed. Use balances!
2
- export * from './ethereum-balance'
3
- export * from './polygon-balance'
@@ -1,23 +0,0 @@
1
- import { get } from 'lodash'
2
- import assets from '@exodus/ethereum-meta'
3
-
4
- const polygon = assets.find(({ name: tokenName }) => tokenName === 'polygon')
5
-
6
- // @deprecated to be removed. Use balances!
7
- export const getPolygonBalances = ({ liquidBalance, accountState }) => {
8
- const delegatedBalance = get(
9
- accountState,
10
- 'staking.polygon.delegatedBalance',
11
- polygon.currency.ZERO
12
- )
13
- const undelegatedBalance = get(
14
- accountState,
15
- 'staking.polygon.unclaimedUndelegatedBalance',
16
- polygon.currency.ZERO
17
- )
18
- const totalBalance = liquidBalance.add(delegatedBalance).add(undelegatedBalance)
19
- return {
20
- balance: totalBalance,
21
- liquidBalance,
22
- }
23
- }