@exodus/ethereum-api 8.27.0 → 8.28.1

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.28.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.28.0...@exodus/ethereum-api@8.28.1) (2025-02-03)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: add ETH stakeable property (#4917)
13
+
14
+ * fix: add optional chaining to tx references (#4948)
15
+
16
+ * fix: ETH activity txs field (#4915)
17
+
18
+
19
+
20
+ ## [8.28.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.27.0...@exodus/ethereum-api@8.28.0) (2025-01-23)
21
+
22
+
23
+ ### Features
24
+
25
+
26
+ * feat(eth-like,btc-like): make broadcastTx compatible with rawTx (#4911)
27
+
28
+
29
+
6
30
  ## [8.27.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.26.1...@exodus/ethereum-api@8.27.0) (2025-01-22)
7
31
 
8
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.27.0",
3
+ "version": "8.28.1",
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": "92c1dbc059594e5a127d9052012a4422fc0f1a12"
67
+ "gitHead": "7f03ce2fb4a9fe95064a14b6b9be8fdceb4dcda6"
68
68
  }
@@ -4,7 +4,8 @@ const isValidResponseCheck = (x) => x.result !== undefined
4
4
  const _request = async (...args) => request(isValidResponseCheck, 'proxy', ...args)
5
5
 
6
6
  export async function sendRawTransaction(data) {
7
- const txhash = await _request('eth_sendRawTransaction', { hex: '0x' + data })
7
+ const _data = data instanceof Uint8Array ? Buffer.from(data).toString('hex') : data
8
+ const txhash = await _request('eth_sendRawTransaction', { hex: '0x' + _data })
8
9
 
9
10
  const isValidTxHash = /^0x[\dA-Fa-f]{64}$/.test(txhash)
10
11
  if (!isValidTxHash) throw new Error(`Invalid tx hash: ${txhash}`)
@@ -91,7 +91,8 @@ export default class ApiCoinNodesServer extends EventEmitter {
91
91
  }
92
92
 
93
93
  sendRawTransactionRequest(data) {
94
- const hex = data.startsWith('0x') ? data : '0x' + data
94
+ const _data = data instanceof Uint8Array ? Buffer.from(data).toString('hex') : data
95
+ const hex = _data.startsWith('0x') ? _data : '0x' + _data
95
96
  return this.buildRequest({ method: 'eth_sendRawTransaction', params: [hex] })
96
97
  }
97
98
 
@@ -162,7 +162,8 @@ export function create(defaultURL, ensAssetName) {
162
162
  },
163
163
 
164
164
  async sendRawTransaction(data) {
165
- const hex = data.startsWith('0x') ? data : '0x' + data
165
+ const _data = data instanceof Uint8Array ? Buffer.from(data).toString('hex') : data
166
+ const hex = _data.startsWith('0x') ? _data : '0x' + _data
166
167
  return requestWithRetry(
167
168
  'proxy',
168
169
  { method: 'eth_sendRawTransaction', params: [hex] },
@@ -224,7 +224,8 @@ export default class ClarityServer extends EventEmitter {
224
224
  }
225
225
 
226
226
  sendRawTransactionRequest(data) {
227
- const hex = data.startsWith('0x') ? data : '0x' + data
227
+ const _data = data instanceof Uint8Array ? Buffer.from(data).toString('hex') : data
228
+ const hex = _data.startsWith('0x') ? _data : '0x' + _data
228
229
  return this.buildRequest({ method: 'eth_sendRawTransaction', params: [hex] })
229
230
  }
230
231
 
@@ -110,10 +110,13 @@ export const getBalancesFactory = ({ monitorType, config = Object.create(null) }
110
110
  total = spendable.add(staked).add(staking).add(unstaking).add(unstaked)
111
111
  }
112
112
 
113
+ const stakeable = spendable
114
+
113
115
  return {
114
116
  // new
115
117
  spendable,
116
118
  total,
119
+ stakeable,
117
120
  staked,
118
121
  staking,
119
122
  unstaking,
@@ -15,10 +15,10 @@ export const isPolygonTx = ({ coinName }) => coinName === 'polygon'
15
15
  export const isPolygonDelegate = (tx) =>
16
16
  isPolygonTx(tx) && tx.to === STAKING_MANAGER_CONTRACT && tx.data?.methodId === DELEGATE
17
17
  export const isPolygonUndelegate = (tx) =>
18
- isPolygonTx(tx) && tx.from[0] === STAKING_MANAGER_CONTRACT && tx.data?.methodId === UNDELEGATE
18
+ isPolygonTx(tx) && tx.from?.[0] === STAKING_MANAGER_CONTRACT && tx.data?.methodId === UNDELEGATE
19
19
  export const isPolygonReward = (tx) =>
20
- isPolygonTx(tx) && tx.from[0] === STAKING_MANAGER_CONTRACT && tx.data?.methodId === CLAIM_REWARD
20
+ isPolygonTx(tx) && tx.from?.[0] === STAKING_MANAGER_CONTRACT && tx.data?.methodId === CLAIM_REWARD
21
21
  export const isPolygonClaimUndelegate = (tx) =>
22
22
  isPolygonTx(tx) &&
23
- tx.from[0] === STAKING_MANAGER_CONTRACT &&
23
+ tx.from?.[0] === STAKING_MANAGER_CONTRACT &&
24
24
  tx.data?.methodId === CLAIM_UNDELEGATE_BALANCE
@@ -21,16 +21,16 @@ export const decodePolygonStakingTxInputAmount = (tx) => {
21
21
 
22
22
  export const calculateRewardsFromStakeTx = ({ tx, currency }) => {
23
23
  const stakedAmount = currency.baseUnit(decodePolygonStakingTxInputAmount(tx))
24
- const { reward } = tx.data
24
+ const { rewards } = tx.data
25
25
  // stake tx might have rewards in it,
26
26
  // i.e: https://etherscan.io/tx/0x0a81d266109034a3a70c6f1b9601c105d8caebbd0de652a0619344f9559ae4fa
27
27
  // thus reward = txInputAmount(amount to stake) - tx.coinAmount
28
28
  // tx.coinAmount is already computed from monitor; incoming - outgoing ERC20 token txs
29
29
  const stakeTxContainsReward = !stakedAmount.equals(tx.coinAmount.abs())
30
30
 
31
- if (reward) {
31
+ if (rewards) {
32
32
  // cache rewards
33
- return currency.baseUnit(reward)
33
+ return currency.baseUnit(rewards)
34
34
  }
35
35
 
36
36
  if (stakeTxContainsReward) {