Skip to content

Commit

Permalink
Chew glass and use his fork of anchor gen for enum (#58)
Browse files Browse the repository at this point in the history
anchor-gen proper does not support enum with nested field definitions. Use Chewingglass’ fork to get that feature
  • Loading branch information
madninja authored Nov 14, 2024
1 parent a7e694d commit 3036b33
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
11 changes: 11 additions & 0 deletions programs/helium-entity-manager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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,
}
}
}
6 changes: 6 additions & 0 deletions programs/helium-sub-daos/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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 }
}
}
7 changes: 7 additions & 0 deletions programs/treasury-management/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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 }
}
}

0 comments on commit 3036b33

Please sign in to comment.