Skip to content

TypedData.assert

Asserts that EIP-712 Typed Data is valid.

Imports

Named
import { TypedData } from 'ox'

Examples

import { TypedData } from 'ox'
 
TypedData.assert({
  domain: {
    name: 'Ether!',
    version: '1',
    chainId: 1,
    verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
  },
  primaryType: 'Foo',
  types: {
    Foo: [
      { name: 'address', type: 'address' },
      { name: 'name', type: 'string' },
      { name: 'foo', type: 'string' },
    ],
  },
  message: {
    address: '0xb9CAB4F0E46F7F6b1024b5A7463734fa68E633f9',
    name: 'jxom',
    foo: '0xb9CAB4F0E46F7F6b1024b5A7463734fa68E633f9',
  },
})

Definition

function assert<typedData, primaryType>(
  value: assert.Value<typedData, primaryType>,
): void

Source: src/core/TypedData.ts

Parameters

value

  • Type: assert.Value<typedData, primaryType>

The Typed Data to validate.

Return Type

void