Skip to content

Display user's own reputation in account screen #511

@Catrya

Description

@Catrya

Allow users to see their own reputation (rating, reviews, days) in the account/profile screen, without needing to create an order.

Current Behavior

Users can only see their reputation when they create an order, because the rating info is included in the order event tags. There's no way to view reputation from the account screen.

Proposed Solution

Query the user's rating from the public Nostr event (kind 38384) published by Mostro.

Implementation approach

  1. Query rating event from relay:
    • Get trade pubkeys from recent completed sessions stored locally
    • Query kind 38384 events filtering by #d tag with those trade keys
    • Use the most recent event found (rating is cumulative)
final sessions = await sessionStorage.getAllSessions();
final completedTradeKeys = sessions
    .where((s) => s.status == OrderStatus.success)
    .sorted((a, b) => b.startTime.compareTo(a.startTime))
    .take(20)
    .map((s) => s.tradeKey.public)
    .toList();
final filter = NostrFilter(
  kinds: [38384],
  authors: [mostroPubkey],
  additionalFilters: {'#d': completedTradeKeys},
  limit: 1,
);
  1. Cache locally: • Store the last known reputation locally
    • Display cached value immediately when opening account screen
    • Update only when: • First app launch after install
    • After completing a successful trade
    • Manual pull-to-refresh by user

  2. Display in account screen: • Rating (stars or numeric)
    • Total reviews
    • Days using Mostro

Edge cases

• New user with no trades: Show "No reputation yet"
• User with trades but no ratings received: Show "No ratings received yet"
• App reinstalled without restore: "No reputation yet"

UI Reference

Similar to CreatorReputationCard widget already used in order cards, but for the current user in account screen.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions