blockfrost / openapi

OpenAPI specification for Blockfrost.io service
https://docs.blockfrost.io
MIT License
22 stars 18 forks source link

Support HexString metadata (not including '0x') #321

Closed leo42 closed 1 year ago

leo42 commented 1 year ago

I have added fallback for finding metadata of V2 without prepending the "0x", for my project it is impossible to add it as a string as I utilize the Tx-ID as the token name and so I am at the limit for the size.

I have also seen other projects follow this standard (as hex encoded strings) and it works with several explorers and koios.

Please consider merging this change.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
openapi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2023 10:31pm
slowbackspace commented 1 year ago

@leo42 I think that the whole point of CIP25v2 is that policy and asset name should be stored as bytes, not utf8 encoded strings. This change should not affect the length. We are prepending 0x just to find the correct data in dbsync since this is how it represents bytes.

In other words, even if you would prepend 0x it won’t work. The point is you need policy and asset name in CBOR as bytes not text/string.

If you don’t want to follow this just stick with CIP25v1.

Just a side note, the fallback you you found is implemented due to old bug we had in the code and prevented breaking change. I don’t think it’s a good idea to change or expand it.

leo42 commented 1 year ago

I left the old fallback and just added a second one before it, so it should not break anything :)

I cannot use V1 since the name of my tokens is nonsensical and cannot be properly interpreted by most indexers. Example 1a9fed5591aed8fcc3217af6f96769b092bdccbe11700e023e4599bea0cfa0a7 -> " ŸíU‘®ØüÃ!zöùgi°’½Ì¾ p >E™¾ Ï §"

Javascript limitations make what you are asking pretty hard(not impossible,maybe it's easier if you have a reference implementation?), I am just trying to encode the raw name of the token in the metadata(as I understand the intention was for the V2 standard)

Like I mentioned koios and cexplorer already recognize this "interpretation" of CIP25v2 and are able to process and serve the metadata so It would not be going against the ecosystem standards.

On Thu, Sep 14, 2023 at 2:20 PM Maroš @.***> wrote:

@leo42 https://github.com/leo42 I think that the whole point of CIP25v2 is that policy and asset name should be stored as bytes, not utf8 encoded strings. This change should not affect the length.

If you don’t wan to follow this just stick with CIP25v1.

Just a side note, the fallback you you found is implemented due to old bug we had in the code and prevented breaking change. I don’t think it’s a good idea to change it.

— Reply to this email directly, view it on GitHub https://github.com/blockfrost/openapi/pull/321#issuecomment-1719342960, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBLGXLKTJQW4OQ6G6J3XWTX2LZAPANCNFSM6AAAAAA4XFIANI . You are receiving this because you were mentioned.Message ID: @.***>

leo42 commented 1 year ago

I just managed to mint using Byte encoded names.

This works and the metadata finally appears in Blockfost/Nami but it is not accepted by Koios where not I get broken links from them....

leo42 commented 1 year ago

cexplorer also breaks when using this standart

slowbackspace commented 1 year ago

Could you post a link your asset with new metadata? If they are correct you should probably open issue with these other services since you are now following the standard and they don’t.

leo42 commented 1 year ago

https://preprod.cardanoscan.io/transaction/656c3c0a8b9e565a9d269e1fdec7d736c99d0e057f2adfec6fbb13699d397eb1

Koios Query returns no metadata.

https://preprod.koios.rest/api/v0/asset_info?_asset_policy=64b87bcae32aed7e122db37e202b014d55bbe739e0cdef4b317695b4&_asset_name=6b929fe1489c1089df35173802d81ea921da200eca862083e663151e872057e2

and cexplorer undestands only the medatadata of the hex strings (last 2 are the ones using bytes) https://preprod.cexplorer.io/policy/64b87bcae32aed7e122db37e202b014d55bbe739e0cdef4b317695b4