Package io.keyko.nevermined.manager
Class AccountsManager
- java.lang.Object
-
- io.keyko.nevermined.manager.BaseManager
-
- io.keyko.nevermined.manager.AccountsManager
-
public class AccountsManager extends BaseManager
Controller class to manage the token functions
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.keyko.nevermined.manager.BaseManager
BaseManager.ContractAddresses
-
-
Field Summary
Fields Modifier and Type Field Description private StringfaucetUrlprivate static org.apache.logging.log4j.Loggerlog-
Fields inherited from class io.keyko.nevermined.manager.BaseManager
accessSecretStoreCondition, agreementStoreManager, computeExecutionCondition, condition, conditionStoreManager, config, contractAddresses, didRegistry, dispenser, escrowAccessSecretStoreTemplate, escrowComputeExecutionTemplate, escrowReward, lockRewardCondition, mainAccount, providerAddress, templateStoreManager, tokenContract
-
-
Constructor Summary
Constructors Modifier Constructor Description privateAccountsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BalancegetAccountBalance(String accountAddress)Given an account returns a Balance object with the Ethereum and Ocean balanceList<Account>getAccounts()Returns the list of ethereum accounts registered in the Keeper node If getBalance is true, get the ethereum and nevermined balance of each accountBigIntegergetEthAccountBalance(String accountAddress)Given an account returns the Ethereum balanceStringgetFaucetUrl()static AccountsManagergetInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)Given the KeeperService and MetadataApiService, returns a new instance of AccountsManager using them as attributesBigIntegergetNeverminedAccountBalance(String accountAddress)Given an account returns the Ocean balance Contract: NeverminedToken Method: balanceOforg.web3j.protocol.core.methods.response.TransactionReceiptrequestTokens(BigInteger amount)Requests Nevermined Tokens from the Dispenser Smart ContractAccountsManagersetFaucetUrl(String faucetUrl)org.web3j.protocol.core.methods.response.TransactionReceipttransfer(String receiverAccount, BigInteger amount)Transfer tokens from one account to the receiver address-
Methods inherited from class io.keyko.nevermined.manager.BaseManager
buildDDO, getAccessSecretStoreCondition, getComputeExecutionCondition, getContractAddresses, getDecriptedSecretStoreMetadataFiles, getDecriptedSecretStoreMetadataFiles, getEscrowComputeExecutionTemplate, getEscrowReward, getEvmDto, getKeeperService, getLockRewardCondition, getMainAccount, getMetadataApiService, getProviderAddress, getSecretStoreDto, getSecretStoreManager, getTemplateIdByName, resolveDID, setAccessSecretStoreCondition, setAgreementStoreManagerContract, setComputeExecutionCondition, setConditionStoreManagerContract, setDidRegistryContract, setDispenserContract, setEscrowAccessSecretStoreTemplate, setEscrowComputeExecutionTemplate, setEscrowReward, setEvmDto, setKeeperService, setLockRewardCondition, setMainAccount, setMetadataApiService, setProviderAddress, setSecretStoreDto, setSecretStoreManager, setTemplateStoreManagerContract, setTokenContract, tokenApprove, toString
-
-
-
-
Field Detail
-
log
private static final org.apache.logging.log4j.Logger log
-
faucetUrl
private String faucetUrl
-
-
Constructor Detail
-
AccountsManager
private AccountsManager(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
-
-
Method Detail
-
getInstance
public static AccountsManager getInstance(io.keyko.common.web3.KeeperService keeperService, MetadataApiService metadataApiService)
Given the KeeperService and MetadataApiService, returns a new instance of AccountsManager using them as attributes- Parameters:
keeperService- Keeper DtometadataApiService- Provider Dto- Returns:
- AccountsManager
-
getAccounts
public List<Account> getAccounts() throws EthereumException
Returns the list of ethereum accounts registered in the Keeper node If getBalance is true, get the ethereum and nevermined balance of each account- Returns:
- List of accounts
- Throws:
EthereumException- if the EVM throws an exception
-
getAccountBalance
public Balance getAccountBalance(String accountAddress) throws EthereumException
Given an account returns a Balance object with the Ethereum and Ocean balance- Parameters:
accountAddress- account- Returns:
- Balance
- Throws:
EthereumException- if the EVM throws an exception
-
getEthAccountBalance
public BigInteger getEthAccountBalance(String accountAddress) throws EthereumException
Given an account returns the Ethereum balance- Parameters:
accountAddress- account- Returns:
- ethereum balance
- Throws:
EthereumException- if the EVM throws an exception
-
getNeverminedAccountBalance
public BigInteger getNeverminedAccountBalance(String accountAddress) throws EthereumException
Given an account returns the Ocean balance Contract: NeverminedToken Method: balanceOf- Parameters:
accountAddress- account- Returns:
- nevermined balance
- Throws:
EthereumException- if the EVM throws an exception
-
requestTokens
public org.web3j.protocol.core.methods.response.TransactionReceipt requestTokens(BigInteger amount) throws EthereumException
Requests Nevermined Tokens from the Dispenser Smart Contract- Parameters:
amount- amount of tokens requests- Returns:
- TransactionReceipt
- Throws:
EthereumException- if the EVM throws an exception
-
transfer
public org.web3j.protocol.core.methods.response.TransactionReceipt transfer(String receiverAccount, BigInteger amount) throws EthereumException
Transfer tokens from one account to the receiver address- Parameters:
receiverAccount- Address of the transfer receiveramount- Amount of tokens to transfer- Returns:
- TransactionReceipt tx receipt
- Throws:
EthereumException- if the EVM throws an exception
-
getFaucetUrl
public String getFaucetUrl()
-
setFaucetUrl
public AccountsManager setFaucetUrl(String faucetUrl)
-
-