mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 10:34:32 +00:00
Merge branch 'ui-testing' into speedup
This commit is contained in:
commit
fa39ef6aff
47 changed files with 1243 additions and 331 deletions
|
@ -589,9 +589,16 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
_loadChangeNowData();
|
||||
}
|
||||
|
||||
return const LockscreenView(
|
||||
String? startupWalletId;
|
||||
if (ref.read(prefsChangeNotifierProvider).gotoWalletOnStartup) {
|
||||
startupWalletId =
|
||||
ref.read(prefsChangeNotifierProvider).startupWalletId;
|
||||
}
|
||||
|
||||
return LockscreenView(
|
||||
isInitialAppLogin: true,
|
||||
routeOnSuccess: HomeView.routeName,
|
||||
routeOnSuccessArguments: startupWalletId,
|
||||
biometricsAuthenticationTitle: "Unlock Stack",
|
||||
biometricsLocalizedReason:
|
||||
"Unlock your stack wallet using biometrics",
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/providers/exchange/available_currencies_state_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/available_floating_rate_pairs_state_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/change_now_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/changenow_initial_load_status.dart';
|
||||
import 'package:stackwallet/providers/exchange/estimate_rate_exchange_form_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/fixed_rate_exchange_form_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/fixed_rate_market_pairs_provider.dart';
|
||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class ExchangeLoadingOverlayView extends ConsumerStatefulWidget {
|
||||
const ExchangeLoadingOverlayView({Key? key}) : super(key: key);
|
||||
const ExchangeLoadingOverlayView({
|
||||
Key? key,
|
||||
required this.unawaitedLoad,
|
||||
}) : super(key: key);
|
||||
|
||||
final VoidCallback unawaitedLoad;
|
||||
|
||||
@override
|
||||
ConsumerState<ExchangeLoadingOverlayView> createState() =>
|
||||
|
@ -28,103 +26,6 @@ class _ExchangeLoadingOverlayViewState
|
|||
|
||||
bool userReloaded = false;
|
||||
|
||||
Future<void> _loadFixedRateMarkets() async {
|
||||
if (ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state ==
|
||||
ChangeNowLoadStatus.loading) {
|
||||
// already in progress so just
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.loading;
|
||||
|
||||
final response3 =
|
||||
await ref.read(changeNowProvider).getAvailableFixedRateMarkets();
|
||||
if (response3.value != null) {
|
||||
ref.read(fixedRateMarketPairsStateProvider.state).state =
|
||||
response3.value!;
|
||||
|
||||
if (ref.read(fixedRateExchangeFormProvider).market == null) {
|
||||
final matchingMarkets =
|
||||
response3.value!.where((e) => e.to == "doge" && e.from == "btc");
|
||||
if (matchingMarkets.isNotEmpty) {
|
||||
await ref
|
||||
.read(fixedRateExchangeFormProvider)
|
||||
.updateMarket(matchingMarkets.first, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logging.instance.log(
|
||||
"Failed to load changeNOW fixed rate markets: ${response3.exception?.errorMessage}",
|
||||
level: LogLevel.Error);
|
||||
|
||||
ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.failed;
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.success;
|
||||
}
|
||||
|
||||
Future<void> _loadChangeNowStandardCurrencies() async {
|
||||
if (ref
|
||||
.read(changeNowEstimatedInitialLoadStatusStateProvider.state)
|
||||
.state ==
|
||||
ChangeNowLoadStatus.loading) {
|
||||
// already in progress so just
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.loading;
|
||||
|
||||
final response = await ref.read(changeNowProvider).getAvailableCurrencies();
|
||||
final response2 =
|
||||
await ref.read(changeNowProvider).getAvailableFloatingRatePairs();
|
||||
if (response.value != null) {
|
||||
ref.read(availableChangeNowCurrenciesStateProvider.state).state =
|
||||
response.value!;
|
||||
if (response2.value != null) {
|
||||
ref.read(availableFloatingRatePairsStateProvider.state).state =
|
||||
response2.value!;
|
||||
|
||||
if (response.value!.length > 1) {
|
||||
if (ref.read(estimatedRateExchangeFormProvider).from == null) {
|
||||
if (response.value!.where((e) => e.ticker == "btc").isNotEmpty) {
|
||||
await ref.read(estimatedRateExchangeFormProvider).updateFrom(
|
||||
response.value!.firstWhere((e) => e.ticker == "btc"), false);
|
||||
}
|
||||
}
|
||||
if (ref.read(estimatedRateExchangeFormProvider).to == null) {
|
||||
if (response.value!.where((e) => e.ticker == "doge").isNotEmpty) {
|
||||
await ref.read(estimatedRateExchangeFormProvider).updateTo(
|
||||
response.value!.firstWhere((e) => e.ticker == "doge"), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logging.instance.log(
|
||||
"Failed to load changeNOW available floating rate pairs: ${response2.exception?.errorMessage}",
|
||||
level: LogLevel.Error);
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.failed;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Logging.instance.log(
|
||||
"Failed to load changeNOW currencies: ${response.exception?.errorMessage}",
|
||||
level: LogLevel.Error);
|
||||
await Future<void>.delayed(const Duration(seconds: 3));
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.failed;
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.success;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_statusEst =
|
||||
|
@ -168,8 +69,10 @@ class _ExchangeLoadingOverlayViewState
|
|||
child: const CustomLoadingOverlay(
|
||||
message: "Loading ChangeNOW data", eventBus: null),
|
||||
),
|
||||
if (_statusEst == ChangeNowLoadStatus.failed ||
|
||||
_statusFixed == ChangeNowLoadStatus.failed)
|
||||
if ((_statusEst == ChangeNowLoadStatus.failed ||
|
||||
_statusFixed == ChangeNowLoadStatus.failed) &&
|
||||
_statusEst != ChangeNowLoadStatus.loading &&
|
||||
_statusFixed != ChangeNowLoadStatus.loading)
|
||||
Container(
|
||||
color: CFColors.stackAccent.withOpacity(0.7),
|
||||
child: Column(
|
||||
|
@ -186,13 +89,8 @@ class _ExchangeLoadingOverlayViewState
|
|||
.copyWith(color: CFColors.stackAccent),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_statusEst == ChangeNowLoadStatus.failed) {
|
||||
_loadChangeNowStandardCurrencies();
|
||||
}
|
||||
if (_statusFixed == ChangeNowLoadStatus.failed) {
|
||||
userReloaded = true;
|
||||
_loadFixedRateMarkets();
|
||||
}
|
||||
widget.unawaitedLoad();
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -29,7 +29,6 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||
import 'package:stackwallet/utilities/format.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||
|
@ -1272,55 +1271,55 @@ class _WalletInitiatedExchangeViewState
|
|||
.read(estimatedRateExchangeFormProvider)
|
||||
.fromAmountString);
|
||||
|
||||
if (ft.toLowerCase() ==
|
||||
coin.ticker.toLowerCase()) {
|
||||
bool shouldPop = false;
|
||||
bool wasPopped = false;
|
||||
unawaited(showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (shouldPop) {
|
||||
wasPopped = true;
|
||||
}
|
||||
return shouldPop;
|
||||
},
|
||||
child: const CustomLoadingOverlay(
|
||||
message: "Checking available balance",
|
||||
eventBus: null,
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
final availableBalance =
|
||||
await manager.availableBalance;
|
||||
|
||||
final feeObject = await manager.fees;
|
||||
|
||||
final fee = await manager.estimateFeeFor(
|
||||
Format.decimalAmountToSatoshis(
|
||||
sendAmount),
|
||||
feeObject.medium);
|
||||
|
||||
shouldPop = true;
|
||||
if (!wasPopped && mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
if (availableBalance <
|
||||
sendAmount +
|
||||
Format.satoshisToAmount(fee)) {
|
||||
unawaited(showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
title: "Insufficient balance",
|
||||
message:
|
||||
"Current ${coin.prettyName} wallet does not have enough ${coin.ticker} for this trade",
|
||||
),
|
||||
));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (ft.toLowerCase() ==
|
||||
// coin.ticker.toLowerCase()) {
|
||||
// bool shouldPop = false;
|
||||
// bool wasPopped = false;
|
||||
// unawaited(showDialog<void>(
|
||||
// context: context,
|
||||
// builder: (_) => WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// if (shouldPop) {
|
||||
// wasPopped = true;
|
||||
// }
|
||||
// return shouldPop;
|
||||
// },
|
||||
// child: const CustomLoadingOverlay(
|
||||
// message: "Checking available balance",
|
||||
// eventBus: null,
|
||||
// ),
|
||||
// ),
|
||||
// ));
|
||||
//
|
||||
// final availableBalance =
|
||||
// await manager.availableBalance;
|
||||
//
|
||||
// final feeObject = await manager.fees;
|
||||
//
|
||||
// final fee = await manager.estimateFeeFor(
|
||||
// Format.decimalAmountToSatoshis(
|
||||
// sendAmount),
|
||||
// feeObject.medium);
|
||||
//
|
||||
// shouldPop = true;
|
||||
// if (!wasPopped && mounted) {
|
||||
// Navigator.of(context).pop();
|
||||
// }
|
||||
//
|
||||
// if (availableBalance <
|
||||
// sendAmount +
|
||||
// Format.satoshisToAmount(fee)) {
|
||||
// unawaited(showDialog<void>(
|
||||
// context: context,
|
||||
// builder: (_) => StackOkDialog(
|
||||
// title: "Insufficient balance",
|
||||
// message:
|
||||
// "Current ${coin.prettyName} wallet does not have enough ${coin.ticker} for this trade",
|
||||
// ),
|
||||
// ));
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (isEstimated) {
|
||||
final fromTicker = ref
|
||||
|
|
|
@ -13,6 +13,7 @@ import 'package:stackwallet/pages/wallets_view/wallets_view.dart';
|
|||
import 'package:stackwallet/providers/global/notifications_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/home_view_index_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/unread_notifications_provider.dart';
|
||||
import 'package:stackwallet/services/change_now/change_now_loading_service.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
|
@ -40,7 +41,16 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
|
||||
bool _exitEnabled = false;
|
||||
|
||||
final _cnLoadingService = ChangeNowLoadingService();
|
||||
|
||||
Future<bool> _onWillPop() async {
|
||||
|
||||
// go to home view when tapping back on the main exchange view
|
||||
if (ref.read(homeViewPageIndexStateProvider.state).state == 1) {
|
||||
ref.read(homeViewPageIndexStateProvider.state).state = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_exitEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
@ -70,6 +80,11 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
return _exitEnabled;
|
||||
}
|
||||
|
||||
void _loadCNData() {
|
||||
// unawaited future
|
||||
_cnLoadingService.loadAll(ref);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_pageController = PageController();
|
||||
|
@ -77,9 +92,11 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
const WalletsView(),
|
||||
if (Constants.enableExchange)
|
||||
Stack(
|
||||
children: const [
|
||||
ExchangeView(),
|
||||
ExchangeLoadingOverlayView(),
|
||||
children: [
|
||||
const ExchangeView(),
|
||||
ExchangeLoadingOverlayView(
|
||||
unawaitedLoad: _loadCNData,
|
||||
),
|
||||
],
|
||||
),
|
||||
// const BuyView(),
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
|
||||
// import 'package:stackwallet/providers/global/has_authenticated_start_state_provider.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
// import 'package:stackwallet/providers/global/should_show_lockscreen_on_resume_state_provider.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/biometrics.dart';
|
||||
|
@ -15,6 +20,7 @@ import 'package:stackwallet/utilities/text_styles.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_pin_put/custom_pin_put.dart';
|
||||
import 'package:stackwallet/widgets/shake/shake.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class LockscreenView extends ConsumerStatefulWidget {
|
||||
const LockscreenView({
|
||||
|
@ -75,10 +81,20 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
|||
if (widget.popOnSuccess) {
|
||||
Navigator.of(context).pop(widget.routeOnSuccessArguments);
|
||||
} else {
|
||||
Navigator.of(context).pushReplacementNamed(
|
||||
unawaited(Navigator.of(context).pushReplacementNamed(
|
||||
widget.routeOnSuccess,
|
||||
arguments: widget.routeOnSuccessArguments,
|
||||
);
|
||||
));
|
||||
if (widget.routeOnSuccess == HomeView.routeName &&
|
||||
widget.routeOnSuccessArguments is String) {
|
||||
final walletId = widget.routeOnSuccessArguments as String;
|
||||
unawaited(Navigator.of(context).pushNamed(WalletView.routeName,
|
||||
arguments: Tuple2(
|
||||
walletId,
|
||||
ref
|
||||
.read(walletsChangeNotifierProvider)
|
||||
.getManagerProvider(walletId))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +121,7 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
|||
// await walletsService.getWalletId(currentWalletName));
|
||||
// }
|
||||
|
||||
_onUnlock();
|
||||
unawaited(_onUnlock());
|
||||
}
|
||||
// leave this commented to enable pin fall back should biometrics not work properly
|
||||
// else {
|
||||
|
@ -250,10 +266,10 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
|||
_timeout = const Duration(minutes: 60);
|
||||
}
|
||||
|
||||
Future<void>.delayed(_timeout).then((_) {
|
||||
unawaited(Future<void>.delayed(_timeout).then((_) {
|
||||
_attemptLock = false;
|
||||
_attempts = 0;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
if (_attemptLock) {
|
||||
|
@ -264,13 +280,13 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
|||
prettyTime += "${_timeout.inSeconds} seconds";
|
||||
}
|
||||
|
||||
showFloatingFlushBar(
|
||||
unawaited(showFloatingFlushBar(
|
||||
type: FlushBarType.warning,
|
||||
message:
|
||||
"Incorrect PIN entered too many times. Please wait $prettyTime",
|
||||
context: context,
|
||||
iconAsset: Assets.svg.alertCircle,
|
||||
);
|
||||
));
|
||||
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 100));
|
||||
|
@ -286,15 +302,15 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
|||
if (storedPin == pin) {
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 200));
|
||||
_onUnlock();
|
||||
unawaited(_onUnlock());
|
||||
} else {
|
||||
_shakeController.shake();
|
||||
showFloatingFlushBar(
|
||||
unawaited(_shakeController.shake());
|
||||
unawaited(showFloatingFlushBar(
|
||||
type: FlushBarType.warning,
|
||||
message: "Incorrect PIN. Please try again",
|
||||
context: context,
|
||||
iconAsset: Assets.svg.alertCircle,
|
||||
);
|
||||
));
|
||||
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 100));
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/language_v
|
|||
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/security_views/security_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/support_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/sub_widgets/settings_list_button.dart';
|
||||
|
@ -166,6 +167,18 @@ class GlobalSettingsView extends StatelessWidget {
|
|||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
SettingsListButton(
|
||||
iconAssetName: Assets.svg.arrowUpRight,
|
||||
iconSize: 16,
|
||||
title: "Startup",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
StartupPreferencesView.routeName);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
SettingsListButton(
|
||||
iconAssetName: Assets.svg.sun,
|
||||
iconSize: 18,
|
||||
|
|
|
@ -0,0 +1,269 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
class StartupPreferencesView extends ConsumerStatefulWidget {
|
||||
const StartupPreferencesView({Key? key}) : super(key: key);
|
||||
|
||||
static const String routeName = "/startupPreferences";
|
||||
|
||||
@override
|
||||
ConsumerState<StartupPreferencesView> createState() =>
|
||||
_StartupPreferencesViewState();
|
||||
}
|
||||
|
||||
class _StartupPreferencesViewState
|
||||
extends ConsumerState<StartupPreferencesView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: CFColors.almostWhite,
|
||||
appBar: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
"Startup preferences",
|
||||
style: STextStyles.navBarTitle,
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
RoundedWhiteContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: RawMaterialButton(
|
||||
// splashColor: CFColors.splashLight,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
.gotoWalletOnStartup = false;
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: Radio(
|
||||
activeColor: CFColors.link2,
|
||||
value: false,
|
||||
groupValue: ref.watch(
|
||||
prefsChangeNotifierProvider
|
||||
.select((value) => value
|
||||
.gotoWalletOnStartup),
|
||||
),
|
||||
onChanged: (value) {
|
||||
if (value is bool) {
|
||||
ref
|
||||
.read(
|
||||
prefsChangeNotifierProvider)
|
||||
.gotoWalletOnStartup = value;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Home screen",
|
||||
style: STextStyles.titleBold12,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
"Stack Wallet home screen",
|
||||
style: STextStyles.itemSubtitle,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: RawMaterialButton(
|
||||
// splashColor: CFColors.splashLight,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
ref
|
||||
.read(prefsChangeNotifierProvider)
|
||||
.gotoWalletOnStartup = true;
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: Radio(
|
||||
activeColor: CFColors.link2,
|
||||
value: true,
|
||||
groupValue: ref.watch(
|
||||
prefsChangeNotifierProvider
|
||||
.select((value) => value
|
||||
.gotoWalletOnStartup),
|
||||
),
|
||||
onChanged: (value) {
|
||||
if (value is bool) {
|
||||
ref
|
||||
.read(
|
||||
prefsChangeNotifierProvider)
|
||||
.gotoWalletOnStartup = value;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Specific wallet",
|
||||
style: STextStyles.titleBold12,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
"Select a specific wallet to load into on startup",
|
||||
style: STextStyles.itemSubtitle,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.gotoWalletOnStartup)))
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
if (ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.gotoWalletOnStartup)))
|
||||
Container(
|
||||
color: Colors.transparent,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 12.0,
|
||||
right: 12,
|
||||
bottom: 12,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 12 + 20,
|
||||
height: 12,
|
||||
),
|
||||
Flexible(
|
||||
child: RawMaterialButton(
|
||||
// splashColor: CFColors.splashLight,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants
|
||||
.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
StartupWalletSelectionView
|
||||
.routeName);
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Select wallet...",
|
||||
style: STextStyles.link2,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
class StartupWalletSelectionView extends ConsumerStatefulWidget {
|
||||
const StartupWalletSelectionView({Key? key}) : super(key: key);
|
||||
|
||||
static const String routeName = "/startupWalletSelection";
|
||||
@override
|
||||
ConsumerState<StartupWalletSelectionView> createState() =>
|
||||
_StartupWalletSelectionViewState();
|
||||
}
|
||||
|
||||
class _StartupWalletSelectionViewState
|
||||
extends ConsumerState<StartupWalletSelectionView> {
|
||||
final Map<String, DSBController> _controllers = {};
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final managers = ref
|
||||
.watch(walletsChangeNotifierProvider.select((value) => value.managers));
|
||||
|
||||
_controllers.clear();
|
||||
for (final manager in managers) {
|
||||
_controllers[manager.walletId] = DSBController();
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: CFColors.almostWhite,
|
||||
appBar: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
title: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(
|
||||
"Select startup wallet",
|
||||
style: STextStyles.navBarTitle,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: LayoutBuilder(builder: (context, constraints) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 12,
|
||||
top: 12,
|
||||
right: 12,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight - 24,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
"Select a wallet to load into immediately on startup",
|
||||
style: STextStyles.smallMed12,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
RoundedWhiteContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
...managers.map(
|
||||
(manager) => Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
key: Key(
|
||||
"startupWalletSelectionGroupKey_${manager.walletId}"),
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: CFColors.coin
|
||||
.forCoin(manager.coin)
|
||||
.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg
|
||||
.iconFor(coin: manager.coin),
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
manager.walletName,
|
||||
style: STextStyles.titleBold12,
|
||||
),
|
||||
// const SizedBox(
|
||||
// height: 2,
|
||||
// ),
|
||||
// FutureBuilder(
|
||||
// future: manager.totalBalance,
|
||||
// builder: (builderContext,
|
||||
// AsyncSnapshot<Decimal> snapshot) {
|
||||
// if (snapshot.connectionState ==
|
||||
// ConnectionState.done &&
|
||||
// snapshot.hasData) {
|
||||
// return Text(
|
||||
// "${Format.localizedStringAsFixed(
|
||||
// value: snapshot.data!,
|
||||
// locale: ref.watch(
|
||||
// localeServiceChangeNotifierProvider
|
||||
// .select((value) =>
|
||||
// value.locale)),
|
||||
// decimalPlaces: 8,
|
||||
// )} ${manager.coin.ticker}",
|
||||
// style: STextStyles.itemSubtitle,
|
||||
// );
|
||||
// } else {
|
||||
// return AnimatedText(
|
||||
// stringsToLoopThrough: const [
|
||||
// "Loading balance",
|
||||
// "Loading balance.",
|
||||
// "Loading balance..",
|
||||
// "Loading balance..."
|
||||
// ],
|
||||
// style: STextStyles.itemSubtitle,
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: Radio(
|
||||
activeColor: CFColors.link2,
|
||||
value: manager.walletId,
|
||||
groupValue: ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.startupWalletId),
|
||||
),
|
||||
onChanged: (value) {
|
||||
if (value is String) {
|
||||
ref
|
||||
.read(
|
||||
prefsChangeNotifierProvider)
|
||||
.startupWalletId = value;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -24,6 +24,9 @@ import 'package:stackwallet/providers/global/auto_swb_service_provider.dart';
|
|||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/ui/transaction_filter_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/unread_notifications_provider.dart';
|
||||
import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart';
|
||||
import 'package:stackwallet/providers/wallet/wallet_balance_toggle_state_provider.dart';
|
||||
import 'package:stackwallet/services/change_now/change_now_loading_service.dart';
|
||||
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/manager.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
|
||||
|
@ -35,6 +38,7 @@ import 'package:stackwallet/utilities/constants.dart';
|
|||
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||
|
@ -42,10 +46,6 @@ import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
|||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../providers/wallet/public_private_balance_state_provider.dart';
|
||||
import '../../providers/wallet/wallet_balance_toggle_state_provider.dart';
|
||||
import '../../utilities/enums/wallet_balance_toggle_state.dart';
|
||||
|
||||
/// [eventBus] should only be set during testing
|
||||
class WalletView extends ConsumerStatefulWidget {
|
||||
const WalletView({
|
||||
|
@ -79,6 +79,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
late StreamSubscription<dynamic> _syncStatusSubscription;
|
||||
late StreamSubscription<dynamic> _nodeStatusSubscription;
|
||||
|
||||
final _cnLoadingService = ChangeNowLoadingService();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
walletId = widget.walletId;
|
||||
|
@ -272,9 +274,10 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
|
||||
unawaited(Navigator.of(context).pushNamed(
|
||||
WalletInitiatedExchangeView.routeName,
|
||||
arguments: Tuple2(
|
||||
arguments: Tuple3(
|
||||
walletId,
|
||||
coin,
|
||||
_loadCNData,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
@ -346,6 +349,11 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
}
|
||||
}
|
||||
|
||||
void _loadCNData() {
|
||||
// unawaited future
|
||||
_cnLoadingService.loadAll(ref, coin: ref.read(managerProvider).coin);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
|
|
@ -56,6 +56,8 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/stack_back
|
|||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/support_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart';
|
||||
|
@ -224,6 +226,18 @@ class RouteGenerator {
|
|||
builder: (_) => const SyncingPreferencesView(),
|
||||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case StartupPreferencesView.routeName:
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const StartupPreferencesView(),
|
||||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case StartupWalletSelectionView.routeName:
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const StartupWalletSelectionView(),
|
||||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case ManageNodesView.routeName:
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
|
@ -719,7 +733,7 @@ class RouteGenerator {
|
|||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
case WalletInitiatedExchangeView.routeName:
|
||||
if (args is Tuple2<String, Coin>) {
|
||||
if (args is Tuple3<String, Coin, VoidCallback>) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => Stack(
|
||||
|
@ -728,7 +742,9 @@ class RouteGenerator {
|
|||
walletId: args.item1,
|
||||
coin: args.item2,
|
||||
),
|
||||
const ExchangeLoadingOverlayView(),
|
||||
ExchangeLoadingOverlayView(
|
||||
unawaitedLoad: args.item3,
|
||||
),
|
||||
],
|
||||
),
|
||||
settings: RouteSettings(
|
||||
|
|
140
lib/services/change_now/change_now_loading_service.dart
Normal file
140
lib/services/change_now/change_now_loading_service.dart
Normal file
|
@ -0,0 +1,140 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/providers/exchange/available_currencies_state_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/available_floating_rate_pairs_state_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/change_now_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/changenow_initial_load_status.dart';
|
||||
import 'package:stackwallet/providers/exchange/estimate_rate_exchange_form_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/fixed_rate_exchange_form_provider.dart';
|
||||
import 'package:stackwallet/providers/exchange/fixed_rate_market_pairs_provider.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
|
||||
class ChangeNowLoadingService {
|
||||
Future<void> loadAll(WidgetRef ref, {Coin? coin}) async {
|
||||
try {
|
||||
await Future.wait([
|
||||
_loadFixedRateMarkets(ref, coin: coin),
|
||||
_loadChangeNowStandardCurrencies(ref, coin: coin),
|
||||
]);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("ChangeNowLoadingService.loadAll failed: $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadFixedRateMarkets(WidgetRef ref, {Coin? coin}) async {
|
||||
if (ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state ==
|
||||
ChangeNowLoadStatus.loading) {
|
||||
// already in progress so just
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.loading;
|
||||
|
||||
final response3 =
|
||||
await ref.read(changeNowProvider).getAvailableFixedRateMarkets();
|
||||
if (response3.value != null) {
|
||||
ref.read(fixedRateMarketPairsStateProvider.state).state =
|
||||
response3.value!;
|
||||
|
||||
if (ref.read(fixedRateExchangeFormProvider).market == null) {
|
||||
String fromTicker = "btc";
|
||||
String toTicker = "xmr";
|
||||
|
||||
if (coin != null) {
|
||||
fromTicker = coin.ticker.toLowerCase();
|
||||
}
|
||||
|
||||
final matchingMarkets = response3.value!
|
||||
.where((e) => e.to == toTicker && e.from == fromTicker);
|
||||
if (matchingMarkets.isNotEmpty) {
|
||||
await ref
|
||||
.read(fixedRateExchangeFormProvider)
|
||||
.updateMarket(matchingMarkets.first, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logging.instance.log(
|
||||
"Failed to load changeNOW fixed rate markets: ${response3.exception?.errorMessage}",
|
||||
level: LogLevel.Error);
|
||||
|
||||
ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.failed;
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowFixedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.success;
|
||||
}
|
||||
|
||||
Future<void> _loadChangeNowStandardCurrencies(WidgetRef ref,
|
||||
{Coin? coin}) async {
|
||||
if (ref
|
||||
.read(changeNowEstimatedInitialLoadStatusStateProvider.state)
|
||||
.state ==
|
||||
ChangeNowLoadStatus.loading) {
|
||||
// already in progress so just
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.loading;
|
||||
|
||||
final response = await ref.read(changeNowProvider).getAvailableCurrencies();
|
||||
final response2 =
|
||||
await ref.read(changeNowProvider).getAvailableFloatingRatePairs();
|
||||
if (response.value != null) {
|
||||
ref.read(availableChangeNowCurrenciesStateProvider.state).state =
|
||||
response.value!;
|
||||
if (response2.value != null) {
|
||||
ref.read(availableFloatingRatePairsStateProvider.state).state =
|
||||
response2.value!;
|
||||
|
||||
String fromTicker = "btc";
|
||||
String toTicker = "xmr";
|
||||
|
||||
if (coin != null) {
|
||||
fromTicker = coin.ticker.toLowerCase();
|
||||
}
|
||||
|
||||
if (response.value!.length > 1) {
|
||||
if (ref.read(estimatedRateExchangeFormProvider).from == null) {
|
||||
if (response.value!
|
||||
.where((e) => e.ticker == fromTicker)
|
||||
.isNotEmpty) {
|
||||
await ref.read(estimatedRateExchangeFormProvider).updateFrom(
|
||||
response.value!.firstWhere((e) => e.ticker == fromTicker),
|
||||
false);
|
||||
}
|
||||
}
|
||||
if (ref.read(estimatedRateExchangeFormProvider).to == null) {
|
||||
if (response.value!.where((e) => e.ticker == toTicker).isNotEmpty) {
|
||||
await ref.read(estimatedRateExchangeFormProvider).updateTo(
|
||||
response.value!.firstWhere((e) => e.ticker == toTicker),
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logging.instance.log(
|
||||
"Failed to load changeNOW available floating rate pairs: ${response2.exception?.errorMessage}",
|
||||
level: LogLevel.Error);
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.failed;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Logging.instance.log(
|
||||
"Failed to load changeNOW currencies: ${response.exception?.errorMessage}",
|
||||
level: LogLevel.Error);
|
||||
await Future<void>.delayed(const Duration(seconds: 3));
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.failed;
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(changeNowEstimatedInitialLoadStatusStateProvider.state).state =
|
||||
ChangeNowLoadStatus.success;
|
||||
}
|
||||
}
|
|
@ -418,7 +418,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
"index: $index, \t GapCounter $account ${type.name}: $gapCounter",
|
||||
level: LogLevel.Info);
|
||||
|
||||
final ID = "k_$index";
|
||||
final _id = "k_$index";
|
||||
Map<String, String> txCountCallArgs = {};
|
||||
final Map<String, dynamic> receivingNodes = {};
|
||||
|
||||
|
@ -463,13 +463,13 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
throw Exception("No Path type $type exists");
|
||||
}
|
||||
receivingNodes.addAll({
|
||||
"${ID}_$j": {
|
||||
"${_id}_$j": {
|
||||
"node": node,
|
||||
"address": address,
|
||||
}
|
||||
});
|
||||
txCountCallArgs.addAll({
|
||||
"${ID}_$j": address,
|
||||
"${_id}_$j": address,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -478,9 +478,9 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
|
||||
// check and add appropriate addresses
|
||||
for (int k = 0; k < txCountBatchSize; k++) {
|
||||
int count = counts["${ID}_$k"]!;
|
||||
int count = counts["${_id}_$k"]!;
|
||||
if (count > 0) {
|
||||
final node = receivingNodes["${ID}_$k"];
|
||||
final node = receivingNodes["${_id}_$k"];
|
||||
// add address to array
|
||||
addressArray.add(node["address"] as String);
|
||||
iterationsAddressArray.add(node["address"] as String);
|
||||
|
@ -526,7 +526,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} catch (e, s) {
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@ -568,25 +568,25 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
// receiving addresses
|
||||
Logging.instance
|
||||
.log("checking receiving addresses...", level: LogLevel.Info);
|
||||
Future resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
|
||||
|
||||
Future resultReceive49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 0);
|
||||
|
||||
Future resultReceive84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 0);
|
||||
|
||||
Logging.instance
|
||||
.log("checking change addresses...", level: LogLevel.Info);
|
||||
// change addresses
|
||||
Future resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
|
||||
|
||||
Future resultChange49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 1);
|
||||
|
||||
Future resultChange84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 1);
|
||||
|
||||
await Future.wait([
|
||||
|
@ -851,7 +851,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
// notify on unconfirmed transactions
|
||||
for (final tx in unconfirmedTxnsToNotifyPending) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -862,10 +862,10 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Sending transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -876,7 +876,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
// notify on confirmed
|
||||
for (final tx in unconfirmedTxnsToNotifyConfirmed) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -892,10 +892,10 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Outgoing transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -903,7 +903,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -970,15 +970,15 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
if (currentHeight != storedHeight) {
|
||||
if (currentHeight != -1) {
|
||||
// -1 failed to fetch current height
|
||||
updateStoredChainHeight(newHeight: currentHeight);
|
||||
unawaited(updateStoredChainHeight(newHeight: currentHeight));
|
||||
}
|
||||
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.2, walletId));
|
||||
Future changeAddressForTransactions =
|
||||
final changeAddressForTransactions =
|
||||
_checkChangeAddressForTransactions(DerivePathType.bip84);
|
||||
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.3, walletId));
|
||||
Future currentReceivingAddressesForTransactions =
|
||||
final currentReceivingAddressesForTransactions =
|
||||
_checkCurrentReceivingAddressesForTransactions();
|
||||
|
||||
final newTxData = _fetchTransactionData();
|
||||
|
@ -999,7 +999,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
GlobalEventBus.instance
|
||||
.fire(RefreshPercentChangedEvent(0.80, walletId));
|
||||
|
||||
Future allTxsToWatch = getAllTxsToWatch(await newTxData);
|
||||
final allTxsToWatch = getAllTxsToWatch(await newTxData);
|
||||
await Future.wait([
|
||||
newTxData,
|
||||
changeAddressForTransactions,
|
||||
|
@ -1358,7 +1358,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
);
|
||||
|
||||
if (shouldRefresh) {
|
||||
refresh();
|
||||
unawaited(refresh());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
}
|
||||
|
||||
Future<void> updateStoredChainHeight({required int newHeight}) async {
|
||||
DB.instance.put<dynamic>(
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: walletId, key: "storedChainHeight", value: newHeight);
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
"index: $index, \t GapCounter $account ${type.name}: $gapCounter",
|
||||
level: LogLevel.Info);
|
||||
|
||||
final ID = "k_$index";
|
||||
final _id = "k_$index";
|
||||
Map<String, String> txCountCallArgs = {};
|
||||
final Map<String, dynamic> receivingNodes = {};
|
||||
|
||||
|
@ -392,13 +392,13 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
throw Exception("No Path type $type exists");
|
||||
}
|
||||
receivingNodes.addAll({
|
||||
"${ID}_$j": {
|
||||
"${_id}_$j": {
|
||||
"node": node,
|
||||
"address": address,
|
||||
}
|
||||
});
|
||||
txCountCallArgs.addAll({
|
||||
"${ID}_$j": address,
|
||||
"${_id}_$j": address,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -407,9 +407,9 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
|
||||
// check and add appropriate addresses
|
||||
for (int k = 0; k < txCountBatchSize; k++) {
|
||||
int count = counts["${ID}_$k"]!;
|
||||
int count = counts["${_id}_$k"]!;
|
||||
if (count > 0) {
|
||||
final node = receivingNodes["${ID}_$k"];
|
||||
final node = receivingNodes["${_id}_$k"];
|
||||
// add address to array
|
||||
addressArray.add(node["address"] as String);
|
||||
iterationsAddressArray.add(node["address"] as String);
|
||||
|
@ -455,7 +455,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} catch (e, s) {
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@ -485,13 +485,13 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
// receiving addresses
|
||||
Logging.instance
|
||||
.log("checking receiving addresses...", level: LogLevel.Info);
|
||||
Future resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
|
||||
|
||||
Logging.instance
|
||||
.log("checking change addresses...", level: LogLevel.Info);
|
||||
// change addresses
|
||||
Future resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
|
||||
|
||||
await Future.wait([
|
||||
|
@ -653,7 +653,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
// notify on new incoming transaction
|
||||
for (final tx in unconfirmedTxnsToNotifyPending) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -664,10 +664,10 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Sending transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -678,7 +678,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
// notify on confirmed
|
||||
for (final tx in unconfirmedTxnsToNotifyConfirmed) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -694,11 +694,11 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.now(),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Outgoing transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -706,7 +706,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.now(),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
if (currentHeight != storedHeight) {
|
||||
if (currentHeight != -1) {
|
||||
// -1 failed to fetch current height
|
||||
updateStoredChainHeight(newHeight: currentHeight);
|
||||
unawaited(updateStoredChainHeight(newHeight: currentHeight));
|
||||
}
|
||||
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.2, walletId));
|
||||
|
@ -1127,7 +1127,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
);
|
||||
|
||||
if (shouldRefresh) {
|
||||
refresh();
|
||||
unawaited(refresh());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2796,7 +2796,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
);
|
||||
|
||||
// clear cache
|
||||
_cachedElectrumXClient.clearSharedTransactionCache(coin: coin);
|
||||
await _cachedElectrumXClient.clearSharedTransactionCache(coin: coin);
|
||||
|
||||
// back up data
|
||||
await _rescanBackup();
|
||||
|
@ -3062,6 +3062,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
return available - estimatedFee;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> generateNewAddress() async {
|
||||
try {
|
||||
await _incrementAddressIndexForChain(
|
||||
|
|
|
@ -225,7 +225,7 @@ Future<void> executeNative(Map<String, dynamic> arguments) async {
|
|||
sendPort
|
||||
.send("Error An error was thrown in this isolate $function: $e\n$s");
|
||||
} finally {
|
||||
Logging.instance.isar?.close();
|
||||
await Logging.instance.isar?.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
// TODO notify ui/ fire event for node changed?
|
||||
|
||||
if (shouldRefresh) {
|
||||
refresh();
|
||||
unawaited(refresh());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -705,7 +705,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
try {
|
||||
result = await cancelPendingTransaction(tx_slate_id);
|
||||
Logging.instance.log("result?: $result", level: LogLevel.Info);
|
||||
if (result != null && !(result.toLowerCase().contains("error"))) {
|
||||
if (!(result.toLowerCase().contains("error"))) {
|
||||
await postCancel(
|
||||
receiveAddress, tx_slate_id, signature, sendersAddress);
|
||||
}
|
||||
|
@ -1180,10 +1180,10 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
transactionFees = message['result'] as String;
|
||||
});
|
||||
debugPrint(transactionFees);
|
||||
var decodeData;
|
||||
dynamic decodeData;
|
||||
try {
|
||||
decodeData = json.decode(transactionFees!);
|
||||
} catch (e, s) {
|
||||
} catch (e) {
|
||||
if (ifErrorEstimateFee) {
|
||||
//Error Not enough funds. Required: 0.56500000, Available: 0.56200000
|
||||
if (transactionFees!.contains("Required")) {
|
||||
|
@ -1705,7 +1705,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
|
||||
try {
|
||||
final String response = message['result'] as String;
|
||||
if (response == null || response == "") {
|
||||
if (response == "") {
|
||||
Logging.instance.log("response: ${response.runtimeType}",
|
||||
level: LogLevel.Info);
|
||||
await deleteSlate(currentAddress,
|
||||
|
@ -1921,7 +1921,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
if (currentHeight != storedHeight) {
|
||||
if (currentHeight != -1) {
|
||||
// -1 failed to fetch current height
|
||||
updateStoredChainHeight(newHeight: currentHeight);
|
||||
unawaited(updateStoredChainHeight(newHeight: currentHeight));
|
||||
}
|
||||
|
||||
final newTxData = _fetchTransactionData();
|
||||
|
@ -2288,7 +2288,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
timer?.cancel();
|
||||
timer = null;
|
||||
if (isActive) {
|
||||
startSync();
|
||||
unawaited(startSync());
|
||||
} else {
|
||||
for (final isolate in isolates.values) {
|
||||
isolate.kill(priority: Isolate.immediate);
|
||||
|
|
|
@ -1127,7 +1127,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
final balance =
|
||||
Format.decimalAmountToSatoshis(await availablePrivateBalance());
|
||||
if (satoshiAmount == balance) {
|
||||
print("is send all");
|
||||
// print("is send all");
|
||||
isSendAll = true;
|
||||
}
|
||||
dynamic txHexOrError =
|
||||
|
@ -2796,18 +2796,18 @@ class FiroWallet extends CoinServiceAPI {
|
|||
final listTxData = txData.getAllTransactions();
|
||||
listTxData.forEach((key, value) {
|
||||
// ignore change addresses
|
||||
bool hasAtLeastOneReceive = false;
|
||||
// bool hasAtLeastOneReceive = false;
|
||||
// int howManyReceiveInputs = 0;
|
||||
for (var element in value.inputs) {
|
||||
if (listLelantusTxData.containsKey(element.txid) &&
|
||||
listLelantusTxData[element.txid]!.txType == "Received"
|
||||
// &&
|
||||
// listLelantusTxData[element.txid].subType != "mint"
|
||||
) {
|
||||
hasAtLeastOneReceive = true;
|
||||
// howManyReceiveInputs++;
|
||||
}
|
||||
}
|
||||
// for (var element in value.inputs) {
|
||||
// if (listLelantusTxData.containsKey(element.txid) &&
|
||||
// listLelantusTxData[element.txid]!.txType == "Received"
|
||||
// // &&
|
||||
// // listLelantusTxData[element.txid].subType != "mint"
|
||||
// ) {
|
||||
// // hasAtLeastOneReceive = true;
|
||||
// // howManyReceiveInputs++;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (value.txType == "Received" && value.subType != "mint") {
|
||||
// Every receive other than a mint should be shown. Mints will be collected and shown from the send side
|
||||
|
@ -4238,7 +4238,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
Future<void> _restore(int latestSetId, Map<dynamic, dynamic> setDataMap,
|
||||
dynamic usedSerialNumbers) async {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
Future data = _txnData;
|
||||
final dataFuture = _txnData;
|
||||
final String currency = _prefs.currency;
|
||||
final Decimal currentPrice = await firoPrice;
|
||||
|
||||
|
@ -4252,7 +4252,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
"network": _network,
|
||||
});
|
||||
|
||||
await Future.wait([data]);
|
||||
await Future.wait([dataFuture]);
|
||||
var result = await receivePort.first;
|
||||
if (result is String) {
|
||||
Logging.instance
|
||||
|
@ -4263,8 +4263,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
stop(receivePort);
|
||||
|
||||
final message = await staticProcessRestore(
|
||||
(await data) as models.TransactionData,
|
||||
result as Map<dynamic, dynamic>);
|
||||
(await dataFuture), result as Map<dynamic, dynamic>);
|
||||
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: walletId, key: 'mintIndex', value: message['mintIndex']);
|
||||
|
@ -4305,7 +4304,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
final latestSetId = await getLatestSetId();
|
||||
|
||||
final List<Map<String, dynamic>> sets = [];
|
||||
List<Future> anonFutures = [];
|
||||
List<Future<Map<String, dynamic>>> anonFutures = [];
|
||||
for (int i = 1; i <= latestSetId; i++) {
|
||||
final set = cachedElectrumXClient.getAnonymitySet(
|
||||
groupId: "$i",
|
||||
|
@ -4315,8 +4314,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
}
|
||||
await Future.wait(anonFutures);
|
||||
for (int i = 1; i <= latestSetId; i++) {
|
||||
Map<String, dynamic> set =
|
||||
(await anonFutures[i - 1]) as Map<String, dynamic>;
|
||||
Map<String, dynamic> set = (await anonFutures[i - 1]);
|
||||
set["setId"] = i;
|
||||
sets.add(set);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ class Prefs extends ChangeNotifier {
|
|||
_backupFrequencyType = await _getBackupFrequencyType();
|
||||
_lastAutoBackup = await _getLastAutoBackup();
|
||||
_hideBlockExplorerWarning = await _getHideBlockExplorerWarning();
|
||||
_gotoWalletOnStartup = await _getGotoWalletOnStartup();
|
||||
_startupWalletId = await _getStartupWalletId();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
@ -468,8 +470,6 @@ class Prefs extends ChangeNotifier {
|
|||
boxName: DB.boxNamePrefs, key: "autoBackupFileUri") as DateTime?;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// auto backup
|
||||
|
||||
bool _hideBlockExplorerWarning = false;
|
||||
|
@ -492,7 +492,56 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getHideBlockExplorerWarning() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "hideBlockExplorerWarning") as bool? ??
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "hideBlockExplorerWarning") as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
// auto backup
|
||||
|
||||
bool _gotoWalletOnStartup = false;
|
||||
|
||||
bool get gotoWalletOnStartup => _gotoWalletOnStartup;
|
||||
|
||||
set gotoWalletOnStartup(bool gotoWalletOnStartup) {
|
||||
if (_gotoWalletOnStartup != gotoWalletOnStartup) {
|
||||
DB.instance
|
||||
.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "gotoWalletOnStartup",
|
||||
value: gotoWalletOnStartup)
|
||||
.then((_) {
|
||||
_gotoWalletOnStartup = gotoWalletOnStartup;
|
||||
notifyListeners();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _getGotoWalletOnStartup() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "gotoWalletOnStartup") as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
// startup wallet id
|
||||
|
||||
String? _startupWalletId;
|
||||
|
||||
String? get startupWalletId => _startupWalletId;
|
||||
|
||||
set startupWalletId(String? startupWalletId) {
|
||||
if (this.startupWalletId != startupWalletId) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "startupWalletId",
|
||||
value: startupWalletId);
|
||||
_startupWalletId = startupWalletId;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> _getStartupWalletId() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "startupWalletId") as String?;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -358,6 +358,28 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs {
|
|||
super.noSuchMethod(Invocation.setter(#lastAutoBackup, lastAutoBackup),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get hideBlockExplorerWarning =>
|
||||
(super.noSuchMethod(Invocation.getter(#hideBlockExplorerWarning),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#hideBlockExplorerWarning, hideBlockExplorerWarning),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get gotoWalletOnStartup =>
|
||||
(super.noSuchMethod(Invocation.getter(#gotoWalletOnStartup),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod(
|
||||
Invocation.setter(#gotoWalletOnStartup, gotoWalletOnStartup),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
set startupWalletId(String? startupWalletId) =>
|
||||
super.noSuchMethod(Invocation.setter(#startupWalletId, startupWalletId),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get hasListeners =>
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false)
|
||||
as bool);
|
||||
|
|
|
@ -207,6 +207,28 @@ class MockPrefs extends _i1.Mock implements _i4.Prefs {
|
|||
super.noSuchMethod(Invocation.setter(#lastAutoBackup, lastAutoBackup),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get hideBlockExplorerWarning =>
|
||||
(super.noSuchMethod(Invocation.getter(#hideBlockExplorerWarning),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#hideBlockExplorerWarning, hideBlockExplorerWarning),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get gotoWalletOnStartup =>
|
||||
(super.noSuchMethod(Invocation.getter(#gotoWalletOnStartup),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod(
|
||||
Invocation.setter(#gotoWalletOnStartup, gotoWalletOnStartup),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
set startupWalletId(String? startupWalletId) =>
|
||||
super.noSuchMethod(Invocation.setter(#startupWalletId, startupWalletId),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get hasListeners =>
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false)
|
||||
as bool);
|
||||
|
|
|
@ -8,18 +8,20 @@ import 'package:decimal/decimal.dart' as _i7;
|
|||
import 'package:http/http.dart' as _i4;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/models/exchange/change_now/available_floating_rate_pair.dart'
|
||||
as _i12;
|
||||
as _i13;
|
||||
import 'package:stackwallet/models/exchange/change_now/change_now_response.dart'
|
||||
as _i2;
|
||||
import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart'
|
||||
as _i9;
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart' as _i6;
|
||||
import 'package:stackwallet/models/exchange/change_now/estimated_exchange_amount.dart'
|
||||
as _i8;
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart'
|
||||
as _i10;
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart'
|
||||
as _i11;
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart'
|
||||
as _i12;
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart'
|
||||
as _i9;
|
||||
as _i10;
|
||||
import 'package:stackwallet/services/change_now/change_now.dart' as _i3;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
@ -98,38 +100,42 @@ class MockChangeNow extends _i1.Mock implements _i3.ChangeNow {
|
|||
as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i8.EstimatedExchangeAmount>>);
|
||||
@override
|
||||
_i5.Future<_i2.ChangeNowResponse<_i8.EstimatedExchangeAmount>>
|
||||
getEstimatedFixedRateExchangeAmount(
|
||||
_i5.Future<_i2.ChangeNowResponse<_i9.CNExchangeEstimate>>
|
||||
getEstimatedExchangeAmountV2(
|
||||
{String? fromTicker,
|
||||
String? toTicker,
|
||||
_i7.Decimal? fromAmount,
|
||||
bool? useRateId = true,
|
||||
_i9.CNEstimateType? fromOrTo,
|
||||
_i7.Decimal? amount,
|
||||
String? fromNetwork,
|
||||
String? toNetwork,
|
||||
_i9.CNFlowType? flow = _i9.CNFlowType.standard,
|
||||
String? apiKey}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getEstimatedFixedRateExchangeAmount, [], {
|
||||
Invocation.method(#getEstimatedExchangeAmountV2, [], {
|
||||
#fromTicker: fromTicker,
|
||||
#toTicker: toTicker,
|
||||
#fromAmount: fromAmount,
|
||||
#useRateId: useRateId,
|
||||
#fromOrTo: fromOrTo,
|
||||
#amount: amount,
|
||||
#fromNetwork: fromNetwork,
|
||||
#toNetwork: toNetwork,
|
||||
#flow: flow,
|
||||
#apiKey: apiKey
|
||||
}),
|
||||
returnValue: Future<
|
||||
_i2.ChangeNowResponse<
|
||||
_i8.EstimatedExchangeAmount>>.value(
|
||||
_FakeChangeNowResponse_0<_i8.EstimatedExchangeAmount>()))
|
||||
as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i8.EstimatedExchangeAmount>>);
|
||||
_i2.ChangeNowResponse<_i9.CNExchangeEstimate>>.value(
|
||||
_FakeChangeNowResponse_0<_i9.CNExchangeEstimate>()))
|
||||
as _i5.Future<_i2.ChangeNowResponse<_i9.CNExchangeEstimate>>);
|
||||
@override
|
||||
_i5.Future<_i2.ChangeNowResponse<List<_i9.FixedRateMarket>>>
|
||||
_i5.Future<_i2.ChangeNowResponse<List<_i10.FixedRateMarket>>>
|
||||
getAvailableFixedRateMarkets({String? apiKey}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getAvailableFixedRateMarkets, [], {#apiKey: apiKey}),
|
||||
returnValue:
|
||||
Future<_i2.ChangeNowResponse<List<_i9.FixedRateMarket>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i9.FixedRateMarket>>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<List<_i9.FixedRateMarket>>>);
|
||||
Future<_i2.ChangeNowResponse<List<_i10.FixedRateMarket>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i10.FixedRateMarket>>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<List<_i10.FixedRateMarket>>>);
|
||||
@override
|
||||
_i5.Future<_i2.ChangeNowResponse<_i10.ExchangeTransaction>>
|
||||
_i5.Future<_i2.ChangeNowResponse<_i11.ExchangeTransaction>>
|
||||
createStandardExchangeTransaction(
|
||||
{String? fromTicker,
|
||||
String? toTicker,
|
||||
|
@ -155,11 +161,11 @@ class MockChangeNow extends _i1.Mock implements _i3.ChangeNow {
|
|||
#apiKey: apiKey
|
||||
}),
|
||||
returnValue: Future<
|
||||
_i2.ChangeNowResponse<_i10.ExchangeTransaction>>.value(
|
||||
_FakeChangeNowResponse_0<_i10.ExchangeTransaction>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i10.ExchangeTransaction>>);
|
||||
_i2.ChangeNowResponse<_i11.ExchangeTransaction>>.value(
|
||||
_FakeChangeNowResponse_0<_i11.ExchangeTransaction>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i11.ExchangeTransaction>>);
|
||||
@override
|
||||
_i5.Future<_i2.ChangeNowResponse<_i10.ExchangeTransaction>>
|
||||
_i5.Future<_i2.ChangeNowResponse<_i11.ExchangeTransaction>>
|
||||
createFixedRateExchangeTransaction(
|
||||
{String? fromTicker,
|
||||
String? toTicker,
|
||||
|
@ -187,26 +193,26 @@ class MockChangeNow extends _i1.Mock implements _i3.ChangeNow {
|
|||
#apiKey: apiKey
|
||||
}),
|
||||
returnValue: Future<
|
||||
_i2.ChangeNowResponse<_i10.ExchangeTransaction>>.value(
|
||||
_FakeChangeNowResponse_0<_i10.ExchangeTransaction>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i10.ExchangeTransaction>>);
|
||||
_i2.ChangeNowResponse<_i11.ExchangeTransaction>>.value(
|
||||
_FakeChangeNowResponse_0<_i11.ExchangeTransaction>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i11.ExchangeTransaction>>);
|
||||
@override
|
||||
_i5.Future<_i2.ChangeNowResponse<_i11.ExchangeTransactionStatus>>
|
||||
_i5.Future<_i2.ChangeNowResponse<_i12.ExchangeTransactionStatus>>
|
||||
getTransactionStatus({String? id, String? apiKey}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getTransactionStatus, [], {#id: id, #apiKey: apiKey}),
|
||||
returnValue:
|
||||
Future<_i2.ChangeNowResponse<_i11.ExchangeTransactionStatus>>.value(
|
||||
_FakeChangeNowResponse_0<_i11.ExchangeTransactionStatus>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i11.ExchangeTransactionStatus>>);
|
||||
Future<_i2.ChangeNowResponse<_i12.ExchangeTransactionStatus>>.value(
|
||||
_FakeChangeNowResponse_0<_i12.ExchangeTransactionStatus>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<_i12.ExchangeTransactionStatus>>);
|
||||
@override
|
||||
_i5.Future<_i2.ChangeNowResponse<List<_i12.AvailableFloatingRatePair>>>
|
||||
_i5.Future<_i2.ChangeNowResponse<List<_i13.AvailableFloatingRatePair>>>
|
||||
getAvailableFloatingRatePairs({bool? includePartners = false}) => (super
|
||||
.noSuchMethod(
|
||||
Invocation.method(#getAvailableFloatingRatePairs, [],
|
||||
{#includePartners: includePartners}),
|
||||
returnValue:
|
||||
Future<_i2.ChangeNowResponse<List<_i12.AvailableFloatingRatePair>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i12.AvailableFloatingRatePair>>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<List<_i12.AvailableFloatingRatePair>>>);
|
||||
Future<_i2.ChangeNowResponse<List<_i13.AvailableFloatingRatePair>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i13.AvailableFloatingRatePair>>())) as _i5
|
||||
.Future<_i2.ChangeNowResponse<List<_i13.AvailableFloatingRatePair>>>);
|
||||
}
|
||||
|
|
|
@ -334,6 +334,10 @@ class MockManager extends _i1.Mock implements _i11.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
_i8.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i8.Future<bool>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -315,6 +315,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -313,6 +313,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -9,18 +9,20 @@ import 'package:decimal/decimal.dart' as _i15;
|
|||
import 'package:http/http.dart' as _i13;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/models/exchange/change_now/available_floating_rate_pair.dart'
|
||||
as _i19;
|
||||
as _i20;
|
||||
import 'package:stackwallet/models/exchange/change_now/change_now_response.dart'
|
||||
as _i2;
|
||||
import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart'
|
||||
as _i17;
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart' as _i14;
|
||||
import 'package:stackwallet/models/exchange/change_now/estimated_exchange_amount.dart'
|
||||
as _i16;
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart'
|
||||
as _i10;
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart'
|
||||
as _i18;
|
||||
as _i19;
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart'
|
||||
as _i17;
|
||||
as _i18;
|
||||
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart'
|
||||
as _i5;
|
||||
import 'package:stackwallet/services/change_now/change_now.dart' as _i12;
|
||||
|
@ -183,6 +185,28 @@ class MockPrefs extends _i1.Mock implements _i3.Prefs {
|
|||
super.noSuchMethod(Invocation.setter(#lastAutoBackup, lastAutoBackup),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get hideBlockExplorerWarning =>
|
||||
(super.noSuchMethod(Invocation.getter(#hideBlockExplorerWarning),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#hideBlockExplorerWarning, hideBlockExplorerWarning),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get gotoWalletOnStartup =>
|
||||
(super.noSuchMethod(Invocation.getter(#gotoWalletOnStartup),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod(
|
||||
Invocation.setter(#gotoWalletOnStartup, gotoWalletOnStartup),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
set startupWalletId(String? startupWalletId) =>
|
||||
super.noSuchMethod(Invocation.setter(#startupWalletId, startupWalletId),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get hasListeners =>
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false)
|
||||
as bool);
|
||||
|
@ -386,36 +410,40 @@ class MockChangeNow extends _i1.Mock implements _i12.ChangeNow {
|
|||
as _i7
|
||||
.Future<_i2.ChangeNowResponse<_i16.EstimatedExchangeAmount>>);
|
||||
@override
|
||||
_i7.Future<_i2.ChangeNowResponse<_i16.EstimatedExchangeAmount>>
|
||||
getEstimatedFixedRateExchangeAmount(
|
||||
_i7.Future<_i2.ChangeNowResponse<_i17.CNExchangeEstimate>>
|
||||
getEstimatedExchangeAmountV2(
|
||||
{String? fromTicker,
|
||||
String? toTicker,
|
||||
_i15.Decimal? fromAmount,
|
||||
bool? useRateId = true,
|
||||
_i17.CNEstimateType? fromOrTo,
|
||||
_i15.Decimal? amount,
|
||||
String? fromNetwork,
|
||||
String? toNetwork,
|
||||
_i17.CNFlowType? flow = _i17.CNFlowType.standard,
|
||||
String? apiKey}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getEstimatedFixedRateExchangeAmount, [], {
|
||||
Invocation.method(#getEstimatedExchangeAmountV2, [], {
|
||||
#fromTicker: fromTicker,
|
||||
#toTicker: toTicker,
|
||||
#fromAmount: fromAmount,
|
||||
#useRateId: useRateId,
|
||||
#fromOrTo: fromOrTo,
|
||||
#amount: amount,
|
||||
#fromNetwork: fromNetwork,
|
||||
#toNetwork: toNetwork,
|
||||
#flow: flow,
|
||||
#apiKey: apiKey
|
||||
}),
|
||||
returnValue: Future<
|
||||
_i2.ChangeNowResponse<
|
||||
_i16.EstimatedExchangeAmount>>.value(
|
||||
_FakeChangeNowResponse_0<_i16.EstimatedExchangeAmount>()))
|
||||
as _i7
|
||||
.Future<_i2.ChangeNowResponse<_i16.EstimatedExchangeAmount>>);
|
||||
_i2.ChangeNowResponse<_i17.CNExchangeEstimate>>.value(
|
||||
_FakeChangeNowResponse_0<_i17.CNExchangeEstimate>()))
|
||||
as _i7.Future<_i2.ChangeNowResponse<_i17.CNExchangeEstimate>>);
|
||||
@override
|
||||
_i7.Future<_i2.ChangeNowResponse<List<_i17.FixedRateMarket>>>
|
||||
_i7.Future<_i2.ChangeNowResponse<List<_i18.FixedRateMarket>>>
|
||||
getAvailableFixedRateMarkets({String? apiKey}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getAvailableFixedRateMarkets, [], {#apiKey: apiKey}),
|
||||
returnValue:
|
||||
Future<_i2.ChangeNowResponse<List<_i17.FixedRateMarket>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i17.FixedRateMarket>>())) as _i7
|
||||
.Future<_i2.ChangeNowResponse<List<_i17.FixedRateMarket>>>);
|
||||
Future<_i2.ChangeNowResponse<List<_i18.FixedRateMarket>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i18.FixedRateMarket>>())) as _i7
|
||||
.Future<_i2.ChangeNowResponse<List<_i18.FixedRateMarket>>>);
|
||||
@override
|
||||
_i7.Future<_i2.ChangeNowResponse<_i10.ExchangeTransaction>>
|
||||
createStandardExchangeTransaction(
|
||||
|
@ -479,22 +507,22 @@ class MockChangeNow extends _i1.Mock implements _i12.ChangeNow {
|
|||
_FakeChangeNowResponse_0<_i10.ExchangeTransaction>())) as _i7
|
||||
.Future<_i2.ChangeNowResponse<_i10.ExchangeTransaction>>);
|
||||
@override
|
||||
_i7.Future<_i2.ChangeNowResponse<_i18.ExchangeTransactionStatus>>
|
||||
_i7.Future<_i2.ChangeNowResponse<_i19.ExchangeTransactionStatus>>
|
||||
getTransactionStatus({String? id, String? apiKey}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getTransactionStatus, [], {#id: id, #apiKey: apiKey}),
|
||||
returnValue:
|
||||
Future<_i2.ChangeNowResponse<_i18.ExchangeTransactionStatus>>.value(
|
||||
_FakeChangeNowResponse_0<_i18.ExchangeTransactionStatus>())) as _i7
|
||||
.Future<_i2.ChangeNowResponse<_i18.ExchangeTransactionStatus>>);
|
||||
Future<_i2.ChangeNowResponse<_i19.ExchangeTransactionStatus>>.value(
|
||||
_FakeChangeNowResponse_0<_i19.ExchangeTransactionStatus>())) as _i7
|
||||
.Future<_i2.ChangeNowResponse<_i19.ExchangeTransactionStatus>>);
|
||||
@override
|
||||
_i7.Future<_i2.ChangeNowResponse<List<_i19.AvailableFloatingRatePair>>>
|
||||
_i7.Future<_i2.ChangeNowResponse<List<_i20.AvailableFloatingRatePair>>>
|
||||
getAvailableFloatingRatePairs({bool? includePartners = false}) => (super
|
||||
.noSuchMethod(
|
||||
Invocation.method(#getAvailableFloatingRatePairs, [],
|
||||
{#includePartners: includePartners}),
|
||||
returnValue:
|
||||
Future<_i2.ChangeNowResponse<List<_i19.AvailableFloatingRatePair>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i19.AvailableFloatingRatePair>>())) as _i7
|
||||
.Future<_i2.ChangeNowResponse<List<_i19.AvailableFloatingRatePair>>>);
|
||||
Future<_i2.ChangeNowResponse<List<_i20.AvailableFloatingRatePair>>>.value(
|
||||
_FakeChangeNowResponse_0<List<_i20.AvailableFloatingRatePair>>())) as _i7
|
||||
.Future<_i2.ChangeNowResponse<List<_i20.AvailableFloatingRatePair>>>);
|
||||
}
|
||||
|
|
|
@ -483,6 +483,10 @@ class MockManager extends _i1.Mock implements _i12.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i9.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -373,6 +373,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i6.Future<int>);
|
||||
@override
|
||||
_i6.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i6.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -373,6 +373,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i6.Future<int>);
|
||||
@override
|
||||
_i6.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i6.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -373,6 +373,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i6.Future<int>);
|
||||
@override
|
||||
_i6.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i6.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -248,6 +248,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -371,6 +371,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i6.Future<int>);
|
||||
@override
|
||||
_i6.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i6.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -483,6 +483,10 @@ class MockManager extends _i1.Mock implements _i12.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i9.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -399,6 +399,10 @@ class MockManager extends _i1.Mock implements _i12.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
_i8.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i8.Future<bool>);
|
||||
@override
|
||||
void addListener(_i11.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -248,6 +248,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -248,6 +248,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -360,6 +360,10 @@ class MockManager extends _i1.Mock implements _i11.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
_i8.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i8.Future<bool>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -360,6 +360,10 @@ class MockManager extends _i1.Mock implements _i11.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
_i8.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i8.Future<bool>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -248,6 +248,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -248,6 +248,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -371,6 +371,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i6.Future<int>);
|
||||
@override
|
||||
_i6.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i6.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -527,6 +527,10 @@ class MockManager extends _i1.Mock implements _i15.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
_i8.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i8.Future<bool>);
|
||||
@override
|
||||
void addListener(_i14.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -371,6 +371,10 @@ class MockManager extends _i1.Mock implements _i9.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i6.Future<int>);
|
||||
@override
|
||||
_i6.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i6.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -250,6 +250,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -249,6 +249,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -248,6 +248,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -270,6 +270,10 @@ class MockManager extends _i1.Mock implements _i8.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -250,6 +250,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
|
@ -232,6 +232,22 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
super.noSuchMethod(Invocation.method(#stopNetworkAlivePinging, []),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
_i8.Future<Map<String, dynamic>> prepareSendPublic(
|
||||
{String? address, int? satoshiAmount, Map<String, dynamic>? args}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#prepareSendPublic, [], {
|
||||
#address: address,
|
||||
#satoshiAmount: satoshiAmount,
|
||||
#args: args
|
||||
}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i8.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i8.Future<String> confirmSendPublic({dynamic txData}) => (super.noSuchMethod(
|
||||
Invocation.method(#confirmSendPublic, [], {#txData: txData}),
|
||||
returnValue: Future<String>.value('')) as _i8.Future<String>);
|
||||
@override
|
||||
_i8.Future<Map<String, dynamic>> prepareSend(
|
||||
{String? address, int? satoshiAmount, Map<String, dynamic>? args}) =>
|
||||
(super.noSuchMethod(
|
||||
|
@ -257,6 +273,47 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
#send, [], {#toAddress: toAddress, #amount: amount, #args: args}),
|
||||
returnValue: Future<String>.value('')) as _i8.Future<String>);
|
||||
@override
|
||||
int estimateTxFee({int? vSize, int? feeRatePerKB}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#estimateTxFee, [], {#vSize: vSize, #feeRatePerKB: feeRatePerKB}),
|
||||
returnValue: 0) as int);
|
||||
@override
|
||||
dynamic coinSelection(int? satoshiAmountToSend, int? selectedTxFeeRate,
|
||||
String? _recipientAddress, bool? isSendAll,
|
||||
{int? additionalOutputs = 0, List<_i4.UtxoObject>? utxos}) =>
|
||||
super.noSuchMethod(Invocation.method(#coinSelection, [
|
||||
satoshiAmountToSend,
|
||||
selectedTxFeeRate,
|
||||
_recipientAddress,
|
||||
isSendAll
|
||||
], {
|
||||
#additionalOutputs: additionalOutputs,
|
||||
#utxos: utxos
|
||||
}));
|
||||
@override
|
||||
_i8.Future<Map<String, dynamic>> fetchBuildTxData(
|
||||
List<_i4.UtxoObject>? utxosToUse) =>
|
||||
(super.noSuchMethod(Invocation.method(#fetchBuildTxData, [utxosToUse]),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i8.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i8.Future<Map<String, dynamic>> buildTransaction(
|
||||
{List<_i4.UtxoObject>? utxosToUse,
|
||||
Map<String, dynamic>? utxoSigningData,
|
||||
List<String>? recipients,
|
||||
List<int>? satoshiAmounts}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#buildTransaction, [], {
|
||||
#utxosToUse: utxosToUse,
|
||||
#utxoSigningData: utxoSigningData,
|
||||
#recipients: recipients,
|
||||
#satoshiAmounts: satoshiAmounts
|
||||
}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i8.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i8.Future<void> updateNode(bool? shouldRefresh) =>
|
||||
(super.noSuchMethod(Invocation.method(#updateNode, [shouldRefresh]),
|
||||
returnValue: Future<void>.value(),
|
||||
|
@ -293,8 +350,8 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
returnValue: <Map<dynamic, _i10.LelantusCoin>>[])
|
||||
as List<Map<dynamic, _i10.LelantusCoin>>);
|
||||
@override
|
||||
_i8.Future<void> autoMint() =>
|
||||
(super.noSuchMethod(Invocation.method(#autoMint, []),
|
||||
_i8.Future<void> anonymizeAllPublicFunds() =>
|
||||
(super.noSuchMethod(Invocation.method(#anonymizeAllPublicFunds, []),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i8.Future<void>);
|
||||
@override
|
||||
|
@ -325,6 +382,11 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i8.Future<void>);
|
||||
@override
|
||||
_i8.Future<void> checkChangeAddressForTransactions() => (super.noSuchMethod(
|
||||
Invocation.method(#checkChangeAddressForTransactions, []),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i8.Future<void>);
|
||||
@override
|
||||
_i8.Future<void> fillAddresses(String? suppliedMnemonic,
|
||||
{int? perBatch = 50, int? numberOfThreads = 4}) =>
|
||||
(super.noSuchMethod(
|
||||
|
@ -367,6 +429,11 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i8.Future<void>);
|
||||
@override
|
||||
_i8.Future<Map<int, dynamic>> getSetDataMap(int? latestSetId) =>
|
||||
(super.noSuchMethod(Invocation.method(#getSetDataMap, [latestSetId]),
|
||||
returnValue: Future<Map<int, dynamic>>.value(<int, dynamic>{}))
|
||||
as _i8.Future<Map<int, dynamic>>);
|
||||
@override
|
||||
_i8.Future<List<Map<String, dynamic>>> fetchAnonymitySets() =>
|
||||
(super.noSuchMethod(Invocation.method(#fetchAnonymitySets, []),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
|
@ -387,11 +454,11 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
returnValueForMissingStub: Future<void>.value()) as _i8.Future<void>);
|
||||
@override
|
||||
_i8.Future<dynamic> getCoinsToJoinSplit(int? required) =>
|
||||
(super.noSuchMethod(Invocation.method(#GetCoinsToJoinSplit, [required]),
|
||||
(super.noSuchMethod(Invocation.method(#getCoinsToJoinSplit, [required]),
|
||||
returnValue: Future<dynamic>.value()) as _i8.Future<dynamic>);
|
||||
@override
|
||||
_i8.Future<int> estimateJoinSplitFee(int? spendAmount) => (super.noSuchMethod(
|
||||
Invocation.method(#EstimateJoinSplitFee, [spendAmount]),
|
||||
Invocation.method(#estimateJoinSplitFee, [spendAmount]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
_i8.Future<int> estimateFeeFor(int? satoshiAmount, int? feeRate) =>
|
||||
|
@ -399,6 +466,27 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
_i8.Future<int> estimateFeeForPublic(int? satoshiAmount, int? feeRate) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#estimateFeeForPublic, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i8.Future<int>);
|
||||
@override
|
||||
int roughFeeEstimate(int? inputCount, int? outputCount, int? feeRatePerKB) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#roughFeeEstimate, [inputCount, outputCount, feeRatePerKB]),
|
||||
returnValue: 0) as int);
|
||||
@override
|
||||
int sweepAllEstimate(int? feeRate) =>
|
||||
(super.noSuchMethod(Invocation.method(#sweepAllEstimate, [feeRate]),
|
||||
returnValue: 0) as int);
|
||||
@override
|
||||
_i8.Future<List<Map<String, dynamic>>> fastFetch(List<String>? allTxHashes) =>
|
||||
(super.noSuchMethod(Invocation.method(#fastFetch, [allTxHashes]),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
<Map<String, dynamic>>[]))
|
||||
as _i8.Future<List<Map<String, dynamic>>>);
|
||||
@override
|
||||
_i8.Future<List<_i4.Transaction>> getJMintTransactions(
|
||||
_i6.CachedElectrumX? cachedClient,
|
||||
List<String>? transactions,
|
||||
|
@ -418,6 +506,20 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
|
|||
returnValue:
|
||||
Future<List<_i4.Transaction>>.value(<_i4.Transaction>[]))
|
||||
as _i8.Future<List<_i4.Transaction>>);
|
||||
@override
|
||||
_i8.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i8.Future<bool>);
|
||||
@override
|
||||
_i8.Future<_i3.Decimal> availablePrivateBalance() =>
|
||||
(super.noSuchMethod(Invocation.method(#availablePrivateBalance, []),
|
||||
returnValue: Future<_i3.Decimal>.value(_FakeDecimal_1()))
|
||||
as _i8.Future<_i3.Decimal>);
|
||||
@override
|
||||
_i8.Future<_i3.Decimal> availablePublicBalance() =>
|
||||
(super.noSuchMethod(Invocation.method(#availablePublicBalance, []),
|
||||
returnValue: Future<_i3.Decimal>.value(_FakeDecimal_1()))
|
||||
as _i8.Future<_i3.Decimal>);
|
||||
}
|
||||
|
||||
/// A class which mocks [ElectrumX].
|
||||
|
|
|
@ -250,6 +250,10 @@ class MockManager extends _i1.Mock implements _i5.Manager {
|
|||
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<bool> generateNewAddress() =>
|
||||
(super.noSuchMethod(Invocation.method(#generateNewAddress, []),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
|
Loading…
Reference in a new issue