@exodus/ethereum-lib 5.13.0 → 5.14.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,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
+ ## [5.14.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.13.1...@exodus/ethereum-lib@5.14.0) (2025-06-26)
7
+
8
+
9
+ ### Features
10
+
11
+
12
+ * feat: ensure satsifactory tipGasPrice during acceleration (#5939)
13
+
14
+
15
+
16
+ ## [5.13.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.13.0...@exodus/ethereum-lib@5.13.1) (2025-06-23)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+
22
+ * fix: basemainnet main asset rpc only (#5904)
23
+
24
+
25
+
6
26
  ## [5.13.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.12.0...@exodus/ethereum-lib@5.13.0) (2025-06-18)
7
27
 
8
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "5.13.0",
3
+ "version": "5.14.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",
@@ -50,5 +50,5 @@
50
50
  "type": "git",
51
51
  "url": "git+https://github.com/ExodusMovement/assets.git"
52
52
  },
53
- "gitHead": "4c871b4f5c3ed6a503547eb1b749a746770d2e5f"
53
+ "gitHead": "ced8d8f22450dd7e952770664a7ee91ed8c39092"
54
54
  }
package/src/constants.js CHANGED
@@ -136,7 +136,3 @@ export const CONFIRMATIONS_NUMBER = mapValues(
136
136
  export const ETHEREUM_LIKE_ASSETS = Object.keys(CHAIN_DATA)
137
137
 
138
138
  export const BUMP_RATE = 1.2
139
- /* @deprecated */
140
- export const ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES = Object.keys(CHAIN_DATA).filter(
141
- (key) => CHAIN_DATA[key].monitorType === 'no-history'
142
- )
@@ -183,11 +183,36 @@ const calculateBumpedGasPriceEip1559 = ({
183
183
  })
184
184
  }
185
185
 
186
+ // During transaction acceleration, our goal is to land the
187
+ // transaction in the next available block. However, this
188
+ // cannot be guaranteed if we're only applying the `BUMP_RATE`
189
+ // to an initially small `tipGasPrice` that's insufficient for
190
+ // current levels of congestion (even after multiplication).
191
+ //
192
+ // Therefore, if the `currentMaxPriorityFeePerGas` is known
193
+ // and it is greater than our evaluated `bumpedTipGasPrice`,
194
+ // we'll short-circuit to use that one instead.
195
+ const ensureSaneBumpedGasPriceEip1559 = ({
196
+ currentMaxPriorityFeePerGas,
197
+ eip1559BumpedGasPrice,
198
+ }) => {
199
+ assert(currentMaxPriorityFeePerGas, 'expected currentMaxPriorityFeePerGas')
200
+
201
+ const { bumpedGasPrice, bumpedTipGasPrice } = eip1559BumpedGasPrice
202
+ if (currentMaxPriorityFeePerGas.lte(bumpedTipGasPrice)) return eip1559BumpedGasPrice
203
+
204
+ return {
205
+ bumpedTipGasPrice: currentMaxPriorityFeePerGas,
206
+ bumpedGasPrice: bumpedGasPrice.sub(bumpedTipGasPrice).add(currentMaxPriorityFeePerGas),
207
+ }
208
+ }
209
+
186
210
  export const calculateBumpedGasPrice = ({
187
211
  baseAsset,
188
212
  tx,
189
213
  currentBaseFee,
190
214
  currentGasPrice,
215
+ currentTipGasPrice,
191
216
  eip1559Enabled,
192
217
  }) => {
193
218
  // Determine the transaction we intend to override's
@@ -210,12 +235,19 @@ export const calculateBumpedGasPrice = ({
210
235
  ? baseAsset.currency.baseUnit(tx.data.tipGasPrice)
211
236
  : null
212
237
 
213
- return calculateBumpedGasPriceEip1559({
238
+ const eip1559BumpedGasPrice = calculateBumpedGasPriceEip1559({
214
239
  baseAsset,
215
240
  currentBaseFeePerGas: currentBaseFee,
216
241
  prevMaxPriorityFeePerGas,
217
242
  prevMaxFeePerGas,
218
243
  })
244
+
245
+ if (!currentTipGasPrice) return eip1559BumpedGasPrice
246
+
247
+ return ensureSaneBumpedGasPriceEip1559({
248
+ currentMaxPriorityFeePerGas: currentTipGasPrice,
249
+ eip1559BumpedGasPrice,
250
+ })
219
251
  }
220
252
 
221
253
  export const canAccelerateTx = ({
@@ -251,6 +283,7 @@ export const canAccelerateTx = ({
251
283
  gasPrice: currentGasPrice,
252
284
  eip1559Enabled,
253
285
  baseFeePerGas: currentBaseFee,
286
+ tipGasPrice: currentTipGasPrice,
254
287
  } = getFeeData(assetName)
255
288
 
256
289
  const { bumpedGasPrice: gasPriceToUse } = calculateBumpedGasPrice({
@@ -258,6 +291,7 @@ export const canAccelerateTx = ({
258
291
  tx,
259
292
  currentGasPrice,
260
293
  currentBaseFee,
294
+ currentTipGasPrice,
261
295
  eip1559Enabled,
262
296
  })
263
297
  const replacementFee = gasPriceToUse.mul(tx.data.gasLimit)
@@ -2,9 +2,6 @@ import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs/tx'
2
2
  import { padToEven, toBuffer } from '@exodus/ethereumjs/util'
3
3
  import baseX from 'base-x'
4
4
 
5
- // eslint-disable-next-line @exodus/import/no-deprecated
6
- import { ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES } from '../constants.js'
7
-
8
5
  export { default as calculateExtraEth } from './calculate-extra-eth.js'
9
6
 
10
7
  const base10 = baseX('0123456789')
@@ -140,6 +137,7 @@ export const isRpcBalanceAsset = (asset) =>
140
137
  [
141
138
  'ethereumarbone',
142
139
  'fantommainnet',
140
+ 'basemainnet',
143
141
  'matic',
144
142
  'optimism',
145
143
  'ousd_ethereum_48fcf72d',
@@ -147,7 +145,7 @@ export const isRpcBalanceAsset = (asset) =>
147
145
  'weth',
148
146
  ...customTokensWithRpcBalance,
149
147
  // eslint-disable-next-line @exodus/import/no-deprecated
150
- ].includes(asset.name) || ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES.includes(asset.baseAsset.name)
148
+ ].includes(asset.name)
151
149
 
152
150
  export const getAssetAddresses = (asset) => {
153
151
  // It seems to be two schemas of assets. The original and the transformed by the client.