do int.parse inside scanOutputs, add import for badHttpAddress

This commit is contained in:
ryleedavis 2023-10-06 16:36:21 -06:00
parent 410e0fbb1e
commit 848d45ad72
3 changed files with 25 additions and 26 deletions

View file

@ -26,7 +26,6 @@ import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart'; import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart';
import 'package:stackwallet/route_generator.dart'; import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart'; import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
@ -37,6 +36,7 @@ import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/example/libepiccash.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart'; import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
@ -89,11 +89,9 @@ class _ConfirmTransactionViewState
late final FocusNode _noteFocusNode; late final FocusNode _noteFocusNode;
late final TextEditingController noteController; late final TextEditingController noteController;
late final FocusNode _onChainNoteFocusNode; late final FocusNode _onChainNoteFocusNode;
late final TextEditingController onChainNoteController; late final TextEditingController onChainNoteController;
Future<void> _attemptSend(BuildContext context) async { Future<void> _attemptSend(BuildContext context) async {
final manager = final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId); ref.read(walletsChangeNotifierProvider).getManager(walletId);
@ -283,7 +281,8 @@ class _ConfirmTransactionViewState
_onChainNoteFocusNode = FocusNode(); _onChainNoteFocusNode = FocusNode();
onChainNoteController = TextEditingController(); onChainNoteController = TextEditingController();
onChainNoteController.text = transactionInfo["onChainNote"] as String? ?? ""; onChainNoteController.text =
transactionInfo["onChainNote"] as String? ?? "";
super.initState(); super.initState();
} }
@ -885,23 +884,22 @@ class _ConfirmTransactionViewState
).copyWith( ).copyWith(
suffixIcon: onChainNoteController.text.isNotEmpty suffixIcon: onChainNoteController.text.isNotEmpty
? Padding( ? Padding(
padding: padding: const EdgeInsets.only(right: 0),
const EdgeInsets.only(right: 0), child: UnconstrainedBox(
child: UnconstrainedBox( child: Row(
child: Row( children: [
children: [ TextFieldIconButton(
TextFieldIconButton( child: const XIcon(),
child: const XIcon(), onTap: () async {
onTap: () async { setState(() {
setState(() { onChainNoteController.text = "";
onChainNoteController.text = ""; });
}); },
}, ),
],
),
), ),
], )
),
),
)
: null, : null,
), ),
), ),
@ -911,7 +909,8 @@ class _ConfirmTransactionViewState
height: 12, height: 12,
), ),
Text( Text(
(coin == Coin.epicCash) ? "Local Note (optional)" (coin == Coin.epicCash)
? "Local Note (optional)"
: "Note (optional)", : "Note (optional)",
style: style:
STextStyles.desktopTextExtraSmall(context).copyWith( STextStyles.desktopTextExtraSmall(context).copyWith(

View file

@ -788,11 +788,11 @@ class EpicCashWallet extends CoinServiceAPI
level: LogLevel.Info, level: LogLevel.Info,
); );
int nextScannedBlock = int.parse(await epiccash.LibEpiccash.scanOutputs( int nextScannedBlock = await epiccash.LibEpiccash.scanOutputs(
wallet: wallet!, wallet: wallet!,
startHeight: lastScannedBlock, startHeight: lastScannedBlock,
numberOfBlocks: scanChunkSize, numberOfBlocks: scanChunkSize,
)); );
// update local cache // update local cache
await epicUpdateLastScannedBlock(nextScannedBlock); await epicUpdateLastScannedBlock(nextScannedBlock);

View file

@ -179,12 +179,12 @@ abstract class LibEpiccash {
/// ///
/// Scan Epic outputs /// Scan Epic outputs
/// ///
static Future<String> scanOutputs({ static Future<int> scanOutputs({
required String wallet, required String wallet,
required int startHeight, required int startHeight,
required int numberOfBlocks, required int numberOfBlocks,
}) async { }) async {
return await m.protect(() async { return int.parse(await m.protect(() async {
try { try {
return await compute(_scanOutputsWrapper, ( return await compute(_scanOutputsWrapper, (
wallet: wallet, wallet: wallet,
@ -194,7 +194,7 @@ abstract class LibEpiccash {
} catch (e) { } catch (e) {
throw ("Error getting scanning outputs : ${e.toString()}"); throw ("Error getting scanning outputs : ${e.toString()}");
} }
}); }));
} }
/// ///