@exodus/ethereum-lib 5.24.0 → 5.24.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 +23 -0
- package/package.json +2 -2
- package/src/account-state/index.js +1 -0
- package/src/index.js +1 -0
- package/src/selectors/get-can-accelerate-tx-factory.js +4 -1
- package/src/tx-log/index.js +1 -0
- package/src/tx-log/lifecycle.js +37 -0
- package/src/unsigned-tx/create-unsigned-tx.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.24.1...@exodus/ethereum-lib@5.24.2) (2026-05-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix(ethereum-lib): avoid float precision loss in legacy unsigned-tx fee (#7918)
|
|
13
|
+
|
|
14
|
+
* fix(ethereum-lib): use .gte() instead of >= for currency comparison (#7961)
|
|
15
|
+
|
|
16
|
+
* fix: stale truncated balances after new transaction (#7897)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [5.24.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.24.0...@exodus/ethereum-lib@5.24.1) (2026-05-12)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* validate polygon unstake state before gas estimation ([#8002](https://github.com/ExodusMovement/assets/issues/8002)) ([f63a244](https://github.com/ExodusMovement/assets/commit/f63a2441868c6226fe14085c0f7d9587131e69e0))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [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
30
|
|
|
8
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.2",
|
|
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": "8cf5e6a5fc7d235c2c57ea51219bb1e3469329c5"
|
|
55
55
|
}
|
|
@@ -11,6 +11,7 @@ export default function createEthereumLikeAccountState({ asset, extraData = {},
|
|
|
11
11
|
balance: asset.currency.ZERO,
|
|
12
12
|
tokenBalances: {},
|
|
13
13
|
nonce: 0,
|
|
14
|
+
truncatedAccountState: { balance: asset.currency.ZERO, tokenBalances: Object.create(null) },
|
|
14
15
|
index: 0,
|
|
15
16
|
isBlacklisted: null,
|
|
16
17
|
eip7702Delegation: null,
|
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'
|
|
@@ -222,7 +222,10 @@ const calculateBumpedGasPriceEip1559 = ({
|
|
|
222
222
|
prevMaxFeePerGas,
|
|
223
223
|
})
|
|
224
224
|
|
|
225
|
-
assert(
|
|
225
|
+
assert(
|
|
226
|
+
bumpedGasPrice.gte(currentBaseFeePerGas),
|
|
227
|
+
'bumpedGasPrice must be >= currentBaseFeePerGas'
|
|
228
|
+
)
|
|
226
229
|
|
|
227
230
|
// Since `calculateBumpedGasPriceNonEip1559` will guarantee that
|
|
228
231
|
// the returned `bumpedGasPrice` will be greater than the
|
|
@@ -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
|
+
}
|
|
@@ -36,7 +36,6 @@ export default function createUnsignedTxFactory({ chainId }) {
|
|
|
36
36
|
eip1559Enabled,
|
|
37
37
|
}) => {
|
|
38
38
|
console.warn('createUnsignedTxFactory is deprecated, use createTxFactory instead')
|
|
39
|
-
const baseAsset = asset.baseAsset
|
|
40
39
|
assert(chainId, 'chainId is required')
|
|
41
40
|
|
|
42
41
|
txValue = assertValidTxValue({ asset, amount, txValue })
|
|
@@ -70,7 +69,9 @@ export default function createUnsignedTxFactory({ chainId }) {
|
|
|
70
69
|
|
|
71
70
|
const txMeta = {
|
|
72
71
|
assetName: asset.name,
|
|
73
|
-
|
|
72
|
+
// Use NumberUnit#mul (BN-backed) to avoid float-precision loss when
|
|
73
|
+
// gasPrice (in wei) * gasLimit exceeds Number.MAX_SAFE_INTEGER (~9e15).
|
|
74
|
+
fee: gasPrice.mul(gasLimit),
|
|
74
75
|
eip1559Enabled: !!eip1559Enabled,
|
|
75
76
|
fromAddress,
|
|
76
77
|
}
|