Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
11cdb4b
wallet: use get_subaddress() of monero-cpp
everoddandeven Nov 28, 2026
fde2513
wallet: remove the tx sorting that monero-cpp already does
everoddandeven Nov 28, 2026
3270b19
wallet: bind the methods to monero_wallet instead of its trampoline
everoddandeven Nov 28, 2026
7a73140
wallet: add the missing overrides of the wallet trampoline
everoddandeven Nov 28, 2026
fc895ab
wallet: rethrow monero errors in get_tx()
everoddandeven Nov 28, 2026
f6d763a
docs: fix the return type of get_new_key_images_from_last_import()
everoddandeven Nov 28, 2026
c7401c1
daemon: register the trampoline of MoneroDaemon for python subclasses
everoddandeven Nov 28, 2026
8b4acfa
wallet: accept a 64 bit num_blocks_fetched in the constructor of Mone…
everoddandeven Nov 28, 2026
7af3f82
docs: fix the return type of export_key_images()
everoddandeven Nov 28, 2026
5f510c2
utils: remove the unused regex include
everoddandeven Nov 28, 2026
ed047a4
bindings: remove the redundant catch of monero_rpc_error
everoddandeven Nov 28, 2026
4fe854f
wallet: define the overloads of set_daemon_connection() of MoneroWall…
everoddandeven Nov 28, 2026
197782e
wallet full: release the GIL while getting the keys and cache file bu…
everoddandeven Nov 28, 2026
8728adc
docs: type the listeners of get_listeners() as a set
everoddandeven Nov 28, 2026
fec91e7
docs: type the wallet that create_wallet() and open_wallet() of Moner…
everoddandeven Nov 28, 2026
2a526a5
docs: add the inherited overloads of set_daemon_connection() to Moner…
everoddandeven Nov 28, 2026
286a132
tests: validate the public keys as public keys
everoddandeven Nov 28, 2026
034507c
docs: type merge() with the class that it accepts
everoddandeven Nov 29, 2026
6034ea9
docs: accept None in the arguments of MoneroDaemon.start_mining()
everoddandeven Nov 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/monero-spec.drawio
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@
<mxCell id="q11gqvAsyF0Tu2FjbUK3-3" parent="QYUe6zCbC_x82nWfNGpH-169" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="remove_listener(listener: MoneroWalletListener) -&gt; None" vertex="1">
<mxGeometry height="26" width="814" y="84" as="geometry" />
</mxCell>
<mxCell id="q11gqvAsyF0Tu2FjbUK3-1" parent="QYUe6zCbC_x82nWfNGpH-169" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="get_listeners() -&gt; list[MoneroWalletListener]" vertex="1">
<mxCell id="q11gqvAsyF0Tu2FjbUK3-1" parent="QYUe6zCbC_x82nWfNGpH-169" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="get_listeners() -&gt; set[MoneroWalletListener]" vertex="1">
<mxGeometry height="26" width="814" y="110" as="geometry" />
</mxCell>
<mxCell id="q11gqvAsyF0Tu2FjbUK3-2" parent="QYUe6zCbC_x82nWfNGpH-169" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="is_view_only() -&gt; bool" vertex="1">
Expand Down Expand Up @@ -2189,7 +2189,7 @@
<mxCell id="QYUe6zCbC_x82nWfNGpH-65" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;fontStyle=0" value="get_output_histogram(amounts: list[int], min_count: Optional[int], max_count: Optional[int], is_unlocked: Optional[bool],&#10; recent_cutoff: Optional[int]) -&gt; list[MoneroOutputHistogramEntry]" vertex="1">
<mxGeometry height="38" width="814" y="122" as="geometry" />
</mxCell>
<mxCell id="QYUe6zCbC_x82nWfNGpH-143" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="start_mining(address: str, num_threads: int, is_background: bool, ignore_battery: bool) -&gt; None" vertex="1">
<mxCell id="QYUe6zCbC_x82nWfNGpH-143" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="start_mining(address: str, num_threads: Optional[int], is_background: Optional[bool], ignore_battery: Optional[bool]) -&gt; None" vertex="1">
<mxGeometry height="26" width="814" y="160" as="geometry" />
</mxCell>
<mxCell id="QYUe6zCbC_x82nWfNGpH-144" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="stop_mining() -&gt; None" vertex="1">
Expand Down Expand Up @@ -2219,7 +2219,7 @@
<mxCell id="QYUe6zCbC_x82nWfNGpH-152" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="add_listener(listener: MoneroDaemonListener) -&gt; None" vertex="1">
<mxGeometry height="26" width="814" y="406" as="geometry" />
</mxCell>
<mxCell id="sync-13" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;fontStyle=0" value="get_listeners() -&gt; list[MoneroDaemonListener]" vertex="1">
<mxCell id="sync-13" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;fontStyle=0" value="get_listeners() -&gt; set[MoneroDaemonListener]" vertex="1">
<mxGeometry height="26" width="814" y="432" as="geometry" />
</mxCell>
<mxCell id="QYUe6zCbC_x82nWfNGpH-153" parent="sync-1" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontFamily=Verdana;" value="remove_listener(listener: MoneroDaemonListener) -&gt; None" vertex="1">
Expand Down
4 changes: 4 additions & 0 deletions src/cpp/daemon/py_monero_daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ class PyMoneroDaemon : public monero_daemon {
PYBIND11_OVERRIDE(void, monero_daemon, set_bootstrap_daemon, address, username, password, proxy);
}

void remove_bootstrap_daemon() override {
PYBIND11_OVERRIDE(void, monero_daemon, remove_bootstrap_daemon);
}

void set_log_hash_rate(bool is_visible) override {
PYBIND11_OVERRIDE(void, monero_daemon, set_log_hash_rate, is_visible);
}
Expand Down
9 changes: 3 additions & 6 deletions src/cpp/py_monero_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@ std::shared_ptr<T> make_gil_free_holder(T* ptr) {
#define MONERO_CATCH_AND_RETHROW(expr) \
try { \
return expr; \
} catch (const monero_rpc_error& e) { \
} catch (const monero_error&) { \
throw; \
} catch (const monero_error& e) { \
throw; \
} \
catch (const std::exception& e) { \
} catch (const std::exception& e) { \
throw monero_error(e.what()); \
}

Expand Down Expand Up @@ -171,7 +168,7 @@ struct PyMoneroTypes {
py::class_<monero_address_book_entry, serializable_struct, std::shared_ptr<monero_address_book_entry>> py_monero_address_book_entry;
py::class_<monero_wallet_listener, PyMoneroWalletListener, std::shared_ptr<monero_wallet_listener>> py_monero_wallet_listener;
py::class_<monero_daemon_listener, PyMoneroDaemonListener, std::shared_ptr<monero_daemon_listener>> py_monero_daemon_listener;
py::class_<monero_daemon, std::shared_ptr<monero_daemon>> py_monero_daemon;
py::class_<monero_daemon, PyMoneroDaemon, std::shared_ptr<monero_daemon>> py_monero_daemon;
py::class_<monero_daemon_rpc, monero_daemon, std::shared_ptr<monero_daemon_rpc>> py_monero_daemon_rpc;
py::class_<monero_wallet, PyMoneroWallet, std::shared_ptr<monero_wallet>> py_monero_wallet;
py::class_<monero_wallet_keys, monero_wallet, std::shared_ptr<monero_wallet_keys>> py_monero_wallet_keys;
Expand Down
39 changes: 0 additions & 39 deletions src/cpp/utils/py_monero_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
*
* Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
*/
#include <regex>
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "py_monero_utils.h"

Expand Down Expand Up @@ -124,41 +123,3 @@ std::string PyMoneroUtils::binary_blocks_fast_to_json(const std::string &bin) {
monero_utils::binary_blocks_fast_to_json(bin, json);
return json;
}

void PyMoneroUtils::sort_txs_wallet(std::vector<std::shared_ptr<monero_tx_wallet>>& txs, const std::vector<std::string>& hashes) {
bool empty = hashes.empty();
std::vector<std::string> tx_hashes;
std::unordered_map<std::string, std::shared_ptr<monero_tx_wallet>> tx_map;

for (const auto& tx : txs) {
std::string tx_hash = tx->m_hash.get();
tx_map.emplace(tx_hash, tx);
if (empty) tx_hashes.push_back(tx_hash);
}

std::vector<std::shared_ptr<monero_tx_wallet>> sorted_txs;
sorted_txs.reserve(hashes.size());

const auto& v_hashes = empty ? tx_hashes : hashes;

for (const auto& tx_hash : v_hashes) {
auto it = tx_map.find(tx_hash);
if (it != tx_map.end()) {
sorted_txs.push_back(it->second);
}
}

txs = std::move(sorted_txs);
}

std::vector<std::shared_ptr<monero_tx_wallet>> PyMoneroUtils::get_and_sort_txs(const monero_wallet& wallet, const monero_tx_query& tx_query) {
auto txs = wallet.get_txs(tx_query);
sort_txs_wallet(txs, tx_query.m_hashes);
return txs;
}

std::vector<std::shared_ptr<monero_tx_wallet>> PyMoneroUtils::get_and_sort_txs(const monero_wallet& wallet, const std::vector<std::string>& tx_hashes) {
monero_tx_query tx_query;
tx_query.m_hashes = tx_hashes;
return get_and_sort_txs(wallet, tx_query);
}
4 changes: 0 additions & 4 deletions src/cpp/utils/py_monero_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ class PyMoneroUtils {
static bool is_valid_payment_id_long(const std::string& payment_id_str);
static bool is_valid_payment_id_short(const std::string& payment_id_str);

static void sort_txs_wallet(std::vector<std::shared_ptr<monero_tx_wallet>>& txs, const std::vector<std::string>& hashes);
static std::vector<std::shared_ptr<monero_tx_wallet>> get_and_sort_txs(const monero_wallet& wallet, const std::vector<std::string>& tx_hashes);
static std::vector<std::shared_ptr<monero_tx_wallet>> get_and_sort_txs(const monero_wallet& wallet, const monero_tx_query& tx_query);

template <typename Parent, typename Child>
static void set_query(std::shared_ptr<Parent>& self, std::shared_ptr<Child>& field, const boost::optional<std::shared_ptr<Child>>& val) {
const auto old = field;
Expand Down
24 changes: 24 additions & 0 deletions src/cpp/wallet/py_monero_wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ class PyMoneroWallet : public monero_wallet {
PYBIND11_OVERRIDE(monero_version, monero_wallet, get_version);
}

std::string get_path() const override {
PYBIND11_OVERRIDE(std::string, monero_wallet, get_path);
}

monero_network_type get_network_type() const override {
PYBIND11_OVERRIDE(monero_network_type, monero_wallet, get_network_type);
}
Expand Down Expand Up @@ -306,6 +310,10 @@ class PyMoneroWallet : public monero_wallet {
PYBIND11_OVERRIDE(void, monero_wallet, start_syncing, sync_period_in_ms);
}

void stop_syncing() override {
PYBIND11_OVERRIDE(void, monero_wallet, stop_syncing);
}

void scan_txs(const std::vector<std::string>& tx_hashes) override {
PYBIND11_OVERRIDE(void, monero_wallet, scan_txs, tx_hashes);
}
Expand Down Expand Up @@ -370,6 +378,22 @@ class PyMoneroWallet : public monero_wallet {
PYBIND11_OVERRIDE(monero_account, monero_wallet, create_account, label);
}

void tag_accounts(const std::string& tag, const std::vector<uint32_t>& account_indices) override {
PYBIND11_OVERRIDE(void, monero_wallet, tag_accounts, tag, account_indices);
}

void untag_accounts(const std::vector<uint32_t>& account_indices) override {
PYBIND11_OVERRIDE(void, monero_wallet, untag_accounts, account_indices);
}

std::vector<std::shared_ptr<monero_account_tag>> get_account_tags() const override {
PYBIND11_OVERRIDE(std::vector<std::shared_ptr<monero_account_tag>>, monero_wallet, get_account_tags);
}

void set_account_tag_label(const std::string& tag, const std::string& label) override {
PYBIND11_OVERRIDE(void, monero_wallet, set_account_tag_label, tag, label);
}

std::vector<monero_subaddress> get_subaddresses(uint32_t account_idx) const override {
PYBIND11_OVERRIDE(std::vector<monero_subaddress>, monero_wallet, get_subaddresses, account_idx);
}
Expand Down
Loading
Loading