Skip to main content

createRole(roleName, roleId, seed)

Create a new role in the peaq network’s Role-Based Access Control (RBAC) system.

Create Role Code Examples

On EVM, createRole returns the tx wrapped in an object alongside roleId, so you can read the generated role ID when you did not set one yourself.

fetchRole(owner, roleId, wssBaseUrl)

Fetches the role stored at the given roleId for the owner address.

Fetch Role Code Examples

fetchRoles(owner, wssBaseUrl)

Fetches every role owned by the given address.

Fetch Roles Code Examples

updateRole(roleName, roleId, seed)

Allows the owner to update the role name.

Update Role Code Examples

disableRole(roleId, seed)

Disables a role.

Disable Role Code Examples

assignRoleToUser(userId, roleId, seed)

Assigns a role to a user.

Assign Role to User Code Examples

fetchUserRoles(owner, userId, wssBaseUrl)

Fetches the roles assigned to a user.

Fetch User Roles Code Examples

unassignRoleToUser(userId, roleId, seed)

Removes a role from a user.

Unassign Role to User Code Examples