Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • MangoClient

Index

Constructors

Properties

Accessors

Methods

Constructors

  • new MangoClient(program: Program<MangoV4>, programId: PublicKey, cluster: Cluster, opts?: MangoClientOptions): MangoClient

Properties

cluster: Cluster
estimateFee: boolean
fallbackOracleConfig: FallbackOracleConfig = 'never'
fixedFallbacks: Map<string, [PublicKey, PublicKey]> = ...
idsSource: IdsSource
multipleConnections: Connection[] = []
openbookFeesToDao: boolean
opts: MangoClientOptions = {}
postSendTxCallback?: (callbackOpts: TxCallbackOptions) => void

Type declaration

    • (callbackOpts: TxCallbackOptions): void
    • Parameters

      • callbackOpts: TxCallbackOptions

      Returns void

postTxConfirmationCallback?: (callbackOpts: TxCallbackOptions) => void

Type declaration

    • (callbackOpts: TxCallbackOptions): void
    • Parameters

      • callbackOpts: TxCallbackOptions

      Returns void

prependedGlobalAdditionalInstructions: TransactionInstruction[] = []
prioritizationFee: number
program: Program<MangoV4>
programId: PublicKey
txConfirmationCommitment: Commitment

Accessors

  • get connection(): Connection
  • get walletPk(): PublicKey

Methods

  • accountBuybackFeesWithMngoIx(group: Group, mangoAccount: MangoAccount, maxBuybackUsd?: number): Promise<TransactionInstruction>
  • accountExpandV2(group: Group, account: MangoAccount, tokenCount: number, serum3Count: number, perpCount: number, perpOoCount: number, tokenConditionalSwapCount: number): Promise<MangoSignatureStatus>
  • accountExpandV2Ix(group: Group, account: MangoAccount, tokenCount: number, serum3Count: number, perpCount: number, perpOoCount: number, tokenConditionalSwapCount: number): Promise<TransactionInstruction>
  • Parameters

    • group: Group
    • account: MangoAccount
    • tokenCount: number
    • serum3Count: number
    • perpCount: number
    • perpOoCount: number
    • tokenConditionalSwapCount: number

    Returns Promise<TransactionInstruction>

  • accountExpandV3(group: Group, account: MangoAccount, tokenCount: number, serum3Count: number, perpCount: number, perpOoCount: number, tokenConditionalSwapCount: number, openbookV2Count: number): Promise<MangoSignatureStatus>
  • accountExpandV3Ix(group: Group, account: MangoAccount, tokenCount: number, serum3Count: number, perpCount: number, perpOoCount: number, tokenConditionalSwapCount: number, openbookV2Count: number): Promise<TransactionInstruction>
  • Parameters

    • group: Group
    • account: MangoAccount
    • tokenCount: number
    • serum3Count: number
    • perpCount: number
    • perpOoCount: number
    • tokenConditionalSwapCount: number
    • openbookV2Count: number

    Returns Promise<TransactionInstruction>

  • Builds health remaining accounts.

    For single mango account it builds a list of PublicKeys which is compatbile with Fixed account retriever.

    For multiple mango accounts it uses same logic as for fixed but packing all banks, then perp markets, and then serum oo accounts, which should always be compatible with Scanning account retriever.

    Parameters

    • group: Group
    • mangoAccounts: MangoAccount[]
    • banks: Bank[] = []

      banks in which new positions might be opened

    • perpMarkets: PerpMarket[] = []

      markets in which new positions might be opened

    • serumOpenOrdersForMarket: [Serum3Market, PublicKey][] = []

      markets in which new positions might be opened (openbook v1)

    • openbookOpenOrdersForMarket: [OpenbookV2Market, PublicKey][] = []

      markets in which new positions might be opened (openbook v2)

    Returns Promise<PublicKey[]>

  • Note: this ix doesn't settle liabs, reduce open positions, or withdraw tokens to wallet, it simply closes the account. To close successfully ensure all positions are closed, or use forceClose flag

    Parameters

    Returns Promise<MangoSignatureStatus>

  • createMangoAccount(group: Group, accountNumber?: number, name?: string, tokenCount?: number, serum3Count?: number, perpCount?: number, perpOoCount?: number): Promise<MangoSignatureStatus>
  • deriveFallbackOracleContexts(group: Group): Promise<Map<string, [PublicKey, PublicKey]>>
  • This function assumes that the provided group has loaded banks

    Parameters

    Returns Promise<Map<string, [PublicKey, PublicKey]>>

  • estimatePrioritizationFee(ixs: TransactionInstruction[]): Promise<number>
  • Returns an estimate of a prioritization fee for a set of instructions.

    The estimate is based on the median fees of writable accounts that will be involved in the transaction.

    Parameters

    • ixs: TransactionInstruction[]

      the instructions that make up the transaction

    Returns Promise<number>

    prioritizationFeeEstimate -- in microLamports

  • getAllMangoAccounts(group: Group, loadSerum3Oo?: boolean, loadOpenbookV2Oo?: boolean): Promise<MangoAccount[]>
  • getBanksForGroup(group: Group): Promise<Bank[]>
  • getGroup(groupPk: PublicKey): Promise<Group>
  • getGroupForCreator(creatorPk: PublicKey, groupNum: number): Promise<Group>
  • getGroupsForCreator(creatorPk: PublicKey): Promise<Group[]>
  • getIds(groupPk: PublicKey): Promise<undefined | Id>
  • getMangoAccount(mangoAccountPk: PublicKey, loadSerum3Oo?: boolean, loadOpenbookV2Oo?: boolean): Promise<MangoAccount>
  • getMangoAccountForOwner(group: Group, ownerPk: PublicKey, accountNumber: number, loadSerum3Oo?: boolean, loadOpenbookV2Oo?: boolean): Promise<undefined | MangoAccount>
  • getMangoAccountFromAi(mangoAccountPk: PublicKey, ai: AccountInfo<Buffer>): MangoAccount
  • getMangoAccountFromPk(mangoAccountPk: PublicKey): Promise<MangoAccount>
  • getMangoAccountWithSlot(mangoAccountPk: PublicKey, loadSerum3Oo?: boolean, loadOpenbookV2Oo?: boolean): Promise<undefined | { slot: number; value: MangoAccount }>
  • Parameters

    • mangoAccountPk: PublicKey
    • loadSerum3Oo: boolean = false
    • loadOpenbookV2Oo: boolean = false

    Returns Promise<undefined | { slot: number; value: MangoAccount }>

  • getMangoAccountsForDelegate(group: Group, delegate: PublicKey, loadSerum3Oo?: boolean, loadOpenbookV2Oo?: boolean): Promise<MangoAccount[]>
  • getMangoAccountsForOwner(group: Group, ownerPk: PublicKey, loadSerum3Oo?: boolean, loadOpenbookV2Oo?: boolean): Promise<MangoAccount[]>
  • groupChangeInsuranceFund(group: Group, withdrawDestination: PublicKey, newInsuranceMint: PublicKey): Promise<MangoSignatureStatus>
  • groupCreate(groupNum: number, testing: boolean, version: number, insuranceMintPk: PublicKey): Promise<MangoSignatureStatus>
  • groupEdit(group: Group, admin?: PublicKey, fastListingAdmin?: PublicKey, securityAdmin?: PublicKey, testing?: number, version?: number, depositLimitQuote?: BN, feesPayWithMngo?: boolean, feesMngoBonusRate?: number, feesSwapMangoAccount?: PublicKey, feesMngoTokenIndex?: TokenIndex, feesExpiryInterval?: BN, allowedFastListingsPerInterval?: number, collateralFeeInterval?: BN): Promise<MangoSignatureStatus>
  • Parameters

    • group: Group
    • Optional admin: PublicKey
    • Optional fastListingAdmin: PublicKey
    • Optional securityAdmin: PublicKey
    • Optional testing: number
    • Optional version: number
    • Optional depositLimitQuote: BN
    • Optional feesPayWithMngo: boolean
    • Optional feesMngoBonusRate: number
    • Optional feesSwapMangoAccount: PublicKey
    • Optional feesMngoTokenIndex: TokenIndex
    • Optional feesExpiryInterval: BN
    • Optional allowedFastListingsPerInterval: number
    • Optional collateralFeeInterval: BN

    Returns Promise<MangoSignatureStatus>

  • marginTrade(__namedParameters: { amountIn: number; flashLoanType: FlashLoanType; group: Group; inputMintPk: PublicKey; mangoAccount: MangoAccount; outputMintPk: PublicKey; userDefinedAlts: AddressLookupTableAccount[]; userDefinedInstructions: TransactionInstruction[] }): Promise<MangoSignatureStatus>
  • Parameters

    • __namedParameters: { amountIn: number; flashLoanType: FlashLoanType; group: Group; inputMintPk: PublicKey; mangoAccount: MangoAccount; outputMintPk: PublicKey; userDefinedAlts: AddressLookupTableAccount[]; userDefinedInstructions: TransactionInstruction[] }
      • amountIn: number
      • flashLoanType: FlashLoanType
      • group: Group
      • inputMintPk: PublicKey
      • mangoAccount: MangoAccount
      • outputMintPk: PublicKey
      • userDefinedAlts: AddressLookupTableAccount[]
      • userDefinedInstructions: TransactionInstruction[]

    Returns Promise<MangoSignatureStatus>

  • openbookV2CancelAllOrdersIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey, side?: OpenbookV2Side, limit?: number): Promise<TransactionInstruction>
  • openbookV2CancelOrderIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey, side: OpenbookV2Side, orderId: BN): Promise<TransactionInstruction>
  • openbookV2CloseOpenOrdersIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<TransactionInstruction>
  • openbookV2CreateOpenOrdersIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<{ ix: TransactionInstruction; openOrdersAccount: PublicKey }>
  • openbookV2EditMarket(group: Group, openbookV2MarketIndex: MarketIndex, reduceOnly: null | boolean, forceClose: null | boolean, name: null | string, oraclePriceBand: null | number): Promise<MangoSignatureStatus>
  • openbookV2GetMarkets(group: Group, baseTokenIndex?: number, quoteTokenIndex?: number): Promise<OpenbookV2Market[]>
  • openbookV2RegisterMarket(group: Group, openbookV2MarketExternalPk: PublicKey, baseBank: Bank, quoteBank: Bank, marketIndex: number, name: string, oraclePriceBand: number): Promise<MangoSignatureStatus>
  • openbookV2SettleFundsIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<TransactionInstruction>
  • openbookV2SettleFundsV2Ix(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<TransactionInstruction>
  • perpCancelOrderByClientOrderIdIx(group: Group, mangoAccount: MangoAccount, perpMarketIndex: PerpMarketIndex, clientOrderId: BN): Promise<TransactionInstruction>
  • perpConsumeEventsIx(group: Group, perpMarketIndex: PerpMarketIndex, accounts: PublicKey[], limit: number): Promise<TransactionInstruction>
  • perpCreateMarket(group: Group, oraclePk: PublicKey, perpMarketIndex: number, name: string, oracleConfig: OracleConfigParams, baseDecimals: number, quoteLotSize: number, baseLotSize: number, maintBaseAssetWeight: number, initBaseAssetWeight: number, maintBaseLiabWeight: number, initBaseLiabWeight: number, maintOverallAssetWeight: number, initOverallAssetWeight: number, baseLiquidationFee: number, makerFee: number, takerFee: number, feePenalty: number, minFunding: number, maxFunding: number, impactQuantity: number, groupInsuranceFund: boolean, settleFeeFlat: number, settleFeeAmountThreshold: number, settleFeeFractionLowHealth: number, settleTokenIndex: number, settlePnlLimitFactor: number, settlePnlLimitWindowSize: number, positivePnlLiquidationFee: number, platformLiquidationFee: number): Promise<MangoSignatureStatus>
  • Parameters

    • group: Group
    • oraclePk: PublicKey
    • perpMarketIndex: number
    • name: string
    • oracleConfig: OracleConfigParams
    • baseDecimals: number
    • quoteLotSize: number
    • baseLotSize: number
    • maintBaseAssetWeight: number
    • initBaseAssetWeight: number
    • maintBaseLiabWeight: number
    • initBaseLiabWeight: number
    • maintOverallAssetWeight: number
    • initOverallAssetWeight: number
    • baseLiquidationFee: number
    • makerFee: number
    • takerFee: number
    • feePenalty: number
    • minFunding: number
    • maxFunding: number
    • impactQuantity: number
    • groupInsuranceFund: boolean
    • settleFeeFlat: number
    • settleFeeAmountThreshold: number
    • settleFeeFractionLowHealth: number
    • settleTokenIndex: number
    • settlePnlLimitFactor: number
    • settlePnlLimitWindowSize: number
    • positivePnlLiquidationFee: number
    • platformLiquidationFee: number

    Returns Promise<MangoSignatureStatus>

  • perpPlaceOrderIx(group: Group, mangoAccount: MangoAccount, perpMarketIndex: PerpMarketIndex, side: PerpOrderSide, price: number, quantity: number, maxQuoteQuantity?: number, clientOrderId?: number, orderType?: PerpOrderType, reduceOnly?: boolean, expiryTimestamp?: number, limit?: number): Promise<TransactionInstruction>
  • perpPlaceOrderPeggedIx(group: Group, mangoAccount: MangoAccount, perpMarketIndex: PerpMarketIndex, side: PerpOrderSide, priceOffset: number, quantity: number, pegLimit?: number, maxQuoteQuantity?: number, clientOrderId?: number, orderType?: PerpOrderType, reduceOnly?: boolean, expiryTimestamp?: number, limit?: number): Promise<TransactionInstruction>
  • perpPlaceOrderPeggedV2Ix(group: Group, mangoAccount: MangoAccount, perpMarketIndex: PerpMarketIndex, side: PerpOrderSide, priceOffset: number, quantity: number, pegLimit?: number, maxQuoteQuantity?: number, clientOrderId?: number, orderType?: PerpOrderType, selfTradeBehavior?: PerpSelfTradeBehavior, reduceOnly?: boolean, expiryTimestamp?: number, limit?: number): Promise<TransactionInstruction>
  • perpUpdateFundingIx(group: Group, perpMarket: PerpMarket): Promise<TransactionInstruction>
  • sendAndConfirmTransaction(ixs: TransactionInstruction[], opts?: Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>): Promise<MangoSignatureStatus>
  • sendAndConfirmTransaction(ixs: TransactionInstruction[], opts?: { confirmInBackground: true } & Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>): Promise<MangoSignatureStatus>
  • Parameters

    • ixs: TransactionInstruction[]
    • Optional opts: Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>

    Returns Promise<MangoSignatureStatus>

  • Parameters

    • ixs: TransactionInstruction[]
    • Optional opts: { confirmInBackground: true } & Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>

    Returns Promise<MangoSignatureStatus>

  • sendAndConfirmTransactionForGroup(group: Group, ixs: TransactionInstruction[], opts?: Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>): Promise<MangoSignatureStatus>
  • sendAndConfirmTransactionForGroup(group: Group, ixs: TransactionInstruction[], opts?: { confirmInBackground: true } & Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>): Promise<MangoSignatureStatus>
  • Parameters

    • group: Group
    • ixs: TransactionInstruction[]
    • Optional opts: Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>

    Returns Promise<MangoSignatureStatus>

  • Parameters

    • group: Group
    • ixs: TransactionInstruction[]
    • Optional opts: { confirmInBackground: true } & Partial<{ additionalSigners: Keypair[]; alts: AddressLookupTableAccount[]; confirmInBackground: boolean; estimateFee: boolean; latestBlockhash: Readonly<LatestBlockhash>; multipleConnections: Connection[]; preflightCommitment: Commitment; prioritizationFee: number; txConfirmationCommitment: Commitment; postSendTxCallback: any; postTxConfirmationCallback: any }>

    Returns Promise<MangoSignatureStatus>

  • sequenceCheckIx(group: Group, mangoAccount: MangoAccount): Promise<TransactionInstruction>
  • serum3CancelAllOrdersIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey, limit?: number): Promise<TransactionInstruction>
  • serum3CancelOrderByClientIdIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey, clientOrderId: BN): Promise<TransactionInstruction>
  • serum3CancelOrderIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey, side: OpenbookV2Side, orderId: BN): Promise<TransactionInstruction>
  • serum3CloseOpenOrdersIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<TransactionInstruction>
  • serum3CreateOpenOrdersIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<TransactionInstruction>
  • serum3EditMarket(group: Group, serum3MarketIndex: MarketIndex, reduceOnly: null | boolean, forceClose: null | boolean, name: null | string, oraclePriceBand: null | number): Promise<MangoSignatureStatus>
  • serum3EditMarketIx(group: Group, serum3MarketIndex: MarketIndex, admin: PublicKey, reduceOnly: null | boolean, forceClose: null | boolean, name: null | string, oraclePriceBand: null | number): Promise<TransactionInstruction>
  • Parameters

    • group: Group
    • serum3MarketIndex: MarketIndex
    • admin: PublicKey
    • reduceOnly: null | boolean
    • forceClose: null | boolean
    • name: null | string
    • oraclePriceBand: null | number

    Returns Promise<TransactionInstruction>

  • serum3GetMarkets(group: Group, baseTokenIndex?: number, quoteTokenIndex?: number): Promise<Serum3Market[]>
  • serum3RegisterMarket(group: Group, serum3MarketExternalPk: PublicKey, baseBank: Bank, quoteBank: Bank, marketIndex: number, name: string, oraclePriceBand: number): Promise<MangoSignatureStatus>
  • serum3SettleFundsIx(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<TransactionInstruction>
  • serum3SettleFundsV2Ix(group: Group, mangoAccount: MangoAccount, externalMarketPk: PublicKey): Promise<TransactionInstruction>
  • tcsStopLossOnBorrow(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxBuyUi: null | number, pricePremium: null | number, allowMargin: null | boolean, expiryTimestamp: null | number): Promise<MangoSignatureStatus>
  • tcsStopLossOnBorrowIx(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxBuyUi: null | number, pricePremium: null | number, allowMargin: null | boolean, expiryTimestamp: null | number): Promise<TransactionInstruction[]>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • thresholdPrice: number
    • thresholdPriceInSellPerBuyToken: boolean
    • maxBuyUi: null | number
    • pricePremium: null | number
    • allowMargin: null | boolean
    • expiryTimestamp: null | number

    Returns Promise<TransactionInstruction[]>

  • tcsStopLossOnDeposit(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxSell: null | number, pricePremium: null | number, expiryTimestamp: null | number): Promise<MangoSignatureStatus>
  • tcsStopLossOnDepositIx(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxSell: null | number, pricePremium: null | number, expiryTimestamp: null | number): Promise<TransactionInstruction[]>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • thresholdPrice: number
    • thresholdPriceInSellPerBuyToken: boolean
    • maxSell: null | number
    • pricePremium: null | number
    • expiryTimestamp: null | number

    Returns Promise<TransactionInstruction[]>

  • tcsTakeProfitOnBorrow(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxBuyUi: null | number, pricePremium: null | number, allowMargin: null | boolean, expiryTimestamp: null | number): Promise<MangoSignatureStatus>
  • tcsTakeProfitOnBorrowIx(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxBuyUi: null | number, pricePremium: null | number, allowMargin: null | boolean, expiryTimestamp: null | number): Promise<TransactionInstruction[]>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • thresholdPrice: number
    • thresholdPriceInSellPerBuyToken: boolean
    • maxBuyUi: null | number
    • pricePremium: null | number
    • allowMargin: null | boolean
    • expiryTimestamp: null | number

    Returns Promise<TransactionInstruction[]>

  • tcsTakeProfitOnDeposit(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxSell: null | number, pricePremium: null | number, expiryTimestamp: null | number): Promise<MangoSignatureStatus>
  • tcsTakeProfitOnDepositIx(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, thresholdPrice: number, thresholdPriceInSellPerBuyToken: boolean, maxSell: null | number, pricePremium: null | number, expiryTimestamp: null | number): Promise<TransactionInstruction[]>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • thresholdPrice: number
    • thresholdPriceInSellPerBuyToken: boolean
    • maxSell: null | number
    • pricePremium: null | number
    • expiryTimestamp: null | number

    Returns Promise<TransactionInstruction[]>

  • tokenConditionalSwapCancelIx(group: Group, account: MangoAccount, tokenConditionalSwapId: BN): Promise<TransactionInstruction>
  • tokenConditionalSwapCreate(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, lowerLimitNativeNative: number, upperLimitNativeNative: number, maxBuy: number, maxSell: number, tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow", pricePremium: null | number, allowCreatingDeposits: boolean, allowCreatingBorrows: boolean, expiryTimestamp: null | number, displayPriceInSellTokenPerBuyToken: boolean): Promise<MangoSignatureStatus>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • lowerLimitNativeNative: number
    • upperLimitNativeNative: number
    • maxBuy: number
    • maxSell: number
    • tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow"
    • pricePremium: null | number
    • allowCreatingDeposits: boolean
    • allowCreatingBorrows: boolean
    • expiryTimestamp: null | number
    • displayPriceInSellTokenPerBuyToken: boolean

    Returns Promise<MangoSignatureStatus>

  • tokenConditionalSwapCreateIx(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, lowerLimitNativeNative: number, upperLimitNativeNative: number, maxBuy: number, maxSell: number, tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow", pricePremium: null | number, allowCreatingDeposits: boolean, allowCreatingBorrows: boolean, expiryTimestamp: null | number, displayPriceInSellTokenPerBuyToken: boolean): Promise<TransactionInstruction[]>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • lowerLimitNativeNative: number
    • upperLimitNativeNative: number
    • maxBuy: number
    • maxSell: number
    • tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow"
    • pricePremium: null | number
    • allowCreatingDeposits: boolean
    • allowCreatingBorrows: boolean
    • expiryTimestamp: null | number
    • displayPriceInSellTokenPerBuyToken: boolean

    Returns Promise<TransactionInstruction[]>

  • tokenConditionalSwapCreateLinearAuction(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, priceStart: number, priceEnd: number, maxBuy: number, maxSell: number, allowCreatingDeposits: boolean, allowCreatingBorrows: boolean, displayPriceInSellTokenPerBuyToken: boolean, startTimestamp: number, durationSeconds: number, expiryTimestamp: null | number): Promise<MangoSignatureStatus>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • priceStart: number
    • priceEnd: number
    • maxBuy: number
    • maxSell: number
    • allowCreatingDeposits: boolean
    • allowCreatingBorrows: boolean
    • displayPriceInSellTokenPerBuyToken: boolean
    • startTimestamp: number
    • durationSeconds: number
    • expiryTimestamp: null | number

    Returns Promise<MangoSignatureStatus>

  • tokenConditionalSwapCreateLinearAuctionIx(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, priceStart: number, priceEnd: number, maxBuy: number, maxSell: number, allowCreatingDeposits: boolean, allowCreatingBorrows: boolean, displayPriceInSellTokenPerBuyToken: boolean, startTimestamp: number, durationSeconds: number, expiryTimestamp: null | number): Promise<TransactionInstruction[]>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • priceStart: number
    • priceEnd: number
    • maxBuy: number
    • maxSell: number
    • allowCreatingDeposits: boolean
    • allowCreatingBorrows: boolean
    • displayPriceInSellTokenPerBuyToken: boolean
    • startTimestamp: number
    • durationSeconds: number
    • expiryTimestamp: null | number

    Returns Promise<TransactionInstruction[]>

  • tokenConditionalSwapCreatePremiumAuction(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, lowerLimit: number, upperLimit: number, maxBuy: number, maxSell: number, tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow", maxPricePremiumPercent: null | number, allowCreatingDeposits: boolean, allowCreatingBorrows: boolean, expiryTimestamp: null | number, displayPriceInSellTokenPerBuyToken: boolean, durationSeconds: number): Promise<MangoSignatureStatus>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • lowerLimit: number
    • upperLimit: number
    • maxBuy: number
    • maxSell: number
    • tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow"
    • maxPricePremiumPercent: null | number
    • allowCreatingDeposits: boolean
    • allowCreatingBorrows: boolean
    • expiryTimestamp: null | number
    • displayPriceInSellTokenPerBuyToken: boolean
    • durationSeconds: number

    Returns Promise<MangoSignatureStatus>

  • tokenConditionalSwapCreatePremiumAuctionIx(group: Group, account: MangoAccount, sellBank: Bank, buyBank: Bank, lowerLimitNative: number, upperLimitNative: number, maxBuy: number, maxSell: number, tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow", maxPricePremiumPercent: null | number, allowCreatingDeposits: boolean, allowCreatingBorrows: boolean, expiryTimestamp: null | number, displayPriceInSellTokenPerBuyToken: boolean, durationSeconds: any, premiumMultiplier?: number, extraPricePremiumBps?: number): Promise<TransactionInstruction[]>
  • Parameters

    • group: Group
    • account: MangoAccount
    • sellBank: Bank
    • buyBank: Bank
    • lowerLimitNative: number
    • upperLimitNative: number
    • maxBuy: number
    • maxSell: number
    • tcsIntention: null | "TakeProfitOnDeposit" | "StopLossOnDeposit" | "TakeProfitOnBorrow" | "StopLossOnBorrow"
    • maxPricePremiumPercent: null | number
    • allowCreatingDeposits: boolean
    • allowCreatingBorrows: boolean
    • expiryTimestamp: null | number
    • displayPriceInSellTokenPerBuyToken: boolean
    • durationSeconds: any
    • premiumMultiplier: number = 1
    • extraPricePremiumBps: number = 0

    Returns Promise<TransactionInstruction[]>

  • tokenConditionalSwapCreateRawIx(group: Group, account: MangoAccount, buyMintPk: PublicKey, sellMintPk: PublicKey, maxBuy: BN, maxSell: BN, expiryTimestamp: null | number, priceLowerLimit: number, priceUpperLimit: number, pricePremiumRate: number, allowCreatingDeposits: boolean, allowCreatingBorrows: boolean, priceDisplayStyle: TokenConditionalSwapDisplayPriceStyle, intention: TokenConditionalSwapIntention): Promise<TransactionInstruction[]>
  • tokenConditionalSwapTriggerIx(group: Group, liqee: MangoAccount, liqor: MangoAccount, tokenConditionalSwapId: BN, maxBuyTokenToLiqee: number, maxSellTokenToLiqor: number): Promise<TransactionInstruction>
  • tokenRegister(group: Group, mintPk: PublicKey, oraclePk: PublicKey, fallbackOraclePk: PublicKey, tokenIndex: number, name: string, params: TokenRegisterParams): Promise<MangoSignatureStatus>
  • tokenRegisterTrustless(group: Group, mintPk: PublicKey, oraclePk: PublicKey, tokenIndex: number, name: string): Promise<MangoSignatureStatus>
  • tokenUpdateIndexAndRateIx(group: Group, mintPk: PublicKey): Promise<TransactionInstruction>
  • tokenWithdrawNativeIx(group: Group, mangoAccount: MangoAccount, mintPk: PublicKey, nativeAmount: BN, allowBorrow: boolean): Promise<TransactionInstruction[]>
  • connect(provider: default, cluster: Cluster, programId: PublicKey, opts?: MangoClientOptions): MangoClient
  • Connect with defaults,

    • random ephemeral keypair,
    • fetch ids using gPa
    • connects to mainnet-beta
    • uses well known program Id

    Parameters

    • clusterUrl: string

    Returns MangoClient

  • connectForGroupName(provider: default, groupName: string): MangoClient

Generated using TypeDoc