Skip to content

AbiError.getSelector

Computes the 4-byte selector for an AbiError.AbiError.

Imports

Named
import { AbiError } from 'ox'

Examples

import { AbiError } from 'ox'
 
const selector = AbiError.getSelector('error BadSignatureV(uint8 v)')
'0x6352211e'
import { AbiError } from 'ox'
 
const selector = AbiError.getSelector({
  inputs: [{ name: 'v', type: 'uint8' }],
  name: 'BadSignatureV',
  type: 'error'
})
'0x6352211e'

Definition

function getSelector(
  abiItem: AbiError.AbiError,
): Hex.Hex

Source: src/AbiError.ts

Parameters

abiItem

The ABI item to compute the selector for.

abiItem.hash

  • Type: 0x${string}
  • Optional

abiItem.overloads

  • Type: readonly any[]
  • Optional

Return Type

The first 4 bytes of the Hash.keccak256 hash of the error signature.

Hex.Hex

Error Type

AbiError.getSelector.ErrorType