mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
51a4954fcb
6 changed files with 816 additions and 805 deletions
|
@ -60,9 +60,15 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
Future<List<PaymentMethod>> getAvailablePaymentTypes(
|
||||
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 {
|
||||
final response =
|
||||
|
@ -75,7 +81,9 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
|
||||
.toList();
|
||||
} 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 [];
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
|
@ -839,7 +839,7 @@ Future<void> setup({
|
|||
if (wallet.type == WalletType.monero ||
|
||||
wallet.type == WalletType.wownero ||
|
||||
wallet.type == WalletType.haven) {
|
||||
return MoneroAccountListViewModel(wallet);
|
||||
return MoneroAccountListViewModel(wallet,getIt.get<SettingsStore>());
|
||||
}
|
||||
throw Exception(
|
||||
'Unexpected wallet type: ${wallet.type} for generate Monero AccountListViewModel');
|
||||
|
|
|
@ -307,9 +307,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
|
||||
if (state is TransactionCommitted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
if (!context.mounted) {
|
||||
return;
|
||||
}
|
||||
if (!mounted) return;
|
||||
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
|
@ -323,7 +321,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
actionButtonKey: ValueKey('send_page_sent_dialog_ok_button_key'),
|
||||
actionButton: () {
|
||||
Navigator.of(bottomSheetContext).pop();
|
||||
if (context.mounted) {
|
||||
if (mounted) {
|
||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
Routes.dashboard,
|
||||
(route) => false,
|
||||
|
|
|
@ -215,7 +215,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
|||
items: _getItems(),
|
||||
selectedAtIndex: isPolyseed
|
||||
? 1
|
||||
: seedTypeController.value.text.contains("14") && widget.type == WalletType.wownero
|
||||
: (seedTypeController.value.text.contains("14") && widget.type == WalletType.wownero) || isBip39
|
||||
? 2
|
||||
: 0,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
|
@ -325,9 +325,9 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
|||
'${language.replaceAll("POLYSEED_", "")} (Seed language)';
|
||||
|
||||
void _changeSeedType(MoneroSeedType item) {
|
||||
_setSeedType(item);
|
||||
_changeLanguage('English');
|
||||
widget.seedSettingsViewModel.setMoneroSeedType(item);
|
||||
_setSeedType(item);
|
||||
_changeLanguage('English', isPolyseed || isBip39);
|
||||
}
|
||||
|
||||
void _setSeedType(MoneroSeedType item) {
|
||||
|
|
|
@ -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:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
@ -12,7 +14,9 @@ class MoneroAccountListViewModel = MoneroAccountListViewModelBase
|
|||
with _$MoneroAccountListViewModel;
|
||||
|
||||
abstract class MoneroAccountListViewModelBase with Store {
|
||||
MoneroAccountListViewModelBase(this._wallet) : scrollOffsetFromTop = 0;
|
||||
MoneroAccountListViewModelBase(this._wallet,this.settingsStore) : scrollOffsetFromTop = 0;
|
||||
|
||||
final SettingsStore settingsStore;
|
||||
|
||||
@observable
|
||||
double scrollOffsetFromTop;
|
||||
|
@ -26,13 +30,14 @@ abstract class MoneroAccountListViewModelBase with Store {
|
|||
|
||||
@computed
|
||||
List<AccountListItem> get accounts {
|
||||
final hideBalance = settingsStore.balanceDisplayMode == BalanceDisplayMode.hiddenBalance;
|
||||
if (_wallet.type == WalletType.monero) {
|
||||
return monero
|
||||
!.getAccountList(_wallet)
|
||||
.accounts.map((acc) => AccountListItem(
|
||||
label: acc.label,
|
||||
id: acc.id,
|
||||
balance: acc.balance,
|
||||
balance: hideBalance ? '●●●●●●' : acc.balance,
|
||||
isSelected: acc.id == monero!.getCurrentAccount(_wallet).id))
|
||||
.toList();
|
||||
}
|
||||
|
@ -43,7 +48,7 @@ abstract class MoneroAccountListViewModelBase with Store {
|
|||
.accounts.map((acc) => AccountListItem(
|
||||
label: acc.label,
|
||||
id: acc.id,
|
||||
balance: acc.balance,
|
||||
balance: hideBalance ? '●●●●●●' : acc.balance,
|
||||
isSelected: acc.id == wownero!.getCurrentAccount(_wallet).id))
|
||||
.toList();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue