From 32ef10cf1b73f70e595a88cf89de854d1c461d1b Mon Sep 17 00:00:00 2001 From: Lisa Jetton Date: Tue, 31 Oct 2023 19:02:44 -0500 Subject: [PATCH] `hpos-hc-connect/hha_types`: Add hha struct (#172) ### Updates - Add `HappAndHost` struct. > NB: This is needed in the envo\y-chaperone rust tests. --- crates/core_app_cli/src/actions/get_specific_happ_prefs.rs | 5 ++++- crates/hpos_connect_hc/src/hha_types.rs | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/core_app_cli/src/actions/get_specific_happ_prefs.rs b/crates/core_app_cli/src/actions/get_specific_happ_prefs.rs index e3829b1..dc2bd58 100644 --- a/crates/core_app_cli/src/actions/get_specific_happ_prefs.rs +++ b/crates/core_app_cli/src/actions/get_specific_happ_prefs.rs @@ -4,7 +4,8 @@ use hpos_hc_connect::{hha_types::HappPreferences, CoreAppAgent, CoreAppRoleName} pub async fn get(pref_hash: String) -> Result<()> { let mut agent = CoreAppAgent::connect().await?; - let pref_holo_hash = ActionHashB64::from_b64_str(&pref_hash)?; + let pref_holo_hash = ActionHashB64::from_b64_str(&pref_hash) + .expect("Failed to serialize string into ActionHashB4"); let hash = ActionHash::from(pref_holo_hash); let result = agent @@ -16,6 +17,8 @@ pub async fn get(pref_hash: String) -> Result<()> { ) .await?; + println!("ZOME CALL RESULT: {:?}", result); + let prefs: HappPreferences = rmp_serde::from_slice(result.as_bytes())?; println!("==================="); diff --git a/crates/hpos_connect_hc/src/hha_types.rs b/crates/hpos_connect_hc/src/hha_types.rs index 3c640d4..e7a43f6 100644 --- a/crates/hpos_connect_hc/src/hha_types.rs +++ b/crates/hpos_connect_hc/src/hha_types.rs @@ -3,6 +3,12 @@ use holofuel_types::fuel::Fuel; use serde::{Deserialize, Serialize}; use std::time::Duration; +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct HappAndHost { + pub happ_id: ActionHashB64, + pub holoport_id: String, +} + #[derive(Debug, Serialize, Deserialize, Clone)] pub struct HappPreferences { pub max_fuel_before_invoice: Fuel, @@ -32,6 +38,7 @@ pub struct HoloportDetails { pub preferences: Option, pub preferences_hash: Option, } + #[derive(Debug, Serialize, Deserialize, SerializedBytes)] pub struct PresentedHappBundle { pub id: ActionHashB64,