elements/
lib.rs

1// Rust Elements Library
2// Written in 2018 by
3//   Andrew Poelstra <apoelstra@blockstream.com>
4//
5// To the extent possible under law, the author(s) have dedicated all
6// copyright and related and neighboring rights to this software to
7// the public domain worldwide. This software is distributed without
8// any warranty.
9//
10// You should have received a copy of the CC0 Public Domain Dedication
11// along with this software.
12// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13//
14
15//! # Rust Elements Library
16//!
17//! Extensions to `rust-bitcoin` to support deserialization and serialization
18//! of Elements transactions and blocks.
19//!
20
21// Coding conventions
22#![deny(non_upper_case_globals)]
23#![deny(non_camel_case_types)]
24#![deny(non_snake_case)]
25#![deny(unused_mut)]
26#![deny(missing_docs)]
27#![allow(clippy::manual_range_contains)] // this lint is bullshit
28
29/// Re-export of bitcoin crate
30pub extern crate bitcoin;
31/// Re-export of secp256k1-zkp crate
32pub extern crate secp256k1_zkp;
33/// Re-export of serde crate
34#[cfg(feature = "serde")]
35#[macro_use]
36pub extern crate actual_serde as serde;
37#[cfg(all(test, feature = "serde"))]
38extern crate serde_test;
39
40#[cfg(test)]
41extern crate bincode;
42#[cfg(test)]
43extern crate rand;
44#[cfg(any(test, feature = "serde_json"))]
45extern crate serde_json;
46
47#[macro_use]
48mod internal_macros;
49pub mod address;
50pub mod blech32;
51mod blind;
52mod block;
53pub mod confidential;
54pub mod dynafed;
55pub mod encode;
56mod error;
57mod ext;
58mod fast_merkle_root;
59pub mod hash_types;
60pub mod hex;
61pub mod issuance;
62pub mod locktime;
63pub mod opcodes;
64mod parse;
65pub mod pset;
66pub mod schnorr;
67pub mod script;
68#[cfg(feature = "serde")]
69mod serde_utils;
70pub mod sighash;
71pub mod taproot;
72mod transaction;
73// consider making upstream public
74mod endian;
75// re-export bitcoin deps which we re-use
76pub use bitcoin::hashes;
77// export everything at the top level so it can be used as `elements::Transaction` etc.
78pub use crate::address::{Address, AddressError, AddressParams};
79pub use crate::blind::{
80    BlindAssetProofs, BlindError, BlindValueProofs, ConfidentialTxOutError, RangeProofMessage,
81    SurjectionInput, TxOutError, TxOutSecrets, UnblindError, VerificationError, CtLocation, CtLocationType,
82};
83pub use crate::block::ExtData as BlockExtData;
84pub use crate::block::{Block, BlockHeader};
85pub use crate::ext::{ReadExt, WriteExt};
86pub use crate::fast_merkle_root::fast_merkle_root;
87pub use crate::hash_types::*;
88pub use crate::issuance::{AssetId, ContractHash};
89pub use crate::locktime::LockTime;
90pub use crate::schnorr::{SchnorrSig, SchnorrSigError};
91pub use crate::script::Script;
92pub use crate::sighash::SchnorrSighashType;
93pub use crate::transaction::Sequence;
94pub use crate::transaction::{
95    AssetIssuance, EcdsaSighashType, OutPoint, PeginData, PegoutData, Transaction, TxIn,
96    TxInWitness, TxOut, TxOutWitness,
97};