near-sdk (Rust) 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…
- The latest release in the 3.0 line.
- Newest near-sdk (Rust): near-sdk (Rust) 5.30.0
3.0.1
- Introduced
#[private]method decorator, that verifiespredecessor_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 toprintln!macro. - Added
test_utilsmod fromnear_sdkthat contains a bunch of helper methods and structures, e.g.test_env- simple test environment mod used internally.- Expanded
testing_envto be able to pass promise results - Added
VMContextBuilderto help construct aVMContextfor tests - Added
get_logsmethod that returns current logs from the contract execution. - TEST_BREAKING
env::created_receiptsmoved totest_utils::get_created_receipts.envshouldn't contain testing methods. - Updated a few examples to use
log!macro
- Added
#[derive(PanicOnDefault)]that automatically implementsDefaulttrait that panics when called. This is helpful to prevent contracts from being initialized usingDefaultby removing boilerplate code. - Introduce
setup_allocmacro 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
Base58CryptoHashandCryptoHashto represent32bytes slice ofu8. - Introduce
LazyOptionto 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.0is not published, due to tag conflicts on thenear-sdk-rsrepo.