Skip to content

Commit

Permalink
Merge pull request #14 from DeFiCh/canonbrother/clone-block
Browse files Browse the repository at this point in the history
Fix: clone block + tx, Vout & VinStandard typing
  • Loading branch information
canonbrother authored Jul 1, 2024
2 parents 80154ed + 332a5c6 commit bd540ae
Showing 1 changed file with 11 additions and 11 deletions.
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

0 comments on commit bd540ae

Please sign in to comment.