feat: add /scripts/{script_hash}/utxos endpoint#460
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
968641f to
77a6221
Compare
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>
77a6221 to
34f05b2
Compare
Contributor
There was a problem hiding this comment.
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}/utxospath with standard pagination params (count,page,order). - Introduced a new
script_utxosresponse schema (mirroring address UTXO responses but without deprecatedtx_index). - Bumped version
0.1.89 → 0.1.90and 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.
…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>
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
Adds a new paged endpoint
GET /scripts/{script_hash}/utxosthat 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_indexof 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}/utxosso clients can reuse existing UTXO parsing, but omits the deprecatedtx_indexfield — consistent with the newertx_content_utxoschema, which only exposesoutput_index.Changes
src/schemas/scripts/script_utxos.yaml— new response schemasrc/paths/api/scripts/{script_hash}/utxos.yaml— new pathsrc/definitions.yaml0.1.89 → 0.1.90Notes
🤖 Generated with Claude Code