Expose raw peya yield info in monero_c
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -4777,6 +4777,138 @@ class PeyaC {
|
||||
_PEYA_Wallet_serializeCacheToJsonPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Void> PEYA_Wallet_getYieldInfoRaw(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _PEYA_Wallet_getYieldInfoRaw(
|
||||
wallet_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_Wallet_getYieldInfoRawPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Void> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('PEYA_Wallet_getYieldInfoRaw');
|
||||
late final _PEYA_Wallet_getYieldInfoRaw = _PEYA_Wallet_getYieldInfoRawPtr
|
||||
.asFunction<ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
int PEYA_YieldInfoRaw_count(
|
||||
ffi.Pointer<ffi.Void> yieldInfoRaw_ptr,
|
||||
) {
|
||||
return _PEYA_YieldInfoRaw_count(
|
||||
yieldInfoRaw_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_YieldInfoRaw_countPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>)>>(
|
||||
'PEYA_YieldInfoRaw_count');
|
||||
late final _PEYA_YieldInfoRaw_count = _PEYA_YieldInfoRaw_countPtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
int PEYA_YieldInfoRaw_blockHeight(
|
||||
ffi.Pointer<ffi.Void> yieldInfoRaw_ptr,
|
||||
int index,
|
||||
) {
|
||||
return _PEYA_YieldInfoRaw_blockHeight(
|
||||
yieldInfoRaw_ptr,
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_YieldInfoRaw_blockHeightPtr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Uint64 Function(ffi.Pointer<ffi.Void>, ffi.Int)>>(
|
||||
'PEYA_YieldInfoRaw_blockHeight');
|
||||
late final _PEYA_YieldInfoRaw_blockHeight = _PEYA_YieldInfoRaw_blockHeightPtr
|
||||
.asFunction<int Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
int PEYA_YieldInfoRaw_slippageTotalThisBlock(
|
||||
ffi.Pointer<ffi.Void> yieldInfoRaw_ptr,
|
||||
int index,
|
||||
) {
|
||||
return _PEYA_YieldInfoRaw_slippageTotalThisBlock(
|
||||
yieldInfoRaw_ptr,
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_YieldInfoRaw_slippageTotalThisBlockPtr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Uint64 Function(ffi.Pointer<ffi.Void>, ffi.Int)>>(
|
||||
'PEYA_YieldInfoRaw_slippageTotalThisBlock');
|
||||
late final _PEYA_YieldInfoRaw_slippageTotalThisBlock =
|
||||
_PEYA_YieldInfoRaw_slippageTotalThisBlockPtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
int PEYA_YieldInfoRaw_lockedCoinsThisBlock(
|
||||
ffi.Pointer<ffi.Void> yieldInfoRaw_ptr,
|
||||
int index,
|
||||
) {
|
||||
return _PEYA_YieldInfoRaw_lockedCoinsThisBlock(
|
||||
yieldInfoRaw_ptr,
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_YieldInfoRaw_lockedCoinsThisBlockPtr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Uint64 Function(ffi.Pointer<ffi.Void>, ffi.Int)>>(
|
||||
'PEYA_YieldInfoRaw_lockedCoinsThisBlock');
|
||||
late final _PEYA_YieldInfoRaw_lockedCoinsThisBlock =
|
||||
_PEYA_YieldInfoRaw_lockedCoinsThisBlockPtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
int PEYA_YieldInfoRaw_lockedCoinsTally(
|
||||
ffi.Pointer<ffi.Void> yieldInfoRaw_ptr,
|
||||
int index,
|
||||
) {
|
||||
return _PEYA_YieldInfoRaw_lockedCoinsTally(
|
||||
yieldInfoRaw_ptr,
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_YieldInfoRaw_lockedCoinsTallyPtr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Uint64 Function(ffi.Pointer<ffi.Void>, ffi.Int)>>(
|
||||
'PEYA_YieldInfoRaw_lockedCoinsTally');
|
||||
late final _PEYA_YieldInfoRaw_lockedCoinsTally =
|
||||
_PEYA_YieldInfoRaw_lockedCoinsTallyPtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
int PEYA_YieldInfoRaw_networkHealthPercentage(
|
||||
ffi.Pointer<ffi.Void> yieldInfoRaw_ptr,
|
||||
int index,
|
||||
) {
|
||||
return _PEYA_YieldInfoRaw_networkHealthPercentage(
|
||||
yieldInfoRaw_ptr,
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_YieldInfoRaw_networkHealthPercentagePtr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Uint8 Function(ffi.Pointer<ffi.Void>, ffi.Int)>>(
|
||||
'PEYA_YieldInfoRaw_networkHealthPercentage');
|
||||
late final _PEYA_YieldInfoRaw_networkHealthPercentage =
|
||||
_PEYA_YieldInfoRaw_networkHealthPercentagePtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
void PEYA_YieldInfoRaw_free(
|
||||
ffi.Pointer<ffi.Void> yieldInfoRaw_ptr,
|
||||
) {
|
||||
return _PEYA_YieldInfoRaw_free(
|
||||
yieldInfoRaw_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _PEYA_YieldInfoRaw_freePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
|
||||
'PEYA_YieldInfoRaw_free');
|
||||
late final _PEYA_YieldInfoRaw_free = _PEYA_YieldInfoRaw_freePtr.asFunction<
|
||||
void Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Void> PEYA_WalletManager_createWallet(
|
||||
ffi.Pointer<ffi.Void> wm_ptr,
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
2
peya
2
peya
Submodule peya updated: fd1126fa7b...cf5969b5dd
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
#include "helpers.hpp"
|
||||
#include <cstring>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#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<Monero::WalletImpl*>(wallet_ptr);
|
||||
auto *result = new std::vector<cryptonote::yield_block_info>();
|
||||
if (!wallet->getYieldInfoRaw(*result)) {
|
||||
delete result;
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<void*>(result);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
int PEYA_YieldInfoRaw_count(void* yieldInfoRaw_ptr) {
|
||||
DEBUG_START()
|
||||
auto *yieldInfoRaw = reinterpret_cast<std::vector<cryptonote::yield_block_info>*>(yieldInfoRaw_ptr);
|
||||
if (yieldInfoRaw == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return static_cast<int>(yieldInfoRaw->size());
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
uint64_t PEYA_YieldInfoRaw_blockHeight(void* yieldInfoRaw_ptr, int index) {
|
||||
DEBUG_START()
|
||||
auto *yieldInfoRaw = reinterpret_cast<std::vector<cryptonote::yield_block_info>*>(yieldInfoRaw_ptr);
|
||||
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(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<std::vector<cryptonote::yield_block_info>*>(yieldInfoRaw_ptr);
|
||||
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(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<std::vector<cryptonote::yield_block_info>*>(yieldInfoRaw_ptr);
|
||||
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(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<std::vector<cryptonote::yield_block_info>*>(yieldInfoRaw_ptr);
|
||||
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(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<std::vector<cryptonote::yield_block_info>*>(yieldInfoRaw_ptr);
|
||||
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(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<std::vector<cryptonote::yield_block_info>*>(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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user