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 BigIntegerbalanceOf(String address)Get token balance of a wallet address (on blockchain)voidcreateAdminAccount()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)intgetAdminLevel(String address)Get admin level of a wallet address from token (on blockchain)StringgetAdminWalletAddress()BigIntegergetEtherBalanceOf(String address)Get ether balance of a wallet address (on blockchain)TransactionDetailinitialize(TransactionDetail transactionDetail, String issuerUsername)Initializes (on blockchain) a receiver wallet address using 'Admin' wallet by using funds transmitted in transaction detail.booleanisApprovedAccount(String address)Checks if a wallet address is approved on token (on blockchain)booleanisInitializedAccount(String address)Checks whether the wallet is initialized or not (on blockchain)voidrefreshContractDetailFromBlockchain(ContractDetail contractDetail, Set<String> contractModifications)Retrieves contract details from blockchain, like: - Sell price - Owner - Symbol - Name ...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
-
initialize
TransactionDetail initialize(TransactionDetail transactionDetail, String issuerUsername) throws Exception
Initializes (on blockchain) a receiver wallet address using 'Admin' wallet by using funds transmitted in transaction detail. 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
-
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
-
balanceOf
BigInteger balanceOf(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(String address) throws Exception
Checks whether the wallet is initialized or not (on blockchain)- Parameters:
address-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
getAdminLevel
int getAdminLevel(String address) throws Exception
Get admin level of a wallet address from token (on blockchain)- Parameters:
address-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
isApprovedAccount
boolean isApprovedAccount(String address) throws Exception
Checks if a wallet address is approved on token (on blockchain)- Parameters:
address-- Returns:
TransactionDetailwith the hash of the transaction sent in blockchain- Throws:
Exception
-
refreshContractDetailFromBlockchain
void refreshContractDetailFromBlockchain(ContractDetail contractDetail, Set<String> contractModifications)
Retrieves contract details from blockchain, like: - Sell price - Owner - Symbol - Name ...- Parameters:
contractDetail- existing contract detail retrieved from internal database to refresh its attributes.contractModifications- list of called method names to change contract state on blockchain. This parameter will be used to know which methods to call to refresh contract state in order to optimize the number of calls to Blockchain
-
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
-
-