jupiter

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WrappedSOL = "So11111111111111111111111111111111111111112"
)

Variables

View Source
var (
	PriorityLevelNone     = PriorityLevel("")
	PriorityLevelMedium   = PriorityLevel("medium")   // 25%
	PriorityLevelHigh     = PriorityLevel("high")     // 50%
	PriorityLevelVeryHigh = PriorityLevel("veryHigh") // 75%
)

Functions

This section is empty.

Types

type Audit

type Audit struct {
	MintAuthorityDisabled   bool            `json:"mintAuthorityDisabled"`
	FreezeAuthorityDisabled bool            `json:"freezeAuthorityDisabled"`
	TopHoldersPercentage    decimal.Decimal `json:"topHoldersPercentage"`
}

type ErrorResponse

type ErrorResponse struct {
	Message   string `json:"error"`
	ErrorCode string `json:"errorCode"`
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type FirstPool

type FirstPool struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"createdAt"`
}

type JupiterClient

type JupiterClient struct {
	// contains filtered or unexported fields
}

func NewJupiterClient

func NewJupiterClient(apiUrl, apiKey string, transportProxy *http.Transport) *JupiterClient

func (*JupiterClient) Quote

func (client *JupiterClient) Quote(ctx context.Context, inputToken, outputToken string, amount *big.Int, slippageBps int) (*QuoteResponse, error)

func (*JupiterClient) SendSwapTransaction

func (client *JupiterClient) SendSwapTransaction(ctx context.Context, svcCtx *svc.ServiceContext, wallet *solana.Wallet, swapResponse *SwapResponse, maxRetries uint) (string, error)

func (*JupiterClient) Swap

func (client *JupiterClient) Swap(ctx context.Context, userWalletAddress string, quote *QuoteResponse, priorityLevel PriorityLevel, maxLamports int64) (*SwapResponse, error)

func (*JupiterClient) TokenStats

func (client *JupiterClient) TokenStats(ctx context.Context, tokenAddress string) (*TokenInfo, error)

type PlatformFee

type PlatformFee struct {
	Amount decimal.Decimal `json:"amount"`
	FeeBps int             `json:"feeBps"`
}

type PrioritizationFeeLamports

type PrioritizationFeeLamports struct {
	JitoTipLamports              int64                         `json:"jitoTipLamports,omitempty"`
	PriorityLevelWithMaxLamports *PriorityLevelWithMaxLamports `json:"priorityLevelWithMaxLamports,omitempty"`
}

type PriorityLevel

type PriorityLevel string

type PriorityLevelWithMaxLamports

type PriorityLevelWithMaxLamports struct {
	PriorityLevel PriorityLevel `json:"priorityLevel"`
	MaxLamports   int64         `json:"maxLamports"`
}

type QuoteResponse

type QuoteResponse struct {
	InputMint            string          `json:"inputMint"`
	InAmount             decimal.Decimal `json:"inAmount"`
	OutputMint           string          `json:"outputMint"`
	OutAmount            decimal.Decimal `json:"outAmount"`
	OtherAmountThreshold decimal.Decimal `json:"otherAmountThreshold"`
	SwapMode             string          `json:"swapMode"`
	SlippageBps          int             `json:"slippageBps"`
	PlatformFee          *PlatformFee    `json:"platformFee"`
	PriceImpactPct       decimal.Decimal `json:"priceImpactPct"`
	RoutePlan            []RoutePlan     `json:"routePlan"`
}

type RoutePlan

type RoutePlan struct {
	SwapInfo SwapInfo `json:"swapInfo"`
	Percent  int      `json:"percent"`
	Bps      int      `json:"bps"`
}

type SimulationError

type SimulationError struct {
	ErrorCode string `json:"errorCode"`
	Error     string `json:"error"`
}

type Stats

type Stats struct {
	PriceChange       decimal.Decimal `json:"priceChange"`
	LiquidityChange   decimal.Decimal `json:"liquidityChange"`
	VolumeChange      decimal.Decimal `json:"volumeChange"`
	BuyVolume         decimal.Decimal `json:"buyVolume"`
	SellVolume        decimal.Decimal `json:"sellVolume"`
	BuyOrganicVolume  decimal.Decimal `json:"buyOrganicVolume"`
	SellOrganicVolume decimal.Decimal `json:"sellOrganicVolume"`
	NumBuys           int             `json:"numBuys"`
	NumSells          int             `json:"numSells"`
	NumTraders        int             `json:"numTraders"`
	NumOrganicBuyers  int             `json:"numOrganicBuyers"`
	NumNetBuyers      int             `json:"numNetBuyers"`
}

type SwapInfo

type SwapInfo struct {
	AmmKey     string          `json:"ammKey"`
	Label      string          `json:"label"`
	InputMint  string          `json:"inputMint"`
	OutputMint string          `json:"outputMint"`
	InAmount   decimal.Decimal `json:"inAmount"`
	OutAmount  decimal.Decimal `json:"outAmount"`
	FeeAmount  decimal.Decimal `json:"feeAmount"`
	FeeMint    string          `json:"feeMint"`
}

type SwapRequest

type SwapRequest struct {
	UserPublicKey             string                    `json:"userPublicKey"`
	QuoteResponse             QuoteResponse             `json:"quoteResponse"`
	PrioritizationFeeLamports PrioritizationFeeLamports `json:"prioritizationFeeLamports"`
	DynamicComputeUnitLimit   bool                      `json:"dynamicComputeUnitLimit"`
}

type SwapResponse

type SwapResponse struct {
	SwapTransaction           string           `json:"swapTransaction"`
	LastValidBlockHeight      int64            `json:"lastValidBlockHeight"`
	PrioritizationFeeLamports int64            `json:"prioritizationFeeLamports"`
	SimulationError           *SimulationError `json:"simulationError"`
}

type TokenInfo

type TokenInfo struct {
	ID                string          `json:"id"`
	Name              string          `json:"name"`
	Symbol            string          `json:"symbol"`
	Icon              string          `json:"icon"`
	Decimals          int             `json:"decimals"`
	CircSupply        decimal.Decimal `json:"circSupply"`
	TotalSupply       decimal.Decimal `json:"totalSupply"`
	TokenProgram      string          `json:"tokenProgram"`
	FirstPool         FirstPool       `json:"firstPool"`
	HolderCount       int             `json:"holderCount"`
	Audit             Audit           `json:"audit"`
	OrganicScore      decimal.Decimal `json:"organicScore"`
	OrganicScoreLabel string          `json:"organicScoreLabel"`
	IsVerified        bool            `json:"isVerified"`
	Cexes             []string        `json:"cexes"`
	Tags              []string        `json:"tags"`
	FDV               decimal.Decimal `json:"fdv"`
	MCap              decimal.Decimal `json:"mcap"`
	UsdPrice          decimal.Decimal `json:"usdPrice"`
	PriceBlockId      int64           `json:"priceBlockId"`
	Liquidity         decimal.Decimal `json:"liquidity"`
	Stats5m           Stats           `json:"stats5m"`
	Stats1h           Stats           `json:"stats1h"`
	Stats6h           Stats           `json:"stats6h"`
	Stats24h          Stats           `json:"stats24h"`
	CtLikes           int             `json:"ctLikes"`
	SmartCtLikes      int             `json:"smartCtLikes"`
	UpdatedAt         time.Time       `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL