55 lines
1.9 KiB
Markdown
55 lines
1.9 KiB
Markdown
# 馃懢 Drift Protocol Documentation
|
|
|
|
[Drift Protocol](https://www.drift.trade/) brings on-chain, cross-margined perpetual futures to Solana. Making futures DEXs the best way to trade.
|
|
|
|
## Local Development
|
|
|
|
First, run `pnpm i` to install the dependencies.
|
|
|
|
Then, run `pnpm dev` to start the development server and visit localhost:3000.
|
|
|
|
## Autogenerated SDK Docs
|
|
|
|
The SDKDocs component attempts to pull in automatically generated definitions for classes, methods, functions, variables and enums. Each can include descriptions, parameters and return signatures that have been documented inline.
|
|
|
|
### TypeScript
|
|
|
|
Definitions are pulled directly from the SDK's npm package which is installed in this project and parsed as TSDoc.
|
|
|
|
### Rust
|
|
|
|
`rustup` has the ability to generate definitions and output them as JSON. This can be done locally by cloning drift-rs and running the cargo doc command. You will need the nightly build as the JSON output is not yet available in the stable release.
|
|
|
|
```
|
|
rustup default nightly
|
|
RUSTDOCFLAGS="-Z unstable-options --output-format json" \
|
|
cargo doc --no-deps
|
|
```
|
|
|
|
This will output the definitions to `target/doc/drift_rs.json` which needs to be copied into `types/drift_rs.json`
|
|
|
|
There is currently no option to exclude external creates and the file is too large to be parsed efficiently. We then need to run post processing to remove external crate definitions:
|
|
|
|
```
|
|
pnpm run rust-docs
|
|
```
|
|
|
|
This reduces drift_rs.json from 44mb to about 1mb.
|
|
|
|
### Python
|
|
|
|
In driftpy run the command:
|
|
```
|
|
/usr/bin/python3 scripts/export_api_docs.py
|
|
```
|
|
|
|
This will output `docs/generated/api_reference.json` which you can copy to `types/sdks/driftpy.json`
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License.
|
|
|
|
## Deployment
|
|
|
|
Before deploying to vercel, run yarn and commit the package-lock.json file. This is necessary for new navigation routes to show up in the build output.
|