near-sdk (Rust) 3.1.0
Updated dependencies for near-sdk; Introduce trait IntoStorageKey and updating all persistent collections to take it instead of Vec<u8>. It's a non-breaking change.
- The latest release in the 3.1 line.
- Newest near-sdk (Rust): near-sdk (Rust) 5.30.0
3.1.0
- Updated dependencies for
near-sdk - Introduce trait
IntoStorageKeyand updating all persistent collections to take it instead ofVec<u8>. It's a non-breaking change. - Introduce a macro derive
BorshStorageKeythat implementsIntoStorageKeyusing borsh serialization. Example:
use near_sdk::BorshStorageKey;
#[derive(BorshSerialize, BorshStorageKey)]
enum StorageKey {
Records,
UniqueValues,
}
#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)]
pub struct StatusMessage {
pub records: LookupMap<String, String>,
pub unique_values: LookupSet<String>,
}
#[near_bindgen]
impl StatusMessage {
#[init]
pub fn new() -> Self {
Self {
records: LookupMap::new(StorageKey::Records),
unique_values: LookupSet::new(StorageKey::UniqueValues),
}
}
}