getWorkflow

The getWorkflow method is the standard way of getting a whole workflow with instances of all associated modules.

Parameters: an object with the following properties

{
    publicClient: PublicClient // the public client / provider to make RPC calls
    walletClient: WalletClient // the wallet client to sign and submit transactions
    orchestratorAddress: 0x${string} // the address of a deployed orchestrator proxy contract
    requestedModules?: WorkflowRequestedModules // includes a specification of the modules used by the workflow. That is which Authorizer, Funding Manager, Payment Processor and optional logic modules are used.
}

Note: passing a requestedModules will ensure typesafety and type completion.

Returns: on object with the following properties

// each ModuleName corresponds to the name of a module (e.g. FM_DepositVault_v1) 
// and each Module is a module instance as described in the previous section
{
    orchestrator: GetModuleReturn<'Orchestrator_v1', W>
    fundingManager: GetModuleReturn<ModuleName, W>
    authorizer: GetModuleReturn<ModuleName, W>
    paymentProcessor: GetModuleReturn<ModuleName, W>
    optionalModule: {
        [name: ModuleName]: GetModuleReturn<ModuleName, W>
    }
    fundingToken: {
        address: `0x${string}`
        module: GetModuleReturn<'ERC20', W>
        decimals: number
        symbol: string
    }
    // issuance token is conditional based on modules which use issuance logic
    issuanceToken: {
        address: `0x${string}`
        module: GetModuleReturn<'ERC20', W>
        decimals: number
        symbol: string
    }
}

Example:

import { getWorkflow } from '@inverter-network/sdk'

const workflow = await getWorkflow({
    publicClient,
    walletClient,
    orchestratorAddress: '0x8a1897E6Fa0236F68f86240C391D2a7bED3Cf85c',
    requestedModules: {
      authorizer: 'AUT_Roles_v1',
      fundingManager: 'FM_DepositVault_v1',
      paymentProcessor: 'PP_Simple_v1',
      optionalModules: ['LM_PC_Bounties_v1'],
    },
})

const bountyIds = await workflow.optionalModule.LM_PC_Bounties_v1.read.listBountyIds.run()

Last updated