mango-v4-ui/types/jupiter.ts

155 lines
3.4 KiB
TypeScript

import { AccountInfo, PublicKey, TransactionInstruction } from '@solana/web3.js'
import Decimal from 'decimal.js'
export declare type SideType = typeof Side.Ask | typeof Side.Bid
export declare const Side: {
Bid: {
// eslint-disable-next-line @typescript-eslint/ban-types
bid: {}
}
Ask: {
// eslint-disable-next-line @typescript-eslint/ban-types
ask: {}
}
}
export interface QuoteParams {
sourceMint: string
destinationMint: string
amount: number
swapMode: SwapMode
}
export declare type TokenMintAddress = string
export interface Quote {
notEnoughLiquidity: boolean
minInAmount?: number
minOutAmount?: number
inAmount: number
outAmount: number
feeAmount: number
feeMint: TokenMintAddress
feePct: number
priceImpactPct: number
}
export declare type QuoteMintToReferrer = Map<TokenMintAddress, string>
export interface SwapParams {
sourceMint: string
destinationMint: string
userSourceTokenAccount: string
userDestinationTokenAccount: string
userTransferAuthority: string
/**
* amount is used for instruction and can be null when it is an intermediate swap, only the first swap has an amount
*/
amount: number
swapMode: SwapMode
openOrdersAddress?: string
quoteMintToReferrer?: QuoteMintToReferrer
}
export declare type PlatformFee = {
feeBps: number
feeAccount: string
}
export interface ExactOutSwapParams extends SwapParams {
inAmount: number
slippageBps: number
platformFee?: PlatformFee
overflowFeeAccount?: string
}
export declare type AccountInfoMap = Map<string, AccountInfo<Buffer> | null>
export declare type 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'
export interface TransactionFeeInfo {
signatureFee: number
openOrdersDeposits: number[]
ataDeposits: number[]
totalFeeAndDeposits: number
minimumSOLForTransaction: number
}
export declare enum SwapMode {
ExactIn = 'ExactIn',
ExactOut = 'ExactOut',
}
export interface Fee {
amount: number
mint: string
pct: number
}
export interface MarketInfo {
id: string
inAmount: number
inputMint: string
label: string
lpFee: Fee
notEnoughLiquidity: boolean
outAmount: number
outputMint: string
platformFee: Fee
priceImpactPct: number
}
export interface RouteInfo {
amount: number
inAmount: number
marketInfos: MarketInfo[]
otherAmountThreshold: number
outAmount: number
priceImpactPct: number
slippageBps: number
swapMode: SwapMode
instructions?: TransactionInstruction[]
mints?: PublicKey[]
routerName?: 'Mango'
}
export type Routes = {
routesInfos: RouteInfo[]
cached: boolean
}
export interface Token {
chainId: number // 101,
address: string // 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
symbol: string // e.g. 'USDC',
name: string // 'Wrapped USDC',
decimals: number // 6,
logoURI: string // 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BXXkv6z8ykpG1yuvUDPgh732wzVHB69RnB9YgSYh3itW/logo.png',
tags: string[] // [ 'stablecoin' ]
extensions?: {
coingeckoId: string
}
amount?: Decimal
amountWithBorrow?: Decimal
}