Skip to content

Commit

Permalink
chore(sns): Generate SNS API crate with type conversions (#2642)
Browse files Browse the repository at this point in the history
This adds an SNS Governance API crate, in the same style as the NNS
Governance API crate, which will allow us to simplify dependency graphs
between SNS canisters.

---------

Co-authored-by: IDX GitHub Automation <[email protected]>
  • Loading branch information
max-dfinity and IDX GitHub Automation authored Nov 16, 2024
1 parent 3397eb8 commit 80b90f2
Show file tree
Hide file tree
Showing 10 changed files with 7,823 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rs/sns/governance/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ DEPENDENCIES = [
"//rs/rust_canisters/canister_log",
"//rs/rust_canisters/canister_profiler",
"//rs/rust_canisters/http_types",
"//rs/sns/governance/api",
"//rs/sns/governance/proposal_criticality",
"//rs/sns/governance/proposals_amount_total_limit",
"//rs/sns/governance/token_valuation",
Expand Down
1 change: 1 addition & 0 deletions rs/sns/governance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ic-nervous-system-proto = { path = "../../nervous_system/proto" }
ic-nervous-system-root = { path = "../../nervous_system/root" }
ic-nervous-system-runtime = { path = "../../nervous_system/runtime" }
ic-nns-constants = { path = "../../nns/constants" }
ic-sns-governance-api = { path = "./api" }
ic-sns-governance-proposal-criticality = { path = "./proposal_criticality" }
ic-sns-governance-proposals-amount-total-limit = { path = "./proposals_amount_total_limit" }
ic-sns-governance-token-valuation = { path = "./token_valuation" }
Expand Down
43 changes: 43 additions & 0 deletions rs/sns/governance/api/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
load("@rules_rust//rust:defs.bzl", "rust_library")

package(default_visibility = ["//visibility:public"])

# See rs/nervous_system/feature_test.md
DEPENDENCIES = [
# Keep sorted.
"//rs/ledger_suite/icp:icp_ledger",
"//rs/nervous_system/proto",
"//rs/protobuf",
"//rs/types/base_types",
"//rs/types/types",
"//rs/utils",
"@crate_index//:bytes",
"@crate_index//:candid",
"@crate_index//:clap",
"@crate_index//:comparable",
"@crate_index//:itertools",
"@crate_index//:prost",
"@crate_index//:serde",
"@crate_index//:serde_bytes",
"@crate_index//:strum",
]

MACRO_DEPENDENCIES = [
# Keep sorted.
"@crate_index//:strum_macros",
]

ALIASES = {}

rust_library(
name = "api",
srcs = glob(
["src/**/*.rs"],
exclude = ["**/*tests.rs"],
),
aliases = ALIASES,
crate_name = "ic_sns_governance_api",
proc_macro_deps = MACRO_DEPENDENCIES,
version = "0.9.0",
deps = DEPENDENCIES,
)
30 changes: 30 additions & 0 deletions rs/sns/governance/api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "ic-sns-governance-api"
version.workspace = true
authors.workspace = true
edition.workspace = true
description.workspace = true
documentation.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
path = "src/lib.rs"

[dependencies]
bytes = { workspace = true }
candid = { workspace = true }
clap = { workspace = true }
comparable = { version = "0.5", features = ["derive"] }
ic-base-types = { path = "../../../types/base_types" }
ic-nervous-system-proto = { path = "../../../nervous_system/proto" }
ic-nns-common = { path = "../../../nns/common" }
ic-protobuf = { path = "../../../protobuf" }
ic-types = { path = "../../../types/types" }
ic-utils = { path = "../../../utils" }
icp-ledger = { path = "../../../ledger_suite/icp" }
itertools = { workspace = true }
prost = { workspace = true }
serde = { workspace = true }
serde_bytes = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
Loading

0 comments on commit 80b90f2

Please sign in to comment.