Skip to content

Instantly share code, notes, and snippets.

@wphan
Created November 7, 2025 19:55
Show Gist options
  • Select an option

  • Save wphan/7c9c39e3505955c17612cf961579f90b to your computer and use it in GitHub Desktop.

Select an option

Save wphan/7c9c39e3505955c17612cf961579f90b to your computer and use it in GitHub Desktop.
import { DriftClient, Wallet } from "@drift-labs/sdk";
import { Connection, Keypair } from "@solana/web3.js";
const RPC_URL = process.env.RPC_URL!;
const main = async () => {
const dc = new DriftClient({
env: 'mainnet-beta',
connection: new Connection(process.env.RPC_URL!),
wallet: new Wallet(Keypair.generate()),
});
await dc.subscribe();
const perpMarkets = dc.getPerpMarketAccounts().map(mkt => mkt.pubkey.toBase58());
console.log(perpMarkets);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment