Skip to content

Commit

Permalink
feat(btcio): PreviousTransactionOutput for signrawtx
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Jan 22, 2025
1 parent 8cf5bbe commit 5994041
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions crates/btcio/src/rpc/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,46 @@ pub struct SignRawTransactionWithWallet {
pub errors: Option<Vec<SignRawTransactionWithWalletError>>,
}

/// Models the optional previous transaction outputs argument for the method
/// `signrawtransactionwithwallet`.
///
/// These are the outputs that this transaction depends on but may not yet be in the block chain.
/// Widely used for One Parent One Child (1P1C) Relay in Bitcoin >28.0.
///
/// > transaction outputs
/// > [
/// > { (json object)
/// > "txid": "hex", (string, required) The transaction id
/// > "vout": n, (numeric, required) The output number
/// > "scriptPubKey": "hex", (string, required) The output script
/// > "redeemScript": "hex", (string, optional) (required for P2SH) redeem script
/// > "witnessScript": "hex", (string, optional) (required for P2WSH or P2SH-P2WSH) witness
/// > script
/// > "amount": amount, (numeric or string, optional) (required for Segwit inputs) the
/// > amount spent
/// > },
/// > ...
/// > ]
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct PreviousTransactionOutput {
/// The transaction id.
#[serde(deserialize_with = "deserialize_txid")]
pub txid: Txid,
/// The output number.
pub vout: u32,
/// The output script.
#[serde(rename = "scriptPubKey")]
pub script_pubkey: String,
/// The redeem script.
#[serde(rename = "redeemScript")]
pub redeem_script: Option<String>,
/// The witness script.
#[serde(rename = "witnessScript")]
pub witness_script: Option<String>,
/// The amount spent.
pub amount: Option<f64>,
}

/// Models the result of the JSON-RPC method `listdescriptors`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct ListDescriptors {
Expand Down

0 comments on commit 5994041

Please sign in to comment.