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
- Deploy a subgraph
- Index
ChannelCreated, ChannelRedeemed, and ChannelClosed events.
- Store channels between payers and merchants.
- 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.
- 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.
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
ChannelCreated,ChannelRedeemed, andChannelClosedevents.Benefits