| Crates.io | palantiri |
| lib.rs | palantiri |
| version | 0.1.0 |
| created_at | 2025-04-08 15:24:07.560629+00 |
| updated_at | 2025-04-08 15:24:07.560629+00 |
| description | RPC client |
| homepage | |
| repository | https://github.com/malik672/palantiri |
| max_upload_size | |
| id | 1625631 |
| size | 184,554 |
A high-performance Ethereum RPC client with zero-copy parsing for maximum efficiency.
The transport layer is responsible for executing RPC requests.
pub trait Transport: Send + Sync + std::fmt::Debug {
async fn execute_raw(&self, request: String) -> Result<Vec<u8>, RpcError>;
async fn execute(&self, request: String) -> Result<String, RpcError>;
async fn execute_with_retry(&self, request: String, retry: usize) -> Result<String, RpcError>;
async fn connect(&self) -> Result<(), RpcError>;
}
pub async fn get_chain_id(&self) -> Result<U64, RpcError>
// Get current gas price
pub async fn get_gas_price(&self) -> Result<U256, RpcError>
// Get current block number
pub async fn get_block_number(&self) -> Result<U64, RpcError>
pub async fn get_block_by_number(
&self,
number: u64,
full_tx: bool,
) -> Result<Option<Block>, RpcError>
// Get block header only
pub async fn get_block_header_by_number(
&self,
number: u64,
full_tx: bool
) -> Result<Option<BlockHeader>, RpcError>
pub async fn get_transaction_by_tx_hash(
&self,
hash: B256
) -> Result<Option<TransactionTx>, RpcError>
// Get transaction by block and index
pub async fn get_transaction_by_block_with_index(
&self,
block: BlockIdentifier,
index: U64
) -> Result<Option<TransactionTx>, RpcError>
pub async fn get_balance(
&self,
address: Address,
block: BlockNumber
) -> Result<U256, RpcError>
// Get contract code
pub async fn get_code(
&self,
address: Address,
block: BlockNumber
) -> Result<Bytes, RpcError>
pub async fn get_logs(
&self,
from_block: u64,
to_block: u64,
address: Option<Address>,
topics: Option<Vec<B256>>
) -> Result<Option<Vec<Log>>, RpcError>
let client = RpcClient::new(transport);
// Fetch blocks concurrently
let blocks = client.get_block_by_number(block_num, false).await?;
Contributions are welcome! Please submit issues or pull requests to help improve this library.
This project is licensed under MIT License.