Documentation ¶
Index ¶
- type Account
- type AppParams
- type Environment
- func (env *Environment) Close()
- func (env *Environment) CreateApp(creator basics.Address, params AppParams) basics.AppIndex
- func (env *Environment) CreateAsset(creator basics.Address, params basics.AssetParams) basics.AssetIndex
- func (env *Environment) OptIntoApp(address basics.Address, appID basics.AppIndex)
- func (env *Environment) OptIntoAsset(address basics.Address, assetID basics.AssetIndex)
- func (env *Environment) Rekey(account, rekeyTo basics.Address)
- func (env *Environment) TransferAlgos(from, to basics.Address, amount uint64)
- func (env *Environment) TransferAsset(from, to basics.Address, assetID basics.AssetIndex, amount uint64)
- func (env *Environment) Txn(txn transactions.SignedTxn) transactions.ApplyData
- type TxnInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Addr basics.Address Sk *crypto.SignatureSecrets AcctData basics.AccountData }
Account contains public and private keys, as well as the state of an account
type AppParams ¶
type AppParams struct { ApprovalProgram interface{} ClearStateProgram interface{} GlobalState basics.TealKeyValue LocalStateSchema basics.StateSchema GlobalStateSchema basics.StateSchema ExtraProgramPages uint32 }
AppParams mirrors basics.AppParams, but allows the approval and clear state programs to have the same values that txntest.Txn accepts
type Environment ¶
type Environment struct { Ledger *data.Ledger Config config.Local // Accounts is a list of all accounts in the ledger, excluding the fee sink and rewards pool Accounts []Account FeeSinkAccount Account RewardsPoolAccount Account TxnInfo TxnInfo // contains filtered or unexported fields }
Environment contains the ledger and testing environment for transaction simulations. It also provides convenience methods to execute transactions against the ledger prior to simulation. This allows you to create specific a ledger state before running a simulation.
func PrepareSimulatorTest ¶
func PrepareSimulatorTest(t *testing.T) Environment
PrepareSimulatorTest creates an environment to test transaction simulations. The caller is responsible for calling Close() on the returned Environment.
func (*Environment) Close ¶
func (env *Environment) Close()
Close reclaims resources used by the testing environment
func (*Environment) CreateApp ¶
CreateApp creates an application with the given parameters and returns its ID
func (*Environment) CreateAsset ¶
func (env *Environment) CreateAsset(creator basics.Address, params basics.AssetParams) basics.AssetIndex
CreateAsset creates an asset with the given parameters and returns its ID
func (*Environment) OptIntoApp ¶
func (env *Environment) OptIntoApp(address basics.Address, appID basics.AppIndex)
OptIntoApp opts the given account into the given application
func (*Environment) OptIntoAsset ¶
func (env *Environment) OptIntoAsset(address basics.Address, assetID basics.AssetIndex)
OptIntoAsset opts the given account into the given asset
func (*Environment) Rekey ¶
func (env *Environment) Rekey(account, rekeyTo basics.Address)
Rekey rekeys the given account to the given authorizer
func (*Environment) TransferAlgos ¶
func (env *Environment) TransferAlgos(from, to basics.Address, amount uint64)
TransferAlgos transfers the given amount of Algos from one account to another
func (*Environment) TransferAsset ¶
func (env *Environment) TransferAsset(from, to basics.Address, assetID basics.AssetIndex, amount uint64)
TransferAsset transfers the given amount of an asset from one account to another
func (*Environment) Txn ¶
func (env *Environment) Txn(txn transactions.SignedTxn) transactions.ApplyData
Txn creates and executes a new block with the given transaction and returns its ApplyData
type TxnInfo ¶
type TxnInfo struct {
LatestHeader bookkeeping.BlockHeader
}
TxnInfo contains information about the network used for instantiating txntest.Txns
func (TxnInfo) CurrentProtocolParams ¶
func (info TxnInfo) CurrentProtocolParams() config.ConsensusParams
CurrentProtocolParams returns the consensus parameters that the network is currently using
func (TxnInfo) LatestRound ¶
LatestRound returns the round number of the most recently committed block