ethereum

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEcdsaKeyAddress

func GetEcdsaKeyAddress(privateKey string) (*ecdsa.PrivateKey, string, error)

GetEcdsaKeyAddress returns the public ecdsa key and address given the private key

func GetEthereumAccountNonce

func GetEthereumAccountNonce(endpoint string, address string) (int64, error)

Types

type ChainConfig

type ChainConfig struct {
	RPC                string `yaml:"rpc"`
	WS                 string `yaml:"ws"`
	Domain             types.Domain
	ChainID            int64  `yaml:"chain-id"`
	MessageTransmitter string `yaml:"message-transmitter"`

	StartBlock     uint64 `yaml:"start-block"`
	LookbackPeriod uint64 `yaml:"lookback-period"`

	BroadcastRetries       int `yaml:"broadcast-retries"`
	BroadcastRetryInterval int `yaml:"broadcast-retry-interval"`

	MinMintAmount uint64 `yaml:"min-mint-amount"`

	MetricsDenom    string `yaml:"metrics-denom"`
	MetricsExponent int    `yaml:"metrics-exponent"`

	// TODO move to keyring
	MinterPrivateKey string `yaml:"minter-private-key"`
}

func (*ChainConfig) Chain

func (c *ChainConfig) Chain(name string) (types.Chain, error)

type ContractBackendWrapper

type ContractBackendWrapper struct {
	*ethclient.Client
}

func NewContractBackendWrapper

func NewContractBackendWrapper(client *ethclient.Client) *ContractBackendWrapper

func (*ContractBackendWrapper) SendTransaction

func (c *ContractBackendWrapper) SendTransaction(ctx context.Context, tx *types.Transaction) error

type Ethereum

type Ethereum struct {
	MetricsDenom    string
	MetricsExponent int
	// contains filtered or unexported fields
}

func NewChain

func NewChain(
	name string,
	domain types.Domain,
	chainID int64,
	rpcURL string,
	wsURL string,
	messageTransmitterAddress string,
	startBlock uint64,
	lookbackPeriod uint64,
	privateKey string,
	maxRetries int,
	retryIntervalSeconds int,
	minAmount uint64,
	metricsDenom string,
	metricsExponent int,
) (*Ethereum, error)

func (*Ethereum) Broadcast

func (e *Ethereum) Broadcast(
	ctx context.Context,
	logger log.Logger,
	msgs []*types.MessageState,
	sequenceMap *types.SequenceMap,
	m *relayer.PromMetrics,
) error

func (*Ethereum) CloseClients added in v0.1.2

func (e *Ethereum) CloseClients()

func (*Ethereum) Domain

func (e *Ethereum) Domain() types.Domain

func (*Ethereum) InitializeBroadcaster

func (e *Ethereum) InitializeBroadcaster(
	ctx context.Context,
	logger log.Logger,
	sequenceMap *types.SequenceMap,
) error

func (*Ethereum) InitializeClients added in v0.1.2

func (e *Ethereum) InitializeClients(ctx context.Context, logger log.Logger) error

func (*Ethereum) IsDestinationCaller

func (e *Ethereum) IsDestinationCaller(destinationCaller []byte) (isCaller bool, readableAddress string)

func (*Ethereum) LastFlushedBlock added in v0.1.2

func (e *Ethereum) LastFlushedBlock() uint64

func (*Ethereum) LatestBlock added in v0.1.2

func (e *Ethereum) LatestBlock() uint64

func (*Ethereum) Name

func (e *Ethereum) Name() string

func (*Ethereum) SetLatestBlock added in v0.1.2

func (e *Ethereum) SetLatestBlock(block uint64)

func (*Ethereum) StartListener

func (e *Ethereum) StartListener(
	ctx context.Context,
	logger log.Logger,
	processingQueue chan *types.TxState,
	flushInterval time.Duration,
)

StartListener starts the ethereum websocket subscription, queries history pertaining to the lookback period, and starts the reoccurring flush

If an error occurs in websocket stream, this function will handle relevant sub routines and then re-run itself.

func (*Ethereum) TrackLatestBlockHeight added in v0.1.2

func (e *Ethereum) TrackLatestBlockHeight(ctx context.Context, logger log.Logger, m *relayer.PromMetrics)

func (*Ethereum) WalletBalanceMetric added in v0.1.2

func (e *Ethereum) WalletBalanceMetric(ctx context.Context, logger log.Logger, m *relayer.PromMetrics)

type JsonError

type JsonError interface {
	Error() string
	ErrorCode() int
	ErrorData() interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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