Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.x402r.org/llms.txt

Use this file to discover all available pages before exploring further.

Overview

HookCombinator chains hooks into one, invoking each in sequence. Each operator slot accepts only one hook address, so use HookCombinator when you need more than one hook on the same action.

Deployment

Deploy via HookCombinatorFactory:
const comboAddress = await hookCombinatorFactory.write.deploy([
  [escrowPeriodAddress, paymentIndexRecorderHookAddress]  // Records auth time + payment index
]);

config.authorizePostActionHook = comboAddress;

Behavior

  • The combinator invokes hooks in the order provided
  • If any hook reverts, all revert: the entire recording is atomic
  • Each hook receives the same paymentInfo, amount, caller, and data parameters

Limits

Max 10 hooks per combinator. Each extra hook adds ~1k gas overhead for the delegation call.

Gas

Cost: Sum of all individual hook costs + ~1k gas overhead per hook for delegation. Example: EscrowPeriod (~20k) + PaymentIndexRecorderHook (~20k) + ~2k overhead = ~42k gas total.

Next Steps

AuthorizationTimeRecorderHook

Record authorization timestamps.

PaymentIndexRecorderHook

Index payments for on-chain queries.