Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

SingleSigner::query_next_nonce

Fetch the next unused nonce for this signer's account.

Signature

pub async fn query_next_nonce<C>(&self, client: &C) -> anyhow::Result<Nonce>
where
    C: QueryClient,
    anyhow::Error: From<C::Error>;

Available on every state of SingleSigner.

Example

use {
    anyhow::Result,
    dango_sdk::{HttpClient, Secp256k1, SingleSigner},
    grug::Addr,
    std::str::FromStr,
};
 
#[tokio::main]
async fn main() -> Result<()> {
    let http   = HttpClient::new("https://api-mainnet.dango.zone")?;
    let signer = SingleSigner::new(
        Addr::from_str("0x0000000000000000000000000000000000000000")?,
        Secp256k1::new_random(),
    );
 
    let nonce = signer.query_next_nonce(&http).await?;
    println!("next nonce: {nonce}");
    Ok(())
}

Parameters

client&C implementing QueryClient.

Returns

Noncelast_seen_nonce + 1, or 0 if the account has never signed a transaction.

Notes

  • Reads QuerySeenNoncesRequest on the account contract.
  • Borrowing variant. To flip the typestate, use with_query_nonce.

See also