@exodus/ethereum-api 7.0.17 → 7.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 +3 -3
- package/src/allowance/constants.js +3 -2
- package/src/allowance/index.js +90 -84
- package/src/ens/addresses.js +3 -1
- package/src/eth-like-util.js +2 -2
- package/src/etherscan/account.js +2 -2
- package/src/etherscan/index.js +15 -35
- package/src/etherscan/proxy.js +3 -3
- package/src/etherscan/request.js +1 -1
- package/src/etherscan/ws.js +2 -2
- package/src/exodus-eth-server/api-coin-nodes.js +4 -3
- package/src/exodus-eth-server/api.js +6 -4
- package/src/exodus-eth-server/clarity.js +10 -3
- package/src/exodus-eth-server/ws.js +13 -1
- package/src/fee-monitor/ethereumarbnova.js +4 -1
- package/src/fee-monitor/ethereumarbone.js +4 -1
- package/src/fee-monitor/optimism.js +4 -1
- package/src/gas-estimation.js +3 -1
- package/src/get-balances.js +1 -0
- package/src/simulate-tx/simulate-eth-tx.js +4 -3
- package/src/staking/ethereum/api.js +8 -8
- package/src/staking/ethereum/service.js +31 -33
- package/src/staking/ethereum/staking-utils.js +3 -5
- package/src/staking/fantom-staking.js +2 -2
- package/src/staking/matic/api.js +2 -3
- package/src/staking/matic/service.js +32 -40
- package/src/tx-log/clarity-monitor.js +14 -9
- package/src/tx-log/clarity-utils/get-derive-data-needed-for-tick.js +1 -1
- package/src/tx-log/clarity-utils/get-log-items-from-server-tx.js +4 -1
- package/src/tx-log/ethereum-monitor.js +8 -11
- package/src/tx-log/ethereum-no-history-monitor.js +13 -11
- package/src/tx-log/monitor-utils/check-pending-transactions.js +2 -0
- package/src/tx-log/monitor-utils/exclude-unchanged-token-balances.js +2 -3
- package/src/tx-log/monitor-utils/get-derive-data-needed-for-tick.js +1 -1
- package/src/tx-log/monitor-utils/get-derive-transactions-to-check.js +2 -1
- package/src/tx-log/monitor-utils/get-log-items-from-server-tx.js +5 -2
- package/src/tx-log/ws-updates.js +1 -1
- package/src/websocket/index.js +5 -4
- package/LICENSE.md +0 -0
- package/src/tx-log/monitor-utils/types.js +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export function excludeUnchangedTokenBalances(currentTokenBalances, newTokenBalancePairs) {
|
|
2
2
|
const newTokenBalances = Object.fromEntries(newTokenBalancePairs)
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
return newTokenBalancePairs.reduce((tokenBalancesAcc, [token, balance]) => {
|
|
5
5
|
const currentBalance = currentTokenBalances[token]
|
|
6
6
|
if (!newTokenBalances[token].isZero || (currentBalance && !currentBalance.isZero)) {
|
|
7
7
|
tokenBalancesAcc[token] = balance
|
|
8
8
|
}
|
|
9
|
+
|
|
9
10
|
return tokenBalancesAcc
|
|
10
11
|
}, {})
|
|
11
|
-
|
|
12
|
-
return tokenBalances
|
|
13
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// A super-selector that returns all the current data needed for a tick of the ETH monitor.
|
|
2
2
|
|
|
3
3
|
export default function getDeriveDataNeededForTick(aci) {
|
|
4
|
-
return async function({ assetName, walletAccount }) {
|
|
4
|
+
return async function ({ assetName, walletAccount }) {
|
|
5
5
|
const receiveAddress = await aci.getReceiveAddress({ assetName, walletAccount, useCache: true })
|
|
6
6
|
const currentAccountState = await aci.getAccountState({ assetName, walletAccount })
|
|
7
7
|
const minimumConfirmations = await aci.getConfirmationsNumber({ assetName })
|
|
@@ -3,7 +3,7 @@ import getSenderNonceKey from './get-sender-nonce-key'
|
|
|
3
3
|
|
|
4
4
|
export const UNCONFIRMED_TX_LIMIT = ms('5m')
|
|
5
5
|
|
|
6
|
-
const mapToObject = (map) => Object.fromEntries(
|
|
6
|
+
const mapToObject = (map) => Object.fromEntries(map.entries()) // only for string keys
|
|
7
7
|
|
|
8
8
|
export default function getDeriveTransactionsToCheck({ getTxLog }) {
|
|
9
9
|
return async ({ assetName: _assetName, walletAccount, tokens, ourWalletAddress }) => {
|
|
@@ -23,6 +23,7 @@ export default function getDeriveTransactionsToCheck({ getTxLog }) {
|
|
|
23
23
|
) {
|
|
24
24
|
pendingTransactionsToCheck.set(tx.txId, { tx, assetName })
|
|
25
25
|
}
|
|
26
|
+
|
|
26
27
|
if (tx.meta.simulated) simulatedTransactions.set(tx.txId, tx)
|
|
27
28
|
|
|
28
29
|
const senderNonceKey = getSenderNonceKey(tx, ourWalletAddress)
|
|
@@ -28,7 +28,9 @@ export default function getLogItemsFromServerTx({
|
|
|
28
28
|
const toAddress = tryFindExternalRecipient(ethereumTransfers, ourWalletAddress)
|
|
29
29
|
const ourWalletWasSender = serverTx.from === ourWalletAddress
|
|
30
30
|
const METHOD_ID_LENGTH = 10
|
|
31
|
-
const methodId = serverTx.data && {
|
|
31
|
+
const methodId = serverTx.data && {
|
|
32
|
+
methodId: serverTx.data.slice(0, Math.max(0, METHOD_ID_LENGTH)),
|
|
33
|
+
}
|
|
32
34
|
const data = serverTx.data || '0x'
|
|
33
35
|
const logItemCommonProperties = {
|
|
34
36
|
confirmations,
|
|
@@ -83,6 +85,7 @@ export default function getLogItemsFromServerTx({
|
|
|
83
85
|
])
|
|
84
86
|
}
|
|
85
87
|
}
|
|
88
|
+
|
|
86
89
|
// handle erc20
|
|
87
90
|
Object.entries(tokenTransfersByTokenName).forEach(([tokenName, tokenTransfers]) => {
|
|
88
91
|
const sendingTransferPresent = tokenTransfers.some(({ from }) => from === ourWalletAddress)
|
|
@@ -154,7 +157,7 @@ function isSelfSendTx({
|
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
function isNftTransfer({ serverTx, ourWalletAddress }) {
|
|
157
|
-
if (!Array.isArray(serverTx.erc721) || serverTx.erc721.length
|
|
160
|
+
if (!Array.isArray(serverTx.erc721) || serverTx.erc721.length === 0) return false
|
|
158
161
|
|
|
159
162
|
return serverTx.erc721.some(
|
|
160
163
|
(transfer) => transfer.to === ourWalletAddress || transfer.from === ourWalletAddress
|
package/src/tx-log/ws-updates.js
CHANGED
|
@@ -11,7 +11,7 @@ export function subscribeToWSNotifications({
|
|
|
11
11
|
beforeStart = false,
|
|
12
12
|
}) {
|
|
13
13
|
Object.entries(addressesByWalletAccount).forEach(([walletAccount, addresses]) => {
|
|
14
|
-
const address = String(
|
|
14
|
+
const address = String([...addresses][0]).toLowerCase() // Only check m/0/0
|
|
15
15
|
const mapKey = `${server.getURL()}:${address}` // different chains might have the same addresses
|
|
16
16
|
if (subscribedToAddressNotificationsMap.has(mapKey)) return
|
|
17
17
|
|
package/src/websocket/index.js
CHANGED
|
@@ -11,10 +11,11 @@ if (typeof process !== 'undefined' && (process.type === 'renderer' || process.ty
|
|
|
11
11
|
} else {
|
|
12
12
|
module.exports = require('ws')
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
module.exports = globalThis.WebSocket
|
|
17
|
-
} else {
|
|
14
|
+
// eslint-disable-next-line no-undef
|
|
15
|
+
} else if (typeof WebSocket === 'undefined') {
|
|
18
16
|
// THIS IS FOR UNIT TESTING.
|
|
19
17
|
module.exports = require('ws')
|
|
18
|
+
} else {
|
|
19
|
+
// THIS IS FOR BE
|
|
20
|
+
module.exports = globalThis.WebSocket
|
|
20
21
|
}
|
package/LICENSE.md
DELETED
|
File without changes
|
|
File without changes
|