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',
  },
})
'0x4305429dd165189369e3373e404dac11fa3bc66d93d5231b00198cb578d402e0'

Definition

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

Source: src/core/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: Types

The types of the Typed Data struct.

Return Type

The hashed Typed Data struct.

Hex.Hex