difftreelog
fix last_collection_idx
in: master
2 files changed
pallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth46 type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;46 type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;47 }47 }4849 #[pallet::storage]50 #[pallet::getter(fn collection_index)]51 pub type CollectionIndex<T: Config> = StorageValue<_, RmrkCollectionId, ValueQuery>;485249 #[pallet::pallet]53 #[pallet::pallet]50 #[pallet::generate_store(pub(super) trait Store)]54 #[pallet::generate_store(pub(super) trait Store)]143 ].into_iter()147 ].into_iter()144 )?;148 )?;149150 <CollectionIndex<T>>::mutate(|n| *n += 1);145151146 Self::deposit_event(Event::CollectionCreated {152 Self::deposit_event(Event::CollectionCreated {147 issuer: sender,153 issuer: sender,378 .map_err(Self::map_common_err_to_proxy)384 .map_err(Self::map_common_err_to_proxy)379 }385 }386387 pub fn last_collection_idx() -> RmrkCollectionId {388 <CollectionIndex<T>>::get()389 }380390381 pub fn get_nft_collection(collection_id: CollectionId) -> Result<NonfungibleHandle<T>, DispatchError> {391 pub fn get_nft_collection(collection_id: CollectionId) -> Result<NonfungibleHandle<T>, DispatchError> {382 let collection = <CollectionHandle<T>>::try_get(collection_id)392 let collection = <CollectionHandle<T>>::try_get(collection_id)runtime/common/src/runtime_apis.rsdiffbeforeafterboth142 RmrkTheme142 RmrkTheme143 > for Runtime {143 > for Runtime {144 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {144 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {145 Ok(<pallet_common::CreatedCollectionCount<Runtime>>::get().0) // todo storage from proxy pallet145 Ok(RmrkCore::last_collection_idx())146 }146 }147 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {147 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {148 // TODO decide on displacement to palettes -- does RMRK belong there, spread across common and nonfungible?148 // TODO decide on displacement to palettes -- does RMRK belong there, spread across common and nonfungible?