Skip to content

Commit 490a517

Browse files
committed
[feat](ui): Displayed Contract Source Code
1 parent a36d31d commit 490a517

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/ui/home/address_info.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ pub fn render<B: Backend>(
6767
.fg(Color::White),
6868
));
6969

70+
if let Some(contract_metadata) = address_info.contract_metadata {
71+
details.push(Line::from(
72+
Span::raw(format!("{:<17}:", "CONTRACT METADATA")).fg(Color::White),
73+
));
74+
75+
let source_code = contract_metadata.items[0]
76+
.source_code()
77+
.replace("\\n", "\n");
78+
let source_code = source_code.split('\n').collect::<Vec<_>>();
79+
80+
for line in source_code {
81+
details.push(Line::from(
82+
Span::raw(format!("{:<19}{}", "", line)).fg(Color::White),
83+
));
84+
}
85+
}
86+
7087
let details = Paragraph::new(details)
7188
.block(detail_block.to_owned())
7289
.alignment(Alignment::Left)

0 commit comments

Comments
 (0)