Class AbstractTokenTransferTransaction<T extends AbstractTokenTransferTransaction<T>>

Direct Known Subclasses:
TokenAirdropTransaction, TransferTransaction

abstract class AbstractTokenTransferTransaction<T extends AbstractTokenTransferTransaction<T>> extends Transaction<T>
  • Field Details

  • Constructor Details

    • AbstractTokenTransferTransaction

      protected AbstractTokenTransferTransaction()
    • AbstractTokenTransferTransaction

      AbstractTokenTransferTransaction(LinkedHashMap<TransactionId,LinkedHashMap<AccountId,Transaction>> txs) throws com.google.protobuf.InvalidProtocolBufferException
      Constructor.
      Parameters:
      txs - Compound list of transaction id's list of (AccountId, Transaction) records
      Throws:
      com.google.protobuf.InvalidProtocolBufferException - when there is an issue with the protobuf
    • AbstractTokenTransferTransaction

      AbstractTokenTransferTransaction(TransactionBody txBody)
      Constructor.
      Parameters:
      txBody - protobuf TransactionBody
  • Method Details

    • getTokenIdDecimals

      public Map<TokenId,Integer> getTokenIdDecimals()
      Extract the list of token id decimals.
      Returns:
      the list of token id decimals
    • getTokenTransfers

      public Map<TokenId,Map<AccountId,Long>> getTokenTransfers()
      Extract the list of token transfer records.
      Returns:
      the list of token transfer records
    • doAddTokenTransfer

      protected T doAddTokenTransfer(TokenId tokenId, AccountId accountId, long amount, boolean isApproved, @Nullable Integer expectedDecimals, @Nullable FungibleHookCall hookCall)
    • addTokenTransfer

      public T addTokenTransfer(TokenId tokenId, AccountId accountId, long value)
      Add a non-approved token transfer to the transaction.
      Parameters:
      tokenId - the token id
      accountId - the account id
      value - the value
      Returns:
      the updated transaction
    • addApprovedTokenTransfer

      public T addApprovedTokenTransfer(TokenId tokenId, AccountId accountId, long value)
      Add an approved token transfer to the transaction.
      Parameters:
      tokenId - the token id
      accountId - the account id
      value - the value
      Returns:
      the updated transaction
    • addTokenTransferWithDecimals

      public T addTokenTransferWithDecimals(TokenId tokenId, AccountId accountId, long value, int decimals)
      Add a non-approved token transfer with decimals.
      Parameters:
      tokenId - the token id
      accountId - the account id
      value - the value
      decimals - the decimals
      Returns:
      the updated transaction
    • addApprovedTokenTransferWithDecimals

      public T addApprovedTokenTransferWithDecimals(TokenId tokenId, AccountId accountId, long value, int decimals)
      Add an approved token transfer with decimals.
      Parameters:
      tokenId - the token id
      accountId - the account id
      value - the value
      decimals - the decimals
      Returns:
      the updated transaction
    • setTokenTransferApproval

      @Deprecated public T setTokenTransferApproval(TokenId tokenId, AccountId accountId, boolean isApproved)
      Parameters:
      tokenId - the token id
      accountId - the account id
      isApproved - whether the transfer is approved
      Returns:
      this
    • getTokenNftTransfers

      public Map<TokenId,List<TokenNftTransfer>> getTokenNftTransfers()
      Extract the of token nft transfers.
      Returns:
      list of token nft transfers
    • doAddNftTransfer

      protected T doAddNftTransfer(NftId nftId, AccountId sender, AccountId receiver, boolean isApproved, @Nullable NftHookCall senderHookCall, @Nullable NftHookCall receiverHookCall)
    • addNftTransfer

      public T addNftTransfer(NftId nftId, AccountId sender, AccountId receiver)
      Add a non-approved nft transfer.
      Parameters:
      nftId - the nft's id
      sender - the sender account id
      receiver - the receiver account id
      Returns:
      the updated transaction
    • addApprovedNftTransfer

      public T addApprovedNftTransfer(NftId nftId, AccountId sender, AccountId receiver)
      Add an approved nft transfer.
      Parameters:
      nftId - the nft's id
      sender - the sender account id
      receiver - the receiver account id
      Returns:
      the updated transaction
    • setNftTransferApproval

      @Deprecated public T setNftTransferApproval(NftId nftId, boolean isApproved)
      Parameters:
      nftId - the NFT id
      isApproved - whether the transfer is approved
      Returns:
      this
    • sortTransfersAndBuild

      protected ArrayList<TokenTransferList> sortTransfersAndBuild()
    • validateChecksums

      void validateChecksums(Client client) throws BadEntityIdException
      Specified by:
      validateChecksums in class Transaction<T extends AbstractTokenTransferTransaction<T>>
      Throws:
      BadEntityIdException