Enum Class Wallet.BalanceType
- All Implemented Interfaces:
Serializable
,Comparable<Wallet.BalanceType>
,Constable
- Enclosing class:
- Wallet
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionBalance that could be safely used to create new spends, if we had all the needed private keys.Same as AVAILABLE but only for outputs we have the private keys for and can sign ourselves.Balance calculated assuming all pending transactions are in fact included into the best chain by miners.Same as ESTIMATED but only for outputs we have the private keys for and can sign ourselves. -
Method Summary
Modifier and TypeMethodDescriptionstatic Wallet.BalanceType
Returns the enum constant of this class with the specified name.static Wallet.BalanceType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ESTIMATED
Balance calculated assuming all pending transactions are in fact included into the best chain by miners. This includes the value of immature coinbase transactions. -
AVAILABLE
Balance that could be safely used to create new spends, if we had all the needed private keys. This is whatever the default coin selector would make available, which by default means transaction outputs with at least 1 confirmation and pending transactions created by our own wallet which have been propagated across the network. Whether we actually have the private keys or not is irrelevant for this balance type. -
ESTIMATED_SPENDABLE
Same as ESTIMATED but only for outputs we have the private keys for and can sign ourselves. -
AVAILABLE_SPENDABLE
Same as AVAILABLE but only for outputs we have the private keys for and can sign ourselves.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-