abi

package
v0.0.0-...-83a01c7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ABI

type ABI struct {
	// contains filtered or unexported fields
}

ABI holds information about methods and events of contract.

func New

func New(data []byte) (*ABI, error)

New create an ABI instance.

func (*ABI) Constructor

func (a *ABI) Constructor() *Method

Constructor returns the constructor method if any.

func (*ABI) EventByID

func (a *ABI) EventByID(id luckyshare.Bytes32) (*Event, bool)

EventByID returns the event for the given event id.

func (*ABI) EventByName

func (a *ABI) EventByName(name string) (*Event, bool)

EventByName find event for the given event name.

func (*ABI) Events

func (a *ABI) Events() []*Event

Events returns all events

func (*ABI) MethodByID

func (a *ABI) MethodByID(id MethodID) (*Method, bool)

MethodByID returns method for given method id.

func (*ABI) MethodByInput

func (a *ABI) MethodByInput(input []byte) (*Method, error)

MethodByInput find the method for given input. If the input shorter than MethodID, or method not found, an error returned.

func (*ABI) MethodByName

func (a *ABI) MethodByName(name string) (*Method, bool)

MethodByName find method for the given method name.

func (*ABI) Methods

func (a *ABI) Methods() []*Method

Methods returns all methods excluding constructor.

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event see abi.Event in go-ethereum.

func (*Event) Decode

func (e *Event) Decode(data []byte, v interface{}) error

Decode decodes event data.

func (*Event) Encode

func (e *Event) Encode(args ...interface{}) ([]byte, error)

Encode encodes args to data.

func (*Event) ID

func (e *Event) ID() luckyshare.Bytes32

ID returns event id.

func (*Event) Name

func (e *Event) Name() string

Name returns event name.

type Method

type Method struct {
	// contains filtered or unexported fields
}

Method see abi.Method in go-ethereum.

func (*Method) Const

func (m *Method) Const() bool

Const returns if the method is const.

func (*Method) DecodeInput

func (m *Method) DecodeInput(input []byte, v interface{}) error

DecodeInput decode input data into args.

func (*Method) DecodeOutput

func (m *Method) DecodeOutput(output []byte, v interface{}) error

DecodeOutput decode output data.

func (*Method) EncodeInput

func (m *Method) EncodeInput(args ...interface{}) ([]byte, error)

EncodeInput encode args to data, and the data is prefixed with method id.

func (*Method) EncodeOutput

func (m *Method) EncodeOutput(args ...interface{}) ([]byte, error)

EncodeOutput encode output args to data.

func (*Method) ID

func (m *Method) ID() MethodID

ID returns method id.

func (*Method) Name

func (m *Method) Name() string

Name returns method name.

type MethodID

type MethodID [4]byte

MethodID method id.

func ExtractMethodID

func ExtractMethodID(input []byte) (id MethodID, err error)

ExtractMethodID extract method id from input data.

Jump to

Keyboard shortcuts

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