ethereum

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(vals ...interface{}) []byte

Encode values into an Ethereum ABI compatible byte slice.

func NewAddressEncodeDecoder added in v0.2.1

func NewAddressEncodeDecoder() address.EncodeDecoder

NewAddressEncodeDecoder constructs a new AddressEncodeDecoder.

Types

type Address

type Address common.Address

An Address represents a public address on the Ethereum blockchain. It can be the address of an external account, or the address of a smart contract.

func NewAddressFromHex

func NewAddressFromHex(str string) (Address, error)

NewAddressFromHex returns an Address decoded from a hex string.

func (Address) Bytes

func (addr Address) Bytes() pack.Bytes

Bytes returns the address as a slice of 20 bytes.

func (Address) Marshal

func (addr Address) Marshal(buf []byte, rem int) ([]byte, int, error)

Marshal the address to binary.

func (Address) MarshalJSON

func (addr Address) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshaling by encoding the address as a hex string.

func (Address) SizeHint

func (Address) SizeHint() int

SizeHint returns the number of bytes needed to represent this address in binary.

func (Address) String

func (addr Address) String() string

String returns the address as a human-readable hex string.

func (*Address) Unmarshal

func (addr *Address) Unmarshal(buf []byte, rem int) ([]byte, int, error)

Unmarshal the address from binary.

func (*Address) UnmarshalJSON

func (addr *Address) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON unmarshaling by expected the data be a hex encoded string representation of an address.

type AddressDecoder

type AddressDecoder interface {
	DecodeAddress(address.Address) (address.RawAddress, error)
}

AddressDecoder implements the address.Decoder interface.

func NewAddressDecoder

func NewAddressDecoder() AddressDecoder

NewAddressDecoder constructs a new AddressDecoder.

type AddressEncodeDecoder added in v0.2.1

type AddressEncodeDecoder struct {
	AddressEncoder
	AddressDecoder
}

AddressEncodeDecoder implements the address.EncodeDecoder interface

type AddressEncoder

type AddressEncoder interface {
	EncodeAddress(address.RawAddress) (address.Address, error)
}

AddressEncoder implements the address.Encoder interface.

func NewAddressEncoder

func NewAddressEncoder() AddressEncoder

NewAddressEncoder constructs a new AddressEncoder.

type Payload

type Payload struct {
	ABI  pack.Bytes `json:"abi"`
	Fn   pack.Bytes `json:"fn"`
	Data pack.Bytes `json:"data"`
}

A Payload is an Ethereum encoded function call. It includes an ABI, the function being called from the ABI, and the data being passed to the function.

Jump to

Keyboard shortcuts

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