Available on crate feature serde only.
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 wownero::Amount;

#[derive(Serialize, Deserialize)]
pub struct HasAmount {
    #[serde(with = "wownero::util::amount::serde::as_wow")]
    pub amount: Amount,
}

Notabene that due to the limits of floating point precission, ::as_wow serializes amounts as strings.

Modules

Serialize and deserialize Amount as real numbers denominated in dustnero. Use with #[serde(with = "amount::serde::as_dust")].

Serialize and deserialize Amount as JSON strings denominated in wow. Use with #[serde(with = "amount::serde::as_wow")].

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.