Skip to content

Commit

Permalink
containers: upgrade transfer ids to use Baid58 v0.4 URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 24, 2023
1 parent 112609e commit 0fba963
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions std/src/containers/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::LIB_NAME_RGB_STD;
/// Transfer identifier.
#[derive(Wrapper, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display, From)]
#[wrapper(Deref, BorrowSlice, Hex, Index, RangeOps)]
#[display(Self::to_baid58)]
#[display(Self::to_baid58_string)]
#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)]
#[strict_type(lib = LIB_NAME_RGB_STD)]
#[cfg_attr(
Expand All @@ -49,15 +49,17 @@ pub struct TransferId(
);

impl ToBaid58<32> for TransferId {
const HRI: &'static str = "tfer";
const HRI: &'static str = "rgb-cons";
fn to_baid58_payload(&self) -> [u8; 32] { self.to_raw_array() }
}
impl FromBaid58<32> for TransferId {}

impl FromStr for TransferId {
type Err = Baid58ParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> { Self::from_baid58_str(s) }
}
impl TransferId {
pub fn to_baid58_string(&self) -> String { format!("{::<#}", self.to_baid58()) }
}

impl CommitEncode for Transfer {
fn commit_encode(&self, e: &mut impl io::Write) {
Expand Down

0 comments on commit 0fba963

Please sign in to comment.