2025-12-16 14:05:34 +02:00
|
|
|
use anyhow::Result;
|
|
|
|
|
use clap::Subcommand;
|
2025-12-18 11:44:38 +02:00
|
|
|
use nssa::AccountId;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
|
|
|
|
use crate::{
|
2025-12-18 11:44:38 +02:00
|
|
|
WalletCore,
|
2025-12-16 14:05:34 +02:00
|
|
|
cli::{SubcommandReturnValue, WalletSubcommand},
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
helperfunctions::{AccountPrivacyKind, parse_addr_with_privacy_prefix, resolve_id_or_label},
|
2025-12-22 04:42:32 +02:00
|
|
|
program_facades::amm::Amm,
|
2025-12-16 14:05:34 +02:00
|
|
|
};
|
|
|
|
|
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Represents generic CLI subcommand for a wallet working with amm program.
|
2025-12-16 14:05:34 +02:00
|
|
|
#[derive(Subcommand, Debug, Clone)]
|
|
|
|
|
pub enum AmmProgramAgnosticSubcommand {
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Produce a new pool.
|
2025-12-16 14:05:34 +02:00
|
|
|
///
|
2026-03-03 23:21:08 +03:00
|
|
|
/// `user_holding_a` and `user_holding_b` must be owned.
|
2025-12-18 11:44:38 +02:00
|
|
|
///
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Only public execution allowed.
|
2025-12-16 14:05:34 +02:00
|
|
|
New {
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_a` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_a_label",
|
|
|
|
|
required_unless_present = "user_holding_a_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_a: Option<String>,
|
|
|
|
|
/// User holding A account label (alternative to --user-holding-a).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_a")]
|
|
|
|
|
user_holding_a_label: Option<String>,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_b` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_b_label",
|
|
|
|
|
required_unless_present = "user_holding_b_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_b: Option<String>,
|
|
|
|
|
/// User holding B account label (alternative to --user-holding-b).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_b")]
|
|
|
|
|
user_holding_b_label: Option<String>,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_lp` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_lp_label",
|
|
|
|
|
required_unless_present = "user_holding_lp_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_lp: Option<String>,
|
|
|
|
|
/// User holding LP account label (alternative to --user-holding-lp).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_lp")]
|
|
|
|
|
user_holding_lp_label: Option<String>,
|
2025-12-16 14:05:34 +02:00
|
|
|
#[arg(long)]
|
|
|
|
|
balance_a: u128,
|
|
|
|
|
#[arg(long)]
|
2026-04-26 21:29:54 -04:00
|
|
|
balance_b: u128,
|
2025-12-16 14:05:34 +02:00
|
|
|
},
|
2026-04-02 09:28:33 +02:00
|
|
|
/// Swap specifying exact input amount.
|
2025-12-16 14:05:34 +02:00
|
|
|
///
|
2026-03-10 00:17:43 +03:00
|
|
|
/// The account associated with swapping token must be owned.
|
2025-12-18 11:44:38 +02:00
|
|
|
///
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Only public execution allowed.
|
2026-04-02 09:28:33 +02:00
|
|
|
SwapExactInput {
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_a` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_a_label",
|
|
|
|
|
required_unless_present = "user_holding_a_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_a: Option<String>,
|
|
|
|
|
/// User holding A account label (alternative to --user-holding-a).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_a")]
|
|
|
|
|
user_holding_a_label: Option<String>,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_b` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_b_label",
|
|
|
|
|
required_unless_present = "user_holding_b_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_b: Option<String>,
|
|
|
|
|
/// User holding B account label (alternative to --user-holding-b).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_b")]
|
|
|
|
|
user_holding_b_label: Option<String>,
|
2025-12-16 14:05:34 +02:00
|
|
|
#[arg(long)]
|
|
|
|
|
amount_in: u128,
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
min_amount_out: u128,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `token_definition` - valid 32 byte base58 string WITHOUT privacy prefix.
|
2025-12-16 14:05:34 +02:00
|
|
|
#[arg(long)]
|
|
|
|
|
token_definition: String,
|
|
|
|
|
},
|
2026-02-25 13:11:54 +01:00
|
|
|
/// Swap specifying exact output amount.
|
|
|
|
|
///
|
|
|
|
|
/// The account associated with swapping token must be owned.
|
|
|
|
|
///
|
|
|
|
|
/// Only public execution allowed.
|
|
|
|
|
SwapExactOutput {
|
|
|
|
|
/// `user_holding_a` - valid 32 byte base58 string with privacy prefix.
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
user_holding_a: String,
|
|
|
|
|
/// `user_holding_b` - valid 32 byte base58 string with privacy prefix.
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
user_holding_b: String,
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
exact_amount_out: u128,
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
max_amount_in: u128,
|
|
|
|
|
/// `token_definition` - valid 32 byte base58 string WITHOUT privacy prefix.
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
token_definition: String,
|
|
|
|
|
},
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Add liquidity.
|
2025-12-16 14:05:34 +02:00
|
|
|
///
|
2026-03-03 23:21:08 +03:00
|
|
|
/// `user_holding_a` and `user_holding_b` must be owned.
|
2025-12-18 11:44:38 +02:00
|
|
|
///
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Only public execution allowed.
|
2025-12-16 14:05:34 +02:00
|
|
|
AddLiquidity {
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_a` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_a_label",
|
|
|
|
|
required_unless_present = "user_holding_a_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_a: Option<String>,
|
|
|
|
|
/// User holding A account label (alternative to --user-holding-a).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_a")]
|
|
|
|
|
user_holding_a_label: Option<String>,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_b` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_b_label",
|
|
|
|
|
required_unless_present = "user_holding_b_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_b: Option<String>,
|
|
|
|
|
/// User holding B account label (alternative to --user-holding-b).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_b")]
|
|
|
|
|
user_holding_b_label: Option<String>,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_lp` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_lp_label",
|
|
|
|
|
required_unless_present = "user_holding_lp_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_lp: Option<String>,
|
|
|
|
|
/// User holding LP account label (alternative to --user-holding-lp).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_lp")]
|
|
|
|
|
user_holding_lp_label: Option<String>,
|
2025-12-16 14:05:34 +02:00
|
|
|
#[arg(long)]
|
|
|
|
|
min_amount_lp: u128,
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
max_amount_a: u128,
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
max_amount_b: u128,
|
|
|
|
|
},
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Remove liquidity.
|
2025-12-16 14:05:34 +02:00
|
|
|
///
|
2026-03-03 23:21:08 +03:00
|
|
|
/// `user_holding_lp` must be owned.
|
2025-12-18 11:44:38 +02:00
|
|
|
///
|
2026-03-10 00:17:43 +03:00
|
|
|
/// Only public execution allowed.
|
2025-12-16 14:05:34 +02:00
|
|
|
RemoveLiquidity {
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_a` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_a_label",
|
|
|
|
|
required_unless_present = "user_holding_a_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_a: Option<String>,
|
|
|
|
|
/// User holding A account label (alternative to --user-holding-a).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_a")]
|
|
|
|
|
user_holding_a_label: Option<String>,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_b` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_b_label",
|
|
|
|
|
required_unless_present = "user_holding_b_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_b: Option<String>,
|
|
|
|
|
/// User holding B account label (alternative to --user-holding-b).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_b")]
|
|
|
|
|
user_holding_b_label: Option<String>,
|
2026-03-10 00:17:43 +03:00
|
|
|
/// `user_holding_lp` - valid 32 byte base58 string with privacy prefix.
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
#[arg(
|
|
|
|
|
long,
|
|
|
|
|
conflicts_with = "user_holding_lp_label",
|
|
|
|
|
required_unless_present = "user_holding_lp_label"
|
|
|
|
|
)]
|
|
|
|
|
user_holding_lp: Option<String>,
|
|
|
|
|
/// User holding LP account label (alternative to --user-holding-lp).
|
|
|
|
|
#[arg(long, conflicts_with = "user_holding_lp")]
|
|
|
|
|
user_holding_lp_label: Option<String>,
|
2025-12-16 14:05:34 +02:00
|
|
|
#[arg(long)]
|
|
|
|
|
balance_lp: u128,
|
|
|
|
|
#[arg(long)]
|
2025-12-19 19:12:58 +02:00
|
|
|
min_amount_a: u128,
|
2025-12-16 14:05:34 +02:00
|
|
|
#[arg(long)]
|
2025-12-19 19:12:58 +02:00
|
|
|
min_amount_b: u128,
|
2025-12-16 14:05:34 +02:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl WalletSubcommand for AmmProgramAgnosticSubcommand {
|
|
|
|
|
async fn handle_subcommand(
|
|
|
|
|
self,
|
|
|
|
|
wallet_core: &mut WalletCore,
|
|
|
|
|
) -> Result<SubcommandReturnValue> {
|
|
|
|
|
match self {
|
2026-03-09 18:27:56 +03:00
|
|
|
Self::New {
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_a,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_a_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_b,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_b_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_lp,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_lp_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
balance_a,
|
|
|
|
|
balance_b,
|
|
|
|
|
} => {
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
let user_holding_a = resolve_id_or_label(
|
|
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_a_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
|
|
|
|
let user_holding_b = resolve_id_or_label(
|
|
|
|
|
user_holding_b,
|
|
|
|
|
user_holding_b_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
|
|
|
|
let user_holding_lp = resolve_id_or_label(
|
|
|
|
|
user_holding_lp,
|
|
|
|
|
user_holding_lp_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
2025-12-18 11:44:38 +02:00
|
|
|
let (user_holding_a, user_holding_a_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_a)?;
|
|
|
|
|
let (user_holding_b, user_holding_b_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_b)?;
|
|
|
|
|
let (user_holding_lp, user_holding_lp_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_lp)?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
let user_holding_a: AccountId = user_holding_a.parse()?;
|
|
|
|
|
let user_holding_b: AccountId = user_holding_b.parse()?;
|
|
|
|
|
let user_holding_lp: AccountId = user_holding_lp.parse()?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
match (
|
|
|
|
|
user_holding_a_privacy,
|
|
|
|
|
user_holding_b_privacy,
|
|
|
|
|
user_holding_lp_privacy,
|
|
|
|
|
) {
|
|
|
|
|
(
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
) => {
|
2025-12-22 04:42:32 +02:00
|
|
|
Amm(wallet_core)
|
|
|
|
|
.send_new_definition(
|
2025-12-18 11:44:38 +02:00
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_b,
|
|
|
|
|
user_holding_lp,
|
|
|
|
|
balance_a,
|
|
|
|
|
balance_b,
|
|
|
|
|
)
|
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
|
|
Ok(SubcommandReturnValue::Empty)
|
|
|
|
|
}
|
|
|
|
|
_ => {
|
|
|
|
|
// ToDo: Implement after private multi-chain calls is available
|
2025-12-22 04:42:32 +02:00
|
|
|
anyhow::bail!("Only public execution allowed for Amm calls");
|
2025-12-18 11:44:38 +02:00
|
|
|
}
|
2025-12-16 14:05:34 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-04-02 09:28:33 +02:00
|
|
|
Self::SwapExactInput {
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_a,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_a_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_b,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_b_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
amount_in,
|
|
|
|
|
min_amount_out,
|
|
|
|
|
token_definition,
|
|
|
|
|
} => {
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
let user_holding_a = resolve_id_or_label(
|
|
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_a_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
|
|
|
|
let user_holding_b = resolve_id_or_label(
|
|
|
|
|
user_holding_b,
|
|
|
|
|
user_holding_b_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
2025-12-18 11:44:38 +02:00
|
|
|
let (user_holding_a, user_holding_a_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_a)?;
|
|
|
|
|
let (user_holding_b, user_holding_b_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_b)?;
|
|
|
|
|
|
|
|
|
|
let user_holding_a: AccountId = user_holding_a.parse()?;
|
|
|
|
|
let user_holding_b: AccountId = user_holding_b.parse()?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
match (user_holding_a_privacy, user_holding_b_privacy) {
|
|
|
|
|
(AccountPrivacyKind::Public, AccountPrivacyKind::Public) => {
|
2025-12-22 04:42:32 +02:00
|
|
|
Amm(wallet_core)
|
2026-04-02 09:28:33 +02:00
|
|
|
.send_swap_exact_input(
|
2025-12-18 11:44:38 +02:00
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_b,
|
|
|
|
|
amount_in,
|
|
|
|
|
min_amount_out,
|
|
|
|
|
token_definition.parse()?,
|
|
|
|
|
)
|
|
|
|
|
.await?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
Ok(SubcommandReturnValue::Empty)
|
|
|
|
|
}
|
|
|
|
|
_ => {
|
|
|
|
|
// ToDo: Implement after private multi-chain calls is available
|
2025-12-22 04:42:32 +02:00
|
|
|
anyhow::bail!("Only public execution allowed for Amm calls");
|
2025-12-18 11:44:38 +02:00
|
|
|
}
|
2025-12-16 14:05:34 +02:00
|
|
|
}
|
2026-02-25 13:11:54 +01:00
|
|
|
}
|
|
|
|
|
Self::SwapExactOutput {
|
|
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_b,
|
|
|
|
|
exact_amount_out,
|
|
|
|
|
max_amount_in,
|
|
|
|
|
token_definition,
|
|
|
|
|
} => {
|
|
|
|
|
let (user_holding_a, user_holding_a_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_a)?;
|
|
|
|
|
let (user_holding_b, user_holding_b_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_b)?;
|
|
|
|
|
|
|
|
|
|
let user_holding_a: AccountId = user_holding_a.parse()?;
|
|
|
|
|
let user_holding_b: AccountId = user_holding_b.parse()?;
|
|
|
|
|
|
|
|
|
|
match (user_holding_a_privacy, user_holding_b_privacy) {
|
|
|
|
|
(AccountPrivacyKind::Public, AccountPrivacyKind::Public) => {
|
|
|
|
|
Amm(wallet_core)
|
|
|
|
|
.send_swap_exact_output(
|
|
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_b,
|
|
|
|
|
exact_amount_out,
|
|
|
|
|
max_amount_in,
|
|
|
|
|
token_definition.parse()?,
|
|
|
|
|
)
|
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
|
|
Ok(SubcommandReturnValue::Empty)
|
|
|
|
|
}
|
|
|
|
|
_ => {
|
|
|
|
|
// ToDo: Implement after private multi-chain calls is available
|
|
|
|
|
anyhow::bail!("Only public execution allowed for Amm calls");
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-16 14:05:34 +02:00
|
|
|
}
|
2026-03-09 18:27:56 +03:00
|
|
|
Self::AddLiquidity {
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_a,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_a_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_b,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_b_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_lp,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_lp_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
min_amount_lp,
|
|
|
|
|
max_amount_a,
|
|
|
|
|
max_amount_b,
|
|
|
|
|
} => {
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
let user_holding_a = resolve_id_or_label(
|
|
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_a_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
|
|
|
|
let user_holding_b = resolve_id_or_label(
|
|
|
|
|
user_holding_b,
|
|
|
|
|
user_holding_b_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
|
|
|
|
let user_holding_lp = resolve_id_or_label(
|
|
|
|
|
user_holding_lp,
|
|
|
|
|
user_holding_lp_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
2025-12-18 11:44:38 +02:00
|
|
|
let (user_holding_a, user_holding_a_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_a)?;
|
|
|
|
|
let (user_holding_b, user_holding_b_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_b)?;
|
|
|
|
|
let (user_holding_lp, user_holding_lp_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_lp)?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
let user_holding_a: AccountId = user_holding_a.parse()?;
|
|
|
|
|
let user_holding_b: AccountId = user_holding_b.parse()?;
|
|
|
|
|
let user_holding_lp: AccountId = user_holding_lp.parse()?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
match (
|
|
|
|
|
user_holding_a_privacy,
|
|
|
|
|
user_holding_b_privacy,
|
|
|
|
|
user_holding_lp_privacy,
|
|
|
|
|
) {
|
|
|
|
|
(
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
) => {
|
2025-12-22 04:42:32 +02:00
|
|
|
Amm(wallet_core)
|
|
|
|
|
.send_add_liquidity(
|
2025-12-18 11:44:38 +02:00
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_b,
|
|
|
|
|
user_holding_lp,
|
|
|
|
|
min_amount_lp,
|
|
|
|
|
max_amount_a,
|
|
|
|
|
max_amount_b,
|
|
|
|
|
)
|
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
|
|
Ok(SubcommandReturnValue::Empty)
|
|
|
|
|
}
|
|
|
|
|
_ => {
|
|
|
|
|
// ToDo: Implement after private multi-chain calls is available
|
2025-12-22 04:42:32 +02:00
|
|
|
anyhow::bail!("Only public execution allowed for Amm calls");
|
2025-12-18 11:44:38 +02:00
|
|
|
}
|
2025-12-16 14:05:34 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-03-09 18:27:56 +03:00
|
|
|
Self::RemoveLiquidity {
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_a,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_a_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_b,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_b_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
user_holding_lp,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
user_holding_lp_label,
|
2025-12-16 14:05:34 +02:00
|
|
|
balance_lp,
|
2025-12-19 19:12:58 +02:00
|
|
|
min_amount_a,
|
|
|
|
|
min_amount_b,
|
2025-12-16 14:05:34 +02:00
|
|
|
} => {
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
let user_holding_a = resolve_id_or_label(
|
|
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_a_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
|
|
|
|
let user_holding_b = resolve_id_or_label(
|
|
|
|
|
user_holding_b,
|
|
|
|
|
user_holding_b_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
|
|
|
|
let user_holding_lp = resolve_id_or_label(
|
|
|
|
|
user_holding_lp,
|
|
|
|
|
user_holding_lp_label,
|
|
|
|
|
&wallet_core.storage.labels,
|
|
|
|
|
&wallet_core.storage.user_data,
|
2026-04-24 22:10:04 -04:00
|
|
|
&None,
|
|
|
|
|
&None,
|
feat: add --account-label as alternative to --account-id across all wallet subcommands
Allow users to identify accounts by their human-readable label instead of the
full `Privacy/base58` account ID. This makes the CLI much more ergonomic for
users who have labeled their accounts.
- [x] Add `resolve_account_label()` in `helperfunctions.rs` that looks up a label,
determines account privacy (public/private), and returns the full `Privacy/id` string
- [x] Add `--account-label` (or `--from-label`, `--to-label`, `--definition-label`,
`--holder-label`, `--user-holding-*-label`) as mutually exclusive alternative to
every `--account-id`-style flag across all subcommands:
- `account get`, `account label`
- `auth-transfer init`, `auth-transfer send`
- `token new`, `token send`, `token burn`, `token mint`
- `pinata claim`
- `amm new`, `amm swap`, `amm add-liquidity`, `amm remove-liquidity`
- [x] Update zsh completion script with `_wallet_account_labels()` helper
- [x] Add bash completion script with `_wallet_get_account_labels()` helper
1. Start a local sequencer
2. Create accounts and label them: `wallet account new public --label alice`
3. Use labels in commands: `wallet account get --account-label alice`
4. Verify mutual exclusivity: `wallet account get --account-id <id> --account-label alice` should error
5. Test shell completions: `wallet account get --account-label <TAB>` should list labels
None
None
- [x] Complete PR description
- [x] Implement the core functionality
- [ ] Add/update tests
- [x] Add/update documentation and inline comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:33:51 +11:00
|
|
|
)?;
|
2025-12-18 11:44:38 +02:00
|
|
|
let (user_holding_a, user_holding_a_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_a)?;
|
|
|
|
|
let (user_holding_b, user_holding_b_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_b)?;
|
|
|
|
|
let (user_holding_lp, user_holding_lp_privacy) =
|
|
|
|
|
parse_addr_with_privacy_prefix(&user_holding_lp)?;
|
|
|
|
|
|
|
|
|
|
let user_holding_a: AccountId = user_holding_a.parse()?;
|
|
|
|
|
let user_holding_b: AccountId = user_holding_b.parse()?;
|
|
|
|
|
let user_holding_lp: AccountId = user_holding_lp.parse()?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
match (
|
|
|
|
|
user_holding_a_privacy,
|
|
|
|
|
user_holding_b_privacy,
|
|
|
|
|
user_holding_lp_privacy,
|
|
|
|
|
) {
|
|
|
|
|
(
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
AccountPrivacyKind::Public,
|
|
|
|
|
) => {
|
2025-12-22 04:42:32 +02:00
|
|
|
Amm(wallet_core)
|
|
|
|
|
.send_remove_liquidity(
|
2025-12-18 11:44:38 +02:00
|
|
|
user_holding_a,
|
|
|
|
|
user_holding_b,
|
|
|
|
|
user_holding_lp,
|
|
|
|
|
balance_lp,
|
2025-12-19 19:12:58 +02:00
|
|
|
min_amount_a,
|
|
|
|
|
min_amount_b,
|
2025-12-18 11:44:38 +02:00
|
|
|
)
|
|
|
|
|
.await?;
|
2025-12-16 14:05:34 +02:00
|
|
|
|
2025-12-18 11:44:38 +02:00
|
|
|
Ok(SubcommandReturnValue::Empty)
|
|
|
|
|
}
|
|
|
|
|
_ => {
|
|
|
|
|
// ToDo: Implement after private multi-chain calls is available
|
2025-12-22 04:42:32 +02:00
|
|
|
anyhow::bail!("Only public execution allowed for Amm calls");
|
2025-12-18 11:44:38 +02:00
|
|
|
}
|
2025-12-16 14:05:34 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|