Documentation
¶
Index ¶
- Constants
- func NewClient(ctx context.Context, rpcUrl string) (*ethclient.Client, error)
- func WaitForTransaction(ctx context.Context, logger *zap.Logger, client *ethclient.Client, ...) error
- type BlockchainPublisher
- type ChainClient
- type IBlockchainPublisher
- type LogStreamBuilder
- type LogStreamer
- type NodeRegistry
- type NodeRegistryAdmin
- func (n *NodeRegistryAdmin) AddNode(ctx context.Context, owner string, signingKeyPub *ecdsa.PublicKey, ...) error
- func (n *NodeRegistryAdmin) UpdateHealth(ctx context.Context, nodeId int64, health bool) error
- func (n *NodeRegistryAdmin) UpdateHttpAddress(ctx context.Context, nodeId int64, address string) error
- type NodeRegistryCaller
- type PrivateKeySigner
- type RpcLogStreamBuilder
- type RpcLogStreamer
- type TransactionSigner
Constants ¶
const ( BACKFILL_BLOCKS = 1000 // Don't index very new blocks to account for reorgs // Setting to 0 since we are talking about L2s with low reorg risk LAG_FROM_HIGHEST_BLOCK = 0 ERROR_SLEEP_TIME = 100 * time.Millisecond NO_LOGS_SLEEP_TIME = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockchainPublisher ¶
type BlockchainPublisher struct {
// contains filtered or unexported fields
}
Can publish to the blockchain, signing messages using the provided signer
func NewBlockchainPublisher ¶
func NewBlockchainPublisher( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractOptions config.ContractsOptions, ) (*BlockchainPublisher, error)
func (*BlockchainPublisher) PublishGroupMessage ¶
func (*BlockchainPublisher) PublishIdentityUpdate ¶
type ChainClient ¶
type ChainClient interface {
ethereum.BlockNumberReader
ethereum.LogFilterer
ethereum.ChainIDReader
}
type IBlockchainPublisher ¶
type LogStreamBuilder ¶
type LogStreamBuilder interface {
ListenForContractEvent(
fromBlock uint64,
contractAddress common.Address,
topic common.Hash,
) <-chan types.Log
Build() (LogStreamer, error)
}
Construct a raw blockchain listener that can be used to listen for events across many contract event types
type LogStreamer ¶
type NodeRegistry ¶
type NodeRegistryAdmin ¶
type NodeRegistryAdmin struct {
// contains filtered or unexported fields
}
* A NodeRegistryAdmin is a struct responsible for calling admin functions on the node registry *
func NewNodeRegistryAdmin ¶
func NewNodeRegistryAdmin( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractsOptions config.ContractsOptions, ) (*NodeRegistryAdmin, error)
func (*NodeRegistryAdmin) UpdateHealth ¶
func (*NodeRegistryAdmin) UpdateHttpAddress ¶
type NodeRegistryCaller ¶
type NodeRegistryCaller struct {
// contains filtered or unexported fields
}
* A NodeRegistryCaller is a struct responsible for calling public functions on the node registry *
func NewNodeRegistryCaller ¶
func NewNodeRegistryCaller( logger *zap.Logger, client *ethclient.Client, contractsOptions config.ContractsOptions, ) (*NodeRegistryCaller, error)
func (*NodeRegistryCaller) GetAllNodes ¶
func (n *NodeRegistryCaller) GetAllNodes( ctx context.Context, ) ([]abis.NodesNodeWithId, error)
type PrivateKeySigner ¶
type PrivateKeySigner struct {
// contains filtered or unexported fields
}
* PrivateKeySigner is a naive and not secure implementation of the TransactionSigner interface.
It is meant to be used in tests only *
func NewPrivateKeySigner ¶
func NewPrivateKeySigner(privateKeyString string, chainID int) (*PrivateKeySigner, error)
func (*PrivateKeySigner) FromAddress ¶
func (s *PrivateKeySigner) FromAddress() common.Address
func (*PrivateKeySigner) SignerFunc ¶
func (s *PrivateKeySigner) SignerFunc() bind.SignerFn
type RpcLogStreamBuilder ¶
type RpcLogStreamBuilder struct {
// contains filtered or unexported fields
}
The builder that allows you to configure contract events to listen for
func NewRpcLogStreamBuilder ¶
func NewRpcLogStreamBuilder(client *ethclient.Client, logger *zap.Logger) *RpcLogStreamBuilder
func (*RpcLogStreamBuilder) Build ¶
func (c *RpcLogStreamBuilder) Build() (*RpcLogStreamer, error)
func (*RpcLogStreamBuilder) ListenForContractEvent ¶
type RpcLogStreamer ¶
type RpcLogStreamer struct {
// contains filtered or unexported fields
}
* A RpcLogStreamer is a naive implementation of the ChainStreamer interface. It queries a remote blockchain node for log events to backfill history, and then streams new events, to get a complete history of events on a chain. *
func NewRpcLogStreamer ¶
func NewRpcLogStreamer( client ChainClient, logger *zap.Logger, watchers []contractConfig, ) *RpcLogStreamer