git.delta.rocks / unique-network / refs/commits / 80bfde33245f

difftreelog

feat add rmrk proxt extrinsics comments

Daniel Shiposha2022-06-09parent: #95a6d97.patch.diff
in: master

2 files changed

modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
176176
177 #[pallet::call]177 #[pallet::call]
178 impl<T: Config> Pallet<T> {178 impl<T: Config> Pallet<T> {
179 /// Create a collection
180 #[transactional]
179 #[pallet::weight(<SelfWeightOf<T>>::create_collection())]181 #[pallet::weight(<SelfWeightOf<T>>::create_collection())]
180 #[transactional]
181 pub fn create_collection(182 pub fn create_collection(
182 origin: OriginFor<T>,183 origin: OriginFor<T>,
183 metadata: RmrkString,184 metadata: RmrkString,
229 Ok(())230 Ok(())
230 }231 }
231232
233 /// destroy collection
232 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]234 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
233 #[transactional]235 #[transactional]
234 pub fn destroy_collection(236 pub fn destroy_collection(
255 Ok(())257 Ok(())
256 }258 }
257259
260 /// Change the issuer of a collection
261 ///
262 /// Parameters:
263 /// - `origin`: sender of the transaction
264 /// - `collection_id`: collection id of the nft to change issuer of
265 /// - `new_issuer`: Collection's new issuer
258 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]266 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
259 #[transactional]267 #[transactional]
260 pub fn change_collection_issuer(268 pub fn change_collection_issuer(
285 Ok(())293 Ok(())
286 }294 }
287295
296 /// lock collection
288 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]297 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
289 #[transactional]298 #[transactional]
290 pub fn lock_collection(299 pub fn lock_collection(
316 Ok(())325 Ok(())
317 }326 }
318327
328 /// Mints an NFT in the specified collection
329 /// Sets metadata and the royalty attribute
330 ///
331 /// Parameters:
332 /// - `collection_id`: The class of the asset to be minted.
333 /// - `nft_id`: The nft value of the asset to be minted.
334 /// - `recipient`: Receiver of the royalty
335 /// - `royalty`: Permillage reward from each trade for the Recipient
336 /// - `metadata`: Arbitrary data about an nft, e.g. IPFS hash
337 /// - `transferable`: Ability to transfer this NFT
319 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]338 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
320 #[transactional]339 #[transactional]
321 pub fn mint_nft(340 pub fn mint_nft(
385 Ok(())404 Ok(())
386 }405 }
387406
407 /// burn nft
388 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]408 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
389 #[transactional]409 #[transactional]
390 pub fn burn_nft(410 pub fn burn_nft(
416 Ok(())436 Ok(())
417 }437 }
418438
439 /// Transfers a NFT from an Account or NFT A to another Account or NFT B
440 ///
441 /// Parameters:
442 /// - `origin`: sender of the transaction
443 /// - `rmrk_collection_id`: collection id of the nft to be transferred
444 /// - `rmrk_nft_id`: nft id of the nft to be transferred
445 /// - `new_owner`: new owner of the nft which can be either an account or a NFT
419 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]446 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
420 #[transactional]447 #[transactional]
421 pub fn send(448 pub fn send(
520 Ok(())547 Ok(())
521 }548 }
522549
550 /// Accepts an NFT sent from another account to self or owned NFT
551 ///
552 /// Parameters:
553 /// - `origin`: sender of the transaction
554 /// - `rmrk_collection_id`: collection id of the nft to be accepted
555 /// - `rmrk_nft_id`: nft id of the nft to be accepted
556 /// - `new_owner`: either origin's account ID or origin-owned NFT, whichever the NFT was
557 /// sent to
523 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]558 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
524 #[transactional]559 #[transactional]
525 pub fn accept_nft(560 pub fn accept_nft(
589 Ok(())624 Ok(())
590 }625 }
591626
627 /// Rejects an NFT sent from another account to self or owned NFT
628 ///
629 /// Parameters:
630 /// - `origin`: sender of the transaction
631 /// - `rmrk_collection_id`: collection id of the nft to be accepted
632 /// - `rmrk_nft_id`: nft id of the nft to be accepted
592 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]633 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
593 #[transactional]634 #[transactional]
594 pub fn reject_nft(635 pub fn reject_nft(
625 Ok(())666 Ok(())
626 }667 }
627668
669 /// accept the addition of a new resource to an existing NFT
628 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]670 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
629 #[transactional]671 #[transactional]
630 pub fn accept_resource(672 pub fn accept_resource(
681 Ok(())723 Ok(())
682 }724 }
683725
726 /// accept the removal of a resource of an existing NFT
684 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]727 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
685 #[transactional]728 #[transactional]
686 pub fn accept_resource_removal(729 pub fn accept_resource_removal(
738 Ok(())781 Ok(())
739 }782 }
740783
784 /// set a custom value on an NFT
741 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]785 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
742 #[transactional]786 #[transactional]
743 pub fn set_property(787 pub fn set_property(
797 Ok(())841 Ok(())
798 }842 }
799843
844 /// set a different order of resource priority
800 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]845 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
801 #[transactional]846 #[transactional]
802 pub fn set_priority(847 pub fn set_priority(
835 Ok(())880 Ok(())
836 }881 }
837882
883 /// Create basic resource
838 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]884 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
839 #[transactional]885 #[transactional]
840 pub fn add_basic_resource(886 pub fn add_basic_resource(
872 Ok(())918 Ok(())
873 }919 }
874920
921 /// Create composable resource
875 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]922 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
876 #[transactional]923 #[transactional]
877 pub fn add_composable_resource(924 pub fn add_composable_resource(
912 Ok(())959 Ok(())
913 }960 }
914961
962 /// Create slot resource
915 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]963 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
916 #[transactional]964 #[transactional]
917 pub fn add_slot_resource(965 pub fn add_slot_resource(
951 Ok(())999 Ok(())
952 }1000 }
9531001
1002 /// remove resource
954 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]1003 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
955 #[transactional]1004 #[transactional]
956 pub fn remove_resource(1005 pub fn remove_resource(
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-equip/src/lib.rs
+++ b/pallets/proxy-rmrk-equip/src/lib.rs
@@ -74,6 +74,16 @@
 
 	#[pallet::call]
 	impl<T: Config> Pallet<T> {
+
+		/// Creates a new Base.
+		/// Modeled after [base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)
+		///
+		/// Parameters:
+		/// - origin: Caller, will be assigned as the issuer of the Base
+		/// - base_type: media type, e.g. "svg"
+		/// - symbol: arbitrary client-chosen symbol
+		/// - parts: array of Fixed and Slot parts composing the base, confined in length by
+		///   RmrkPartsLimit
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn create_base(
@@ -137,6 +147,19 @@
 			Ok(())
 		}
 
+		/// Adds a Theme to a Base.
+		/// Modeled after [themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md)
+		/// Themes are stored in the Themes storage
+		/// A Theme named "default" is required prior to adding other Themes.
+		///
+		/// Parameters:
+		/// - origin: The caller of the function, must be issuer of the base
+		/// - base_id: The Base containing the Theme to be updated
+		/// - theme: The Theme to add to the Base.  A Theme has a name and properties, which are an
+		///   array of [key, value, inherit].
+		///   - key: arbitrary BoundedString, defined by client
+		///   - value: arbitrary BoundedString, defined by client
+		///   - inherit: optional bool
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn theme_add(