Package org.exoplatform.wallet.service
Interface WalletTransactionService
public interface WalletTransactionService
Manage stored transaction details in eXo internal datasource
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancelTransactionsWithSameNonce(TransactionDetail transactionDetail) Cancels other transactions having same nonce as the corresponding transaction sentbooleancanSendTransactionToBlockchain(String senderAddress) Determines whether the user can send transaction to blockchain or not.longlonglongcountPendingTransactionsWithSameNonce(String transactionHash, String fromAddress, long nonce) Count the number of transactions sent from the same Wallet and having same Nonce than another transactionlonglonglonglonglonggetPendingEtherTransactions(String address) longRetrieves the list of pending transactions of a given wallet from database which is not yet sent to blockchaingetPendingWalletTransactionsSent(String address) Retrieves the list of pending transactions of a given wallet from database which was sent to blockchaingetTransactionByHash(String hash) getTransactionByHash(String hash, String currentUser) getTransactions(String address, String contractAddress, String contractMethodName, String hash, int limit, boolean onlyPending, boolean administration, String currentUser) getTransactionStatistics(String address, String periodicity, String selectedDate, Locale locale) Retrives the Transaction statistics of a user on a designated contract by period of timevoidsaveTransactionDetail(TransactionDetail transactionDetail, boolean broadcastMinedTransaction) Save transaction details in databasevoidsaveTransactionDetail(TransactionDetail transactionDetail, String currentUser) Save transaction details in database
-
Method Details
-
getPendingWalletTransactionsNotSent
Retrieves the list of pending transactions of a given wallet from database which is not yet sent to blockchain- Parameters:
address-Walletaddress- Returns:
Listof pendingTransactionDetail
-
getPendingWalletTransactionsSent
Retrieves the list of pending transactions of a given wallet from database which was sent to blockchain- Parameters:
address-Walletaddress- Returns:
Listof pendingTransactionDetail
-
getPendingEtherTransactions
- Parameters:
address-Walletaddress- Returns:
Listof pendingTransactionDetailof 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 addresscontractAddress- contract address to use to filter transactionscontractMethodName- the contract method name to use to filter on transactionshash- the transaction hash to include in resulted transactionslimit- 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 resultsonlyPending- whether filtering on pending transactions only or notadministration- include administration transactions or notcurrentUser- 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:
TransactionStatisticswith sent and received amounts and labels
-
getTransactionByHash
- Parameters:
hash- transaction hash- Returns:
- the transaction detail corresponding to the hash parameter, retrieved from internal database
-
getPendingTransactionByHash
- Parameters:
hash- transaction hash- Returns:
- the transaction detail corresponding to the hash parameter, retrieved from internal database
-
getTransactionByHash
- Parameters:
hash- transaction hashcurrentUser- current username that is getting transaction details- Returns:
- the transaction detail corresponding to the hash parameter, retrieved from internal database
-
getNonce
- 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
- 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
Save transaction details in database- Parameters:
transactionDetail- transaction detail to savebroadcastMinedTransaction- 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 savecurrentUser- 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:
ListofTransactionDetailhaving RawTransaction to send on blockchain
-
canSendTransactionToBlockchain
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
Cancels other transactions having same nonce as the corresponding transaction sent- Parameters:
transactionDetail- of typeTransactionDetailthat boosted a previousTransactionDetailhaving the same nonce
-
countPendingTransactionsWithSameNonce
Count the number of transactions sent from the same Wallet and having same Nonce than another transaction- Parameters:
transactionHash- transaction hashfromAddress- wallet addressnonce- transaction nonce- Returns:
Longfor transactions having same nonce but the designated transactionHash
-
countTransactions
long countTransactions()- Returns:
- count of transactions present in database
-