Skip to main content

at_block

Attribute Macro at_block 

Source
#[at_block]
Expand description

Generate query for the latest state for functions that query something at specified block.

§Note

  • the docs must be end with at specified block.
  • the function name must be end with _at.
  • the last argument must be Option<H256>.

§Example

/// Imdocs at specified block.
#[at_block]
pub fn query_at(addr: Address, block_hash: Option<H256>) -> R {
    // ...
}

will generate functions

/// Imdocs at specified block.
pub fn query_at(addr: Address, block_hash: impl Into<Option<H256>>) -> R {
    // ...
}

/// Imdocs.
pub fn query(addr: Address) -> R {
    query_at(addr, None)
}