monero-c
C ABI for using Monero
Loading...
Searching...
No Matches
monero_c_utils.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for monero_c_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MONERO_EXPORT   __attribute__((visibility("default")))
 Copyright (c) Libmonero.
 
#define MONERO_C_ABI_VERSION_MAJOR   0
 
#define MONERO_C_ABI_VERSION_MINOR   1
 
#define MONERO_C_ABI_VERSION_PATCH   1
 

Typedefs

typedef enum monero_result monero_result
 
typedef enum monero_utils_network_type monero_utils_network_type
 

Enumerations

enum  monero_result { MONERO_OK = 0 , MONERO_ERROR = -1 }
 
enum  monero_utils_network_type { MONERO_UTILS_NETWORK_MAINNET = 0 , MONERO_UTILS_NETWORK_TESTNET = 1 , MONERO_UTILS_NETWORK_STAGENET = 2 , MONERO_UTILS_NETWORK_REGTEST = 3 }
 

Functions

MONERO_EXPORT const char * monero_last_error (void)
 Return the message of the most recent MONERO_ERROR result on the calling thread, from any monero_c function.
 
MONERO_EXPORT void monero_utils_free (void *ptr)
 Frees a string or byte buffer returned by any monero_utils_* function.
 
MONERO_EXPORT monero_result monero_utils_get_abi_version (uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch)
 Get the version of the C ABI of the loaded library.
 
MONERO_EXPORT void monero_utils_set_log_level (int32_t level)
 Set the log level, which picks default category filters (0 = warnings and errors only, 4 = full trace).
 
MONERO_EXPORT void monero_utils_set_log_categories (const char *categories)
 Set the log categories filter directly, overriding whatever monero_utils_set_log_level() last selected.
 
MONERO_EXPORT void monero_utils_configure_logging (const char *path, bool console)
 Configures where log output is written.
 
MONERO_EXPORT bool monero_utils_is_valid_address (const char *address, int32_t network_type)
 Check whether an address is valid for a given network.
 
MONERO_EXPORT bool monero_utils_is_valid_private_view_key (const char *private_view_key)
 Check whether a private view key is valid.
 
MONERO_EXPORT bool monero_utils_is_valid_private_spend_key (const char *private_spend_key)
 Check whether a private spend key is valid.
 
MONERO_EXPORT bool monero_utils_is_valid_public_view_key (const char *public_view_key)
 Check whether a public view key is valid.
 
MONERO_EXPORT bool monero_utils_is_valid_public_spend_key (const char *public_spend_key)
 Check whether a public spend key is valid.
 
MONERO_EXPORT bool monero_utils_is_valid_payment_id (const char *payment_id)
 Check whether a payment id is valid.
 
MONERO_EXPORT bool monero_utils_is_valid_mnemonic (const char *mnemonic, const char *language)
 Check whether a mnemonic seed is valid.
 
MONERO_EXPORT bool monero_utils_is_valid_language (const char *language)
 Indicates if the given language is valid.
 
MONERO_EXPORT monero_result monero_utils_validate_address (const char *address, int32_t network_type)
 Validate an address for a given network, like monero_utils_is_valid_address() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_validate_private_view_key (const char *private_view_key)
 Validate a private view key, like monero_utils_is_valid_private_view_key() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_validate_private_spend_key (const char *private_spend_key)
 Validate a private spend key, like monero_utils_is_valid_private_spend_key() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_validate_public_view_key (const char *public_view_key)
 Validate a public view key, like monero_utils_is_valid_public_view_key() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_validate_public_spend_key (const char *public_spend_key)
 Validate a public spend key, like monero_utils_is_valid_public_spend_key() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_validate_payment_id (const char *payment_id)
 Validate a payment id, like monero_utils_is_valid_payment_id() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_validate_mnemonic (const char *mnemonic, const char *language)
 Validate a mnemonic seed, like monero_utils_is_valid_mnemonic() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_get_integrated_address (int32_t network_type, const char *standard_address, const char *payment_id, char **out_json)
 Builds an integrated address from a standard address and payment id.
 
MONERO_EXPORT monero_result monero_utils_get_payment_uri (const char *tx_config_json, int32_t network_type, char **out_uri)
 Create a payment URI from a transaction configuration.
 
MONERO_EXPORT monero_result monero_utils_parse_payment_uri (const char *uri, int32_t network_type, char **out_tx_config_json)
 Parse a payment URI into a transaction configuration.
 
MONERO_EXPORT monero_result monero_utils_json_to_binary (const char *json, uint8_t **out_data, size_t *out_len)
 Convert a JSON string to its binary-encoded (portable storage format) equivalent.
 
MONERO_EXPORT monero_result monero_utils_binary_to_json (const uint8_t *data, size_t len, char **out_json)
 Convert a binary-encoded (portable storage format) buffer to its JSON equivalent.
 
MONERO_EXPORT monero_result monero_utils_binary_blocks_to_json (const uint8_t *data, size_t len, char **out_json)
 Decodes a get_blocks.bin-style response.
 
MONERO_EXPORT monero_result monero_utils_binary_blocks_fast_to_json (const uint8_t *data, size_t len, char **out_json)
 Decodes a get_blocks_by_height.bin-style response.
 
MONERO_EXPORT monero_result monero_utils_xmr_to_atomic_units (double amount_xmr, uint64_t *out_atomic_units)
 Convert an amount in XMR to atomic units.
 
MONERO_EXPORT double monero_utils_atomic_units_to_xmr (uint64_t amount_atomic_units)
 Convert an amount in atomic units to XMR.
 
MONERO_EXPORT bool monero_utils_parse_payment_id_long (const char *payment_id_str, uint8_t out_payment_id[32])
 Parse a long payment ID from a string.
 
MONERO_EXPORT bool monero_utils_parse_payment_id_short (const char *payment_id_str, uint8_t out_payment_id[8])
 Parse a short payment ID from a string.
 
MONERO_EXPORT bool monero_utils_is_valid_payment_id_long (const char *payment_id_str)
 Check whether a long payment id is valid.
 
MONERO_EXPORT bool monero_utils_is_valid_payment_id_short (const char *payment_id_str)
 Check whether a short payment id is valid.
 
MONERO_EXPORT monero_result monero_utils_validate_payment_id_long (const char *payment_id_str)
 Validate a long payment id, like monero_utils_is_valid_payment_id_long() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT monero_result monero_utils_validate_payment_id_short (const char *payment_id_str)
 Validate a short payment id, like monero_utils_is_valid_payment_id_short() but reports the reason through monero_last_error() on failure.
 
MONERO_EXPORT int32_t monero_utils_get_ring_size (void)
 Return the network-enforced ring size.
 

Macro Definition Documentation

◆ MONERO_C_ABI_VERSION_MAJOR

#define MONERO_C_ABI_VERSION_MAJOR   0

◆ MONERO_C_ABI_VERSION_MINOR

#define MONERO_C_ABI_VERSION_MINOR   1

◆ MONERO_C_ABI_VERSION_PATCH

#define MONERO_C_ABI_VERSION_PATCH   1

◆ MONERO_EXPORT

#define MONERO_EXPORT   __attribute__((visibility("default")))

Copyright (c) Libmonero.

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) woodser

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 developers

Typedef Documentation

◆ monero_result

◆ monero_utils_network_type

Enumeration Type Documentation

◆ monero_result

Enumerator
MONERO_OK 
MONERO_ERROR 

◆ monero_utils_network_type

Enumerator
MONERO_UTILS_NETWORK_MAINNET 
MONERO_UTILS_NETWORK_TESTNET 
MONERO_UTILS_NETWORK_STAGENET 
MONERO_UTILS_NETWORK_REGTEST 

Function Documentation

◆ monero_last_error()

MONERO_EXPORT const char * monero_last_error ( void  )

Return the message of the most recent MONERO_ERROR result on the calling thread, from any monero_c function.

A successful call doesn't clear it, so read it only after MONERO_ERROR.

Returns
the error message, or "" if none. The pointer belongs to monero-c and stays valid until the next call that fails on this thread. Copy it to keep it. Unlike other monero_utils_* out params, don't pass it to monero_utils_free().

◆ monero_utils_atomic_units_to_xmr()

MONERO_EXPORT double monero_utils_atomic_units_to_xmr ( uint64_t  amount_atomic_units)

Convert an amount in atomic units to XMR.

Parameters
amount_atomic_unitsis the amount in atomic units to convert
Returns
the amount in XMR

◆ monero_utils_binary_blocks_fast_to_json()

MONERO_EXPORT monero_result monero_utils_binary_blocks_fast_to_json ( const uint8_t *  data,
size_t  len,
char **  out_json 
)

Decodes a get_blocks_by_height.bin-style response.

Parameters
datais the binary-encoded buffer to decode
lenis the length of the binary-encoded buffer
out_jsonreceives the decoded JSON string, freed with monero_utils_free(). See monero_utils_binary_to_json().
Returns
MONERO_OK on success, or MONERO_ERROR if the buffer is invalid

◆ monero_utils_binary_blocks_to_json()

MONERO_EXPORT monero_result monero_utils_binary_blocks_to_json ( const uint8_t *  data,
size_t  len,
char **  out_json 
)

Decodes a get_blocks.bin-style response.

Parameters
datais the binary-encoded buffer to decode
lenis the length of the binary-encoded buffer
out_jsonreceives the decoded JSON string, freed with monero_utils_free(). See monero_utils_binary_to_json().
Returns
MONERO_OK on success, or MONERO_ERROR if the buffer is invalid

◆ monero_utils_binary_to_json()

MONERO_EXPORT monero_result monero_utils_binary_to_json ( const uint8_t *  data,
size_t  len,
char **  out_json 
)

Convert a binary-encoded (portable storage format) buffer to its JSON equivalent.

Parameters
datais the binary-encoded buffer to convert
lenis the length of the binary-encoded buffer
out_jsonreceives the decoded JSON string, freed with monero_utils_free()
Returns
MONERO_OK on success, or MONERO_ERROR if the buffer is invalid

◆ monero_utils_configure_logging()

MONERO_EXPORT void monero_utils_configure_logging ( const char *  path,
bool  console 
)

Configures where log output is written.

Parameters
pathis the log file's base path
consoleis whether to also write log output to the console

◆ monero_utils_free()

MONERO_EXPORT void monero_utils_free ( void *  ptr)

Frees a string or byte buffer returned by any monero_utils_* function.

Parameters
ptris the pointer previously returned by a monero_utils_* function

◆ monero_utils_get_abi_version()

MONERO_EXPORT monero_result monero_utils_get_abi_version ( uint32_t *  out_major,
uint32_t *  out_minor,
uint32_t *  out_patch 
)

Get the version of the C ABI of the loaded library.

A binding compares it with the version it was written for, to detect a library that doesn't match.

Parameters
out_majorreceives the major version
out_minorreceives the minor version
out_patchreceives the patch version
Returns
MONERO_OK or MONERO_ERROR

◆ monero_utils_get_integrated_address()

MONERO_EXPORT monero_result monero_utils_get_integrated_address ( int32_t  network_type,
const char *  standard_address,
const char *  payment_id,
char **  out_json 
)

Builds an integrated address from a standard address and payment id.

Parameters
network_typeis the network to validate the address against
standard_addressis the base address to integrate the payment id into
payment_idis the payment id to integrate, or "" to generate a random one
out_jsonreceives a JSON-serialized monero_integrated_address, freed with monero_utils_free()
Returns
MONERO_OK on success, or MONERO_ERROR if the address or payment id is invalid

◆ monero_utils_get_payment_uri()

MONERO_EXPORT monero_result monero_utils_get_payment_uri ( const char *  tx_config_json,
int32_t  network_type,
char **  out_uri 
)

Create a payment URI from a transaction configuration.

Parameters
tx_config_jsonis a JSON-serialized monero_tx_config with exactly one destination (address + amount)
network_typeis the network to format the URI's address for
out_urireceives the payment URI string, freed with monero_utils_free()
Returns
MONERO_OK on success, or MONERO_ERROR if the transaction config is invalid

◆ monero_utils_get_ring_size()

MONERO_EXPORT int32_t monero_utils_get_ring_size ( void  )

Return the network-enforced ring size.

Returns
the ring size (monero_utils::RING_SIZE)

◆ monero_utils_is_valid_address()

MONERO_EXPORT bool monero_utils_is_valid_address ( const char *  address,
int32_t  network_type 
)

Check whether an address is valid for a given network.

Parameters
addressis the address to validate
network_typeis the network to validate the address against
Returns
true if the address is valid, false otherwise

◆ monero_utils_is_valid_language()

MONERO_EXPORT bool monero_utils_is_valid_language ( const char *  language)

Indicates if the given language is valid.

Parameters
languageis the language to validate (case-sensitive, e.g. "English")
Returns
true if the language is valid, false otherwise

◆ monero_utils_is_valid_mnemonic()

MONERO_EXPORT bool monero_utils_is_valid_mnemonic ( const char *  mnemonic,
const char *  language 
)

Check whether a mnemonic seed is valid.

A mnemonic of more than 4096 bytes is never valid.

Parameters
mnemonicis the mnemonic seed to validate
languagerestricts validation to that seed language, or "" to accept any language
Returns
true if the mnemonic is valid, false otherwise

◆ monero_utils_is_valid_payment_id()

MONERO_EXPORT bool monero_utils_is_valid_payment_id ( const char *  payment_id)

Check whether a payment id is valid.

Parameters
payment_idis the payment id to validate, as 16 or 64 hex characters
Returns
true if the payment id is valid, false otherwise

◆ monero_utils_is_valid_payment_id_long()

MONERO_EXPORT bool monero_utils_is_valid_payment_id_long ( const char *  payment_id_str)

Check whether a long payment id is valid.

Parameters
payment_id_stris the payment id to validate, as 64 hex characters
Returns
true if the payment id is valid, false otherwise

◆ monero_utils_is_valid_payment_id_short()

MONERO_EXPORT bool monero_utils_is_valid_payment_id_short ( const char *  payment_id_str)

Check whether a short payment id is valid.

Parameters
payment_id_stris the payment id to validate, as 16 hex characters
Returns
true if the payment id is valid, false otherwise

◆ monero_utils_is_valid_private_spend_key()

MONERO_EXPORT bool monero_utils_is_valid_private_spend_key ( const char *  private_spend_key)

Check whether a private spend key is valid.

Parameters
private_spend_keyis the private spend key to validate
Returns
true if the private spend key is valid, false otherwise

◆ monero_utils_is_valid_private_view_key()

MONERO_EXPORT bool monero_utils_is_valid_private_view_key ( const char *  private_view_key)

Check whether a private view key is valid.

Parameters
private_view_keyis the private view key to validate
Returns
true if the private view key is valid, false otherwise

◆ monero_utils_is_valid_public_spend_key()

MONERO_EXPORT bool monero_utils_is_valid_public_spend_key ( const char *  public_spend_key)

Check whether a public spend key is valid.

Parameters
public_spend_keyis the public spend key to validate
Returns
true if the public spend key is valid, false otherwise

◆ monero_utils_is_valid_public_view_key()

MONERO_EXPORT bool monero_utils_is_valid_public_view_key ( const char *  public_view_key)

Check whether a public view key is valid.

Parameters
public_view_keyis the public view key to validate
Returns
true if the public view key is valid, false otherwise

◆ monero_utils_json_to_binary()

MONERO_EXPORT monero_result monero_utils_json_to_binary ( const char *  json,
uint8_t **  out_data,
size_t *  out_len 
)

Convert a JSON string to its binary-encoded (portable storage format) equivalent.

Parameters
jsonis the JSON string to convert
out_datareceives the binary-encoded buffer, freed with monero_utils_free()
out_lenreceives the length of the binary-encoded buffer
Returns
MONERO_OK on success, or MONERO_ERROR if the JSON is invalid

◆ monero_utils_parse_payment_id_long()

MONERO_EXPORT bool monero_utils_parse_payment_id_long ( const char *  payment_id_str,
uint8_t  out_payment_id[32] 
)

Parse a long payment ID from a string.

Parameters
payment_id_stris the string to parse
out_payment_idreceives the parsed 32-byte payment id if valid
Returns
true if the payment ID is valid, false otherwise

◆ monero_utils_parse_payment_id_short()

MONERO_EXPORT bool monero_utils_parse_payment_id_short ( const char *  payment_id_str,
uint8_t  out_payment_id[8] 
)

Parse a short payment ID from a string.

Parameters
payment_id_stris the string to parse
out_payment_idreceives the parsed 8-byte payment id if valid
Returns
true if the payment ID is valid, false otherwise

◆ monero_utils_parse_payment_uri()

MONERO_EXPORT monero_result monero_utils_parse_payment_uri ( const char *  uri,
int32_t  network_type,
char **  out_tx_config_json 
)

Parse a payment URI into a transaction configuration.

Parameters
uriis the payment URI to parse
network_typeis the network to validate the URI's address against
out_tx_config_jsonreceives a JSON-serialized monero_tx_config parsed from the URI, freed with monero_utils_free()
Returns
MONERO_OK on success, or MONERO_ERROR if the URI is invalid

◆ monero_utils_set_log_categories()

MONERO_EXPORT void monero_utils_set_log_categories ( const char *  categories)

Set the log categories filter directly, overriding whatever monero_utils_set_log_level() last selected.

Parameters
categoriesis a comma-separated list of "category:level" pairs (e.g. "*:WARNING,net:FATAL"). Prefix with '+' to append to the current filter, or '-' to remove matching categories from it

◆ monero_utils_set_log_level()

MONERO_EXPORT void monero_utils_set_log_level ( int32_t  level)

Set the log level, which picks default category filters (0 = warnings and errors only, 4 = full trace).

Use monero_utils_set_log_categories() for finer control.

Parameters
levelis the log level, 0 (least verbose) through 4 (most verbose)

◆ monero_utils_validate_address()

MONERO_EXPORT monero_result monero_utils_validate_address ( const char *  address,
int32_t  network_type 
)

Validate an address for a given network, like monero_utils_is_valid_address() but reports the reason through monero_last_error() on failure.

Parameters
addressis the address to validate
network_typeis the network to validate the address against
Returns
MONERO_OK if the address is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_mnemonic()

MONERO_EXPORT monero_result monero_utils_validate_mnemonic ( const char *  mnemonic,
const char *  language 
)

Validate a mnemonic seed, like monero_utils_is_valid_mnemonic() but reports the reason through monero_last_error() on failure.

A mnemonic of more than 4096 bytes fails.

Parameters
mnemonicis the mnemonic seed to validate
languagerestricts validation to that seed language, or "" to accept any language
Returns
MONERO_OK if the mnemonic is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_payment_id()

MONERO_EXPORT monero_result monero_utils_validate_payment_id ( const char *  payment_id)

Validate a payment id, like monero_utils_is_valid_payment_id() but reports the reason through monero_last_error() on failure.

Parameters
payment_idis the payment id to validate, as 16 or 64 hex characters
Returns
MONERO_OK if the payment id is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_payment_id_long()

MONERO_EXPORT monero_result monero_utils_validate_payment_id_long ( const char *  payment_id_str)

Validate a long payment id, like monero_utils_is_valid_payment_id_long() but reports the reason through monero_last_error() on failure.

Parameters
payment_id_stris the payment id to validate, as 64 hex characters
Returns
MONERO_OK if the payment id is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_payment_id_short()

MONERO_EXPORT monero_result monero_utils_validate_payment_id_short ( const char *  payment_id_str)

Validate a short payment id, like monero_utils_is_valid_payment_id_short() but reports the reason through monero_last_error() on failure.

Parameters
payment_id_stris the payment id to validate, as 16 hex characters
Returns
MONERO_OK if the payment id is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_private_spend_key()

MONERO_EXPORT monero_result monero_utils_validate_private_spend_key ( const char *  private_spend_key)

Validate a private spend key, like monero_utils_is_valid_private_spend_key() but reports the reason through monero_last_error() on failure.

Parameters
private_spend_keyis the private spend key to validate
Returns
MONERO_OK if the private spend key is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_private_view_key()

MONERO_EXPORT monero_result monero_utils_validate_private_view_key ( const char *  private_view_key)

Validate a private view key, like monero_utils_is_valid_private_view_key() but reports the reason through monero_last_error() on failure.

Parameters
private_view_keyis the private view key to validate
Returns
MONERO_OK if the private view key is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_public_spend_key()

MONERO_EXPORT monero_result monero_utils_validate_public_spend_key ( const char *  public_spend_key)

Validate a public spend key, like monero_utils_is_valid_public_spend_key() but reports the reason through monero_last_error() on failure.

Parameters
public_spend_keyis the public spend key to validate
Returns
MONERO_OK if the public spend key is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_validate_public_view_key()

MONERO_EXPORT monero_result monero_utils_validate_public_view_key ( const char *  public_view_key)

Validate a public view key, like monero_utils_is_valid_public_view_key() but reports the reason through monero_last_error() on failure.

Parameters
public_view_keyis the public view key to validate
Returns
MONERO_OK if the public view key is valid, or MONERO_ERROR otherwise (see monero_last_error())

◆ monero_utils_xmr_to_atomic_units()

MONERO_EXPORT monero_result monero_utils_xmr_to_atomic_units ( double  amount_xmr,
uint64_t *  out_atomic_units 
)

Convert an amount in XMR to atomic units.

Parameters
amount_xmris the amount in XMR to convert
out_atomic_unitsreceives the amount in atomic units (1 XMR = 10^12)
Returns
MONERO_OK on success, or MONERO_ERROR if amount_xmr is negative, non-finite, or too large to represent in atomic units