EIP712Utils class

Internal utility class for common operations related to EIP-712 encoding and decoding.

Constructors

EIP712Utils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

arrayRegex RegExp
Regular expression for detecting array types and extracting the child type and size.
final
typeRegex RegExp
Regular expression for extracting the base type from a type string.
final

Static Methods

abiEncode(List<String> types, List inputs) List<int>
Encodes data using the ABI encoding format based on the provided types and inputs.
eip712TypedDataV1ValueToJson(String type, dynamic value) → dynamic
Ensures correct representation of values based on the specified type.
encodeStruct(Eip712TypedData typedData, String type, Map<String, dynamic> data) List<int>
Encodes a struct with the specified type and data, returning the result as a list of integers. The struct is defined in the Eip712TypedData, and the data parameter contains field values.
encodeValue(Eip712TypedData typedData, String type, dynamic data) → Tuple<String, dynamic>
Encodes a value according to its type in the context of EIP-712 structured data. The method handles array types, struct types, strings, and bytes. Returns a Tuple containing the encoded type and data.
getMethodSigature(Eip712TypedData typedData, String type) List<int>
Generates the method signature hash for a given EIP-712 typed data and type. The method signature includes all dependencies and their corresponding types and names.
legacyV1encode(List<String> types, List inputs) List<int>
Encodes data using the legacy EIP-712 encoding format (used in EIP-712 V1) based on the provided types and inputs.
structHash(Eip712TypedData typedData, String type, Map<String, dynamic> data) List<int>
Calculates the Keccak256 hash of the encoded struct data for a given type. Uses the encodeStruct method to encode the struct data before hashing.

Constants

bytes32TypeName → const String
Type name for bytes32.
domainKeyName → const String
Key name for the EIP-712 domain.
eip191PrefixBytes → const List<int>
Prefix bytes used in EIP-191 signatures.