Skip to content

Commit

Permalink
feat: add console wallet detail (#6531)
Browse files Browse the repository at this point in the history
Description
---
Added console wallet detail:
- Receive tab: `Node ID` => `Node ID / Public key`
- Network tab: `Type, Public key` => `Type, Node ID, Public key`

Motivation and Context
---
To provide more useable information.

How Has This Been Tested?
---
System-level testing.

What process can a PR reviewer use to test or verify this change?
---
Code review, system-level testing.

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
hansieodendaal authored Sep 6, 2024
1 parent e29c909 commit 594e984
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl NetworkTab {
f.render_widget(block, area);

let areas = Layout::default()
.constraints([Constraint::Length(2), Constraint::Min(8)].as_ref())
.constraints([Constraint::Length(1), Constraint::Min(8)].as_ref())
.margin(1)
.split(area);

Expand All @@ -91,6 +91,7 @@ impl NetworkTab {

let mut column0_items = Vec::with_capacity(capacity);
let mut column1_items = Vec::with_capacity(capacity);
let mut column2_items = Vec::with_capacity(capacity);

let styles: HashMap<bool, Style> = [
(true, Style::default().fg(Color::White).add_modifier(Modifier::BOLD)),
Expand All @@ -107,7 +108,8 @@ impl NetworkTab {
.unwrap_or(&Style::default().fg(Color::Reset))
.to_owned();
column0_items.push(ListItem::new(Span::styled(peer_type, style)));
column1_items.push(ListItem::new(Span::styled(peer.public_key.to_string(), style)));
column1_items.push(ListItem::new(Span::styled(peer.node_id.to_string(), style)));
column2_items.push(ListItem::new(Span::styled(peer.public_key.to_string(), style)));
}

self.base_node_list_state.set_num_items(capacity);
Expand All @@ -119,8 +121,9 @@ impl NetworkTab {
.highlight_style(Style::default().add_modifier(Modifier::BOLD).fg(Color::Magenta))
.heading_style(Style::default().fg(Color::Magenta))
.max_width(MAX_WIDTH)
.add_column(Some("Type"), Some(28), column0_items)
.add_column(Some("Public Key"), Some(65), column1_items);
.add_column(Some("Type"), Some(17), column0_items)
.add_column(Some("NodeID"), Some(27), column1_items)
.add_column(Some("Public Key"), Some(65), column2_items);
column_list.render(f, areas[1], &mut base_node_list_state);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl ReceiveTab {

const ITEM_01: &str = "Tari Address interactive: ";
const ITEM_02: &str = "Tari Address one-sided: ";
const ITEM_03: &str = "Node ID: ";
const ITEM_03: &str = "Node ID / Public key: ";
const ITEM_04: &str = "Network Address: ";
const ITEM_05: &str = "Interactive emoji address: ";
const ITEM_06: &str = "One-sided emoji address: ";
Expand Down Expand Up @@ -94,6 +94,11 @@ impl ReceiveTab {
app_state.get_identity().node_id.clone(),
Style::default().fg(Color::White),
),
Span::styled(" / ", Style::default().fg(Color::White)),
Span::styled(
app_state.get_identity().public_key.clone(),
Style::default().fg(Color::White),
),
]);
let paragraph = Paragraph::new(node_id_text).block(Block::default());
f.render_widget(paragraph, details_chunks[2]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ impl AppStateInner {
.join(", "),
qr_code: image,
node_id: wallet_id.node_identity.node_id().to_string(),
public_key: wallet_id.node_identity.public_key().to_string(),
};
self.data.my_identity = identity;
self.updated = true;
Expand Down Expand Up @@ -1301,6 +1302,7 @@ impl AppStateData {
.join(", "),
qr_code: image,
node_id: wallet_identity.node_identity.node_id().to_string(),
public_key: wallet_identity.node_identity.public_key().to_string(),
};
let base_node_previous = base_node_selected.clone();

Expand Down Expand Up @@ -1354,6 +1356,7 @@ pub struct MyIdentity {
pub network_address: String,
pub qr_code: String,
pub node_id: String,
pub public_key: String,
}

#[derive(Clone, Debug)]
Expand Down

0 comments on commit 594e984

Please sign in to comment.