fedimint_server_ui/dashboard/
bitcoin.rs1use fedimint_core::util::SafeUrl;
2use fedimint_server_core::dashboard_ui::ServerBitcoinRpcStatus;
3use maud::{Markup, html};
4
5pub fn render(url: SafeUrl, status: &Option<ServerBitcoinRpcStatus>) -> Markup {
6 html! {
7 div class="card h-100" {
8 div class="card-header dashboard-header" { "Bitcoin Rpc Connection" }
9 div class="card-body" {
10 div class="alert alert-info mb-3" {
11 (url.to_unsafe().to_string())
12 }
13
14 @if let Some(status) = status {
15 table class="table table-sm mb-0" {
16 tbody {
17 tr {
18 th { "Network" }
19 td { (format!("{:?}", status.network)) }
20 }
21 tr {
22 th { "Block Count" }
23 td { (status.block_count) }
24 }
25 @if let Some(fee_rate) = status.fee_rate {
26 tr {
27 th { "Fee Rate" }
28 td { (format!("{} sats/vB", fee_rate.sats_per_kvb / 1000)) }
29 }
30 }
31 @if let Some(sync) = status.sync_progress {
32 tr {
33 th { "Sync Progress" }
34 td { (format!("{:.1}%", sync * 100.0)) }
35 }
36 }
37 }
38 }
39 @if let Some(sync) = status.sync_progress {
40 @if sync < 0.999 {
41 div class="alert alert-warning mt-3 mb-0" {
42 "The bitcoin backend is not fully synced yet. We need to wait for it to sync before we can participate in consensus."
43 }
44 }
45 }
46 } @else {
47 div class="alert alert-danger mb-0" {
48 "Failed to connect to bitcoin backend. Please establish a connection in order to participate in consensus."
49 }
50 }
51 }
52 }
53 }
54}