com.r3corda.contracts.asset / Cash / generateExit

# generateExit

`fun generateExit(tx: TransactionBuilder, amountIssued: Amount<Issued<Currency>>, changeKey: PublicKey, cashStates: List<StateAndRef<State>>): PublicKey`

Generate an transaction exiting cash from the ledger.

### Parameters

`tx` - transaction builder to add states and commands to.
`amountIssued` - the amount to be exited, represented as a quantity of issued currency.
`changeKey` - the key to send any change to. This needs to be explicitly stated as the input states are not necessarily owned by us.
`cashStates` - the cash states to take funds from. No checks are done about ownership of these states, it is the responsibility of the caller to check that they do not exit funds held by others.

Return
the public key of the cash issuer, who must sign the transaction for it to be valid.