From e3ed18b9a56471318643a16e327359696a652a30 Mon Sep 17 00:00:00 2001 From: Doug Anderson444 Date: Tue, 13 Feb 2024 14:52:43 -0400 Subject: [PATCH] add logging --- crates/delano-wit-ui/src/api.rs | 6 +++++- crates/delano-wit-ui/src/lib.rs | 1 + crates/delano-wit-ui/src/templates/output.html | 6 +----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/delano-wit-ui/src/api.rs b/crates/delano-wit-ui/src/api.rs index 763e0a6..9194830 100644 --- a/crates/delano-wit-ui/src/api.rs +++ b/crates/delano-wit-ui/src/api.rs @@ -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. @@ -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 } @@ -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, diff --git a/crates/delano-wit-ui/src/lib.rs b/crates/delano-wit-ui/src/lib.rs index 06721c2..5f88f3c 100644 --- a/crates/delano-wit-ui/src/lib.rs +++ b/crates/delano-wit-ui/src/lib.rs @@ -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()) diff --git a/crates/delano-wit-ui/src/templates/output.html b/crates/delano-wit-ui/src/templates/output.html index d205db4..4185347 100644 --- a/crates/delano-wit-ui/src/templates/output.html +++ b/crates/delano-wit-ui/src/templates/output.html @@ -40,11 +40,7 @@ {% if state.proof|length < 150 %}
{{state.proof}}
{% else %} - +