Skip to content

AbiFunction.decodeData

ABI-decodes function arguments according to the ABI Item's input types (inputs).

Imports

Named
import { AbiFunction } from 'ox'

Examples

import { AbiFunction } from 'ox'
 
const approve = AbiFunction.from('function approve(address, uint256)')
 
const data = AbiFunction.encodeData(
  approve,
  ['0xd8da6bf26964af9d7eed9e03e53415d37aa96045', 69420n]
)
// '0x095ea7b3000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa960450000000000000000000000000000000000000000000000000000000000010f2c'
 
const input = AbiFunction.decodeData(approve, data)
['0xd8da6bf26964af9d7eed9e03e53415d37aa96045', 69420n]

Definition

function decodeData<abiItem>(
  abiFunction: abiItem | AbiFunction,
  data: Hex.Hex,
): decodeData.ReturnType<abiItem>

Source: src/core/AbiFunction.ts

Parameters

abiFunction

  • Type: abiItem | AbiFunction

The ABI Item to decode.

data

  • Type: Hex.Hex

The data to decode.

Return Type

decodeData.ReturnType<abiItem>