Allow listing confirmed transactions
This commit is contained in:
@@ -15,13 +15,14 @@ fun main(args: Array<String>) {
|
||||
val db = DatabaseConfig.Memory("")
|
||||
val client = BlockchainConfig.Electrum(ElectrumConfig("ssl://electrum.blockstream.info:60002", null, 5u, null, 10u))
|
||||
val wallet = OnlineWallet(descriptor, Network.TESTNET, db, client)
|
||||
val address = wallet.getNewAddress()
|
||||
println("Please send $amount satoshis to address: $address")
|
||||
println("Syncing...")
|
||||
wallet.sync(LogProgress(), null)
|
||||
println("Initial wallet balance: ${wallet.getBalance()}")
|
||||
println("Please send $amount satoshis to address: ${wallet.getNewAddress()}")
|
||||
readLine()
|
||||
println("Syncing...")
|
||||
wallet.sync(LogProgress(), null)
|
||||
val balance = wallet.getBalance()
|
||||
println("New wallet balance: $balance")
|
||||
println("New wallet balance: ${wallet.getBalance()}")
|
||||
println("Press Enter to return funds")
|
||||
readLine()
|
||||
println("Creating a partially signed bitcoin transaction with recipient $recipient and amount $amount satoshis...")
|
||||
@@ -31,10 +32,10 @@ fun main(args: Array<String>) {
|
||||
println("Broadcasting the signed transaction...")
|
||||
val transactionId = wallet.broadcast(transaction)
|
||||
println("Refunded $amount satoshis to $recipient via transaction id $transactionId")
|
||||
println("Confirming transaction...")
|
||||
println("Syncing...")
|
||||
wallet.sync(LogProgress(), null)
|
||||
val final_balance = wallet.getBalance()
|
||||
println("New wallet balance: $final_balance")
|
||||
println("Press Enter to exit")
|
||||
readLine()
|
||||
val confirmedTransaction = wallet.getTransactions().stream().filter({ it.id.equals(transactionId) }).findFirst().orElse(null)
|
||||
println("Confirmed transaction: $confirmedTransaction")
|
||||
println("Final wallet balance: ${wallet.getBalance()}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user