Skip to content

Commit ed9aae2

Browse files
Merge pull request #1165 from cypherstack/bug-fixes
Bug fixes
2 parents 9604f13 + f3898cd commit ed9aae2

File tree

16 files changed

+934
-924
lines changed

16 files changed

+934
-924
lines changed

lib/models/isar/exchange_cache/currency.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import 'package:isar/isar.dart';
1313
import '../../../app_config.dart';
1414
import '../../../services/exchange/change_now/change_now_exchange.dart';
1515
import '../../../services/exchange/exchange.dart';
16-
import '../../../services/exchange/majestic_bank/majestic_bank_exchange.dart';
1716
import '../../../services/exchange/nanswap/nanswap_exchange.dart';
1817
import '../../../services/exchange/trocador/trocador_exchange.dart';
1918
import 'pair.dart';
@@ -72,6 +71,11 @@ class Currency {
7271
@ignore
7372
String? _fuzzyCache;
7473
String getFuzzyNet() {
74+
// hack for legacy support
75+
if (exchangeName == "Majestic Bank") {
76+
return ticker.toLowerCase();
77+
}
78+
7579
return _fuzzyCache ??= switch (Exchange.fromName(
7680
exchangeName,
7781
).runtimeType) {
@@ -82,8 +86,7 @@ class Currency {
8286
// case const (SimpleSwapExchange):
8387

8488
// currently a hardcoded of coins so we can just
85-
const (MajesticBankExchange) => ticker.toLowerCase(),
86-
89+
// const (MajesticBankExchange) => ticker.toLowerCase(),
8790
const (TrocadorExchange) =>
8891
(network == "Mainnet" ? ticker.toLowerCase() : network),
8992

lib/pages/exchange_view/exchange_form.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import '../../services/exchange/change_now/change_now_exchange.dart';
3030
import '../../services/exchange/exchange.dart';
3131
import '../../services/exchange/exchange_data_loading_service.dart';
3232
import '../../services/exchange/exchange_response.dart';
33-
import '../../services/exchange/majestic_bank/majestic_bank_exchange.dart';
3433
import '../../services/exchange/nanswap/nanswap_exchange.dart';
3534
import '../../services/exchange/trocador/trocador_exchange.dart';
3635
import '../../themes/stack_colors.dart';
@@ -80,7 +79,6 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
8079
return Exchange.exchangesWithTorSupport;
8180
} else {
8281
return [
83-
MajesticBankExchange.instance,
8482
ChangeNowExchange.instance,
8583
TrocadorExchange.instance,
8684
NanswapExchange.instance,

lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import '../../../models/exchange/aggregate_currency.dart';
1515
import '../../../providers/providers.dart';
1616
import '../../../services/exchange/change_now/change_now_exchange.dart';
1717
import '../../../services/exchange/exchange.dart';
18-
import '../../../services/exchange/majestic_bank/majestic_bank_exchange.dart';
1918
import '../../../services/exchange/nanswap/nanswap_exchange.dart';
2019
import '../../../services/exchange/trocador/trocador_exchange.dart';
2120
import '../../../themes/stack_colors.dart';
@@ -82,11 +81,6 @@ class _ExchangeProviderOptionsState
8281
sendCurrency: sendCurrency,
8382
receiveCurrency: receivingCurrency,
8483
);
85-
final showMajesticBank = exchangeSupported(
86-
exchangeName: MajesticBankExchange.exchangeName,
87-
sendCurrency: sendCurrency,
88-
receiveCurrency: receivingCurrency,
89-
);
9084
final showTrocador = exchangeSupported(
9185
exchangeName: TrocadorExchange.exchangeName,
9286
sendCurrency: sendCurrency,
@@ -112,20 +106,7 @@ class _ExchangeProviderOptionsState
112106
fixedRate: widget.fixedRate,
113107
reversed: widget.reversed,
114108
),
115-
if (showChangeNow && showMajesticBank)
116-
isDesktop
117-
? Container(
118-
height: 1,
119-
color: Theme.of(context).extension<StackColors>()!.background,
120-
)
121-
: const SizedBox(height: 16),
122-
if (showMajesticBank)
123-
ExchangeOption(
124-
exchange: MajesticBankExchange.instance,
125-
fixedRate: widget.fixedRate,
126-
reversed: widget.reversed,
127-
),
128-
if ((showChangeNow || showMajesticBank) && showTrocador)
109+
if (showChangeNow && showTrocador)
129110
isDesktop
130111
? Container(
131112
height: 1,
@@ -138,8 +119,7 @@ class _ExchangeProviderOptionsState
138119
reversed: widget.reversed,
139120
exchange: TrocadorExchange.instance,
140121
),
141-
if ((showChangeNow || showMajesticBank || showTrocador) &&
142-
showNanswap)
122+
if ((showChangeNow || showTrocador) && showNanswap)
143123
isDesktop
144124
? Container(
145125
height: 1,

lib/pages/exchange_view/trade_details_view.dart

Lines changed: 59 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import '../../providers/providers.dart';
2929
import '../../route_generator.dart';
3030
import '../../services/exchange/change_now/change_now_exchange.dart';
3131
import '../../services/exchange/exchange.dart';
32-
import '../../services/exchange/majestic_bank/majestic_bank_exchange.dart';
3332
import '../../services/exchange/nanswap/nanswap_exchange.dart';
3433
import '../../services/exchange/simpleswap/simpleswap_exchange.dart';
3534
import '../../services/exchange/trocador/trocador_exchange.dart';
@@ -101,7 +100,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
101100
.trades
102101
.firstWhere((e) => e.tradeId == tradeId);
103102

104-
if (mounted) {
103+
if (mounted && trade.exchangeName != "Majestic Bank") {
105104
final exchange = Exchange.fromName(trade.exchangeName);
106105
final response = await exchange.updateTrade(trade);
107106

@@ -435,36 +434,6 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
435434
mainAxisAlignment: MainAxisAlignment.spaceBetween,
436435
children: [
437436
Text("Status", style: STextStyles.itemSubtitle(context)),
438-
if (trade.exchangeName ==
439-
MajesticBankExchange.exchangeName &&
440-
trade.status == "Completed")
441-
Row(
442-
mainAxisSize: MainAxisSize.min,
443-
children: [
444-
GestureDetector(
445-
onTap: () {
446-
showDialog<void>(
447-
context: context,
448-
builder:
449-
(context) => const StackOkDialog(
450-
title: "Trade Info",
451-
message:
452-
"Majestic Bank does not store order data indefinitely",
453-
),
454-
);
455-
},
456-
child: SvgPicture.asset(
457-
Assets.svg.circleInfo,
458-
height: 20,
459-
width: 20,
460-
color:
461-
Theme.of(
462-
context,
463-
).extension<StackColors>()!.infoItemIcons,
464-
),
465-
),
466-
],
467-
),
468437
],
469438
),
470439
const SizedBox(height: 4),
@@ -1202,68 +1171,66 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
12021171
],
12031172
),
12041173
),
1205-
isDesktop ? const _Divider() : const SizedBox(height: 12),
1206-
RoundedWhiteContainer(
1207-
padding:
1208-
isDesktop
1209-
? const EdgeInsets.all(16)
1210-
: const EdgeInsets.all(12),
1211-
child: Column(
1212-
crossAxisAlignment: CrossAxisAlignment.start,
1213-
children: [
1214-
Text("Tracking", style: STextStyles.itemSubtitle(context)),
1215-
const SizedBox(height: 4),
1216-
Builder(
1217-
builder: (context) {
1218-
late final String url;
1219-
switch (trade.exchangeName) {
1220-
case ChangeNowExchange.exchangeName:
1221-
url =
1222-
"https://changenow.io/exchange/txs/${trade.tradeId}";
1223-
break;
1224-
case SimpleSwapExchange.exchangeName:
1225-
url =
1226-
"https://simpleswap.io/exchange?id=${trade.tradeId}";
1227-
break;
1228-
case MajesticBankExchange.exchangeName:
1229-
url =
1230-
"https://majesticbank.sc/track?trx=${trade.tradeId}";
1231-
break;
1232-
case NanswapExchange.exchangeName:
1233-
url =
1234-
"https://nanswap.com/transaction/${trade.tradeId}";
1235-
break;
1236-
1237-
default:
1238-
if (trade.exchangeName.startsWith(
1239-
TrocadorExchange.exchangeName,
1240-
)) {
1174+
if (trade.exchangeName != "Majestic Bank")
1175+
isDesktop ? const _Divider() : const SizedBox(height: 12),
1176+
if (trade.exchangeName != "Majestic Bank")
1177+
RoundedWhiteContainer(
1178+
padding:
1179+
isDesktop
1180+
? const EdgeInsets.all(16)
1181+
: const EdgeInsets.all(12),
1182+
child: Column(
1183+
crossAxisAlignment: CrossAxisAlignment.start,
1184+
children: [
1185+
Text("Tracking", style: STextStyles.itemSubtitle(context)),
1186+
const SizedBox(height: 4),
1187+
Builder(
1188+
builder: (context) {
1189+
late final String url;
1190+
switch (trade.exchangeName) {
1191+
case ChangeNowExchange.exchangeName:
12411192
url =
1242-
"https://trocador.app/en/checkout/${trade.tradeId}";
1243-
}
1244-
}
1245-
return ConditionalParent(
1246-
condition: isDesktop,
1247-
builder:
1248-
(child) => MouseRegion(
1249-
cursor: SystemMouseCursors.click,
1250-
child: child,
1251-
),
1252-
child: GestureDetector(
1253-
onTap: () {
1254-
launchUrl(
1255-
Uri.parse(url),
1256-
mode: LaunchMode.externalApplication,
1257-
);
1258-
},
1259-
child: Text(url, style: STextStyles.link2(context)),
1260-
),
1261-
);
1262-
},
1263-
),
1264-
],
1193+
"https://changenow.io/exchange/txs/${trade.tradeId}";
1194+
break;
1195+
case SimpleSwapExchange.exchangeName:
1196+
url =
1197+
"https://simpleswap.io/exchange?id=${trade.tradeId}";
1198+
break;
1199+
case NanswapExchange.exchangeName:
1200+
url =
1201+
"https://nanswap.com/transaction/${trade.tradeId}";
1202+
break;
1203+
1204+
default:
1205+
if (trade.exchangeName.startsWith(
1206+
TrocadorExchange.exchangeName,
1207+
)) {
1208+
url =
1209+
"https://trocador.app/en/checkout/${trade.tradeId}";
1210+
}
1211+
}
1212+
return ConditionalParent(
1213+
condition: isDesktop,
1214+
builder:
1215+
(child) => MouseRegion(
1216+
cursor: SystemMouseCursors.click,
1217+
child: child,
1218+
),
1219+
child: GestureDetector(
1220+
onTap: () {
1221+
launchUrl(
1222+
Uri.parse(url),
1223+
mode: LaunchMode.externalApplication,
1224+
);
1225+
},
1226+
child: Text(url, style: STextStyles.link2(context)),
1227+
),
1228+
);
1229+
},
1230+
),
1231+
],
1232+
),
12651233
),
1266-
),
12671234
if (!isDesktop) const SizedBox(height: 12),
12681235
if (!isDesktop && showSendFromStackButton)
12691236
SecondaryButton(

lib/pages/send_view/send_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ class _SendViewState extends ConsumerState<SendView> {
814814
break;
815815
}
816816
} else if (wallet is MwebInterface &&
817+
ref.read(pWalletInfo(walletId)).isMwebEnabled &&
817818
ref.read(publicPrivateBalanceStateProvider) == BalanceType.private) {
818819
txDataFuture = wallet.prepareSendMweb(
819820
txData: TxData(

lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
409409
break;
410410
}
411411
} else if (wallet is MwebInterface &&
412+
ref.read(pWalletInfo(walletId)).isMwebEnabled &&
412413
ref.read(publicPrivateBalanceStateProvider) == BalanceType.private) {
413414
txDataFuture = wallet.prepareSendMweb(
414415
txData: TxData(

lib/services/exchange/exchange.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ abstract class Exchange {
3030
return ChangeNowExchange.instance;
3131
case SimpleSwapExchange.exchangeName:
3232
return SimpleSwapExchange.instance;
33-
case MajesticBankExchange.exchangeName:
34-
return MajesticBankExchange.instance;
33+
// case MajesticBankExchange.exchangeName:
34+
// return MajesticBankExchange.instance;
3535
case TrocadorExchange.exchangeName:
3636
return TrocadorExchange.instance;
3737
case NanswapExchange.exchangeName:
@@ -106,7 +106,7 @@ abstract class Exchange {
106106
///
107107
/// Add to this list when adding a new exchange which supports Tor.
108108
static List<Exchange> get exchangesWithTorSupport => [
109-
MajesticBankExchange.instance,
109+
// MajesticBankExchange.instance,
110110
TrocadorExchange.instance,
111111
NanswapExchange.instance, // Maybe??
112112
];

lib/services/exchange/exchange_data_loading_service.dart

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import '../../utilities/logger.dart';
2323
import '../../utilities/prefs.dart';
2424
import '../../utilities/stack_file_system.dart';
2525
import 'change_now/change_now_exchange.dart';
26-
import 'majestic_bank/majestic_bank_exchange.dart';
2726
import 'nanswap/nanswap_exchange.dart';
2827
import 'trocador/trocador_exchange.dart';
2928

@@ -194,7 +193,7 @@ class ExchangeDataLoadingService {
194193

195194
// Exchanges which support Tor just get treated normally.
196195
final futures = [
197-
loadMajesticBankCurrencies(),
196+
// loadMajesticBankCurrencies(),
198197
loadTrocadorCurrencies(),
199198
loadNanswapCurrencies(),
200199
];
@@ -359,28 +358,28 @@ class ExchangeDataLoadingService {
359358
// }
360359
// }
361360

362-
Future<void> loadMajesticBankCurrencies() async {
363-
if (_isar == null) {
364-
await initDB();
365-
}
366-
final exchange = MajesticBankExchange.instance;
367-
final responseCurrencies = await exchange.getAllCurrencies(false);
368-
369-
if (responseCurrencies.value != null) {
370-
await isar.writeTxn(() async {
371-
final idsToDelete =
372-
await isar.currencies
373-
.where()
374-
.exchangeNameEqualTo(MajesticBankExchange.exchangeName)
375-
.idProperty()
376-
.findAll();
377-
await isar.currencies.deleteAll(idsToDelete);
378-
await isar.currencies.putAll(responseCurrencies.value!);
379-
});
380-
} else {
381-
Logging.instance.w("loadMajesticBankCurrencies: $responseCurrencies");
382-
}
383-
}
361+
// Future<void> loadMajesticBankCurrencies() async {
362+
// if (_isar == null) {
363+
// await initDB();
364+
// }
365+
// final exchange = MajesticBankExchange.instance;
366+
// final responseCurrencies = await exchange.getAllCurrencies(false);
367+
//
368+
// if (responseCurrencies.value != null) {
369+
// await isar.writeTxn(() async {
370+
// final idsToDelete =
371+
// await isar.currencies
372+
// .where()
373+
// .exchangeNameEqualTo(MajesticBankExchange.exchangeName)
374+
// .idProperty()
375+
// .findAll();
376+
// await isar.currencies.deleteAll(idsToDelete);
377+
// await isar.currencies.putAll(responseCurrencies.value!);
378+
// });
379+
// } else {
380+
// Logging.instance.w("loadMajesticBankCurrencies: $responseCurrencies");
381+
// }
382+
// }
384383

385384
Future<void> loadTrocadorCurrencies() async {
386385
if (_isar == null) {

0 commit comments

Comments
 (0)