@exodus/ethereum-api 8.22.3 → 8.22.4

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,16 @@
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
+ ## [8.22.4](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.22.3...@exodus/ethereum-api@8.22.4) (2024-12-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: use multipled gasPrice when sending (#4628)
13
+
14
+
15
+
6
16
  ## [8.22.3](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.22.2...@exodus/ethereum-api@8.22.3) (2024-12-09)
7
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.22.3",
3
+ "version": "8.22.4",
4
4
  "description": "Transaction monitors, fee monitors, RPC with the blockchain node, and other networking code for Ethereum and EVM-based blockchains",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -64,5 +64,5 @@
64
64
  "type": "git",
65
65
  "url": "git+https://github.com/ExodusMovement/assets.git"
66
66
  },
67
- "gitHead": "baff21e8431ee823250984b91dd5c3f4bb51ba32"
67
+ "gitHead": "9271a07964a668a9903bd4268b893c83ca1118f9"
68
68
  }
@@ -104,6 +104,18 @@ const getFeeAsyncFactory = ({
104
104
 
105
105
  const feeData = await assetClientInterface.getFeeConfig({ assetName: asset.baseAsset.name })
106
106
 
107
+ const { fee, gasPrice, ...rest } = getFee({
108
+ asset,
109
+ feeData,
110
+ gasLimit,
111
+ isExchange,
112
+ isSendAll,
113
+ amount,
114
+ isRbfAllowed,
115
+ calculateEffectiveFee,
116
+ customFee,
117
+ })
118
+
107
119
  const optimismL1DataFee = asset.baseAsset.estimateL1DataFee
108
120
  ? await asset.baseAsset.estimateL1DataFee({
109
121
  unsignedTx: createUnsignedTx({
@@ -113,24 +125,12 @@ const getFeeAsyncFactory = ({
113
125
  amount,
114
126
  nonce: 0,
115
127
  txInput,
116
- gasPrice: feeData.gasPrice,
128
+ gasPrice,
117
129
  gasLimit,
118
130
  }),
119
131
  })
120
132
  : undefined
121
133
 
122
- const { fee, ...rest } = getFee({
123
- asset,
124
- feeData,
125
- gasLimit,
126
- isExchange,
127
- isSendAll,
128
- amount,
129
- isRbfAllowed,
130
- calculateEffectiveFee, // BE
131
- customFee, // BE
132
- })
133
-
134
134
  const l1DataFee = optimismL1DataFee
135
135
  ? asset.baseAsset.currency.baseUnit(optimismL1DataFee)
136
136
  : asset.baseAsset.currency.ZERO
@@ -138,6 +138,7 @@ const getFeeAsyncFactory = ({
138
138
  fee: fee.add(l1DataFee),
139
139
  optimismL1DataFee,
140
140
  gasLimit,
141
+ gasPrice,
141
142
  ...rest,
142
143
  }
143
144
  }
package/src/get-fee.js CHANGED
@@ -49,7 +49,8 @@ export const getFeeFactory =
49
49
  isRbfAllowed = true, // Destkop, isRbfAllowed=true when advanced panel is on
50
50
  calculateEffectiveFee,
51
51
  }) => {
52
- const { gasPrice, eip1559Enabled, baseFeePerGas, tipGasPrice } = feeData
52
+ const { gasPrice: feeDataGasPrice, eip1559Enabled, baseFeePerGas, tipGasPrice } = feeData
53
+
53
54
  const gasPriceMultiplier = getGasPriceMultiplier({
54
55
  asset,
55
56
  isRbfAllowed,
@@ -58,20 +59,22 @@ export const getFeeFactory =
58
59
  isSendAll,
59
60
  })
60
61
 
62
+ const gasPrice = customFee || feeDataGasPrice.mul(gasPriceMultiplier)
63
+
61
64
  const gasLimit = providedGasLimit || asset.gasLimit || defaultGasLimit
62
65
 
63
66
  const extraFeeData = getExtraFeeData({ asset, amount })
64
67
  if (calculateEffectiveFee && eip1559Enabled) {
65
- const maxFeePerGas = customFee || gasPrice
68
+ const maxFeePerGas = gasPrice
66
69
  // effective_gas_price = min(base_fee_per_gas + tip_gas_price, max_fee_per_gas)
67
70
  const feePerGas = baseFeePerGas.add(tipGasPrice)
68
71
  const effectiveGasPrice = feePerGas.lt(maxFeePerGas) ? feePerGas : maxFeePerGas
69
72
 
70
- return { fee: effectiveGasPrice.mul(gasLimit), extraFeeData }
73
+ return { fee: effectiveGasPrice.mul(gasLimit), gasPrice, extraFeeData }
71
74
  }
72
75
 
73
- const fee = (customFee || gasPrice.mul(gasPriceMultiplier)).mul(gasLimit)
74
- return { fee, extraFeeData }
76
+ const fee = gasPrice.mul(gasLimit)
77
+ return { fee, gasPrice, extraFeeData }
75
78
  }
76
79
 
77
80
  // Used in BE
@@ -6,15 +6,10 @@ const getFeeInfo = async function getFeeInfo({
6
6
  fromAddress,
7
7
  toAddress,
8
8
  amount,
9
- isExchange,
10
9
  txInput,
11
10
  feeOpts = {},
12
11
  }) {
13
- const {
14
- gasPrice: gasPrice_,
15
- tipGasPrice: tipGasPrice_,
16
- gasPriceEconomicalRate,
17
- } = await assetClientInterface.getFeeData({
12
+ const { gasPrice: gasPrice_, tipGasPrice: tipGasPrice_ } = await assetClientInterface.getFeeData({
18
13
  assetName: asset.name,
19
14
  })
20
15
 
@@ -31,10 +26,7 @@ const getFeeInfo = async function getFeeInfo({
31
26
  })
32
27
  }
33
28
 
34
- const economicalFeeMultiplier = isExchange ? 1 : gasPriceEconomicalRate || 1
35
-
36
- const fee = gasPrice.mul(economicalFeeMultiplier).mul(gasLimit)
37
- return { gasPrice, gasLimit, fee, tipGasPrice }
29
+ return { gasPrice, gasLimit, tipGasPrice }
38
30
  }
39
31
 
40
32
  export default getFeeInfo
@@ -13,15 +13,7 @@ const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
13
13
  assert(assetClientInterface, 'assetClientInterface is required')
14
14
  assert(createUnsignedTx, 'createUnsignedTx is required')
15
15
  return async ({ asset, walletAccount, address, amount, options = {} }) => {
16
- const {
17
- nft,
18
- isExchange,
19
- bumpTxId,
20
- nonce: providedNonce,
21
- customFee,
22
- keepTxInput,
23
- isSendAll,
24
- } = options
16
+ const { nft, bumpTxId, nonce: providedNonce, customFee, keepTxInput, isSendAll } = options
25
17
  let { txInput, feeAmount } = options // avoid let!
26
18
 
27
19
  const feeOpts = {
@@ -127,7 +119,6 @@ const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
127
119
  txInput,
128
120
  keepTxInput,
129
121
  isSendAll,
130
- isExchange,
131
122
  createUnsignedTx,
132
123
  }
133
124
  let { txId, rawTx, nonce, gasLimit, tipGasPrice } = await createTx(createTxParams)
@@ -275,7 +266,6 @@ const createTx = async ({
275
266
  keepTxInput = false,
276
267
  customFee: customGasPrice,
277
268
  isSendAll,
278
- isExchange,
279
269
  fromAddress,
280
270
  feeOpts,
281
271
  createUnsignedTx,
@@ -300,7 +290,6 @@ const createTx = async ({
300
290
  fromAddress,
301
291
  toAddress,
302
292
  amount,
303
- isExchange,
304
293
  txInput,
305
294
  feeOpts,
306
295
  })