@exodus/ethereum-lib 5.2.1 → 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 +13 -0
- package/package.json +2 -2
- package/src/constants.js +8 -21
- package/src/utils/index.js +24 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.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
|
+
|
|
6
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)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @exodus/ethereum-lib
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Ethereum Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"type": "git",
|
|
55
55
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bd817012efdb2bfa6e74308f213ed9030e9661b8"
|
|
58
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
|
-
|
|
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/utils/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import baseX from 'base-x'
|
|
2
2
|
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
|
-
import
|
|
4
|
-
|
|
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) =>
|
|
35
|
-
|
|
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) =>
|
|
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) =>
|
|
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) => {
|