_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. get_amount
Numscript

get_amount

Numscript

Requires flag: experimental-get-amount-function

Returns the numeric amount part of a monetary value.

Numscript
vars {
  monetary $payment
  number $amount = get_amount($payment)
}

send $payment (
  source = @world
  destination = @users:1234
)

set_tx_meta("amount", $amount)

With $payment = [EUR/2 5000], $amount resolves to 5000.

Use cases#

  • Store the amount of a dynamic monetary variable in transaction metadata
  • Compute fees or splits based on the amount
  • Log transaction amounts independently of the asset
get_assetMid-script Function Calls
On This Page
  • Use cases