Optional
authorityOptional
enableOptional
includeOptional
optsOptional
receiverOptional
sbOptional
sbOptional
signerOptional
skipOptional
stateOptional
userOptional
wormholeAdd to an insurance fund stake and optionally initialize the account
The account where the funds to stake come from. Usually an associated token account
Optional
fromOptional -- withdraw from current subaccount to fund stake amount, instead of wallet balance
Optional
initializeAdd instructions to initialize the staking account -- required if its the first time the currrent authority has staked in this market
Spot market index
Optional
txOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccount | PhoenixV1FulfillmentConfigAccount | OpenbookV2FulfillmentConfigAccountOptional
authority: PublicKeyOptional
userAccount: UserAccountOptional
txParams: TxParamsOptional
txVersion: TransactionVersionOptional
lookupTables: AddressLookupTableAccount[]Optional
forceVersionedTransaction: booleanOptional
txParams: TxParamsOptional
txVersion: TransactionVersionOptional
lookupTables: AddressLookupTableAccount[]Optional
forceVersionedTransaction: booleanOptional
txParams: TxParamsOptional
txVersion: TransactionVersionOptional
lookupTables: AddressLookupTableAccount[]Optional
forceVersionedTransaction: booleanOptional
recentBlockhash: Readonly<{ Optional
txParams: TxParamsOptional
txVersion: TransactionVersionOptional
lookupTables: AddressLookupTableAccount[]Optional
forceVersionedTransaction: booleanOptional
direction?: PositionDirectionOptional
marketOptional
marketOptional
txParams: TxParamsOptional
subAccountId: numberOptional
marketType: MarketTypeOptional
marketIndex: numberOptional
direction: PositionDirectionOptional
txParams: TxParamsOptional
subAccountId: numberuse placePerpOrder or placeAndTakePerpOrder instead
Optional
limitPrice: BNOptional
subAccountId: numberConverts an amount to the perp precision. The perp market precision is BASE_PRECISION (1e9).
Converts an amount to the price precision. The perp market precision is PRICE_PRECISION (1e6).
Optional
name: stringOptional
fromSubAccountId: numberOptional
referrerInfo: ReferrerInfoOptional
donateAmount: BNOptional
txParams: TxParamsOptional
customMaxMarginRatio: numberOptional
name: stringOptional
fromSubAccountId: numberOptional
referrerInfo: ReferrerInfoOptional
donateAmount: BNOptional
customMaxMarginRatio: numberOptional
authority: PublicKeyDeposit funds into the given spot market
to deposit
spot market index to deposit into
can be the wallet public key if using native sol
Optional
subAccountId: numbersubaccountId to deposit
if true, deposit must not increase account risk
Optional
txParams: TxParamsUpdate the subscribed accounts to a given authority, while leaving the connected wallet intact. This allows a user to emulate another user's account on the UI and sign permissionless transactions with their own wallet.
Optional
order: Pick<Order, "marketIndex" | "orderId">Optional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
fillerPublicKey: numberOptional
order: OrderOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccount | PhoenixV1FulfillmentConfigAccount | OpenbookV2FulfillmentConfigAccountOptional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
txParams: TxParamsOptional
fillerPublicKey: PublicKeyForces a fetch to rpc before returning accounts. Useful for anchor tests.
Forces a fetch to rpc before returning accounts. Useful for anchor tests.
Forces a fetch to rpc before returning accounts. Useful for anchor tests.
Forces a fetch to rpc before returning accounts. Useful for anchor tests.
Optional
subAccountId: numberOptional
subAccountId: numberOptional
subAccountId: numberOptional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
fillerSubAccountId: numberOptional
order: OrderOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccount | PhoenixV1FulfillmentConfigAccount | OpenbookV2FulfillmentConfigAccountOptional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
fillerPublicKey: PublicKeyOptional
fillerPublicKey: PublicKeyOptional
marketIndex: numberOptional
name: stringOptional
referrerInfo: ReferrerInfoOptional
inOptional
onlyOptional
outOptional
reduceOptional
route?: RouteOptional
slippageOptional
swapOptional
userOptional
inOptional
onlyOptional
outOptional
quote?: QuoteResponseOptional
reduceOptional
slippageOptional
swapOptional
userOptional
limitPrice: BNOptional
liquidatorSubAccountId: numberOptional
limitPrice: BNOptional
liquidatorSubAccountId: numberOptional
limitPrice: BNOptional
liquidatorSubAccountId: numberOptional
liquidatorSubAccountId: numberOptional
limitPrice: BNOptional
liquidatorSubAccountId: numberCalculates taker / maker fee (as a percentage, e.g. .001 = 10 basis points) for particular marketType
: {takerFee: number, makerFee: number} Precision None
Optional
marketIndex: numberOptional
user: UserReturns the market index and type for a given market name E.g. "SOL-PERP" -> { marketIndex: 0, marketType: MarketType.PERP }
Optional
auctionOptional
auctionOptional
auctionOptional
immediateOptional
maxOptional
newOptional
newOptional
newOptional
newOptional
newOptional
newOptional
policy?: ModifyOrderPolicyOptional
postOptional
reduceOptional
txOptional
subAccountId: numberOptional
auctionOptional
auctionOptional
auctionOptional
immediateOptional
maxOptional
newOptional
newOptional
newOptional
newOptional
newOptional
newOptional
policy?: ModifyOrderPolicyOptional
postOptional
reduceOptional
subAccountId: numberOptional
referrerInfo: ReferrerInfoOptional
subAccountId: numberOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccountOptional
referrerInfo: ReferrerInfoOptional
subAccountId: numberOptional
referrerInfo: ReferrerInfoOptional
subAccountId: numberOptional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
successCondition: PlaceAndTakeOrderSuccessConditionOptional
subAccountId: numberOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccountOptional
makerInfo: MakerInfoOptional
referrerInfo: ReferrerInfoOptional
subAccountId: numberOptional
subAccountId: numberOptional
subAccountId: numberOptional
depositToTradeArgs: { Optional
subAccountId: numberOptional
sharesToBurn: BNOptional
subAccountId: numberOptional
liquidatorSubAccountId: numberOptional
liquidatorSubAccountId: numberOptional
subAccountId: numberGet the drift begin_swap and end_swap instructions
Optional
fillerPublicKey: PublicKeyOptional
fuelBoostTaker: numberOptional
fuelBoostMaker: numberOptional
fuelBoostPosition: numberOptional
minBorrowRate: numberOptional
fuelBoostDeposits: numberOptional
fuelBoostBorrows: numberOptional
fuelBoostTaker: numberOptional
fuelBoostMaker: numberOptional
fuelBoostInsurance: numberOptional
fillerPublicKey: PublicKeyOptional
userAccountPublicKey: PublicKeyOptional
fillerPublicKey: PublicKeyOptional
subAccountId: numberOptional
authority: PublicKeyOptional
subAccountId: numberOptional
includeRent: booleanOptional
marketIndex: numberOptional
name: stringOptional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsCreates the User account for a user, and deposits some initial collateral
Optional
name: stringOptional
fromSubAccountId: numberOptional
referrerInfo: ReferrerInfoOptional
donateAmount: BNOptional
txParams: TxParamsOptional
customMaxMarginRatio: numberOptional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
limitPrice: BNOptional
txParams: TxParamsOptional
liquidatorSubAccountId: numberOptional
limitPrice: BNOptional
txParams: TxParamsOptional
liquidatorSubAccountId: numberOptional
limitPrice: BNOptional
txParams: TxParamsOptional
liquidatorSubAccountId: numberOptional
txParams: TxParamsOptional
liquidatorSubAccountId: numberOptional
limitPrice: BNOptional
txParams: TxParamsOptional
liquidatorSubAccountId: numberModifies an open order (spot or perp) by closing it and replacing it with a new order.
Optional
auctionOptional
auctionOptional
auctionOptional
immediateOptional
maxOptional
newOptional
newOptional
newOptional
newOptional
newOptional
newOptional
policy?: ModifyOrderPolicyOptional
postOptional
reduceOptional
txParams: TxParamsOptional
subAccountId: numberModifies an open order by closing it and replacing it with a new order.
Optional
auctionOptional
auctionOptional
auctionOptional
immediateOptional
maxOptional
newOptional
newOptional
newOptional
newOptional
newOptional
newOptional
policy?: ModifyOrderPolicyOptional
postOptional
reduceOptional
txParams: TxParamsOptional
subAccountId: numberEach drift instruction must include perp and sport market accounts in the ix remaining accounts. Use this function to force a subset of markets to be included in the remaining accounts for every ix
use placePerpOrder or placeAndTakePerpOrder instead
Optional
limitPrice: BNOptional
subAccountId: numberOptional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
subAccountId: numberOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccountOptional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
subAccountId: numberOptional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
subAccountId: numberOptional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
successCondition: PlaceAndTakeOrderSuccessConditionOptional
txParams: TxParamsOptional
subAccountId: numberOptional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
subAccountId: numberOptional
cancelExistingOrders: booleanOptional
settlePnl: booleanOptional
exitEarlyIfSimFails: booleanOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccountOptional
makerInfo: MakerInfoOptional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
subAccountId: numberOptional
txParams: TxParamsOptional
subAccountId: numberOptional
txParams: TxParamsOptional
subAccountId: numberOptional
txParams: TxParamsOptional
subAccountId: numberOptional
txParams: TxParamsOptional
makerInfo: MakerInfo | MakerInfo[]Optional
txParams: TxParamsOptional
referrerInfo: ReferrerInfoOptional
cancelExistingOrders: booleanOptional
settlePnl: booleanOptional
makerInfo: MakerInfo | MakerInfo[]Optional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
subAccountId: numberOptional
cancelExistingOrders: booleanOptional
settlePnl: booleanOptional
exitEarlyIfSimFails: booleanOptional
fulfillmentConfig: SerumV3FulfillmentConfigAccountOptional
makerInfo: MakerInfoOptional
referrerInfo: ReferrerInfoOptional
txParams: TxParamsOptional
subAccountId: numberOptional
txParams: TxParamsOptional
subAccountId: numberOptional
txParams: TxParamsOptional
subAccountId: numberOptional
txParams: TxParamsOptional
liquidatorSubAccountId: numberOptional
txParams: TxParamsOptional
liquidatorSubAccountId: numberSends a market order and returns a signed tx which can fill the order against the vamm, which the caller can use to fill their own order if required.
Optional
makerInfo: MakerInfo | MakerInfo[]Optional
txParams: TxParamsOptional
referrerInfo: ReferrerInfoOptional
cancelExistingOrders: booleanBuilds and returns an extra transaciton to cancel the existing orders in the same perp market. Intended use is to auto-cancel TP/SL orders when closing a position. Ignored if orderParams.marketType is not MarketType.PERP
Optional
settlePnl: booleanOptional
additionalSigners: Signer[]Optional
opts: ConfirmOptionsOptional
preSigned: booleanOptional
txParams: TxParamsOptional
txParams: TxParamsOptional
opts: { Optional
filterOptional
txParams: TxParamsSwap tokens in drift account using jupiter
Optional
inOptional
onlyOptional
outOptional
reduceOptional
route?: RouteOptional
slippageOptional
swapOptional
txOptional
v6?: { Optional
quote?: QuoteResponseOptional
data: anyOptional
txParams: TxParamsOptional
fillerPublicKey: PublicKeyOptional
minBorrowRate: numberOptional
fuelBoostDeposits: numberOptional
fuelBoostBorrows: numberOptional
fuelBoostTaker: numberOptional
fuelBoostMaker: numberOptional
fuelBoostInsurance: numberOptional
txParams: TxParamsOptional
fillerPublicKey: PublicKeyOptional
txParams: TxParamsOptional
fillerPublicKey: PublicKeyUpdate the wallet to use for drift transactions and linked user account
Optional
subAccountIds: number[]Optional
activeSubAccountId: numberOptional
includeDelegates: booleanOptional
authoritySubaccountMap: Map<string, number[]>Optional
subAccountId: numberOptional
txParams: TxParamsOptional
opts: { Optional
dustGenerated using TypeDoc
DriftClient
This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.