diff --git a/impls/monero.dart/lib/src/checksum_peya.dart b/impls/monero.dart/lib/src/checksum_peya.dart index cf54cda..6cbdb81 100644 --- a/impls/monero.dart/lib/src/checksum_peya.dart +++ b/impls/monero.dart/lib/src/checksum_peya.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names -const String wallet2_api_c_h_sha256 = "5ccccf76d6ce6a38985030ed89ff49c8d688b7920c38b85e6072bad415e5c28f"; -const String wallet2_api_c_cpp_sha256 = "cfbc7bcfb8f8066660a2b19225249d6cc44958272c7816676a32c8ec37fedbda-fd1126fa7b476ab887502f63dd3ee565da4145a0"; +const String wallet2_api_c_h_sha256 = "abfc67892fa12c69b7871ed5db0de819b7d6f1a270b2d9f3b0340d95e43bf8a7"; +const String wallet2_api_c_cpp_sha256 = "5aeae36dc0d58a38d1ac61fc027c3c3f10f4331284f27833fdd3146e12d010b5-cf5969b5dd96d78d5bcc8a2fe97c9e6522c781a5"; const String wallet2_api_c_exp_sha256 = "31b4f92a01ff4812c46e5978c0195f725fe93c87bcd8036391a12fe9d5774621"; diff --git a/impls/monero.dart/lib/src/generated_bindings_peya.g.dart b/impls/monero.dart/lib/src/generated_bindings_peya.g.dart index de96732..d5d35a2 100644 --- a/impls/monero.dart/lib/src/generated_bindings_peya.g.dart +++ b/impls/monero.dart/lib/src/generated_bindings_peya.g.dart @@ -4777,6 +4777,138 @@ class PeyaC { _PEYA_Wallet_serializeCacheToJsonPtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer PEYA_Wallet_getYieldInfoRaw( + ffi.Pointer wallet_ptr, + ) { + return _PEYA_Wallet_getYieldInfoRaw( + wallet_ptr, + ); + } + + late final _PEYA_Wallet_getYieldInfoRawPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('PEYA_Wallet_getYieldInfoRaw'); + late final _PEYA_Wallet_getYieldInfoRaw = _PEYA_Wallet_getYieldInfoRawPtr + .asFunction Function(ffi.Pointer)>(); + + int PEYA_YieldInfoRaw_count( + ffi.Pointer yieldInfoRaw_ptr, + ) { + return _PEYA_YieldInfoRaw_count( + yieldInfoRaw_ptr, + ); + } + + late final _PEYA_YieldInfoRaw_countPtr = + _lookup)>>( + 'PEYA_YieldInfoRaw_count'); + late final _PEYA_YieldInfoRaw_count = _PEYA_YieldInfoRaw_countPtr.asFunction< + int Function(ffi.Pointer)>(); + + int PEYA_YieldInfoRaw_blockHeight( + ffi.Pointer yieldInfoRaw_ptr, + int index, + ) { + return _PEYA_YieldInfoRaw_blockHeight( + yieldInfoRaw_ptr, + index, + ); + } + + late final _PEYA_YieldInfoRaw_blockHeightPtr = _lookup< + ffi + .NativeFunction, ffi.Int)>>( + 'PEYA_YieldInfoRaw_blockHeight'); + late final _PEYA_YieldInfoRaw_blockHeight = _PEYA_YieldInfoRaw_blockHeightPtr + .asFunction, int)>(); + + int PEYA_YieldInfoRaw_slippageTotalThisBlock( + ffi.Pointer yieldInfoRaw_ptr, + int index, + ) { + return _PEYA_YieldInfoRaw_slippageTotalThisBlock( + yieldInfoRaw_ptr, + index, + ); + } + + late final _PEYA_YieldInfoRaw_slippageTotalThisBlockPtr = _lookup< + ffi + .NativeFunction, ffi.Int)>>( + 'PEYA_YieldInfoRaw_slippageTotalThisBlock'); + late final _PEYA_YieldInfoRaw_slippageTotalThisBlock = + _PEYA_YieldInfoRaw_slippageTotalThisBlockPtr.asFunction< + int Function(ffi.Pointer, int)>(); + + int PEYA_YieldInfoRaw_lockedCoinsThisBlock( + ffi.Pointer yieldInfoRaw_ptr, + int index, + ) { + return _PEYA_YieldInfoRaw_lockedCoinsThisBlock( + yieldInfoRaw_ptr, + index, + ); + } + + late final _PEYA_YieldInfoRaw_lockedCoinsThisBlockPtr = _lookup< + ffi + .NativeFunction, ffi.Int)>>( + 'PEYA_YieldInfoRaw_lockedCoinsThisBlock'); + late final _PEYA_YieldInfoRaw_lockedCoinsThisBlock = + _PEYA_YieldInfoRaw_lockedCoinsThisBlockPtr.asFunction< + int Function(ffi.Pointer, int)>(); + + int PEYA_YieldInfoRaw_lockedCoinsTally( + ffi.Pointer yieldInfoRaw_ptr, + int index, + ) { + return _PEYA_YieldInfoRaw_lockedCoinsTally( + yieldInfoRaw_ptr, + index, + ); + } + + late final _PEYA_YieldInfoRaw_lockedCoinsTallyPtr = _lookup< + ffi + .NativeFunction, ffi.Int)>>( + 'PEYA_YieldInfoRaw_lockedCoinsTally'); + late final _PEYA_YieldInfoRaw_lockedCoinsTally = + _PEYA_YieldInfoRaw_lockedCoinsTallyPtr.asFunction< + int Function(ffi.Pointer, int)>(); + + int PEYA_YieldInfoRaw_networkHealthPercentage( + ffi.Pointer yieldInfoRaw_ptr, + int index, + ) { + return _PEYA_YieldInfoRaw_networkHealthPercentage( + yieldInfoRaw_ptr, + index, + ); + } + + late final _PEYA_YieldInfoRaw_networkHealthPercentagePtr = _lookup< + ffi + .NativeFunction, ffi.Int)>>( + 'PEYA_YieldInfoRaw_networkHealthPercentage'); + late final _PEYA_YieldInfoRaw_networkHealthPercentage = + _PEYA_YieldInfoRaw_networkHealthPercentagePtr.asFunction< + int Function(ffi.Pointer, int)>(); + + void PEYA_YieldInfoRaw_free( + ffi.Pointer yieldInfoRaw_ptr, + ) { + return _PEYA_YieldInfoRaw_free( + yieldInfoRaw_ptr, + ); + } + + late final _PEYA_YieldInfoRaw_freePtr = + _lookup)>>( + 'PEYA_YieldInfoRaw_free'); + late final _PEYA_YieldInfoRaw_free = _PEYA_YieldInfoRaw_freePtr.asFunction< + void Function(ffi.Pointer)>(); + ffi.Pointer PEYA_WalletManager_createWallet( ffi.Pointer wm_ptr, ffi.Pointer path, diff --git a/impls/monero.ts/checksum_peya.ts b/impls/monero.ts/checksum_peya.ts index 275b5e9..eceb168 100644 --- a/impls/monero.ts/checksum_peya.ts +++ b/impls/monero.ts/checksum_peya.ts @@ -1,5 +1,5 @@ export const peyaChecksum = { - wallet2_api_c_h_sha256: "5ccccf76d6ce6a38985030ed89ff49c8d688b7920c38b85e6072bad415e5c28f", - wallet2_api_c_cpp_sha256: "cfbc7bcfb8f8066660a2b19225249d6cc44958272c7816676a32c8ec37fedbda-fd1126fa7b476ab887502f63dd3ee565da4145a0", + wallet2_api_c_h_sha256: "abfc67892fa12c69b7871ed5db0de819b7d6f1a270b2d9f3b0340d95e43bf8a7", + wallet2_api_c_cpp_sha256: "5aeae36dc0d58a38d1ac61fc027c3c3f10f4331284f27833fdd3146e12d010b5-cf5969b5dd96d78d5bcc8a2fe97c9e6522c781a5", wallet2_api_c_exp_sha256: "31b4f92a01ff4812c46e5978c0195f725fe93c87bcd8036391a12fe9d5774621", } diff --git a/peya b/peya index fd1126f..cf5969b 160000 --- a/peya +++ b/peya @@ -1 +1 @@ -Subproject commit fd1126fa7b476ab887502f63dd3ee565da4145a0 +Subproject commit cf5969b5dd96d78d5bcc8a2fe97c9e6522c781a5 diff --git a/peya_libwallet2_api_c/CMakeLists.txt b/peya_libwallet2_api_c/CMakeLists.txt index 82b116c..21284cd 100644 --- a/peya_libwallet2_api_c/CMakeLists.txt +++ b/peya_libwallet2_api_c/CMakeLists.txt @@ -74,6 +74,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") set(MONERO_DIR ${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}) set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../contrib/depends/${HOST_ABI}) +include_directories(${MONERO_DIR}/src) if (${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11") set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" hidapi) diff --git a/peya_libwallet2_api_c/src/main/cpp/peya_checksum.h b/peya_libwallet2_api_c/src/main/cpp/peya_checksum.h index cfd96fd..56ac7cd 100644 --- a/peya_libwallet2_api_c/src/main/cpp/peya_checksum.h +++ b/peya_libwallet2_api_c/src/main/cpp/peya_checksum.h @@ -1,6 +1,6 @@ #ifndef MONEROC_CHECKSUMS #define MONEROC_CHECKSUMS -const char * PEYA_wallet2_api_c_h_sha256 = "5ccccf76d6ce6a38985030ed89ff49c8d688b7920c38b85e6072bad415e5c28f"; -const char * PEYA_wallet2_api_c_cpp_sha256 = "cfbc7bcfb8f8066660a2b19225249d6cc44958272c7816676a32c8ec37fedbda-fd1126fa7b476ab887502f63dd3ee565da4145a0"; +const char * PEYA_wallet2_api_c_h_sha256 = "abfc67892fa12c69b7871ed5db0de819b7d6f1a270b2d9f3b0340d95e43bf8a7"; +const char * PEYA_wallet2_api_c_cpp_sha256 = "5aeae36dc0d58a38d1ac61fc027c3c3f10f4331284f27833fdd3146e12d010b5-cf5969b5dd96d78d5bcc8a2fe97c9e6522c781a5"; const char * PEYA_wallet2_api_c_exp_sha256 = "31b4f92a01ff4812c46e5978c0195f725fe93c87bcd8036391a12fe9d5774621"; #endif diff --git a/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp index 9c135e7..18a9d64 100644 --- a/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp +++ b/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp @@ -4,7 +4,9 @@ #include "helpers.hpp" #include #include +#include #include "../../../../peya/src/wallet/api/wallet2_api.h" +#include "wallet/api/wallet.h" #include "peya_checksum.h" #ifdef __cplusplus @@ -2309,6 +2311,85 @@ const char* PEYA_Wallet_serializeCacheToJson(void* wallet_ptr) { return strdup(result.c_str()); DEBUG_END() } + +void* PEYA_Wallet_getYieldInfoRaw(void* wallet_ptr) { + DEBUG_START() + auto *wallet = reinterpret_cast(wallet_ptr); + auto *result = new std::vector(); + if (!wallet->getYieldInfoRaw(*result)) { + delete result; + return nullptr; + } + return reinterpret_cast(result); + DEBUG_END() +} + +int PEYA_YieldInfoRaw_count(void* yieldInfoRaw_ptr) { + DEBUG_START() + auto *yieldInfoRaw = reinterpret_cast*>(yieldInfoRaw_ptr); + if (yieldInfoRaw == nullptr) { + return 0; + } + return static_cast(yieldInfoRaw->size()); + DEBUG_END() +} + +uint64_t PEYA_YieldInfoRaw_blockHeight(void* yieldInfoRaw_ptr, int index) { + DEBUG_START() + auto *yieldInfoRaw = reinterpret_cast*>(yieldInfoRaw_ptr); + if (yieldInfoRaw == nullptr || index < 0 || static_cast(index) >= yieldInfoRaw->size()) { + return 0; + } + return (*yieldInfoRaw)[index].block_height; + DEBUG_END() +} + +uint64_t PEYA_YieldInfoRaw_slippageTotalThisBlock(void* yieldInfoRaw_ptr, int index) { + DEBUG_START() + auto *yieldInfoRaw = reinterpret_cast*>(yieldInfoRaw_ptr); + if (yieldInfoRaw == nullptr || index < 0 || static_cast(index) >= yieldInfoRaw->size()) { + return 0; + } + return (*yieldInfoRaw)[index].slippage_total_this_block; + DEBUG_END() +} + +uint64_t PEYA_YieldInfoRaw_lockedCoinsThisBlock(void* yieldInfoRaw_ptr, int index) { + DEBUG_START() + auto *yieldInfoRaw = reinterpret_cast*>(yieldInfoRaw_ptr); + if (yieldInfoRaw == nullptr || index < 0 || static_cast(index) >= yieldInfoRaw->size()) { + return 0; + } + return (*yieldInfoRaw)[index].locked_coins_this_block; + DEBUG_END() +} + +uint64_t PEYA_YieldInfoRaw_lockedCoinsTally(void* yieldInfoRaw_ptr, int index) { + DEBUG_START() + auto *yieldInfoRaw = reinterpret_cast*>(yieldInfoRaw_ptr); + if (yieldInfoRaw == nullptr || index < 0 || static_cast(index) >= yieldInfoRaw->size()) { + return 0; + } + return (*yieldInfoRaw)[index].locked_coins_tally; + DEBUG_END() +} + +uint8_t PEYA_YieldInfoRaw_networkHealthPercentage(void* yieldInfoRaw_ptr, int index) { + DEBUG_START() + auto *yieldInfoRaw = reinterpret_cast*>(yieldInfoRaw_ptr); + if (yieldInfoRaw == nullptr || index < 0 || static_cast(index) >= yieldInfoRaw->size()) { + return 0; + } + return (*yieldInfoRaw)[index].network_health_percentage; + DEBUG_END() +} + +void PEYA_YieldInfoRaw_free(void* yieldInfoRaw_ptr) { + DEBUG_START() + auto *yieldInfoRaw = reinterpret_cast*>(yieldInfoRaw_ptr); + delete yieldInfoRaw; + DEBUG_END() +} void* PEYA_WalletManager_createWallet(void* wm_ptr, const char* path, const char* password, const char* language, int networkType) { DEBUG_START() diff --git a/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.h index 99d42b2..061eeb2 100644 --- a/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.h +++ b/peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.h @@ -876,6 +876,14 @@ extern ADDAPI void PEYA_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned extern ADDAPI void PEYA_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len); extern ADDAPI void PEYA_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)); extern ADDAPI const char* PEYA_Wallet_serializeCacheToJson(void* wallet_ptr); +extern ADDAPI void* PEYA_Wallet_getYieldInfoRaw(void* wallet_ptr); +extern ADDAPI int PEYA_YieldInfoRaw_count(void* yieldInfoRaw_ptr); +extern ADDAPI uint64_t PEYA_YieldInfoRaw_blockHeight(void* yieldInfoRaw_ptr, int index); +extern ADDAPI uint64_t PEYA_YieldInfoRaw_slippageTotalThisBlock(void* yieldInfoRaw_ptr, int index); +extern ADDAPI uint64_t PEYA_YieldInfoRaw_lockedCoinsThisBlock(void* yieldInfoRaw_ptr, int index); +extern ADDAPI uint64_t PEYA_YieldInfoRaw_lockedCoinsTally(void* yieldInfoRaw_ptr, int index); +extern ADDAPI uint8_t PEYA_YieldInfoRaw_networkHealthPercentage(void* yieldInfoRaw_ptr, int index); +extern ADDAPI void PEYA_YieldInfoRaw_free(void* yieldInfoRaw_ptr); // }; // struct WalletManager