@exodus/ethereum-api 8.29.0 → 8.29.2

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,28 @@
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.29.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.29.1...@exodus/ethereum-api@8.29.2) (2025-02-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: security hardening (#5035)
13
+
14
+
15
+
16
+ ## [8.29.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.29.0...@exodus/ethereum-api@8.29.1) (2025-02-10)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+
22
+ * fix: clarity baseGasPrice ws field (#5029)
23
+
24
+ * fix: magnifier returns 0 as base fee in WS (#5030)
25
+
26
+
27
+
6
28
  ## [8.29.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.28.1...@exodus/ethereum-api@8.29.0) (2025-02-06)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.29.0",
3
+ "version": "8.29.2",
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": "45145f8d82dcee20192872aae962f9c1e1bfc487"
67
+ "gitHead": "d9dacbc9ccadf109a2a2b10e97c35c46759e803e"
68
68
  }
@@ -119,7 +119,7 @@ export const getIsForwarderContract = memoizeLruCache(
119
119
  const ERC20 = new SolidityContract(ABI.erc20)
120
120
  const ERC20BytesParams = new SolidityContract(ABI.erc20BytesParams)
121
121
  const DEFAULT_PARAM_NAMES = ['decimals', 'name', 'symbol']
122
- const erc20ParamsCache = {}
122
+ const erc20ParamsCache = Object.create(null)
123
123
 
124
124
  export const getERC20Params = async ({ asset, address, paramNames = DEFAULT_PARAM_NAMES } = {}) => {
125
125
  assert(asset, 'getERC20Params(): asset required')
@@ -176,7 +176,7 @@ export class ClarityMonitor extends BaseMonitor {
176
176
 
177
177
  async getNewAccountState({ tokens, currentTokenBalances, ourWalletAddress }) {
178
178
  const asset = this.asset
179
- const newAccountState = {}
179
+ const newAccountState = Object.create(null)
180
180
  const balances = await this.getBalances({ tokens, ourWalletAddress })
181
181
  if (isRpcBalanceAsset(asset)) {
182
182
  const balance = balances[asset.name]
@@ -199,7 +199,7 @@ export class ClarityMonitor extends BaseMonitor {
199
199
 
200
200
  async getReceiveAddressesByWalletAccount() {
201
201
  const walletAccounts = await this.aci.getWalletAccounts({ assetName: this.asset.name })
202
- const addressesByAccount = {}
202
+ const addressesByAccount = Object.create(null)
203
203
  for (const walletAccount of walletAccounts) {
204
204
  addressesByAccount[walletAccount] = await this.aci.getReceiveAddresses({
205
205
  assetName: this.asset.name,
@@ -220,7 +220,7 @@ export class ClarityMonitor extends BaseMonitor {
220
220
  }
221
221
 
222
222
  async getBalances({ tokens, ourWalletAddress }) {
223
- const batch = {}
223
+ const batch = Object.create(null)
224
224
  if (isRpcBalanceAsset(this.asset)) {
225
225
  const request = this.server.getBalanceRequest(ourWalletAddress)
226
226
  batch[this.asset.name] = request
@@ -263,7 +263,7 @@ export class ClarityMonitor extends BaseMonitor {
263
263
  return [...set]
264
264
  }
265
265
 
266
- async updateGasPrice({ gasPrice, baseFeePerGas }) {
266
+ async updateGasPrice({ gasPrice, baseGasPrice: baseFeePerGas }) {
267
267
  try {
268
268
  const feeData = await this.aci.getFeeConfig({ assetName: this.asset.name })
269
269
  const feeConfig = resolveGasPrices({
@@ -202,11 +202,25 @@ export class EthereumMonitor extends BaseMonitor {
202
202
  async updateGasPrice({ gasPrice, baseFeePerGas }) {
203
203
  try {
204
204
  const feeData = await this.aci.getFeeConfig({ assetName: this.asset.name })
205
+
206
+ const resolveBaseFeePerGas = () => {
207
+ if (!feeData.eip1559Enabled) {
208
+ return
209
+ }
210
+
211
+ if (baseFeePerGas === 0) {
212
+ // In some cases, web socker sends 0 baseFeePerGas!!
213
+ return this.server.getBaseFeePerGas().then((wei) => `${wei} wei`)
214
+ }
215
+
216
+ return `${fromHexToString(baseFeePerGas)} wei`
217
+ }
218
+
205
219
  const feeConfig = resolveGasPrices({
206
220
  asset: this.asset,
207
221
  feeData,
208
222
  gasPrice: `${fromHexToString(gasPrice)} wei`,
209
- baseFeePerGas: baseFeePerGas ? `${fromHexToString(baseFeePerGas)} wei` : undefined,
223
+ baseFeePerGas: await resolveBaseFeePerGas(),
210
224
  })
211
225
  await this.aci.updateFeeConfig({ assetName: this.asset.name, feeConfig })
212
226
  } catch (e) {
@@ -216,7 +230,7 @@ export class EthereumMonitor extends BaseMonitor {
216
230
 
217
231
  async getNewAccountState({ tokens, currentTokenBalances, ourWalletAddress }) {
218
232
  const asset = this.asset
219
- const newAccountState = {}
233
+ const newAccountState = Object.create(null)
220
234
  const server = this.server
221
235
  if (isRpcBalanceAsset(asset)) {
222
236
  const result = await server.getBalanceProxied(ourWalletAddress)
@@ -241,7 +255,7 @@ export class EthereumMonitor extends BaseMonitor {
241
255
 
242
256
  async getReceiveAddressesByWalletAccount() {
243
257
  const walletAccounts = await this.aci.getWalletAccounts({ assetName: this.asset.name })
244
- const addressesByAccount = {}
258
+ const addressesByAccount = Object.create(null)
245
259
  for (const walletAccount of walletAccounts) {
246
260
  addressesByAccount[walletAccount] = await this.aci.getReceiveAddresses({
247
261
  assetName: this.asset.name,
@@ -63,7 +63,7 @@ export class EthereumNoHistoryMonitor extends BaseMonitor {
63
63
 
64
64
  async getNewAccountState({ tokens, currentTokenBalances, ourWalletAddress }) {
65
65
  const asset = this.asset
66
- const newAccountState = {}
66
+ const newAccountState = Object.create(null)
67
67
  const balances = await this.getBalances({ tokens, ourWalletAddress })
68
68
  const balance = balances[asset.name]
69
69
  newAccountState.balance = asset.currency.baseUnit(balance)
@@ -8,5 +8,5 @@ export function excludeUnchangedTokenBalances(currentTokenBalances, newTokenBala
8
8
  }
9
9
 
10
10
  return tokenBalancesAcc
11
- }, {})
11
+ }, Object.create(null))
12
12
  }