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

Fix: clone block + tx, Vout & VinStandard typing #14

Merged
merged 4 commits into from
Jul 1, 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
22 changes: 11 additions & 11 deletions json/src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct BlockchainInfo {
warnings: String,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Block<T> {
pub hash: BlockHash,
Expand Down Expand Up @@ -79,7 +79,7 @@ pub struct BlockHeader {
nextblockhash: String,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Transaction {
pub txid: Txid,
Expand All @@ -94,44 +94,44 @@ pub struct Transaction {
pub hex: String,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ScriptSig {
asm: String,
pub hex: Option<String>,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(untagged)]
pub enum Vin {
Coinbase(VinCoinbase),
Standard(VinStandard),
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct VinCoinbase {
pub coinbase: String,
pub sequence: i64,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct VinStandard {
pub txid: Txid,
pub vout: u64,
pub vout: usize,
pub script_sig: ScriptSig,
pub txinwitness: Option<Vec<String>>,
pub sequence: i64,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Vout {
pub value: f64,
pub n: u64,
pub n: usize,
pub script_pub_key: ScriptPubKey,
pub token_id: Option<u64>,
pub token_id: Option<u32>,
}

#[derive(Debug, Serialize, Deserialize)]
Expand All @@ -157,7 +157,7 @@ pub struct TxOutSetInfo {
total_amount: i64,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ScriptPubKey {
pub asm: String,
Expand Down
Loading