Skip to content

Configuration

Types and defaults are from the source; the API reference has the full signatures.

Option Type Default What it does
network QoreNetwork required the chain: qorechainTestnet
escrow 0x… none offer pq-erc20, settled by this PQ402Escrow
vault 0x… none offer pq-perennial, as spends from this vault; at least one of escrow and vault
facilitator { verify, settle } required verifies and settles every scheme offered: an x402Facilitator with both registered
kemKeys { kemKey(account) } required reads the payer’s ML-KEM-1024 key, to seal answers
gateway { address, mldsaSecretKey, sealKeys } none turns on sealing and signed receipts
routes Record<"METHOD /path", PaidRoute> required the paid routes, without query
maxTimeoutSeconds number 120 how long a payment may take, offered in the 402
now () => number the clock Unix seconds, for tests
Option Type Default What it does
price "$0.01", "0.01 fUSD" or { asset, amount } required the price; $ resolves to fUSD
payTo 0x… required who gets paid
description string none shown in the 402
mimeType string none shown in the 402
requestSealing "required" or "optional" "optional" whether a plaintext body is refused

nodeListener(gate, handler, options) (@pq402/server)

Section titled “nodeListener(gate, handler, options) (@pq402/server)”
Option Type Default What it does
maxBodyBytes number 1 MiB larger bodies get 413
fallbackOrigin string http://localhost origin for resource.url when there is no Host header
Option Type Default What it does
payer 0x… required the paying account; its keys must be registered
mldsaSecretKey Uint8Array required signs payments
sealKeys SealKeyPair required opens sealed answers
keys KeyDirectory required reads the gateway’s keys (and positions): an EvmChainReader
chainId string required the chain the sealing must be for: qorechain-diana
maxAmount bigint required the most it pays for one call, in atomic units
perennial { positionId } none pay from this agent-budget position when offered
sealRequests boolean true seal bodies whenever the server offers it
fetch typeof fetch global fetch the transport
now () => number the clock Unix seconds, for tests
Option Type Default What it does
publicClient viem PublicClient required estimates gas, reads receipts
walletClient viem WalletClient required the relayer’s account; it needs an open, scoped EVM window
gas bigint none a fixed gas limit; skips the estimate
gasHeadroomPercent number 20 added to each estimate
maxGas bigint 1_000_000n a call estimated above this is refused before sending
maxFeePerGas bigint the wallet’s fee cap; each transaction reserves gas × this from the window
maxPriorityFeePerGas bigint the wallet’s tip cap
Option Type Default What it does
network QoreNetwork required qorechainTestnet
publicClient viem PublicClient one for network.evmRpc EVM JSON-RPC reads
fetch typeof fetch global fetch REST reads of the KEM key registry

PqErc20Facilitator and PqPerennialFacilitator

Section titled “PqErc20Facilitator and PqPerennialFacilitator”
Option Type Default What it does
networks string[] required e.g. ["eip155:9800"]
reader ChainReader required keys, balances and positions
settler Settler none needed to settle; a verify-only facilitator may omit it
settlementMargin number 6 seconds a payment must still be valid for when verified