pass in a custom FusionParams from _serverTerm and _portTerm

This commit is contained in:
sneurlax 2023-10-16 14:46:45 -05:00
parent 9b9a7cbb28
commit 67cd3e5948
4 changed files with 19 additions and 6 deletions

@ -1 +1 @@
Subproject commit d371eb2643493f78fa5583f1dc41d2c988bf9e28 Subproject commit 7ebd6daa321867acebcc6adb8107c1322c03f3e7

View file

@ -47,7 +47,6 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
String _serverTerm = ""; String _serverTerm = "";
String _portTerm = ""; String _portTerm = "";
int? port;
late bool enableSSLCheckbox; late bool enableSSLCheckbox;
FusionOption _option = FusionOption.continuous; FusionOption _option = FusionOption.continuous;
@ -265,7 +264,9 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
.read(walletsChangeNotifierProvider) .read(walletsChangeNotifierProvider)
.getManager(widget.walletId) .getManager(widget.walletId)
.wallet as FusionWalletInterface) .wallet as FusionWalletInterface)
.fuse() .fuse(
serverHost: _serverTerm,
serverPort: int.parse(_portTerm))
}, },
), ),
], ],

View file

@ -647,7 +647,9 @@ class _DesktopCashFusion extends ConsumerState<DesktopCashFusionView> {
} }
} }
unawaited(fusionWallet.fuse()); unawaited(fusionWallet.fuse(
serverHost: _serverTerm,
serverPort: int.parse(_portTerm)));
// unawaited(fusionWallet.stepThruUiStates()); // unawaited(fusionWallet.stepThruUiStates());
await showDialog<void>( await showDialog<void>(

View file

@ -292,9 +292,19 @@ mixin FusionWalletInterface {
/// Fuse the wallet's UTXOs. /// Fuse the wallet's UTXOs.
/// ///
/// This function is called when the user taps the "Fuse" button in the UI. /// This function is called when the user taps the "Fuse" button in the UI.
Future<void> fuse() async { Future<void> fuse(
{required String serverHost, required int serverPort}) async {
// Initial attempt for CashFusion integration goes here. // Initial attempt for CashFusion integration goes here.
final mainFusionObject = fusion.Fusion(fusion.FusionParams());
// Use server host and port which ultimately come from text fields.
// TODO validate.
fusion.FusionParams serverParams = fusion.FusionParams(
serverHost: serverHost,
serverPort: serverPort,
);
// Instantiate a Fusion object with custom parameters.
final mainFusionObject = fusion.Fusion(serverParams);
// Pass wallet functions to the Fusion object // Pass wallet functions to the Fusion object
await mainFusionObject.initFusion( await mainFusionObject.initFusion(