Skip to content

feat: add /scripts/{script_hash}/utxos endpoint#460

Merged
slowbackspace merged 2 commits into
masterfrom
feat/scripts-script-hash-utxos
Jun 23, 2026
Merged

feat: add /scripts/{script_hash}/utxos endpoint#460
slowbackspace merged 2 commits into
masterfrom
feat/scripts-script-hash-utxos

Conversation

@slowbackspace

@slowbackspace slowbackspace commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new paged endpoint GET /scripts/{script_hash}/utxos that lists the UTXOs holding a given script as a reference script (CIP-33).

Motivation

From a support ticket: to use a script as a reference input (CIP-31) you need the tx_hash#output_index of a UTXO carrying it. Today the only way via Blockfrost is to know the holding address and enumerate its UTXOs — awkward, since a script can be deployed at many addresses (or unknown ones). This endpoint resolves a script hash directly to the UTXOs that carry it.

A script can legitimately be held by multiple unspent UTXOs (observed up to 24 on mainnet), so the endpoint is paginated.

Response shape

Mirrors /addresses/{address}/utxos so clients can reuse existing UTXO parsing, but omits the deprecated tx_index field — consistent with the newer tx_content_utxo schema, which only exposes output_index.

Changes

  • src/schemas/scripts/script_utxos.yaml — new response schema
  • src/paths/api/scripts/{script_hash}/utxos.yaml — new path
  • registered in src/definitions.yaml
  • version bump 0.1.89 → 0.1.90
  • regenerated bundles, types, json-schema, snapshot

Notes

  • The matching backend implementation (blockfrost-backend-ryo) depends on this version once published.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
openapi Ready Ready Preview, Comment Jun 23, 2026 12:29pm

Request Review

Adds an endpoint listing the UTXOs that hold a given script as a
reference script (CIP-33). These outputs can be used as reference
inputs (CIP-31) to execute the script without including its bytes.
A script may be held by multiple UTXOs, potentially at different
addresses, so the endpoint is paginated.

Response shape mirrors /addresses/{address}/utxos, omitting the
deprecated tx_index field (consistent with tx_content_utxo).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Cardano Scripts API endpoint to discover UTXOs that carry a given script as a reference script (CIP-33), enabling clients to locate tx_hash#output_index without enumerating addresses.

Changes:

  • Added GET /scripts/{script_hash}/utxos path with standard pagination params (count, page, order).
  • Introduced a new script_utxos response schema (mirroring address UTXO responses but without deprecated tx_index).
  • Bumped version 0.1.89 → 0.1.90 and regenerated bundled specs/types/snapshots/docs.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/tests/snapshots/get-schema-for-endpoint.test.ts.snap Snapshot updated to include the new endpoint schema.
src/schemas/scripts/script_utxos.yaml New response schema for script reference UTXO listing.
src/paths/api/scripts/{script_hash}/utxos.yaml New OpenAPI path definition for listing reference-script-holding UTXOs.
src/generated-types.ts Regenerated TS types including the new path and schema.
src/definitions.yaml Registered the new path and bumped version.
package.json Package version bump to 0.1.90.
openapi.yaml Regenerated OpenAPI YAML bundle including new path/schema and version bump.
openapi.json Regenerated OpenAPI JSON bundle including new path/schema and version bump.
docs/blockfrost-openapi.yaml Regenerated docs bundle including new path/schema and version bump.
CHANGELOG.md Added release entry for 0.1.90 documenting the new endpoint.
blockfrost-openapi.yaml Regenerated bundled spec including new path/schema and version bump.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/schemas/scripts/script_utxos.yaml
…h}/utxos

The endpoint only returns UTXOs that hold the queried script as a
reference script, so the field always equals the queried hash and
cannot be null. It is also already in the required list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

@slowbackspace slowbackspace merged commit e9f3d66 into master Jun 23, 2026
7 checks passed
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.

2 participants