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

Initial work on v0.11 #100

Merged
merged 27 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9be5afc
refactor crates
dr-orlovsky Aug 1, 2023
325cf5b
refactor: include rgb-invoice crate
dr-orlovsky Aug 1, 2023
06d02c9
chore: update to resolver=2
dr-orlovsky Aug 1, 2023
82f6e1e
Merge branch 'master' into v0.11
dr-orlovsky Aug 1, 2023
f9fca92
interface: add convenience wrappers to OutpointFilter
dr-orlovsky Aug 2, 2023
4f816fe
containers: provide way for Bindles to load from in-memory data
dr-orlovsky Aug 4, 2023
5e21ad6
stl: improve CoinAmount display
dr-orlovsky Aug 4, 2023
7c4d490
move descriptor as a feature from rgb-runtime
dr-orlovsky Aug 6, 2023
8565fc3
stl: derive Hash for spec types missing it
dr-orlovsky Aug 6, 2023
78c1615
derive Hash on types missing it
dr-orlovsky Aug 6, 2023
e0df0e3
stl: implement Display for RicardianContract
dr-orlovsky Aug 6, 2023
352420b
iface: make RGB20 to return Amount in balance method
dr-orlovsky Aug 6, 2023
77a9939
descriptor: add default empty option
dr-orlovsky Aug 6, 2023
7e8f85c
stl: add convenience convertors to Precision
dr-orlovsky Aug 6, 2023
94d7dee
stl: add Amount and Precision arithmetics
dr-orlovsky Aug 7, 2023
1615823
stl: improve CoinAmount methods
dr-orlovsky Aug 7, 2023
17b9fec
chore: update to the new bp-std Keychain API
dr-orlovsky Aug 9, 2023
006ba12
descriptor: add serde serialization for descriptors
dr-orlovsky Aug 9, 2023
148d4be
descriptor: add RgbKeychain enum
dr-orlovsky Aug 9, 2023
c8a0a8f
descriptor: fix keychain display format
dr-orlovsky Aug 11, 2023
9cafedb
descriptor: add serde derivations to RgbKeychain
dr-orlovsky Aug 12, 2023
25fdeaa
descriptor: add converter functions
dr-orlovsky Aug 12, 2023
a3ec616
descriptor: impl From<K> for TapretKey
dr-orlovsky Aug 12, 2023
e50af46
iface: provide simple API to get a standard interface wrapper (Rgb20 …
dr-orlovsky Aug 15, 2023
3294d67
iface: make interface wrapper APIs more consistent
dr-orlovsky Aug 15, 2023
5898c9e
chore: update dependencies
dr-orlovsky Oct 5, 2023
69eb429
chore: update dependencies
dr-orlovsky Oct 9, 2023
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
467 changes: 219 additions & 248 deletions Cargo.lock

Large diffs are not rendered by default.

77 changes: 17 additions & 60 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[workspace]
members = [
"std",
".",
"invoice",
"stl"
]
default-members = [
"std",
"."
"invoice"
]
resolver = "2"

[workspace.package]
authors = ["Dr Maxim Orlovsky <orlovsky@lnp-bp.org>"]
Expand All @@ -17,62 +19,17 @@ edition = "2021"
license = "Apache-2.0"

[workspace.dependencies]
amplify = "4.0.1"
amplify = "4.5.0"
baid58 = "0.4.4"
strict_encoding = "2.5.0"
strict_types = "1.6.0"
commit_verify = { version = "0.10.5", features = ["stl"] }
bp-core = { version = "0.10.8", features = ["stl"] }
rgb-core = { version = "0.10.7", features = ["stl"] }

[package]
name = "rgb-wallet"
version = "0.10.7"
description = "RGB wallet library for smart contracts on 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 }
readme = "README.md"
exclude = [".github", "std"]

[lib]
name = "rgbwallet"
crate-type = ["cdylib", "rlib"] # We need this for WASM

[dependencies]
amplify = { workspace = true }
baid58 = { workspace = true }
commit_verify = { workspace = true }
strict_encoding = { workspace = true }
# descriptor-wallet = "0.10.0-alpha.1"
bp-core = { workspace = true }
rgb-core = { workspace = true }
rgb-std = { version = "0.10.7", path = "std" }
fluent-uri = "0.1.4"
indexmap = "1.9.2"
# TODO: This dependencies should be replaced with psbt package
bitcoin = "0.30.0"
chrono = "0.4.24"
percent-encoding = "2.2.0"

[features]
default = []
all = ["fs", "serde"]
serde = ["rgb-std/serde", "rgb-core/serde"]
fs = ["rgb-std/fs"]

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
rand = { version = "0.8.4", optional = true }
getrandom = { version = "0.2", features = ["js"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3"

[package.metadata.docs.rs]
features = [ "all" ]
strict_encoding = "2.6.1"
strict_types = "1.6.3"
commit_verify = { version = "0.10.6", features = ["stl"] }
bp-core = { version = "0.10.11", features = ["stl"] }
bp-std = "0.10.0-beta.1"
rgb-core = { version = "0.10.8", features = ["stl"] }
cfg_eval = "0.1.2"
serde_crate = { package = "serde", version = "1" }
serde_with = "3.1.0"

[patch.crates-io]
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "v0.10" }
39 changes: 39 additions & 0 deletions invoice/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "rgb-invoice"
version = "0.11.0-alpha"
description = "RGB smart contract invoicing library"
keywords = ["bitcoin", "invoices", "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 }
readme = "../README.md"

[lib]
name = "rgbinvoice"
crate-type = ["cdylib", "rlib"] # We need this for WASM

[dependencies]
amplify = { workspace = true }
baid58 = { workspace = true }
strict_encoding = { workspace = true }
bp-std = { workspace = true }
rgb-std = { version = "0.11.0-alpha", path = "../std" }
indexmap = "2.0.0"
fluent-uri = "0.1.4"
chrono = "0.4.24"
percent-encoding = "2.2.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
rand = { version = "0.8.4", optional = true }
getrandom = { version = "0.2", features = ["js"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3"

[package.metadata.docs.rs]
features = [ "all" ]
9 changes: 4 additions & 5 deletions src/invoice/builder.rs → invoice/src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RGB wallet library for smart contracts on Bitcoin & Lightning network
// RGB smart contract invoicing library
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -21,10 +21,9 @@

use std::str::FromStr;

use rgb::ContractId;
use rgbstd::interface::TypedState;
use rgbstd::stl::Precision;
use rgbstd::Chain;
use rgb::interface::TypedState;
use rgb::stl::Precision;
use rgb::{Chain, ContractId};

use super::{Beneficiary, RgbInvoice, RgbTransport, TransportParseError};

Expand Down
9 changes: 4 additions & 5 deletions src/invoice/invoice.rs → invoice/src/invoice.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RGB wallet library for smart contracts on Bitcoin & Lightning network
// RGB smart contract invoicing library
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -19,11 +19,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use bitcoin::Address;
use bpstd::Address;
use indexmap::IndexMap;
use rgb::{AttachId, ContractId, SecretSeal};
use rgbstd::interface::TypedState;
use rgbstd::Chain;
use rgb::interface::TypedState;
use rgb::{AttachId, Chain, ContractId, SecretSeal};
use strict_encoding::{FieldName, TypeName};

#[derive(Clone, Eq, PartialEq, Hash, Debug)]
Expand Down
7 changes: 6 additions & 1 deletion src/invoice/mod.rs → invoice/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RGB wallet library for smart contracts on Bitcoin & Lightning network
// RGB smart contract invoicing library
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -19,6 +19,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[macro_use]
extern crate amplify;
#[macro_use]
extern crate strict_encoding;

mod invoice;
mod parse;
mod builder;
Expand Down
23 changes: 10 additions & 13 deletions src/invoice/parse.rs → invoice/src/parse.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RGB wallet library for smart contracts on Bitcoin & Lightning network
// RGB smart contract invoicing library
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -23,14 +23,13 @@ use std::fmt::{self, Debug, Display, Formatter};
use std::num::ParseIntError;
use std::str::FromStr;

use bitcoin::{Address, Network};
use bp::Chain;
use bpstd::{Address, AddressNetwork};
use fluent_uri::enc::EStr;
use fluent_uri::Uri;
use indexmap::IndexMap;
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
use rgb::{ContractId, SecretSeal};
use rgbstd::interface::TypedState;
use rgb::interface::TypedState;
use rgb::{Chain, ContractId, SecretSeal};
use strict_encoding::{InvalidIdent, TypeName};

use super::{Beneficiary, RgbInvoice, RgbTransport};
Expand Down Expand Up @@ -110,8 +109,8 @@ pub enum InvoiceParseError {
Beneficiary(String),

#[display(doc_comments)]
/// network {0} is not supported.
UnsupportedNetwork(Network),
/// network {0:?} is not supported.
UnsupportedNetwork(AddressNetwork),

#[from]
Num(ParseIntError),
Expand Down Expand Up @@ -298,13 +297,11 @@ impl FromStr for RgbInvoice {
(Ok(seal), Err(_)) => Beneficiary::BlindedSeal(seal),
(Err(_), Ok(addr)) => {
chain = Some(match addr.network {
Network::Bitcoin => Chain::Bitcoin,
Network::Testnet => Chain::Testnet3,
Network::Signet => Chain::Signet,
Network::Regtest => Chain::Regtest,
unknown => return Err(InvoiceParseError::UnsupportedNetwork(unknown)),
AddressNetwork::Mainnet => Chain::Bitcoin,
AddressNetwork::Testnet => Chain::Testnet3,
AddressNetwork::Regtest => Chain::Regtest,
});
Beneficiary::WitnessUtxo(addr.assume_checked())
Beneficiary::WitnessUtxo(addr)
}
(Err(_), Err(_)) => {
return Err(InvoiceParseError::Beneficiary(beneficiary_str.to_owned()));
Expand Down
35 changes: 35 additions & 0 deletions psbt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "rgb-psbt"
version = "0.11.0-alpha"
description = "RGB smart contract invoicing library"
keywords = ["bitcoin", "invoices", "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 }
readme = "../README.md"

[lib]
name = "rgbpsbt"
crate-type = ["cdylib", "rlib"] # We need this for WASM

[dependencies]
amplify = { workspace = true }
baid58 = { workspace = true }
bp-std = { workspace = true }
psbt = "0.11.0"
rgb-std = { version = "0.11.0-alpha", path = "../std" }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
rand = { version = "0.8.4", optional = true }
getrandom = { version = "0.2", features = ["js"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3"

[package.metadata.docs.rs]
features = [ "all" ]
14 changes: 14 additions & 0 deletions psbt/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions scripts/typelib.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

cargo run --bin rgb-stl -- --sty
cargo run --bin rgb-stl -- --stl
cargo run --bin rgb-stl -- --sta
cargo run -p rgb-stl --bin rgb-stl -- --sty
cargo run -p rgb-stl --bin rgb-stl -- --stl
cargo run -p rgb-stl --bin rgb-stl -- --sta
90 changes: 0 additions & 90 deletions src/lib.rs

This file was deleted.

Loading