Skip to content
Merged
Show file tree
Hide file tree
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
126 changes: 63 additions & 63 deletions types/src/model/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,63 @@ pub struct Bip9Statistics {
pub possible: Option<bool>,
}

/// Models the result of the JSON-RPC method `getdescriptoractivity`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct GetDescriptorActivity {
/// A list of activity events related to the descriptors.
pub activity: Vec<ActivityEntry>,
}

/// A spend or receive activity entry. Part of `getdescriptoractivity`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum ActivityEntry {
/// The spend activity using `model::SpendActivity`.
Spend(SpendActivity),
/// The receive activity using `model::ReceiveActivity`.
Receive(ReceiveActivity),
}

/// Models a 'spend' activity event. Part of `getdescriptoractivity`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct SpendActivity {
/// The total amount of the spent output.
pub amount: Amount,
/// The blockhash (omitted if unconfirmed).
pub block_hash: Option<BlockHash>,
/// Height of the spend (omitted if unconfirmed).
pub height: Option<u32>,
/// The txid of the spending transaction.
pub spend_txid: Txid,
/// The vout of the spend.
pub spend_vout: u32,
/// The txid of the prevout.
pub prevout_txid: Txid,
/// The vout of the prevout.
pub prevout_vout: u32,
/// The prev scriptPubKey.
pub prevout_spk: ScriptPubkey,
}

/// Models a 'receive' activity event. Part of `getdescriptoractivity`
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ReceiveActivity {
/// The total amount in BTC of the new output.
pub amount: Amount,
/// The block that this receive is in (omitted if unconfirmed).
pub block_hash: Option<BlockHash>,
/// The height of the receive (omitted if unconfirmed).
pub height: Option<u32>,
/// The txid of the receiving transaction.
pub txid: Txid,
/// The vout of the receiving output.
pub vout: u32,
/// The ScriptPubKey.
pub output_spk: ScriptPubkey,
}

/// Models the result of JSON-RPC method `getdifficulty`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
Expand All @@ -520,7 +577,7 @@ pub struct GetMempoolAncestors(pub Vec<Txid>);
#[serde(deny_unknown_fields)]
pub struct GetMempoolAncestorsVerbose(pub BTreeMap<Txid, MempoolEntry>);

/// Models the result of JSON-RPC method `getmempoolancestors` with verbose set to false.
/// Models the result of JSON-RPC method `getmempooldescendants` with verbose set to false.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct GetMempoolDescendants(pub Vec<Txid>);
Expand Down Expand Up @@ -696,68 +753,6 @@ pub struct GetTxSpendingPrevoutItem {
pub spending_txid: Option<Txid>,
}

/// Models the result of JSON-RPC method `verifytxoutproof`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct VerifyTxOutProof(pub Vec<Txid>);

/// Models the result of the JSON-RPC method `getdescriptoractivity`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct GetDescriptorActivity {
/// A list of activity events related to the descriptors.
pub activity: Vec<ActivityEntry>,
}

/// A spend or receive activity entry. Part of `getdescriptoractivity`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum ActivityEntry {
/// The spend activity using `model::SpendActivity`.
Spend(SpendActivity),
/// The receive activity using `model::ReceiveActivity`.
Receive(ReceiveActivity),
}

/// Models a 'spend' activity event. Part of `getdescriptoractivity`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct SpendActivity {
/// The total amount of the spent output.
pub amount: Amount,
/// The blockhash (omitted if unconfirmed).
pub block_hash: Option<BlockHash>,
/// Height of the spend (omitted if unconfirmed).
pub height: Option<u32>,
/// The txid of the spending transaction.
pub spend_txid: Txid,
/// The vout of the spend.
pub spend_vout: u32,
/// The txid of the prevout.
pub prevout_txid: Txid,
/// The vout of the prevout.
pub prevout_vout: u32,
/// The prev scriptPubKey.
pub prevout_spk: ScriptPubkey,
}

/// Models a 'receive' activity event. Part of `getdescriptoractivity`
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ReceiveActivity {
/// The total amount in BTC of the new output.
pub amount: Amount,
/// The block that this receive is in (omitted if unconfirmed).
pub block_hash: Option<BlockHash>,
/// The height of the receive (omitted if unconfirmed).
pub height: Option<u32>,
/// The txid of the receiving transaction.
pub txid: Txid,
/// The vout of the receiving output.
pub vout: u32,
/// The ScriptPubKey.
pub output_spk: ScriptPubkey,
}

/// Models the result of JSON-RPC method `loadtxoutset`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
Expand All @@ -782,3 +777,8 @@ pub struct ScanBlocksStart {
/// Blocks that may have matched a scanobject
pub relevant_blocks: Vec<BlockHash>,
}

/// Models the result of JSON-RPC method `verifytxoutproof`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct VerifyTxOutProof(pub Vec<Txid>);
24 changes: 12 additions & 12 deletions types/src/model/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ pub struct CreateMultisig {
pub warnings: Option<Vec<String>>,
}

/// Models the result of JSON-RPC method `estimatesmartfee`.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct EstimateSmartFee {
/// Estimate fee rate in BTC/kB.
pub fee_rate: Option<FeeRate>,
/// Errors encountered during processing.
pub errors: Option<Vec<String>>,
/// Block number where estimate was found.
pub blocks: u32,
}

/// Models the result of JSON-RPC method `deriveaddresses`.
///
/// > deriveaddresses "descriptor" ( range )
Expand All @@ -56,6 +44,18 @@ pub struct DeriveAddressesMultipath {
pub addresses: Vec<DeriveAddresses>,
}

/// Models the result of JSON-RPC method `estimatesmartfee`.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct EstimateSmartFee {
/// Estimate fee rate in BTC/kB.
pub fee_rate: Option<FeeRate>,
/// Errors encountered during processing.
pub errors: Option<Vec<String>>,
/// Block number where estimate was found.
pub blocks: u32,
}

/// Models the result of JSON-RPC method `signmessagewithprivkey`.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SignMessageWithPrivKey(pub sign_message::MessageSignature);
Expand Down
20 changes: 10 additions & 10 deletions types/src/model/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,16 +748,6 @@ pub struct LoadWallet {
pub warnings: Vec<String>,
}

/// Models the result of JSON-RPC method `rescanblockchain`.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct RescanBlockchain {
/// The block height where the rescan has started.
pub start_height: u32,
/// The height of the last rescanned block.
pub stop_height: u32,
}

/// Models the result of JSON-RPC method `psbtbumpfee`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
Expand All @@ -772,6 +762,16 @@ pub struct PsbtBumpFee {
pub errors: Vec<String>,
}

/// Models the result of JSON-RPC method `rescanblockchain`.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct RescanBlockchain {
/// The block height where the rescan has started.
pub start_height: u32,
/// The height of the last rescanned block.
pub stop_height: u32,
}

/// Models the result of JSON-RPC method `send`.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
Expand Down
2 changes: 1 addition & 1 deletion types/src/v17/blockchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ pub struct GetMempoolInfo {
#[serde(deny_unknown_fields)]
pub struct GetRawMempool(pub Vec<String>);

/// Result of JSON-RPC method `getmempooldescendants` with verbose set to `true`.
/// Result of JSON-RPC method `getrawmempool` with verbose set to `true`.
///
/// Map of txid to [`MempoolEntry`].
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
Expand Down
78 changes: 39 additions & 39 deletions types/src/v17/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,6 @@ use serde::{Deserialize, Serialize};
// TODO: Remove wildcard, use explicit types.
pub use self::error::*;

/// The purpose of an address. Part of `getaddressesbylabel`.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum AddressPurpose {
/// A send-to address.
Send,
/// A receive-from address.
Receive,
}

/// The category of a transaction. Part of `gettransaction`, `listsinceblock` and `listtransactions`.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum TransactionCategory {
/// Transactions sent.
Send,
/// Non-coinbase transactions received.
Receive,
/// Coinbase transactions received with more than 100 confirmations.
Generate,
/// Coinbase transactions received with 100 or fewer confirmations.
Immature,
/// Orphaned coinbase transactions received.
Orphan,
}

/// Whether this transaction can be RBF'ed. Part of `gettransaction`, `listsinceblock` and
/// `listtransactions`.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Bip125Replaceable {
/// Yes, can be replaced due to BIP-125 (RBF).
Yes,
/// No, cannot be replaced due to BIP-125 (RBF).
No,
/// RBF unknown.
Unknown,
}

/// Result of JSON-RPC method `abortrescan`.
///
/// > abortrescan
Expand Down Expand Up @@ -217,6 +178,16 @@ pub struct AddressInformation {
pub purpose: AddressPurpose,
}

/// The purpose of an address. Part of `getaddressesbylabel`.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum AddressPurpose {
/// A send-to address.
Send,
/// A receive-from address.
Receive,
}

/// Result of the JSON-RPC method `getaddressinfo`.
///
/// > getaddressinfo "address"
Expand Down Expand Up @@ -502,6 +473,35 @@ pub struct GetTransactionDetail {
pub abandoned: Option<bool>,
}

/// The category of a transaction. Part of `gettransaction`, `listsinceblock` and `listtransactions`.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum TransactionCategory {
/// Transactions sent.
Send,
/// Non-coinbase transactions received.
Receive,
/// Coinbase transactions received with more than 100 confirmations.
Generate,
/// Coinbase transactions received with 100 or fewer confirmations.
Immature,
/// Orphaned coinbase transactions received.
Orphan,
}

/// Whether this transaction can be RBF'ed. Part of `gettransaction`, `listsinceblock` and
/// `listtransactions`.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Bip125Replaceable {
/// Yes, can be replaced due to BIP-125 (RBF).
Yes,
/// No, cannot be replaced due to BIP-125 (RBF).
No,
/// RBF unknown.
Unknown,
}

/// Result of the JSON-RPC method `getunconfirmedbalance`.
///
/// > getunconfirmedbalance
Expand Down
Loading