Using Numscript

Numscript is the built-in scripting language of Numary. The main design goal of Numscript is to make it easy & safe to model complex financial transactions.

Numscript-based transactions can either be created by using the script endpoint, or by using the command numary exec <ledger-name> script.num

A simple send

send [COIN 100] (
  source = @world
  destination = @users:001

Sending from multiple accounts

It is possible to send money from multiple accounts in cascade. In this case, the machine will sequentially draw funds from the specified accounts in order, until it reaches the required amount.

send [COIN 100] (
  source = {
  destination = @payments:acme_01234

Sending to multiple accounts

The send operation features a built-in allocation system where a monetary value can be split and sent to multiple destinations according to the specified repartition.

send [USD/2 1099] (
  source = @rides:001
  destination = {
    85% to @drivers:033
    15% to @platform:fees

Note that the order of destinations is important. The total remainder value of the repartition, if any, will be spread from top to bottom. In the example above, the unsplittable cent will go to the driver.

Injecting variables

vars {
  account $driver

send [USD/2 99] (
  source = @platform:tips
  destination = $driver

Checking your script

numary check script.num