@exodus/ethereum-api 8.45.0 → 8.45.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,14 @@
|
|
|
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.45.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.45.0...@exodus/ethereum-api@8.45.1) (2025-08-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/ethereum-api
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.45.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.44.0...@exodus/ethereum-api@8.45.0) (2025-08-04)
|
|
7
15
|
|
|
8
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.45.
|
|
3
|
+
"version": "8.45.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",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"type": "git",
|
|
64
64
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "ef612bef233c1c654ef543610dbd5ab76214c8fc"
|
|
67
67
|
}
|
|
@@ -8,6 +8,8 @@ import { getServerByName } from '../../exodus-eth-server/index.js'
|
|
|
8
8
|
const MIN_AMOUNT = '0.1'
|
|
9
9
|
const RETRY_DELAYS = ['10s']
|
|
10
10
|
|
|
11
|
+
const EVERSTAKE_API_URL = 'https://eth.a.exodus.io/everstake-rewards'
|
|
12
|
+
|
|
11
13
|
export class EthereumStaking {
|
|
12
14
|
static addresses = {
|
|
13
15
|
ethereum: {
|
|
@@ -139,8 +141,8 @@ export class EthereumStaking {
|
|
|
139
141
|
return this.asset.currency.baseUnit(depositedBalance)
|
|
140
142
|
}
|
|
141
143
|
|
|
142
|
-
/* Get earned Rewards */
|
|
143
144
|
async getLiquidRewards(address) {
|
|
145
|
+
// latest accrued rewards
|
|
144
146
|
const [compoundBalance, depositedBalance] = await Promise.all([
|
|
145
147
|
this.autocompoundBalanceOf(address),
|
|
146
148
|
this.depositedBalanceOf(address),
|
|
@@ -148,6 +150,29 @@ export class EthereumStaking {
|
|
|
148
150
|
return compoundBalance.sub(depositedBalance)
|
|
149
151
|
}
|
|
150
152
|
|
|
153
|
+
async getTotalRewards(address) {
|
|
154
|
+
// use external everstake API to get total rewards
|
|
155
|
+
const url = new URL(EVERSTAKE_API_URL)
|
|
156
|
+
|
|
157
|
+
const options = {
|
|
158
|
+
method: 'POST',
|
|
159
|
+
headers: { 'Content-Type': 'application/json' },
|
|
160
|
+
body: JSON.stringify({
|
|
161
|
+
address,
|
|
162
|
+
}),
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
const response = await fetch(url.toString(), options)
|
|
167
|
+
const rewards = await response.json()
|
|
168
|
+
if (rewards === 'address') return this.asset.currency.ZERO // address not found
|
|
169
|
+
return this.asset.currency.baseUnit(rewards)
|
|
170
|
+
} catch (error) {
|
|
171
|
+
console.warn('Error fetching ETH total rewards:', error)
|
|
172
|
+
return this.asset.currency.ZERO
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
151
176
|
/** Return withdrawable unstaked amount */
|
|
152
177
|
async withdrawRequest(address) {
|
|
153
178
|
let amounts = await this.#callReadFunctionContract(
|
|
@@ -517,7 +517,7 @@ export async function getEthereumStakingInfo({ address, asset, server }) {
|
|
|
517
517
|
staking.pendingBalanceOf(delegator),
|
|
518
518
|
staking.pendingDepositedBalanceOf(delegator),
|
|
519
519
|
staking.withdrawRequest(delegator),
|
|
520
|
-
staking.
|
|
520
|
+
staking.getTotalRewards(delegator),
|
|
521
521
|
])
|
|
522
522
|
|
|
523
523
|
const delegatedBalance = activeStakedBalance.add(pendingBalance).add(pendingDepositedBalance)
|