public abstract class AbstractWallet extends RpcClientSupport implements Wallet
Wallet.Address| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
LOG |
clientALL_FUNDS, LABEL_CHANGE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractWallet(Blockchain blockchain,
wf.bitcoin.javabitcoindrpcclient.BitcoindRpcClient client) |
| Modifier and Type | Method and Description |
|---|---|
Wallet.Address |
addAddress(String rawAddr,
List<String> labels)
Add a watch only address to this wallet
|
Wallet.Address |
addPrivateKey(String privKey,
List<String> labels)
Add an address deriven from a private key to this wallet
|
protected String |
concatLabels(List<String> labels) |
protected abstract Wallet.Address |
createAdddressFromRaw(String rawAddr,
List<String> labels) |
protected abstract Wallet.Address |
createNewAddress(List<String> labels) |
String |
createRawTx(Tx tx) |
Wallet.Address |
findAddress(String rawAddr)
Find the address for a given raw address
|
Wallet.Address |
getAddress(String label)
Get the default address for a given label
|
List<Wallet.Address> |
getAddresses()
Get all addresses.
|
List<Wallet.Address> |
getAddresses(String label)
Get addresses for a given label.
|
BigDecimal |
getBalance(String label)
Get the balance for a given label
|
BigDecimal |
getBalance(Wallet.Address addr)
Get the balance for a given address
|
protected Blockchain |
getBlockchain() |
Wallet.Address |
getChangeAddress(String label)
Get a random change address for a given label.
|
List<Wallet.Address> |
getChangeAddresses(String label)
Get change addresses for a given label
|
List<String> |
getLabels()
List available label
|
protected Tx |
getLockedTransaction(String txId) |
Tx |
getTransaction(String txId)
Get the transaction for the given Id
|
static BigDecimal |
getUTXOAmount(List<UTXO> utxos) |
void |
importAddresses(Config config)
Import addressses from configuration.
|
protected abstract boolean |
isP2PKH(String addr) |
List<UTXO> |
listLockUnspent(List<Wallet.Address> addrs)
List locked UTXOs associated with a list of addresses
The lock state of an UTXO is delegated to the underlying
wallet implementation and may not survive wallet restart.
|
List<UTXO> |
listUnspent(List<Wallet.Address> addrs)
List UTXOs associated with a list of addresses
|
List<UTXO> |
listUnspent(String label)
Get all unspent transaction outputs associated with the given label
|
boolean |
lockUnspent(UTXO utxo,
boolean unlock)
Lock an unspent transaction output.
|
Wallet.Address |
newAddress(String label)
Generate new address.
|
Wallet.Address |
newChangeAddress(String label)
Generate new change address.
|
void |
redeemChange(String label,
Wallet.Address toAddr) |
List<UTXO> |
selectUnspent(List<Wallet.Address> addrs,
BigDecimal amount)
Select a list of unspent transaction outputs that satisfy the requested amount
|
List<UTXO> |
selectUnspent(String label,
BigDecimal amount)
Select a list of unspent transaction outputs that satisfy the requested amount
|
String |
sendFromLabel(String label,
String toAddress,
BigDecimal amount)
Sends funds that are associated with a given label to an address
|
String |
sendRawTransaction(String signedTx) |
String |
sendToAddress(String toAddress,
BigDecimal amount)
Sends funds from the default account to an address
|
String |
sendTx(Tx tx)
Send a raw transaction to the network
|
String |
signRawTx(String rawTx,
List<TxInput> inputs) |
protected List<String> |
splitLabels(String labels) |
Wallet.Address |
updateAddress(Wallet.Address addr,
List<String> labels) |
getRpcClientprotected AbstractWallet(Blockchain blockchain, wf.bitcoin.javabitcoindrpcclient.BitcoindRpcClient client)
protected Blockchain getBlockchain()
public void importAddresses(Config config)
WalletimportAddresses in interface Walletpublic Wallet.Address addPrivateKey(String privKey, List<String> labels)
WalletaddPrivateKey in interface Walletpublic Wallet.Address addAddress(String rawAddr, List<String> labels)
WalletaddAddress in interface Walletpublic final Wallet.Address newAddress(String label)
WalletnewAddress in interface Walletpublic final Wallet.Address newChangeAddress(String label)
WalletnewChangeAddress in interface Walletpublic List<String> getLabels()
Walletpublic Wallet.Address getAddress(String label)
WalletgetAddress in interface Walletpublic Wallet.Address findAddress(String rawAddr)
WalletfindAddress in interface Walletpublic List<Wallet.Address> getAddresses()
WalletgetAddresses in interface Walletpublic List<Wallet.Address> getAddresses(String label)
WalletgetAddresses in interface Walletpublic List<Wallet.Address> getChangeAddresses(String label)
WalletgetChangeAddresses in interface Walletpublic Wallet.Address getChangeAddress(String label)
WalletgetChangeAddress in interface Walletpublic BigDecimal getBalance(String label)
WalletgetBalance in interface Walletpublic BigDecimal getBalance(Wallet.Address addr)
WalletgetBalance in interface Walletpublic static BigDecimal getUTXOAmount(List<UTXO> utxos)
public String sendToAddress(String toAddress, BigDecimal amount)
WalletsendToAddress in interface Walletpublic String sendFromLabel(String label, String toAddress, BigDecimal amount)
WalletsendFromLabel in interface Walletpublic String sendTx(Tx tx)
Walletpublic List<UTXO> listUnspent(String label)
WalletlistUnspent in interface Walletpublic List<UTXO> listUnspent(List<Wallet.Address> addrs)
WalletlistUnspent in interface Walletpublic List<UTXO> listLockUnspent(List<Wallet.Address> addrs)
WalletlistLockUnspent in interface Walletpublic boolean lockUnspent(UTXO utxo, boolean unlock)
WalletlockUnspent in interface Walletpublic List<UTXO> selectUnspent(String label, BigDecimal amount)
WalletselectUnspent in interface Walletpublic List<UTXO> selectUnspent(List<Wallet.Address> addrs, BigDecimal amount)
WalletselectUnspent in interface Walletpublic Tx getTransaction(String txId)
WalletgetTransaction in interface Walletpublic Wallet.Address updateAddress(Wallet.Address addr, List<String> labels)
public void redeemChange(String label, Wallet.Address toAddr)
protected abstract Wallet.Address createAdddressFromRaw(String rawAddr, List<String> labels)
protected abstract Wallet.Address createNewAddress(List<String> labels)
protected abstract boolean isP2PKH(String addr)
Copyright © 2018. All rights reserved.