mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-15 16:12:16 +00:00
WIP mempool electrumx cals
This commit is contained in:
parent
debcb71d89
commit
3dac77b8d6
1 changed files with 59 additions and 0 deletions
|
@ -930,6 +930,7 @@ class ElectrumXClient {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: update when we get new call to include tx hashes in response
|
||||
/// Takes [startNumber], if it is 0, we get the full set,
|
||||
/// otherwise the used tags after that number
|
||||
Future<List<String>> getSparkUnhashedUsedCoinsTags({
|
||||
|
@ -1024,6 +1025,64 @@ class ElectrumXClient {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the txids of the current transactions found in the mempool
|
||||
Future<Set<String>> getMempoolTxids({
|
||||
String? requestID,
|
||||
}) async {
|
||||
try {
|
||||
final start = DateTime.now();
|
||||
final response = await request(
|
||||
requestID: requestID,
|
||||
command: "spark.getmempooltxids",
|
||||
);
|
||||
|
||||
// TODO verify once server is live
|
||||
final txids = List<String>.from(response as List).toSet();
|
||||
// final map = Map<String, dynamic>.from(response as Map);
|
||||
// final txids = List<String>.from(map["tags"] as List).toSet();
|
||||
|
||||
Logging.instance.log(
|
||||
"Finished ElectrumXClient.getMempoolTxids(). "
|
||||
"Duration=${DateTime.now().difference(start)}",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
|
||||
return txids;
|
||||
} catch (e) {
|
||||
Logging.instance.log(e, level: LogLevel.Error);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the txids of the current transactions found in the mempool
|
||||
Future<Map<String, dynamic>> getMempoolSparkData({
|
||||
String? requestID,
|
||||
required List<String> txids,
|
||||
}) async {
|
||||
try {
|
||||
final start = DateTime.now();
|
||||
final response = await request(
|
||||
requestID: requestID,
|
||||
command: "spark.getmempooltxs",
|
||||
args: txids,
|
||||
);
|
||||
|
||||
// TODO verify once server is live
|
||||
final map = Map<String, dynamic>.from(response as Map);
|
||||
|
||||
Logging.instance.log(
|
||||
"Finished ElectrumXClient.getMempoolSparkData(txids: $txids). "
|
||||
"Duration=${DateTime.now().difference(start)}",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
|
||||
return map;
|
||||
} catch (e) {
|
||||
Logging.instance.log(e, level: LogLevel.Error);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/// Get the current fee rate.
|
||||
|
|
Loading…
Reference in a new issue