It is a good starting point for checking an existing Wasm file on NEAR Protocol.
Install Rust and Cargo: https://www.rust-lang.org/tools/install
- Put the Wasm file you want to test into the root of this project and name it
contract.wasm - Run
cargo test
If you want to test the contract with the latest version of NEAR Protocol, you can build the NEAR Protocol from the source code.
- Clone nearcore from
debug/wasm-logsbranch: https://github.com/near/nearcore/compare/debug/wasm-logs make neard-debug- Set the
NEAR_SANDBOX_BIN_PATHenv variable to a full path pointing to theneardin./target/debugfolder - Set the
NEAR_ENABLE_SANDBOX_LOG=1 - and run
cargo test
Example one-liner:
env NEAR_SANDBOX_BIN_PATH=/home/frol/nearcore/target/debug/neard NEAR_ENABLE_SANDBOX_LOG=1 cargo test