Skip to content

TypedData.encodeType

Encodes EIP-712 Typed Data schema for the provided primaryType.

Imports

Named
import { TypedData } from 'ox'

Examples

import { TypedData } from 'ox'
 
TypedData.encodeType({
  types: {
    Foo: [
      { name: 'address', type: 'address' },
      { name: 'name', type: 'string' },
      { name: 'foo', type: 'string' },
    ],
  },
  primaryType: 'Foo',
})
'Foo(address address,string name,string foo)'

Definition

function encodeType(
  value: encodeType.Value,
): string

Source: src/TypedData.ts

Parameters

value

  • Type: encodeType.Value

The Typed Data schema.

value.primaryType

  • Type: string

value.types

  • Type: abitype.TypedData

Return Type

The encoded type.

string