From 895d4eb92dffb74c33b3095db6523c959a043298 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 18 Feb 2025 15:16:48 +0100 Subject: [PATCH] chore: hide wallet redeem-faucet-coupon command --- CHANGELOG.md | 2 + docs/cli-reference/dfx-cycles.mdx | 59 ++++++++++++++++++++++++++---- docs/cli-reference/dfx-wallet.mdx | 55 ---------------------------- src/dfx/src/commands/wallet/mod.rs | 1 + 4 files changed, 54 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d475cc31f..c66090c8e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ ### feat: streamlined output during asset synchronization +### chore: hide `dfx wallet redeem-faucet-coupon` + ## Dependencies ### Motoko diff --git a/docs/cli-reference/dfx-cycles.mdx b/docs/cli-reference/dfx-cycles.mdx index 4cd1d58fd5..285b223bfa 100644 --- a/docs/cli-reference/dfx-cycles.mdx +++ b/docs/cli-reference/dfx-cycles.mdx @@ -14,14 +14,15 @@ dfx cycles [subcommand] [options] The following subcommands are available: -| Command | Description | -|---------------------------------------|--------------------------------------------------------------------------------------| -| [`approve`](#dfx-cycles-approve) | Approves a principal to spend cycles on your behalf. | -| [`balance`](#dfx-cycles-balance) | Prints the account balance of the user. | -| [`convert`](#dfx-cycles-convert) | Convert some of the user's ICP balance into cycles. | -| [`top-up`](#dfx-cycles-top-up) | Deposit cycles into a canister. | -| [`transfer`](#dfx-cycles-transfer) | Send cycles to another account. | -| `help` | Displays usage information message for a specified subcommand. | +| Command | Description | +|-------------------------------------------------|--------------------------------------------------------------------------------------| +| [`approve`](#dfx-cycles-approve) | Approves a principal to spend cycles on your behalf. | +| [`balance`](#dfx-cycles-balance) | Prints the account balance of the user. | +| [`convert`](#dfx-cycles-convert) | Convert some of the user's ICP balance into cycles. | +| [`redeem-faucet-coupon`](#redeem-faucet-coupon) | Redeem a code at the cycles faucet. | +| [`top-up`](#dfx-cycles-top-up) | Deposit cycles into a canister. | +| [`transfer`](#dfx-cycles-transfer) | Send cycles to another account. | +| `help` | Displays usage information message for a specified subcommand. | To view usage information for a specific subcommand, specify the subcommand and the `--help` flag. For example, to see usage information for `dfx cycles balance`, you can run the following command: @@ -200,6 +201,48 @@ Transfer from a subaccount: dfx cycles transfer raxcz-bidhr-evrzj-qyivt-nht5a-eltcc-24qfc-o6cvi-hfw7j-dcecz-kae 1000000000 --from-subaccount 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f --network ic ``` +## dfx cycles redeem-faucet-coupon + +Use the `dfx cycles redeem-faucet-coupon` command to redeem a cycles faucet coupon. +This will redeem a coupon and deposit the cycles to your cycles ledger account. + +### Basic usage +``` +dfx cycles redeem-faucet-coupon +``` + +### Arguments + +Use the following necessary argument with the `dfx cycles redeem-faucet-coupon` command. + + +|Argument |Description +----------|-------------- +|`` | The coupon code to redeem at the faucet.| + + +### Flags + +You can use the following optional flags with the `dfx cycles redeem-faucet-coupon` command. + + +|Flag |Description| +|-----|-----------| +|`--faucet`|Alternative faucet address. If not set, this uses the DFINITY faucet.| +|`--yes`|Skips yes/no checks by answering 'yes'. Not recommended outside of CI.| + +### Example + +If you have a coupon code `ABCDE-ABCDE-ABCDE`, you can redeem it like this: +``` bash +dfx cycles redeem-faucet-coupon 'ABCDE-ABCDE-ABCDE' +``` + +This will print something similar to this: +``` +Redeemed coupon ABCDE-ABCDE-ABCDE to the cycles ledger for 10 TC (trillion cycles). New balance: 10 TC. +``` + ## dfx cycles top-up Use the `dfx cycles top-up` command to send cycles from your account to a canister. diff --git a/docs/cli-reference/dfx-wallet.mdx b/docs/cli-reference/dfx-wallet.mdx index 76653f38fe..c4833fe7af 100644 --- a/docs/cli-reference/dfx-wallet.mdx +++ b/docs/cli-reference/dfx-wallet.mdx @@ -35,7 +35,6 @@ For reference information and examples that illustrate using `dfx wallet` comman |[`deauthorize`](#dfx-wallet-deauthorize) | Deauthorize a cycles wallet custodian using the custodian's principal. |`help`|Displays a usage message and the help of the given subcommand(s). |[`name`](#dfx-wallet-name) |Returns the name of the cycles wallet if you've used the `dfx wallet set-name` command. -|[`redeem-faucet-coupon`](#redeem-faucet-coupon) | Redeem a code at the cycles faucet. | |[`remove-controller`](#dfx-wallet-remove-controller) |Removes a specified controller from the selected identity's cycles wallet. |[`send`](#dfx-wallet-send) |Sends a specified amount of cycles from the selected identity's cycles wallet to another canister. |[`set-name`](#dfx-wallet-set-name) |Specify a name for your cycles wallet. @@ -320,60 +319,6 @@ If you have named your cycles wallet "Terrances_wallet", then the command would Terrances_wallet ``` -## dfx wallet redeem-faucet-coupon - -Use the `dfx wallet redeem-faucet-coupon` command to redeem a cycles faucet coupon. -If you have no wallet set, this will create a wallet for you. -If you have a wallet set already, this will add the coupon's cycles to your existing wallet. - -### Basic usage -``` -dfx wallet redeem-faucet-coupon -``` - -### Arguments - -Use the following necessary argument with the `dfx wallet redeem-faucet-coupon` command. - - -|Argument |Description -----------|-------------- -|`` | The coupon code to redeem at the faucet.| - - -### Flags - -You can use the following optional flags with the `dfx wallet redeem-faucet-coupon` command. - - -|Flag |Description| -|-----|-----------| -|`--faucet`|Alternative faucet address. If not set, this uses the DFINITY faucet.| -|`--yes`|Skips yes/no checks by answering 'yes'. Not recommended outside of CI.| - -### Example - -If you have no wallet yet and a coupon code `ABCDE-ABCDE-ABCDE`, you can redeem it like this: -``` bash -dfx wallet redeem-faucet-coupon 'ABCDE-ABCDE-ABCDE' -``` - -This will print something similar to this: -``` -Redeemed coupon ABCDE-ABCDE-ABCDE for a new wallet: rdmx6-jaaaa-aaaaa-aaadq-cai -New wallet set. -``` - -If you have a wallet already and a coupon code `ABCDE-ABCDE-ABCDE`, you can redeem it like this: -``` bash -dfx wallet redeem-faucet-coupon 'ABCDE-ABCDE-ABCDE' -``` - -This will print something similar to this: -``` -Redeemed coupon code ABCDE-ABCDE-ABCDE for 20.000 TC (trillion cycles). -``` - ## dfx wallet remove-controller Use the `dfx wallet remove-controller` command to remove a controller of your selected identity's cycles wallet. diff --git a/src/dfx/src/commands/wallet/mod.rs b/src/dfx/src/commands/wallet/mod.rs index 8b179faeef..8ce04faa7a 100644 --- a/src/dfx/src/commands/wallet/mod.rs +++ b/src/dfx/src/commands/wallet/mod.rs @@ -68,6 +68,7 @@ pub fn exec(env: &dyn Environment, opts: WalletOpts) -> DfxResult { SubCommand::Custodians(v) => custodians::exec(&agent_env, v).await, SubCommand::Deauthorize(v) => deauthorize::exec(&agent_env, v).await, SubCommand::Name(v) => name::exec(&agent_env, v).await, + #[command(hide = true)] SubCommand::RedeemFaucetCoupon(v) => redeem_faucet_coupon::exec(&agent_env, v).await, SubCommand::RemoveController(v) => remove_controller::exec(&agent_env, v).await, SubCommand::Send(v) => send::exec(&agent_env, v).await,