[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;
pub mod keys;
pub(crate) mod psbt;
#[allow(missing_docs)] // TODO add missing docs and remove this allow
pub(crate) mod types;
pub mod wallet;

View File

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