Documentation ¶
Index ¶
- Variables
- type Client
- type Conn
- type EthSubscription
- type LogSubscriber
- type Pool
- type PooledClient
- func (c *PooledClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *PooledClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (c *PooledClient) GetCode(ctx context.Context, addr common.Address) (string, error)
- func (c *PooledClient) GetExpiry(ctx context.Context, address common.Address) (uint64, error)
- func (c *PooledClient) GetPublicKey(ctx context.Context, address common.Address) (PublicKey, error)
- func (c *PooledClient) NonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (c *PooledClient) SendTransaction(ctx context.Context, tx *types.Transaction) (SendTransactionResponse, error)
- func (c *PooledClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (c *PooledClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type PooledClientProps
- type PublicKey
- type SendTransactionResponse
- type Subscriber
- type Subscription
- type SubscriptionEndEvent
- type SubscriptionManager
- type SubscriptionManagerProps
- type SubscriptionProps
- type UniDialer
- type UniDialerProps
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { EstimateGas(context.Context, ethereum.CallMsg) (uint64, error) GetExpiry(context.Context, common.Address) (uint64, error) GetPublicKey(context.Context, common.Address) (PublicKey, error) NonceAt(context.Context, common.Address) (uint64, error) SendTransaction(context.Context, *types.Transaction) (SendTransactionResponse, error) SubscribeFilterLogs(context.Context, ethereum.FilterQuery, chan<- types.Log) (ethereum.Subscription, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) GetCode(ctx context.Context, addr common.Address) (string, error) }
type EthSubscription ¶
type EthSubscription struct {
// contains filtered or unexported fields
}
EthSubscription abstracts an ethereum.Subscription to be able to pass a chan<- interface{} and to monitor the state of the subscription
func (*EthSubscription) Err ¶
func (s *EthSubscription) Err() <-chan error
Err returns a channel to retrieve subscription errors. Only one error at most will be sent through this chanel, when the subscription is closed, this channel will be closed so this can be used by a client to monitor whether the subscription is active
func (*EthSubscription) Unsubscribe ¶
func (s *EthSubscription) Unsubscribe()
Unsubscribe destroys the subscription
type LogSubscriber ¶
type LogSubscriber struct { FilterQuery ethereum.FilterQuery BlockNumber uint64 Index uint // contains filtered or unexported fields }
LogSubscriber creates log based subscriptions using the underlying clients
func (*LogSubscriber) Subscribe ¶
func (s *LogSubscriber) Subscribe( ctx context.Context, client Client, c chan<- interface{}, ) (ethereum.Subscription, error)
Subscribe implementation of Subscriber for LogSubscriber
type PooledClient ¶
type PooledClient struct {
// contains filtered or unexported fields
}
func NewPooledClient ¶
func NewPooledClient(props PooledClientProps) *PooledClient
func (*PooledClient) EstimateGas ¶
func (*PooledClient) GetPublicKey ¶
func (*PooledClient) SendTransaction ¶
func (c *PooledClient) SendTransaction(ctx context.Context, tx *types.Transaction) (SendTransactionResponse, error)
func (*PooledClient) SubscribeFilterLogs ¶
func (c *PooledClient) SubscribeFilterLogs( ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log, ) (ethereum.Subscription, error)
func (*PooledClient) TransactionReceipt ¶
type PooledClientProps ¶
type PooledClientProps struct { Pool Pool RetryConfig concurrent.RetryConfig }
type SendTransactionResponse ¶
type Subscriber ¶
type Subscriber interface { // Subscribe creates a subscription and forwards the received // events on the provided channel Subscribe(context.Context, Client, chan<- interface{}) (ethereum.Subscription, error) }
Subscriber is an interface for types that creates subscriptions against an ethereum-like backend
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription abstracts an ethereum subscription into a type that implements automatic dialing and retries
func NewSubscription ¶
func NewSubscription(props SubscriptionProps) *Subscription
NewSubscription creates a new subscription with the passed properties
func (*Subscription) Key ¶
func (s *Subscription) Key() string
Key uniquely identifies the subscription within the global space of subscriptions
func (*Subscription) Unsubscribe ¶
func (s *Subscription) Unsubscribe()
type SubscriptionEndEvent ¶
type SubscriptionEndEvent struct { // Key uniquely identifies a subscription. It is provided by the // supervisor Key string // Error in case the subscription ended because of an error Error error }
SubscriptionEndEvent is issued to the subscription supervisor when the subscription has been destroyed
type SubscriptionManager ¶
type SubscriptionManager struct {
// contains filtered or unexported fields
}
SubscriptionManager manages the lifetime of a group of subscriptions
func NewSubscriptionManager ¶
func NewSubscriptionManager( props SubscriptionManagerProps, ) *SubscriptionManager
NewSubscriptionManager creates a new subscription manager
func (*SubscriptionManager) Create ¶
func (m *SubscriptionManager) Create( ctx context.Context, key string, subscriber Subscriber, c chan<- interface{}, ) error
Create a new subscription identified by the specified key
type SubscriptionManagerProps ¶
type SubscriptionManagerProps struct { // Context used by the manager and that can be used // to signal a cancellation Context context.Context // Logger used by the manager and its subscriptions Logger log.Logger // Client to make requests Client Client }
SubscriptionManagerProps properties used to create the behaviour of the manager and the subscriptions created
type SubscriptionProps ¶
type SubscriptionProps struct { // Logger used by the subscription Logger log.Logger // Client to make requests Client Client // URL to dial to for the subscription. Must be a ws URL since // other provides may not support creating subscriptions URL string // Key uniquely identifies a subscription and it can be used to // notify the subscription supervisor Key string // Subscriber used to create the subscription Subscriber Subscriber // C channel to receive the events for a subscription C chan<- interface{} }
SubscriptionProps are the properties required when creating a subscription
type UniDialer ¶
type UniDialer struct {
// contains filtered or unexported fields
}
UniDialer implements the Dialer interface and it provides a connection to a specific URL. If a different URL is attempted the FixedDialer will return an error
func NewUniDialer ¶
NewUniDialer keeps a connection open to an endpoint. If the connection needs to be recreated a client can signal the pool to recreate the connection. Only websocket endpoints are supported because only websocket endpoints support the subscribe API
type UniDialerProps ¶
type UniDialerProps struct { URL string RetryConfig concurrent.RetryConfig }