Skip to content

Commit

Permalink
Use updated params for sending Bitcoin-based transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
ant013 committed Nov 22, 2024
1 parent 9e44f30 commit 60ee345
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 60ee345

Please sign in to comment.