rpc

package
v0.0.0-...-abe358f Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCClient

type RPCClient struct {
	URL    string
	Client *http.Client
}

RPCClient represents an RPC client for Ethereum node communication

func NewRPCClient

func NewRPCClient(rpcURL string) *RPCClient

NewRPCClient creates a new RPC client with the specified URL

func (*RPCClient) CallContext

func (c *RPCClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error

CallContext performs a JSON-RPC call with the given arguments. If the context is canceled before the call has successfully returned, CallContext returns immediately.

The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.

func (*RPCClient) NonceAt

func (c *RPCClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

NonceAt returns the account nonce of the given account. The block number can be nil, in which case the nonce is taken from the latest known block.

func (*RPCClient) QueryDetailedTransactionStatus

func (c *RPCClient) QueryDetailedTransactionStatus(txHash common.Hash) error

QueryDetailedTransactionStatus queries detailed pending/queued status via RPC

func (*RPCClient) QueryTransactionByHash

func (c *RPCClient) QueryTransactionByHash(txHash common.Hash) (string, error)

QueryTransactionByHash queries eth_getTransactionByHash

func (*RPCClient) QueryTxpoolContent

func (c *RPCClient) QueryTxpoolContent(txHash common.Hash) (string, error)

QueryTxpoolContent queries txpool_content to get pending/queued status

func (*RPCClient) SendRequest

func (c *RPCClient) SendRequest(method string, params []interface{}) (map[string]interface{}, error)

SendRequest sends a JSON-RPC request to the Ethereum node

Jump to

Keyboard shortcuts

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