Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add missing helper functions for block_id on RpcWithBlock #756

Closed
mattsse opened this issue May 16, 2024 · 0 comments · Fixed by #757
Closed

[Feature] Add missing helper functions for block_id on RpcWithBlock #756

mattsse opened this issue May 16, 2024 · 0 comments · Fixed by #757
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mattsse
Copy link
Member

mattsse commented May 16, 2024

Component

rpc

Describe the feature you would like

we should add the same helper functions that BlockId has here

/// Set the block id.
#[allow(clippy::missing_const_for_fn)] // false positive
pub fn block_id(mut self, block_id: BlockId) -> Self {
self.block_id = block_id;
self
}

see:

/// Creates a new "pending" tag instance.
pub const fn pending() -> Self {
Self::Number(BlockNumberOrTag::Pending)
}
/// Creates a new "latest" tag instance.
pub const fn latest() -> Self {
Self::Number(BlockNumberOrTag::Latest)
}
/// Creates a new "earliest" tag instance.
pub const fn earliest() -> Self {
Self::Number(BlockNumberOrTag::Earliest)
}
/// Creates a new "finalized" tag instance.
pub const fn finalized() -> Self {
Self::Number(BlockNumberOrTag::Finalized)
}
/// Creates a new "safe" tag instance.
pub const fn safe() -> Self {
Self::Number(BlockNumberOrTag::Safe)
}
/// Creates a new block number instance.
pub const fn number(num: u64) -> Self {
Self::Number(BlockNumberOrTag::Number(num))
}
/// Create a new block hash instance.
pub const fn hash(block_hash: B256) -> Self {

Additional context

No response

@mattsse mattsse added enhancement New feature or request good first issue Good for newcomers labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant