hirosystems / ordinals-api

Bitcoin Ordinals API
Apache License 2.0
201 stars 63 forks source link

[BRC-20] Add register-event or brc20-valid event with ticker to /inscription/:iid endpoint #123

Open janniks opened 1 year ago

janniks commented 1 year ago

As an API user I would like to get BRC-20 information from an inscription I'm currently viewing.

e.g. I found inscription A via an explorer, I would like to know


Add metadata to the response. (Maybe similar to a "isRecursive" tag?)

chresko commented 1 year ago

Are we able to start with the first bullet i.e. 'isBRC-20' and also display in the Explorer? We could test if people find this first, high-level information valuable.

janniks commented 1 year ago

Thinking this could become a nested .metadata field or similar. Thinking out loud below, nothing final

{
  ...inscription,
  "protocol": "brc-20",
  // ^-- maybe as single `protocol` field, providing the same information as a bunch of `isProtocol` booleans
  "meta": {
    "is_recursive": false,
    "is_brc20": true,
    "brc20_ingest_error": "Unexpected comma at character 14:36"
    // ^-- how could we best add more less structured data that might be helpful?

   "protocol_error": "`.p` is wizord, but JSON missing `.x` field",
    // ^-- single error field if content type is json-ish (text/plain or application/json) with .p or .protocol matching the available protocols of the API ingester
  }
}
janniks commented 1 year ago

@rafaelcr what are your thoughts on this? I think keeping logs/reasons is too complicated for now. (although it would make debugging easier as well, e.g. keeping the reason for a failed transfer like not enough sender balance or malformed amount, whatever)

But it would be interesting to get a a "protocol": "brc-20" or isBrc20: true on a single inscription response. I think we could join from the fetched inscription to a brc20_event via location

rafaelcr commented 1 year ago

I think we could join from the fetched inscription to a brc20_event via location

Definitely @janniks , I think this is also easy to do... Are you up for it? 😃

janniks commented 1 year ago

Maybe also add an additional endpoint/filter to get activity by inscriptionId. 🤔 Mainly thinking from an explorer perspective. → If the inscription isBrc20, then fetch the events data, to nicely display balance+-, from, to, etc.