@exodus/ethereum-api 8.25.0 → 8.25.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,30 @@
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.25.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.25.1...@exodus/ethereum-api@8.25.2) (2025-01-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: add missing polygon exports (#4829)
13
+
14
+ * fix: ETH web3 assert typo (#4826)
15
+
16
+
17
+
18
+ ## [8.25.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.25.0...@exodus/ethereum-api@8.25.1) (2025-01-09)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+
24
+ * fix: ETH pending staking balance (#4816)
25
+
26
+ * fix: evm nonce calculation fallback (#4817)
27
+
28
+
29
+
6
30
  ## [8.25.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.24.4...@exodus/ethereum-api@8.25.0) (2025-01-07)
7
31
 
8
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.25.0",
3
+ "version": "8.25.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",
@@ -28,7 +28,7 @@
28
28
  "@exodus/bip44-constants": "^195.0.0",
29
29
  "@exodus/crypto": "^1.0.0-rc.13",
30
30
  "@exodus/currency": "^6.0.1",
31
- "@exodus/ethereum-lib": "^5.8.2",
31
+ "@exodus/ethereum-lib": "^5.8.3",
32
32
  "@exodus/ethereum-meta": "^2.1.5",
33
33
  "@exodus/ethereumholesky-meta": "^2.0.0",
34
34
  "@exodus/ethereumjs": "^1.0.0",
@@ -64,5 +64,5 @@
64
64
  "type": "git",
65
65
  "url": "git+https://github.com/ExodusMovement/assets.git"
66
66
  },
67
- "gitHead": "6fc73c68f6070908c9c32089e939b6b568a5b4b2"
67
+ "gitHead": "4047b725fd2d9000e809e72074a82650f69c120f"
68
68
  }
@@ -11,6 +11,12 @@ const getStaked = ({ accountState, asset }) => {
11
11
  return accountState?.staking?.[asset.name]?.delegatedBalance || asset.currency.ZERO
12
12
  }
13
13
 
14
+ const getStaking = ({ accountState, asset }) => {
15
+ return (accountState?.staking?.[asset.name]?.pendingBalance || asset.currency.ZERO).add(
16
+ accountState?.staking?.[asset.name]?.pendingDepositedBalance || asset.currency.ZERO
17
+ )
18
+ }
19
+
14
20
  const getUnstaking = ({ accountState, asset }) => {
15
21
  return accountState?.staking?.[asset.name]?.undelegatedBalance || asset.currency.ZERO
16
22
  }
@@ -77,6 +83,7 @@ export const getBalancesFactory = ({ monitorType, config = Object.create(null) }
77
83
  const unconfirmedSent = getUnconfirmedSentBalance({ asset, txLog })
78
84
 
79
85
  const staked = getStaked({ asset, accountState })
86
+ const staking = getStaking({ asset, accountState })
80
87
  const unstaking = getUnstaking({ asset, accountState })
81
88
  const unstaked = getUnstaked({ asset, accountState })
82
89
 
@@ -86,7 +93,7 @@ export const getBalancesFactory = ({ monitorType, config = Object.create(null) }
86
93
  // Balance from accountState is considered total b/c is fetched from rpc
87
94
  if (useAccountStateBalanceOnly || isRpcBalanceAsset(asset) || monitorType === 'no-history') {
88
95
  total = getBalanceFromAccountState({ asset, accountState }).sub(unconfirmedSent)
89
- spendable = total.sub(staked).sub(unstaking).sub(unstaked)
96
+ spendable = total.sub(staked).sub(staking).sub(unstaking).sub(unstaked)
90
97
  } else {
91
98
  // Balance from txLog does not include staking rewards
92
99
  // spendable and total are calculated differently based on staking txs
@@ -96,7 +103,7 @@ export const getBalancesFactory = ({ monitorType, config = Object.create(null) }
96
103
  txLog,
97
104
  unconfirmedReceived,
98
105
  })
99
- total = spendable.add(staked).add(unstaking).add(unstaked)
106
+ total = spendable.add(staked).add(staking).add(unstaking).add(unstaked)
100
107
  }
101
108
 
102
109
  return {
@@ -104,6 +111,7 @@ export const getBalancesFactory = ({ monitorType, config = Object.create(null) }
104
111
  spendable,
105
112
  total,
106
113
  staked,
114
+ staking,
107
115
  unstaking,
108
116
  unstaked,
109
117
  unconfirmedReceived,
package/src/index.js CHANGED
@@ -45,6 +45,14 @@ export {
45
45
  isEthereumUndelegatePending,
46
46
  isEthereumUndelegate,
47
47
  isEthereumClaimUndelegate,
48
+ MaticStakingApi,
49
+ createPolygonStakingService,
50
+ getPolygonStakingInfo,
51
+ isPolygonTx,
52
+ isPolygonDelegate,
53
+ isPolygonUndelegate,
54
+ isPolygonReward,
55
+ isPolygonClaimUndelegate,
48
56
  } from './staking/index.js'
49
57
 
50
58
  export { fetchTxPreview, maybeRemoveDuplicates, retrieveSideEffects } from './simulate-tx/index.js'
@@ -1,9 +1,17 @@
1
1
  import { getNonce } from '../eth-like-util.js'
2
2
 
3
- export const resolveNonce = async ({ asset, fromAddress, providedNonce, txLog, triedNonce }) => {
4
- const nonceFromNode = asset.baseAsset?.api?.features?.noHistory
5
- ? await getNonce({ asset: asset.baseAsset, address: fromAddress, tag: 'latest' }) // maybe 'pending' to unconfirmed txs
6
- : 0
3
+ export const resolveNonce = async ({
4
+ asset,
5
+ forceFromNode,
6
+ fromAddress,
7
+ providedNonce,
8
+ txLog,
9
+ triedNonce,
10
+ }) => {
11
+ const nonceFromNode =
12
+ asset.baseAsset?.api?.features?.noHistory || forceFromNode
13
+ ? await getNonce({ asset: asset.baseAsset, address: fromAddress, tag: 'latest' }) // maybe 'pending' to unconfirmed txs
14
+ : 0
7
15
 
8
16
  const nonceFromLog = [...txLog]
9
17
  .filter((tx) => tx.sent && !tx.dropped && tx.data.nonce != null)
@@ -164,6 +164,7 @@ const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
164
164
  providedNonce,
165
165
  txLog: baseAssetTxLog,
166
166
  triedNonce: nonce,
167
+ forceFromNode: true,
167
168
  })
168
169
  ;({ txId, rawTx } = await createTx({ ...createTxParams, nonce }))
169
170
 
@@ -2,7 +2,7 @@ import { createSimulateMessage as createSimulateEVMMessage } from '@exodus/web3-
2
2
  import assert from 'minimalistic-assert'
3
3
 
4
4
  export const createSimulateMessage = ({ asset }) => {
5
- assert('asset', '"asset" should be passed.')
5
+ assert(asset, '"asset" should be passed.')
6
6
 
7
7
  const simulateEVMMessage = createSimulateEVMMessage()
8
8
 
@@ -2,7 +2,7 @@ import { createSimulateTransactions as createSimulateEVMTransactions } from '@ex
2
2
  import assert from 'minimalistic-assert'
3
3
 
4
4
  export const createSimulateTransactions = ({ asset }) => {
5
- assert('asset', '"asset" should be passed.')
5
+ assert(asset, '"asset" should be passed.')
6
6
 
7
7
  const simulateEVMTransactions = createSimulateEVMTransactions({
8
8
  apiEndpoint: 'https://simulation.a.exodus.io/simulate',