diff --git a/iOS Example/Sources/Adapters/BaseAdapter.swift b/iOS Example/Sources/Adapters/BaseAdapter.swift index 476fcbc5..fe3afd02 100644 --- a/iOS Example/Sources/Adapters/BaseAdapter.swift +++ b/iOS Example/Sources/Adapters/BaseAdapter.swift @@ -137,11 +137,23 @@ extension BaseAdapter { func send(to address: String, memo: String? = nil, amount: Decimal, sortType: TransactionDataSortType, unspentOutputs: [UnspentOutputInfo]? = nil, pluginData: [UInt8: IPluginData] = [:]) throws { let satoshiAmount = convertToSatoshi(value: amount) - _ = try abstractKit.send(to: address, memo: memo, value: satoshiAmount, feeRate: feeRate, sortType: sortType, rbfEnabled: false, unspentOutputs: unspentOutputs, pluginData: pluginData) + let params = SendParameters(address: address, + value: satoshiAmount, + feeRate: feeRate, + sortType: sortType, + rbfEnabled: false, + memo: memo, + unspentOutputs: unspentOutputs, + pluginData: pluginData) + _ = try abstractKit.send(params: params) } func availableBalance(for address: String?, memo: String? = nil, unspentOutputs: [UnspentOutputInfo]? = nil, pluginData: [UInt8: IPluginData] = [:]) -> Decimal { - let amount = (try? abstractKit.maxSpendableValue(toAddress: address, memo: memo, feeRate: feeRate, unspentOutputs: unspentOutputs, pluginData: pluginData)) ?? 0 + let amount = (try? abstractKit.maxSpendableValue(params: .init(address: address, + feeRate: feeRate, + memo: memo, + unspentOutputs: unspentOutputs, + pluginData: pluginData))) ?? .zero return Decimal(amount) / coinRate } @@ -154,13 +166,14 @@ extension BaseAdapter { } func minSpendableAmount(for address: String?) throws -> Decimal { - try Decimal(abstractKit.minSpendableValue(toAddress: address)) / coinRate + let amount = Decimal(try abstractKit.minSpendableValue(params: .init(address: address))) + return amount / coinRate } func fee(for value: Decimal, memo: String?, address: String?, pluginData: [UInt8: IPluginData] = [:]) -> Decimal { do { let amount = convertToSatoshi(value: value) - let sendInfo = try abstractKit.sendInfo(for: amount, memo: memo, feeRate: feeRate, unspentOutputs: nil) + let sendInfo = try abstractKit.sendInfo(params: .init(value: amount, feeRate: feeRate, memo: memo, unspentOutputs: nil)) return Decimal(sendInfo.fee) / coinRate } catch { return 0 diff --git a/iOS Example/Sources/Adapters/BitcoinAdapter.swift b/iOS Example/Sources/Adapters/BitcoinAdapter.swift index 0703bd04..29a11ccf 100644 --- a/iOS Example/Sources/Adapters/BitcoinAdapter.swift +++ b/iOS Example/Sources/Adapters/BitcoinAdapter.swift @@ -13,7 +13,13 @@ class BitcoinAdapter: BaseAdapter { fatalError("Cant create BitcoinSeed") } - bitcoinKit = try! Kit(seed: seed, purpose: purpose, walletId: "walletId", syncMode: syncMode, networkType: networkType, confirmationsThreshold: 1, logger: logger.scoped(with: "BitcoinKit")) + bitcoinKit = try! Kit(seed: seed, + purpose: purpose, + walletId: "walletId", + syncMode: syncMode, + networkType: networkType, + confirmationsThreshold: 1, + logger: logger.scoped(with: "BitcoinKit")) super.init(name: "Bitcoin", coinCode: "BTC", abstractKit: bitcoinKit) bitcoinKit.delegate = self diff --git a/iOS Example/Sources/Core/Manager.swift b/iOS Example/Sources/Core/Manager.swift index 836a8d7a..09e8f028 100644 --- a/iOS Example/Sources/Core/Manager.swift +++ b/iOS Example/Sources/Core/Manager.swift @@ -43,11 +43,19 @@ class Manager { let words = restoreData.components(separatedBy: .whitespacesAndNewlines) if words.count > 1 { - adapter = BitcoinAdapter(words: words, purpose: configuration.purpose, testMode: configuration.testNet, syncMode: syncMode, logger: logger) + adapter = BitcoinAdapter(words: words, + purpose: configuration.purpose, + testMode: configuration.testNet, + syncMode: syncMode, + logger: logger) } else { do { _ = try HDExtendedKey(extendedKey: restoreData) - adapter = BitcoinAdapter(extendedKey: restoreData, purpose: configuration.purpose, testMode: configuration.testNet, syncMode: syncMode, logger: logger) + adapter = BitcoinAdapter(extendedKey: restoreData, + purpose: configuration.purpose, + testMode: configuration.testNet, + syncMode: syncMode, + logger: logger) } catch { adapter = nil }