@@ -17,6 +17,7 @@ import '../../../models/isar/models/blockchain_data/transaction.dart';
1717import '../../../models/isar/models/blockchain_data/v2/input_v2.dart' ;
1818import '../../../models/isar/models/blockchain_data/v2/output_v2.dart' ;
1919import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart' ;
20+ import '../../../models/mwc_slatepack_models.dart' ;
2021import '../../../models/mwcmqs_config_model.dart' ;
2122import '../../../models/node_model.dart' ;
2223import '../../../models/paymint/fee_object_model.dart' ;
@@ -26,7 +27,6 @@ import '../../../services/event_bus/events/global/node_connection_status_changed
2627import '../../../services/event_bus/events/global/refresh_percent_changed_event.dart' ;
2728import '../../../services/event_bus/events/global/wallet_sync_status_changed_event.dart' ;
2829import '../../../services/event_bus/global_event_bus.dart' ;
29- import '../../../models/mwc_slatepack_models.dart' ;
3030import '../../../utilities/amount/amount.dart' ;
3131import '../../../utilities/default_mwcmqs.dart' ;
3232import '../../../utilities/flutter_secure_storage_interface.dart' ;
@@ -76,34 +76,47 @@ class MimblewimblecoinWallet extends Bip39Wallet {
7676 key: '${walletId }_mwcmqsConfig' ,
7777 value: stringConfig,
7878 );
79-
79+
8080 // Restart MWCMQS listener with new configuration if wallet has a handle.
8181 try {
82- final handle = await secureStorageInterface.read (key: '${walletId }_wallet' );
82+ final handle = await secureStorageInterface.read (
83+ key: '${walletId }_wallet' ,
84+ );
8385 if (handle != null && handle.isNotEmpty) {
8486 await stopSlatepackListener ();
8587 await startSlatepackListener ();
86- Logging .instance.i ('Restarted MWCMQS listener with new config: $host :$port ' );
88+ Logging .instance.i (
89+ 'Restarted MWCMQS listener with new config: $host :$port ' ,
90+ );
8791 }
8892 } catch (e, s) {
89- Logging .instance.e ('Failed to restart MWCMQS listener after config update: $e \n $s ' );
93+ Logging .instance.e (
94+ 'Failed to restart MWCMQS listener after config update: $e \n $s ' ,
95+ );
9096 }
9197 }
9298
9399 Future <String > _ensureWalletOpen () async {
94- final existing = await secureStorageInterface.read (key: '${walletId }_wallet' );
100+ final existing = await secureStorageInterface.read (
101+ key: '${walletId }_wallet' ,
102+ );
95103 if (existing != null && existing.isNotEmpty) return existing;
96104
97105 final config = await _getRealConfig ();
98- final password = await secureStorageInterface.read (key: '${walletId }_password' );
106+ final password = await secureStorageInterface.read (
107+ key: '${walletId }_password' ,
108+ );
99109 if (password == null ) {
100110 throw Exception ('Wallet password not found' );
101111 }
102112 final opened = await mimblewimblecoin.Libmwc .openWallet (
103113 config: config,
104114 password: password,
105115 );
106- await secureStorageInterface.write (key: '${walletId }_wallet' , value: opened);
116+ await secureStorageInterface.write (
117+ key: '${walletId }_wallet' ,
118+ value: opened,
119+ );
107120 return opened;
108121 }
109122
@@ -133,15 +146,13 @@ class MimblewimblecoinWallet extends Bip39Wallet {
133146
134147 if (customConfigJson != null ) {
135148 try {
136- final customConfig = jsonDecode (customConfigJson) as Map <String , dynamic >;
149+ final customConfig =
150+ jsonDecode (customConfigJson) as Map <String , dynamic >;
137151 final host = customConfig['mwcmqs_domain' ] as String ? ;
138152 final port = customConfig['mwcmqs_port' ] as int ? ;
139-
153+
140154 if (host != null && port != null ) {
141- return MwcMqsConfigModel (
142- host: host,
143- port: port,
144- );
155+ return MwcMqsConfigModel (host: host, port: port);
145156 }
146157 } catch (e) {
147158 Logging .instance.w ('Failed to parse custom MWCMQS config: $e ' );
@@ -199,13 +210,18 @@ class MimblewimblecoinWallet extends Bip39Wallet {
199210 /// Decode a slatepack.
200211 Future <SlatepackDecodeResult > decodeSlatepack (String slatepack) async {
201212 try {
202- final handle = await secureStorageInterface.read (key: '${walletId }_wallet' );
203- final result = handle != null
204- ? await mimblewimblecoin.Libmwc .decodeSlatepackWithWallet (
205- wallet: handle,
206- slatepack: slatepack,
207- )
208- : await mimblewimblecoin.Libmwc .decodeSlatepack (slatepack: slatepack);
213+ final handle = await secureStorageInterface.read (
214+ key: '${walletId }_wallet' ,
215+ );
216+ final result =
217+ handle != null
218+ ? await mimblewimblecoin.Libmwc .decodeSlatepackWithWallet (
219+ wallet: handle,
220+ slatepack: slatepack,
221+ )
222+ : await mimblewimblecoin.Libmwc .decodeSlatepack (
223+ slatepack: slatepack,
224+ );
209225
210226 return SlatepackDecodeResult (
211227 success: true ,
@@ -292,7 +308,9 @@ class MimblewimblecoinWallet extends Bip39Wallet {
292308 try {
293309 await _ensureWalletOpen ();
294310 final mwcmqsConfig = await getMwcMqsConfig ();
295- final wallet = await secureStorageInterface.read (key: '${walletId }_wallet' );
311+ final wallet = await secureStorageInterface.read (
312+ key: '${walletId }_wallet' ,
313+ );
296314 mimblewimblecoin.Libmwc .startMwcMqsListener (
297315 wallet: wallet! ,
298316 mwcmqsConfig: mwcmqsConfig.toString (),
@@ -798,7 +816,6 @@ class MimblewimblecoinWallet extends Bip39Wallet {
798816
799817 @override
800818 Future <void > init ({bool ? isRestore}) async {
801-
802819 if (isRestore != true ) {
803820 String ? encodedWallet = await secureStorageInterface.read (
804821 key: "${walletId }_wallet" ,
0 commit comments