From 7faf112aedc72a4e8e93b41457afdad9e990fea3 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Wed, 18 May 2022 17:56:39 +0000 Subject: [PATCH] fix: rmrk_property macro --- --- a/pallets/rmrk-proxy/src/misc.rs +++ b/pallets/rmrk-proxy/src/misc.rs @@ -1,19 +1,24 @@ use super::*; use codec::{Encode, Decode}; +use frame_support::dispatch::Vec; use pallet_nonfungible::NonfungibleHandle; #[macro_export] macro_rules! rmrk_property { ($key:ident, $value:expr) => { Property { - key: rmrk_property!($key), + key: rmrk_property!(@raw $key), value: $value.into() } }; - ($key:ident) => { + (@raw $key:ident) => { RmrkProperty::$key.to_key() }; + + ($key:ident) => { + PropertyScope::Rmrk.apply(rmrk_property!(@raw $key)).unwrap() + }; } macro_rules! impl_rmrk_value { --- a/primitives/data-structs/src/lib.rs +++ b/primitives/data-structs/src/lib.rs @@ -678,6 +678,7 @@ } } +#[derive(Debug)] pub enum PropertiesError { NoSpaceForProperty, PropertyLimitReached, @@ -693,7 +694,7 @@ } impl PropertyScope { - fn apply(self, key: PropertyKey) -> Result { + pub fn apply(self, key: PropertyKey) -> Result { let scope_str: &[u8] = match self { Self::None => return Ok(key), Self::Rmrk => b"rmrk", -- gitstuff