Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIP-33 Token and NFT Registry #72

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"yaml.schemas": {
"swaggerviewer:openapi": "file:///Users/merul/Desktop/Projects/tips/tips/TIP-0033/api-spec.yaml"
}
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ The following TIPs are currently being discussed and are awaiting further contri
| 24 | [Tangle Message](https://github.com/iotaledger/tips/pull/55) | A new version of TIP-6 that removes the Indexation Payload and instead adds the Tagged Data Payload as a supported payload | Standards | Core | Draft |
| 25 | [Core REST API](https://github.com/iotaledger/tips/pull/57) | Node Core REST API routes and objects in OpenAPI Specification | Standards | Interface | Draft |
| 26 | [UTXO Indexer REST API](https://github.com/iotaledger/tips/pull/62) | UTXO Indexer REST API routes and objects in OpenAPI Specification | Standards | Interface | Draft |
| 27 | [IOTA NFT standards](https://github.com/iotaledger/tips/pull/65) | Define NFT metadata standard, policy registry and creator royalties | Standards | IRC | Draft |
| 28 | [Node Event API](https://github.com/iotaledger/tips/pull/66) | Node event API definitions in AsyncAPI Specification | Standards | Interface | Draft |
| 29 | [Milestone Payload](https://github.com/iotaledger/tips/pull/69) | Milestone Payload with keys removed from essence | Standards | Core | Draft |
| 30 | [Native Token Metadata Standard](https://github.com/iotaledger/tips/pull/68) | A JSON schema that describes token metadata format for native token foundries. | Standards | IRC | Draft |

## Accepted TIPs (as of 2022-01-16)
## Accepted TIPs (as of 2022-03-31)

| # | Title | Description | Type | Layer | Status |
|-----|-----------------------------------------------------------|------------------------------------------------------------------------------------------------|-----------|-----------|----------|
Expand Down
295 changes: 295 additions & 0 deletions tips/TIP-0033/api-spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
openapi: 3.0.3
info:
title: IOTA Token and NFT Collections Registry
description: This document specifies the REST API for the Token and NFT Collections Registry
contact:
email: merul@kamilabs.io
license:
name: Apache 2.0
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
version: 1.0.0
servers:
- url: "http://127.0.0.1:5001"
tags:
- name: token
description: Everything about the token registry
- name: nft
description: Everything about the nft registry

paths:
/api/v1/tokens:
get:
parameters:
- in: query
name: symbol
schema:
type: string
required: false
description: symbol of the token to look for
- in: query
name: name
schema:
type: string
required: false
description: name of the token to search for
tags:
- token
summary: Returns all of the accepted tokens that match the query requirements
description: returns all of the accepted tokens that a are a part of the registry repository on github and match the query pattern. Return all when nothing is specified.
responses:
200:
description: "Successful Operation"
content:
application/json:
schema:
$ref: "#/components/schemas/TokenEntries"

400:
description: "Unsuccessful Operation. Bad request data"
content:
application/json:
schema:
$ref: "#/components/schemas/BadRequestResponse"

404:
description: "Unsuccessful Operation. No Tokens Found"
content:
application/json:
schema:
$ref: "#/components/schemas/NotFoundResponse"

500:
description: "Unsuccessful Operation. Internal Server Error"
content:
application/json:
schema:
$ref: "#/components/schemas/InternalErrorResponse"

/api/v1/tokens/{tokenId}:
get:
tags:
- token
summary: Get token which matches the tokenId
description: Get the token which matches the tokenId
parameters:
- in: path
name: tokenId
schema:
type: string
description: tokenId of the token to fetch data of
required: true
responses:
200:
description: "Successful Operation"
content:
application/json:
schema:
$ref: "#/components/schemas/TokenEntry"

400:
description: "Unsuccessful Operation. Bad request data"
content:
application/json:
schema:
$ref: "#/components/schemas/BadRequestResponse"

404:
description: "Unsuccessful Operation. No Tokens Found"
content:
application/json:
schema:
$ref: "#/components/schemas/NotFoundResponse"

500:
description: "Unsuccessful Operation. Internal Server Error"
content:
application/json:
schema:
$ref: "#/components/schemas/InternalErrorResponse"

/api/v1/nfts:
get:
parameters:
- in: query
name: name
schema:
type: string
required: false
description: name of the collection to look for
tags:
- nft
summary: Returns all of the accepted nft collections that match the query
description: returns all of the accepted nft collections that a are a part of the registry repository on github and match the query pattern. Return all when no query is specified.
responses:
200:
description: "Successful Operation"
content:
application/json:
schema:
$ref: "#/components/schemas/NftCollectionEntries"

400:
description: "Unsuccessful Operation. Bad request data"
content:
application/json:
schema:
$ref: "#/components/schemas/BadRequestResponse"

404:
description: "Unsuccessful Operation. No Collections Found"
content:
application/json:
schema:
$ref: "#/components/schemas/NotFoundResponse"

500:
description: "Unsuccessful Operation. Internal Server Error"
content:
application/json:
schema:
$ref: "#/components/schemas/InternalErrorResponse"

/api/v1/nfts/{collectionId}:
get:
tags:
- nft
summary: Get the NFT Collection which matches the collectionId
description: Get the NFT Collection which matches the collectionId
parameters:
- in: path
name: collectionId
schema:
type: string
description: collectionId of the token to fetch data of
required: true
responses:
200:
description: "Successful Operation"
content:
application/json:
schema:
$ref: "#/components/schemas/NftCollectionEntry"

400:
description: "Unsuccessful Operation. Bad request data"
content:
application/json:
schema:
$ref: "#/components/schemas/BadRequestResponse"

404:
description: "Unsuccessful Operation. No Tokens Found"
content:
application/json:
schema:
$ref: "#/components/schemas/NotFoundResponse"

500:
description: "Unsuccessful Operation. Internal Server Error"
content:
application/json:
schema:
$ref: "#/components/schemas/InternalErrorResponse"

components:
schemas:
TokenEntries:
description: array of TokenEntry
properties:
tokens:
type: array
items:
$ref: "#/components/schemas/TokenEntry"
required:
- tokens

TokenEntry:
description: Entry of a single token into the registry
properties:
name:
type: string
description: Human readable identifier for a given token
url:
type: string
description: URL to get more information about a token
symbol:
type: string
description: symbol/ticker for the token
tokenId:
type: string
description: Token Id assigned to the token (Foundry ID + Token Tag)
required:
- name
- symbol
- tokenId

NftCollectionEntries:
description: array of NftCollectionEntry
properties:
collections:
type: array
items:
$ref: "#/components/schemas/NftCollectionEntry"
required:
- collections

NftCollectionEntry:
description: Entry of a single NFT
properties:
name:
type: string
description: Human readable identifier for a NFT Collection
url:
type: string
description: URL to get more information about the NFT Collection
collectionId:
type: string
description: Unique identifier for the NFT collection
required:
- name
- collectionId

ErrorResponse:
description: The error format.
properties:
error:
type: object
properties:
code:
type: string
description: The application error code.
message:
type: string
description: The error reason.
required:
- code
- message
required:
- error

BadRequestResponse:
description: Indicates that the request was bad.
allOf:
- $ref: "#/components/schemas/ErrorResponse"
example:
error:
code: 400
message: invalid data provided

NotFoundResponse:
description: Indicates that the data was not found.
allOf:
- $ref: "#/components/schemas/ErrorResponse"
example:
error:
code: 404
message: could not find data

InternalErrorResponse:
description: Indicates that the server encountered an unexpected condition, which prevented it from fulfilling the request by the client.
allOf:
- $ref: "#/components/schemas/ErrorResponse"
example:
error:
code: 500
message: internal server error
Loading