Skip to content

wdotsol/drift-protocol-v2-docs

 
 

Repository files navigation

👾 Drift Protocol Documentation

Drift Protocol 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

Coming soon

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.

Releases

No releases published

Packages

No packages published

Languages

  • MDX 83.9%
  • TypeScript 13.6%
  • JavaScript 1.5%
  • CSS 1.0%