Documentation ¶
Index ¶
- Constants
- Variables
- func NewInternalError(msg string) *internalError
- func NewInvalidParamsError(msg string) *invalidParamsError
- func NewInvalidRequestError(msg string) *invalidRequestError
- func NewMethodNotFoundError(method string) *methodNotFoundError
- func NewSubscriptionNotFoundError(method string) *subscriptionNotFoundError
- type BlockNumber
- type BlockNumberOrHash
- type Error
- type GetBalanceParams
- type Request
- type Response
- type RpcFunc
- type RpcServer
Constants ¶
View Source
const ( PendingBlockFlag = "pending" LatestBlockFlag = "latest" EarliestBlockFlag = "earliest" )
View Source
const ( PendingBlockNumber = BlockNumber(-3) LatestBlockNumber = BlockNumber(-2) EarliestBlockNumber = BlockNumber(-1) )
Variables ¶
View Source
var (
ErrStateNotFound = errors.New("given root and slot not found in storage")
)
Functions ¶
func NewInternalError ¶
func NewInternalError(msg string) *internalError
func NewInvalidParamsError ¶
func NewInvalidParamsError(msg string) *invalidParamsError
func NewInvalidRequestError ¶
func NewInvalidRequestError(msg string) *invalidRequestError
func NewMethodNotFoundError ¶
func NewMethodNotFoundError(method string) *methodNotFoundError
func NewSubscriptionNotFoundError ¶
func NewSubscriptionNotFoundError(method string) *subscriptionNotFoundError
Types ¶
type BlockNumber ¶
type BlockNumber int64
func CreateBlockNumberPointer ¶
func CreateBlockNumberPointer(str string) (*BlockNumber, error)
func StringToBlockNumber ¶
func StringToBlockNumber(str string) (BlockNumber, error)
func (*BlockNumber) UnmarshalJSON ¶
func (b *BlockNumber) UnmarshalJSON(buffer []byte) error
UnmarshalJSON automatically decodes the user input for the block number, when a JSON RPC method is called
type BlockNumberOrHash ¶
type BlockNumberOrHash struct { BlockNumber *BlockNumber `json:"blockNumber,omitempty"` BlockHash *types.Hash `json:"blockHash,omitempty"` }
func (*BlockNumberOrHash) UnmarshalJSON ¶
func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error
UnmarshalJSON will try to extract the filter's data. Here are the possible input formats :
1 - "latest", "pending" or "earliest" - self-explaining keywords 2 - "0x2" - block number #2 (EIP-1898 backward compatible) 3 - {blockNumber: "0x2"} - EIP-1898 compliant block number #2 4 - {blockHash: "0xe0e..."} - EIP-1898 compliant block hash 0xe0e...
type GetBalanceParams ¶
type GetBalanceParams struct { Address types.Address Number *BlockNumber }
func (*GetBalanceParams) Unmarshal ¶
func (gp *GetBalanceParams) Unmarshal(params ...any) error
type RpcServer ¶
type RpcServer struct {
// contains filtered or unexported fields
}
func NewRpcServer ¶
func NewRpcServer(logger hclog.Logger, blockchain *blockchain.Blockchain, addr, port string) *RpcServer
func (*RpcServer) GetBalance ¶
not support "earliest" and "pending"
func (*RpcServer) GetBlockNumber ¶
Click to show internal directories.
Click to hide internal directories.