Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
DougAnderson444 committed Feb 13, 2024
1 parent 3b990d9 commit e3ed18b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 5 additions & 1 deletion crates/delano-wit-ui/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,14 @@ impl State {

/// Publish the proof to the network by emiting a serialized message of the Key and Provables
pub(crate) fn publish_proof(self) -> Self {
println!("Publishing proof");
// TODO: Handle failures better
let Some(Loaded::Proof(ref provables)) = self.proof else {
println!("No proof to publish");
return self;
};
let Ok(issuer_key) = wallet::actions::issuer_public() else {
println!("Issuer public key failed");
return self;
};
// Emit key-value pair.
Expand All @@ -220,6 +223,7 @@ impl State {

let message_data = Context::Message(base64_publishables.to_string());
let message = serde_json::to_string(&message_data).unwrap_or_default();
println!("Publishing: {}", message);
wurbo_in::emit(&message);
self
}
Expand All @@ -243,7 +247,7 @@ impl StructObject for State {
Ok(urlsafe_proof) => Some(Value::from(urlsafe_proof)),
Err(e) => Some(Value::from(e.to_string())),
},
None => Some(Value::from("No proof generated")),
None => Some(Value::from("Click to generate a proof.")),
},
"history" => Some(Value::from_serializable(&self.history.clone())),
_ => None,
Expand Down
1 change: 1 addition & 0 deletions crates/delano-wit-ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ impl From<&context_types::Context> for StructContext {
.with_target(OUTPUT_HTML.to_string())
}
context_types::Context::Publishproof => {
println!("Publishing proof handler");
// emit publish event
StructContext::from(api::State::from_latest().publish_proof())
.with_target(OUTPUT_HTML.to_string())
Expand Down
6 changes: 1 addition & 5 deletions crates/delano-wit-ui/src/templates/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
{% if state.proof|length < 150 %}
<div class="">{{state.proof}}</div>
{% else %}
<a
href="/#{{state.proof}}"
target="_blank"
class="underline text-blue-500"
>
<a href="/#{{state.proof}}" target="_blank" class="">
<button
class="shadow bg-blue-500 rounded p-2 text-white font-semibold"
>
Expand Down

0 comments on commit e3ed18b

Please sign in to comment.