Address Index
The address index selection strategy to use to derive an address from the wallet’s external descriptor.
If you’re unsure which one to use, use AddressIndex.NEW
.
Samples
fun main() {
//sampleStart
val wallet: Wallet = Wallet(
descriptor = descriptor,
changeDescriptor = changeDescriptor,
network = Network.TESTNET,
databaseConfig = DatabaseConfig.Memory
)
fun getLastUnusedAddress(): AddressInfo {
return wallet.getAddress(AddressIndex.LAST_UNUSED)
}
//sampleEnd
}
Entries
Link copied to clipboard
Content copied to clipboard
Return the address for the current descriptor index if it has not been used in a received transaction. Otherwise return a new address as with AddressIndex.NEW
. Use with caution, if the wallet has not yet detected an address has been used it could return an already used address. This function is primarily meant for situations where the caller is untrusted; for example when deriving donation addresses on-demand for a public web page.