Add Amount and SignedAmount types

This commit is contained in:
Steven Roose 2018-11-10 00:45:00 +00:00
parent d4282353c9
commit 688d95b463
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
4 changed files with 1350 additions and 5 deletions

View File

@ -18,7 +18,7 @@ path = "src/lib.rs"
fuzztarget = ["secp256k1/fuzztarget", "bitcoin_hashes/fuzztarget"] fuzztarget = ["secp256k1/fuzztarget", "bitcoin_hashes/fuzztarget"]
serde-decimal = ["use-serde", "strason"] serde-decimal = ["use-serde", "strason"]
unstable = [] unstable = []
use-serde = ["serde", "serde_test", "bitcoin_hashes/serde"] use-serde = ["serde", "bitcoin_hashes/serde"]
[dependencies] [dependencies]
bitcoin-bech32 = "0.9.0" bitcoin-bech32 = "0.9.0"
@ -27,11 +27,9 @@ rand = "0.3"
bitcoin_hashes = "0.3" bitcoin_hashes = "0.3"
bitcoinconsensus = { version = "0.16", optional = true } bitcoinconsensus = { version = "0.16", optional = true }
[dev-dependencies]
tempfile = "3"
[dependencies.serde] [dependencies.serde]
version = "1" version = "1"
features = ["derive"]
optional = true optional = true
[dependencies.serde_test] [dependencies.serde_test]
@ -49,3 +47,9 @@ version = "=0.3.2"
[dependencies.secp256k1] [dependencies.secp256k1]
version = "0.12" version = "0.12"
features = [ "rand" ] features = [ "rand" ]
[dev-dependencies]
serde_derive = "1"
serde_json = "1"
serde_test = "1"
tempfile = "3"

View File

@ -49,8 +49,10 @@ extern crate hex;
extern crate rand; extern crate rand;
extern crate secp256k1; extern crate secp256k1;
#[cfg(feature = "serde")] extern crate serde; #[cfg(feature = "serde")] extern crate serde;
#[cfg(feature = "serde_test")] extern crate serde_test;
#[cfg(feature = "strason")] extern crate strason; #[cfg(feature = "strason")] extern crate strason;
#[cfg(all(test, feature = "serde"))] #[macro_use] extern crate serde_derive; // for 1.22.0 compat
#[cfg(all(test, feature = "serde"))] extern crate serde_json;
#[cfg(all(test, feature = "serde"))] extern crate serde_test;
#[cfg(all(test, feature = "unstable"))] extern crate test; #[cfg(all(test, feature = "unstable"))] extern crate test;
#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus; #[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus;
@ -77,6 +79,8 @@ pub use consensus::encode::VarInt;
pub use network::constants::Network; pub use network::constants::Network;
pub use util::Error; pub use util::Error;
pub use util::address::Address; pub use util::address::Address;
pub use util::amount::Amount;
pub use util::amount::SignedAmount;
pub use util::hash::BitcoinHash; pub use util::hash::BitcoinHash;
pub use util::key::PrivateKey; pub use util::key::PrivateKey;
pub use util::key::PublicKey; pub use util::key::PublicKey;

1336
src/util/amount.rs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
pub mod key; pub mod key;
pub mod address; pub mod address;
pub mod amount;
pub mod base58; pub mod base58;
pub mod bip32; pub mod bip32;
pub mod bip143; pub mod bip143;