From 04752d86512447ca2de2735ccc90930e7a9df3e8 Mon Sep 17 00:00:00 2001 From: EA Date: Tue, 1 Oct 2024 15:57:05 +0600 Subject: [PATCH] Fix duplicate transactions --- .../Core/Adapters/Evm/EvmTransactionsAdapter.swift | 2 +- .../Core/Adapters/Tron/TronTransactionAdapter.swift | 2 +- .../SendEvm/Confirmation/SendEvmConfirmationModule.swift | 2 +- .../UnstoppableWallet/UserInterface/Extensions/Decimal.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift index 2073376177..0e4839a05e 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift @@ -97,7 +97,7 @@ extension EvmTransactionsAdapter: ITransactionsAdapter { } func transactionsSingle(from: TransactionRecord?, token: MarketKit.Token?, filter: TransactionTypeFilter, address: String?, limit: Int) -> Single<[TransactionRecord]> { - evmKit.transactionsSingle(tagQueries: [tagQuery(token: token, filter: filter, address: address?.lowercased())], fromHash: from.flatMap { Data(hex: $0.transactionHash) }, limit: limit) + evmKit.transactionsSingle(tagQueries: [tagQuery(token: token, filter: filter, address: address?.lowercased())], fromHash: from.flatMap { $0.transactionHash.hs.hexData }, limit: limit) .map { [weak self] transactions -> [TransactionRecord] in transactions.compactMap { self?.transactionConverter.transactionRecord(fromTransaction: $0) } } diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift index 065b58484b..689a8c96e7 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift @@ -100,7 +100,7 @@ extension TronTransactionsAdapter: ITransactionsAdapter { func transactionsSingle(from: TransactionRecord?, token: MarketKit.Token?, filter: TransactionTypeFilter, address: String?, limit: Int) -> Single<[TransactionRecord]> { let address = address.flatMap { try? TronKit.Address(address: $0) }?.hex - let transactions = tronKit.transactions(tagQueries: [tagQuery(token: token, filter: filter, address: address)], fromHash: from.flatMap { Data(hex: $0.transactionHash) }, limit: limit) + let transactions = tronKit.transactions(tagQueries: [tagQuery(token: token, filter: filter, address: address)], fromHash: from.flatMap { $0.transactionHash.hs.hexData }, limit: limit) return Single.just(transactions.compactMap { transactionConverter.transactionRecord(fromTransaction: $0) }) } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/Confirmation/SendEvmConfirmationModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/Confirmation/SendEvmConfirmationModule.swift index ab424ebc61..b581197a38 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/Confirmation/SendEvmConfirmationModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/Confirmation/SendEvmConfirmationModule.swift @@ -107,7 +107,7 @@ enum SendEvmConfirmationModule { } static func resendViewController(adapter: ITransactionsAdapter, type: ResendTransactionType, transactionHash: String) throws -> UIViewController { - guard let adapter = adapter as? EvmTransactionsAdapter, let fullTransaction = adapter.evmKit.transaction(hash: Data(hex: transactionHash.hs.stripHexPrefix())) else { + guard let adapter = adapter as? EvmTransactionsAdapter, let hash = transactionHash.hs.hexData, let fullTransaction = adapter.evmKit.transaction(hash: hash) else { throw CreateModuleError.wrongTransaction } diff --git a/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/Decimal.swift b/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/Decimal.swift index 44767eaefe..c803f5671a 100644 --- a/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/Decimal.swift +++ b/UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/Decimal.swift @@ -1,7 +1,7 @@ import BigInt import Foundation -private let max256ByteNumber = BigUInt(Data(hex: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")) +private let max256ByteNumber = BigUInt("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff".hs.hexData!) extension Decimal { init?(bigUInt: BigUInt, decimals: Int) {