Skip to content

Commit 6b39ee2

Browse files
authoredJul 7, 2024··
Merge pull request #405 from alephium/add-nft-schema-example
Add NFT and NFT Collection Schema Example
2 parents 0b2717b + 294e7bf commit 6b39ee2

File tree

2 files changed

+76
-4
lines changed

2 files changed

+76
-4
lines changed
 

‎docs/dapps/standards/non-fungible-tokens.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,30 @@ Interface INFT {
3636
// },
3737
// "description": {
3838
// "type": "string",
39-
// "description": "General description of the NFT"
39+
// "description": "General description of the NFT",
40+
// "nullable": true
4041
// },
4142
// "image": {
4243
// "type": "string",
4344
// "description": "A URI to the image that represents the NFT"
45+
// },
46+
// "attributes": {
47+
// "type": "array",
48+
// "description": "An array of attributes for the NFT",
49+
// "items": {
50+
// "type": "object",
51+
// "properties": {
52+
// "trait_type": {
53+
// "type": "string",
54+
// "description": "The type of trait"
55+
// },
56+
// "value": {
57+
// "type": ["string", "number", "boolean"],
58+
// "description": "The value of the trait"
59+
// }
60+
// }
61+
// },
62+
// "nullable": true
4463
// }
4564
// }
4665
// }

‎docs/dapps/tutorials/first-nft.md

+56-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Contract AwesomeNFT(
5959
The NFT metadata pointed to by the token URI should return a json file
6060
with the following schema:
6161

62-
```json
62+
```typescript
6363
{
6464
"title": "NFT Metadata",
6565
"type": "object",
@@ -70,15 +70,58 @@ with the following schema:
7070
},
7171
"description": {
7272
"type": "string",
73-
"description": "General description of the NFT"
73+
"description": "General description of the NFT",
74+
"nullable": true
7475
},
7576
"image": {
7677
"type": "string",
7778
"description": "A URI to the image that represents the NFT"
79+
},
80+
"attributes": {
81+
"type": "array",
82+
"description": "An array of attributes for the NFT",
83+
"items": {
84+
"type": "object",
85+
"properties": {
86+
"trait_type": {
87+
"type": "string",
88+
"description": "The type of trait"
89+
},
90+
"value": {
91+
"type": ["string", "number", "boolean"],
92+
"description": "The value of the trait"
93+
}
94+
}
95+
},
96+
"nullable": true
7897
}
7998
}
8099
}
81100
```
101+
102+
Here is a concrete example of the NFT metadata:
103+
104+
```typescript
105+
{
106+
"name": "#0001",
107+
"image": "https://ipfs.io/ipfs/QmaEdvjx5gRBU3m6jxJT4DDc4DDZsbcKLqgS6rmeqHH9pq/0002.png",
108+
"attributes": [
109+
{
110+
"trait_type": "Background",
111+
"value": "Aged leather"
112+
},
113+
{
114+
"trait_type": "Intricate Processes",
115+
"value": "deep texture"
116+
},
117+
{
118+
"trait_type": "Behavioral Patterns",
119+
"value": "worn patina"
120+
}
121+
]
122+
}
123+
```
124+
82125
That is all for creating a NFT contract!
83126

84127
## Create NFT collection contract
@@ -162,7 +205,7 @@ The `INFTCollection` interface defines four methods:
162205
The metadata of the NFT collection pointed to by collection URI should
163206
return a json file with the following schema:
164207

165-
```json
208+
```typescript
166209
{
167210
"title": "NFT Collection Metadata",
168211
"type": "object",
@@ -183,6 +226,16 @@ return a json file with the following schema:
183226
}
184227
```
185228

229+
Here is a concrete example of the NFT collection metadata:
230+
231+
```typescript
232+
{
233+
"name": "ALEPHIUM EVERYWHERE",
234+
"description": "ALPH is everywhere,\nWill you know how to find its trace?\nIn your heart, it’s there.",
235+
"image": "https://alephium-nft.infura-ipfs.io/ipfs/Qmb8kEPPW4E17nzyZ691bgQAMbMEgRcNZxuH3wXgByfzvt"
236+
}
237+
```
238+
186239
The `mint` function is responsible for minting an NFT in this
187240
collection. It takes the metadata URI for the new NFT as parameter and
188241
creates a

0 commit comments

Comments
 (0)
Please sign in to comment.