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

cli: Add subcommands for address lookup tables #27123

Merged
merged 3 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions cli-output/src/cli_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2111,6 +2111,75 @@ impl fmt::Display for CliUpgradeableBuffers {
}
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct CliAddressLookupTable {
pub lookup_table_address: String,
pub authority: Option<String>,
pub deactivation_slot: u64,
pub last_extended_slot: u64,
pub addresses: Vec<String>,
}
impl QuietDisplay for CliAddressLookupTable {}
impl VerboseDisplay for CliAddressLookupTable {}
impl fmt::Display for CliAddressLookupTable {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Lookup Table Address:", &self.lookup_table_address)?;
if let Some(authority) = &self.authority {
writeln_name_value(f, "Authority:", authority)?;
} else {
writeln_name_value(f, "Authority:", "None (frozen)")?;
}
if self.deactivation_slot == u64::MAX {
writeln_name_value(f, "Deactivation Slot:", "None (still active)")?;
} else {
writeln_name_value(f, "Deactivation Slot:", &self.deactivation_slot.to_string())?;
}
if self.last_extended_slot == 0 {
writeln_name_value(f, "Last Extended Slot:", "None (empty)")?;
} else {
writeln_name_value(
f,
"Last Extended Slot:",
&self.last_extended_slot.to_string(),
)?;
}
if self.addresses.is_empty() {
writeln_name_value(f, "Address Table Entries:", "None (empty)")?;
} else {
writeln!(f, "{}", style("Address Table Entries:".to_string()).bold())?;
writeln!(f)?;
writeln!(
f,
"{}",
style(format!(" {:<5} {}", "Index", "Address")).bold()
)?;
for (index, address) in self.addresses.iter().enumerate() {
writeln!(f, " {:<5} {}", index, address)?;
}
}
Ok(())
}
}

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliAddressLookupTableCreated {
pub lookup_table_address: String,
pub signature: String,
}
impl QuietDisplay for CliAddressLookupTableCreated {}
impl VerboseDisplay for CliAddressLookupTableCreated {}
impl fmt::Display for CliAddressLookupTableCreated {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Signature:", &self.signature)?;
writeln_name_value(f, "Lookup Table Address:", &self.lookup_table_address)?;
Ok(())
}
}

#[derive(Debug, Default)]
pub struct ReturnSignersConfig {
pub dump_transaction_message: bool,
Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ serde = "1.0.143"
serde_derive = "1.0.103"
serde_json = "1.0.83"
solana-account-decoder = { path = "../account-decoder", version = "=1.12.0" }
solana-address-lookup-table-program = { path = "../programs/address-lookup-table", version = "=1.12.0" }
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "=1.12.0" }
solana-clap-utils = { path = "../clap-utils", version = "=1.12.0" }
solana-cli-config = { path = "../cli-config", version = "=1.12.0" }
Expand Down
Loading