git.delta.rocks / unique-network / refs/commits / 41b30206b8b0

difftreelog

build remove RMRK usage

Fahrrader2022-05-27parent: #7f246e9.patch.diff
in: master

6 files changed

modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -68,10 +68,10 @@
 use unique_runtime_common::types::{AuraId, RuntimeInstance, AccountId, Balance, Index, Hash, Block};
 
 // RMRK
-use up_data_structs::{
+/* TODO free RMRK! use up_data_structs::{
 	RmrkCollectionInfo, RmrkInstanceInfo, RmrkResourceInfo, RmrkPropertyInfo, RmrkBaseInfo,
 	RmrkPartType, RmrkTheme,
-};
+};*/
 
 /// Unique native executor instance.
 #[cfg(feature = "unique-runtime")]
@@ -353,6 +353,7 @@
 		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
 		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
 		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
+		/* TODO free RMRK!
 		+ rmrk_rpc::RmrkApi<
 			Block,
 			AccountId,
@@ -363,7 +364,7 @@
 			RmrkBaseInfo<AccountId>,
 			RmrkPartType,
 			RmrkTheme,
-		> + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
+		>*/ + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
 		+ sp_api::Metadata<Block>
 		+ sp_offchain::OffchainWorkerApi<Block>
 		+ cumulus_primitives_core::CollectCollationInfo<Block>,
@@ -644,6 +645,7 @@
 		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
 		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
 		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
+		/* TODO free RMRK!
 		+ rmrk_rpc::RmrkApi<
 			Block,
 			AccountId,
@@ -654,7 +656,7 @@
 			RmrkBaseInfo<AccountId>,
 			RmrkPartType,
 			RmrkTheme,
-		> + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
+		>*/ + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
 		+ sp_api::Metadata<Block>
 		+ sp_offchain::OffchainWorkerApi<Block>
 		+ cumulus_primitives_core::CollectCollationInfo<Block>
@@ -787,6 +789,7 @@
 		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
 		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
 		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
+		/* TODO free RMRK!
 		+ rmrk_rpc::RmrkApi<
 			Block,
 			AccountId,
@@ -797,7 +800,7 @@
 			RmrkBaseInfo<AccountId>,
 			RmrkPartType,
 			RmrkTheme,
-		> + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
+		>*/ + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
 		+ sp_api::Metadata<Block>
 		+ sp_offchain::OffchainWorkerApi<Block>
 		+ cumulus_primitives_core::CollectCollationInfo<Block>
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -44,10 +44,10 @@
 	Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance,
 };
 // RMRK
-use up_data_structs::{
+/* TODO free RMRK! use up_data_structs::{
 	RmrkCollectionInfo, RmrkInstanceInfo, RmrkResourceInfo, RmrkPropertyInfo, RmrkBaseInfo,
 	RmrkPartType, RmrkTheme,
-};
+};*/
 
 /// Public io handler for exporting into other modules
 pub type IoHandler = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
@@ -149,6 +149,7 @@
 	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,
 	C::Api: fp_rpc::ConvertTransactionRuntimeApi<Block>,
 	C::Api: up_rpc::UniqueApi<Block, <R as RuntimeInstance>::CrossAccountId, AccountId>,
+	/* TODO free RMRK!
 	C::Api: rmrk_rpc::RmrkApi<
 		Block,
 		AccountId,
@@ -159,7 +160,7 @@
 		RmrkBaseInfo<AccountId>,
 		RmrkPartType,
 		RmrkTheme,
-	>,
+	>,*/
 	B: sc_client_api::Backend<Block> + Send + Sync + 'static,
 	B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,
 	P: TransactionPool<Block = Block> + 'static,
@@ -233,7 +234,7 @@
 	// todo look into
 	//let unique = Unique::new(client.clone());
 	io.extend_with(UniqueApi::to_delegate(Unique::new(client.clone())));
-	io.extend_with(RmrkApi::to_delegate(Unique::new(client.clone())));
+	// TODO free RMRK! io.extend_with(RmrkApi::to_delegate(Unique::new(client.clone())));
 
 	if let Some(filter_pool) = filter_pool {
 		io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
126 }126 }
127 }127 }
128128
129 impl rmrk_rpc::RmrkApi<129 /*
130 Block,130 TODO free RMRK!
131 AccountId,131 impl rmrk_rpc::RmrkApi<
132 RmrkCollectionInfo<AccountId>,132 Block,
133 RmrkInstanceInfo<AccountId>,133 AccountId,
134 RmrkResourceInfo,134 RmrkCollectionInfo<AccountId>,
135 RmrkPropertyInfo,135 RmrkInstanceInfo<AccountId>,
136 RmrkBaseInfo<AccountId>,136 RmrkResourceInfo,
137 RmrkPartType,137 RmrkPropertyInfo,
138 RmrkTheme138 RmrkBaseInfo<AccountId>,
139 > for Runtime {139 RmrkPartType,
140 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {140 RmrkTheme
141 Ok(RmrkCore::last_collection_idx())141 > for Runtime {
142 }142 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {
143143 Ok(RmrkCore::last_collection_idx())
144 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {144 }
145 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind}};145
146146 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {
147 let collection_id = CollectionId(collection_id);147 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind}};
148 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Regular) {148
149 Ok(c) => c,149 let collection_id = CollectionId(collection_id);
150 Err(_) => return Ok(None),150 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Regular) {
151 };151 Ok(c) => c,
152152 Err(_) => return Ok(None),
153 let nfts_count = dispatch_unique_runtime!(collection_id.total_supply())?;153 };
154154
155 Ok(Some(RmrkCollectionInfo {155 let nfts_count = dispatch_unique_runtime!(collection_id.total_supply())?;
156 issuer: collection.owner.clone(),156
157 metadata: RmrkCore::get_collection_property(collection_id, RmrkProperty::Metadata)?.decode_or_default(),157 Ok(Some(RmrkCollectionInfo {
158 max: collection.limits.token_limit,158 issuer: collection.owner.clone(),
159 symbol: collection.token_prefix.rebind(),159 metadata: RmrkCore::get_collection_property(collection_id, RmrkProperty::Metadata)?.decode_or_default(),
160 nfts_count160 max: collection.limits.token_limit,
161 }))161 symbol: collection.token_prefix.rebind(),
162 }162 nfts_count
163163 }))
164 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {164 }
165 use up_data_structs::mapping::TokenAddressMapping;165
166 use pallet_proxy_rmrk_core::{RmrkProperty, misc::RmrkDecode};166 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {
167167 use up_data_structs::mapping::TokenAddressMapping;
168 let collection_id = CollectionId(collection_id);168 use pallet_proxy_rmrk_core::{RmrkProperty, misc::RmrkDecode};
169 let nft_id = TokenId(nft_by_id);169
170 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }170 let collection_id = CollectionId(collection_id);
171171 let nft_id = TokenId(nft_by_id);
172 let owner = match dispatch_unique_runtime!(collection_id.token_owner(nft_id))? {172 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }
173 Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {173
174 Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),174 let owner = match dispatch_unique_runtime!(collection_id.token_owner(nft_id))? {
175 None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())175 Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {
176 },176 Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),
177 None => return Ok(None)177 None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())
178 };178 },
179179 None => return Ok(None)
180 let allowance = pallet_nonfungible::Allowance::<Runtime>::get((collection_id, nft_id));180 };
181181
182 Ok(Some(RmrkInstanceInfo {182 let allowance = pallet_nonfungible::Allowance::<Runtime>::get((collection_id, nft_id));
183 owner: owner,183
184 royalty: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?.decode_or_default(),184 Ok(Some(RmrkInstanceInfo {
185 metadata: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Metadata)?.decode_or_default(),185 owner: owner,
186 equipped: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Equipped)?.decode_or_default(),186 royalty: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?.decode_or_default(),
187 pending: allowance.is_some(),187 metadata: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Metadata)?.decode_or_default(),
188 }))188 equipped: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Equipped)?.decode_or_default(),
189 }189 pending: allowance.is_some(),
190190 }))
191 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {191 }
192 use pallet_proxy_rmrk_core::misc::CollectionType;192
193193 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {
194 let cross_account_id = CrossAccountId::from_sub(account_id);194 use pallet_proxy_rmrk_core::misc::CollectionType;
195 let collection_id = CollectionId(collection_id);195
196 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }196 let cross_account_id = CrossAccountId::from_sub(account_id);
197197 let collection_id = CollectionId(collection_id);
198 Ok(198 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }
199 dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id))?199
200 .into_iter()200 Ok(
201 .map(|token| token.0)201 dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id))?
202 .collect()202 .into_iter()
203 )203 .map(|token| token.0)
204 }204 .collect()
205205 )
206 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {206 }
207 let collection_id = CollectionId(collection_id);207
208 let nft_id = TokenId(nft_id);208 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {
209 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }209 let collection_id = CollectionId(collection_id);
210210 let nft_id = TokenId(nft_id);
211 Ok(211 if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }
212 pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))212
213 .filter_map(|(child_id, is_child)|213 Ok(
214 match is_child {214 pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))
215 true => Some(RmrkNftChild {215 .filter_map(|(child_id, is_child)|
216 collection_id: child_id.0.0,216 match is_child {
217 nft_id: child_id.1.0,217 true => Some(RmrkNftChild {
218 }),218 collection_id: child_id.0.0,
219 false => None,219 nft_id: child_id.1.0,
220 }220 }),
221 ).collect()221 false => None,
222 )222 }
223 }223 ).collect()
224224 )
225 fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {225 }
226 use pallet_proxy_rmrk_core::misc::CollectionType;226
227227 fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
228 let collection_id = CollectionId(collection_id);228 use pallet_proxy_rmrk_core::misc::CollectionType;
229 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {229
230 return Ok(Vec::new());230 let collection_id = CollectionId(collection_id);
231 }231 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {
232232 return Ok(Vec::new());
233 let properties = RmrkCore::filter_user_properties(233 }
234 collection_id,234
235 /* token_id = */ None,235 let properties = RmrkCore::filter_user_properties(
236 filter_keys,236 collection_id,
237 |key, value| RmrkPropertyInfo {237 /* token_id = */ None,
238 key,238 filter_keys,
239 value239 |key, value| RmrkPropertyInfo {
240 }240 key,
241 )?;241 value
242242 }
243 Ok(properties)243 )?;
244 }244
245245 Ok(properties)
246 fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {246 }
247 use pallet_proxy_rmrk_core::misc::NftType;247
248248 fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
249 let collection_id = CollectionId(collection_id);249 use pallet_proxy_rmrk_core::misc::NftType;
250 let token_id = TokenId(nft_id);250
251251 let collection_id = CollectionId(collection_id);
252 if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {252 let token_id = TokenId(nft_id);
253 return Ok(Vec::new());253
254 }254 if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {
255255 return Ok(Vec::new());
256 let properties = RmrkCore::filter_user_properties(256 }
257 collection_id,257
258 Some(token_id),258 let properties = RmrkCore::filter_user_properties(
259 filter_keys,259 collection_id,
260 |key, value| RmrkPropertyInfo {260 Some(token_id),
261 key,261 filter_keys,
262 value262 |key, value| RmrkPropertyInfo {
263 }263 key,
264 )?;264 value
265265 }
266 Ok(properties)266 )?;
267 }267
268268 Ok(properties)
269 fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {269 }
270 use frame_support::BoundedVec;270
271 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};271 fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {
272272 use frame_support::BoundedVec;
273 let collection_id = CollectionId(collection_id);273 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};
274 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo make sure the collection type doesn't matter274
275275 let collection_id = CollectionId(collection_id);
276 let nft_id = TokenId(nft_id);276 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo make sure the collection type doesn't matter
277 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }277
278278 let nft_id = TokenId(nft_id);
279 let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)279 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }
280 .unwrap()280
281 .decode_or_default();281 let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)
282 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }282 .unwrap()
283283 .decode_or_default();
284 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))284 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }
285 .filter_map(|(resource_id, properties)| Some(RmrkResourceInfo {285
286 id: BoundedVec::default(), // todo ResourceId property286 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))
287 pending: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceAccept).unwrap().decode_or_default(),287 .filter_map(|(resource_id, properties)| Some(RmrkResourceInfo {
288 pending_removal: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceRemoval).unwrap().decode_or_default(),288 id: BoundedVec::default(), // todo ResourceId property
289 resource: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::ResourceType).unwrap().decode_or_default(),/* {289 pending: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceAccept).unwrap().decode_or_default(),
290 RmrkResourceTypes::Basic(resource) => RmrkResourceTypes::Basic(),/*(RmrkBasicResource {290 pending_removal: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceRemoval).unwrap().decode_or_default(),
291 src: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Src).unwrap().decode_or_default(),291 resource: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::ResourceType).unwrap().decode_or_default(),/* {
292 metadata: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Metadata).unwrap().decode_or_default(),292 RmrkResourceTypes::Basic(resource) => RmrkResourceTypes::Basic(),/*(RmrkBasicResource {
293 license: RmrkCore::get_nft_property_inner(properties, RmrkProperty::License).unwrap().decode_or_default(),293 src: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Src).unwrap().decode_or_default(),
294 thumb: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Thumb).unwrap().decode_or_default(),294 metadata: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Metadata).unwrap().decode_or_default(),
295 },*///BasicResource<BoundedString>)295 license: RmrkCore::get_nft_property_inner(properties, RmrkProperty::License).unwrap().decode_or_default(),
296 _ => todo!(), //RmrkResourceTypes::Composable(ComposableResource<BoundedString, BoundedParts>),296 thumb: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Thumb).unwrap().decode_or_default(),
297 //RmrkResourceTypes::Slot(SlotResource<BoundedString>),297 },*///BasicResource<BoundedString>)
298 },*/298 _ => todo!(), //RmrkResourceTypes::Composable(ComposableResource<BoundedString, BoundedParts>),
299 }))299 //RmrkResourceTypes::Slot(SlotResource<BoundedString>),
300 .collect();300 },*/
301301 }))
302 Ok(resources)302 .collect();
303 }303
304304 Ok(resources)
305 fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {305 }
306 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};306
307307 fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {
308 let collection_id = CollectionId(collection_id);308 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};
309 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo ensure the collection type doesn't matter309
310310 let collection_id = CollectionId(collection_id);
311 let nft_id = TokenId(nft_id);311 if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo ensure the collection type doesn't matter
312 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }312
313313 let nft_id = TokenId(nft_id);
314 /*let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)314 if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }
315 .unwrap()315
316 .decode_or_default();316 /*let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)
317 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }317 .unwrap()
318318 .decode_or_default();
319 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))319 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }
320 .filter_map(|(resource_id, properties)| Some((320
321 resource_id, // ResourceId property321 let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))
322 RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::Priority).unwrap().decode_or_default(),322 .filter_map(|(resource_id, properties)| Some((
323 )))323 resource_id, // ResourceId property
324 .collect()324 RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::Priority).unwrap().decode_or_default(),
325 .sort_by_key(|(_, index)| *index)325 )))
326 .into_iter().map(|(resource_id, _)| resource_id)*/326 .collect()
327 let priorities = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourcePriorities)?.decode_or_default();327 .sort_by_key(|(_, index)| *index)
328328 .into_iter().map(|(resource_id, _)| resource_id)*/
329 Ok(priorities)329 let priorities = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourcePriorities)?.decode_or_default();
330 }330
331331 Ok(priorities)
332 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {332 }
333 use pallet_proxy_rmrk_core::{333
334 RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind},334 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {
335 };335 use pallet_proxy_rmrk_core::{
336336 RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind},
337 let collection_id = CollectionId(base_id);337 };
338 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Base) {338
339 Ok(c) => c,339 let collection_id = CollectionId(base_id);
340 Err(_) => return Ok(None),340 let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Base) {
341 };341 Ok(c) => c,
342342 Err(_) => return Ok(None),
343 Ok(Some(RmrkBaseInfo {343 };
344 issuer: collection.owner.clone(),344
345 base_type: RmrkCore::get_collection_property(collection_id, RmrkProperty::BaseType)?.decode_or_default(),345 Ok(Some(RmrkBaseInfo {
346 symbol: collection.token_prefix.rebind(),346 issuer: collection.owner.clone(),
347 }))347 base_type: RmrkCore::get_collection_property(collection_id, RmrkProperty::BaseType)?.decode_or_default(),
348 }348 symbol: collection.token_prefix.rebind(),
349349 }))
350 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {350 }
351 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};351
352352 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
353 let collection_id = CollectionId(base_id);353 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};
354 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() { return Ok(Vec::new()); }354
355355 let collection_id = CollectionId(base_id);
356 let parts = dispatch_unique_runtime!(collection_id.collection_tokens())?356 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() { return Ok(Vec::new()); }
357 .into_iter()357
358 .filter_map(|token_id| {358 let parts = dispatch_unique_runtime!(collection_id.collection_tokens())?
359 let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;359 .into_iter()
360360 .filter_map(|token_id| {
361 match nft_type {361 let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;
362 NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {362
363 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),363 match nft_type {
364 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),364 NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {
365 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),365 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),
366 })),366 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),
367 NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {367 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),
368 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),368 })),
369 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),369 NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {
370 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),370 id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),
371 equippable: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::EquippableList).ok()?.decode_or_default(),371 src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),
372 })),372 z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),
373 _ => None373 equippable: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::EquippableList).ok()?.decode_or_default(),
374 }374 })),
375 })375 _ => None
376 .collect();376 }
377377 })
378 Ok(parts)378 .collect();
379 }379
380380 Ok(parts)
381 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {381 }
382 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode}};382
383383 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
384 let collection_id = CollectionId(base_id);384 use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode}};
385 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {385
386 return Ok(Vec::new());386 let collection_id = CollectionId(base_id);
387 }387 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {
388388 return Ok(Vec::new());
389 let theme_names = dispatch_unique_runtime!(collection_id.collection_tokens())?389 }
390 .iter()390
391 .filter_map(|token_id| {391 let theme_names = dispatch_unique_runtime!(collection_id.collection_tokens())?
392 let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).unwrap();392 .iter()
393393 .filter_map(|token_id| {
394 match nft_type {394 let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).unwrap();
395 Theme => Some(395
396 RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ThemeName).unwrap().decode_or_default()396 match nft_type {
397 ),397 Theme => Some(
398 _ => None398 RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ThemeName).unwrap().decode_or_default()
399 }399 ),
400 })400 _ => None
401 .collect();401 }
402402 })
403 Ok(theme_names)403 .collect();
404 }404
405405 Ok(theme_names)
406 fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {406 }
407 use pallet_proxy_rmrk_core::{407
408 RmrkProperty,408 fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {
409 misc::{CollectionType, NftType, RmrkDecode}409 use pallet_proxy_rmrk_core::{
410 };410 RmrkProperty,
411411 misc::{CollectionType, NftType, RmrkDecode}
412 let collection_id = CollectionId(base_id);412 };
413 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {413
414 return Ok(None);414 let collection_id = CollectionId(base_id);
415 }415 if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {
416416 return Ok(None);
417 let theme_info = dispatch_unique_runtime!(collection_id.collection_tokens())?417 }
418 .into_iter()418
419 .find_map(|token_id| {419 let theme_info = dispatch_unique_runtime!(collection_id.collection_tokens())?
420 RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;420 .into_iter()
421421 .find_map(|token_id| {
422 let name: RmrkString = RmrkCore::get_nft_property(422 RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;
423 collection_id, token_id, RmrkProperty::ThemeName423
424 ).ok()?.decode_or_default();424 let name: RmrkString = RmrkCore::get_nft_property(
425425 collection_id, token_id, RmrkProperty::ThemeName
426 if name == theme_name {426 ).ok()?.decode_or_default();
427 Some((name, token_id))427
428 } else {428 if name == theme_name {
429 None429 Some((name, token_id))
430 }430 } else {
431 });431 None
432432 }
433 let (name, theme_id) = match theme_info {433 });
434 Some((name, theme_id)) => (name, theme_id),434
435 None => return Ok(None)435 let (name, theme_id) = match theme_info {
436 };436 Some((name, theme_id)) => (name, theme_id),
437437 None => return Ok(None)
438 let properties = RmrkCore::filter_user_properties(438 };
439 collection_id,439
440 Some(theme_id),440 let properties = RmrkCore::filter_user_properties(
441 filter_keys,441 collection_id,
442 |key, value| RmrkThemeProperty {442 Some(theme_id),
443 key,443 filter_keys,
444 value444 |key, value| RmrkThemeProperty {
445 }445 key,
446 )?;446 value
447447 }
448 let inherit = RmrkCore::get_nft_property(448 )?;
449 collection_id,449
450 theme_id,450 let inherit = RmrkCore::get_nft_property(
451 RmrkProperty::ThemeInherit451 collection_id,
452 )?.decode_or_default();452 theme_id,
453453 RmrkProperty::ThemeInherit
454 let theme = RmrkTheme {454 )?.decode_or_default();
455 name,455
456 properties,456 let theme = RmrkTheme {
457 inherit,457 name,
458 };458 properties,
459459 inherit,
460 Ok(Some(theme))460 };
461 }461
462 }462 Ok(Some(theme))
463 }
464 }*/
463465
464 impl sp_api::Core<Block> for Runtime {466 impl sp_api::Core<Block> for Runtime {
465 fn version() -> RuntimeVersion {467 fn version() -> RuntimeVersion {
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -903,13 +903,15 @@
 	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
 }
 
+/*
+TODO free RMRK!
 impl pallet_proxy_rmrk_core::Config for Runtime {
 	type Event = Event;
 }
 
 impl pallet_proxy_rmrk_equip::Config for Runtime {
 	type Event = Event;
-}
+}*/
 
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
@@ -1032,8 +1034,10 @@
 		Refungible: pallet_refungible::{Pallet, Storage} = 68,
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
+		/* TODO free RMRK!
 		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
 		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
+		*/
 
 		// Frontier
 		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -887,14 +887,14 @@
 impl pallet_nonfungible::Config for Runtime {
 	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
 }
-
+/* TODO free RMRK!
 impl pallet_proxy_rmrk_core::Config for Runtime {
 	type Event = Event;
 }
 
 impl pallet_proxy_rmrk_equip::Config for Runtime {
 	type Event = Event;
-}
+}*/
 
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
@@ -1017,8 +1017,9 @@
 		Refungible: pallet_refungible::{Pallet, Storage} = 68,
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
+		/* TODO free RMRK!
 		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
-		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
+		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,*/
 
 		// Frontier
 		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -892,14 +892,14 @@
 impl pallet_nonfungible::Config for Runtime {
 	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
 }
-
+/* TODO free RMRK!
 impl pallet_proxy_rmrk_core::Config for Runtime {
 	type Event = Event;
 }
 
 impl pallet_proxy_rmrk_equip::Config for Runtime {
 	type Event = Event;
-}
+}*/
 
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
@@ -1022,8 +1022,9 @@
 		Refungible: pallet_refungible::{Pallet, Storage} = 68,
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
+		/* TODO free RMRK!
 		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
-		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
+		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,*/
 
 		// Frontier
 		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,