In an Inverter Workflow we have the preliminary authorizer which manages the access of the users who are subject to the individual modules of this workflow.
Defining the workflow
import { Inverter, RequestedModules } from'@inverter-network/sdk'constsdk=newInverter({ publicClient, walletClient})const { getDeploy } = sdk// Should either be `as const` or be passed dirrectly in the `run` or `simulate` function argsconstrequestedModules= { fundingManager:'FM_DepositVault_v1', paymentProcessor:'PP_Simple_v1', authorizer:'AUT_Roles_v1', optionalModules: ['LM_PC_Bounties_v1' ]} asconstsatisfiesRequestedModulesconstworkflow=awaitsdk.getWorkflow({ orchestratorAddress:'0x8a1897E6Fa0236F68f86240C391D2a7bED3Cf85c', requestedModules})
Fetch Role Hexes
To begin with the process we need the role hexes from the authorizer.
For admin roles we need to use the granteRole or revokeRole function from the authorizer.
For the granting or revoking we are using the non generated role.
constargs= [ adminRole,walletClient.account.address,] asconst// Grant roleconsttxHash=awaitworkflow.authorizer.write.grantRole.run(args)// Revoke roleconsttxHash=awaitworkflow.authorizer.write.revokeRole.run(args)
Module Role
For any role which is not a orchestrator admin role we need to generate a role id using the authorizer this generation is necessary to have a unique identifier since every workflow has different modules with different addresses.
Generate Role
Note that this is only to check the status of a module role.