diff --git a/CHANGELOG.md b/CHANGELOG.md index 25c7e17..db51faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - document `--program-id` default values in `--help` +- all internal modules are now `pub` to allow people to use the library ## [0.2.0] - 2023-07-30 diff --git a/solores/src/idl_format/README.md b/solores/src/idl_format/README.md index 3531942..59332b1 100644 --- a/solores/src/idl_format/README.md +++ b/solores/src/idl_format/README.md @@ -4,4 +4,4 @@ The main `IdlFormat` trait defines - how to deserialize the IDL file - how to generate rust code from the deserialized struct -Currently each IDL format is completely isolated from each other in its own folder with no common code shared between them. This allows for independent evolution of each format at the cost of (a lot of) duplicated code. Might refactor this in the future. \ No newline at end of file +Currently each IDL format is completely isolated from each other in its own folder with minimum common code shared between them. This allows for independent evolution of each format at the cost of (a lot of) duplicated code. Might refactor this in the future. \ No newline at end of file diff --git a/solores/src/idl_format/anchor/typedefs/typedef.rs b/solores/src/idl_format/anchor/typedefs/typedef.rs index 3c25962..14fbf72 100644 --- a/solores/src/idl_format/anchor/typedefs/typedef.rs +++ b/solores/src/idl_format/anchor/typedefs/typedef.rs @@ -219,9 +219,9 @@ impl ToTokens for EnumVariant { } } -const PUBKEY_TOKEN: &str = "Pubkey"; +pub const PUBKEY_TOKEN: &str = "Pubkey"; -fn primitive_or_pubkey_to_token(s: &str) -> String { +pub fn primitive_or_pubkey_to_token(s: &str) -> String { if s == "publicKey" { PUBKEY_TOKEN.to_owned() } else if s == "string" { diff --git a/solores/src/idl_format/shank/typedefs/typedef.rs b/solores/src/idl_format/shank/typedefs/typedef.rs index 22e92e3..5cf0b72 100644 --- a/solores/src/idl_format/shank/typedefs/typedef.rs +++ b/solores/src/idl_format/shank/typedefs/typedef.rs @@ -220,9 +220,9 @@ impl ToTokens for EnumVariant { } } -const PUBKEY_TOKEN: &str = "Pubkey"; +pub const PUBKEY_TOKEN: &str = "Pubkey"; -fn primitive_or_pubkey_to_token(s: &str) -> String { +pub fn primitive_or_pubkey_to_token(s: &str) -> String { if s == "publicKey" { PUBKEY_TOKEN.to_owned() } else if s == "string" { diff --git a/solores/src/lib.rs b/solores/src/lib.rs index ecabc4a..92f5c7a 100644 --- a/solores/src/lib.rs +++ b/solores/src/lib.rs @@ -12,11 +12,13 @@ use idl_format::IdlFormat; use crate::idl_format::{anchor::AnchorIdl, shank::ShankIdl}; -mod idl_format; -mod utils; -mod write_cargotoml; -mod write_gitignore; -mod write_src; +// Just make all mods pub to allow ppl to use the lib + +pub mod idl_format; +pub mod utils; +pub mod write_cargotoml; +pub mod write_gitignore; +pub mod write_src; use write_cargotoml::write_cargotoml; use write_gitignore::write_gitignore; diff --git a/solores/src/write_cargotoml.rs b/solores/src/write_cargotoml.rs index 60be350..ff486d9 100644 --- a/solores/src/write_cargotoml.rs +++ b/solores/src/write_cargotoml.rs @@ -16,7 +16,7 @@ pub fn write_cargotoml(args: &Args, idl: &dyn IdlFormat) -> std::io::Result<()> } #[derive(Serialize)] -struct CargoToml<'a> { +pub struct CargoToml<'a> { package: Package<'a>, dependencies: GeneratedCrateDependencies<'a>, } @@ -50,14 +50,14 @@ impl<'a> CargoToml<'a> { } #[derive(Serialize)] -struct Package<'a> { +pub struct Package<'a> { name: &'a str, version: &'a str, edition: &'a str, } #[derive(Serialize)] -struct GeneratedCrateDependencies<'a> { +pub struct GeneratedCrateDependencies<'a> { borsh: DependencyValue<'a>, #[serde(rename = "solana-program")] @@ -74,7 +74,7 @@ struct GeneratedCrateDependencies<'a> { num_traits: Option>, } -struct DependencyValue<'a>(&'a str); +pub struct DependencyValue<'a>(&'a str); impl Serialize for DependencyValue<'_> { fn serialize(&self, serializer: S) -> Result @@ -88,7 +88,7 @@ impl Serialize for DependencyValue<'_> { } } -struct OptionalDependencyValue<'a>(&'a str); +pub struct OptionalDependencyValue<'a>(&'a str); impl Serialize for OptionalDependencyValue<'_> { fn serialize(&self, serializer: S) -> Result