feed in getChainHeight stub

This commit is contained in:
sneurlax 2023-09-28 11:05:06 -05:00
parent 06760cff3d
commit 6a2df4a76e
2 changed files with 20 additions and 1 deletions

@ -1 +1 @@
Subproject commit 7683f610e0a1ce3f4e68d2be609b667c80381379 Subproject commit 3d89074c6a4852d1b92dc837b23e571d9ca9698c

View file

@ -34,6 +34,7 @@ mixin FusionWalletInterface {
late final Future<int> Function({ late final Future<int> Function({
required String address, required String address,
}) _getTxCountForAddress; }) _getTxCountForAddress;
late final Future<int> Function() _getChainHeight;
/// Initializes the FusionWalletInterface mixin. /// Initializes the FusionWalletInterface mixin.
/// ///
@ -49,6 +50,7 @@ mixin FusionWalletInterface {
required Future<int> Function({ required Future<int> Function({
required String address, required String address,
}) getTxCountForAddress, }) getTxCountForAddress,
required Future<int> Function() getChainHeight,
}) async { }) async {
// Set passed in wallet data. // Set passed in wallet data.
_walletId = walletId; _walletId = walletId;
@ -58,6 +60,7 @@ mixin FusionWalletInterface {
_torService = FusionTorService.sharedInstance; _torService = FusionTorService.sharedInstance;
_getWalletCachedElectrumX = getWalletCachedElectrumX; _getWalletCachedElectrumX = getWalletCachedElectrumX;
_getTxCountForAddress = getTxCountForAddress; _getTxCountForAddress = getTxCountForAddress;
_getChainHeight = getChainHeight;
} }
/// Returns a list of all addresses in the wallet. /// Returns a list of all addresses in the wallet.
@ -197,6 +200,21 @@ mixin FusionWalletInterface {
} }
} }
/// Returns the current chain height.
///
/// This function is used by FusionDart to determine if a transaction is
/// confirmed or not.
///
/// Returns:
/// A `Future<int>` that resolves to the current chain height.
///
/// Throws:
/// An `Exception` if the chain height cannot be determined.
Future<int> getChainHeight() async {
throw UnimplementedError(
"TODO getChainHeight eg look up chain height from electrumx");
}
// Initial attempt for CashFusion integration goes here. // Initial attempt for CashFusion integration goes here.
/// Fuse the wallet's UTXOs. /// Fuse the wallet's UTXOs.
@ -217,6 +235,7 @@ mixin FusionWalletInterface {
/*createNewReservedChangeAddress: createNewReservedChangeAddress,*/ /*createNewReservedChangeAddress: createNewReservedChangeAddress,*/
getUnusedReservedChangeAddresses: getUnusedReservedChangeAddresses, getUnusedReservedChangeAddresses: getUnusedReservedChangeAddresses,
getSocksProxyAddress: getSocksProxyAddress, getSocksProxyAddress: getSocksProxyAddress,
getChainHeight: getChainHeight,
); );
// Add stack UTXOs. // Add stack UTXOs.