🔁Workflow Creation

Creating workflows involves defining triggers and actions, and deploying them on the blockchain.

Example

const workflowFactory = new WorkflowsFactory(provider);

  const wf = await workflowFactory.create({
    name: 'MultiSender Action Example',
    triggers: [new InstantTrigger()], // or [] for no triggers === instant workflow execution
    actions: [
      new MultiSenderAction(
        {
          items: recepients.map(([to, amount]) => ({
            to,
            amount: parseUnits(amount, tokens.usdt.decimals),
            asset: tokens.usdt,
          })),
        },
        commonConfig
      ),
    ],
    chainId,
  });

  const tx = await wf.buildAndDeploy(swAddress, account as Address);

In this example, tokens are sent to multiple recipients with the specified amounts.

Try this with our npm packages and check out more on GitHub.

Last updated