Skip to content

Commit

Permalink
Merge pull request #405 from alephium/add-nft-schema-example
Browse files Browse the repository at this point in the history
Add NFT and NFT Collection Schema Example
  • Loading branch information
polarker authored Jul 7, 2024
2 parents 0b2717b + 294e7bf commit 6b39ee2
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 4 deletions.
21 changes: 20 additions & 1 deletion docs/dapps/standards/non-fungible-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,30 @@ Interface INFT {
// },
// "description": {
// "type": "string",
// "description": "General description of the NFT"
// "description": "General description of the NFT",
// "nullable": true
// },
// "image": {
// "type": "string",
// "description": "A URI to the image that represents the NFT"
// },
// "attributes": {
// "type": "array",
// "description": "An array of attributes for the NFT",
// "items": {
// "type": "object",
// "properties": {
// "trait_type": {
// "type": "string",
// "description": "The type of trait"
// },
// "value": {
// "type": ["string", "number", "boolean"],
// "description": "The value of the trait"
// }
// }
// },
// "nullable": true
// }
// }
// }
Expand Down
59 changes: 56 additions & 3 deletions docs/dapps/tutorials/first-nft.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Contract AwesomeNFT(
The NFT metadata pointed to by the token URI should return a json file
with the following schema:

```json
```typescript
{
"title": "NFT Metadata",
"type": "object",
Expand All @@ -70,15 +70,58 @@ with the following schema:
},
"description": {
"type": "string",
"description": "General description of the NFT"
"description": "General description of the NFT",
"nullable": true
},
"image": {
"type": "string",
"description": "A URI to the image that represents the NFT"
},
"attributes": {
"type": "array",
"description": "An array of attributes for the NFT",
"items": {
"type": "object",
"properties": {
"trait_type": {
"type": "string",
"description": "The type of trait"
},
"value": {
"type": ["string", "number", "boolean"],
"description": "The value of the trait"
}
}
},
"nullable": true
}
}
}
```

Here is a concrete example of the NFT metadata:

```typescript
{
"name": "#0001",
"image": "https://ipfs.io/ipfs/QmaEdvjx5gRBU3m6jxJT4DDc4DDZsbcKLqgS6rmeqHH9pq/0002.png",
"attributes": [
{
"trait_type": "Background",
"value": "Aged leather"
},
{
"trait_type": "Intricate Processes",
"value": "deep texture"
},
{
"trait_type": "Behavioral Patterns",
"value": "worn patina"
}
]
}
```

That is all for creating a NFT contract!

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

```json
```typescript
{
"title": "NFT Collection Metadata",
"type": "object",
Expand All @@ -183,6 +226,16 @@ return a json file with the following schema:
}
```

Here is a concrete example of the NFT collection metadata:

```typescript
{
"name": "ALEPHIUM EVERYWHERE",
"description": "ALPH is everywhere,\nWill you know how to find its trace?\nIn your heart, it’s there.",
"image": "https://alephium-nft.infura-ipfs.io/ipfs/Qmb8kEPPW4E17nzyZ691bgQAMbMEgRcNZxuH3wXgByfzvt"
}
```

The `mint` function is responsible for minting an NFT in this
collection. It takes the metadata URI for the new NFT as parameter and
creates a
Expand Down

0 comments on commit 6b39ee2

Please sign in to comment.