Utils
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Utils.type
Members list
Value members
Concrete methods
Finds an input in the list of inputs by its out reference.
Finds an input in the list of inputs by its out reference.
Value parameters
- inputs
-
The list of inputs to search in.
- outRef
-
The output reference to find.
Attributes
- Returns
-
An
Optioncontaining the found input, orNoneif not found.
Deprecated methods
Calculates the total amount of ADA (Lovelace) from a list of transaction inputs.
Calculates the total amount of ADA (Lovelace) from a list of transaction inputs.
LOVELACE ONLY: native tokens in the inputs are ignored. Use TxInfo.valueSpentFrom(addr) and compare the whole Value.
Value parameters
- inputs
-
the list of transaction inputs to sum
Attributes
- Returns
-
the total Lovelace amount from all resolved inputs
- Example
-
val inputs = List(TxInInfo(...), TxInInfo(...)) val totalAda = Utils.getAdaFromInputs(inputs) // Returns the sum of Lovelace from all resolved input outputs // Returns BigInt(0) if the list is empty - Deprecated
-
[Since version 1.1.1]lovelace-only; sum whole Values: TxInfo.valueSpentFrom(addr) for a full address, or ".+("inputs.filter(_.resolved.address.credential === cred).foldLeft(Value.zero)(_ + _.resolved.value) for a key payee")
Calculates the total amount of ADA (Lovelace) from a list of transaction outputs.
Calculates the total amount of ADA (Lovelace) from a list of transaction outputs.
LOVELACE ONLY: native tokens in the outputs are ignored, so a check built on this sum lets them be stripped. Use TxInfo.valuePaidTo(addr) and compare the whole Value.
Value parameters
- outputs
-
the list of transaction outputs to sum
Attributes
- Returns
-
the total Lovelace amount from all outputs
- Example
-
val outputs = List(TxOut(...), TxOut(...)) val totalAda = Utils.getAdaFromOutputs(outputs) // Returns the sum of Lovelace from all outputs // Returns BigInt(0) if the list is empty - Deprecated
-
[Since version 1.1.1]lovelace-only; sum whole Values: TxInfo.valuePaidTo(addr) for a full address, or ".+("outputs.filter(_.address.credential === cred).foldLeft(Value.zero)(_ + _.value) for a key payee")