Reorganize files, set up testings
This commit is contained in:
12
schema/json/Makefile
Normal file
12
schema/json/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
all: build
|
||||
|
||||
build:
|
||||
python bundle.py
|
||||
|
||||
|
||||
test: build
|
||||
check-jsonschema --schemafile dist/cic.json test_valid.json
|
||||
|
||||
|
||||
install: build
|
||||
cp -v dist/cic.json ../../python/cic_schema/data/
|
||||
43
schema/json/bundle.py
Normal file
43
schema/json/bundle.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# standard imports
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
fp = os.path.join('.', 'cic.in.json')
|
||||
f = open(fp, 'r')
|
||||
o = json.load(f)
|
||||
|
||||
fp = os.path.join('.', 'mime.in.json')
|
||||
f = open(fp, 'r')
|
||||
o_mime = json.load(f)
|
||||
o['mime'] = o_mime
|
||||
|
||||
|
||||
fp = os.path.join('.', 'opensea_part.in.json')
|
||||
f = open(fp, 'r')
|
||||
o_opensea = json.load(f)
|
||||
for k in o_opensea['properties'].keys():
|
||||
p = {}
|
||||
for v in o_opensea['properties'][k]:
|
||||
p[v] = o_opensea['properties'][k][v]
|
||||
o['properties'][k] = p
|
||||
o['required'] += o_opensea['required']
|
||||
o['oneOf'] = o_opensea['oneOf']
|
||||
|
||||
|
||||
fp = os.path.join('.', 'nft.in.json')
|
||||
f = open(fp, 'r')
|
||||
o_nft = json.load(f)
|
||||
for k in o_nft['properties'].keys():
|
||||
p = {}
|
||||
for v in o_nft['properties'][k]:
|
||||
p[v] = o_nft['properties'][k][v]
|
||||
o['properties'][k] = p
|
||||
|
||||
|
||||
os.makedirs('dist', exist_ok=True)
|
||||
|
||||
fp = os.path.join('dist', 'cic.json')
|
||||
f = open(fp, 'w')
|
||||
json.dump(o, f)
|
||||
f.close()
|
||||
27
schema/json/cic.in.json
Normal file
27
schema/json/cic.in.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "CIC core metadata container",
|
||||
"$id": "/cic/core",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"attachments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "/mime"
|
||||
}
|
||||
},
|
||||
"certifications": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
},
|
||||
"required": ["version", "attachments"]
|
||||
}
|
||||
38
schema/json/mime.in.json
Normal file
38
schema/json/mime.in.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "/mime",
|
||||
"title": "A single generic attachment for documenting any asset",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contentType": {
|
||||
"type": "string",
|
||||
"$comment": "valid mime type"
|
||||
},
|
||||
"contentTransferEncoding": {
|
||||
"type": "string",
|
||||
"enum": ["BASE64", "QUOTED-PRINTABLE", "8BIT", "7BIT"]
|
||||
},
|
||||
"subject": {
|
||||
"type": "string",
|
||||
"$comment": "utf-8"
|
||||
},
|
||||
"body": {
|
||||
"type": "string",
|
||||
"$comment": "uri including dataurl"
|
||||
},
|
||||
"ref": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"required": ["contentType", "subject"],
|
||||
"oneOf": [
|
||||
{
|
||||
"required": ["body"]
|
||||
},
|
||||
{
|
||||
"required": ["ref"]
|
||||
}
|
||||
]
|
||||
}
|
||||
23
schema/json/nft.in.json
Normal file
23
schema/json/nft.in.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "/erc721",
|
||||
"title": "Asset Metadata",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Identifies the asset to which this NFT represents"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Describes the asset to which this NFT represents"
|
||||
},
|
||||
"image": {
|
||||
"type": "string",
|
||||
"description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.",
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"required": ["name", "description"]
|
||||
}
|
||||
66
schema/json/opensea_part.in.json
Normal file
66
schema/json/opensea_part.in.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "/opensea",
|
||||
"title": "Partial implementation of the OpenSea token metadata standard",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"image_data": {
|
||||
"type": "string",
|
||||
"description": "Raw SVG image data, if you want to generate images on the fly (not recommended). Only use this if you're not including the image parameter.",
|
||||
"contentEncoding": "base64",
|
||||
"contentMediaType": "image/svg+xml"
|
||||
},
|
||||
"image": {
|
||||
"type": "string",
|
||||
"description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.",
|
||||
"format": "uri"
|
||||
},
|
||||
"external_url": {
|
||||
"type": "string",
|
||||
"description": "This is the URL that will appear below the asset's image on OpenSea and will allow users to leave OpenSea and view the item on your site.",
|
||||
"format": "uri"
|
||||
},
|
||||
"attributes": {
|
||||
"type": "array",
|
||||
"description": "These are the attributes for the item, which will show up on the OpenSea page for the item. (see below)",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"trait_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
},
|
||||
"display_type": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["trait_type", "value"]
|
||||
}
|
||||
|
||||
},
|
||||
"animation_url": {
|
||||
"type": "string",
|
||||
"description": "Animation_url also supports HTML pages, allowing you to build rich experiences and interactive NFTs using JavaScript canvas, WebGL, and more. Scripts and relative paths within the HTML page are now supported. However, access to browser extensions is not supported.",
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"required": ["attributes"],
|
||||
"oneOf": [
|
||||
{
|
||||
"required": ["image"]
|
||||
},
|
||||
{
|
||||
"required": ["image_data"]
|
||||
}
|
||||
]
|
||||
}
|
||||
5
schema/rdf/Makefile
Normal file
5
schema/rdf/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
all: install
|
||||
|
||||
install:
|
||||
cp -v evm.rdfs ../../python/cic_schema/data/
|
||||
|
||||
14
schema/rdf/evm.rdfs
Normal file
14
schema/rdf/evm.rdfs
Normal file
@@ -0,0 +1,14 @@
|
||||
@base <https://defalsify.org/rdf-eth/0.1/evm.rdfs> .
|
||||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||
@prefix rdfs: <https://www.w3.org/TR/rdf-schema/#> .
|
||||
|
||||
<#location> a rdfs:Class .
|
||||
<#tx> a rdfs:Class .
|
||||
<#account> rdfs:subClassOf <#location> .
|
||||
<#contract> rdfs:subClassOf <#location> .
|
||||
<#voucherContract> rdfs:subClassOf <#contract> .
|
||||
<#nftContract> rdfs:subClassOf <#contract> .
|
||||
<#gasTransfer> rdfs:subClassOf <#tx> .
|
||||
<#voucherTransfer> rdfs:subClassOf <#tx> .
|
||||
<#nftTransfer> rdfs:subClassOf <#tx> .
|
||||
<#id> rdfs:Datatype xsd:hexBinary .
|
||||
Reference in New Issue
Block a user