rpc

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientPool

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

ClientPool is an Ethereum JSON-RPC provider that provides automatic connection pooling and request deduplication.

func NewClientPool

func NewClientPool(endpoint string, poolSize uint) (*ClientPool, error)

func (*ClientPool) ExecuteRequestAsync

func (c *ClientPool) ExecuteRequestAsync(ctx context.Context, method string, args ...interface{}) (*PendingResult, error)

ExecuteRequestAsync makes a non-blocking RPC request whose result may be obtained from interacting with *PendingResult. If there is an existing request on the wire with the same method/args, this function will return a PendingResult linked to that request.

func (*ClientPool) ExecuteRequestBlocking

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

ExecuteRequestBlocking makes a blocking RPC request and stores the result in the result interface pointer. If there is an existing request on the wire with the same method/args, the calling thread will be blocked until it has completed.

type PendingResult

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

PendingResult defines an object that can be returned when calling the RPC asynchronously. It's kinda like a promise as seen in other languages.

func (*PendingResult) GetResultBlocking

func (p *PendingResult) GetResultBlocking(result interface{}) error

GetResultBlocking obtains the result from the client, blocking until the result or an error is available. Callers must pass a pointer to their data through result. Note that if the fuzzer is shutting down, an error may be returned to signify the context has been cancelled.

Jump to

Keyboard shortcuts

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