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

Serialize BlockId directly for block_receipts #16

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ targets = [
# The path where the advisory database is cloned/fetched into
db-path = "~/.cargo/advisory-db"
# The url of the advisory database to use
db-url = "https://github.com/rustsec/advisory-db"
db-urls = ["https://github.com/rustsec/advisory-db"]
# The lint level for security vulnerabilities
vulnerability = "warn"
# The lint level for unmaintained crates
Expand Down
14 changes: 3 additions & 11 deletions src/api/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,8 @@ impl<T: Transport> Eth<T> {

/// Get block receipts
pub fn block_receipts(&self, block: BlockId) -> CallFuture<Option<Vec<TransactionReceipt>>, T::Out> {
let result = match block {
BlockId::Hash(hash) => {
let hash = helpers::serialize(&hash);
self.transport.execute("eth_getBlockReceipts", vec![hash])
}
BlockId::Number(num) => {
let num = helpers::serialize(&num);
self.transport.execute("eth_getBlockReceipts", vec![num])
}
};
let block: serde_json::Value = helpers::serialize(&block);
let result = self.transport.execute("eth_getBlockReceipts", vec![block]);

CallFuture::new(result)
}
Expand Down Expand Up @@ -521,7 +513,7 @@ mod tests {
"status": "0x1",
"effectiveGasPrice": "0x100"
}"#;

const EXAMPLE_BLOCK_RECEIPTS: &str = r#"[{
"transactionHash": "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
"transactionIndex": "0x1",
Expand Down
3 changes: 2 additions & 1 deletion src/types/uint.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pub use ethereum_types::{BigEndianHash, Bloom as H2048, H128, H160, H256, H512, H520, H64, U128, U256, U64};
pub use ethereum_types::{Bloom as H2048, H128, H160, H256, H512, H520, H64, U128, U256, U64};

#[cfg(test)]
mod tests {
use super::*;
use ethereum_types::BigEndianHash;
use wasm_bindgen_test::*;

type Res = Result<U256, serde_json::Error>;
Expand Down
Loading