From 0fba963db7949110e8b9608d358a6c1f5086e3a1 Mon Sep 17 00:00:00 2001 From: Maxim Orlovsky Date: Mon, 24 Jul 2023 04:31:32 +0200 Subject: [PATCH] containers: upgrade transfer ids to use Baid58 v0.4 URLs --- std/src/containers/transfer.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/std/src/containers/transfer.rs b/std/src/containers/transfer.rs index 5c84e990..47c2d99f 100644 --- a/std/src/containers/transfer.rs +++ b/std/src/containers/transfer.rs @@ -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( @@ -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::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) {