public static enum Wallet.BalanceType extends Enum<Wallet.BalanceType>
It's possible to calculate a wallets balance from multiple points of view. This enum selects which
Wallet.getBalance(BalanceType)
should use.
Consider a real-world example: you buy a snack costing $5 but you only have a $10 bill. At the start you have $10 viewed from every possible angle. After you order the snack you hand over your $10 bill. From the perspective of your wallet you have zero dollars (AVAILABLE). But you know in a few seconds the shopkeeper will give you back $5 change so most people in practice would say they have $5 (ESTIMATED).
The fact that the wallet can track transactions which are not spendable by itself ("watching wallets") adds another type of balance to the mix. Although the wallet won't do this by default, advanced use cases that override the relevancy checks can end up with a mix of spendable and unspendable transactions.
Enum Constant and Description |
---|
AVAILABLE
Balance that could be safely used to create new spends, if we had all the needed private keys.
|
AVAILABLE_SPENDABLE
Same as AVAILABLE but only for outputs we have the private keys for and can sign ourselves.
|
ESTIMATED
Balance calculated assuming all pending transactions are in fact included into the best chain by miners.
|
ESTIMATED_SPENDABLE
Same as ESTIMATED but only for outputs we have the private keys for and can sign ourselves.
|
Modifier and Type | Method and Description |
---|---|
static Wallet.BalanceType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Wallet.BalanceType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Wallet.BalanceType ESTIMATED
public static final Wallet.BalanceType AVAILABLE
public static final Wallet.BalanceType ESTIMATED_SPENDABLE
public static final Wallet.BalanceType AVAILABLE_SPENDABLE
public static Wallet.BalanceType[] values()
for (Wallet.BalanceType c : Wallet.BalanceType.values()) System.out.println(c);
public static Wallet.BalanceType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2016. All rights reserved.