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
      • 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:
        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
      • 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​(String address)
                              throws Exception
        Checks whether the wallet is initialized or not (on blockchain)
        Parameters:
        address -
        Returns:
        TransactionDetail with 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:
        TransactionDetail with 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:
        TransactionDetail with 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 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