noderpc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockByHashResponse

type BlockByHashResponse struct {
	Result BlockResult `json:"result" validate:"required"`
}

BlockByHashResponse represents the response struct.

type BlockByNumberResponse

type BlockByNumberResponse struct {
	Result BlockResult `json:"result" validate:"required"`
}

BlockByNumberResponse represents the response struct.

type BlockNumberResponse

type BlockNumberResponse struct {
	Result string `json:"result" validate:"required"`
}

BlockNumberResponse represents the response struct.

type BlockResult

type BlockResult struct {
	BlockNumberUI64 uint64
	BlockNumber     string `json:"number" validate:"required"`
	BlockHash       string `json:"hash" validate:"required"`
}

BlockResult represents the result struct.

type ChainIDResponse

type ChainIDResponse struct {
	Result string `json:"result" validate:"required"`
}

ChainIDResponse represents the response struct.

type Client

type Client struct {
	InfuraProjectID     string
	InfuraProjectSecret string
	// contains filtered or unexported fields
}

Client represents a Client.

func New

func New(httpClient *http.Client) *Client

New create an instance of Client.

func (*Client) BlockNumber

func (c *Client) BlockNumber(
	ctx context.Context,
	url string,
	headers map[string]string,
) (uint64, error)

func (*Client) Call

func (c *Client) Call(
	ctx context.Context,
	url string,
	method string,
	params interface{},
	headers map[string]string,
) ([]byte, error)

Call invokes a JSON-RPC method.

func (*Client) ChainID

func (c *Client) ChainID(
	ctx context.Context,
	url string,
	headers map[string]string,
) (string, error)

func (*Client) GetBlockByHash

func (c *Client) GetBlockByHash(
	ctx context.Context,
	url string,
	headers map[string]string,
	blockHash string,
) (BlockResult, error)

func (*Client) GetBlockByNumber

func (c *Client) GetBlockByNumber(
	ctx context.Context,
	url string,
	headers map[string]string,
	blockNumber uint64,
) (BlockResult, error)

func (*Client) SendRawTransaction

func (c *Client) SendRawTransaction(ctx context.Context,
	url string,
	headers map[string]string,
	rawTransaction string,
) (SendRawTransactionError, error)

func (*Client) Syncing

func (c *Client) Syncing(
	ctx context.Context,
	url string,
	headers map[string]string,
) (bool, error)

type SendRawTransactionError

type SendRawTransactionError struct {
	Code    int    `json:"code" `
	Message string `json:"message" `
}

type SendRawTransactionResponse

type SendRawTransactionResponse struct {
	Error SendRawTransactionError `json:"error" `
}

type SyncingInProgressDetailsResponse

type SyncingInProgressDetailsResponse struct {
	CurrentBlock  string `json:"currentBlock" `
	HighestBlock  string `json:"highestBlock" `
	KnownStates   string `json:"knownStates" `
	PulledStates  string `json:"pulledStates" `
	StartingBlock string `json:"startingBlock" `
}

type SyncingInProgressResponse

type SyncingInProgressResponse struct {
	Result SyncingInProgressDetailsResponse `json:"result" validate:"required"`
}

SyncingInProgressResponse represents the response when is not sync.

type SyncingResponse

type SyncingResponse struct {
	Result bool `json:"result" validate:"required"`
}

SyncingResponse represents the response struct.

Jump to

Keyboard shortcuts

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