-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.1.0] Introduce BorshStorageKey (#352)
### `3.1.0` * Introduce trait `IntoStorageKey` and updating all persistent collections to take it instead of `Vec<u8>`. It's a non-breaking change. * Introduce a macro derive `BorshStorageKey` that implements `IntoStorageKey` using borsh serialization. Example: ```rust 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), } } } ```
- Loading branch information
Evgeny Kuzyakov
authored
Apr 6, 2021
1 parent
b92f88c
commit bac0ec7
Showing
50 changed files
with
542 additions
and
663 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.