UNPKG

@q-dev/q-ts-gdk-sdk

Version:

Typescript Library to interact with GDK Contracts

142 lines (141 loc) 7.01 kB
/// <reference types="node" /> import type { ContractOptions } from "web3-eth-contract"; import type { EventLog } from "web3-core"; import type { EventEmitter } from "events"; import type { Callback, NonPayableTransactionObject, BlockType, ContractEventLog, BaseContract } from "./types"; export interface EventOptions { filter?: object; fromBlock?: BlockType; topics?: string[]; } export type AddedPermissions = ContractEventLog<{ role: string; resource: string; permissionsToAdd: string[]; allowed: boolean; 0: string; 1: string; 2: string[]; 3: boolean; }>; export type AddedToGroups = ContractEventLog<{ who: string; groupsToAddTo: string[]; 0: string; 1: string[]; }>; export type GrantedGroupRoles = ContractEventLog<{ groupTo: string; rolesToGrant: string[]; 0: string; 1: string[]; }>; export type GrantedRoles = ContractEventLog<{ to: string; rolesToGrant: string[]; 0: string; 1: string[]; }>; export type Initialized = ContractEventLog<{ version: string; 0: string; }>; export type RemovedFromGroups = ContractEventLog<{ who: string; groupsToRemoveFrom: string[]; 0: string; 1: string[]; }>; export type RemovedPermissions = ContractEventLog<{ role: string; resource: string; permissionsToRemove: string[]; allowed: boolean; 0: string; 1: string; 2: string[]; 3: boolean; }>; export type RevokedGroupRoles = ContractEventLog<{ groupFrom: string; rolesToRevoke: string[]; 0: string; 1: string[]; }>; export type RevokedRoles = ContractEventLog<{ from: string; rolesToRevoke: string[]; 0: string; 1: string[]; }>; export interface RBACGroupable extends BaseContract { constructor(jsonInterface: any[], address?: string, options?: ContractOptions): RBACGroupable; clone(): RBACGroupable; methods: { ALL_PERMISSION(): NonPayableTransactionObject<string>; ALL_RESOURCE(): NonPayableTransactionObject<string>; CREATE_PERMISSION(): NonPayableTransactionObject<string>; DELETE_PERMISSION(): NonPayableTransactionObject<string>; MASTER_ROLE(): NonPayableTransactionObject<string>; RBAC_RESOURCE(): NonPayableTransactionObject<string>; READ_PERMISSION(): NonPayableTransactionObject<string>; UPDATE_PERMISSION(): NonPayableTransactionObject<string>; addPermissionsToRole(role_: string, permissionsToAdd_: [string, string[]][], allowed_: boolean): NonPayableTransactionObject<void>; addUserToGroups(who_: string, groupsToAddTo_: string[]): NonPayableTransactionObject<void>; getGroupRoles(group_: string): NonPayableTransactionObject<string[]>; getRolePermissions(role_: string): NonPayableTransactionObject<{ allowed_: [string, string[]][]; disallowed_: [string, string[]][]; 0: [string, string[]][]; 1: [string, string[]][]; }>; getUserGroups(who_: string): NonPayableTransactionObject<string[]>; getUserRoles(who_: string): NonPayableTransactionObject<string[]>; grantGroupRoles(groupTo_: string, rolesToGrant_: string[]): NonPayableTransactionObject<void>; grantRoles(to_: string, rolesToGrant_: string[]): NonPayableTransactionObject<void>; hasPermission(who_: string, resource_: string, permission_: string): NonPayableTransactionObject<boolean>; removePermissionsFromRole(role_: string, permissionsToRemove_: [string, string[]][], allowed_: boolean): NonPayableTransactionObject<void>; removeUserFromGroups(who_: string, groupsToRemoveFrom_: string[]): NonPayableTransactionObject<void>; revokeGroupRoles(groupFrom_: string, rolesToRevoke_: string[]): NonPayableTransactionObject<void>; revokeRoles(from_: string, rolesToRevoke_: string[]): NonPayableTransactionObject<void>; }; events: { AddedPermissions(cb?: Callback<AddedPermissions>): EventEmitter; AddedPermissions(options?: EventOptions, cb?: Callback<AddedPermissions>): EventEmitter; AddedToGroups(cb?: Callback<AddedToGroups>): EventEmitter; AddedToGroups(options?: EventOptions, cb?: Callback<AddedToGroups>): EventEmitter; GrantedGroupRoles(cb?: Callback<GrantedGroupRoles>): EventEmitter; GrantedGroupRoles(options?: EventOptions, cb?: Callback<GrantedGroupRoles>): EventEmitter; GrantedRoles(cb?: Callback<GrantedRoles>): EventEmitter; GrantedRoles(options?: EventOptions, cb?: Callback<GrantedRoles>): EventEmitter; Initialized(cb?: Callback<Initialized>): EventEmitter; Initialized(options?: EventOptions, cb?: Callback<Initialized>): EventEmitter; RemovedFromGroups(cb?: Callback<RemovedFromGroups>): EventEmitter; RemovedFromGroups(options?: EventOptions, cb?: Callback<RemovedFromGroups>): EventEmitter; RemovedPermissions(cb?: Callback<RemovedPermissions>): EventEmitter; RemovedPermissions(options?: EventOptions, cb?: Callback<RemovedPermissions>): EventEmitter; RevokedGroupRoles(cb?: Callback<RevokedGroupRoles>): EventEmitter; RevokedGroupRoles(options?: EventOptions, cb?: Callback<RevokedGroupRoles>): EventEmitter; RevokedRoles(cb?: Callback<RevokedRoles>): EventEmitter; RevokedRoles(options?: EventOptions, cb?: Callback<RevokedRoles>): EventEmitter; allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter; }; once(event: "AddedPermissions", cb: Callback<AddedPermissions>): void; once(event: "AddedPermissions", options: EventOptions, cb: Callback<AddedPermissions>): void; once(event: "AddedToGroups", cb: Callback<AddedToGroups>): void; once(event: "AddedToGroups", options: EventOptions, cb: Callback<AddedToGroups>): void; once(event: "GrantedGroupRoles", cb: Callback<GrantedGroupRoles>): void; once(event: "GrantedGroupRoles", options: EventOptions, cb: Callback<GrantedGroupRoles>): void; once(event: "GrantedRoles", cb: Callback<GrantedRoles>): void; once(event: "GrantedRoles", options: EventOptions, cb: Callback<GrantedRoles>): void; once(event: "Initialized", cb: Callback<Initialized>): void; once(event: "Initialized", options: EventOptions, cb: Callback<Initialized>): void; once(event: "RemovedFromGroups", cb: Callback<RemovedFromGroups>): void; once(event: "RemovedFromGroups", options: EventOptions, cb: Callback<RemovedFromGroups>): void; once(event: "RemovedPermissions", cb: Callback<RemovedPermissions>): void; once(event: "RemovedPermissions", options: EventOptions, cb: Callback<RemovedPermissions>): void; once(event: "RevokedGroupRoles", cb: Callback<RevokedGroupRoles>): void; once(event: "RevokedGroupRoles", options: EventOptions, cb: Callback<RevokedGroupRoles>): void; once(event: "RevokedRoles", cb: Callback<RevokedRoles>): void; once(event: "RevokedRoles", options: EventOptions, cb: Callback<RevokedRoles>): void; }