Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit bc02c11

Browse files
committed
token-cli: owner-related cleanups
1 parent b93d49e commit bc02c11

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

token/cli/src/main.rs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ use bench::*;
7070
pub const OWNER_ADDRESS_ARG: ArgConstant<'static> = ArgConstant {
7171
name: "owner",
7272
long: "owner",
73-
help: "Address of the token's owner. Defaults to the client keypair address.",
73+
help: "Address of the primary authority controlling a mint or account. Defaults to the client keypair address.",
7474
};
7575

7676
pub const OWNER_KEYPAIR_ARG: ArgConstant<'static> = ArgConstant {
7777
name: "owner",
7878
long: "owner",
79-
help: "Keypair of the token's owner. Defaults to the client keypair.",
79+
help: "Keypair of the primary authority controlling a mint or account. Defaults to the client keypair.",
8080
};
8181

8282
pub const MINT_ADDRESS_ARG: ArgConstant<'static> = ArgConstant {
@@ -1348,13 +1348,8 @@ async fn command_wrap(
13481348
let lamports = sol_to_lamports(sol);
13491349
let token = native_token_client_from_config(config)?;
13501350

1351-
let account = wrapped_sol_account.unwrap_or_else(|| {
1352-
get_associated_token_address_with_program_id(
1353-
&wallet_address,
1354-
token.get_address(),
1355-
&config.program_id,
1356-
)
1357-
});
1351+
let account =
1352+
wrapped_sol_account.unwrap_or_else(|| token.get_associated_token_address(&wallet_address));
13581353

13591354
println_display(config, format!("Wrapping {} SOL into {}", sol, account));
13601355

@@ -1407,13 +1402,8 @@ async fn command_unwrap(
14071402
let use_associated_account = maybe_account.is_none();
14081403
let token = native_token_client_from_config(config)?;
14091404

1410-
let account = maybe_account.unwrap_or_else(|| {
1411-
get_associated_token_address_with_program_id(
1412-
&wallet_address,
1413-
token.get_address(),
1414-
&config.program_id,
1415-
)
1416-
});
1405+
let account =
1406+
maybe_account.unwrap_or_else(|| token.get_associated_token_address(&wallet_address));
14171407

14181408
println_display(config, format!("Unwrapping {}", account));
14191409

@@ -2805,7 +2795,8 @@ fn app<'a, 'b>(
28052795
.value_name("RECIPIENT_TOKEN_ACCOUNT_ADDRESS")
28062796
.takes_value(true)
28072797
.index(3)
2808-
.help("The token account address of recipient [default: associated token account for --owner]"),
2798+
.help("The token account address of recipient \
2799+
[default: associated token account for --mint-authority]"),
28092800
)
28102801
.arg(
28112802
Arg::with_name("mint_authority")
@@ -2953,6 +2944,7 @@ fn app<'a, 'b>(
29532944
Defaults to the client keypair."
29542945
),
29552946
)
2947+
.arg(owner_address_arg())
29562948
.arg(multisig_signer_arg())
29572949
.nonce_args(true)
29582950
.offline_args(),
@@ -3027,7 +3019,6 @@ fn app<'a, 'b>(
30273019
.help("Token of the associated account to close. \
30283020
To close a specific account, use the `--address` parameter instead"),
30293021
)
3030-
.arg(owner_address_arg())
30313022
.arg(
30323023
Arg::with_name("recipient")
30333024
.long("recipient")
@@ -3060,6 +3051,7 @@ fn app<'a, 'b>(
30603051
.help("Specify the token account to close \
30613052
[default: owner's associated token account]"),
30623053
)
3054+
.arg(owner_address_arg())
30633055
.arg(multisig_signer_arg())
30643056
.nonce_args(true)
30653057
)
@@ -3075,7 +3067,6 @@ fn app<'a, 'b>(
30753067
.required(true)
30763068
.help("Token to close"),
30773069
)
3078-
.arg(owner_address_arg())
30793070
.arg(
30803071
Arg::with_name("recipient")
30813072
.long("recipient")
@@ -3096,6 +3087,7 @@ fn app<'a, 'b>(
30963087
Defaults to the client keypair.",
30973088
),
30983089
)
3090+
.arg(owner_address_arg())
30993091
.arg(multisig_signer_arg())
31003092
.nonce_args(true)
31013093
.offline_args(),

0 commit comments

Comments
 (0)