Documentation ¶
Index ¶
- func UnwrapStatusError(err error) error
- func WithEmulatorOptions(options ...emulator.Option) func(g *EmulatorGateway)
- func WithLogger(logger *zerolog.Logger) func(g *EmulatorGateway)
- type EmulatorGateway
- func (g *EmulatorGateway) CoverageReport() *runtime.CoverageReport
- func (g *EmulatorGateway) ExecuteScript(script []byte, arguments []cadence.Value) (cadence.Value, error)
- func (g *EmulatorGateway) ExecuteScriptAtHeight(script []byte, arguments []cadence.Value, height uint64) (cadence.Value, error)
- func (g *EmulatorGateway) ExecuteScriptAtID(script []byte, arguments []cadence.Value, id flow.Identifier) (cadence.Value, error)
- func (g *EmulatorGateway) GetAccount(address flow.Address) (*flow.Account, error)
- func (g *EmulatorGateway) GetBlockByHeight(height uint64) (*flow.Block, error)
- func (g *EmulatorGateway) GetBlockByID(id flow.Identifier) (*flow.Block, error)
- func (g *EmulatorGateway) GetCollection(id flow.Identifier) (*flow.Collection, error)
- func (g *EmulatorGateway) GetEvents(eventType string, startHeight uint64, endHeight uint64) ([]flow.BlockEvents, error)
- func (g *EmulatorGateway) GetLatestBlock() (*flow.Block, error)
- func (g *EmulatorGateway) GetLatestProtocolStateSnapshot() ([]byte, error)
- func (g *EmulatorGateway) GetTransaction(id flow.Identifier) (*flow.Transaction, error)
- func (g *EmulatorGateway) GetTransactionResult(ID flow.Identifier, _ bool) (*flow.TransactionResult, error)
- func (g *EmulatorGateway) GetTransactionResultsByBlockID(_ flow.Identifier) ([]*flow.TransactionResult, error)
- func (g *EmulatorGateway) GetTransactionsByBlockID(_ flow.Identifier) ([]*flow.Transaction, error)
- func (g *EmulatorGateway) Ping() error
- func (g *EmulatorGateway) RollbackToBlockHeight(height uint64) error
- func (g *EmulatorGateway) SecureConnection() bool
- func (g *EmulatorGateway) SendSignedTransaction(tx *flow.Transaction) (*flow.Transaction, error)
- func (g *EmulatorGateway) SetContext(ctx context.Context)
- type EmulatorKey
- type Gateway
- type GrpcGateway
- func (g *GrpcGateway) ExecuteScript(script []byte, arguments []cadence.Value) (cadence.Value, error)
- func (g *GrpcGateway) ExecuteScriptAtHeight(script []byte, arguments []cadence.Value, height uint64) (cadence.Value, error)
- func (g *GrpcGateway) ExecuteScriptAtID(script []byte, arguments []cadence.Value, ID flow.Identifier) (cadence.Value, error)
- func (g *GrpcGateway) GetAccount(address flow.Address) (*flow.Account, error)
- func (g *GrpcGateway) GetBlockByHeight(height uint64) (*flow.Block, error)
- func (g *GrpcGateway) GetBlockByID(id flow.Identifier) (*flow.Block, error)
- func (g *GrpcGateway) GetCollection(id flow.Identifier) (*flow.Collection, error)
- func (g *GrpcGateway) GetEvents(eventType string, startHeight uint64, endHeight uint64) ([]flow.BlockEvents, error)
- func (g *GrpcGateway) GetLatestBlock() (*flow.Block, error)
- func (g *GrpcGateway) GetLatestProtocolStateSnapshot() ([]byte, error)
- func (g *GrpcGateway) GetTransaction(ID flow.Identifier) (*flow.Transaction, error)
- func (g *GrpcGateway) GetTransactionResult(ID flow.Identifier, waitSeal bool) (*flow.TransactionResult, error)
- func (g *GrpcGateway) GetTransactionResultsByBlockID(blockID flow.Identifier) ([]*flow.TransactionResult, error)
- func (g *GrpcGateway) GetTransactionsByBlockID(blockID flow.Identifier) ([]*flow.Transaction, error)
- func (g *GrpcGateway) Ping() error
- func (g *GrpcGateway) SecureConnection() bool
- func (g *GrpcGateway) SendSignedTransaction(tx *flow.Transaction) (*flow.Transaction, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnwrapStatusError ¶
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 ¶ added in v1.0.1
func (g *EmulatorGateway) CoverageReport() *runtime.CoverageReport
func (*EmulatorGateway) ExecuteScript ¶
func (*EmulatorGateway) ExecuteScriptAtHeight ¶
func (*EmulatorGateway) ExecuteScriptAtID ¶
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, ) ([]flow.BlockEvents, error)
func (*EmulatorGateway) GetLatestBlock ¶
func (g *EmulatorGateway) GetLatestBlock() (*flow.Block, error)
func (*EmulatorGateway) GetLatestProtocolStateSnapshot ¶
func (g *EmulatorGateway) GetLatestProtocolStateSnapshot() ([]byte, error)
func (*EmulatorGateway) GetTransaction ¶
func (g *EmulatorGateway) GetTransaction(id flow.Identifier) (*flow.Transaction, error)
func (*EmulatorGateway) GetTransactionResult ¶
func (g *EmulatorGateway) GetTransactionResult(ID flow.Identifier, _ bool) (*flow.TransactionResult, error)
func (*EmulatorGateway) GetTransactionResultsByBlockID ¶
func (g *EmulatorGateway) GetTransactionResultsByBlockID(_ flow.Identifier) ([]*flow.TransactionResult, error)
func (*EmulatorGateway) GetTransactionsByBlockID ¶
func (g *EmulatorGateway) GetTransactionsByBlockID(_ flow.Identifier) ([]*flow.Transaction, error)
func (*EmulatorGateway) Ping ¶
func (g *EmulatorGateway) Ping() error
func (*EmulatorGateway) RollbackToBlockHeight ¶ added in v1.1.0
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(tx *flow.Transaction) (*flow.Transaction, error)
func (*EmulatorGateway) SetContext ¶
func (g *EmulatorGateway) SetContext(ctx context.Context)
type EmulatorKey ¶
type EmulatorKey struct { PublicKey crypto.PublicKey SigAlgo crypto.SignatureAlgorithm HashAlgo crypto.HashAlgorithm }
type Gateway ¶
type Gateway interface { GetAccount(flow.Address) (*flow.Account, error) SendSignedTransaction(*flow.Transaction) (*flow.Transaction, error) GetTransaction(flow.Identifier) (*flow.Transaction, error) GetTransactionResultsByBlockID(blockID flow.Identifier) ([]*flow.TransactionResult, error) GetTransactionResult(flow.Identifier, bool) (*flow.TransactionResult, error) GetTransactionsByBlockID(blockID flow.Identifier) ([]*flow.Transaction, error) ExecuteScript([]byte, []cadence.Value) (cadence.Value, error) ExecuteScriptAtHeight([]byte, []cadence.Value, uint64) (cadence.Value, error) ExecuteScriptAtID([]byte, []cadence.Value, flow.Identifier) (cadence.Value, error) GetLatestBlock() (*flow.Block, error) GetBlockByHeight(uint64) (*flow.Block, error) GetBlockByID(flow.Identifier) (*flow.Block, error) GetEvents(string, uint64, uint64) ([]flow.BlockEvents, error) GetCollection(flow.Identifier) (*flow.Collection, error) GetLatestProtocolStateSnapshot() ([]byte, error) Ping() 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) (*GrpcGateway, error)
NewGrpcGateway returns a new gRPC gateway.
func NewSecureGrpcGateway ¶
func NewSecureGrpcGateway(network config.Network) (*GrpcGateway, error)
NewSecureGrpcGateway returns a new gRPC gateway with a secure client connection.
func (*GrpcGateway) ExecuteScript ¶
func (g *GrpcGateway) ExecuteScript(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(script []byte, arguments []cadence.Value, height uint64) (cadence.Value, error)
ExecuteScriptAtHeight executes a script at block height.
func (*GrpcGateway) ExecuteScriptAtID ¶
func (g *GrpcGateway) ExecuteScriptAtID(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(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, ) ([]flow.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) GetLatestProtocolStateSnapshot ¶
func (g *GrpcGateway) GetLatestProtocolStateSnapshot() ([]byte, error)
GetLatestProtocolStateSnapshot gets the latest finalized protocol state snapshot
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(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(blockID flow.Identifier) ([]*flow.TransactionResult, error)
func (*GrpcGateway) GetTransactionsByBlockID ¶
func (g *GrpcGateway) GetTransactionsByBlockID(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(tx *flow.Transaction) (*flow.Transaction, error)
SendSignedTransaction sends a transaction to flow that is already prepared and signed.