diff --git a/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt b/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt index f4a4bf7..6f71888 100644 --- a/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt +++ b/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt @@ -35,7 +35,9 @@ class LiveTxBuilderTest { wallet.commit() println("Balance: ${wallet.getBalance().total}") - assert(wallet.getBalance().total > 0uL) + assert(wallet.getBalance().total > 0uL) { + "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()} and try again." + } val recipient: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) val psbt: Psbt = TxBuilder() @@ -59,7 +61,9 @@ class LiveTxBuilderTest { wallet.commit() println("Balance: ${wallet.getBalance().total}") - assert(wallet.getBalance().total > 0uL) + assert(wallet.getBalance().total > 0uL) { + "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()} and try again." + } val recipient1: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) val recipient2: Address = Address("tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", Network.SIGNET) diff --git a/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveWalletTest.kt b/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveWalletTest.kt index 13544d9..a30663d 100644 --- a/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveWalletTest.kt +++ b/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveWalletTest.kt @@ -37,7 +37,9 @@ class LiveWalletTest { val balance: Balance = wallet.getBalance() println("Balance: $balance") - assert(wallet.getBalance().total > 0uL) + assert(wallet.getBalance().total > 0uL) { + "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()} and try again." + } println("Transactions count: ${wallet.transactions().count()}") val transactions = wallet.transactions().take(3) @@ -59,7 +61,6 @@ class LiveWalletTest { wallet.applyUpdate(update) wallet.commit() println("Balance: ${wallet.getBalance().total}") - println("New address: ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address}") assert(wallet.getBalance().total > 0uL) { "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address} and try again." @@ -82,7 +83,7 @@ class LiveWalletTest { println("Txid is: ${tx.txid()}") val txFee: ULong = wallet.calculateFee(tx) - println("Tx fee is: ${txFee}") + println("Tx fee is: $txFee") val feeRate: FeeRate = wallet.calculateFeeRate(tx) println("Tx fee rate is: ${feeRate.toSatPerVbCeil()} sat/vB") diff --git a/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt b/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt index f371136..ae89b82 100644 --- a/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt +++ b/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt @@ -33,7 +33,9 @@ class LiveTxBuilderTest { wallet.commit() println("Balance: ${wallet.getBalance().total}") - assert(wallet.getBalance().total > 0uL) + assert(wallet.getBalance().total > 0uL) { + "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()} and try again." + } val recipient: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) val psbt: Psbt = TxBuilder() @@ -58,7 +60,9 @@ class LiveTxBuilderTest { wallet.commit() println("Balance: ${wallet.getBalance().total}") - assert(wallet.getBalance().total > 0uL) + assert(wallet.getBalance().total > 0uL) { + "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()} and try again." + } val recipient1: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) val recipient2: Address = Address("tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", Network.SIGNET) diff --git a/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveWalletTest.kt b/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveWalletTest.kt index bbaa386..d68e7e6 100644 --- a/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveWalletTest.kt +++ b/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveWalletTest.kt @@ -33,7 +33,9 @@ class LiveWalletTest { wallet.commit() println("Balance: ${wallet.getBalance().total}") - assert(wallet.getBalance().total > 0uL) + assert(wallet.getBalance().total > 0uL) { + "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()} and try again." + } println("Transactions count: ${wallet.transactions().count()}") val transactions = wallet.transactions().take(3) @@ -55,7 +57,6 @@ class LiveWalletTest { wallet.applyUpdate(update) wallet.commit() println("Balance: ${wallet.getBalance().total}") - println("New address: ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()}") assert(wallet.getBalance().total > 0uL) { "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address.asString()} and try again." diff --git a/bdk-python/tests/test_live_tx_builder.py b/bdk-python/tests/test_live_tx_builder.py index c707517..221d40e 100644 --- a/bdk-python/tests/test_live_tx_builder.py +++ b/bdk-python/tests/test_live_tx_builder.py @@ -32,7 +32,11 @@ class LiveTxBuilderTest(unittest.TestCase): wallet.apply_update(update) wallet.commit() - self.assertGreater(wallet.get_balance().total, 0) + self.assertGreater( + wallet.get_balance().total, + 0, + f"Wallet balance must be greater than 0! Please send funds to {wallet.reveal_next_address(bdk.KeychainKind.EXTERNAL).address.as_string()} and try again." + ) recipient = bdk.Address( address="tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", @@ -68,7 +72,11 @@ class LiveTxBuilderTest(unittest.TestCase): wallet.apply_update(update) wallet.commit() - self.assertGreater(wallet.get_balance().total, 0) + self.assertGreater( + wallet.get_balance().total, + 0, + f"Wallet balance must be greater than 0! Please send funds to {wallet.reveal_next_address(bdk.KeychainKind.EXTERNAL).address.as_string()} and try again." + ) recipient1 = bdk.Address( address="tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", diff --git a/bdk-python/tests/test_live_wallet.py b/bdk-python/tests/test_live_wallet.py index 0001595..f37bd7c 100644 --- a/bdk-python/tests/test_live_wallet.py +++ b/bdk-python/tests/test_live_wallet.py @@ -32,7 +32,11 @@ class LiveWalletTest(unittest.TestCase): wallet.apply_update(update) wallet.commit() - self.assertGreater(wallet.get_balance().total, 0) + self.assertGreater( + wallet.get_balance().total, + 0, + f"Wallet balance must be greater than 0! Please send funds to {wallet.reveal_next_address(bdk.KeychainKind.EXTERNAL).address.as_string()} and try again." + ) print(f"Transactions count: {len(wallet.transactions())}") transactions = wallet.transactions()[:3] @@ -64,7 +68,11 @@ class LiveWalletTest(unittest.TestCase): wallet.apply_update(update) wallet.commit() - self.assertGreater(wallet.get_balance().total, 0) + self.assertGreater( + wallet.get_balance().total, + 0, + f"Wallet balance must be greater than 0! Please send funds to {wallet.reveal_next_address(bdk.KeychainKind.EXTERNAL).address.as_string()} and try again." + ) recipient = bdk.Address( address="tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", diff --git a/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift b/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift index a514049..466b99c 100644 --- a/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift +++ b/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift @@ -1,8 +1,8 @@ import XCTest @testable import BitcoinDevKit -let SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" -let TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" +private let SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +private let TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" final class LiveTxBuilderTests: XCTestCase { var dbFilePath: URL! @@ -45,9 +45,14 @@ final class LiveTxBuilderTests: XCTestCase { parallelRequests: 1 ) try wallet.applyUpdate(update: update) - try wallet.commit() + let _ = try wallet.commit() + let address = try wallet.revealNextAddress(keychain: KeychainKind.external).address.asString() - XCTAssertGreaterThan(wallet.getBalance().total, UInt64(0), "Wallet must have positive balance, please add funds") + XCTAssertGreaterThan( + wallet.getBalance().total, + UInt64(0), + "Wallet must have positive balance, please send funds to \(address)" + ) let recipient: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .signet) let psbt: Psbt = try TxBuilder() @@ -82,9 +87,14 @@ final class LiveTxBuilderTests: XCTestCase { parallelRequests: 1 ) try wallet.applyUpdate(update: update) - try wallet.commit() - - XCTAssertGreaterThan(wallet.getBalance().total, UInt64(0), "Wallet must have positive balance, please add funds") + let _ = try wallet.commit() + let address = try wallet.revealNextAddress(keychain: KeychainKind.external).address.asString() + + XCTAssertGreaterThan( + wallet.getBalance().total, + UInt64(0), + "Wallet must have positive balance, please send funds to \(address)" + ) let recipient1: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .signet) let recipient2: Address = try Address(address: "tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", network: .signet) @@ -100,7 +110,7 @@ final class LiveTxBuilderTests: XCTestCase { .enableRbf() .finish(wallet: wallet) - try! wallet.sign(psbt: psbt) + let _ = try! wallet.sign(psbt: psbt) XCTAssertTrue(psbt.serialize().hasPrefix("cHNi"), "PSBT should start with cHNI") } diff --git a/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift b/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift index d908d3f..0b7d702 100644 --- a/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift +++ b/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift @@ -1,8 +1,8 @@ import XCTest @testable import BitcoinDevKit -let SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" -let TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" +private let SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +private let TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" final class LiveWalletTests: XCTestCase { var dbFilePath: URL! @@ -45,9 +45,14 @@ final class LiveWalletTests: XCTestCase { parallelRequests: 1 ) try wallet.applyUpdate(update: update) - try wallet.commit() + let _ = try wallet.commit() + let address = try wallet.revealNextAddress(keychain: KeychainKind.external).address.asString() - XCTAssertGreaterThan(wallet.getBalance().total, UInt64(0)) + XCTAssertGreaterThan( + wallet.getBalance().total, + UInt64(0), + "Wallet must have positive balance, please send funds to \(address)" + ) print("Transactions count: \(wallet.transactions().count)") let transactions = wallet.transactions().prefix(3) @@ -78,9 +83,15 @@ final class LiveWalletTests: XCTestCase { parallelRequests: 1 ) try wallet.applyUpdate(update: update) - try wallet.commit() - - XCTAssertGreaterThan(wallet.getBalance().total, UInt64(0), "Wallet must have positive balance, please add funds") + let _ = try wallet.commit() + let address = try wallet.revealNextAddress(keychain: KeychainKind.external).address.asString() + + XCTAssertGreaterThan( + wallet.getBalance().total, + UInt64(0), + "Wallet must have positive balance, please send funds to \(address)" + ) + print("Balance: \(wallet.getBalance().total)")