helpers

package
v0.0.0-...-95bd726 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AvaxAssetID            = "CAM"
	DefaultStakingDelay    = 20 * time.Second
	DefaultStakingPeriod   = 72 * time.Hour
	DefaultDelegationDelay = 20 * time.Second // Time until delegation period should begin

	DefaultDelegationPeriod          = 36 * time.Hour
	DefaultDelegationFeeRate float32 = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCWorkFlowRunner

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

RPCWorkFlowRunner executes standard testing workflows like funding accounts from genesis and adding nodes as validators, using the a given camino client handle as the entry point to the test network. It runs the RpcWorkflows using the credential set in the userPass field. Note: RPCWorkFlowRunner does not store user credentials in a secure way. It is only suitable for testing purposes.

func NewRPCWorkFlowRunner

func NewRPCWorkFlowRunner(
	client *apis.Client,
	user api.UserPass,
	networkAcceptanceTimeout time.Duration) *RPCWorkFlowRunner

NewRPCWorkFlowRunner ...

func (RPCWorkFlowRunner) AddDelegatorToPrimaryNetwork

func (runner RPCWorkFlowRunner) AddDelegatorToPrimaryNetwork(
	delegateeNodeID string,
	pChainAddress string,
	stakeAmount uint64,
) error

AddDelegatorToPrimaryNetwork delegates to [delegateeNodeID] and blocks until the transaction is confirmed and the delegation period begins

func (RPCWorkFlowRunner) AddValidatorToPrimaryNetwork

func (runner RPCWorkFlowRunner) AddValidatorToPrimaryNetwork(
	nodeID string,
	pchainAddress string,
	stakeAmount uint64,
) error

AddValidatorToPrimaryNetwork adds [nodeID] as a validator and blocks until the transaction is confirmed and the validation period begins

func (RPCWorkFlowRunner) AwaitPChainTxs

func (runner RPCWorkFlowRunner) AwaitPChainTxs(txIDs ...ids.ID) error

AwaitPChainTxs confirms each transaction and returns an error if any of them are not confirmed

func (RPCWorkFlowRunner) AwaitXChainTxs

func (runner RPCWorkFlowRunner) AwaitXChainTxs(txIDs ...ids.ID) error

AwaitXChainTxs confirms each transaction and returns an error if any of them are not confirmed

func (RPCWorkFlowRunner) CreateDefaultAddresses

func (runner RPCWorkFlowRunner) CreateDefaultAddresses() (string, string, error)

CreateDefaultAddresses creates the keystore user for this workflow runner and creates an X and P Chain address for that keystore user

func (RPCWorkFlowRunner) FundXChainAddresses

func (runner RPCWorkFlowRunner) FundXChainAddresses(addresses []string, amount uint64) error

FundXChainAddresses sends [amount] AVAX to each address in [addresses] and returns the created txIDs

func (RPCWorkFlowRunner) ImportGenesisFunds

func (runner RPCWorkFlowRunner) ImportGenesisFunds() (string, error)

ImportGenesisFunds imports the genesis private key to this user's keystore

func (RPCWorkFlowRunner) ImportGenesisFundsAndStartValidating

func (runner RPCWorkFlowRunner) ImportGenesisFundsAndStartValidating(
	seedAmount uint64,
	stakeAmount uint64) (string, error)

ImportGenesisFundsAndStartValidating attempts to import genesis funds and add this node as a validator

func (RPCWorkFlowRunner) IssueTxList

func (runner RPCWorkFlowRunner) IssueTxList(
	txList [][]byte,
) error

IssueTxList issues each consecutive transaction in order

func (RPCWorkFlowRunner) SendAVAX

func (runner RPCWorkFlowRunner) SendAVAX(to string, amount uint64) (ids.ID, error)

SendAVAX attempts to send [amount] AVAX to address [to] using [runner]'s userPass

func (RPCWorkFlowRunner) SendAVAXBackAndForth

func (runner RPCWorkFlowRunner) SendAVAXBackAndForth(to string, amount, txFee, numTxs uint64, errs chan error)

SendAVAXBackAndForth sends [amount] AVAX to address [to] using funds from [runner.userPass], [numTxs] times

func (RPCWorkFlowRunner) TransferAvaPChainToXChain

func (runner RPCWorkFlowRunner) TransferAvaPChainToXChain(
	xChainAddress string,
	amount uint64) error

TransferAvaPChainToXChain exports AVAX from the P Chain and then imports it to the X Chain and blocks until both transactions have been accepted

func (RPCWorkFlowRunner) TransferAvaXChainToPChain

func (runner RPCWorkFlowRunner) TransferAvaXChainToPChain(pChainAddress string, amount uint64) error

TransferAvaXChainToPChain exports AVAX from the X Chain and then imports it to the P Chain and blocks until both transactions have been accepted

func (RPCWorkFlowRunner) User

func (runner RPCWorkFlowRunner) User() api.UserPass

User returns the user credentials for this worker

func (RPCWorkFlowRunner) VerifyPChainBalance

func (runner RPCWorkFlowRunner) VerifyPChainBalance(address string, expectedBalance uint64) error

VerifyPChainBalance verifies that the balance of P Chain Address: [address] is [expectedBalance]

func (RPCWorkFlowRunner) VerifyXChainAVABalance

func (runner RPCWorkFlowRunner) VerifyXChainAVABalance(address string, expectedBalance uint64) error

VerifyXChainAVABalance verifies that the balance of X Chain Address: [address] is [expectedBalance]

Jump to

Keyboard shortcuts

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