diff --git a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/CoreSendIntegrationTests.swift b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/CoreSendIntegrationTests.swift index 00ce6de6c4e..b6dfac2622f 100644 --- a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/CoreSendIntegrationTests.swift +++ b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/CoreSendIntegrationTests.swift @@ -32,9 +32,7 @@ final class CoreSendIntegrationTests: IntegrationTestCase { let recipientAddress = try receiver.getCoreWallet().nextReceiveAddress() let beforeTxids = try await readTxids() - _ = try sender.getCoreWallet().sendToAddresses( - recipients: [(address: recipientAddress, amountDuffs: amount)] - ) + _ = try sender.send(to: recipientAddress, amountDuffs: amount) guard let sendTxid = try await waitForNewTxid(notIn: beforeTxids) else { XCTFail("send PersistentTransaction row never appeared on iteration \(i)") return diff --git a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/PersisterRestartClassificationIntegrationTests.swift b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/PersisterRestartClassificationIntegrationTests.swift index b5d264bc16f..1db69679afc 100644 --- a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/PersisterRestartClassificationIntegrationTests.swift +++ b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/PersisterRestartClassificationIntegrationTests.swift @@ -19,10 +19,8 @@ final class PersisterRestartClassificationIntegrationTests: IntegrationTestCase try await alice.waitForSpendable(exactly: fundingDuffs, timeout: 90) let aliceSecondAddr = try alice.getCoreWallet().nextReceiveAddress() - let sendTxData = try alice.getCoreWallet().sendToAddresses( - recipients: [(address: aliceSecondAddr, amountDuffs: sendAmount)] - ) - let sendTxid = Self.txid(ofRawTx: sendTxData) + let sendTx = try alice.send(to: aliceSecondAddr, amountDuffs: sendAmount) + let sendTxid = Self.txid(ofRawTx: sendTx.data) try await waitForTxRow(sendTxid) // First sighting must already classify as Internal / -fee. diff --git a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/SpvRestartIntegrationTests.swift b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/SpvRestartIntegrationTests.swift index ed823c40681..17fdc23454c 100644 --- a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/SpvRestartIntegrationTests.swift +++ b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/SpvRestartIntegrationTests.swift @@ -64,9 +64,7 @@ final class SpvRestartIntegrationTests: IntegrationTestCase { let recipientAddress = try receiver.getCoreWallet().nextReceiveAddress() let beforeTxids = try await readTxids() - _ = try sender.getCoreWallet().sendToAddresses( - recipients: [(address: recipientAddress, amountDuffs: amount)] - ) + _ = try sender.send(to: recipientAddress, amountDuffs: amount) guard let sendTxid = try await waitForNewTxid(notIn: beforeTxids) else { XCTFail("send PersistentTransaction row never appeared") return diff --git a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift index 7c20954cb20..c31e55d3b40 100644 --- a/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift +++ b/packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift @@ -19,6 +19,20 @@ final class TestWalletWrapper { wallet } + /// Build + sign + broadcast a single-output payment from this wallet's + /// BIP-44 account 0 — the integration-test replacement for the removed + /// one-shot `ManagedCoreWallet.sendToAddresses`. Returns the built + /// `CoreTransaction` (its `.data` is the raw signed bytes). + @discardableResult + func send(to address: String, amountDuffs: UInt64) throws -> CoreTransaction { + let builder = try CoreTransactionBuilder(network: core.network()) + _ = try builder.addOutput(address: address, amountDuffs: amountDuffs) + try builder.setFunding(wallet: wallet, accountType: .bip44, accountIndex: 0) + let tx = try builder.buildSigned(wallet: wallet, accountType: .bip44, accountIndex: 0) + _ = try core.broadcastTransaction(tx) + return tx + } + func waitForSpendable(exactly duffs: UInt64, timeout: TimeInterval = 60) async throws { try await Wait.until( "wallet spendable == \(duffs) duffs",