1#![cfg_attr(not(feature = "std"), no_std)]23use sp_api::{Encode, Decode};4use sp_std::vec::Vec;5use sp_runtime::DispatchError;6use up_data_structs::rmrk::{primitives::*, NftChild};78pub type Result<T> = core::result::Result<T, DispatchError>;910pub type RpcString = Vec<u8>;1112pub type PropertyKey = RpcString;1314pub type ThemeName = RpcString;1516sp_api::decl_runtime_apis! {17 pub trait RmrkApi<18 AccountId,19 CollectionInfo,20 NftInfo,21 ResourceInfo,22 PropertyInfo,23 BaseInfo,24 PartType,25 Theme26 >27 where28 AccountId: Encode,29 CollectionInfo: Decode,30 NftInfo: Decode,31 ResourceInfo: Decode,32 PropertyInfo: Decode,33 BaseInfo: Decode,34 PartType: Decode,35 Theme: Decode,36 {37 fn last_collection_idx() -> Result<CollectionId>;3839 fn collection_by_id(id: CollectionId) -> Result<Option<CollectionInfo>>;4041 fn nft_by_id(collection_id: CollectionId, nft_id: NftId) -> Result<Option<NftInfo>>;4243 fn account_tokens(account_id: AccountId, collection_id: CollectionId) -> Result<Vec<NftId>>;4445 fn nft_children(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<NftChild>>;4647 fn collection_properties(collection_id: CollectionId, filter_keys: Option<Vec<PropertyKey>>) -> Result<Vec<PropertyInfo>>;4849 fn nft_properties(collection_id: CollectionId, nft_id: NftId, filter_keys: Option<Vec<PropertyKey>>) -> Result<Vec<PropertyInfo>>;5051 fn nft_resources(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<ResourceInfo>>;5253 fn nft_resource_priorities(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<ResourceId>>;5455 fn base(base_id: BaseId) -> Result<Option<BaseInfo>>;5657 fn base_parts(base_id: BaseId) -> Result<Vec<PartType>>;5859 fn theme_names(base_id: BaseId) -> Result<Vec<ThemeName>>;6061 fn theme(base_id: BaseId, theme_name: ThemeName, filter_keys: Option<Vec<PropertyKey>>) -> Result<Option<Theme>>;62 }63}