@exodus/ethereum-api 2.0.7 → 2.1.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-api",
3
- "version": "2.0.7",
3
+ "version": "2.1.0",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -10,7 +10,7 @@
10
10
  "access": "restricted"
11
11
  },
12
12
  "dependencies": {
13
- "@exodus/ethereum-lib": "^2.0.7",
13
+ "@exodus/ethereum-lib": "^2.1.0",
14
14
  "@exodus/simple-retry": "^0.0.6",
15
15
  "fetchival": "0.3.3",
16
16
  "lodash": "^4.17.11",
@@ -20,5 +20,5 @@
20
20
  "url-join": "4.0.0",
21
21
  "ws": "6.1.0"
22
22
  },
23
- "gitHead": "42fbfc6f7d7af50691c871b363150d904d4e59fd"
23
+ "gitHead": "3530b1a7710f3aec0aba47dd761e4911629a96ad"
24
24
  }
@@ -102,6 +102,19 @@ export function create(defaultURL) {
102
102
  return requestWithRetry('proxy', { method: 'eth_estimateGas', ...data, tag })
103
103
  },
104
104
 
105
+ /**
106
+ * Hits a magnifier endpoint returning maximum gas limit that a specified
107
+ * contract along with method consumed in the past.
108
+ * @param opts : Object with parameters
109
+ * @returns {Promise<*>}
110
+ */
111
+ async getGasEstimation({ address, data }) {
112
+ return requestWithRetry('gas-estimation', {
113
+ address,
114
+ data,
115
+ })
116
+ },
117
+
105
118
  async ethCall(data, tag = 'latest') {
106
119
  return request('proxy', { method: 'eth_call', ...data, tag })
107
120
  },
@@ -39,13 +39,14 @@ export async function fetchGasLimit({
39
39
  toAddress,
40
40
  txInput = '0x',
41
41
  amount,
42
- feeData,
42
+ feeData = {},
43
43
  bip70,
44
44
  isContract,
45
45
  throwOnError = true,
46
46
  extraPercentage,
47
47
  }) {
48
48
  if (!amount) amount = asset.currency.ZERO
49
+ if (!feeData.gasPrice) feeData.gasPrice = getBaseAsset(asset).currency.ZERO
49
50
 
50
51
  const isToken = isEthereumToken(asset)
51
52
  if (isToken) {