@exodus/ethereum-lib 2.10.5 → 2.10.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "2.10.5",
3
+ "version": "2.10.7",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -24,5 +24,5 @@
24
24
  "peerDependencies": {
25
25
  "@exodus/assets": "8.0.x"
26
26
  },
27
- "gitHead": "7b3935c60ae39ce470c129efa86da4e9a06d676b"
27
+ "gitHead": "f89f33caaa18c960071628b7a0cb740481c10705"
28
28
  }
@@ -88,14 +88,12 @@ export const calculateBumpedGasPrice = ({ baseAsset, tx, currentGasPrice, eip155
88
88
  let bumpedGasPrice = usedGasPrice.mul(BUMP_RATE)
89
89
  bumpedGasPrice = currentGasPrice.gt(bumpedGasPrice) ? currentGasPrice : bumpedGasPrice
90
90
 
91
- const tipGasPrice = tx.data?.tipGasPrice
92
- ? baseAsset.currency.baseUnit(tx.data.tipGasPrice).to('Gwei')
93
- : baseAsset.currency.parse('2 Gwei') // we bump a legacy tx by an EIP1559 tx
94
- const bumpedTipGasPrice = tipGasPrice.mul(BUMP_RATE)
95
-
96
- return eip1559Enabled
91
+ return eip1559Enabled && tx.data?.tipGasPrice
97
92
  ? {
98
- bumpedTipGasPrice,
93
+ bumpedTipGasPrice: baseAsset.currency
94
+ .baseUnit(tx.data.tipGasPrice)
95
+ .to('Gwei')
96
+ .mul(BUMP_RATE),
99
97
  bumpedGasPrice,
100
98
  }
101
99
  : { bumpedGasPrice }
@@ -54,13 +54,14 @@ export function getBaseAsset(asset) {
54
54
  return isEthereumToken(asset) ? assets.ethereum : asset
55
55
  }
56
56
 
57
+ const TRANSACTION_TYPE = 2
58
+ const TRANSACTION_TYPE_BUFFER = Buffer.from(TRANSACTION_TYPE.toString(16).padStart(2, '0'), 'hex')
59
+
57
60
  export function deserialize(hex) {
58
61
  const buf = ethUtil.toBuffer(hex)
59
- try {
60
- return FeeMarketEIP1559Transaction.fromSerializedTx(buf)
61
- } catch (error) {
62
- return Transaction.fromSerializedTx(buf)
63
- }
62
+ return buf.slice(0, 1).equals(TRANSACTION_TYPE_BUFFER)
63
+ ? FeeMarketEIP1559Transaction.fromSerializedTx(buf)
64
+ : Transaction.fromSerializedTx(buf)
64
65
  }
65
66
 
66
67
  const getTxType = (serializedTx: string) => serializedTx.slice(2, 4)