fetch

package
v0.8.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetch

type Fetch interface {
	Block(ctx context.Context, block uint64) (fetchResponse FetchResponse, err error)
}

Fetch defines a block fetcher that must return a full JSON response

func NewGraphqlFetcher

func NewGraphqlFetcher(o GraphqlOpts) Fetch

type FetchResponse

type FetchResponse struct {
	Data struct {
		Block struct {
			Transactions []Transaction `json:"transactions"`
		} `json:"block"`
	} `json:"data"`
}

BlockResponse represents a full fetch JSON response

type Graphql

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

func (*Graphql) Block

func (f *Graphql) Block(ctx context.Context, blockNumber uint64) (FetchResponse, error)

type GraphqlOpts

type GraphqlOpts struct {
	GraphqlEndpoint string
}

type Transaction

type Transaction struct {
	Block struct {
		Number    uint64 `json:"number"`
		Timestamp string `json:"timestamp"`
	} `json:"block"`
	Hash  string `json:"hash"`
	Index uint   `json:"index"`
	From  struct {
		Address string `json:"address"`
	} `json:"from"`
	To struct {
		Address string `json:"address"`
	} `json:"to"`
	Value     string `json:"value"`
	InputData string `json:"inputData"`
	Status    uint64 `json:"status"`
	GasUsed   uint64 `json:"gasUsed"`
}

Transaction reprsents a JSON object of all important mined transaction information

Jump to

Keyboard shortcuts

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