rpc

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevnetRPCEndpoint  = "https://api.devnet.solana.com"
	TestnetRPCEndpoint = "https://api.testnet.solana.com"
	MainnetRPCEndpoint = "https://api.mainnet-beta.solana.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Commitment

type Commitment string
const (
	CommitmentFinalized Commitment = "finalized"
	CommitmentConfirmed Commitment = "confirmed"
	CommitmentProcessed Commitment = "processed"
)

type Context

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

type Encoding

type Encoding string
const (
	EncodingBase58     Encoding = "base58" // limited to Account data of less than 128 bytes
	EncodingBase64     Encoding = "base64"
	EncodingBase64Zstd Encoding = "base64+zstd"
)

type ErrorResponse

type ErrorResponse struct {
	Code    int                    `json:"code"`
	Message string                 `json:"message"`
	Data    map[string]interface{} `json:"data,omitempty"`
}

type FeeCalculator

type FeeCalculator struct {
	LamportsPerSignature uint64 `json:"lamportsPerSignature"`
}

FeeCalculator is a list of fee

type GeneralResponse

type GeneralResponse struct {
	JsonRPC string         `json:"jsonrpc"`
	ID      uint64         `json:"id"`
	Error   *ErrorResponse `json:"error,omitempty"`
}

type GetAccountInfoConfig

type GetAccountInfoConfig struct {
	Commitment Commitment                     `json:"commitment,omitempty"`
	Encoding   GetAccountInfoConfigEncoding   `json:"encoding,omitempty"`
	DataSlice  *GetAccountInfoConfigDataSlice `json:"dataSlice,omitempty"`
}

GetAccountInfoConfig is an option config for `getAccountInfo`

type GetAccountInfoConfigDataSlice

type GetAccountInfoConfigDataSlice struct {
	Offset uint64 `json:"offset,omitempty"`
	Length uint64 `json:"length,omitempty"`
}

GetAccountInfoConfigDataSlice is a part of GetAccountInfoConfig

type GetAccountInfoConfigEncoding

type GetAccountInfoConfigEncoding string

GetAccountInfoConfigEncoding is account's data encode format

const (
	// GetAccountInfoConfigEncodingBase58 limited to Account data of less than 128 bytes
	GetAccountInfoConfigEncodingBase58     GetAccountInfoConfigEncoding = "base58"
	GetAccountInfoConfigEncodingJsonParsed GetAccountInfoConfigEncoding = "jsonParsed"
	GetAccountInfoConfigEncodingBase64     GetAccountInfoConfigEncoding = "base64"
	GetAccountInfoConfigEncodingBase64Zstd GetAccountInfoConfigEncoding = "base64+zstd"
)

type GetAccountInfoResponse

type GetAccountInfoResponse struct {
	GeneralResponse
	Result GetAccountInfoResult `json:"result"`
}

GetAccountInfoResponse is a full raw rpc response of `getAccountInfo`

type GetAccountInfoResult

type GetAccountInfoResult struct {
	Context Context                   `json:"context"`
	Value   GetAccountInfoResultValue `json:"value"`
}

GetAccountInfoResult is rpc result of `getAccountInfo`

type GetAccountInfoResultValue

type GetAccountInfoResultValue struct {
	Lamports  uint64      `json:"lamports"`
	Owner     string      `json:"owner"`
	Excutable bool        `json:"excutable"`
	RentEpoch uint64      `json:"rentEpoch"`
	Data      interface{} `json:"data"`
}

GetAccountInfoResultValue is rpc result of `getAccountInfo`

type GetBalanceConfig

type GetBalanceConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

GetBalanceConfig is a option config for `getBalance`

type GetBalanceResponse

type GetBalanceResponse struct {
	GeneralResponse
	Result GetBalanceResult `json:"result"`
}

GetBalanceResponse is a full raw rpc response of `getBalance`

type GetBalanceResult

type GetBalanceResult struct {
	Context Context `json:"context"`
	Value   uint64  `json:"value"`
}

GetBalanceResult is a part of raw rpc response of `getBalance`

type GetBlockCommitmentResponse

type GetBlockCommitmentResponse struct {
	Commitment []uint64 `json:"commitment"`
	TotalStake uint64   `json:"totalStake"`
}

type GetBlockConfig

type GetBlockConfig struct {
	// TODO custom
	// Encoding           string     `json:"encoding"`             // default: "json", either "json", "jsonParsed", "base58" (slow), "base64"
	// TransactionDetails string     `json:"transactionDetails"`   // default: "full", either "full", "signatures", "none"
	Commitment Commitment `json:"commitment,omitempty"` // "processed" is not supported. If parameter not provided, the default is "finalized".
}

type GetBlockHeightConfig

type GetBlockHeightConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

type GetBlockResponse

type GetBlockResponse struct {
	Blockhash         string `json:"blockhash"`
	PreviousBlockhash string `json:"previousBlockhash"`
	ParentSLot        uint64 `json:"parentSlot"`
	BlockTime         int64  `json:"blockTime"`
	Transactions      []struct {
		Meta        TransactionMeta `json:"meta"`
		Transaction Transaction     `json:"transaction"`
	} `json:"transactions"`
	Rewards []struct {
		Pubkey      string `json:"pubkey"`
		Lamports    int64  `json:"lamports"`
		PostBalance uint64 `json:"postBalance"`
		RewardType  string `json:"rewardType"` // type of reward: "fee", "rent", "voting", "staking"
	} `json:"rewards"`
}

type GetBlocksConfig

type GetBlocksConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

type GetBlocksWithLimitConfig

type GetBlocksWithLimitConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

type GetClusterNodesResponse

type GetClusterNodesResponse struct {
	FeatureSet   *uint64 `json:"featureSet"`
	Gossip       string  `json:"gossip"`
	Pubkey       string  `json:"pubkey"`
	RPC          string  `json:"rpc"`
	ShredVersion int     `json:"shredVersion"`
	Tpu          string  `json:"tpu"`
	Version      *string `json:"version"`
}

type GetConfirmBlockResponse

type GetConfirmBlockResponse struct {
	Blockhash         string `json:"blockhash"`
	PreviousBlockhash string `json:"previousBlockhash"`
	ParentSLot        uint64 `json:"parentSlot"`
	BlockTime         int64  `json:"blockTime"`
	Transactions      []struct {
		Meta        TransactionMeta `json:"meta"`
		Transaction Transaction     `json:"transaction"`
	} `json:"transactions"`
	Rewards []struct {
		Pubkey      string `json:"pubkey"`
		Lamports    int64  `json:"lamports"`
		PostBalance uint64 `json:"postBalance"`
		RewardType  string `json:"rewardType"` // type of reward: "fee", "rent", "voting", "staking"
	} `json:"rewards"`
}

type GetConfirmedSignaturesForAddress

type GetConfirmedSignaturesForAddress struct {
	BlockTime *int64      `json:"blockTime"`
	Err       interface{} `json:"err"`
	Memo      *string     `json:"memo"`
	Signature string      `json:"signature"`
	Slot      int64       `json:"slot"`
}

type GetConfirmedSignaturesForAddressConfig

type GetConfirmedSignaturesForAddressConfig struct {
	Limit      int        `json:"limit,omitempty"`
	Before     string     `json:"before,omitempty"`
	Until      string     `json:"until,omitempty"`
	Commitment Commitment `json:"commitment,omitempty"`
}

type GetConfirmedTransactionResponse

type GetConfirmedTransactionResponse struct {
	Slot        uint64          `json:"slot"`
	Meta        TransactionMeta `json:"meta"`
	Transaction Transaction     `json:"transaction"`
}

type GetEpochInfoResponse

type GetEpochInfoResponse struct {
	AbsoluteSlot uint64 `json:"absoluteSlot"`
	BlockHeight  uint64 `json:"blockHeight"`
	Epoch        uint64 `json:"epoch"`
	SlotIndex    uint64 `json:"slotIndex"`
	SlotsInEpoch uint64 `json:"slotsInEpoch"`
}

type GetInflationRate

type GetInflationRate struct {
	Epoch      int64   `json:"epoch"`
	Foundation float64 `json:"foundation"`
	Total      float64 `json:"total"`
	Validator  float64 `json:"validator"`
}

type GetProgramAccounts

type GetProgramAccounts struct {
	Pubkey  string                    `json:"pubkey"`
	Account GetProgramAccountsAccount `json:"account"`
}

type GetProgramAccountsAccount

type GetProgramAccountsAccount struct {
	Lamports   uint64      `json:"lamports"`
	Owner      string      `json:"owner"`
	RentEpoch  uint64      `json:"rentEpoch"`
	Data       interface{} `json:"data"`
	Executable bool        `json:"executable"`
}

type GetProgramAccountsConfig

type GetProgramAccountsConfig struct {
	Encoding   GetProgramAccountsConfigEncoding   `json:"encoding,omitempty"`
	Commitment Commitment                         `json:"commitment,omitempty"`
	DataSlice  *GetProgramAccountsConfigDataSlice `json:"dataSlice,omitempty"`
	Filters    []GetProgramAccountsConfigFilter   `json:"filters,omitempty"`
}

GetProgramAccountsConfig is a option config for `getProgramAccounts`

type GetProgramAccountsConfigDataSlice

type GetProgramAccountsConfigDataSlice struct {
	Offset uint64 `json:"offset"`
	Length uint64 `json:"length"`
}

GetProgramAccountsConfigDataSlice is a part of GetProgramAccountsConfig

type GetProgramAccountsConfigEncoding

type GetProgramAccountsConfigEncoding string
const (
	// GetProgramAccountsConfigEncodingBase58 limited to Account data of less than 128 bytes
	GetProgramAccountsConfigEncodingBase58     GetProgramAccountsConfigEncoding = "base58"
	GetProgramAccountsConfigEncodingJsonParsed GetProgramAccountsConfigEncoding = "jsonParsed"
	GetProgramAccountsConfigEncodingBase64     GetProgramAccountsConfigEncoding = "base64"
	GetProgramAccountsConfigEncodingBase64Zstd GetProgramAccountsConfigEncoding = "base64+zstd"
)

type GetProgramAccountsConfigFilter

type GetProgramAccountsConfigFilter struct {
	MemCmp   *GetProgramAccountsConfigFilterMemCmp `json:"memcmp,omitempty"`
	DataSize uint64                                `json:"dataSize,omitempty"`
}

GetProgramAccountsConfigFilter you can set either MemCmp or DataSize but can be both, if needed, separate them into two

type GetProgramAccountsConfigFilterMemCmp

type GetProgramAccountsConfigFilterMemCmp struct {
	Offset uint64 `json:"offset"`
	Bytes  string `json:"bytes"`
}

type GetProgramAccountsResponse

type GetProgramAccountsResponse struct {
	GeneralResponse
	Result []GetProgramAccounts `json:"result"`
}

GetProgramAccountsResponse is a full rpc response for `getProgramAccounts`

type GetProgramAccountsWithContextResponse

type GetProgramAccountsWithContextResponse struct {
	GeneralResponse
	Result GetProgramAccountsWithContextResult `json:"result"`
}

GetProgramAccountsResponse is a full rpc response for `getProgramAccounts` with context

type GetProgramAccountsWithContextResult

type GetProgramAccountsWithContextResult struct {
	Context Context              `json:"context"`
	Value   []GetProgramAccounts `json:"value"`
}

type GetRecentBlockHashResponse

type GetRecentBlockHashResponse struct {
	GeneralResponse
	Result GetRecentBlockHashResult `json:"result"`
}

GetRecentBlockHashResponse is full raw response of `getRecentBlockhash`

type GetRecentBlockHashResult

type GetRecentBlockHashResult struct {
	Context Context                       `json:"context"`
	Value   GetRecentBlockHashResultValue `json:"value"`
}

GetRecentBlockHashResult is part of response of `getRecentBlockhash`

type GetRecentBlockHashResultValue

type GetRecentBlockHashResultValue struct {
	Blockhash     string        `json:"blockhash"`
	FeeCalculator FeeCalculator `json:"feeCalculator"`
}

GetRecentBlockHashResultValue is part of response of `getRecentBlockhash`

type GetRecentBlockhashConfig

type GetRecentBlockhashConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

GetRecentBlockhashConfig is a option config for `getRecentBlockhash`

type GetSignatureStatusesResponse

type GetSignatureStatusesResponse struct {
	Slot               uint64      `json:"slot"`
	Confirmations      *uint64     `json:"confirmations"`
	ConfirmationStatus *Commitment `json:"confirmationStatus"`
	Err                interface{} `json:"err"`
}

type GetSignaturesForAddress

type GetSignaturesForAddress struct {
	Signature string      `json:"signature"`
	Slot      uint64      `json:"slot"`
	BlockTime *int64      `json:"blockTime"`
	Err       interface{} `json:"err"`
	Memo      *string     `json:"memo"`
}

type GetSignaturesForAddressConfig

type GetSignaturesForAddressConfig struct {
	Limit      int        `json:"limit,omitempty"` // between 1 and 1000, default: 1000
	Before     string     `json:"before,omitempty"`
	Until      string     `json:"until,omitempty"`
	Commitment Commitment `json:"commitment,omitempty"` // "processed" is not supported, default is "finalized"
}

type GetSlotConfig

type GetSlotConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

GetSlotConfig is a option config for `getSlot`

type GetSlotResponse

type GetSlotResponse struct {
	GeneralResponse
	Result uint64 `json:"result"`
}

GetSlotResponse is a full raw rpc response of `getSlot`

type GetStakeActivationConfig

type GetStakeActivationConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
	Epoch      uint64     `json:"epoch,omitempty"`
}

type GetStakeActivationResponse

type GetStakeActivationResponse struct {
	State    StakeActivationState `json:"state"`
	Active   uint64               `json:"active"`
	Inactive uint64               `json:"inactive"`
}

type GetTokenAccountBalanceConfig

type GetTokenAccountBalanceConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

type GetTokenAccountBalanceResponse

type GetTokenAccountBalanceResponse struct {
	GeneralResponse
	Result GetTokenAccountBalanceResult `json:"result"`
}

type GetTokenAccountBalanceResult

type GetTokenAccountBalanceResult struct {
	Context Context                           `json:"context"`
	Value   GetTokenAccountBalanceResultValue `json:"value"`
}

type GetTokenAccountBalanceResultValue

type GetTokenAccountBalanceResultValue struct {
	Amount         string `json:"amount"`
	Decimals       uint8  `json:"decimals"`
	UIAmountString string `json:"uiAmountString"`
}

type GetTokenSupply

type GetTokenSupply struct {
	Amount         string `json:"amount"`
	Decimals       int64  `json:"decimals"`
	UIAmountString string `json:"uiAmountString"`
}

type GetTransaction

type GetTransaction struct {
	Slot        uint64          `json:"slot"`
	Meta        TransactionMeta `json:"meta"`
	Transaction Transaction     `json:"transaction"`
}

type GetTransactionWithLimitConfig

type GetTransactionWithLimitConfig struct {
	// TODO custom encoding
	// Encoding   string     `json:"encoding"`          // either "json", "jsonParsed", "base58" (slow), "base64", default: json
	Commitment Commitment `json:"commitment,omitempty"` // "processed" is not supported. If parameter not provided, the default is "finalized".
}

type GetVersionResponse

type GetVersionResponse struct {
	SolanaCore string `json:"solana-core"`
	FeatureSet uint64 `json:"feature-set"`
}

type Instruction

type Instruction struct {
	ProgramIDIndex uint64   `json:"programIdIndex"`
	Accounts       []uint64 `json:"accounts"`
	Data           string   `json:"data"`
}

type Message

type Message struct {
	Header          MessageHeader `json:"header"`
	AccountKeys     []string      `json:"accountKeys"`
	RecentBlockhash string        `json:"recentBlockhash"`
	Instructions    []Instruction `json:"instructions"`
}

type MessageHeader

type MessageHeader struct {
	NumRequiredSignatures       uint8 `json:"numRequiredSignatures"`
	NumReadonlySignedAccounts   uint8 `json:"numReadonlySignedAccounts"`
	NumReadonlyUnsignedAccounts uint8 `json:"numReadonlyUnsignedAccounts"`
}

type RpcClient

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

func NewRpcClient

func NewRpcClient(endpoint string) RpcClient

func (*RpcClient) Call

func (c *RpcClient) Call(ctx context.Context, params ...interface{}) ([]byte, error)

Call will return body of response. if http code beyond 200~300, the error also returns.

func (*RpcClient) GetAccountInfo

func (c *RpcClient) GetAccountInfo(ctx context.Context, base58Addr string) (GetAccountInfoResponse, error)

GetAccountInfo returns all information associated with the account of provided Pubkey

func (*RpcClient) GetAccountInfoWithCfg

func (c *RpcClient) GetAccountInfoWithCfg(ctx context.Context, base58Addr string, cfg GetAccountInfoConfig) (GetAccountInfoResponse, error)

GetAccountInfo returns all information associated with the account of provided Pubkey

func (*RpcClient) GetBalance

func (c *RpcClient) GetBalance(ctx context.Context, base58Addr string) (GetBalanceResponse, error)

GetBalance returns the SOL balance

func (*RpcClient) GetBalanceWithCfg

func (c *RpcClient) GetBalanceWithCfg(ctx context.Context, base58Addr string, cfg GetBalanceConfig) (GetBalanceResponse, error)

GetBalanceWithCfg returns the SOL balance

func (*RpcClient) GetBlock

func (s *RpcClient) GetBlock(ctx context.Context, slot uint64, cfg GetBlockConfig) (GetBlockResponse, error)

NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6 GetBlock returns identity and transaction information about a confirmed block in the ledger

func (*RpcClient) GetBlockCommitment

func (s *RpcClient) GetBlockCommitment(ctx context.Context, slot uint64) (GetBlockCommitmentResponse, error)

GetBlockCommitment returns commitment for particular block

func (*RpcClient) GetBlockHeight

func (s *RpcClient) GetBlockHeight(ctx context.Context, cfg GetBlockHeightConfig) (uint64, error)

GetBlockHeight returns the current block height of the node

func (*RpcClient) GetBlockTime

func (s *RpcClient) GetBlockTime(ctx context.Context, slot uint64) (int64, error)

GetBlockTime returns the estimated production time of a block.

func (*RpcClient) GetBlocks

func (s *RpcClient) GetBlocks(ctx context.Context, startSlot uint64, endSlot uint64, cfg GetBlocksConfig) ([]uint64, error)

NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6 GetBlocks returns a list of confirmed blocks between two slots Max range allowed is 500,000 slots

func (*RpcClient) GetBlocksWithLimit

func (s *RpcClient) GetBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64, cfg GetBlocksWithLimitConfig) ([]uint64, error)

NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocksWithLimit for solana-core v1.6 GetBlocksWithLimit returns a list of confirmed blocks starting at the given slot

func (*RpcClient) GetClusterNodes

func (s *RpcClient) GetClusterNodes(ctx context.Context) ([]GetClusterNodesResponse, error)

GetClusterNodes returns information about all the nodes participating in the cluster

func (*RpcClient) GetConfirmedBlock

func (s *RpcClient) GetConfirmedBlock(ctx context.Context, slot uint64) (GetConfirmBlockResponse, error)

DEPRECATED: Please use getBlock instead This method is expected to be removed in solana-core v1.8 GetConfirmedBlock returns identity and transaction information about a confirmed block in the ledger

func (*RpcClient) GetConfirmedBlocks

func (s *RpcClient) GetConfirmedBlocks(ctx context.Context, startSlot uint64, endSlot uint64) ([]uint64, error)

DEPRECATED: Please use getBlocks instead This method is expected to be removed in solana-core v1.8 GetConfirmedBlocks returns a list of confirmed blocks between two slots

func (*RpcClient) GetConfirmedBlocksWithLimit

func (s *RpcClient) GetConfirmedBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64) ([]uint64, error)

DEPRECATED: Please use getBlocksWithLimit instead This method is expected to be removed in solana-core v1.8 GetConfirmedBlocksWithLimit returns a list of confirmed blocks starting at the given slot

func (*RpcClient) GetConfirmedSignaturesForAddress

func (s *RpcClient) GetConfirmedSignaturesForAddress(ctx context.Context, base58Addr string, config GetConfirmedSignaturesForAddressConfig) ([]GetConfirmedSignaturesForAddress, error)

DEPRECATED: Please use getSignaturesForAddress instead This method is expected to be removed in solana-core v1.8 GetConfirmedSignaturesForAddress returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block

func (*RpcClient) GetConfirmedTransaction

func (s *RpcClient) GetConfirmedTransaction(ctx context.Context, txhash string) (GetConfirmedTransactionResponse, error)

DEPRECATED: Please use getTransaction instead This method is expected to be removed in solana-core v1.8 GetConfirmedTransaction returns transaction details for a confirmed transaction

func (*RpcClient) GetEpochInfo

func (s *RpcClient) GetEpochInfo(ctx context.Context, commitment Commitment) (GetEpochInfoResponse, error)

GetEpochInfo returns information about the current epoch

func (*RpcClient) GetFirstAvailableBlock

func (s *RpcClient) GetFirstAvailableBlock(ctx context.Context) (uint64, error)

GetFirstAvailableBlock returns the slot of the lowest confirmed block that has not been purged from the ledger

func (*RpcClient) GetGenesisHash

func (s *RpcClient) GetGenesisHash(ctx context.Context) (string, error)

GetGenesisHash returns the genesis hash

func (*RpcClient) GetIdentity

func (s *RpcClient) GetIdentity(ctx context.Context) (string, error)

GetIdentity returns the identity pubkey for the current node

func (*RpcClient) GetInflationRate

func (s *RpcClient) GetInflationRate(ctx context.Context) (GetInflationRate, error)

GetInflationRate returns the specific inflation values for the current epoch

func (*RpcClient) GetMinimumBalanceForRentExemption

func (s *RpcClient) GetMinimumBalanceForRentExemption(ctx context.Context, accountDataLen uint64) (uint64, error)

GetMinimumBalanceForRentExemption returns minimum balance required to make account rent exempt.

func (*RpcClient) GetProgramAccounts

func (c *RpcClient) GetProgramAccounts(ctx context.Context, programId string) (GetProgramAccountsResponse, error)

func (*RpcClient) GetProgramAccountsWithConfig

func (c *RpcClient) GetProgramAccountsWithConfig(ctx context.Context, programId string, cfg GetProgramAccountsConfig) (GetProgramAccountsResponse, error)

func (*RpcClient) GetProgramAccountsWithContext

func (c *RpcClient) GetProgramAccountsWithContext(ctx context.Context, programId string) (GetProgramAccountsWithContextResponse, error)

func (*RpcClient) GetProgramAccountsWithContextAndConfig

func (c *RpcClient) GetProgramAccountsWithContextAndConfig(ctx context.Context, programId string, cfg GetProgramAccountsConfig) (GetProgramAccountsWithContextResponse, error)

func (*RpcClient) GetRecentBlockhash

func (c *RpcClient) GetRecentBlockhash(ctx context.Context) (GetRecentBlockHashResponse, error)

getRecentBlockhash returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.

func (*RpcClient) GetRecentBlockhashWithConfig

func (c *RpcClient) GetRecentBlockhashWithConfig(ctx context.Context, cfg GetRecentBlockhashConfig) (GetRecentBlockHashResponse, error)

getRecentBlockhash returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.

func (*RpcClient) GetSignatureStatuses

func (s *RpcClient) GetSignatureStatuses(ctx context.Context, signatures []string) ([]GetSignatureStatusesResponse, error)

func (*RpcClient) GetSignaturesForAddress

func (s *RpcClient) GetSignaturesForAddress(ctx context.Context, base58Addr string, config GetConfirmedSignaturesForAddressConfig) ([]GetConfirmedSignaturesForAddress, error)

NEW: This method is only available in solana-core v1.7 or newer. Please use "getConfirmedSignaturesForAddress2" for solana-core v1.6 GetSignaturesForAddress Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block

func (*RpcClient) GetSlot

func (c *RpcClient) GetSlot(ctx context.Context) (GetSlotResponse, error)

GetSlot returns the SOL balance

func (*RpcClient) GetSlotWithCfg

func (c *RpcClient) GetSlotWithCfg(ctx context.Context, cfg GetSlotConfig) (GetSlotResponse, error)

GetSlotWithCfg returns the SOL balance

func (*RpcClient) GetStakeActivation

func (s *RpcClient) GetStakeActivation(ctx context.Context, address string, cfg GetStakeActivationConfig) (GetStakeActivationResponse, error)

GetStakeActivation returns epoch activation information for a stake account

func (*RpcClient) GetTokenAccountBalance

func (c *RpcClient) GetTokenAccountBalance(ctx context.Context, base58Addr string) (GetTokenAccountBalanceResponse, error)

GetTokenAccountBalance returns the token balance of an SPL Token account

func (*RpcClient) GetTokenAccountBalanceWithCfg

func (c *RpcClient) GetTokenAccountBalanceWithCfg(ctx context.Context, base58Addr string, cfg GetTokenAccountBalanceConfig) (GetTokenAccountBalanceResponse, error)

GetTokenAccountBalance returns the token balance of an SPL Token account

func (*RpcClient) GetTokenSupply

func (s *RpcClient) GetTokenSupply(ctx context.Context, mintBase58Addr string, commitment Commitment) (GetTokenSupply, error)

GetTokenSupply returns the total supply of an SPL Token type.

func (*RpcClient) GetTransaction

NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedTransaction for solana-core v1.6 GetConfirmedTransaction returns transaction details for a confirmed transaction

func (*RpcClient) GetTransactionCount

func (s *RpcClient) GetTransactionCount(ctx context.Context) (uint64, error)

GetTransactionCount returns the current transaction count from the ledger

func (*RpcClient) GetVersion

func (s *RpcClient) GetVersion(ctx context.Context) (GetVersionResponse, error)

GetVersion returns the current solana versions running on the node

func (*RpcClient) MinimumLedgerSlot

func (s *RpcClient) MinimumLedgerSlot(ctx context.Context) (uint64, error)

MinimumLedgerSlot returns the lowest slot that the node has information about in its ledger. This value may increase over time if the node is configured to purge older ledger data

func (*RpcClient) RequestAirdrop

func (s *RpcClient) RequestAirdrop(ctx context.Context, base58Addr string, lamport uint64) (string, error)

RequestAirdrop Requests an airdrop of lamports to a Pubkey, return string is Transaction Signature of airdrop, as base-58 encoded

func (*RpcClient) SendTransaction

func (c *RpcClient) SendTransaction(ctx context.Context, tx string) (SendTransactionResponse, error)

SendTransaction submits a signed transaction to the cluster for processing

func (*RpcClient) SendTransactionWithConfig

func (c *RpcClient) SendTransactionWithConfig(ctx context.Context, tx string, cfg SendTransactionConfig) (SendTransactionResponse, error)

SendTransaction submits a signed transaction to the cluster for processing

func (*RpcClient) SimulateTransaction

func (s *RpcClient) SimulateTransaction(ctx context.Context, rawTx string, cfg SimulateTransactionConfig) (SimulateTransactionResponse, error)

SimulateTransaction simulate sending a transaction

type SendTransactionConfig

type SendTransactionConfig struct {
	SkipPreflight       bool                          `json:"skipPreflight,omitempty"`       // default: false
	PreflightCommitment Commitment                    `json:"preflightCommitment,omitempty"` // default: finalized
	Encoding            SendTransactionConfigEncoding `json:"encoding,omitempty"`            // default: base58
	MaxRetries          uint64                        `json:"maxRetries,omitempty"`
}

type SendTransactionConfigEncoding

type SendTransactionConfigEncoding string
const (
	SendTransactionConfigEncodingBase58 SendTransactionConfigEncoding = "base58"
	SendTransactionConfigEncodingBase64 SendTransactionConfigEncoding = "base64"
)

type SendTransactionResponse

type SendTransactionResponse struct {
	GeneralResponse
	Result string `json:"result"`
}

type SimulateTransactionConfig

type SimulateTransactionConfig struct {
	SigVerify              bool                               `json:"sigVerify,omitempty"`              // default: false, conflicts with replace blockhash
	PreflightCommitment    Commitment                         `json:"preflightCommitment,omitempty"`    // default: finalized
	Encoding               SimulateTransactionEncoding        `json:"encoding,omitempty"`               // default: "base58", either "base58" or "base64"
	ReplaceRecentBlockhash bool                               `json:"replaceRecentBlockhash,omitempty"` // default: false, conflicts with sigVerify
	Accounts               *SimulateTransactionConfigAccounts `json:"accounts,omitempty"`
}

type SimulateTransactionConfigAccounts

type SimulateTransactionConfigAccounts struct {
	Encoding  string   `json:"encoding,omitempty"`
	Addresses []string `json:"addresses"`
}

type SimulateTransactionConfigAccountsEncoding

type SimulateTransactionConfigAccountsEncoding string

type SimulateTransactionEncoding

type SimulateTransactionEncoding string
const (
	SimulateTransactionEncodingBase58 SimulateTransactionEncoding = "base58" // (slow, DEPRECATED)
	SimulateTransactionEncodingBase64 SimulateTransactionEncoding = "base64"
)

type SimulateTransactionResponse

type SimulateTransactionResponse struct {
	Err      interface{}              `json:"err"`
	Logs     []string                 `json:"logs"`
	Accounts []GetAccountInfoResponse `json:"accounts"`
}

type StakeActivationState

type StakeActivationState string
const (
	StakeActivationStateActive       StakeActivationState = "active"
	StakeActivationStateInactive     StakeActivationState = "inactive"
	StakeActivationStateActivating   StakeActivationState = "activating"
	StakeActivationStateDeactivating StakeActivationState = "deactivating"
)

type Transaction

type Transaction struct {
	Signatures []string `json:"signatures"`
	Message    Message  `json:"message"`
}

type TransactionMeta

type TransactionMeta struct {
	Fee               uint64                        `json:"fee"`
	PreBalances       []int64                       `json:"preBalances"`
	PostBalances      []int64                       `json:"postBalances"`
	PreTokenBalances  []TransactionMetaTokenBalance `json:"preTokenBalances"`
	PostTokenBalances []TransactionMetaTokenBalance `json:"postTokenBalances"`
	LogMessages       []string                      `json:"logMessages"`
	InnerInstructions []struct {
		Index        uint64        `json:"index"`
		Instructions []Instruction `json:"instructions"`
	} `json:"innerInstructions"`
	Err    interface{}            `json:"err"`
	Status map[string]interface{} `json:"status"`
}

type TransactionMetaTokenBalance

type TransactionMetaTokenBalance struct {
	AccountIndex  int    `json:"accountIndex"`
	Mint          string `json:"mint"`
	UITokenAmount struct {
		Amount         string `json:"amount"`
		Decimals       int64  `json:"decimals"`
		UIAmountString string `json:"uiAmountString"`
	} `json:"uiTokenAmount"`
}

Jump to

Keyboard shortcuts

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