@exodus/ethereum-api 8.34.0 → 8.34.2
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
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.34.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.34.1...@exodus/ethereum-api@8.34.2) (2025-04-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: import matic unstaking transactions from eth txLog (#5441)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [8.34.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.34.0...@exodus/ethereum-api@8.34.1) (2025-04-15)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* fix: remove bsc assets from RPC balance list (#5444)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [8.34.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.33.7...@exodus/ethereum-api@8.34.0) (2025-04-08)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.34.
|
|
3
|
+
"version": "8.34.2",
|
|
4
4
|
"description": "Transaction monitors, fee monitors, RPC with the blockchain node, and other networking code for Ethereum and EVM-based blockchains",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@exodus/bip44-constants": "^195.0.0",
|
|
29
29
|
"@exodus/crypto": "^1.0.0-rc.13",
|
|
30
30
|
"@exodus/currency": "^6.0.1",
|
|
31
|
-
"@exodus/ethereum-lib": "^5.10.
|
|
31
|
+
"@exodus/ethereum-lib": "^5.10.1",
|
|
32
32
|
"@exodus/ethereum-meta": "^2.5.0",
|
|
33
33
|
"@exodus/ethereumholesky-meta": "^2.0.2",
|
|
34
34
|
"@exodus/ethereumjs": "^1.0.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"type": "git",
|
|
65
65
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "e7d49daa108ffa7200e33f6cfe2d1c175cd675ea"
|
|
68
68
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import assetsList, { asset as ethereum } from '@exodus/ethereum-meta'
|
|
2
|
+
import { Tx } from '@exodus/models'
|
|
3
|
+
|
|
1
4
|
import { MaticStakingApi } from './api.js'
|
|
2
5
|
|
|
3
6
|
// function selector for buyVoucher(uint256 _amount, uint256 _minSharesToMint)
|
|
@@ -11,6 +14,13 @@ const CLAIM_UNDELEGATE_BALANCE = '0xe97fddc2'
|
|
|
11
14
|
|
|
12
15
|
const STAKING_MANAGER_CONTRACT = MaticStakingApi.STAKING_MANAGER_ADDR
|
|
13
16
|
|
|
17
|
+
const METHOD_ID_CHAR_LENGTH = 10
|
|
18
|
+
|
|
19
|
+
const { currency: polygonCurrency } = assetsList.find(
|
|
20
|
+
({ name: tokenName }) => tokenName === 'polygon'
|
|
21
|
+
)
|
|
22
|
+
const currencies = { ethereum: ethereum.currency, polygon: polygonCurrency }
|
|
23
|
+
|
|
14
24
|
export const isPolygonTx = ({ coinName }) => coinName === 'polygon'
|
|
15
25
|
export const isPolygonDelegate = (tx) =>
|
|
16
26
|
isPolygonTx(tx) && tx.to === STAKING_MANAGER_CONTRACT && tx.data?.methodId === DELEGATE
|
|
@@ -22,3 +32,47 @@ export const isPolygonClaimUndelegate = (tx) =>
|
|
|
22
32
|
isPolygonTx(tx) &&
|
|
23
33
|
tx.from?.[0] === STAKING_MANAGER_CONTRACT &&
|
|
24
34
|
tx.data?.methodId === CLAIM_UNDELEGATE_BALANCE
|
|
35
|
+
|
|
36
|
+
const isPolygonStakingContractTxInEthereumTxLog = (tx) =>
|
|
37
|
+
tx.to === MaticStakingApi.EVERSTAKE_VALIDATOR_CONTRACT_ADDR
|
|
38
|
+
|
|
39
|
+
const isPolygonStakingContractCallInEthTx = ({ tx, methodId }) =>
|
|
40
|
+
tx?.data?.data?.slice?.(0, Math.max(0, METHOD_ID_CHAR_LENGTH)) === methodId // ETH txs have contract data in 'data'
|
|
41
|
+
|
|
42
|
+
const isPolygonUndelegateTxInEthreumTxLog = (tx) =>
|
|
43
|
+
isPolygonStakingContractCallInEthTx({ tx, methodId: UNDELEGATE })
|
|
44
|
+
|
|
45
|
+
// Some polygon unstake txs are only kept in the ETH tx log rather than Polygon tx log.
|
|
46
|
+
// This is b/c the given tx does not have any ERC2O token transfer (MATIC).
|
|
47
|
+
// Token tx log only has txs which contains ERC2O token transfer of the given token.
|
|
48
|
+
export const isPolygonUndelegateTxInEthereumTxLog = (tx) =>
|
|
49
|
+
isPolygonStakingContractTxInEthereumTxLog(tx) && isPolygonUndelegateTxInEthreumTxLog(tx)
|
|
50
|
+
|
|
51
|
+
export const createUndelegateTx = (tx) => {
|
|
52
|
+
return Tx.fromJSON({
|
|
53
|
+
...tx,
|
|
54
|
+
coinName: 'polygon',
|
|
55
|
+
coinAmount: currencies.polygon.ZERO,
|
|
56
|
+
tokens: [],
|
|
57
|
+
currencies,
|
|
58
|
+
from: [STAKING_MANAGER_CONTRACT],
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const getPolygonUndelegateTxInEthereumTxLog = (ethereumLogItems) => {
|
|
63
|
+
if (!ethereumLogItems || ethereumLogItems.length === 0) return []
|
|
64
|
+
|
|
65
|
+
const polygonLogItems = []
|
|
66
|
+
const polygonEthUndelegateTxs = [...ethereumLogItems].filter((tx) =>
|
|
67
|
+
isPolygonUndelegateTxInEthereumTxLog(tx)
|
|
68
|
+
)
|
|
69
|
+
const polygonUndelegateTxs = [...polygonEthUndelegateTxs].map((tx) => createUndelegateTx(tx))
|
|
70
|
+
|
|
71
|
+
for (const polygonTx of polygonUndelegateTxs) {
|
|
72
|
+
polygonLogItems.push(polygonTx)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
polygonLogItems.sort((a, b) => new Date(b.date) - new Date(a.date))
|
|
76
|
+
|
|
77
|
+
return polygonLogItems
|
|
78
|
+
}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
import { getPolygonUndelegateTxInEthereumTxLog } from '../staking/matic/matic-staking-utils.js'
|
|
1
2
|
import { assetStakingTxData } from './asset-staking-tx-data.js'
|
|
2
3
|
|
|
3
4
|
const getTxStakingData = ({ assetName, currency, tx }) => {
|
|
4
5
|
return assetStakingTxData[assetName]({ tx, currency })
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
const getAssetExpandedTxLog = async ({ assetName, aci, txs, walletAccount }) => {
|
|
9
|
+
const additionalTxs = []
|
|
10
|
+
if (assetName === 'polygon') {
|
|
11
|
+
const ethereumTxLog = await aci.getTxLog({ walletAccount, assetName: 'ethereum' })
|
|
12
|
+
const polygonUndelegateTxs = getPolygonUndelegateTxInEthereumTxLog(ethereumTxLog)
|
|
13
|
+
|
|
14
|
+
for (const tx of polygonUndelegateTxs) {
|
|
15
|
+
if (txs.has(tx.txId)) continue
|
|
16
|
+
|
|
17
|
+
additionalTxs.push(tx)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return additionalTxs
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
const processTxLog = async ({ asset, assetClientInterface: aci, walletAccount, batch }) => {
|
|
8
25
|
const { name: assetName, currency } = asset
|
|
9
26
|
const txs = await aci.getTxLog({ assetName, walletAccount })
|
|
@@ -20,6 +37,9 @@ const processTxLog = async ({ asset, assetClientInterface: aci, walletAccount, b
|
|
|
20
37
|
}
|
|
21
38
|
}
|
|
22
39
|
|
|
40
|
+
const expandedTxs = await getAssetExpandedTxLog({ assetName, aci, txs, walletAccount })
|
|
41
|
+
newTxs.push(...expandedTxs)
|
|
42
|
+
|
|
23
43
|
if (newTxs.length > 0) {
|
|
24
44
|
aci.updateTxLogAndNotifyBatch({ assetName, walletAccount, txs: newTxs, batch })
|
|
25
45
|
}
|