Package org.exoplatform.wallet.service
Interface WalletTokenAdminService
-
public interface WalletTokenAdminServiceCommunicates with blockchain to send transactions and retrieve information using admin wallet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidboostAdminTransactions()Boosts the transaction issued from Admin wallet by increasing the gas pricevoidcreateAdminAccount()Generates admin account wallet and store it internally in eXo ServerWalletcreateAdminAccount(String privateKey, String issuerUsername)Creates admin account wallet using provided private key and store it internally in eXo ServerStringgenerateHash(String rawTransaction)StringgetAdminWalletAddress()BigIntegergetEtherBalanceOf(String address)Get ether balance of a wallet address (on blockchain)BigIntegergetTokenBalanceOf(String address)Get token balance of a wallet address (on blockchain)booleanisInitializedAccount(Wallet wallet)Checks whether the wallet is initialized or not (on blockchain)voidretrieveWalletInformationFromBlockchain(Wallet wallet, ContractDetail contractDetail, Set<String> walletModifications)Retrieves wallet details from blockchainTransactionDetailreward(TransactionDetail transactionDetail, String issuerUsername)Send rewarded token amounts (on blockchain) to a receiver wallet address using 'Admin' wallet.TransactionDetailsendEther(TransactionDetail transactionDetail, String issuerUsername)Send ether (on blockchain) to a receiver wallet address using 'Admin' wallet.TransactionDetailsendToken(TransactionDetail transactionDetail, String issuerUsername)Send token (on blockchain) to a receiver wallet address using 'Admin' wallet.
-
-
-
Method Detail
-
createAdminAccount
void createAdminAccount()
Generates admin account wallet and store it internally in eXo Server
-
createAdminAccount
Wallet createAdminAccount(String privateKey, String issuerUsername) throws IllegalAccessException
Creates admin account wallet using provided private key and store it internally in eXo Server- Parameters:
privateKey- admin account wallet private keyissuerUsername- current user creating wallet- Returns:
- created wallet
- Throws:
IllegalAccessException- if current user is not allowed to create admin wallet account
-
getAdminWalletAddress
String getAdminWalletAddress()
- Returns:
- Admin wallet address
-
generateHash
String generateHash(String rawTransaction)
- Parameters:
rawTransaction- raw transaction to send to blockchain- Returns:
- real generated transaction hash using Web3j
-
reward
TransactionDetail reward(TransactionDetail transactionDetail, String issuerUsername) throws Exception
Send rewarded token amounts (on blockchain) to a receiver wallet address using 'Admin' wallet. The amount sent could be different from rewarded amount. A label and a message are associated to the transaction. Those properties aren't sent on blockchain, but stored in database. The transaction issuer will be stored in transaction details stored internally in eXo server.- Parameters:
transactionDetail-issuerUsername-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
sendEther
TransactionDetail sendEther(TransactionDetail transactionDetail, String issuerUsername) throws Exception
Send ether (on blockchain) to a receiver wallet address using 'Admin' wallet. The transaction issuer, label and message will be stored in transaction details inside eXo server only.- Parameters:
transactionDetail-issuerUsername-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
sendToken
TransactionDetail sendToken(TransactionDetail transactionDetail, String issuerUsername) throws Exception
Send token (on blockchain) to a receiver wallet address using 'Admin' wallet. The transaction issuer, label and message will be stored in transaction details inside eXo server only.- Parameters:
transactionDetail-issuerUsername-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
getTokenBalanceOf
BigInteger getTokenBalanceOf(String address) throws Exception
Get token balance of a wallet address (on blockchain)- Parameters:
address-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
getEtherBalanceOf
BigInteger getEtherBalanceOf(String address) throws Exception
Get ether balance of a wallet address (on blockchain)- Parameters:
address-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
isInitializedAccount
boolean isInitializedAccount(Wallet wallet) throws Exception
Checks whether the wallet is initialized or not (on blockchain)- Parameters:
wallet-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
retrieveWalletInformationFromBlockchain
void retrieveWalletInformationFromBlockchain(Wallet wallet, ContractDetail contractDetail, Set<String> walletModifications) throws Exception
Retrieves wallet details from blockchain- Parameters:
wallet- object to refreshcontractDetail- contract details attributeswalletModifications- list of called method names to change wallet state on blockchain. This parameter will be used to know which methods to call to refresh wallet state in order to optimize the number of calls to Blockchain- Throws:
Exception
-
boostAdminTransactions
void boostAdminTransactions()
Boosts the transaction issued from Admin wallet by increasing the gas price
-
-