Skip to content

refactor: replace SQL HTTP with gRPC in edge marketplace client#289

Open
MartianGreed wants to merge 2 commits intoponderingdemocritus/nft-sqlfrom
refactor/edge-sql-to-grpc
Open

refactor: replace SQL HTTP with gRPC in edge marketplace client#289
MartianGreed wants to merge 2 commits intoponderingdemocritus/nft-sqlfrom
refactor/edge-sql-to-grpc

Conversation

@MartianGreed
Copy link
Collaborator

@MartianGreed MartianGreed commented Feb 23, 2026

Summary

Replaces raw SQL queries over HTTP (/sql endpoint) in the edge marketplace client with structured gRPC calls via @dojoengine/sdk and ToriiClient.

Based on ponderingdemocritus/nft-sql branch.

Changes

  • client.edge.ts: Rewritten to use gRPC transport instead of SQL HTTP
    • fetchToriisgetTokenContracts/getTokens for collection metadata
    • fetchCollectionTokens for token listing and getCollectionTokenMetadataBatch
    • fetchTokenBalances for ownership verification
    • ToriiQueryBuilder with KeysClause/MemberClause for Order and Book entity queries (same patterns as client.dojo.ts)
  • Tests: Rewritten to mock gRPC transport (fetchToriis, fetchCollectionTokens, fetchTokenBalances)
  • Edge smoke test: Simplified (gRPC transport not edge-runtime compatible)

Notes

  • The torii-sql-fetcher module is still used by filters.ts and remains in the codebase
  • The edge and dojo clients now share the same gRPC transport layer
  • -499 lines net reduction by reusing shared tokens.ts helpers

@vercel
Copy link

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
arcade Ready Ready Preview Feb 23, 2026 9:54am
arcade-storybook Ready Ready Preview Feb 23, 2026 9:54am

Request Review

…ient

Replace raw SQL queries over HTTP (/sql endpoint) with structured gRPC
calls, aligning the edge client with the dojo client's transport layer.

Based on ponderingdemocritus/nft-sql branch optimizations.

Changes:
- client.edge.ts: rewritten to use fetchToriis/fetchCollectionTokens/
  fetchTokenBalances (gRPC) + SDK entity queries instead of
  fetchToriisSql (HTTP POST to /sql)
- getTokenContracts/getTokens for collection metadata
- fetchCollectionTokens for token listing and metadata batch
- fetchTokenBalances for ownership verification
- ToriiQueryBuilder with KeysClause/MemberClause for Order/Book entities
- Updated all tests to mock gRPC transport
- Simplified edge-runtime smoke test
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

Successfully merging this pull request may close these issues.

1 participant