Skip to content

Commit

Permalink
contract: impl wrapper for Issuer type
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Mar 25, 2024
1 parent b5e7ff8 commit f17c2a2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/contract/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
use std::cmp::Ordering;
use std::collections::{btree_map, btree_set, BTreeMap};
use std::iter;
use std::str::FromStr;

use amplify::confinement::{Confined, SmallBlob, SmallOrdSet, TinyOrdMap, TinyOrdSet};
use amplify::Wrapper;
use amplify::hex::FromHex;
use amplify::{hex, Wrapper};
use commit_verify::{
CommitEncode, CommitEngine, CommitId, Conceal, MerkleHash, MerkleLeaves, ReservedBytes,
StrictHash,
Expand Down Expand Up @@ -280,7 +282,9 @@ pub trait Operation {
///
/// Contract validity doesn't assume any checks on the issuer identity; these
/// checks must be performed at the application level.
#[derive(Clone, PartialEq, Eq, Hash, Debug, Default)]
#[derive(Wrapper, Clone, PartialEq, Eq, Hash, Debug, Default, From, Display)]
#[wrapper(Deref, AsSlice, BorrowSlice, Hex)]
#[display(LowerHex)]
#[derive(StrictType, StrictEncode, StrictDecode)]
#[strict_type(lib = LIB_NAME_RGB)]
#[derive(CommitEncode)]
Expand All @@ -292,6 +296,12 @@ pub trait Operation {
)]
pub struct Issuer(SmallBlob);

impl FromStr for Issuer {
type Err = hex::Error;

fn from_str(s: &str) -> Result<Self, Self::Err> { Issuer::from_hex(s) }
}

#[derive(Clone, PartialEq, Eq, Debug)]
#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)]
#[strict_type(lib = LIB_NAME_RGB)]
Expand Down

0 comments on commit f17c2a2

Please sign in to comment.