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

Modules

  • 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

  • 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 current, very frequently used assertion. Similar to near_sdk::utils::assert_self except you can enter a custom message for claribility.
  • The equivalent of .expect() but a lightweight version to reduce compiled-wasm size.
  • Checks for successful promise.
  • NEAR to yoctonear conversion.
  • Converts yoctoNEAR to NEAR. If there are many decimal places, will only leave the “first 5 decimals.”