diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart index b515192d..19466ee3 100644 --- a/impls/monero.dart/lib/monero.dart +++ b/impls/monero.dart/lib/monero.dart @@ -2236,6 +2236,18 @@ bool Wallet_setProxy(wallet ptr, {required String address}) { return s; } +@Deprecated("TODO") +bool Wallet_setCaFilePath(wallet wm_ptr, String path) { + debugStart?.call('MONERO_WalletManager_setCaFilePath'); + lib ??= MoneroC(DynamicLibrary.open(libPath)); + + final path_ = path.toNativeUtf8().cast(); + final result = lib!.MONERO_Wallet_setCaFilePath(wm_ptr, path_); + calloc.free(path_); + debugEnd?.call('MONERO_WalletManager_setCaFilePath'); + return result; +} + @Deprecated("TODO") int Wallet_balance(wallet ptr, {required int accountIndex}) { debugStart?.call('MONERO_Wallet_balance'); diff --git a/impls/monero.dart/lib/src/generated_bindings_monero.g.dart b/impls/monero.dart/lib/src/generated_bindings_monero.g.dart index 2dd392f7..b9186ae5 100644 --- a/impls/monero.dart/lib/src/generated_bindings_monero.g.dart +++ b/impls/monero.dart/lib/src/generated_bindings_monero.g.dart @@ -2624,6 +2624,24 @@ class MoneroC { late final _MONERO_Wallet_setProxy = _MONERO_Wallet_setProxyPtr.asFunction< bool Function(ffi.Pointer, ffi.Pointer)>(); + bool MONERO_Wallet_setCaFilePath( + ffi.Pointer wallet_ptr, + ffi.Pointer path, + ) { + return _MONERO_Wallet_setCaFilePath( + wallet_ptr, + path, + ); + } + + late final _MONERO_Wallet_setCaFilePathPtr = _lookup< + ffi.NativeFunction< + ffi.Bool Function(ffi.Pointer, + ffi.Pointer)>>('MONERO_Wallet_setCaFilePath'); + late final _MONERO_Wallet_setCaFilePath = + _MONERO_Wallet_setCaFilePathPtr.asFunction< + bool Function(ffi.Pointer, ffi.Pointer)>(); + int MONERO_Wallet_balance( ffi.Pointer wallet_ptr, int accountIndex, diff --git a/impls/monero.dart/lib/src/monero.dart b/impls/monero.dart/lib/src/monero.dart index 2e64e620..8d60426a 100644 --- a/impls/monero.dart/lib/src/monero.dart +++ b/impls/monero.dart/lib/src/monero.dart @@ -1376,6 +1376,11 @@ class MoneroWallet implements Wallet2Wallet { void setProxy({required String address}) { monero.Wallet_setProxy(walletPtr, address: address); } + + @override + bool setCaFilePath(String path) { + return monero.Wallet_setCaFilePath(walletPtr, path); + } @override void setRecoveringFromDevice({required bool recoveringFromDevice}) { diff --git a/impls/monero.dart/lib/src/wallet2.dart b/impls/monero.dart/lib/src/wallet2.dart index 69167a76..56d4e758 100644 --- a/impls/monero.dart/lib/src/wallet2.dart +++ b/impls/monero.dart/lib/src/wallet2.dart @@ -271,6 +271,7 @@ abstract class Wallet2Wallet { void setTrustedDaemon({required bool arg}); bool trustedDaemon(); void setProxy({required String address}); + bool setCaFilePath(String path); int balance({required int accountIndex}); int unlockedBalance({required int accountIndex}); int viewOnlyBalance({required int accountIndex}); diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp index 18b7ac8e..8dfd9629 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp @@ -6,6 +6,7 @@ #include #include "../../../../monero/src/wallet/api/wallet2_api.h" #include "../../../../lwsf/include/lws_frontend.h" +#include "../../../../lwsf/src/wallet.h" #include "monero_checksum.h" #ifdef __cplusplus @@ -1344,6 +1345,17 @@ bool MONERO_Wallet_setProxy(void* wallet_ptr, const char* address) { DEBUG_END() } +bool MONERO_Wallet_setCaFilePath(void* wallet_ptr, const char* path) { + DEBUG_START() + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + lwsf::internal::wallet *lwsf_wallet = dynamic_cast(wallet); + if (!lwsf_wallet) + return false; + lwsf_wallet->setCaFilePath(std::string(path)); + return true; + DEBUG_END() +} + uint64_t MONERO_Wallet_balance(void* wallet_ptr, uint32_t accountIndex) { DEBUG_START() Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h index 62de41bb..0005e4c5 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h @@ -574,6 +574,8 @@ extern ADDAPI void MONERO_Wallet_setTrustedDaemon(void* wallet_ptr, bool arg); extern ADDAPI bool MONERO_Wallet_trustedDaemon(void* wallet_ptr); // virtual bool setProxy(const std::string &address) = 0; extern ADDAPI bool MONERO_Wallet_setProxy(void* wallet_ptr, const char* address); +// virtual bool setCaFilePath(const std::string &path) = 0; +extern ADDAPI bool MONERO_Wallet_setCaFilePath(void* wallet_ptr, const char* path); // virtual uint64_t balance(uint32_t accountIndex = 0) const = 0; extern ADDAPI uint64_t MONERO_Wallet_balance(void* wallet_ptr, uint32_t accountIndex); // uint64_t balanceAll() const {