1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use borsh::BorshDeserialize;
use colored::Colorize;
use common::program::SWAP_PROGRAM_ID;
use solana_client::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;
use tabled::object::Segment;
use tabled::style::Color;
use tabled::{Alignment, Modify, Panel, Rotate, Style, Table};
use common::command::ProcessResult;
use common::contract::state::config::ClmmConfig;
pub fn process(rpc_client: &RpcClient) -> ProcessResult {
let (config_key, _) = Pubkey::find_program_address(&[b"clmmconfig"], &SWAP_PROGRAM_ID);
let data = rpc_client.get_account_data(&config_key).unwrap();
println!("Config Key: {:?}", config_key);
let config_account: ClmmConfig = ClmmConfig::try_from_slice(&data[8..]).unwrap();
let color = Color::try_from(" ".cyan().to_string()).unwrap();
Ok(Table::new(vec![config_account])
.with(Rotate::Bottom)
.with(Rotate::Right)
.with(Style::modern())
.with(color)
.with(Panel("Config Account Info", 0))
.with(Modify::new(Segment::all()).with(Alignment::center()))
.to_string())
}