@exodus/ethereum-api 2.6.11 → 2.6.13

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-api",
3
- "version": "2.6.11",
3
+ "version": "2.6.13",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -10,16 +10,15 @@
10
10
  "access": "restricted"
11
11
  },
12
12
  "dependencies": {
13
- "@exodus/ethereum-lib": "^2.10.6",
13
+ "@exodus/ethereum-lib": "^2.10.7",
14
14
  "@exodus/ethereumjs-util": "^7.1.0-exodus.6",
15
15
  "@exodus/simple-retry": "^0.0.6",
16
16
  "fetchival": "0.3.3",
17
- "lodash": "^4.17.11",
18
17
  "make-concurrent": "4.0.0",
19
18
  "ms": "^2.1.1",
20
19
  "url": "0.10.3",
21
20
  "url-join": "4.0.0",
22
21
  "ws": "6.1.0"
23
22
  },
24
- "gitHead": "c4cb814f32493aea178c8ed6cf07c8df5ea97c1f"
23
+ "gitHead": "f89f33caaa18c960071628b7a0cb740481c10705"
25
24
  }
@@ -1,4 +1,3 @@
1
- import { get } from 'lodash'
2
1
  import { normalizeTxId, isEthereumLikeAsset, isEthereumLikeToken } from '@exodus/ethereum-lib'
3
2
  import { eth, serverMap, getServer } from './exodus-eth-server'
4
3
 
@@ -37,7 +36,7 @@ export async function getBalance({ asset, address }) {
37
36
  if (!isEthereumLikeAsset(asset)) throw new Error(`unsupported asset ${asset.name}`)
38
37
  const server = getServer(asset)
39
38
  const balances = await server.getBalance(address)
40
- return get(balances, ['confirmed', 'value'], '0')
39
+ return balances?.confirmed?.value || '0'
41
40
  }
42
41
 
43
42
  // Only ETH-like assets with token support
@@ -45,7 +44,8 @@ export async function getTokenBalance({ asset, address }) {
45
44
  if (!isEthereumLikeToken(asset)) throw new Error(`unsupported ETH-like token ${asset.name}`)
46
45
  const server = getServer(asset)
47
46
  const balances = await server.getBalance(address)
48
- return get(balances, ['confirmed', asset.contract.address.toLowerCase()], '0')
47
+ const contractAddress = asset.contract.address.toLowerCase()
48
+ return balances?.confirmed?.[contractAddress] || '0'
49
49
  }
50
50
 
51
51
  // Returns function for supplied asset
@@ -45,6 +45,9 @@ export async function fetchGasLimit({
45
45
  throwOnError = true,
46
46
  extraPercentage,
47
47
  }) {
48
+ if (bip70?.bitpay?.data && bip70?.bitpay?.gasPrice)
49
+ return asset.name === 'ethereum' ? 65000 : 130000 // from on chain stats https://dune.xyz/queries/189123
50
+
48
51
  if (!amount) amount = asset.currency.ZERO
49
52
  if (!feeData.gasPrice) feeData.gasPrice = asset.baseAsset.currency.ZERO
50
53
 
@@ -61,20 +64,7 @@ export async function fetchGasLimit({
61
64
  if (!isContract) return asset.gasLimit
62
65
  }
63
66
 
64
- let gasPrice = ethUtil.bufferToHex(currency2buffer(feeData.gasPrice))
65
-
66
- if (bip70 && bip70.bitpay) {
67
- if (bip70.bitpay.data) {
68
- txInput = bip70.bitpay.data
69
- }
70
-
71
- if (bip70.bitpay.gasPrice) {
72
- const bitPayGasPrice = ethUtil.bufferToHex(currency2buffer(bip70.bitpay.gasPrice))
73
- if (new ethUtil.BN(bitPayGasPrice).gt(new ethUtil.BN(gasPrice))) {
74
- gasPrice = bitPayGasPrice
75
- }
76
- }
77
- }
67
+ const gasPrice = ethUtil.bufferToHex(currency2buffer(feeData.gasPrice))
78
68
 
79
69
  try {
80
70
  return await estimateGasLimit(