diff --git a/Cargo.lock b/Cargo.lock index 2ecc34b..62f7815 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -323,8 +323,7 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "966395ea17fa99b33a9093355924b0f79312b410e2c8a85ca8ebb8333098fb9a" +source = "git+https://github.com/BP-WG/bp-core?branch=v0.11#c014bad013c99e4eb828eabc37c1c5ccc30acf75" dependencies = [ "amplify", "chrono", @@ -338,8 +337,7 @@ dependencies = [ [[package]] name = "bp-core" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27581dae64d76a00fe4015eb7d710d262192ca6f18c1e798f75c4f5477f52d3c" +source = "git+https://github.com/BP-WG/bp-core?branch=v0.11#c014bad013c99e4eb828eabc37c1c5ccc30acf75" dependencies = [ "amplify", "bp-consensus", @@ -357,8 +355,7 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4d21f5af26b145f7f73c7a338dc7bfe44d2b0f943c3ec6e3447d11d1fc3d6e0" +source = "git+https://github.com/BP-WG/bp-core?branch=v0.11#c014bad013c99e4eb828eabc37c1c5ccc30acf75" dependencies = [ "amplify", "base85", @@ -372,8 +369,7 @@ dependencies = [ [[package]] name = "bp-derive" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259436bf0c49fa1fd0648cdde09d2d9bdc183dd4d2dfb3934902ef27faa9f14d" +source = "git+https://github.com/BP-WG/bp-std?branch=v0.11#79cee6874bf037a276b08d2ad0aa0206417bb52b" dependencies = [ "amplify", "bitcoin_hashes", @@ -422,8 +418,7 @@ dependencies = [ [[package]] name = "bp-invoice" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ee0387fa924bd002b51713c42daf3cb7c3b669509523607445a99c90491788" +source = "git+https://github.com/BP-WG/bp-std?branch=v0.11#79cee6874bf037a276b08d2ad0aa0206417bb52b" dependencies = [ "amplify", "bech32", @@ -435,8 +430,7 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131f371c9d605d5ed07cb0f5b07f3f261f6b3f6a146b6e890ecdb37802c51f6a" +source = "git+https://github.com/BP-WG/bp-core?branch=v0.11#c014bad013c99e4eb828eabc37c1c5ccc30acf75" dependencies = [ "amplify", "baid58", @@ -452,8 +446,7 @@ dependencies = [ [[package]] name = "bp-std" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84413a3ce10b304ce52c7a1604fccf78634f3a27df47b239be381b76ceb1bdea" +source = "git+https://github.com/BP-WG/bp-std?branch=v0.11#79cee6874bf037a276b08d2ad0aa0206417bb52b" dependencies = [ "amplify", "bp-consensus", @@ -491,8 +484,7 @@ dependencies = [ [[package]] name = "bp-wallet" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4552e90fad2ed01b091b499b891e7a5d9e03f3c74e718e0e4801b01056fc247" +source = "git+https://github.com/BP-WG/bp-wallet?branch=v0.11#f217eb141dbb51df6f15cde351aef76c6366f53c" dependencies = [ "amplify", "bp-electrum", @@ -754,8 +746,7 @@ dependencies = [ [[package]] name = "descriptors" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08e46bb50018748f38bad98647589f2bef433faa5d8ed233c1e472c51275bd0d" +source = "git+https://github.com/BP-WG/bp-std?branch=v0.11#79cee6874bf037a276b08d2ad0aa0206417bb52b" dependencies = [ "amplify", "bp-derive", @@ -1424,8 +1415,7 @@ dependencies = [ [[package]] name = "psbt" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a572f23bb63e0826d4540a6b925f152c64a47e0871d63dc06553aa7fcd045e5a" +source = "git+https://github.com/BP-WG/bp-std?branch=v0.11#79cee6874bf037a276b08d2ad0aa0206417bb52b" dependencies = [ "amplify", "base64", @@ -1571,8 +1561,7 @@ dependencies = [ [[package]] name = "rgb-core" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377bc5d01d9b22fef51da1ab83cfc743bf29827ce11fc4a2616894282a95c6a8" +source = "git+https://github.com/RGB-WG/rgb-core?branch=asset_tags#9d193fbfc676fee6496c025f395606eea45704d6" dependencies = [ "aluvm", "amplify", @@ -1594,8 +1583,7 @@ dependencies = [ [[package]] name = "rgb-invoice" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb83cdef397b7e8d84bd46f3f61620d89436e139cbab1cb929fd1c29aae24376" +source = "git+https://github.com/RGB-WG/rgb-std?branch=asset_tags#dbf0df4d5c8457b5d298b0a69ecb0e58b04257c1" dependencies = [ "amplify", "baid58", @@ -1665,8 +1653,7 @@ dependencies = [ [[package]] name = "rgb-std" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a52e61cff03f205c5f4782bbe714d3a9a065086ec6c896ca39f3618aea5434d2" +source = "git+https://github.com/RGB-WG/rgb-std?branch=asset_tags#dbf0df4d5c8457b5d298b0a69ecb0e58b04257c1" dependencies = [ "amplify", "ascii-armor", @@ -2111,8 +2098,7 @@ dependencies = [ [[package]] name = "strict_types" version = "2.7.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c32716de4b99b0e8fb0c114e99b6929613e8d7302999c6b8c77251783923ad" +source = "git+https://github.com/strict-types/strict-types?branch=master#2350162c6a6fda6a7f74373e0a08d8e3a70c37b4" dependencies = [ "amplify", "ascii-armor", diff --git a/Cargo.toml b/Cargo.toml index f7bc07d..4115404 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,3 +94,18 @@ serde = ["serde_crate", "serde_with", "serde_yaml", "bp-std/serde", "bp-wallet/s [package.metadata.docs.rs] features = ["all"] + +[patch.crates-io] +strict_types = { git = "https://github.com/strict-types/strict-types", branch = "master" } +bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } +bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } +bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } +bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } +bp-invoice = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" } +bp-std = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" } +psbt = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" } +descriptors = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" } +bp-wallet = { git = "https://github.com/BP-WG/bp-wallet", branch = "v0.11" } +rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "asset_tags" } +rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "asset_tags" } +rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "asset_tags" } diff --git a/cli/src/command.rs b/cli/src/command.rs index 2978a31..60c63fb 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -43,7 +43,7 @@ use rgbstd::persistence::{Inventory, Stash}; use rgbstd::schema::SchemaId; use rgbstd::validation::Validity; use rgbstd::vm::RgbIsa; -use rgbstd::{AssetTag, AssignmentType, BundleId, OutputSeal, XChain, XOutputSeal}; +use rgbstd::{BundleId, OutputSeal, XChain, XOutputSeal}; use seals::txout::CloseMethod; use serde_crate::{Deserialize, Serialize}; use strict_types::encoding::{FieldName, TypeName}; @@ -784,7 +784,6 @@ impl Exec for RgbArgs { pub struct ConsignmentInspection { version: ContainerVer, transfer: bool, - asset_tags: TinyOrdMap, terminals: SmallOrdMap, supplements: TinyOrdSet, signatures: TinyOrdMap, @@ -838,7 +837,6 @@ impl Exec for RgbArgs { let contract = ConsignmentInspection { version: contract.version, transfer: contract.transfer, - asset_tags: contract.asset_tags, terminals: contract.terminals, supplements: contract.supplements, signatures: contract.signatures, @@ -890,6 +888,7 @@ impl Exec for RgbArgs { fs::create_dir_all(format!("{root_dir}/stash/ifaces"))?; fs::create_dir_all(format!("{root_dir}/stash/geneses"))?; fs::create_dir_all(format!("{root_dir}/stash/bundles"))?; + fs::create_dir_all(format!("{root_dir}/stash/witnesses"))?; fs::create_dir_all(format!("{root_dir}/stash/anchors"))?; fs::create_dir_all(format!("{root_dir}/stash/extensions"))?; fs::create_dir_all(format!("{root_dir}/state"))?; @@ -924,22 +923,21 @@ impl Exec for RgbArgs { serde_yaml::to_string(suppl)?, )?; } - let tags = runtime.contract_asset_tags(id)?; - fs::write( - format!("{root_dir}/stash/geneses/{id}.tags.yaml"), - serde_yaml::to_string(tags)?, - )?; } for id in runtime.bundle_ids()? { fs::write( format!("{root_dir}/stash/bundles/{id}.yaml"), serde_yaml::to_string(runtime.bundle(id)?)?, )?; + fs::write( + format!("{root_dir}/stash/witnesses/{id}.yaml"), + serde_yaml::to_string(&runtime.bundled_witness(id)?.pub_witness)?, + )?; } for id in runtime.witness_ids()? { fs::write( format!("{root_dir}/stash/anchors/{id}.yaml"), - serde_yaml::to_string(runtime.anchor(id)?)?, + serde_yaml::to_string(&runtime.anchor(id)?)?, )?; } for id in runtime.extension_ids()? { @@ -961,11 +959,15 @@ impl Exec for RgbArgs { // Index fs::write( format!("{root_dir}/index/op-to-bundle.yaml"), - serde_yaml::to_string(runtime.debug_bundle_op_index())?, + serde_yaml::to_string(runtime.debug_op_bundle_index())?, + )?; + fs::write( + format!("{root_dir}/index/bundle-to-contract.yaml"), + serde_yaml::to_string(runtime.debug_bundle_contract_index())?, )?; fs::write( - format!("{root_dir}/index/bundle-to-anchor.yaml"), - serde_yaml::to_string(runtime.debug_anchor_bundle_index())?, + format!("{root_dir}/index/bundle-to-witness.yaml"), + serde_yaml::to_string(runtime.debug_bundle_witness_index())?, )?; fs::write( format!("{root_dir}/index/contracts.yaml"), diff --git a/psbt/src/lib.rs b/psbt/src/lib.rs index 33547d4..bebe42f 100644 --- a/psbt/src/lib.rs +++ b/psbt/src/lib.rs @@ -29,7 +29,7 @@ use bp::dbc::tapret::TapretProof; pub use psbt::*; pub use rgb::*; use rgbstd::containers::{Batch, Fascia}; -use rgbstd::{AnchorSet, XAnchor, XChain}; +use rgbstd::{AnchorSet, XChain, XWitnessId}; pub use self::rgb::{ ProprietaryKeyRgb, RgbExt, RgbInExt, RgbOutExt, RgbPsbtError, PSBT_GLOBAL_RGB_TRANSITION, @@ -106,7 +106,8 @@ impl RgbPsbt for Psbt { let anchor = AnchorSet::from_split(tapret_anchor, opret_anchor) .expect("at least one of DBC are present due to CloseMethodSet type guarantees"); Ok(Fascia { - anchor: XAnchor::Bitcoin(anchor), + witness_id: XWitnessId::Bitcoin(self.txid()), + anchor, bundles, }) } diff --git a/src/pay.rs b/src/pay.rs index c6f8af0..e6bc2ca 100644 --- a/src/pay.rs +++ b/src/pay.rs @@ -22,7 +22,6 @@ use std::collections::{BTreeMap, BTreeSet}; use std::convert::Infallible; -use amplify::confinement::Confined; use bp::dbc::tapret::TapretProof; use bp::seals::txout::{CloseMethod, ExplicitSeal}; use bp::{Outpoint, Sats, ScriptPubkey, Vout}; @@ -35,7 +34,7 @@ use rgbstd::invoice::{Amount, Beneficiary, InvoiceState, RgbInvoice}; use rgbstd::persistence::{ ComposeError, ConsignerError, Inventory, InventoryError, Stash, StashError, }; -use rgbstd::{WitnessId, XChain}; +use rgbstd::XChain; use crate::{ ContractOutpointsFilter, DescriptorRgb, RgbKeychain, Runtime, TapTweakAlreadyAssigned, @@ -342,20 +341,9 @@ impl Runtime { }; self.stock_mut().consume(fascia)?; - let mut transfer = self + let transfer = self .stock() .transfer(contract_id, beneficiary2, beneficiary1)?; - let mut terminals = transfer.terminals.to_inner(); - for (bundle_id, terminal) in terminals.iter_mut() { - let Some(ab) = transfer.anchored_bundle(*bundle_id) else { - continue; - }; - if ab.anchor.witness_id_unchecked() == WitnessId::Bitcoin(witness_txid) { - // TODO: Use unsigned tx - terminal.witness_tx = Some(XChain::Bitcoin(psbt.to_unsigned_tx().into())); - } - } - transfer.terminals = Confined::from_collection_unsafe(terminals); Ok(transfer) } diff --git a/src/resolvers/any.rs b/src/resolvers/any.rs index 08f69d2..e3da7a8 100644 --- a/src/resolvers/any.rs +++ b/src/resolvers/any.rs @@ -22,7 +22,7 @@ use rgbstd::containers::Consignment; use rgbstd::resolvers::ResolveHeight; use rgbstd::validation::{ResolveWitness, WitnessResolverError}; -use rgbstd::{WitnessAnchor, WitnessId, XAnchor, XPubWitness}; +use rgbstd::{WitnessAnchor, XWitnessId, XWitnessTx}; #[cfg(feature = "electrum")] use crate::electrum; @@ -73,9 +73,9 @@ impl AnyResolver { pub fn add_terminals(&mut self, consignment: &Consignment) { match self { #[cfg(feature = "electrum")] - AnyResolver::Electrum(inner) => inner.add_terminals(consignment), + AnyResolver::Electrum(inner) => inner.add_witnesses(consignment), #[cfg(feature = "esplora_blocking")] - AnyResolver::Esplora(inner) => inner.add_terminals(consignment), + AnyResolver::Esplora(inner) => inner.add_witnesses(consignment), } } } @@ -83,12 +83,12 @@ impl AnyResolver { impl ResolveHeight for AnyResolver { type Error = AnyAnchorResolverError; - fn resolve_anchor(&mut self, anchor: &XAnchor) -> Result { + fn resolve_height(&mut self, witness_id: XWitnessId) -> Result { match self { #[cfg(feature = "electrum")] - AnyResolver::Electrum(inner) => inner.resolve_anchor(anchor).map_err(|e| e.into()), + AnyResolver::Electrum(inner) => inner.resolve_height(witness_id).map_err(|e| e.into()), #[cfg(feature = "esplora_blocking")] - AnyResolver::Esplora(inner) => inner.resolve_anchor(anchor).map_err(|e| e.into()), + AnyResolver::Esplora(inner) => inner.resolve_height(witness_id).map_err(|e| e.into()), } } } @@ -96,8 +96,8 @@ impl ResolveHeight for AnyResolver { impl ResolveWitness for AnyResolver { fn resolve_pub_witness( &self, - witness_id: WitnessId, - ) -> Result { + witness_id: XWitnessId, + ) -> Result { match self { #[cfg(feature = "electrum")] AnyResolver::Electrum(inner) => inner.resolve_pub_witness(witness_id), diff --git a/src/resolvers/electrum.rs b/src/resolvers/electrum.rs index f67a45e..af72748 100644 --- a/src/resolvers/electrum.rs +++ b/src/resolvers/electrum.rs @@ -27,7 +27,7 @@ use electrum::{Client, ElectrumApi, Error, Param}; use rgbstd::containers::Consignment; use rgbstd::resolvers::ResolveHeight; use rgbstd::validation::{ResolveWitness, WitnessResolverError}; -use rgbstd::{Layer1, WitnessAnchor, WitnessId, WitnessOrd, WitnessPos, XAnchor, XPubWitness}; +use rgbstd::{Layer1, WitnessAnchor, WitnessOrd, WitnessPos, XChain, XWitnessId, XWitnessTx}; pub struct Resolver { electrum_client: Client, @@ -45,9 +45,6 @@ pub enum AnchorResolverError { /// impossible conversion ImpossibleConversion, - /// invalid anchor {0} - InvalidAnchor(String), - /// unsupported layer 1 {0} UnsupportedLayer1(Layer1), } @@ -62,13 +59,17 @@ impl Resolver { }) } - pub fn add_terminals(&mut self, consignment: &Consignment) { + pub fn add_witnesses(&mut self, consignment: &Consignment) { self.terminal_txes.extend( consignment - .terminals - .values() - .filter_map(|t| t.witness_tx.as_ref().map(XPubWitness::as_reduced_unsafe)) - .map(|tx| (tx.txid(), tx.clone())), + .bundles + .iter() + .filter_map(|bw| bw.pub_witness.maybe_map_ref(|w| w.tx.clone())) + .filter_map(|tx| match tx { + XChain::Bitcoin(tx) => Some(tx), + XChain::Liquid(_) | XChain::Other(_) => None, + }) + .map(|tx| (tx.txid(), tx)), ); } } @@ -76,18 +77,15 @@ impl Resolver { impl ResolveHeight for Resolver { type Error = AnchorResolverError; - fn resolve_anchor(&mut self, anchor: &XAnchor) -> Result { - let XAnchor::Bitcoin(anchor) = anchor else { - return Err(AnchorResolverError::UnsupportedLayer1(anchor.layer1())); + fn resolve_height(&mut self, witness_id: XWitnessId) -> Result { + let XWitnessId::Bitcoin(txid) = witness_id else { + return Err(AnchorResolverError::UnsupportedLayer1(witness_id.layer1())); }; - let txid = anchor - .txid() - .ok_or(AnchorResolverError::InvalidAnchor(format!("{:#?}", anchor)))?; if self.terminal_txes.contains_key(&txid) { return Ok(WitnessAnchor { witness_ord: WitnessOrd::OffChain, - witness_id: WitnessId::Bitcoin(txid), + witness_id, }); } @@ -154,7 +152,7 @@ impl ResolveHeight for Resolver { Ok(WitnessAnchor { witness_ord, - witness_id: WitnessId::Bitcoin(txid), + witness_id, }) } } @@ -162,9 +160,9 @@ impl ResolveHeight for Resolver { impl ResolveWitness for Resolver { fn resolve_pub_witness( &self, - witness_id: WitnessId, - ) -> Result { - let WitnessId::Bitcoin(txid) = witness_id else { + witness_id: XWitnessId, + ) -> Result { + let XWitnessId::Bitcoin(txid) = witness_id else { return Err(WitnessResolverError::Other( witness_id, AnchorResolverError::UnsupportedLayer1(witness_id.layer1()).to_string(), @@ -172,7 +170,7 @@ impl ResolveWitness for Resolver { }; if let Some(tx) = self.terminal_txes.get(&txid) { - return Ok(XPubWitness::Bitcoin(tx.clone())); + return Ok(XWitnessTx::Bitcoin(tx.clone())); } match self.electrum_client.transaction_get_raw(&txid) { @@ -180,7 +178,7 @@ impl ResolveWitness for Resolver { let tx = Tx::consensus_deserialize(raw_tx).map_err(|_| { WitnessResolverError::Other(witness_id, s!("cannot deserialize raw TX")) })?; - Ok(XPubWitness::Bitcoin(tx)) + Ok(XWitnessTx::Bitcoin(tx)) } Err(e) if e.to_string() diff --git a/src/resolvers/esplora_blocking.rs b/src/resolvers/esplora_blocking.rs index 944a673..b167751 100644 --- a/src/resolvers/esplora_blocking.rs +++ b/src/resolvers/esplora_blocking.rs @@ -26,9 +26,7 @@ pub use esplora::Error as ResolverError; use rgbstd::containers::Consignment; use rgbstd::resolvers::ResolveHeight; use rgbstd::validation::{ResolveWitness, WitnessResolverError}; -use rgbstd::{ - Layer1, WitnessAnchor, WitnessId, WitnessOrd, WitnessPos, XAnchor, XChain, XPubWitness, -}; +use rgbstd::{Layer1, WitnessAnchor, WitnessOrd, WitnessPos, XChain, XWitnessId, XWitnessTx}; pub struct Resolver { esplora_client: esplora::BlockingClient, @@ -43,9 +41,6 @@ pub enum AnchorResolverError { #[display(inner)] Error(esplora::Error), - /// invalid anchor {0} - InvalidAnchor(String), - /// unsupported layer 1 {0} UnsupportedLayer1(Layer1), } @@ -60,13 +55,17 @@ impl Resolver { }) } - pub fn add_terminals(&mut self, consignment: &Consignment) { + pub fn add_witnesses(&mut self, consignment: &Consignment) { self.terminal_txes.extend( consignment - .terminals - .values() - .filter_map(|t| t.witness_tx.as_ref().map(XPubWitness::as_reduced_unsafe)) - .map(|tx| (tx.txid(), tx.clone())), + .bundles + .iter() + .filter_map(|bw| bw.pub_witness.maybe_map_ref(|w| w.tx.clone())) + .filter_map(|tx| match tx { + XChain::Bitcoin(tx) => Some(tx), + XChain::Liquid(_) | XChain::Other(_) => None, + }) + .map(|tx| (tx.txid(), tx)), ); } } @@ -74,18 +73,15 @@ impl Resolver { impl ResolveHeight for Resolver { type Error = AnchorResolverError; - fn resolve_anchor(&mut self, anchor: &XAnchor) -> Result { - let XAnchor::Bitcoin(anchor) = anchor else { - return Err(AnchorResolverError::UnsupportedLayer1(anchor.layer1())); + fn resolve_height(&mut self, witness_id: XWitnessId) -> Result { + let XWitnessId::Bitcoin(txid) = witness_id else { + return Err(AnchorResolverError::UnsupportedLayer1(witness_id.layer1())); }; - let txid = anchor - .txid() - .ok_or(AnchorResolverError::InvalidAnchor(format!("{:#?}", anchor)))?; if self.terminal_txes.contains_key(&txid) { return Ok(WitnessAnchor { witness_ord: WitnessOrd::OffChain, - witness_id: WitnessId::Bitcoin(txid), + witness_id, }); } @@ -101,7 +97,7 @@ impl ResolveHeight for Resolver { }; Ok(WitnessAnchor { witness_ord: ord, - witness_id: WitnessId::Bitcoin(txid), + witness_id, }) } } @@ -109,9 +105,9 @@ impl ResolveHeight for Resolver { impl ResolveWitness for Resolver { fn resolve_pub_witness( &self, - witness_id: WitnessId, - ) -> Result { - let WitnessId::Bitcoin(txid) = witness_id else { + witness_id: XWitnessId, + ) -> Result { + let XWitnessId::Bitcoin(txid) = witness_id else { return Err(WitnessResolverError::Other( witness_id, AnchorResolverError::UnsupportedLayer1(witness_id.layer1()).to_string(), @@ -119,7 +115,7 @@ impl ResolveWitness for Resolver { }; if let Some(tx) = self.terminal_txes.get(&txid) { - return Ok(XPubWitness::Bitcoin(tx.clone())); + return Ok(XWitnessTx::Bitcoin(tx.clone())); } self.esplora_client diff --git a/src/runtime.rs b/src/runtime.rs index ef4040e..61f814c 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -42,7 +42,7 @@ use rgbstd::persistence::{ }; use rgbstd::resolvers::ResolveHeight; use rgbstd::validation::{self, ResolveWitness}; -use rgbstd::{AssignmentWitness, ContractId, WitnessId, XChain, XOutpoint}; +use rgbstd::{AssignmentWitness, ContractId, XChain, XOutpoint, XWitnessId}; use strict_types::encoding::{DecodeError, DeserializeError, Ident, SerializeError, TypeName}; use crate::{DescriptorRgb, RgbDescr}; @@ -156,7 +156,7 @@ impl, K> WitnessFilter for Runtime { self.wallet() .transactions() .keys() - .any(|txid| AssignmentWitness::Present(WitnessId::Bitcoin(*txid)) == witness) + .any(|txid| AssignmentWitness::Present(XWitnessId::Bitcoin(*txid)) == witness) } } @@ -267,7 +267,7 @@ impl, K> Runtime { &self, contract_id: ContractId, iface_name: impl Into, - ) -> Result>, RuntimeError> { + ) -> Result>, RuntimeError> { let iface_name = iface_name.into(); let iface = self.stock.iface_by_name(&iface_name)?; let default_op = iface