Skip to content

TypedData.hashStruct

Hashes EIP-712 Typed Data struct.

Imports

Named
import { TypedData } from 'ox'

Examples

import { TypedData } from 'ox'
 
TypedData.hashStruct({
  types: {
    Foo: [
      { name: 'address', type: 'address' },
      { name: 'name', type: 'string' },
      { name: 'foo', type: 'string' },
    ],
  },
  primaryType: 'Foo',
  data: {
    address: '0xb9CAB4F0E46F7F6b1024b5A7463734fa68E633f9',
    name: 'jxom',
    foo: '0xb9CAB4F0E46F7F6b1024b5A7463734fa68E633f9',
  },
})
'0x996fb3b6d48c50312d69abdd4c1b6fb02057c85aa86bb8d04c6f023326a168ce'

Definition

function hashStruct(
  value: hashStruct.Value,
): Hex.Hex

Source: src/TypedData.ts

Parameters

value

  • Type: hashStruct.Value

The Typed Data struct to hash.

value.data

  • Type: Record

The Typed Data struct to hash.

value.primaryType

  • Type: string

The primary type of the Typed Data struct.

value.types

  • Type: abitype.TypedData

The types of the Typed Data struct.

Return Type

The hashed Typed Data struct.

Hex.Hex

Error Type

TypedData.hashStruct.ErrorType