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

Improvements and bugfixes for command-line interface #248

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c2a3a70
cli: improve short help string
dr-orlovsky Sep 7, 2024
52fa963
cli: fix stock creation
dr-orlovsky Sep 7, 2024
8693907
chore: move interfaces dependency to cli
dr-orlovsky Sep 7, 2024
d8c5fd2
resolvers: add ContractIssueResolver
dr-orlovsky Sep 7, 2024
ce1b908
cli: does not require issue command to connect to an indexer/resolver
dr-orlovsky Sep 7, 2024
22e50ec
example: improve demo contract
dr-orlovsky Sep 7, 2024
406f80a
wallet: use new history API. Remve interfaces dependency
dr-orlovsky Sep 20, 2024
419264c
cli: automatically choose interface for a contract
dr-orlovsky Sep 20, 2024
1a78901
Merge remote-tracking branch 'origin/fix/252' into develop
dr-orlovsky Sep 20, 2024
c85b0ae
cli: make iface optional in state command
dr-orlovsky Sep 20, 2024
de9587a
cli: print information about the mining status in contract state
dr-orlovsky Sep 20, 2024
e8c987f
cli: fix missed mempool feature
dr-orlovsky Sep 20, 2024
954f7f2
cli: fix displaying fungible amount with history command
dr-orlovsky Sep 20, 2024
07c1b12
wallet: distinguish spent and unspent outputs
dr-orlovsky Sep 20, 2024
b36d00f
cli: sort history
dr-orlovsky Sep 20, 2024
8e0802c
cli: improve state printout
dr-orlovsky Sep 20, 2024
da65a6d
cli: make iface optional in invoice command
dr-orlovsky Sep 22, 2024
955c52f
cli: support NFT invoicing
dr-orlovsky Sep 22, 2024
94e48de
cli: support invoicing with fractional token amounts
dr-orlovsky Sep 22, 2024
a3b2e43
wallet: add support for custom L2s
dr-orlovsky Sep 25, 2024
ba318f6
indexers: make AnyResolver thread-safe
dr-orlovsky Sep 25, 2024
94d6951
indexers: re-export errors and configs
dr-orlovsky Sep 25, 2024
479b0ed
indexers: remove Sync requirement from AnyResolver
dr-orlovsky Sep 25, 2024
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
32 changes: 4 additions & 28 deletions Cargo.lock

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

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ license = "Apache-2.0"

[workspace.dependencies]
amplify = "4.7.0"
nonasync = { version = "0.1.0", features = ["log"] }
nonasync = { version = "0.1.2", features = ["log"] }
baid64 = "0.2.2"
strict_encoding = "2.7.0"
strict_types = "2.7.0"
Expand All @@ -37,7 +37,6 @@ psbt = { version = "0.11.0-beta.8", features = ["client-side-validation"] }
bp-wallet = { version = "0.11.0-beta.8" }
rgb-std = { version = "0.11.0-beta.8" }
rgb-psbt = { version = "0.11.0-beta.8", path = "psbt" }
rgb-interfaces = "0.11.0-beta.8"
indexmap = "2.4.0"
chrono = "0.4.38"
serde_crate = { package = "serde", version = "1", features = ["derive"] }
Expand Down Expand Up @@ -103,3 +102,8 @@ serde = ["serde_crate", "serde_yaml", "bp-std/serde", "descriptors/serde", "rgb-

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

[patch.crates-io]
bp-wallet = { git = "https://github.com/BP-WG/bp-wallet", branch = "develop" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "fix/273" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "fix/rgb-252" }
3 changes: 1 addition & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ bp-std = { workspace = true, features = ["serde"] }
bp-wallet = { workspace = true, features = ["cli"] }
psbt = { workspace = true }
rgb-std = { workspace = true, features = ["serde"] }
rgb-interfaces = { workspace = true }
rgb-runtime = { version = "0.11.0-beta.7", path = "..", features = ["electrum_blocking", "esplora_blocking", "mempool_blocking", "log", "serde", "fs", "cli"] }
rgb-runtime = { version = "0.11.0-beta.8", path = "..", features = ["electrum_blocking", "esplora_blocking", "mempool_blocking", "log", "serde", "fs", "cli"] }
log = { workspace = true }
env_logger = "0.11.5"
clap = { version = "4.5.17", features = ["derive", "env"] }
Expand Down
16 changes: 12 additions & 4 deletions cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,27 @@ impl RgbArgs {
}

let provider = FsBinStore::new(stock_path.clone())?;
let mut stock = Stock::load(provider, true).map_err(WalletError::WalletPersist).or_else(|err| {
if matches!(err, WalletError::Deserialize(DeserializeError::Decode(DecodeError::Io(ref err))) if err.kind() == ErrorKind::NotFound) {
let mut stock = Stock::load(provider, true).or_else(|err| {
if err
.0
.downcast_ref::<DeserializeError>()
.map(|e| matches!(e, DeserializeError::Decode(DecodeError::Io(ref e)) if e.kind() == ErrorKind::NotFound))
.unwrap_or_default()
{
if self.verbose > 1 {
eprint!("stock file is absent, creating a new one ... ");
}
fs::create_dir_all(&stock_path)?;
let provider = FsBinStore::new(stock_path)?;
let mut stock = Stock::in_memory();
stock.make_persistent(provider, true).map_err(WalletError::StockPersist)?;
stock
.make_persistent(provider, true)
.map_err(WalletError::StockPersist)?;
return Ok(stock);
}
eprintln!("stock file is damaged, failing");
Err(err)
error!("Unable to load stock data: {err:?}");
Err(WalletError::StockPersist(err))
})?;

if self.sync {
Expand Down
Loading