adding status field

This commit is contained in:
aglkm
2025-07-07 12:29:48 +03:00
parent ba6ecfcc1b
commit a6cd6a5236
3 changed files with 32 additions and 14 deletions

View File

@@ -500,7 +500,16 @@ pub async fn get_output(commit: &str, output: &mut Output) -> Result<(), anyhow:
output.height = resp["result"]["Ok"][0]["block_height"].to_string();
output.commit = resp["result"]["Ok"][0]["commit"].as_str().unwrap().to_string();
output.out_type = resp["result"]["Ok"][0]["output_type"].as_str().unwrap().to_string();
output.raw_data = serde_json::to_string_pretty(&resp).unwrap()
output.raw_data = serde_json::to_string_pretty(&resp).unwrap();
let resp_status = call("get_status", "[]", "1", "owner").await?;
if resp_status != Value::Null {
let curr_height = resp_status["result"]["Ok"]["tip"]["height"].to_string();
let num_conf = curr_height.parse::<u64>().unwrap() - output.height.parse::<u64>().unwrap() + 1;
output.status = format!("{} Confirmations", num_conf.to_string());
}
}
Ok(())
@@ -546,7 +555,16 @@ pub async fn get_kernel(excess: &str, kernel: &mut Kernel) -> Result<(), anyhow:
kernel.ker_type = resp["result"]["Ok"]["tx_kernel"]["features"].as_str().unwrap().to_string();
}
kernel.raw_data = serde_json::to_string_pretty(&resp).unwrap()
kernel.raw_data = serde_json::to_string_pretty(&resp).unwrap();
let resp_status = call("get_status", "[]", "1", "owner").await?;
if resp_status != Value::Null {
let curr_height = resp_status["result"]["Ok"]["tip"]["height"].to_string();
let num_conf = curr_height.parse::<u64>().unwrap() - kernel.height.parse::<u64>().unwrap() + 1;
kernel.status = format!("{} Confirmations", num_conf.to_string());
}
}
Ok(())

View File

@@ -6,12 +6,7 @@
<div class="card border-start-0 border-end-0 rounded-0">
<div class="card-body">
<div class="d-flex justify-content-between">
<div class="darkorange-text"><i class="bi bi-card-text"></i> KERNEL</div>
{% if kernel.status == "Unconfirmed" %}
<span class="badge text-bg-warning px-2 py-2">UNCONFIRMED</span>
{% endif %}
</div>
<div class="darkorange-text"><i class="bi bi-card-text"></i> KERNEL</div>
<br>
<div class="d-flex justify-content-between">
<div class="value-text">Excess&nbsp;</div>
@@ -40,6 +35,11 @@
<div class="value-text text-end">{{ kernel.fee }}</div>
</div>
{% endif %}
<br>
<div class="d-flex justify-content-between">
<div class="value-text">Status&nbsp;</div>
<div class="value-text text-end">{{ kernel.status }}</div>
</div>
</div>
</div>

View File

@@ -6,12 +6,7 @@
<div class="card rounded-0">
<div class="card-body">
<div class="d-flex justify-content-between">
<div class="darkorange-text"><i class="bi bi-card-text"></i> OUTPUT</div>
{% if output.status == "Unconfirmed" %}
<span class="badge text-bg-warning px-2 py-2">UNCONFIRMED</span>
{% endif %}
</div>
<div class="darkorange-text"><i class="bi bi-card-text"></i> OUTPUT</div>
<br>
<div class="d-flex justify-content-between">
<div class="value-text">Commitment&nbsp;</div>
@@ -33,6 +28,11 @@
<div class="value-text">Type&nbsp;</div>
<div class="value-text text-end">{{ output.out_type }}</div>
</div>
<br>
<div class="d-flex justify-content-between">
<div class="value-text">Status&nbsp;</div>
<div class="value-text text-end">{{ output.status }}</div>
</div>
</div>
</div>