fix spark anon set fetch using the reverse hex of the blockhash given to us by an earlier call of that same electrumx method

This commit is contained in:
julian 2024-05-30 15:09:26 -06:00
parent c7e7643fe5
commit d99231c973
2 changed files with 12 additions and 1 deletions

View file

@ -35,7 +35,7 @@ abstract class FiroCacheCoordinator {
final json = await client.getSparkAnonymitySet(
coinGroupId: groupId.toString(),
startBlockHash: blockHash,
startBlockHash: blockHash.toHexReversedFromBase64,
);
await _FiroCache._updateWith(json, groupId);

View file

@ -14,6 +14,7 @@ import 'dart:typed_data';
import 'package:dart_bs58/dart_bs58.dart';
import 'package:dart_bs58check/dart_bs58check.dart';
import 'package:hex/hex.dart';
import '../extensions.dart';
extension StringExtensions on String {
@ -27,4 +28,14 @@ extension StringExtensions on String {
Uint8List get toUint8ListFromBase58CheckEncoded => bs58check.decode(this);
BigInt get toBigIntFromHex => toUint8ListFromHex.toBigInt;
String get toHexFromBase64 => base64Decode(LineSplitter.split(this).join())
.map((e) => e.toRadixString(16).padLeft(2, '0'))
.join();
String get toHexReversedFromBase64 =>
base64Decode(LineSplitter.split(this).join())
.reversed
.map((e) => e.toRadixString(16).padLeft(2, '0'))
.join();
}