ethcoder

package
v1.19.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: LGPL-3.0, MIT Imports: 15 Imported by: 10

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 Keccak256Hash added in v1.17.0

func Keccak256Hash(input []byte) common.Hash

func MustHexDecode

func MustHexDecode(h string) []byte

func MustNewArrayTypeTuple added in v1.4.1

func MustNewArrayTypeTuple(components []abi.ArgumentMarshaling) abi.Type

func MustNewType added in v1.4.1

func MustNewType(str string) abi.Type

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 SHA3 added in v1.17.0

func SHA3(input []byte) common.Hash

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)

func (*TypedData) HashStruct added in v1.3.4

func (t *TypedData) HashStruct(primaryType string, data map[string]interface{}) ([]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