Documentation ¶
Index ¶
- Variables
- func CheckInvariants(ctx context.Context, rtc client.RuntimeClient) error
- func CreateAndFundAccount(ctx context.Context, rtc client.RuntimeClient, funder signature.Signer, id int, ...) (signature.Signer, error)
- func EstimateGas(ctx context.Context, rtc client.RuntimeClient, tx types.Transaction, ...) types.Transaction
- func GenNonce(ctx context.Context, rtc client.RuntimeClient, _ *rand.Rand, ...) (*types.Transaction, error)
- func GenTransfer(ctx context.Context, rtc client.RuntimeClient, rng *rand.Rand, ...) (*types.Transaction, error)
- func Generate(ctx context.Context, rtc client.RuntimeClient, rng *rand.Rand, ...) (uint64, uint64, uint64, error)
- func GetChainContext(ctx context.Context, rtc client.RuntimeClient) (signature.Context, error)
- func NewClient(clientNodeUnixSocketPath string, runtimeID common.Namespace) (client.RuntimeClient, error)
- func RandomizeFee(_ context.Context, rng *rand.Rand, tx *types.Transaction) error
- func SignAndSubmitTxRaw(ctx context.Context, rtc client.RuntimeClient, signer signature.Signer, ...) (*types.CallResult, error)
- type AccountType
- type GenerateTx
Constants ¶
This section is empty.
Variables ¶
var DefaultTxGenerators = []GenerateTx{GenTransfer, GenNonce}
DefaultTxGenerators is the default set of transaction generators, which can be used as the txGens argument to Generate().
Functions ¶
func CheckInvariants ¶
func CheckInvariants(ctx context.Context, rtc client.RuntimeClient) error
CheckInvariants issues a check of invariants in all modules in the runtime.
func CreateAndFundAccount ¶
func CreateAndFundAccount(ctx context.Context, rtc client.RuntimeClient, funder signature.Signer, id int, acctType AccountType, fundAmount uint64) (signature.Signer, error)
CreateAndFundAccount creates a new account and funds it using the given funding account.
func EstimateGas ¶
func EstimateGas(ctx context.Context, rtc client.RuntimeClient, tx types.Transaction, extraGas uint64) types.Transaction
EstimateGas estimates the amount of gas the transaction will use. Returns modified transaction that has just the right amount of gas.
func GenNonce ¶
func GenNonce(ctx context.Context, rtc client.RuntimeClient, _ *rand.Rand, acct signature.Signer, _ []signature.Signer) (*types.Transaction, error)
GenNonce just queries the account's nonce.
func GenTransfer ¶
func GenTransfer( ctx context.Context, rtc client.RuntimeClient, rng *rand.Rand, acct signature.Signer, accts []signature.Signer, ) (*types.Transaction, error)
GenTransfer generates transfer transactions.
func Generate ¶
func Generate(ctx context.Context, rtc client.RuntimeClient, rng *rand.Rand, accounts []signature.Signer, txGens []GenerateTx, txDelay time.Duration) (uint64, uint64, uint64, error)
Generate generates and submits a random transaction for the given accounts every txDelay seconds until the context is terminated.
func GetChainContext ¶
GetChainContext returns the chain context.
func NewClient ¶
func NewClient(clientNodeUnixSocketPath string, runtimeID common.Namespace) (client.RuntimeClient, error)
NewClient creates a new runtime client.
func RandomizeFee ¶
RandomizeFee generates random fee parameters for the transaction.
func SignAndSubmitTxRaw ¶
func SignAndSubmitTxRaw(ctx context.Context, rtc client.RuntimeClient, signer signature.Signer, tx types.Transaction, extraGas uint64) (*types.CallResult, error)
SignAndSubmitTxRaw signs and submits the given transaction. Gas estimation is done automatically.
Types ¶
type AccountType ¶
type AccountType uint8
AccountType is the type of account to create.
const ( AccountEd25519 AccountType = 0 AccountSecp256k1 AccountType = 1 AccountSr25519 AccountType = 2 AccountTypeMax = AccountSr25519 )
Supported account types.
func (AccountType) String ¶
func (at AccountType) String() string
type GenerateTx ¶
type GenerateTx func(context.Context, client.RuntimeClient, *rand.Rand, signature.Signer, []signature.Signer) (*types.Transaction, error)
GenerateTx is a function that generates a random transaction or performs a random query (in which case the returned transaction can be nil).