From 5dd850d19f0db9880257d6f4940405fb427b6da0 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Mon, 2 Sep 2024 21:45:04 +0200 Subject: [PATCH 1/5] chore: patch dependencies --- Cargo.lock | 12 ++++-------- Cargo.toml | 6 ++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44c2a68..5fb2e60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -476,8 +476,7 @@ dependencies = [ [[package]] name = "bp-wallet" version = "0.11.0-beta.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced31423a2325a666532e92c1ca7ceff986eda9f147a241ba812e5ed2fee0eaf" +source = "git+https://github.com/BP-WG/bp-wallet?branch=master#13d59a775d3928be929569a4cc7d24dd0f59c25d" dependencies = [ "amplify", "base64", @@ -1369,8 +1368,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rgb-core" version = "0.11.0-beta.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243f1dcdf028b1cbadc9ed27866619feed0608eba0c84f59b344026648312731" +source = "git+https://github.com/RGB-WG/rgb-core?branch=master#4f67584ef950a8097cc2c41f8caedb26bdd9996c" dependencies = [ "aluvm", "amplify", @@ -1410,8 +1408,7 @@ dependencies = [ [[package]] name = "rgb-invoice" version = "0.11.0-beta.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43cd206275a055440a8c496cb7b5040842d6a0e354d00df268bc635ee07b871" +source = "git+https://github.com/RGB-WG/rgb-std?branch=master#070bfcdc8135134069080a66662ea60ba7021a96" dependencies = [ "amplify", "baid64", @@ -1476,8 +1473,7 @@ dependencies = [ [[package]] name = "rgb-std" version = "0.11.0-beta.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66b8810d29c080f3ee5046bd9dda7b42ab2321e09dd914bc9a4702b4731f15c" +source = "git+https://github.com/RGB-WG/rgb-std?branch=master#070bfcdc8135134069080a66662ea60ba7021a96" dependencies = [ "aluvm", "amplify", diff --git a/Cargo.toml b/Cargo.toml index de871cc..0a4298c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,3 +100,9 @@ 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 = "master" } +rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "master" } +rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "master" } +rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "master" } From 22a4583485c205b696743222ad7fb55e10b2a1b7 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Mon, 2 Sep 2024 21:48:35 +0200 Subject: [PATCH 2/5] pay: use just single secret seal in payments --- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- src/pay.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5fb2e60..3e09587 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1111,7 +1111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -1408,7 +1408,7 @@ dependencies = [ [[package]] name = "rgb-invoice" version = "0.11.0-beta.7" -source = "git+https://github.com/RGB-WG/rgb-std?branch=master#070bfcdc8135134069080a66662ea60ba7021a96" +source = "git+https://github.com/RGB-WG/rgb-std?branch=fix/262#526c2668c41dd0386b0df2be5715cc6d70a9fa9a" dependencies = [ "amplify", "baid64", @@ -1473,7 +1473,7 @@ dependencies = [ [[package]] name = "rgb-std" version = "0.11.0-beta.7" -source = "git+https://github.com/RGB-WG/rgb-std?branch=master#070bfcdc8135134069080a66662ea60ba7021a96" +source = "git+https://github.com/RGB-WG/rgb-std?branch=fix/262#526c2668c41dd0386b0df2be5715cc6d70a9fa9a" dependencies = [ "aluvm", "amplify", diff --git a/Cargo.toml b/Cargo.toml index 0a4298c..3418c64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,5 +104,5 @@ features = ["all"] [patch.crates-io] bp-wallet = { git = "https://github.com/BP-WG/bp-wallet", branch = "master" } rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "master" } -rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "master" } -rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "master" } +rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "fix/262" } +rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "fix/262" } diff --git a/src/pay.rs b/src/pay.rs index d2d82b6..9623c94 100644 --- a/src/pay.rs +++ b/src/pay.rs @@ -308,9 +308,9 @@ where Self::Descr: DescriptorRgb pay2vout.method, Outpoint::new(witness_txid, vout), )); - (vec![], vec![seal]) + (None, vec![seal]) } - Beneficiary::BlindedSeal(seal) => (vec![XChain::Bitcoin(seal)], vec![]), + Beneficiary::BlindedSeal(seal) => (Some(XChain::Bitcoin(seal)), vec![]), }; struct FasciaResolver { From 36c932b1bd165bec1faa56160da2b7b09f717880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Tue, 3 Sep 2024 13:45:37 +0200 Subject: [PATCH 3/5] esplora indexer: detect mempool TXs --- src/indexers/esplora_blocking.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/indexers/esplora_blocking.rs b/src/indexers/esplora_blocking.rs index 2d1906c..9b25ebd 100644 --- a/src/indexers/esplora_blocking.rs +++ b/src/indexers/esplora_blocking.rs @@ -38,6 +38,9 @@ impl RgbResolver for BlockingClient { } fn resolve_pub_witness_ord(&self, txid: Txid) -> Result { + if self.tx(&txid)?.is_none() { + return Ok(WitnessOrd::Archived); + } let status = self.tx_status(&txid)?; let ord = match status .block_height @@ -46,8 +49,7 @@ impl RgbResolver for BlockingClient { Some((h, t)) => { WitnessOrd::Mined(WitnessPos::new(h, t as i64).ok_or(Error::InvalidServerData)?) } - // TODO: Figure out how to detect mempool transactions - None => WitnessOrd::Archived, + None => WitnessOrd::Tentative, }; Ok(ord) } From 2d3378593edcf1d85690583bde17e47b57402a9d Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Tue, 3 Sep 2024 21:30:53 +0200 Subject: [PATCH 4/5] cli: fix version used in printing out PSBT. Closes #239 --- cli/src/command.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cli/src/command.rs b/cli/src/command.rs index 412a04a..1412ead 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -843,21 +843,18 @@ impl Exec for RgbArgs { // TODO: Support lock time and RBFs let params = TransferParams::with(*fee, *sats); - let (psbt, _, transfer) = + let (mut psbt, _, transfer) = wallet.pay(invoice, params).map_err(|err| err.to_string())?; transfer.save_file(out_file)?; - let ver = if *v2 { PsbtVer::V2 } else { PsbtVer::V0 }; + psbt.version = if *v2 { PsbtVer::V2 } else { PsbtVer::V0 }; match psbt_file { Some(file_name) => { let mut psbt_file = File::create(file_name)?; - psbt.encode(ver, &mut psbt_file)?; + psbt.encode(psbt.version, &mut psbt_file)?; } - None => match ver { - PsbtVer::V0 => println!("{psbt}"), - PsbtVer::V2 => println!("{psbt:#}"), - }, + None => println!("{psbt}"), } } Command::Inspect { file, dir, path } => { From af4c13086a104f9ba64d0a7e013d26fd505359f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Wed, 4 Sep 2024 13:57:04 +0200 Subject: [PATCH 5/5] RgbResolver: add Send trait bound --- src/indexers/any.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indexers/any.rs b/src/indexers/any.rs index 3b5dca0..08b3b7f 100644 --- a/src/indexers/any.rs +++ b/src/indexers/any.rs @@ -34,7 +34,7 @@ use crate::{Txid, XChain}; // We need to repeat methods of `WitnessResolve` trait here to avoid making // wrappers around resolver types. TODO: Use wrappers instead -pub trait RgbResolver { +pub trait RgbResolver: Send { fn check(&self, network: Network, expected_block_hash: String) -> Result<(), String>; fn resolve_pub_witness(&self, txid: Txid) -> Result, String>; fn resolve_pub_witness_ord(&self, txid: Txid) -> Result;