CashUtils
Keywords: net.corda.finance.workflows.asset.CashUtils class
Date: 2023-09-18

net.corda.finance.workflows.asset

## Class CashUtils

- net.corda.finance.workflows.asset.CashUtils

-     public class CashUtils

- - ### Field Detail

    - #### INSTANCE

          public static CashUtils INSTANCE

  - ### Method Detail

    - #### generateSpend

          @JvmStatic
           @Suspendable
           @Deprecated
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                 ServiceHub services,
                                                                                                                                                                 @NotNull
                                                                                                                                                                 TransactionBuilder tx,
                                                                                                                                                                 @NotNull
                                                                                                                                                                 Amount<java.util.Currency> amount,
                                                                                                                                                                 @NotNull
                                                                                                                                                                 AbstractParty to,
                                                                                                                                                                 @NotNull
                                                                                                                                                                 java.util.Set<? extends net.corda.core.identity.AbstractParty> onlyFromParties)

      Deprecated.

      Generate a transaction that moves an amount of currency to the given party, and sends any change back to sole identity of the calling node. Fails for nodes with multiple identities.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `amount` - How much currency to send.
        `to` - the recipient party.
        `onlyFromParties` - if non-null, the asset states will be filtered to only include those issued by the set of given parties. This can be useful if the party you're trying to pay has expectations about which type of asset claims they are willing to accept.
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`

    - #### generateSpend

          @JvmStatic
           @JvmOverloads
           @Suspendable
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                   ServiceHub services,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   TransactionBuilder tx,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   Amount<java.util.Currency> amount,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   PartyAndCertificate ourIdentity,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   AbstractParty to,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   java.util.Set<? extends net.corda.core.identity.AbstractParty> onlyFromParties,
                                                                                                                                                                   boolean anonymous)

      Generate a transaction that moves an amount of currency to the given party.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `amount` - How much currency to send.
        `ourIdentity` - ourIdentity is used to determine the where the change will be sent. If anonymous is true then an anonymous identity will be generated from this and the change will be spent to that, otherwise ourIdentity will be used as is.
        `to` - the recipient party.
        `onlyFromParties` - if non-null, the asset states will be filtered to only include those issued by the set of given parties. This can be useful if the party you're trying to pay has expectations about which type of asset claims they are willing to accept.
        `anonymous` - whether or not to use CI to send the change to
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`

    - #### generateSpend

          @JvmStatic
           @JvmOverloads
           @Suspendable
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                   ServiceHub services,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   TransactionBuilder tx,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   Amount<java.util.Currency> amount,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   PartyAndCertificate ourIdentity,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   AbstractParty to,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   java.util.Set<? extends net.corda.core.identity.AbstractParty> onlyFromParties)

      Generate a transaction that moves an amount of currency to the given party.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `amount` - How much currency to send.
        `ourIdentity` - ourIdentity is used to determine the where the change will be sent. If anonymous is true then an anonymous identity will be generated from this and the change will be spent to that, otherwise ourIdentity will be used as is.
        `to` - the recipient party.
        `onlyFromParties` - if non-null, the asset states will be filtered to only include those issued by the set of given parties. This can be useful if the party you're trying to pay has expectations about which type of asset claims they are willing to accept.
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`

    - #### generateSpend

          @JvmStatic
           @JvmOverloads
           @Suspendable
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                   ServiceHub services,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   TransactionBuilder tx,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   Amount<java.util.Currency> amount,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   PartyAndCertificate ourIdentity,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   AbstractParty to)

      Generate a transaction that moves an amount of currency to the given party.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `amount` - How much currency to send.
        `ourIdentity` - ourIdentity is used to determine the where the change will be sent. If anonymous is true then an anonymous identity will be generated from this and the change will be spent to that, otherwise ourIdentity will be used as is.
        `to` - the recipient party.
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`

    - #### generateSpend

          @JvmStatic
           @Suspendable
           @Deprecated
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                 ServiceHub services,
                                                                                                                                                                 @NotNull
                                                                                                                                                                 TransactionBuilder tx,
                                                                                                                                                                 @NotNull
                                                                                                                                                                 java.util.List<net.corda.finance.contracts.asset.PartyAndAmount> payments,
                                                                                                                                                                 @NotNull
                                                                                                                                                                 java.util.Set<? extends net.corda.core.identity.AbstractParty> onlyFromParties)

      Deprecated.

      Generate a transaction that moves money of the given amounts to the recipients specified, and sends any change back to sole identity of the calling node. Fails for nodes with multiple identities.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `payments` - A list of amounts to pay, and the party to send the payment to.
        `onlyFromParties` - if non-null, the asset states will be filtered to only include those issued by the set of given parties. This can be useful if the party you're trying to pay has expectations about which type of asset claims they are willing to accept.
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`

    - #### generateSpend

          @JvmStatic
           @JvmOverloads
           @Suspendable
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                   ServiceHub services,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   TransactionBuilder tx,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   java.util.List<net.corda.finance.contracts.asset.PartyAndAmount> payments,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   PartyAndCertificate ourIdentity,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   java.util.Set<? extends net.corda.core.identity.AbstractParty> onlyFromParties,
                                                                                                                                                                   boolean anonymous)

      Generate a transaction that moves money of the given amounts to the recipients specified.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `payments` - A list of amounts to pay, and the party to send the payment to.
        `ourIdentity` - ourIdentity is used to determine the where the change will be sent. If anonymous is true then an anonymous identity will be generated from this and the change will be spent to that, otherwise ourIdentity will be used as is.
        `onlyFromParties` - if non-null, the asset states will be filtered to only include those issued by the set of given parties. This can be useful if the party you're trying to pay has expectations about which type of asset claims they are willing to accept.
        `anonymous` - whether or not to use CI to send the change to
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`

    - #### generateSpend

          @JvmStatic
           @JvmOverloads
           @Suspendable
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                   ServiceHub services,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   TransactionBuilder tx,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   java.util.List<net.corda.finance.contracts.asset.PartyAndAmount> payments,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   PartyAndCertificate ourIdentity,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   java.util.Set<? extends net.corda.core.identity.AbstractParty> onlyFromParties)

      Generate a transaction that moves money of the given amounts to the recipients specified.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `payments` - A list of amounts to pay, and the party to send the payment to.
        `ourIdentity` - ourIdentity is used to determine the where the change will be sent. If anonymous is true then an anonymous identity will be generated from this and the change will be spent to that, otherwise ourIdentity will be used as is.
        `onlyFromParties` - if non-null, the asset states will be filtered to only include those issued by the set of given parties. This can be useful if the party you're trying to pay has expectations about which type of asset claims they are willing to accept.
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`

    - #### generateSpend

          @JvmStatic
           @JvmOverloads
           @Suspendable
           @NotNull
          public static kotlin.Pair<net.corda.core.transactions.TransactionBuilder,java.util.List> generateSpend(@NotNull
                                                                                                                                                                   ServiceHub services,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   TransactionBuilder tx,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   java.util.List<net.corda.finance.contracts.asset.PartyAndAmount> payments,
                                                                                                                                                                   @NotNull
                                                                                                                                                                   PartyAndCertificate ourIdentity)

      Generate a transaction that moves money of the given amounts to the recipients specified.

      Note: an `class Amount` of Currency is only fungible for a given Issuer Party within a `interface FungibleAsset`

      Parameters:
        `services` - The `interface ServiceHub` to provide access to the database session.
        `tx` - A builder, which may contain inputs, outputs and commands already. The relevant components needed to move the cash will be added on top.
        `payments` - A list of amounts to pay, and the party to send the payment to.
        `ourIdentity` - ourIdentity is used to determine the where the change will be sent. If anonymous is true then an anonymous identity will be generated from this and the change will be spent to that, otherwise ourIdentity will be used as is.
      Returns:
        A Pair of the same transaction builder passed in as `tx`, and the list of keys that need to sign the resulting transaction for it to be valid.
      Throws:
        `InsufficientBalanceException` - when a cash spending transaction fails because there is insufficient quantity for a given currency (and optionally set of Issuer Parties).
      See Also:
        `class Amount`, Currency, `interface FungibleAsset`