Skip to content

feat: Add Signet API endpoints for orders and fills#10

Merged
rymcol merged 4 commits intosignet-mainfrom
samwise/eng-1896-signet-api-endpoints
Mar 13, 2026
Merged

feat: Add Signet API endpoints for orders and fills#10
rymcol merged 4 commits intosignet-mainfrom
samwise/eng-1896-signet-api-endpoints

Conversation

@init4samwise
Copy link

Summary

Implements REST API endpoints for querying Signet orders and fills by block number or transaction hash.

Endpoints Added

Block-based endpoints

  • GET /api/v2/signet/blocks/:block_number/orders - Returns all orders initiated in a specific block
  • GET /api/v2/signet/blocks/:block_number/fills - Returns all fills executed in a specific block
  • GET /api/v2/signet/blocks/:block_number/activity - Combined view of orders and fills

Transaction-based endpoints

  • GET /api/v2/signet/transactions/:tx_hash/orders - Orders initiated by a specific transaction
  • GET /api/v2/signet/transactions/:tx_hash/fills - Fills executed by a specific transaction
  • GET /api/v2/signet/transactions/:tx_hash/activity - Combined view for a transaction

Features

  • ✅ Pagination support for all list endpoints
  • ✅ JSON response format following Blockscout conventions
  • ✅ Order status calculation (pending/expired based on deadline)
  • ✅ Combined activity view for orders and fills together

Response Formats

Orders endpoint

{
  "items": [
    {
      "order_hash": "0x...:3",
      "outputs_witness_hash": "0x...",
      "deadline": 1707000000,
      "transaction_hash": "0x...",
      "log_index": 3,
      "block_number": 12345,
      "inputs": [{ "token": "0x...", "amount": "1000000" }],
      "outputs": [{ "token": "0x...", "amount": "500000", "recipient": "0x...", "chain_id": 1 }],
      "status": "pending",
      "sweep": null
    }
  ],
  "next_page_params": null
}

Fills endpoint

{
  "items": [
    {
      "outputs_witness_hash": "0x...",
      "transaction_hash": "0x...",
      "log_index": 5,
      "block_number": 12345,
      "chain_type": "rollup",
      "outputs": [{ "token": "0x...", "amount": "500000", "recipient": "0x...", "chain_id": 1 }]
    }
  ],
  "next_page_params": null
}

Files Changed

New files

  • apps/explorer/lib/explorer/chain/signet.ex - Query functions for orders/fills
  • apps/block_scout_web/lib/block_scout_web/controllers/api/v2/signet/signet_controller.ex - API controller
  • apps/block_scout_web/lib/block_scout_web/views/api/v2/signet_view.ex - JSON view

Modified files

  • apps/block_scout_web/lib/block_scout_web/routers/api_router.ex - Added Signet routes
  • apps/explorer/lib/explorer/chain.ex - Added pagination helpers for Signet

Testing

Manual testing recommended with existing Signet data. All endpoints follow established Blockscout patterns.


Closes ENG-1896

Implements REST API endpoints for querying Signet orders and fills:

Block-based endpoints:
- GET /api/v2/signet/blocks/:block_number/orders
- GET /api/v2/signet/blocks/:block_number/fills
- GET /api/v2/signet/blocks/:block_number/activity

Transaction-based endpoints:
- GET /api/v2/signet/transactions/:tx_hash/orders
- GET /api/v2/signet/transactions/:tx_hash/fills
- GET /api/v2/signet/transactions/:tx_hash/activity

Features:
- Pagination support for all list endpoints
- JSON response format following Blockscout conventions
- Order status calculation (pending/expired)
- Combined activity view for orders and fills together

New files:
- apps/explorer/lib/explorer/chain/signet.ex - Query functions
- apps/block_scout_web/lib/block_scout_web/controllers/api/v2/signet/signet_controller.ex
- apps/block_scout_web/lib/block_scout_web/views/api/v2/signet_view.ex

Modified files:
- apps/block_scout_web/lib/block_scout_web/routers/api_router.ex - Added routes
- apps/explorer/lib/explorer/chain.ex - Added pagination helpers

Closes ENG-1896
@init4samwise init4samwise requested a review from a team March 11, 2026 07:07
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rymcol
Copy link

rymcol commented Mar 11, 2026

@init4samwise fix the failing checks here please

init4samwise and others added 2 commits March 11, 2026 19:55
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@init4samwise init4samwise changed the base branch from master to signet-main March 11, 2026 20:24
@rymcol rymcol merged commit 9389c31 into signet-main Mar 13, 2026
17 of 19 checks passed
@rymcol rymcol deleted the samwise/eng-1896-signet-api-endpoints branch March 13, 2026 13:03
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.

3 participants