Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move get_system_account_next_index to GetAccountInformation #575

Merged
merged 2 commits into from
May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 21 additions & 25 deletions src/api/rpc_api/frame_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ pub trait GetAccountInformation {
type Index;
type AccountData;

/// Retrieves the next account index as available on the node.
// FIXME: Remove std feature #574
#[cfg(feature = "std")]
async fn get_system_account_next_index(
&self,
account_id: Self::AccountId,
) -> Result<Self::Index>;

async fn get_account_info(
&self,
address: &Self::AccountId,
Expand All @@ -52,6 +60,19 @@ where
type Index = T::Index;
type AccountData = T::AccountData;

// FIXME: Remove std feature: #574
#[cfg(feature = "std")]
async fn get_system_account_next_index(
&self,
account_id: Self::AccountId,
) -> Result<Self::Index> {
let next_index = self
.client()
.request("system_accountNextIndex", rpc_params![account_id])
.await?;
Ok(next_index)
}

async fn get_account_info(
&self,
address: &Self::AccountId,
Expand Down Expand Up @@ -86,16 +107,6 @@ pub trait SystemApi {
type ChainType;
type Properties;
type Health;
type Index;
type AccountId;

/// Retrieves the next accountIndex as available on the node.
// FIXME: Remove once #391 is fixed.
#[cfg(feature = "std")]
async fn get_system_account_next_index(
&self,
account_id: Self::AccountId,
) -> Result<Self::Index>;

/// Get the node's implementation name.
async fn get_system_name(&self) -> Result<String>;
Expand Down Expand Up @@ -138,21 +149,6 @@ where
type ChainType = ac_primitives::ChainType;
type Properties = ac_primitives::Properties;
type Health = ac_primitives::Health;
type Index = T::Index;
type AccountId = T::AccountId;

// FIXME: Remove once #391 is fixed.
#[cfg(feature = "std")]
async fn get_system_account_next_index(
&self,
account_id: Self::AccountId,
) -> Result<Self::Index> {
let next_index = self
.client()
.request("system_accountNextIndex", rpc_params![account_id])
.await?;
Ok(next_index)
}

async fn get_system_name(&self) -> Result<String> {
let res = self.client().request("system_name", rpc_params![]).await?;
Expand Down