Package org.exoplatform.wallet.storage
Class TransactionStorage
- java.lang.Object
-
- org.exoplatform.wallet.storage.TransactionStorage
-
- Direct Known Subclasses:
CachedTransactionStorage
public class TransactionStorage extends Object
-
-
Constructor Summary
Constructors Constructor Description TransactionStorage(org.exoplatform.services.listener.ListenerService listenerService, WalletTransactionDAO walletTransactionDAO)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcountContractPendingTransactionsSent(long networkId)longcountContractPendingTransactionsToSend(long networkId)longcountPendingTransactionAsSender(long networkId, String fromAddress)longcountPendingTransactionSent(long networkId, String fromAddress)longcountPendingTransactionsWithSameNonce(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 pendingdoublecountReceivedContractAmount(String contractAddress, String address, ZonedDateTime startDate, ZonedDateTime endDate)doublecountSentContractAmount(String contractAddress, String address, ZonedDateTime startDate, ZonedDateTime endDate)longcountTransactions()List<org.exoplatform.wallet.model.transaction.TransactionDetail>getContractTransactions(String contractAddress, String contractMethodName, int limit)longgetMaxUsedNonce(long networkId, String fromAddress)List<org.exoplatform.wallet.model.transaction.TransactionDetail>getPendingEtherTransactions(String address, long networkId)org.exoplatform.wallet.model.transaction.TransactionDetailgetPendingTransactionByHash(String hash)Retrieve aTransactionDetailidentified by its blockchain hashList<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 nonceList<org.exoplatform.wallet.model.transaction.TransactionDetail>getPendingWalletTransactionsNotSent(String address, long networkId)List<org.exoplatform.wallet.model.transaction.TransactionDetail>getPendingWalletTransactionsSent(String address, long networkId)org.exoplatform.wallet.model.transaction.TransactionDetailgetTransactionByHash(String hash)Retrieve aTransactionDetailidentified by its blockchain hashList<org.exoplatform.wallet.model.transaction.TransactionDetail>getTransactions(long networkId, int limit)List<org.exoplatform.wallet.model.transaction.TransactionDetail>getTransactionsToSend(long networkId)List<org.exoplatform.wallet.model.transaction.TransactionDetail>getWalletTransactions(long networkId, String address, String contractAddress, String contractMethodName, String hash, int limit, boolean pending, boolean administration)voidsaveTransactionDetail(org.exoplatform.wallet.model.transaction.TransactionDetail transactionDetail)Saves a decoded transaction detail in internal database
-
-
-
Constructor Detail
-
TransactionStorage
public TransactionStorage(org.exoplatform.services.listener.ListenerService listenerService, WalletTransactionDAO walletTransactionDAO)
-
-
Method Detail
-
getPendingEtherTransactions
public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getPendingEtherTransactions(String address, long networkId)
- Parameters:
address-WalletaddressnetworkId- blockchain network id- Returns:
ListofTransactionDetailof 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:
ListofTransactionDetailnot yet sent on blockchain
-
getMaxUsedNonce
public long getMaxUsedNonce(long networkId, String fromAddress)- Parameters:
networkId- blockchain network idfromAddress- 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 addresscontractMethodName- filter transactions by a contract methodlimit- size limit of transactions to retrieve- Returns:
ListofTransactionDetailwith corresponding filter entries
-
getTransactions
public List<org.exoplatform.wallet.model.transaction.TransactionDetail> getTransactions(long networkId, int limit)
- Parameters:
networkId- blockchain network idlimit- size limit of transactions to retrieve- Returns:
ListofTransactionDetailfor 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 idaddress- wallet addresscontractAddress- filter transactions by a contract addresscontractMethodName- filter transactions by a contract methodhash- retrieve include in the list of transactions this hash even if the limit is reachedlimit- size limit of transactions to retrievepending- whether include pending or notadministration- whether include administration transactions or not- Returns:
ListofTransactionDetailwith 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 idtransactionHash- Transaction hash that will replace othersfromAddress- transaction sender addressnonce- Nonce of the transaction- Returns:
ListofTransactionDetail
-
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 idtransactionHash- Transaction hash to exclude from countfromAddress- transaction sender addressnonce- Nonce of the transaction- Returns:
ListofTransactionDetail
-
getTransactionByHash
public org.exoplatform.wallet.model.transaction.TransactionDetail getTransactionByHash(String hash)
Retrieve aTransactionDetailidentified by its blockchain hash- Parameters:
hash- blockchain transaction hash- Returns:
TransactionDetail
-
getPendingTransactionByHash
public org.exoplatform.wallet.model.transaction.TransactionDetail getPendingTransactionByHash(String hash)
Retrieve aTransactionDetailidentified by its blockchain hash- Parameters:
hash- blockchain transaction hash- Returns:
TransactionDetail
-
countPendingTransactionSent
public long countPendingTransactionSent(long networkId, String fromAddress)- Parameters:
networkId- blockchain network idfromAddress- 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 idfromAddress- 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 addressaddress- wallet addressstartDate- start date of selected periodendDate- 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 addressaddress- wallet addressstartDate- start date of selected periodendDate- end date of selected period- Returns:
- sum of token amounts sent during selected period
-
countTransactions
public long countTransactions()
-
-