Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sui-tool] dump-packages uses GraphQL #18337

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 170 additions & 12 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ members = [
"crates/sui-open-rpc",
"crates/sui-open-rpc-macros",
"crates/sui-oracle",
"crates/sui-package-dump",
"crates/sui-package-management",
"crates/sui-package-resolver",
"crates/sui-proc-macros",
Expand Down Expand Up @@ -305,6 +306,8 @@ criterion = { version = "0.5.0", features = [
] }
crossterm = "0.25.0"
csv = "1.2.1"
cynic = { version = "3.7.3", features = ["http-reqwest"] }
cynic-codegen = "= 3.7.3"
dashmap = "5.5.3"
# datatest-stable = "0.1.2"
datatest-stable = { git = "https://github.com/nextest-rs/datatest-stable.git", rev = "72db7f6d1bbe36a5407e96b9488a581f763e106f" }
Expand Down Expand Up @@ -628,6 +631,7 @@ sui-network = { path = "crates/sui-network" }
sui-node = { path = "crates/sui-node" }
sui-open-rpc = { path = "crates/sui-open-rpc" }
sui-open-rpc-macros = { path = "crates/sui-open-rpc-macros" }
sui-package-dump = { path = "crates/sui-package-dump" }
sui-package-management = { path = "crates/sui-package-management" }
sui-package-resolver = { path = "crates/sui-package-resolver" }
sui-proc-macros = { path = "crates/sui-proc-macros" }
Expand Down
7 changes: 7 additions & 0 deletions crates/sui-graphql-rpc/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ use std::path::PathBuf;
version
)]
pub enum Command {
/// Output a TOML config (suitable for passing into the --config parameter of the start-server
/// command) with all values set to their defaults.
GenerateConfig {
/// Optional path to a file to output to. Prints to stdout if none is provided.
output: Option<PathBuf>,
},

StartServer {
/// The title to display at the top of the page
#[clap(short, long)]
Expand Down
13 changes: 13 additions & 0 deletions crates/sui-graphql-rpc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ static VERSION: Version = Version {
async fn main() {
let cmd: Command = Command::parse();
match cmd {
Command::GenerateConfig { output } => {
let config = ServiceConfig::default();
let toml = toml::to_string_pretty(&config).expect("Failed to serialize configuration");

if let Some(path) = output {
fs::write(&path, toml).unwrap_or_else(|e| {
panic!("Failed to write configuration to {}: {e}", path.display())
});
} else {
println!("{}", toml);
}
}

Command::StartServer {
ide_title,
db_url,
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-graphql-rpc/src/server/graphiql_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub async fn start_graphiql_server(
version: &Version,
cancellation_token: CancellationToken,
) -> Result<(), Error> {
info!("Starting server with config: {:?}", server_config);
info!("Starting server with config: {:#?}", server_config);
info!("Server version: {}", version);
start_graphiql_server_impl(
ServerBuilder::from_config(server_config, version, cancellation_token).await?,
Expand Down
22 changes: 22 additions & 0 deletions crates/sui-package-dump/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "sui-package-dump"
version.workspace = true
authors = ["Mysten Labs <build@mystenlabs.com"]
license = "Apache-2.0"
publish = false
edition = "2021"

[dependencies]
anyhow.workspace = true
bcs.workspace = true
cynic.workspace = true
fastcrypto.workspace = true
move-core-types.workspace = true
reqwest.workspace = true
serde.workspace = true
serde_json.workspace = true
sui-types.workspace = true
tracing.workspace = true

[build-dependencies]
cynic-codegen.workspace = true
Loading
Loading