diff --git a/README.md b/README.md index 48ecb0b..10da636 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ An HTTP server will be needed to handle HTTPS requests and serve the frontend. S Install Monero node or choose a [public one](https://monero.fail/). -Configure and start [monero-wallet-rpc](https://monerodocs.org/interacting/monero-wallet-rpc-reference/) daemon. +Configure and start [monero-wallet-rpc](https://monerodocs.org/interacting/monero-wallet-rpc-reference/) daemon. Add `disable-rpc-login=1` to your `monero-wallet-rpc` config (currently RPC auth is not supported in Mitra). Create a wallet for your instance. diff --git a/contrib/mitra_config.yaml b/contrib/mitra_config.yaml index 7e68aa1..3ebfd70 100644 --- a/contrib/mitra_config.yaml +++ b/contrib/mitra_config.yaml @@ -51,8 +51,8 @@ registrations_open: false # - chain_id: monero:mainnet # node_url: 'http://opennode.xmr-tw.org:18089' # wallet_url: 'http://127.0.0.1:18083' -# wallet_name: mitra -# wallet_password: mitra +# wallet_name: null +# wallet_password: null # IPFS integration diff --git a/src/cli.rs b/src/cli.rs index 8273e5a..4b3c5d8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -385,6 +385,7 @@ impl ResetSubscriptions { } /// Create Monero wallet +/// (can be used when monero-wallet-rpc runs with --wallet-dir option) #[derive(Parser)] pub struct CreateMoneroWallet { name: String, diff --git a/src/config/blockchain.rs b/src/config/blockchain.rs index a40820d..bb55bab 100644 --- a/src/config/blockchain.rs +++ b/src/config/blockchain.rs @@ -56,7 +56,9 @@ pub struct MoneroConfig { #[serde(alias = "daemon_url")] pub node_url: String, pub wallet_url: String, - pub wallet_name: String, + // Wallet name and password are required when + // monero-wallet-rpc is running with --wallet-dir option + pub wallet_name: Option, pub wallet_password: Option, } diff --git a/src/monero/wallet.rs b/src/monero/wallet.rs index 88204d0..4934a10 100644 --- a/src/monero/wallet.rs +++ b/src/monero/wallet.rs @@ -36,7 +36,7 @@ pub enum MoneroError { OtherError(&'static str), } -/// http://monerotoruzizulg5ttgat2emf4d6fbmiea25detrmmy7erypseyteyd.onion/resources/developer-guides/wallet-rpc.html#create_wallet +/// https://monerodocs.org/interacting/monero-wallet-rpc-reference/#create_wallet pub async fn create_monero_wallet( config: &MoneroConfig, name: String, @@ -48,14 +48,17 @@ pub async fn create_monero_wallet( Ok(()) } +/// https://monerodocs.org/interacting/monero-wallet-rpc-reference/#open_wallet pub async fn open_monero_wallet( config: &MoneroConfig, ) -> Result { let wallet_client = RpcClient::new(config.wallet_url.clone()).wallet(); - wallet_client.open_wallet( - config.wallet_name.clone(), - config.wallet_password.clone(), - ).await?; + if let Some(ref wallet_name) = config.wallet_name { + wallet_client.open_wallet( + wallet_name.clone(), + config.wallet_password.clone(), + ).await?; + }; Ok(wallet_client) } @@ -89,7 +92,7 @@ pub async fn get_subaddress_balance( Ok(subaddress_data) } -/// http://monerotoruzizulg5ttgat2emf4d6fbmiea25detrmmy7erypseyteyd.onion/resources/developer-guides/wallet-rpc.html#sweep_all +/// https://monerodocs.org/interacting/monero-wallet-rpc-reference/#sweep_all pub async fn send_monero( wallet_client: &WalletClient, from_address: u32,