Skip to content

Commit

Permalink
chore: update IfaceWrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Sep 11, 2024
1 parent 5acc09c commit 7aec4ad
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 7 deletions.
6 changes: 2 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
18 changes: 17 additions & 1 deletion src/rgb20/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -105,6 +106,21 @@ impl<S: ContractStateRead> IfaceWrapper<S> for Rgb20Wrapper<S> {
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<WitnessOrd> {
self.0.state.witness_info(witness_id)
}
}

impl<S: ContractStateRead> Rgb20Wrapper<S> {
Expand Down
18 changes: 17 additions & 1 deletion src/rgb21/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -72,6 +73,21 @@ impl<S: ContractStateRead> IfaceWrapper<S> for Rgb21Wrapper<S> {
}

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<WitnessOrd> {
self.0.state.witness_info(witness_id)
}
}

impl<S: ContractStateRead> Rgb21Wrapper<S> {
Expand Down
18 changes: 17 additions & 1 deletion src/rgb25/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -55,6 +56,21 @@ impl<S: ContractStateRead> IfaceWrapper<S> for Rgb25Wrapper<S> {
}

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<WitnessOrd> {
self.0.state.witness_info(witness_id)
}
}

impl<S: ContractStateRead> Rgb25Wrapper<S> {
Expand Down

0 comments on commit 7aec4ad

Please sign in to comment.