@exodus/ethereum-api 2.6.16 → 2.7.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-api",
3
- "version": "2.6.16",
3
+ "version": "2.7.1",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -19,6 +19,5 @@
19
19
  "url": "0.10.3",
20
20
  "url-join": "4.0.0",
21
21
  "ws": "6.1.0"
22
- },
23
- "gitHead": "84627634686049aa4d88d8b631af006dba571bb9"
22
+ }
24
23
  }
@@ -4,6 +4,7 @@ const EXODUS_ETH_SERVER_URL = 'https://geth.a.exodus.io/wallet/v1/'
4
4
  const EXODUS_ETC_SERVER_URL = 'https://getc.a.exodus.io/wallet/v1/'
5
5
  const EXODUS_BSC_SERVER_URL = 'https://bsc.a.exodus.io/wallet/v1/'
6
6
  const EXODUS_POLYGON_SERVER_URL = 'https://polygon.a.exodus.io/wallet/v1/'
7
+ const EXODUS_AVAX_C_SERVER_URL = 'https://avax-c.a.exodus.io/wallet/v1/'
7
8
 
8
9
  // allow self-signed certs
9
10
  // process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
@@ -11,6 +12,7 @@ export const eth = create(EXODUS_ETH_SERVER_URL)
11
12
  export const etc = create(EXODUS_ETC_SERVER_URL)
12
13
  export const bsc = create(EXODUS_BSC_SERVER_URL)
13
14
  export const polygon = create(EXODUS_POLYGON_SERVER_URL)
15
+ export const avaxc = create(EXODUS_AVAX_C_SERVER_URL)
14
16
 
15
17
  // exported for in-library use only.
16
18
  export const serverMap = {
@@ -18,6 +20,7 @@ export const serverMap = {
18
20
  ethereumclassic: etc,
19
21
  bsc,
20
22
  matic: polygon,
23
+ avalanchec: avaxc,
21
24
  }
22
25
 
23
26
  export function getServer(asset) {
@@ -4,6 +4,7 @@ import WebSocket from '../websocket'
4
4
 
5
5
  const RECONNECT_INTERVAL = ms('10s')
6
6
  const PING_INTERVAL = ms('10s')
7
+ const MAX_RECONNECT_DELAY = ms('15s')
7
8
 
8
9
  export default function createWebSocket(getURL) {
9
10
  const addresses = new Set()
@@ -57,7 +58,9 @@ export default function createWebSocket(getURL) {
57
58
  ws = null
58
59
  clearInterval(pingIntervalId)
59
60
  pingIntervalId = null
60
- if (opened) openTimeoutId = setTimeout(open, RECONNECT_INTERVAL)
61
+ if (opened) {
62
+ openTimeoutId = setTimeout(open, reconnectDelay())
63
+ }
61
64
  events.emit('close')
62
65
  }
63
66
  }
@@ -78,6 +81,12 @@ export default function createWebSocket(getURL) {
78
81
  events.emit('close')
79
82
  }
80
83
 
84
+ function reconnectDelay() {
85
+ const min = RECONNECT_INTERVAL
86
+ const max = MAX_RECONNECT_DELAY
87
+ return Math.floor(Math.random() * (max - min + 1) + min)
88
+ }
89
+
81
90
  function watch(address) {
82
91
  if (addresses.has(address)) return
83
92
  addresses.add(address)
@@ -0,0 +1,12 @@
1
+ import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
2
+ import { avaxc as avalancheServer } from '../exodus-eth-server'
3
+
4
+ export class AvalancheFeeMonitor extends EthereumLikeFeeMonitor {
5
+ constructor({ updateFee }) {
6
+ super({
7
+ updateFee,
8
+ assetName: 'avalanchec',
9
+ getGasPrice: avalancheServer.gasPrice,
10
+ })
11
+ }
12
+ }
@@ -2,3 +2,4 @@ export * from './ethereum'
2
2
  export * from './ethereumclassic'
3
3
  export * from './bsc'
4
4
  export * from './polygon'
5
+ export * from './avalanchec'
package/LICENSE.md DELETED
File without changes