summaryrefslogtreecommitdiff
path: root/impls/monero.rs/src
diff options
context:
space:
mode:
Diffstat (limited to 'impls/monero.rs/src')
-rw-r--r--impls/monero.rs/src/lib.rs22
-rw-r--r--impls/monero.rs/src/main.rs26
2 files changed, 11 insertions, 37 deletions
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<Arc<Self>> {
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(())
-}