jupiter

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultApiBaseUrl = "https://quote-api.jup.ag/v6/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(baseUrl string) *Client

NewClient returns a new Jupiter client for performing on-chain swaps

func (*Client) GetQuote

func (c *Client) GetQuote(
	ctx context.Context,
	inputMint string,
	outputMint string,
	quarksToSwap uint64,
	slippageBps uint32,
	forceDirectRoute bool,
	maxAccounts uint8,
	useLegacyInstruction bool,
) (*Quote, error)

GetQuote gets an optimal route for performing a swap

func (*Client) GetSwapInstructions

func (c *Client) GetSwapInstructions(
	ctx context.Context,
	quote *Quote,
	owner string,
	destinationTokenAccount string,
) (*SwapInstructions, error)

GetSwapInstructions gets the instructions to construct a transaction to sign and execute on chain to perform a swap with a given quote

type Quote

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

func (*Quote) GetEstimatedSwapAmount added in v1.2.0

func (q *Quote) GetEstimatedSwapAmount() uint64

type SwapInstructions

type SwapInstructions struct {
	TokenLedgerInstruction    *solana.Instruction
	ComputeBudgetInstructions []solana.Instruction
	SetupInstructions         []solana.Instruction
	SwapInstruction           solana.Instruction
	CleanupInstruction        *solana.Instruction
}

Jump to

Keyboard shortcuts

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