Package io.meeds.wallet.service
Interface WalletTokenAdminService
public interface WalletTokenAdminService
Communicates with blockchain to send transactions and retrieve information
using admin wallet
-
Method Summary
Modifier and TypeMethodDescriptionvoidBoosts the transaction issued from Admin wallet by increasing the gas pricevoidGenerates admin account wallet and store it internally in eXo ServercreateAdminAccount(String privateKey, String issuerUsername) Creates admin account wallet using provided private key and store it internally in eXo ServergenerateHash(String rawTransaction) getEtherBalanceOf(String address) Get ether balance of a wallet address (on blockchain)getTokenBalanceOf(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 blockchainreward(TransactionDetail transactionDetail, String issuerUsername) Send rewarded token amounts (on blockchain) to a receiver wallet address using 'Admin' wallet.sendEther(TransactionDetail transactionDetail, String issuerUsername) Send ether (on blockchain) to a receiver wallet address using 'Admin' wallet.sendToken(TransactionDetail transactionDetail, String issuerUsername) Send token (on blockchain) to a receiver wallet address using 'Admin' wallet.
-
Method Details
-
createAdminAccount
void createAdminAccount()Generates admin account wallet and store it internally in eXo Server -
createAdminAccount
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
- 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
Get token balance of a wallet address (on blockchain)- Parameters:
address-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain
-
getEtherBalanceOf
Get ether balance of a wallet address (on blockchain)- Parameters:
address-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
isInitializedAccount
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
-