@exodus/ethereum-lib 2.3.0 → 2.3.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.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -25,5 +25,5 @@
25
25
  "devDependencies": {
26
26
  "@exodus/models": "^8.5.1"
27
27
  },
28
- "gitHead": "1b43dd94263594666e89c4948e728d28e5ffa798"
28
+ "gitHead": "92d4717b906fd92d37c90d8ba41f3c314cd65534"
29
29
  }
package/src/constants.js CHANGED
@@ -1,7 +1,8 @@
1
- export const CHAIN_IDS = { ethereum: 1, ethereumclassic: 61 }
1
+ export const CHAIN_IDS = { ethereum: 1, ethereumclassic: 61, quorum: 10 }
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
+ quorum: 4,
7
8
  }
@@ -1,2 +1,3 @@
1
1
  export { default as ethereum } from './ethereum'
2
2
  export { default as ethereumclassic } from './ethereumclassic'
3
+ export { default as quorum } from './quorum'
@@ -0,0 +1,11 @@
1
+ import { FeeData } from '@exodus/asset-lib'
2
+
3
+ export default new FeeData(
4
+ {
5
+ gasPrice: '0 Gwei',
6
+ max: '0 Gwei',
7
+ min: '0 Gwei',
8
+ },
9
+ 'gasPrice',
10
+ 'quorum'
11
+ )
@@ -1,5 +1,5 @@
1
1
  import ethUtil from 'ethereumjs-util'
2
- import { isEthereumToken, currency2buffer, getBaseAsset } from '../utils'
2
+ import { isEthereumToken, isQuorumToken, currency2buffer, getBaseAsset } from '../utils'
3
3
  import { CHAIN_IDS } from '../constants'
4
4
 
5
5
  import type { UnsignedTransaction } from '#/app-models'
@@ -25,7 +25,7 @@ export default function createUnsignedTx({
25
25
  const baseAsset = getBaseAsset(asset)
26
26
  if (!chainId) chainId = CHAIN_IDS[baseAsset.name] // mainnet
27
27
 
28
- const isToken = isEthereumToken(asset)
28
+ const isToken = isEthereumToken(asset) || isQuorumToken(asset)
29
29
  const to = isToken ? asset.contract.address : address
30
30
  let value = currency2buffer(isToken ? baseAsset.currency.ZERO : amount)
31
31
 
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
  import * as ethUtil from 'ethereumjs-util'
3
- import { isEthereumToken, buffer2currency, getBaseAsset } from '../utils'
3
+ import { isEthereumToken, isQuorumToken, buffer2currency, getBaseAsset } 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)
13
+ const isToken = isEthereumToken(asset) || isQuorumToken(asset)
14
14
  const baseAsset = getBaseAsset(asset)
15
15
  const gasPrice = buffer2currency({ asset: baseAsset, value: txData.gasPrice })
16
16
  const gasLimit = ethUtil.bufferToInt(txData.gasLimit)
package/src/utils.js CHANGED
@@ -6,6 +6,7 @@ const base10 = baseX('0123456789')
6
6
  const base16 = baseX('0123456789abcdef')
7
7
 
8
8
  export const isEthereumToken = (asset) => asset.assetType === 'ETHEREUM_ERC20'
9
+ export const isQuorumToken = (asset) => asset.assetType === 'QUORUM_ERC20'
9
10
 
10
11
  export function buffer2currency({ asset, value }) {
11
12
  return asset.currency.baseUnit(base10.encode(value)).toDefault()
@@ -34,5 +35,5 @@ export function normalizeTxId(txId: string): string {
34
35
  }
35
36
 
36
37
  export function getBaseAsset(asset) {
37
- return isEthereumToken(asset) ? assets.ethereum : asset
38
+ return isEthereumToken(asset) ? assets.ethereum : isQuorumToken(asset) ? assets.quorum : asset
38
39
  }