mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Remove GetFiatCurrenciesAndRates snippet
This commit is contained in:
@@ -21,28 +21,3 @@ func getCurrentRates(sdk:BlockingBreezServices) -> [Rate]? {
|
||||
// ANCHOR_END: fetch-fiat-rates
|
||||
return fiatRates
|
||||
}
|
||||
|
||||
func getFiatCurrencyAndRates(sdk: BlockingBreezServices) -> [(FiatCurrency,Rate)]? {
|
||||
// ANCHOR: get-fiat-currencies-and-rates
|
||||
var ratesMap = [String:Rate]()
|
||||
if let supportedFiatCurrencies = try? sdk.listFiatCurrencies(), let fiatRates = try? sdk.fetchFiatRates() {
|
||||
for fiatRate in fiatRates {
|
||||
ratesMap[fiatRate.coin.lowercased()] = fiatRate
|
||||
}
|
||||
|
||||
let sorted = supportedFiatCurrencies.sorted(by: { f1, f2 in
|
||||
f1.id<f2.id
|
||||
})
|
||||
|
||||
var result = [(FiatCurrency,Rate)]()
|
||||
for currency in sorted {
|
||||
if let rate = ratesMap[currency.id.lowercased()] {
|
||||
result.append((currency, rate))
|
||||
}
|
||||
|
||||
}
|
||||
return result
|
||||
}
|
||||
// ANCHOR_END: get-fiat-currencies-and-rates
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user