Supporting fiat currencies
You can get the full details of supported fiat currencies, such as symbols and localized names:
Rust
let supported_fiat_currencies = sdk.list_fiat_currencies().await?;
Swift
let supportedFiatCurrencies = try? sdk.listFiatCurrencies()
Kotlin
try {
val fiatCurrencyList = sdk.listFiatCurrencies()
} catch (e: Exception) {
// handle error
}
React Native
const fiatCurrencies = await listFiatCurrencies()
Dart
List<FiatCurrency> fiatCurrencyList = await breezSDKLiquid.instance!.listFiatCurrencies();
Python
try:
supported_fiat_currencies = sdk.list_fiat_currencies()
except Exception as error:
print(error)
raise
Go
if fiatCurrencies, err := sdk.ListFiatCurrencies(); err == nil {
log.Printf("%#v", fiatCurrencies)
}
C#
try
{
var fiatCurrencies = sdk.ListFiatCurrencies();
}
catch (Exception)
{
// Handle error
}
To get the current BTC rate in the various supported fiat currencies:
Rust
let fiat_rates = sdk.fetch_fiat_rates().await?;
Swift
let fiatRates = try? sdk.fetchFiatRates()
Kotlin
try {
val fiatRatesMap = sdk.fetchFiatRates()
} catch (e: Exception) {
// handle error
}
React Native
const fiatRates = await fetchFiatRates()
Dart
final List<Rate> rates = await breezSDKLiquid.instance!.fetchFiatRates();
final fiatRatesMap = rates.fold<Map<String, Rate>>({}, (map, rate) {
map[rate.coin] = rate;
return map;
});
// print your desired rate
print(fiatRatesMap["USD"]?.value);
Python
try:
fiat_rates = sdk.fetch_fiat_rates()
except Exception as error:
print(error)
raise
Go
if fiatRates, err := sdk.FetchFiatRates(); err == nil {
log.Printf("%#v", fiatRates)
}
C#
try
{
var fiatRates = sdk.FetchFiatRates();
}
catch (Exception)
{
// Handle error
}