Drift
drift-reserve is the liquid reserve sleeve.
The implementation lives in services/adapters/src/drift.ts.
Supported paths
Fixture mode
Used when no live RPC is provided. Good for:- offline tests
- deterministic demos
- no-network development
SDK mode
Used whenDRIFT_RPC_URL is set.
Current supported operations:
depositrequest_withdrawfinalize_withdrawvia the same withdraw path
Important behavior
- deposit can initialize the Drift user account automatically
- withdraw requires an existing user account with collateral
- the adapter emits
instructionLabelsandinstructionEnvelopesfor Ranger
Main environment variables
| Variable | Purpose |
|---|---|
DRIFT_RPC_URL | Solana RPC used by the Drift adapter |
DRIFT_OWNER_ADDRESS | Drift authority expected by the SDK |
DRIFT_ENV | Cluster config, usually mainnet-beta |
DRIFT_MARKET_INDEX | Spot market index, default 0 for USDC |
DRIFT_MARKET_SYMBOL | Market symbol, usually USDC |
DRIFT_SUB_ACCOUNT_ID | Subaccount used for deposits and withdrawals |
DRIFT_USER_NAME | Name used when initializing a Drift user |
Validation order
node --experimental-strip-types services/ranger/src/drift-smoke.ts- set
DRIFT_SMOKE_MODE=depositfirst - use
drift-live-send.tsonly after bundle construction is working - use
withdrawonly after a real deposit exists for that signer
Common failure mode
If you runwithdraw too early, you should expect an error that the Drift user account does not exist yet.