pub struct Client<H, S = ()> { /* private fields */ }Expand description
Reads for any module (nitro::sys::arb_os_version() through Client::read) and, with a
Signer, transactions. S is () for a client that only reads.
Client::parent is the same client on HyperEVM, Elysium’s parent, for the bridge’s calls
there: deposits, retryable tickets and claims.
Implementations§
Source§impl<H: Http, S> Client<H, S>
impl<H: Http, S> Client<H, S>
Sourcepub fn new(http: H, network: Network, signer: S) -> Self
pub fn new(http: H, network: Network, signer: S) -> Self
One network through Kinetiq’s public node (Network::rpc_url), signing with signer.
Sourcepub fn at(http: H, url: impl Into<String>, network: Network, signer: S) -> Self
pub fn at(http: H, url: impl Into<String>, network: Network, signer: S) -> Self
One network through another node: Conduit’s, or a provider’s with its key in the URL.
Sourcepub fn parent(http: H, network: Network, signer: S) -> Self
pub fn parent(http: H, network: Network, signer: S) -> Self
The network’s parent, HyperEVM, through its own node
(df_hyperliquid_core::Network::evm_rpc_url), signing for its chain
(Network::parent_chain_id): for the bridge’s calls there. Sends and Ethereum’s reads work
as on Elysium, and receipts and transactions read; Nitro’s own (blocks, Client::estimate)
are Elysium’s, so read HyperEVM’s blocks through Client::rpc.
pub const fn network(&self) -> Network
Sourcepub const fn chain(&self) -> u64
pub const fn chain(&self) -> u64
The chain this client signs for: Elysium’s, or HyperEVM’s for Client::parent.
pub const fn http(&self) -> &H
pub const fn signer(&self) -> &S
Sourcepub async fn read<T>(&self, read: &Read<T>) -> Result<T, ReadError>
pub async fn read<T>(&self, read: &Read<T>) -> Result<T, ReadError>
A typed read at the latest block.
pub async fn chain_id(&self) -> Result<u64, RpcError>
pub async fn block_number(&self) -> Result<u64, RpcError>
Sourcepub async fn balance(&self, owner: Address) -> Result<U256, RpcError>
pub async fn balance(&self, owner: Address) -> Result<U256, RpcError>
An address’s HYPE in wei, at the latest block.
Sourcepub async fn nonce(&self, owner: Address) -> Result<u64, RpcError>
pub async fn nonce(&self, owner: Address) -> Result<u64, RpcError>
The next nonce owner may use, counting what the sequencer has taken.
Sourcepub async fn code(&self, at: Address) -> Result<Vec<u8>, RpcError>
pub async fn code(&self, at: Address) -> Result<Vec<u8>, RpcError>
Empty for an account that is not a contract; 0xfe for a precompile.
Sourcepub async fn gas_price(&self) -> Result<U256, RpcError>
pub async fn gas_price(&self) -> Result<U256, RpcError>
What one unit of gas costs now, in wei: the base fee. There is no tip to add.
Sourcepub async fn estimate(
&self,
from: Option<Address>,
call: &Call,
) -> Result<Estimate, ReadError>
pub async fn estimate( &self, from: Option<Address>, call: &Call, ) -> Result<Estimate, ReadError>
The gas call takes when from sends it, split into Elysium’s execution and HyperEVM’s
data, at the base fees it would pay (crate::nitro::node::gas_estimate_components).
pub async fn receipt(&self, hash: B256) -> Result<Option<Receipt>, RpcError>
pub async fn transaction( &self, hash: B256, ) -> Result<Option<Transaction>, RpcError>
pub async fn block( &self, block: BlockTag, full: bool, ) -> Result<Option<Block>, RpcError>
pub async fn block_by_hash( &self, hash: B256, full: bool, ) -> Result<Option<Block>, RpcError>
pub async fn block_receipts( &self, block: BlockTag, ) -> Result<Option<Vec<Receipt>>, RpcError>
Source§impl<H: Http, S: Signer> Client<H, S>
Sending needs the sign feature: each signature is recovered and must match the signer before
anything is sent, since a remote signer can sign as another address.
impl<H: Http, S: Signer> Client<H, S>
Sending needs the sign feature: each signature is recovered and must match the signer before
anything is sent, since a remote signer can sign as another address.
Sourcepub async fn prepare(&self, call: Call) -> Result<Eip1559, SendError>
pub async fn prepare(&self, call: Call) -> Result<Eip1559, SendError>
The transaction that makes call: this client’s chain, the next nonce, the node’s gas
estimate with with_headroom, and fees over the current base fee (gas::fees).
Sourcepub async fn sign(&self, tx: &Eip1559) -> Result<Vec<u8>, SignError>
pub async fn sign(&self, tx: &Eip1559) -> Result<Vec<u8>, SignError>
The bytes a node is sent: signed by the signer, the signature recovered and checked.
Sourcepub async fn send(&self, call: Call) -> Result<B256, SendError>
pub async fn send(&self, call: Call) -> Result<B256, SendError>
Prepares, signs and sends call once; the hash the node took it under.
Sourcepub async fn send_prepared(&self, tx: &Eip1559) -> Result<B256, SendError>
pub async fn send_prepared(&self, tx: &Eip1559) -> Result<B256, SendError>
Signs and sends a prepared transaction once.
Sourcepub async fn send_sync(
&self,
call: Call,
timeout_ms: Option<u64>,
) -> Result<Receipt, SendError>
pub async fn send_sync( &self, call: Call, timeout_ms: Option<u64>, ) -> Result<Receipt, SendError>
Prepares, signs and sends call once with eth_sendRawTransactionSync: the answer is its
receipt, a reverted one included. The node gives up after timeout_ms (its own default
when None); then the transaction may still land.