Module breez_sdk_core::bitcoin::util::amount::serde
Expand description
This module adds serde serialization and deserialization support for Amounts. Since there is not a default way to serialize and deserialize Amounts, multiple ways are supported and it’s up to the user to decide which serialiation to use. The provided modules can be used as follows:
ⓘ
use serde::{Serialize, Deserialize};
use bitcoin::Amount;
#[derive(Serialize, Deserialize)]
pub struct HasAmount {
#[serde(with = "bitcoin::util::amount::serde::as_btc")]
pub amount: Amount,
}
Modules§
- Serialize and deserialize
Amount
as JSON numbers denominated in BTC. Use with#[serde(with = "amount::serde::as_btc")]
. - Serialize and deserialize
Amount
as real numbers denominated in satoshi. Use with#[serde(with = "amount::serde::as_sat")]
.
Traits§
- This trait is used only to avoid code duplication and naming collisions of the different serde serialization crates.
- This trait is only for internal Amount type serialization/deserialization