_Docs/
Get StartedModulesPlatformDeployCookbookChangelogReference
_Stack
_Modules
  • Ledger
  • Numscript
  • Connectivity
  • WalletsEE
  • FlowsEE
    • Workflows definition
    • Workflows execution
    • Stages Reference
      • Send Statement
      • Waiting for events
      • Waiting for a delay
    • Examples
      • Ledger to Ledger
      • Payment to Wallet
      • Ledger to Stripe Payout
    • Triggers
  • ReconciliationEE
  1. Modules
  2. Flows
  3. Examples
  4. Ledger to Ledger
Flows

Ledger to Ledger

In the Formance Ledger world, ledgers are logically separated from one another.

There are occurences where you want to transfer value from one ledger to another.

Fortunately for us, Flows provide a way to do this that takes care of the underlying details for us.

Workflow definition#

YAML
---
stages:
# let's first provision a user account on our first ledger
- send:
    source:
      account:
        id: "world"
        ledger: "flows-demo-001"
    destination:
      account:
        id: "users:42"
        ledger: "flows-demo-001"
    amount:
      asset: "USD/2"
      amount: 100
# now let's transfer that value to our second ledger
- send:
    source:
      account:
        id: "users:42"
        ledger: "flows-demo-001"
    destination:
      account:
        id: "users:42"
        # note that we're sending to a different ledger
        ledger: "flows-demo-002"
    amount:
      asset: "USD/2"
      amount: 100

Running the workflow#

Let's save the above workflow to a file called ledger-to-ledger.yaml and create it:

fctl orchestration workflows create ledger-to-ledger.yaml
POST/api/orchestration/workflows

Now run the workflow:

fctl orchestration workflows run <workflow-id>
POST/api/orchestration/workflows/<workflow-id>/instances

We can now check the status of the workflow instance:

fctl orchestration instances show <workflow-instance-id>
GET/api/orchestration/instances/<workflow-instance-id>
Waiting for a delayPayment to Wallet
On This Page
  • Workflow definition
  • Running the workflow