client

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchWithMajority

func FetchWithMajority[T any](ctx context.Context, nodes []*T, fetchFunc func(*T) (json.RawMessage, error)) (json.RawMessage, error)

Types

type Client

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

func NewClient

func NewClient(url string) *Client

func (*Client) FetchBlockMerkleProof

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.HeaderImpl, error)

func (*Client) FetchHeadersByRange

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

func (*Client) FetchLatestBlockHeight

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

func (*Client) FetchRawHeaderByHeight

func (c *Client) FetchRawHeaderByHeight(ctx context.Context, blockHeight uint64) (json.RawMessage, error)

func (*Client) FetchTransactionByHash

func (c *Client) FetchTransactionByHash(ctx context.Context, hash *types.TaggedBase64) (types.TransactionQueryData, error)

func (*Client) FetchTransactionsInBlock

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

func (*Client) FetchVidCommonByHeight

func (c *Client) FetchVidCommonByHeight(ctx context.Context, blockHeight uint64) (common.VidCommon, error)

func (*Client) SubmitTransaction

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

type EspressoClient

type EspressoClient interface {
	QueryService
	SubmitAPI
}

type MultipleNodesClient

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

func NewMultipleNodesClient

func NewMultipleNodesClient(urls []string) *MultipleNodesClient

func (*MultipleNodesClient) FetchHeaderByHeight

func (c *MultipleNodesClient) FetchHeaderByHeight(ctx context.Context, height uint64) (types.HeaderImpl, error)

func (*MultipleNodesClient) FetchHeadersByRange

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

func (*MultipleNodesClient) FetchLatestBlockHeight

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

func (*MultipleNodesClient) FetchRawHeaderByHeight

func (c *MultipleNodesClient) FetchRawHeaderByHeight(ctx context.Context, height uint64) (json.RawMessage, error)

func (*MultipleNodesClient) FetchTransactionByHash

func (c *MultipleNodesClient) FetchTransactionByHash(ctx context.Context, hash *types.TaggedBase64) (types.TransactionQueryData, error)

func (*MultipleNodesClient) FetchTransactionsInBlock

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

func (*MultipleNodesClient) FetchVidCommonByHeight

func (c *MultipleNodesClient) FetchVidCommonByHeight(ctx context.Context, blockHeight uint64) (common.VidCommon, error)

func (*MultipleNodesClient) SubmitTransaction

func (c *MultipleNodesClient) SubmitTransaction(ctx context.Context, tx common.Transaction) (*common.TaggedBase64, 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.HeaderImpl, error)
	// Get the raw header for block number `height`.
	FetchRawHeaderByHeight(ctx context.Context, height uint64) (json.RawMessage, error)
	// Get the headers starting from the given :from up until the given :until
	FetchHeadersByRange(ctx context.Context, from uint64, until uint64) ([]types.HeaderImpl, error)
	// Get the transactions belonging to the given namespace at the block height,
	// along with a proof that these are all such transactions.
	FetchTransactionsInBlock(ctx context.Context, blockHeight uint64, namespace uint64) (TransactionsInBlock, error)
	// Get the transaction by its hash.
	FetchTransactionByHash(ctx context.Context, hash *types.TaggedBase64) (types.TransactionQueryData, error)
	// Get the VidCommon for the given block height.
	FetchVidCommonByHeight(ctx context.Context, blockHeight uint64) (types.VidCommon, 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 common.Transaction) (*common.TaggedBase64, 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"`
	VidCommon types.VidCommon      `json:"vidCommon"`
}

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