Merge remote-tracking branch 'origin/main'

This commit is contained in:
OmarHatem 2025-05-09 15:01:27 +03:00
commit 51a4954fcb
6 changed files with 816 additions and 805 deletions

View file

@ -60,9 +60,15 @@ class OnRamperBuyProvider extends BuyProvider {
Future<List<PaymentMethod>> getAvailablePaymentTypes( Future<List<PaymentMethod>> getAvailablePaymentTypes(
String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async { String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async {
final params = {'type': isBuyAction ? 'buy' : 'sell'}; final normalizedCryptoCurrency =
cryptoCurrency.title + _getNormalizeNetwork(cryptoCurrency);
final url = Uri.https(_baseApiUrl, '$supported$paymentTypes/$fiatCurrency', params); final sourceCurrency = (isBuyAction ? fiatCurrency : normalizedCryptoCurrency).toLowerCase();
final destinationCurrency = (isBuyAction ? normalizedCryptoCurrency : fiatCurrency).toLowerCase();
final params = {'type': isBuyAction ? 'buy' : 'sell', 'destination' : destinationCurrency};
final url = Uri.https(_baseApiUrl, '$supported$paymentTypes/$sourceCurrency', params);
try { try {
final response = final response =
@ -75,7 +81,9 @@ class OnRamperBuyProvider extends BuyProvider {
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>)) .map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
.toList(); .toList();
} else { } else {
printV('Failed to fetch available payment types'); final responseBody =
jsonDecode(response.body) as Map<String, dynamic>;
printV('Failed to fetch available payment types: ${responseBody['message']}');
return []; return [];
} }
} catch (e) { } catch (e) {

View file

@ -839,7 +839,7 @@ Future<void> setup({
if (wallet.type == WalletType.monero || if (wallet.type == WalletType.monero ||
wallet.type == WalletType.wownero || wallet.type == WalletType.wownero ||
wallet.type == WalletType.haven) { wallet.type == WalletType.haven) {
return MoneroAccountListViewModel(wallet); return MoneroAccountListViewModel(wallet,getIt.get<SettingsStore>());
} }
throw Exception( throw Exception(
'Unexpected wallet type: ${wallet.type} for generate Monero AccountListViewModel'); 'Unexpected wallet type: ${wallet.type} for generate Monero AccountListViewModel');

View file

@ -307,9 +307,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
if (state is TransactionCommitted) { if (state is TransactionCommitted) {
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
if (!context.mounted) { if (!mounted) return;
return;
}
await showModalBottomSheet<void>( await showModalBottomSheet<void>(
context: context, context: context,
@ -323,7 +321,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
actionButtonKey: ValueKey('send_page_sent_dialog_ok_button_key'), actionButtonKey: ValueKey('send_page_sent_dialog_ok_button_key'),
actionButton: () { actionButton: () {
Navigator.of(bottomSheetContext).pop(); Navigator.of(bottomSheetContext).pop();
if (context.mounted) { if (mounted) {
Navigator.of(context).pushNamedAndRemoveUntil( Navigator.of(context).pushNamedAndRemoveUntil(
Routes.dashboard, Routes.dashboard,
(route) => false, (route) => false,

View file

@ -215,7 +215,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
items: _getItems(), items: _getItems(),
selectedAtIndex: isPolyseed selectedAtIndex: isPolyseed
? 1 ? 1
: seedTypeController.value.text.contains("14") && widget.type == WalletType.wownero : (seedTypeController.value.text.contains("14") && widget.type == WalletType.wownero) || isBip39
? 2 ? 2
: 0, : 0,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -325,9 +325,9 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
'${language.replaceAll("POLYSEED_", "")} (Seed language)'; '${language.replaceAll("POLYSEED_", "")} (Seed language)';
void _changeSeedType(MoneroSeedType item) { void _changeSeedType(MoneroSeedType item) {
_setSeedType(item);
_changeLanguage('English');
widget.seedSettingsViewModel.setMoneroSeedType(item); widget.seedSettingsViewModel.setMoneroSeedType(item);
_setSeedType(item);
_changeLanguage('English', isPolyseed || isBip39);
} }
void _setSeedType(MoneroSeedType item) { void _setSeedType(MoneroSeedType item) {

View file

@ -1,3 +1,5 @@
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/wownero/wownero.dart'; import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
@ -12,7 +14,9 @@ class MoneroAccountListViewModel = MoneroAccountListViewModelBase
with _$MoneroAccountListViewModel; with _$MoneroAccountListViewModel;
abstract class MoneroAccountListViewModelBase with Store { abstract class MoneroAccountListViewModelBase with Store {
MoneroAccountListViewModelBase(this._wallet) : scrollOffsetFromTop = 0; MoneroAccountListViewModelBase(this._wallet,this.settingsStore) : scrollOffsetFromTop = 0;
final SettingsStore settingsStore;
@observable @observable
double scrollOffsetFromTop; double scrollOffsetFromTop;
@ -26,13 +30,14 @@ abstract class MoneroAccountListViewModelBase with Store {
@computed @computed
List<AccountListItem> get accounts { List<AccountListItem> get accounts {
final hideBalance = settingsStore.balanceDisplayMode == BalanceDisplayMode.hiddenBalance;
if (_wallet.type == WalletType.monero) { if (_wallet.type == WalletType.monero) {
return monero return monero
!.getAccountList(_wallet) !.getAccountList(_wallet)
.accounts.map((acc) => AccountListItem( .accounts.map((acc) => AccountListItem(
label: acc.label, label: acc.label,
id: acc.id, id: acc.id,
balance: acc.balance, balance: hideBalance ? '●●●●●●' : acc.balance,
isSelected: acc.id == monero!.getCurrentAccount(_wallet).id)) isSelected: acc.id == monero!.getCurrentAccount(_wallet).id))
.toList(); .toList();
} }
@ -43,7 +48,7 @@ abstract class MoneroAccountListViewModelBase with Store {
.accounts.map((acc) => AccountListItem( .accounts.map((acc) => AccountListItem(
label: acc.label, label: acc.label,
id: acc.id, id: acc.id,
balance: acc.balance, balance: hideBalance ? '●●●●●●' : acc.balance,
isSelected: acc.id == wownero!.getCurrentAccount(_wallet).id)) isSelected: acc.id == wownero!.getCurrentAccount(_wallet).id))
.toList(); .toList();
} }

File diff suppressed because it is too large Load diff