@exodus/ethereum-api 8.22.2 → 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,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
+ ## [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
+
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)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+
22
+ * fix: send evm compatibility (#4661)
23
+
24
+
25
+
6
26
  ## [8.22.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.22.1...@exodus/ethereum-api@8.22.2) (2024-12-04)
7
27
 
8
28
  **Note:** Version bump only for package @exodus/ethereum-api
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.22.2",
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": "94b6b798534f6b0587f6940248ab612513bfc34f"
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
@@ -12,26 +12,19 @@ import { resolveNonce } from './nonce-utils.js'
12
12
  const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
13
13
  assert(assetClientInterface, 'assetClientInterface is required')
14
14
  assert(createUnsignedTx, 'createUnsignedTx is required')
15
- return async ({
16
- nft,
17
- asset,
18
- walletAccount,
19
- amount,
20
- address,
21
- feeAmount,
22
- shouldLog = true,
23
- keepTxInput,
24
- txInput,
25
- nonce: providedNonce,
26
- bumpTxId,
27
- customFee,
28
- isSendAll,
29
- isExchange,
30
- feeOpts: feeOpts_ = {},
31
- }) => {
15
+ return async ({ asset, walletAccount, address, amount, options = {} }) => {
16
+ const { nft, bumpTxId, nonce: providedNonce, customFee, keepTxInput, isSendAll } = options
17
+ let { txInput, feeAmount } = options // avoid let!
18
+
19
+ const feeOpts = {
20
+ gasPrice: options.gasPrice,
21
+ tipGasPrice: options.tipGasPrice,
22
+ gasLimit: options.gasLimit,
23
+ }
24
+
32
25
  const assetName = asset.name
33
26
  const baseAsset = asset.baseAsset
34
- const feeOpts = { ...feeOpts_ }
27
+
35
28
  const assets = await assetClientInterface.getAssetsForNetwork({ baseAssetName: baseAsset.name })
36
29
 
37
30
  // Using a default zero value to not break code relying on the `tx.feeAmount` property.
@@ -126,7 +119,6 @@ const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
126
119
  txInput,
127
120
  keepTxInput,
128
121
  isSendAll,
129
- isExchange,
130
122
  createUnsignedTx,
131
123
  }
132
124
  let { txId, rawTx, nonce, gasLimit, tipGasPrice } = await createTx(createTxParams)
@@ -274,7 +266,6 @@ const createTx = async ({
274
266
  keepTxInput = false,
275
267
  customFee: customGasPrice,
276
268
  isSendAll,
277
- isExchange,
278
269
  fromAddress,
279
270
  feeOpts,
280
271
  createUnsignedTx,
@@ -299,7 +290,6 @@ const createTx = async ({
299
290
  fromAddress,
300
291
  toAddress,
301
292
  amount,
302
- isExchange,
303
293
  txInput,
304
294
  feeOpts,
305
295
  })