Skip to content

Commit 083d4a8

Browse files
authored
cli: Fixed --transfer-hook CLI option not allowing default Pubkey as value (#605)
* Fixed transfer-hook CLI option not allowing default Pubkey as value * review changes
1 parent 1ecf459 commit 083d4a8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ solana-sdk = "2.2.1"
3232
solana-system-interface = "1"
3333
solana-transaction-status = "2.3.4"
3434
spl-associated-token-account-client = { version = "2.0.0" }
35+
spl-pod = { version = "0.5.1" }
3536
spl-token = { version = "8.0", features = ["no-entrypoint"] }
3637
spl-token-2022 = { version = "9.0.0", path = "../../program", features = ["no-entrypoint"] }
3738
spl-token-client = { version = "0.17.0", path = "../rust-legacy" }

clients/cli/src/command.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use {
3535
},
3636
solana_system_interface::program as system_program,
3737
spl_associated_token_account_client::address::get_associated_token_address_with_program_id,
38+
spl_pod::optional_keys::OptionalNonZeroPubkey,
3839
spl_token_2022::{
3940
extension::{
4041
confidential_transfer::{
@@ -350,9 +351,12 @@ async fn command_create_token(
350351
}
351352

352353
if transfer_hook_program_id.is_some() || enable_transfer_hook {
354+
let program_id = transfer_hook_program_id
355+
.map(OptionalNonZeroPubkey)
356+
.unwrap_or_default();
353357
extensions.push(ExtensionInitializationParams::TransferHook {
354358
authority: Some(authority),
355-
program_id: transfer_hook_program_id,
359+
program_id: program_id.into(),
356360
});
357361
}
358362

0 commit comments

Comments
 (0)