Documentation
¶
Index ¶
- Constants
- Variables
- type AccountInfo
- type BlockResult
- type Client
- func (c *Client) GetAccountBalance(publicKey string) (*RPCResponse[Result[int64]], error)
- func (c *Client) GetAccountInfo(publicKey string) (*RPCResponse[Result[AccountInfo]], error)
- func (c *Client) GetBlock(slotNumber int64, getBlockProps *GetBlockProps) (*RPCResponse[Result[BlockResult]], error)
- func (c *Client) GetBlockHeight() (*RPCResponse[int64], error)
- func (c *Client) GetBlockProduction() (*RPCResponse[Result[GetBlockProdResponse]], error)
- type ClientOptions
- type Context
- type GetBlockProdResponse
- type GetBlockProps
- type Header
- type Instruction
- type Message
- type Meta
- type RPCRequest
- type RPCResponse
- type Range
- type Result
- type Status
- type TransactionElement
- type TransactionTransaction
Constants ¶
View Source
const ( // APIVersion is the version of the Solana API. APIVersion = "1.0.0" // DefaultURL is the devnet URL for the Solana API. DevnetURL = "https://api.devnet.solana.com" // JSONRPCVersion is the version of the JSON-RPC protocol. JSONRPCVersion = "2.0" )
Variables ¶
View Source
var ( // DefaultHTTPClient is the default HTTP client for the Solana API. DefaultHTTPClient = &http.Client{} // DefaultClientOptions is the default options for the Solana API client. DefaultClientOptions = &ClientOptions{ HttpClient: DefaultHTTPClient, } )
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type BlockResult ¶
type BlockResult struct {
BlockHeight int64 `json:"blockHeight"`
BlockTime interface{} `json:"blockTime"`
Blockhash string `json:"blockhash"`
ParentSlot int64 `json:"parentSlot"`
PreviousBlockhash string `json:"previousBlockhash"`
Transactions []TransactionElement `json:"transactions"`
}
type Client ¶
Client represents a JSON-RPC client with a base URL.
func NewClient ¶
func NewClient(baseURL string, opts *ClientOptions) *Client
NewClient creates a new JSON-RPC client with the specified base URL.
func (*Client) GetAccountBalance ¶
GetAccountBalance retrieves the account balance for a given public key.
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo(publicKey string) (*RPCResponse[Result[AccountInfo]], error)
func (*Client) GetBlock ¶
func (c *Client) GetBlock(slotNumber int64, getBlockProps *GetBlockProps) (*RPCResponse[Result[BlockResult]], error)
func (*Client) GetBlockHeight ¶
func (c *Client) GetBlockHeight() (*RPCResponse[int64], error)
func (*Client) GetBlockProduction ¶
func (c *Client) GetBlockProduction() (*RPCResponse[Result[GetBlockProdResponse]], error)
GetBlockProduction retrieves the block production information from the Solana RPC endpoint.
type ClientOptions ¶
type GetBlockProdResponse ¶
type GetBlockProps ¶
type Instruction ¶
type Message ¶
type Message struct {
AccountKeys []string `json:"accountKeys"`
Header *Header `json:"header"`
Instructions []Instruction `json:"instructions"`
RecentBlockhash string `json:"recentBlockhash"`
}
type Meta ¶
type Meta struct {
Err interface{} `json:"err"`
Fee int64 `json:"fee"`
InnerInstructions []interface{} `json:"innerInstructions"`
LogMessages []interface{} `json:"logMessages"`
PostBalances []int64 `json:"postBalances"`
PostTokenBalances []interface{} `json:"postTokenBalances"`
PreBalances []int64 `json:"preBalances"`
PreTokenBalances []interface{} `json:"preTokenBalances"`
Rewards interface{} `json:"rewards"`
Status *Status `json:"status"`
}
type RPCRequest ¶
type RPCRequest struct {
JSONRPC string `json:"jsonrpc"`
ID int `json:"id"`
Method string `json:"method"`
Params interface{} `json:"params"`
}
RPCRequest represents a JSON-RPC request object.
type RPCResponse ¶
type TransactionElement ¶
type TransactionElement struct {
Meta *Meta `json:"meta"`
Transaction *TransactionTransaction `json:"transaction"`
}
type TransactionTransaction ¶
Click to show internal directories.
Click to hide internal directories.