Package org.exoplatform.wallet.service
Interface WalletTransactionService
-
public interface WalletTransactionServiceManage stored transaction details in eXo internal datasource
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancelTransactionsWithSameNonce(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.intcountPendingTransactions()longcountTransactionsByNonce(TransactionDetail transactionDetail)Count the number of transactions sent from the same Wallet and having same NoncelonggetMaxAttemptsToSend()longgetMaxParallelPendingTransactions()longgetNonce(String fromAddress)longgetNonce(String fromAddress, String currentUserId)TransactionDetailgetPendingTransactionByHash(String hash)longgetPendingTransactionMaxDays()List<TransactionDetail>getPendingTransactions()TransactionDetailgetTransactionByHash(String hash)TransactionDetailgetTransactionByHash(String hash, String currentUser)List<TransactionDetail>getTransactions(String address, String contractAddress, String contractMethodName, String hash, int limit, boolean onlyPending, boolean administration, String currentUser)TransactionStatisticsgetTransactionStatistics(String address, String periodicity, String selectedDate, Locale locale)Retrives the Transaction statistics of a user on a designated contract by period of timeList<TransactionDetail>getTransactionsToSend()booleanisLogAllTransaction()voidsaveTransactionDetail(TransactionDetail transactionDetail, boolean broadcastMinedTransaction)Save transaction details in databasevoidsaveTransactionDetail(TransactionDetail transactionDetail, String currentUser)Save transaction details in database
-
-
-
Method Detail
-
getPendingTransactions
List<TransactionDetail> getPendingTransactions()
- Returns:
Listof pendingTransactionDetailmarked as pending on blockchain
-
countPendingTransactions
int countPendingTransactions()
- Returns:
- pending transactions count
-
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
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 hashcurrentUser- 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 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
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
-
isLogAllTransaction
boolean isLogAllTransaction()
- Returns:
- true if all transactions including uknown ones detected on contract has to be logged, else false
-
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 typeTransactionDetailthat boosted a previousTransactionDetailhaving the same nonce
-
countTransactionsByNonce
long countTransactionsByNonce(TransactionDetail transactionDetail)
Count the number of transactions sent from the same Wallet and having same Nonce- Parameters:
transactionDetail- of typeTransactionDetail
-
-