Skip to content

Commit

Permalink
Merge pull request #499 from Adamant-im/develop
Browse files Browse the repository at this point in the history
Release 3.7.0
  • Loading branch information
StanislavDevIOS authored Jul 15, 2024
2 parents 3040128 + 3bfaa58 commit f6d0b76
Show file tree
Hide file tree
Showing 86 changed files with 1,112 additions and 767 deletions.
148 changes: 82 additions & 66 deletions Adamant.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Adamant/App/DI/AppAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,22 @@ struct AppAssembly: Assembly {
}.inObjectScope(.container)

// MARK: LskNodeApiService
container.register(LskNodeApiService.self) { r in
LskNodeApiService(api: .init(
container.register(KlyNodeApiService.self) { r in
KlyNodeApiService(api: .init(
service: .init(),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .lskNode
nodeGroup: .klyNode
))
}.inObjectScope(.container)

// MARK: LskServiceApiService
container.register(LskServiceApiService.self) { r in
LskServiceApiService(api: .init(
// MARK: KlyServiceApiService
container.register(KlyServiceApiService.self) { r in
KlyServiceApiService(api: .init(
service: .init(),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .lskService
nodeGroup: .klyService
))
}.inObjectScope(.container)

Expand Down Expand Up @@ -231,7 +231,7 @@ struct AppAssembly: Assembly {
}.inObjectScope(.container)

// MARK: LanguageStorageProtocol
container.register(LanguageStorageProtocol.self) { r in
container.register(LanguageStorageProtocol.self) { _ in
LanguageStorageService()
}.inObjectScope(.container)

Expand Down Expand Up @@ -333,7 +333,7 @@ struct AppAssembly: Assembly {
AdmWalletService(),
BtcWalletService(),
EthWalletService(),
LskWalletService(),
KlyWalletService(),
DogeWalletService(),
DashWalletService()
]
Expand Down
40 changes: 20 additions & 20 deletions Adamant/Helpers/NodeGroup+Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public extension NodeGroup {
return BtcWalletService.healthCheckParameters.onScreenUpdateInterval
case .eth:
return EthWalletService.healthCheckParameters.onScreenUpdateInterval
case .lskNode:
return LskWalletService.healthCheckParameters.onScreenUpdateInterval
case .lskService:
return LskWalletService.healthCheckParameters.onScreenServiceUpdateInterval
case .klyNode:
return KlyWalletService.healthCheckParameters.onScreenUpdateInterval
case .klyService:
return KlyWalletService.healthCheckParameters.onScreenServiceUpdateInterval
case .doge:
return DogeWalletService.healthCheckParameters.onScreenUpdateInterval
case .dash:
Expand All @@ -36,10 +36,10 @@ public extension NodeGroup {
return BtcWalletService.healthCheckParameters.crucialUpdateInterval
case .eth:
return EthWalletService.healthCheckParameters.crucialUpdateInterval
case .lskNode:
return LskWalletService.healthCheckParameters.crucialUpdateInterval
case .lskService:
return LskWalletService.healthCheckParameters.crucialServiceUpdateInterval
case .klyNode:
return KlyWalletService.healthCheckParameters.crucialUpdateInterval
case .klyService:
return KlyWalletService.healthCheckParameters.crucialServiceUpdateInterval
case .doge:
return DogeWalletService.healthCheckParameters.crucialUpdateInterval
case .dash:
Expand All @@ -55,10 +55,10 @@ public extension NodeGroup {
return BtcWalletService.healthCheckParameters.threshold
case .eth:
return EthWalletService.healthCheckParameters.threshold
case .lskNode:
return LskWalletService.healthCheckParameters.threshold
case .lskService:
return LskWalletService.healthCheckParameters.threshold
case .klyNode:
return KlyWalletService.healthCheckParameters.threshold
case .klyService:
return KlyWalletService.healthCheckParameters.threshold
case .doge:
return DogeWalletService.healthCheckParameters.threshold
case .dash:
Expand All @@ -74,10 +74,10 @@ public extension NodeGroup {
return BtcWalletService.healthCheckParameters.normalUpdateInterval
case .eth:
return EthWalletService.healthCheckParameters.normalUpdateInterval
case .lskNode:
return LskWalletService.healthCheckParameters.normalUpdateInterval
case .lskService:
return LskWalletService.healthCheckParameters.normalServiceUpdateInterval
case .klyNode:
return KlyWalletService.healthCheckParameters.normalUpdateInterval
case .klyService:
return KlyWalletService.healthCheckParameters.normalServiceUpdateInterval
case .doge:
return DogeWalletService.healthCheckParameters.normalUpdateInterval
case .dash:
Expand All @@ -94,10 +94,10 @@ public extension NodeGroup {
minNodeVersion = BtcWalletService.minNodeVersion
case .eth:
minNodeVersion = EthWalletService.minNodeVersion
case .lskNode:
minNodeVersion = LskWalletService.minNodeVersion
case .lskService:
minNodeVersion = LskWalletService.minNodeVersion
case .klyNode:
minNodeVersion = KlyWalletService.minNodeVersion
case .klyService:
minNodeVersion = KlyWalletService.minNodeVersion
case .doge:
minNodeVersion = DogeWalletService.minNodeVersion
case .dash:
Expand Down
10 changes: 5 additions & 5 deletions Adamant/Models/NodeWithGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ extension NodeGroup {
return BtcWalletService.tokenNetworkSymbol
case .eth:
return EthWalletService.tokenNetworkSymbol
case .lskNode:
return LskWalletService.tokenNetworkSymbol
case .lskService:
return LskWalletService.tokenNetworkSymbol
case .klyNode:
return KlyWalletService.tokenNetworkSymbol
case .klyService:
return KlyWalletService.tokenNetworkSymbol
+ " " + .adamant.coinsNodesList.serviceNode
case .doge:
return DogeWalletService.tokenNetworkSymbol
Expand All @@ -36,7 +36,7 @@ extension NodeGroup {

var includeVersionTitle: Bool {
switch self {
case .btc, .lskNode, .lskService, .doge, .adm:
case .btc, .klyNode, .klyService, .doge, .adm:
return true
case .eth, .dash:
return false
Expand Down
5 changes: 3 additions & 2 deletions Adamant/Modules/Chat/ViewModel/ChatMessageFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ private extension ChatMessageFactory {
: transaction.senderAddress

let coreService = walletServiceCompose.getWallet(by: transfer.type)?.core
let defaultIcon: UIImage = .asset(named: "no-token") ?? .init()

return .transaction(.init(value: .init(
id: id,
Expand All @@ -263,9 +264,9 @@ private extension ChatMessageFactory {
title: isFromCurrentSender
? .adamant.chat.transactionSent
: .adamant.chat.transactionReceived,
icon: coreService?.tokenLogo ?? .init(),
icon: coreService?.tokenLogo ?? defaultIcon,
amount: AdamantBalanceFormat.full.format(transfer.amount),
currency: coreService?.tokenSymbol ?? "",
currency: coreService?.tokenSymbol ?? .adamant.transfer.unknownToken,
date: transaction.sentDate?.humanizedDateTime(withWeekday: false) ?? "",
comment: transfer.comments,
backgroundColor: backgroundColor,
Expand Down
4 changes: 2 additions & 2 deletions Adamant/Modules/CoinsNodesList/CoinsNodesListFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ private struct CoinsNodesListAssembly: Assembly {
apiServices: .init(
btc: $0.resolve(BtcApiService.self)!,
eth: $0.resolve(EthApiService.self)!,
lskNode: $0.resolve(LskNodeApiService.self)!,
lskService: $0.resolve(LskServiceApiService.self)!,
klyNode: $0.resolve(KlyNodeApiService.self)!,
klyService: $0.resolve(KlyServiceApiService.self)!,
doge: $0.resolve(DogeApiService.self)!,
dash: $0.resolve(DashApiService.self)!,
adm: $0.resolve(ApiService.self)!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ extension CoinsNodesListViewModel {
struct ApiServices {
let btc: WalletApiService
let eth: WalletApiService
let lskNode: WalletApiService
let lskService: WalletApiService
let klyNode: WalletApiService
let klyService: WalletApiService
let doge: WalletApiService
let dash: WalletApiService
let adm: WalletApiService
Expand All @@ -27,10 +27,10 @@ extension CoinsNodesListViewModel.ApiServices {
return btc
case .eth:
return eth
case .lskNode:
return lskNode
case .lskService:
return lskService
case .klyNode:
return klyNode
case .klyService:
return klyService
case .doge:
return doge
case .dash:
Expand Down
2 changes: 1 addition & 1 deletion Adamant/Modules/ScreensFactory/AdamantScreensFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct AdamantScreensFactory: ScreensFactory {
chatSelectTextFactory = .init()

walletFactoryCompose = AdamantWalletFactoryCompose(
lskWalletFactory: .init(assembler: assembler),
klyWalletFactory: .init(assembler: assembler),
dogeWalletFactory: .init(assembler: assembler),
dashWalletFactory: .init(assembler: assembler),
btcWalletFactory: .init(assembler: assembler),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ Node(url: URL(string: "http://184.94.215.92:45555")!),
Node(url: URL(string: "https://node1.adamant.business")!, altUrl: URL(string: "http://194.233.75.29:45555")),
Node(url: URL(string: "https://node2.blockchain2fa.io")!),
Node(url: URL(string: "https://phecda.adm.im")!, altUrl: URL(string: "http://46.250.234.248:36666")),
Node(url: URL(string: "https://tegmine.adm.im")!, altUrl: URL(string: "http://5.104.87.219:36666")),
Node(url: URL(string: "https://tegmine.adm.im")!),
Node(url: URL(string: "https://tauri.adm.im")!, altUrl: URL(string: "http://154.26.159.245:36666")),
Node(url: URL(string: "https://dschubba.adm.im")!, altUrl: URL(string: "http://85.239.234.17:36666")),
Node(url: URL(string: "https://dschubba.adm.im")!),
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ final class BtcTransferViewController: TransferViewControllerBase {
let transaction = try await service.createTransaction(
recipient: recipient,
amount: amount,
fee: transactionFee
fee: transactionFee,
comment: nil
)

if await !doesNotContainSendingTx() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extension BtcWalletService {
static var nodes: [Node] {
[
Node(url: URL(string: "https://btcnode1.adamant.im")!, altUrl: URL(string: "http://176.9.38.204:44099")),
Node(url: URL(string: "https://btcnode2.adamant.im")!, altUrl: URL(string: "http://176.9.32.126:44099")),
Node(url: URL(string: "https://btcnode3.adamant.im")!, altUrl: URL(string: "http://195.201.242.108:44099")),
]
}

Expand Down
7 changes: 6 additions & 1 deletion Adamant/Modules/Wallets/Bitcoin/BtcWalletService+Send.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ extension BtcWalletService: WalletServiceTwoStepSend {
typealias T = BitcoinKit.Transaction

// MARK: Create & Send
func createTransaction(recipient: String, amount: Decimal, fee: Decimal) async throws -> BitcoinKit.Transaction {
func createTransaction(
recipient: String,
amount: Decimal,
fee: Decimal,
comment: String?
) async throws -> BitcoinKit.Transaction {
// MARK: 1. Prepare
guard let wallet = self.btcWallet else {
throw WalletServiceError.notLogged
Expand Down
4 changes: 2 additions & 2 deletions Adamant/Modules/Wallets/DI/AdamantWalletFactoryCompose.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct AdamantWalletFactoryCompose: WalletFactoryCompose {
private let factories: [any WalletFactory]

init(
lskWalletFactory: LskWalletFactory,
klyWalletFactory: KlyWalletFactory,
dogeWalletFactory: DogeWalletFactory,
dashWalletFactory: DashWalletFactory,
btcWalletFactory: BtcWalletFactory,
Expand All @@ -21,7 +21,7 @@ struct AdamantWalletFactoryCompose: WalletFactoryCompose {
admWalletFactory: AdmWalletFactory
) {
factories = [
lskWalletFactory,
klyWalletFactory,
dogeWalletFactory,
dashWalletFactory,
btcWalletFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ final class DashTransferViewController: TransferViewControllerBase {
let transaction = try await service.createTransaction(
recipient: recipient,
amount: amount,
fee: transactionFee
fee: transactionFee,
comment: nil
)

if await !doesNotContainSendingTx() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extension DashWalletService {
}

var defaultOrdinalLevel: Int? {
80
70
}

static var minNodeVersion: String? {
Expand Down
9 changes: 6 additions & 3 deletions Adamant/Modules/Wallets/Dash/DashWalletService+Send.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ extension DashWalletService: WalletServiceTwoStepSend {
return try await createTransaction(
recipient: recipient,
amount: amount,
fee: transactionFee
fee: transactionFee,
comment: nil
)
}

Expand All @@ -34,14 +35,16 @@ extension DashWalletService: WalletServiceTwoStepSend {
return try await createTransaction(
recipient: recipient,
amount: amount,
fee: transactionFee
fee: transactionFee,
comment: nil
)
}

func createTransaction(
recipient: String,
amount: Decimal,
fee: Decimal
fee: Decimal,
comment: String?
) async throws -> BitcoinKit.Transaction {
// MARK: 1. Prepare
guard let wallet = self.dashWallet else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ final class DogeTransferViewController: TransferViewControllerBase {
let transaction = try await service.createTransaction(
recipient: recipient,
amount: amount,
fee: transactionFee
fee: transactionFee,
comment: nil
)

if await !doesNotContainSendingTx() {
Expand Down
3 changes: 2 additions & 1 deletion Adamant/Modules/Wallets/Doge/DogeWalletService+Send.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ extension DogeWalletService: WalletServiceTwoStepSend {
func createTransaction(
recipient: String,
amount: Decimal,
fee: Decimal
fee: Decimal,
comment: String?
) async throws -> BitcoinKit.Transaction {
// Prepare
guard let wallet = self.dogeWallet else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ final class ERC20TransferViewController: TransferViewControllerBase {
let transaction = try await service.createTransaction(
recipient: recipient,
amount: amount,
fee: transactionFee
fee: transactionFee,
comment: nil
)

if await !doesNotContainSendingTx(
Expand Down
3 changes: 2 additions & 1 deletion Adamant/Modules/Wallets/ERC20/ERC20WalletService+Send.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ extension ERC20WalletService: WalletServiceTwoStepSend {
func createTransaction(
recipient: String,
amount: Decimal,
fee: Decimal
fee: Decimal,
comment: String?
) async throws -> CodableTransaction {
guard let ethWallet = ethWallet else {
throw WalletServiceError.notLogged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ final class EthTransferViewController: TransferViewControllerBase {
let transaction = try await service.createTransaction(
recipient: recipient,
amount: amount,
fee: transactionFee
fee: transactionFee,
comment: nil
)

if await !doesNotContainSendingTx(
Expand Down
3 changes: 2 additions & 1 deletion Adamant/Modules/Wallets/Ethereum/EthWalletService+Send.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ extension EthWalletService: WalletServiceTwoStepSend {
func createTransaction(
recipient: String,
amount: Decimal,
fee: Decimal
fee: Decimal,
comment: String?
) async throws -> CodableTransaction {
try await ethApiService.requestWeb3 { [weak self] web3 in
guard let self = self else { throw WalletServiceError.internalError(.unknownError) }
Expand Down
Loading

0 comments on commit f6d0b76

Please sign in to comment.