Documentation ¶
Index ¶
- type AlonzoValue
- type Value
- func (val Value) Add(other Value) Value
- func (val *Value) AddAssets(other MultiAsset.MultiAsset[int64])
- func (val *Value) AddLovelace(amount int64)
- func (val Value) Clone() Value
- func (val Value) Equal(other Value) bool
- func (val Value) GetAssets() MultiAsset.MultiAsset[int64]
- func (val Value) GetCoin() int64
- func (val Value) Greater(other Value) bool
- func (val Value) GreaterOrEqual(other Value) bool
- func (val Value) Less(other Value) bool
- func (val Value) LessOrEqual(other Value) bool
- func (val *Value) MarshalCBOR() ([]byte, error)
- func (val Value) RemoveZeroAssets() Value
- func (val *Value) SetLovelace(amount int64)
- func (val *Value) SetMultiAsset(amount MultiAsset.MultiAsset[int64])
- func (val Value) String() string
- func (val Value) Sub(other Value) Value
- func (val *Value) SubLovelace(amount int64)
- func (val Value) ToAlonzoValue() AlonzoValue
- func (val *Value) UnmarshalCBOR(value []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlonzoValue ¶ added in v1.0.3
type AlonzoValue struct { Am Amount.AlonzoAmount Coin int64 HasAssets bool }
func (AlonzoValue) Clone ¶ added in v1.0.3
func (alVal AlonzoValue) Clone() AlonzoValue
*
Clone creates a copy of the AlonzoValue, including its assets. Returns: AlonzoValue: A copy of the AlonzoValue.
func (*AlonzoValue) MarshalCBOR ¶ added in v1.0.3
func (alVal *AlonzoValue) MarshalCBOR() ([]byte, error)
*
MarshalCBOR serializes the AlonzoValue into an CBOr-encoded data. Returns: []byte: The CBOR-encoded data. error: An error if deserialization fails.
func (AlonzoValue) ToValue ¶ added in v1.0.3
func (alVal AlonzoValue) ToValue() Value
*
ToValue converts an AlonzoValue to a Value object, preserving its attributes. Returns: Value: A Value object converted from an AlonzoValue.
func (*AlonzoValue) UnmarshalCBOR ¶ added in v1.0.3
func (val *AlonzoValue) UnmarshalCBOR(value []byte) error
*
UnmarshalCBOR deserializes CBOr-encoded data into an AlonzoValue. Params: value ([]byte): The CBOR-encoded data to be deserialized. Returns: error: An error if deserialization fails.
type Value ¶
func PureLovelaceValue ¶
*
PureLovelaceValue creates a Value with only a specified amount of Lovelace (coin) and no assets. Params: coin (int64): The amount of Lovelace (coin) to set in the Value. Returns: Value: The Value with the specified amount of Lovelace and no assets.
func SimpleValue ¶
func SimpleValue(coin int64, assets MultiAsset.MultiAsset[int64]) Value
*
SimpleValue creates a Value object with a specified coin value and a MultiAssets. Params: coin (int64): The coin value. assets (MultiAsset.MultiAsset[int64]): the assets. Returns: Value: A Value object.
func (Value) Add ¶
*
Add function adds another Value to the current Value. Params: other (Value): The Value to add to the current Value. Returns: Value: The resulting Value after the addition.
func (*Value) AddAssets ¶
func (val *Value) AddAssets(other MultiAsset.MultiAsset[int64])
*
AddAssets adds MultiAsset assets to a Value. Params: other (MultiAsset.MultiAsset[int64]): the MultiAssets assets to be added.
func (*Value) AddLovelace ¶
*
AddLovelace adds a specified amount of Lovelace (coin) from the Value. In case that there aren't any assets, then it adds to the Coin field, otherwise to the AlonzoAmount's Coin field. Params: amount (int64): The amount of Lovelace (coin) to add.
func (Value) Clone ¶
*
Clone creates a copy of the Value, including its assets. Returns: Value: A copy of the Value.
func (Value) Equal ¶
*
Equal checks if the current Value is equal to another Value. Params: other (Value): The Value to compare. Returns: bool: True if the current value is equal to the other Value, false otherwise.
func (Value) GetAssets ¶
func (val Value) GetAssets() MultiAsset.MultiAsset[int64]
*
GetAssets returns the MultiAsset assets in the Value. Returns: MultiAsset.MultiAsset[int64]: The MultiAsset assets.
func (Value) GetCoin ¶
*
GetCoin returns the amount of Lovelace (coin) in the Value. Returns: int64: The amount of Lovelace (coin).
func (Value) Greater ¶
*
Greater checks if the current Value is greater than another Value. Params: other (Value): The Value to compare. Returns: bool: True if the current value is greater than the other Value, false otherwise.
func (Value) GreaterOrEqual ¶
*
GreaterOrEqual checks if the current Value is greater than or equal to another Value. Params: other (Value): The Value to compare. Returns: bool: True if the current value is greater than or equal to the other Value, false otherwise.
func (Value) Less ¶
*
Less checks if the current Value is less than another Value. Params: other (Value): The Value to compare. Returns: bool: True if the current value is less than the other Value, false otherwise.
func (Value) LessOrEqual ¶
*
LessOrEqual checks if the current Value is less than or equal to another Value. Params: other (Value): The Value to compare. Returns: bool: True if the current value is less than or equal to the other Value, false otherwise.
func (*Value) MarshalCBOR ¶
*
MarshalCBOR marshals the Value into a CBOR-encoded byte slice. If the Value has assets, then it encodes the AlonzoAmount using CBOR, otherwise it encodes the Coin field directly. Returns: []byte: The CBOR-encoded byte slice. error: An error if marshaling fails.
func (Value) RemoveZeroAssets ¶
*
RemoveZeroAssets removes assets with zero values from a Value. Returns: Value: A Value without zero assets.
func (*Value) SetLovelace ¶
*
SetLovelace sets a specified amount of Lovelace (coin) in the Value. In case that there aren't any assets, then it sets the Coin field, otherwise it sets the AlonzoAmount's Coin field. Params: amount (int64): The amount of Lovelace (coin) to set.
func (*Value) SetMultiAsset ¶
func (val *Value) SetMultiAsset(amount MultiAsset.MultiAsset[int64])
*
SetMultiAsset sets the MultiAsset in the Value. Params: amount (MultiAsset.MultiAsset[int64]): The MultiAsset assets to set.
func (Value) String ¶
*
String reutnrs a string representation of teh Value. Returns: string: The string representation of the Value.
func (Value) Sub ¶
*
Sub function subtracts another Value to the current Value. Params: other (Value): The Value to subtract to the current Value. Returns: Value: The resulting Value after the subtraction.
func (*Value) SubLovelace ¶
*
SubLovelace subtracts a specified amount of Lovelace (coin) from the Value. In case that there aren't any assets, then it subtracts from the Coin field, otherwise from the AlonzoAmount's Coin field. Params: amount (int64): The amount of Lovelace (coin) to subtract.
func (Value) ToAlonzoValue ¶ added in v1.0.3
func (val Value) ToAlonzoValue() AlonzoValue
*
ToAlonzoValue converts a Value object to an AlonzoValue, preserving its attributes. Returns: AlonzoValue: An AlonzoValue converted from a Value object.
func (*Value) UnmarshalCBOR ¶
*
UnmarshalCBOR unmarshals a CBOR-encoded byte slice into the Value, which decoed either a uint64 inot the Coin field or a CBOR-encoded Amount into the AlonzoAmount field. Params: value ([]byte): The CBOR-encoded byte slice to unmarshal. Returns: error: An error if unmarshaling fails.
Click to show internal directories.
Click to hide internal directories.