[docs] Add more docs to 'types.rs'

This commit is contained in:
Steve Myers 2020-12-16 11:33:34 -08:00
parent 635d98c069
commit 8cfbf1f0a2
No known key found for this signature in database
GPG Key ID: 8105A46B22C2D051
2 changed files with 12 additions and 2 deletions

View File

@ -258,7 +258,6 @@ pub mod descriptor;
mod doctest; mod doctest;
pub mod keys; pub mod keys;
pub(crate) mod psbt; pub(crate) mod psbt;
#[allow(missing_docs)] // TODO add missing docs and remove this allow
pub(crate) mod types; pub(crate) mod types;
pub mod wallet; pub mod wallet;

View File

@ -29,7 +29,7 @@ use bitcoin::hash_types::Txid;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Types of script /// Types of keychains
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum KeychainKind { pub enum KeychainKind {
/// External /// External
@ -39,6 +39,7 @@ pub enum KeychainKind {
} }
impl KeychainKind { impl KeychainKind {
/// Return [`KeychainKind`] as a byte
pub fn as_byte(&self) -> u8 { pub fn as_byte(&self) -> u8 {
match self { match self {
KeychainKind::External => b'e', KeychainKind::External => b'e',
@ -92,19 +93,29 @@ impl std::default::Default for FeeRate {
/// A wallet unspent output /// A wallet unspent output
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct UTXO { pub struct UTXO {
/// Reference to a transaction output
pub outpoint: OutPoint, pub outpoint: OutPoint,
/// Transaction output
pub txout: TxOut, pub txout: TxOut,
/// Type of keychain
pub keychain: KeychainKind, pub keychain: KeychainKind,
} }
/// A wallet transaction /// A wallet transaction
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
pub struct TransactionDetails { pub struct TransactionDetails {
/// Optional transaction
pub transaction: Option<Transaction>, pub transaction: Option<Transaction>,
/// Transaction id
pub txid: Txid, pub txid: Txid,
/// Timestamp
pub timestamp: u64, pub timestamp: u64,
/// Received value (sats)
pub received: u64, pub received: u64,
/// Sent value (sats)
pub sent: u64, pub sent: u64,
/// Fee value (sats)
pub fees: u64, pub fees: u64,
/// Confirmed in block height, `None` means unconfirmed
pub height: Option<u32>, pub height: Option<u32>,
} }