added 'deposit' to rpc

This commit is contained in:
lunar-mining
2021-07-20 19:01:25 +02:00
parent a1b5e93c95
commit 23dc8547cd
2 changed files with 14 additions and 0 deletions

View File

@@ -64,6 +64,12 @@ impl RpcAdapter {
Ok(())
}
pub fn deposit(&self) -> Result<()> {
debug!(target: "deposit", "deposit: START");
let (public, private) = self.wallet.key_gen();
self.wallet.put_keypair(public, private)?;
Ok(())
}
//pub async fn walletdb(&self) -> WalletPtr {
// self.wallet.clone();
//}

View File

@@ -238,6 +238,14 @@ impl RpcInterface {
}
});
let self1 = self.clone();
io.add_method("deposit", move |_| {
let self2 = self1.clone();
async move {
Ok(jsonrpc_core::Value::String("Initiating deposit... ".into()))
}
});
io.add_method("transfer", |params: jsonrpc_core::Params| async move {
let parsed: TransferParams = params.parse().unwrap();
println!("test transfer params: {:?}", parsed);