Monero C++ Library
Classes | Enumerations | Functions
monero Namespace Reference

Classes

struct  monero_account
 
struct  monero_block
 
struct  monero_block_header
 
struct  monero_check
 
struct  monero_check_reserve
 
struct  monero_check_tx
 
struct  monero_destination
 
struct  monero_incoming_transfer
 
struct  monero_integrated_address
 
struct  monero_key_image
 
struct  monero_key_image_import_result
 
struct  monero_multisig_info
 
struct  monero_multisig_init_result
 
struct  monero_multisig_sign_result
 
struct  monero_outgoing_transfer
 
struct  monero_output
 
struct  monero_output_query
 
struct  monero_output_wallet
 
struct  monero_rpc_connection
 
struct  monero_send_request
 
struct  monero_subaddress
 
class  monero_sync_listener
 
struct  monero_sync_result
 
struct  monero_transfer
 
struct  monero_transfer_query
 
struct  monero_tx
 
struct  monero_tx_query
 
struct  monero_tx_set
 
struct  monero_tx_wallet
 
class  monero_wallet
 
class  monero_wallet_listener
 
struct  serializable_struct
 
struct  sync_listener_wrapper
 
struct  wallet2_listener
 

Enumerations

enum  monero_network_type : uint8_t { MAINNET = 0, TESTNET, STAGENET }
 
enum  monero_send_priority : uint8_t { DEFAULT = 0, UNIMPORTANT, NORMAL, ELEVATED }
 

Functions

void merge_tx (vector< shared_ptr< monero_tx >> &txs, const shared_ptr< monero_tx > &tx)
 
bool bool_equals (bool val, const boost::optional< bool > &opt_val)
 
shared_ptr< monero_tx_wallet > build_tx_with_incoming_transfer (const tools::wallet2 &m_w2, uint64_t height, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd)
 
shared_ptr< monero_tx_wallet > build_tx_with_outgoing_transfer (const tools::wallet2 &m_w2, uint64_t height, const crypto::hash &txid, const tools::wallet2::confirmed_transfer_details &pd)
 
shared_ptr< monero_tx_wallet > build_tx_with_incoming_transfer_unconfirmed (const tools::wallet2 &m_w2, const crypto::hash &payment_id, const tools::wallet2::pool_payment_details &ppd)
 
shared_ptr< monero_tx_wallet > build_tx_with_outgoing_transfer_unconfirmed (const tools::wallet2 &m_w2, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd)
 
shared_ptr< monero_tx_wallet > build_tx_with_vout (const tools::wallet2 &m_w2, const tools::wallet2::transfer_details &td)
 
void merge_tx (const shared_ptr< monero_tx_wallet > &tx, map< string, shared_ptr< monero_tx_wallet >> &tx_map, map< uint64_t, shared_ptr< monero_block >> &block_map, bool skip_if_absent)
 
bool tx_height_less_than (const shared_ptr< monero_tx > &tx1, const shared_ptr< monero_tx > &tx2)
 
bool incoming_transfer_before (const shared_ptr< monero_incoming_transfer > &transfer1, const shared_ptr< monero_incoming_transfer > &transfer2)
 
bool vout_before (const shared_ptr< monero_output > &o1, const shared_ptr< monero_output > &o2)
 
std::string get_default_ringdb_path (cryptonote::network_type nettype)
 
bool validate_transfer (wallet2 *m_w2, const std::list< wallet_rpc::transfer_destination > &destinations, const std::string &payment_id, std::vector< cryptonote::tx_destination_entry > &dsts, std::vector< uint8_t > &extra, bool at_least_one_destination, epee::json_rpc::error &er)
 
template<typename Ts , typename Tu >
bool fill_response (wallet2 *m_w2, std::vector< tools::wallet2::pending_tx > &ptx_vector, bool get_tx_key, Ts &tx_key, Tu &amount, Tu &fee, std::string &multisig_txset, std::string &unsigned_txset, bool do_not_relay, Ts &tx_hash, bool get_tx_hex, Ts &tx_blob, bool get_tx_metadata, Ts &tx_metadata, epee::json_rpc::error &er)
 
void merge_incoming_transfer (vector< shared_ptr< monero_incoming_transfer >> &transfers, const shared_ptr< monero_incoming_transfer > &transfer)
 

Detailed Description

Copyright (c) 2017-2019 woodser

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Parts of this file are originally copyright (c) 2014-2019, The Monero Project

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

All rights reserved.

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developersPublic library intereface.

Public library interface.

Copyright (c) 2017-2019 woodser

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Parts of this file are originally copyright (c) 2014-2019, The Monero Project

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

All rights reserved.

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developersPublic library interface.

Public interface for libmonero-cpp library.

Enumeration Type Documentation

◆ monero_network_type

Enumerates Monero network types.

◆ monero_send_priority

Enumerates Monero network types.

Function Documentation

◆ incoming_transfer_before()

bool monero::incoming_transfer_before ( const shared_ptr< monero_incoming_transfer > &  transfer1,
const shared_ptr< monero_incoming_transfer > &  transfer2 
)

Returns true iff transfer1 is ordered before transfer2 by ascending account and subaddress indices.

◆ merge_tx()

void monero::merge_tx ( const shared_ptr< monero_tx_wallet > &  tx,
map< string, shared_ptr< monero_tx_wallet >> &  tx_map,
map< uint64_t, shared_ptr< monero_block >> &  block_map,
bool  skip_if_absent 
)

Merges a transaction into a unique set of transactions.

TODO monero-core: skip_if_absent only necessary because incoming payments not returned when sent from/to same account #4500

Parameters
txis the transaction to merge into the existing txs
tx_mapmaps tx ids to txs
block_mapmaps block heights to blocks
skip_if_absentspecifies if the tx should not be added if it doesn't already exist

◆ tx_height_less_than()

bool monero::tx_height_less_than ( const shared_ptr< monero_tx > &  tx1,
const shared_ptr< monero_tx > &  tx2 
)

Returns true iff tx1's height is known to be less than tx2's height for sorting.

◆ validate_transfer()

bool monero::validate_transfer ( wallet2 *  m_w2,
const std::list< wallet_rpc::transfer_destination > &  destinations,
const std::string &  payment_id,
std::vector< cryptonote::tx_destination_entry > &  dsts,
std::vector< uint8_t > &  extra,
bool  at_least_one_destination,
epee::json_rpc::error &  er 
)

-------------— DUPLICATED WALLET RPC TRANSFER CODE ------------------—

These functions are duplicated from private functions in wallet rpc on_transfer/on_transfer_split, with minor modifications to not be class members.

This code is used to generate and send transactions with equivalent functionality as wallet rpc.

Duplicated code is not ideal. Solutions considered:

(1) Duplicate wallet rpc code as done here. (2) Modify monero-wallet-rpc on_transfer() / on_transfer_split() to be public. (3) Modify monero-wallet-rpc to make this class a friend. (4) Move all logic in monero-wallet-rpc to wallet2 so all users can access.

Options 2-4 require modification of Monero Core C++. Of those, (4) is probably ideal. TODO: open patch on Monero core which moves common wallet rpc logic (e.g. on_transfer, on_transfer_split) to m_w2.

Until then, option (1) is used because it allows Monero Core binaries to be used without modification, it's easy, and anything other than (4) is temporary.

◆ vout_before()

bool monero::vout_before ( const shared_ptr< monero_output > &  o1,
const shared_ptr< monero_output > &  o2 
)

Returns true iff wallet vout1 is ordered before vout2 by ascending account and subaddress indices then index.