TypeScript API surface
Generated from the built tx402 package’s own exports, so this list cannot claim a symbol the
package does not ship. Signatures and per-symbol documentation live in the bundled .d.ts
files, which your editor reads directly — this page answers “what is available and from where”.
tx402 — the core entry point
Section titled “tx402 — the core entry point”Importing this path must not load a chain library, and a package-contract test asserts it.
viem, @solana/kit, @x402/evm, and @x402/svm are reached through a lazy import()
only when a payment on that family is actually planned.
Functions
Section titled “Functions”assertValidReleaseManifestchainFamilycreateBalanceProbeCachecreateTx402ClientdecodePaymentRequireddigestRequestBodyfingerprintRequestformatMoneyDecimalisEvmSignerisSolanaSignerisTx402ErrornormalizeFingerprintUrlnormalizePolicyHostorderRouteCandidatesparseMoneyAtomicparsePositiveMoneyAtomicplanRoutesrequireNetworkresolveNetworkverifyReleaseManifest
Classes and constructors
Section titled “Classes and constructors”AmbiguousPaymentErrorBudgetExceededErrorClockSkewErrorConfigurationErrorDomainNotAllowedErrorHealthIndexInsufficientLiquidityErrorInvalidPaymentRequiredErrorMemorySpendStoreMoneyParseErrorNonReplayableRequestErrorPaidRedirectBlockedErrorPolicyEngineRecipientUnpinnedErrorReservedHeaderErrorResourceDeliveryErrorSignerErrorSpendScopeFrozenErrorTransportErrorTx402ErrorUnsupportedProtocolErrorUnsupportedSchemeError
Constants
Section titled “Constants”BALANCE_KEY_SEPARATORBALANCE_TIMEOUT_MSBUNDLED_MANIFESTCIRCUIT_OPEN_MSEVENT_NAMESHEALTH_CONSECUTIVE_FAILURES_TO_OPENHEALTH_EWMA_ALPHAHEALTH_FAILURE_RATE_TO_OPENHEALTH_FAILURE_WINDOWHEALTH_IDLE_RETENTION_MSHEALTH_LATENCY_PENALTY_MAXHEALTH_LATENCY_REFERENCE_MSHEALTH_MAX_ENDPOINTSHEALTH_MIN_SAMPLES_FOR_RATEHEALTH_NEW_ENDPOINT_SCOREHEALTH_OPEN_MSMANIFEST_SIGNING_DOMAINMAX_AUTHORIZATION_SECONDSMAX_PAYMENT_REQUIRED_BYTESMAX_PAYMENT_REQUIRED_DEPTHMAX_PAYMENT_REQUIREMENTSMAX_PROVIDERS_PER_NETWORKPACKAGE_NAMEPACKAGE_VERSIONPROJECT_URLSPROTOCOL_HEADERSREQUEST_FINGERPRINT_DOMAINREQUEST_ID_HEADERRESERVATION_TTL_MSRESERVED_REQUEST_HEADERSROLLING_WINDOW_MSTRUSTED_MANIFEST_KEYSTX402_ERROR_CODESTX402_ERROR_DESCRIPTORSTX402_ERROR_TAXONOMYX402_PROTOCOL_VERSION
The client itself
Section titled “The client itself”createTx402Client(config) returns an object carrying these methods. They are read from a
constructed instance, so this list cannot claim a method the package does not ship.
inspect(input: Tx402RequestInfo, init?: Tx402RequestInit): Promise<PaymentInspection>plan(input: Tx402RequestInfo, init?: Tx402RequestInit): Promise<PaymentPlan>fetch(input: Tx402RequestInfo, init?: Tx402RequestInit): Promise<Response>getBudgetState(): BudgetStatequeryBudgetState(query: BudgetQuery): Promise<BudgetState>resetHealth(): void
fetch is the one most code calls. The other five are what you reach for when a payment has
to be reasoned about rather than simply made: plan answers “what would this cost” without
signing or reserving, inspect returns the raw challenge, and getBudgetState /
queryBudgetState read the spend ledger — the latter for any scope, including one written by
another process. Reconciling a settlement from code starts with plan and ends with
queryBudgetState.
Optional subpath exports
Section titled “Optional subpath exports”| Import | Loads | Use when |
|---|---|---|
tx402/evm |
viem, @x402/evm |
You pay on an EVM network and want the bundled adapter. |
tx402/solana |
@solana/kit, @x402/svm |
You pay on Solana and want the bundled adapter. |
tx402/signers |
viem/accounts, and @solana/kit lazily |
Development only. privateKeyToEvmSigner wraps a raw hex key as an EvmSigner; keypairToSolanaSigner wraps a keypair as a SolanaSigner. |
The Python package mirrors this split with extras: pip install tx402 is the core,
tx402[evm], tx402[svm], and tx402[all] add the chain libraries. import tx402 loads no
chain library in either language.