summaryrefslogtreecommitdiff
path: root/impls/monero.rs/example/src/main.rs
diff options
context:
space:
mode:
authorsneurlax <sneurlax@gmail.com>2024-10-12 01:55:27 -0500
committersneurlax <sneurlax@gmail.com>2024-10-12 01:55:27 -0500
commitdc103c890cc1752f246fef3f8e472bc852ddd487 (patch)
tree703e210358fe6759a626f008271a0069a6537358 /impls/monero.rs/example/src/main.rs
parent44c1676a0982a60626b7f0b03702ac287df2304e (diff)
refactor library loading
and update docs
Diffstat (limited to 'impls/monero.rs/example/src/main.rs')
-rw-r--r--impls/monero.rs/example/src/main.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/impls/monero.rs/example/src/main.rs b/impls/monero.rs/example/src/main.rs
index aae688b..099c6d4 100644
--- a/impls/monero.rs/example/src/main.rs
+++ b/impls/monero.rs/example/src/main.rs
@@ -1,25 +1,26 @@
-use monero_rust::{WalletError, WalletManager, NETWORK_TYPE_MAINNET};
+use monero_rust::{network, WalletError, WalletManager};
fn main() -> Result<(), WalletError> {
let wallet_manager = WalletManager::new(None)?;
let wallet = wallet_manager.create_wallet(
- "wallet",
+ "wallet_name",
"password",
"English",
- NETWORK_TYPE_MAINNET,
+ network::MAINNET,
)?;
+ println!("Wallet created successfully.");
+
match wallet.get_seed("") {
Ok(seed) => println!("Seed: {}", seed),
- Err(e) => {
- eprintln!("Failed to get seed: {:?}", e);
- return Err(e);
- }
+ Err(e) => eprintln!("Failed to get seed: {:?}", e),
}
- let address = wallet.get_address(0, 0)?;
- println!("Wallet Address: {}", address);
+ match wallet.get_address(0, 0) {
+ Ok(address) => println!("Primary address: {}", address),
+ Err(e) => eprintln!("Failed to get address: {:?}", e),
+ }
Ok(())
}