utils

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: GPL-3.0, LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DYNAMIC_RPC_FILE = "contract-examples/dynamic_rpc.json"
	LOCAL_RPC_FILE   = "contract-examples/local_rpc.json"
)

Variables

This section is empty.

Functions

func DescribeLocal

func DescribeLocal(text string, body func()) bool

DescribeLocal annotates the tests that requires local network-runner. Can only run with local cluster.

func DescribePrecompile

func DescribePrecompile(body func()) bool

func GetClient

func GetClient() runner_sdk.Client

func GetExecPath

func GetExecPath() string

Loads the executable path for "avalanchego".

func GetOutputPath

func GetOutputPath() string

func GetPluginDir

func GetPluginDir() string

func GetSkipNetworkRunnerShutdown

func GetSkipNetworkRunnerShutdown() bool

func GetVmGenesisPath

func GetVmGenesisPath() string

func Outf

func Outf(format string, args ...interface{})

Outputs to stdout.

e.g.,

Outf("{{green}}{{bold}}hi there %q{{/}}", "aa")
Outf("{{magenta}}{{bold}}hi therea{{/}} {{cyan}}{{underline}}b{{/}}")

ref. https://github.com/onsi/ginkgo/blob/v2.0.0/formatter/formatter.go#L52-L73

func RunCommand

func RunCommand(ctx context.Context, bin string, args ...string) (cmd.Status, error)

func SetClient

func SetClient(c runner_sdk.Client)

func SetClusterInfo

func SetClusterInfo(c ClusterInfo)

func SetExecPath

func SetExecPath(p string)

Sets the executable path for "avalanchego".

func SetOutputFile

func SetOutputFile(filepath string)

func SetPluginDir

func SetPluginDir(dir string)

func SetSkipNetworkRunnerShutdown

func SetSkipNetworkRunnerShutdown(b bool)

func SetVmGenesisPath

func SetVmGenesisPath(p string)

func UpdateHardhatConfig

func UpdateHardhatConfig() error

Types

type ClusterInfo

type ClusterInfo struct {
	URIs                  []string `json:"uris"`
	Endpoint              string   `json:"endpoint"`
	PID                   int      `json:"pid"`
	LogsDir               string   `json:"logsDir"`
	SubnetEVMRPCEndpoints []string `json:"subnetEVMRPCEndpoints"`
}

ClusterInfo represents the local cluster information.

func GetClusterInfo

func GetClusterInfo() ClusterInfo

func (ClusterInfo) Save

func (ci ClusterInfo) Save(p string) error

type EvmClient

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

func NewEvmClient

func NewEvmClient(ep string, baseFee uint64, priorityFee uint64) (*EvmClient, error)

func (*EvmClient) ConfirmTx

func (ec *EvmClient) ConfirmTx(ctx context.Context, txHash common.Hash) (*big.Int, error)

func (*EvmClient) FetchBalance

func (ec *EvmClient) FetchBalance(ctx context.Context, addr common.Address) (*big.Int, error)

func (*EvmClient) FetchNonce

func (ec *EvmClient) FetchNonce(ctx context.Context, addr common.Address) (uint64, error)

func (*EvmClient) TransferTx

func (ec *EvmClient) TransferTx(
	ctx context.Context,
	sender common.Address,
	senderPriv *ecdsa.PrivateKey,
	recipient common.Address,
	transferAmount *big.Int) (*big.Int, error)

makes transfer tx and returns the new balance of sender

func (*EvmClient) WaitForBalance

func (ec *EvmClient) WaitForBalance(ctx context.Context, addr common.Address, minBalance *big.Int) error

Jump to

Keyboard shortcuts

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