pub struct Network { /* private fields */ }Expand description
A cheap, cloneable handle onto the target network.
Chain verbs return TestkitError::Offline when the scenario has no live
target. Network::client exposes the underlying typed JSON-RPC client as
an escape hatch for methods this handle does not wrap.
Implementations§
Source§impl Network
impl Network
Sourcepub fn client(&self) -> Option<&NativeClient<HttpClient>>
pub fn client(&self) -> Option<&NativeClient<HttpClient>>
The underlying typed JSON-RPC client, for methods this handle does not wrap.
Sourcepub async fn submit_raw(&self, tx_hex: String) -> Result<TxHash>
pub async fn submit_raw(&self, tx_hex: String) -> Result<TxHash>
Submit a pre-signed transaction once, verifying the returned identity.
Sourcepub async fn receipt(
&self,
tx_hash: TxHash,
) -> Result<Option<TransactionReceipt>>
pub async fn receipt( &self, tx_hash: TxHash, ) -> Result<Option<TransactionReceipt>>
Fetch a transaction receipt if it is already available.
Sourcepub async fn await_receipt(&self, tx_hash: TxHash) -> Result<TransactionReceipt>
pub async fn await_receipt(&self, tx_hash: TxHash) -> Result<TransactionReceipt>
Read-only receipt wait. Errors retain commitment and advisory status evidence; no status authorizes resubmission or proves that execution cannot occur.
Sourcepub async fn transaction_status(
&self,
tx_hash: TxHash,
) -> Result<TransactionStatus>
pub async fn transaction_status( &self, tx_hash: TxHash, ) -> Result<TransactionStatus>
Fetch a transaction’s advisory status.
Sourcepub async fn await_pending(&self, tx_hash: TxHash) -> Result<()>
pub async fn await_pending(&self, tx_hash: TxHash) -> Result<()>
Wait until the scheduler reports a submitted transaction as pending.
A successful submit RPC confirms admission, not nomination. Manual
block tests should await this barrier before requesting nomination.
If the transaction commits before Pending is observed, this returns
TestkitError::TransactionNotPending because the requested nomination
boundary has already passed.
Sourcepub async fn produce_block(&self) -> Result<ProducedBlock>
pub async fn produce_block(&self) -> Result<ProducedBlock>
Produce one block through a harness-owned local node in manual mode.
Sourcepub async fn get_storage_at(
&self,
address: ContractAddress,
key: &[u8],
) -> Result<StorageResult>
pub async fn get_storage_at( &self, address: ContractAddress, key: &[u8], ) -> Result<StorageResult>
Read one latest-committed storage item at address/key.
Sourcepub async fn view_call(
&self,
contract: ContractAddress,
entrypoint: ContractEntrypointID,
calldata: &[u8],
caller: Option<ContractAddress>,
) -> Result<SimulationResult>
pub async fn view_call( &self, contract: ContractAddress, entrypoint: ContractEntrypointID, calldata: &[u8], caller: Option<ContractAddress>, ) -> Result<SimulationResult>
Simulate a contract call through simulateInvocation.
caller sets the simulated msg.sender; pass an agent’s own address to
read state keyed by that caller.
Sourcepub async fn get_events(&self, query: EventQuery) -> Result<EventPage>
pub async fn get_events(&self, query: EventQuery) -> Result<EventPage>
Query events using native opaque pagination cursors.