From 60ee3459413ae0b030d48d1f20fa124a25940d02 Mon Sep 17 00:00:00 2001 From: Anton Stavnichiy Date: Fri, 22 Nov 2024 15:49:15 +0700 Subject: [PATCH] Use updated params for sending Bitcoin-based transactions --- .../Modules/SendNew/BitcoinSendHandler.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/BitcoinSendHandler.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/BitcoinSendHandler.swift index 05c7a0d16e..064926ac28 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/BitcoinSendHandler.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/BitcoinSendHandler.swift @@ -55,16 +55,20 @@ extension BitcoinSendHandler: ISendHandler { ) } - func send(data _: ISendData) async throws { - try adapter.send(params: params) + func send(data: ISendData) async throws { + guard let data = data as? SendData else { + throw SendError.invalidData + } + + try adapter.send(params: data.params) } } extension BitcoinSendHandler { class SendData: BaseSendBtcData, ISendData { private let token: Token - private let params: SendParameters private let transactionError: Error? + let params: SendParameters init(token: Token, params: SendParameters, transactionError: Error?, satoshiPerByte: Int?, feeData: BitcoinFeeData?) { self.token = token @@ -130,6 +134,12 @@ extension BitcoinSendHandler { } } +extension BitcoinSendHandler { + enum SendError: Error { + case invalidData + } +} + extension BitcoinSendHandler { static func instance(token: Token, params: SendParameters) -> BitcoinSendHandler? { guard let adapter = App.shared.adapterManager.adapter(for: token) as? BitcoinBaseAdapter else {