Skip to main content
Optional preset hooks for Armory clients.

Installation

API Reference

PaymentPreference

Chain and token selection hooks.

PaymentPreference.chain(preferredChains)

Prefer specific networks when multiple options are available.
Parameter:
  • preferredChains - Array of network keys (string or string[])
Supported network keys:
  • ethereum - Ethereum Mainnet
  • base - Base Mainnet
  • base-sepolia - Base Sepolia Testnet
  • skale-base - SKALE Base
  • skale-base-sepolia - SKALE Base Sepolia
  • ethereum-sepolia - Ethereum Sepolia Testnet

PaymentPreference.token(preferredTokens)

Prefer specific tokens when multiple options are available.
Parameter:
  • preferredTokens - Array of token symbols (string or string[])

PaymentPreference.cheapest()

Select the option with the lowest amount within the selected network and asset.

Logger

Payment event logging.

Logger.console(options?)

Log payment events to the console.
Options:

Utilities

combineHooks(…hooks)

Combine multiple hook arrays into a single array.

Types

PaymentRequiredContext

Context passed when payment is required.

PaymentPayloadContext

Context passed before signing payment.

ClientHookErrorContext

Context passed when a hook errors.

ClientHook

Hook interface.

Usage

Selection Behavior

  • Hook selection narrows progressively in array order
  • Chain preference runs first, then token preference can narrow within selected chain
  • Cheapest refines within the selected network and asset
  • If no hook selects, clients fall back to the first compatible accepts[] option from PAYMENT-REQUIRED

Notes

  • This package is optional. Core clients work without it.
  • Hooks are fail-closed by default: if a hook throws, payment flow throws.