-
Notifications
You must be signed in to change notification settings - Fork 11
/
RoleControl.ts
43 lines (35 loc) · 1004 Bytes
/
RoleControl.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Copyright (c) 2024 DSR Corporation, Denver, Colorado.
* https://www.dsr-corporation.com
* SPDX-License-Identifier: Apache-2.0
*/
import { Account } from '../utils/account'
import { Contract } from '../utils/contract'
export enum ROLES {
EMPTY,
TRUSTEE,
ENDORSER,
STEWARD,
}
export class RoleControl extends Contract {
constructor(sender?: Account) {
super(RoleControl.name, sender)
}
public async getRole(account: string) {
return this.instance.getRole(account)
}
public async hasRole(role: number, account: string) {
return this.instance.hasRole(role, account)
}
public async assignRole(role: number, account: string) {
const tx = await this.instance.assignRole(role, account)
return tx.wait()
}
public async revokeRole(role: number, account: string) {
const tx = await this.instance.revokeRole(role, account)
return await tx.wait()
}
public async getRoleCount(role: number) {
return this.instance.getRoleCount(role)
}
}