Skip to content
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
47 changes: 25 additions & 22 deletions Cargo.lock

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

12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ required-features = ["cli"]
amplify = { workspace = true }
baid58 = { workspace = true }
strict_types = { workspace = true, features = ["serde"] }
commit_verify = "0.10.5"
commit_verify = { version = "0.10.5", features = ["serde"] }
bp-core = { version = "0.10.11", features = ["serde"] }
rgb-std = { workspace = true }
rgb-wallet = { workspace = true }
rgb-std = { workspace = true, features = ["serde"] }
rgb-wallet = { workspace = true, features = ["serde"] }
rgb-persist-fs = { version = "0.10.0", path = "fs" }
bitcoin = { version = "0.30.1", features = ["serde"] }
electrum-client = { version = "0.17.0", optional = true }
Expand All @@ -63,6 +63,8 @@ clap = { version = "4.1.8", features = ["derive", "env"], optional = true }
shellexpand = { version = "3.0.0", optional = true }
serde = "1.0.159"
serde_yaml = "0.9.19"
serde_json = "1.0.107"
toml = "0.8.2"

[features]
default = ["electrum", "log"]
Expand All @@ -72,3 +74,7 @@ cli = ["clap", "shellexpand", "log", "electrum"]

[package.metadata.docs.rs]
features = [ "all" ]

[patch.crates-io]
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "fix/vm-serde" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-wallet", branch = "master" }
48 changes: 24 additions & 24 deletions src/bin/rgb/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ use strict_types::StrictVal;
// TODO: For now, serde implementation doesn't work for consignments due to
// some of the keys which can't be serialized to strings. Once this fixed,
// allow this inspect formats option
/*
#[derive(ValueEnum, Copy, Clone, Eq, PartialEq, Hash, Debug, Display, Default)]
#[display(lowercase)]
pub enum InspectFormat {
Expand All @@ -54,7 +53,6 @@ pub enum InspectFormat {
Debug,
Contractum,
}
*/

#[derive(Subcommand, Clone, PartialEq, Eq, Debug, Display)]
#[display(lowercase)]
Expand Down Expand Up @@ -179,9 +177,10 @@ pub enum Command {
/// Inspects any RGB data file.
#[display("inspect")]
Inspect {
// #[clap(short, long, default_value = "yaml")]
// /// Format used for data inspection
// format: InspectFormat,
#[clap(short, long, default_value = "yaml")]
/// Format used for data inspection
format: InspectFormat,

/// RGB file to inspect.
file: PathBuf,
},
Expand Down Expand Up @@ -579,12 +578,12 @@ impl Command {
);
eprintln!("Stash data are updated.");
}
Command::Inspect { file } => {
Command::Inspect { file, format } => {
let bindle = UniversalBindle::load(file)?;
// TODO: For now, serde implementation doesn't work for consignments due to
// some of the keys which can't be serialized to strings. Once this fixed,
// allow this inspect formats option
/* let s = match format {
let s = match format {
InspectFormat::Yaml => {
serde_yaml::to_string(&bindle).expect("unable to present as YAML")
}
Expand All @@ -598,8 +597,6 @@ impl Command {
InspectFormat::Contractum => todo!("contractum representation"),
};
println!("{s}");
*/
println!("{bindle:#?}");
}
Command::Dump { root_dir } => {
fs::remove_dir_all(&root_dir).ok();
Expand All @@ -615,52 +612,55 @@ impl Command {
// Stash
for id in runtime.schema_ids()? {
fs::write(
format!("{root_dir}/stash/schemata/{id}.debug"),
format!("{:#?}", runtime.schema(id)?),
format!("{root_dir}/stash/schemata/{id}.yaml"),
serde_yaml::to_string(runtime.schema(id)?)?,
)?;
}
for (id, name) in runtime.ifaces()? {
fs::write(
format!("{root_dir}/stash/ifaces/{id}.{name}.debug"),
format!("{:#?}", runtime.iface_by_id(id)?),
format!("{root_dir}/stash/ifaces/{id}.{name}.yaml"),
serde_yaml::to_string(runtime.iface_by_id(id)?)?,
)?;
}
for id in runtime.contract_ids()? {
fs::write(
format!("{root_dir}/stash/geneses/{id}.debug"),
format!("{:#?}", runtime.genesis(id)?),
format!("{root_dir}/stash/geneses/{id}.yaml"),
serde_yaml::to_string(runtime.genesis(id)?)?,
)?;
for (no, suppl) in runtime.contract_suppl(id).into_iter().flatten().enumerate()
{
fs::write(
format!("{root_dir}/stash/geneses/{id}.suppl.{no:03}.debug"),
format!("{:#?}", suppl),
format!("{root_dir}/stash/geneses/{id}.suppl.{no:03}.yaml"),
serde_yaml::to_string(suppl)?,
)?;
}
}
for id in runtime.bundle_ids()? {
fs::write(
format!("{root_dir}/stash/bundles/{id}.debug"),
format!("{:#?}", runtime.bundle(id)?),
format!("{root_dir}/stash/bundles/{id}.yaml"),
serde_yaml::to_string(runtime.bundle(id)?)?,
)?;
}
for id in runtime.anchor_ids()? {
fs::write(
format!("{root_dir}/stash/anchors/{id}.debug"),
format!("{:#?}", runtime.anchor(id)?),
format!("{root_dir}/stash/anchors/{id}.yaml"),
serde_yaml::to_string(runtime.anchor(id)?)?,
)?;
}
for id in runtime.extension_ids()? {
fs::write(
format!("{root_dir}/stash/extensions/{id}.debug"),
format!("{:#?}", runtime.extension(id)?),
format!("{root_dir}/stash/extensions/{id}.yaml"),
serde_yaml::to_string(runtime.extension(id)?)?,
)?;
}
// TODO: Add sigs debugging

// State
for (id, history) in runtime.debug_history() {
fs::write(format!("{root_dir}/state/{id}.debug"), format!("{:#?}", history))?;
fs::write(
format!("{root_dir}/state/{id}.yaml"),
serde_yaml::to_string(history)?,
)?;
}

// Index
Expand Down