Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"key-did-resolver": "^1.4.0",
"prettier": "^2.4.0",
"ts-jest": "^27.0.5",
"typescript": "^4.4.3"
"typescript": "^4.4.3",
"near-api-js":"^0.43.1"
},
"jest": {
"preset": "ts-jest"
Expand Down
3 changes: 3 additions & 0 deletions packages/nft-metadata-standard/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['3box', '3box/typescript'],
}
27 changes: 27 additions & 0 deletions packages/nft-metadata-standard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# NFT metadata standard DataModel

DataModel implementation of the **NFT metadata standard** schema and definition specified in [CIP-19](https://github.com/ceramicnetwork/CIP/blob/main/CIPs/CIP-19/CIP-19.md).

## Installation

```sh
npm install -D @datamodels/nft-metadata-standard
```

## Rationale

The ** NFT metadata standard ** contains a DID's basic profile information.

By standardizing profile information for DIDs, th NFT metadata standard simplifies how applications can view and display the profiles of their users.

**NFT metadata standard**: basica schame for nft metadata using the [opensa sea standards](https://docs.opensea.io/docs/metadata-standards)

**DID-agnostic support:** Since Ceramic documents can be created and controlled by any DID, the NFT metadata standard can be used in conjunction with any DID method.

## Schemas

### [BasicProfile](./schemas/nftMetadata.json)

## License

Dual licensed under MIT and Apache 2
41 changes: 41 additions & 0 deletions packages/nft-metadata-standard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@datamodels/nft-metadata-standard",
"version": "0.1.0",
"author": "Lucas espinosa",
"license": "(Apache-2.0 OR MIT)",
"homepage": "https://github.com/ceramicstudio/datamodels#readme",
"keywords": [
"datamodel"
],
"repository": {
"type": "git",
"url": "https://github.com/ceramicstudio/datamodels",
"directory": "packages/nft-metadata-standard"
},
"main": "dist/model.cjs",
"module": "dist/model.mjs",
"typings": "dist/model.d.ts",
"exports": {
"import": "./dist/model.mjs",
"require": "./dist/model.cjs",
"default": "./dist/model.cjs"
},
"files": [
"dist",
"schemas",
"types"
],
"engines": {
"node": ">=14"
},
"scripts": {
"types": "del types && json2ts -i schemas -o types",
"build": "del dist && tsc && swc src -o ./dist/model.mjs --config-file ../../swc.esm.json && swc src -o ./dist/model.cjs --config-file ../../swc.cjs.json",
"lint": "eslint --fix",
"prepare": "yarn build",
"prepublishOnly": "package-check"
},
"dependencies": {
"@glazed/types": "^0.1.3"
}
}
1 change: 1 addition & 0 deletions packages/nft-metadata-standard/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('eslint-config-3box/prettier.config')
68 changes: 68 additions & 0 deletions packages/nft-metadata-standard/schemas/nftMetadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"title": "nftMetadata",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "The name schema",
"description": "Name of the item."
},
"image": {
"type": "string",
"title": "The image schema",
"description": "This is the URL to the image of the item. Can be just about any type of image (including SVGs, which will be cached into PNGs by OpenSea), and can be IPFS URLs or paths. We recommend using a 350 x 350 image."
},
"image_data": {
"type": "string",
"title": "Raw SVG image data,",
"description": "aw 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."
},
"attributes": {
"type": "array",
"items": {
"type": "object",
"required": [
"trait_type",
"value"
],
"properties": {
"value": {
"type": ["number","string"]
},
"trait_type": {
"type": "string"
},
"display_type": {
"type": "string"
}
}
}
},
"description": {
"type": "string",
"title": "The description schema",
"description": "A human readable description of the item. Markdown is supported."
},
"external_url": {
"type": "string",
"title": "The external_url schema",
"description": "his is the URL to the image of the item. Can be just about any type of image (including SVGs, which will be cached into PNGs by OpenSea), and can be IPFS URLs or paths. We recommend using a 350 x 350 image."
},
"background_color": {
"type": "string",
"title": "background color",
"description": "Background color of the item on OpenSea. Must be a six-character hexadecimal without a pre-pended #."
},
"animation_url":{
"type": "string",
"title": "animation url",
"description": "A URL to a multi-media attachment for the item. The file extensions GLTF, GLB, WEBM, MP4, M4V, OGV, and OGG are supported, along with the audio-only extensions MP3, WAV, and OGA. 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."
},
"youtube_url": {
"type": "string",
"title": "YouTube video",
"description": "A URL to a YouTube video."
}
}
}
62 changes: 62 additions & 0 deletions packages/nft-metadata-standard/src/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import type { ModelTypeAliases, EncodedManagedModel } from '@glazed/types'

import type { NftMetadata } from '../types/nftMetadata'

export type ModelTypes = ModelTypeAliases<
{ nftMetadata: NftMetadata },
{ nftMetadata: 'nftMetadata' }
>

export const model: EncodedManagedModel = {
schemas: {
kjzl6cwe1jw149xvbio5fnai2whxmonm7rfu4yipopzjskeercnslyca42gg48j: {
alias: 'nftMetadata',
commits: [
{
jws: {
payload: 'AXESIFRATC8fB0VWXnBv2gQTBo4_oltNWnHlqD-ceWHHWRlT',
signatures: [
{
signature:
'ojNk94c50a938jr92sMHiFnT62LZppFdH5KYHfp4ttElr4RHJAqgQ7-4iegeHDgdp2a1AVG5DqQ9MJVUV1RuBg',
protected:
'eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa29lbllLejZNZ0pCVEhNUm1iQVpLSERMcW5ib0Z0WjdUM0hqN2IxUjF5SFc4I3o2TWtvZW5ZS3o2TWdKQlRITVJtYkFaS0hETHFuYm9GdFo3VDNIajdiMVIxeUhXOCJ9',
},
],
link: 'bafyreicuibgc6hyhivlf44dp3icbgbuoh6rfwtk2ohs2qp44pfq4owizkm',
},
linkedBlock:
'omRkYXRhpGR0eXBlZm9iamVjdGV0aXRsZWtuZnRNZXRhZGF0YWckc2NoZW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aW5nIEphdmFTY3JpcHQgY2FudmFzLCBXZWJHTCwgYW5kIG1vcmUuIFNjcmlwdHMgYW5kIHJlbGF0aXZlIHBhdGhzIHdpdGhpbiB0aGUgSFRNTCBwYWdlIGFyZSBub3cgc3VwcG9ydGVkLiBIb3dldmVyLCBhY2Nlc3MgdG8gYnJvd3NlciBleHRlbnNpb25zIGlzIG5vdCBzdXBwb3J0ZWQucGJhY2tncm91bmRfY29sb3KjZHR5cGVmc3RyaW5nZXRpdGxlcGJhY2tncm91bmQgY29sb3JrZGVzY3JpcHRpb254ZEJhY2tncm91bmQgY29sb3Igb2YgdGhlIGl0ZW0gb24gT3BlblNlYS4gTXVzdCBiZSBhIHNpeC1jaGFyYWN0ZXIgaGV4YWRlY2ltYWwgd2l0aG91dCBhIHByZS1wZW5kZWQgIy5maGVhZGVyomZ1bmlxdWVwSHlra09rQnVCOHFzQXhGS2tjb250cm9sbGVyc4F4OGRpZDprZXk6ejZNa29lbllLejZNZ0pCVEhNUm1iQVpLSERMcW5ib0Z0WjdUM0hqN2IxUjF5SFc4',
},
],
dependencies: {},
version: 'k3y52l7qbv1fryeoupwrqn9mokn3j5bbxz74mb9h2nsssr52gyi17g47bwxgym4n4',
},
},
definitions: {
kjzl6cwe1jw146hzzqr6xfcctyqlt0rp23mmpsijmqzba80vo7gkgs80xzbtc69: {
alias: 'nftMetadata',
commits: [
{
jws: {
payload: 'AXESIC2t3VxWL_G20F6fpZK72m3oROBzegLOrKs-329HOO2g',
signatures: [
{
signature:
'HMzbcGMl3HLNO5kW1EzfFcdybJaOd6aptpMaKA9W-dIb-d9V2T_9NpSjzjQlnDvChlfNAvDyRSRNbp5xcVeXBg',
protected:
'eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa29lbllLejZNZ0pCVEhNUm1iQVpLSERMcW5ib0Z0WjdUM0hqN2IxUjF5SFc4I3o2TWtvZW5ZS3o2TWdKQlRITVJtYkFaS0hETHFuYm9GdFo3VDNIajdiMVIxeUhXOCJ9',
},
],
link: 'bafyreibnvxovyvrp6g3naxu7uwjlxwtn5bcoa432alhkzkz635xuoohnua',
},
linkedBlock:
'omRkYXRho2RuYW1la25mdE1ldGFkYXRhZnNjaGVtYXhLY2VyYW1pYzovL2szeTUybDdxYnYxZnJ5ZW91cHdycW45bW9rbjNqNWJieHo3NG1iOWgybnNzc3I1Mmd5aTE3ZzQ3Ynd4Z3ltNG40a2Rlc2NyaXB0aW9ueCNTdGFuZGFyZCAgb3BlbiBzZWEgU2NoZW1hIGZvciBuZnRzLmZoZWFkZXKjZnNjaGVtYXhLY2VyYW1pYzovL2szeTUybDdxYnYxZnJ5MWZwNHMwbndkYXJoMHZhaHVzYXJwcG9zZ2V2eTBwZW1peWt5bWQyb3JkNnN3dGhhcmN3ZnVuaXF1ZXBkWlAxK0djSWRNV3I1L3p2a2NvbnRyb2xsZXJzgXg4ZGlkOmtleTp6Nk1rb2VuWUt6Nk1nSkJUSE1SbWJBWktIRExxbmJvRnRaN1QzSGo3YjFSMXlIVzg=',
},
],
schema: 'kjzl6cwe1jw149xvbio5fnai2whxmonm7rfu4yipopzjskeercnslyca42gg48j',
version: 'k3y52l7qbv1frxq7zy69d9p3v93172dgy6xsxjervlrv48p29851tjcp2pn80mkg0',
},
},
tiles: {},
}
7 changes: 7 additions & 0 deletions packages/nft-metadata-standard/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["src"]
}
57 changes: 57 additions & 0 deletions packages/nft-metadata-standard/types/nftMetadata.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* tslint:disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/

/**
* Name of the item.
*/
export type TheNameSchema = string
/**
* This is the URL to the image of the item. Can be just about any type of image (including SVGs, which will be cached into PNGs by OpenSea), and can be IPFS URLs or paths. We recommend using a 350 x 350 image.
*/
export type TheImageSchema = string
/**
* aw 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.
*/
export type RawSVGImageData = string
/**
* A human readable description of the item. Markdown is supported.
*/
export type TheDescriptionSchema = string
/**
* his is the URL to the image of the item. Can be just about any type of image (including SVGs, which will be cached into PNGs by OpenSea), and can be IPFS URLs or paths. We recommend using a 350 x 350 image.
*/
export type TheExternalUrlSchema = string
/**
* Background color of the item on OpenSea. Must be a six-character hexadecimal without a pre-pended #.
*/
export type BackgroundColor = string
/**
* A URL to a multi-media attachment for the item. The file extensions GLTF, GLB, WEBM, MP4, M4V, OGV, and OGG are supported, along with the audio-only extensions MP3, WAV, and OGA. 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.
*/
export type AnimationUrl = string
/**
* A URL to a YouTube video.
*/
export type YouTubeVideo = string

export interface NftMetadata {
name?: TheNameSchema
image?: TheImageSchema
image_data?: RawSVGImageData
attributes?: Array<{
value: number | string
trait_type: string
display_type?: string
[k: string]: unknown
}>
description?: TheDescriptionSchema
external_url?: TheExternalUrlSchema
background_color?: BackgroundColor
animation_url?: AnimationUrl
youtube_url?: YouTubeVideo
[k: string]: unknown
}
3 changes: 3 additions & 0 deletions packages/token-list/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['3box', '3box/typescript'],
}
27 changes: 27 additions & 0 deletions packages/token-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Token List DataModel

DataModel implementation of token list

## Installation

```sh
npm install -D @datamodels/token-list
```

## Rationale

DataModel implementation of token list

By standardizing tokenlist information for DIDs, the Token List simplifies how applications can view and display the profiles of their users.

Token Lists is a community-led initiative to improve discoverability, reputation and trust in ERC20 token lists in a manner that is inclusive, transparent, and decentralized.

**DID-agnostic support:** Since Ceramic documents can be created and controlled by any DID, the Token List can be used in conjunction with any DID method.

## Schemas

### [tokenList](./schemas/tokenList.json)

## License

Dual licensed under MIT and Apache 2
41 changes: 41 additions & 0 deletions packages/token-list/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@datamodels/token-list",
"version": "0.1.0",
"author": "Lucas espinosa",
"license": "(Apache-2.0 OR MIT)",
"homepage": "https://github.com/ceramicstudio/datamodels#readme",
"keywords": [
"datamodel"
],
"repository": {
"type": "git",
"url": "https://github.com/ceramicstudio/datamodels",
"directory": "packages/token-list"
},
"main": "dist/model.cjs",
"module": "dist/model.mjs",
"typings": "dist/model.d.ts",
"exports": {
"import": "./dist/model.mjs",
"require": "./dist/model.cjs",
"default": "./dist/model.cjs"
},
"files": [
"dist",
"schemas",
"types"
],
"engines": {
"node": ">=14"
},
"scripts": {
"types": "del types && json2ts -i schemas -o types",
"build": "del dist && tsc && swc src -o ./dist/model.mjs --config-file ../../swc.esm.json && swc src -o ./dist/model.cjs --config-file ../../swc.cjs.json",
"lint": "eslint --fix",
"prepare": "yarn build",
"prepublishOnly": "package-check"
},
"dependencies": {
"@glazed/types": "^0.1.3"
}
}
1 change: 1 addition & 0 deletions packages/token-list/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('eslint-config-3box/prettier.config')
Loading