Class AdminClient

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.

Hierarchy

Constructors

Properties

Accessors

Methods

addAndSubscribeToUsers addInsuranceFundStake addPerpLpShares addPerpMarketToRemainingAccountMaps addPhoenixRemainingAccounts addSerumRemainingAccounts addSpotFulfillmentAccounts addSpotMarketToRemainingAccountMaps addUser buildTransaction cancelAndPlaceOrders cancelOrder cancelOrderByUserId cancelOrders cancelOrdersByIds cancelRequestRemoveInsuranceFundStake closePosition convertToPerpPrecision convertToPricePrecision convertToSpotPrecision createAssociatedTokenAccountIdempotentInstruction createUser deleteInitializedPerpMarket deleteUser deposit depositIntoPerpMarketFeePool depositIntoSpotMarketRevenuePool fetchAccounts fetchAllUserAccounts fetchMarketLookupTableAccount fetchReferrerNameAccount fillPerpOrder fillSpotOrder forceCancelOrders forceGetPerpMarketAccount forceGetSpotMarketAccount forceGetStateAccount forceGetUserAccount getAddInsuranceFundStakeIx getAddPerpLpSharesIx getAssociatedTokenAccount getAssociatedTokenAccountCreationIx getCancelOrderByUserIdIx getCancelOrderIx getCancelOrdersByIdsIx getCancelOrdersIx getDepositInstruction getFillPerpOrderIx getFillSpotOrderIx getForceCancelOrdersIx getInitializeInsuranceFundStakeIx getInitializeUserInstructions getInitializeUserStatsIx getJupiterSwapIx getLiquidateBorrowForPerpPnlIx getLiquidatePerpIx getLiquidatePerpPnlForDepositIx getLiquidateSpotIx getMarketIndexAndType getModifyOrderByUserIdIx getModifyOrderIx getNextSubAccountId getOracleDataForPerpMarket getOracleDataForSpotMarket getOraclePriceDataAndSlot getOrder getOrderByUserId getPerpMarketAccount getPerpMarketAccounts getPerpMarketExtendedInfo getPhoenixV1FulfillmentConfig getPlaceAndMakePerpOrderIx getPlaceAndMakeSpotOrderIx getPlaceAndTakePerpOrderIx getPlaceAndTakeSpotOrderIx getPlaceOrdersIx getPlacePerpOrderIx getPlaceSpotOrderIx getQuoteAssetTokenAmount getQuoteSpotMarketAccount getQuoteValuePerLpShare getReferredUserStatsAccountsByReferrer getReferrerNameAccountsForAuthority getRemainingAccountMapsForUsers getRemainingAccounts getRemovePerpLpSharesInExpiringMarket getRemovePerpLpSharesIx getResolvePerpBankruptcyIx getResolvePerpPnlDeficitIx getResolveSpotBankruptcyIx getRevertFillIx getSerumV3FulfillmentConfig getSettleExpiredMarketIx getSettleFundingPaymentIx getSettlePNLsIxs getSignerPublicKey getSpotMarketAccount getSpotMarketAccounts getSpotPosition getStakeForMSOLIx getStateAccount getStatePublicKey getSwapIx getTokenAmount getTransferDepositIx getTriggerOrderIx getUpdateAMMsIx getUpdateFundingRateIx getUpdatePerpBidAskTwapIx getUpdateUserIdleIx getUpdateUserMarginTradingEnabledIx getUpdateUserOpenOrdersCountIx getUser getUserAccount getUserAccountAndSlot getUserAccountPublicKey getUserAccountsAndAddressesForAuthority getUserAccountsForAuthority getUserAccountsForDelegate getUserMapKey getUserStats getUserStatsAccountPublicKey getUsers getWithdrawIx getWrappedSolAccountCreationIxs hasUser initialize initializeInsuranceFundStake initializePerpMarket initializePhoenixFulfillmentConfig initializeReferrerName initializeSerumFulfillmentConfig initializeSpotMarket initializeUserAccount initializeUserAccountAndDepositCollateral initializeUserAccountForDevnet liquidateBorrowForPerpPnl liquidatePerp liquidatePerpPnlForDeposit liquidateSpot modifyOrder modifyOrderByUserOrderId modifyPerpOrder modifyPerpOrderByUserOrderId moveAmmPrice moveAmmToPrice mustIncludeMarketsInIx openPosition placeAndMakePerpOrder placeAndMakeSpotOrder placeAndTakePerpOrder placeAndTakeSpotOrder placeOrders placePerpOrder placeSpotOrder removeInsuranceFundStake removePerpLpShares removePerpLpSharesInExpiringMarket repegAmmCurve requestRemoveInsuranceFundStake resetPerpMarketAmmOracleTwap resolvePerpBankruptcy resolvePerpPnlDeficit resolveSpotBankruptcy sendMarketOrderAndGetSignedFillTx sendSignedTx sendTransaction settleExpiredMarket settleExpiredMarketPoolsToRevenuePool settleFundingPayment settleLP settleLPIx settlePNL settlePNLIx settlePNLs settleRevenueToInsuranceFund stakeForMSOL subscribe subscribeUsers swap switchActiveUser transferDeposit triggerEvent triggerOrder unsubscribe unsubscribeUsers updateAMMs updateAdmin updateAmmJitIntensity updateDiscountMint updateExchangeStatus updateFundingRate updateInitialPctToLiquidate updateInsuranceFundUnstakingPeriod updateK updateLiquidationDuration updateLpCooldownTime updateMaxSlippageRatio updateOracleGuardRails updatePerpAuctionDuration updatePerpBidAskTwap updatePerpFeeStructure updatePerpMarketAmmOracleTwap updatePerpMarketBaseSpread updatePerpMarketConcentrationScale updatePerpMarketContractTier updatePerpMarketCurveUpdateIntensity updatePerpMarketExpiry updatePerpMarketImfFactor updatePerpMarketLiquidationFee updatePerpMarketMarginRatio updatePerpMarketMaxFillReserveFraction updatePerpMarketMaxImbalances updatePerpMarketMaxOpenInterest updatePerpMarketMaxSpread updatePerpMarketMinOrderSize updatePerpMarketName updatePerpMarketOracle updatePerpMarketStatus updatePerpMarketStepSizeAndTickSize updatePerpMarketTargetBaseAssetAmountPerLp updatePerpMarketUnrealizedAssetWeight updateSerumFulfillmentConfigStatus updateSerumVault updateSpotAuctionDuration updateSpotFeeStructure updateSpotMarketAssetTier updateSpotMarketBorrowRate updateSpotMarketCumulativeInterest updateSpotMarketCumulativeInterestIx updateSpotMarketExpiry updateSpotMarketIfFactor updateSpotMarketLiquidationFee updateSpotMarketMarginWeights updateSpotMarketMaxTokenDeposits updateSpotMarketMinOrderSize updateSpotMarketName updateSpotMarketOracle updateSpotMarketOrdersEnabled updateSpotMarketRevenueSettlePeriod updateSpotMarketStatus updateSpotMarketStepSizeAndTickSize updateStateSettlementDuration updateUserCustomMarginRatio updateUserDelegate updateUserIdle updateUserMarginTradingEnabled updateUserName updateUserOpenOrdersCount updateWallet updateWhitelistMint updateWithdrawGuardThreshold withdraw

Constructors

Properties

_isSubscribed: boolean = false
accountSubscriber: DriftClientAccountSubscriber
activeSubAccountId: number
authority: PublicKey
authoritySubAccountMap?: Map<string, number[]>
connection: Connection
eventEmitter: StrictEventEmitter<EventEmitter, DriftClientAccountEvents, DriftClientAccountEvents, "addEventListener" | "removeEventListener", "on" | "addListener" | "removeListener" | "once" | "emit">
includeDelegates?: boolean
lookupTableAccount: AddressLookupTableAccount
marketLookupTable: PublicKey
mustIncludePerpMarketIndexes: Set<number> = ...
mustIncludeSpotMarketIndexes: Set<number> = ...
opts?: ConfirmOptions
perpMarketLastSlotCache: Map<number, number> = ...
program: Program<Idl>
provider: AnchorProvider
signerPublicKey?: PublicKey
skipLoadUsers?: boolean
spotMarketLastSlotCache: Map<number, number> = ...
statePublicKey?: PublicKey
txParams: TxParams
txSender: TxSender
txVersion: TransactionVersion
userAccountSubscriptionConfig: UserSubscriptionConfig
userStats?: UserStats
userStatsAccountPublicKey: PublicKey
userStatsAccountSubscriptionConfig: UserStatsSubscriptionConfig
users: Map<string, User> = ...
wallet: IWallet

Accessors

  • get isSubscribed(): boolean
  • Returns boolean

  • set isSubscribed(val: boolean): void
  • Parameters

    • val: boolean

    Returns void

Methods

  • Add to an insurance fund stake and optionally initialize the account

    Parameters

    • __namedParameters: {
          amount: BN;
          collateralAccountPublicKey: PublicKey;
          fromSubaccount?: boolean;
          initializeStakeAccount?: boolean;
          marketIndex: number;
      }
      • amount: BN
      • collateralAccountPublicKey: PublicKey

        The account where the funds to stake come from. Usually an associated token account

      • Optional fromSubaccount?: boolean

        Optional -- withdraw from current subaccount to fund stake amount, instead of wallet balance

      • Optional initializeStakeAccount?: boolean

        Add instructions to initialize the staking account -- required if its the first time the currrent authority has staked in this market

      • marketIndex: number

        Spot market index

    Returns Promise<string>

  • Parameters

    • marketIndex: number
    • writable: boolean
    • oracleAccountMap: Map<string, AccountMeta>
    • spotMarketAccountMap: Map<number, AccountMeta>
    • perpMarketAccountMap: Map<number, AccountMeta>

    Returns void

  • Parameters

    • marketIndex: number
    • writable: boolean
    • oracleAccountMap: Map<string, AccountMeta>
    • spotMarketAccountMap: Map<number, AccountMeta>

    Returns void

  • Parameters

    • instructions: TransactionInstruction | TransactionInstruction[]
    • Optional txParams: TxParams
    • Optional txVersion: TransactionVersion
    • Optional lookupTables: AddressLookupTableAccount[]

    Returns Promise<Transaction | VersionedTransaction>

  • Converts an amount to the spot precision for a given market. The spot market precision is based on the token mint decimals.

    Parameters

    • marketIndex: number
    • amount: any

    Returns BN

  • Parameters

    • marketIndex: number

    Returns Promise<string>

  • Deposit funds into the given spot market

    Parameters

    • amount: BN
    • marketIndex: number
    • associatedTokenAccount: PublicKey

      can be the wallet public key if using native sol

    • Optional subAccountId: number
    • reduceOnly: boolean = false

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • amount: BN
    • sourceVault: PublicKey

    Returns Promise<string>

  • Parameters

    • amount: BN
    • marketIndex: number
    • userTokenAccount: PublicKey
    • Optional subAccountId: number
    • reduceOnly: boolean = false
    • userInitialized: boolean = true

    Returns Promise<TransactionInstruction>

  • Parameters

    • __namedParameters: {
          amount: BN;
          inAssociatedTokenAccount?: PublicKey;
          inMarketIndex: number;
          jupiterClient: JupiterClient;
          onlyDirectRoutes?: boolean;
          outAssociatedTokenAccount?: PublicKey;
          outMarketIndex: number;
          reduceOnly?: SwapReduceOnly;
          route?: Route;
          slippageBps?: number;
          swapMode?: SwapMode;
          userAccountPublicKey?: PublicKey;
      }
      • amount: BN
      • Optional inAssociatedTokenAccount?: PublicKey
      • inMarketIndex: number
      • jupiterClient: JupiterClient
      • Optional onlyDirectRoutes?: boolean
      • Optional outAssociatedTokenAccount?: PublicKey
      • outMarketIndex: number
      • Optional reduceOnly?: SwapReduceOnly
      • Optional route?: Route
      • Optional slippageBps?: number
      • Optional swapMode?: SwapMode
      • Optional userAccountPublicKey?: PublicKey

    Returns Promise<{
        ixs: TransactionInstruction[];
        lookupTables: AddressLookupTableAccount[];
    }>

  • Parameters

    • userAccountPublicKey: PublicKey
    • userAccount: UserAccount
    • assetMarketIndex: number
    • liabilityMarketIndex: number
    • maxLiabilityTransfer: BN
    • Optional limitPrice: BN

    Returns Promise<TransactionInstruction>

  • Returns the market index and type for a given market name E.g. "SOL-PERP" -> { marketIndex: 0, marketType: MarketType.PERP }

    Parameters

    • name: string

    Returns {
        marketIndex: number;
        marketType: MarketType;
    }

  • Parameters

    • __namedParameters: {
          auctionDuration?: number;
          auctionEndPrice?: BN;
          auctionStartPrice?: BN;
          immediateOrCancel?: boolean;
          maxTs?: BN;
          newBaseAmount?: BN;
          newDirection?: PositionDirection;
          newLimitPrice?: BN;
          newOraclePriceOffset?: number;
          newTriggerCondition?: OrderTriggerCondition;
          newTriggerPrice?: BN;
          policy?: ModifyOrderPolicy;
          postOnly?: boolean;
          reduceOnly?: boolean;
          txParams?: TxParams;
          userOrderId: number;
      }
      • Optional auctionDuration?: number
      • Optional auctionEndPrice?: BN
      • Optional auctionStartPrice?: BN
      • Optional immediateOrCancel?: boolean
      • Optional maxTs?: BN
      • Optional newBaseAmount?: BN
      • Optional newDirection?: PositionDirection
      • Optional newLimitPrice?: BN
      • Optional newOraclePriceOffset?: number
      • Optional newTriggerCondition?: OrderTriggerCondition
      • Optional newTriggerPrice?: BN
      • Optional policy?: ModifyOrderPolicy
      • Optional postOnly?: boolean
      • Optional reduceOnly?: boolean
      • Optional txParams?: TxParams
      • userOrderId: number

    Returns Promise<TransactionInstruction>

  • Parameters

    • __namedParameters: {
          auctionDuration?: number;
          auctionEndPrice?: BN;
          auctionStartPrice?: BN;
          immediateOrCancel?: boolean;
          maxTs?: BN;
          newBaseAmount?: BN;
          newDirection?: PositionDirection;
          newLimitPrice?: BN;
          newOraclePriceOffset?: number;
          newTriggerCondition?: OrderTriggerCondition;
          newTriggerPrice?: BN;
          orderId: number;
          policy?: ModifyOrderPolicy;
          postOnly?: boolean;
          reduceOnly?: boolean;
      }
      • Optional auctionDuration?: number
      • Optional auctionEndPrice?: BN
      • Optional auctionStartPrice?: BN
      • Optional immediateOrCancel?: boolean
      • Optional maxTs?: BN
      • Optional newBaseAmount?: BN
      • Optional newDirection?: PositionDirection
      • Optional newLimitPrice?: BN
      • Optional newOraclePriceOffset?: number
      • Optional newTriggerCondition?: OrderTriggerCondition
      • Optional newTriggerPrice?: BN
      • orderId: number
      • Optional policy?: ModifyOrderPolicy
      • Optional postOnly?: boolean
      • Optional reduceOnly?: boolean

    Returns Promise<TransactionInstruction>

  • Parameters

    Returns {
        oracleAccountMap: Map<string, AccountMeta>;
        perpMarketAccountMap: Map<number, AccountMeta>;
        spotMarketAccountMap: Map<number, AccountMeta>;
    }

    • oracleAccountMap: Map<string, AccountMeta>
    • perpMarketAccountMap: Map<number, AccountMeta>
    • spotMarketAccountMap: Map<number, AccountMeta>
  • Parameters

    • users: {
          settleeUserAccount: UserAccount;
          settleeUserAccountPublicKey: PublicKey;
      }[]
    • marketIndexes: number[]

    Returns Promise<TransactionInstruction[]>

  • Parameters

    • __namedParameters: {
          amount: BN;
          userAccountPublicKey?: PublicKey;
      }
      • amount: BN
      • Optional userAccountPublicKey?: PublicKey

    Returns Promise<TransactionInstruction[]>

  • Get the drift begin_swap and end_swap instructions

    Parameters

    • __namedParameters: {
          amountIn: BN;
          inMarketIndex: number;
          inTokenAccount: PublicKey;
          limitPrice?: BN;
          outMarketIndex: number;
          outTokenAccount: PublicKey;
          reduceOnly?: SwapReduceOnly;
          userAccountPublicKey?: PublicKey;
      }
      • amountIn: BN
      • inMarketIndex: number
      • inTokenAccount: PublicKey
      • Optional limitPrice?: BN
      • outMarketIndex: number
      • outTokenAccount: PublicKey
      • Optional reduceOnly?: SwapReduceOnly
      • Optional userAccountPublicKey?: PublicKey

    Returns Promise<{
        beginSwapIx: TransactionInstruction;
        endSwapIx: TransactionInstruction;
    }>

  • Returns the token amount for a given market. The spot market precision is based on the token mint decimals. Positive if it is a deposit, negative if it is a borrow.

    Parameters

    • marketIndex: number

    Returns BN

  • Parameters

    • amount: BN
    • marketIndex: number
    • fromSubAccountId: number
    • toSubAccountId: number

    Returns Promise<TransactionInstruction>

  • Parameters

    • amount: BN
    • marketIndex: number
    • userTokenAccount: PublicKey
    • reduceOnly: boolean = false

    Returns Promise<TransactionInstruction>

  • Parameters

    • amount: BN
    • Optional includeRent: boolean

    Returns Promise<{
        ixs: TransactionInstruction[];
        pubkey: PublicKey;
        signers: Signer[];
    }>

  • Parameters

    • marketIndex: number
    • priceOracle: PublicKey
    • baseAssetReserve: BN
    • quoteAssetReserve: BN
    • periodicity: BN
    • pegMultiplier: BN = PEG_PRECISION
    • oracleSource: OracleSource = OracleSource.PYTH
    • marginRatioInitial: number = 2000
    • marginRatioMaintenance: number = 500
    • liquidatorFee: number = 0
    • activeStatus: boolean = true
    • name: string = DEFAULT_MARKET_NAME

    Returns Promise<string>

  • Parameters

    • mint: PublicKey
    • optimalUtilization: number
    • optimalRate: number
    • maxRate: number
    • oracle: PublicKey
    • oracleSource: OracleSource
    • initialAssetWeight: number
    • maintenanceAssetWeight: number
    • initialLiabilityWeight: number
    • maintenanceLiabilityWeight: number
    • imfFactor: number = 0
    • liquidatorFee: number = 0
    • activeStatus: boolean = true
    • name: string = DEFAULT_MARKET_NAME

    Returns Promise<string>

  • Modifies an open order (spot or perp) by closing it and replacing it with a new order.

    Returns

    Parameters

    • orderParams: {
          auctionDuration?: number;
          auctionEndPrice?: BN;
          auctionStartPrice?: BN;
          immediateOrCancel?: boolean;
          maxTs?: BN;
          newBaseAmount?: BN;
          newDirection?: PositionDirection;
          newLimitPrice?: BN;
          newOraclePriceOffset?: number;
          newTriggerCondition?: OrderTriggerCondition;
          newTriggerPrice?: BN;
          orderId: number;
          policy?: ModifyOrderPolicy;
          postOnly?: boolean;
          reduceOnly?: boolean;
      }
      • Optional auctionDuration?: number
      • Optional auctionEndPrice?: BN
      • Optional auctionStartPrice?: BN
      • Optional immediateOrCancel?: boolean
      • Optional maxTs?: BN
      • Optional newBaseAmount?: BN
      • Optional newDirection?: PositionDirection
      • Optional newLimitPrice?: BN
      • Optional newOraclePriceOffset?: number
      • Optional newTriggerCondition?: OrderTriggerCondition
      • Optional newTriggerPrice?: BN
      • orderId: number
      • Optional policy?: ModifyOrderPolicy
      • Optional postOnly?: boolean
      • Optional reduceOnly?: boolean
    • Optional txParams: TxParams

    Returns Promise<string>

  • Modifies an open order by closing it and replacing it with a new order.

    Returns

    Parameters

    • orderParams: {
          auctionDuration?: number;
          auctionEndPrice?: BN;
          auctionStartPrice?: BN;
          immediateOrCancel?: boolean;
          maxTs?: BN;
          newBaseAmount?: BN;
          newDirection?: PositionDirection;
          newLimitPrice?: BN;
          newOraclePriceOffset?: number;
          newTriggerCondition?: OrderTriggerCondition;
          newTriggerPrice?: BN;
          policy?: ModifyOrderPolicy;
          postOnly?: boolean;
          reduceOnly?: boolean;
          userOrderId: number;
      }
      • Optional auctionDuration?: number
      • Optional auctionEndPrice?: BN
      • Optional auctionStartPrice?: BN
      • Optional immediateOrCancel?: boolean
      • Optional maxTs?: BN
      • Optional newBaseAmount?: BN
      • Optional newDirection?: PositionDirection
      • Optional newLimitPrice?: BN
      • Optional newOraclePriceOffset?: number
      • Optional newTriggerCondition?: OrderTriggerCondition
      • Optional newTriggerPrice?: BN
      • Optional policy?: ModifyOrderPolicy
      • Optional postOnly?: boolean
      • Optional reduceOnly?: boolean
      • userOrderId: number
    • Optional txParams: TxParams

    Returns Promise<string>

  • Modifies an open order by closing it and replacing it with a new order.

    Deprecated

    use modifyOrder instead

    Returns

    Parameters

    • orderId: number
    • Optional newBaseAmount: BN
    • Optional newLimitPrice: BN
    • Optional newOraclePriceOffset: number

    Returns Promise<string>

  • Modifies an open order by closing it and replacing it with a new order.

    Deprecated

    use modifyOrderByUserOrderId instead

    Returns

    Parameters

    • userOrderId: number
    • Optional newBaseAmount: BN
    • Optional newLimitPrice: BN
    • Optional newOraclePriceOffset: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • baseAssetReserve: BN
    • quoteAssetReserve: BN
    • Optional sqrtK: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • targetPrice: BN

    Returns Promise<string>

  • Each 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

    Parameters

    • __namedParameters: {
          perpMarketIndexes: number[];
          spotMarketIndexes: number[];
      }
      • perpMarketIndexes: number[]
      • spotMarketIndexes: number[]

    Returns void

  • Parameters

    • newPeg: BN
    • perpMarketIndex: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number

    Returns Promise<string>

  • Parameters

    • tx: Transaction | VersionedTransaction
    • Optional additionalSigners: Signer[]
    • Optional opts: ConfirmOptions
    • Optional preSigned: boolean

    Returns Promise<TxSigAndSlot>

  • Swap tokens in drift account using jupiter

    Parameters

    • __namedParameters: {
          amount: BN;
          inAssociatedTokenAccount?: PublicKey;
          inMarketIndex: number;
          jupiterClient: JupiterClient;
          outAssociatedTokenAccount?: PublicKey;
          outMarketIndex: number;
          reduceOnly?: SwapReduceOnly;
          route?: Route;
          slippageBps?: number;
          swapMode?: SwapMode;
          txParams?: TxParams;
      }

    Returns Promise<string>

  • Withdraws from the fromSubAccount and deposits into the toSubAccount

    Parameters

    • amount: BN
    • marketIndex: number
    • fromSubAccountId: number
    • toSubAccountId: number
    • Optional txParams: TxParams

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • ammJitIntensity: number

    Returns Promise<string>

  • Parameters

    • initialPctToLiquidate: number

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • insuranceWithdrawEscrowPeriod: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • sqrtK: BN

    Returns Promise<string>

  • Parameters

    • liquidationDuration: number

    Returns Promise<string>

  • Parameters

    • cooldownTime: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • maxSlippageRatio: number

    Returns Promise<string>

  • Parameters

    • minDuration: any

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • baseSpread: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • concentrationScale: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • curveUpdateIntensity: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • expiryTs: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • imfFactor: number
    • unrealizedPnlImfFactor: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • liquidatorFee: number
    • ifLiquidationFee: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • marginRatioInitial: number
    • marginRatioMaintenance: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • maxBaseAssetAmountRatio: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • unrealizedMaxImbalance: BN
    • maxRevenueWithdrawPerPeriod: BN
    • quoteMaxInsurance: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • maxOpenInterest: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • maxSpread: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • orderSize: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • name: string

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • stepSize: BN
    • tickSize: BN

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • targetBaseAssetAmountPerLP: number

    Returns Promise<string>

  • Parameters

    • perpMarketIndex: number
    • unrealizedInitialAssetWeight: number
    • unrealizedMaintenanceAssetWeight: number

    Returns Promise<string>

  • Parameters

    • defaultAuctionDuration: number

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • optimalUtilization: number
    • optimalBorrowRate: number
    • optimalMaxRate: number

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • expiryTs: BN

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • userIfFactor: BN
    • totalIfFactor: BN

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • liquidatorFee: number
    • ifLiquidationFee: number

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • initialAssetWeight: number
    • maintenanceAssetWeight: number
    • initialLiabilityWeight: number
    • maintenanceLiabilityWeight: number
    • imfFactor: number = 0

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • maxTokenDeposits: BN

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • orderSize: BN

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • name: string

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • ordersEnabled: boolean

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • revenueSettlePeriod: BN

    Returns Promise<string>

  • Parameters

    • spotMarketIndex: number
    • stepSize: BN
    • tickSize: BN

    Returns Promise<string>

  • Parameters

    • settlementDuration: number

    Returns Promise<string>

  • Update the wallet to use for drift transactions and linked user account

    Parameters

    • newWallet: IWallet
    • Optional subAccountIds: number[]
    • Optional activeSubAccountId: number
    • Optional includeDelegates: boolean
    • Optional authoritySubaccountMap: Map<string, number[]>

    Returns Promise<boolean>

  • Parameters

    • spotMarketIndex: number
    • withdrawGuardThreshold: BN

    Returns Promise<string>

  • Withdraws from a user account. If deposit doesn't already exist, creates a borrow

    Parameters

    • amount: BN
    • marketIndex: number
    • associatedTokenAddress: PublicKey

      the token account to withdraw to. can be the wallet public key if using native sol

    • reduceOnly: boolean = false

    Returns Promise<string>

Generated using TypeDoc