Skip to content

MultiAsset

Extends: RefCounted

Description

A value held at a Utxo is used for representing these assets and their respective quantities.

A value held at a Utxo is used for representing these assets and their respective quantities.

Constants Descriptions

Status

enum Status{SUCCESS = 0, COULD_NOT_EXTRACT_POLICY_ID = 1, COULD_NOT_EXTRACT_ASSET_NAME = 2, COULD_NOT_DECODE_HEX = 3, INVALID_ASSET_NAME = 4, OTHER_ERROR = 5}

Method Descriptions

_init

func _init(multi_asset: _MultiAsset) -> MultiAsset

get_asset_quantity

func get_asset_quantity(asset: AssetClass) -> BigInt

Return the quantity of the given [param asset] held.

get_tokens

func get_tokens(policy_id: PolicyId) -> Dictionary

Get a Dictionary mapping [class AssetName]s to [class BigInt]s under the given [param policy_id].

set_asset_quantity

func set_asset_quantity(asset: AssetClass, quantity: BigInt) -> SetAssetResult

Set the [param quantity] of the given [param asset].

add_asset

func add_asset(asset: AssetClass, quantity: BigInt) -> SetAssetResult

merge

func merge(other: MultiAsset)

to_dictionary

func to_dictionary() -> Dictionary

Convert to a dictionary representation. This can be used by [method from_dictionary].

duplicate

func duplicate() -> MultiAsset

from_dictionary (static)

func from_dictionary(assets: Dictionary) -> FromDictionaryResult

Try to parse a dictionary into a MultiAssets as values.

empty (static)

func empty() -> MultiAsset

Return a value with no assets

Sub-classes

FromDictionaryResult

Property Descriptions

value

var value: MultiAsset
  • Getter: @value_getter

WARNING: This function may fail! First match on Result.tag or call Result.is_ok.

error

var error: String
  • Getter: @error_getter

WARNING: This function may fail! First match on Result.tag or call Result._is_err.

SetAssetResult

Property Descriptions

value

var value: Variant
  • Getter: @value_getter

WARNING: This function may fail! First match on Result.tag or call Result.is_ok.

error

var error: String
  • Getter: @error_getter

WARNING: This function may fail! First match on Result.tag or call Result._is_err.