public class IotaAccount extends Object implements Account, EventListener
| Modifier and Type | Class and Description |
|---|---|
static class |
IotaAccount.Builder |
| Modifier | Constructor and Description |
|---|---|
protected |
IotaAccount(AccountBuilder builder) |
|
IotaAccount(AccountOptions options) |
|
IotaAccount(String seed)
Constructs a IotaAccount with a config based on environment variables or default values.
|
|
IotaAccount(String seed,
AccountStore store)
Constructs a IotaAccount with a config based on environment variables or default values.
|
|
IotaAccount(String seed,
AccountStore store,
AccountConfig iotaConfig)
Constructs a IotaAccount with config
|
|
IotaAccount(String seed,
AccountStore store,
String config)
Constructs a IotaAccount with a config from String
|
| Modifier and Type | Method and Description |
|---|---|
long |
availableBalance()
Runs the input selection with the CDAs in order to determine the usable balance for funding transfers.
|
AccountState |
exportAccount()
Makes a copy of the current account state.
|
AccountStateManager |
getAccountManager() |
IotaAPI |
getApi() |
EventManager |
getEventManager() |
String |
getId()
Returns the account’s unique identifier which is a sha256 hash of the account’s seed.
|
SeedProvider |
getSeed() |
void |
importAccount(AccountState state)
Saves the current account state, then replaces it with the one provided.
|
boolean |
isNew()
Checks whether the state of the account is new.
|
void |
load()
Loads the account’s inner event loop to accept commands and provided plugins using current the account settings
|
void |
load(String accountId,
AccountState state) |
Future<ConditionalDepositAddress> |
newDepositAddress(Date timeOut,
boolean multiUse,
long expectedAmount,
ExpireCondition... otherConditions)
Future always completed
Allocates a new CDA in the underlying store.
|
Future<ConditionalDepositAddress> |
newDepositRequest(DepositRequest request,
ExpireCondition... otherConditions) |
Future<Bundle> |
send(Recipient recipient)
Future always completed
Sends the specified amounts to the given recipient.
|
Future<Bundle> |
send(String address,
long amount,
Optional<String> message,
Optional<String> tag)
Sends a transfer using the accounts balance to the provided address.
|
Future<Bundle> |
send(String address,
long amount,
String message,
String tag) |
Future<Bundle> |
sendMulti(String[] addresses,
long amount,
Optional<String> message,
Optional<String> tag)
NOT YET IMPLEMENTED
|
Future<Bundle> |
sendZeroValue(Optional<String> message,
Optional<String> tag,
Optional<String> address)
Future always completed
|
Future<Bundle> |
sendZeroValue(String message,
String tag,
String address)
Future always completed
|
void |
shutdown()
Shutdowns the account’s inner event loop and shutdowns all plugins.
|
boolean |
start()
Starts the account event loop
|
String |
toString() |
long |
totalBalance()
Uses all stored CDAs to determine the current total balance.
|
void |
updateSettings(AccountOptions newSettings)
Updates the settings of the account in a synchronized manner by shutting down all plugins,
stopping the event loop, applying the settings
and starting the newly defined plugins and kicking off the event loop again.
|
public IotaAccount(AccountOptions options)
options - protected IotaAccount(AccountBuilder builder)
public IotaAccount(String seed) throws Exception
seed - Exception - If the config did not load for whatever reasonpublic IotaAccount(String seed, AccountStore store) throws Exception
seed - store - The method we use for storing key/value dataException - If the config did not load for whatever reasonpublic IotaAccount(String seed, AccountStore store, String config) throws Exception
seed - store - The method we use for storing key/value dataconfig - The location of the configException - If the config did not load for whatever reasonpublic IotaAccount(String seed, AccountStore store, AccountConfig iotaConfig) throws Exception
seed - store - The method we use for storing key/value dataiotaConfig - The config we load nodes fromException - If the config did not load for whatever reasonpublic void load()
Accountload in interface Accountload in interface TaskServicepublic void load(String accountId, AccountState state) throws AccountError
AccountErrorpublic String getId() throws AccountError
getId in interface AccountAccountError - When we failed to generate the IDpublic boolean start()
throws AccountError
start in interface Accountstart in interface TaskServicetrue if loaded successful. otherwise falseAccountError - When an error occurred during start-uppublic void shutdown()
throws AccountError
shutdown in interface Accountshutdown in interface TaskServiceAccountErrorpublic long availableBalance()
throws AccountError
availableBalance in interface AccountAccountError - When we failed to get the balancepublic long totalBalance()
throws AccountError
totalBalance in interface AccountAccountError - When we failed to get the balancepublic boolean isNew()
public void updateSettings(AccountOptions newSettings) throws AccountError
updateSettings in interface AccountnewSettings - The new settings for this accountAccountError - When we failed to update the settingspublic Future<Bundle> send(String address, long amount, Optional<String> message, Optional<String> tag)
.get() on the future in order to start this transfer.address - The receiver of this transferamount - The amount we are sending to the addressmessage - An optional message for this transfertag - An optional tag for this transferpublic Future<ConditionalDepositAddress> newDepositAddress(Date timeOut, boolean multiUse, long expectedAmount, ExpireCondition... otherConditions) throws AccountError
newDepositAddress in interface AccounttimeOut - The date this address expiresmultiUse - If we expect multiple depositsexpectedAmount - The final balance we expect to have in this address before we expireotherConditions - Currently unused, used to specify custom conditionsConditionalDepositAddress The newly generated CDAAccountError - When we were not able to generate a new addresspublic Future<ConditionalDepositAddress> newDepositRequest(DepositRequest request, ExpireCondition... otherConditions) throws AccountError
AccountErrorpublic Future<Bundle> send(Recipient recipient) throws AccountError
send in interface Accountrecipient - Information about the receiving end of the transactionsAccountErrorpublic Future<Bundle> sendZeroValue(String message, String tag, String address) throws ArgumentException, SendException
message - the optional message to use, can be nulltag - the optional tag to use, can be nulladdress - the optional address to use, can be nullArgumentException - If an argument is wrongSendException - If an internal error happened whilst sendingpublic Future<Bundle> sendZeroValue(Optional<String> message, Optional<String> tag, Optional<String> address) throws ArgumentException, SendException
message - the optional message to usetag - the optional tag to useArgumentException - If an argument is wrongSendException - If an internal error happened whilst sendingpublic Future<Bundle> sendMulti(String[] addresses, long amount, Optional<String> message, Optional<String> tag)
addresses - amount - message - tag - public AccountState exportAccount()
null if it failedpublic void importAccount(AccountState state)
state - the new account statepublic SeedProvider getSeed()
public IotaAPI getApi()
public EventManager getEventManager()
public AccountStateManager getAccountManager()
Copyright © 2019. All rights reserved.