Options
All
  • Public
  • Public/Protected
  • All
Menu

@blockworks-foundation/mango-v4

Index

Type aliases

AccountInfoMap: Map<string, AccountInfo<Buffer> | null>
AmmLabel: "Aldrin" | "Crema" | "Cropper" | "Cykura" | "DeltaFi" | "GooseFX" | "Invariant" | "Lifinity" | "Lifinity V2" | "Marinade" | "Mercurial" | "Meteora" | "Raydium" | "Raydium CLMM" | "Saber" | "Serum" | "Orca" | "Step" | "Penguin" | "Saros" | "Stepn" | "Orca (Whirlpools)" | "Sencha" | "Saber (Decimals)" | "Dradex" | "Balansol" | "Openbook" | "Unknown"
Modify<T, R>: Omit<T, keyof R> & R

Type parameters

  • T

  • R

OracleConfig: { confFilter: I80F48; maxStalenessSlots: BN }

Type declaration

  • confFilter: I80F48
  • maxStalenessSlots: BN
OracleConfigDto: { confFilter: I80F48Dto; maxStalenessSlots: BN }

Type declaration

ParsedFillEvent: Modify<FillEvent, { price: number; quantity: number }>
PerpMarketIndex: number & As<"perp-market-index">
PlatformFee: { feeAccount: string; feeBps: number }

Type declaration

  • feeAccount: string
  • feeBps: number
QuoteMintToReferrer: Map<TokenMintAddress, string>
Routes: { bestRoute: RouteInfo | null; routes: RouteInfo[] }

Type declaration

StablePriceModel: { delayAccumulatorPrice: number; delayAccumulatorTime: number; delayGrowthLimit: number; delayIntervalSeconds: number; delayPrices: number[]; lastDelayIntervalIndex: number; lastUpdateTimestamp: BN; stableGrowthLimit: number; stablePrice: number }

Type declaration

  • delayAccumulatorPrice: number
  • delayAccumulatorTime: number
  • delayGrowthLimit: number
  • delayIntervalSeconds: number
  • delayPrices: number[]
  • lastDelayIntervalIndex: number
  • lastUpdateTimestamp: BN
  • stableGrowthLimit: number
  • stablePrice: number
Token: { address: string; chainId: number; decimals: number; extensions: { coingeckoId?: string }; logoURI: string; name: string; symbol: string; tags: string[] }

Type declaration

  • address: string
  • chainId: number
  • decimals: number
  • extensions: { coingeckoId?: string }
    • Optional coingeckoId?: string
  • logoURI: string
  • name: string
  • symbol: string
  • tags: string[]
TokenIndex: number & As<"token-index">
TokenMintAddress: string

Variables

I64_MAX_BN: BN = ...
MANGO_ROUTER_API_URL: "https://api.mngo.cloud/router/v1" = 'https://api.mngo.cloud/router/v1'
MANGO_V4_ID: { devnet: PublicKey; mainnet-beta: PublicKey; testnet: PublicKey } = ...

Type declaration

  • devnet: PublicKey
  • mainnet-beta: PublicKey
  • testnet: PublicKey
NullPerpEditParams: PerpEditParams = ...
NullTokenEditParams: TokenEditParams = ...
OPENBOOK_PROGRAM_ID: { devnet: PublicKey; mainnet-beta: PublicKey } = ...

Type declaration

  • devnet: PublicKey
  • mainnet-beta: PublicKey
QUOTE_DECIMALS: 6 = 6
TrueIxGateParams: IxGateParams = ...
U64_MAX_BN: BN = ...

Functions

  • RUST_I64_MAX(): BN
  • RUST_I64_MIN(): BN
  • RUST_U64_MAX(): BN
  • bpsToDecimal(bps: number): number
  • Parameters

    • bps: number

    Returns number

  • buildIxGate(p: IxGateParams): BN
  • buildVersionedTx(provider: AnchorProvider, ix: TransactionInstruction[], additionalSigners?: Signer[], alts?: AddressLookupTableAccount[]): Promise<VersionedTransaction>
  • Parameters

    • provider: AnchorProvider
    • ix: TransactionInstruction[]
    • additionalSigners: Signer[] = []
    • alts: AddressLookupTableAccount[] = []

    Returns Promise<VersionedTransaction>

  • createAssociatedTokenAccountIdempotentInstruction(payer: PublicKey, owner: PublicKey, mint: PublicKey): Promise<TransactionInstruction>
  • Parameters

    • payer: PublicKey
    • owner: PublicKey
    • mint: PublicKey

    Returns Promise<TransactionInstruction>

  • fetchJupiterTransaction(connection: Connection, selectedRoute: RouteInfo, userPublicKey: PublicKey, slippage: number, inputMint: PublicKey, outputMint: PublicKey): Promise<[TransactionInstruction[], AddressLookupTableAccount[]]>
  • Parameters

    • connection: Connection
    • selectedRoute: RouteInfo
    • userPublicKey: PublicKey
    • slippage: number
    • inputMint: PublicKey
    • outputMint: PublicKey

    Returns Promise<[TransactionInstruction[], AddressLookupTableAccount[]]>

  • fetchRoutes(inputMint: any, outputMint: any, amount?: string, slippage?: number, swapMode?: string, feeBps?: string, wallet?: PublicKey): Promise<Routes>
  • Parameters

    • inputMint: any
    • outputMint: any
    • amount: string = '0'
    • slippage: number = 50
    • swapMode: string = 'ExactIn'
    • feeBps: string = '0'
    • wallet: PublicKey = PublicKey.default

    Returns Promise<Routes>

  • getAssociatedTokenAddress(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<PublicKey>
  • Get the address of the associated token account for a given mint and owner

    Parameters

    • mint: PublicKey

      Token mint account

    • owner: PublicKey

      Owner of the new account

    • allowOwnerOffCurve: boolean = false

      Allow the owner account to be a PDA (Program Derived Address)

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    • associatedTokenProgramId: PublicKey = ASSOCIATED_TOKEN_PROGRAM_ID

      SPL Associated Token program account

    Returns Promise<PublicKey>

    Address of the associated token account

  • percentageToDecimal(percentage: number): number
  • Parameters

    • percentage: number

    Returns number

  • prepareMangoRouterInstructions(selectedRoute: RouteInfo, inputMint: PublicKey, outputMint: PublicKey, userPublicKey: PublicKey): Promise<[TransactionInstruction[], AddressLookupTableAccount[]]>
  • Parameters

    • selectedRoute: RouteInfo
    • inputMint: PublicKey
    • outputMint: PublicKey
    • userPublicKey: PublicKey

    Returns Promise<[TransactionInstruction[], AddressLookupTableAccount[]]>

  • toNative(uiAmount: number, decimals: number): BN
  • Parameters

    • uiAmount: number
    • decimals: number

    Returns BN

  • toNativeI80F48(uiAmount: number, decimals: number): I80F48
  • toNativeI80F48ForQuote(uiAmount: number): I80F48
  • toUiDecimals(nativeAmount: number | BN | I80F48, decimals: number): number
  • Parameters

    • nativeAmount: number | BN | I80F48
    • decimals: number

    Returns number

  • toUiDecimalsForQuote(nativeAmount: number | BN | I80F48): number

Generated using TypeDoc