feat: add /scripts/{script_hash}/utxos endpoint#460
Open
slowbackspace wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
968641f to
77a6221
Compare
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