jupiter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwapInstructions

func GetSwapInstructions(
	logger i_logger.ILogger,
	userAddress solana.PublicKey,
	tokenAddress solana.PublicKey,
	quoteResponse *QuoteType,
	isClose bool,
) ([]solana.Instruction, error)

Types

type InstructionType

type InstructionType struct {
	ProgramId string `json:"programId"`
	Accounts_ []struct {
		Pubkey     string `json:"pubkey"`
		IsSigner   bool   `json:"isSigner"`
		IsWritable bool   `json:"isWritable"`
	} `json:"accounts"`
	Data_ string `json:"data"`
}

func (*InstructionType) Accounts

func (t *InstructionType) Accounts() []*solana.AccountMeta

func (*InstructionType) Data

func (t *InstructionType) Data() ([]byte, error)

func (*InstructionType) ProgramID

func (t *InstructionType) ProgramID() solana.PublicKey

type QuoteType

type QuoteType struct {
	InputMint            string `json:"inputMint"`
	InAmount             string `json:"inAmount"`
	OutputMint           string `json:"outputMint"`
	OutAmount            string `json:"outAmount"`
	OtherAmountThreshold string `json:"otherAmountThreshold"`
	SwapMode             string `json:"swapMode"`
	SlippageBps          uint64 `json:"slippageBps"`
	// PlatformFee          string `json:"platformFee,omitempty"`
	PriceImpactPct string          `json:"priceImpactPct"`
	RoutePlan      []RoutePlanType `json:"routePlan"`
}

func GetQuote

func GetQuote(
	logger i_logger.ILogger,
	swapType type_.SwapType,
	tokenAddress solana.PublicKey,
	tokenAmountWithDecimals uint64,
	slippage uint64,
) (*QuoteType, error)

type RoutePlanType

type RoutePlanType struct {
	SwapInfo SwapInfoType `json:"swapInfo"`
	Percent  uint64       `json:"percent"`
}

type SwapInfoType

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

type SwapInstructionsParamsType

type SwapInstructionsParamsType struct {
	QuoteResponse    *QuoteType `json:"quoteResponse"`
	UserPublicKey    string     `json:"userPublicKey"`
	WrapAndUnwrapSol bool       `json:"wrapAndUnwrapSol"`
}

type SwapInstructionsResultType

type SwapInstructionsResultType struct {
	ComputeBudgetInstructions   []*InstructionType `json:"computeBudgetInstructions"`
	SetupInstructions           []*InstructionType `json:"setupInstructions"`
	SwapInstruction             *InstructionType   `json:"swapInstruction"`
	CleanupInstruction          *InstructionType   `json:"cleanupInstruction"`
	OtherInstructions           []*InstructionType `json:"otherInstructions"`
	AddressLookupTableAddresses []string           `json:"addressLookupTableAddresses"`
	PrioritizationFeeLamports   uint64             `json:"prioritizationFeeLamports"`
	ComputeUnitLimit            uint64             `json:"computeUnitLimit"`
	PrioritizationType          struct {
		ComputeBudget struct {
			MicroLamports          uint64 `json:"microLamports"`
			EstimatedMicroLamports uint64 `json:"estimatedMicroLamports"`
		} `json:"computeBudget"`
	} `json:"prioritizationType"`
}

Jump to

Keyboard shortcuts

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