Skip to content

Commit

Permalink
Fix missing BTC in conversion coins list
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Aug 29, 2023
1 parent 0899b70 commit 16443d2
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import StorageKit
import MarketKit

class BalanceConversionManager {
private let blockchainTypes: [BlockchainType] = [.bitcoin, .ethereum, .binanceSmartChain]
private let tokenQueries = [
TokenQuery(blockchainType: .bitcoin, tokenType: .derived(derivation: .bip84)),
TokenQuery(blockchainType: .ethereum, tokenType: .native),
TokenQuery(blockchainType: .binanceSmartChain, tokenType: .native)
]
private let keyBlockchainUid = "conversion-blockchain-uid"

private let marketKit: MarketKit.Kit
Expand All @@ -25,10 +29,9 @@ class BalanceConversionManager {
self.marketKit = marketKit

do {
let queries = blockchainTypes.map { TokenQuery(blockchainType: $0, tokenType: .native) }
let tokens = try marketKit.tokens(queries: queries)
conversionTokens = blockchainTypes.compactMap { blockchainType in
tokens.first { $0.blockchainType == blockchainType }
let tokens = try marketKit.tokens(queries: tokenQueries)
conversionTokens = tokenQueries.compactMap { tokenQuery in
tokens.first { $0.tokenQuery == tokenQuery }
}
} catch {
conversionTokens = []
Expand Down

0 comments on commit 16443d2

Please sign in to comment.