Skip to content

Files

Latest commit

e5a7b1f · Jan 15, 2025

History

History
30 lines (20 loc) · 935 Bytes

README.md

File metadata and controls

30 lines (20 loc) · 935 Bytes

drift-examples

Examples here are written using bun 1.1.9. If you using node, recommended version is v20.18.0. And use @drift-labs/sdk. If you are using the drift sdk in browser environment, it's recommended to use @drift-labs/sdk-browser instead.

Install dependencies:

bun install

All examples require the following environment variables:

  • PRIVATE_KEY: The private key of the account to use, can be:
    • numbers array (from solana-keygen new)
    • base58 encoded private key (phantom exported private key)
    • a file to any of the above
  • RPC_URL: The RPC URL of the network to use for the example, you need a proper one

Run Examples

Each file under examples/ is an example, start with:

bun run example/1_init_user.ts