-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
243d367
commit 1b29b7d
Showing
8 changed files
with
549 additions
and
243 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
pub mod block; | ||
mod tx; | ||
pub mod tx_in_pool; | ||
//! This module contains types mappings for other common types | ||
//! to allow for easier JSON (de)serialization. | ||
//! | ||
//! The main types are: | ||
//! - [`block::Block`] | ||
//! - [`tx::Transaction`] | ||
//! | ||
//! Modules exist within this module as the JSON representation | ||
//! of types sometimes differs, thus, the modules hold the types | ||
//! that match the specific schema, for example [`block::Input`] | ||
//! is different than [`tx::Input`]. | ||
|
||
pub use block::Block; | ||
pub use tx::Transaction; | ||
pub mod block; | ||
pub mod output; | ||
pub mod tx; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//! JSON output types. | ||
//! | ||
//! The same [`Output`] is used in both | ||
//! [`crate::json::block::MinerTransaction::vout`] and [`crate::json::tx::Transaction::vout`]. | ||
|
||
#[cfg(feature = "serde")] | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// JSON representation of an output. | ||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct Output { | ||
pub amount: u64, | ||
pub target: Target, | ||
} | ||
|
||
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct Target { | ||
/// Should be [`None`] if [`Self::tagged_key`] is [`Some`] | ||
#[serde(default, skip_serializing_if = "Option::is_none")] | ||
pub key: Option<String>, | ||
|
||
/// Should be [`None`] if [`Self::key`] is [`Some`] | ||
#[serde(default, skip_serializing_if = "Option::is_none")] | ||
pub tagged_key: Option<TaggedKey>, | ||
} | ||
|
||
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct TaggedKey { | ||
pub key: String, | ||
pub view_tag: String, | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.