From a046d9002345918bc39dd53c8b13885b2db84263 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Sat, 12 Oct 2024 02:25:46 -0500 Subject: replace main.rs demo with integration tests TODO unit and docs tests --- impls/monero.rs/src/lib.rs | 22 +++++++++++----------- impls/monero.rs/src/main.rs | 26 -------------------------- 2 files changed, 11 insertions(+), 37 deletions(-) delete mode 100644 impls/monero.rs/src/main.rs (limited to 'impls/monero.rs/src') diff --git a/impls/monero.rs/src/lib.rs b/impls/monero.rs/src/lib.rs index 7c21c9d..c9b1d81 100644 --- a/impls/monero.rs/src/lib.rs +++ b/impls/monero.rs/src/lib.rs @@ -6,6 +6,17 @@ use std::sync::Arc; use libloading::{Library, Symbol}; +#[cfg(target_os = "android")] +const LIB_NAME: &str = "libmonero_libwallet2_api_c.so"; +#[cfg(target_os = "ios")] +const LIB_NAME: &str = "MoneroWallet.framework/MoneroWallet"; +#[cfg(target_os = "linux")] +const LIB_NAME: &str = "monero_libwallet2_api_c.so"; +#[cfg(target_os = "macos")] +const LIB_NAME: &str = "monero_libwallet2_api_c.dylib"; +#[cfg(target_os = "windows")] +const LIB_NAME: &str = "monero_libwallet2_api_c.dll"; + pub mod network { use std::os::raw::c_int; pub const MAINNET: c_int = 0; @@ -28,17 +39,6 @@ pub struct WalletManager { library: Library, } -#[cfg(target_os = "android")] -const LIB_NAME: &str = "libmonero_libwallet2_api_c.so"; -#[cfg(target_os = "ios")] -const LIB_NAME: &str = "MoneroWallet.framework/MoneroWallet"; -#[cfg(target_os = "linux")] -const LIB_NAME: &str = "monero_libwallet2_api_c.so"; -#[cfg(target_os = "macos")] -const LIB_NAME: &str = "monero_libwallet2_api_c.dylib"; -#[cfg(target_os = "windows")] -const LIB_NAME: &str = "monero_libwallet2_api_c.dll"; - impl WalletManager { /// Creates a new `WalletManager`, loading the Monero wallet library (`wallet2_api_c`). pub fn new(lib_path: Option<&str>) -> WalletResult> { diff --git a/impls/monero.rs/src/main.rs b/impls/monero.rs/src/main.rs deleted file mode 100644 index 099c6d4..0000000 --- a/impls/monero.rs/src/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -use monero_rust::{network, WalletError, WalletManager}; - -fn main() -> Result<(), WalletError> { - let wallet_manager = WalletManager::new(None)?; - - let wallet = wallet_manager.create_wallet( - "wallet_name", - "password", - "English", - network::MAINNET, - )?; - - println!("Wallet created successfully."); - - match wallet.get_seed("") { - Ok(seed) => println!("Seed: {}", seed), - Err(e) => eprintln!("Failed to get seed: {:?}", e), - } - - match wallet.get_address(0, 0) { - Ok(address) => println!("Primary address: {}", address), - Err(e) => eprintln!("Failed to get address: {:?}", e), - } - - Ok(()) -} -- cgit v1.2.3