doc: cli docs added

This commit is contained in:
Pravdyvy 2025-10-28 16:53:39 +02:00
parent 5840f9b779
commit 785ed5f169
6 changed files with 47 additions and 22 deletions

View File

@ -69,14 +69,16 @@ impl TokenHolding {
///Represents generic chain CLI subcommand
#[derive(Subcommand, Debug, Clone)]
pub enum AccountSubcommand {
///Get
///Get account data
Get {
#[arg(long)]
///Flag to get raw account data
#[arg(short, long)]
raw: bool,
///Valid 32 byte base58 string with privacy prefix
#[arg(short, long)]
addr: String,
},
///New
///Produce new public or private account
#[command(subcommand)]
New(NewSubcommand),
///Sync private accounts
@ -260,7 +262,7 @@ impl WalletSubcommand for AccountSubcommand {
.is_empty()
{
parse_block_range(
last_synced_block,
last_synced_block + 1,
curr_last_block,
wallet_core.sequencer_client.clone(),
wallet_core,

View File

@ -6,12 +6,16 @@ use crate::{SubcommandReturnValue, WalletCore, cli::WalletSubcommand};
///Represents generic chain CLI subcommand
#[derive(Subcommand, Debug, Clone)]
pub enum ChainSubcommand {
///Get current block id from sequencer
CurrentBlockId {},
///Get block at id from sequencer
Block {
#[arg(short, long)]
id: u64,
},
///Get transaction at hash from sequencer
Transaction {
///hash - valid 32 byte hex string
#[arg(short, long)]
hash: String,
},

View File

@ -12,22 +12,28 @@ use crate::{
///Represents generic CLI subcommand for a wallet working with native token transfer program
#[derive(Subcommand, Debug, Clone)]
pub enum AuthTransferSubcommand {
///Initialize account under authenticated transfer program
Init {
///addr - valid 32 byte base58 string
///addr - valid 32 byte base58 string with privacy prefix
#[arg(long)]
addr: String,
},
///Send native tokens from one account to another with variable privacy
///
///If receiver is private, then `to` and (`to_npk` , `to_ipk`) is a mutually exclusive patterns.
///
///First is used for owned accounts, second otherwise.
Send {
///from - valid 32 byte base58 string
///from - valid 32 byte base58 string with privacy prefix
#[arg(long)]
from: String,
///to - valid 32 byte base58 string
///to - valid 32 byte base58 string with privacy prefix
#[arg(long)]
to: Option<String>,
///to_npk - valid 32 byte base58 string
///to_npk - valid 32 byte hex string
#[arg(long)]
to_npk: Option<String>,
///to_ipk - valid 33 byte base58 string
///to_ipk - valid 33 byte hex string
#[arg(long)]
to_ipk: Option<String>,
///amount - amount of balance to move

View File

@ -12,9 +12,9 @@ use crate::{
///Represents generic CLI subcommand for a wallet working with pinata program
#[derive(Subcommand, Debug, Clone)]
pub enum PinataProgramAgnosticSubcommand {
///Claim
///Claim pinata
Claim {
///to_addr - valid 32 byte base58 string
///to_addr - valid 32 byte base58 string with privacy prefix
#[arg(long)]
to_addr: String,
///solution - solution to pinata challenge

View File

@ -12,11 +12,14 @@ use crate::{
///Represents generic CLI subcommand for a wallet working with token program
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramAgnosticSubcommand {
///Produce new ERC-20 token
///
///Currently the only supported privacy options is for public definition
New {
///addr - valid 32 byte base58 string
///definition_addr - valid 32 byte base58 string with privacy prefix
#[arg(long)]
definition_addr: String,
///addr - valid 32 byte base58 string
///supply_addr - valid 32 byte base58 string with privacy prefix
#[arg(long)]
supply_addr: String,
#[arg(short, long)]
@ -24,11 +27,16 @@ pub enum TokenProgramAgnosticSubcommand {
#[arg(short, long)]
total_supply: u128,
},
///Send tokens from one account to another with variable privacy
///
///If receiver is private, then `to` and (`to_npk` , `to_ipk`) is a mutually exclusive patterns.
///
///First is used for owned accounts, second otherwise.
Send {
///from - valid 32 byte base58 string
///from - valid 32 byte base58 string with privacy prefix
#[arg(long)]
from: String,
///to - valid 32 byte base58 string
///to - valid 32 byte base58 string with privacy prefix
#[arg(long)]
to: Option<String>,
///to_npk - valid 32 byte hex string

View File

@ -198,27 +198,32 @@ impl WalletCore {
#[derive(Subcommand, Debug, Clone)]
#[clap(about)]
pub enum Command {
///Transfer command
///Authenticated transfer subcommand
#[command(subcommand)]
AuthTransfer(AuthTransferSubcommand),
///Chain command
///Generic chain info subcommand
#[command(subcommand)]
ChainInfo(ChainSubcommand),
///Chain command
///Account view and sync subcommand
#[command(subcommand)]
Account(AccountSubcommand),
///Pinata command
///Pinata program interaction subcommand
#[command(subcommand)]
Pinata(PinataProgramAgnosticSubcommand),
///Token command
///Token program interaction subcommand
#[command(subcommand)]
Token(TokenProgramAgnosticSubcommand),
// Check the wallet can connect to the node and builtin local programs
// match the remote versions
/// Check the wallet can connect to the node and builtin local programs
/// match the remote versions
CheckHealth {},
}
///To execute commands, env var NSSA_WALLET_HOME_DIR must be set into directory with config
///
/// All account adresses must be valid 32 byte base58 strings.
///
/// All account addresses must be provided as {privacy_prefix}/{addr},
/// where valid options for `privacy_prefix` is `Public` and `Private`
#[derive(Parser, Debug)]
#[clap(version, about)]
pub struct Args {