Skip to content

Commit

Permalink
add missing serde feature cfg attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbus committed Mar 11, 2024
1 parent 640b6ad commit 7c805b5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub trait DescriptorRgb<K = XpubDerivable, V = ()>: Descriptor<K, V> {
}

#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
#[derive(Serialize, Deserialize)]
#[serde(crate = "serde_crate", rename_all = "camelCase")]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "serde_crate", rename_all = "camelCase"))]
#[repr(u8)]
pub enum RgbKeychain {
#[display("0", alt = "0")]
Expand Down Expand Up @@ -106,15 +106,15 @@ impl From<RgbKeychain> for Keychain {
fn from(keychain: RgbKeychain) -> Self { Keychain::from(keychain as u8) }
}

#[serde_as]
#[cfg_attr(feature = "serde", serde_as)]
#[derive(Clone, Eq, PartialEq, Debug)]
#[derive(Serialize, Deserialize)]
#[serde(crate = "serde_crate", rename_all = "camelCase")]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "serde_crate", rename_all = "camelCase"))]
pub struct TapretKey<K: DeriveXOnly = XpubDerivable> {
pub internal_key: K,
// TODO: Allow multiple tweaks per index by introducing derivation using new Terminal trait
// TODO: Change serde implementation for both Terminal and TapretCommitment
#[serde_as(as = "HashMap<serde_with::DisplayFromStr, serde_with::DisplayFromStr>")]
#[cfg_attr(feature = "serde", serde_as(as = "HashMap<serde_with::DisplayFromStr, serde_with::DisplayFromStr>"))]
pub tweaks: HashMap<Terminal, TapretCommitment>,
}

Expand Down Expand Up @@ -224,15 +224,15 @@ impl<K: DeriveXOnly> DescriptorRgb<K> for TapretKey<K> {
}

#[derive(Clone, Eq, PartialEq, Debug, From)]
#[derive(Serialize, Deserialize)]
#[serde(
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(
crate = "serde_crate",
rename_all = "camelCase",
bound(
serialize = "S::Compr: serde::Serialize, S::XOnly: serde::Serialize",
deserialize = "S::Compr: serde::Deserialize<'de>, S::XOnly: serde::Deserialize<'de>"
)
)]
))]
#[non_exhaustive]
pub enum RgbDescr<S: DeriveSet = XpubDerivable> {
#[from]
Expand Down
7 changes: 6 additions & 1 deletion src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
use std::collections::HashMap;
use std::convert::Infallible;
use std::io;
#[cfg(feature = "serde")]
use std::io::ErrorKind;
use std::ops::{Deref, DerefMut};
use std::path::PathBuf;

use amplify::IoError;
use bpstd::{Network, XpubDerivable};
use bpwallet::Wallet;
#[cfg(feature = "serde")]
use rgbfs::StockFs;
use rgbstd::containers::{Contract, LoadError, Transfer};
use rgbstd::interface::{
Expand All @@ -43,7 +45,9 @@ use rgbstd::persistence::{
use rgbstd::resolvers::ResolveHeight;
use rgbstd::validation::{self, ResolveWitness};
use rgbstd::{AssignmentWitness, ContractId, WitnessId, XChain, XOutpoint};
use strict_types::encoding::{DecodeError, DeserializeError, Ident, SerializeError, TypeName};
use strict_types::encoding::{DeserializeError, Ident, SerializeError, TypeName};
#[cfg(feature = "serde")]
use strict_types::encoding::DecodeError;

use crate::{DescriptorRgb, RgbDescr};

Expand Down Expand Up @@ -111,6 +115,7 @@ pub enum RuntimeError {
#[display(doc_comments)]
ResolverError(crate::AnyResolverError),

#[cfg(feature = "serde")]
#[from]
Yaml(serde_yaml::Error),

Expand Down

0 comments on commit 7c805b5

Please sign in to comment.