substrate_api_client/api/runtime_api/
account_nonce.rs1use super::{RuntimeApi, RuntimeApiClient};
15use crate::{api::Result, rpc::Request};
16use ac_primitives::config::Config;
17#[cfg(not(feature = "sync-api"))]
18use alloc::boxed::Box;
19use alloc::vec;
20use sp_core::Encode;
21
22#[maybe_async::maybe_async(?Send)]
23pub trait AccountNonceApi: RuntimeApi {
24 type Index;
25 type AccountId;
26
27 async fn account_nonce(
29 &self,
30 account_id: Self::AccountId,
31 at_block: Option<Self::Hash>,
32 ) -> Result<Self::Index>;
33}
34
35#[maybe_async::maybe_async(?Send)]
36impl<T, Client> AccountNonceApi for RuntimeApiClient<T, Client>
37where
38 T: Config,
39 Client: Request,
40{
41 type Index = T::Index;
42 type AccountId = T::AccountId;
43
44 async fn account_nonce(
45 &self,
46 account_id: Self::AccountId,
47 at_block: Option<Self::Hash>,
48 ) -> Result<Self::Index> {
49 self.runtime_call("AccountNonceApi_account_nonce", vec![account_id.encode()], at_block)
50 .await
51 }
52}