Skip to content

Commit

Permalink
eips: impl From<RpcBlockHash> for BlockId (#1539)
Browse files Browse the repository at this point in the history
eips: impl From<RpcBlockHash> for BlockId
  • Loading branch information
tcoratger authored Oct 21, 2024
1 parent 2d15e90 commit f1ebdb3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/eips/src/eip1898.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ impl From<HashOrNumber> for BlockId {
fn from(block: HashOrNumber) -> Self {
match block {
HashOrNumber::Hash(hash) => {
Self::Hash(RpcBlockHash { block_hash: hash, require_canonical: None })
RpcBlockHash { block_hash: hash, require_canonical: None }.into()
}
HashOrNumber::Number(num) => Self::Number(BlockNumberOrTag::Number(num)),
}
Expand All @@ -406,13 +406,19 @@ impl From<HashOrNumber> for BlockId {

impl From<B256> for BlockId {
fn from(block_hash: B256) -> Self {
Self::Hash(RpcBlockHash { block_hash, require_canonical: None })
RpcBlockHash { block_hash, require_canonical: None }.into()
}
}

impl From<(B256, Option<bool>)> for BlockId {
fn from(hash_can: (B256, Option<bool>)) -> Self {
Self::Hash(RpcBlockHash { block_hash: hash_can.0, require_canonical: hash_can.1 })
RpcBlockHash { block_hash: hash_can.0, require_canonical: hash_can.1 }.into()
}
}

impl From<RpcBlockHash> for BlockId {
fn from(value: RpcBlockHash) -> Self {
Self::Hash(value)
}
}

Expand Down

0 comments on commit f1ebdb3

Please sign in to comment.