hirosystems / ordhook

Build indexers, standards and protocols on top of Ordinals and Inscriptions (BRC20, etc).
Apache License 2.0
190 stars 56 forks source link

How to infer inscription id from transfer event? #270

Closed wagmiwiz closed 8 months ago

wagmiwiz commented 8 months ago

I have a use case where I have known inscriptions (with id, or number) that I would like to track ownership transfers of. It seems that the transfer event only has "ordinal_number". Would it be possible to have inscription id too?

I understand I could do full indexing and try and maintain the link between inscription id and ordinal_number base on inscription_revealed event, but this seems like an overkill.

 "inscription_transferred": {
                  "destination": {
                    "type": "transferred",
                    "value": "bc1q8h67dytup75uurg9jpj32mtudrauraf2fd7lnp"
                  },
                  "ordinal_number": 966238748493125,
                  "post_transfer_output_value": 19430325945,
                  "satpoint_post_transfer": "461b0d8cfea306734a36394edce052194a78b1dc55ab98ab41de17c763bd154b:0:2291455881",
                  "satpoint_pre_transfer": "399f1bd0adb1ba6a3f40c41a8bc9b7b12722d3913741ccb7b2ecad4aae6227d2:0:2291455881",
                  "tx_index": 25
                }
lgalabru commented 8 months ago

Hi @wagmiwiz! If your observer is running on the same machine than ordhook, you could query the inscriptions table present in the hord.sqlite database.

SELECT inscription_id FROM inscriptions WHERE ordinal_number = ?
wagmiwiz commented 8 months ago

Good tip, will move observer to same machine.