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 a49f69c8..f4a4bf7d 100644 --- a/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt +++ b/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt @@ -8,6 +8,9 @@ import java.io.File import kotlin.test.AfterTest import kotlin.test.assertTrue +private const val SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +private const val TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + @RunWith(AndroidJUnit4::class) class LiveTxBuilderTest { private val persistenceFilePath = InstrumentationRegistry @@ -23,9 +26,9 @@ class LiveTxBuilderTest { @Test fun testTxBuilder() { - val descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) - val wallet = Wallet(descriptor, null, persistenceFilePath, Network.TESTNET) - val esploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") + val descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.SIGNET) + val wallet = Wallet(descriptor, null, persistenceFilePath, Network.SIGNET) + val esploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) @@ -34,7 +37,7 @@ class LiveTxBuilderTest { assert(wallet.getBalance().total > 0uL) - val recipient: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.TESTNET) + val recipient: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) val psbt: Psbt = TxBuilder() .addRecipient(recipient.scriptPubkey(), 4200uL) .feeRate(FeeRate.fromSatPerVb(2uL)) @@ -46,10 +49,10 @@ class LiveTxBuilderTest { @Test fun complexTxBuilder() { - val externalDescriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) - val changeDescriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/1/*)", Network.TESTNET) + val externalDescriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.SIGNET) + val changeDescriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/1/*)", Network.SIGNET) val wallet = Wallet(externalDescriptor, changeDescriptor, persistenceFilePath, Network.TESTNET) - val esploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") + val esploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) @@ -58,8 +61,8 @@ class LiveTxBuilderTest { assert(wallet.getBalance().total > 0uL) - val recipient1: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.TESTNET) - val recipient2: Address = Address("tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", Network.TESTNET) + val recipient1: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) + val recipient2: Address = Address("tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", Network.SIGNET) val allRecipients: List = listOf( ScriptAmount(recipient1.scriptPubkey(), 4200uL), ScriptAmount(recipient2.scriptPubkey(), 4200uL), 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 122a8e10..13544d9b 100644 --- a/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveWalletTest.kt +++ b/bdk-android/lib/src/androidTest/kotlin/org/bitcoindevkit/LiveWalletTest.kt @@ -8,6 +8,9 @@ import java.io.File import kotlin.test.AfterTest import kotlin.test.assertTrue +private const val SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +private const val TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + @RunWith(AndroidJUnit4::class) class LiveWalletTest { private val persistenceFilePath = InstrumentationRegistry @@ -23,9 +26,9 @@ class LiveWalletTest { @Test fun testSyncedBalance() { - val descriptor: Descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) - val wallet: Wallet = Wallet(descriptor, null, persistenceFilePath, Network.TESTNET) - val esploraClient: EsploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") + val descriptor: Descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.SIGNET) + val wallet: Wallet = Wallet(descriptor, null, persistenceFilePath, Network.SIGNET) + val esploraClient: EsploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) @@ -48,9 +51,9 @@ class LiveWalletTest { @Test fun testBroadcastTransaction() { - val descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) - val wallet = Wallet(descriptor, null, persistenceFilePath, Network.TESTNET) - val esploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") + val descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.SIGNET) + val wallet = Wallet(descriptor, null, persistenceFilePath, Network.SIGNET) + val esploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) @@ -62,7 +65,7 @@ class LiveWalletTest { "Wallet balance must be greater than 0! Please send funds to ${wallet.revealNextAddress(KeychainKind.EXTERNAL).address} and try again." } - val recipient: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.TESTNET) + val recipient: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) val psbt: Psbt = TxBuilder() .addRecipient(recipient.scriptPubkey(), 4200uL) 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 3104896e..f3711368 100644 --- a/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt +++ b/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveTxBuilderTest.kt @@ -5,6 +5,9 @@ import kotlin.test.AfterTest import kotlin.test.Test import kotlin.test.assertTrue +private const val SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +private const val TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + class LiveTxBuilderTest { private val persistenceFilePath = run { val currentDirectory = System.getProperty("user.dir") @@ -23,8 +26,7 @@ class LiveTxBuilderTest { fun testTxBuilder() { val descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) val wallet = Wallet(descriptor, null, persistenceFilePath, Network.SIGNET) - // val esploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") - val esploraClient = EsploraClient("http://signet.bitcoindevkit.net") + val esploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) @@ -49,8 +51,7 @@ class LiveTxBuilderTest { val externalDescriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) val changeDescriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/1/*)", Network.TESTNET) val wallet = Wallet(externalDescriptor, changeDescriptor, persistenceFilePath, Network.SIGNET) - // val esploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") - val esploraClient = EsploraClient("http://signet.bitcoindevkit.net") + val esploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) 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 d5afff7e..bbaa386e 100644 --- a/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveWalletTest.kt +++ b/bdk-jvm/lib/src/test/kotlin/org/bitcoindevkit/LiveWalletTest.kt @@ -5,6 +5,9 @@ import kotlin.test.AfterTest import kotlin.test.Test import kotlin.test.assertTrue +private const val SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +private const val TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + class LiveWalletTest { private val persistenceFilePath = run { val currentDirectory = System.getProperty("user.dir") @@ -21,11 +24,9 @@ class LiveWalletTest { @Test fun testSyncedBalance() { - val descriptor: Descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) - val wallet: Wallet = Wallet(descriptor, null, persistenceFilePath, Network.TESTNET) - val esploraClient: EsploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") - // val esploraClient: EsploraClient = EsploraClient("https://mempool.space/testnet/api") - // val esploraClient = EsploraClient("https://blockstream.info/testnet/api") + val descriptor: Descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.SIGNET) + val wallet: Wallet = Wallet(descriptor, null, persistenceFilePath, Network.SIGNET) + val esploraClient: EsploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) @@ -46,9 +47,9 @@ class LiveWalletTest { @Test fun testBroadcastTransaction() { - val descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.TESTNET) - val wallet: Wallet = Wallet(descriptor, null, persistenceFilePath, Network.TESTNET) - val esploraClient = EsploraClient("https://esplora.testnet.kuutamo.cloud/") + val descriptor = Descriptor("wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", Network.SIGNET) + val wallet: Wallet = Wallet(descriptor, null, persistenceFilePath, Network.SIGNET) + val esploraClient = EsploraClient(SIGNET_ESPLORA_URL) val fullScanRequest: FullScanRequest = wallet.startFullScan() val update = esploraClient.fullScan(fullScanRequest, 10uL, 1uL) wallet.applyUpdate(update) @@ -60,7 +61,7 @@ class LiveWalletTest { "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.TESTNET) + val recipient: Address = Address("tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", Network.SIGNET) val psbt: Psbt = TxBuilder() .addRecipient(recipient.scriptPubkey(), 4200uL) diff --git a/bdk-python/tests/test_live_tx_builder.py b/bdk-python/tests/test_live_tx_builder.py index 78b130db..c7075174 100644 --- a/bdk-python/tests/test_live_tx_builder.py +++ b/bdk-python/tests/test_live_tx_builder.py @@ -2,6 +2,9 @@ import unittest import os +SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + class LiveTxBuilderTest(unittest.TestCase): def tearDown(self) -> None: @@ -11,15 +14,15 @@ def tearDown(self) -> None: def test_tx_builder(self): descriptor: bdk.Descriptor = bdk.Descriptor( "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)", - bdk.Network.TESTNET + bdk.Network.SIGNET ) wallet: bdk.Wallet = bdk.Wallet( descriptor, None, "./bdk_persistence.db", - bdk.Network.TESTNET + bdk.Network.SIGNET ) - esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = "https://esplora.testnet.kuutamo.cloud/") + esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = SIGNET_ESPLORA_URL) full_scan_request: bdk.FullScanRequest = wallet.start_full_scan() update = esplora_client.full_scan( full_scan_request=full_scan_request, @@ -33,7 +36,7 @@ def test_tx_builder(self): recipient = bdk.Address( address="tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", - network=bdk.Network.TESTNET + network=bdk.Network.SIGNET ) psbt = bdk.TxBuilder().add_recipient(script=recipient.script_pubkey(), amount=4200).fee_rate(fee_rate=bdk.FeeRate.from_sat_per_vb(2)).finish(wallet) @@ -43,19 +46,19 @@ def test_tx_builder(self): def complex_tx_builder(self): descriptor: bdk.Descriptor = bdk.Descriptor( "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)", - bdk.Network.TESTNET + bdk.Network.SIGNET ) change_descriptor: bdk.Descriptor = bdk.Descriptor( "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/1/*)", - bdk.Network.TESTNET + bdk.Network.SIGNET ) wallet: bdk.Wallet = bdk.Wallet( descriptor, change_descriptor, "./bdk_persistence.db", - bdk.Network.TESTNET + bdk.Network.SIGNET ) - esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = "https://esplora.testnet.kuutamo.cloud/") + esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = SIGNET_ESPLORA_URL) full_scan_request: bdk.FullScanRequest = wallet.start_full_scan() update = esplora_client.full_scan( full_scan_request=full_scan_request, @@ -69,11 +72,11 @@ def complex_tx_builder(self): recipient1 = bdk.Address( address="tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", - network=bdk.Network.TESTNET + network=bdk.Network.SIGNET ) recipient2 = bdk.Address( address="tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", - network=bdk.Network.TESTNET + network=bdk.Network.SIGNET ) all_recipients = list( bdk.ScriptAmount(recipient1.script_pubkey, 4200), diff --git a/bdk-python/tests/test_live_wallet.py b/bdk-python/tests/test_live_wallet.py index 0fdafdbd..00015954 100644 --- a/bdk-python/tests/test_live_wallet.py +++ b/bdk-python/tests/test_live_wallet.py @@ -2,6 +2,9 @@ import unittest import os +SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + class LiveWalletTest(unittest.TestCase): def tearDown(self) -> None: @@ -11,15 +14,15 @@ def tearDown(self) -> None: def test_synced_balance(self): descriptor: bdk.Descriptor = bdk.Descriptor( "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", - bdk.Network.TESTNET + bdk.Network.SIGNET ) wallet: bdk.Wallet = bdk.Wallet( descriptor, None, "./bdk_persistence.db", - bdk.Network.TESTNET + bdk.Network.SIGNET ) - esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = "https://esplora.testnet.kuutamo.cloud/") + esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = SIGNET_ESPLORA_URL) full_scan_request: bdk.FullScanRequest = wallet.start_full_scan() update = esplora_client.full_scan( full_scan_request=full_scan_request, @@ -43,15 +46,15 @@ def test_synced_balance(self): def test_broadcast_transaction(self): descriptor: bdk.Descriptor = bdk.Descriptor( "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", - bdk.Network.TESTNET + bdk.Network.SIGNET ) wallet: bdk.Wallet = bdk.Wallet( descriptor, None, "./bdk_persistence.db", - bdk.Network.TESTNET + bdk.Network.SIGNET ) - esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = "https://esplora.testnet.kuutamo.cloud/") + esplora_client: bdk.EsploraClient = bdk.EsploraClient(url = SIGNET_ESPLORA_URL) full_scan_request: bdk.FullScanRequest = wallet.start_full_scan() update = esplora_client.full_scan( full_scan_request=full_scan_request, @@ -65,7 +68,7 @@ def test_broadcast_transaction(self): recipient = bdk.Address( address="tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", - network=bdk.Network.TESTNET + network=bdk.Network.SIGNET ) psbt: bdk.Psbt = bdk.TxBuilder().add_recipient(script=recipient.script_pubkey(), amount=4200).fee_rate(fee_rate=bdk.FeeRate.from_sat_per_vb(2)).finish(wallet) diff --git a/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift b/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift index ef9dc6dd..a514049b 100644 --- a/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift +++ b/bdk-swift/Tests/BitcoinDevKitTests/LiveTxBuilderTests.swift @@ -1,6 +1,9 @@ import XCTest @testable import BitcoinDevKit +let SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +let TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + final class LiveTxBuilderTests: XCTestCase { var dbFilePath: URL! @@ -26,15 +29,15 @@ final class LiveTxBuilderTests: XCTestCase { func testTxBuilder() throws { let descriptor = try Descriptor( descriptor: "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", - network: Network.testnet + network: Network.signet ) let wallet = try Wallet( descriptor: descriptor, changeDescriptor: nil, persistenceBackendPath: dbFilePath.path, - network: .testnet + network: .signet ) - let esploraClient = EsploraClient(url: "https://esplora.testnet.kuutamo.cloud/") + let esploraClient = EsploraClient(url: SIGNET_ESPLORA_URL) let fullScanRequest: FullScanRequest = wallet.startFullScan() let update = try esploraClient.fullScan( fullScanRequest: fullScanRequest, @@ -46,7 +49,7 @@ final class LiveTxBuilderTests: XCTestCase { XCTAssertGreaterThan(wallet.getBalance().total, UInt64(0), "Wallet must have positive balance, please add funds") - let recipient: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .testnet) + let recipient: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .signet) let psbt: Psbt = try TxBuilder() .addRecipient(script: recipient.scriptPubkey(), amount: 4200) .feeRate(feeRate: FeeRate.fromSatPerVb(satPerVb: 2)) @@ -59,19 +62,19 @@ final class LiveTxBuilderTests: XCTestCase { func testComplexTxBuilder() throws { let descriptor = try Descriptor( descriptor: "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", - network: Network.testnet + network: Network.signet ) let changeDescriptor = try Descriptor( descriptor: "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/1/*)", - network: Network.testnet + network: Network.signet ) let wallet = try Wallet( descriptor: descriptor, changeDescriptor: changeDescriptor, persistenceBackendPath: dbFilePath.path, - network: .testnet + network: .signet ) - let esploraClient = EsploraClient(url: "https://esplora.testnet.kuutamo.cloud/") + let esploraClient = EsploraClient(url: SIGNET_ESPLORA_URL) let fullScanRequest: FullScanRequest = wallet.startFullScan() let update = try esploraClient.fullScan( fullScanRequest: fullScanRequest, @@ -83,8 +86,8 @@ final class LiveTxBuilderTests: XCTestCase { XCTAssertGreaterThan(wallet.getBalance().total, UInt64(0), "Wallet must have positive balance, please add funds") - let recipient1: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .testnet) - let recipient2: Address = try Address(address: "tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", network: .testnet) + let recipient1: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .signet) + let recipient2: Address = try Address(address: "tb1qw2c3lxufxqe2x9s4rdzh65tpf4d7fssjgh8nv6", network: .signet) let allRecipients: [ScriptAmount] = [ ScriptAmount(script: recipient1.scriptPubkey(), amount: 4200), ScriptAmount(script: recipient2.scriptPubkey(), amount: 4200) diff --git a/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift b/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift index 24a797b6..d908d3f5 100644 --- a/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift +++ b/bdk-swift/Tests/BitcoinDevKitTests/LiveWalletTests.swift @@ -1,6 +1,9 @@ import XCTest @testable import BitcoinDevKit +let SIGNET_ESPLORA_URL = "http://signet.bitcoindevkit.net" +let TESTNET_ESPLORA_URL = "https://esplora.testnet.kuutamo.cloud" + final class LiveWalletTests: XCTestCase { var dbFilePath: URL! @@ -26,15 +29,15 @@ final class LiveWalletTests: XCTestCase { func testSyncedBalance() throws { let descriptor = try Descriptor( descriptor: "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", - network: Network.testnet + network: Network.signet ) let wallet = try Wallet( descriptor: descriptor, changeDescriptor: nil, persistenceBackendPath: dbFilePath.path, - network: .testnet + network: .signet ) - let esploraClient = EsploraClient(url: "https://esplora.testnet.kuutamo.cloud/") + let esploraClient = EsploraClient(url: SIGNET_ESPLORA_URL) let fullScanRequest: FullScanRequest = wallet.startFullScan() let update = try esploraClient.fullScan( fullScanRequest: fullScanRequest, @@ -59,15 +62,15 @@ final class LiveWalletTests: XCTestCase { func testBroadcastTransaction() throws { let descriptor = try Descriptor( descriptor: "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/0/*)", - network: Network.testnet + network: Network.signet ) let wallet = try Wallet( descriptor: descriptor, changeDescriptor: nil, persistenceBackendPath: dbFilePath.path, - network: .testnet + network: .signet ) - let esploraClient = EsploraClient(url: "https://esplora.testnet.kuutamo.cloud/") + let esploraClient = EsploraClient(url: SIGNET_ESPLORA_URL) let fullScanRequest: FullScanRequest = wallet.startFullScan() let update = try esploraClient.fullScan( fullScanRequest: fullScanRequest, @@ -81,7 +84,7 @@ final class LiveWalletTests: XCTestCase { print("Balance: \(wallet.getBalance().total)") - let recipient: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .testnet) + let recipient: Address = try Address(address: "tb1qrnfslnrve9uncz9pzpvf83k3ukz22ljgees989", network: .signet) let psbt: Psbt = try TxBuilder() .addRecipient(script: recipient.scriptPubkey(), amount: 4200)