Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Augment-Api to include Transfer of Entry Ownership #261

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/augment-api/metadata/cord.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/augment-api/src/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,10 @@ declare module '@polkadot/api-base/types/errors' {
* Identifier Invalid or Not of DeDir Type
**/
InvalidRegistryEntryIdentifier: AugmentedError<ApiType>;
/**
* New Registry Entry owner cannot be same as existing owner.
**/
NewOwnerCannotBeSameAsExistingOwner: AugmentedError<ApiType>;
/**
* Registry Entry Identifier Already Exists
**/
Expand Down
5 changes: 5 additions & 0 deletions packages/augment-api/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ declare module '@polkadot/api-base/types/events' {
* \[creator, registry_identifier, registry_entry_identifier\]
**/
RegistryEntryCreated: AugmentedEvent<ApiType, [creator: AccountId32, registryId: Bytes, registryEntryId: Bytes], { creator: AccountId32, registryId: Bytes, registryEntryId: Bytes }>;
/**
* A existing registry entry ownership has been updated.
* \[updater, new_owner, registry_entry_identifier\]
**/
RegistryEntryOwnershipUpdated: AugmentedEvent<ApiType, [updater: AccountId32, newOwner: AccountId32, registryEntryId: Bytes], { updater: AccountId32, newOwner: AccountId32, registryEntryId: Bytes }>;
/**
* A existing registry entry has been reinstated.
* \[updater, registry_enrtry_identifier\]
Expand Down
47 changes: 47 additions & 0 deletions packages/augment-api/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,53 @@ declare module '@polkadot/api-base/types/submittable' {
* ```
**/
update: AugmentedSubmittable<(registryEntryId: Bytes | string | Uint8Array, authorization: Bytes | string | Uint8Array, digest: H256 | string | Uint8Array, blob: Option<Bytes> | null | Uint8Array | Bytes | string) => SubmittableExtrinsic<ApiType>, [Bytes, Bytes, H256, Option<Bytes>]>;
/**
* Updates the ownership of an existing Registry Entry.
*
* This function allows an authorized user (creator or admin) to update the ownership
* of an existing Registry Entry. Ownership can be transferred to a new owner within
* the same Registry.
*
* # Arguments
* * `origin` - The origin of the call, which must be a signed account (updater).
* * `registry_entry_id` - The unique identifier of the Registry Entry to update ownership.
* * `authorization` - The authorization identifier that links the updater to the Registry.
* * `new_owner` - The account identifier of the new owner of the Registry Entry.
* * `new_owner_authorization` - The authorization identifier that links the new owner to
* the Registry.
*
* # Conditions
* - Only the current creator (owner) of the Registry Entry or an admin of the Registry can
* perform this operation.
* - The new owner must be authorized within the same Registry.
* - The new owner cannot be the same as the current owner to avoid unnecessary storage
* writes.
*
* # Errors
* This function returns an error in the following cases:
* * `RegistryEntryIdentifierDoesNotExist` - If the specified `registry_entry_id` does not
* exist.
* * `UnauthorizedOperation` - If the caller does not have permission to update the
* ownership or if the new owner is not authorized under the same Registry.
* * `NewOwnerCannotBeSameAsExistingOwner` - If the new owner is the same as the current
* owner.
*
* # Events
* Emits the `Event::RegistryEntryOwnershipUpdated` event upon successful ownership update.
* This event includes the `updater`, the `new_owner`, and the `registry_entry_id`.
*
* # Example
* ```rust
* update_ownership(
* origin,
* registry_entry_id,
* authorization,
* new_owner,
* new_owner_authorization,
* )?;
* ```
**/
updateOwnership: AugmentedSubmittable<(registryEntryId: Bytes | string | Uint8Array, authorization: Bytes | string | Uint8Array, newOwner: AccountId32 | string | Uint8Array, newOwnerAuthorization: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, Bytes, AccountId32, Bytes]>;
};
grandpa: {
/**
Expand Down
15 changes: 13 additions & 2 deletions packages/augment-api/src/interfaces/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,11 @@ export default {
},
RegistryEntryReinstated: {
updater: 'AccountId32',
registryEntryId: 'Bytes',
},
RegistryEntryOwnershipUpdated: {
updater: 'AccountId32',
newOwner: 'AccountId32',
registryEntryId: 'Bytes'
}
}
Expand Down Expand Up @@ -2779,7 +2784,13 @@ export default {
},
reinstate: {
registryEntryId: 'Bytes',
authorization: 'Bytes'
authorization: 'Bytes',
},
update_ownership: {
registryEntryId: 'Bytes',
authorization: 'Bytes',
newOwner: 'AccountId32',
newOwnerAuthorization: 'Bytes'
}
}
},
Expand Down Expand Up @@ -3795,7 +3806,7 @@ export default {
* Lookup472: pallet_entries::pallet::Error<T>
**/
PalletEntriesError: {
_enum: ['InvalidIdentifierLength', 'InvalidRegistryEntryIdentifier', 'UnauthorizedOperation', 'RegistryEntryIdentifierAlreadyExists', 'RegistryEntryIdentifierDoesNotExist', 'RegistryEntryNotRevoked']
_enum: ['InvalidIdentifierLength', 'InvalidRegistryEntryIdentifier', 'UnauthorizedOperation', 'RegistryEntryIdentifierAlreadyExists', 'RegistryEntryIdentifierDoesNotExist', 'RegistryEntryNotRevoked', 'NewOwnerCannotBeSameAsExistingOwner']
},
/**
* Lookup473: pallet_schema_accounts::types::SchemaEntry<bounded_collections::bounded_vec::BoundedVec<T, S>, primitive_types::H256, sp_core::crypto::AccountId32>
Expand Down
20 changes: 17 additions & 3 deletions packages/augment-api/src/interfaces/types-lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,13 @@ declare module '@polkadot/types/lookup' {
readonly updater: AccountId32;
readonly registryEntryId: Bytes;
} & Struct;
readonly type: 'RegistryEntryCreated' | 'RegistryEntryUpdated' | 'RegistryEntryRevoked' | 'RegistryEntryReinstated';
readonly isRegistryEntryOwnershipUpdated: boolean;
readonly asRegistryEntryOwnershipUpdated: {
readonly updater: AccountId32;
readonly newOwner: AccountId32;
readonly registryEntryId: Bytes;
} & Struct;
readonly type: 'RegistryEntryCreated' | 'RegistryEntryUpdated' | 'RegistryEntryRevoked' | 'RegistryEntryReinstated' | 'RegistryEntryOwnershipUpdated';
}

/** @name PalletSchemaAccountsEvent (96) */
Expand Down Expand Up @@ -3036,7 +3042,14 @@ declare module '@polkadot/types/lookup' {
readonly registryEntryId: Bytes;
readonly authorization: Bytes;
} & Struct;
readonly type: 'Create' | 'Update' | 'Revoke' | 'Reinstate';
readonly isUpdateOwnership: boolean;
readonly asUpdateOwnership: {
readonly registryEntryId: Bytes;
readonly authorization: Bytes;
readonly newOwner: AccountId32;
readonly newOwnerAuthorization: Bytes;
} & Struct;
readonly type: 'Create' | 'Update' | 'Revoke' | 'Reinstate' | 'UpdateOwnership';
}

/** @name PalletSchemaAccountsCall (263) */
Expand Down Expand Up @@ -4265,7 +4278,8 @@ declare module '@polkadot/types/lookup' {
readonly isRegistryEntryIdentifierAlreadyExists: boolean;
readonly isRegistryEntryIdentifierDoesNotExist: boolean;
readonly isRegistryEntryNotRevoked: boolean;
readonly type: 'InvalidIdentifierLength' | 'InvalidRegistryEntryIdentifier' | 'UnauthorizedOperation' | 'RegistryEntryIdentifierAlreadyExists' | 'RegistryEntryIdentifierDoesNotExist' | 'RegistryEntryNotRevoked';
readonly isNewOwnerCannotBeSameAsExistingOwner: boolean;
readonly type: 'InvalidIdentifierLength' | 'InvalidRegistryEntryIdentifier' | 'UnauthorizedOperation' | 'RegistryEntryIdentifierAlreadyExists' | 'RegistryEntryIdentifierDoesNotExist' | 'RegistryEntryNotRevoked' | 'NewOwnerCannotBeSameAsExistingOwner';
}

/** @name PalletSchemaAccountsSchemaEntry (473) */
Expand Down
Loading