Add version to the response of beacon API client side (#8326)

Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io>
This commit is contained in:
chonghe
2025-10-31 00:47:27 +08:00
committed by GitHub
parent 30094f0c08
commit af9cae4d3e
2 changed files with 34 additions and 13 deletions

View File

@@ -827,7 +827,8 @@ impl BeaconNodeHttpClient {
pub async fn get_beacon_states_pending_deposits(
&self,
state_id: StateId,
) -> Result<Option<ExecutionOptimisticFinalizedResponse<Vec<PendingDeposit>>>, Error> {
) -> Result<Option<ExecutionOptimisticFinalizedBeaconResponse<Vec<PendingDeposit>>>, Error>
{
let mut path = self.eth_path(V1)?;
path.path_segments_mut()
@@ -837,7 +838,9 @@ impl BeaconNodeHttpClient {
.push(&state_id.to_string())
.push("pending_deposits");
self.get_opt(path).await
self.get_fork_contextual(path, |fork| fork)
.await
.map(|opt| opt.map(BeaconResponse::ForkVersioned))
}
/// `GET beacon/states/{state_id}/pending_partial_withdrawals`
@@ -846,8 +849,10 @@ impl BeaconNodeHttpClient {
pub async fn get_beacon_states_pending_partial_withdrawals(
&self,
state_id: StateId,
) -> Result<Option<ExecutionOptimisticFinalizedResponse<Vec<PendingPartialWithdrawal>>>, Error>
{
) -> Result<
Option<ExecutionOptimisticFinalizedBeaconResponse<Vec<PendingPartialWithdrawal>>>,
Error,
> {
let mut path = self.eth_path(V1)?;
path.path_segments_mut()
@@ -857,7 +862,9 @@ impl BeaconNodeHttpClient {
.push(&state_id.to_string())
.push("pending_partial_withdrawals");
self.get_opt(path).await
self.get_fork_contextual(path, |fork| fork)
.await
.map(|opt| opt.map(BeaconResponse::ForkVersioned))
}
/// `GET beacon/states/{state_id}/pending_consolidations`