From cc09fa7fa8e38f1b548c9d8bc9dce06998b79b6e Mon Sep 17 00:00:00 2001 From: cyan Date: Fri, 28 Jun 2024 12:53:39 +0000 Subject: [PATCH] createWalletFromDevice --- monero_libwallet2_api_c/monero_libwallet2_api_c.exp | 1 + .../src/main/cpp/wallet2_api_c.cpp | 12 ++++++++++++ monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h | 1 + 3 files changed, 14 insertions(+) diff --git a/monero_libwallet2_api_c/monero_libwallet2_api_c.exp b/monero_libwallet2_api_c/monero_libwallet2_api_c.exp index 843130d..1c6ee9d 100644 --- a/monero_libwallet2_api_c/monero_libwallet2_api_c.exp +++ b/monero_libwallet2_api_c/monero_libwallet2_api_c.exp @@ -134,6 +134,7 @@ _MONERO_WalletManager_blockchainTargetHeight _MONERO_WalletManager_closeWallet _MONERO_WalletManager_createWallet _MONERO_WalletManager_createWalletFromKeys +_MONERO_WalletManager_createWalletFromDevice _MONERO_WalletManager_createWalletFromPolyseed _MONERO_WalletManager_errorString _MONERO_WalletManager_findWallets 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 8e12e23..c03e273 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 @@ -1709,6 +1709,18 @@ void* MONERO_WalletManager_createWalletFromKeys(void* wm_ptr, const char* path, return reinterpret_cast(wallet); } +void* MONERO_WalletManager_createWalletFromDevice(void* wm_ptr, const char* path, const char* password, int nettype, const char* deviceName, uint64_t restoreHeight, const char* subaddressLookahead, const char* viewKeyString, const char* spendKeyString, uint64_t kdf_rounds) { + Monero::WalletManager *wm = reinterpret_cast(wm_ptr); + Monero::Wallet *wallet = wm->createWalletFromDevice(std::string(path), + std::string(password), + static_cast(nettype), + std::string(deviceName), + restoreHeight, + std::string(subaddressLookahead), + kdf_rounds); + return reinterpret_cast(wallet); +} + void* MONERO_WalletManager_createDeterministicWalletFromSpendKey(void* wm_ptr, const char* path, const char* password, const char* language, int nettype, uint64_t restoreHeight, const char* spendKeyString, uint64_t kdf_rounds) { 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 e714889..1bb3551 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 @@ -928,6 +928,7 @@ extern ADDAPI void* MONERO_WalletManager_createDeterministicWalletFromSpendKey(v // const std::string &subaddressLookahead = "", // uint64_t kdf_rounds = 1, // WalletListener * listener = nullptr) = 0; +extern ADDAPI void* MONERO_WalletManager_createWalletFromDevice(void* wm_ptr, const char* path, const char* password, int nettype, const char* deviceName, uint64_t restoreHeight, const char* subaddressLookahead, const char* viewKeyString, const char* spendKeyString, uint64_t kdf_rounds); // virtual Wallet * createWalletFromPolyseed(const std::string &path, // const std::string &password, // NetworkType nettype,