diff --git a/pubspec.lock b/pubspec.lock index e4b66315c..137456c93 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1046,8 +1046,8 @@ packages: dependency: "direct main" description: path: "." - ref: "5722fb3ba05c8f52e8e0255c485ae5ea52e9a694" - resolved-ref: "5722fb3ba05c8f52e8e0255c485ae5ea52e9a694" + ref: "d4852f3ebaaef20d71a8954098634af8e25c3b50" + resolved-ref: "d4852f3ebaaef20d71a8954098634af8e25c3b50" url: "https://github.com/cypherstack/flutter_libmwc.git" source: git version: "0.1.0" diff --git a/scripts/app_config/templates/pubspec.template.yaml b/scripts/app_config/templates/pubspec.template.yaml index 3761771c1..7ff892fc3 100644 --- a/scripts/app_config/templates/pubspec.template.yaml +++ b/scripts/app_config/templates/pubspec.template.yaml @@ -61,7 +61,7 @@ dependencies: # flutter_libmwc: # git: # url: https://github.com/cypherstack/flutter_libmwc.git -# ref: 5722fb3ba05c8f52e8e0255c485ae5ea52e9a694 +# ref: d4852f3ebaaef20d71a8954098634af8e25c3b50 # %%END_ENABLE_MWC%% # %%ENABLE_TOR%% diff --git a/tool/native_dependency_compatibility.json b/tool/native_dependency_compatibility.json index 7fab35059..2a4bbaf57 100644 --- a/tool/native_dependency_compatibility.json +++ b/tool/native_dependency_compatibility.json @@ -4,6 +4,6 @@ "f7fea2a926ea88e2eb6a353579372188d6915314": { "version": "27.0", "build": "27A266a" }, "6e954a9d5a0aaaafb861049b79041d7ae98c2a08": { "version": "27.0", "build": "27A266a" }, "63e93b01c3c4c68a52b26a43e4442a4738d5e7e8": { "version": "27.0", "build": "27A266a" }, - "5722fb3ba05c8f52e8e0255c485ae5ea52e9a694": { "version": "27.0", "build": "27A266a" } + "d4852f3ebaaef20d71a8954098634af8e25c3b50": { "version": "27.0", "build": "27A266a" } } } diff --git a/tool/wl_templates/MWC_libmwc_interface_impl.template.dart b/tool/wl_templates/MWC_libmwc_interface_impl.template.dart index 01dc5c123..5e87fff63 100644 --- a/tool/wl_templates/MWC_libmwc_interface_impl.template.dart +++ b/tool/wl_templates/MWC_libmwc_interface_impl.template.dart @@ -1,8 +1,11 @@ //ON +import 'dart:async'; + import 'package:flutter_libmwc/lib.dart' as mimblewimblecoin; import 'package:flutter_libmwc/models/transaction.dart' as mimblewimblecoin_models; +import '../../utilities/logger.dart'; //END_ON import '../interfaces/libmwc_interface.dart'; @@ -261,26 +264,45 @@ final class _LibMwcInterfaceImpl extends LibMwcInterface { required String wallet, required String mwcmqsConfig, }) { - return mimblewimblecoin.Libmwc.startMwcMqsListener( - wallet: wallet, - mwcmqsConfig: mwcmqsConfig, + // The plugin's start is asynchronous and throws when the listener cannot + // start. Callers treat this as fire and forget, so log the failure. + unawaited( + mimblewimblecoin.Libmwc.startMwcMqsListener( + wallet: wallet, + mwcmqsConfig: mwcmqsConfig, + ).then( + (_) {}, + onError: (Object e, StackTrace s) => + Logging.instance.e('Failed to start MWCMQS listener: $e\n$s'), + ), ); } @override void stopMwcMqsListener() { - return mimblewimblecoin.Libmwc.stopMwcMqsListener(); + // The plugin stops only the listener of the wallet passed to it; this + // interface stops whichever listener is running. + final owner = mimblewimblecoin.ListenerManager.wallet; + if (owner == null) return; + unawaited( + mimblewimblecoin.Libmwc.stopMwcMqsListener(wallet: owner).then( + (_) {}, + onError: (Object e, StackTrace s) => + Logging.instance.e('Failed to stop MWCMQS listener: $e\n$s'), + ), + ); } @override Future<({String commitId, String slateId})> txFinalize({ required String wallet, required String slateJson, - }) { - return mimblewimblecoin.Libmwc.txFinalize( + }) async { + final result = await mimblewimblecoin.Libmwc.txFinalize( wallet: wallet, slateJson: slateJson, ); + return (commitId: result.commitId, slateId: result.slateId); } @override