flow_helpers

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package flow_helpers provides convience functions for Flow blockchain interaction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAddress

func FormatAddress(address flow.Address) string

func HexString

func HexString(str string) string

func LatestBlockId

func LatestBlockId(ctx context.Context, flowClient FlowClient) (*flow.Identifier, error)

LatestBlockId retuns the flow.Identifier for the latest block in the chain.

func SendAndWait added in v0.6.0

func SendAndWait(ctx context.Context, flowClient FlowClient, tx flow.Transaction, timeout time.Duration) (*flow.TransactionResult, error)

SendAndWait sends the transaction and waits for the transaction to be sealed

func ValidateAddress

func ValidateAddress(address string, chainId flow.ChainID) (string, error)

func ValidateTransactionId

func ValidateTransactionId(id string) error

func WaitForSeal

func WaitForSeal(ctx context.Context, flowClient FlowClient, id flow.Identifier, timeout time.Duration) (*flow.TransactionResult, error)

WaitForSeal blocks until - an error occurs while fetching the transaction result - the transaction gets an error status - the transaction gets a "TransactionStatusSealed" or "TransactionStatusExpired" status - timeout is reached

Types

type FlowClient added in v0.10.0

type FlowClient interface {
	ExecuteScriptAtLatestBlock(ctx context.Context, script []byte, arguments []cadence.Value) (cadence.Value, error)
	GetAccount(ctx context.Context, address flow.Address) (*flow.Account, error)
	GetAccountAtLatestBlock(ctx context.Context, address flow.Address) (*flow.Account, error)
	GetTransaction(ctx context.Context, txID flow.Identifier) (*flow.Transaction, error)
	GetTransactionResult(ctx context.Context, txID flow.Identifier) (*flow.TransactionResult, error)
	GetLatestBlockHeader(ctx context.Context, isSealed bool) (*flow.BlockHeader, error)
	GetEventsForHeightRange(ctx context.Context, eventType string, startHeight uint64, endHeight uint64) ([]flow.BlockEvents, error)
	SendTransaction(ctx context.Context, tx flow.Transaction) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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