corda / net.corda.finance.workflows.asset.selection / AbstractCashSelection / unconsumedCashStatesForSpending

unconsumedCashStatesForSpending

@Suspendable fun unconsumedCashStatesForSpending(services: ServiceHub, amount: Amount<Currency>, onlyFromIssuerParties: Set<AbstractParty> = emptySet(), notary: Party? = null, lockId: UUID, withIssuerRefs: Set<OpaqueBytes> = emptySet()): List<StateAndRef<State>>

Query to gather Cash states that are available and retry if they are temporarily unavailable.

Parameters

services - The service hub to allow access to the database session

amount - The amount of currency desired (ignoring issues, but specifying the currency)

onlyFromIssuerParties - If empty the operation ignores the specifics of the issuer, otherwise the set of eligible states wil be filtered to only include those from these issuers.

notary - If null the notary source is ignored, if specified then only states marked with this notary are included.

lockId - The FlowLogic.runId.uuid of the flow, which is used to soft reserve the states. Also, previous outputs of the flow will be eligible as they are implicitly locked with this id until the flow completes.

withIssuerRefs - If not empty the specific set of issuer references to match against.

Return
The matching states that were found. If sufficient funds were found these will be locked, otherwise what is available is returned unlocked for informational purposes.