Crate near_token
source ·Expand description
A NearToken
type to represent a value of Near.
Each Neartokens
is composed of a floating point number of tokens where each integer unit is equal to one yocto-Near.
NearToken
is implementing the common trait FromStr
. Also, have utils function to parse from str
into u128
.
§Examples
use near_token::NearToken;
let one_near = NearToken::from_yoctonear(10_u128.pow(24));
assert_eq!(one_near, NearToken::from_near(1));
assert_eq!(one_near, NearToken::from_millinear(1000));
§Crate features
-
borsh (optional) - When enabled allows
NearToken
to serialized and deserialized byborsh
. -
serde (optional) - When enabled allows
NearToken
to serialized and deserialized byserde
. -
schemars (optional) - Implements
schemars::JsonSchema
forNearToken
. -
interactive-clap (optional) - Implements
interactive_clap::ToCli
forNearToken
.