@@ -169,7 +169,26 @@ pub mod pallet {
169169
170170 #[ pallet:: call]
171171 impl < T : Config > Pallet < T > {
172- /// Add a delegate with given permissions.
172+ /// Adds a delegate with specified permissions to a registry.
173+ ///
174+ /// Assigns permissions (e.g., ENTRY, ADMIN) to a delegate for the given registry. The caller
175+ /// must have ADMIN permissions, and both the caller and delegate must have valid profiles.
176+ /// The delegate is added via the `delegation::add_delegate` function, and an activity is recorded.
177+ ///
178+ /// # Arguments
179+ /// * `origin` - The signed account adding the delegate.
180+ /// * `identifier` - The SS58 identifier of the registry.
181+ /// * `delegate` - The account ID of the delegate to add.
182+ /// * `roles` - A vector of permission variants (e.g., ENTRY, ADMIN).
183+ ///
184+ /// # Errors
185+ /// * `UnauthorizedOperation` - If the caller lacks ADMIN permissions.
186+ /// * `DelegateAlreadyExists` - If the delegate is already added.
187+ /// * `pallet_profile::Error` - If the caller’s or delegate’s profile is invalid.
188+ ///
189+ /// # Events
190+ /// * `DelegateAdded` - Emitted with `identifier`, `delegate`, `delegate_profile_id`.
191+ /// ```
173192 #[ pallet:: call_index( 0 ) ]
174193 #[ pallet:: weight( { 10_000 } ) ]
175194 pub fn add_delegate (
@@ -202,7 +221,26 @@ pub mod pallet {
202221 Ok ( ( ) )
203222 }
204223
205- /// Removes a delegate
224+ /// Removes a delegate from a registry.
225+ ///
226+ /// Revokes all permissions for the specified delegate in the registry. The caller must have
227+ /// ADMIN permissions, and both the caller and delegate must have valid profiles. The delegate
228+ /// is removed via the `delegation::remove_delegate` function, and an activity is recorded.
229+ ///
230+ /// # Arguments
231+ /// * `origin` - The signed account removing the delegate.
232+ /// * `identifier` - The SS58 identifier of the registry.
233+ /// * `delegate` - The account ID of the delegate to remove.
234+ ///
235+ /// # Errors
236+ /// * `UnauthorizedOperation` - If the caller lacks ADMIN permissions.
237+ /// * `DelegateNotFound` - If the delegate is not found in the registry.
238+ /// * `pallet_profile::Error` - If the caller’s or delegate’s profile is invalid.
239+ ///
240+ /// # Events
241+ /// * `DelegateRemoved` - Emitted with `identifier`, `delegate`, `delegate_profile_id`.
242+ ///
243+ /// ```
206244 #[ pallet:: call_index( 1 ) ]
207245 #[ pallet:: weight( { 10_000 } ) ]
208246 pub fn remove_delegate (
@@ -234,7 +272,30 @@ pub mod pallet {
234272 Ok ( ( ) )
235273 }
236274
237- /// Create a new registry.
275+ /// Creates a new registry.
276+ ///
277+ /// Initializes a new registry with the provided transaction hash and optional metadata
278+ /// (document ID, author, node ID). The creator must have a valid profile. The registry is
279+ /// created via the `registry::create_registry` function, assigned a unique SS58 identifier,
280+ /// and marked as active.
281+ ///
282+ /// # Arguments
283+ /// * `origin` - The signed account creating the registry.
284+ /// * `tx_hash` - The hash of the registry’s content.
285+ /// * `_blob` - Optional data associated with the registry.
286+ /// * `doc_id` - Optional document identifier.
287+ /// * `doc_author_id` - Optional account ID of the document author.
288+ /// * `doc_node_id` - Optional document node identifier.
289+ ///
290+ /// # Errors
291+ /// * `InvalidIdentifierLength` - If the generated registry ID is invalid.
292+ /// * `RegistryAlreadyExists` - If a registry with the same ID exists.
293+ /// * `pallet_profile::Error` - If the creator’s or author’s profile is invalid.
294+ ///
295+ /// # Events
296+ /// * `RegistryCreated` - Emitted with `registry`, `creator`, `profile_id`.
297+ ///
298+ /// ```
238299 #[ pallet:: call_index( 2 ) ]
239300 #[ pallet:: weight( { 10_000 } ) ]
240301 pub fn create (
@@ -279,7 +340,26 @@ pub mod pallet {
279340 Ok ( ( ) )
280341 }
281342
282- /// Archive registry
343+ /// Archives a registry.
344+ ///
345+ /// Marks a registry as archived, preventing further operations. The caller must have ADMIN
346+ /// permissions and a valid profile. The operation is performed via the `registry::archive_registry`
347+ /// function, and an activity is recorded.
348+ ///
349+ /// # Arguments
350+ /// * `origin` - The signed account archiving the registry.
351+ /// * `registry_id` - The SS58 identifier of the registry.
352+ ///
353+ /// # Errors
354+ /// * `UnauthorizedOperation` - If the caller lacks ADMIN permissions.
355+ /// * `RegistryNotFound` - If the registry does not exist.
356+ /// * `ArchivedRegistry` - If the registry is already archived.
357+ /// * `pallet_profile::Error` - If the caller’s profile is invalid.
358+ ///
359+ /// # Events
360+ /// * `RegistryArchived` - Emitted with `registry`, `authority`, `authority_profile_id`.
361+ ///
362+ /// ```
283363 #[ pallet:: call_index( 3 ) ]
284364 #[ pallet:: weight( { 10_000 } ) ]
285365 pub fn archive (
@@ -304,7 +384,26 @@ pub mod pallet {
304384 Ok ( ( ) )
305385 }
306386
307- /// Restore registry
387+ /// Restores an archived registry.
388+ ///
389+ /// Restores a previously archived registry to active status, allowing operations. The caller
390+ /// must have ADMIN permissions and a valid profile. The operation is performed via the
391+ /// `registry::restore_registry` function, and an activity is recorded.
392+ ///
393+ /// # Arguments
394+ /// * `origin` - The signed account restoring the registry.
395+ /// * `registry_id` - The SS58 identifier of the registry.
396+ ///
397+ /// # Errors
398+ /// * `UnauthorizedOperation` - If the caller lacks ADMIN permissions.
399+ /// * `RegistryNotFound` - If the registry does not exist.
400+ /// * `RegistryNotArchived` - If the registry is not archived.
401+ /// * `pallet_profile::Error` - If the caller’s profile is invalid.
402+ ///
403+ /// # Events
404+ /// * `RegistryRestored` - Emitted with `registry`, `authority`, `authority_profile_id`.
405+ ///
406+ /// ```
308407 #[ pallet:: call_index( 4 ) ]
309408 #[ pallet:: weight( { 10_000 } ) ]
310409 pub fn restore (
@@ -329,7 +428,26 @@ pub mod pallet {
329428 Ok ( ( ) )
330429 }
331430
332- /// Update registry entry author
431+ /// Updates the document author of a registry.
432+ ///
433+ /// Changes the document author of the registry to a new account. The caller must have ADMIN
434+ /// permissions, and both the caller and new author must have valid profiles. The operation is
435+ /// performed via the `registry::update_registry_author` function, and an activity is recorded.
436+ ///
437+ /// # Arguments
438+ /// * `origin` - The signed account updating the author.
439+ /// * `registry_id` - The SS58 identifier of the registry.
440+ /// * `new_doc_author_id` - The account ID of the new document author.
441+ ///
442+ /// # Errors
443+ /// * `UnauthorizedOperation` - If the caller lacks ADMIN permissions.
444+ /// * `RegistryNotFound` - If the registry does not exist.
445+ /// * `pallet_profile::Error` - If the caller’s or new author’s profile is invalid.
446+ ///
447+ /// # Events
448+ /// * `RegistryUpdated` - Emitted with `registry`, `authority` (new author), `authority_profile_id`.
449+ ///
450+ /// ```
333451 #[ pallet:: call_index( 5 ) ]
334452 #[ pallet:: weight( { 10_000 } ) ]
335453 pub fn update_author (
@@ -364,7 +482,26 @@ pub mod pallet {
364482 Ok ( ( ) )
365483 }
366484
367- /// Update registry creator
485+ /// Updates the creator of a registry.
486+ ///
487+ /// Transfers ownership of the registry to a new account. The caller must have ADMIN
488+ /// permissions, and both the caller and new creator must have valid profiles. The operation is
489+ /// performed via the `registry::update_registry_creator` function, and an activity is recorded.
490+ ///
491+ /// # Arguments
492+ /// * `origin` - The signed account updating the creator.
493+ /// * `registry_id` - The SS58 identifier of the registry.
494+ /// * `new_creator` - The account ID of the new creator.
495+ ///
496+ /// # Errors
497+ /// * `UnauthorizedOperation` - If the caller lacks ADMIN permissions.
498+ /// * `RegistryNotFound` - If the registry does not exist.
499+ /// * `pallet_profile::Error` - If the caller’s or new creator’s profile is invalid.
500+ ///
501+ /// # Events
502+ /// * `RegistryUpdated` - Emitted with `registry`, `authority` (new creator), `authority_profile_id`.
503+ ///
504+ /// ```
368505 #[ pallet:: call_index( 6 ) ]
369506 #[ pallet:: weight( { 10_000 } ) ]
370507 pub fn update_creator (
@@ -398,7 +535,27 @@ pub mod pallet {
398535 Ok ( ( ) )
399536 }
400537
401- /// Updates the registry hash, optionally accepts a blob.
538+ /// Updates the transaction hash of a registry.
539+ ///
540+ /// Updates the registry’s transaction hash and optionally its blob. The caller must have ADMIN
541+ /// permissions and a valid profile. The operation is performed via the
542+ /// `registry::update_registry_hash` function, and an activity is recorded.
543+ ///
544+ /// # Arguments
545+ /// * `origin` - The signed account updating the hash.
546+ /// * `registry_id` - The SS58 identifier of the registry.
547+ /// * `tx_hash` - The new hash of the registry’s content.
548+ /// * `_blob` - Optional updated data.
549+ ///
550+ /// # Errors
551+ /// * `UnauthorizedOperation` - If the caller lacks ADMIN permissions.
552+ /// * `RegistryNotFound` - If the registry does not exist.
553+ /// * `pallet_profile::Error` - If the caller’s profile is invalid.
554+ ///
555+ /// # Events
556+ /// * `RegistryUpdated` - Emitted with `registry`, `authority`, `authority_profile_id`.
557+ ///
558+ /// ```
402559 #[ pallet:: call_index( 7 ) ]
403560 #[ pallet:: weight( { 10_000 } ) ]
404561 pub fn update_registry_hash (
0 commit comments