@exodus/ethereum-lib 2.8.1 → 2.9.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.8.1",
3
+ "version": "2.9.1",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -24,5 +24,5 @@
24
24
  "peerDependencies": {
25
25
  "@exodus/assets": "8.0.x"
26
26
  },
27
- "gitHead": "beb8b96a02d08dc9e32746e65d3c666cc77ed746"
27
+ "gitHead": "599004e8fe7b62f7c31feacbc2ee1db2322a6084"
28
28
  }
package/src/constants.js CHANGED
@@ -1,10 +1,11 @@
1
- export const CHAIN_IDS = { ethereum: 1, ethereumclassic: 61, bsc: 56 }
1
+ export const CHAIN_IDS = { ethereum: 1, ethereumclassic: 61, bsc: 56, matic: 137 }
2
2
  export const MIN_GASPRICE = 1e9 // 1 gwei
3
3
  export const DEFAULT_FEE_MONITOR_INTERVAL = '1m'
4
4
  export const CONFIRMATIONS_NUMBER = {
5
5
  ethereum: 30,
6
6
  ethereumclassic: 5000,
7
7
  bsc: 15,
8
+ matic: 355,
8
9
  }
9
- export const ETHEREUM_LIKE_ASSETS = ['bsc', 'ethereum', 'ethereumclassic']
10
- export const ETHEREUM_LIKE_TOKEN_TYPES = ['ETHEREUM_ERC20', 'BSC_BEP20']
10
+ export const ETHEREUM_LIKE_ASSETS = ['bsc', 'ethereum', 'ethereumclassic', 'matic']
11
+ export const ETHEREUM_LIKE_TOKEN_TYPES = ['ETHEREUM_ERC20', 'BSC_BEP20', 'MATIC_ERC20']
@@ -11,6 +11,8 @@ export default new FeeData(
11
11
  gasPriceMinimumRate: 0.5,
12
12
  enableFeeDelegation: false,
13
13
  tipGasPrice: '2 Gwei',
14
+ minTipGasPrice: '1 Gwei',
15
+ maxTipGasPrice: '5 Gwei',
14
16
  baseFeeMultiplier: 1.8,
15
17
  eip1559Enabled: false,
16
18
  },
@@ -1,3 +1,4 @@
1
1
  export { default as ethereum } from './ethereum'
2
2
  export { default as ethereumclassic } from './ethereumclassic'
3
3
  export { default as bsc } from './bsc'
4
+ export { default as matic } from './polygon'
@@ -0,0 +1,15 @@
1
+ import { FeeData } from '@exodus/asset-lib'
2
+
3
+ export default new FeeData(
4
+ {
5
+ // https://polygonscan.com/chart/gasprice
6
+ gasPrice: '5 Gwei',
7
+ max: '100 Gwei',
8
+ min: '1 Gwei',
9
+ erc20FuelThreshold: '2500000 Gwei',
10
+ gasPriceEconomicalRate: 0.8,
11
+ gasPriceMinimumRate: 0.6,
12
+ },
13
+ 'gasPrice',
14
+ 'matic'
15
+ )
@@ -18,6 +18,11 @@ export default class EthereumLikeFeeMonitor extends FeeMonitor {
18
18
  this.eip1559Enabled = eip1559Enabled
19
19
  }
20
20
 
21
+ setEip1559Enabled(bool) {
22
+ // bool set by remote-config
23
+ this.eip1559Enabled = bool
24
+ }
25
+
21
26
  async fetchFee() {
22
27
  let gasPrice = parseInt(await this.getGasPrice(), 16)
23
28
 
@@ -11,11 +11,15 @@ const base16 = baseX('0123456789abcdef')
11
11
 
12
12
  export const isEthereumToken = (asset) => asset.assetType === 'ETHEREUM_ERC20'
13
13
  export const isBscToken = (asset) => asset.assetType === 'BSC_BEP20'
14
+ export const isPolygonToken = (asset) => asset.assetType === 'MATIC_ERC20'
15
+
14
16
  // All ethereum-like tokens
15
17
  export const isEthereumLikeToken = (asset) => ETHEREUM_LIKE_TOKEN_TYPES.includes(asset.assetType)
16
18
  export const isToken = isEthereumLikeToken
19
+
17
20
  // All ethereum-like assets (native coins)
18
21
  export const isEthereumLikeAsset = (asset) => ETHEREUM_LIKE_ASSETS.includes(asset.name)
22
+
19
23
  // All ethereum-like assets and tokens
20
24
  export const isEthereumLike = (asset) => ETHEREUM_LIKE_ASSETS.includes(asset.baseAsset.name)
21
25