rpcserver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetAccountEncodingBase58 = iota
	GetAccountEncodingBase64
	GetAccountEncodingBase64Zstd
	GetAccountEncodingJson
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfoPayload

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

type GetAccountInfoConfig

type GetAccountInfoConfig struct {
	Commitment     string
	EncodingType   *int
	DataSlice      *GetAccountInfoDataSlice
	MinContextSlot uint64
}

type GetAccountInfoDataSlice

type GetAccountInfoDataSlice struct {
	Len    *uint64
	Offset *uint64
}

type GetAccountInfoResp

type GetAccountInfoResp struct {
	Context GetAccountInfoRespContext `json:"context"`
	Value   *GetAccountInfoRespValue  `json:"value"`
}

type GetAccountInfoRespContext

type GetAccountInfoRespContext struct {
	ApiVersion string `json:"apiVersion"`
	Slot       uint64 `json:"slot"`
}

type GetAccountInfoRespValue

type GetAccountInfoRespValue struct {
	Data       any    `json:"data"`
	Executable bool   `json:"executable"`
	Lamports   uint64 `json:"lamports"`
	Owner      string `json:"owner"`
	RentEpoch  uint64 `json:"rentEpoch"`
	Space      uint64 `json:"space"`
}

type GetEpochInfoResp

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

type GetLatestBlockhashResp

type GetLatestBlockhashResp struct {
	Context GetLatestBlockhashRespContext `json:"context"`
	Value   *GetLatestBlockhashRespValue  `json:"value"`
}

type GetLatestBlockhashRespContext

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

type GetLatestBlockhashRespValue

type GetLatestBlockhashRespValue struct {
	Blockhash            string `json:"blockhash"`
	LastValidBlockHeight uint64 `json:"lastValidBlockHeight"`
}

type InnerInstruction

type InnerInstruction struct {
	ProgramIdIndex uint8   `json:"programIdIndex"`
	Accounts       []uint8 `json:"accounts"`
	Data           string  `json:"data"`
	StackHeight    *uint32 `json:"stackHeight"`
}

InnerInstruction matches Agave's UiCompiledInstruction. `Data` is base58-encoded; `StackHeight` is nil when not tracked. `StackHeight` is `Option<u32>` in Agave's wire format; using *uint32 here so the field's JSON-number range matches the spec exactly even though real-world CPI depth never exceeds the 4-deep cap.

type InnerInstructionGroup

type InnerInstructionGroup struct {
	Index        uint8              `json:"index"`
	Instructions []InnerInstruction `json:"instructions"`
}

type InvalidParamsError

type InvalidParamsError struct {
	Message string
}

func (*InvalidParamsError) Error

func (e *InvalidParamsError) Error() string

func (*InvalidParamsError) FromJSONRPCError

func (e *InvalidParamsError) FromJSONRPCError(rpcErr jsonrpc.JSONRPCError) error

func (*InvalidParamsError) ToJSONRPCError

func (e *InvalidParamsError) ToJSONRPCError() (jsonrpc.JSONRPCError, error)

type LoadedAddressesPayload

type LoadedAddressesPayload struct {
	Readonly []string `json:"readonly"`
	Writable []string `json:"writable"`
}

type MinContextSlotNotReachedError

type MinContextSlotNotReachedError struct {
	ContextSlot uint64
}

func (*MinContextSlotNotReachedError) Error

func (*MinContextSlotNotReachedError) FromJSONRPCError

func (e *MinContextSlotNotReachedError) FromJSONRPCError(rpcErr jsonrpc.JSONRPCError) error

func (*MinContextSlotNotReachedError) ToJSONRPCError

type ReplacementBlockhashPayload

type ReplacementBlockhashPayload struct {
	Blockhash            string `json:"blockhash"`
	LastValidBlockHeight uint64 `json:"lastValidBlockHeight"`
}

type ReturnDataPayload

type ReturnDataPayload struct {
	ProgramId string   `json:"programId"`
	Data      []string `json:"data"`
}

type RpcServer

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

func NewRpcServer

func NewRpcServer(acctsDb *accountsdb.AccountsDb, port uint16) *RpcServer

func (*RpcServer) GetAccountInfo

func (rpcServer *RpcServer) GetAccountInfo(ctx context.Context, p jsonrpc.RawParams) (GetAccountInfoResp, error)

func (*RpcServer) GetBankHash

func (rpcServer *RpcServer) GetBankHash(ctx context.Context, p jsonrpc.RawParams) (string, error)

func (*RpcServer) GetBlockHeight

func (rpcServer *RpcServer) GetBlockHeight(ctx context.Context, p jsonrpc.RawParams) (uint64, error)

func (*RpcServer) GetEpochInfo

func (rpcServer *RpcServer) GetEpochInfo(ctx context.Context, p jsonrpc.RawParams) (GetEpochInfoResp, error)

func (*RpcServer) GetLatestBlockhash

func (rpcServer *RpcServer) GetLatestBlockhash(ctx context.Context, p jsonrpc.RawParams) (GetLatestBlockhashResp, error)

func (*RpcServer) SendTransaction

func (rpcServer *RpcServer) SendTransaction(ctx context.Context, p jsonrpc.RawParams) (string, error)

func (*RpcServer) SetSlotCtx

func (rpcServer *RpcServer) SetSlotCtx(slotCtx *sealevel.SlotCtx)

func (*RpcServer) SimulateTransaction

func (rpcServer *RpcServer) SimulateTransaction(ctx context.Context, p jsonrpc.RawParams) (SimulateTransactionResp, error)

func (*RpcServer) Start

func (rpcServer *RpcServer) Start()

type SendTransactionPreflightFailureError

type SendTransactionPreflightFailureError struct {
	Message string
	Result  SimulateTransactionRespValue
}

func (*SendTransactionPreflightFailureError) Error

func (*SendTransactionPreflightFailureError) FromJSONRPCError

func (e *SendTransactionPreflightFailureError) FromJSONRPCError(rpcErr jsonrpc.JSONRPCError) error

func (*SendTransactionPreflightFailureError) ToJSONRPCError

type SimulateTransactionResp

type SimulateTransactionResp struct {
	Context SimulateTransactionRespContext `json:"context"`
	Value   SimulateTransactionRespValue   `json:"value"`
}

type SimulateTransactionRespContext

type SimulateTransactionRespContext struct {
	ApiVersion string `json:"apiVersion"`
	Slot       uint64 `json:"slot"`
}

type SimulateTransactionRespValue

type SimulateTransactionRespValue struct {
	Err                    interface{}                  `json:"err"`
	Logs                   *[]string                    `json:"logs"`
	Accounts               *[]*AccountInfoPayload       `json:"accounts"`
	UnitsConsumed          *uint64                      `json:"unitsConsumed"`
	ReturnData             *ReturnDataPayload           `json:"returnData"`
	InnerInstructions      *[]InnerInstructionGroup     `json:"innerInstructions"`
	ReplacementBlockhash   *ReplacementBlockhashPayload `json:"replacementBlockhash"`
	LoadedAccountsDataSize *uint32                      `json:"loadedAccountsDataSize"`
	Fee                    *uint64                      `json:"fee"`
	PreBalances            *[]uint64                    `json:"preBalances"`
	PostBalances           *[]uint64                    `json:"postBalances"`
	PreTokenBalances       *[]TokenBalancePayload       `json:"preTokenBalances"`
	PostTokenBalances      *[]TokenBalancePayload       `json:"postTokenBalances"`
	LoadedAddresses        *LoadedAddressesPayload      `json:"loadedAddresses"`
}

SimulateTransactionRespValue mirrors Agave's RpcSimulateTransactionResult field-for-field. Every field is emitted unconditionally as either a real value or null; no omitempty. Pointer types model Agave's Option<T> so nil → JSON null and a populated value → the value.

`Err` is intentionally left as interface{}: it is a true sum type (nil | string | *replay.TransactionError), and *replay.TransactionError carries a custom MarshalJSON. Wrapping it in a concrete struct would only force a custom MarshalJSON without adding type safety.

type TokenBalancePayload

type TokenBalancePayload struct {
	AccountIndex  uint8                `json:"accountIndex"`
	Mint          string               `json:"mint"`
	Owner         string               `json:"owner,omitempty"`
	ProgramId     string               `json:"programId,omitempty"`
	UiTokenAmount UiTokenAmountPayload `json:"uiTokenAmount"`
}

type UiTokenAmountPayload

type UiTokenAmountPayload struct {
	Amount         string   `json:"amount"`
	Decimals       uint8    `json:"decimals"`
	UiAmount       *float64 `json:"uiAmount"`
	UiAmountString string   `json:"uiAmountString"`
}

Jump to

Keyboard shortcuts

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