indexer

package module
v0.0.0-...-1971f33 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

README

starknet-indexer

Starknet Indexer provides a simple cloud service for indexing the starknet blockchain. It depends on ent, gqlgen, and caigo in order generate db schemas, bind them to graphql endpoints and provide native starknet types.

To learn more about the entql binding generation see: https://entgo.io/docs/tutorial-todo-gql

Quick start

Start indexing

go run cmd/main.go

Visit:

http://localhost:8081/playground

Development

Generate schema, bindings, ect.

go generate ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(addr string, drv *sql.Driver, provider *jsonrpc.Client, config Config, opts ...IndexerOption)

func NewSchema

func NewSchema(client *ent.Client) graphql.ExecutableSchema

NewSchema creates a graphql executable schema.

Types

type Config

type Config struct {
	Head      uint64
	Interval  time.Duration
	Contracts []Contract
}

type Contract

type Contract struct {
	Address    string
	StartBlock uint64
	Handler    func(types.Transaction) error
}

type Engine

type Engine struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(ctx context.Context, client *ent.Client, provider *jsonrpc.Client, config Config) (*Engine, error)

func (*Engine) Register

func (e *Engine) Register(ctx context.Context, h interface{}) error

func (*Engine) Start

func (e *Engine) Start(ctx context.Context)

func (*Engine) Subscribe

func (e *Engine) Subscribe(ctx context.Context)

type IndexerOption

type IndexerOption interface {
	// contains filtered or unexported methods
}

IndexerOption configures how we set up the connection.

func WithDebug

func WithDebug() IndexerOption

func WithHttpClient

func WithHttpClient(client http.Client) IndexerOption

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver is the resolver root.

func (*Resolver) Query

func (r *Resolver) Query() gql.QueryResolver

Query returns gql.QueryResolver implementation.

func (*Resolver) Subscription

func (r *Resolver) Subscription() gql.SubscriptionResolver

Subscription returns gql.SubscriptionResolver implementation.

Jump to

Keyboard shortcuts

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