Skip to content

Commit

Permalink
fix: nesting.md (#1458)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanakannzashi authored Aug 3, 2023
1 parent 9b92ec9 commit e7f03fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/sdk/rust/contract-structure/nesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Default for Contract {

#[near_bindgen]
impl Contract {
pub fn get_tokens(&self, account_id: &AccountId) -> UnorderedSet<String> {
pub fn get_tokens(&self, account_id: &AccountId) -> Vec<String> {
let tokens = self.accounts.get(account_id).unwrap_or_else(|| {
// Constructing a unique prefix for a nested UnorderedSet from a concatenation
// of a prefix and a hash of the account id.
Expand All @@ -41,7 +41,7 @@ impl Contract {
.concat();
UnorderedSet::new(prefix)
});
tokens
tokens.to_vec()
}
}
```
Expand Down Expand Up @@ -89,13 +89,13 @@ pub enum StorageKeys {

#[near_bindgen]
impl Contract {
pub fn get_tokens(&self, account_id: &AccountId) -> UnorderedSet<String> {
pub fn get_tokens(&self, account_id: &AccountId) -> Vec<String> {
let tokens = self.accounts.get(account_id).unwrap_or_else(|| {
UnorderedSet::new(StorageKeys::SubAccount {
account_hash: env::sha256_array(account_id.as_bytes()),
})
});
tokens
tokens.to_vec()
}
}
```
Expand Down

0 comments on commit e7f03fe

Please sign in to comment.