@exodus/ethereum-api 2.17.0 → 2.18.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 +3 -3
- package/package/package.json +0 -33
- package/package/src/eth-like-util.js +0 -147
- package/package/src/etherscan/account.js +0 -49
- package/package/src/etherscan/index.js +0 -48
- package/package/src/etherscan/logs.js +0 -16
- package/package/src/etherscan/proxy.js +0 -47
- package/package/src/etherscan/request.js +0 -25
- package/package/src/etherscan/ws.js +0 -88
- package/package/src/exodus-eth-server/api.js +0 -242
- package/package/src/exodus-eth-server/index.js +0 -36
- package/package/src/exodus-eth-server/ws.js +0 -108
- package/package/src/fee-monitor/avalanchec.js +0 -12
- package/package/src/fee-monitor/bsc.js +0 -12
- package/package/src/fee-monitor/ethereum.js +0 -13
- package/package/src/fee-monitor/ethereumclassic.js +0 -12
- package/package/src/fee-monitor/fantom.js +0 -12
- package/package/src/fee-monitor/harmony.js +0 -12
- package/package/src/fee-monitor/index.js +0 -7
- package/package/src/fee-monitor/polygon.js +0 -12
- package/package/src/gas-estimation.js +0 -103
- package/package/src/get-balances.js +0 -38
- package/package/src/index.js +0 -11
- package/package/src/simulate-tx/fetch-tx-preview.js +0 -21
- package/package/src/simulate-tx/index.js +0 -2
- package/package/src/simulate-tx/simulate-eth-tx.js +0 -86
- package/package/src/staking/fantom-staking.js +0 -115
- package/package/src/staking/index.js +0 -2
- package/package/src/staking/matic-staking.js +0 -159
- package/package/src/tx-log/__tests__/assets-for-test-helper.js +0 -30
- package/package/src/tx-log/__tests__/bsc-history-return-values-for-test-helper.js +0 -94
- package/package/src/tx-log/__tests__/bsc-monitor.integration.test.js +0 -167
- package/package/src/tx-log/__tests__/bsc-monitor.test.js +0 -143
- package/package/src/tx-log/__tests__/ethereum-history-return-values-for-test-helper.js +0 -357
- package/package/src/tx-log/__tests__/ethereum-history-unknown-token-helper.js +0 -612
- package/package/src/tx-log/__tests__/ethereum-monitor.integration.test.js +0 -163
- package/package/src/tx-log/__tests__/ethereum-monitor.test.js +0 -211
- package/package/src/tx-log/__tests__/monitor-test-helper.js +0 -39
- package/package/src/tx-log/__tests__/steth-monitor.integration.test.js +0 -91
- package/package/src/tx-log/__tests__/uniswap-monitor.integration.test.js +0 -86
- package/package/src/tx-log/__tests__/uniswap-monitor.test.js +0 -158
- package/package/src/tx-log/__tests__/uniswap-return-values-for-test-helper.js +0 -193
- package/package/src/tx-log/ethereum-monitor.js +0 -293
- package/package/src/tx-log/index.js +0 -1
- package/package/src/tx-log/ws-updates.js +0 -75
- package/package/src/websocket/index.android.js +0 -2
- package/package/src/websocket/index.ios.js +0 -2
- package/package/src/websocket/index.js +0 -23
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import ms from 'ms'
|
|
2
|
-
|
|
3
|
-
const subscribedToAddressNotificationsMap = new Map()
|
|
4
|
-
|
|
5
|
-
const UPDATE_LOOP_INTERVAL = ms('5m')
|
|
6
|
-
|
|
7
|
-
export function subscribeToWSNotifications({
|
|
8
|
-
addressesByWalletAccount,
|
|
9
|
-
tick,
|
|
10
|
-
getState,
|
|
11
|
-
server,
|
|
12
|
-
beforeStart = false,
|
|
13
|
-
}) {
|
|
14
|
-
Object.entries(addressesByWalletAccount).forEach(([walletAccount, addresses]) => {
|
|
15
|
-
const address = String(Array.from(addresses)[0]).toLowerCase() // Only check m/0/0
|
|
16
|
-
const mapKey = `${server.getURL()}:${address}` // different chains might have the same addresses
|
|
17
|
-
if (subscribedToAddressNotificationsMap.has(mapKey)) return
|
|
18
|
-
|
|
19
|
-
server.ws.watch(address)
|
|
20
|
-
server.ws.events.on(`address-${address}`, () => {
|
|
21
|
-
tick({ refresh: false, getState, walletAccount })
|
|
22
|
-
})
|
|
23
|
-
subscribedToAddressNotificationsMap.set(mapKey, true)
|
|
24
|
-
if (!beforeStart) {
|
|
25
|
-
// tick for a new wallet account
|
|
26
|
-
tick({ refresh: false, getState, walletAccount })
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function subscribeToGasPriceNotifications({
|
|
32
|
-
server,
|
|
33
|
-
updateGasPrice,
|
|
34
|
-
subscribedToGasPriceMap,
|
|
35
|
-
}) {
|
|
36
|
-
const mapKey = server.getURL()
|
|
37
|
-
if (subscribedToGasPriceMap.has(mapKey)) return
|
|
38
|
-
server.ws.events.on('gasprice', updateGasPrice)
|
|
39
|
-
subscribedToGasPriceMap.set(mapKey, true)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function enableWSUpdates({
|
|
43
|
-
interval,
|
|
44
|
-
server,
|
|
45
|
-
timer,
|
|
46
|
-
dispatch,
|
|
47
|
-
getState,
|
|
48
|
-
tickAllWalletAccounts,
|
|
49
|
-
tick,
|
|
50
|
-
addressesByWalletAccount,
|
|
51
|
-
beforeStart = false,
|
|
52
|
-
}) {
|
|
53
|
-
const defaultInterval = interval
|
|
54
|
-
|
|
55
|
-
subscribeToWSNotifications({
|
|
56
|
-
server,
|
|
57
|
-
getState,
|
|
58
|
-
beforeStart,
|
|
59
|
-
tick,
|
|
60
|
-
addressesByWalletAccount,
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
server.ws.events.on('open', () => {
|
|
64
|
-
if (timer.isRunning) {
|
|
65
|
-
timer.setNewInterval(UPDATE_LOOP_INTERVAL)
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
server.ws.events.on('close', async () => {
|
|
69
|
-
if (timer.isRunning) {
|
|
70
|
-
await timer.setNewInterval(defaultInterval)
|
|
71
|
-
return tickAllWalletAccounts({ dispatch, getState })
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
server.ws.open()
|
|
75
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a "light" version of @exodus/core resolution to select the native WebSocket on BE
|
|
3
|
-
* It's a workaround until https://github.com/ExodusMovement/assets/pull/72 is merged.
|
|
4
|
-
*
|
|
5
|
-
* Based on https://github.com/ExodusMovement/fetch/blob/master/core.js , note that chooses native on Desktop
|
|
6
|
-
*/
|
|
7
|
-
if (
|
|
8
|
-
typeof process !== 'undefined' &&
|
|
9
|
-
process &&
|
|
10
|
-
(process.type === 'renderer' || process.type === 'worker')
|
|
11
|
-
) {
|
|
12
|
-
// THIS IS FOR DESKTOP
|
|
13
|
-
module.exports = require('ws')
|
|
14
|
-
} else {
|
|
15
|
-
// eslint-disable-next-line no-undef
|
|
16
|
-
if (global.window?.WebSocket) {
|
|
17
|
-
// THIS IS FOR BE
|
|
18
|
-
module.exports = global.window?.WebSocket
|
|
19
|
-
} else {
|
|
20
|
-
// THIS IS FOR UNIT TESTING.
|
|
21
|
-
module.exports = require('ws')
|
|
22
|
-
}
|
|
23
|
-
}
|