@exodus/ethereum-lib 2.20.0 → 2.21.1

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.1",
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",
@@ -25,8 +26,5 @@
25
26
  "ms": "^2.1.1",
26
27
  "reselect": "~3.0.1"
27
28
  },
28
- "peerDependencies": {
29
- "@exodus/assets": "8.0.x"
30
- },
31
- "gitHead": "57fae619663ea5193c733bd089c9031447f0d025"
29
+ "gitHead": "bc57df8400729a12d36d481311b3c2745b70013b"
32
30
  }
package/src/constants.js CHANGED
@@ -1,49 +1,68 @@
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
+ ethereumgoerli: {
17
+ chainId: 5,
18
+ serverUrl: 'https://geth-goerli-testnet-d.a.exodus.io/wallet/v1/',
19
+ confirmationsNumber: 30,
20
+ tokenType: 'ETHEREUM_GOERLI_ERC20',
21
+ },
22
+ bsc: {
23
+ chainId: 56,
24
+ serverUrl: 'https://bsc.a.exodus.io/wallet/v1/',
25
+ confirmationsNumber: 15,
26
+ tokenType: 'BSC_BEP20',
27
+ },
28
+ matic: {
29
+ chainId: 137,
30
+ serverUrl: 'https://polygon.a.exodus.io/wallet/v1/',
31
+ confirmationsNumber: 355,
32
+ tokenType: 'MATIC_ERC20',
33
+ },
34
+ avalanchec: {
35
+ chainId: 43114,
36
+ serverUrl: 'https://avax-c.a.exodus.io/wallet/v1/',
37
+ confirmationsNumber: 30,
38
+ tokenType: 'AVAX_ERC20',
39
+ },
40
+ fantommainnet: {
41
+ chainId: 250,
42
+ serverUrl: 'https://fantom.a.exodus.io/wallet/v1/',
43
+ confirmationsNumber: 3,
44
+ tokenType: 'FTM_ERC20',
45
+ },
46
+ harmonymainnet: {
47
+ chainId: 1666600000,
48
+ serverUrl: 'https://harmony.a.exodus.io/wallet/v1/',
49
+ confirmationsNumber: 6,
50
+ // tokenType: // we do not support tokens yet
51
+ },
19
52
  }
53
+
54
+ export const DEFAULT_SERVER_URLS = mapValues(CHAIN_DATA, ({ serverUrl }) => serverUrl)
55
+ export const CHAIN_IDS = mapValues(CHAIN_DATA, ({ chainId }) => chainId)
20
56
  export const MIN_GASPRICE = 1e9 // 1 gwei
21
57
  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
- ]
58
+ export const CONFIRMATIONS_NUMBER = mapValues(
59
+ CHAIN_DATA,
60
+ ({ confirmationsNumber }) => confirmationsNumber
61
+ )
62
+ export const ETHEREUM_LIKE_ASSETS = Object.keys(CHAIN_DATA)
63
+ export const ETHEREUM_LIKE_TOKEN_TYPES = Object.values(CHAIN_DATA)
64
+ .filter(({ tokenType }) => tokenType)
65
+ .map(({ tokenType }) => tokenType)
47
66
  export const BUMP_RATE = 1.2
48
67
 
49
68
  export const CUSTOM_CHAINS = ['avalanchec', 'matic'].map((name) => ({
@@ -0,0 +1,19 @@
1
+ import { FeeData } from '@exodus/asset-lib'
2
+
3
+ export default new FeeData(
4
+ {
5
+ gasPrice: '75 Gwei',
6
+ baseFeePerGas: '50 Gwei',
7
+ max: '250 Gwei',
8
+ min: '1 Gwei',
9
+ fuelThreshold: '0.025 GOETH',
10
+ swapFee: '0.05 GOETH',
11
+ gasPriceEconomicalRate: 0.7,
12
+ gasPriceMinimumRate: 0.5,
13
+ enableFeeDelegation: false,
14
+ tipGasPrice: '2 Gwei',
15
+ eip1559Enabled: true,
16
+ },
17
+ 'gasPrice',
18
+ 'ethereumgoerli'
19
+ )
@@ -1,5 +1,6 @@
1
1
  export { default as ethereum } from './ethereum'
2
2
  export { default as ethereumclassic } from './ethereumclassic'
3
+ export { default as ethereumgoerli } from './ethereumgoerli'
3
4
  export { default as bsc } from './bsc'
4
5
  export { default as matic } from './polygon'
5
6
  export { default as avalanchec } from './avalanchec'
@@ -11,6 +11,7 @@ const base10 = baseX('0123456789')
11
11
  const base16 = baseX('0123456789abcdef')
12
12
 
13
13
  export const isEthereumToken = (asset) => asset.assetType === 'ETHEREUM_ERC20'
14
+ export const isEthereumGoerliToken = (asset) => asset.assetType === 'ETHEREUM_GOERLI_ERC20'
14
15
  export const isBscToken = (asset) => asset.assetType === 'BSC_BEP20'
15
16
  export const isPolygonToken = (asset) => asset.assetType === 'MATIC_ERC20'
16
17
  export const isAvalancheToken = (asset) => asset.assetType === 'AVAX_ERC20'
@@ -82,7 +83,7 @@ export const isApproveTx = (tx) => tx?.data?.data?.startsWith(APPROVE_METHOD_ID)
82
83
  export const isFeePaymentTx = (tx) => tx?.data?.data?.startsWith(FEE_PAYMENT_PREFIX)
83
84
 
84
85
  export const isRpcBalanceAsset = (asset) =>
85
- ['bsc', 'matic', 'babydoge_bsc', 'steth'].includes(asset.name)
86
+ ['bsc', 'matic', 'babydoge_bsc', 'steth', 'weth'].includes(asset.name)
86
87
 
87
88
  export const getAssetAddresses = (asset) => {
88
89
  // It seems to be two schemas of assets. The original and the transformed by the client.