Skip to content

Commit

Permalink
hpos-hc-connect/hha_types: Add hha struct (#172)
Browse files Browse the repository at this point in the history
### Updates
 - Add `HappAndHost` struct.
 > NB: This is needed in the envo\y-chaperone rust tests.
  • Loading branch information
JettTech committed Nov 1, 2023
1 parent 1eb51b7 commit 32ef10c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/core_app_cli/src/actions/get_specific_happ_prefs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!("===================");
Expand Down
7 changes: 7 additions & 0 deletions crates/hpos_connect_hc/src/hha_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -32,6 +38,7 @@ pub struct HoloportDetails {
pub preferences: Option<HappPreferences>,
pub preferences_hash: Option<ActionHashB64>,
}

#[derive(Debug, Serialize, Deserialize, SerializedBytes)]
pub struct PresentedHappBundle {
pub id: ActionHashB64,
Expand Down

0 comments on commit 32ef10c

Please sign in to comment.