web3

package
v0.0.0-...-fbce341 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Author           string `json:"author,omitempty"`
	Miner            string `json:"miner,omitempty"`
	Difficulty       string `json:"difficulty"`
	TotalDifficulty  string `json:"totalDifficulty"`
	GasLimit         string `json:"gasLimit"`
	GasUsed          string `json:"gasUsed"`
	Hash             string `json:"hash"`
	MixHash          string `json:"mixHash"`
	LogsBloom        string `json:"logsBloom"`
	ExtraData        string `json:"extraData"`
	Nonce            string `json:"nonce"`
	Number           string `json:"number"`
	ParentHash       string `json:"parentHash"`
	ReceiptsRoot     string `json:"receiptsRoot"`
	SealFields       string `json:"sealFields,omitempty"`
	Sha3Uncles       string `json:"sha3Uncles"`
	Size             string `json:"history,omitempty"`
	StateRoot        string `json:"stateRoot"`
	Timestamp        string `json:"timestamp"`
	TransactionsRoot string `json:"transactionsRoot"`

	BaseFeePerGas string `json:"baseFeePerGas,omitempty"`
}

type Client

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

func NewClient

func NewClient(url string) (*Client, error)

func (*Client) BlockNumber

func (c *Client) BlockNumber(ctx context.Context) (*big.Int, error)

func (*Client) ChainId

func (c *Client) ChainId(ctx context.Context) (string, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Connect

func (c *Client) Connect(
	closeHandler func(error error),
) error

func (*Client) HandleSubscription

func (c *Client) HandleSubscription(subscriptionId string) chan *SubscriptionNotification

func (*Client) Invoke

func (c *Client) Invoke(
	ctx context.Context,
	method string,
	params any,
	resp *jsonrpc.Response,
) error

func (*Client) InvokeRequest

func (c *Client) InvokeRequest(
	ctx context.Context,
	req jsonrpc.Request,
	resp *jsonrpc.Response,
) error

func (*Client) LatestBlock

func (c *Client) LatestBlock(ctx context.Context) (*Block, error)

func (*Client) NetVersion

func (c *Client) NetVersion(ctx context.Context) (string, error)

func (*Client) NodeInfo

func (c *Client) NodeInfo(ctx context.Context) (*NodeInfo, error)

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, params []interface{}) (string, error)

func (*Client) SubscribeToNewHeads

func (c *Client) SubscribeToNewHeads(context context.Context) (string, error)

func (*Client) SubscribeToSyncStatus

func (c *Client) SubscribeToSyncStatus(context context.Context) (string, error)

func (*Client) SyncProgress

func (c *Client) SyncProgress(ctx context.Context) (bool, error)

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(ctx context.Context, subscriptionId string) (bool, error)

func (*Client) Web3ClientVersion

func (c *Client) Web3ClientVersion(ctx context.Context) (*ClientVersion, error)

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 Head struct {
	BlockNumber     string `json:"blockNumber"`
	BlockHash       string `json:"blockHash"`
	ParentHash      string `json:"parentHash"`
	Difficulty      string `json:"difficulty"`
	TotalDifficulty string `json:"totalDifficulty"`
}

func (*Head) BlockNumberBI

func (h *Head) BlockNumberBI() (*big.Int, error)

func (*Head) DifficultyBI

func (h *Head) DifficultyBI() (*big.Int, error)

func (*Head) TotalDifficultyBI

func (h *Head) TotalDifficultyBI() (*big.Int, error)

type NewHead

type NewHead struct {
	ParentHash       string `json:"parentHash"`
	Sha3Uncles       string `json:"sha3Uncles"`
	Miner            string `json:"miner,omitempty"`
	StateRoot        string `json:"stateRoot"`
	TransactionsRoot string `json:"transactionsRoot"`
	ReceiptsRoot     string `json:"receiptsRoot"`
	LogsBloom        string `json:"logsBloom"`
	Difficulty       string `json:"Difficulty"`
	Number           string `json:"number"`
	GasLimit         string `json:"gasLimit"`
	GasUsed          string `json:"gasUsed"`
	Author           string `json:"author,omitempty"`
	Timestamp        string `json:"timestamp"`
	ExtraData        string `json:"extraData"`
	MixHash          string `json:"mixHash"`
	Nonce            string `json:"nonce"`
	BaseFeePerGas    string `json:"baseFeePerGas,omitempty"`
	Hash             string `json:"hash"`
	SealFields       string `json:"sealFields,omitempty"`

	Size            string `json:"history,omitempty"`
	TotalDifficulty string `json:"totalDifficulty,omitempty"`
	Uncles          string `json:"uncles,omitempty"`
	Transactions    string `json:"transactions,omitempty"`
}

type NodeInfo

type NodeInfo struct {
	Id            string          `json:"id"`
	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 SubscriptionNotification

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

func (*SubscriptionNotification) UnmarshalResult

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

type SyncStatus

type SyncStatus struct {
	Syncing bool `json:"syncing"`
}

type Syncing

type Syncing struct {
	IsSyncing bool `json:"syncing"`
	Status    json.RawMessage
}

Jump to

Keyboard shortcuts

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