diff --git a/assets/images/kaspa_icon.png b/assets/images/kaspa_icon.png new file mode 100644 index 000000000..5201174ef Binary files /dev/null and b/assets/images/kaspa_icon.png differ diff --git a/cw_core/lib/crypto_currency.dart b/cw_core/lib/crypto_currency.dart index 0f7f25d9b..162ffb1d2 100644 --- a/cw_core/lib/crypto_currency.dart +++ b/cw_core/lib/crypto_currency.dart @@ -95,6 +95,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen CryptoCurrency.banano, CryptoCurrency.usdtPoly, CryptoCurrency.usdcEPoly, + CryptoCurrency.kaspa, ]; static const havenCurrencies = [ @@ -206,6 +207,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen static const banano = CryptoCurrency(title: 'BAN', fullName: 'Banano', raw: 86, name: 'banano', iconPath: 'assets/images/nano_icon.png', decimals: 29); static const usdtPoly = CryptoCurrency(title: 'USDT', tag: 'POLY', fullName: 'Tether USD (PoS)', raw: 87, name: 'usdtpoly', iconPath: 'assets/images/usdt_icon.png', decimals: 6); static const usdcEPoly = CryptoCurrency(title: 'USDC.E', tag: 'POLY', fullName: 'USD Coin (PoS)', raw: 88, name: 'usdcepoly', iconPath: 'assets/images/usdc_icon.png', decimals: 6); + static const kaspa = CryptoCurrency(title: 'KAS', fullName: 'Kaspa', raw: 89, name: 'kaspa', iconPath: 'assets/images/kaspa_icon.png', decimals: 8); static final Map _rawCurrencyMap = diff --git a/lib/exchange/provider/changenow_exchange_provider.dart b/lib/exchange/provider/changenow_exchange_provider.dart index 300741a08..c4a96bc5b 100644 --- a/lib/exchange/provider/changenow_exchange_provider.dart +++ b/lib/exchange/provider/changenow_exchange_provider.dart @@ -265,6 +265,9 @@ class ChangeNowExchangeProvider extends ExchangeProvider { } String _normalizeCurrency(CryptoCurrency currency) { + if (currency.title == "USDC" && currency.tag == "POLY") { + throw "Only Bridged USDC (USDC.e) is allowed in ChangeNow"; + } switch (currency) { case CryptoCurrency.zec: return 'zec'; diff --git a/lib/src/screens/dashboard/pages/balance_page.dart b/lib/src/screens/dashboard/pages/balance_page.dart index 283d2171d..6ddd8f6e1 100644 --- a/lib/src/screens/dashboard/pages/balance_page.dart +++ b/lib/src/screens/dashboard/pages/balance_page.dart @@ -1,3 +1,5 @@ +import 'dart:math'; + import 'package:auto_size_text/auto_size_text.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/reactions/wallet_connect.dart'; @@ -14,6 +16,7 @@ import 'package:cake_wallet/utils/feature_flag.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart'; +import 'package:cw_core/crypto_currency.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -200,7 +203,7 @@ class CryptoBalanceWidget extends StatelessWidget { additionalFiatBalance: balance.fiatAdditionalBalance, frozenBalance: balance.frozenBalance, frozenFiatBalance: balance.fiatFrozenBalance, - currency: balance.formattedAssetTitle, + currency: balance.asset, hasAdditionalBalance: dashboardViewModel.balanceViewModel.hasAdditionalBalance, ); @@ -216,7 +219,7 @@ class CryptoBalanceWidget extends StatelessWidget { } class BalanceRowWidget extends StatelessWidget { - const BalanceRowWidget({ + BalanceRowWidget({ required this.availableBalanceLabel, required this.availableBalance, required this.availableFiatBalance, @@ -238,7 +241,7 @@ class BalanceRowWidget extends StatelessWidget { final String additionalFiatBalance; final String frozenBalance; final String frozenFiatBalance; - final String currency; + final CryptoCurrency currency; final bool hasAdditionalBalance; // void _showBalanceDescription(BuildContext context) { @@ -268,7 +271,7 @@ class BalanceRowWidget extends StatelessWidget { children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ GestureDetector( behavior: HitTestBehavior.opaque, @@ -325,13 +328,48 @@ class BalanceRowWidget extends StatelessWidget { ], ), ), - Text(currency, - style: TextStyle( - fontSize: 28, - fontFamily: 'Lato', - fontWeight: FontWeight.w800, - color: Theme.of(context).extension()!.assetTitleColor, - height: 1)), + SizedBox( + width: MediaQuery.of(context).size.width * 0.18, + child: Center( + child: Column( + children: [ + currency.iconPath != null + ? Container( + child: Image.asset( + currency.iconPath!, + height: 30.0, + width: 30.0, + ), + ) + : Container( + height: 30.0, + width: 30.0, + child: Center( + child: Text( + currency.title.substring(0, min(currency.title.length, 2)), + style: TextStyle(fontSize: 11), + ), + ), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.grey.shade400, + ), + ), + const SizedBox(height: 10), + Text( + currency.title, + style: TextStyle( + fontSize: 18, + fontFamily: 'Lato', + fontWeight: FontWeight.w800, + color: Theme.of(context).extension()!.assetTitleColor, + height: 1, + ), + ), + ], + ), + ), + ), ], ), if (frozenBalance.isNotEmpty) @@ -374,7 +412,9 @@ class BalanceRowWidget extends StatelessWidget { fontSize: 20, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.textColor, + color: Theme.of(context) + .extension()! + .balanceAmountColor, height: 1, ), maxLines: 1, @@ -388,7 +428,7 @@ class BalanceRowWidget extends StatelessWidget { fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.textColor, + color: Theme.of(context).extension()!.textColor, height: 1, ), ), diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index e72b0f0a8..7930c9c82 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -261,7 +261,7 @@ class ExchangeTradeState extends State { fee: S.of(popupContext).send_fee, feeValue: widget.exchangeTradeViewModel.sendViewModel .pendingTransaction!.feeFormatted, - rightButtonText: S.of(popupContext).ok, + rightButtonText: S.of(popupContext).send, leftButtonText: S.of(popupContext).cancel, actionRightButton: () async { Navigator.of(popupContext).pop(); diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index b20b94cba..3746118d8 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -423,7 +423,7 @@ class SendPage extends BasePage { feeValue: sendViewModel.pendingTransaction!.feeFormatted, feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmountFormatted, outputs: sendViewModel.outputs, - rightButtonText: S.of(_dialogContext).ok, + rightButtonText: S.of(_dialogContext).send, leftButtonText: S.of(_dialogContext).cancel, actionRightButton: () { Navigator.of(_dialogContext).pop();