solana

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	Data struct {
		Parsed struct {
			Info struct {
				Decimals        int    `json:"decimals"`
				FreezeAuthority string `json:"freezeAuthority"`
				IsInitialized   bool   `json:"isInitialized"`
				MintAuthority   string `json:"mintAuthority"`
				Supply          string `json:"supply"`

				Authority     string `json:"authority"`
				Blockhash     string `json:"blockhash"`
				FeeCalculator struct {
					LamportsPerSignature string `json:"lamportsPerSignature"`
				} `json:"feeCalculator"`
			} `json:"info"`
			Type string `json:"type"`
		} `json:"parsed"`
		Program string `json:"program"`
		Space   int    `json:"space"`
	} `json:"data,omitempty"`
	//Data1      []string `json:"data,omitempty"`
	Executable bool   `json:"executable" json:"executable,omitempty"`
	Lamports   uint64 `json:"lamports" json:"lamports,omitempty"`
}

types

type GetTransaction

type GetTransaction struct {
	Result struct {
		BlockTime int `json:"blockTime"`
		Meta      struct {
			ComputeUnitsConsumed int           `json:"computeUnitsConsumed"`
			Err                  interface{}   `json:"err"`
			Fee                  int           `json:"fee"`
			InnerInstructions    []interface{} `json:"innerInstructions"`
			LogMessages          []string      `json:"logMessages"`
			PostBalances         []int         `json:"postBalances"`
			PostTokenBalances    []struct {
				AccountIndex  int    `json:"accountIndex"`
				Mint          string `json:"mint"`
				Owner         string `json:"owner"`
				ProgramID     string `json:"programId"`
				UITokenAmount struct {
					Amount         string  `json:"amount"`
					Decimals       int     `json:"decimals"`
					UIAmount       float64 `json:"uiAmount"`
					UIAmountString string  `json:"uiAmountString"`
				} `json:"uiTokenAmount"`
			} `json:"postTokenBalances"`
			PreBalances      []int `json:"preBalances"`
			PreTokenBalances []struct {
				AccountIndex  int    `json:"accountIndex"`
				Mint          string `json:"mint"`
				Owner         string `json:"owner"`
				ProgramID     string `json:"programId"`
				UITokenAmount struct {
					Amount         string  `json:"amount"`
					Decimals       int     `json:"decimals"`
					UIAmount       float64 `json:"uiAmount"`
					UIAmountString string  `json:"uiAmountString"`
				} `json:"uiTokenAmount"`
			} `json:"preTokenBalances"`
			Rewards []interface{} `json:"rewards"`
			Status  struct {
				Ok interface{} `json:"Ok"`
			} `json:"status"`
		} `json:"meta"`
		Slot        int `json:"slot"`
		Transaction struct {
			Message struct {
				AccountKeys []struct {
					Pubkey   string `json:"pubkey"`
					Signer   bool   `json:"signer"`
					Source   string `json:"source"`
					Writable bool   `json:"writable"`
				} `json:"accountKeys"`
				//AccountKeys  []string `json:"accountKeys"`
				Instructions []struct {
					Accounts    []interface{}   `json:"accounts,omitempty"`
					Data        string          `json:"data,omitempty"`
					ProgramID   string          `json:"programId"`
					StackHeight interface{}     `json:"stackHeight"`
					Parsed      json.RawMessage `json:"parsed"`
					//Parsed      struct {
					//	Info struct {
					//		Amount      string `json:"amount"`
					//		Authority   string `json:"authority"`
					//		Destination string `json:"destination"`
					//		Source      string `json:"source"`
					//	} `json:"info"`
					//	Type string `json:"type"`
					//} `json:"parsed,omitempty"`
					Program string `json:"program,omitempty"`
				} `json:"instructions"`
				RecentBlockhash string `json:"recentBlockhash"`
			} `json:"message"`
			Signatures []string `json:"signatures"`
		} `json:"transaction"`
	} `json:"result"`
	ID int `json:"id"`
	// contains filtered or unexported fields
}

types

type GetTransactionWithLog

type GetTransactionWithLog struct {
	Result struct {
		BlockTime int `json:"blockTime"`
		Meta      struct {
			ComputeUnitsConsumed int           `json:"computeUnitsConsumed"`
			Err                  interface{}   `json:"err"`
			Fee                  int           `json:"fee"`
			InnerInstructions    []interface{} `json:"innerInstructions"`
			LogMessages          []string      `json:"logMessages"`
			PostBalances         []int         `json:"postBalances"`
			PostTokenBalances    []struct {
				AccountIndex  int    `json:"accountIndex"`
				Mint          string `json:"mint"`
				Owner         string `json:"owner"`
				ProgramID     string `json:"programId"`
				UITokenAmount struct {
					Amount         string  `json:"amount"`
					Decimals       int     `json:"decimals"`
					UIAmount       float64 `json:"uiAmount"`
					UIAmountString string  `json:"uiAmountString"`
				} `json:"uiTokenAmount"`
			} `json:"postTokenBalances"`
			PreBalances      []int `json:"preBalances"`
			PreTokenBalances []struct {
				AccountIndex  int    `json:"accountIndex"`
				Mint          string `json:"mint"`
				Owner         string `json:"owner"`
				ProgramID     string `json:"programId"`
				UITokenAmount struct {
					Amount         string  `json:"amount"`
					Decimals       int     `json:"decimals"`
					UIAmount       float64 `json:"uiAmount"`
					UIAmountString string  `json:"uiAmountString"`
				} `json:"uiTokenAmount"`
			} `json:"preTokenBalances"`
			Rewards []interface{} `json:"rewards"`
			Status  struct {
				Ok interface{} `json:"Ok"`
			} `json:"status"`
		} `json:"meta"`
		Slot        int `json:"slot"`
		Transaction struct {
			Message struct {
				// AccountKeys []struct {
				// 	Pubkey   string `json:"pubkey"`
				// 	Signer   bool   `json:"signer"`
				// 	Source   string `json:"source"`
				// 	Writable bool   `json:"writable"`
				// } `json:"accountKeys"`
				AccountKeys  []string `json:"accountKeys"`
				Instructions []struct {
					Accounts    []interface{}   `json:"accounts,omitempty"`
					Data        string          `json:"data,omitempty"`
					ProgramID   string          `json:"programId"`
					StackHeight interface{}     `json:"stackHeight"`
					Parsed      json.RawMessage `json:"parsed"`
					//Parsed      struct {
					//	Info struct {
					//		Amount      string `json:"amount"`
					//		Authority   string `json:"authority"`
					//		Destination string `json:"destination"`
					//		Source      string `json:"source"`
					//	} `json:"info"`
					//	Type string `json:"type"`
					//} `json:"parsed,omitempty"`
					Program string `json:"program,omitempty"`
				} `json:"instructions"`
				RecentBlockhash string `json:"recentBlockhash"`
			} `json:"message"`
			Signatures []string `json:"signatures"`
		} `json:"transaction"`
	} `json:"result"`
	ID int `json:"id"`
	// contains filtered or unexported fields
}

types

type Handler

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

func NewHandler

func NewHandler(rpcUrl string) (*Handler, error)

func (*Handler) CallContract

func (h *Handler) CallContract(ctx context.Context, contractAddress, params, blockNumber string) ([]byte, error)

func (*Handler) CheckTx

func (h *Handler) CheckTx(ctx context.Context, hash string) (*chainrpc.TxResult, error)

func (*Handler) GetBalance

func (h *Handler) GetBalance(ctx context.Context, address, contractAddress, blockNumber string) (string, error)

func (*Handler) GetBlockHeight

func (h *Handler) GetBlockHeight(ctx context.Context) (string, error)

func (*Handler) GetHeight

func (h *Handler) GetHeight(ctx context.Context) (string, error)

func (*Handler) GetTxByHashWithLogs

func (h *Handler) GetTxByHashWithLogs(ctx context.Context, hash string) (*GetTransactionWithLog, error)

func (*Handler) InquireChain

func (h *Handler) InquireChain(ctx context.Context, instruction, params string) (string, error)

func (*Handler) SendTx

func (h *Handler) SendTx(ctx context.Context, signedHex string) (string, error)

type HeliusTokenMetaMainReq

type HeliusTokenMetaMainReq struct {
	Jsonrpc string `json:"jsonrpc"`
	Id      string `json:"id"`
	Method  string `json:"method"`
	Params  struct {
		Id             string `json:"id"`
		DisplayOptions struct {
			ShowFungible bool `json:"showFungible"`
		} `json:"displayOptions"`
	} `json:"params"`
}

type HeliusTokenMetaMainRes

type HeliusTokenMetaMainRes struct {
	Jsonrpc string `json:"jsonrpc"`
	Result  struct {
		Content struct {
			Metadata struct {
				Name   string `json:"name"`
				Symbol string `json:"symbol"`
			} `json:"metadata"`
		} `json:"content"`
		TokenInfo struct {
			Decimals int64 `json:"decimals"`
		} `json:"token_info"`
	} `json:"result"`
}

type HeliusTokenMetaReq

type HeliusTokenMetaReq struct {
	MintAccounts []string `json:"mintAccounts"`
}

type HeliusTokenMetaResItem

type HeliusTokenMetaResItem struct {
	Account            string `json:"account"`
	OnChainAccountInfo struct {
		AccountInfo struct {
			Key        string `json:"key"`
			IsSigner   bool   `json:"isSigner"`
			IsWritable bool   `json:"isWritable"`
			Lamports   int64  `json:"lamports"`
			Data       struct {
				Parsed struct {
					Info struct {
						Decimals        int    `json:"decimals"`
						FreezeAuthority string `json:"freezeAuthority"`
						IsInitialized   bool   `json:"isInitialized"`
						MintAuthority   string `json:"mintAuthority"`
						Supply          string `json:"supply"`
					} `json:"info"`
					Type string `json:"type"`
				} `json:"parsed"`
				Program string `json:"program"`
				Space   int    `json:"space"`
			} `json:"data"`
			Owner      string  `json:"owner"`
			Executable bool    `json:"executable"`
			RentEpoch  float64 `json:"rentEpoch"`
		} `json:"accountInfo"`
		Error string `json:"error"`
	} `json:"onChainAccountInfo"`
	OnChainMetadata struct {
		Metadata struct {
			TokenStandard   string `json:"tokenStandard"`
			Key             string `json:"key"`
			UpdateAuthority string `json:"updateAuthority"`
			Mint            string `json:"mint"`
			Data            struct {
				Name                 string      `json:"name"`
				Symbol               string      `json:"symbol"`
				Uri                  string      `json:"uri"`
				SellerFeeBasisPoints int         `json:"sellerFeeBasisPoints"`
				Creators             interface{} `json:"creators"`
			} `json:"data"`
			PrimarySaleHappened bool `json:"primarySaleHappened"`
			IsMutable           bool `json:"isMutable"`
			EditionNonce        int  `json:"editionNonce"`
			Uses                struct {
				UseMethod string `json:"useMethod"`
				Remaining int    `json:"remaining"`
				Total     int    `json:"total"`
			} `json:"uses"`
			Collection        interface{} `json:"collection"`
			CollectionDetails interface{} `json:"collectionDetails"`
		} `json:"metadata"`
		Error string `json:"error"`
	} `json:"onChainMetadata"`
	LegacyMetadata struct {
		ChainId    int      `json:"chainId"`
		Address    string   `json:"address"`
		Symbol     string   `json:"symbol"`
		Name       string   `json:"name"`
		Decimals   int      `json:"decimals"`
		LogoURI    string   `json:"logoURI"`
		Tags       []string `json:"tags"`
		Extensions struct {
			CoingeckoId string `json:"coingeckoId"`
			SerumV3Usdc string `json:"serumV3Usdc"`
			Website     string `json:"website"`
		} `json:"extensions"`
	} `json:"legacyMetadata"`
}

type PrioritizationFeeItem

type PrioritizationFeeItem struct {
	Slot              uint64 `json:"slot"`
	PrioritizationFee uint64 `json:"prioritizationFee"`
}

types

type RpcBlock

type RpcBlock struct {
	BlockTime    int64   `json:"blockTime"`
	Transactions []RpcTx `json:"transactions"`
}

types

type RpcTx

type RpcTx struct {
	Meta struct {
		ComputeUnitsConsumed int           `json:"computeUnitsConsumed"`
		Err                  interface{}   `json:"err"`
		Fee                  int           `json:"fee"`
		InnerInstructions    []interface{} `json:"innerInstructions"`
		LoadedAddresses      struct {
			Readonly []interface{} `json:"readonly"`
			Writable []interface{} `json:"writable"`
		} `json:"loadedAddresses"`
		LogMessages       []string            `json:"logMessages"`
		PreBalances       []uint64            `json:"preBalances"`
		PostBalances      []uint64            `json:"postBalances"`
		PreTokenBalances  []*SPLTokenTransfer `json:"preTokenBalances"`
		PostTokenBalances []*SPLTokenTransfer `json:"postTokenBalances"`
		Rewards           interface{}         `json:"rewards"`
		Status            struct {
			Ok interface{} `json:"Ok"`
		} `json:"status"`
	} `json:"meta"`
	Transaction struct {
		Message struct {
			AccountKeys []string `json:"accountKeys"`
			//AccountKeys []struct {
			//	Pubkey   string `json:"pubkey"`
			//	Signer   bool   `json:"signer"`
			//	Source   string `json:"source"`
			//	Writable bool   `json:"writable"`
			//} `json:"accountKeys"`
			Header struct {
				NumReadonlySignedAccounts   int `json:"numReadonlySignedAccounts"`
				NumReadonlyUnsignedAccounts int `json:"numReadonlyUnsignedAccounts"`
				NumRequiredSignatures       int `json:"numRequiredSignatures"`
			} `json:"header"`
			Instructions []struct {
				Accounts       []int       `json:"accounts"`
				Data           string      `json:"data"`
				ProgramIDIndex int         `json:"programIdIndex"`
				StackHeight    interface{} `json:"stackHeight"`
			} `json:"instructions"`
			RecentBlockhash string `json:"recentBlockhash"`
		} `json:"message"`
		Signatures []string `json:"signatures"`
	} `json:"transaction"`
	Version interface{} `json:"version"`
}

types

type SPLTokenTransfer

type SPLTokenTransfer struct {
	AccountIndex  int    `json:"accountIndex"`
	Mint          string `json:"mint"`
	Owner         string `json:"owner"`
	UiTokenAmount struct {
		Amount         string  `json:"amount"`
		Decimals       int     `json:"decimals"`
		UiAmount       float64 `json:"uiAmount"`
		UiAmountString string  `json:"uiAmountString"`
	} `json:"uiTokenAmount"`
}

types

type TransferInfo

type TransferInfo struct {
	Info struct {
		Amount            string `json:"amount"`
		Lamports          int    `json:"lamports"`
		Authority         string `json:"authority"`
		MultisigAuthority string `json:"multisigAuthority"`
		Destination       string `json:"destination"`
		Source            string `json:"source"`
	} `json:"info"`
	Type string `json:"type"`
}

types

Jump to

Keyboard shortcuts

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