6 Commits

Author SHA1 Message Date
Codex 909a4db994 Fix Win64 monero_c build for raw yield API
build / peya x86_64 Linux (push) Successful in 13m26s
build / peya Win64 (push) Successful in 16m36s
consistency / checksum sync (push) Failing after 6s
consistency / Dart bindings sync (push) Successful in 1m6s
2026-04-12 21:38:02 +02:00
Codex 6ed8e1f7ab Expose raw peya yield info in monero_c
build / peya x86_64 Linux (push) Failing after 13m2s
build / peya Win64 (push) Failing after 14m29s
consistency / checksum sync (push) Failing after 7s
consistency / Dart bindings sync (push) Successful in 1m2s
2026-04-12 19:09:33 +02:00
Codex 2a133d0102 Fix Peya base asset in wallet C wrapper
build / peya x86_64 Linux (push) Successful in 14m18s
build / peya Win64 (push) Successful in 15m48s
consistency / checksum sync (push) Failing after 7s
consistency / Dart bindings sync (push) Successful in 1m6s
2026-04-11 21:53:10 +02:00
Codex c74e024f98 Fix asset-aware subaddress balance bindings
build / peya x86_64 Linux (push) Successful in 13m21s
build / peya Win64 (push) Has been cancelled
consistency / checksum sync (push) Has been cancelled
consistency / Dart bindings sync (push) Has been cancelled
2026-04-09 15:11:44 +02:00
Codex 4b03e7aefa Regenerate Dart bindings for salvium and peya
consistency / checksum sync (push) Successful in 7s
consistency / Dart bindings sync (push) Successful in 1m1s
build / peya x86_64 Linux (push) Successful in 13m27s
build / peya Win64 (push) Successful in 14m37s
2026-04-09 13:57:22 +02:00
Codex cebd4cb419 Install libclang for monero_c consistency
consistency / checksum sync (push) Successful in 7s
consistency / Dart bindings sync (push) Failing after 1m7s
2026-04-09 13:02:52 +02:00
13 changed files with 805 additions and 281 deletions
+7
View File
@@ -45,6 +45,11 @@ jobs:
fetch-depth: 1
submodules: false
- name: Install libclang for ffigen
run: |
sudo apt-get update
sudo apt-get install -y clang libclang-14-dev llvm-14
- name: Setup Flutter
uses: https://github.com/subosito/flutter-action@v2
with:
@@ -56,6 +61,8 @@ jobs:
dart pub get
- name: Regenerate Dart bindings
env:
LIBCLANG_PATH: /usr/lib/llvm-14/lib
run: |
cd impls/monero.dart
./update_bindings.sh
+8 -2
View File
@@ -1523,9 +1523,10 @@ String SubaddressAccountRow_getBalance(
SubaddressAccountRow addressBookRow_ptr) {
debugStart?.call('PEYA_SubaddressAccountRow_getBalance');
lib ??= PeyaC(DynamicLibrary.open(libPath));
final asset_ = 'PEY'.toNativeUtf8().cast<Char>();
try {
final strPtr = lib!
.PEYA_SubaddressAccountRow_getBalance(addressBookRow_ptr)
.PEYA_SubaddressAccountRow_getBalance(addressBookRow_ptr, asset_)
.cast<Utf8>();
final str = strPtr.toDartString();
PEYA_free(strPtr.cast());
@@ -1535,6 +1536,8 @@ String SubaddressAccountRow_getBalance(
errorHandler?.call('PEYA_SubaddressAccountRow_getBalance', e);
debugEnd?.call('PEYA_SubaddressAccountRow_getBalance');
return "";
} finally {
calloc.free(asset_);
}
}
@@ -1542,9 +1545,10 @@ String SubaddressAccountRow_getUnlockedBalance(
SubaddressAccountRow addressBookRow_ptr) {
debugStart?.call('PEYA_SubaddressAccountRow_getUnlockedBalance');
lib ??= PeyaC(DynamicLibrary.open(libPath));
final asset_ = 'PEY'.toNativeUtf8().cast<Char>();
try {
final strPtr = lib!
.PEYA_SubaddressAccountRow_getUnlockedBalance(addressBookRow_ptr)
.PEYA_SubaddressAccountRow_getUnlockedBalance(addressBookRow_ptr, asset_)
.cast<Utf8>();
final str = strPtr.toDartString();
PEYA_free(strPtr.cast());
@@ -1554,6 +1558,8 @@ String SubaddressAccountRow_getUnlockedBalance(
errorHandler?.call('PEYA_SubaddressAccountRow_getUnlockedBalance', e);
debugEnd?.call('PEYA_SubaddressAccountRow_getUnlockedBalance');
return "";
} finally {
calloc.free(asset_);
}
}
+8 -2
View File
@@ -1523,9 +1523,10 @@ String SubaddressAccountRow_getBalance(
SubaddressAccountRow addressBookRow_ptr) {
debugStart?.call('SALVIUM_SubaddressAccountRow_getBalance');
lib ??= SalviumC(DynamicLibrary.open(libPath));
final asset_ = 'SAL'.toNativeUtf8().cast<Char>();
try {
final strPtr = lib!
.SALVIUM_SubaddressAccountRow_getBalance(addressBookRow_ptr)
.SALVIUM_SubaddressAccountRow_getBalance(addressBookRow_ptr, asset_)
.cast<Utf8>();
final str = strPtr.toDartString();
SALVIUM_free(strPtr.cast());
@@ -1535,6 +1536,8 @@ String SubaddressAccountRow_getBalance(
errorHandler?.call('SALVIUM_SubaddressAccountRow_getBalance', e);
debugEnd?.call('SALVIUM_SubaddressAccountRow_getBalance');
return "";
} finally {
calloc.free(asset_);
}
}
@@ -1542,9 +1545,10 @@ String SubaddressAccountRow_getUnlockedBalance(
SubaddressAccountRow addressBookRow_ptr) {
debugStart?.call('SALVIUM_SubaddressAccountRow_getUnlockedBalance');
lib ??= SalviumC(DynamicLibrary.open(libPath));
final asset_ = 'SAL'.toNativeUtf8().cast<Char>();
try {
final strPtr = lib!
.SALVIUM_SubaddressAccountRow_getUnlockedBalance(addressBookRow_ptr)
.SALVIUM_SubaddressAccountRow_getUnlockedBalance(addressBookRow_ptr, asset_)
.cast<Utf8>();
final str = strPtr.toDartString();
SALVIUM_free(strPtr.cast());
@@ -1554,6 +1558,8 @@ String SubaddressAccountRow_getUnlockedBalance(
errorHandler?.call('SALVIUM_SubaddressAccountRow_getUnlockedBalance', e);
debugEnd?.call('SALVIUM_SubaddressAccountRow_getUnlockedBalance');
return "";
} finally {
calloc.free(asset_);
}
}
+2 -2
View File
@@ -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";
File diff suppressed because it is too large Load Diff
@@ -844,6 +844,24 @@ class SalviumC {
_SALVIUM_TransactionInfo_transfers_addressPtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>, int)>();
ffi.Pointer<ffi.Char> SALVIUM_TransactionInfo_transfers_asset(
ffi.Pointer<ffi.Void> txInfo_ptr,
int asset,
) {
return _SALVIUM_TransactionInfo_transfers_asset(
txInfo_ptr,
asset,
);
}
late final _SALVIUM_TransactionInfo_transfers_assetPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>,
ffi.Int)>>('SALVIUM_TransactionInfo_transfers_asset');
late final _SALVIUM_TransactionInfo_transfers_asset =
_SALVIUM_TransactionInfo_transfers_assetPtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>, int)>();
int SALVIUM_TransactionHistory_count(
ffi.Pointer<ffi.Void> txHistory_ptr,
) {
@@ -1475,6 +1493,35 @@ class SalviumC {
late final _SALVIUM_CoinsInfo_description = _SALVIUM_CoinsInfo_descriptionPtr
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> SALVIUM_CoinsInfo_asset(
ffi.Pointer<ffi.Void> coinsInfo_ptr,
) {
return _SALVIUM_CoinsInfo_asset(
coinsInfo_ptr,
);
}
late final _SALVIUM_CoinsInfo_assetPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>)>>('SALVIUM_CoinsInfo_asset');
late final _SALVIUM_CoinsInfo_asset = _SALVIUM_CoinsInfo_assetPtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
int SALVIUM_CoinsInfo_type(
ffi.Pointer<ffi.Void> coinsInfo_ptr,
) {
return _SALVIUM_CoinsInfo_type(
coinsInfo_ptr,
);
}
late final _SALVIUM_CoinsInfo_typePtr =
_lookup<ffi.NativeFunction<ffi.Uint8 Function(ffi.Pointer<ffi.Void>)>>(
'SALVIUM_CoinsInfo_type');
late final _SALVIUM_CoinsInfo_type = _SALVIUM_CoinsInfo_typePtr.asFunction<
int Function(ffi.Pointer<ffi.Void>)>();
int SALVIUM_Coins_count(
ffi.Pointer<ffi.Void> coins_ptr,
) {
@@ -1867,35 +1914,43 @@ class SalviumC {
ffi.Pointer<ffi.Char> SALVIUM_SubaddressAccountRow_getBalance(
ffi.Pointer<ffi.Void> subaddressAccountRow_ptr,
ffi.Pointer<ffi.Char> asset,
) {
return _SALVIUM_SubaddressAccountRow_getBalance(
subaddressAccountRow_ptr,
asset,
);
}
late final _SALVIUM_SubaddressAccountRow_getBalancePtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>>(
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>>(
'SALVIUM_SubaddressAccountRow_getBalance');
late final _SALVIUM_SubaddressAccountRow_getBalance =
_SALVIUM_SubaddressAccountRow_getBalancePtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>();
ffi.Pointer<ffi.Char> SALVIUM_SubaddressAccountRow_getUnlockedBalance(
ffi.Pointer<ffi.Void> subaddressAccountRow_ptr,
ffi.Pointer<ffi.Char> asset,
) {
return _SALVIUM_SubaddressAccountRow_getUnlockedBalance(
subaddressAccountRow_ptr,
asset,
);
}
late final _SALVIUM_SubaddressAccountRow_getUnlockedBalancePtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>>(
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>>(
'SALVIUM_SubaddressAccountRow_getUnlockedBalance');
late final _SALVIUM_SubaddressAccountRow_getUnlockedBalance =
_SALVIUM_SubaddressAccountRow_getUnlockedBalancePtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>();
int SALVIUM_SubaddressAccountRow_getRowId(
ffi.Pointer<ffi.Void> subaddressAccountRow_ptr,
@@ -2118,9 +2173,8 @@ class SalviumC {
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
'SALVIUM_Wallet_setStoreTxInfo');
late final _SALVIUM_Wallet_setStoreTxInfo =
_SALVIUM_Wallet_setStoreTxInfoPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
late final _SALVIUM_Wallet_setStoreTxInfo = _SALVIUM_Wallet_setStoreTxInfoPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
bool SALVIUM_Wallet_getStoreTxInfo(
ffi.Pointer<ffi.Void> wallet_ptr,
@@ -2133,9 +2187,8 @@ class SalviumC {
late final _SALVIUM_Wallet_getStoreTxInfoPtr =
_lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>(
'SALVIUM_Wallet_getStoreTxInfo');
late final _SALVIUM_Wallet_getStoreTxInfo =
_SALVIUM_Wallet_getStoreTxInfoPtr
.asFunction<bool Function(ffi.Pointer<ffi.Void>)>();
late final _SALVIUM_Wallet_getStoreTxInfo = _SALVIUM_Wallet_getStoreTxInfoPtr
.asFunction<bool Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> SALVIUM_Wallet_getSeedLanguage(
ffi.Pointer<ffi.Void> wallet_ptr,
@@ -2431,6 +2484,70 @@ class SalviumC {
_SALVIUM_Wallet_publicMultisigSignerKeyPtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretViewBalance(
ffi.Pointer<ffi.Void> wallet_ptr,
) {
return _SALVIUM_Wallet_secretViewBalance(
wallet_ptr,
);
}
late final _SALVIUM_Wallet_secretViewBalancePtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretViewBalance');
late final _SALVIUM_Wallet_secretViewBalance =
_SALVIUM_Wallet_secretViewBalancePtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretProveSpend(
ffi.Pointer<ffi.Void> wallet_ptr,
) {
return _SALVIUM_Wallet_secretProveSpend(
wallet_ptr,
);
}
late final _SALVIUM_Wallet_secretProveSpendPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretProveSpend');
late final _SALVIUM_Wallet_secretProveSpend =
_SALVIUM_Wallet_secretProveSpendPtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretGenerateAddress(
ffi.Pointer<ffi.Void> wallet_ptr,
) {
return _SALVIUM_Wallet_secretGenerateAddress(
wallet_ptr,
);
}
late final _SALVIUM_Wallet_secretGenerateAddressPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretGenerateAddress');
late final _SALVIUM_Wallet_secretGenerateAddress =
_SALVIUM_Wallet_secretGenerateAddressPtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretGenerateImage(
ffi.Pointer<ffi.Void> wallet_ptr,
) {
return _SALVIUM_Wallet_secretGenerateImage(
wallet_ptr,
);
}
late final _SALVIUM_Wallet_secretGenerateImagePtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretGenerateImage');
late final _SALVIUM_Wallet_secretGenerateImage =
_SALVIUM_Wallet_secretGenerateImagePtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
void SALVIUM_Wallet_stop(
ffi.Pointer<ffi.Void> wallet_ptr,
) {
@@ -3623,6 +3740,55 @@ class SalviumC {
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>)>();
ffi.Pointer<ffi.Void> SALVIUM_Wallet_createStakeTransaction(
ffi.Pointer<ffi.Void> wallet_ptr,
ffi.Pointer<ffi.Char> dst_addr,
ffi.Pointer<ffi.Char> payment_id,
int amount,
int mixin_count,
int pendingTransactionPriority,
int subaddr_account,
ffi.Pointer<ffi.Char> preferredInputs,
ffi.Pointer<ffi.Char> separator,
) {
return _SALVIUM_Wallet_createStakeTransaction(
wallet_ptr,
dst_addr,
payment_id,
amount,
mixin_count,
pendingTransactionPriority,
subaddr_account,
preferredInputs,
separator,
);
}
late final _SALVIUM_Wallet_createStakeTransactionPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<ffi.Void> Function(
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>,
ffi.Uint64,
ffi.Uint32,
ffi.Int,
ffi.Uint32,
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>)>>('SALVIUM_Wallet_createStakeTransaction');
late final _SALVIUM_Wallet_createStakeTransaction =
_SALVIUM_Wallet_createStakeTransactionPtr.asFunction<
ffi.Pointer<ffi.Void> Function(
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>,
int,
int,
int,
int,
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>)>();
ffi.Pointer<ffi.Void> SALVIUM_Wallet_loadUnsignedTx(
ffi.Pointer<ffi.Void> wallet_ptr,
ffi.Pointer<ffi.Char> unsigned_filename,
+2 -2
View File
@@ -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",
}
+1 -1
Submodule peya updated: fd1126fa7b...a0162b4205
+1
View File
@@ -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,6 +4,7 @@
#include "helpers.hpp"
#include <cstring>
#include <thread>
#include <vector>
#include "../../../../peya/src/wallet/api/wallet2_api.h"
#include "peya_checksum.h"
@@ -994,7 +995,8 @@ const char* PEYA_SubaddressAccountRow_getLabel(void* subaddressAccountRow_ptr) {
const char* PEYA_SubaddressAccountRow_getBalance(void* subaddressAccountRow_ptr, const char* asset) {
DEBUG_START()
Monero::SubaddressAccountRow *subaddressAccountRow = reinterpret_cast<Monero::SubaddressAccountRow*>(subaddressAccountRow_ptr);
std::string str = subaddressAccountRow->getBalance("SAL1");
const std::string requested_asset = asset ? asset : "PEY";
std::string str = subaddressAccountRow->getBalance(requested_asset);
const std::string::size_type size = str.size();
char *buffer = new char[size + 1]; //we need extra char for NUL
memcpy(buffer, str.c_str(), size + 1);
@@ -1005,7 +1007,8 @@ const char* PEYA_SubaddressAccountRow_getBalance(void* subaddressAccountRow_ptr,
const char* PEYA_SubaddressAccountRow_getUnlockedBalance(void* subaddressAccountRow_ptr, const char* asset) {
DEBUG_START()
Monero::SubaddressAccountRow *subaddressAccountRow = reinterpret_cast<Monero::SubaddressAccountRow*>(subaddressAccountRow_ptr);
std::string str = subaddressAccountRow->getUnlockedBalance("SAL1");
const std::string requested_asset = asset ? asset : "PEY";
std::string str = subaddressAccountRow->getUnlockedBalance(requested_asset);
const std::string::size_type size = str.size();
char *buffer = new char[size + 1]; //we need extra char for NUL
memcpy(buffer, str.c_str(), size + 1);
@@ -1461,14 +1464,14 @@ bool PEYA_Wallet_setProxy(void* wallet_ptr, const char* address) {
uint64_t PEYA_Wallet_balance(void* wallet_ptr, uint32_t accountIndex) {
DEBUG_START()
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->balance("SAL1", accountIndex);
return wallet->balance("PEY", accountIndex);
DEBUG_END()
}
uint64_t PEYA_Wallet_unlockedBalance(void* wallet_ptr, uint32_t accountIndex) {
DEBUG_START()
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->unlockedBalance("SAL1", accountIndex);
return wallet->unlockedBalance("PEY", accountIndex);
DEBUG_END()
}
@@ -1836,7 +1839,7 @@ void* PEYA_Wallet_createTransactionMultDest(void* wallet_ptr, const char* dst_ad
return wallet->createTransactionMultDest(Monero::TRANSFER,
dst_addr, std::string(payment_id),
optAmount, mixin_count,
"SAL1", false /* is_return */,
"PEY", false /* is_return */,
PendingTransaction_Priority_fromInt(pendingTransactionPriority),
subaddr_account,
subaddr_indices
@@ -1874,7 +1877,7 @@ void* PEYA_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, cons
std::set<std::string> preferred_inputs = splitString(std::string(preferredInputs), std::string(separator));
return wallet->createTransaction(std::string(dst_addr), std::string(payment_id),
optAmount, mixin_count,
"SAL1", false /* is_return */,
"PEY", false /* is_return */,
PendingTransaction_Priority_fromInt(pendingTransactionPriority),
subaddr_account, subaddr_indices);
DEBUG_END()
@@ -2307,6 +2310,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::Wallet*>(wallet_ptr);
auto *result = new std::vector<Monero::YieldInfoRawRow>();
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<Monero::YieldInfoRawRow>*>(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<Monero::YieldInfoRawRow>*>(yieldInfoRaw_ptr);
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(index) >= yieldInfoRaw->size()) {
return 0;
}
return (*yieldInfoRaw)[index].blockHeight;
DEBUG_END()
}
uint64_t PEYA_YieldInfoRaw_slippageTotalThisBlock(void* yieldInfoRaw_ptr, int index) {
DEBUG_START()
auto *yieldInfoRaw = reinterpret_cast<std::vector<Monero::YieldInfoRawRow>*>(yieldInfoRaw_ptr);
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(index) >= yieldInfoRaw->size()) {
return 0;
}
return (*yieldInfoRaw)[index].slippageTotalThisBlock;
DEBUG_END()
}
uint64_t PEYA_YieldInfoRaw_lockedCoinsThisBlock(void* yieldInfoRaw_ptr, int index) {
DEBUG_START()
auto *yieldInfoRaw = reinterpret_cast<std::vector<Monero::YieldInfoRawRow>*>(yieldInfoRaw_ptr);
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(index) >= yieldInfoRaw->size()) {
return 0;
}
return (*yieldInfoRaw)[index].lockedCoinsThisBlock;
DEBUG_END()
}
uint64_t PEYA_YieldInfoRaw_lockedCoinsTally(void* yieldInfoRaw_ptr, int index) {
DEBUG_START()
auto *yieldInfoRaw = reinterpret_cast<std::vector<Monero::YieldInfoRawRow>*>(yieldInfoRaw_ptr);
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(index) >= yieldInfoRaw->size()) {
return 0;
}
return (*yieldInfoRaw)[index].lockedCoinsTally;
DEBUG_END()
}
uint8_t PEYA_YieldInfoRaw_networkHealthPercentage(void* yieldInfoRaw_ptr, int index) {
DEBUG_START()
auto *yieldInfoRaw = reinterpret_cast<std::vector<Monero::YieldInfoRawRow>*>(yieldInfoRaw_ptr);
if (yieldInfoRaw == nullptr || index < 0 || static_cast<size_t>(index) >= yieldInfoRaw->size()) {
return 0;
}
return (*yieldInfoRaw)[index].networkHealthPercentage;
DEBUG_END()
}
void PEYA_YieldInfoRaw_free(void* yieldInfoRaw_ptr) {
DEBUG_START()
auto *yieldInfoRaw = reinterpret_cast<std::vector<Monero::YieldInfoRawRow>*>(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
@@ -994,7 +994,8 @@ const char* SALVIUM_SubaddressAccountRow_getLabel(void* subaddressAccountRow_ptr
const char* SALVIUM_SubaddressAccountRow_getBalance(void* subaddressAccountRow_ptr, const char* asset) {
DEBUG_START()
Monero::SubaddressAccountRow *subaddressAccountRow = reinterpret_cast<Monero::SubaddressAccountRow*>(subaddressAccountRow_ptr);
std::string str = subaddressAccountRow->getBalance("SAL1");
const std::string requested_asset = asset ? asset : "SAL";
std::string str = subaddressAccountRow->getBalance(requested_asset);
const std::string::size_type size = str.size();
char *buffer = new char[size + 1]; //we need extra char for NUL
memcpy(buffer, str.c_str(), size + 1);
@@ -1005,7 +1006,8 @@ const char* SALVIUM_SubaddressAccountRow_getBalance(void* subaddressAccountRow_p
const char* SALVIUM_SubaddressAccountRow_getUnlockedBalance(void* subaddressAccountRow_ptr, const char* asset) {
DEBUG_START()
Monero::SubaddressAccountRow *subaddressAccountRow = reinterpret_cast<Monero::SubaddressAccountRow*>(subaddressAccountRow_ptr);
std::string str = subaddressAccountRow->getUnlockedBalance("SAL1");
const std::string requested_asset = asset ? asset : "SAL";
std::string str = subaddressAccountRow->getUnlockedBalance(requested_asset);
const std::string::size_type size = str.size();
char *buffer = new char[size + 1]; //we need extra char for NUL
memcpy(buffer, str.c_str(), size + 1);