UserAccount
The main account type for user positions, orders, and balances.PublicKey
required
The public key of the user’s wallet that owns this account
PublicKey
required
The public key of the delegate authorized to trade on behalf of the user
number[]
required
Array representing the account name (max 32 bytes)
number
required
The sub-account identifier (0-255)
SpotPosition[]
required
Array of spot market positions held by the user
PerpPosition[]
required
Array of perpetual market positions held by the user
Order[]
required
Array of open orders for this user
number
required
User status flags (see UserStatus enum)
number
required
The next liquidation identifier to be used
number
required
The next order identifier to be used
number
required
Maximum margin ratio for the account
BN
required
Settled perpetual profit and loss
BN
required
Total deposits made to this account
BN
required
Total withdrawals made from this account
boolean
required
Whether margin trading is enabled for this account
boolean
required
Whether the account is idle (no positions or orders)
number
required
Number of open orders
boolean
required
Whether the account has any open orders
MarginMode
required
The margin mode for this account (DEFAULT, HIGH_LEVERAGE, etc.)
PerpMarketAccount
Represents a perpetual futures market.MarketStatus
required
Current market status (ACTIVE, PAUSED, etc.)
ContractType
required
Type of contract (PERPETUAL, FUTURE, PREDICTION)
ContractTier
required
Risk tier of the contract (A, B, C, SPECULATIVE, etc.)
number
required
Unique identifier for this market
PublicKey
required
The public key of this market account
number[]
required
Market name (max 32 bytes)
AMM
required
Automated Market Maker configuration and state
number
required
Total number of users with positions in this market
number
required
Initial margin requirement ratio
number
required
Maintenance margin requirement ratio
number
required
Fee paid to liquidators
number
required
Fee paid to insurance fund on liquidation
SpotMarketAccount
Represents a spot market for trading tokens.MarketStatus
required
Current market status
AssetTier
required
Asset tier classification (COLLATERAL, PROTECTED, CROSS, ISOLATED)
number
required
Unique identifier for this spot market
PublicKey
required
The public key of this market account
PublicKey
required
The SPL token mint for this market
PublicKey
required
The vault account holding tokens for this market
PublicKey
required
The oracle account providing price data
OracleSource
required
The type of oracle being used (PYTH, SWITCHBOARD, etc.)
number
required
Number of decimals for the token
BN
required
Total deposits in this market
BN
required
Total borrows in this market
number
required
Initial collateral weight for this asset
number
required
Maintenance collateral weight for this asset
UserStatsAccount
Tracks user statistics and fee information.PublicKey
required
The user’s authority public key
PublicKey
required
The referrer’s public key
number
required
Number of sub-accounts currently active
number
required
Total number of sub-accounts ever created
BN
required
Maker volume over the last 30 days
BN
required
Taker volume over the last 30 days
object
required
Fee statistics for this user
StateAccount
The global state account for the Drift Protocol.PublicKey
required
The admin authority for the protocol
number
required
Global exchange status flags
number
required
Total number of perpetual markets
number
required
Total number of spot markets
FeeStructure
required
Fee structure for perpetual markets
FeeStructure
required
Fee structure for spot markets