Skip to content

Commit

Permalink
feat: candid generator + agent crates (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncpenke authored Feb 29, 2024
1 parent d8b55a1 commit f33d90a
Show file tree
Hide file tree
Showing 32 changed files with 3,496 additions and 4 deletions.
29 changes: 26 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,57 @@
resolver = "2"

members = [
"crates/dscvr-candid-generator",
"crates/dscvr-canister-agent",
"crates/dscvr-canister-config",
"crates/dscvr-canister-exports",
"crates/dscvr-interface",
"crates/dscvr-tracing-util",
"crates/ic-canister-io",
"crates/ic-canister-logger",
"crates/ic-canister-stable-storage",
"crates/ic-identity-util",
"crates/ic-rc-principal",
"crates/instrumented-error",
]

[workspace.dependencies]
async-std = "1.12.0"
async-trait = "0.1"
# Note: Need to leave ring at 0.16 for compatibility with ic-agent
bincode = "1.3"
candid = "0.9"
candid = { git = "https://github.com/dscvr-one/candid.git", rev = "65d73d6", features = [
"parser",
] }
convert_case = "0.1"
deepsize = { git = "https://github.com/dscvr-one/deepsize.git", rev = "822ba27", features = [
"candid",
"serde_bytes",
"derive",
"std",
] }
derive_more = "0.99"
enum-iterator = "1.2.0"
flate2 = "1.0"
futures = "0.3.25"
ic-agent = { version = "0.29.0", features = ["pem"] }
ic-agent = { version = "0.25.0", features = ["pem"] }
ic-cdk = "0.11"
lazy_static = "1.4"
num-traits = "0.2.15"
ring = "0.16"
rmp-serde = "1.1"
rustc-hash = { version = "1.1" }
serde = "1.0"
serde_bytes = "0.11"
tokio = "1.0"
serde_json = "1.0"
thiserror = "1.0"
time = "0.3.17"
tokio = "1.0"
tokio-retry = "0.3"
tracing = "0.1"
tracing-error = { version = "0.2", features = ["traced-error"] }
tracing-stackdriver = "0.8"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[patch.crates-io]
candid = { git = "https://github.com/dscvr-one/candid.git", rev = "65d73d6" }
16 changes: 16 additions & 0 deletions crates/dscvr-candid-generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "dscvr-candid-generator"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
candid.workspace = true
convert_case.workspace = true
prettyplease = "0.2"
quote = "1.0"
syn = { version = "2.0", features = ["full"] }
tracing.workspace = true

instrumented-error = { path = "../instrumented-error" }
23 changes: 23 additions & 0 deletions crates/dscvr-candid-generator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! Generates clients that are complementary to those provided
//! by didc (https://github.com/dfinity/candid/tree/master/tools/didc)
pub mod rust_canister_agent;
pub mod util;

#[cfg(test)]
mod test {
use super::*;
use std::path::Path;
const DID: &str = "../../canisters/society_rs/society-common.did";
#[test]
#[ignore]
fn test_generate() {
let output_dir: std::path::PathBuf = Path::new("src").join("gen");
std::fs::create_dir_all("src/gen").unwrap();
let _ = rust_canister_agent::generate(
Path::new(DID),
&output_dir.join("dscvr_tx_log_agent.rs"),
)
.expect("Something good to happen");
}
}
Loading

0 comments on commit f33d90a

Please sign in to comment.