gateway

package
v0.0.2-beta Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmulatorGateway

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

func NewEmulatorGateway

func NewEmulatorGateway(serviceAccount *flowkit.Account) *EmulatorGateway

func (*EmulatorGateway) ExecuteScript

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

func (*EmulatorGateway) GetAccount

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

func (*EmulatorGateway) GetBlockByHeight

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

func (*EmulatorGateway) GetBlockByID

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

func (*EmulatorGateway) GetCollection

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

func (*EmulatorGateway) GetEvents

func (g *EmulatorGateway) GetEvents(
	eventType string,
	startHeight uint64,
	endHeight uint64,
) ([]client.BlockEvents, error)

func (*EmulatorGateway) GetLatestBlock

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

func (*EmulatorGateway) GetTransaction

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

func (*EmulatorGateway) GetTransactionResult

func (g *EmulatorGateway) GetTransactionResult(tx *flow.Transaction, waitSeal bool) (*flow.TransactionResult, error)

func (*EmulatorGateway) Ping

func (g *EmulatorGateway) Ping() error

func (*EmulatorGateway) SendSignedTransaction

func (g *EmulatorGateway) SendSignedTransaction(tx *flowkit.Transaction) (*flow.Transaction, error)

type Gateway

type Gateway interface {
	GetAccount(flow.Address) (*flow.Account, error)
	SendSignedTransaction(*flowkit.Transaction) (*flow.Transaction, error)
	GetTransactionResult(*flow.Transaction, bool) (*flow.TransactionResult, error)
	GetTransaction(flow.Identifier) (*flow.Transaction, error)
	ExecuteScript([]byte, []cadence.Value) (cadence.Value, error)
	GetLatestBlock() (*flow.Block, error)
	GetBlockByHeight(uint64) (*flow.Block, error)
	GetBlockByID(flow.Identifier) (*flow.Block, error)
	GetEvents(string, uint64, uint64) ([]client.BlockEvents, error)
	GetCollection(flow.Identifier) (*flow.Collection, error)
	Ping() error
}

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(host string) (*GrpcGateway, error)

NewGrpcGateway returns a new gRPC gateway.

func (*GrpcGateway) ExecuteScript

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

ExecuteScript execute a scripts on Flow through the Access API.

func (*GrpcGateway) GetAccount

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

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

func (*GrpcGateway) GetBlockByHeight

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

GetBlockByHeight get block by height from the Flow Access API.

func (*GrpcGateway) GetBlockByID

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

GetBlockByID get block by ID from the Flow Access API.

func (*GrpcGateway) GetCollection

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

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

func (*GrpcGateway) GetEvents

func (g *GrpcGateway) GetEvents(
	eventType string,
	startHeight uint64,
	endHeight uint64,
) ([]client.BlockEvents, error)

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

func (*GrpcGateway) GetLatestBlock

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

GetLatestBlock gets the latest block on Flow through the Access API.

func (*GrpcGateway) GetTransaction

func (g *GrpcGateway) GetTransaction(id flow.Identifier) (*flow.Transaction, error)

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

func (*GrpcGateway) GetTransactionResult

func (g *GrpcGateway) GetTransactionResult(tx *flow.Transaction, waitSeal bool) (*flow.TransactionResult, error)

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

func (*GrpcGateway) Ping

func (g *GrpcGateway) Ping() error

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

func (*GrpcGateway) SendSignedTransaction

func (g *GrpcGateway) SendSignedTransaction(transaction *flowkit.Transaction) (*flow.Transaction, error)

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

Jump to

Keyboard shortcuts

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