ethcoder

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: LGPL-3.0, MIT Imports: 14 Imported by: 7 modules, 12 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

This section is empty.

Variables

This section is empty.

Functions

func AbiCoder

func AbiCoder(argTypes []string, argValues []interface{}) ([]byte, error)

func AbiCoderHex

func AbiCoderHex(argTypes []string, argValues []interface{}) (string, error)

func AbiDecodeExpr

func AbiDecodeExpr(expr string, input []byte, argValues []interface{}) error

func AbiDecodeExprAndStringify

func AbiDecodeExprAndStringify(expr string, input []byte) ([]string, error)

func AbiDecoder

func AbiDecoder(argTypes []string, input []byte, argValues []interface{}) error

func AbiDecoderWithReturnedValues

func AbiDecoderWithReturnedValues(argTypes []string, input []byte) ([]interface{}, error)

func AbiEncodeMethodCalldata

func AbiEncodeMethodCalldata(methodExpr string, argValues []interface{}) ([]byte, error)

func AbiEncodeMethodCalldataFromStringValues

func AbiEncodeMethodCalldataFromStringValues(methodExpr string, argStringValues []string) ([]byte, error)

func AbiMarshalStringValues

func AbiMarshalStringValues(argTypes []string, input []byte) ([]string, error)

func AbiUnmarshalStringValues

func AbiUnmarshalStringValues(argTypes []string, stringValues []string) ([]interface{}, error)

AbiDecodeStringValues will take an array of ethereum types and string values, and decode the string values to runtime objects.

func AddressPadding

func AddressPadding(input string) string

func BytesToBytes32

func BytesToBytes32(slice []byte) [32]byte

func FunctionSignature

func FunctionSignature(functionExpr string) string

func HexDecode

func HexDecode(h string) ([]byte, error)

func HexDecodeBigIntArray

func HexDecodeBigIntArray(bigNumsHex []string) ([]*big.Int, error)

func HexDecodeBytes32

func HexDecodeBytes32(h string) ([32]byte, error)

func HexEncode

func HexEncode(h []byte) string

func HexEncodeBigIntArray

func HexEncodeBigIntArray(bigNums []*big.Int) ([]string, error)

func HexTrimLeadingZeros

func HexTrimLeadingZeros(hex string) (string, error)

func Keccak256

func Keccak256(input []byte) []byte

func MustHexDecode

func MustHexDecode(h string) []byte

func PadZeros

func PadZeros(array []byte, totalLength int) ([]byte, error)

func ParseMethodABI

func ParseMethodABI(methodExpr, returnsExpr string) (*abi.ABI, string, error)

ParseMethodABI will return an `abi.ABI` object from the short-hand method string expression, for example, methodExpr: `balanceOf(address)` returnsExpr: `uint256`

func SolidityPack

func SolidityPack(argTypes []string, argValues []interface{}) ([]byte, error)

func SolidityPackHex

func SolidityPackHex(argTypes []string, argValues []interface{}) (string, error)

func StringifyValues

func StringifyValues(values []interface{}) ([]string, error)

Types

type TypedData

type TypedData struct {
	Types       TypedDataTypes         `json:"types"`
	PrimaryType string                 `json:"primaryType"`
	Domain      TypedDataDomain        `json:"domain"`
	Message     map[string]interface{} `json:"message"`
}

func (*TypedData) EncodeDigest

func (t *TypedData) EncodeDigest() ([]byte, error)

type TypedDataArgument

type TypedDataArgument struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type TypedDataDomain

type TypedDataDomain struct {
	Name              string          `json:"name,omitempty"`
	Version           string          `json:"version,omitempty"`
	ChainID           *big.Int        `json:"chainId,omitempty"`
	VerifyingContract *common.Address `json:"verifyingContract,omitempty"`
	Salt              *[32]byte       `json:"salt,omitempty"`
}

func (TypedDataDomain) Map

func (t TypedDataDomain) Map() map[string]interface{}

type TypedDataTypes

type TypedDataTypes map[string][]TypedDataArgument

func (TypedDataTypes) EncodeType

func (t TypedDataTypes) EncodeType(primaryType string) (string, error)

func (TypedDataTypes) TypeHash

func (t TypedDataTypes) TypeHash(primaryType string) ([]byte, error)

Jump to

Keyboard shortcuts

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