diff --git a/Cargo.toml b/Cargo.toml index 1f3ddcfd..8fef75be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,16 @@ [workspace] -members = ["client", "types", "node", "jsonrpc"] +members = ["client", "jsonrpc", "node", "types"] exclude = ["integration_test", "verify"] resolver = "2" [patch.crates-io.corepc-client] path = "client" -[patch.crates-io.corepc-types] -path = "types" +[patch.crates-io.jsonrpc] +path = "jsonrpc" [patch.crates-io.corepc-node] path = "node" -[patch.crates-io.jsonrpc] -path = "jsonrpc" +[patch.crates-io.corepc-types] +path = "types" diff --git a/client/Cargo.toml b/client/Cargo.toml index b2bb7074..f84253cf 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -22,11 +22,11 @@ client-sync = ["jsonrpc"] [dependencies] bitcoin = { version = "0.32.0", default-features = false, features = ["std", "serde"] } -types = { package = "corepc-types", version = "0.9.0", default-features = false, features = ["std"] } log = "0.4" serde = { version = "1.0.103", default-features = false, features = [ "derive", "alloc" ] } serde_json = { version = "1.0.117" } +types = { package = "corepc-types", path = "../types", default-features = false, features = ["std"] } -jsonrpc = { version = "0.18.0", features = ["minreq_http"], optional = true } +jsonrpc = { path = "../jsonrpc", features = ["minreq_http"], optional = true } [dev-dependencies] diff --git a/client/src/client_sync/v21/mod.rs b/client/src/client_sync/v21/mod.rs index c2ada750..58b9d0a8 100644 --- a/client/src/client_sync/v21/mod.rs +++ b/client/src/client_sync/v21/mod.rs @@ -192,7 +192,6 @@ crate::impl_client_v17__get_zmq_notifications!(); /// Request object for the `importdescriptors` method. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] pub struct ImportDescriptorsRequest { /// Descriptor to import. #[serde(rename = "desc")] diff --git a/integration_test/Cargo.toml b/integration_test/Cargo.toml index 1b6ecb89..bffb8adb 100644 --- a/integration_test/Cargo.toml +++ b/integration_test/Cargo.toml @@ -56,17 +56,10 @@ TODO = [] # This is a dirty hack while writing the tests. [dependencies] bitcoin = { version = "0.32.0", default-features = false, features = ["std", "serde"] } -node = { package = "corepc-node", version = "0.9.0", default-features = false } -rand = "0.8.5" env_logger = "0.9.0" +node = { package = "corepc-node", path = "../node", default-features = false } +rand = "0.8.5" +# Just so we can enable the feature. +types = { package = "corepc-types", path = "../types", features = ["serde-deny-unknown-fields"] } [dev-dependencies] - -[patch.crates-io.corepc-client] -path = "../client" - -[patch.crates-io.corepc-types] -path = "../types" - -[patch.crates-io.corepc-node] -path = "../node" diff --git a/node/Cargo.toml b/node/Cargo.toml index 67f46c9e..a9b5ab54 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -13,12 +13,12 @@ rust-version = "1.63.0" exclude = ["tests", "contrib"] [dependencies] -corepc-client = { version = "0.9.0", features = ["client-sync"] } -log = { version = "0.4", default-features = false } -which = { version = "3.1.1", default-features = false } anyhow = { version = "1.0.66", default-features = false, features = ["std"] } -tempfile = {version = "3", default-features = false } +corepc-client = { path = "../client", features = ["client-sync"] } +log = { version = "0.4", default-features = false } serde_json = { version = "1.0.117", default-features = false } +tempfile = { version = "3", default-features = false } +which = { version = "3.1.1", default-features = false } [dev-dependencies] env_logger = { version = "0.9.3", default-features = false } @@ -27,8 +27,8 @@ env_logger = { version = "0.9.3", default-features = false } anyhow = { version = "1.0.66", optional = true } bitcoin_hashes = { version = ">= 0.13, <= 0.14", optional = true } flate2 = { version = "1.0", optional = true } -tar = { version = "0.4", optional = true } minreq = { version = "2.9.1", default-features = false, features = ["https"], optional = true } +tar = { version = "0.4", optional = true } zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"], optional = true } # Please note, it is expected that a single version feature will be enabled however if you enable diff --git a/types/Cargo.toml b/types/Cargo.toml index 97d13bdc..dca63bee 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -15,6 +15,7 @@ exclude = ["tests", "contrib"] [features] default = ["std"] std = ["bitcoin/std"] +serde-deny-unknown-fields = [] [dependencies] bitcoin = { version = "0.32.0", default-features = false, features = ["serde", "base64", "secp-recovery"] } diff --git a/types/src/lib.rs b/types/src/lib.rs index b03f725e..763d6ac2 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -180,7 +180,7 @@ pub fn compact_size_decode(slice: &mut &[u8]) -> u64 { /// backwards compatible so we only provide it not a v0.17 specific type. The `mtype::ScriptPubkey` /// mirrors this design (but with concrete `rust-bitcoin` types). #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ScriptPubkey { /// Script assembly. pub asm: String, @@ -219,7 +219,7 @@ impl ScriptPubkey { /// Data returned by Core for a script signature. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ScriptSig { /// Assembly representation of the script. pub asm: String, diff --git a/types/src/model/blockchain.rs b/types/src/model/blockchain.rs index 34c166b0..382e08ca 100644 --- a/types/src/model/blockchain.rs +++ b/types/src/model/blockchain.rs @@ -19,7 +19,7 @@ use crate::ScriptPubkey; /// Models the result of JSON-RPC method `dumptxoutset`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DumpTxOutSet { /// The number of coins written in the snapshot. pub coins_written: Amount, @@ -37,17 +37,17 @@ pub struct DumpTxOutSet { /// Models the result of JSON-RPC method `getbestblockhash`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBestBlockHash(pub BlockHash); /// Models the result of JSON-RPC method `getblock` with verbosity set to 0. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockVerboseZero(pub Block); /// Models the result of JSON-RPC method `getblock` with verbosity set to 1. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockVerboseOne { /// The block hash (same as provided) in RPC call. pub hash: BlockHash, @@ -91,7 +91,7 @@ pub struct GetBlockVerboseOne { /// Models the result of JSON-RPC method `getblockchaininfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockchainInfo { /// Current network name as defined in BIP70 (main, test, signet, regtest). pub chain: Network, @@ -137,7 +137,7 @@ pub struct GetBlockchainInfo { /// Softfork status. Part of `getblockchaininfo`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Softfork { /// The [`SoftforkType`]: one of "buried", "bip9". #[serde(rename = "type")] @@ -166,7 +166,7 @@ pub enum SoftforkType { /// BIP-9 softfork info. Part of `getblockchaininfo`. #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Bip9SoftforkInfo { /// One of "defined", "started", "locked_in", "active", "failed". pub status: Bip9SoftforkStatus, @@ -201,7 +201,7 @@ pub enum Bip9SoftforkStatus { /// BIP-9 softfork statistics. Part of `getblockchaininfo`. #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Bip9SoftforkStatistics { /// The length in blocks of the BIP9 signalling period. pub period: u32, @@ -217,12 +217,12 @@ pub struct Bip9SoftforkStatistics { /// Models the result of JSON-RPC method `getblockcount`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockCount(pub u64); /// Models the result of JSON-RPC method `getblockfilter`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockFilter { /// The filter data. pub filter: Vec, @@ -232,17 +232,17 @@ pub struct GetBlockFilter { /// Models the result of JSON-RPC method `getblockhash`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockHash(pub BlockHash); /// Models the result of JSON-RPC method `getblockheader`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockHeader(pub block::Header); /// Models the result of JSON-RPC method `getblockheader`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockHeaderVerbose { /// the block hash (same as provided). pub hash: BlockHash, @@ -278,7 +278,7 @@ pub struct GetBlockHeaderVerbose { /// Models the result of JSON-RPC method `getblockstats`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockStats { /// Average fee in the block. pub average_fee: Amount, @@ -348,7 +348,7 @@ pub struct GetBlockStats { /// Models the result of JSON-RPC method `getchainstates`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetChainStates { /// The number of headers seen so far. pub headers: u32, @@ -358,7 +358,7 @@ pub struct GetChainStates { /// A single chainstate. Part of `getchainstates`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ChainState { /// Number of blocks in this chainstate. pub blocks: u32, @@ -384,12 +384,12 @@ pub struct ChainState { /// Models the result of JSON-RPC method `getchaintips`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetChainTips(pub Vec); /// An individual list item from the result of JSON-RPC method `getchaintips`. #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ChainTips { /// Height of the chain tip. pub height: u32, @@ -419,7 +419,7 @@ pub enum ChainTipsStatus { /// Models the result of JSON-RPC method `getchaintxstats`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetChainTxStats { /// The timestamp for the final block in the window in UNIX format. pub time: u32, @@ -441,7 +441,7 @@ pub struct GetChainTxStats { /// Models the result of JSON-RPC method `getdeploymentinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetDeploymentInfo { /// Requested block hash (or tip). pub hash: BlockHash, @@ -453,7 +453,7 @@ pub struct GetDeploymentInfo { /// Deployment info. Part of `getdeploymentinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DeploymentInfo { /// One of "buried", "bip9". pub deployment_type: String, @@ -467,7 +467,7 @@ pub struct DeploymentInfo { /// Status of bip9 softforks. Part of `getdeploymentinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Bip9Info { /// The bit (0-28) in the block version field used to signal this softfork (only for "started" and "locked_in" status). pub bit: Option, @@ -491,7 +491,7 @@ pub struct Bip9Info { /// Numeric statistics about signalling for a softfork. Part of `getdeploymentinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Bip9Statistics { /// The length in blocks of the signalling period. pub period: u32, @@ -507,7 +507,7 @@ pub struct Bip9Statistics { /// Models the result of the JSON-RPC method `getdescriptoractivity`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetDescriptorActivity { /// A list of activity events related to the descriptors. pub activity: Vec, @@ -524,7 +524,7 @@ pub enum ActivityEntry { /// Models a 'spend' activity event. Part of `getdescriptoractivity`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SpendActivity { /// The total amount of the spent output. pub amount: Amount, @@ -546,7 +546,7 @@ pub struct SpendActivity { /// Models a 'receive' activity event. Part of `getdescriptoractivity` #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ReceiveActivity { /// The total amount in BTC of the new output. pub amount: Amount, @@ -564,37 +564,37 @@ pub struct ReceiveActivity { /// Models the result of JSON-RPC method `getdifficulty`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetDifficulty(pub f64); /// Models the result of JSON-RPC method `getmempoolancestors` with verbose set to false. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolAncestors(pub Vec); /// Models the result of JSON-RPC method `getmempoolancestors` with verbose set to true. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolAncestorsVerbose(pub BTreeMap); /// Models the result of JSON-RPC method `getmempooldescendants` with verbose set to false. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolDescendants(pub Vec); /// Models the result of JSON-RPC method `getmempooldescendants` with verbose set to true. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolDescendantsVerbose(pub BTreeMap); /// Models the result of JSON-RPC method `getmempoolentry`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolEntry(pub MempoolEntry); /// Mempool data. Part of `getmempoolentry`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolEntry { /// Virtual transaction size as defined in BIP 141. v0.19 and later only. /// @@ -637,7 +637,7 @@ pub struct MempoolEntry { /// Fee object. Part of `getmempoolentry`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolEntryFees { /// Transaction fee in BTC. pub base: Amount, @@ -651,7 +651,7 @@ pub struct MempoolEntryFees { /// Models the result of JSON-RPC method `getmempoolinfo` with verbose set to true. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolInfo { /// True if the mempool is fully loaded. v0.19 and later only. pub loaded: Option, @@ -685,17 +685,17 @@ pub struct GetMempoolInfo { /// Models the result of JSON-RPC method `getrawmempool` with verbose set to false. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawMempool(pub Vec); /// Models the result of JSON-RPC method `getrawmempool` with verbose set to true. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawMempoolVerbose(pub BTreeMap); /// Models the result of JSON-RPC method `gettxout`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTxOut { /// The hash of the block at the tip of the chain. pub best_block: BlockHash, @@ -713,7 +713,7 @@ pub struct GetTxOut { /// Models the result of JSON-RPC method `gettxoutsetinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTxOutSetInfo { /// The current block height (index). pub height: u32, @@ -740,12 +740,12 @@ pub struct GetTxOutSetInfo { /// Models the result of JSON-RPC method `gettxspendingprevout`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTxSpendingPrevout(pub Vec); /// A transaction item. Part of `gettxspendingprevout`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTxSpendingPrevoutItem { /// The outpoint containing the transaction id and vout value of the checked output. pub outpoint: OutPoint, @@ -755,7 +755,7 @@ pub struct GetTxSpendingPrevoutItem { /// Models the result of JSON-RPC method `loadtxoutset`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct LoadTxOutSet { /// The number of coins loaded from the snapshot. pub coins_loaded: Amount, @@ -780,5 +780,5 @@ pub struct ScanBlocksStart { /// Models the result of JSON-RPC method `verifytxoutproof`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct VerifyTxOutProof(pub Vec); diff --git a/types/src/model/generating.rs b/types/src/model/generating.rs index 99c953bc..a8229246 100644 --- a/types/src/model/generating.rs +++ b/types/src/model/generating.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; /// Models the result of JSON-RPC method `generate`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Generate(pub Vec); impl Generate { @@ -23,7 +23,7 @@ impl Generate { /// Models the result of JSON-RPC method `generateblock`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GenerateBlock { /// Hash of generated block. pub hash: BlockHash, @@ -33,7 +33,7 @@ pub struct GenerateBlock { /// Models the result of JSON-RPC method `generatetoaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GenerateToAddress(pub Vec); impl GenerateToAddress { @@ -46,7 +46,7 @@ impl GenerateToAddress { /// Models the result of JSON-RPC method `generatetodescriptor`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GenerateToDescriptor(pub Vec); impl GenerateToDescriptor { diff --git a/types/src/model/mining.rs b/types/src/model/mining.rs index 5276b8d8..d0703471 100644 --- a/types/src/model/mining.rs +++ b/types/src/model/mining.rs @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize}; /// Models the result of JSON-RPC method `getblocktemplate`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockTemplate { /// The preferred block version. pub version: block::Version, @@ -72,7 +72,7 @@ pub struct GetBlockTemplate { /// Non-coinbase transaction contents. Part of `getblocktemplate`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct BlockTemplateTransaction { /// The transaction. pub data: Transaction, @@ -99,7 +99,7 @@ pub struct BlockTemplateTransaction { /// Models the result of JSON-RPC method `getmininginfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMiningInfo { /// The current block. pub blocks: u64, @@ -132,7 +132,7 @@ pub struct GetMiningInfo { /// Represents the `next` block information. Part of `getmininginfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct NextBlockInfo { /// The next height. pub height: u64, @@ -146,12 +146,12 @@ pub struct NextBlockInfo { /// Models the result of JSON-RPC method `getprioritisedtransactions`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetPrioritisedTransactions(pub BTreeMap); /// An individual prioritised transaction. Part of `getprioritisedtransactions`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PrioritisedTransaction { /// Transaction fee delta in satoshis. pub fee_delta: Amount, diff --git a/types/src/model/network.rs b/types/src/model/network.rs index 19d62167..11ef3cd1 100644 --- a/types/src/model/network.rs +++ b/types/src/model/network.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; /// Models the result of JSON-RPC method `getnetworkinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNetworkInfo { /// The server version. pub version: usize, @@ -48,7 +48,7 @@ pub struct GetNetworkInfo { /// Information per network. Part of `getnetworkinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNetworkInfoNetwork { /// Network (ipv4, ipv6, onion, i2p, cjdns). pub name: String, @@ -64,7 +64,7 @@ pub struct GetNetworkInfoNetwork { /// Local address info. Part of `getnetworkinfo`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNetworkInfoAddress { /// Network address. pub address: String, diff --git a/types/src/model/raw_transactions.rs b/types/src/model/raw_transactions.rs index b322880b..d8c21b15 100644 --- a/types/src/model/raw_transactions.rs +++ b/types/src/model/raw_transactions.rs @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize}; /// Models the result of JSON-RPC method `analyzepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AnalyzePsbt { /// Array of input objects. pub inputs: Vec, @@ -32,7 +32,7 @@ pub struct AnalyzePsbt { /// An input in a PSBT operation. Part of `analyzepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AnalyzePsbtInput { /// Whether a UTXO is provided. pub has_utxo: bool, @@ -46,7 +46,7 @@ pub struct AnalyzePsbtInput { /// Missing elements required to complete an input. Part of `analyzepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AnalyzePsbtInputMissing { /// Public key IDs of public keys whose BIP 32 derivation paths are missing. pub pubkeys: Vec, @@ -60,32 +60,32 @@ pub struct AnalyzePsbtInputMissing { /// Models the result of JSON-RPC method `combinepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CombinePsbt(pub Psbt); /// Models the result of JSON-RPC method `combinerawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CombineRawTransaction(pub Transaction); /// Models the result of JSON-RPC method `converttopsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ConvertToPsbt(pub Psbt); /// Models the result of JSON-RPC method `createpsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreatePsbt(pub Psbt); /// Models the result of JSON-RPC method `createrawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreateRawTransaction(pub Transaction); /// Models the result of JSON-RPC method `decodepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DecodePsbt { /// The decoded PSBT. pub psbt: Psbt, @@ -95,12 +95,12 @@ pub struct DecodePsbt { /// Models the result of JSON-RPC method `decoderawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DecodeRawTransaction(pub Transaction); /// Models the result of JSON-RPC method `decodescript`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DecodeScript { /// The `scriptPubkey`. pub script_pubkey: Option, @@ -122,7 +122,7 @@ pub struct DecodeScript { /// Models the result of JSON-RPC method `descriptorprocesspsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DescriptorProcessPsbt { /// The decoded PSBT. pub psbt: Psbt, @@ -134,7 +134,7 @@ pub struct DescriptorProcessPsbt { /// Models the result of JSON-RPC method `finalizepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct FinalizePsbt { /// The partially signed transaction if not extracted. pub psbt: Option, @@ -146,7 +146,7 @@ pub struct FinalizePsbt { /// Models the result of JSON-RPC method `fundrawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct FundRawTransaction { /// The resulting raw transaction. pub tx: Transaction, @@ -158,13 +158,13 @@ pub struct FundRawTransaction { /// Models the result of JSON-RPC method `getrawtransaction` with verbose set to `false`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawTransaction(pub Transaction); /// Models the result of JSON-RPC method `getrawtransaction` with verbose set to `true`. /// Result of JSON-RPC method `getrawtransaction` #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawTransactionVerbose { /// Whether specified block is in the active chain or not (only present with explicit "blockhash" argument). pub in_active_chain: Option, @@ -182,17 +182,17 @@ pub struct GetRawTransactionVerbose { /// Models the result of JSON-RPC method `joinpsbts`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct JoinPsbts(pub Psbt); /// Models the result of JSON-RPC method `sendrawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendRawTransaction(pub Txid); /// Models the result of JSON-RPC method `signrawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SignRawTransaction { /// The raw transaction with signature(s). pub tx: Transaction, @@ -210,7 +210,7 @@ pub type SignRawTransactionWithKey = SignRawTransaction; /// A script verification error. Part of `signrawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SignFail { /// The referenced, previous transaction. pub txid: Txid, @@ -226,7 +226,7 @@ pub struct SignFail { /// Models the result of JSON-RPC method `submitpackage`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SubmitPackage { /// The transaction package result message. "success" indicates all transactions were accepted into or are already in the mempool. pub package_msg: String, @@ -238,7 +238,7 @@ pub struct SubmitPackage { /// Models the per-transaction result included in the JSON-RPC method `submitpackage`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SubmitPackageTxResult { /// The transaction id. pub txid: Txid, @@ -256,7 +256,7 @@ pub struct SubmitPackageTxResult { /// Models the fees included in the per-transaction result of the JSON-RPC method `submitpackage`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SubmitPackageTxResultFees { /// Transaction fee. pub base_fee: Amount, @@ -272,7 +272,7 @@ pub struct SubmitPackageTxResultFees { /// Models the result of JSON-RPC method `testmempoolaccept`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct TestMempoolAccept { /// Test results for each raw transaction in the input array. pub results: Vec, @@ -280,7 +280,7 @@ pub struct TestMempoolAccept { /// Models a single mempool acceptance test result. Part of `testmempoolaccept`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolAcceptance { /// The transaction ID. pub txid: Txid, @@ -300,7 +300,7 @@ pub struct MempoolAcceptance { /// Models the fees field. Part of `testmempoolaccept`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolAcceptanceFees { /// Transaction fee in BTC. pub base: Amount, @@ -313,5 +313,5 @@ pub struct MempoolAcceptanceFees { /// Models the result of JSON-RPC method `utxoupdatepsbt;`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct UtxoUpdatePsbt(pub Psbt); diff --git a/types/src/model/util.rs b/types/src/model/util.rs index 9a90ccfd..aeb1a92d 100644 --- a/types/src/model/util.rs +++ b/types/src/model/util.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; /// Models the result of JSON-RPC method `createmultisig`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreateMultisig { /// The value of the new multisig address. pub address: Address, @@ -30,7 +30,7 @@ pub struct CreateMultisig { /// > Derives one or more addresses corresponding to an output descriptor. /// > Returns an array of derived addresses. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DeriveAddresses { /// The derived addresses. pub addresses: Vec>, @@ -38,7 +38,7 @@ pub struct DeriveAddresses { /// Models the result of JSON-RPC method `deriveaddresses` for multipath descriptors. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DeriveAddressesMultipath { /// The derived addresses for each of the multipath expansions of the descriptor, in multipath specifier order. pub addresses: Vec, @@ -46,7 +46,7 @@ pub struct DeriveAddressesMultipath { /// Models the result of JSON-RPC method `estimatesmartfee`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct EstimateSmartFee { /// Estimate fee rate in BTC/kB. pub fee_rate: Option, diff --git a/types/src/model/wallet.rs b/types/src/model/wallet.rs index ae2a3fb2..d4dc3132 100644 --- a/types/src/model/wallet.rs +++ b/types/src/model/wallet.rs @@ -56,7 +56,7 @@ pub enum Bip125Replaceable { /// Models the result of JSON-RPC method `addmultisigaddress`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AddMultisigAddress { /// The new multisig address. pub address: Address, @@ -70,7 +70,7 @@ pub struct AddMultisigAddress { /// Models the result of JSON-RPC method `bumpfee`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct BumpFee { /// The id of the new transaction. pub txid: Txid, @@ -84,7 +84,7 @@ pub struct BumpFee { /// Models the result of JSON-RPC method `createwallet`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreateWallet { /// The wallet name if created successfully. /// @@ -96,17 +96,17 @@ pub struct CreateWallet { /// Models the result of JSON-RPC method `dumpprivkey`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DumpPrivKey(pub PrivateKey); /// Models the result of JSON-RPC method `getaddressesbylabel`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddressesByLabel(pub BTreeMap, AddressInformation>); /// Address information. Part of `getaddressesbylabel`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AddressInformation { /// Purpose of address. pub purpose: AddressPurpose, @@ -246,14 +246,14 @@ pub struct GetAddressInfoEmbedded { /// Models the result of JSON-RPC method `getbalance`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBalance(pub Amount); /// Models the result of JSON-RPC method `getbalances`. /// /// Core version 0.19 onwards. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBalances { /// Balances from outputs that the wallet can sign. pub mine: GetBalancesMine, @@ -266,7 +266,7 @@ pub struct GetBalances { /// Balances from outputs that the wallet can sign. Part of `getbalances`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBalancesMine { /// Trusted balance (outputs created by the wallet or confirmed outputs). pub trusted: Amount, @@ -282,7 +282,7 @@ pub struct GetBalancesMine { /// Hash and height of the block this information was generated on. Part of `getbalances`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBalancesWatchOnly { /// Trusted balance (outputs created by the wallet or confirmed outputs). pub trusted: Amount, @@ -294,12 +294,12 @@ pub struct GetBalancesWatchOnly { /// Models the result of JSON-RPC method `gethdkeys`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetHdKeys(pub Vec); /// An HD key entry. Part of `gethdkeys`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct HdKey { /// The extended public key. pub xpub: Xpub, @@ -313,7 +313,7 @@ pub struct HdKey { /// Descriptor object. Part of `gethdkeys`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct HdKeyDescriptor { /// Descriptor string representation. pub descriptor: String, @@ -323,27 +323,27 @@ pub struct HdKeyDescriptor { /// Models the result of JSON-RPC method `getnewaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNewAddress(pub Address); /// Models the result of JSON-RPC method `getrawchangeaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawChangeAddress(pub Address); /// Models the result of JSON-RPC method `getreceivedbyaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetReceivedByAddress(pub Amount); /// Models the result of JSON-RPC method `getreceivedbylabel`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetReceivedByLabel(pub Amount); /// Models the result of JSON-RPC method `gettransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTransaction { /// The transaction amount. #[serde(default, with = "bitcoin::amount::serde::as_btc")] @@ -404,7 +404,7 @@ pub struct GetTransaction { /// Transaction detail. Part of the `gettransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTransactionDetail { /// Only returns true if imported addresses were involved in transaction. v20 and later only. pub involves_watch_only: Option, @@ -437,7 +437,7 @@ pub struct GetTransactionDetail { /// Last processed block item. Part of of `gettransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct LastProcessedBlock { /// Hash of the block this information was generated on. pub hash: BlockHash, @@ -447,12 +447,12 @@ pub struct LastProcessedBlock { /// Models the result of JSON-RPC method `getunconfirmedbalance`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetUnconfirmedBalance(pub Amount); /// Models the result of JSON-RPC method `getwalletinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetWalletInfo { /// The wallet name. pub wallet_name: String, @@ -515,13 +515,13 @@ pub enum GetWalletInfoScanning { /// Models the result of JSON-RPC method `listaddressgroupings`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListAddressGroupings(pub Vec>); /// List address item. Part of `listaddressgroupings`. // FIXME: The Core docs seem wrong, not sure what shape this should be? #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListAddressGroupingsItem { /// The bitcoin address. pub address: Address, @@ -533,12 +533,12 @@ pub struct ListAddressGroupingsItem { /// Models the result of JSON-RPC method `listlockunspent`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListLockUnspent(pub Vec); /// List lock unspent item. Part of of `listlockunspent`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListLockUnspentItem { /// The transaction id locked. pub txid: Txid, @@ -548,12 +548,12 @@ pub struct ListLockUnspentItem { /// Models the result of JSON-RPC method `listreceivedbyaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListReceivedByAddress(pub Vec); /// List received by address item. Part of of `listreceivedbyaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListReceivedByAddressItem { /// Only returned if imported addresses were involved in transaction. pub involves_watch_only: Option, @@ -571,12 +571,12 @@ pub struct ListReceivedByAddressItem { /// Models the result of JSON-RPC method `listreceivedbylabel`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListReceivedByLabel(pub Vec); /// List received by label item. Part of of `listreceivedbyaddress`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListReceivedByLabelItem { /// Only returned if imported addresses were involved in transaction. pub involves_watch_only: Option, @@ -590,7 +590,7 @@ pub struct ListReceivedByLabelItem { /// Models the result of JSON-RPC method `listsinceblock`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListSinceBlock { /// All the transactions. pub transactions: Vec, @@ -609,7 +609,7 @@ pub struct ListSinceBlock { /// Transaction item. Part of `listsinceblock` and `listtransactions`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct TransactionItem { /// Only returns true if imported addresses were involved in transaction. pub involves_watch_only: Option, @@ -691,17 +691,17 @@ pub struct TransactionItem { /// Models the result of JSON-RPC method `listtransactions`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListTransactions(pub Vec); /// Models the result of JSON-RPC method `listunspent`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListUnspent(pub Vec); /// Unspent transaction output. Part of `listunspent`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListUnspentItem { /// The transaction id. pub txid: Txid, @@ -737,12 +737,12 @@ pub struct ListUnspentItem { /// Models the result of JSON-RPC method `listwallets`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListWallets(pub Vec); /// Models the result of JSON-RPC method `loadwallet`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct LoadWallet { /// The wallet name if loaded successfully. pub name: String, @@ -752,7 +752,7 @@ pub struct LoadWallet { /// Models the result of JSON-RPC method `psbtbumpfee`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PsbtBumpFee { /// The base64-encoded unsigned PSBT of the new transaction. pub psbt: Psbt, @@ -766,7 +766,7 @@ pub struct PsbtBumpFee { /// Models the result of JSON-RPC method `rescanblockchain`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct RescanBlockchain { /// The block height where the rescan has started. pub start_height: u32, @@ -776,7 +776,7 @@ pub struct RescanBlockchain { /// Models the result of JSON-RPC method `send`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Send { /// If the transaction has a complete set of signatures. pub complete: bool, @@ -791,7 +791,7 @@ pub struct Send { /// Models the result of JSON-RPC method `sendall`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendAll { /// If the transaction has a complete set of signatures. pub complete: bool, @@ -806,12 +806,12 @@ pub struct SendAll { /// Models the result of JSON-RPC method `sendmany`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendMany(pub Txid); /// Models the verbose result of JSON-RPC method `sendmany` when `verbose=true`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendManyVerbose { /// The transaction id for the send. Only 1 transaction is created regardless of the number of addresses. pub txid: Txid, @@ -821,7 +821,7 @@ pub struct SendManyVerbose { /// Models the result of JSON-RPC method `sendtoaddress`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendToAddress { pub txid: Txid, } @@ -838,7 +838,7 @@ pub type SignRawTransactionWithWallet = SignRawTransaction; /// Models the result of JSON-RPC method `simulaterawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SimulateRawTransaction { /// The wallet balance change (negative means decrease). #[serde(default, with = "bitcoin::amount::serde::as_btc")] @@ -849,7 +849,7 @@ pub struct SimulateRawTransaction { /// /// Core version v0.21 onwards. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct UnloadWallet { /// Warning messages, if any, related to unloading the wallet. // Changes from single string to vector in Core v25 @@ -858,7 +858,7 @@ pub struct UnloadWallet { /// Models the result of JSON-RPC method `walletcreatefundedpsbt`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct WalletCreateFundedPsbt { /// The resulting PSBT. pub psbt: Psbt, @@ -871,7 +871,7 @@ pub struct WalletCreateFundedPsbt { /// Models the result of JSON-RPC method `walletdisplayaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct WalletDisplayAddress { /// The address as confirmed by the signer pub address: Address, @@ -879,7 +879,7 @@ pub struct WalletDisplayAddress { /// Models the result of JSON-RPC method `walletprocesspsbt`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct WalletProcessPsbt { /// The partially signed transaction. pub psbt: Psbt, diff --git a/types/src/psbt/mod.rs b/types/src/psbt/mod.rs index fda4ac4a..8c959033 100644 --- a/types/src/psbt/mod.rs +++ b/types/src/psbt/mod.rs @@ -22,7 +22,7 @@ use crate::{ScriptPubkey, ScriptSig}; /// Part of `decoderawtransaction` and `decodepsbt`. // This JSON data can be encapsulated by a `bitcoin::Transaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct RawTransaction { /// The transaction id. pub txid: String, @@ -74,7 +74,7 @@ impl RawTransaction { /// Represents a transaction input. // This JSON data can be encapsulated by a `bitcoin::TxIn`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct RawTransactionInput { /// The transaction id. pub txid: String, @@ -115,7 +115,7 @@ impl RawTransactionInput { /// Represents a transaction output. // This JSON data can be encapsulated by a `bitcoin::TxOut` + index. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct RawTransactionOutput { /// The value in BTC. pub value: f64, @@ -142,7 +142,7 @@ impl RawTransactionOutput { /// Transaction output for witness UTXOs. // This JSON data can be encapsulated by a `bitcoin::TxOut`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct WitnessUtxo { /// The value in BTC. pub amount: f64, @@ -165,7 +165,7 @@ impl WitnessUtxo { /// A script part of a PSBT input or output. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PsbtScript { /// The asm. pub asm: String, @@ -191,7 +191,7 @@ impl PsbtScript { // bip32_derivation: BTreeMap, // KeySource = (Fingerprint, DerivationPath); #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Bip32Deriv { /// The public key this path corresponds to. pub pubkey: String, @@ -204,7 +204,7 @@ pub struct Bip32Deriv { /// The key source data for a BIP-32 derivation. // In v0.17 the BIP-32 derivation for inputs is a map of pubkey to this type. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct InputKeySource { /// The fingerprint of the master key. pub master_fingerprint: String, @@ -214,7 +214,7 @@ pub struct InputKeySource { /// Final script data. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct FinalScript { /// The asm. pub asm: String, diff --git a/types/src/v17/blockchain/mod.rs b/types/src/v17/blockchain/mod.rs index b23a962c..cdebb87d 100644 --- a/types/src/v17/blockchain/mod.rs +++ b/types/src/v17/blockchain/mod.rs @@ -23,7 +23,7 @@ use crate::{model, ScriptPubkey}; /// > /// > Returns the hash of the best (tip) block in the most-work fully-validated chain. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBestBlockHash(pub String); /// Result of JSON-RPC method `getblock` with verbosity set to 0. @@ -38,7 +38,7 @@ pub struct GetBestBlockHash(pub String); /// > 1. "blockhash" (string, required) The block hash /// > 2. verbosity (numeric, optional, default=1) 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockVerboseZero( /// A string that is serialized, hex-encoded data for block 'hash'. pub String, @@ -46,7 +46,7 @@ pub struct GetBlockVerboseZero( /// Result of JSON-RPC method `getblock` with verbosity set to 1. #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockVerboseOne { /// The block hash (same as provided) in RPC call. pub hash: String, @@ -102,7 +102,7 @@ pub struct GetBlockVerboseOne { /// > /// > Returns an object containing various state info regarding blockchain processing. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockchainInfo { /// Current network name as defined in BIP70 (main, test, signet, regtest). pub chain: String, @@ -148,7 +148,7 @@ pub struct GetBlockchainInfo { /// Softfork status. Part of `getblockchaininfo`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Softfork { /// Name of softfork. pub id: String, @@ -160,7 +160,7 @@ pub struct Softfork { /// Progress toward rejecting pre-softfork blocks. Part of `getblockchaininfo`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SoftforkReject { /// `true` if threshold reached. pub status: bool, @@ -168,7 +168,7 @@ pub struct SoftforkReject { /// Status of BIP-9 softforks in progress. Part of `getblockchaininfo`. #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Bip9Softfork { /// One of "defined", "started", "locked_in", "active", "failed". pub status: Bip9SoftforkStatus, @@ -205,7 +205,7 @@ pub enum Bip9SoftforkStatus { /// > /// > Returns the number of blocks in the longest blockchain. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockCount(pub u64); /// Result of JSON-RPC method `getblockhash`. @@ -215,7 +215,7 @@ pub struct GetBlockCount(pub u64); /// > Arguments: /// > 1. height (numeric, required) The height index #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockHash(pub String); /// Result of JSON-RPC method `getblockheader` with verbosity set to `false`. @@ -226,7 +226,7 @@ pub struct GetBlockHash(pub String); /// > Arguments: /// > 1. "hash" (string, required) The block hash #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockHeader(pub String); /// Result of JSON-RPC method `getblockheader` with verbosity set to `true`. @@ -237,7 +237,7 @@ pub struct GetBlockHeader(pub String); /// > Arguments: /// > 1. "hash" (string, required) The block hash #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockHeaderVerbose { /// The block hash (same as provided). pub hash: String, @@ -292,7 +292,7 @@ pub struct GetBlockHeaderVerbose { /// > Arguments: /// > 1. "hash_or_height" (string or numeric, required) The block hash or height of the target block #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockStats { /// Average fee in the block. #[serde(rename = "avgfee")] @@ -381,12 +381,12 @@ pub struct GetBlockStats { /// /// > Return information about all known tips in the block tree, including the main chain as well as orphaned branches. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetChainTips(pub Vec); /// Chain tip item. Part of `getchaintips`. #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ChainTips { /// Height of the chain tip. pub height: i64, @@ -421,7 +421,7 @@ pub enum ChainTipsStatus { /// > /// > Compute statistics about the total number and rate of transactions in the chain. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetChainTxStats { /// The timestamp for the final block in the window in UNIX format. pub time: i64, @@ -450,7 +450,7 @@ pub struct GetChainTxStats { /// > Result: /// > n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetDifficulty(pub f64); /// Result of JSON-RPC method `getmempoolancestors` with verbose set to `false`. @@ -462,14 +462,14 @@ pub struct GetDifficulty(pub f64); /// > Arguments: /// > 1. "txid" (string, required) The transaction id (must be in mempool) #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolAncestors(pub Vec); /// Result of JSON-RPC method `getmempoolancestors` with verbose set to true. /// /// Map of txid to [`MempoolEntry`] i.e., an ancestor. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolAncestorsVerbose(pub BTreeMap); /// Result of JSON-RPC method `getmempooldescendants` with verbose set to `false`. @@ -481,14 +481,14 @@ pub struct GetMempoolAncestorsVerbose(pub BTreeMap); /// > Arguments: /// > 1. "txid" (string, required) The transaction id (must be in mempool) #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolDescendants(pub Vec); /// Result of JSON-RPC method `getmempooldescendants` with verbose set to true. /// /// Map of txid to [`MempoolEntry`] i.e., a descendant. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolDescendantsVerbose(pub BTreeMap); /// Result of JSON-RPC method `getmempoolentry`. @@ -500,12 +500,12 @@ pub struct GetMempoolDescendantsVerbose(pub BTreeMap); /// > Arguments: /// > 1. "txid" (string, required) The transaction id (must be in mempool) #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolEntry(pub MempoolEntry); /// Mempool data. Part of `getmempoolentry`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolEntry { /// Virtual transaction size as defined in BIP 141. /// @@ -551,7 +551,7 @@ pub struct MempoolEntry { /// Fee object. Part of `getmempoolentry`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolEntryFees { /// Transaction fee in BTC. pub base: f64, @@ -569,7 +569,7 @@ pub struct MempoolEntryFees { /// > /// > Returns details on the active state of the TX memory pool. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolInfo { /// Current transaction count. pub size: i64, @@ -599,14 +599,14 @@ pub struct GetMempoolInfo { /// > /// > Hint: use getmempoolentry to fetch a specific transaction from the mempool. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawMempool(pub Vec); /// Result of JSON-RPC method `getrawmempool` with verbose set to `true`. /// /// Map of txid to [`MempoolEntry`]. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawMempoolVerbose(pub BTreeMap); /// Result of JSON-RPC method `gettxout`. @@ -619,7 +619,7 @@ pub struct GetRawMempoolVerbose(pub BTreeMap); /// > 1. txid (string, required) The transaction id /// > 2. n (numeric, required) vout number #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTxOut { /// The hash of the block at the tip of the chain. #[serde(rename = "bestblock")] @@ -642,7 +642,7 @@ pub struct GetTxOut { /// > Returns statistics about the unspent transaction output set. /// > Note this call may take some time. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTxOutSetInfo { /// The current block height (index). pub height: i64, @@ -673,7 +673,7 @@ pub struct GetTxOutSetInfo { /// > 1. "height" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp /// > to prune blocks whose block time is at least 2 hours older than the provided timestamp. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PruneBlockchain( /// The height of the last block pruned. pub i64, @@ -681,7 +681,7 @@ pub struct PruneBlockchain( /// Result of JSON-RPC method `verifychain`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct VerifyChain(pub bool); /// Result of JSON-RPC method `verifytxoutproof`. @@ -696,5 +696,5 @@ pub struct VerifyChain(pub bool); /// /// Inner field is the txid(s) which the proof commits to, or empty array if the proof can not be validated. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct VerifyTxOutProof(pub Vec); diff --git a/types/src/v17/control.rs b/types/src/v17/control.rs index 0500da04..3c6ad8f2 100644 --- a/types/src/v17/control.rs +++ b/types/src/v17/control.rs @@ -23,12 +23,12 @@ use serde::{Deserialize, Serialize}; // This just mimics the map returned by my instance of Core `v0.17`, I don't know how // to handle other map values or if they exist? #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMemoryInfoStats(pub BTreeMap); /// Information about locked memory manager. Part of `getmemoryinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Locked { /// Number of bytes used. pub used: u64, @@ -53,7 +53,7 @@ pub struct Locked { /// /// > Gets and sets the logging configuration. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Logging { pub addrman: bool, pub bench: bool, diff --git a/types/src/v17/generating.rs b/types/src/v17/generating.rs index 49bb0ea6..90c1c551 100644 --- a/types/src/v17/generating.rs +++ b/types/src/v17/generating.rs @@ -18,7 +18,7 @@ use crate::model; /// > Arguments: /// > 1. nblocks (numeric, required) How many blocks are generated immediately. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Generate( /// Hashes of blocks generated. pub Vec, @@ -42,7 +42,7 @@ impl Generate { /// > 1. nblocks (numeric, required) How many blocks are generated immediately. /// > 2. address (string, required) The address to send the newly generated bitcoin to. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GenerateToAddress( /// Hashes of blocks generated. pub Vec, diff --git a/types/src/v17/mining/mod.rs b/types/src/v17/mining/mod.rs index dc1b70ba..a8f07fef 100644 --- a/types/src/v17/mining/mod.rs +++ b/types/src/v17/mining/mod.rs @@ -42,7 +42,7 @@ pub use self::error::{BlockTemplateTransactionError, GetBlockTemplateError}; /// > "data": "hex", (string, optional) proposed block data to check, encoded in hexadecimal; valid only for mode="proposal" /// > } #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBlockTemplate { /// The preferred block version. pub version: i32, @@ -113,7 +113,7 @@ pub struct GetBlockTemplate { /// Transaction contents. Part of `getblocktemplate`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct BlockTemplateTransaction { /// Transaction data encoded in hexadecimal (byte-for-byte). pub data: String, @@ -143,7 +143,7 @@ pub struct BlockTemplateTransaction { /// > /// > Returns a json object containing mining-related information. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMiningInfo { /// The current block. pub blocks: u64, diff --git a/types/src/v17/network/mod.rs b/types/src/v17/network/mod.rs index 06656b11..64c29aac 100644 --- a/types/src/v17/network/mod.rs +++ b/types/src/v17/network/mod.rs @@ -24,12 +24,12 @@ pub use self::error::*; /// > Arguments: /// > 1. "node" (string, optional) If provided, return information about this specific node, otherwise all nodes are returned. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddedNodeInfo(pub Vec); /// An added node item. Part of `getaddednodeinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AddedNode { /// The node IP address or name (as provided to addnode). #[serde(rename = "addednode")] @@ -42,7 +42,7 @@ pub struct AddedNode { /// An added node address item. Part of `getaddednodeinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AddedNodeAddress { /// The bitcoin server IP and port we're connected to. pub address: String, @@ -56,7 +56,7 @@ pub struct AddedNodeAddress { /// > /// > Returns n (numeric) The connection count #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetConnectionCount(pub u64); /// Result of JSON-RPC method `getnettotals`. @@ -66,7 +66,7 @@ pub struct GetConnectionCount(pub u64); /// > Returns information about network traffic, including bytes in, bytes out, /// > and current time. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNetTotals { /// Total bytes received. #[serde(rename = "totalbytesrecv")] @@ -84,7 +84,7 @@ pub struct GetNetTotals { /// The upload target totals. Part of `getnettotals`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct UploadTarget { /// Length of the measuring timeframe in seconds. pub timeframe: u64, @@ -106,7 +106,7 @@ pub struct UploadTarget { /// /// > Returns an object containing various state info regarding P2P networking. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNetworkInfo { /// The server version. pub version: usize, @@ -146,7 +146,7 @@ pub struct GetNetworkInfo { /// Information per network. Part of `getnetworkinfo`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNetworkInfoNetwork { /// Network (ipv4, ipv6, onion, i2p, cjdns). pub name: String, @@ -162,7 +162,7 @@ pub struct GetNetworkInfoNetwork { /// Local address info. Part of `getnetworkinfo`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNetworkInfoAddress { /// Network address. pub address: String, @@ -178,12 +178,12 @@ pub struct GetNetworkInfoAddress { /// > /// > Returns data about each connected network node as a json array of objects. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetPeerInfo(pub Vec); /// A peer info item. Part of `getpeerinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PeerInfo { /// Peer index. pub id: u32, @@ -266,12 +266,12 @@ pub struct PeerInfo { /// /// > List all banned IPs/Subnets. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListBanned(pub Vec); /// An banned item. Part of `listbanned`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct Banned { // NOTE: Shape taken from Core source code,as method is undocumented in the Bitcoin RPC CLI for version 17 to 20. /// The IP/Subnet of the banned node. @@ -290,5 +290,5 @@ pub struct Banned { /// > /// > Disable/enable all p2p network activity. #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SetNetworkActive(pub bool); diff --git a/types/src/v17/raw_transactions/mod.rs b/types/src/v17/raw_transactions/mod.rs index 4a7dfe97..7950fcf5 100644 --- a/types/src/v17/raw_transactions/mod.rs +++ b/types/src/v17/raw_transactions/mod.rs @@ -38,7 +38,7 @@ pub use crate::psbt::{ /// > ,... /// > ] #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CombinePsbt( /// The base64-encoded partially signed transaction. pub String, @@ -58,7 +58,7 @@ pub struct CombinePsbt( /// > ,... /// > ] #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CombineRawTransaction( /// The hex-encoded raw transaction with signature(s). pub String, @@ -74,7 +74,7 @@ pub struct CombineRawTransaction( /// > Arguments: /// > 1. "hexstring" (string, required) The hex string of a raw transaction #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ConvertToPsbt( /// The resulting raw transaction (base64-encoded string). pub String, @@ -94,7 +94,7 @@ pub struct ConvertToPsbt( /// > "txid":"id", (string, required) The transaction id /// > "vout":n, (numeric, required) The output number #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreatePsbt( /// The resulting raw transaction (base64-encoded string). pub String, @@ -117,7 +117,7 @@ pub struct CreatePsbt( /// > "txid":"id", (string, required) The transaction id /// > "vout":n, (numeric, required) The output number #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreateRawTransaction( /// hex string of the transaction. pub String, @@ -132,7 +132,7 @@ pub struct CreateRawTransaction( /// > Arguments: /// > 1. "psbt" (string, required) The PSBT base64 string #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DecodePsbt { /// The decoded network-serialized unsigned transaction. pub tx: RawTransaction, @@ -148,7 +148,7 @@ pub struct DecodePsbt { /// An input in a partially signed Bitcoin transaction. Part of `decodepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PsbtInput { /// Decoded network transaction for non-witness UTXOs. pub non_witness_utxo: Option, @@ -177,7 +177,7 @@ pub struct PsbtInput { /// An output in a partially signed Bitcoin transaction. Part of `decodepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PsbtOutput { /// The redeem script. pub redeem_script: Option, @@ -198,7 +198,7 @@ pub struct PsbtOutput { /// > Arguments: /// > 1. "hexstring" (string, required) The transaction hex string #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DecodeRawTransaction(pub RawTransaction); /// Result of JSON-RPC method `decodescript`. @@ -211,7 +211,7 @@ pub struct DecodeRawTransaction(pub RawTransaction); /// > 1. "hexstring" (string) the hex encoded script // The docs on Core v0.17 appear to be way off what is actually returned. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DecodeScript { /// Script public key. pub asm: String, @@ -239,7 +239,7 @@ pub struct DecodeScript { /// Seemingly undocumented data returned in the `segwit` field of `DecodeScript`. // This seems to be the same as `DecodeScript` except the `p2sh` field is called `p2sh-segwit`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DecodeScriptSegwit { /// Script public key. pub asm: String, @@ -269,7 +269,7 @@ pub struct DecodeScriptSegwit { /// > Arguments: /// > 1. "psbt" (string) A base64 string of a PSBT #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct FinalizePsbt { /// The base64-encoded partially signed transaction if not extracted. pub psbt: Option, @@ -297,7 +297,7 @@ pub struct FinalizePsbt { /// > Arguments: /// > 1. "hexstring" (string, required) The hex string of the raw transaction #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct FundRawTransaction { /// The resulting raw transaction (hex-encoded string). pub hex: String, @@ -329,7 +329,7 @@ pub struct FundRawTransaction { /// > 2. verbose (bool, optional, default=false) If false, return a string, otherwise return a json object /// > 3. "blockhash" (string, optional) The block in which to look for the transaction #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawTransaction( /// The serialized, hex-encoded data for 'txid'. pub String, @@ -337,7 +337,7 @@ pub struct GetRawTransaction( /// Result of JSON-RPC method `getrawtransaction` with verbose set to `true`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawTransactionVerbose { /// Whether specified block is in the active chain or not (only present with explicit "blockhash" argument). pub in_active_chain: Option, @@ -390,7 +390,7 @@ pub struct GetRawTransactionVerbose { /// > 1. hexstring (string, required) The hex string of the raw transaction /// > 2. allowhighfees (boolean, optional, default=false) Allow high fees #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendRawTransaction( /// The transaction hash in hex. pub String, @@ -410,7 +410,7 @@ pub struct SendRawTransaction( /// > Arguments: /// > 1. "hexstring" (string, required) The transaction hex string #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SignRawTransaction { /// The hex-encoded raw transaction with signature(s). pub hex: String, @@ -440,7 +440,7 @@ pub type SignRawTransactionWithKey = SignRawTransaction; /// A script verification error. Part of `signrawtransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SignFail { /// The hash of the referenced, previous transaction. pub txid: String, @@ -470,12 +470,12 @@ pub struct SignFail { /// > Length must be one for now. /// > 2. allowhighfees (boolean, optional, default=false) Allow high fees #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct TestMempoolAccept(pub Vec); /// A single mempool acceptance test result. Part of `testmempoolaccept`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolAcceptance { /// The transaction hash in hex. pub txid: String, diff --git a/types/src/v17/util/mod.rs b/types/src/v17/util/mod.rs index 72262c2d..d8029154 100644 --- a/types/src/v17/util/mod.rs +++ b/types/src/v17/util/mod.rs @@ -27,7 +27,7 @@ pub use self::error::{CreateMultisigError, ValidateAddressError}; /// > ,... /// > ] #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreateMultisig { /// The value of the new multisig address. pub address: String, @@ -57,7 +57,7 @@ pub struct CreateMultisig { /// > "ECONOMICAL" /// > "CONSERVATIVE" #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct EstimateSmartFee { /// Estimate fee rate in BTC/kB. #[serde(rename = "feerate")] @@ -78,7 +78,7 @@ pub struct EstimateSmartFee { /// > 1. "privkey" (string, required) The private key to sign the message with. /// > 2. "message" (string, required) The message to create a signature of. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SignMessageWithPrivKey(pub String); /// Result of JSON-RPC method `validateaddress`. @@ -94,7 +94,7 @@ pub struct SignMessageWithPrivKey(pub String); /// > Arguments: /// > 1. "address" (string, required) The bitcoin address to validate #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ValidateAddress { /// If the address is valid or not. If not, this is the only property returned. #[serde(rename = "isvalid")] @@ -127,5 +127,5 @@ pub struct ValidateAddress { /// > 2. "signature" (string, required) The signature provided by the signer in base 64 encoding (see signmessage). /// > 3. "message" (string, required) The message that was signed. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct VerifyMessage(pub bool); diff --git a/types/src/v17/wallet/mod.rs b/types/src/v17/wallet/mod.rs index 130ef1a5..96a8d513 100644 --- a/types/src/v17/wallet/mod.rs +++ b/types/src/v17/wallet/mod.rs @@ -24,7 +24,7 @@ use super::SignRawTransaction; /// > /// > Stops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AbortRescan(pub bool); /// Result of the JSON-RPC method `addmultisigaddress`. @@ -41,7 +41,7 @@ pub struct AbortRescan(pub bool); /// > 1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses. /// > 2. "keys" (string, required) A json array of bitcoin addresses or hex-encoded public keys #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AddMultisigAddress { /// The value of the new multisig address. pub address: String, @@ -69,7 +69,7 @@ pub struct AddMultisigAddress { /// > Arguments: /// > 1. txid (string, required) The txid to be bumped #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct BumpFee { /// The id of the new transaction. pub txid: String, @@ -91,7 +91,7 @@ pub struct BumpFee { /// > Arguments: /// > 1. "wallet_name" (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct CreateWallet { /// The wallet name if created successfully. /// @@ -116,7 +116,7 @@ impl CreateWallet { /// > Arguments: /// > 1. "address" (string, required) The bitcoin address for the private key #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DumpPrivKey(pub String); // The private key. impl DumpPrivKey { @@ -136,7 +136,7 @@ impl DumpPrivKey { /// > Arguments: /// > 1. "filename" (string, required) The filename with path (either absolute or relative to bitcoind) #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DumpWallet { /// The filename with full absolute path. #[serde(rename = "filename")] @@ -156,7 +156,7 @@ pub struct DumpWallet { /// > Arguments: /// > 1. passphrase (string, required) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct EncryptWallet(pub String); /// Result of the JSON-RPC method `getaddressesbylabel`. @@ -168,12 +168,12 @@ pub struct EncryptWallet(pub String); /// > Arguments: /// > 1. "label" (string, required) The label. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddressesByLabel(pub BTreeMap); /// Address information. Part of `getaddressesbylabel`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AddressInformation { /// Purpose of address. pub purpose: AddressPurpose, @@ -199,7 +199,7 @@ pub enum AddressPurpose { /// > Arguments: /// > 1. "address" (string, required) The bitcoin address to get the information of. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddressInfo { /// The bitcoin address validated. pub address: String, @@ -297,7 +297,7 @@ pub enum ScriptType { /// ("timestamp", "hdkeypath", "hdseedid") and relation to the wallet ("ismine", "iswatchonly", /// "account"). #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddressInfoEmbedded { /// The bitcoin address validated. pub address: String, @@ -336,7 +336,7 @@ pub struct GetAddressInfoEmbedded { /// Address label field. Part of `getaddressinfo` and `getaddressinfoembedded`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddressInfoLabel { /// The label. pub name: String, @@ -352,7 +352,7 @@ pub struct GetAddressInfoLabel { /// > The available balance is what the wallet considers currently spendable, and is /// > thus affected by options which limit spendability such as -spendzeroconfchange. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetBalance(pub f64); impl GetBalance { @@ -371,7 +371,7 @@ impl GetBalance { /// > If 'label' is specified, it is added to the address book /// > so payments received with the address will be associated with 'label'. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNewAddress(pub String); /// Result of the JSON-RPC method `getrawchangeaddress`. @@ -381,7 +381,7 @@ pub struct GetNewAddress(pub String); /// > Returns a new Bitcoin address, for receiving change. /// > This is for use with raw transactions, NOT normal use. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRawChangeAddress(pub String); /// Result of the JSON-RPC method `getreceivedbyaddress`. @@ -393,7 +393,7 @@ pub struct GetRawChangeAddress(pub String); /// > Arguments: /// > 1. "address" (string, required) The bitcoin address for transactions. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetReceivedByAddress(pub f64); // Amount in BTC. /// Result of the JSON-RPC method `gettransaction`. @@ -405,7 +405,7 @@ pub struct GetReceivedByAddress(pub f64); // Amount in BTC. /// > Arguments: /// > 1. txid (string, required) The transaction id #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTransaction { /// The transaction amount in BTC. pub amount: f64, @@ -450,7 +450,7 @@ pub struct GetTransaction { /// Transaction detail. Part of the `gettransaction`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetTransactionDetail { /// DEPRECATED. The account name involved in the transaction, can be "" for the default account. pub account: Option, // Docs are wrong, this is not documented as optional. @@ -508,7 +508,7 @@ pub enum Bip125Replaceable { /// > getunconfirmedbalance /// > Returns the server's total unconfirmed balance #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetUnconfirmedBalance(pub f64); // Core docs are missing so this is just a guess. /// Result of the JSON-RPC method `getwalletinfo`. @@ -516,7 +516,7 @@ pub struct GetUnconfirmedBalance(pub f64); // Core docs are missing so this is j /// > getwalletinfo /// > Returns an object containing various wallet state info. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetWalletInfo { /// The wallet name. #[serde(rename = "walletname")] @@ -604,7 +604,7 @@ pub struct JsonRpcError { /// > made public by common use as inputs or as the resulting change /// > in past transactions #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListAddressGroupings(pub Vec>); /// List item type. Part of `listaddressgroupings`. @@ -627,7 +627,7 @@ pub enum ListAddressGroupingsItem { /// > /// > Returns the list of all labels, or labels that are assigned to addresses with a specific purpose. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListLabels(pub Vec); /// Result of the JSON-RPC method `listlockunspent`. @@ -637,12 +637,12 @@ pub struct ListLabels(pub Vec); /// > Returns list of temporarily unspendable outputs. /// > See the lockunspent call to lock and unlock transactions for spending. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListLockUnspent(pub Vec); /// List lock unspent item. Part of of `listlockunspent`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListLockUnspentItem { /// The transaction id locked. pub txid: String, @@ -656,12 +656,12 @@ pub struct ListLockUnspentItem { /// > /// > List balances by receiving address. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListReceivedByAddress(pub Vec); /// List received by address item. Part of of `listreceivedbyaddress`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListReceivedByAddressItem { /// Only returned if imported addresses were involved in transaction. #[serde(rename = "involvesWatchonly")] @@ -688,7 +688,7 @@ pub struct ListReceivedByAddressItem { /// > If "blockhash" is no longer a part of the main chain, transactions from the fork point onward are included. /// > Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the "removed" array. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListSinceBlock { /// All the transactions. pub transactions: Vec, @@ -708,7 +708,7 @@ pub struct ListSinceBlock { /// Transaction item. Part of `listsinceblock` and `listtransactions`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct TransactionItem { /// DEPRECATED. The account name associated with the transaction. Will be "" for the default account. pub account: Option, @@ -790,7 +790,7 @@ pub struct TransactionItem { /// > Note that the "account" argument and "otheraccount" return value have been removed in V0.17. To use this RPC with an "account" argument, restart /// > bitcoind with -deprecatedrpc=accounts #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListTransactions(pub Vec); /// Result of the JSON-RPC method `listunspent`. @@ -801,12 +801,12 @@ pub struct ListTransactions(pub Vec); /// > with between minconf and maxconf (inclusive) confirmations. /// > Optionally filter to only include txouts paid to specified addresses. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListUnspent(pub Vec); /// Unspent transaction output. Part of `listunspent`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListUnspentItem { /// The transaction id. pub txid: String, @@ -844,7 +844,7 @@ pub struct ListUnspentItem { /// > Returns a list of currently loaded wallets. /// > For full information on the wallet, use "getwalletinfo" #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ListWallets(pub Vec); /// Result of the JSON-RPC method `loadwallet`. @@ -858,7 +858,7 @@ pub struct ListWallets(pub Vec); /// > Arguments: /// > 1. "filename" (string, required) The wallet directory or .dat file. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct LoadWallet { /// The wallet name if loaded successfully. pub name: String, @@ -886,7 +886,7 @@ pub struct LockUnspent(pub bool); /// > /// > Rescan the local blockchain for wallet related transactions. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct RescanBlockchain { /// The block height where the rescan has started. pub start_height: i64, @@ -911,7 +911,7 @@ pub struct RescanBlockchain { /// > ,... /// > } #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendMany( /// The transaction id for the send. /// @@ -929,7 +929,7 @@ pub struct SendMany( /// > 1. "address" (string, required) The bitcoin address to send to. /// > 2. "amount" (numeric or string, required) The amount in BTC to send. eg 0.1 #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SendToAddress(pub String); impl SendToAddress { @@ -956,7 +956,7 @@ pub struct SetTxFee(pub bool); /// > 1. "address" (string, required) The bitcoin address to use for the private key. /// > 2. "message" (string, required) The message to create a signature of. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct SignMessage( /// The signature of the message encoded in base 64. pub String, @@ -1006,7 +1006,7 @@ pub type SignRawTransactionWithWallet = SignRawTransaction; /// > accepted as second parameter. /// > ] #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct WalletCreateFundedPsbt { /// The resulting raw transaction (base64-encoded string). pub psbt: String, @@ -1028,7 +1028,7 @@ pub struct WalletCreateFundedPsbt { /// > Arguments: /// > 1. "psbt" (string, required) The transaction base64 string #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct WalletProcessPsbt { /// The base64-encoded partially signed transaction. pub psbt: String, diff --git a/types/src/v17/zmq.rs b/types/src/v17/zmq.rs index a03f4cb8..6e7aa26e 100644 --- a/types/src/v17/zmq.rs +++ b/types/src/v17/zmq.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; ///> ///> Returns information about the active ZeroMQ notifications. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetZmqNotifications { /// Type of notification. #[serde(rename = "type")] diff --git a/types/src/v18/blockchain/mod.rs b/types/src/v18/blockchain/mod.rs index 2f52ed90..b4b61880 100644 --- a/types/src/v18/blockchain/mod.rs +++ b/types/src/v18/blockchain/mod.rs @@ -21,14 +21,14 @@ use super::{MapMempoolEntryError, MempoolEntryError, MempoolEntryFees}; /// > Arguments: /// > 1. "txid" (string, required) The transaction id (must be in mempool) #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolAncestors(pub Vec); /// Result of JSON-RPC method `getmempoolancestors` with verbose set to true. /// /// Map of txid to `MempoolEntry` i.e., an ancestor. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolAncestorsVerbose(pub BTreeMap); /// Result of JSON-RPC method `getmempooldescendants` with verbose set to `false`. @@ -40,14 +40,14 @@ pub struct GetMempoolAncestorsVerbose(pub BTreeMap); /// > Arguments: /// > 1. "txid" (string, required) The transaction id (must be in mempool) #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolDescendants(pub Vec); /// Result of JSON-RPC method `getmempooldescendants` with verbose set to true. /// /// Map of txid to [`MempoolEntry`] i.e., a descendant. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolDescendantsVerbose(pub BTreeMap); /// Result of JSON-RPC method `getmempoolentry`. @@ -59,12 +59,12 @@ pub struct GetMempoolDescendantsVerbose(pub BTreeMap); /// > Arguments: /// > 1. "txid" (string, required) The transaction id (must be in mempool) #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetMempoolEntry(pub MempoolEntry); /// Mempool data. Part of `getmempoolentry`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct MempoolEntry { /// Virtual transaction size as defined in BIP 141. /// diff --git a/types/src/v18/control.rs b/types/src/v18/control.rs index ae1d14c5..b1a0c2ae 100644 --- a/types/src/v18/control.rs +++ b/types/src/v18/control.rs @@ -12,14 +12,14 @@ use serde::{Deserialize, Serialize}; /// > /// > Returns details of the RPC server. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetRpcInfo { active_commands: Vec, } /// Information about an active command. Part of `getrpcinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct ActiveCommand { /// The name of the RPC command. pub method: String, diff --git a/types/src/v18/network/mod.rs b/types/src/v18/network/mod.rs index 38fe8c05..b898b888 100644 --- a/types/src/v18/network/mod.rs +++ b/types/src/v18/network/mod.rs @@ -14,12 +14,12 @@ use serde::{Deserialize, Serialize}; /// > /// > Return known addresses which can potentially be used to find new nodes in the network. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetNodeAddresses(pub Vec); /// An item from the list returned by the JSON-RPC method `getnodeaddresses`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct NodeAddress { /// Timestamp in seconds since epoch (Jan 1 1970 GMT) when the node was last seen. pub time: u64, @@ -37,12 +37,12 @@ pub struct NodeAddress { /// > /// > Returns data about each connected network node as a json array of objects. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetPeerInfo(pub Vec); /// A peer info item. Part of `getpeerinfo`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct PeerInfo { /// Peer index. pub id: u32, diff --git a/types/src/v18/raw_transactions/mod.rs b/types/src/v18/raw_transactions/mod.rs index 4014c73a..065b126b 100644 --- a/types/src/v18/raw_transactions/mod.rs +++ b/types/src/v18/raw_transactions/mod.rs @@ -20,7 +20,7 @@ pub use self::error::{AnalyzePsbtError, AnalyzePsbtInputMissingError}; /// Arguments: /// 1. psbt (string, required) A base64 string of a PSBT #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AnalyzePsbt { /// Array of input objects. pub inputs: Vec, @@ -39,7 +39,7 @@ pub struct AnalyzePsbt { /// Represents an input in a PSBT operation. Part of `analyzepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AnalyzePsbtInput { /// Whether a UTXO is provided. pub has_utxo: bool, @@ -53,7 +53,7 @@ pub struct AnalyzePsbtInput { /// Represents missing elements required to complete an input. Part of `analyzepsbt`. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct AnalyzePsbtInputMissing { /// Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing. pub pubkeys: Option>, @@ -81,7 +81,7 @@ pub struct AnalyzePsbtInputMissing { /// > ... /// > ] #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct JoinPsbts( /// The base64-encoded partially signed transaction. pub String, @@ -96,7 +96,7 @@ pub struct JoinPsbts( /// > Arguments: /// > 1. psbt (string, required) A base64 string of a PSBT #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct UtxoUpdatePsbt( /// The base64-encoded partially signed transaction with inputs updated. pub String, diff --git a/types/src/v18/util/mod.rs b/types/src/v18/util/mod.rs index cfee3488..ba9820d5 100644 --- a/types/src/v18/util/mod.rs +++ b/types/src/v18/util/mod.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// > Derives one or more addresses corresponding to an output descriptor. /// > Returns an array of derived addresses. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct DeriveAddresses(pub Vec); /// Result of JSON-RPC method `getdescriptorinfo`. @@ -25,7 +25,7 @@ pub struct DeriveAddresses(pub Vec); /// > Analyses a descriptor. /// > Returns information about the descriptor. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetDescriptorInfo { /// The descriptor in canonical form, without private keys. pub descriptor: String, diff --git a/types/src/v18/wallet/mod.rs b/types/src/v18/wallet/mod.rs index 6206f6f9..4b65241d 100644 --- a/types/src/v18/wallet/mod.rs +++ b/types/src/v18/wallet/mod.rs @@ -25,7 +25,7 @@ pub use super::{ /// > Arguments: /// > 1. "address" (string, required) The bitcoin address to get the information of. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddressInfo { /// The bitcoin address validated. pub address: String, @@ -96,7 +96,7 @@ pub struct GetAddressInfo { /// It includes all getaddressinfo output fields for the embedded address, excluding metadata /// ("timestamp", "hdkeypath", "hdseedid") and relation to the wallet ("ismine", "iswatchonly"). #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] +#[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] pub struct GetAddressInfoEmbedded { /// The bitcoin address validated. pub address: String, @@ -149,7 +149,7 @@ pub struct GetAddressInfoEmbedded { /// > /// > Returns the total amount received by addresses with `