Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type BlockhashResult
- type Client
- func (c *Client) DoRequest(out interface{}, method string, params ...interface{}) error
- func (c *Client) GetAccountDataIn(account solana.PublicKey, inVar interface{}) (err error)
- func (c *Client) GetAccountInfo(account solana.PublicKey) (out *GetAccountInfoResult, err error)
- func (c *Client) GetBalance(publicKey solana.PublicKey, commitment *CommitmentType) (out *GetBalanceResult, err error)
- func (c *Client) GetBlock(slotNum uint64) (out *GetBlockResult, err error)
- func (c *Client) GetConfirmedTransaction(signature string) (out *GetTransactionResponse, err error)
- func (c *Client) GetLatestBlockhash(commitment CommitmentType) (out *GetRecentBlockhashResult, err error)
- func (c *Client) GetMinimumBalanceForRentExemption(dataSize int) (lamport int, err error)
- func (c *Client) GetProgramAccounts(publicKey solana.PublicKey, opts *GetProgramAccountsOpts) (out GetProgramAccountsResult, err error)
- func (c *Client) GetSignaturesForAddress(address solana.PublicKey, opts *GetSignaturesForAddressOpts) (out GetSignaturesForAddressResult, err error)
- func (c *Client) GetSlot(commitment *CommitmentType) (uint64, error)
- func (c *Client) GetTransaction(signature string, commitmentType *CommitmentType) (out *GetTransactionResponse, err error)
- func (c *Client) RequestAirdrop(account *solana.PublicKey, lamport uint64, commitment CommitmentType) (signature string, err error)
- func (c *Client) SendTransaction(transaction *solana.Transaction, opts *SendTransactionOptions) (signature string, err error)
- func (c *Client) SetHeader(k, v string)
- func (c *Client) SimulateTransaction(transaction *solana.Transaction) (*SimulateTransactionResponse, error)
- type ClientOption
- type CommitmentType
- type Context
- type GetAccountInfoResult
- type GetBalanceResult
- type GetBlockResult
- type GetProgramAccountsOpts
- type GetProgramAccountsResult
- type GetRecentBlockhashResult
- type GetSignaturesForAddressOpts
- type GetSignaturesForAddressResult
- type GetTransactionResponse
- type InnerInstruction
- type Instruction
- type InstructionMeta
- type KeyedAccount
- type Message
- type MessageHeader
- type Meta
- type RPCContext
- type RPCFilter
- type RPCFilterMemcmp
- type RpcError
- type SendTransactionOptions
- type SimulateTransactionResponse
- type TokeBalance
- type Transaction
- type TransactionError
- type TransactionSignature
Constants ¶
View Source
const ( // CommitmentProcessed queries the most recent block which has reached 1 confirmation by the connected node CommitmentProcessed = CommitmentType("processed") // CommitmentConfirmed queries the most recent block which has reached 1 confirmation by the cluster CommitmentConfirmed = CommitmentType("confirmed") // CommitmentConfirmed queries the most recent block which has been finalized by the cluster CommitmentFinalized = CommitmentType("finalized") // The following are deprecated CommitmentMax = CommitmentType("max") // Deprecated as of v1.5.5 CommitmentRecent = CommitmentType("recent") // Deprecated as of v1.5.5 CommitmentRoot = CommitmentType("root") // Deprecated as of v1.5.5 CommitmentSingle = CommitmentType("single") // Deprecated as of v1.5.5 CommitmentSingleGossip = CommitmentType("singleGossip") // Deprecated as of v1.5.5 )
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
View Source
var WithDebug = func() ClientOption { return func(cli *Client) *Client { cli.debug = true return cli } }
Functions ¶
This section is empty.
Types ¶
type BlockhashResult ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(rpcURL string, opts ...ClientOption) *Client
func (*Client) GetAccountDataIn ¶
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo(account solana.PublicKey) (out *GetAccountInfoResult, err error)
func (*Client) GetBalance ¶
func (c *Client) GetBalance(publicKey solana.PublicKey, commitment *CommitmentType) (out *GetBalanceResult, err error)
func (*Client) GetBlock ¶
func (c *Client) GetBlock(slotNum uint64) (out *GetBlockResult, err error)
func (*Client) GetConfirmedTransaction ¶
func (c *Client) GetConfirmedTransaction(signature string) (out *GetTransactionResponse, err error)
func (*Client) GetLatestBlockhash ¶
func (c *Client) GetLatestBlockhash(commitment CommitmentType) (out *GetRecentBlockhashResult, err error)
func (*Client) GetMinimumBalanceForRentExemption ¶
func (*Client) GetProgramAccounts ¶
func (c *Client) GetProgramAccounts(publicKey solana.PublicKey, opts *GetProgramAccountsOpts) (out GetProgramAccountsResult, err error)
func (*Client) GetSignaturesForAddress ¶
func (c *Client) GetSignaturesForAddress(address solana.PublicKey, opts *GetSignaturesForAddressOpts) (out GetSignaturesForAddressResult, err error)
func (*Client) GetTransaction ¶
func (c *Client) GetTransaction(signature string, commitmentType *CommitmentType) (out *GetTransactionResponse, err error)
GetTransaction For processing many dependent transactions in series, it's recommended to use "confirmed" commitment, which balances speed with rollback safety. For total safety, it's recommended to use"finalized" commitment.
func (*Client) RequestAirdrop ¶
func (c *Client) RequestAirdrop(account *solana.PublicKey, lamport uint64, commitment CommitmentType) (signature string, err error)
func (*Client) SendTransaction ¶
func (c *Client) SendTransaction(transaction *solana.Transaction, opts *SendTransactionOptions) (signature string, err error)
func (*Client) SimulateTransaction ¶
func (c *Client) SimulateTransaction(transaction *solana.Transaction) (*SimulateTransactionResponse, error)
type ClientOption ¶
type CommitmentType ¶
type CommitmentType string
CommitmentType is the level of commitment desired when querying state. https://docs.solana.com/developing/clients/jsonrpc-api#configuring-state-commitment
type GetAccountInfoResult ¶
type GetAccountInfoResult struct { RPCContext Value *Account `json:"value"` }
type GetBalanceResult ¶
type GetBalanceResult struct { RPCContext Value bin.Uint64 `json:"value"` }
type GetBlockResult ¶
type GetBlockResult struct { // For blocs below ~ 900K RPC nodes often return nil BlockHeight *bin.Uint64 `json:"blockHeight"` // For blocs below ~ 900K RPC nodes often return nil BlockTime *bin.Uint64 `json:"blockTime"` Blockhash solana.PublicKey `json:"blockhash"` ParentSlot bin.Uint64 `json:"parentSlot"` PreviousBlockhash solana.PublicKey `json:"previousBlockhash"` }
type GetProgramAccountsOpts ¶
type GetProgramAccountsOpts struct { Commitment CommitmentType `json:"commitment,omitempty"` // Filter on accounts, implicit AND between filters Filters []RPCFilter `json:"filters,omitempty"` }
type GetProgramAccountsResult ¶
type GetProgramAccountsResult []*KeyedAccount
type GetRecentBlockhashResult ¶
type GetRecentBlockhashResult struct { RPCContext Value *BlockhashResult `json:"value"` }
type GetSignaturesForAddressResult ¶
type GetSignaturesForAddressResult []*TransactionSignature
type GetTransactionResponse ¶
type InnerInstruction ¶
type InnerInstruction struct { Index bin.Uint64 `json:"index"` Instructions []InstructionMeta `json:"instructions"` }
type Instruction ¶
type InstructionMeta ¶
type KeyedAccount ¶
type KeyedAccount struct { Pubkey solana.PublicKey `json:"pubkey"` Account *Account `json:"account"` }
type Message ¶
type Message struct { AccountKeys []solana.PublicKey `json:"accountKeys"` Header MessageHeader `json:"header"` Instructions []Instruction `json:"instructions"` RecentBlockhash solana.PublicKey `json:"recentBlockhash"` }
type MessageHeader ¶
type Meta ¶
type Meta struct { Err *TransactionError `json:"err"` Fee bin.Uint64 `json:"fee"` PreBalances []bin.Uint64 `json:"preBalances"` PostBalances []bin.Uint64 `json:"postBalances"` InnerInstructions []*InnerInstruction `json:"innerInstructions"` PostTokenBalances []*TokeBalance `json:"postTokenBalances"` PreTokenBalances []*TokeBalance `json:"preTokenBalances"` LogMessages []string `json:"logMessages"` Rewards []interface{} `json:"rewards"` }
type RPCContext ¶
type RPCContext struct {
Context Context `json:"context,omitempty"`
}
type RPCFilter ¶
type RPCFilter struct { Memcmp *RPCFilterMemcmp `json:"memcmp,omitempty"` DataSize bin.Uint64 `json:"dataSize,omitempty"` }
type RPCFilterMemcmp ¶
type RPCFilterMemcmp struct { Offset int `json:"offset"` Bytes solana.Base58 `json:"bytes"` }
type SendTransactionOptions ¶
type SendTransactionOptions struct { SkipPreflight bool // disable transaction verification step PreflightCommitment CommitmentType // preflight commitment level; default: "finalized" }
type SimulateTransactionResponse ¶
type SimulateTransactionResponse struct { Err *TransactionError Logs []string }
type TokeBalance ¶
type Transaction ¶
type Transaction struct { Signatures []string `json:"signatures"` Message *Message `json:"message"` }
func (*Transaction) ResolveProgramIdIndex ¶
func (t *Transaction) ResolveProgramIdIndex(programIdIndex uint64) (out solana.PublicKey, err error)
type TransactionError ¶
type TransactionError struct { Raw map[string]interface{} `json:"data,omitempty"` InstructionIndex uint64 InstructionErrorCode string InstructionErrorType string }
func (*TransactionError) UnmarshalJSON ¶
func (t *TransactionError) UnmarshalJSON(data []byte) (err error)
type TransactionSignature ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.