From 7aec4ad482a4b688f8737bfa7d0bb439f4e01167 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Wed, 11 Sep 2024 12:49:03 +0200 Subject: [PATCH] chore: update IfaceWrappers --- Cargo.lock | 6 ++---- Cargo.toml | 4 ++++ src/rgb20/wrapper.rs | 18 +++++++++++++++++- src/rgb21/wrapper.rs | 18 +++++++++++++++++- src/rgb25/wrapper.rs | 18 +++++++++++++++++- 5 files changed, 57 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16cd9e5..ad7fc88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -711,8 +711,7 @@ dependencies = [ [[package]] name = "rgb-invoice" version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d42e9d284f857f3dccce63521789f3da75568f55488d255ebacc8fe343012a5d" +source = "git+https://github.com/RGB-WG/rgb-std?branch=develop#ef4679f6401c60d9080115649da5d208e66a0fad" dependencies = [ "amplify", "baid64", @@ -732,8 +731,7 @@ dependencies = [ [[package]] name = "rgb-std" version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a97b5e58521f41837b1a92f480041fd72a0659f22cb132354d2bbcba25b25" +source = "git+https://github.com/RGB-WG/rgb-std?branch=develop#ef4679f6401c60d9080115649da5d208e66a0fad" dependencies = [ "aluvm", "amplify", diff --git a/Cargo.toml b/Cargo.toml index 39ffa8f..69f58c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,3 +47,7 @@ wasm-bindgen-test = "0.3" [package.metadata.docs.rs] features = ["all"] + +[patch.crates-io] +rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "develop" } +rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "develop" } diff --git a/src/rgb20/wrapper.rs b/src/rgb20/wrapper.rs index 7fa2736..f09ef93 100644 --- a/src/rgb20/wrapper.rs +++ b/src/rgb20/wrapper.rs @@ -28,7 +28,8 @@ use rgbstd::interface::{ use rgbstd::invoice::{Amount, Precision}; use rgbstd::persistence::ContractStateRead; use rgbstd::stl::{AssetSpec, ContractTerms, Details}; -use rgbstd::{AssetTag, XWitnessId}; +use rgbstd::{AssetTag, ContractId, SchemaId, XWitnessId}; +use rgbstd::vm::WitnessOrd; use strict_encoding::InvalidRString; use super::{Inflation, PrimaryIssue, Rgb20, Rgb20Info}; @@ -105,6 +106,21 @@ impl IfaceWrapper for Rgb20Wrapper { replaced: self.total_replaced_supply(), } } + + #[inline] + fn contract_id(&self) -> ContractId { + self.0.contract_id() + } + + #[inline] + fn schema_id(&self) -> SchemaId { + self.0.state.schema_id() + } + + #[inline] + fn witness_info(&self, witness_id: XWitnessId) -> Option { + self.0.state.witness_info(witness_id) + } } impl Rgb20Wrapper { diff --git a/src/rgb21/wrapper.rs b/src/rgb21/wrapper.rs index cf38864..b8bbb27 100644 --- a/src/rgb21/wrapper.rs +++ b/src/rgb21/wrapper.rs @@ -24,7 +24,8 @@ use rgbstd::interface::{ }; use rgbstd::persistence::ContractStateRead; use rgbstd::stl::{bp_tx_stl, rgb_contract_stl, AssetSpec, ContractTerms}; -use rgbstd::Allocation; +use rgbstd::{Allocation, ContractId, SchemaId, XWitnessId}; +use rgbstd::vm::WitnessOrd; use strict_types::stl::std_stl; use strict_types::{CompileError, LibBuilder, TypeLib}; @@ -72,6 +73,21 @@ impl IfaceWrapper for Rgb21Wrapper { } fn info(&self) -> Self::Info { todo!() } + + #[inline] + fn contract_id(&self) -> ContractId { + self.0.contract_id() + } + + #[inline] + fn schema_id(&self) -> SchemaId { + self.0.state.schema_id() + } + + #[inline] + fn witness_info(&self, witness_id: XWitnessId) -> Option { + self.0.state.witness_info(witness_id) + } } impl Rgb21Wrapper { diff --git a/src/rgb25/wrapper.rs b/src/rgb25/wrapper.rs index 8f5b5ce..cfe36fd 100644 --- a/src/rgb25/wrapper.rs +++ b/src/rgb25/wrapper.rs @@ -25,7 +25,8 @@ use rgbstd::interface::{ use rgbstd::invoice::{Amount, Precision}; use rgbstd::persistence::ContractStateRead; use rgbstd::stl::{ContractTerms, Details, Name}; -use rgbstd::AssetTag; +use rgbstd::{AssetTag, ContractId, SchemaId, XWitnessId}; +use rgbstd::vm::WitnessOrd; use strict_encoding::InvalidRString; use super::{Issue, Rgb25, Rgb25Info}; @@ -55,6 +56,21 @@ impl IfaceWrapper for Rgb25Wrapper { } fn info(&self) -> Self::Info { todo!() } + + #[inline] + fn contract_id(&self) -> ContractId { + self.0.contract_id() + } + + #[inline] + fn schema_id(&self) -> SchemaId { + self.0.state.schema_id() + } + + #[inline] + fn witness_info(&self, witness_id: XWitnessId) -> Option { + self.0.state.witness_info(witness_id) + } } impl Rgb25Wrapper {