transaction

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: BSD-3-Clause Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEventNotFound = errors.New("event not found")
	ErrNoTopic       = errors.New("no topic")
)
View Source
var (
	// ErrTransactionReverted denotes that the sent transaction has been
	// reverted.
	ErrTransactionReverted = errors.New("transaction reverted")
)

Functions

func FindSingleEvent

func FindSingleEvent(abi *abi.ABI, receipt *types.Receipt, contractAddress common.Address, event abi.Event, out interface{}) error

FindSingleEvent will find the first event of the given kind.

func IsSynced

func IsSynced(ctx context.Context, backend Backend, maxDelay time.Duration) (bool, error)

IsSynced will check if we are synced with the given blockchain backend. This is true if the current wall clock is after the block time of last block with the given maxDelay as the maximum duration we can be behind the block time.

func NewService

func NewService(logger logging.Logger, backend Backend, signer crypto.Signer, store storage.StateStorer, chainID *big.Int) (chain.Transaction, error)

NewService creates a new transaction service.

func ParseABIUnchecked

func ParseABIUnchecked(json string) abi.ABI

ParseABIUnchecked will parse a valid json abi. Only use this with string constants known to be correct.

func ParseEvent

func ParseEvent(a *abi.ABI, eventName string, c interface{}, e types.Log) error

ParseEvent will parse the specified abi event from the given log

func WaitSynced

func WaitSynced(ctx context.Context, backend Backend, maxDelay time.Duration) error

WaitSynced will wait until we are synced with the given blockchain backend, with the given maxDelay duration as the maximum time we can be behind the last block.

Types

type Backend

type Backend interface {
	bind.ContractBackend
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	BlockNumber(ctx context.Context) (uint64, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	BalanceAt(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error)
}

Backend is the minimum of blockchain backend functions we need.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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