From f0b0c3279357bf214099ed062fb149db12d78ae1 Mon Sep 17 00:00:00 2001 From: Marc Nijdam Date: Mon, 11 Nov 2024 17:00:18 -0800 Subject: [PATCH] Chew glass and use his fork of anchor gen for enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit anchor-gen proper does not support enum with nested field definitions. Use Chewingglass’ fork to get that feature --- Cargo.toml | 4 ++-- programs/helium-entity-manager/src/lib.rs | 11 +++++++++++ programs/helium-sub-daos/src/lib.rs | 6 ++++++ programs/treasury-management/src/lib.rs | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4f5be0e..58eb62d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,8 @@ members = [ ] [workspace.dependencies] -anchor-gen = "0" -anchor-lang = "=0.29" +anchor-lang= "=0.29" +anchor-gen = { git = "https://github.com/ChewingGlass/anchor-gen.git", branch = "master" } [dependencies] anchor-gen = { workspace = true } diff --git a/programs/helium-entity-manager/src/lib.rs b/programs/helium-entity-manager/src/lib.rs index f5e5bdf..6fea333 100644 --- a/programs/helium-entity-manager/src/lib.rs +++ b/programs/helium-entity-manager/src/lib.rs @@ -1,2 +1,13 @@ anchor_gen::generate_cpi_crate!("../../idl/helium_entity_manager.json"); declare_id!("hemjuPXBpNvggtaUnN1MwT3wrdhttKEfosTcc2P9Pg8"); + +impl Default for ConfigSettingsV0 { + fn default() -> Self { + ConfigSettingsV0::IotConfig { + min_gain: 0, + max_gain: 10000000, + full_location_staking_fee: 0, + dataonly_location_staking_fee: 0, + } + } +} diff --git a/programs/helium-sub-daos/src/lib.rs b/programs/helium-sub-daos/src/lib.rs index 81759d0..eb212b4 100644 --- a/programs/helium-sub-daos/src/lib.rs +++ b/programs/helium-sub-daos/src/lib.rs @@ -1,2 +1,8 @@ anchor_gen::generate_cpi_crate!("../../idl/helium_sub_daos.json"); declare_id!("hdaoVTCqhfHHo75XdAMxBKdUqvq1i5bF23sisBqVgGR"); + +impl Default for Curve { + fn default() -> Self { + Curve::ExponentialCurveV0 { k: 1 } + } +} diff --git a/programs/treasury-management/src/lib.rs b/programs/treasury-management/src/lib.rs index 6e9d489..34887be 100644 --- a/programs/treasury-management/src/lib.rs +++ b/programs/treasury-management/src/lib.rs @@ -1,2 +1,9 @@ anchor_gen::generate_cpi_crate!("../../idl/treasury_management.json"); declare_id!("treaf4wWBBty3fHdyBpo35Mz84M8k3heKXmjmi9vFt5"); + +impl Default for Curve { + fn default() -> Self { + // Default: Linear + Curve::ExponentialCurveV0 { k: 1 } + } +}