@exodus/ethereum-api 9.0.2 → 10.0.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/CHANGELOG.md +22 -0
- package/package.json +2 -2
- package/src/create-asset-utils.js +0 -10
- package/src/error-wrapper.js +9 -1
- package/src/eth-like-util.js +7 -2
- package/src/exodus-eth-server/index.js +0 -4
- package/src/get-balance-for-address.js +1 -1
- package/src/get-balances.js +23 -13
- package/src/index.js +0 -1
- package/src/nft-utils.js +6 -2
- package/src/server-based-fee-monitor.js +1 -1
- package/src/tx-log/clarity-truncated-history-monitor.js +31 -10
- package/src/tx-log/clarity-truncated-history-monitor.md +6 -2
- package/src/tx-log/index.js +0 -1
- package/src/tx-log/monitor-utils/extract-balance-from-clarity-account-info.js +7 -1
- package/src/tx-log/monitor-utils/index.js +0 -2
- package/src/exodus-eth-server/api.js +0 -276
- package/src/exodus-eth-server/ws.js +0 -126
- package/src/tx-log/ethereum-monitor.js +0 -351
- package/src/tx-log/monitor-utils/get-history-from-server.js +0 -43
- package/src/tx-log/monitor-utils/get-log-items-from-server-tx.js +0 -203
- package/src/tx-log/monitor-utils/get-names-of-tokens-transferred-by-server-tx.js +0 -40
- package/src/tx-log/ws-updates.js +0 -71
package/src/tx-log/ws-updates.js
DELETED
|
@@ -1,71 +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
|
-
server,
|
|
11
|
-
beforeStart = false,
|
|
12
|
-
}) {
|
|
13
|
-
Object.entries(addressesByWalletAccount).forEach(([walletAccount, addresses]) => {
|
|
14
|
-
const address = String([...addresses][0]).toLowerCase() // Only check m/0/0
|
|
15
|
-
const mapKey = `${server.getURL()}:${address}` // different chains might have the same addresses
|
|
16
|
-
if (subscribedToAddressNotificationsMap.has(mapKey)) return
|
|
17
|
-
|
|
18
|
-
server.ws.watch(address)
|
|
19
|
-
server.ws.events.on(`address-${address}`, () => {
|
|
20
|
-
tick({ refresh: false, walletAccount })
|
|
21
|
-
})
|
|
22
|
-
subscribedToAddressNotificationsMap.set(mapKey, true)
|
|
23
|
-
if (!beforeStart) {
|
|
24
|
-
// tick for a new wallet account
|
|
25
|
-
tick({ refresh: false, walletAccount })
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function subscribeToGasPriceNotifications({
|
|
31
|
-
server,
|
|
32
|
-
updateGasPrice,
|
|
33
|
-
subscribedToGasPriceMap,
|
|
34
|
-
}) {
|
|
35
|
-
const mapKey = server.getURL()
|
|
36
|
-
if (subscribedToGasPriceMap.has(mapKey)) return
|
|
37
|
-
server.ws.events.on('gasprice', updateGasPrice)
|
|
38
|
-
subscribedToGasPriceMap.set(mapKey, true)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function enableWSUpdates({
|
|
42
|
-
interval,
|
|
43
|
-
server,
|
|
44
|
-
timer,
|
|
45
|
-
tickWalletAccounts,
|
|
46
|
-
tick,
|
|
47
|
-
addressesByWalletAccount,
|
|
48
|
-
beforeStart = false,
|
|
49
|
-
}) {
|
|
50
|
-
const defaultInterval = interval
|
|
51
|
-
|
|
52
|
-
subscribeToWSNotifications({
|
|
53
|
-
server,
|
|
54
|
-
beforeStart,
|
|
55
|
-
tick,
|
|
56
|
-
addressesByWalletAccount,
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
server.ws.events.on('open', () => {
|
|
60
|
-
if (timer.isRunning) {
|
|
61
|
-
timer.setNewInterval(UPDATE_LOOP_INTERVAL)
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
server.ws.events.on('close', async () => {
|
|
65
|
-
if (timer.isRunning) {
|
|
66
|
-
await timer.setNewInterval(defaultInterval)
|
|
67
|
-
return tickWalletAccounts()
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
server.ws.open()
|
|
71
|
-
}
|