Value
Represents a collection of tokens.
Constructor
Constructs a Value
instance using a quantity of lovelace and an Assets
instance.
new helios.Value(
lovelace: bigint = 0n,
assets: helios.Assets = new helios.Assets()
)
Static methods
fromCbor
Deserialize a CBOR encoded Value
instance.
Shifts bytes
to the next CBOR element.
helios.Value.fromCbor(bytes: number[]): helios.Value
fromData
Turns a UplcData
instance into a Value
. Throws an error if it isn't in the right format.
helios.Value.fromData(data: helios.UplcData): helios.Value
Getters
assets
Gets the Assets
contained in the Value
.
value.assets: helios.Assets
lovelace
Gets the lovelace quantity contained in the Value
.
value.lovelace: bigint
Methods
add
Adds two Value
instances together. Returns a new Value
instance.
value1.add(value2: helios.Value): helios.Value
assertAllPositive
Throws an error if any of the Value
entries is negative.
value.assertAllPositive(): void
eq
Checks if two Value
instances are equal (Assets
need to be in the same order).
value1.eq(value2: helios.Value): boolean
ge
Checks if a Value
instance is strictly greater or equal to another Value
instance.
value1.ge(value2: helios.Value): boolean
gt
Checks if a Value
instance is strictly greater than another Value
instance.
value1.gt(value2: helios.Value): boolean
sub
Substracts one Value
instance from another. Returns a new Value
instance.
value1.sub(value2: helios.Value): helios.Value
setLovelace
Mutates the quantity of lovelace in a Value
.
value.setLovelace(lovelace: bigint): void
toCbor
Serialize a Value
instance using CBOR.
value.toCbor(): number[]
toData
Returns a MapData
representation of a Value
.
value.toData(): helios.MapData