From 6c843149958bf7cbedf015e294f5ea75ce562000 Mon Sep 17 00:00:00 2001 From: Jetttech Date: Sun, 29 Oct 2023 13:51:41 -0500 Subject: [PATCH] fix test and default trait for `PublisherPricingPref~ --- Cargo.lock | 1 + .../src/actions/list_all_my_happs.rs | 1 + crates/holo_happ_manager/Cargo.toml | 1 + crates/holo_happ_manager/src/hha_type.rs | 29 +++++++++++++------ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18abe5b0..c7c0c4b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2150,6 +2150,7 @@ dependencies = [ "holochain_env_setup", "holochain_keystore", "holochain_types", + "holofuel_types", "hpos-config-core", "hpos_hc_connect", "rmp-serde 1.1.1", diff --git a/crates/core_app_cli/src/actions/list_all_my_happs.rs b/crates/core_app_cli/src/actions/list_all_my_happs.rs index dcd0c86f..2a31373d 100644 --- a/crates/core_app_cli/src/actions/list_all_my_happs.rs +++ b/crates/core_app_cli/src/actions/list_all_my_happs.rs @@ -3,6 +3,7 @@ use holochain_types::prelude::{ holochain_serial, ActionHashB64, AgentPubKeyB64, ExternIO, FunctionName, SerializedBytes, ZomeName, }; +use holofuel_types::fuel::Fuel; use hpos_hc_connect::{CoreAppAgent, CoreAppRoleName}; use serde::{Deserialize, Serialize}; diff --git a/crates/holo_happ_manager/Cargo.toml b/crates/holo_happ_manager/Cargo.toml index 27b0d419..32378858 100644 --- a/crates/holo_happ_manager/Cargo.toml +++ b/crates/holo_happ_manager/Cargo.toml @@ -21,6 +21,7 @@ tracing-subscriber = "0.3.17" tokio = "1.28.2" url2 = "0.0.6" hpos-config-core = { git = "https://github.com/Holo-Host/hpos-config", rev = "bfaced6044ae570bf20d4528fa9aaafcc43ddeec" } +holofuel_types = "0.5.0" [dev-dependencies] configure-holochain = { path = "../configure-holochain"} diff --git a/crates/holo_happ_manager/src/hha_type.rs b/crates/holo_happ_manager/src/hha_type.rs index c1277296..e4187ce1 100644 --- a/crates/holo_happ_manager/src/hha_type.rs +++ b/crates/holo_happ_manager/src/hha_type.rs @@ -1,4 +1,5 @@ use holochain_types::prelude::{holochain_serial, SerializedBytes}; +use holofuel_types::fuel::Fuel; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, SerializedBytes, Clone)] @@ -18,11 +19,11 @@ pub struct HappInput { #[serde(default)] pub description: String, #[serde(default)] - pub categories: Vec, // + pub categories: Vec, #[serde(default)] - pub jurisdictions: Vec, // + pub jurisdictions: Vec, #[serde(default)] - pub exclude_jurisdictions: bool, // + pub exclude_jurisdictions: bool, #[serde(default)] pub publisher_pricing_pref: PublisherPricingPref, #[serde(default)] @@ -31,22 +32,32 @@ pub struct HappInput { pub uid: Option, } +#[derive(Debug, Serialize, Deserialize, SerializedBytes, Clone)] +pub struct DnaResource { + pub hash: String, // hash of the dna, not a stored dht address + pub src_url: String, + pub nick: String, +} + #[derive(Debug, Serialize, Deserialize, SerializedBytes, Clone, Default)] pub struct LoginConfig { pub display_publisher_name: bool, pub registration_info_url: Option, } -#[derive(Debug, Serialize, Deserialize, SerializedBytes, Clone, Default)] +#[derive(Debug, Serialize, Deserialize, SerializedBytes, Clone)] pub struct PublisherPricingPref { pub cpu: Fuel, pub storage: Fuel, pub bandwidth: Fuel, } -#[derive(Debug, Serialize, Deserialize, SerializedBytes, Clone)] -pub struct DnaResource { - pub hash: String, // hash of the dna, not a stored dht address - pub src_url: String, - pub nick: String, +impl Default for PublisherPricingPref { + fn default() -> Self { + Self { + cpu: Fuel::new(0), + storage: Fuel::new(0), + bandwidth: Fuel::new(0), + } + } }