@exodus/ethereum-lib 2.20.0 → 2.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -9,12 +9,13 @@
9
9
  ],
10
10
  "author": "Exodus Movement, Inc.",
11
11
  "license": "UNLICENSED",
12
- "homepage": "https://github.com/ExodusMovement/ethereum#readme",
12
+ "homepage": "https://github.com/ExodusMovement/assets/tree/main/ethereum",
13
13
  "publishConfig": {
14
14
  "access": "restricted"
15
15
  },
16
16
  "dependencies": {
17
17
  "@exodus/asset-lib": "^3.5.4",
18
+ "@exodus/basic-utils": "^0.7.0",
18
19
  "@exodus/ethereumjs-common": "^2.4.0-exodus.6",
19
20
  "@exodus/ethereumjs-tx": "^3.3.0-exodus.6",
20
21
  "@exodus/ethereumjs-util": "^7.1.0-exodus.6",
@@ -28,5 +29,5 @@
28
29
  "peerDependencies": {
29
30
  "@exodus/assets": "8.0.x"
30
31
  },
31
- "gitHead": "57fae619663ea5193c733bd089c9031447f0d025"
32
+ "gitHead": "5a1621d8fb3c1ecf4c47dc37f284e9a40d7fd018"
32
33
  }
package/src/constants.js CHANGED
@@ -1,49 +1,62 @@
1
- export const DEFAULT_SERVER_URLS = {
2
- ethereum: 'https://geth.a.exodus.io/wallet/v1/',
3
- ethereumclassic: 'https://getc.a.exodus.io/wallet/v1/',
4
- bsc: 'https://bsc.a.exodus.io/wallet/v1/',
5
- matic: 'https://polygon.a.exodus.io/wallet/v1/',
6
- avalanchec: 'https://avax-c.a.exodus.io/wallet/v1/',
7
- fantommainnet: 'https://fantom.a.exodus.io/wallet/v1/',
8
- harmonymainnet: 'https://harmony.a.exodus.io/wallet/v1/',
9
- }
1
+ import { mapValues } from '@exodus/basic-utils'
10
2
 
11
- export const CHAIN_IDS = {
12
- ethereum: 1,
13
- ethereumclassic: 61,
14
- bsc: 56,
15
- matic: 137,
16
- avalanchec: 43114,
17
- fantommainnet: 250,
18
- harmonymainnet: 1666600000,
3
+ const CHAIN_DATA = {
4
+ ethereum: {
5
+ chainId: 1,
6
+ serverUrl: 'https://geth.a.exodus.io/wallet/v1/',
7
+ confirmationsNumber: 30,
8
+ tokenType: 'ETHEREUM_ERC20',
9
+ },
10
+ ethereumclassic: {
11
+ chainId: 61,
12
+ serverUrl: 'https://getc.a.exodus.io/wallet/v1/',
13
+ confirmationsNumber: 5000,
14
+ // tokenType: // we do not support tokens
15
+ },
16
+ bsc: {
17
+ chainId: 56,
18
+ serverUrl: 'https://bsc.a.exodus.io/wallet/v1/',
19
+ confirmationsNumber: 15,
20
+ tokenType: 'BSC_BEP20',
21
+ },
22
+ matic: {
23
+ chainId: 137,
24
+ serverUrl: 'https://polygon.a.exodus.io/wallet/v1/',
25
+ confirmationsNumber: 355,
26
+ tokenType: 'MATIC_ERC20',
27
+ },
28
+ avalanchec: {
29
+ chainId: 43114,
30
+ serverUrl: 'https://avax-c.a.exodus.io/wallet/v1/',
31
+ confirmationsNumber: 30,
32
+ tokenType: 'AVAX_ERC20',
33
+ },
34
+ fantommainnet: {
35
+ chainId: 250,
36
+ serverUrl: 'https://fantom.a.exodus.io/wallet/v1/',
37
+ confirmationsNumber: 3,
38
+ tokenType: 'FTM_ERC20',
39
+ },
40
+ harmonymainnet: {
41
+ chainId: 1666600000,
42
+ serverUrl: 'https://harmony.a.exodus.io/wallet/v1/',
43
+ confirmationsNumber: 6,
44
+ // tokenType: // we do not support tokens yet
45
+ },
19
46
  }
47
+
48
+ export const DEFAULT_SERVER_URLS = mapValues(CHAIN_DATA, ({ serverUrl }) => serverUrl)
49
+ export const CHAIN_IDS = mapValues(CHAIN_DATA, ({ chainId }) => chainId)
20
50
  export const MIN_GASPRICE = 1e9 // 1 gwei
21
51
  export const DEFAULT_FEE_MONITOR_INTERVAL = '1m'
22
- export const CONFIRMATIONS_NUMBER = {
23
- ethereum: 30,
24
- ethereumclassic: 5000,
25
- bsc: 15,
26
- matic: 355,
27
- avalanchec: 30,
28
- fantommainnet: 3,
29
- harmonymainnet: 6,
30
- }
31
- export const ETHEREUM_LIKE_ASSETS = [
32
- 'bsc',
33
- 'ethereum',
34
- 'ethereumclassic',
35
- 'matic',
36
- 'avalanchec',
37
- 'fantommainnet',
38
- 'harmonymainnet',
39
- ]
40
- export const ETHEREUM_LIKE_TOKEN_TYPES = [
41
- 'ETHEREUM_ERC20',
42
- 'BSC_BEP20',
43
- 'MATIC_ERC20',
44
- 'AVAX_ERC20',
45
- 'FTM_ERC20',
46
- ]
52
+ export const CONFIRMATIONS_NUMBER = mapValues(
53
+ CHAIN_DATA,
54
+ ({ confirmationsNumber }) => confirmationsNumber
55
+ )
56
+ export const ETHEREUM_LIKE_ASSETS = Object.keys(CHAIN_DATA)
57
+ export const ETHEREUM_LIKE_TOKEN_TYPES = Object.values(CHAIN_DATA)
58
+ .filter(({ tokenType }) => tokenType)
59
+ .map(({ tokenType }) => tokenType)
47
60
  export const BUMP_RATE = 1.2
48
61
 
49
62
  export const CUSTOM_CHAINS = ['avalanchec', 'matic'].map((name) => ({
@@ -82,7 +82,7 @@ export const isApproveTx = (tx) => tx?.data?.data?.startsWith(APPROVE_METHOD_ID)
82
82
  export const isFeePaymentTx = (tx) => tx?.data?.data?.startsWith(FEE_PAYMENT_PREFIX)
83
83
 
84
84
  export const isRpcBalanceAsset = (asset) =>
85
- ['bsc', 'matic', 'babydoge_bsc', 'steth'].includes(asset.name)
85
+ ['bsc', 'matic', 'babydoge_bsc', 'steth', 'weth'].includes(asset.name)
86
86
 
87
87
  export const getAssetAddresses = (asset) => {
88
88
  // It seems to be two schemas of assets. The original and the transformed by the client.