Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sat at index content endpoint (/r/sat/:sat_number/at/:index/content) #4113

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

astralarkitekt
Copy link

Add recursive endpoint for sat inscription content

This PR adds a new recursive endpoint /r/sat/<SAT_NUMBER>/at/<INDEX>/content that returns the raw content of inscriptions on a specific sat at a given index. This endpoint complements the existing /r/sat/<SAT_NUMBER>/at/<INDEX> endpoint by directly returning the inscription content instead of just the inscription ID.

Features

  • New endpoint /r/sat/<SAT_NUMBER>/at/<INDEX>/content
  • Supports negative indices (e.g., -1 for most recent inscription)
  • Returns appropriate mime-type and content
  • Requires --index-sats flag like other sat-based endpoints

Documentation

  • Added detailed documentation in docs/src/inscriptions/recursion.md
  • Includes example usage with curl
  • Follows existing recursive endpoint documentation format

Testing

  • Endpoint follows the same pattern as existing recursive endpoints
  • Returns proper content-type headers and raw inscription content
  • Handles negative indices correctly

Example Usage

curl -s -H "Accept: application/json" \
http://0.0.0.0:80/r/sat/289488340427831/at/-1/content

Use cases

This endpoint is particularly valuable for dynamic on-chain content that evolves over time through reinscriptions. For example:

  • On-chain blogs can automatically display their latest posts
  • Dynamic NFTs can fetch their most recent state
  • Decentralized applications can efficiently access updated content
  • Content aggregators can streamline their data fetching
  • Games can add special events that auto-update the game

By providing direct access to the latest inscription content on a specific sat, this endpoint reduces the number of API calls needed (from 2 to 1) and simplifies the development of applications that leverage reinscription functionality. This makes it easier to build applications that treat sats as updateable storage locations while maintaining the decentralized nature of ordinal inscriptions.

@gmart7t2
Copy link
Contributor

gmart7t2 commented Nov 29, 2024

It looks like your endpoint doesn't handle content proxying or delegation.

Compare your function with the regular content() function:

Screenshot_20241129_075622_Presearch

Screenshot_20241129_075444_Presearch

Wouldn't it be better to look up the inscriptionid and pass it to the content() function rather than adding another function that handles content?

Edit: maybe content proxying isn't needed since we don't proxy the sat endpoint. But delegation is.

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