abi

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package abi implements a Solidity ABI lexer and parser.

Index

Constants

This section is empty.

Variables

View Source
var ErrSyntax = errors.New("syntax error")

Functions

func Copy

func Copy(dst, src any) error

Copy shallow copies the value src to dst. If src is an anonymous struct or an array/slice of anonymous structs, the fields of the anonymous struct are copied to dst.

Types

type Arguments

type Arguments []abi.Argument

Arguments represents a slice of abi.Argument's.

func Parse

func Parse(s string) (a Arguments, err error)

Parse parses the given Solidity args and returns its arguments.

func ParseWithName

func ParseWithName(s string) (name string, a Arguments, err error)

ParseWithName parses the given Solidity function/event signature and returns its name and arguments.

func (Arguments) Decode

func (a Arguments) Decode(data []byte, args ...any) error

Decode ABI-decodes the given data to the given arguments args.

func (Arguments) Encode

func (a Arguments) Encode(args ...any) ([]byte, error)

Encode ABI-encodes the given arguments args.

func (Arguments) EncodeWithSelector

func (a Arguments) EncodeWithSelector(selector [4]byte, args ...any) ([]byte, error)

EncodeWithSelector ABI-encodes the given arguments args prepended by the given selector.

func (Arguments) EncodeWithSignature

func (a Arguments) EncodeWithSignature(signature string, args ...any) ([]byte, error)

EncodeWithSignature ABI-encodes the given arguments args prepended by the first 4 bytes of the hash of the given signature.

func (Arguments) Signature

func (a Arguments) Signature() string

func (Arguments) SignatureWithName

func (a Arguments) SignatureWithName(name string) string

Jump to

Keyboard shortcuts

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