Documentation ¶
Overview ¶
package tests contains tests and test helper functions
Index ¶
- func CallVerifyMethod(appId uint64, account *crypto.Account, proofFilename string, ...) (*transaction.ABIMethodResult, error)
- func CompileTealFromFile(tealFilename string) ([]byte, error)
- func CompileWithPuyapy(name string, dir string) error
- func CreateDirectoryIfNeeded(dir string) error
- func DeployArc4AppIfNeeded(appName string, dir string) (appId uint64, err error)
- func ExecuteAbiCall(appId uint64, account *crypto.Account, schema *Arc32Schema, methodName string, ...) (*transaction.ExecuteResult, error)
- func GetAppByName(appName string, creatorAddress string) (*models.Application, error)
- func GetDefaultAccount() (account *crypto.Account, err error)
- func RandomBigInt(maxBits int64) *big.Int
- func SendTxn(txn types.Transaction, account *crypto.Account) (*models.PendingTransactionInfoResponse, error)
- func TestCircuitWithGnark(circuit frontend.Circuit, assignment frontend.Circuit, curve ecc.ID) (*ap.CompiledCircuit, *ap.VerifiedProof, error)
- type Arc32Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallVerifyMethod ¶
func CallVerifyMethod(appId uint64, account *crypto.Account, proofFilename string, publicInputsFilename string, schema *Arc32Schema, simulate bool) ( *transaction.ABIMethodResult, error)
CallVerifyMethod calls a verifier app with the given proof and public inputs. If account is nil, it uses the default localnet account. If simulate is true, it simulates the call instead of sending it, adding the maximum extra opcode budget. A local network must be running with default parameters
func CompileTealFromFile ¶
CompileTealFromFile reads a teal file and returns a compiled b64 binary. A local network must be running with default parameters
func CompileWithPuyapy ¶
CompileWithPuyapy compiles a python file with puyapy. Takes a name, which is the file name without the .py extension and the path to the directort where the file is located. It renames puyapy output files to match name, substituting the standard "Contract" prefix with name
func CreateDirectoryIfNeeded ¶
func DeployArc4AppIfNeeded ¶
DeployArc4AppIfNeeded lookups the appName among the apps deployed in the local network by the main account. If the app is not found, it deploys it. If found, it checks that the app is up to date with the latest compiled version and if not it deletes it and deploys the new version.
The function expects to find the files: - dir + appName + ".approval.teal" - dir + appName + ".clear.teal" - dir + appName + ".arc32.json"
A local network must be running with default parameters
func ExecuteAbiCall ¶
func ExecuteAbiCall(appId uint64, account *crypto.Account, schema *Arc32Schema, methodName string, oc types.OnCompletion, methodArgs []interface{}) ( *transaction.ExecuteResult, error)
ExecuteAbiCall calls an abi method on an app. A local network must be running with default parameters
func GetAppByName ¶
func GetAppByName(appName string, creatorAddress string) ( *models.Application, error)
GetAppByName returns the app created by creatorAddress with the name appName. If the app is not found, it returns nil. A local network must be running with default parameters
func GetDefaultAccount ¶
GetDefaultAccount returns the default account for the local network A local network must be running with default parameters
func RandomBigInt ¶
RandomBigInt returns a random big integer bigger than 1 of up to maxBits bits. If maxBits is less than 1, it defaults to 32.
func SendTxn ¶
func SendTxn(txn types.Transaction, account *crypto.Account) ( *models.PendingTransactionInfoResponse, error)
SendTxn signs and sends a transaction to the network. A local network must be running with default parameters
func TestCircuitWithGnark ¶
func TestCircuitWithGnark(circuit frontend.Circuit, assignment frontend.Circuit, curve ecc.ID) (*ap.CompiledCircuit, *ap.VerifiedProof, error)
TestCircuitWithGnark compiles a circuit and verifies a proof from an assignment using gnark (no interaction with the AVM)
Types ¶
type Arc32Schema ¶
type Arc32Schema struct { Source struct { Approval string `json:"approval"` Clear string `json:"clear"` } `json:"source"` State struct { Global struct { NumByteSlices uint64 `json:"num_byte_slices"` NumUints uint64 `json:"num_uints"` } `json:"global"` Local struct { NumByteSlices uint64 `json:"num_byte_slices"` NumUints uint64 `json:"num_uints"` } `json:"local"` } `json:"state"` Contract abi.Contract `json:"contract"` }
Arc32Schema defines a partial ARC32 schema
func ReadArc32Schema ¶
func ReadArc32Schema(filepath string) ( schema *Arc32Schema, err error)
ReadArc32Schema reads an ARC32 schema from a JSON file