Help us shape the future of Go! Take the 2026 Go Developer Survey

gateway

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnwrapStatusError

func UnwrapStatusError(err error) error

func WithEmulatorOptions

func WithEmulatorOptions(options ...emulator.Option) func(g *EmulatorGateway)

func WithLogger

func WithLogger(logger *zerolog.Logger) func(g *EmulatorGateway)

Types

type EmulatorGateway

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

func NewEmulatorGateway

func NewEmulatorGateway(key *EmulatorKey) *EmulatorGateway

func NewEmulatorGatewayWithOpts

func NewEmulatorGatewayWithOpts(key *EmulatorKey, opts ...func(*EmulatorGateway)) *EmulatorGateway

func (*EmulatorGateway) CoverageReport

func (g *EmulatorGateway) CoverageReport() *runtime.CoverageReport

func (*EmulatorGateway) ExecuteScript

func (g *EmulatorGateway) ExecuteScript(
	ctx context.Context,
	script []byte,
	arguments []cadence.Value,
) (cadence.Value, error)

func (*EmulatorGateway) ExecuteScriptAtHeight

func (g *EmulatorGateway) ExecuteScriptAtHeight(
	ctx context.Context,
	script []byte,
	arguments []cadence.Value,
	height uint64,
) (cadence.Value, error)

func (*EmulatorGateway) ExecuteScriptAtID

func (g *EmulatorGateway) ExecuteScriptAtID(
	ctx context.Context,
	script []byte,
	arguments []cadence.Value,
	id flow.Identifier,
) (cadence.Value, error)

func (*EmulatorGateway) GetAccount

func (g *EmulatorGateway) GetAccount(ctx context.Context, address flow.Address) (*flow.Account, error)

func (*EmulatorGateway) GetAccountAtBlockHeight added in v2.10.1

func (g *EmulatorGateway) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, blockHeight uint64) (*flow.Account, error)

func (*EmulatorGateway) GetBlockByHeight

func (g *EmulatorGateway) GetBlockByHeight(ctx context.Context, height uint64) (*flow.Block, error)

func (*EmulatorGateway) GetBlockByID

func (g *EmulatorGateway) GetBlockByID(ctx context.Context, id flow.Identifier) (*flow.Block, error)

func (*EmulatorGateway) GetCollection

func (g *EmulatorGateway) GetCollection(ctx context.Context, id flow.Identifier) (*flow.Collection, error)

func (*EmulatorGateway) GetEvents

func (g *EmulatorGateway) GetEvents(
	ctx context.Context,
	eventType string,
	startHeight uint64,
	endHeight uint64,
) ([]flow.BlockEvents, error)

func (*EmulatorGateway) GetLatestBlock

func (g *EmulatorGateway) GetLatestBlock(ctx context.Context) (*flow.Block, error)

func (*EmulatorGateway) GetLatestProtocolStateSnapshot

func (g *EmulatorGateway) GetLatestProtocolStateSnapshot(ctx context.Context) ([]byte, error)

func (*EmulatorGateway) GetNodeVersionInfo added in v2.11.0

func (g *EmulatorGateway) GetNodeVersionInfo(context.Context) (*flow.NodeVersionInfo, error)

func (*EmulatorGateway) GetSystemTransaction added in v2.3.0

func (g *EmulatorGateway) GetSystemTransaction(ctx context.Context, blockID flow.Identifier) (*flow.Transaction, error)

func (*EmulatorGateway) GetSystemTransactionResult added in v2.3.0

func (g *EmulatorGateway) GetSystemTransactionResult(ctx context.Context, blockID flow.Identifier) (*flow.TransactionResult, error)

func (*EmulatorGateway) GetSystemTransactionResultWithID added in v2.6.0

func (g *EmulatorGateway) GetSystemTransactionResultWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.TransactionResult, error)

func (*EmulatorGateway) GetSystemTransactionWithID added in v2.6.0

func (g *EmulatorGateway) GetSystemTransactionWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.Transaction, error)

func (*EmulatorGateway) GetTransaction

func (g *EmulatorGateway) GetTransaction(ctx context.Context, id flow.Identifier) (*flow.Transaction, error)

func (*EmulatorGateway) GetTransactionResult

func (g *EmulatorGateway) GetTransactionResult(ctx context.Context, ID flow.Identifier, _ bool) (*flow.TransactionResult, error)

func (*EmulatorGateway) GetTransactionResultsByBlockID

func (g *EmulatorGateway) GetTransactionResultsByBlockID(ctx context.Context, id flow.Identifier) ([]*flow.TransactionResult, error)

func (*EmulatorGateway) GetTransactionsByBlockID

func (g *EmulatorGateway) GetTransactionsByBlockID(ctx context.Context, id flow.Identifier) ([]*flow.Transaction, error)

func (*EmulatorGateway) Ping

func (g *EmulatorGateway) Ping() error

func (*EmulatorGateway) RollbackToBlockHeight

func (g *EmulatorGateway) RollbackToBlockHeight(height uint64) error

func (*EmulatorGateway) SecureConnection

func (g *EmulatorGateway) SecureConnection() bool

SecureConnection placeholder func to complete gateway interface implementation

func (*EmulatorGateway) SendSignedTransaction

func (g *EmulatorGateway) SendSignedTransaction(ctx context.Context, tx *flow.Transaction) (*flow.Transaction, error)

func (*EmulatorGateway) WaitServer

func (g *EmulatorGateway) WaitServer(ctx context.Context) error

type EmulatorKey

type EmulatorKey struct {
	PublicKey crypto.PublicKey
	SigAlgo   crypto.SignatureAlgorithm
	HashAlgo  crypto.HashAlgorithm
}

type Gateway

type Gateway interface {
	GetAccount(context.Context, flow.Address) (*flow.Account, error)
	GetAccountAtBlockHeight(context.Context, flow.Address, uint64) (*flow.Account, error)
	SendSignedTransaction(context.Context, *flow.Transaction) (*flow.Transaction, error)
	GetTransaction(context.Context, flow.Identifier) (*flow.Transaction, error)
	GetTransactionResultsByBlockID(ctx context.Context, blockID flow.Identifier) ([]*flow.TransactionResult, error)
	GetTransactionResult(context.Context, flow.Identifier, bool) (*flow.TransactionResult, error)
	GetTransactionsByBlockID(context.Context, flow.Identifier) ([]*flow.Transaction, error)
	GetSystemTransaction(ctx context.Context, blockID flow.Identifier) (*flow.Transaction, error)
	GetSystemTransactionResult(ctx context.Context, blockID flow.Identifier) (*flow.TransactionResult, error)
	GetSystemTransactionWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.Transaction, error)
	GetSystemTransactionResultWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.TransactionResult, error)
	ExecuteScript(context.Context, []byte, []cadence.Value) (cadence.Value, error)
	ExecuteScriptAtHeight(context.Context, []byte, []cadence.Value, uint64) (cadence.Value, error)
	ExecuteScriptAtID(context.Context, []byte, []cadence.Value, flow.Identifier) (cadence.Value, error)
	GetLatestBlock(context.Context) (*flow.Block, error)
	GetBlockByHeight(context.Context, uint64) (*flow.Block, error)
	GetBlockByID(context.Context, flow.Identifier) (*flow.Block, error)
	GetEvents(context.Context, string, uint64, uint64) ([]flow.BlockEvents, error)
	GetCollection(context.Context, flow.Identifier) (*flow.Collection, error)
	GetLatestProtocolStateSnapshot(context.Context) ([]byte, error)
	GetNodeVersionInfo(context.Context) (*flow.NodeVersionInfo, error)
	Ping() error
	WaitServer(context.Context) error
	SecureConnection() bool
}

Gateway describes blockchain access interface

type GrpcGateway

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

GrpcGateway is a gateway implementation that uses the Flow Access gRPC API.

func NewGrpcGateway

func NewGrpcGateway(network config.Network, opts ...grpcAccess.ClientOption) (*GrpcGateway, error)

func NewSecureGrpcGateway

func NewSecureGrpcGateway(network config.Network, opts ...grpc.DialOption) (*GrpcGateway, error)

NewSecureGrpcGateway returns a new gRPC gateway with a secure client connection.

func (*GrpcGateway) ExecuteScript

func (g *GrpcGateway) ExecuteScript(ctx context.Context, script []byte, arguments []cadence.Value) (cadence.Value, error)

ExecuteScript executes a script on Flow through the Access API.

func (*GrpcGateway) ExecuteScriptAtHeight

func (g *GrpcGateway) ExecuteScriptAtHeight(ctx context.Context, script []byte, arguments []cadence.Value, height uint64) (cadence.Value, error)

ExecuteScriptAtHeight executes a script at block height.

func (*GrpcGateway) ExecuteScriptAtID

func (g *GrpcGateway) ExecuteScriptAtID(ctx context.Context, script []byte, arguments []cadence.Value, ID flow.Identifier) (cadence.Value, error)

ExecuteScriptAtID executes a script at block ID.

func (*GrpcGateway) GetAccount

func (g *GrpcGateway) GetAccount(ctx context.Context, address flow.Address) (*flow.Account, error)

GetAccount gets an account by address from the Flow Access API.

func (*GrpcGateway) GetAccountAtBlockHeight added in v2.10.1

func (g *GrpcGateway) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, blockHeight uint64) (*flow.Account, error)

GetAccountAtBlockHeight gets an account by address at a specific block height from the Flow Access API.

func (*GrpcGateway) GetBlockByHeight

func (g *GrpcGateway) GetBlockByHeight(ctx context.Context, height uint64) (*flow.Block, error)

GetBlockByHeight gets a block by height from the Flow Access API with full block payload.

func (*GrpcGateway) GetBlockByID

func (g *GrpcGateway) GetBlockByID(ctx context.Context, id flow.Identifier) (*flow.Block, error)

GetBlockByID gets a block by ID from the Flow Access API with full block payload.

func (*GrpcGateway) GetCollection

func (g *GrpcGateway) GetCollection(ctx context.Context, id flow.Identifier) (*flow.Collection, error)

GetCollection gets a collection by ID from the Flow Access API.

func (*GrpcGateway) GetEvents

func (g *GrpcGateway) GetEvents(
	ctx context.Context,
	eventType string,
	startHeight uint64,
	endHeight uint64,
) ([]flow.BlockEvents, error)

GetEvents gets events by name and block range from the Flow Access API.

func (*GrpcGateway) GetLatestBlock

func (g *GrpcGateway) GetLatestBlock(ctx context.Context) (*flow.Block, error)

GetLatestBlock gets the latest sealed block on Flow through the Access API with full block payload.

func (*GrpcGateway) GetLatestProtocolStateSnapshot

func (g *GrpcGateway) GetLatestProtocolStateSnapshot(ctx context.Context) ([]byte, error)

GetLatestProtocolStateSnapshot gets the latest finalized protocol state snapshot

func (*GrpcGateway) GetNodeVersionInfo added in v2.11.0

func (g *GrpcGateway) GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error)

GetNodeVersionInfo returns version information for the access node.

func (*GrpcGateway) GetSystemTransaction added in v2.3.0

func (g *GrpcGateway) GetSystemTransaction(ctx context.Context, blockID flow.Identifier) (*flow.Transaction, error)

func (*GrpcGateway) GetSystemTransactionResult added in v2.3.0

func (g *GrpcGateway) GetSystemTransactionResult(ctx context.Context, blockID flow.Identifier) (*flow.TransactionResult, error)

func (*GrpcGateway) GetSystemTransactionResultWithID added in v2.6.0

func (g *GrpcGateway) GetSystemTransactionResultWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.TransactionResult, error)

func (*GrpcGateway) GetSystemTransactionWithID added in v2.6.0

func (g *GrpcGateway) GetSystemTransactionWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.Transaction, error)

func (*GrpcGateway) GetTransaction

func (g *GrpcGateway) GetTransaction(ctx context.Context, ID flow.Identifier) (*flow.Transaction, error)

GetTransaction gets a transaction by ID from the Flow Access API.

func (*GrpcGateway) GetTransactionResult

func (g *GrpcGateway) GetTransactionResult(ctx context.Context, ID flow.Identifier, waitSeal bool) (*flow.TransactionResult, error)

GetTransactionResult gets a transaction result by ID from the Flow Access API.

func (*GrpcGateway) GetTransactionResultsByBlockID

func (g *GrpcGateway) GetTransactionResultsByBlockID(ctx context.Context, blockID flow.Identifier) ([]*flow.TransactionResult, error)

func (*GrpcGateway) GetTransactionsByBlockID

func (g *GrpcGateway) GetTransactionsByBlockID(ctx context.Context, blockID flow.Identifier) ([]*flow.Transaction, error)

func (*GrpcGateway) Ping

func (g *GrpcGateway) Ping() error

Ping is used to check if the access node is alive and healthy.

func (*GrpcGateway) SecureConnection

func (g *GrpcGateway) SecureConnection() bool

SecureConnection is used to log warning if a service should be using a secure client but is not

func (*GrpcGateway) SendSignedTransaction

func (g *GrpcGateway) SendSignedTransaction(ctx context.Context, tx *flow.Transaction) (*flow.Transaction, error)

SendSignedTransaction sends a transaction to flow that is already prepared and signed.

func (*GrpcGateway) WaitServer

func (g *GrpcGateway) WaitServer(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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