MultiAsset

package
v1.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiAsset

type MultiAsset[V int64 | uint64] map[Policy.PolicyId]Asset.Asset[V]

func (MultiAsset[V]) Add

func (ma MultiAsset[V]) Add(other MultiAsset[V]) MultiAsset[V]

*

Add adds another MultiAsset to the current MultiAsset.

Params:
	other MultiAsset[V]: The MultiAsset to add.

Returns:
	MultiAsset[V]: The result of the addition.

func (MultiAsset[V]) Clone

func (ma MultiAsset[V]) Clone() MultiAsset[V]

*

Clone creates a deep copy of the MultiAsset.

Returns:
	MultiAsset[V]: A copy of the MultiAsset.

func (MultiAsset[V]) Equal

func (ma MultiAsset[V]) Equal(other MultiAsset[V]) bool

*

Equal checks if two MultiAsset instances are equal.

Params:
	other MultiAsset[V]: The other MultiAsset to compare.

Returns:
	bool: True if the two MultiAsset instances are equal, false otherwise.

func (MultiAsset[V]) Filter

func (ma MultiAsset[V]) Filter(f func(policy Policy.PolicyId, asset AssetName.AssetName, quantity V) bool) MultiAsset[V]

*

Filter returns a MultiAsset containing only the assets that
satisfy the filter function.

Params:
	f func(policy Policy.PolicyId, asset Asset.Asset[V]) bool: The filter function.

Returns:
	MultiAsset[V]: The filtered MultiAsset.

func (MultiAsset[V]) GetByPolicyAndId added in v1.0.3

func (ma MultiAsset[V]) GetByPolicyAndId(pol Policy.PolicyId, asset_name AssetName.AssetName) V

*

GetByPolicyAndId returns the asset amount given a policy and asset name.

Params:
	pol Policy.PolicyId: The policy ID.
	asset_name AssetName.AssetName: The asset name.

Returns:
	V: The asset amount.

func (MultiAsset[V]) Greater

func (ma MultiAsset[V]) Greater(other MultiAsset[V]) bool

*

Greater checks if the current MultiAsset is greater
than another MultiAsset.

Params:
	other MultiAsset[V]: The other MultiAsset to compare.

Returns:
	bool: True if the current MultiAsset is greater than the other, false otherwise.

func (MultiAsset[V]) Less

func (ma MultiAsset[V]) Less(other MultiAsset[V]) bool

*

Less checks if the current MultiAsset is less
than another MultiAsset.

Params:
	other MultiAsset[V]: The other MultiAsset to compare.

Returns:
	bool: True if the current MultiAsset is less than the other, false otherwise.

func (MultiAsset[V]) RemoveZeroAssets

func (ma MultiAsset[V]) RemoveZeroAssets() MultiAsset[V]

*

RemoveZeroAssets removes assets with a zero amount from the MultiAsset.

Returns:
	MultiAsset[V]: A MultiAsset with zero-amount assets removed.

func (MultiAsset[V]) Sub

func (ma MultiAsset[V]) Sub(other MultiAsset[V]) MultiAsset[V]

*

Sub subtracts another MultiAsset from the current MultiAsset.

Params:
	other MultiAsset[V]: The MultiAsset to subtract.

Returns:
	MultiAsset[V]: The result of the subtraction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL