forest-filecoin 0.36.0

Rust Filecoin implementation.
Documentation
// Copyright 2019-2026 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use crate::rpc::{ApiPaths, Ctx, Permission, RpcMethod, ServerError};
use crate::{beacon::BeaconEntry, shim::clock::ChainEpoch};
use anyhow::Result;
use enumflags2::{BitFlags, make_bitflags};

/// `BeaconGetEntry` returns the beacon entry for the given Filecoin epoch. If
/// the entry has not yet been produced, the call will block until the entry
/// becomes available
pub enum BeaconGetEntry {}
impl RpcMethod<1> for BeaconGetEntry {
    const NAME: &'static str = "Filecoin.BeaconGetEntry";
    const PARAM_NAMES: [&'static str; 1] = ["first"];
    const API_PATHS: BitFlags<ApiPaths> = make_bitflags!(ApiPaths::V0); // Not supported in V1
    const PERMISSION: Permission = Permission::Read;
    const DESCRIPTION: &'static str =
        "Returns the drand beacon entry for the given epoch, blocking until it becomes available.";

    type Params = (ChainEpoch,);
    type Ok = BeaconEntry;

    async fn handle(
        ctx: Ctx,
        (first,): Self::Params,
        ext: &http::Extensions,
    ) -> Result<Self::Ok, ServerError> {
        crate::rpc::state::StateGetBeaconEntry::handle(ctx, (first,), ext).await
    }
}