Skip to content

Commit

Permalink
chore: Update documentation (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChefKai authored Jul 27, 2021
1 parent 4b92c42 commit 2b96f2f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 66 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# pancake-profile-api
# PancakeSwap Profile API

Serverless API implementation for PancakeSwap Profile smart contract on Binance Smart Chain.
Serverless API implementation for PancakeSwap Profile contract

# Dependencies

- [Vercel CLI](https://vercel.com/download)
- Required to emulate local environment (serverless functions).
- Required to emulate local environment (serverless).

# Documentation

Expand All @@ -19,12 +19,12 @@ You can configure your database URI for any development purpose by exporting an

```shell
# Default: mongodb://localhost:27017/profile
export MONGO_URI = "";
export MONGO_URI = "mongodb://host:port/database";
```

# 2. Blacklist

You can configure (add/edit/remove) the blacklist by editing the file located [here](utils/blacklist.json).
You can configure (create/update/delete) the blacklist by editing the file located [here](utils/blacklist.json).

> Note: All blacklisted words must be LOWERCASE.
Expand Down Expand Up @@ -59,7 +59,7 @@ curl -X GET 'localhost:3000/api/version'

## Deploy

Deployments to production should be triggered by a webhook when a commit, or a pull-request is merged to `master`.
Deploy to production should be triggered by a webhook when a commit, or a pull-request is merged to `master`.

If you need to force a deployment, use the following command:

Expand Down
105 changes: 46 additions & 59 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ Base endpoint: [profile.pancakeswap.com/api](https://profile.pancakeswap.com/api

All endpoints supports [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).

# Misc
# Miscellaneous

## 1. Version

> Return the current API version (used to ensure deployment).
> Return the current API version.
Usage :

```
```shell
$ curl -X GET https://profile.pancakeswap.com/api/version
```

Response :

```
```json5
{
"version": "1.0.0"
}
```

# Users
# Profile

# 1. Users

Expand All @@ -34,105 +34,92 @@ Response :
Usage :

```
```shell
$ curl -X GET https://profile.pancakeswap.com/api/users/0x000000000000000000000000000000000000dEaD
```

Response :

```
```json5
{
"adress": <string>,
"username": <string>,
"adress": "<string>",
"username": "<string>",
"leaderboard": {
"global": <integer>,
"team": <integer>,
"volume": <float>
"global": "<integer>",
"team": "<integer>",
"volume": "<float>",
"next_rank": "<float>"
},
"created_at": "2021-01-01T00:00:00.000Z",
"updated_at": null
"created_at": "<string>",
"updated_at": "<string|null>"
}
```

# 2. Register

### POST /users/register

> Create a user, with an address and username, both confirmed by signature request.
Usage :

```
```shell
$ curl -X POST -d '{"address": "0x...", "username": "Chef...", "signature": "0x..."}' https://profile.pancakeswap.com/api/users/register
```

Response :

```
```json5
{
"adress": <string>,
"username": <string>,
"created_at": "2021-01-01T00:00:00.000Z",
"updated_at": null
"adress": "<string>",
"username": "<string>",
"created_at": "<string>",
"updated_at": "<string|null>"
}
```

# 3. Valid

### GET /users/valid/{username}

> Return username validity, based on multiple criteria.
Usage :

```
```shell
$ curl -X GET https://profile.pancakeswap.com/api/users/valid/ChefPancake
```

Response :

```
-- Success
```json5
{
"username": <string>,
"valid": <boolean>
}
-- Failure
{
"error": {
"message": <string>
}
"username": "<string>",
"valid": "<boolean>"
}
```

# Leaderboard

## 1. Global
## 2. Team

### GET /leaderboard/global

> Return global leaderboard, ordered by rank (-> volume in USD).
> Return leaderboard, ordered by rank (-> volume in USD (desc)).
Usage :

```
```shell
$ curl -X GET https://profile.pancakeswap.com/api/leaderboard/global
```

Response :

```
```json5
{
"total": 12345,
"total": "<integer>",
"volume": "<float>",
"data": [
{
"rank": <integer>,
"adress": <string>,
"username": <string>,
"volume": <integer>
},
...
"rank": "<integer>",
"address": "<string>",
"volume": "<float>",
"teamId": "<integer>"
}
]
}
```
Expand All @@ -141,27 +128,27 @@ Response :

### GET /leaderboard/team/{id}

> Return team leaderboard, per team ID, ordered by rank (-> volume in USD).
> Return leaderboard, for a given team, ordered by rank (-> volume in USD).
Usage :

```
```shell
$ curl -X GET https://profile.pancakeswap.com/api/leaderboard/team/1
```

Response :

```
```json5
{
"total": 12345,
"total": "<integer>",
"volume": "<float>",
"data": [
{
"rank": <integer>,
"adress": <string>,
"username": <string>,
"volume": <integer>
},
...
"rank": "<integer>",
"address": "<string>",
"volume": "<float>",
"teamId": "<integer>"
}
]
}
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pancake-profile-api",
"version": "1.1.2",
"description": "Serverless API implementation for PancakeSwap Profile contract.",
"description": "Serverless API implementation for PancakeSwap Profile contract",
"main": "api/version.ts",
"repository": "[email protected]:pancakeswap/pancake-profile-api.git",
"author": "PancakeSwap",
Expand Down

0 comments on commit 2b96f2f

Please sign in to comment.