@exodus/ethereum-api 8.13.3 → 8.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,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.14.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.13.3...@exodus/ethereum-api@8.14.0) (2024-08-26)
7
+
8
+
9
+ ### Features
10
+
11
+ * allow custom gasPriceEconomicalRate ([#3236](https://github.com/ExodusMovement/assets/issues/3236)) ([acdf78e](https://github.com/ExodusMovement/assets/commit/acdf78e20c9f93da2cafa0045f24e5ad4f2e0a5d))
12
+ * forceGasLimitEstimation asset plugin param ([#3237](https://github.com/ExodusMovement/assets/issues/3237)) ([7da77dd](https://github.com/ExodusMovement/assets/commit/7da77dd8f09bddc752dc113b5ef875bf1ff5263c))
13
+
14
+
15
+
6
16
  ## [8.13.3](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.13.2...@exodus/ethereum-api@8.13.3) (2024-08-13)
7
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.13.3",
3
+ "version": "8.14.0",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@exodus/asset": "^1.2.0",
24
24
  "@exodus/asset-lib": "^4.2.2",
25
- "@exodus/assets": "^9.1.1",
25
+ "@exodus/assets": "^11.0.0",
26
26
  "@exodus/basic-utils": "^2.1.0",
27
27
  "@exodus/bip44-constants": "^195.0.0",
28
28
  "@exodus/crypto": "^1.0.0-rc.0",
@@ -65,5 +65,5 @@
65
65
  "type": "git",
66
66
  "url": "git+https://github.com/ExodusMovement/assets.git"
67
67
  },
68
- "gitHead": "71031eb3482dd28419a5b53df1ba83c45011095f"
68
+ "gitHead": "12dda1cbba91cbfeaeb0811570baa671b8557c2c"
69
69
  }
@@ -158,6 +158,7 @@ export const fromAddEthereumChainParameterToFactoryParams = (params) => {
158
158
  confirmationsNumber: 5,
159
159
  monitorType: 'no-history',
160
160
  isTestnet: params.isTestnet,
161
+ ...params.plugin, // extra plugin configuration
161
162
  },
162
163
  baseFeePerGas: params.baseFeePerGas,
163
164
  gasPrice: params.gasPrice,
@@ -57,6 +57,7 @@ export const createAssetFactory = ({
57
57
  serverUrl,
58
58
  stakingConfiguration = {},
59
59
  useEip1191ChainIdChecksum = false,
60
+ forceGasLimitEstimation = false,
60
61
  }) => {
61
62
  assert(assetsList, 'assetsList is required')
62
63
  assert(feeData, 'feeData is required')
@@ -269,6 +270,7 @@ export const createAssetFactory = ({
269
270
  chainId,
270
271
  monitorType,
271
272
  estimateL1DataFee,
273
+ forceGasLimitEstimation,
272
274
  server,
273
275
  ...(erc20FuelBuffer && { erc20FuelBuffer }),
274
276
  ...(fuelThreshold && { fuelThreshold: asset.currency.defaultUnit(fuelThreshold) }),
@@ -1,9 +1,9 @@
1
1
  import {
2
- // eslint-disable-next-line import/no-deprecated
2
+ // eslint-disable-next-line @exodus/import/no-deprecated
3
3
  DEFAULT_SERVER_URLS,
4
- // eslint-disable-next-line import/no-deprecated
4
+ // eslint-disable-next-line @exodus/import/no-deprecated
5
5
  ETHEREUM_LIKE_ASSETS,
6
- // eslint-disable-next-line import/no-deprecated
6
+ // eslint-disable-next-line @exodus/import/no-deprecated
7
7
  ETHEREUM_LIKE_MONITOR_TYPES,
8
8
  } from '@exodus/ethereum-lib'
9
9
  import assert from 'minimalistic-assert'
@@ -30,11 +30,11 @@ export function createEvmServer({ assetName, serverUrl, monitorType }) {
30
30
 
31
31
  // @Deprecated
32
32
  const serverMap = Object.fromEntries(
33
- // eslint-disable-next-line import/no-deprecated
33
+ // eslint-disable-next-line @exodus/import/no-deprecated
34
34
  ETHEREUM_LIKE_ASSETS.map((assetName) => {
35
- // eslint-disable-next-line import/no-deprecated
35
+ // eslint-disable-next-line @exodus/import/no-deprecated
36
36
  const monitorType = ETHEREUM_LIKE_MONITOR_TYPES[assetName]
37
- // eslint-disable-next-line import/no-deprecated
37
+ // eslint-disable-next-line @exodus/import/no-deprecated
38
38
  const serverUrl = DEFAULT_SERVER_URLS[assetName]
39
39
  return [assetName, createEvmServer({ assetName, serverUrl, monitorType })]
40
40
  })
@@ -74,8 +74,9 @@ export async function fetchGasLimit({
74
74
  toAddress = asset.contract.address
75
75
  } else if (
76
76
  !isContract &&
77
- // hacky, convert this to a fetchGasLimit forceGasLimitEstimation plugin flag!
77
+ !asset.forceGasLimitEstimation &&
78
78
  ![
79
+ // back compatiblity until all plugins are updated. Then remove this array
79
80
  'ethereumarbone',
80
81
  'ethereumarbonesepolia',
81
82
  'ethereumarbnova',
package/src/get-fee.js CHANGED
@@ -7,16 +7,19 @@ const taxes = {
7
7
 
8
8
  const getGasPriceMultiplier = ({ asset, feeData, isExchange, isSendAll, isRbfAllowed }) => {
9
9
  // exchanges quotes expire, do not risk having a stuck tx
10
- if (isExchange) return 1
10
+
11
+ const gasPriceMultiplier = feeData.gasPriceMultiplier || 1
12
+
13
+ if (isExchange) return gasPriceMultiplier
11
14
 
12
15
  // if eip1559 enabled, do not risk not leaving enough ETH to cover base fee (applies only for native asset)
13
16
  // (gasPrice difference will be reimbursed anyway: users do not overpay)
14
- if (isSendAll && isEthereumLike(asset) && feeData.eip1559Enabled) return 1
17
+ if (isSendAll && isEthereumLike(asset) && feeData.eip1559Enabled) return gasPriceMultiplier
15
18
 
16
19
  // do not risk having a stuck tx if we're not able to accelerate it
17
- if (!isRbfAllowed || !feeData.rbfEnabled) return 1
20
+ if (!isRbfAllowed || !feeData.rbfEnabled) return gasPriceMultiplier
18
21
 
19
- return feeData.gasPriceEconomicalRate
22
+ return feeData.gasPriceEconomicalRate || gasPriceMultiplier
20
23
  }
21
24
 
22
25
  const getExtraFeeData = ({ asset, amount }) => {
@@ -96,7 +96,7 @@ export class MaticStakingApi {
96
96
  /**
97
97
  * UnbondNonce is a counter stored in the contract that tracks each time a delegator unstakes
98
98
  * @param address delegator address
99
- * @return current unbonded nonce
99
+ * @returns current unbonded nonce
100
100
  */
101
101
  getCurrentUnbondNonce = async (address) => {
102
102
  const unbondNonce = await this.callReadFunctionContract(