mirror of
https://github.com/MAGICGrants/flutter_libsparkmobile.git
synced 2026-01-09 21:17:56 -05:00
untested change to add serial context to coin before attempting to id it
This commit is contained in:
@@ -93,6 +93,7 @@ abstract final class LibSpark {
|
||||
final String serializedCoin, {
|
||||
required final String privateKeyHex,
|
||||
required final int index,
|
||||
required final Uint8List context,
|
||||
final bool isTestNet = false,
|
||||
}) {
|
||||
// take sublist as tx hash is also appended here for some reason
|
||||
@@ -101,17 +102,21 @@ abstract final class LibSpark {
|
||||
final serializedCoinPtr = b64CoinDecoded.unsignedCharPointer();
|
||||
final privateKeyPtr =
|
||||
privateKeyHex.to32BytesFromHex().unsignedCharPointer();
|
||||
final contextPtr = context.unsignedCharPointer();
|
||||
|
||||
final result = _bindings.idAndRecoverCoin(
|
||||
serializedCoinPtr,
|
||||
b64CoinDecoded.length,
|
||||
privateKeyPtr,
|
||||
index,
|
||||
contextPtr,
|
||||
context.length,
|
||||
isTestNet ? 1 : 0,
|
||||
);
|
||||
|
||||
malloc.free(serializedCoinPtr);
|
||||
malloc.free(privateKeyPtr);
|
||||
malloc.free(contextPtr);
|
||||
|
||||
if (result.address == nullptr.address) {
|
||||
return null;
|
||||
|
||||
@@ -59,6 +59,8 @@ class FlutterLibsparkmobileBindings {
|
||||
int serializedCoinLength,
|
||||
ffi.Pointer<ffi.UnsignedChar> keyData,
|
||||
int index,
|
||||
ffi.Pointer<ffi.UnsignedChar> context,
|
||||
int contextLength,
|
||||
int isTestNet,
|
||||
) {
|
||||
return _idAndRecoverCoin(
|
||||
@@ -66,6 +68,8 @@ class FlutterLibsparkmobileBindings {
|
||||
serializedCoinLength,
|
||||
keyData,
|
||||
index,
|
||||
context,
|
||||
contextLength,
|
||||
isTestNet,
|
||||
);
|
||||
}
|
||||
@@ -77,10 +81,18 @@ class FlutterLibsparkmobileBindings {
|
||||
ffi.Int,
|
||||
ffi.Pointer<ffi.UnsignedChar>,
|
||||
ffi.Int,
|
||||
ffi.Pointer<ffi.UnsignedChar>,
|
||||
ffi.Int,
|
||||
ffi.Int)>>('idAndRecoverCoin');
|
||||
late final _idAndRecoverCoin = _idAndRecoverCoinPtr.asFunction<
|
||||
ffi.Pointer<AggregateCoinData> Function(ffi.Pointer<ffi.UnsignedChar>,
|
||||
int, ffi.Pointer<ffi.UnsignedChar>, int, int)>();
|
||||
ffi.Pointer<AggregateCoinData> Function(
|
||||
ffi.Pointer<ffi.UnsignedChar>,
|
||||
int,
|
||||
ffi.Pointer<ffi.UnsignedChar>,
|
||||
int,
|
||||
ffi.Pointer<ffi.UnsignedChar>,
|
||||
int,
|
||||
int)>();
|
||||
|
||||
/// FFI-friendly wrapper for spark::createSparkMintRecipients.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user