Skip to content

Commit

Permalink
fix: some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cernicc committed Jun 7, 2024
1 parent f157bb3 commit 49bc92c
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cli/polka-storage-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ subxt = { workspace = true }
subxt-signer = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
url = { workspace = true }

[lints]
Expand Down
1 change: 1 addition & 0 deletions cli/polka-storage-provider/src/commands/info.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use clap::Parser;
use cli_primitives::Result;

/// Command to display information about the storage provider.
#[derive(Debug, Clone, Parser)]
pub(crate) struct InfoCommand {}

Expand Down
1 change: 1 addition & 0 deletions cli/polka-storage-provider/src/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use clap::Parser;
use cli_primitives::Result;
use tracing::info;

/// Command to initialize the storage provider.s
#[derive(Debug, Clone, Parser)]
pub(crate) struct InitCommand {}

Expand Down
1 change: 1 addition & 0 deletions cli/polka-storage-provider/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
const SERVER_DEFAULT_BIND_ADDR: &str = "127.0.0.1:8000";
const SUBSTRATE_DEFAULT_RPC_ADDR: &str = "ws://127.0.0.1:9944";

/// Command to start the storage provider.
#[derive(Debug, Clone, Parser)]
pub(crate) struct RunCommand {
/// RPC API endpoint of the parachain node
Expand Down
1 change: 0 additions & 1 deletion cli/polka-storage-provider/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! A CLI application that facilitates management operations over a running full node and other components.
#![deny(unused_crate_dependencies)]

mod cli;
Expand Down
1 change: 1 addition & 0 deletions cli/polka-storage-provider/src/rpc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fmt::Display;
use jsonrpsee::types::{error::INTERNAL_ERROR_CODE, ErrorObjectOwned};
use serde_json::Value;

/// Error type for RPC server errors.
pub struct ServerError {
inner: ErrorObjectOwned,
}
Expand Down
1 change: 1 addition & 0 deletions cli/polka-storage-provider/src/rpc/methods/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};

use crate::rpc::{error::ServerError, ApiVersion, Ctx, RpcMethod};

/// This RPC method exposes the system information.
#[derive(Debug)]
pub struct Info;

Expand Down
4 changes: 2 additions & 2 deletions cli/polka-storage-provider/src/rpc/methods/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use subxt_signer::sr25519::dev;

use crate::{
rpc::{error::ServerError, ApiVersion, Ctx, RpcMethod},
substrate::get_balance,
substrate::get_system_balances,
};

/// This RPC method exposes getting the system balances for the particular
Expand All @@ -20,7 +20,7 @@ impl RpcMethod for WalletBalance {
// TODO(@cernicc,05/06/2024): Implement correctly. dev alice is used as a show case for now.
let account = dev::alice().public_key().into();
// TODO(@cernicc,05/06/2024): Handle error.
let balance = get_balance(&ctx.substrate_client, &account).await?;
let balance = get_system_balances(&ctx.substrate_client, &account).await?;

Ok(balance.map(|balance| WalletBalanceResult {
free: balance.data.free.to_string(),
Expand Down
3 changes: 2 additions & 1 deletion cli/polka-storage-provider/src/substrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ pub async fn init_client(url: impl AsRef<str>) -> Result<Client, Error> {
Ok(inner)
}

pub async fn get_balance(
/// Get system balances for the particular account.
pub async fn get_system_balances(
client: &Client,
account: &AccountId32,
) -> Result<Option<AccountInfo<u32, AccountData<u128>>>, Error> {
Expand Down

0 comments on commit 49bc92c

Please sign in to comment.