firehose

package
v0.0.0-...-948650a Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package firehose implements simplified APIs for accessing the StreamingFast Firehose gRPC service. See https://firehose.streamingfast.io/

Index

Constants

View Source
const (
	TokenURL      = "https://auth.dfuse.io/v1/auth/issue"
	ETHMainnetURL = "mainnet.eth.streamingfast.io:443"
	ETHGoerliURL  = "goerli.eth.streamingfast.io:443"
)

Production URLs for the hosted Firehose service.

Variables

This section is empty.

Functions

func DefaultDialOptions

func DefaultDialOptions(tokenURL, apiKey string) ([]grpc.DialOption, error)

DefaultDialOptions returns gRPC DialOptions suitable for calling production Firehose servers as run by StreamingFast.

func ERC721TransferEvent

func ERC721TransferEvent() *ethpb.Event

ERC721TransferEvent returns the protobuf signature of an ERC721 Transfer event.

func ETHClient

func ETHClient(ctx context.Context, endpointURL, tokenURL, apiKey string, opts ...grpc.DialOption) (svcpb.HydrantServiceClient, func() error, error)

ETHClient returns a new Ethereum Hydrant service client.

func ETHClientFromSecret

func ETHClientFromSecret(ctx context.Context, chainID uint64, apiKey *secrets.Secret) (svcpb.HydrantServiceClient, func() error, error)

ETHClientFromSecret returns a new Ethereum Hydrant service client for the given chain ID using the provided secret.

func ETHGoerliClient

func ETHGoerliClient(ctx context.Context, apiKey string, opts ...grpc.DialOption) (svcpb.HydrantServiceClient, func() error, error)

ETHGoerliClient returns a new Ethereum Hydrant service client connected to the Goerli endpoint.

func ETHGoerliServer

func ETHGoerliServer(ctx context.Context, apiKey string, opts ...grpc.DialOption) (svcpb.HydrantServiceServer, func() error, error)

ETHGoerliServer returns a new Ethereum Hydrant service server connected to the Goerli endpoint.

func ETHMainnetClient

func ETHMainnetClient(ctx context.Context, apiKey string, opts ...grpc.DialOption) (svcpb.HydrantServiceClient, func() error, error)

ETHMainnetClient returns a new Ethereum Hydrant service client connected to the Mainnet endpoint.

func ETHMainnetServer

func ETHMainnetServer(ctx context.Context, apiKey string, opts ...grpc.DialOption) (svcpb.HydrantServiceServer, func() error, error)

ETHMainnetServer returns a new Ethereum Hydrant service server connected to the Mainnet endpoint.

func ETHServer

func ETHServer(ctx context.Context, endpointURL, tokenURL, apiKey string, opts ...grpc.DialOption) (svcpb.HydrantServiceServer, func() error, error)

ETHServer returns a new Ethereum Hydrant service server.

Types

type Block

type Block[B BlockProto] struct {
	Response *hosepb.Response
	Block    B
}

An Block couples a Firehose response with an unmarshalled block of concrete type.

type BlockProto

type BlockProto interface {
	*sfethpb.Block | *solpb.Block
}

BlockProto is a type constraint limited to the types of blocks supported by Firehose.

type Blocks

type Blocks[B BlockProto] struct {
	// C is a channel on which new Blocks are sent. It is closed when either the
	// stream client ends or an error occurs.
	C <-chan Block[B]
	// contains filtered or unexported fields
}

A Blocks stream provides a channel of blocks.

func (*Blocks[_]) Close

func (b *Blocks[_]) Close()

Close MUST be called to release resources used by the block streamer.

func (*Blocks[_]) Err

func (b *Blocks[_]) Err() error

Err returns any error that occurred during streaming. It SHOULD be called after C is closed.

type Proxy

type Proxy[B BlockProto] struct {
	// contains filtered or unexported fields
}

A Proxy provides access to the Firehose service through a modified API.

func Dial

func Dial[B BlockProto](ctx context.Context, endpointURL, tokenURL, apiKey string, opts ...grpc.DialOption) (*Proxy[B], error)

Dial dials the gRPC endpoint with tokens obtained from the token URL. If no gRPC DialOptions are provided then DefaultDialOptions(…) is used.

func DialETHGoerli

func DialETHGoerli(ctx context.Context, apiKey string, opts ...grpc.DialOption) (*Proxy[*sfethpb.Block], error)

DialETHGoerli is equivalent to Dial() with URLs to connect to the Ethereum Goerli endpoint and sfethpb.Block as the type argument.

func DialETHMainnet

func DialETHMainnet(ctx context.Context, apiKey string, opts ...grpc.DialOption) (*Proxy[*sfethpb.Block], error)

DialETHMainnet is equivalent to Dial() with URLs to connect to the Ethereum Mainnet endpoint and sfethpb.Block as the type argument.

func (*Proxy[B]) Blocks

func (p *Proxy[B]) Blocks(ctx context.Context, req *hosepb.Request, opts ...grpc.CallOption) (*Blocks[B], error)

Blocks queries propagates the request to the Proxy's underlying client.

func (*Proxy[_]) Close

func (p *Proxy[_]) Close() error

Close closes the underlying connection to the Firehose service.

Directories

Path Synopsis
Package firehosetest provides test doubles for the StreamingFast Firehose service, coupled to EVM code running on a simulated blockchain.
Package firehosetest provides test doubles for the StreamingFast Firehose service, coupled to EVM code running on a simulated blockchain.
The hydrant binary connects to the StreamingFast Firehose service to expose simplified APIs.
The hydrant binary connects to the StreamingFast Firehose service to expose simplified APIs.

Jump to

Keyboard shortcuts

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