RBAC work, adding updateMetadata and updateAdminRoles operations#659
Open
rbaconcordium wants to merge 11 commits intofeature/rbacfrom
Open
RBAC work, adding updateMetadata and updateAdminRoles operations#659rbaconcordium wants to merge 11 commits intofeature/rbacfrom
rbaconcordium wants to merge 11 commits intofeature/rbacfrom
Conversation
soerenbf
reviewed
Mar 4, 2026
Contributor
soerenbf
left a comment
There was a problem hiding this comment.
Looks good in general. Here are a few things I think would be good to add/change:
- Change the target branch to a feature branch that collects functionality for the feature (as discussed)
- Add unit tests for the CBOR encoding of the operations added
- Update the
CHANGELOG.md
packages/sdk/src/plt/Token.ts
Outdated
Comment on lines
+952
to
+980
|
|
||
| /** | ||
| * assign roles to admin or revoke roles from admin | ||
| * @param {TokenOperationType} type - The type of operation, either `AssignAdminRoles` or `RevokeAdminRoles`. | ||
| * @param {Token} token - The token to update. | ||
| * @param {TokenUpdateAdminRolesDetails} updateAdminRoleDetails - role details to be processed | ||
| * @param {AccountAddress.Type} sender - The account address of the sender. | ||
| * @param {AccountSigner} signer - The signer responsible for signing the transaction. | ||
| * @param {TokenUpdateMetadata} [metadata={ expiry: TransactionExpiry.futureMinutes(5) }] - The metadata for the token update. | ||
| * @returns A promise that resolves to the transaction hash. | ||
|
|
||
| */ | ||
| export async function updateAdminRoles( | ||
| type: TokenOperationType.AssignAdminRoles | TokenOperationType.RevokeAdminRoles, | ||
| token: Token, | ||
| updateAdminRoleDetails: TokenUpdateAdminRolesDetails, | ||
| sender: AccountAddress.Type, | ||
| signer: AccountSigner, | ||
| metadata?: TokenUpdateMetadata | ||
| ): Promise<TransactionHash.Type> { | ||
| switch (type) { | ||
| case TokenOperationType.AssignAdminRoles: | ||
| return assignAdminRoles(token, updateAdminRoleDetails, sender, signer, metadata); | ||
| case TokenOperationType.RevokeAdminRoles: | ||
| return revokeAdminRoles(token, updateAdminRoleDetails, sender, signer, metadata); | ||
| default: | ||
| throw new Error(`Unsupported operation type: ${type}`); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
I don't think we need this. The type in the cddl is mostly there to collect similar operations under a single name but it's not useful I think.
Contributor
Author
There was a problem hiding this comment.
removing this function and exporting the individual functions instead.
| UpdateAllowList = 'allowList', | ||
| UpdateDenyList = 'denyList', | ||
| Pause = 'pause', | ||
| Unpause = 'unpause', |
Contributor
There was a problem hiding this comment.
Suggested change
| Unpause = 'unpause', |
There's no "unpause" role, the "pause" role will be used for this purpose as well 🙂
Contributor
Author
I have changed as per above. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
To introduce two operations, to update metadata and to update admin roles.
Changes
Added two functions, updateMetadata and updateAdminRoles.
Added TokenOperationType.UpdateMetadata and TokenOperationType.AssignAdminRoles, RevokeAdminRoles.
Added enum TokenAdminRole
Added type TokenUpdateAdminRoleDetails
Added operation types TokenUpdateAdminRoleOperation, TokenAssignAdminRolesOperation, TokenRevokeAdminRolesOperation and TokenUpdateMetadataOperation
Checklist
hard-to-understand areas.
CLA acceptance
_Remove if not applicable.
By submitting the contribution I accept the terms and conditions of the
Contributor License Agreement v1.0
link: https://developers.concordium.com/CLAs/Contributor-License-Agreement-v1.0.pdf
I accept the above linked CLA.