txntest

package
v0.0.0-...-15eb78e Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignedTxns

func SignedTxns(txns ...*Txn) []transactions.SignedTxn

SignedTxns turns a list of Txns into a slice of SignedTxns with GroupIDs set properly to make them a transaction group. Maybe another name is more approrpriate

Types

type Txn

type Txn struct {
	Type protocol.TxType

	Sender      basics.Address
	Fee         interface{} // basics.MicroNovas, uint64, int, or nil
	FirstValid  basics.Round
	LastValid   basics.Round
	Note        []byte
	GenesisID   string
	GenesisHash crypto.Digest
	Group       crypto.Digest
	Lease       [32]byte
	RekeyTo     basics.Address

	VotePK           crypto.OneTimeSignatureVerifier
	SelectionPK      crypto.VRFVerifier
	VoteFirst        basics.Round
	VoteLast         basics.Round
	VoteKeyDilution  uint64
	Nonparticipation bool

	Receiver         basics.Address
	Amount           uint64
	CloseRemainderTo basics.Address

	ConfigAsset basics.AssetIndex
	AssetParams basics.AssetParams

	XferAsset     basics.AssetIndex
	AssetAmount   uint64
	AssetSender   basics.Address
	AssetReceiver basics.Address
	AssetCloseTo  basics.Address

	FreezeAccount basics.Address
	FreezeAsset   basics.AssetIndex
	AssetFrozen   bool

	ApplicationID     basics.AppIndex
	OnCompletion      transactions.OnCompletion
	ApplicationArgs   [][]byte
	Accounts          []basics.Address
	ForeignApps       []basics.AppIndex
	ForeignAssets     []basics.AssetIndex
	LocalStateSchema  basics.StateSchema
	GlobalStateSchema basics.StateSchema
	ApprovalProgram   interface{} // string, nil, or []bytes if already compiled
	ClearStateProgram interface{} // string, nil or []bytes if already compiled
	ExtraProgramPages uint32

	CertRound basics.Round
	CertType  protocol.CompactCertType
	Cert      compactcert.Cert
}

Txn exists to simplify writing tests where transaction.Transaction might be unwieldy. Txn simplifies testing in these ways: * Provides a flat structure to simplify object construction. * Defines convenience methods to help setup test state.

func (*Txn) FillDefaults

func (tx *Txn) FillDefaults(params config.ConsensusParams)

FillDefaults populates some obvious defaults from config params, unless they have already been set.

func (*Txn) Noted

func (tx *Txn) Noted(note string) *Txn

Noted returns a new Txn with the given note field.

func (Txn) SignedTxn

func (tx Txn) SignedTxn() transactions.SignedTxn

SignedTxn produces a unsigned, transactions.SignedTransaction from the fields in this Txn. This seemingly pointless operation exists, again, for convenience when driving tests.

func (Txn) SignedTxnWithAD

func (tx Txn) SignedTxnWithAD() transactions.SignedTxnWithAD

SignedTxnWithAD produces unsigned, transactions.SignedTxnWithAD from the fields in this Txn. This seemingly pointless operation exists, again, for convenience when driving tests.

func (Txn) Txn

func (tx Txn) Txn() transactions.Transaction

Txn produces a transactions.Transaction from the fields in this Txn

Jump to

Keyboard shortcuts

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