1234567891011121314151617#![cfg_attr(not(feature = "std"), no_std)]1819use sp_api::{Encode, Decode};20use sp_std::vec::Vec;21use sp_runtime::DispatchError;22use rmrk_traits::{primitives::*, NftChild};2324pub type Result<T> = core::result::Result<T, DispatchError>;2526pub type RpcString = Vec<u8>;2728pub type PropertyKey = RpcString;2930pub type ThemeName = RpcString;3132sp_api::decl_runtime_apis! {33 pub trait RmrkApi<34 AccountId,35 CollectionInfo,36 NftInfo,37 ResourceInfo,38 PropertyInfo,39 BaseInfo,40 PartType,41 Theme42 >43 where44 AccountId: Encode,45 CollectionInfo: Decode,46 NftInfo: Decode,47 ResourceInfo: Decode,48 PropertyInfo: Decode,49 BaseInfo: Decode,50 PartType: Decode,51 Theme: Decode,52 {53 fn last_collection_idx() -> Result<CollectionId>;5455 fn collection_by_id(id: CollectionId) -> Result<Option<CollectionInfo>>;5657 fn nft_by_id(collection_id: CollectionId, nft_id: NftId) -> Result<Option<NftInfo>>;5859 fn account_tokens(account_id: AccountId, collection_id: CollectionId) -> Result<Vec<NftId>>;6061 fn nft_children(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<NftChild>>;6263 fn collection_properties(collection_id: CollectionId, filter_keys: Option<Vec<PropertyKey>>) -> Result<Vec<PropertyInfo>>;6465 fn nft_properties(collection_id: CollectionId, nft_id: NftId, filter_keys: Option<Vec<PropertyKey>>) -> Result<Vec<PropertyInfo>>;6667 fn nft_resources(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<ResourceInfo>>;6869 fn nft_resource_priority(collection_id: CollectionId, nft_id: NftId, resource_id: ResourceId) -> Result<Option<u32>>;7071 fn base(base_id: BaseId) -> Result<Option<BaseInfo>>;7273 fn base_parts(base_id: BaseId) -> Result<Vec<PartType>>;7475 fn theme_names(base_id: BaseId) -> Result<Vec<ThemeName>>;7677 fn theme(base_id: BaseId, theme_name: ThemeName, filter_keys: Option<Vec<PropertyKey>>) -> Result<Option<Theme>>;78 }79}