arb_rpc/
lib.rs

1//! Arbitrum-specific RPC types, converters, and builders.
2//!
3//! Provides the Arbitrum Eth API builder and RPC type conversions needed
4//! to serve the `eth_` namespace with Arbitrum-specific transaction,
5//! receipt, and header types.
6
7pub mod api;
8pub mod arb_api;
9pub mod arbdebug;
10pub mod arbtimeboost;
11pub mod arbtrace;
12pub mod block_producer;
13pub mod builder;
14pub mod conditional_tx;
15pub mod header;
16pub mod nitro_execution;
17pub mod nitro_execution_handler;
18pub mod nodeinterface_rpc;
19pub mod outbox_proof;
20pub mod receipt;
21pub mod response;
22pub mod stylus_debug;
23pub mod stylus_tracer;
24pub mod transaction;
25pub mod types;
26
27pub use api::ArbEthApi;
28pub use arb_api::{ArbApiHandler, ArbApiServer};
29pub use block_producer::{BlockProducer, BlockProducerError, BlockProductionInput, ProducedBlock};
30pub use builder::{ArbEthApiBuilder, ArbRpcConvert};
31pub use header::ArbHeaderConverter;
32pub use nitro_execution::{NitroExecutionApiServer, RpcMessageResult, RpcMessageWithMetadata};
33pub use nitro_execution_handler::NitroExecutionHandler;
34pub use receipt::ArbReceiptConverter;
35pub use response::ArbRpcTxConverter;
36pub use transaction::ArbTransactionRequest;
37pub use types::ArbRpcTypes;
38
39use alloy_primitives::{B256, U256};
40use serde::{Deserialize, Serialize};
41
42/// Arbitrum transaction receipt extension fields.
43#[derive(Debug, Clone, Default, Serialize, Deserialize)]
44#[serde(rename_all = "camelCase")]
45pub struct ArbReceiptFields {
46    /// L1 block number when the L2 tx was batched.
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub l1_block_number: Option<u64>,
49    /// Gas units charged for L1 calldata.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub gas_used_for_l1: Option<U256>,
52}
53
54/// Arbitrum block information returned by `arb_getBlockInfo`.
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(rename_all = "camelCase")]
57pub struct ArbBlockInfo {
58    /// The L1 block number that this L2 block was batched on.
59    pub l1_block_number: u64,
60    /// ArbOS format version of this block.
61    pub arbos_format_version: u64,
62    /// The send count (L2-to-L1 messages) as of this block.
63    pub send_count: u64,
64    /// The send root hash.
65    pub send_root: B256,
66}
67
68/// Maintenance status for the node.
69#[derive(Debug, Clone, Default, Serialize, Deserialize)]
70#[serde(rename_all = "camelCase")]
71pub struct ArbMaintenanceStatus {
72    pub is_running: bool,
73}
74
75/// Nitro-parity response for `arb_getRawBlockMetadata`.
76///
77/// Per block in the queried range, returns the block number and the raw
78/// metadata bytes. In arbreth we currently do not maintain a separate
79/// metadata sidecar (Nitro's `bulkBlockMetadataFetcher`), so the bytes
80/// are empty — consumers should interpret "empty rawMetadata" as "no
81/// metadata stored", which matches the Nitro schema.
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(rename_all = "camelCase")]
84pub struct NumberAndBlockMetadata {
85    pub block_number: u64,
86    pub raw_metadata: alloy_primitives::Bytes,
87}