mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
add stop fn to interface and refactor fusion obj to be an instance var
This commit is contained in:
parent
e1ee2ed28d
commit
e9f00582d8
1 changed files with 14 additions and 3 deletions
|
@ -124,6 +124,9 @@ mixin FusionWalletInterface {
|
|||
late final CachedElectrumX Function() _getWalletCachedElectrumX;
|
||||
late final Future<int> Function() _getChainHeight;
|
||||
|
||||
// Fusion object.
|
||||
fusion.Fusion? _mainFusionObject;
|
||||
|
||||
/// Initializes the FusionWalletInterface mixin.
|
||||
///
|
||||
/// This function must be called before any other functions in this mixin.
|
||||
|
@ -410,10 +413,10 @@ mixin FusionWalletInterface {
|
|||
);
|
||||
|
||||
// Instantiate a Fusion object with custom parameters.
|
||||
final mainFusionObject = fusion.Fusion(serverParams);
|
||||
_mainFusionObject = fusion.Fusion(serverParams);
|
||||
|
||||
// Pass wallet functions to the Fusion object
|
||||
await mainFusionObject.initFusion(
|
||||
await _mainFusionObject!.initFusion(
|
||||
getTransactionsByAddress: _getTransactionsByAddress,
|
||||
getUnusedReservedChangeAddresses: _getUnusedReservedChangeAddresses,
|
||||
getSocksProxyAddress: _getSocksProxyAddress,
|
||||
|
@ -511,7 +514,7 @@ mixin FusionWalletInterface {
|
|||
}
|
||||
|
||||
// Fuse UTXOs.
|
||||
return await mainFusionObject.fuse(
|
||||
return await _mainFusionObject!.fuse(
|
||||
inputsFromWallet: coinList,
|
||||
network:
|
||||
_coin.isTestNet ? fusion.Utilities.testNet : fusion.Utilities.mainNet,
|
||||
|
@ -523,4 +526,12 @@ mixin FusionWalletInterface {
|
|||
throw UnimplementedError(
|
||||
"TODO refreshFusion eg look up number of fusion participants connected/coordinating");
|
||||
}
|
||||
|
||||
/// Stop the fusion process.
|
||||
///
|
||||
/// This function is called when the user taps the "Cancel" button in the UI
|
||||
/// or closes the fusion progress dialog.
|
||||
Future<void>? stop() {
|
||||
return _mainFusionObject?.stop();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue