txntest

package
v0.0.0-...-ff2c966 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const TmLsig = `` /* 9365-byte string literal not displayed */

TmLsig is a tinyman lsig contract used in tests/benchmarks

Variables

This section is empty.

Functions

func CreateTinyManSignedTxGroup

func CreateTinyManSignedTxGroup(tb testing.TB, txns []Txn) ([]transactions.SignedTxn, []*crypto.SignatureSecrets)

CreateTinyManSignedTxGroup repro this tx group by tinyman https://algoexplorer.io/tx/group/d1bUcqFbNZDMIdcreM9Vw2jzOIZIa2UzDgTTlr2Sl4o%3D which is an algo to USDC swap. The source code below is extracted from algoexplorer, which adds some unusual stuff as comments

func Group

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

Group turns a list of Txns into a slice of SignedTxns with GroupIDs set properly to make them a transaction group. The input Txns are modified with the calculated GroupID.

Types

type Txn

type Txn struct {
	Type protocol.TxType

	Sender      basics.Address
	Fee         interface{} // basics.MicroAlgos, 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
	StateProofPK     merklesignature.Commitment

	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
	Boxes             []transactions.BoxRef
	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

	StateProofType protocol.StateProofType
	StateProof     stateproof.StateProof
	StateProofMsg  stateproofmsg.Message
}

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 CreateTinyManTxGroup

func CreateTinyManTxGroup(tb testing.TB, randNote bool) []Txn

CreateTinyManTxGroup repro this tx group by tinyman https://algoexplorer.io/tx/group/d1bUcqFbNZDMIdcreM9Vw2jzOIZIa2UzDgTTlr2Sl4o%3D

func (Txn) Args

func (tx Txn) Args(strings ...string) *Txn

Args returns a new Txn with the given strings as app args

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