Operate a Workflow
Setup Requirements
Set up Inverter Network SDK: Refer to the Quick Start guide for detailed instructions.
Deploy a Workflow: Refer to the Deploy a Workflow guide for detailed instructions.
// EXEMPLE MixedRequestedModules USAGE
import type { ModuleData, MixedRequestedModules } from '@inverter-network/sdk'
const AUT_Roles_v1 = {'<your_module_data>'} as const satisifies ModuleData
const requestedModules = {
fundingManager: 'FM_DepositVault_v1',
paymentProcessor: 'PP_Simple_v1',
authorizer: AUT_Roles_v1,
} as const satisfies MixedRequestedModules
Retrieving a Workflow
Parameters
orchestratorAddress
(required): The address of the orchestrator responsible for managing the workflow. This parameter must always be provided.requestedModules
(optional): Suggested to be included for end-to-end TypeScript coverage. This parameter provides additional context or configuration for the workflow's orientation.
import { sdk } from '<your_sdk_export>'
const { getWorkflow } = sdk
// Should either be `as const` or be passed dirrectly in the `requestedModules`
const requestedModules = {
fundingManager: 'FM_DepositVault_v1',
paymentProcessor: 'PP_Simple_v1',
authorizer: 'AUT_Roles_v1',
optionalModules: [
'LM_PC_Bounties_v1', 'LM_PC_RecurringPayments_v1'
]
} as const satisfies MixedRequestedModules
const workflow = await getWorkflow({
orchestratorAddress: '0x8a1897E6Fa0236F68f86240C391D2a7bED3Cf85c',
requestedModules
});
const {
orchestrator,
authorizer,
fundingManager,
optionalModule,
fundingToken
} = workflow
Reading Data
You can read data from any of the modules as shown below. In this example, we are retrieving the totalSupply
of the fundingToken:
const totalSupply = await workflow.fundingToken.module.read.totalSupply.run();
Writing Data
You can write data to any of the modules as shown below. In this example, we are making a deposit to the funding manager:
const txHash = await workflow.fundingManager.write.deposit.run('100', {
confirmations: 1,
onHash: (hash) => {console.log(hash)},
onConfirmation: (receipt) => {console.log(receipt)},
onApprove: (receipts) => {console.log(receipts)}
});
Last updated