apiproxy

package
v0.32.9 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RestProxyHandler

type RestProxyHandler struct {
	access.API
	*forwarder.Forwarder
	Logger  zerolog.Logger
	Metrics metrics.ObserverMetrics
	Chain   flow.Chain
}

RestProxyHandler is a structure that represents the proxy algorithm for observer node. It includes the local backend and forwards the methods which can't be handled locally to an upstream using gRPC API.

func NewRestProxyHandler

func NewRestProxyHandler(
	api access.API,
	identities flow.IdentityList,
	timeout time.Duration,
	maxMsgSize uint,
	log zerolog.Logger,
	metrics metrics.ObserverMetrics,
	chain flow.Chain,
) (*RestProxyHandler, error)

NewRestProxyHandler returns a new rest proxy handler for observer node.

func (*RestProxyHandler) ExecuteScriptAtBlockHeight

func (r *RestProxyHandler) ExecuteScriptAtBlockHeight(ctx context.Context, blockHeight uint64, script []byte, arguments [][]byte) ([]byte, error)

ExecuteScriptAtBlockHeight executes script at the given block height .

func (*RestProxyHandler) ExecuteScriptAtBlockID

func (r *RestProxyHandler) ExecuteScriptAtBlockID(ctx context.Context, blockID flow.Identifier, script []byte, arguments [][]byte) ([]byte, error)

ExecuteScriptAtBlockID executes script at the given block id .

func (*RestProxyHandler) ExecuteScriptAtLatestBlock

func (r *RestProxyHandler) ExecuteScriptAtLatestBlock(ctx context.Context, script []byte, arguments [][]byte) ([]byte, error)

ExecuteScriptAtLatestBlock executes script at latest block.

func (*RestProxyHandler) GetAccountAtBlockHeight

func (r *RestProxyHandler) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, height uint64) (*flow.Account, error)

GetAccountAtBlockHeight returns account by account address and block height.

func (*RestProxyHandler) GetCollectionByID

func (r *RestProxyHandler) GetCollectionByID(ctx context.Context, id flow.Identifier) (*flow.LightCollection, error)

GetCollectionByID returns a collection by ID.

func (*RestProxyHandler) GetEventsForBlockIDs

func (r *RestProxyHandler) GetEventsForBlockIDs(
	ctx context.Context,
	eventType string,
	blockIDs []flow.Identifier,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) ([]flow.BlockEvents, error)

GetEventsForBlockIDs returns events by their name in the specified block IDs.

func (*RestProxyHandler) GetEventsForHeightRange

func (r *RestProxyHandler) GetEventsForHeightRange(
	ctx context.Context,
	eventType string,
	startHeight, endHeight uint64,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) ([]flow.BlockEvents, error)

GetEventsForHeightRange returns events by their name in the specified blocks heights.

func (*RestProxyHandler) GetExecutionResultByID

func (r *RestProxyHandler) GetExecutionResultByID(ctx context.Context, id flow.Identifier) (*flow.ExecutionResult, error)

GetExecutionResultByID gets execution result by its ID.

func (*RestProxyHandler) GetExecutionResultForBlockID

func (r *RestProxyHandler) GetExecutionResultForBlockID(ctx context.Context, blockID flow.Identifier) (*flow.ExecutionResult, error)

GetExecutionResultForBlockID gets execution result by provided block ID.

func (*RestProxyHandler) GetTransaction

func (r *RestProxyHandler) GetTransaction(ctx context.Context, id flow.Identifier) (*flow.TransactionBody, error)

GetTransaction returns transaction by ID.

func (*RestProxyHandler) GetTransactionResult

func (r *RestProxyHandler) GetTransactionResult(
	ctx context.Context,
	id flow.Identifier,
	blockID flow.Identifier,
	collectionID flow.Identifier,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) (*access.TransactionResult, error)

GetTransactionResult returns transaction result by the transaction ID.

func (*RestProxyHandler) SendTransaction

func (r *RestProxyHandler) SendTransaction(ctx context.Context, tx *flow.TransactionBody) error

SendTransaction sends already created transaction.

Jump to

Keyboard shortcuts

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