Interface WalletTransactionService


public interface WalletTransactionService
Manage stored transaction details in eXo internal datasource
  • Method Details

    • getPendingWalletTransactionsNotSent

      List<TransactionDetail> getPendingWalletTransactionsNotSent(String address)
      Retrieves the list of pending transactions of a given wallet from database which is not yet sent to blockchain
      Parameters:
      address - Wallet address
      Returns:
      List of pending TransactionDetail
    • getPendingWalletTransactionsSent

      List<TransactionDetail> getPendingWalletTransactionsSent(String address)
      Retrieves the list of pending transactions of a given wallet from database which was sent to blockchain
      Parameters:
      address - Wallet address
      Returns:
      List of pending TransactionDetail
    • getPendingEtherTransactions

      List<TransactionDetail> getPendingEtherTransactions(String address)
      Parameters:
      address - Wallet address
      Returns:
      List of pending TransactionDetail of type ether sending marked as pending in database
    • countContractPendingTransactionsSent

      long countContractPendingTransactionsSent()
      Returns:
      pending contract transactions already sent to blockchain
    • countContractPendingTransactionsToSend

      long countContractPendingTransactionsToSend()
      Returns:
      pending contract transactions not yet sent to blockchain
    • getTransactions

      List<TransactionDetail> getTransactions(String address, String contractAddress, String contractMethodName, String hash, int limit, boolean onlyPending, boolean administration, String currentUser) throws IllegalAccessException
      Parameters:
      address - wallet address
      contractAddress - contract address to use to filter transactions
      contractMethodName - the contract method name to use to filter on transactions
      hash - the transaction hash to include in resulted transactions
      limit - limit size of returned transactions unless the hash parameter is not null, in that case, continue searching in transactions list until the hash is included in results
      onlyPending - whether filtering on pending transactions only or not
      administration - include administration transactions or not
      currentUser - the user accessing the list of transactions
      Returns:
      the list of transactions corresponding to filter parameters
      Throws:
      IllegalAccessException - if the current user isn't allowed to access wallet transactions
    • getTransactionStatistics

      TransactionStatistics getTransactionStatistics(String address, String periodicity, String selectedDate, Locale locale)
      Retrives the Transaction statistics of a user on a designated contract by period of time
      Parameters:
      address -
      periodicity -
      selectedDate -
      locale -
      Returns:
      TransactionStatistics with sent and received amounts and labels
    • getTransactionByHash

      TransactionDetail getTransactionByHash(String hash)
      Parameters:
      hash - transaction hash
      Returns:
      the transaction detail corresponding to the hash parameter, retrieved from internal database
    • getPendingTransactionByHash

      TransactionDetail getPendingTransactionByHash(String hash)
      Parameters:
      hash - transaction hash
      Returns:
      the transaction detail corresponding to the hash parameter, retrieved from internal database
    • getTransactionByHash

      TransactionDetail getTransactionByHash(String hash, String currentUser)
      Parameters:
      hash - transaction hash
      currentUser - current username that is getting transaction details
      Returns:
      the transaction detail corresponding to the hash parameter, retrieved from internal database
    • getNonce

      long getNonce(String fromAddress, String currentUserId) throws IllegalAccessException
      Parameters:
      fromAddress -
      currentUserId -
      Returns:
      the next nonce to include in transaction to send on blockchain. If no pending transaction return 0 to let get nonce from blockchain directly for more consistency.
      Throws:
      IllegalAccessException - when user is not owner of wallet address
    • getNonce

      long getNonce(String fromAddress)
      Parameters:
      fromAddress -
      Returns:
      the next nonce to include in transaction to send on blockchain. If no pending transaction return 0 to let get nonce from blockchain directly for more consistency.
    • saveTransactionDetail

      void saveTransactionDetail(TransactionDetail transactionDetail, boolean broadcastMinedTransaction)
      Save transaction details in database
      Parameters:
      transactionDetail - transaction detail to save
      broadcastMinedTransaction - whether the transaction has been mined on blockchain or not
    • saveTransactionDetail

      void saveTransactionDetail(TransactionDetail transactionDetail, String currentUser) throws IllegalAccessException
      Save transaction details in database
      Parameters:
      transactionDetail - transaction detail to save
      currentUser - current username that is saving transaction
      Throws:
      IllegalAccessException - if current user is not allowed to save transaction to sender and receiver wallet
    • getPendingTransactionMaxDays

      long getPendingTransactionMaxDays()
      Returns:
      max days to wait until marking a non existing transaction on blockchain as failed
    • getTransactionsToSend

      List<TransactionDetail> getTransactionsToSend()
      Returns:
      List of TransactionDetail having RawTransaction to send on blockchain
    • canSendTransactionToBlockchain

      boolean canSendTransactionToBlockchain(String senderAddress)
      Determines whether the user can send transaction to blockchain or not. In fact, this will avoid to send mutiple parallel transactions to the blockchain and to avoid transaction nonce collision. A transaction can be replaced by another one when it uses the same nonce and with a higher gas price. The problem here is that we can't determine for sure (using API that access to the blockchain) the next available nonce to use for transaction to send (inconsistent information can be retrieved from blockchain when tens of thousands of transactions are pending on blockchain when we use eth_getTransactionCount(address, 'pending')).
      Parameters:
      senderAddress - wallet address of transaction sender
      Returns:
      true if address can send a transaction to blockchain.
    • getMaxAttemptsToSend

      long getMaxAttemptsToSend()
      Returns:
      max attempts of sending a transaction
    • getMaxParallelPendingTransactions

      long getMaxParallelPendingTransactions()
      Returns:
      Max parallel transactions
    • cancelTransactionsWithSameNonce

      void cancelTransactionsWithSameNonce(TransactionDetail transactionDetail)
      Cancels other transactions having same nonce as the corresponding transaction sent
      Parameters:
      transactionDetail - of type TransactionDetail that boosted a previous TransactionDetail having the same nonce
    • countPendingTransactionsWithSameNonce

      long countPendingTransactionsWithSameNonce(String transactionHash, String fromAddress, long nonce)
      Count the number of transactions sent from the same Wallet and having same Nonce than another transaction
      Parameters:
      transactionHash - transaction hash
      fromAddress - wallet address
      nonce - transaction nonce
      Returns:
      Long for transactions having same nonce but the designated transactionHash
    • countTransactions

      long countTransactions()
      Returns:
      count of transactions present in database