@exodus/ethereum-lib 5.24.0 → 5.24.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/CHANGELOG.md +9 -0
- package/package.json +2 -2
- package/src/index.js +1 -0
- package/src/tx-log/index.js +1 -0
- package/src/tx-log/lifecycle.js +37 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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
|
+
## [5.24.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.24.0...@exodus/ethereum-lib@5.24.1) (2026-05-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* validate polygon unstake state before gas estimation ([#8002](https://github.com/ExodusMovement/assets/issues/8002)) ([f63a244](https://github.com/ExodusMovement/assets/commit/f63a2441868c6226fe14085c0f7d9587131e69e0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [5.24.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.23.0...@exodus/ethereum-lib@5.24.0) (2026-04-30)
|
|
7
16
|
|
|
8
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.1",
|
|
4
4
|
"description": "Ethereum utils, such as for cryptography, address encoding/decoding, transaction building, etc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"type": "git",
|
|
52
52
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7f184588091acba3b358e4af13783ee1e2bab4ba"
|
|
55
55
|
}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './encode.js'
|
|
2
2
|
export * from './unsigned-tx/index.js'
|
|
3
3
|
export * from './utils/index.js'
|
|
4
|
+
export * from './tx-log/index.js'
|
|
4
5
|
export * from './constants.js'
|
|
5
6
|
export * from './selectors/index.js'
|
|
6
7
|
export { signMessage, signMessageWithSigner } from './sign-message.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isPendingTxInLog, isConfirmedTxInLog, getMethodIdFromEthTx } from './lifecycle.js'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Generic ethereum tx-log lifecycle and method-ID helpers shared between
|
|
2
|
+
// `@exodus/ethereum-api` and `@exodus/ethereum-plugin`. Both sides agree on
|
|
3
|
+
// what "pending" and "confirmed" mean from a single definition.
|
|
4
|
+
//
|
|
5
|
+
// For lifecycle decisions we only look at `confirmations`, `error`, and
|
|
6
|
+
// `dropped`. The Tx model (hydra/libraries/models/src/tx) does expose
|
|
7
|
+
// `pending` and `failed` getters, but we derive from the raw fields so the
|
|
8
|
+
// helpers also work on plain JSON tx objects, and so we can be stricter than
|
|
9
|
+
// `tx.pending` (which uses `confirmations <= 0` and would include the
|
|
10
|
+
// "unknown if propagated" state where `confirmations === -1`).
|
|
11
|
+
//
|
|
12
|
+
// We deliberately do not check `data.replacedBy`: it's only ever written by
|
|
13
|
+
// the bitcoin send pipeline. On ethereum, replaced txs are physically
|
|
14
|
+
// removed from the txLog by the ethereum monitors through the asset-client
|
|
15
|
+
// interface (the legacy ethereum-monitor uses the singular `removeTxLog`,
|
|
16
|
+
// the clarity monitors use `removeTxLogBatch`). Any `replacedBy` reads on
|
|
17
|
+
// ethereum paths elsewhere in the codebase are dead/defensive carryovers
|
|
18
|
+
// from bitcoin.
|
|
19
|
+
|
|
20
|
+
const isIgnoredTxInLog = (tx) => Boolean(tx.error || tx.dropped)
|
|
21
|
+
|
|
22
|
+
export const isPendingTxInLog = (tx) => !isIgnoredTxInLog(tx) && tx.confirmations === 0
|
|
23
|
+
|
|
24
|
+
export const isConfirmedTxInLog = (tx) => !isIgnoredTxInLog(tx) && tx.confirmations > 0
|
|
25
|
+
|
|
26
|
+
// Returns the lowercased method ID of an ethereum contract-call tx, or
|
|
27
|
+
// undefined if the tx is a plain transfer / has no recognizable input data.
|
|
28
|
+
// Reads `tx.data.methodId` first (set by the monitor for any contract-call
|
|
29
|
+
// tx with input data), falling back to slicing the leading bytes of
|
|
30
|
+
// `tx.data.data` (raw input). The consumer decides whether the result
|
|
31
|
+
// matches a method ID it cares about. `methodId` is the candidate selector
|
|
32
|
+
// being matched against; we use its length to slice the right number of
|
|
33
|
+
// chars.
|
|
34
|
+
export const getMethodIdFromEthTx = (tx, methodId) => {
|
|
35
|
+
const raw = tx.data?.methodId || tx.data?.data?.slice?.(0, Math.max(0, methodId.length))
|
|
36
|
+
return raw?.toLowerCase()
|
|
37
|
+
}
|