mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 01:21:01 +00:00
changes to nfts pallet for xcm integration (#14395)
* Use Incrementable from frame_support::traits * Chore * make incremental fallible and new nfts function for custom collection ids * fmt * fix benchmark tests nfts * add test * fmt * add safety comment to CollectionId * fmt * add comments to Incrementable * line wrapping * rewrap comments * address feedback * fmt * change unwrap for expect --------- Co-authored-by: Jegor Sidorenko <jegor@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -55,6 +55,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn set_next_collection_id(collection: T::CollectionId) {
|
||||
let next_id = collection.increment();
|
||||
NextCollectionId::<T, I>::set(next_id);
|
||||
Self::deposit_event(Event::NextCollectionIdIncremented { next_id });
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "runtime-benchmarks"))]
|
||||
pub fn set_next_id(id: T::CollectionId) {
|
||||
NextCollectionId::<T, I>::set(Some(id));
|
||||
@@ -62,6 +68,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn get_next_id() -> T::CollectionId {
|
||||
NextCollectionId::<T, I>::get().unwrap_or(T::CollectionId::initial_value())
|
||||
NextCollectionId::<T, I>::get()
|
||||
.or(T::CollectionId::initial_value())
|
||||
.expect("Failed to get next collection ID")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user