Skip to content

Commit

Permalink
Use new endpoint for pricing
Browse files Browse the repository at this point in the history
  • Loading branch information
vikmeup committed Aug 7, 2018
1 parent 5668e6a commit 86cabc6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Trust/Core/Network/TrustNetwork.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class TrustNetwork: NetworkProtocol {
self.wallet = wallet
}

private func getTickerFrom(rawTicker: CoinTicker) -> CoinTicker? {
private func getTickerFrom(_ rawTicker: CoinTicker) -> CoinTicker? {
guard let contract = EthereumAddress(string: rawTicker.contract) else { return .none }
return CoinTicker(
price: rawTicker.price,
Expand Down Expand Up @@ -85,10 +85,8 @@ final class TrustNetwork: NetworkProtocol {
switch result {
case .success(let response):
do {
let rawTickers = try response.map([CoinTicker].self, atKeyPath: "response", using: JSONDecoder())
let tickers = rawTickers.compactMap { rawTicker in
return self.getTickerFrom(rawTicker: rawTicker)
}
let rawTickers = try response.map(ArrayResponse<CoinTicker>.self).docs
let tickers = rawTickers.compactMap { self.getTickerFrom($0) }
seal.fulfill(tickers)
} catch {
seal.reject(error)
Expand Down

0 comments on commit 86cabc6

Please sign in to comment.