feat: Add GraphQL/REST API and WebSocket for Signet orders#5
Open
init4samwise wants to merge 4 commits intofeat/signet-orders-indexerfrom
Open
feat: Add GraphQL/REST API and WebSocket for Signet orders#5init4samwise wants to merge 4 commits intofeat/signet-orders-indexerfrom
init4samwise wants to merge 4 commits intofeat/signet-orders-indexerfrom
Conversation
Phase 2 of ENG-1876: Signet Order Tracking and Indexing This adds GraphQL API support for querying Signet orders and fills: **New GraphQL Types (apps/block_scout_web/lib/block_scout_web/graphql/signet/):** - schema/types.ex: signet_order and signet_fill node objects - schema/query_fields.ex: Query fields with pagination support **New Resolvers:** - resolvers/order.ex: get_by and list resolvers for orders - resolvers/fill.ex: get_by and list resolvers for fills **New Explorer Module (apps/explorer/lib/explorer/graphql/signet.ex):** - get_order/2: Fetch single order by transaction_hash + log_index - orders_query/1: Paginated orders with block range filters - get_fill/3: Fetch single fill by chain_type + transaction_hash + log_index - fills_query/1: Paginated fills with chain_type and block range filters **GraphQL Queries:** - signet_order(transaction_hash, log_index): Get single order - signet_orders(first, after, block_number_gte, block_number_lte): Paginated orders - signet_fill(chain_type, transaction_hash, log_index): Get single fill - signet_fills(first, after, chain_type, block_number_gte, block_number_lte): Paginated fills Uses compile-time chain_type check to conditionally include Signet schema when CHAIN_TYPE=signet, following Blockscout's chain-specific extension patterns. Builds on PR #2 (Phase 1 data models and indexer). Closes ENG-1876
Phase 2 test coverage for ENG-1876. Tests for signet_order query: - Returns order by transaction_hash and log_index - Returns error for non-existent order - Returns error for invalid transaction hash Tests for signet_orders query: - Returns paginated orders - Filters by block_number_gte - Filters by block_number_lte - Filters by block range (gte and lte) - Returns empty list when no orders match Tests for signet_fill query: - Returns fill by chain_type, transaction_hash, and log_index - Returns host chain fill - Returns error for non-existent fill - Returns error for invalid chain type Tests for signet_fills query: - Returns paginated fills - Filters by chain_type - Filters by block_number_gte - Filters by block_number_lte - Combines chain_type and block range filters - Returns empty list when no fills match Uses compile-time chain_type check to conditionally compile tests when CHAIN_TYPE=signet, following existing Signet test patterns.
Adds REST API endpoints in addition to GraphQL API for Signet data: New endpoints: - GET /api/v2/signet/orders - List orders with pagination - GET /api/v2/signet/orders/count - Get total order count - GET /api/v2/signet/orders/:tx_hash/:log_index - Get single order - GET /api/v2/signet/fills - List fills with pagination and filtering - GET /api/v2/signet/fills/count - Get fill count (filterable) - GET /api/v2/signet/fills/:chain_type/:tx_hash/:log_index - Get single fill Features: - Block range filtering (block_number_gte, block_number_lte) - Chain type filtering for fills (rollup/host) - Standard Blockscout pagination - JSON rendering of orders and fills Files added: - signet_controller.ex - REST API controller - signet_view.ex - JSON view rendering - signet_controller_test.exs - Controller tests - api_router.ex - Added /signet routes (chain_type check) Follows Arbitrum controller pattern for consistency.
Adds real-time event broadcasting for Signet orders and fills: New files: - signet_channel.ex: WebSocket channel for signet:new_order, signet:new_fill, signet:order_updates - notifiers/signet.ex: Event handlers that broadcast order/fill events to connected clients Modified files: - user_socket.ex: Register signet channel when chain_type=signet - notifier.ex: Add signet-specific event handlers This enables clients to subscribe to real-time updates for: - New order creations - New fill events - Order status updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 3 of ENG-1876: Signet Order Tracking and Indexing.
Adds API endpoints and real-time event support for Signet order tracking.
Changes
GraphQL API
signet_order(transaction_hash, log_index): Get single ordersignet_orders(first, after, block_number_gte, block_number_lte): Paginated orderssignet_fill(chain_type, transaction_hash, log_index): Get single fillsignet_fills(first, after, chain_type, block_number_gte, block_number_lte): Paginated fillsREST API v2
GET /api/v2/signet/orders- List orders with paginationGET /api/v2/signet/orders/count- Get total order countGET /api/v2/signet/orders/:tx_hash/:log_index- Get single orderGET /api/v2/signet/fills- List fills with pagination and filteringGET /api/v2/signet/fills/count- Get fill countGET /api/v2/signet/fills/:chain_type/:tx_hash/:log_index- Get single fillWebSocket Channels
signet:new_order- New order eventssignet:new_fill- New fill eventssignet:order_updates- Order status updatesTests
Related