utils

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLocalNodeURI = "http://127.0.0.1:9650"
	NodeURIs            = []string{DefaultLocalNodeURI, "http://127.0.0.1:9652", "http://127.0.0.1:9654", "http://127.0.0.1:9656", "http://127.0.0.1:9658"}
)
View Source
var BlockchainIDs map[string]string

At boot time subnets are created, one for each test suite. This global variable has all the subnets IDs that can be used.

One process creates the AvalancheGo node and all the subnets, and these subnets IDs are passed to all other processes and stored in this global variable

Functions

func CreateNewSubnet

func CreateNewSubnet(ctx context.Context, genesisFilePath string) string

CreateNewSubnet creates a new subnet and Subnet-EVM blockchain with the given genesis file. returns the ID of the new created blockchain.

func GetDefaultChainURI

func GetDefaultChainURI(blockchainID string) string

GetDefaultChainURI returns the default chain URI for a given blockchainID

func RegisterNodeRun

func RegisterNodeRun()

func RegisterPingTest

func RegisterPingTest()

func RunCommand

func RunCommand(bin string, args ...string) (*cmd.Cmd, error)

RunCommand starts the command [bin] with the given [args] and returns the command to the caller TODO cmd package mentions we can do this more efficiently with cmd.NewCmdOptions rather than looping and calling Status().

func RunDefaultHardhatTests

func RunDefaultHardhatTests(ctx context.Context, blockchainID string, test string)

RunDefaultHardhatTests runs the hardhat tests on a given blockchain ID with default parameters. Default parameters are: 1. Hardhat contract environment is located at ./contracts 2. Hardhat test file is located at ./contracts/test/<test>.ts 3. npx is available in the ./contracts directory

func RunTestCMD

func RunTestCMD(testCMD *exec.Cmd, rpcURI string)

RunTestCMD runs a given test command with the given rpcURI It also waits for the test ping to succeed before running the test command

Types

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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