54 lines
1.1 KiB
Rust
Raw Normal View History

2024-12-05 13:05:58 +02:00
use serde::{Deserialize, Serialize};
2024-12-03 09:32:35 +02:00
2025-11-26 00:27:20 +03:00
// Requests
2024-12-05 13:05:58 +02:00
#[derive(Serialize, Deserialize, Debug)]
pub struct SendTxRequest {
2025-08-12 12:18:13 -03:00
pub transaction: Vec<u8>,
2024-12-05 13:05:58 +02:00
}
2025-11-26 00:27:20 +03:00
// Responses
2024-12-05 13:05:58 +02:00
#[derive(Serialize, Deserialize, Debug)]
pub struct SendTxResponse {
pub status: String,
2025-08-21 15:58:31 +03:00
pub tx_hash: String,
2024-12-05 13:05:58 +02:00
}
2025-11-26 00:27:20 +03:00
// General
2024-12-05 13:05:58 +02:00
#[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,
2025-11-26 00:27:20 +03:00
// ToDo: Correct checking of id
2024-12-05 13:05:58 +02:00
id: 1,
}
}
}
#[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
}
2025-07-30 14:01:40 +03:00
#[derive(Debug, Serialize, Deserialize, Clone)]
/// Helperstruct for account serialization
2025-07-30 14:01:40 +03:00
pub struct AccountInitialData {
/// Hex encoded account id
pub account_id: String,
2025-07-30 14:01:40 +03:00
pub balance: u64,
}