add scripts for installing charting_library + update readme (#298)
This commit is contained in:
parent
4aec1bee67
commit
515036ac05
@ -16,6 +16,9 @@ NEXT_PUBLIC_SWAPPER=osmo1q3p82qtudu7f5edgvqyzf6hk8xanezlr0w7ntypnsea4jfpe37ps29e
|
||||
NEXT_PUBLIC_PARAMS=osmo1xvg28lrr72662t9u0hntt76lyax9zvptdvdmff4k2q9dhjm8x6ws9zym4v
|
||||
NEXT_PUBLIC_API=http://localhost:3000/api
|
||||
NEXT_PUBLIC_CANDLES_ENDPOINT="https://api.thegraph.com/subgraphs/name/{NAME}/{GRAPH_NAME}"
|
||||
CHARTING_LIBRARY_USERNAME="username_with_access_to_charting_library"
|
||||
CHARTING_LIBRARY_ACCESS_TOKEN="access_token_with_access_to_charting_library"
|
||||
CHARTING_LIBRARY_REPOSITORY="github.com/username/charting_library/"
|
||||
|
||||
# MAINNET #
|
||||
# NEXT_PUBLIC_NETWORK=mainnet
|
||||
@ -33,4 +36,7 @@ NEXT_PUBLIC_CANDLES_ENDPOINT="https://api.thegraph.com/subgraphs/name/{NAME}/{GR
|
||||
# NEXT_PUBLIC_INCENTIVES=osmo1nkahswfr8shg8rlxqwup0vgahp0dk4x8w6tkv3rra8rratnut36sk22vrm
|
||||
# NEXT_PUBLIC_ZAPPER=osmo17qwvc70pzc9mudr8t02t3pl74hhqsgwnskl734p4hug3s8mkerdqzduf7c
|
||||
# NEXT_PUBLIC_SWAPPER=osmo1wee0z8c7tcawyl647eapqs4a88q8jpa7ddy6nn2nrs7t47p2zhxswetwla
|
||||
# NEXT_PUBLIC_API=http://localhost:3000/api
|
||||
# NEXT_PUBLIC_API=http://localhost:3000/api
|
||||
# CHARTING_LIBRARY_USERNAME="username_with_access_to_charting_library"
|
||||
# CHARTING_LIBRARY_ACCESS_TOKEN="access_token_with_access_to_charting_library"
|
||||
# CHARTING_LIBRARY_REPOSITORY="username/charting_library"
|
||||
|
58
README.md
58
README.md
@ -7,6 +7,7 @@ First, install the dependencies:
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
Then, run the development server:
|
||||
|
||||
```bash
|
||||
@ -15,52 +16,17 @@ yarn dev
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
|
||||
## Trading charts
|
||||
|
||||
## Hive endpoint
|
||||
The trade charts are sourced with the TradingView [charting_library](https://www.tradingview.com/charting-library-docs/). In order to enable the charts, request has to be requested from TradingView. This allows the charting_library package to be pulled-in during the application build process. For this, it is recommended to do the following:
|
||||
|
||||
Much of the requests the app sends are served via a graphql server known as '[Hive](https://github.com/terra-money/hive-graph)'. While this is built for Terra, it should operate fine ontop of any Cosmos chain. If you require a local or testnet deployment of hive, you need to do the following:
|
||||
1. Request access to the TradingView repository
|
||||
2. Create a private fork
|
||||
3. Generate a Personal Access Token from Github
|
||||
4. Add the following to the environment variables:
|
||||
a. CHARTING_LIBRARY_USERNAME -> the username of the account with access
|
||||
b. CHARTING_LIBRARY_ACCESS_TOKEN -> the access token
|
||||
c. CHARTING_LIBRARY_REPOSITORY -> the URI of the Github repository
|
||||
5. Build the application by executing the `install_charting_library.sh` script prior.
|
||||
|
||||
Clone the [repo](https://github.com/terra-money/hive-graph)
|
||||
|
||||
Install all the dependencies:
|
||||
|
||||
```
|
||||
npm ci
|
||||
```
|
||||
|
||||
Copy the `.env.sample` file to `.env`
|
||||
|
||||
```
|
||||
cp .env.sample .env
|
||||
```
|
||||
|
||||
Update `LCD_URL` and `CHAIN_ID` to the endpoints of the chain you want to be querying.
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
`npm run start:dev`
|
||||
|
||||
Runs the NodeJs services in the development mode.\
|
||||
Open [localhost:8085/graphql](http://localhost:8085/graphql) to view it in the browser or Postman.
|
||||
|
||||
The service will reload if you make edits.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
|
||||
### Deploy Previews
|
||||
|
||||
Develop branch with testnet configuration: http://testnet-v2.marsprotocol.io/
|
||||
For development on localhost, run `yarn install-charting-library`. Ensure that you have a `.env.local` file defined with the variables mentioned above.
|
||||
|
10
install_charting_library.js
Normal file
10
install_charting_library.js
Normal file
@ -0,0 +1,10 @@
|
||||
require('dotenv').config()
|
||||
const shell = require('shelljs')
|
||||
const path = require('path')
|
||||
|
||||
shell.exec(
|
||||
`CHARTING_LIBRARY_USERNAME=${process.env.CHARTING_LIBRARY_USERNAME} ` +
|
||||
`CHARTING_LIBRARY_ACCESS_TOKEN=${process.env.CHARTING_LIBRARY_ACCESS_TOKEN} ` +
|
||||
`CHARTING_LIBRARY_REPOSITORY=${process.env.CHARTING_LIBRARY_REPOSITORY} sh ` +
|
||||
path.join(__dirname, 'install_charting_library.sh'),
|
||||
)
|
@ -6,9 +6,7 @@ remove_if_directory_exists() {
|
||||
|
||||
BRANCH="master"
|
||||
|
||||
REPOSITORY="https://$TV_USERNAME:$TV_ACCESS_TOKEN@github.com/tradingview/charting_library/"
|
||||
|
||||
echo $REPOSITORY
|
||||
REPOSITORY="https://$CHARTING_LIBRARY_USERNAME:$CHARTING_LIBRARY_ACCESS_TOKEN@$CHARTING_LIBRARY_REPOSITORY"
|
||||
|
||||
LATEST_HASH=$(git ls-remote $REPOSITORY $BRANCH | grep -Eo '^[[:alnum:]]+')
|
||||
|
@ -11,7 +11,8 @@
|
||||
"format": "eslint ./src/ ./__tests__/ --fix && prettier --write ./src/ ./__tests__/",
|
||||
"prettier-check": "prettier --ignore-path .gitignore --check ./src/",
|
||||
"start": "next start",
|
||||
"validate-env": "node ./validate-env"
|
||||
"validate-env": "node ./validate-env",
|
||||
"install-charting-library": "dotenv -e .env.local node install_charting_library.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cosmjs/cosmwasm-stargate": "^0.31.0",
|
||||
@ -50,6 +51,7 @@
|
||||
"autoprefixer": "^10.4.14",
|
||||
"babel-jest": "^29.5.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"dotenv-cli": "^7.2.1",
|
||||
"eslint": "8.43.0",
|
||||
"eslint-config-next": "^13.4.4",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
@ -58,6 +60,7 @@
|
||||
"jest-environment-jsdom": "^29.6.1",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-tailwindcss": "^0.3.0",
|
||||
"shelljs": "^0.8.5",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"typescript": "5.1.6"
|
||||
}
|
||||
|
19
yarn.lock
19
yarn.lock
@ -5079,7 +5079,22 @@ dot-case@^3.0.4:
|
||||
no-case "^3.0.4"
|
||||
tslib "^2.0.3"
|
||||
|
||||
dotenv@^16.3.1:
|
||||
dotenv-cli@^7.2.1:
|
||||
version "7.2.1"
|
||||
resolved "https://registry.yarnpkg.com/dotenv-cli/-/dotenv-cli-7.2.1.tgz#e595afd9ebfb721df9da809a435b9aa966c92062"
|
||||
integrity sha512-ODHbGTskqRtXAzZapDPvgNuDVQApu4oKX8lZW7Y0+9hKA6le1ZJlyRS687oU9FXjOVEDU/VFV6zI125HzhM1UQ==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.3"
|
||||
dotenv "^16.0.0"
|
||||
dotenv-expand "^10.0.0"
|
||||
minimist "^1.2.6"
|
||||
|
||||
dotenv-expand@^10.0.0:
|
||||
version "10.0.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-10.0.0.tgz#12605d00fb0af6d0a592e6558585784032e4ef37"
|
||||
integrity sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==
|
||||
|
||||
dotenv@^16.0.0, dotenv@^16.3.1:
|
||||
version "16.3.1"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e"
|
||||
integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==
|
||||
@ -8464,7 +8479,7 @@ shebang-regex@^3.0.0:
|
||||
|
||||
shelljs@^0.8.5:
|
||||
version "0.8.5"
|
||||
resolved "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
|
||||
integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==
|
||||
dependencies:
|
||||
glob "^7.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user