cake_wallet/cw_mweb/lib/cw_mweb_method_channel.dart

33 lines
948 B
Dart
Raw Normal View History

2024-04-20 23:20:52 +00:00
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'cw_mweb_platform_interface.dart';
/// An implementation of [CwMwebPlatform] that uses method channels.
class MethodChannelCwMweb extends CwMwebPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('cw_mweb');
@override
2024-04-21 11:19:44 +00:00
Future<int?> start(String dataDir) async {
final result = await methodChannel.invokeMethod<int>('start', {'dataDir': dataDir});
2024-04-20 23:20:52 +00:00
return result;
}
@override
Future<void> stop() async {
await methodChannel.invokeMethod<void>('stop');
}
2024-09-04 22:50:56 +00:00
@override
2024-09-05 18:02:16 +00:00
Future<String?> address(Uint8List scanSecret, Uint8List spendPub, int index) async {
2024-09-04 22:50:56 +00:00
final result = await methodChannel.invokeMethod<String>('address', {
'scanSecret': scanSecret,
'spendPub': spendPub,
'index': index,
});
return result;
}
2024-04-20 23:20:52 +00:00
}