abi

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const AccountReferenceType = avm_abi.AccountReferenceType

AccountReferenceType is the ABI argument type string for account references

View Source
const AnyTransactionType = avm_abi.AnyTransactionType

AnyTransactionType is the ABI argument type string for a nonspecific transaction argument

View Source
const ApplicationCallTransactionType = avm_abi.ApplicationCallTransactionType

ApplicationCallTransactionType is the ABI argument type string for an application call transaction argument

View Source
const ApplicationReferenceType = avm_abi.ApplicationReferenceType

ApplicationReferenceType is the ABI argument type string for application references

View Source
const AssetConfigTransactionType = avm_abi.AssetConfigTransactionType

AssetConfigTransactionType is the ABI argument type string for an asset configuration transaction argument

View Source
const AssetFreezeTransactionType = avm_abi.AssetFreezeTransactionType

AssetFreezeTransactionType is the ABI argument type string for an asset freeze transaction argument

View Source
const AssetReferenceType = avm_abi.AssetReferenceType

AssetReferenceType is the ABI argument type string for asset references

View Source
const AssetTransferTransactionType = avm_abi.AssetTransferTransactionType

AssetTransferTransactionType is the ABI argument type string for an asset transfer transaction argument

View Source
const KeyRegistrationTransactionType = avm_abi.KeyRegistrationTransactionType

KeyRegistrationTransactionType is the ABI argument type string for a key registration transaction argument

View Source
const PaymentTransactionType = avm_abi.PaymentTransactionType

PaymentTransactionType is the ABI argument type string for a payment transaction argument

View Source
const VoidReturnType = avm_abi.VoidReturnType

VoidReturnType is the ABI return type string for a method that does not return any value

Variables

This section is empty.

Functions

func IsReferenceType

func IsReferenceType(typeStr string) bool

IsReferenceType checks if a type string represents a reference type argument, such as "account", "asset", or "application".

func IsTransactionType

func IsTransactionType(typeStr string) bool

IsTransactionType checks if a type string represents a transaction type argument, such as "txn", "pay", "keyreg", etc.

Types

type Arg

type Arg struct {
	// Optional, user-friendly name for the argument
	Name string `json:"name,omitempty"`
	// The type of the argument as a string. See the method GetTypeObject to
	// obtain the ABI type object
	Type string `json:"type"`

	// Optional, user-friendly description for the argument
	Desc string `json:"desc,omitempty"`
	// contains filtered or unexported fields
}

Arg represents an ABI Method argument

func (*Arg) GetTypeObject

func (a *Arg) GetTypeObject() (Type, error)

GetTypeObject parses and returns the ABI type object for this argument's type. An error will be returned if this argument's type is a transaction or reference type

func (Arg) IsReferenceArg

func (a Arg) IsReferenceArg() bool

IsReferenceArg checks if this argument's type is a reference type

func (Arg) IsTransactionArg

func (a Arg) IsTransactionArg() bool

IsTransactionArg checks if this argument's type is a transaction type

type Contract

type Contract struct {
	// A user-friendly name for the contract
	Name string `json:"name"`
	// Optional, user-friendly description for the contract
	Desc string `json:"desc,omitempty"`
	// Optional information about the contract's instances across different
	// networks
	Networks map[string]ContractNetworkInfo `json:"networks,omitempty"`
	// The methods that the contract implements
	Methods []Method `json:"methods"`
}

Contract represents an ABI contract, which is a concrete set of methods implemented by a single app

func (*Contract) GetMethodByName added in v1.17.0

func (c *Contract) GetMethodByName(name string) (Method, error)

type ContractNetworkInfo

type ContractNetworkInfo struct {
	// The application ID of the contract for this network
	AppID uint64 `json:"appID"`
}

ContractNetworkInfo contains network-specific information about the contract

type Interface

type Interface struct {
	// A user-friendly name for the interface
	Name string `json:"name"`
	// Optional, user-friendly description for the interface
	Desc string `json:"desc,omitempty"`
	// The methods that the interface contains
	Methods []Method `json:"methods"`
}

Interface represents an ABI interface, which is a logically grouped collection of methods

func (*Interface) GetMethodByName added in v1.17.0

func (i *Interface) GetMethodByName(name string) (Method, error)

type Method

type Method struct {
	// The name of the method
	Name string `json:"name"`
	// Optional, user-friendly description for the method
	Desc string `json:"desc,omitempty"`
	// The arguments of the method, in order
	Args []Arg `json:"args"`
	// Information about the method's return value
	Returns Return `json:"returns"`
}

Method represents an individual ABI method definition

func GetMethodByName added in v1.17.0

func GetMethodByName(methods []Method, name string) (Method, error)

func MethodFromSignature

func MethodFromSignature(methodStr string) (Method, error)

MethodFromSignature decoded a method signature string into a Method object.

func (*Method) GetSelector

func (method *Method) GetSelector() []byte

GetSelector calculates and returns the 4-byte selector of the method

func (*Method) GetSignature

func (method *Method) GetSignature() string

GetSignature calculates and returns the signature of the method

func (*Method) GetTxCount

func (method *Method) GetTxCount() int

GetTxCount returns the number of transactions required to invoke this method

type Return

type Return struct {
	// The type of the return value as a string. See the method GetTypeObject to
	// obtain the ABI type object
	Type string `json:"type"`

	// Optional, user-friendly description for the return value
	Desc string `json:"desc,omitempty"`
	// contains filtered or unexported fields
}

Return represents an ABI method return value

func (*Return) GetTypeObject

func (r *Return) GetTypeObject() (Type, error)

GetTypeObject parses and returns the ABI type object for this return type. An error will be returned if this is a void return type.

func (Return) IsVoid

func (r Return) IsVoid() bool

IsVoid checks if this return type is void, meaning the method does not have any return value

type Type

type Type = avm_abi.Type

func MakeTupleType

func MakeTupleType(argumentTypes []Type) (Type, error)

MakeTupleType makes tuple ABI type by taking an array of tuple element types as argument.

func TypeOf

func TypeOf(str string) (Type, error)

Jump to

Keyboard shortcuts

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