feat(rpc): eth_transactionBy impls (#1664)

Co-authored-by: Sam Bukowski <sambukowski@Sams-MacBook-Pro.local>
This commit is contained in:
sambukowski
2023-03-11 02:54:11 -07:00
committed by GitHub
parent a0f195590c
commit 853da85c44
5 changed files with 71 additions and 29 deletions

View File

@ -9,7 +9,8 @@ use jsonrpsee::{
types::error::{CallError, ErrorCode},
};
use reth_primitives::{
hex_literal::hex, Address, BlockId, BlockNumberOrTag, Bytes, NodeRecord, H256, H64, U256,
hex_literal::hex, Address, BlockId, BlockNumberOrTag, Bytes, NodeRecord, TxHash, H256, H64,
U256,
};
use reth_rpc_api::{
clients::{AdminApiClient, EthApiClient},
@ -50,6 +51,7 @@ where
let address = Address::default();
let index = Index::default();
let hash = H256::default();
let tx_hash = TxHash::default();
let block_number = BlockNumberOrTag::default();
let call_request = CallRequest::default();
let transaction_request = TransactionRequest::default();
@ -75,21 +77,13 @@ where
EthApiClient::block_uncles_count_by_number(client, block_number).await.unwrap();
EthApiClient::uncle_by_block_hash_and_index(client, hash, index).await.unwrap();
EthApiClient::uncle_by_block_number_and_index(client, block_number, index).await.unwrap();
EthApiClient::create_access_list(client, call_request.clone(), None).await.unwrap();
EthApiClient::transaction_by_hash(client, tx_hash).await.unwrap();
EthApiClient::transaction_by_block_hash_and_index(client, hash, index).await.unwrap();
EthApiClient::transaction_by_block_number_and_index(client, block_number, index).await.unwrap();
// Unimplemented
assert!(is_unimplemented(EthApiClient::syncing(client).await.err().unwrap()));
assert!(is_unimplemented(EthApiClient::author(client).await.err().unwrap()));
assert!(is_unimplemented(EthApiClient::transaction_by_hash(client, hash).await.err().unwrap()));
assert!(is_unimplemented(
EthApiClient::transaction_by_block_hash_and_index(client, hash, index).await.err().unwrap()
));
assert!(is_unimplemented(
EthApiClient::transaction_by_block_number_and_index(client, block_number, index)
.await
.err()
.unwrap()
));
assert!(is_unimplemented(EthApiClient::transaction_receipt(client, hash).await.err().unwrap()));
assert!(is_unimplemented(
EthApiClient::call(client, call_request.clone(), None, None).await.err().unwrap()