@exodus/ethereum-api 8.20.1 → 8.21.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,20 @@
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.21.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.20.1...@exodus/ethereum-api@8.21.0) (2024-10-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * introduce exodus/ethereumjs ([#4339](https://github.com/ExodusMovement/assets/issues/4339)) ([e81d577](https://github.com/ExodusMovement/assets/commit/e81d5771c4956a22cfcf434a999310bbb5be81a3))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * ETH getBalances with staking info ([#4348](https://github.com/ExodusMovement/assets/issues/4348)) ([19f790c](https://github.com/ExodusMovement/assets/commit/19f790cd6e422307a8c6852d2dd8eca6a16ea95a))
17
+
18
+
19
+
6
20
  ## [8.20.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.20.0...@exodus/ethereum-api@8.20.1) (2024-10-25)
7
21
 
8
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.20.1",
3
+ "version": "8.21.0",
4
4
  "description": "Ethereum Api",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -31,7 +31,7 @@
31
31
  "@exodus/ethereum-lib": "^5.4.0",
32
32
  "@exodus/ethereum-meta": "^2.0.0",
33
33
  "@exodus/ethereumholesky-meta": "^2.0.0",
34
- "@exodus/ethereumjs-util": "^7.1.0-exodus.7",
34
+ "@exodus/ethereumjs": "^1.0.0",
35
35
  "@exodus/fetch": "^1.3.0",
36
36
  "@exodus/models": "^12.0.1",
37
37
  "@exodus/simple-retry": "^0.0.6",
@@ -64,5 +64,5 @@
64
64
  "type": "git",
65
65
  "url": "git+https://github.com/ExodusMovement/assets.git"
66
66
  },
67
- "gitHead": "b170fd8817e953f92d4fe38e1686d9e7bdbd92ea"
67
+ "gitHead": "348e70ac005cfaf08b3336e86a8cbcd845f5170c"
68
68
  }
@@ -1,4 +1,4 @@
1
- import { bufferToHex } from '@exodus/ethereumjs-util'
1
+ import { bufferToHex } from '@exodus/ethereumjs/util'
2
2
  import SolidityContract from '@exodus/solidity-contract'
3
3
  import EventEmitter from 'events'
4
4
  import lodash from 'lodash'
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from '@exodus/crypto/randomUUID'
2
- import { bufferToHex } from '@exodus/ethereumjs-util'
2
+ import { bufferToHex } from '@exodus/ethereumjs/util'
3
3
  import fetchival from '@exodus/fetch/experimental/fetchival'
4
4
  import { retry } from '@exodus/simple-retry'
5
5
  import SolidityContract from '@exodus/solidity-contract'
@@ -1,4 +1,4 @@
1
- import { bufferToHex } from '@exodus/ethereumjs-util'
1
+ import { bufferToHex } from '@exodus/ethereumjs/util'
2
2
  import SolidityContract from '@exodus/solidity-contract'
3
3
  import EventEmitter from 'events'
4
4
  import io from 'socket.io-client'
@@ -1,5 +1,5 @@
1
1
  import { currency2buffer, isEthereumLikeToken } from '@exodus/ethereum-lib'
2
- import { bufferToHex, toBuffer } from '@exodus/ethereumjs-util'
2
+ import { bufferToHex, toBuffer } from '@exodus/ethereumjs/util'
3
3
  import BN from 'bn.js'
4
4
 
5
5
  import { estimateGas, isContractAddressCached } from './eth-like-util.js'
@@ -35,11 +35,20 @@ export const getStakingHistoryBalance = ({ asset, txLog }) => {
35
35
  let stakingHistoryBalance = asset.currency.ZERO
36
36
  for (const tx of txLog) {
37
37
  const successfulTx = tx.confirmations && !tx.failed
38
- if (successfulTx && tx.data?.txAmount) {
38
+ const txData = tx.data
39
+
40
+ // staking tx must has data value
41
+ if (!txData) continue
42
+
43
+ let { txAmount } = txData
44
+ if (successfulTx && (txAmount || txData.delegate)) {
39
45
  // only staking txs have tx.data.txAmount set
40
- // tx.data.txAmount is negative for stake tx type
41
- const txAmount = asset.currency.defaultUnit(tx.data.txAmount)
42
- stakingHistoryBalance = stakingHistoryBalance.add(txAmount)
46
+
47
+ if (txData.delegate && !txAmount) {
48
+ txAmount = txData.delegate // fix missing txAmount in stakeTx
49
+ }
50
+
51
+ stakingHistoryBalance = stakingHistoryBalance.add(asset.currency.defaultUnit(txAmount))
43
52
  }
44
53
  }
45
54
 
@@ -1,5 +1,5 @@
1
1
  import { createContract, createEthereumJsTx } from '@exodus/ethereum-lib'
2
- import { bufferToHex } from '@exodus/ethereumjs-util'
2
+ import { bufferToHex } from '@exodus/ethereumjs/util'
3
3
  import assert from 'minimalistic-assert'
4
4
 
5
5
  import { fromHexToBigInt } from '../number-utils.js'
@@ -1,5 +1,5 @@
1
1
  import { createContract } from '@exodus/ethereum-lib'
2
- import { bufferToHex } from '@exodus/ethereumjs-util'
2
+ import { bufferToHex } from '@exodus/ethereumjs/util'
3
3
  import { retry } from '@exodus/simple-retry'
4
4
 
5
5
  import { getServerByName } from '../../exodus-eth-server/index.js'
@@ -1,6 +1,6 @@
1
1
  import { createContract } from '@exodus/ethereum-lib'
2
2
  import ethAssets from '@exodus/ethereum-meta'
3
- import { bufferToHex } from '@exodus/ethereumjs-util'
3
+ import { bufferToHex } from '@exodus/ethereumjs/util'
4
4
  import { retry } from '@exodus/simple-retry'
5
5
  import BN from 'bn.js'
6
6