Class TransactionStorage

java.lang.Object
org.exoplatform.wallet.storage.TransactionStorage
Direct Known Subclasses:
CachedTransactionStorage

public class TransactionStorage extends Object
  • Constructor Details

    • TransactionStorage

      public TransactionStorage(org.exoplatform.services.listener.ListenerService listenerService, WalletTransactionDAO walletTransactionDAO)
  • Method Details

    • getPendingEtherTransactions

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getPendingEtherTransactions(String address, long networkId)
      Parameters:
      address - Wallet address
      networkId - blockchain network id
      Returns:
      List of TransactionDetail of type ether transfer marked as pending in internal database
    • getPendingWalletTransactionsNotSent

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getPendingWalletTransactionsNotSent(String address, long networkId)
    • getPendingWalletTransactionsSent

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getPendingWalletTransactionsSent(String address, long networkId)
    • countContractPendingTransactionsSent

      public long countContractPendingTransactionsSent(long networkId)
    • countContractPendingTransactionsToSend

      public long countContractPendingTransactionsToSend(long networkId)
    • getTransactionsToSend

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getTransactionsToSend(long networkId)
      Parameters:
      networkId - blockchain network id
      Returns:
      List of TransactionDetail not yet sent on blockchain
    • getMaxUsedNonce

      public long getMaxUsedNonce(long networkId, String fromAddress)
      Parameters:
      networkId - blockchain network id
      fromAddress - wallet address
      Returns:
      the max used nonce from stored transactions in internal database
    • getContractTransactions

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getContractTransactions(String contractAddress, String contractMethodName, int limit)
      Parameters:
      contractAddress - filter transactions by a contract address
      contractMethodName - filter transactions by a contract method
      limit - size limit of transactions to retrieve
      Returns:
      List of TransactionDetail with corresponding filter entries
    • getTransactions

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getTransactions(long networkId, int limit)
      Parameters:
      networkId - blockchain network id
      limit - size limit of transactions to retrieve
      Returns:
      List of TransactionDetail for selected blockchain network id
    • getWalletTransactions

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getWalletTransactions(long networkId, String address, String contractAddress, String contractMethodName, String hash, int limit, boolean pending, boolean administration)
      Parameters:
      networkId - blockchain network id
      address - wallet address
      contractAddress - filter transactions by a contract address
      contractMethodName - filter transactions by a contract method
      hash - retrieve include in the list of transactions this hash even if the limit is reached
      limit - size limit of transactions to retrieve
      pending - whether include pending or not
      administration - whether include administration transactions or not
      Returns:
      List of TransactionDetail with corresponding filter entries
    • saveTransactionDetail

      public void saveTransactionDetail(org.exoplatform.wallet.model.transaction.TransactionDetail transactionDetail)
      Saves a decoded transaction detail in internal database
      Parameters:
      transactionDetail - decoded transaction detail
    • getPendingTransactionsWithSameNonce

      public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getPendingTransactionsWithSameNonce(long networkId, String transactionHash, String fromAddress, long nonce)
      Return list of transactions for a given address that corresponds to a nonce
      Parameters:
      networkId - blockchain network id
      transactionHash - Transaction hash that will replace others
      fromAddress - transaction sender address
      nonce - Nonce of the transaction
      Returns:
      List of TransactionDetail
    • countPendingTransactionsWithSameNonce

      public long countPendingTransactionsWithSameNonce(long networkId, String transactionHash, String fromAddress, long nonce)
      Count the number of transactions for a given address that corresponds to a given nonce and that are always marked as pending
      Parameters:
      networkId - blockchain network id
      transactionHash - Transaction hash to exclude from count
      fromAddress - transaction sender address
      nonce - Nonce of the transaction
      Returns:
      List of TransactionDetail
    • getTransactionByHash

      public org.exoplatform.wallet.model.transaction.TransactionDetail getTransactionByHash(String hash)
      Retrieve a TransactionDetail identified by its blockchain hash
      Parameters:
      hash - blockchain transaction hash
      Returns:
      TransactionDetail
    • getPendingTransactionByHash

      public org.exoplatform.wallet.model.transaction.TransactionDetail getPendingTransactionByHash(String hash)
      Retrieve a TransactionDetail identified by its blockchain hash
      Parameters:
      hash - blockchain transaction hash
      Returns:
      TransactionDetail
    • countPendingTransactionSent

      public long countPendingTransactionSent(long networkId, String fromAddress)
      Parameters:
      networkId - blockchain network id
      fromAddress - transaction sender address
      Returns:
      count of pending transactions sent on a blockchain network for a specified user
    • countPendingTransactionAsSender

      public long countPendingTransactionAsSender(long networkId, String fromAddress)
      Parameters:
      networkId - blockchain network id
      fromAddress - transaction sender address
      Returns:
      count of pending transactions of a sender
    • countReceivedContractAmount

      public double countReceivedContractAmount(String contractAddress, String address, ZonedDateTime startDate, ZonedDateTime endDate)
      Parameters:
      contractAddress - blockchain contract address
      address - wallet address
      startDate - start date of selected period
      endDate - end date of selected period
      Returns:
      sum of token amounts received during selected period
    • countSentContractAmount

      public double countSentContractAmount(String contractAddress, String address, ZonedDateTime startDate, ZonedDateTime endDate)
      Parameters:
      contractAddress - blockchain contract address
      address - wallet address
      startDate - start date of selected period
      endDate - end date of selected period
      Returns:
      sum of token amounts sent during selected period
    • countTransactions

      public long countTransactions()