@exodus/ethereum-lib 2.4.0 → 2.5.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.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@exodus/asset-lib": "^3.4.0",
14
- "@exodus/models": "^8.4.0",
14
+ "@exodus/models": "^8.5.12",
15
15
  "@exodus/solidity-contract": "^0.1.3",
16
16
  "base-x": "^3.0.2",
17
17
  "ethereumjs-tx": "^1.3.7",
@@ -23,8 +23,5 @@
23
23
  "peerDependencies": {
24
24
  "@exodus/assets": "8.0.x"
25
25
  },
26
- "devDependencies": {
27
- "@exodus/models": "^8.5.1"
28
- },
29
- "gitHead": "719a498fd869276a64d17569a2f37325c60ddfb3"
26
+ "gitHead": "20021e426b0554c029a3c223cb5a2e06711358e3"
30
27
  }
package/src/constants.js CHANGED
@@ -1,8 +1,9 @@
1
- export const CHAIN_IDS = { ethereum: 1, ethereumclassic: 61, quorum: 10 }
1
+ export const CHAIN_IDS = { ethereum: 1, ethereumclassic: 61, quorum: 10, bsc: 56 }
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
  quorum: 4,
8
+ bsc: 15,
8
9
  }
@@ -0,0 +1,11 @@
1
+ import { FeeData } from '@exodus/asset-lib'
2
+
3
+ export default new FeeData(
4
+ {
5
+ gasPrice: '20 Gwei',
6
+ max: '200 Gwei',
7
+ min: '1 Gwei',
8
+ },
9
+ 'gasPrice',
10
+ 'bsc'
11
+ )
@@ -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 quorum } from './quorum'
4
+ export { default as bsc } from './bsc'
@@ -1,5 +1,5 @@
1
1
  import ethUtil from 'ethereumjs-util'
2
- import { isEthereumToken, isQuorumToken, currency2buffer, getBaseAsset } from '../utils'
2
+ import { isEthereumToken, isQuorumToken, currency2buffer } from '../utils'
3
3
  import { CHAIN_IDS } from '../constants'
4
4
 
5
5
  import type { UnsignedTransaction } from '#/app-models'
@@ -22,7 +22,7 @@ export default function createUnsignedTx({
22
22
  txInput = Buffer.alloc(0)
23
23
  }
24
24
 
25
- const baseAsset = getBaseAsset(asset)
25
+ const baseAsset = asset.baseAsset
26
26
  if (!chainId) chainId = CHAIN_IDS[baseAsset.name] // mainnet
27
27
 
28
28
  const isToken = isEthereumToken(asset) || isQuorumToken(asset)
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
  import * as ethUtil from 'ethereumjs-util'
3
- import { isEthereumToken, isQuorumToken, buffer2currency, getBaseAsset } from '../utils'
3
+ import { isEthereumToken, isQuorumToken, buffer2currency } from '../utils'
4
4
  import { CHAIN_IDS } from '../constants'
5
5
 
6
6
  import type { UnsignedTransaction, ParsedTransaction } from '@exodus/models/lib/types'
@@ -11,7 +11,7 @@ export default function parseUnsignedTx(
11
11
  ): ParsedTransaction {
12
12
  const { txData } = unsignedTx
13
13
  const isToken = isEthereumToken(asset) || isQuorumToken(asset)
14
- const baseAsset = getBaseAsset(asset)
14
+ const baseAsset = asset.baseAsset
15
15
  const gasPrice = buffer2currency({ asset: baseAsset, value: txData.gasPrice })
16
16
  const gasLimit = ethUtil.bufferToInt(txData.gasLimit)
17
17
 
package/src/utils.js CHANGED
@@ -35,5 +35,6 @@ export function normalizeTxId(txId: string): string {
35
35
  }
36
36
 
37
37
  export function getBaseAsset(asset) {
38
+ console.log(`calling deprecated function getBaseAsset(${asset.name})`) // Apr. 9th 2021
38
39
  return isEthereumToken(asset) ? assets.ethereum : isQuorumToken(asset) ? assets.quorum : asset
39
40
  }