diff --git a/extended-vnft/app/src/services/extended_vnft/mod.rs b/extended-vnft/app/src/services/extended_vnft/mod.rs index ad627fc..df1572e 100644 --- a/extended-vnft/app/src/services/extended_vnft/mod.rs +++ b/extended-vnft/app/src/services/extended_vnft/mod.rs @@ -164,6 +164,17 @@ impl ExtendedService { pub fn token_metadata_by_id(&self, token_id: TokenId) -> Option { 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 {