Skip to content

v3.0.1

Compare
Choose a tag to compare
@evgenykuzyakov evgenykuzyakov released this 25 Mar 18:33
· 922 commits to master since this release
ff38c94

3.0.1

  • Introduced #[private] method decorator, that verifies predecessor_account_id() == current_account_id().
    NOTE: Usually, when a contract has to have a callback for a remote cross-contract call, this callback method should
    only be called by the contract itself. It's to avoid someone else calling it and messing the state. Pretty common pattern
    is to have an assert that validates that the direct caller (predecessor account ID) matches to the contract's account (current account ID).
  • Added how to build contracts with reproducible builds.
  • Added log! macro to log a string from a contract similar to println! macro.
  • Added test_utils mod from near_sdk that contains a bunch of helper methods and structures, e.g.
    • test_env - simple test environment mod used internally.
    • Expanded testing_env to be able to pass promise results
    • Added VMContextBuilder to help construct a VMContext for tests
    • Added get_logs method that returns current logs from the contract execution.
    • TEST_BREAKING env::created_receipts moved to test_utils::get_created_receipts.
      env shouldn't contain testing methods.
    • Updated a few examples to use log! macro
  • Added #[derive(PanicOnDefault)] that automatically implements Default trait that panics when called.
    This is helpful to prevent contracts from being initialized using Default by removing boilerplate code.
  • Introduce setup_alloc macro that generates the same boilerplate as before, but also adds a #[cfg(target_arch = "wasm32")], which prevents the allocator from being used when the contract's main file is used in simulation testing.
  • Introduce Base58CryptoHash and CryptoHash to represent 32 bytes slice of u8.
  • Introduce LazyOption to keep a single large value with lazy deserialization.
  • BREAKING #[init] now checks that the state is not initialized. This is expected behavior. To ignore state check you can call #[init(ignore_state)]
  • NOTE: 3.0.0 is not published, due to tag conflicts on the near-sdk-rs repo.