_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_asset
Numscript

get_asset

Numscript

Requires flag: experimental-get-asset-function

Returns the asset part of a monetary value.

Numscript
vars {
  monetary $payment
  asset $asset = get_asset($payment)
}

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

set_tx_meta("currency", $asset)

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

Use cases#

  • Store the asset of a dynamic monetary variable in transaction metadata
  • Route transactions differently based on currency
  • Validate asset type before processing
Account Interpolationget_amount
On This Page
  • Use cases