cli: add command to dump the upgradeable program to a file (#15029)
This commit is contained in:
@ -1533,55 +1533,28 @@ impl fmt::Display for CliProgramAuthority {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CliUpgradeableProgram {
|
||||
pub program_id: String,
|
||||
pub program_executable: bool,
|
||||
pub program_lamports: u64,
|
||||
pub programdata_address: String,
|
||||
pub programdata_lamports: u64,
|
||||
pub programdata_authority: String,
|
||||
pub programdata_slot: u64,
|
||||
pub programdata_data_len: usize,
|
||||
pub programdata_program_len: usize,
|
||||
pub use_lamports_unit: bool,
|
||||
pub authority: String,
|
||||
pub last_upgrade_slot: u64,
|
||||
pub program_len: usize,
|
||||
}
|
||||
impl QuietDisplay for CliUpgradeableProgram {}
|
||||
impl VerboseDisplay for CliUpgradeableProgram {}
|
||||
impl fmt::Display for CliUpgradeableProgram {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
writeln!(f)?;
|
||||
writeln_name_value(f, "Program Address:", &self.program_id)?;
|
||||
writeln_name_value(f, " Executable:", &self.program_executable.to_string())?;
|
||||
writeln_name_value(f, "Program Id:", &self.program_id)?;
|
||||
writeln_name_value(f, "ProgramData Address:", &self.programdata_address)?;
|
||||
writeln_name_value(f, "Authority:", &self.authority)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Balance:",
|
||||
&build_balance_message(self.program_lamports, self.use_lamports_unit, true),
|
||||
)?;
|
||||
writeln_name_value(f, " ProgramData Address:", &self.programdata_address)?;
|
||||
writeln_name_value(f, " Authority:", &self.programdata_authority)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Balance:",
|
||||
&build_balance_message(self.programdata_lamports, self.use_lamports_unit, true),
|
||||
"Last Upgraded In Slot:",
|
||||
&self.last_upgrade_slot.to_string(),
|
||||
)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Total Length:",
|
||||
&format!(
|
||||
"{:?} ({:#x?}) bytes",
|
||||
self.programdata_data_len, self.programdata_data_len
|
||||
),
|
||||
)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Program Length:",
|
||||
&format!(
|
||||
"{:?} ({:#x?}) bytes",
|
||||
self.programdata_program_len, self.programdata_program_len
|
||||
),
|
||||
)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Last Upgraded In Slot:",
|
||||
&self.programdata_slot.to_string(),
|
||||
"Program Length:",
|
||||
&format!("{:?} ({:#x?}) bytes", self.program_len, self.program_len),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
@ -1591,11 +1564,8 @@ impl fmt::Display for CliUpgradeableProgram {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CliUpgradeableBuffer {
|
||||
pub address: String,
|
||||
pub lamports: u64,
|
||||
pub authority: String,
|
||||
pub data_len: usize,
|
||||
pub program_len: usize,
|
||||
pub use_lamports_unit: bool,
|
||||
}
|
||||
impl QuietDisplay for CliUpgradeableBuffer {}
|
||||
impl VerboseDisplay for CliUpgradeableBuffer {}
|
||||
@ -1603,20 +1573,10 @@ impl fmt::Display for CliUpgradeableBuffer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
writeln!(f)?;
|
||||
writeln_name_value(f, "Buffer Address:", &self.address)?;
|
||||
writeln_name_value(f, " Authority:", &self.authority)?;
|
||||
writeln_name_value(f, "Authority:", &self.authority)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Balance:",
|
||||
&build_balance_message(self.lamports, self.use_lamports_unit, true),
|
||||
)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Total Length:",
|
||||
&format!("{:?} ({:#x?}) bytes", self.data_len, self.data_len),
|
||||
)?;
|
||||
writeln_name_value(
|
||||
f,
|
||||
" Program Length:",
|
||||
"Program Length:",
|
||||
&format!("{:?} ({:#x?}) bytes", self.program_len, self.program_len),
|
||||
)?;
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user