ethrpc

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: LGPL-3.0, MIT Imports: 17 Imported by: 9 modules, 29 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Networks = map[uint64]Network{
	1: {
		Name:                "mainnet",
		ChainID:             1,
		NumBlocksToFinality: 20,
	},
	3: {
		Name:                "ropsten",
		ChainID:             3,
		NumBlocksToFinality: 20,
	},
	4: {
		Name:                "rinkeby",
		ChainID:             4,
		NumBlocksToFinality: 20,
	},
	5: {
		Name:                "goerli",
		ChainID:             5,
		NumBlocksToFinality: 20,
	},
	42: {
		Name:                "kovan",
		ChainID:             42,
		NumBlocksToFinality: 20,
	},
	137: {
		Name:                "polygon",
		ChainID:             137,
		NumBlocksToFinality: 100,
	},
	80001: {
		Name:                "polygon-mumbai",
		ChainID:             80001,
		NumBlocksToFinality: 100,
	},
	56: {
		Name:                "bsc",
		ChainID:             56,
		NumBlocksToFinality: 50,
	},
	97: {
		Name:                "bsc-testnet",
		ChainID:             97,
		NumBlocksToFinality: 50,
	},
	10: {
		Name:                "optimism",
		ChainID:             10,
		NumBlocksToFinality: 50,
	},
	69: {
		Name:                "optimism-testnet",
		ChainID:             69,
		NumBlocksToFinality: 50,
	},
	42161: {
		Name:                "arbitrum",
		ChainID:             42161,
		NumBlocksToFinality: 50,
	},
	421613: {
		Name:                "arbitrum-testnet",
		ChainID:             421613,
		NumBlocksToFinality: 50,
	},
	42170: {
		Name:                "arbitrum-nova",
		ChainID:             42170,
		NumBlocksToFinality: 50,
	},
	43114: {
		Name:                "avalanche",
		ChainID:             43114,
		NumBlocksToFinality: 50,
	},
	43113: {
		Name:                "avalanche-testnet",
		ChainID:             43113,
		NumBlocksToFinality: 50,
	},
	250: {
		Name:                "fantom",
		ChainID:             250,
		NumBlocksToFinality: 100,
	},
	4002: {
		Name:                "fantom-testnet",
		ChainID:             4002,
		NumBlocksToFinality: 100,
	},
	100: {
		Name:                "gnosis",
		ChainID:             100,
		NumBlocksToFinality: 100,
	},
	1313161554: {
		Name:                "aurora",
		ChainID:             1313161554,
		NumBlocksToFinality: 50,
	},
	1313161556: {
		Name:                "aurora-testnet",
		ChainID:             1313161556,
		NumBlocksToFinality: 50,
	},
}

Functions

func WaitForTxnReceipt added in v1.3.6

func WaitForTxnReceipt(ctx context.Context, provider *Provider, txHash common.Hash) (*types.Receipt, error)

Types

type Config

type Config struct {
	Nodes []NodeConfig

	ChaindID int // expected ChainID so we confirm on connect..
	TestMode bool
}

func (*Config) AddNode

func (c *Config) AddNode(nodeConfig NodeConfig)

type Network added in v1.17.0

type Network struct {
	Name                string
	ChainID             uint64
	NumBlocksToFinality int
}

type NodeConfig

type NodeConfig struct {
	URL                 string
	MaxRequestPerSecond float64
}

type Provider

type Provider struct {
	*ethclient.Client
	Config *Config
	RPC    *rpc.Client
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(ethURL string, optClient ...*http.Client) (*Provider, error)

func NewProviderWithConfig

func NewProviderWithConfig(config *Config, optClient ...*http.Client) (*Provider, error)

func (*Provider) BlockByHash added in v1.1.7

func (s *Provider) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*Provider) BlockByNumber

func (s *Provider) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*Provider) ChainID

func (s *Provider) ChainID(ctx context.Context) (*big.Int, error)

func (*Provider) Dial

func (s *Provider) Dial() error

func (*Provider) QueryContract added in v1.3.4

func (s *Provider) QueryContract(ctx context.Context, contractAddress string, inputAbiExpr, outputAbiExpr string, args []string) ([]string, error)

ie, QueryContext(context.Background(), "0xabcdef..", "balanceOf(uint256)", "uint256", []string{"1"}) TODO: add common methods in helpers util, and also use generics to convert the return for us

func (*Provider) SendRawTransaction added in v1.3.6

func (s *Provider) SendRawTransaction(ctx context.Context, signedTxHex string) (common.Hash, error)

func (*Provider) SetHttpClient added in v1.14.4

func (s *Provider) SetHttpClient(httpClient *http.Client)

func (*Provider) TransactionDetails

func (s *Provider) TransactionDetails(ctx context.Context, txnHash common.Hash) (bool, *types.Receipt, *types.Transaction, string, error)

Jump to

Keyboard shortcuts

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