Crate near_helper

Source
Expand description

§NEAR-SDK-RS 4.0 pre-release

Some helper for NEAR 4.0 after upgrading from previous versions.

Re-exports§

pub use crate::timestamp::*;

Modules§

timestamp
Because we can’t use the chrono crate (even with serde and wasmbind it doesn’t seems to compile properly), here we are. Because we have near_sdk::env::block_timestamp_ms(), here tries to convert that.

Functions§

as_scientific_notation
Return the scientific notation of a given value, based on the digit you want to keep. This offers you to calculate using the number of kept digits, hence simplifying calculations.
assert_predecessor_is_currentDeprecated
Assert predecessor is current, very frequently used assertion. Similar to near_sdk::utils::assert_self except you can enter a custom message for claribility.
expect_lightweightDeprecated
The equivalent of .expect() but a lightweight version to reduce compiled-wasm size.
is_promise_successDeprecated
Checks for successful promise.
near_to_yoctonear
NEAR to yoctonear conversion.
yoctonear_to_near
Converts yoctoNEAR to NEAR. If there are many decimal places, will only leave the “first 5 decimals.”