Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispenser Stats Not Showing in Wallet page #675

Open
babalicious-io opened this issue Jan 25, 2025 · 3 comments
Open

Dispenser Stats Not Showing in Wallet page #675

babalicious-io opened this issue Jan 25, 2025 · 3 comments
Assignees

Comments

@babalicious-io
Copy link
Collaborator

babalicious-io commented Jan 25, 2025

Dispenser Stats Not Showing in the Wallet page on the live stampchain site and in the updated PR with WalletProfileDetails

Description

The dispenser statistics (open/closed/total) are not being displayed correctly in the WalletProfileDetails component. All values are showing as 0 when there should be active dispensers.

Expected Behavior

  • open: Number of dispensers opened by address with give_remaining > 0
  • closed: Number of dispensers opened by address with give_remaining === 0
  • total: Total count of all dispensers opened by address (open + closed)

Current Behavior

All values are showing as 0 in the UI:

Image

Investigation Steps

  1. Added console logs throughout the data flow:

    • Route handler ([address].tsx)
    • StampController (getDispensersWithStampsByAddress)
    • DispenserManager (getDispensersByAddress)
    • XCP API call configuration
  2. Verified the endpoint construction:

    • Endpoint: /addresses/${address}/dispensers
    • Parameters include pagination and sorting
    • Checked baseUrl configuration
  3. Data flow appears to break somewhere between:

    • API call in DispenserManager
    • Processing in StampController
    • Final data transformation in route handler

Potential Issues

  1. XCP API endpoint might have changed
  2. Data transformation between DispenserManager and final wallet data might be incorrect
  3. Cache invalidation issues with fetchXcpV2WithCache
  4. Pagination parameters might not be correctly applied

Proposed Solution

  1. Verify XCP API endpoint and response format
  2. Add error boundaries and fallback data
  3. Implement proper type checking throughout the flow
  4. Add comprehensive logging for production debugging
  5. Consider implementing a health check for the dispenser API endpoint

Technical Details

Current Implementation:

// Route Handler
const dispensersResponse = await StampController.getDispensersWithStampsByAddress(
address,
dispensersParams.page,
dispensersParams.limit,
{ sortBy: dispensersParams.sort }
);
// Data Processing
const allDispensers = dispensersResponse.status === "fulfilled"
? dispensersResponse.value.dispensers
: [];
const openDispensers = allDispensers.filter((d) => d.give_remaining > 0);
const closedDispensers = allDispensers.filter((d) => d.give_remaining === 0);

Related Components

  • WalletProfileDetails.tsx
  • StampController.ts
  • DispenserManager.ts
  • [address].tsx route

Additional Context

  • Fresh framework version: 1.7.3
  • Deno version: 2.1.5
  • Project: BTCStampsExplorer

Next Steps

  1. Add comprehensive error logging
  2. Verify XCP API contract hasn't changed
  3. Add type safety throughout the data flow
  4. Implement proper error handling and fallbacks
  5. Add monitoring for dispenser API health

/label bug data-flow api
/priority high

@babalicious-io
Copy link
Collaborator Author

live site

Image

from PR - wip

Image

@babalicious-io
Copy link
Collaborator Author

PR #679

I believe the issue is that the dispenser statistics (open/closed/total) are displaying stats relating to a wallet IF it is a dispenser

We need to display stats relating to the wallet that created the dispenser(s)
we need the following data:

  • how many dispensers an addy has opened
  • how many are open
  • how many are closed

@babalicious-io
Copy link
Collaborator Author

Discovered two old issues which pertains to the display of the amount of dispensers a wallet addy has opened/areOpen/closed
#215
#214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@babalicious-io @itttm127 and others