1use super::*;2use codec::{Encode, Decode};34#[macro_export]5macro_rules! map_common_err_to_proxy {6 (match $err:ident { $($common_err:ident => $proxy_err:ident),+ }) => {7 $(8 if $err == <CommonError<T>>::$common_err.into() {9 return <Error<T>>::$proxy_err.into()10 } else11 )+ {12 $err13 }14 };15}1617pub trait RmrkDecode<T: Decode + Default, S> {18 fn decode_or_default(&self) -> T;19}202122impl<T: Decode + Default, S> RmrkDecode<T, S> for BoundedVec<u8, S> {23 fn decode_or_default(&self) -> T {24 let mut value = self.as_slice();2526 T::decode(&mut value).unwrap_or_default()27 }28}2930pub trait RmrkRebind<T, S> {31 fn rebind(&self) -> BoundedVec<u8, S>;32}333435impl<T, S> RmrkRebind<T, S> for BoundedVec<u8, T>36where37 BoundedVec<u8, S>: TryFrom<Vec<u8>>,38{39 fn rebind(&self) -> BoundedVec<u8, S> {40 BoundedVec::<u8, S>::try_from(self.clone().into_inner()).unwrap_or_default()41 }42}4344#[derive(Encode, Decode, PartialEq, Eq)]45pub enum CollectionType {46 Regular,47 Resource,48 Base,49}505152#[derive(Encode, Decode, PartialEq, Eq, Default)]53pub enum NftType {54 #[default]55 Regular,56 Resource,57 FixedPart,58 SlotPart,59 Theme,60}616263#[derive(Encode, Decode, PartialEq, Eq, Default)]64pub enum ResourceType {65 #[default]66 Basic,67 Composable,68 Slot,69}