@exodus/ethereum-api 1.0.7 → 1.0.9

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": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -10,7 +10,8 @@
10
10
  "access": "restricted"
11
11
  },
12
12
  "dependencies": {
13
- "@exodus/ethereum-lib": "^1.1.0",
13
+ "@exodus/ethereum-lib": "^1.1.1",
14
+ "@exodus/simple-retry": "^0.0.6",
14
15
  "fetchival": "0.3.3",
15
16
  "lodash": "^4.17.11",
16
17
  "make-concurrent": "4.0.0",
@@ -19,5 +20,5 @@
19
20
  "url-join": "4.0.0",
20
21
  "ws": "6.1.0"
21
22
  },
22
- "gitHead": "1594f269e65cf8998a152917c5c7d7b519d71066"
23
+ "gitHead": "27d757e9b2e1e356c52f99854c64ef42e61b4865"
23
24
  }
@@ -3,6 +3,9 @@ import url from 'url'
3
3
  import fetchival from 'fetchival'
4
4
  import ms from 'ms'
5
5
  import createWebSocket from './ws'
6
+ import { retry } from '@exodus/simple-retry'
7
+
8
+ const RETRY_DELAYS = ['10s']
6
9
 
7
10
  export function create(defaultURL) {
8
11
  let API_URL = defaultURL
@@ -31,6 +34,9 @@ export function create(defaultURL) {
31
34
  }
32
35
  }
33
36
 
37
+ // Default retry function
38
+ const requestWithRetry = retry(request, { delayTimesMs: RETRY_DELAYS })
39
+
34
40
  return {
35
41
  getURL() {
36
42
  return API_URL
@@ -63,7 +69,7 @@ export function create(defaultURL) {
63
69
  },
64
70
 
65
71
  async gasPrice() {
66
- return request('proxy', { method: 'eth_gasPrice' })
72
+ return requestWithRetry('proxy', { method: 'eth_gasPrice' })
67
73
  },
68
74
 
69
75
  async getTransactionCount(address, tag = 'latest') {
@@ -1,14 +1,12 @@
1
1
  import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
2
2
  import { eth as ethServer } from '../exodus-eth-server'
3
- import { withFallback } from '../with-fallback'
4
- import * as etherscan from '../etherscan'
5
3
 
6
4
  export class EthereumFeeMonitor extends EthereumLikeFeeMonitor {
7
5
  constructor({ updateFee }) {
8
6
  super({
9
7
  updateFee,
10
8
  assetName: 'ethereum',
11
- getGasPrice: withFallback(ethServer.gasPrice, etherscan.gasPrice),
9
+ getGasPrice: ethServer.gasPrice,
12
10
  })
13
11
  }
14
12
  }