com.r3corda.contracts.cash / Cash / generateSpend

# generateSpend

`fun generateSpend(tx: TransactionBuilder, amount: Amount<Currency>, to: PublicKey, cashStates: List<StateAndRef<State>>, onlyFromParties: Set<Party>? = null): List<PublicKey>`

Generate a transaction that consumes one or more of the given input states to move money to the given pubkey. Note that the wallet list is not updated: its up to you to do that.

### Parameters

`onlyFromParties` - if non-null, the wallet will be filtered to only include cash states issued by the set of given parties. This can be useful if the party youre trying to pay has expectations about which type of cash claims they are willing to accept.