web3

package
v0.0.0-...-d9a1657 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodEthSubscription = "eth_subscription"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeader

type BlockHeader struct {
	Hash       string `json:"hash"`
	Number     string `json:"number"`
	ParentHash string `json:"parentHash"`
	Timestamp  string `json:"timestamp"`
}

func (*BlockHeader) MustNumberUint64

func (h *BlockHeader) MustNumberUint64() uint64

func (*BlockHeader) NumberUint64

func (h *BlockHeader) NumberUint64() (uint64, error)

type ClientInfo

type ClientInfo struct {
	NetworkId     uint64
	ChainId       uint64
	ClientId      string        `json:"clientId"`
	ClientVersion ClientVersion `json:"clientVersion"`
}

type ClientVersion

type ClientVersion struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	OS       string `json:"os"`
	Language string `json:"language"`
}

func ParseClientVersion

func ParseClientVersion(str string) (ClientVersion, error)

func (ClientVersion) String

func (cv ClientVersion) String() string

type NodeInfo

type NodeInfo struct {
	Id            string          `json:"id"`
	Ip            string          `json:"ip"`
	Name          string          `json:"name"`
	Enode         string          `json:"enode"`
	Ports         json.RawMessage `json:"ports"`
	Protocols     json.RawMessage `json:"protocols"`
	ListenAddress string          `json:"listenAddr"`
}

func (*NodeInfo) ParseClientVersion

func (n *NodeInfo) ParseClientVersion() (ClientVersion, error)

type Session

type Session struct {
	ClientInfo *ClientInfo
	// contains filtered or unexported fields
}

func NewSession

func NewSession(log *zap.Logger, conn *websocket.Conn, clientId string) *Session

func (*Session) BlockByNumber

func (s *Session) BlockByNumber(ctx context.Context, number uint64) (json.RawMessage, error)

func (*Session) BlockNumber

func (s *Session) BlockNumber(ctx context.Context) (uint64, error)

func (*Session) Init

func (s *Session) Init() error

func (*Session) Invoke

func (s *Session) Invoke(ctx context.Context, id, method string, params, result interface{}) error

func (*Session) InvokeRequest

func (s *Session) InvokeRequest(ctx context.Context, req *pjrpc.Request, resp *json.RawMessage) error

func (*Session) LatestBlock

func (s *Session) LatestBlock(ctx context.Context) (json.RawMessage, error)

func (*Session) Listen

func (s *Session) Listen() error

func (*Session) LoadBlock

func (s *Session) LoadBlock(number uint64) (*BlockHeader, error)

func (*Session) NewHeads

func (s *Session) NewHeads() <-chan *json.RawMessage

func (*Session) Shutdown

func (s *Session) Shutdown() error

type SubscriptionNotification

type SubscriptionNotification struct {
	SubscriptionId string          `json:"subscription"`
	Result         json.RawMessage `json:"result"`
}

func (*SubscriptionNotification) UnmarshalResult

func (sn *SubscriptionNotification) UnmarshalResult(result interface{}) error

Jump to

Keyboard shortcuts

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