Skip to content

Commit ac98e9b

Browse files
committed
serialize cache to json
1 parent b576312 commit ac98e9b

9 files changed

Lines changed: 453 additions & 9 deletions

File tree

impls/monero.dart/lib/monero.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3604,6 +3604,17 @@ void Wallet_setLedgerCallback(Pointer<NativeFunction<Void Function(Pointer<Unsig
36043604
return ret;
36053605
}
36063606

3607+
@Deprecated("TODO")
3608+
String MONERO_Wallet_serializeCacheToJson(wallet ptr) {
3609+
debugStart?.call('MONERO_Wallet_serializeCacheToJson');
3610+
lib ??= MoneroC(DynamicLibrary.open(libPath));
3611+
final ret = lib!.MONERO_Wallet_serializeCacheToJson(ptr);
3612+
final str = ret.cast<Utf8>().toDartString();
3613+
MONERO_free(ret.cast());
3614+
debugEnd?.call('MONERO_Wallet_serializeCacheToJson');
3615+
return str;
3616+
}
3617+
36073618
// WalletManager
36083619
@Deprecated("TODO")
36093620
typedef WalletManager = Pointer<Void>;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// ignore_for_file: constant_identifier_names
2-
const String wallet2_api_c_h_sha256 = "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84";
3-
const String wallet2_api_c_cpp_sha256 = "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
4-
const String wallet2_api_c_exp_sha256 = "b2f2355242f9ad852ccf860a60a5c7a74054f9450ba1fbf9c0f42c58dbfdee9d";
2+
const String wallet2_api_c_h_sha256 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
3+
const String wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
4+
const String wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";

impls/monero.dart/lib/src/generated_bindings_monero.g.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,6 +4488,22 @@ class MoneroC {
44884488
ffi.Void Function(ffi.Pointer<ffi.UnsignedChar> command,
44894489
ffi.UnsignedInt cmd_len)>>)>();
44904490

4491+
ffi.Pointer<ffi.Char> MONERO_Wallet_serializeCacheToJson(
4492+
ffi.Pointer<ffi.Void> wallet_ptr,
4493+
) {
4494+
return _MONERO_Wallet_serializeCacheToJson(
4495+
wallet_ptr,
4496+
);
4497+
}
4498+
4499+
late final _MONERO_Wallet_serializeCacheToJsonPtr = _lookup<
4500+
ffi.NativeFunction<
4501+
ffi.Pointer<ffi.Char> Function(
4502+
ffi.Pointer<ffi.Void>)>>('MONERO_Wallet_serializeCacheToJson');
4503+
late final _MONERO_Wallet_serializeCacheToJson =
4504+
_MONERO_Wallet_serializeCacheToJsonPtr.asFunction<
4505+
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
4506+
44914507
ffi.Pointer<ffi.Void> MONERO_WalletManager_createWallet(
44924508
ffi.Pointer<ffi.Void> wm_ptr,
44934509
ffi.Pointer<ffi.Char> path,

impls/monero.ts/checksum_monero.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const moneroChecksum = {
2-
wallet2_api_c_h_sha256: "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84",
3-
wallet2_api_c_cpp_sha256: "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe",
4-
wallet2_api_c_exp_sha256: "b2f2355242f9ad852ccf860a60a5c7a74054f9450ba1fbf9c0f42c58dbfdee9d",
2+
wallet2_api_c_h_sha256: "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235",
3+
wallet2_api_c_cpp_sha256: "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe",
4+
wallet2_api_c_exp_sha256: "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce",
55
}

monero_libwallet2_api_c/monero_libwallet2_api_c.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ _MONERO_DeviceProgress_progress
123123
_MONERO_DeviceProgress_indeterminate
124124
_MONERO_Wallet_seed
125125
_MONERO_Wallet_setLedgerCallback
126+
_MONERO_Wallet_serializeCacheToJson
126127
_MONERO_Wallet_getSeedLanguage
127128
_MONERO_Wallet_setSeedLanguage
128129
_MONERO_Wallet_status
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef MONEROC_CHECKSUMS
22
#define MONEROC_CHECKSUMS
3-
const char * MONERO_wallet2_api_c_h_sha256 = "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84";
4-
const char * MONERO_wallet2_api_c_cpp_sha256 = "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
5-
const char * MONERO_wallet2_api_c_exp_sha256 = "b2f2355242f9ad852ccf860a60a5c7a74054f9450ba1fbf9c0f42c58dbfdee9d";
3+
const char * MONERO_wallet2_api_c_h_sha256 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
4+
const char * MONERO_wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
5+
const char * MONERO_wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";
66
#endif

monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,6 +2162,14 @@ void MONERO_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *c
21622162
DEBUG_END()
21632163
}
21642164

2165+
const char* MONERO_Wallet_serializeCacheToJson(void* wallet_ptr) {
2166+
DEBUG_START()
2167+
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
2168+
std::string result = wallet->serializeCacheToJson();
2169+
return strdup(result.c_str());
2170+
DEBUG_END()
2171+
}
2172+
21652173
void* MONERO_WalletManager_createWallet(void* wm_ptr, const char* path, const char* password, const char* language, int networkType) {
21662174
DEBUG_START()
21672175
Monero::WalletManager *wm = reinterpret_cast<Monero::WalletManager*>(wm_ptr);

monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceReceive();
842842
extern ADDAPI void MONERO_Wallet_setDeviceReceivedData(unsigned char* data, size_t len);
843843
extern ADDAPI void MONERO_Wallet_setDeviceSendData(unsigned char* data, size_t len);
844844
extern ADDAPI void MONERO_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
845+
extern ADDAPI const char* MONERO_Wallet_serializeCacheToJson(void* wallet_ptr);
845846
// };
846847

847848
// struct WalletManager

0 commit comments

Comments
 (0)