Skip to content

Commit

Permalink
Skip serializing None in batch::File (#3943)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph committed Sep 14, 2024
1 parent ed19df5 commit c5f4ab5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/subcommand/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pub struct RawOutput {
pub runestone: Option<Artifact>,
}

#[derive(Serialize, Eq, PartialEq, Deserialize, Debug)]
#[serde_with::skip_serializing_none]
#[derive(Serialize, Eq, PartialEq, Deserialize, Debug)]
pub struct CompactInscription {
pub body: Option<String>,
pub content_encoding: Option<String>,
Expand Down
5 changes: 3 additions & 2 deletions src/wallet/batch/entry.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use super::*;

#[serde_with::skip_serializing_none]
#[derive(Serialize, Deserialize, Default, PartialEq, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub struct Entry {
pub file: Option<PathBuf>,
pub delegate: Option<InscriptionId>,
pub satpoint: Option<SatPoint>,
pub destination: Option<Address<NetworkUnchecked>>,
pub file: Option<PathBuf>,
pub metadata: Option<serde_yaml::Value>,
pub metaprotocol: Option<String>,
pub satpoint: Option<SatPoint>,
}

impl Entry {
Expand Down
7 changes: 4 additions & 3 deletions src/wallet/batch/etching.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use super::*;

#[serde_with::skip_serializing_none]
#[derive(Serialize, Deserialize, PartialEq, Debug, Copy, Clone, Default)]
#[serde(deny_unknown_fields)]
pub struct Etching {
pub divisibility: u8,
pub premine: Decimal,
pub rune: SpacedRune,
pub supply: Decimal,
pub symbol: char,
pub divisibility: u8,
pub supply: Decimal,
pub premine: Decimal,
pub terms: Option<batch::Terms>,
pub turbo: bool,
}
5 changes: 3 additions & 2 deletions src/wallet/batch/file.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
use super::*;

#[serde_with::skip_serializing_none]
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Default)]
#[serde(deny_unknown_fields)]
pub struct File {
pub inscriptions: Vec<Entry>,
pub mode: Mode,
pub parent: Option<InscriptionId>,
pub postage: Option<u64>,
#[serde(default)]
pub reinscribe: bool,
pub etching: Option<batch::Etching>,
pub sat: Option<Sat>,
pub satpoint: Option<SatPoint>,
pub inscriptions: Vec<batch::entry::Entry>,
pub etching: Option<batch::Etching>,
}

impl File {
Expand Down
1 change: 1 addition & 0 deletions src/wallet/batch/terms.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::*;

#[serde_with::skip_serializing_none]
#[derive(Serialize, Deserialize, PartialEq, Debug, Copy, Clone, Default)]
#[serde(deny_unknown_fields)]
pub struct Terms {
Expand Down

0 comments on commit c5f4ab5

Please sign in to comment.