fiat api fix, attempt icon fix, other review fixes

This commit is contained in:
Matthew Fosse 2024-03-04 23:07:10 -08:00
parent e32203945a
commit 7f7a941f45
6 changed files with 35 additions and 31 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -187,7 +187,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
static const scrt = CryptoCurrency(title: 'SCRT', fullName: 'Secret Network', raw: 59, name: 'scrt', iconPath: 'assets/images/scrt_icon.png', decimals: 6);
static const uni = CryptoCurrency(title: 'UNI', tag: 'ETH', fullName: 'Uniswap', raw: 60, name: 'uni', iconPath: 'assets/images/uni_icon.png', decimals: 18);
static const stx = CryptoCurrency(title: 'STX', fullName: 'Stacks', raw: 61, name: 'stx', iconPath: 'assets/images/stx_icon.png', decimals: 8);
static const btcln = CryptoCurrency(title: 'Sats', tag: 'LN', fullName: 'Bitcoin Lightning Network', raw: 62, name: 'btcln', iconPath: 'assets/images/lightning_logo.png', decimals: 8);
static const btcln = CryptoCurrency(title: 'sats', tag: 'LN', fullName: 'Bitcoin Lightning Network', raw: 62, name: 'btcln', iconPath: 'assets/images/lightning_logo.png', decimals: 8);
static const shib = CryptoCurrency(title: 'SHIB', tag: 'ETH', fullName: 'Shiba Inu', raw: 63, name: 'shib', iconPath: 'assets/images/shib_icon.png', decimals: 18);
static const aave = CryptoCurrency(title: 'AAVE', tag: 'ETH', fullName: 'Aave', raw: 64, name: 'aave', iconPath: 'assets/images/aave_icon.png', decimals: 18);
static const arb = CryptoCurrency(title: 'ARB', fullName: 'Arbitrum', raw: 65, name: 'arb', iconPath: 'assets/images/arb_icon.png', decimals: 18);
@ -217,7 +217,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
static const kaspa = CryptoCurrency(title: 'KAS', fullName: 'Kaspa', raw: 89, name: 'kas', iconPath: 'assets/images/kaspa_icon.png', decimals: 8);
static const digibyte = CryptoCurrency(title: 'DGB', fullName: 'DigiByte', raw: 90, name: 'dgb', iconPath: 'assets/images/digibyte.png', decimals: 8);
static const usdtSol = CryptoCurrency(title: 'USDT', tag: 'SOL', fullName: 'USDT Tether', raw: 90, name: 'usdtsol', iconPath: 'assets/images/usdt_icon.png', decimals: 6);
static const satoshis = CryptoCurrency(title: 'Sats', fullName: 'Satoshis', raw: 91, name: 'sats', iconPath: 'assets/images/lightning_logo.png', decimals: 0);
static const satoshis = CryptoCurrency(title: 'sats', fullName: 'Satoshis', raw: 91, name: 'sats', iconPath: 'assets/images/lightning_logo.png', decimals: 0);

View file

@ -31,35 +31,32 @@ Future<void> startFiatRateUpdate(
await updateHavenRate(fiatConversionStore);
}
Iterable<CryptoCurrency>? currencies;
if (appStore.wallet!.type == WalletType.ethereum) {
currencies =
ethereum!.getERC20Currencies(appStore.wallet!).where((element) => element.enabled);
Iterable<CryptoCurrency>? currencies = [];
switch (appStore.wallet!.type) {
case WalletType.ethereum:
currencies = ethereum!.getERC20Currencies(appStore.wallet!).where((element) => element.enabled);
break;
case WalletType.polygon:
currencies = polygon!.getERC20Currencies(appStore.wallet!).where((element) => element.enabled);
break;
case WalletType.solana:
currencies = solana!.getSPLTokenCurrencies(appStore.wallet!).where((element) => element.enabled);
break;
case WalletType.lightning:
currencies = [CryptoCurrency.btc];
break;
default:
currencies = [appStore.wallet!.currency];
break;
}
if (appStore.wallet!.type == WalletType.polygon) {
currencies =
polygon!.getERC20Currencies(appStore.wallet!).where((element) => element.enabled);
}
if (appStore.wallet!.type == WalletType.solana) {
currencies =
solana!.getSPLTokenCurrencies(appStore.wallet!).where((element) => element.enabled);
}
if (appStore.wallet!.type == WalletType.lightning) {
currencies = [CryptoCurrency.btc];
}
if (currencies != null) {
for (final currency in currencies) {
() async {
fiatConversionStore.prices[currency] = await FiatConversionService.fetchPrice(
crypto: currency,
fiat: settingsStore.fiatCurrency,
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly);
}.call();
}
for (final currency in currencies) {
() async {
fiatConversionStore.prices[currency] = await FiatConversionService.fetchPrice(
crypto: currency,
fiat: settingsStore.fiatCurrency,
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly);
}.call();
}
// keep btcln price in sync with btc (since the fiat api only returns btc and not btcln)

View file

@ -30,6 +30,7 @@ class DesktopWalletSelectionDropDown extends StatefulWidget {
class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionDropDown> {
final moneroIcon = Image.asset('assets/images/monero_logo.png', height: 24, width: 24);
final bitcoinIcon = Image.asset('assets/images/bitcoin.png', height: 24, width: 24);
final lightningIcon = Image.asset('assets/images/lightning_logo.png', height: 24, width: 24);
final litecoinIcon = Image.asset('assets/images/litecoin_icon.png', height: 24, width: 24);
final havenIcon = Image.asset('assets/images/haven_logo.png', height: 24, width: 24);
final ethereumIcon = Image.asset('assets/images/eth_icon.png', height: 24, width: 24);
@ -138,6 +139,8 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
switch (type) {
case WalletType.bitcoin:
return bitcoinIcon;
case WalletType.lightning:
return lightningIcon;
case WalletType.monero:
return moneroIcon;
case WalletType.litecoin:

View file

@ -27,7 +27,7 @@ class MenuWidgetState extends State<MenuWidget> {
this.fromBottomEdge = 25,
this.moneroIcon = Image.asset('assets/images/monero_menu.png'),
this.bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png'),
this.lightningIcon = Image.asset('assets/images/lightning_logo.png'),
this.lightningIcon = Image.asset('assets/images/lightning_menu.png'),
this.litecoinIcon = Image.asset('assets/images/litecoin_menu.png'),
this.havenIcon = Image.asset('assets/images/haven_menu.png'),
this.ethereumIcon = Image.asset('assets/images/eth_icon.png'),
@ -100,7 +100,7 @@ class MenuWidgetState extends State<MenuWidget> {
color: Theme.of(context).extension<CakeMenuTheme>()!.iconColor);
bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png',
color: Theme.of(context).extension<CakeMenuTheme>()!.iconColor);
lightningIcon = Image.asset('assets/images/lightning_logo.png',
lightningIcon = Image.asset('assets/images/lightning_menu.png',
color: Theme.of(context).extension<CakeMenuTheme>()!.iconColor);
return Row(

View file

@ -74,6 +74,10 @@ class TransactionListItem extends ActionListItem with Keyable {
price: price);
break;
case WalletType.bitcoin:
amount = calculateFiatAmountRaw(
cryptoAmount: bitcoin!.formatterBitcoinAmountToDouble(amount: transaction.amount),
price: price);
break;
case WalletType.lightning:
amount = calculateFiatAmountRaw(
cryptoAmount: lightning!.formatterLightningAmountToDouble(amount: transaction.amount),