Value
Represents a collection of tokens.
export interface Value {
add(other: Value): Value
assertAllPositive(): Value
assetClasses: AssetClass<unknown>[]
assets: Assets
copy(): Value
dump(): any
isEqual(other: Value): boolean
isGreaterOrEqual(other: Value): boolean
isGreaterThan(other: Value): boolean
kind: "Value"
lovelace: bigint
multiply(scalar: IntLike): Value
subtract(other: Value): Value
toCbor(): number[]
toUplcData(isInScriptContext: boolean): MapData
}
Properties
add
value.add satisfies (other: Value) => Value
assertAllPositive
Throws an error if any of the Value
entries is negative.
Used when building transactions because transactions can't contain negative values.
value.assertAllPositive satisfies () => Value
assetClasses
value.assetClasses satisfies AssetClass<unknown>[]
assets
value.assets satisfies Assets
copy
Deep copy
value.copy satisfies () => Value
dump
value.dump satisfies () => any
isEqual
Checks if two Value
instances are equal (Assets
need to be in the same order).
value.isEqual satisfies (other: Value) => boolean
isGreaterOrEqual
Checks if a Value
instance is strictly greater or equal to another Value
instance. Returns false if any asset is missing.
value.isGreaterOrEqual satisfies (other: Value) => boolean
isGreaterThan
Checks if a Value
instance is strictly greater than another Value
instance. Returns false if any asset is missing.
value.isGreaterThan satisfies (other: Value) => boolean
kind
value.kind satisfies "Value"
lovelace
value.lovelace satisfies bigint
multiply
Multiplies a Value
by a whole number.
value.multiply satisfies (scalar: IntLike) => Value
subtract
Substracts one Value
instance from another. Returns a new Value
instance.
value.subtract satisfies (other: Value) => Value
toCbor
value.toCbor satisfies () => number[]
toUplcData
Used when building script context
value.toUplcData satisfies (isInScriptContext: boolean) => MapData