Documentation ¶
Index ¶
- Constants
- Variables
- type BatchEntry
- type BatchPollConnector
- type BatchResult
- type BlockMarshaller
- type Blocks
- type CeloConnector
- func (c *CeloConnector) Client() *ethClient.Client
- func (c *CeloConnector) ContractAddress() ethCommon.Address
- func (c *CeloConnector) GetCurrentGuardianSetIndex(ctx context.Context) (uint32, error)
- func (c *CeloConnector) GetGuardianSet(ctx context.Context, index uint32) (ethAbi.StructsGuardianSet, error)
- func (c *CeloConnector) NetworkName() string
- func (c *CeloConnector) ParseLogMessagePublished(ethLog ethTypes.Log) (*ethAbi.AbiLogMessagePublished, error)
- func (c *CeloConnector) RawBatchCallContext(ctx context.Context, b []ethRpc.BatchElem) error
- func (c *CeloConnector) RawCallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *CeloConnector) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error)
- func (c *CeloConnector) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (c *CeloConnector) TimeOfBlockByHash(ctx context.Context, hash ethCommon.Hash) (uint64, error)
- func (c *CeloConnector) TransactionReceipt(ctx context.Context, txHash ethCommon.Hash) (*ethTypes.Receipt, error)
- func (c *CeloConnector) WatchLogMessagePublished(ctx context.Context, errC chan error, ...) (ethEvent.Subscription, error)
- type Connector
- type EthereumBaseConnector
- func (e *EthereumBaseConnector) Client() *ethClient.Client
- func (e *EthereumBaseConnector) ContractAddress() ethCommon.Address
- func (e *EthereumBaseConnector) GetCurrentGuardianSetIndex(ctx context.Context) (uint32, error)
- func (e *EthereumBaseConnector) GetGuardianSet(ctx context.Context, index uint32) (ethAbi.StructsGuardianSet, error)
- func (e *EthereumBaseConnector) NetworkName() string
- func (e *EthereumBaseConnector) ParseLogMessagePublished(log ethTypes.Log) (*ethAbi.AbiLogMessagePublished, error)
- func (e *EthereumBaseConnector) RawBatchCallContext(ctx context.Context, b []ethRpc.BatchElem) error
- func (e *EthereumBaseConnector) RawCallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (e *EthereumBaseConnector) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error)
- func (e *EthereumBaseConnector) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (e *EthereumBaseConnector) TimeOfBlockByHash(ctx context.Context, hash ethCommon.Hash) (uint64, error)
- func (e *EthereumBaseConnector) TransactionReceipt(ctx context.Context, txHash ethCommon.Hash) (*ethTypes.Receipt, error)
- func (e *EthereumBaseConnector) WatchLogMessagePublished(ctx context.Context, errC chan error, ...) (ethEvent.Subscription, error)
- type FinalityLevel
- type FinalizerPollConnector
- type InstantFinalityConnector
- type LogPollConnector
- type NewBlock
- type PollFinalizer
- type PollSubscription
Constants ¶
const MAX_GAP_BATCH_SIZE uint64 = 5
Variables ¶
var ErrUnsubscribed = errors.New("unsubscribed")
Functions ¶
This section is empty.
Types ¶
type BatchEntry ¶
type BatchEntry struct {
// contains filtered or unexported fields
}
type BatchPollConnector ¶
type BatchPollConnector struct { Connector Delay time.Duration // contains filtered or unexported fields }
BatchPollConnector uses batch requests to poll for latest, safe and finalized blocks.
func NewBatchPollConnector ¶
func (*BatchPollConnector) SubscribeForBlocks ¶
func (b *BatchPollConnector) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error)
type BatchResult ¶
type BatchResult struct {
// contains filtered or unexported fields
}
type BlockMarshaller ¶
type BlockMarshaller struct { Number *hexutil.Big Hash common.Hash `json:"hash"` Time hexutil.Uint64 `json:"timestamp"` // L1BlockNumber is the L1 block number in which an Arbitrum batch containing this block was submitted. // This field is only populated when connecting to Arbitrum. L1BlockNumber *hexutil.Big }
type CeloConnector ¶
type CeloConnector struct {
// contains filtered or unexported fields
}
CeloConnector implements EVM network query capabilities for the Celo network. It's almost identical to EthereumConnector except it's using the Celo fork and provides shims between their respective types.
func NewCeloConnector ¶
func (*CeloConnector) Client ¶
func (c *CeloConnector) Client() *ethClient.Client
func (*CeloConnector) ContractAddress ¶
func (c *CeloConnector) ContractAddress() ethCommon.Address
func (*CeloConnector) GetCurrentGuardianSetIndex ¶
func (c *CeloConnector) GetCurrentGuardianSetIndex(ctx context.Context) (uint32, error)
func (*CeloConnector) GetGuardianSet ¶
func (c *CeloConnector) GetGuardianSet(ctx context.Context, index uint32) (ethAbi.StructsGuardianSet, error)
func (*CeloConnector) NetworkName ¶
func (c *CeloConnector) NetworkName() string
func (*CeloConnector) ParseLogMessagePublished ¶
func (c *CeloConnector) ParseLogMessagePublished(ethLog ethTypes.Log) (*ethAbi.AbiLogMessagePublished, error)
func (*CeloConnector) RawBatchCallContext ¶
func (*CeloConnector) RawCallContext ¶
func (c *CeloConnector) RawCallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
func (*CeloConnector) SubscribeForBlocks ¶
func (c *CeloConnector) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error)
func (*CeloConnector) SubscribeNewHead ¶
func (c *CeloConnector) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
func (*CeloConnector) TimeOfBlockByHash ¶
func (*CeloConnector) TransactionReceipt ¶
func (*CeloConnector) WatchLogMessagePublished ¶
func (c *CeloConnector) WatchLogMessagePublished(ctx context.Context, errC chan error, sink chan<- *ethAbi.AbiLogMessagePublished) (ethEvent.Subscription, error)
type Connector ¶
type Connector interface { NetworkName() string ContractAddress() common.Address GetCurrentGuardianSetIndex(ctx context.Context) (uint32, error) GetGuardianSet(ctx context.Context, index uint32) (ethabi.StructsGuardianSet, error) WatchLogMessagePublished(ctx context.Context, errC chan error, sink chan<- *ethabi.AbiLogMessagePublished) (event.Subscription, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) TimeOfBlockByHash(ctx context.Context, hash common.Hash) (uint64, error) ParseLogMessagePublished(log types.Log) (*ethabi.AbiLogMessagePublished, error) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error) RawCallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error RawBatchCallContext(ctx context.Context, b []rpc.BatchElem) error Client() *ethClient.Client SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) }
Connector exposes Wormhole-specific interactions with an EVM-based network
type EthereumBaseConnector ¶
type EthereumBaseConnector struct {
// contains filtered or unexported fields
}
EthereumBaseConnector implements EVM network query capabilities for go-ethereum based networks and networks supporting the standard web3 rpc.
func (*EthereumBaseConnector) Client ¶
func (e *EthereumBaseConnector) Client() *ethClient.Client
func (*EthereumBaseConnector) ContractAddress ¶
func (e *EthereumBaseConnector) ContractAddress() ethCommon.Address
func (*EthereumBaseConnector) GetCurrentGuardianSetIndex ¶
func (e *EthereumBaseConnector) GetCurrentGuardianSetIndex(ctx context.Context) (uint32, error)
func (*EthereumBaseConnector) GetGuardianSet ¶
func (e *EthereumBaseConnector) GetGuardianSet(ctx context.Context, index uint32) (ethAbi.StructsGuardianSet, error)
func (*EthereumBaseConnector) NetworkName ¶
func (e *EthereumBaseConnector) NetworkName() string
func (*EthereumBaseConnector) ParseLogMessagePublished ¶
func (e *EthereumBaseConnector) ParseLogMessagePublished(log ethTypes.Log) (*ethAbi.AbiLogMessagePublished, error)
func (*EthereumBaseConnector) RawBatchCallContext ¶
func (*EthereumBaseConnector) RawCallContext ¶
func (e *EthereumBaseConnector) RawCallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
func (*EthereumBaseConnector) SubscribeForBlocks ¶
func (e *EthereumBaseConnector) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error)
func (*EthereumBaseConnector) SubscribeNewHead ¶
func (e *EthereumBaseConnector) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
func (*EthereumBaseConnector) TimeOfBlockByHash ¶
func (*EthereumBaseConnector) TransactionReceipt ¶
func (*EthereumBaseConnector) WatchLogMessagePublished ¶
func (e *EthereumBaseConnector) WatchLogMessagePublished(ctx context.Context, errC chan error, sink chan<- *ethAbi.AbiLogMessagePublished) (ethEvent.Subscription, error)
type FinalityLevel ¶
type FinalityLevel uint8
const ( Latest FinalityLevel = iota Safe Finalized )
func (FinalityLevel) String ¶
func (f FinalityLevel) String() string
String() formats the finality as a string. Note that these strings are used in the RPC calls, so they cannot be changed.
type FinalizerPollConnector ¶
type FinalizerPollConnector struct { Connector Delay time.Duration // contains filtered or unexported fields }
FinalizerPollConnector polls for new blocks. It takes a finalizer which will be used to determine when a block is finalized.
func NewFinalizerPollConnector ¶
func NewFinalizerPollConnector(ctx context.Context, baseConnector Connector, finalizer PollFinalizer, delay time.Duration) (*FinalizerPollConnector, error)
func (*FinalizerPollConnector) SubscribeForBlocks ¶
func (b *FinalizerPollConnector) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error)
type InstantFinalityConnector ¶
type InstantFinalityConnector struct { Connector // contains filtered or unexported fields }
InstantFinalityConnector is used for chains that support instant finality. It uses the standard geth head sink to read blocks and publishes each block as latest, safe and finalized.
func NewInstantFinalityConnector ¶
func NewInstantFinalityConnector(baseConnector Connector, logger *zap.Logger) (*InstantFinalityConnector, error)
func (*InstantFinalityConnector) SubscribeForBlocks ¶
func (c *InstantFinalityConnector) SubscribeForBlocks(ctx context.Context, errC chan error, sink chan<- *NewBlock) (ethereum.Subscription, error)
type LogPollConnector ¶
type LogPollConnector struct { Connector // contains filtered or unexported fields }
LogPollConnector pulls logs on each new block event when subscribing using WatchLogMessagePublished instead of using a websocket connection. It can be used in conjunction with a BlockPollConnector and Finalizer to only return finalized message log events.
func NewLogPollConnector ¶
func (*LogPollConnector) WatchLogMessagePublished ¶
func (l *LogPollConnector) WatchLogMessagePublished(ctx context.Context, errC chan error, sink chan<- *ethAbi.AbiLogMessagePublished) (ethEvent.Subscription, error)
type NewBlock ¶
type NewBlock struct { Number *big.Int Hash common.Hash Time uint64 L1BlockNumber *big.Int // This is only populated on some chains (Arbitrum) Finality FinalityLevel }
func (*NewBlock) Copy ¶
func (b *NewBlock) Copy(f FinalityLevel) *NewBlock
type PollFinalizer ¶
type PollSubscription ¶
type PollSubscription struct {
// contains filtered or unexported fields
}
func NewPollSubscription ¶
func NewPollSubscription() *PollSubscription
func (*PollSubscription) Err ¶
func (sub *PollSubscription) Err() <-chan error
func (*PollSubscription) Unsubscribe ¶
func (sub *PollSubscription) Unsubscribe()