diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinAdapter.swift index 0f57656e29..7f1dc7bbcc 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinAdapter.swift @@ -27,7 +27,7 @@ class BitcoinAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .hdExtendedKey(key): @@ -41,7 +41,7 @@ class BitcoinAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .btcAddress(address, _, tokenType): @@ -55,7 +55,7 @@ class BitcoinAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) default: diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinBaseAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinBaseAdapter.swift index e761311841..67d145dcf4 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinBaseAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinBaseAdapter.swift @@ -7,7 +7,8 @@ import MarketKit import RxSwift class BitcoinBaseAdapter { - static let confirmationsThreshold = 3 + static let confirmationsThreshold = 1 // Number of confirmations for coins in transaction to be available for spending + static let txStatusConfirmationsThreshold = 3 // Number of confirmations for transaction status displayed private let abstractKit: AbstractKit var coinRate: Decimal { 100_000_000 } // pow(10, 8) @@ -86,7 +87,7 @@ class BitcoinBaseAdapter { transactionHash: transaction.transactionHash, transactionIndex: transaction.transactionIndex, blockHeight: transaction.blockHeight, - confirmationsThreshold: Self.confirmationsThreshold, + confirmationsThreshold: Self.txStatusConfirmationsThreshold, date: Date(timeIntervalSince1970: Double(transaction.timestamp)), fee: transaction.fee.map { Decimal($0) / coinRate }, failed: transaction.status == .invalid, @@ -105,7 +106,7 @@ class BitcoinBaseAdapter { transactionHash: transaction.transactionHash, transactionIndex: transaction.transactionIndex, blockHeight: transaction.blockHeight, - confirmationsThreshold: Self.confirmationsThreshold, + confirmationsThreshold: Self.txStatusConfirmationsThreshold, date: Date(timeIntervalSince1970: Double(transaction.timestamp)), fee: transaction.fee.map { Decimal($0) / coinRate }, failed: transaction.status == .invalid, @@ -126,7 +127,7 @@ class BitcoinBaseAdapter { transactionHash: transaction.transactionHash, transactionIndex: transaction.transactionIndex, blockHeight: transaction.blockHeight, - confirmationsThreshold: Self.confirmationsThreshold, + confirmationsThreshold: Self.txStatusConfirmationsThreshold, date: Date(timeIntervalSince1970: Double(transaction.timestamp)), fee: transaction.fee.map { Decimal($0) / coinRate }, failed: transaction.status == .invalid, diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinCashAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinCashAdapter.swift index 21c6a8ee29..91d1164b3e 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinCashAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/BitcoinCashAdapter.swift @@ -32,7 +32,7 @@ class BitcoinCashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .hdExtendedKey(key): @@ -41,7 +41,7 @@ class BitcoinCashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .btcAddress(address, _, _): @@ -50,7 +50,7 @@ class BitcoinCashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: nil ) default: diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/DashAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/DashAdapter.swift index 62fb0c0d13..71a9b563d1 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/DashAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/DashAdapter.swift @@ -26,7 +26,7 @@ class DashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .hdExtendedKey(key): @@ -35,7 +35,7 @@ class DashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .btcAddress(address, _, _): @@ -44,7 +44,7 @@ class DashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) default: diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ECashAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ECashAdapter.swift index ecae432306..9ff92df856 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ECashAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/ECashAdapter.swift @@ -7,7 +7,6 @@ import RxSwift class ECashAdapter: BitcoinBaseAdapter { private static let networkType: ECashKit.Kit.NetworkType = .mainNet - private static let eCashConfirmationsThreshold = 1 override var coinRate: Decimal { 100 } // pow(10,2) private let eCashKit: ECashKit.Kit @@ -26,7 +25,7 @@ class ECashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: Self.eCashConfirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .hdExtendedKey(key): @@ -35,7 +34,7 @@ class ECashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: Self.eCashConfirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .btcAddress(address, _, _): @@ -44,7 +43,7 @@ class ECashAdapter: BitcoinBaseAdapter { walletId: wallet.account.id, syncMode: syncMode, networkType: Self.networkType, - confirmationsThreshold: Self.eCashConfirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) default: diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/LitecoinAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/LitecoinAdapter.swift index a988061f0d..ad3e31009f 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/LitecoinAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/LitecoinAdapter.swift @@ -43,7 +43,7 @@ class LitecoinAdapter: BitcoinBaseAdapter { syncMode: syncMode, hasher: hasher, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .hdExtendedKey(key): @@ -58,7 +58,7 @@ class LitecoinAdapter: BitcoinBaseAdapter { syncMode: syncMode, hasher: hasher, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) case let .btcAddress(address, _, tokenType): @@ -73,7 +73,7 @@ class LitecoinAdapter: BitcoinBaseAdapter { syncMode: syncMode, hasher: hasher, networkType: Self.networkType, - confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold, + confirmationsThreshold: Self.confirmationsThreshold, logger: logger ) default: