Skip to content

[Feature Request] Implement Subgraph to Track Payment Channels #2

Description

@pali101

Description

Currently, the SDK does not provide a way to fetch all active payment channels for a user (payer or merchant). Instead of modifying the smart contract, we can use The Graph to index payment channels and query them efficiently.

Proposed Solution

  1. Deploy a subgraph
    • Index ChannelCreated, ChannelRedeemed, and ChannelClosed events.
    • Store channels between payers and merchants.
  2. Update the SDK
    • Add a function to query the subgraph for a list of open channels by payer.
    • Add a function to query the subgraph for a list of open channels with merchant.
  3. Expose API for Frontend
    • Allow frontends to easily fetch all open channels for a user without scanning on-chain data.

Benefits

  • Cheaper & Faster - No additional gas costs for storage, and queries are nearly instant.
  • Better User Experience - Fetch all active channels in a single GraphQL query.
  • Scalable - Easily extendable to add more analytics, filtering, or historical data.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions