Documentation ¶
Index ¶
- Constants
- func NewClient(ctx context.Context, rpcUrl string) (*ethclient.Client, error)
- func WaitForTransaction(ctx context.Context, logger *zap.Logger, client *ethclient.Client, ...) (*types.Receipt, error)
- type BlockchainPublisher
- func (m *BlockchainPublisher) PublishGroupMessage(ctx context.Context, groupID [32]byte, message []byte) (*abis.GroupMessagesMessageSent, error)
- func (m *BlockchainPublisher) PublishIdentityUpdate(ctx context.Context, inboxId [32]byte, identityUpdate []byte) (*abis.IdentityUpdatesIdentityUpdateCreated, error)
- 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 = uint64(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 = uint64(0) ERROR_SLEEP_TIME = 100 * time.Millisecond NO_LOGS_SLEEP_TIME = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func WaitForTransaction ¶
func WaitForTransaction( ctx context.Context, logger *zap.Logger, client *ethclient.Client, timeout time.Duration, pollSleep time.Duration, hash common.Hash, ) (*types.Receipt, error)
Waits for the given transaction hash to have been submitted to the chain and soft confirmed
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 (m *BlockchainPublisher) PublishGroupMessage( ctx context.Context, groupID [32]byte, message []byte, ) (*abis.GroupMessagesMessageSent, error)
func (*BlockchainPublisher) PublishIdentityUpdate ¶
func (m *BlockchainPublisher) PublishIdentityUpdate( ctx context.Context, inboxId [32]byte, identityUpdate []byte, ) (*abis.IdentityUpdatesIdentityUpdateCreated, error)
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 (*RpcLogStreamBuilder) Build ¶
func (c *RpcLogStreamBuilder) Build() (*RpcLogStreamer, error)
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( ctx context.Context, client ChainClient, logger *zap.Logger, watchers []contractConfig, ) *RpcLogStreamer
func (*RpcLogStreamer) Start ¶
func (r *RpcLogStreamer) Start()
func (*RpcLogStreamer) Stop ¶ added in v0.1.1
func (r *RpcLogStreamer) Stop()