http

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 13 Imported by: 28

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 added in v0.35.0

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

NewWithClient allows you to provide a custom client.

func NewWithOptions added in v0.35.0

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 added in v0.35.0

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