@exodus/ethereum-lib 5.22.1 → 5.24.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 CHANGED
@@ -3,6 +3,32 @@
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.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.23.0...@exodus/ethereum-lib@5.24.0) (2026-04-30)
7
+
8
+
9
+ ### Features
10
+
11
+
12
+ * feat: start adding truncated history for clarity evm (#7604)
13
+
14
+
15
+
16
+ ## [5.23.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.22.1...@exodus/ethereum-lib@5.23.0) (2026-04-15)
17
+
18
+
19
+ ### Features
20
+
21
+
22
+ * feat: evm duplex transactions (#7688)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+
28
+ * fix: lint failed by ethereum-plugin (#7758)
29
+
30
+
31
+
6
32
  ## [5.22.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.22.0...@exodus/ethereum-lib@5.22.1) (2026-03-26)
7
33
 
8
34
  **Note:** Version bump only for package @exodus/ethereum-lib
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "5.22.1",
3
+ "version": "5.24.0",
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": "f7c3c3541471b863d7b8cb66b8e7885df847821d"
54
+ "gitHead": "87bf2c314792d465c10789267316e74d7a19301a"
55
55
  }
@@ -10,6 +10,7 @@ export default function createEthereumLikeAccountState({ asset, extraData = {},
10
10
  clarityCursor: '',
11
11
  balance: asset.currency.ZERO,
12
12
  tokenBalances: {},
13
+ nonce: 0,
13
14
  index: 0,
14
15
  isBlacklisted: null,
15
16
  eip7702Delegation: null,
@@ -123,7 +123,7 @@ const wrapResponseToObject = ({ bumpType = BumpType.NONE, errorMessage = null }
123
123
  errorMessage,
124
124
  })
125
125
 
126
- const calculateTxGasPrice = (tx) => tx.feeAmount.div(tx.data.gasLimit)
126
+ export const calculateTxGasPrice = (tx) => tx.feeAmount.div(tx.data.gasLimit)
127
127
 
128
128
  const calculateBumpedGasPriceNonEip1559 = ({ currentGasPrice, prevMaxFeePerGas }) => {
129
129
  assert(currentGasPrice, 'currentGasPrice is required')
@@ -1,5 +1,6 @@
1
1
  export {
2
2
  default as getCanAccelerateTxFactory,
3
+ calculateTxGasPrice,
3
4
  calculateBumpedGasPrice,
4
5
  calculateBumpedGasPriceForFeeData,
5
6
  getPendingNonExchangeTxs,
@@ -1,7 +1,24 @@
1
+ import NumberUnit from '@exodus/currency'
1
2
  import { intToBuffer, toBuffer } from '@exodus/ethereumjs/util'
2
3
  import assert from 'minimalistic-assert'
3
4
 
4
- import { currency2buffer, isToken } from '../utils/index.js'
5
+ import { currency2buffer, isEthereumLikeToken, isToken } from '../utils/index.js'
6
+
7
+ export const assertValidTxValue = ({ asset, amount, txValue: providedTxValue }) => {
8
+ if (!providedTxValue && isEthereumLikeToken(asset)) return asset.baseAsset.currency.ZERO
9
+
10
+ if (!providedTxValue) return amount
11
+
12
+ assert(
13
+ providedTxValue instanceof NumberUnit &&
14
+ providedTxValue.unitType.equals(asset.baseAsset.currency),
15
+ 'invalid txValue'
16
+ )
17
+
18
+ assert(asset !== asset.baseAsset || providedTxValue.equals(amount), 'inconsistent txValue')
19
+
20
+ return providedTxValue
21
+ }
5
22
 
6
23
  export default function createUnsignedTxFactory({ chainId }) {
7
24
  assert(typeof chainId === 'number', 'chainId is required')
@@ -11,6 +28,7 @@ export default function createUnsignedTxFactory({ chainId }) {
11
28
  amount,
12
29
  nonce,
13
30
  txInput,
31
+ txValue,
14
32
  gasLimit,
15
33
  gasPrice, // eip 1559: `maxFeePerGas`
16
34
  tipGasPrice, // eip 1559: `maxPriorityPerGas`
@@ -21,6 +39,8 @@ export default function createUnsignedTxFactory({ chainId }) {
21
39
  const baseAsset = asset.baseAsset
22
40
  assert(chainId, 'chainId is required')
23
41
 
42
+ txValue = assertValidTxValue({ asset, amount, txValue })
43
+
24
44
  if (txInput) {
25
45
  txInput = toBuffer(txInput) // If txInput is already a Buffer, then it is passed through
26
46
  } else {
@@ -29,7 +49,7 @@ export default function createUnsignedTxFactory({ chainId }) {
29
49
 
30
50
  const _isToken = isToken(asset)
31
51
  const to = _isToken ? asset.contract.address : address
32
- let value = currency2buffer(_isToken ? baseAsset.currency.ZERO : amount)
52
+ let value = currency2buffer(txValue)
33
53
 
34
54
  // TODO: check: present on desktop missing on mobile. This insures we never have a buffer specifying 0.
35
55
  // In ETH, a buffer of zero length and a buffer specifying 0 imply different things
@@ -1,4 +1,4 @@
1
- export { default as createUnsignedTxFactory } from './create-unsigned-tx.js'
1
+ export { default as createUnsignedTxFactory, assertValidTxValue } from './create-unsigned-tx.js'
2
2
  export { default as parseUnsignedTx } from './parse-unsigned-tx.js'
3
3
  export { default as signUnsignedTx, signUnsignedTxWithSigner } from './sign-unsigned-tx.js'
4
4
  export { default as createAndSignTxFactory } from './create-and-sign-tx.js'
@@ -94,7 +94,7 @@ export default function parseUnsignedTx({ asset, unsignedTx }) {
94
94
  const baseAsset = asset.baseAsset
95
95
  const txData = unsignedTx.txData
96
96
  const {
97
- to: rawTo,
97
+ to: txToAddress,
98
98
  data,
99
99
  value,
100
100
  gasLimit,
@@ -117,7 +117,7 @@ export default function parseUnsignedTx({ asset, unsignedTx }) {
117
117
  nonce: bufferToInt(txData.nonce),
118
118
  }
119
119
 
120
- const { to, amount: resolvedAmount } = resolveToAmount({ asset, data, value, to: rawTo })
120
+ const { to, amount: resolvedAmount } = resolveToAmount({ asset, data, value, to: txToAddress })
121
121
 
122
122
  // the txMeta.fee may include implicit l1 fees
123
123
  const fee = unsignedTx.txMeta?.fee
@@ -130,15 +130,20 @@ export default function parseUnsignedTx({ asset, unsignedTx }) {
130
130
  : resolvedAmount ?? asset.currency.ZERO
131
131
 
132
132
  return {
133
- to,
133
+ to, // TODO: This should be {address,toAddress}
134
134
  amount,
135
135
  fee,
136
136
  gasLimit,
137
137
  gasPrice,
138
- tipGasPrice,
138
+ // HACK: Backwards compatibility. Where falsy,
139
+ // the `tipGasPrice` should be omitted,
140
+ // rather than declared as a falsy key.
141
+ ...(tipGasPrice ? { tipGasPrice } : null),
139
142
  eip1559Enabled,
140
143
  nonce,
141
144
  from: null, // TODO: how?
142
145
  data,
146
+ value,
147
+ txToAddress,
143
148
  }
144
149
  }