_Docs/
Get StartedModulesPlatformDeployCookbookChangelogReference
_Stack
_Modules
  • Ledger
  • Numscript
    • Program Structure
    • Selecting an Interpreter
    • Unambiguous Monetary Notation
    • CLI
    • Numscript specs format
    • Reference
      • Send
      • Sources
      • Destinations
      • Rounding
      • Save
      • Overdraft
      • Variables
      • Metadata
      • oneofexp
      • Account Interpolationexp
      • get_assetexp
      • get_amountexp
      • Mid-script Function Callsexp
      • Asset Colorsexp
  • Connectivity
  • WalletsEE
  • FlowsEE
  • ReconciliationEE
  1. Modules
  2. Numscript
  3. Reference
  4. Account Interpolation
Numscript

Account Interpolation

Numscript

Requires flag: experimental-account-interpolation

Build account addresses dynamically by inserting variables into the address:

Numscript
vars {
  string $user_id
  string $type
}

send [USD/2 1000] (
  source = @world
  destination = @users:$user_id:wallets:$type
)

With $user_id = "42" and $type = "main", the destination resolves to @users:42:wallets:main.

Supported variable types#

Account, string, and number variables can be interpolated. Each is coerced to a string and inserted into the address.

Numscript
vars {
  number $id
  account $org
}

send [USD/2 500] (
  source = @world
  destination = @orgs:$org:members:$id:balance
)

Use cases#

  • Route to user-specific accounts without hardcoding addresses
  • Build hierarchical account structures from transaction parameters
  • Create dynamic chart-of-accounts patterns like @orders:$order_id:payments:$payment_id
oneofget_asset
On This Page
  • Supported variable types
  • Use cases