Signer.signTypedData
is more
useful.
types
.
This performs all necessary checking that types are valid and do not violate the
EIP-712 structural constraints as well as computes the
primaryType.
Parameter | Type |
---|---|
types | Record <string , TypedDataField []> |
TypedDataEncoder
Property | Modifier | Type | Description |
---|---|---|---|
primaryType | readonly | string | The primary type for the structured types. This is derived automatically from the types, since no recursion is possible, once the DAG for the types is consturcted internally, the primary type must be the only remaining type with no parent nodes. |
Record
<string
, TypedDataField
[]>
value
for the types.
Parameter | Type | Description |
---|---|---|
value | Record <string , any > | The value to encode. |
string
The encoded value.
value
for the type
.
Parameter | Type | Description |
---|---|---|
type | string | The type to encode the value for. |
value | any | The value to encode. |
string
The encoded value.
name
.
Parameter | Type | Description |
---|---|---|
name | string | The name to get the full type for. |
string
The full type.
type
.
Parameter | Type | Description |
---|---|---|
type | string | The type to get the encoder for. |
Function
The encoder for the type.
Parameter | Type |
---|---|
value | any |
string
value
for the types.
Parameter | Type | Description |
---|---|---|
value | Record <string , any > | The value to hash. |
string
The hash of the value.
value
for the type of name
.
Parameter | Type | Description |
---|---|---|
name | string | The name of the type. |
value | Record <string , any > | The value to hash. |
string
The hash of the value.
calback
for each value in value
, passing the type and component within value
.
This is useful for replacing addresses or other transformation that may be desired on each component, based on
its type.
Parameter | Type | Description |
---|---|---|
value | Record <string , any > | The value to visit. |
callback | (type , data ) => any | The callback to call for each value. |
any
The result of the callback.
value
for types
with domain
.
Parameter | Type | Description |
---|---|---|
domain | TypedDataDomain | The domain to use. |
types | Record <string , TypedDataField []> | The types to encode. |
value | Record <string , any > | The value to encode. |
string
The encoded value.
types
.
Parameter | Type | Description |
---|---|---|
types | Record <string , TypedDataField []> | The types to encode. |
TypedDataEncoder
The encoder for the types.
Parameter | Type | Description |
---|---|---|
domain | TypedDataDomain | The domain to use. |
types | Record <string , TypedDataField []> | The types to encode. |
value | Record <string , any > | The value to encode. |
any
The JSON-encoded payload.
types
.
Parameter | Type | Description |
---|---|---|
types | Record <string , TypedDataField []> | The types to get the primary type for. |
string
The primary type.
value
for types
with
domain
.
Parameter | Type | Description |
---|---|---|
domain | TypedDataDomain | The domain to use. |
types | Record <string , TypedDataField []> | The types to hash. |
value | Record <string , any > | The value to hash. |
string
The hash of the value.
domain
.
Parameter | Type | Description |
---|---|---|
domain | TypedDataDomain | The domain to hash. |
string
The hash of the domain.
value
using types
and name
.
Parameter | Type | Description |
---|---|---|
name | string | The name of the type. |
types | Record <string , TypedDataField []> | The types to hash. |
value | Record <string , any > | The value to hash. |
string
The hash of the value.