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 error;
16pub mod header;
17pub mod nitro_execution;
18pub mod nitro_execution_handler;
19pub mod nodeinterface_rpc;
20pub mod outbox_proof;
21pub mod receipt;
22pub mod response;
23pub mod stylus_debug;
24pub mod stylus_tracer;
25pub mod transaction;
26pub mod types;
27
28use alloy_primitives::{B256, U256};
29pub use api::ArbEthApi;
30pub use arb_api::{ArbApiHandler, ArbApiServer};
31pub use block_producer::{BlockProducer, BlockProducerError, BlockProductionInput, ProducedBlock};
32pub use builder::{ArbEthApiBuilder, ArbRpcConvert};
33pub use error::{RpcError, RpcResult};
34pub use header::ArbHeaderConverter;
35pub use nitro_execution::{NitroExecutionApiServer, RpcMessageResult, RpcMessageWithMetadata};
36pub use nitro_execution_handler::NitroExecutionHandler;
37pub use receipt::ArbReceiptConverter;
38pub use response::ArbRpcTxConverter;
39use serde::{Deserialize, Serialize};
40pub use transaction::ArbTransactionRequest;
41pub use types::ArbRpcTypes;
42
43/// Arbitrum transaction receipt extension fields.
44#[derive(Debug, Clone, Default, Serialize, Deserialize)]
45#[serde(rename_all = "camelCase")]
46pub struct ArbReceiptFields {
47    /// L1 block number when the L2 tx was batched.
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub l1_block_number: Option<u64>,
50    /// Gas units charged for L1 calldata.
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub gas_used_for_l1: Option<U256>,
53}
54
55/// Arbitrum block information returned by `arb_getBlockInfo`.
56#[derive(Debug, Clone, Serialize, Deserialize)]
57#[serde(rename_all = "camelCase")]
58pub struct ArbBlockInfo {
59    /// The L1 block number that this L2 block was batched on.
60    pub l1_block_number: u64,
61    /// ArbOS format version of this block.
62    pub arbos_format_version: u64,
63    /// The send count (L2-to-L1 messages) as of this block.
64    pub send_count: u64,
65    /// The send root hash.
66    pub send_root: B256,
67}
68
69/// Maintenance status for the node.
70#[derive(Debug, Clone, Default, Serialize, Deserialize)]
71#[serde(rename_all = "camelCase")]
72pub struct ArbMaintenanceStatus {
73    pub is_running: bool,
74}
75
76/// Response for `arb_getRawBlockMetadata`.
77///
78/// Per block in the queried range, returns the block number and raw
79/// metadata bytes. We do not maintain a separate metadata sidecar yet,
80/// so the bytes are empty — consumers should interpret "empty rawMetadata"
81/// as "no metadata stored".
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}