@exodus/ethereum-lib 2.7.2 → 2.7.3

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.7.2",
3
+ "version": "2.7.3",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -23,5 +23,5 @@
23
23
  "peerDependencies": {
24
24
  "@exodus/assets": "8.0.x"
25
25
  },
26
- "gitHead": "cd08eeb37f107463a6285a9fb151a97e6e1cd2c7"
26
+ "gitHead": "c9ae40c620c5f8378550977516ffd4f4d03663a8"
27
27
  }
@@ -5,9 +5,9 @@ export default new FeeData(
5
5
  gasPrice: '20 Gwei',
6
6
  max: '200 Gwei',
7
7
  min: '1 Gwei',
8
- erc20FuelThreshold: '25000000 Gwei',
9
- gasPriceEconomicalRate: 1,
10
- gasPriceMinimumRate: 1,
8
+ erc20FuelThreshold: '2500000 Gwei',
9
+ gasPriceEconomicalRate: 0.8,
10
+ gasPriceMinimumRate: 0.6,
11
11
  },
12
12
  'gasPrice',
13
13
  'bsc'
@@ -1,5 +1,5 @@
1
1
  import ethUtil from 'ethereumjs-util'
2
- import { isEthereumToken, isQuorumToken, currency2buffer } from '../utils'
2
+ import { isToken, currency2buffer } from '../utils'
3
3
  import { CHAIN_IDS } from '../constants'
4
4
 
5
5
  import type { UnsignedTransaction } from '#/app-models'
@@ -25,9 +25,9 @@ export default function createUnsignedTx({
25
25
  const baseAsset = asset.baseAsset
26
26
  if (!chainId) chainId = CHAIN_IDS[baseAsset.name] // mainnet
27
27
 
28
- const isToken = isEthereumToken(asset) || isQuorumToken(asset)
29
- const to = isToken ? asset.contract.address : address
30
- let value = currency2buffer(isToken ? baseAsset.currency.ZERO : amount)
28
+ const _isToken = isToken(asset)
29
+ const to = _isToken ? asset.contract.address : address
30
+ let value = currency2buffer(_isToken ? baseAsset.currency.ZERO : amount)
31
31
 
32
32
  // TODO: check: present on desktop missing on mobile. This insures we never have a buffer specifying 0.
33
33
  // In ETH, a buffer of zero length and a buffer specifying 0 imply different things
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
  import * as ethUtil from 'ethereumjs-util'
3
- import { isEthereumToken, isQuorumToken, buffer2currency } from '../utils'
3
+ import { isToken, buffer2currency } from '../utils'
4
4
  import { CHAIN_IDS } from '../constants'
5
5
 
6
6
  import type { UnsignedTransaction, ParsedTransaction } from '@exodus/models/lib/types'
@@ -10,7 +10,7 @@ export default function parseUnsignedTx(
10
10
  unsignedTx: UnsignedTransaction
11
11
  ): ParsedTransaction {
12
12
  const { txData } = unsignedTx
13
- const isToken = isEthereumToken(asset) || isQuorumToken(asset)
13
+ const _isToken = isToken(asset)
14
14
  const baseAsset = asset.baseAsset
15
15
  const gasPrice = buffer2currency({ asset: baseAsset, value: txData.gasPrice })
16
16
  const gasLimit = ethUtil.bufferToInt(txData.gasLimit)
@@ -18,7 +18,7 @@ export default function parseUnsignedTx(
18
18
  let { to, chainId, data } = txData
19
19
  let amount
20
20
  const fee = gasPrice.mul(gasLimit)
21
- if (isToken) {
21
+ if (_isToken) {
22
22
  const { method, values } = asset.contract.decodeInput(data)
23
23
  if (method === 'transfer' || method === 'approve') {
24
24
  to = values[0]
@@ -10,6 +10,8 @@ const base16 = baseX('0123456789abcdef')
10
10
  export const isEthereumToken = (asset) => asset.assetType === 'ETHEREUM_ERC20'
11
11
  export const isBscToken = (asset) => asset.assetType === 'BSC_BEP20'
12
12
  export const isQuorumToken = (asset) => asset.assetType === 'QUORUM_ERC20'
13
+ export const isToken = (asset) =>
14
+ isEthereumToken(asset) || isBscToken(asset) || isQuorumToken(asset)
13
15
 
14
16
  export function buffer2currency({ asset, value }) {
15
17
  return asset.currency.baseUnit(base10.encode(value)).toDefault()