mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-07 15:53:14 +00:00
fix process rs
This commit is contained in:
parent
93ef263c5e
commit
c617fcc6e4
@ -16,6 +16,17 @@ use common::rpc_primitives::requests::{
|
|||||||
|
|
||||||
use super::{respond, types::err_rpc::RpcErr, JsonHandler};
|
use super::{respond, types::err_rpc::RpcErr, JsonHandler};
|
||||||
|
|
||||||
|
pub const HELLO: &str = "hello";
|
||||||
|
pub const REGISTER_ACCOUNT: &str = "register_account";
|
||||||
|
pub const SEND_TX: &str = "send_tx";
|
||||||
|
pub const GET_BLOCK: &str = "get_block";
|
||||||
|
pub const GET_GENESIS: &str = "get_genesis";
|
||||||
|
pub const GET_LAST_BLOCK: &str = "get_last_block";
|
||||||
|
|
||||||
|
pub const HELLO_FROM_SEQUENCER: &str = "HELLO_FROM_SEQUENCER";
|
||||||
|
|
||||||
|
pub const SUCCESS: &str = "Success";
|
||||||
|
|
||||||
impl JsonHandler {
|
impl JsonHandler {
|
||||||
pub async fn process(&self, message: Message) -> Result<Message, HttpError> {
|
pub async fn process(&self, message: Message) -> Result<Message, HttpError> {
|
||||||
let id = message.id();
|
let id = message.id();
|
||||||
@ -38,7 +49,7 @@ impl JsonHandler {
|
|||||||
let _hello_request = HelloRequest::parse(Some(request.params))?;
|
let _hello_request = HelloRequest::parse(Some(request.params))?;
|
||||||
|
|
||||||
let helperstruct = HelloResponse {
|
let helperstruct = HelloResponse {
|
||||||
greeting: "HELLO_FROM_SEQUENCER".to_string(),
|
greeting: HELLO_FROM_SEQUENCER.to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
respond(helperstruct)
|
respond(helperstruct)
|
||||||
@ -58,7 +69,7 @@ impl JsonHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let helperstruct = RegisterAccountResponse {
|
let helperstruct = RegisterAccountResponse {
|
||||||
status: "Success".to_string(),
|
status: SUCCESS.to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
respond(helperstruct)
|
respond(helperstruct)
|
||||||
@ -77,7 +88,7 @@ impl JsonHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let helperstruct = SendTxResponse {
|
let helperstruct = SendTxResponse {
|
||||||
status: "Success".to_string(),
|
status: SUCCESS.to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
respond(helperstruct)
|
respond(helperstruct)
|
||||||
@ -130,12 +141,12 @@ impl JsonHandler {
|
|||||||
|
|
||||||
pub async fn process_request_internal(&self, request: Request) -> Result<Value, RpcErr> {
|
pub async fn process_request_internal(&self, request: Request) -> Result<Value, RpcErr> {
|
||||||
match request.method.as_ref() {
|
match request.method.as_ref() {
|
||||||
"hello" => self.process_temp_hello(request).await,
|
HELLO => self.process_temp_hello(request).await,
|
||||||
"register_account" => self.process_register_account_request(request).await,
|
REGISTER_ACCOUNT => self.process_register_account_request(request).await,
|
||||||
"send_tx" => self.process_send_tx(request).await,
|
SEND_TX => self.process_send_tx(request).await,
|
||||||
"get_block" => self.process_get_block_data(request).await,
|
GET_BLOCK => self.process_get_block_data(request).await,
|
||||||
"get_genesis" => self.process_get_genesis(request).await,
|
GET_GENESIS => self.process_get_genesis(request).await,
|
||||||
"get_last_block" => self.process_get_last_block(request).await,
|
GET_LAST_BLOCK => self.process_get_last_block(request).await,
|
||||||
_ => Err(RpcErr(RpcError::method_not_found(request.method))),
|
_ => Err(RpcErr(RpcError::method_not_found(request.method))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user