solana

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RaydiumLiquidityPoolv4ProgramID = solana.MustPublicKeyFromBase58("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8")
	RaydiumCpmmPoolProgramID        = solana.MustPublicKeyFromBase58("CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C")
	NativeSOL                       = "11111111111111111111111111111111"
)

Functions

func BuildTransacion added in v1.0.9

func BuildTransacion(url string, signers []solana.PrivateKey, instrs ...solana.Instruction) (*solana.Transaction, error)

func CheckAccount added in v1.0.15

func CheckAccount(urls []string, payer solana.PublicKey, publicKey solana.PublicKey, fromTokenAddr, toTokenAddr string) (map[string]solana.PublicKey, []solana.Instruction, error)

func ExecuteInstructions added in v1.0.9

func ExecuteInstructions(
	ctx context.Context,
	url string,
	signers []solana.PrivateKey,
	instrs ...solana.Instruction,
) (string, error)

func ExecuteInstructionsAndWaitConfirm added in v1.0.9

func ExecuteInstructionsAndWaitConfirm(
	ctx context.Context,
	url string,
	RPCWs string,
	signers []solana.PrivateKey,
	instrs ...solana.Instruction,
) (string, error)

func GetBalance added in v1.0.11

func GetBalance(urls []string, pubkey string) (uint64, error)

func GetMultiAccounts added in v1.0.17

func GetMultiAccounts(urls []string, accounts []*PoolTokenPairAccount) (resp *rpc.GetMultipleAccountsResult, err error)

func GetSPLTokenTopAccounts added in v1.0.49

func GetSPLTokenTopAccounts(urls []string, token string) (count int, err error)

func GetTokenAccountBalance added in v1.0.7

func GetTokenAccountBalance(urls []string, pubkey string) (string, float64, error)

func GetTokenAccountsFromMints added in v1.0.15

func GetTokenAccountsFromMints(ctx context.Context, url string, owner solana.PublicKey,
	mints ...solana.PublicKey) (map[string]solana.PublicKey, map[string]solana.PublicKey, error)

func GetTokenDecimal added in v1.0.24

func GetTokenDecimal(urls []string, mint string) (decimals int, err error)

func GetTokenMint added in v1.0.27

func GetTokenMint(urls []string, mint string) (tokenmint *token.Mint, err error)

func GetTransaction added in v1.0.7

func GetTransaction(urls []string, signature string) (out *rpc.GetTransactionResult, err error)

func ProcessTransactionWithAddressLookups added in v1.0.26

func ProcessTransactionWithAddressLookups(tx *solana.Transaction, urls []string) error

func TransferSOL added in v1.0.14

func TransferSOL(urls []string, wsUrl string, fromKey string, to string, amount uint64) (sig string, err error)

func TransferToken added in v1.0.6

func TransferToken(urls []string, wsUrl string, amount uint64, senderSPLTokenAccount, mint, recipient solana.PublicKey, sender *solana.PrivateKey) (sig string, err error)

Types

type Context added in v1.0.7

type Context struct {
	Slot int `json:"slot"`
}

type Encoding added in v1.0.7

type Encoding struct {
	Encoding string `json:"encoding"`
}

type GetBalanceResponse added in v1.0.11

type GetBalanceResponse struct {
	Context struct {
		APIVersion string `json:"apiVersion"`
		Slot       int    `json:"slot"`
	} `json:"context"`
	Value uint64 `json:"value"`
}

type GetTokenAccountsByOwnerResponse added in v1.0.7

type GetTokenAccountsByOwnerResponse struct {
	Context struct {
		Slot int `json:"slot"`
	} `json:"context"`
	Value []struct {
		Account struct {
			Data struct {
				Parsed struct {
					Info struct {
						IsNative    bool   `json:"isNative"`
						Mint        string `json:"mint"`
						Owner       string `json:"owner"`
						State       string `json:"state"`
						TokenAmount struct {
							Amount         string  `json:"amount"`
							Decimals       int     `json:"decimals"`
							UIAmount       float64 `json:"uiAmount"`
							UIAmountString string  `json:"uiAmountString"`
						} `json:"tokenAmount"`
					} `json:"info"`
					Type string `json:"type"`
				} `json:"parsed"`
				Program string `json:"program"`
				Space   int    `json:"space"`
			} `json:"data"`
			Executable bool   `json:"executable"`
			Lamports   int    `json:"lamports"`
			Owner      string `json:"owner"`
		} `json:"account"`
		Pubkey string `json:"pubkey"`
	} `json:"value"`
}

func GetTokenAccountsByOwner added in v1.0.7

func GetTokenAccountsByOwner(urls []string, pubkey string, mint string, programid string) (*GetTokenAccountsByOwnerResponse, error)

type LastestBlockHashContext added in v1.0.50

type LastestBlockHashContext struct {
	ApiVersion string `json:"apiVersion"`
	Slot       int64  `json:"slot"`
}

type LastestBlockHashResult added in v1.0.50

type LastestBlockHashResult struct {
	Context *LastestBlockHashContext `json:"context"`
	Value   *LastestBlockHashValue   `json:"value"`
}

func GetLatestBlockhash added in v1.0.50

func GetLatestBlockhash(url string) (out *LastestBlockHashResult, err error)

type LastestBlockHashValue added in v1.0.50

type LastestBlockHashValue struct {
	Blockhash            solana.Hash `json:"blockhash"`
	LastValidBlockHeight int64       `json:"lastValidBlockHeight"`
}

type LatestBlockhashParams added in v1.0.50

type LatestBlockhashParams struct {
	Commitment string `json:"commitment"`
}

type MetaResponse added in v1.0.7

type MetaResponse struct {
	Success bool    `json:"success"`
	Message string  `json:"message"`
	Result  *Result `json:"result"`
}

type Mint added in v1.0.7

type Mint struct {
	Mint string `json:"mint"`
}

type PoolInfoResponse added in v1.0.7

type PoolInfoResponse struct {
	RaydiumLiquidityPoolv4 []*RaydiumLiquidityPoolv4 `json:"Raydium_LiquidityPoolv4"`
}

func GetPoolInfo added in v1.0.7

func GetPoolInfo(url string, keys []string, tokenA string, tokenB string) (*PoolInfoResponse, error)

type PoolTokenPairAccount added in v1.0.17

type PoolTokenPairAccount struct {
	BaseMint      solana.PublicKey
	BaseDecimals  int
	BaseAmount    uint64
	QuoteMint     solana.PublicKey
	QuoteDecimals int
	QuoteAmount   uint64
}

type Program added in v1.0.11

type Program struct {
	ProgramId string `json:"programId"`
}

type RaydiumLiquidityPoolv4 added in v1.0.7

type RaydiumLiquidityPoolv4 struct {
	BaseDecimal     int    `json:"baseDecimal"`
	BaseMint        string `json:"baseMint"`
	BaseVault       string `json:"baseVault"`
	LpMint          string `json:"lpMint"`
	LpVault         string `json:"lpVault"`
	MarketId        string `json:"marketId"`
	MarketProgramId string `json:"marketProgramId"`
	OpenOrders      string `json:"openOrders"`
	QuoteDecimal    int    `json:"quoteDecimal"`
	QuoteMint       string `json:"quoteMint"`
	QuoteVault      string `json:"quoteVault"`
	TargetOrders    string `json:"targetOrders"`
	WithdrawQueue   string `json:"withdrawQueue"`
	Pubkey          string `json:"pubkey"`
}

type RaydiumSwapInnerInstructionData added in v1.0.11

type RaydiumSwapInnerInstructionData struct {
	Source       string
	Destionation string
	Owner        string
	Amount       uint64
}

type RaydiumSwapInstructionParam added in v1.0.11

type RaydiumSwapInstructionParam struct {
	SwapIn  *RaydiumSwapInnerInstructionData
	SwapOut *RaydiumSwapInnerInstructionData
}

func ParseRaydiumCPSwapInstructionParam added in v1.0.29

func ParseRaydiumCPSwapInstructionParam(out *rpc.GetTransactionResult, urls []string) (param *RaydiumSwapInstructionParam, succeed bool, err error)

func ParseRaydiumCpSwapInstructionParam added in v1.0.29

func ParseRaydiumCpSwapInstructionParam(out *rpc.GetTransactionResult, urls []string) (param *RaydiumSwapInstructionParam, succeed bool, err error)

func ParseRaydiumSwapInstructionParam added in v1.0.11

func ParseRaydiumSwapInstructionParam(out *rpc.GetTransactionResult, urls []string) (param *RaydiumSwapInstructionParam, succeed bool, err error)

type Result added in v1.0.7

type Result struct {
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int    `json:"decimals"`
	Address  string `json:"address"`
}

func GetTokenMeta added in v1.0.24

func GetTokenMeta(url string, mint string, keys []string) (out *Result, err error)

type TokenAccountInfo added in v1.0.15

type TokenAccountInfo struct {
	Mint    solana.PublicKey
	Account solana.PublicKey
}

type TokenBalance added in v1.0.7

type TokenBalance struct {
	Context *Context `json:"context"`
	Value   *Value   `json:"value"`
}

type TransferSOLInstructionParam added in v1.0.11

type TransferSOLInstructionParam struct {
	Source      string
	Destination string
	Amount      uint64
}

func ParseTransferSOLInstructionParam added in v1.0.11

func ParseTransferSOLInstructionParam(out *rpc.GetTransactionResult, urls []string) (params []*TransferSOLInstructionParam, succeed bool, err error)

type Value added in v1.0.7

type Value struct {
	Amount         string  `json:"amount"`
	Decimals       int     `json:"decimals"`
	UIAmount       float64 `json:"uiAmount"`
	UIAmountString string  `json:"uiAmountString"`
}

func GetSPLTokenTotalSupply added in v1.0.48

func GetSPLTokenTotalSupply(urls []string, pubkeyString string) (value *Value, err error)

Jump to

Keyboard shortcuts

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