Built-in functions callable from Numscript. Which functions you can use depends on the interpreter version bundled in your Ledger release — see Selecting an Interpreter for the full availability matrix.
The entries below reflect your current selection: each experimental function shows whether it is available for the interpreter version you have selected.
Statements#
These are available on both the original (machine) and experimental interpreters.
set_tx_meta("key", value)#
Writes metadata to the transaction. The key is a string; the value can be any type, as a literal or a variable. Details
Available from: all versions (machine and experimental-interpreter).
set_account_meta(account, "key", value)#
Writes metadata to an account during the transaction. Details
Available from: all versions (machine and experimental-interpreter).
Functions in vars#
These functions are called when initializing variables in the vars block. They require the experimental interpreter (runtime: experimental-interpreter) and the experimental-mid-script-function-call flag.
meta(account, "key")#
Reads structured account metadata into a typed variable. Details
Available from: interpreter 0.0.15 · Ledger 2.3 · Stack v3.1 · flag experimental-mid-script-function-call
balance(account, asset)#
Returns the balance of an account for an asset. Fails on negative balances — use overdraft() for accounts that may go negative. Details
Available from: interpreter 0.0.15 · Ledger 2.3 · Stack v3.1 · flag experimental-mid-script-function-call
overdraft(account, asset)#
Returns the positive overdraft amount of an account, or zero if the balance is non-negative. Details
Available from: interpreter 0.0.15 · Ledger 2.3 · Stack v3.1 · flags experimental-overdraft-function, experimental-mid-script-function-call
get_asset(monetary)#
Returns the asset part of a monetary value. Details
Available from: interpreter 0.0.16 · Ledger 2.3 · Stack v3.1 · flag experimental-get-asset-function
get_amount(monetary)#
Returns the numeric amount part of a monetary value. Details
Available from: interpreter 0.0.16 · Ledger 2.3 · Stack v3.1 · flag experimental-get-amount-function