eip712

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const PrimaryTypeNameEIP712Domain = "EIP712Domain"

Variables

This section is empty.

Functions

func EIP712HashingTypedMessage

func EIP712HashingTypedMessage(tm TypedMessage, chainId *big.Int) ([]byte, error)

func GetDomain

func GetDomain(cpcAddr common.Address, chainId *big.Int) apitypes.TypedDataDomain

GetDomain returns typed data domain for the given custom-precompiled-contract.

func GetDomainTypes

func GetDomainTypes() []apitypes.Type

GetDomainTypes returns domain types for EIP712Domain.

func VerifySignature

func VerifySignature(
	expectedAddress common.Address,
	tm TypedMessage, r, s [32]byte, v uint8,
	chainId *big.Int,
) (match bool, recoveredAddress common.Address, err error)

VerifySignature verifies the signature of the given typed message. The signature is verified by recovering the public key from the given signature and comparing it with the expected address.

Types

type TypedMessage

type TypedMessage interface {
	ToTypedData(chainId *big.Int) apitypes.TypedData
}

TypedMessage is a solidity struct that can be converted to a typed data.

Jump to

Keyboard shortcuts

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