Hello, everybody.
I am trying to build the cip68 metadata using lucid.
{
"constructor": 0,
"fields": [
{
"map": [
{
"k": {
"bytes": "6E616D65"
},
"v": {
"bytes": "5370616365427564"
}
},
{
"k": {
"bytes": "696D616765"
},
"v": {
"bytes": "697066733A2F2F74657374"
}
}
]
},
{
"int": 1
}
]
}
To build the metadata like the example above, should we use Data.Map or Data.List?
I am not sure.
Hello there,
I have gone through your post and in my opinion this is how you might create a CIP68 metadata datum using Lucid
// Import necessary libraries
import cip68
// Define metadata structure
metadata = {
“title”: “Example Metadata”,
“author”: “John Doe”,
“date”: “2024-03-04”,
“description”: “This is an example of CIP68 metadata datum”,
// Add more fields as needed
}
// Instantiate metadata object
metadataObject = cip68.Metadata(metadata)
// Serialize metadata
serializedMetadata = metadataObject.serialize()
// Store or transmit metadata
print(serializedMetadata) // For example, you might print it to the console
Also this is a basic code and might need adjustments based on the specifics of your project and the requirements of CIP68.
I hope this will work for you.
Thanks for your reply.
I found this answer actually.
Normal Javascript Map will work for Map-like Datum.
Don’t need to use Lucid Data’s Map type.