Runnable examples of persistent collections in near_sdk::store:
VectorLookupMapandIterableMapLookupSetandIterableSet- Nested collections with distinct storage prefixes and explicit cleanup
The contract is in collections-rs/store. Collection modules include unit tests, and the integration suite uses near-sandbox and near-api to deploy the contract to a local Sandbox and checks each collection across calls. See the collections guide for explanations of storage prefixes and collection selection.
Install rustup. The repository pins Rust 1.97.1 and uses NEAR SDK 5.29.1. Install the contract build tool:
cargo install cargo-near --version 0.21.1 --locked --no-default-featurescd collections-rs/store
cargo near build non-reproducible-wasm --lockedThe build command prints the path to the generated Wasm artifact.
cd collections-rs
cargo test --lockedTests build the contract from source and use local Sandbox accounts. They do not require a funded public-network account or a frontend.