http

package
v0.0.0-...-be384fd Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(chainID, remote string) (provider.Provider, error)

New creates a HTTP provider, which is using the rpchttp.HTTP client under the hood. If no scheme is provided in the remote URL, http will be used by default. The 5s timeout is used for all requests.

func NewWithClient

func NewWithClient(chainID string, client rpcclient.RemoteClient) provider.Provider

func NewWithClientAndOptions

func NewWithClientAndOptions(chainID string, client rpcclient.RemoteClient, options Options) provider.Provider

NewWithClient allows you to provide a custom client.

func NewWithOptions

func NewWithOptions(chainID, remote string, options Options) (provider.Provider, error)

NewWithOptions is an extension to creating a new http provider that allows the addition of a specified timeout and maxRetryAttempts

Types

type Options

type Options struct {
	// 0 means no retries
	MaxRetryAttempts uint16
	// 0 means no timeout.
	Timeout time.Duration
	// The amount of requests that a client doesn't have the block
	// for before the provider deems the client unreliable
	NoBlockThreshold uint16
	// The amount of requests that a client doesn't respond to
	// before the provider deems the client unreliable
	NoResponseThreshold uint16
}

Jump to

Keyboard shortcuts

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