abi

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2018 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ElementSize = 32

EVM Solidity calls and return values are packed into pieces of 32 bytes, including a bool (wasting 255 out of 256 bits)

View Source
const FunctionIDSize = 4

Variables

This section is empty.

Functions

func GetPackingTypes added in v0.20.1

func GetPackingTypes(args []Argument) []interface{}

func Pack added in v0.20.1

func Pack(argSpec []Argument, args ...interface{}) ([]byte, error)

func PackIntoStruct added in v0.20.1

func PackIntoStruct(argSpec []Argument, st interface{}) ([]byte, error)

func Packer added in v0.20.1

func Packer(abiData, funcName string, args ...string) ([]byte, error)

Convenience Packing Functions

func ReadAbiFormulateCall added in v0.20.1

func ReadAbiFormulateCall(abiSpecBytes []byte, funcName string, args []string) ([]byte, error)

func ReadAbiFormulateCallFile added in v0.20.1

func ReadAbiFormulateCallFile(abiLocation, binPath, funcName string, args []string) ([]byte, error)

func Unpack added in v0.20.1

func Unpack(argSpec []Argument, data []byte, args ...interface{}) error

func UnpackIntoStruct added in v0.20.1

func UnpackIntoStruct(argSpec []Argument, data []byte, st interface{}) error

Types

type AbiSpec added in v0.20.1

type AbiSpec struct {
	Constructor FunctionSpec
	Fallback    FunctionSpec
	Functions   map[string]FunctionSpec
	Events      map[string]Event
}

func ReadAbiSpec added in v0.20.1

func ReadAbiSpec(specBytes []byte) (*AbiSpec, error)

func ReadAbiSpecFile added in v0.20.1

func ReadAbiSpecFile(filename string) (*AbiSpec, error)

func (*AbiSpec) Pack added in v0.20.1

func (abiSpec *AbiSpec) Pack(fname string, args ...interface{}) ([]byte, error)

type AbiSpecJSON added in v0.20.1

type AbiSpecJSON struct {
	Name            string
	Type            string
	Inputs          []ArgumentJSON
	Outputs         []ArgumentJSON
	Constant        bool
	Payable         bool
	StateMutability string
	Anonymous       bool
}

type Argument added in v0.20.1

type Argument struct {
	Name        string
	EVM         EVMType
	IsArray     bool
	Indexed     bool
	ArrayLength uint64
}

func EVMTypeFromReflect added in v0.20.1

func EVMTypeFromReflect(v reflect.Type) Argument

type ArgumentJSON added in v0.20.1

type ArgumentJSON struct {
	Name       string
	Type       string
	Components []ArgumentJSON
	Indexed    bool
}

type EVMAddress added in v0.20.1

type EVMAddress struct {
}

func (EVMAddress) GetSignature added in v0.20.1

func (e EVMAddress) GetSignature() string

type EVMBool added in v0.20.1

type EVMBool struct {
}

func (EVMBool) GetSignature added in v0.20.1

func (e EVMBool) GetSignature() string

type EVMBytes added in v0.20.1

type EVMBytes struct {
	M uint64
}

func (EVMBytes) GetSignature added in v0.20.1

func (e EVMBytes) GetSignature() string

type EVMFixed added in v0.20.1

type EVMFixed struct {
	N, M uint64
	// contains filtered or unexported fields
}

func (EVMFixed) GetSignature added in v0.20.1

func (e EVMFixed) GetSignature() string

type EVMInt added in v0.20.1

type EVMInt struct {
	M uint64
}

func (EVMInt) GetSignature added in v0.20.1

func (e EVMInt) GetSignature() string

type EVMString added in v0.20.1

type EVMString struct {
}

func (EVMString) GetSignature added in v0.20.1

func (e EVMString) GetSignature() string

type EVMType added in v0.20.1

type EVMType interface {
	GetSignature() string
	// contains filtered or unexported methods
}

type EVMUint added in v0.20.1

type EVMUint struct {
	M uint64
}

func (EVMUint) GetSignature added in v0.20.1

func (e EVMUint) GetSignature() string

type Event added in v0.20.1

type Event struct {
	Inputs    []Argument
	Anonymous bool
}

type FunctionID

type FunctionID [FunctionIDSize]byte

func GetFunctionID added in v0.20.1

func GetFunctionID(signature string) (id FunctionID)

func (FunctionID) Bytes added in v0.20.1

func (fs FunctionID) Bytes() []byte

type FunctionSpec added in v0.20.1

type FunctionSpec struct {
	FunctionID FunctionID
	Inputs     []Argument
	Outputs    []Argument
}

func SpecFromFunctionReflect added in v0.20.1

func SpecFromFunctionReflect(fname string, v reflect.Value, skipIn, skipOut int) *FunctionSpec

func SpecFromStructReflect added in v0.20.1

func SpecFromStructReflect(fname string, args reflect.Type, rets reflect.Type) *FunctionSpec

SpecFromStructReflect generates a FunctionSpec where the arguments and return values are described a struct. Both args and rets should be set to the return value of reflect.TypeOf() with the respective struct as an argument.

func (*FunctionSpec) SetFunctionID added in v0.20.1

func (functionSpec *FunctionSpec) SetFunctionID(functionName string)

type Variable added in v0.20.1

type Variable struct {
	Name  string
	Value string
}

func ReadAndDecodeContractReturn added in v0.20.1

func ReadAndDecodeContractReturn(abiLocation, binPath, funcName string, resultRaw []byte) ([]*Variable, error)

func Unpacker added in v0.20.1

func Unpacker(abiData, name string, data []byte) ([]*Variable, error)

Jump to

Keyboard shortcuts

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