Documentation
¶
Index ¶
- type MultiAsset
- func (ma MultiAsset[V]) Add(other MultiAsset[V]) MultiAsset[V]
- func (ma MultiAsset[V]) Clone() MultiAsset[V]
- func (ma MultiAsset[V]) Equal(other MultiAsset[V]) bool
- func (ma MultiAsset[V]) Filter(f func(policy Policy.PolicyId, asset AssetName.AssetName, quantity V) bool) MultiAsset[V]
- func (ma MultiAsset[V]) GetByPolicyAndId(pol Policy.PolicyId, asset_name AssetName.AssetName) V
- func (ma MultiAsset[V]) Greater(other MultiAsset[V]) bool
- func (ma MultiAsset[V]) IsEmpty() bool
- func (ma MultiAsset[V]) Less(other MultiAsset[V]) bool
- func (ma MultiAsset[V]) MarshalCBOR() ([]byte, error)
- func (ma MultiAsset[V]) RemoveZeroAssets() MultiAsset[V]
- func (ma MultiAsset[V]) Sub(other MultiAsset[V]) MultiAsset[V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultiAsset ¶
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]) IsEmpty ¶ added in v1.6.0
func (ma MultiAsset[V]) IsEmpty() bool
IsEmpty returns true if the MultiAsset is nil or empty. This method is used by the CBOR library to determine if the field should be omitted when using the "omitempty" tag.
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]) MarshalCBOR ¶ added in v1.6.0
func (ma MultiAsset[V]) MarshalCBOR() ([]byte, error)
MarshalCBOR serializes the MultiAsset to CBOR format with deterministic key ordering. Policy IDs are sorted lexicographically by their byte representation, and asset names within each policy are also sorted lexicographically.
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.
Click to show internal directories.
Click to hide internal directories.