forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NFT Mirror MystenLabs#666] Set up project skeleton for the Oracle se…
…rver
- Loading branch information
Showing
22 changed files
with
14,031 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Set to production when deploying to production | ||
NODE_ENV=development | ||
|
||
# Node.js server configuration | ||
SERVER_PORT=8000 | ||
|
||
# Alchemy API KEY. Please replace it with your own(https://dashboard.alchemyapi.io/) | ||
ALCHEMY_API_KEY="demo" | ||
|
||
# Sui Gateway endpoint | ||
SUI_GATEWAY_ENDPOINT = "http://127.0.0.1:5000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"prettier/prettier": 2 // Means error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.env | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
build/ | ||
coverage/ | ||
package-lock.json | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# open-api | ||
gateway-generated-schema.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"tabWidth": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Sui Oracle Service | ||
|
||
The oracle service is a trusted entity that faciliates the cross-chain airdrop of NFT tokens on Sui. This implementation is a MVP | ||
version that's not indended for any production use. The service currently only supports the copying of Ethereum | ||
ERC-721 token to Sui. | ||
|
||
As shown in the graph below, the main job of the oracle is to validate the user ownership of the NFT, call the Airdrop contract to claim the token, and return the Sui explorer link of the newly minted NFT. | ||
|
||
![user flow](./docs/flow.png 'User Flow') | ||
|
||
## Get Started | ||
|
||
1. Set up the `.env` file through `cp .env.sample .env`. Rememeber to replace any placeholder value(e.g., ALCHEMY_API_KEY). | ||
2. Install the dependencies through `npm i` | ||
3. Start the server through `npm run dev` | ||
4. The easiest way to test out an endpoint is through [http://localhost:8000/docs](http://localhost:8000/docs) by clicking on "Try it out". No need to manually write curl command or example data. | ||
|
||
## Useful Commands for Development | ||
|
||
**Requirements**: Node 14.0.0 or later version | ||
|
||
In the project directory, you can run: | ||
|
||
### `npm i` | ||
|
||
Before running any of the following scripts `npm i` must run in order to install the necessary dependencies. | ||
|
||
### `npm run dev` | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:8000](http://localhost:8000) to view it in the browser. | ||
|
||
The page will reload if you make edits.\ | ||
You will also see any lint errors in the console. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.\ | ||
It bundles React in production mode and optimizes the build for the best performance. | ||
|
||
### `npm run start` | ||
|
||
Run the production version | ||
|
||
### `npm run lint` | ||
|
||
Run linting check (prettier/eslint/stylelint). | ||
|
||
### `npm run lint:fix` | ||
|
||
Run linting check but also try to fix any issues. | ||
|
||
### `npm run prettier:fix:watch` | ||
|
||
Run prettier in watch mode and format any file that changes. (Also runs prettier once in the beginning for all the files)\ | ||
It can be useful during development to format automatically all the files that change. | ||
|
||
## Documentation | ||
|
||
Swagger UI is available at [http://localhost:8000/docs](http://localhost:8000/docs). The UI will always show the latest documentation during development. | ||
|
||
Aside from allowing developers to inspect the documentation, the Swagger UI also allows the developer to quickly test out the endpoint by clicking the "Try it out" button with pre-populated example data. | ||
|
||
The syntax for documentation annotation can be found in the [tsoa docs](https://tsoa-community.github.io/docs/getting-started.html). | ||
|
||
![swagger ui](./docs/swagger.png 'Swagger UI') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.