web3

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ETHClientAddress string
	ETHClient        EthClient
	ChainID          *big.Int
	RegistryContract RegistryContract
	RLNContract      RLNContract
	// contains filtered or unexported fields
}

Config is a helper struct that contains attributes for interaction with RLN smart contracts

func BuildConfig

func BuildConfig(ctx context.Context, ethClientAddress string, registryAddress common.Address) (*Config, error)

BuildConfig returns an instance of Web3Config with all the required elements for interaction with the RLN smart contracts

func NewConfig

func NewConfig(ethClientAddress string, registryAddress common.Address) *Config

NewConfig creates an instance of web3 Config

func (*Config) Build

func (w *Config) Build(ctx context.Context) error

Build sets up the Config object by instantiating the eth client and contracts

type EthClient

type EthClient interface {
	bind.ContractBackend
	SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
	Close()
}

EthClient is an interface for the ethclient.Client, so that we can pass mock client for testing

type RLNContract

type RLNContract struct {
	*contracts.RLN
	Address             common.Address
	StorageIndex        uint16
	DeployedBlockNumber uint64
}

RLNContract contains an instance of the RLN contract, its address and the storage index within the registry that represents this contract

type RegistryContract

type RegistryContract struct {
	*contracts.RLNRegistry
	Address common.Address
}

RegistryContract contains an instance of the RLN Registry contract and its address

Jump to

Keyboard shortcuts

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