mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-08-26 07:11:13 +00:00
fix: update 1
This commit is contained in:
+26
-15
@@ -9,7 +9,10 @@ use rpc_primitives::{
|
||||
|
||||
use crate::{
|
||||
rpc_error_responce_inverter,
|
||||
types::{err_rpc::cast_seq_client_error_into_rpc_error, rpc_structs::{RegisterAccountRequest, RegisterAccountResponse, SendTxRequest}},
|
||||
types::{
|
||||
err_rpc::cast_seq_client_error_into_rpc_error,
|
||||
rpc_structs::{RegisterAccountRequest, RegisterAccountResponse, SendTxRequest},
|
||||
},
|
||||
};
|
||||
|
||||
use super::{respond, types::err_rpc::RpcErr, JsonHandler};
|
||||
@@ -31,21 +34,25 @@ impl JsonHandler {
|
||||
}
|
||||
}
|
||||
|
||||
async fn process_register_account(&self, request: Request) -> Result<Value, RpcErr> {
|
||||
let req = RegisterAccountRequest::parse(Some(request.params))?;
|
||||
// async fn process_register_account(&self, request: Request) -> Result<Value, RpcErr> {
|
||||
// let req = RegisterAccountRequest::parse(Some(request.params))?;
|
||||
|
||||
{
|
||||
let guard = self.node_chain_store.lock().await;
|
||||
// {
|
||||
// let guard = self.node_chain_store.lock().await;
|
||||
|
||||
guard.sequencer_client.register_account(&guard.main_acc).await.map_err(cast_seq_client_error_into_rpc_error)?;
|
||||
}
|
||||
// guard
|
||||
// .sequencer_client
|
||||
// .register_account(&guard.main_acc)
|
||||
// .await
|
||||
// .map_err(cast_seq_client_error_into_rpc_error)?;
|
||||
// }
|
||||
|
||||
let helperstruct = RegisterAccountResponse {
|
||||
status: "success".to_string()
|
||||
};
|
||||
// let helperstruct = RegisterAccountResponse {
|
||||
// status: "success".to_string(),
|
||||
// };
|
||||
|
||||
respond(helperstruct)
|
||||
}
|
||||
// respond(helperstruct)
|
||||
// }
|
||||
|
||||
async fn process_send_tx(&self, request: Request) -> Result<Value, RpcErr> {
|
||||
let req = SendTxRequest::parse(Some(request.params))?;
|
||||
@@ -53,11 +60,15 @@ impl JsonHandler {
|
||||
{
|
||||
let guard = self.node_chain_store.lock().await;
|
||||
|
||||
guard.sequencer_client.send_tx(req.transaction).await.map_err(cast_seq_client_error_into_rpc_error)?;
|
||||
guard
|
||||
.sequencer_client
|
||||
.send_tx(req.transaction)
|
||||
.await
|
||||
.map_err(cast_seq_client_error_into_rpc_error)?;
|
||||
}
|
||||
|
||||
let helperstruct = RegisterAccountResponse {
|
||||
status: "success".to_string()
|
||||
status: "success".to_string(),
|
||||
};
|
||||
|
||||
respond(helperstruct)
|
||||
@@ -66,7 +77,7 @@ impl JsonHandler {
|
||||
pub async fn process_request_internal(&self, request: Request) -> Result<Value, RpcErr> {
|
||||
match request.method.as_ref() {
|
||||
//Todo : Add handling of more JSON RPC methods
|
||||
"register_account" => self.process_register_account(request).await,
|
||||
//"register_account" => self.process_register_account(request).await,
|
||||
"send_tx" => self.process_send_tx(request).await,
|
||||
_ => Err(RpcErr(RpcError::method_not_found(request.method))),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user