2025-07-14 09:37:00 -03:00
|
|
|
use common::transaction::SignedTransaction;
|
2024-12-05 13:05:58 +02:00
|
|
|
use serde::{Deserialize, Serialize};
|
2024-12-03 09:32:35 +02:00
|
|
|
|
2024-12-05 13:05:58 +02:00
|
|
|
//Requests
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
|
|
|
pub struct SendTxRequest {
|
2025-07-14 09:37:00 -03:00
|
|
|
pub transaction: SignedTransaction,
|
2025-05-23 09:04:04 +03:00
|
|
|
///UTXO Commitment Root, Pub Tx Root
|
|
|
|
|
pub tx_roots: [[u8; 32]; 2],
|
2024-12-05 13:05:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Responses
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
|
|
|
pub struct SendTxResponse {
|
|
|
|
|
pub status: String,
|
2024-12-25 09:50:54 +02:00
|
|
|
pub additional_data: Option<String>,
|
2024-12-05 13:05:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//General
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize)]
|
|
|
|
|
pub struct SequencerRpcRequest {
|
|
|
|
|
jsonrpc: String,
|
|
|
|
|
pub method: String,
|
|
|
|
|
pub params: serde_json::Value,
|
|
|
|
|
pub id: u64,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl SequencerRpcRequest {
|
|
|
|
|
pub fn from_payload_version_2_0(method: String, payload: serde_json::Value) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
jsonrpc: "2.0".to_string(),
|
|
|
|
|
method,
|
|
|
|
|
params: payload,
|
|
|
|
|
//ToDo: Correct checking of id
|
|
|
|
|
id: 1,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-29 14:11:47 +02:00
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
|
|
|
pub struct SequencerRpcResponse {
|
|
|
|
|
pub jsonrpc: String,
|
|
|
|
|
pub result: serde_json::Value,
|
|
|
|
|
pub id: u64,
|
2024-12-30 09:10:04 +02:00
|
|
|
}
|