client

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(url string) *Client

func (*Client) FetchBlockMerkleProof added in v0.0.10

func (c *Client) FetchBlockMerkleProof(ctx context.Context, rootHeight uint64, hotshotHeight uint64) (types.HotShotBlockMerkleProof, error)

Fetches a block merkle proof at the snapshot rootHeight for the leaf at the provided HotShot height

func (*Client) FetchHeaderByHeight

func (c *Client) FetchHeaderByHeight(ctx context.Context, blockHeight uint64) (types.Header, error)

func (*Client) FetchHeadersByRange added in v0.0.14

func (c *Client) FetchHeadersByRange(ctx context.Context, from uint64, until uint64) ([]types.Header, error)

func (*Client) FetchLatestBlockHeight

func (c *Client) FetchLatestBlockHeight(ctx context.Context) (uint64, error)

func (*Client) FetchTransactionsInBlock

func (c *Client) FetchTransactionsInBlock(ctx context.Context, blockHeight uint64, namespace uint64) (TransactionsInBlock, error)

func (*Client) SubmitTransaction

func (c *Client) SubmitTransaction(ctx context.Context, tx types.Transaction) error

type NamespaceResponse

type NamespaceResponse struct {
	Proof        *json.RawMessage     `json:"proof"`
	Transactions *[]types.Transaction `json:"transactions"`
}

type QueryService

type QueryService interface {
	// Get the latest block number
	FetchLatestBlockHeight(ctx context.Context) (uint64, error)
	// Get the header for block number `height`.
	FetchHeaderByHeight(ctx context.Context, height uint64) (types.Header, error)
	// Get the headers starting from the given :from up until the given :until
	FetchHeadersByRange(ctx context.Context, from uint64, until uint64) ([]types.Header, error)
	// Get the transactions belonging to the given namespace in the block with the given header,
	// along with a proof that these are all such transactions.
	FetchTransactionsInBlock(ctx context.Context, header *types.Header, namespace uint64) (TransactionsInBlock, error)
}

Interface to the Espresso Sequencer query service.

type SubmitAPI

type SubmitAPI interface {
	// Submit a transaction to the espresso sequencer.
	SubmitTransaction(ctx context.Context, tx types.Transaction) error
}

Interface to the Espresso Sequencer submit API

type TransactionsInBlock

type TransactionsInBlock struct {
	// The transactions.
	Transactions []types.Bytes `json:"transactions"`
	// A proof that these are all the transactions in the block with the requested namespace.
	Proof types.NamespaceProof `json:"proof"`
}

Response to `FetchTransactionsInBlock`

func (*TransactionsInBlock) UnmarshalJSON

func (t *TransactionsInBlock) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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