Update traits.json structure
Closed this issue · 5 comments
As discussed a while ago, Here's a few example on the update of "traits.json" structure,
v1.0.0 "traits.json" with thumbnail, animation and 3 layers (I removed the background already on this structure)
{
"collection_name": "Lazy Loop Cat",
"collection_lower": "lazyloopcat",
"description": "Lazy Loop Cat description",
"artist_name": "lazyloopcat.loopring.eth",
"thumbnails": true,
"animation": true,
"animation_format": ".gif",
"royalty_percentage": 10,
"royalty_address": "0x0000000000000000000000000000000dead",
"seed": "cats",
"image_layers": [
{
"layer_name": "Head",
"variations": 1,
"filenames": {
"Diamond": "head_diamond.png"
},
"weights": [
1
]
},
{
"layer_name": "Torso",
"variations": 1,
"filenames": {
"Diamond": "torso_diamond.json"
},
"weights": [
2
]
},
{
"layer_name": "Feet",
"variations": 1,
"filenames": {
"Diamond": "feet_diamond.json"
},
"weights": [
3
]
}
],
"thumbnail_size": [
200,
200
]
}
V2.0.0 "traits.json" that corresponds to the one above
{
"collection": {
"name": "Lazy Loop Cat",
"lower": "lazy_loop_cat",
"description": "Lazy Loop Cat Description",
"artists": [
"lazyloopcat.loopring.eth"
],
"royalty": {
"address": "0x00000000000000000000000000000000d3ad",
"percentage": 5
},
"options": {
"seed": "cats",
"thumbnails": {
"width": 200,
"height": 200
},
"animation": {
"format": ".gif"
}
},
"layers": {
"Head": [
{
"name": "Diamond",
"filename": "head_diamond.png",
"weight": 1
}
],
"Torso": [
{
"name": "Diamond",
"filename": "torso_diamond.png",
"weight": 2
}
],
"Feet": [
{
"name": "Diamond",
"filename": "feet_diamond.png",
"weight": 3
}
]
}
}
}
If the v1.0.0 traits.json doesn't have an animation or thumbnail the v2 will just remove it in the "options" properties
{
"collection": {
"name": "Lazy Loop Cat",
"lower": "lazy_loop_cat",
"description": "Lazy Loop Cat Description",
"artists": [
"lazyloopcat.loopring.eth"
],
"royalty": {
"address": "0x00000000000000000000000000000000d3ad",
"percentage": 5
},
"options": {
"seed": "cats"
},
"layers": {
"Head": [
{
"name": "Diamond",
"filename": "head_diamond.png",
"weight": 1
}
],
"Torso": [
{
"name": "Diamond",
"filename": "torso_diamond.png",
"weight": 2
}
],
"Feet": [
{
"name": "Diamond",
"filename": "feet_diamond.png",
"weight": 3
}
]
}
}
}
If the v1.0.0 "traits.json" have more than 1 variants on their layers
{
"collection": {
"name": "Lazy Loop Cat",
"lower": "lazy_loop_cat",
"description": "Lazy Loop Cat Description",
"artists": [
"lazyloopcat.loopring.eth"
],
"royalty": {
"address": "0x00000000000000000000000000000000d3ad",
"percentage": 5
},
"options": {
"seed": "cats"
},
"layers": {
"Head": [
{
"name": "Diamond",
"filename": "head_diamond.png",
"weight": 1
},
{
"name": "Gold",
"filename": "head_gold.png",
"weight": 2
},
{
"name": "Bronze",
"filename": "head_bronze.png",
"weight": 3
}
],
"Torso": [
{
"name": "Diamond",
"filename": "torso_diamond.png",
"weight": 2
}
],
"Feet": [
{
"name": "Diamond",
"filename": "feet_diamond.png",
"weight": 3
}
]
}
}
}
- What happens to
royalty.address
field if Royalty Address is not provided? - What happens to
artists
field if Artist Name is not provided?
Development of the traits.json
converters is in the dev/traits-converter
branch
traits JSON converters merged into dev/react-ui
branch with commit 2a1e136
# Convert to latest traits JSON version (currently v2.0.0)
./docker.sh python3 generator/json-convert.py --file traits_v1.0.0.json --output other/folder/traits.json
# Convert to specific version (e.g. v1.0.0)
./docker.sh python3 generator/json-convert.py --file traits_v2.0.0.json --version 1.0.0 --output other/folder/traits.json
# Convert in place (input file will be replaced)
./docker.sh python3 generator/json-convert.py --file traits_v1.0.0.json
generate.py
and other files using load_traits()
from generator/utils.py
now convert to v1.0.0 traits json and should work with the new v2.0.0 traits.json format
@you3h
The React UI needs to populate the "version": "v2.0.0" field in the root JSON dictionary
Created issue you3h/LooPyGen_Client#21 for tracking
Closing