medley

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package medley provides some functions that may be useful in various parts of shutter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindFlags

func BindFlags(cmd *cobra.Command) error

BindFlags automatically sets options to command line flags from environment variables.

func CloneWithGob

func CloneWithGob(src, dst interface{})

CloneWithGob clones the given object by serializing/deserializing with gob.

func DedupAddresses

func DedupAddresses(addrs []common.Address) []common.Address

DedupAddresses returns a new slice containing only unique addresses.

func EnsureUniqueAddresses

func EnsureUniqueAddresses(addrs []common.Address) error

EnsureUniqueAddresses makes sure the slice of addresses doesn't contain duplicate addresses.

func FindAddressIndex

func FindAddressIndex(addresses []common.Address, addr common.Address) (int, error)

FindAddressIndex returns the index of the given address inside the slice of addresses or returns an error, if the slice does not contain the given address.

func GetRevertReason

func GetRevertReason(ctx context.Context, b ethereum.ContractCaller, from common.Address, tx *types.Transaction, blockNum *big.Int) error

GetRevertReason returns the reason for a failed transaction.

func ShowHelpAndExit

func ShowHelpAndExit(cmd *cobra.Command, args []string)

ShowHelpAndExit shows the commands help message and exits the program with status 1.

func Sleep

func Sleep(ctx context.Context, d time.Duration)

Sleep pauses the current goroutine for the given duration.

func WaitMined

func WaitMined(ctx context.Context, client *ethclient.Client, txHash common.Hash) (*types.Receipt, error)

WaitMined waits for a transaction to be mined and returns its receipt. It's a replacement for bind.WaitMined which doesn't seem to work with Ganache in some cases.

func WaitMinedMany

func WaitMinedMany(ctx context.Context, client *ethclient.Client, txHashes []common.Hash) ([]*types.Receipt, error)

Types

type ChecksumAddr

type ChecksumAddr common.Address

ChecksumAddr is used internally to serialize addresses as checksum addresses when writing JSON files.

func (ChecksumAddr) MarshalJSON

func (addr ChecksumAddr) MarshalJSON() ([]byte, error)

func (*ChecksumAddr) UnmarshalJSON

func (addr *ChecksumAddr) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
Package txbatch is used to batch transactions for a main chain node
Package txbatch is used to batch transactions for a main chain node

Jump to

Keyboard shortcuts

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