Skip to content

ValidatorData.encode

Encodes data with a validator in ERC-191 format: 0x19 ‖ 0x00 ‖ <intended validator address> ‖ <data to sign>.

Imports

Named
import { ValidatorData } from 'ox'

Examples

import { Hex, ValidatorData } from 'ox'
 
const encoded = ValidatorData.encode({
  data: Hex.fromString('hello world'),
  validator: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
})
'0x1900d8da6bf26964af9d7eed9e03e53415d37aa9604568656c6c6f20776f726c64'
'0x19 ‖ 0x00 ‖ 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 ‖ "hello world"'

Definition

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

Source: src/core/ValidatorData.ts

Parameters

value

  • Type: encode.Value

The data to encode.

value.data

  • Type: 0x${string} | Uint8Array

value.validator

  • Type: abitype_Address

Return Type

The encoded personal sign message.

Hex.Hex