Skip to content

Commit

Permalink
transfering query to extend-vnft and adding TokenMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
MedovTimur committed Nov 21, 2024
1 parent f9b4942 commit e07567a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
11 changes: 11 additions & 0 deletions extended-vnft/app/src/services/extended_vnft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ impl ExtendedService {
pub fn token_metadata_by_id(&self, token_id: TokenId) -> Option<TokenMetadata> {
self.get().token_metadata_by_id.get(&token_id).cloned()
}
pub fn tokens_for_owner(&self, owner: ActorId) -> Vec<(TokenId, TokenMetadata)> {
Storage::tokens_for_owner()
.get(&owner)
.unwrap_or(&HashSet::new())
.iter()
.filter_map(|token_id| {
self.token_metadata_by_id(*token_id)
.map(|metadata| (*token_id, metadata))
})
.collect()
}
}

impl ExtendedService {
Expand Down
9 changes: 0 additions & 9 deletions vnft-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,4 @@ impl Service {
let storage = Storage::get();
&storage.symbol
}
pub fn tokens_for_owner(&self, owner: ActorId) -> Vec<TokenId> {
Storage::get()
.tokens_for_owner
.get(&owner)
.unwrap_or(&HashSet::new())
.iter()
.cloned()
.collect()
}
}

0 comments on commit e07567a

Please sign in to comment.