Skip to content

AbiParameters.encodePacked

Encodes an array of primitive values to a packed ABI encoding.

Imports

Named
import { AbiParameters } from 'ox'

Examples

import { AbiParameters } from 'ox'
 
const encoded = AbiParameters.encodePacked(
  ['address', 'string'],
  ['0xd8da6bf26964af9d7eed9e03e53415d37aa96045', 'hello world'],
)
'0xd8da6bf26964af9d7eed9e03e53415d37aa9604568656c6c6f20776f726c64'

Definition

function encodePacked<packedAbiTypes>(
  types: packedAbiTypes,
  values: encodePacked.Values<packedAbiTypes>,
): Hex.Hex

Source: src/core/AbiParameters.ts

Parameters

types

  • Type: packedAbiTypes

Set of ABI types to pack encode.

values

  • Type: encodePacked.Values<packedAbiTypes>

The set of primitive values that correspond to the ABI types defined in types.

values.type

  • Type: packedAbiTypes[key]

Return Type

The encoded packed data.

Hex.Hex