Skip to content

serializeHookConfig

Serializes a HookConfig object into a Hex format by encoding the hook type, presence of post/pre hooks, address, and entity ID.

Import

import { serializeHookConfig } from "@account-kit/smart-contracts";

Usage

import { type HookType, serializeHookConfig } from "@account-kit/smart-contracts";
import { Address } from "viem";
 
const moduleAddress: Address = "0x1234";
const entityId: number = 1234;
const hookType: HookType = HookType.Validation;
const hasPostHooks: boolean = false;
const hasPreHooks: boolean = true;
 
const hookConfigHex = serializeHookConfig({
moduleAddress,
entityId
hookType,
hasPostHooks,
hasPreHooks
});

Parameters

config

HookConfig The hook configuration containing address, entity ID, hook type, and post/pre hook indicators

Returns

Hex The serialized hook configuration in hexadecimal format