Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: derive Clone for all RPC types #90

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions cmd/crates/soroban-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub enum Error {
MissingOp,
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct SendTransactionResponse {
pub hash: String,
pub status: String,
Expand All @@ -124,7 +124,7 @@ pub struct SendTransactionResponse {
pub latest_ledger_close_time: u32,
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct GetTransactionResponseRaw {
pub status: String,
#[serde(
Expand All @@ -144,7 +144,7 @@ pub struct GetTransactionResponseRaw {
// TODO: add ledger info and application order
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct GetTransactionResponse {
pub status: String,
pub envelope: Option<xdr::TransactionEnvelope>,
Expand Down Expand Up @@ -209,7 +209,7 @@ impl GetTransactionResponse {
}
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct LedgerEntryResult {
pub key: String,
pub xdr: String,
Expand All @@ -224,14 +224,14 @@ pub struct LedgerEntryResult {
pub live_until_ledger_seq_ledger_seq: Option<u32>,
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct GetLedgerEntriesResponse {
pub entries: Option<Vec<LedgerEntryResult>>,
#[serde(rename = "latestLedger")]
pub latest_ledger: i64,
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct GetNetworkResponse {
#[serde(
rename = "friendbotUrl",
Expand All @@ -244,15 +244,15 @@ pub struct GetNetworkResponse {
pub protocol_version: u32,
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct GetLatestLedgerResponse {
pub id: String,
#[serde(rename = "protocolVersion")]
pub protocol_version: u32,
pub sequence: u32,
}

#[derive(serde::Deserialize, serde::Serialize, Debug, Default)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Default, Clone)]
pub struct Cost {
#[serde(
rename = "cpuInsns",
Expand All @@ -266,20 +266,20 @@ pub struct Cost {
pub mem_bytes: u64,
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct SimulateHostFunctionResultRaw {
#[serde(deserialize_with = "deserialize_default_from_null")]
pub auth: Vec<String>,
pub xdr: String,
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct SimulateHostFunctionResult {
pub auth: Vec<SorobanAuthorizationEntry>,
pub xdr: xdr::ScVal,
}

#[derive(serde::Deserialize, serde::Serialize, Debug, Default)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Default, Clone)]
pub struct SimulateTransactionResponse {
#[serde(
rename = "minResourceFee",
Expand Down Expand Up @@ -354,7 +354,7 @@ impl SimulateTransactionResponse {
}
}

#[derive(serde::Deserialize, serde::Serialize, Debug, Default)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Default, Clone)]
pub struct RestorePreamble {
#[serde(rename = "transactionData")]
pub transaction_data: String,
Expand All @@ -365,7 +365,7 @@ pub struct RestorePreamble {
pub min_resource_fee: u64,
}

#[derive(serde::Deserialize, serde::Serialize, Debug)]
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct GetEventsResponse {
#[serde(deserialize_with = "deserialize_default_from_null")]
pub events: Vec<Event>,
Expand Down Expand Up @@ -532,15 +532,15 @@ pub enum EventStart {
Cursor(String),
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct FullLedgerEntry {
pub key: LedgerKey,
pub val: LedgerEntryData,
pub last_modified_ledger: u32,
pub live_until_ledger_seq: u32,
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct FullLedgerEntries {
pub entries: Vec<FullLedgerEntry>,
pub latest_ledger: i64,
Expand Down
Loading