corda / net.corda.core.contracts / AmountTransfer / apply

apply

fun apply(balances: List<SourceAndAmount<T, P>>, newRef: Any? = null): List<SourceAndAmount<T, P>>

Applies this AmountTransfer to a list of SourceAndAmount objects representing balances. The list can be heterogeneous in terms of token types and parties, so long as there is sufficient balance of the correct token type held with the party paying for the transfer.

Parameters

balances - The source list of SourceAndAmount objects containing the funds to satisfy the exchange.

newRef - An optional marker object which is attached to any new SourceAndAmount objects created in the output. i.e. To the new payment destination entry and to any residual change output.

Exceptions

ArithmeticException - if there is underflow in the summations.

Return
A copy of the original list, except that funds needed to cover the exchange will have been removed and a new output and possibly residual amount entry will be added at the end of the list.