Skip to content

Commit 0ef4ea1

Browse files
committed
Reorder types structs and enums
Some of the structs and enums are not in alphabetical order. Order them all by the RPC name, with sub structs directly below. Code moves only, no content changes.
1 parent 3fc512d commit 0ef4ea1

File tree

8 files changed

+246
-246
lines changed

8 files changed

+246
-246
lines changed

types/src/model/blockchain.rs

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,63 @@ pub struct Bip9Statistics {
505505
pub possible: Option<bool>,
506506
}
507507

508+
/// Models the result of the JSON-RPC method `getdescriptoractivity`.
509+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
510+
#[serde(deny_unknown_fields)]
511+
pub struct GetDescriptorActivity {
512+
/// A list of activity events related to the descriptors.
513+
pub activity: Vec<ActivityEntry>,
514+
}
515+
516+
/// A spend or receive activity entry. Part of `getdescriptoractivity`.
517+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
518+
pub enum ActivityEntry {
519+
/// The spend activity using `model::SpendActivity`.
520+
Spend(SpendActivity),
521+
/// The receive activity using `model::ReceiveActivity`.
522+
Receive(ReceiveActivity),
523+
}
524+
525+
/// Models a 'spend' activity event. Part of `getdescriptoractivity`.
526+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
527+
#[serde(deny_unknown_fields)]
528+
pub struct SpendActivity {
529+
/// The total amount of the spent output.
530+
pub amount: Amount,
531+
/// The blockhash (omitted if unconfirmed).
532+
pub block_hash: Option<BlockHash>,
533+
/// Height of the spend (omitted if unconfirmed).
534+
pub height: Option<u32>,
535+
/// The txid of the spending transaction.
536+
pub spend_txid: Txid,
537+
/// The vout of the spend.
538+
pub spend_vout: u32,
539+
/// The txid of the prevout.
540+
pub prevout_txid: Txid,
541+
/// The vout of the prevout.
542+
pub prevout_vout: u32,
543+
/// The prev scriptPubKey.
544+
pub prevout_spk: ScriptPubkey,
545+
}
546+
547+
/// Models a 'receive' activity event. Part of `getdescriptoractivity`
548+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
549+
#[serde(deny_unknown_fields)]
550+
pub struct ReceiveActivity {
551+
/// The total amount in BTC of the new output.
552+
pub amount: Amount,
553+
/// The block that this receive is in (omitted if unconfirmed).
554+
pub block_hash: Option<BlockHash>,
555+
/// The height of the receive (omitted if unconfirmed).
556+
pub height: Option<u32>,
557+
/// The txid of the receiving transaction.
558+
pub txid: Txid,
559+
/// The vout of the receiving output.
560+
pub vout: u32,
561+
/// The ScriptPubKey.
562+
pub output_spk: ScriptPubkey,
563+
}
564+
508565
/// Models the result of JSON-RPC method `getdifficulty`.
509566
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
510567
#[serde(deny_unknown_fields)]
@@ -696,68 +753,6 @@ pub struct GetTxSpendingPrevoutItem {
696753
pub spending_txid: Option<Txid>,
697754
}
698755

699-
/// Models the result of JSON-RPC method `verifytxoutproof`.
700-
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
701-
#[serde(deny_unknown_fields)]
702-
pub struct VerifyTxOutProof(pub Vec<Txid>);
703-
704-
/// Models the result of the JSON-RPC method `getdescriptoractivity`.
705-
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
706-
#[serde(deny_unknown_fields)]
707-
pub struct GetDescriptorActivity {
708-
/// A list of activity events related to the descriptors.
709-
pub activity: Vec<ActivityEntry>,
710-
}
711-
712-
/// A spend or receive activity entry. Part of `getdescriptoractivity`.
713-
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
714-
pub enum ActivityEntry {
715-
/// The spend activity using `model::SpendActivity`.
716-
Spend(SpendActivity),
717-
/// The receive activity using `model::ReceiveActivity`.
718-
Receive(ReceiveActivity),
719-
}
720-
721-
/// Models a 'spend' activity event. Part of `getdescriptoractivity`.
722-
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
723-
#[serde(deny_unknown_fields)]
724-
pub struct SpendActivity {
725-
/// The total amount of the spent output.
726-
pub amount: Amount,
727-
/// The blockhash (omitted if unconfirmed).
728-
pub block_hash: Option<BlockHash>,
729-
/// Height of the spend (omitted if unconfirmed).
730-
pub height: Option<u32>,
731-
/// The txid of the spending transaction.
732-
pub spend_txid: Txid,
733-
/// The vout of the spend.
734-
pub spend_vout: u32,
735-
/// The txid of the prevout.
736-
pub prevout_txid: Txid,
737-
/// The vout of the prevout.
738-
pub prevout_vout: u32,
739-
/// The prev scriptPubKey.
740-
pub prevout_spk: ScriptPubkey,
741-
}
742-
743-
/// Models a 'receive' activity event. Part of `getdescriptoractivity`
744-
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
745-
#[serde(deny_unknown_fields)]
746-
pub struct ReceiveActivity {
747-
/// The total amount in BTC of the new output.
748-
pub amount: Amount,
749-
/// The block that this receive is in (omitted if unconfirmed).
750-
pub block_hash: Option<BlockHash>,
751-
/// The height of the receive (omitted if unconfirmed).
752-
pub height: Option<u32>,
753-
/// The txid of the receiving transaction.
754-
pub txid: Txid,
755-
/// The vout of the receiving output.
756-
pub vout: u32,
757-
/// The ScriptPubKey.
758-
pub output_spk: ScriptPubkey,
759-
}
760-
761756
/// Models the result of JSON-RPC method `loadtxoutset`.
762757
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
763758
#[serde(deny_unknown_fields)]
@@ -782,3 +777,8 @@ pub struct ScanBlocksStart {
782777
/// Blocks that may have matched a scanobject
783778
pub relevant_blocks: Vec<BlockHash>,
784779
}
780+
781+
/// Models the result of JSON-RPC method `verifytxoutproof`.
782+
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
783+
#[serde(deny_unknown_fields)]
784+
pub struct VerifyTxOutProof(pub Vec<Txid>);

types/src/model/util.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ pub struct CreateMultisig {
2323
pub warnings: Option<Vec<String>>,
2424
}
2525

26-
/// Models the result of JSON-RPC method `estimatesmartfee`.
27-
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
28-
#[serde(deny_unknown_fields)]
29-
pub struct EstimateSmartFee {
30-
/// Estimate fee rate in BTC/kB.
31-
pub fee_rate: Option<FeeRate>,
32-
/// Errors encountered during processing.
33-
pub errors: Option<Vec<String>>,
34-
/// Block number where estimate was found.
35-
pub blocks: u32,
36-
}
37-
3826
/// Models the result of JSON-RPC method `deriveaddresses`.
3927
///
4028
/// > deriveaddresses "descriptor" ( range )
@@ -56,6 +44,18 @@ pub struct DeriveAddressesMultipath {
5644
pub addresses: Vec<DeriveAddresses>,
5745
}
5846

47+
/// Models the result of JSON-RPC method `estimatesmartfee`.
48+
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
49+
#[serde(deny_unknown_fields)]
50+
pub struct EstimateSmartFee {
51+
/// Estimate fee rate in BTC/kB.
52+
pub fee_rate: Option<FeeRate>,
53+
/// Errors encountered during processing.
54+
pub errors: Option<Vec<String>>,
55+
/// Block number where estimate was found.
56+
pub blocks: u32,
57+
}
58+
5959
/// Models the result of JSON-RPC method `signmessagewithprivkey`.
6060
#[derive(Clone, Debug, PartialEq, Eq)]
6161
pub struct SignMessageWithPrivKey(pub sign_message::MessageSignature);

types/src/model/wallet.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -748,16 +748,6 @@ pub struct LoadWallet {
748748
pub warnings: Vec<String>,
749749
}
750750

751-
/// Models the result of JSON-RPC method `rescanblockchain`.
752-
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
753-
#[serde(deny_unknown_fields)]
754-
pub struct RescanBlockchain {
755-
/// The block height where the rescan has started.
756-
pub start_height: u32,
757-
/// The height of the last rescanned block.
758-
pub stop_height: u32,
759-
}
760-
761751
/// Models the result of JSON-RPC method `psbtbumpfee`.
762752
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
763753
#[serde(deny_unknown_fields)]
@@ -772,6 +762,16 @@ pub struct PsbtBumpFee {
772762
pub errors: Vec<String>,
773763
}
774764

765+
/// Models the result of JSON-RPC method `rescanblockchain`.
766+
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
767+
#[serde(deny_unknown_fields)]
768+
pub struct RescanBlockchain {
769+
/// The block height where the rescan has started.
770+
pub start_height: u32,
771+
/// The height of the last rescanned block.
772+
pub stop_height: u32,
773+
}
774+
775775
/// Models the result of JSON-RPC method `send`.
776776
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
777777
#[serde(deny_unknown_fields)]

types/src/v17/wallet/mod.rs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,45 +17,6 @@ use serde::{Deserialize, Serialize};
1717
// TODO: Remove wildcard, use explicit types.
1818
pub use self::error::*;
1919

20-
/// The purpose of an address. Part of `getaddressesbylabel`.
21-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
22-
#[serde(rename_all = "lowercase")]
23-
pub enum AddressPurpose {
24-
/// A send-to address.
25-
Send,
26-
/// A receive-from address.
27-
Receive,
28-
}
29-
30-
/// The category of a transaction. Part of `gettransaction`, `listsinceblock` and `listtransactions`.
31-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
32-
#[serde(rename_all = "lowercase")]
33-
pub enum TransactionCategory {
34-
/// Transactions sent.
35-
Send,
36-
/// Non-coinbase transactions received.
37-
Receive,
38-
/// Coinbase transactions received with more than 100 confirmations.
39-
Generate,
40-
/// Coinbase transactions received with 100 or fewer confirmations.
41-
Immature,
42-
/// Orphaned coinbase transactions received.
43-
Orphan,
44-
}
45-
46-
/// Whether this transaction can be RBF'ed. Part of `gettransaction`, `listsinceblock` and
47-
/// `listtransactions`.
48-
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
49-
#[serde(rename_all = "lowercase")]
50-
pub enum Bip125Replaceable {
51-
/// Yes, can be replaced due to BIP-125 (RBF).
52-
Yes,
53-
/// No, cannot be replaced due to BIP-125 (RBF).
54-
No,
55-
/// RBF unknown.
56-
Unknown,
57-
}
58-
5920
/// Result of JSON-RPC method `abortrescan`.
6021
///
6122
/// > abortrescan
@@ -217,6 +178,16 @@ pub struct AddressInformation {
217178
pub purpose: AddressPurpose,
218179
}
219180

181+
/// The purpose of an address. Part of `getaddressesbylabel`.
182+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
183+
#[serde(rename_all = "lowercase")]
184+
pub enum AddressPurpose {
185+
/// A send-to address.
186+
Send,
187+
/// A receive-from address.
188+
Receive,
189+
}
190+
220191
/// Result of the JSON-RPC method `getaddressinfo`.
221192
///
222193
/// > getaddressinfo "address"
@@ -502,6 +473,35 @@ pub struct GetTransactionDetail {
502473
pub abandoned: Option<bool>,
503474
}
504475

476+
/// The category of a transaction. Part of `gettransaction`, `listsinceblock` and `listtransactions`.
477+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
478+
#[serde(rename_all = "lowercase")]
479+
pub enum TransactionCategory {
480+
/// Transactions sent.
481+
Send,
482+
/// Non-coinbase transactions received.
483+
Receive,
484+
/// Coinbase transactions received with more than 100 confirmations.
485+
Generate,
486+
/// Coinbase transactions received with 100 or fewer confirmations.
487+
Immature,
488+
/// Orphaned coinbase transactions received.
489+
Orphan,
490+
}
491+
492+
/// Whether this transaction can be RBF'ed. Part of `gettransaction`, `listsinceblock` and
493+
/// `listtransactions`.
494+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
495+
#[serde(rename_all = "lowercase")]
496+
pub enum Bip125Replaceable {
497+
/// Yes, can be replaced due to BIP-125 (RBF).
498+
Yes,
499+
/// No, cannot be replaced due to BIP-125 (RBF).
500+
No,
501+
/// RBF unknown.
502+
Unknown,
503+
}
504+
505505
/// Result of the JSON-RPC method `getunconfirmedbalance`.
506506
///
507507
/// > getunconfirmedbalance

0 commit comments

Comments
 (0)