Interface WalletTokenAdminService


  • public interface WalletTokenAdminService
    Communicates with blockchain to send transactions and retrieve information 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 key
        issuerUsername - 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:
        TransactionDetail with 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:
        TransactionDetail with 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:
        TransactionDetail with 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:
        TransactionDetail with 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:
        TransactionDetail with 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:
        TransactionDetail with 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 refresh
        contractDetail - contract details attributes
        walletModifications - 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