Skip to main content

@description

Class for interacting with Permissions in the Switchboard and SwitchboardAttestationService contracts.

Index

Methods

publicstaticget

  • get(switchboard: ISwitchboardProgram, granter: AttestationQueueAccount | OracleQueueAccount, grantee: string): Promise<NONE | PERMIT_ORACLE_HEARTBEAT | PERMIT_ORACLE_QUEUE_USAGE | PERMIT_ATTESTATION_QUEUE_USAGE>
  • @async
    @function

    get

    @description

    Static method to set permissions between a granter and a grantee


    Parameters

    Returns Promise<NONE | PERMIT_ORACLE_HEARTBEAT | PERMIT_ORACLE_QUEUE_USAGE | PERMIT_ATTESTATION_QUEUE_USAGE>

    Promise that resolves to the ContractTransaction

    const contractTransaction = await Permissions.set(switchboard, granter, grantee, permission, enable, options);

publicstaticgetAttestationPermissions

  • getAttestationPermissions(switchboard: ISwitchboardProgram, granter: string, grantee: string): Promise<NONE | PERMIT_ORACLE_HEARTBEAT | PERMIT_ORACLE_QUEUE_USAGE | PERMIT_ATTESTATION_QUEUE_USAGE>
  • @async
    @function

    getAttestationPermissions

    @description

    Static method to fetch permissions between a granter and a grantee


    Parameters

    • switchboard: ISwitchboardProgram

      Instance of the Switchboard Program class

    • granter: string

      The account granting permissions

    • grantee: string

      The account being granted permissions

    Returns Promise<NONE | PERMIT_ORACLE_HEARTBEAT | PERMIT_ORACLE_QUEUE_USAGE | PERMIT_ATTESTATION_QUEUE_USAGE>

    Promise that resolves to the permission string

    const contractTransaction = await Permissions.setSwitchboardPermissions(switchboard, granter, grantee, permission, enable, options);

publicstaticgetSwitchboardPermissions

  • getSwitchboardPermissions(switchboard: ISwitchboardProgram, granter: string, grantee: string): Promise<NONE | PERMIT_ORACLE_HEARTBEAT | PERMIT_ORACLE_QUEUE_USAGE | PERMIT_ATTESTATION_QUEUE_USAGE>
  • @async
    @function

    getSwitchboardPermissions

    @description

    Static method to fetch permissions between a granter and a grantee


    Parameters

    • switchboard: ISwitchboardProgram

      Instance of the Switchboard Program class

    • granter: string

      The account granting permissions

    • grantee: string

      The account being granted permissions

    Returns Promise<NONE | PERMIT_ORACLE_HEARTBEAT | PERMIT_ORACLE_QUEUE_USAGE | PERMIT_ATTESTATION_QUEUE_USAGE>

    Promise that resolves to the permission string

    const contractTransaction = await Permissions.setSwitchboardPermissions(switchboard, granter, grantee, permission, enable, options);

publicstatichas

  • @async
    @function

    has

    @description

    Static method to determine whether a given grantee and granter have a set of permissions


    Parameters

    Returns Promise<boolean>

    Promise that resolves to a boolean indicating whether the grantee and granter have the set of permissions

    const hasPermissions = await Permissions.has(switchboard, granter, grantee, permission);

publicstatichasAttestationPermissions

  • hasAttestationPermissions(switchboard: ISwitchboardProgram, granter: string, grantee: string, permission: number): Promise<boolean>
  • @async
    @function

    hasAttestationPermissions

    @description

    Static method to determine whether a given grantee and granter have a set of permissions in Attestation


    Parameters

    • switchboard: ISwitchboardProgram

      Instance of the Switchboard Program class

    • granter: string

      The account granting permissions

    • grantee: string

      The account being granted permissions

    • permission: number

      The type of permissions to check

    Returns Promise<boolean>

    Promise that resolves to a boolean indicating whether the grantee and granter have the set of permissions in Attestation

    const hasPermissions = await Permissions.hasAttestationPermissions(switchboard, granter, grantee, permission);

publicstatichasSwitchboardPermissions

  • hasSwitchboardPermissions(switchboard: ISwitchboardProgram, granter: string, grantee: string, permission: number): Promise<boolean>
  • @async
    @function

    hasSwitchboardPermissions

    @description

    Static method to determine whether a given grantee and granter have a set of permissions in Switchboard


    Parameters

    • switchboard: ISwitchboardProgram

      Instance of the Switchboard Program class

    • granter: string

      The account granting permissions

    • grantee: string

      The account being granted permissions

    • permission: number

      The type of permissions to check

    Returns Promise<boolean>

    Promise that resolves to a boolean indicating whether the grantee and granter have the set of permissions in Switchboard

    const hasPermissions = await Permissions.hasSwitchboardPermissions(switchboard, granter, grantee, permission);

publicstaticset

  • @async
    @function

    set

    @description

    Static method to set permissions between a granter and a grantee


    Parameters

    • switchboard: ISwitchboardProgram

      Instance of the SwitchboardProgram class

    • granter: AttestationQueueAccount | OracleQueueAccount

      The account granting permissions

    • grantee: string

      The account being granted permissions

    • permission: number

      The type of permissions to grant

    • optionalenable: boolean

      Whether to enable the permissions

    • optionaloptions: any

      Transaction options

    Returns Promise<ContractTransaction>

    Promise that resolves to the ContractTransaction

    const contractTransaction = await Permissions.set(switchboard, granter, grantee, permission, enable, options);

publicstaticsetAttestationPermissions

  • setAttestationPermissions(switchboard: ISwitchboardProgram, granter: string, grantee: string, permission: number, enable?: boolean, options?: any): Promise<ContractTransaction>
  • @async
    @function

    setAttestationPermissions

    @description

    Static method to set permissions between a granter and a grantee in Attestation


    Parameters

    • switchboard: ISwitchboardProgram

      Instance of the Switchboard Program class

    • granter: string

      The account granting permissions

    • grantee: string

      The account being granted permissions

    • permission: number

      The type of permissions to grant

    • optionalenable: boolean

      Whether to enable the permissions

    • optionaloptions: any

      Transaction options

    Returns Promise<ContractTransaction>

    Promise that resolves to the ContractTransaction

    const contractTransaction = await Permissions.setAttestationPermissions(switchboard, granter, grantee, permission, enable, options);

publicstaticsetSwitchboardPermissions

  • setSwitchboardPermissions(switchboard: ISwitchboardProgram, granter: string, grantee: string, permission: number, enable?: boolean, options?: any): Promise<ContractTransaction>
  • @async
    @function

    setSwitchboardPermissions

    @description

    Static method to set permissions between a granter and a grantee


    Parameters

    • switchboard: ISwitchboardProgram

      Instance of the Switchboard Program class

    • granter: string

      The account granting permissions

    • grantee: string

      The account being granted permissions

    • permission: number

      The type of permissions to grant

    • optionalenable: boolean

      Whether to enable the permissions

    • optionaloptions: any

      Transaction options

    Returns Promise<ContractTransaction>

    Promise that resolves to the ContractTransaction

    const contractTransaction = await Permissions.setSwitchboardPermissions(switchboard, granter, grantee, permission, enable, options);