Skip to content

Commit c25039c

Browse files
[token-cli] Add support for confidential mint burn extension (Initialize, Mint, Burn, ApplyPendingBurn) (#1244)
* add confidential mint burn support in token-cli * address review comments * update `get_mint_info` to take in `confidential_mint_burn` parameter * fix a bad merge * cargo fmt
1 parent 08acc4d commit c25039c

6 files changed

Lines changed: 636 additions & 28 deletions

File tree

clients/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ solana-logger = "3.0.0"
3030
solana-remote-wallet = { version = "3.1.0", features = ["agave-unstable-api"] }
3131
solana-sdk = "3.0.0"
3232
solana-system-interface = "3.2.0"
33-
solana-zk-sdk = "7.0.1"
3433
solana-zk-elgamal-proof-interface = "0.1.3"
34+
solana-zk-sdk = "7.0.1"
3535
solana-zk-sdk-pod = "0.1.2"
3636
spl-associated-token-account-interface = { version = "2.0.0" }
3737
spl-memo-interface = "2.1.0"

clients/cli/src/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ async fn command_deposit_into_or_withdraw_from(
247247
println!("Scanning accounts...");
248248
let program_id = get_valid_mint_program_id(rpc_client, token).await?;
249249

250-
let mint_info = config.get_mint_info(token, None).await?;
250+
let mint_info = config.get_mint_info(token, None, None).await?;
251251
let from_or_to = from_or_to
252252
.unwrap_or_else(|| get_associated_token_address_with_program_id(owner, token, &program_id));
253253
config.check_account(&from_or_to, Some(*token)).await?;

clients/cli/src/clap_app.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ pub enum CommandName {
167167
DepositConfidentialTokens,
168168
WithdrawConfidentialTokens,
169169
ApplyPendingBalance,
170+
ApplyPendingBurn,
170171
UpdateGroupAddress,
171172
UpdateMemberAddress,
172173
UpdateUiAmountMultiplier,
@@ -943,6 +944,16 @@ pub fn app<'a>(
943944
.conflicts_with("enable_permissioned_burn")
944945
.help("Specify a permissioned burn authority for the mint. Defaults to the mint authority.")
945946
)
947+
.arg(
948+
Arg::with_name("enable_confidential_mint_burn")
949+
.long("enable-confidential-mint-burn")
950+
.takes_value(false)
951+
.requires("enable_confidential_transfers")
952+
.help(
953+
"Enable the confidential mint and burn extension. \
954+
Requires confidential transfers to be enabled."
955+
),
956+
)
946957
.arg(multisig_signer_arg())
947958
.nonce_args(true)
948959
.arg(memo_arg())
@@ -1552,6 +1563,13 @@ pub fn app<'a>(
15521563
This may be a keypair file or the ASK keyword."
15531564
),
15541565
)
1566+
.arg(
1567+
Arg::with_name("confidential")
1568+
.long("confidential")
1569+
.takes_value(false)
1570+
.help("Burn tokens confidentially. Required for \
1571+
offline signing on confidential mints."),
1572+
)
15551573
.arg(multisig_signer_arg())
15561574
.mint_args()
15571575
.nonce_args(true)
@@ -1611,6 +1629,13 @@ pub fn app<'a>(
16111629
Defaults to the client keypair."
16121630
),
16131631
)
1632+
.arg(
1633+
Arg::with_name("confidential")
1634+
.long("confidential")
1635+
.takes_value(false)
1636+
.help("Mint tokens confidentially. Required for \
1637+
offline signing on confidential mints."),
1638+
)
16141639
.arg(mint_decimals_arg())
16151640
.arg(multisig_signer_arg())
16161641
.nonce_args(true)
@@ -2805,6 +2830,29 @@ pub fn app<'a>(
28052830
.arg(multisig_signer_arg())
28062831
.nonce_args(true)
28072832
)
2833+
.subcommand(
2834+
SubCommand::with_name(CommandName::ApplyPendingBurn.into())
2835+
.about("Apply pending burn amount to the confidential supply")
2836+
.arg(
2837+
Arg::with_name("token")
2838+
.validator(|s| is_valid_pubkey(s))
2839+
.value_name("TOKEN_MINT_ADDRESS")
2840+
.takes_value(true)
2841+
.index(1)
2842+
.required(true)
2843+
.help("The token mint address"),
2844+
)
2845+
.arg(
2846+
owner_keypair_arg_with_value_name("MINT_AUTHORITY_KEYPAIR")
2847+
.help(
2848+
"Specify the mint authority keypair. \
2849+
This may be a keypair file or the ASK keyword. \
2850+
Defaults to the client keypair."
2851+
)
2852+
)
2853+
.arg(multisig_signer_arg())
2854+
.nonce_args(true)
2855+
)
28082856
.subcommand(
28092857
SubCommand::with_name(CommandName::UpdateUiAmountMultiplier.into())
28102858
.about("Update UI multiplier")

0 commit comments

Comments
 (0)