Skip to content

Commit

Permalink
Merge hybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Nov 14, 2023
2 parents 91fa0fd + 2cc9d53 commit 11a708b
Show file tree
Hide file tree
Showing 21 changed files with 2,487 additions and 929 deletions.
1,314 changes: 1,115 additions & 199 deletions Cargo.lock

Large diffs are not rendered by default.

97 changes: 51 additions & 46 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
[workspace]
members = [
"cli",
"fs",
".",
"."
]
default-members = [
"cli",
"fs",
"."
]

[workspace.package]
version = "0.11.0-alpha"
keywords = ["bitcoin", "lightning", "rgb", "smart-contracts", "lnp-bp"]
categories = ["cryptography::cryptocurrencies"]
authors = ["Dr Maxim Orlovsky <orlovsky@lnp-bp.org>"]
homepage = "https://github.com/RGB-WG"
repository = "https://github.com/RGB-WG/rgb"
rust-version = "1.67" # For command-line tool it is 1.70 because of clap
homepage = "https://lnp-bp.org"
repository = "https://github.com/RGB-WG/rgb-wallet"
rust-version = "1.67" # Due to strict encoding library
edition = "2021"
license = "Apache-2.0"

Expand All @@ -21,60 +26,60 @@ amplify = "4.5.0"
baid58 = "0.4.4"
strict_encoding = "2.6.1"
strict_types = "1.6.3"
rgb-std = { version = "0.10.9", features = ["fs"] }
rgb-wallet = { version = "0.10.9", features = ["fs"] }
bp-dbc = "0.10.10"
bp-std = "0.10.0-beta.1"
bp-wallet = "0.10.0-beta.1"
bp-utils = "0.10.0-beta.1"
bp-esplora = "0.10.0-beta.1"
rgb-std = { version = "0.10.10", features = ["fs"] }
rgb-invoice = "0.10.10"
indexmap = "2.0.2"
serde_crate = { package = "serde", version = "1", features = ["derive"] }
serde_yaml = "0.9.19"
log = { version = "0.4", features = ["max_level_trace", "release_max_level_debug"] }

[package]
name = "rgb-contracts"
version = "0.10.2"
description = " RGB: scalable & confidential smart contracts for Bitcoin & Lightning network"
keywords = ["bitcoin", "lightning", "rgb", "smart-contracts", "lnp-bp"]
categories = ["cryptography::cryptocurrencies"]
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }
name = "rgb-runtime"
version.workspace = true
description = "RGB smart contracts wallet runtime"
keywords.workspace = true
categories.workspace = true
readme = "README.md"
exclude = [".github", "std"]
authors.workspace = true
homepage.workspace = true
repository.workspace = true
rust-version.workspace = true
edition.workspace = true
license.workspace = true

[lib]
name = "rgb"

[[bin]]
name = "rgb"
required-features = ["cli"]
name = "rgb_rt"

[dependencies]
amplify = { workspace = true }
baid58 = { workspace = true }
strict_types = { workspace = true, features = ["serde"] }
commit_verify = { version = "0.10.5", features = ["serde"] }
bp-core = { version = "0.10.11", features = ["serde"] }
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 }
log = { version = "0.4", features = ["max_level_trace", "release_max_level_debug"], optional = true }
env_logger = "0.10.0"
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"
strict_types = { workspace = true }
bp-dbc = { workspace = true }
bp-std = { workspace = true }
bp-wallet = { workspace = true, features = ["fs"] }
bp-esplora = { workspace = true, optional = true }
descriptors = "=0.10.0-BP-beta.1"
rgb-std = { workspace = true }
rgb-persist-fs = { version = "0.11.0-alpha", path = "fs" }
indexmap = { workspace = true }
serde_crate = { workspace = true, optional = true }
serde_yaml = { workspace = true, optional = true }
log = { workspace = true, optional = true }

[features]
default = ["electrum", "log"]
all = ["cli", "log"]
electrum = ["electrum-client", "log"]
cli = ["clap", "shellexpand", "log", "electrum"]
default = []
all = ["esplora", "serde", "log"]
esplora = ["bp-esplora", "bp-wallet/esplora"]
serde = ["serde_crate", "serde_yaml", "bp-std/serde", "bp-wallet/serde",]

[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" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "v0.10" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "hybrid" }
rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "hybrid" }
42 changes: 42 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[package]
name = "rgb-contracts"
version = { workspace = true }
description = "Command-line wallet for RGB smart contracts on Bitcoin"
keywords = { workspace = true }
categories = { workspace = true }
readme = "../README.md"
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
rust-version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }

[[bin]]
name = "rgb"
path = "src/main.rs"

[dependencies]
amplify = { workspace = true }
baid58 = { workspace = true }
strict_types = { workspace = true, features = ["serde"] }
commit_verify = "0.10.6"
bp-seals = "0.10.11"
bp-std = { workspace = true, features = ["serde"] }
bp-wallet = { workspace = true }
bp-esplora = { workspace = true }
bp-util = "0.10.0-beta.1"
rgb-std = { workspace = true, features = ["serde"] }
rgb-invoice = { workspace = true }
rgb-runtime = { version = "0.11.0-alpha", path = "..", features = ["log", "serde"] }
log = { workspace = true }
env_logger = "0.10.0"
clap = { version = "4.4.6", features = ["derive", "env"] }
shellexpand = "3.1.0"
serde_crate = { workspace = true }
serde_yaml = { workspace = true }
serde_json = "1.0.108"
toml = "0.8.2"

[features]
default = []
76 changes: 76 additions & 0 deletions cli/src/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// RGB smart contracts for Bitcoin & Lightning
//
// SPDX-License-Identifier: Apache-2.0
//
// Written in 2019-2023 by
// Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
//
// Copyright (C) 2019-2023 LNP/BP Standards Association. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use bp_util::DescriptorOpts;
use bpstd::XpubDerivable;
use rgb_rt::{DescriptorRgb, Runtime, RuntimeError, TapretKey};

use crate::Command;

#[derive(Args, Clone, PartialEq, Eq, Debug)]
pub struct DescrRgbOpts {
/// Use tapret(KEY) descriptor as wallet.
#[arg(long, global = true)]
pub tapret_key_only: Option<XpubDerivable>,
}

impl DescriptorOpts for DescrRgbOpts {
type Descr = DescriptorRgb;

fn is_some(&self) -> bool { self.tapret_key_only.is_some() }

fn descriptor(&self) -> Option<Self::Descr> {
self.tapret_key_only
.clone()
.map(TapretKey::from)
.map(TapretKey::into)
}
}

/// Command-line arguments
#[derive(Parser)]
#[derive(Wrapper, WrapperMut, Clone, Eq, PartialEq, Debug, From)]
#[wrapper(Deref)]
#[wrapper_mut(DerefMut)]
#[command(author, version, about)]
pub struct RgbArgs {
#[clap(flatten)]
#[from]
#[wrap]
pub inner: bp_util::Args<Command, DescrRgbOpts>,
}

impl Default for RgbArgs {
fn default() -> Self { unreachable!() }
}

impl RgbArgs {
pub fn rgb_runtime(&self) -> Result<Runtime, RuntimeError> {
eprint!("Loading stock ... ");
let runtime = Runtime::<DescriptorRgb>::load_pure_rgb(
self.general.data_dir.clone(),
self.general.chain,
)?;
eprintln!("success");

Ok(runtime)
}
}
Loading

0 comments on commit 11a708b

Please sign in to comment.