Drift Protocol is an open sourced project:
For any help/setup questions, feel free to ask in #dev-chat on Discord!
Requires Anchor and Solana's web3.js library to be installed.
npm install @drift-labs/sdk
Anchor automatically generates IDLs based on a Program ID.
To receive devnet usdc for (https://master.drift.trade)
This Clearinghouse client object wraps around the core Rust program. All the trading functions will call from the Clearinghouse class.
From here, all program calls will be made through the Clearinghouse Object.
User accounts need to be initialized on the clearinghouse before being able to interact with the Clearinghouse program. User account connects the trader's wallet and the on-chain market. Funds are escrowed within the user account.
To refer to each market, the SDK refers to market indices based on the following table. (Note that this is subject to change and update as new markets are deployed) see https://github.com/drift-labs/protocol-v1/blob/master/sdk/src/constants/markets.ts
The following function returns the mark price given a market index.