# Deploy a Workflow

## **Setup Requirements**

1. **Set up Inverter Network SDK**: Refer to the[ Quick Start](https://docs.inverter.network/sdk/typescript-sdk) Guide for detailed instructions.

{% hint style="info" %}
*( optional )* You can pass in a ModuleData typed object into the `requestedModules` constant's fields, this makes it so that you can work with your self managed inverter modules
{% endhint %}

```typescript
// 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
```

***

## Retrieve the Deployment Functions

To deploy your initial workflow, you will need to retrieve the deployment functions. Please ensure that you adjust the [`requestedModules`](https://docs.inverter.network/sdk/api/deployworkflow) to match the ones you want to include in your workflow. Retrieve the `deployWorkflow` function as shown below:

**Parameters**

* **`requestedModules` (required)**:\
  This parameter defines the modules which will be deployed.
* `tagConfig` **(optional)**:\
  This parameter is to provide the deployment with parser metadata.
* `useTags` **(optional):**\
  This parameter is to optionally disable auto format parse for inputs and outputs (default true).

{% code overflow="wrap" %}

```typescript
import { sdk } from '<your_sdk_export>'
import type { MixedRequestedModules } from '@inverter-network/sdk'

const { deployWorkflow } = 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 { inputs, estimateGas, run, simulate } = await deployWorkflow({
    requestedModules
})
```

{% endcode %}

## Deploying the Workflow

After setting up your deployment with the `deployWorkflow` function, you can proceed to deploy the workflow with the specified modules by calling the `run` function and passing the configuration arguments, as shown below:

**Parameters**

* **`args` (required)**:\
  These arguments will be strongly typed by the inverter types library, you need to prove the arguments required by the modules.
* `options` **(optional)**:\
  These are contract executions options, i.e. which can define the number of confirmations...

{% code overflow="wrap" %}

```typescript
import type { GetDeployWorkflowArgs } from '@inverter-network/sdk'

// Should either be `as const` or be passed dirrectly in the `estimateGas`, `run`, `simulate` or `bytecode` function args
const args = {
    // orchestrator section is optional
    orchestrator: {
        independentUpdates: true,
        independentUpdatesAdmin: "0x5eb14c2e7D0cD925327d74ae4ce3fC692ff8ABEF",
    },
    fundingManager: {
        orchestratorTokenAddress: "0x5eb14c2e7D0cD925327d74ae4ce3fC692ff8ABEF",
    },
    authorizer: {
        initialAdmin: "0x7AcaF5360474b8E40f619770c7e8803cf3ED1053",
    },
    optionalModules: {
        LM_PC_RecurringPayments_v1: {
            epochLength: "70000000",
        },
    },
} as const satisfies GetDeployWorkflowArgs<typeof requestedModules>

const { orchestratorAddress, transactionHash } = await run(args);
```

{% endcode %}
