# Changelog

> Notable changes to ai-economy-sdk, x402-algorand and x402-avm-js, newest first.

This page combines the changelogs of the three packages: [ai-economy-sdk](https://github.com/x402-avm/ai-economy-sdk/blob/main/CHANGELOG.md), [x402-algorand](https://github.com/x402-avm/x402-algorand/blob/main/CHANGELOG.md) and [x402-avm-js](https://github.com/x402-avm/x402-avm-js/blob/main/CHANGELOG.md).

## 2026-11-19 (ai-economy-sdk 0.5.1, x402-avm-js 0.4.1) (ai-economy-sdk 0.5.1, x402-avm-js 0.4.1)

## ai-economy-sdk 0.5.1

**Fixed**

- When the buyer's own spend controls refused a payment inside `paid_mcp_session`, the caller got an `ExceptionGroup` wrapping x402's `PaymentError` (cause `NoMatchingRequirementsError`), so `except AIEconomyError` missed it. The refusal now surfaces as `SpendLimitExceededError`, with the x402 error as `__cause__`. Other errors, and groups that contain anything besides the refusal, propagate unchanged.

**Added**

- `SpendLimitExceededError(AIEconomyError)`, exported from the package and documented in `ai_economy_sdk.exceptions`. Its message includes the amount and asset the server asked for.

## x402-avm-js 0.4.1

**Fixed**

- `algodClient('localnet')` connected to port 80 instead of 4001: the empty-string port passed to `algosdk.Algodv2` made algosdk 3.x override the port in the URL. The port is now omitted so the URL's own port (or the scheme default for MainNet and TestNet) is used. Affected every release since the first.

## 2026-11-19 (minor releases) (ai-economy-sdk 0.5.0, x402-algorand 0.3.0, x402-avm-js 0.4.0)

> **Warning:**
**Security: upgrade ai-economy-sdk to 0.5.0.** In 0.4.x the payment gate only inspected `POST` requests whose path ended in `/messages`. A FastMCP Streamable HTTP app wrapped with `PaymentGate.middleware()` (`POST /mcp`), or a gated SSE app mounted under a path prefix, passed priced `tools/call` requests to the server **without a payment**.

## Security

**ai-economy-sdk 0.5.0**

- The gate inspects the JSON-RPC body of every HTTP `POST`, whatever its path or transport, and its route table matches every path.
- Fails closed: `SettleOnSuccessMiddleware` refuses (with `PaymentRequiredError`) any priced tool call that did not pass through the HTTP gate. A gated call whose payment reservation has expired is refused instead of being served without settlement. JSON-RPC batches containing `tools/call` are rejected with HTTP 400, and the HTTP middleware refuses priced calls with HTTP 500 if `SettleOnSuccessMiddleware` was never installed.
- `subscription_issuer` can no longer be silently ignored: the issuer is always passed to `chain.has_active_subscription()`, and `PaymentGate` raises `ConfigurationError` at construction if that method has no `issuer` parameter.
- `DefaultAvmSigner` no longer stores the key in a public attribute, and its `repr()` shows only the address.

**x402-avm-js 0.4.0**

- Client-side spend limits protect against a server requesting an unexpectedly large amount (see Breaking below).

## Breaking and changed

**x402-avm-js 0.4.0**

- **Default spend cap.** `payForRequirement` and `buildExactAvmGroup` refuse any payment above 1,000,000 base units (1 ALGO, or 1 USDC) with a `SpendLimitExceededError`, before anything is signed. To pay more, pass the new options argument, for example `payForRequirement(challenge, address, algod, signer, { maxAmount: 5_000_000n })`; `maxAmount: Infinity` removes the cap.
- Node.js 18 is no longer supported; the package requires Node.js 20 or later.
- Types: `extra` and `extensions` values are `unknown` instead of `any`; `selectRequirement`, `encodePaymentHeader` and `payForRequirement` take `PaymentRequired` instead of `PaymentRequired | any`.
- `decodePaymentRequired` validates the decoded shape and throws `InvalidPaymentRequiredError` (it used to return whatever JSON it found).
- `src/` is published in the package, so source maps and go-to-definition resolve.

**ai-economy-sdk 0.5.0**

- `PaymentGate.wrap()` without `transport=` still serves SSE but emits a `FutureWarning`; the default will change to `"streamable-http"` in a future release.
- The SSE compatibility patch (stateless MCP sessions, so raw JSON-RPC clients can call tools without the `initialize` handshake) is applied only for the SSE transport. Correction to the 0.4.0 entry "Removed monkeypatches": this FastMCP patch was still present in 0.4.0 and 0.4.1.
- **Potentially breaking:** `AIEconomySDK.add_tool()` decides once, from the pricing function's signature, whether to call it as `(args, sender)` or `(args)`; a function accepting neither raises `ConfigurationError` at registration (0.4.x failed per request).
- **Potentially breaking:** `ChainReader` and `PaymentGate` catch only lookup errors (algod/indexer HTTP errors, connection errors, malformed responses), log them and report no usage, subscription or pass, as before. Other exceptions now propagate.
- **Potentially breaking:** `DefaultAvmSigner.private_key` is a read-only property; assigning to it raises `AttributeError`.
- On the SSE transport the `POST` response is the server's own response plus settlement headers.
- Signing uses `AccountTransactionSigner` instead of the deprecated `Transaction.sign()`.
- Requires `x402-algorand>=0.2.1`.

**x402-algorand 0.3.0**

- Errors for unsupported or unregistered networks are `NetworkError`, for an algod on the wrong network `NetworkMismatchError`, and for undecodable transactions `TransactionDecodeError`. All are subclasses of `ValueError`, as before.
- The facilitator checks every transaction sent by one of its own addresses (not only the first), and signs all of the advertised `feePayer`'s transactions, as the specification requires.
- Fee payer signing, simulation and settlement failures are also logged to the `x402_algorand` logger; the returned `invalid_reason` / `error_reason` codes are unchanged.
- `settle()` returns the ID of `paymentGroup[paymentIndex]` as the transaction, as required by the specification; with a fee payer it previously returned the ID of the fee payer transaction.
- The V1 facilitator and client wrappers accept the official SDK's `PaymentPayloadV1` / `PaymentRequirementsV1` models and return `VerifyResponse` / `SettleResponse`, so V1 payments routed through `x402Facilitator` / `x402Client` work. Requirements without `extra` no longer fail validation.
- Ed25519 signature verification of a payment from a rekeyed account uses the auth address. A rekey pair is only accepted when the second rekey returns authority to the sender.
- `pynacl` is a declared dependency (it was already required through `py-algorand-sdk`).

## Added

**ai-economy-sdk 0.5.0**

- Streamable HTTP support: `PaymentGate.wrap(mcp, transport="streamable-http")` (alias `"http"`) serves the MCP Streamable HTTP transport at `POST /mcp`, stateless by default (`stateless_http=False` enables MCP sessions). `wrap()` also accepts `path=` and other `FastMCP.http_app()` keyword arguments. `AIEconomySDK.build_app(transport=...)` forwards to it.
- `paid_mcp_session(..., transport=...)` connects over Streamable HTTP or SSE. Without `transport=`, URLs whose path ends in `/mcp` use Streamable HTTP and all others use SSE.
- Exception hierarchy, exported from the package: `AIEconomyError`, `ConfigurationError` (a `ValueError`), `UnknownNetworkError`, `AlgodClientRequiredError` (also a `RuntimeError`), `PaymentVerificationError` (a `RuntimeError`), `PaymentRequiredError` and `SettlementError` (FastMCP `ToolError`s). Each also subclasses the type raised at the same place in 0.4.x. See [Errors and error codes](https://x402-avm.github.io/reference/errors#ai-economy-sdk-exceptions).
- Typing module `ai_economy_sdk.types` (`ServerSigner`, `ChainLookup`, `Prices`, `GatePriceFunction`, `ToolPriceFunction`, `SpendControlsArg`, `Transport`), and a `py.typed` marker.
- `ai_economy_sdk.__version__`.
- `SettleOnSuccessMiddleware` is exported for apps that build the FastMCP HTTP app themselves.
- Logging to the `ai_economy_sdk` logger: refused calls, settlement failures, expired reservations and failed chain lookups at `WARNING`.
- Python 3.14 support.

**x402-algorand 0.3.0**

- Ready-made signers: `PayerAvmSigner` (client side) and `ServerAvmSigner` (facilitator side: fee payer signing, simulate, send, confirm; also usable as a client signer), built with `from_private_key(...)` or `from_mnemonic(...)`. `ServerAvmSigner` accepts several keys, an `algod_client` or `algod_url`/`algod_token`, and checks that algod is on the requested network. Keys are never included in `repr()`, error messages or logs.
- Exception hierarchy in `x402_algorand.errors`, exported from `x402_algorand`: `X402AlgorandError`, `NetworkError`, `NetworkMismatchError`, `TransactionDecodeError`, `SigningError`, `SimulationError`.
- Payments authorized by a k-of-n multisig, a logic signature, or the auth address of a rekeyed account are accepted, as allowed by the exact scheme specification.
- `x402_algorand.__version__`, a `py.typed` marker, and Python 3.14 support.

**x402-avm-js 0.4.0**

- Spend controls: `maxAmount` (per payment, or per asset), `allowedAssets`, `allowedNetworks`, `allowedPayTo`; exported `SpendControls`, `DEFAULT_MAX_AMOUNT`, `checkSpendControls`. See [Guardrails](https://x402-avm.github.io/build/pay-from-browser#spend-controls).
- Typed errors, all extending `X402AvmError` with a stable `code`: `SpendLimitExceededError`, `PaymentNotAllowedError`, `InvalidPaymentRequiredError`, `NoSupportedRequirementError`, `NetworkMismatchError`, `UnknownNetworkError`, `InvalidOptionsError`.
- `parsePaymentRequired(value: unknown)` for validating untrusted input.
- `buildExactAvmGroup` rejects requirements whose `extra.genesisHash` or `extra.genesisId` disagrees with the algod parameters, and malformed `payTo`, `feePayer`, `amount` and `asset` values.

## Deprecated

**ai-economy-sdk 0.5.0**

- `sign_identity()` (legacy `x-sender-*` headers): use `sign_identity_txn()`, which binds the proof to one network. It still works and emits a `DeprecationWarning`; servers keep accepting legacy headers, and `paid_mcp_session` still sends them.
- Reading `DefaultAvmSigner.private_key` emits a `DeprecationWarning`. Keep your own reference to the key.

## Fixed

**ai-economy-sdk 0.5.0**

- A `TypeError` raised inside a two-argument pricing function was caught and the function was called again with one argument.

## 2026-11-19 (patch releases) (ai-economy-sdk 0.4.1, x402-algorand 0.2.1, x402-avm-js 0.3.1)

## ai-economy-sdk 0.4.1

- Project URLs (`Homepage`, `Documentation`, `Repository`, `Issues`, `Changelog`) and PyPI classifiers in `pyproject.toml`.
- Dependency ranges kept at `fastmcp>=3.4,<4` and `mcp>=1.29,<2`: `mcp` 2.x and `fastmcp` 4.x are excluded because of upstream `httpx` changes that affect `x402` compatibility.

## x402-algorand 0.2.1

- Project URLs (`Homepage`, `Documentation`, `Issues`, `Changelog`) and classifiers (Python 3.10–3.13, `Typing :: Typed`, `Development Status :: 4 - Beta`) in `pyproject.toml`.

## x402-avm-js 0.3.1

- Package metadata: repository, homepage, bugs URL, keywords and author.
- The timestamp helper `getNs()` reads `globalThis.process` safely, so it works in browser, edge and Node.js environments.

## 2026-11-18 (ai-economy-sdk 0.4.0, x402-algorand 0.2.0, x402-avm-js 0.3.0, and earlier 0.2/0.3 releases)

## x402-algorand 0.2.0

**Changed**

- x402-algorand is now a plugin for the official `x402` Python SDK (`x402>=2.28,<3`, github.com/x402-foundation/x402). It ships only the Algorand exact scheme, under the import name `x402_algorand` (was `x402.mechanisms.avm` inside a fork of the whole SDK).
- Network ids follow the Algorand CAIP-2 profile: `algorand:` plus the first 32 characters of the URL-safe base64 genesis hash (MainNet `algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k`, TestNet `algorand:SGO1GKSzyE7IEPItTxCByw9x8FmnrCDe`). Legacy long ids are accepted and converted.
- The facilitator checks the network by the id derived from each transaction's genesis hash, so LocalNet and private networks need no registry entry.

**Added**

- `caip2_from_genesis_hash`, `register_network` and `get_genesis_hash` helpers.
- The client scheme implements `find_default_asset`, so the official `x402Client` spend controls pay ALGO and USDC by default (capped at 1,000,000 base units per payment); other assets are allowed with `x402Client.set_spend_controls(...)`.
- The client refuses to build a payment when its algod is on a different network than the requirement.

**Removed**

- The bundled copy of the x402 core SDK (`x402/`); install the official `x402` package instead.

## ai-economy-sdk 0.4.0

**Added**

- Integration with the official `x402>=2.28` framework and the `x402-algorand>=0.2.0` plugin.
- `spend_controls` parameter of `paid_mcp_session` (`dict | Literal[False] | None = None`), to enforce per-payment caps or allow custom ASAs before signing.
- NumPy-style docstrings across the public API (`PaymentGate`, `paid_mcp_session`, `ChainReader`, `DefaultAvmSigner`).

**Changed**

- Monkeypatches removed in favour of the native `find_default_asset` and spend control filtering provided by `x402-algorand`.
- Network ids follow the Algorand CAIP-2 profile (first 32 characters of the URL-safe base64 genesis hash).

## x402-avm-js 0.3.0

**Added**

- CAIP-2 short network ids (`algorand:` plus 32 characters), with fallback for legacy 44-character ids.
- Compatibility with the official `x402` 2.28 protocol and the `x402_algorand` plugin.
- Native ALGO (asset 0) and ASAs, including Circle USDC.
- Fee sponsorship through `feePayer` two-transaction atomic groups.
- Identity proofs with `buildIdentityTxn` and `encodeIdentityHeader` (`X-Identity-Txn`).
- A self-contained test suite that funds LocalNet accounts from the KMD dispenser and creates its own test ASAs.

Migration notes: [x402-algorand from 0.1.x](https://x402-avm.github.io/reference/packages#x402-algorand-from-0-1-x), [ai-economy-sdk from 0.3](https://x402-avm.github.io/reference/packages#ai-economy-sdk-from-0-3), [x402-avm-js from 0.2](https://x402-avm.github.io/reference/packages#x402-avm-js-from-0-2).

## ai-economy-sdk 0.3.1

- Added vendor passes: `ChainReader.active_passes()`, `ChainReader.has_pass()` and `PaymentGate(pass_scopes=..., pass_days=...)`.
- The MIT `LICENSE` file ships in the package.
- Requires `x402-algorand>=0.1.4`.

## ai-economy-sdk 0.3.0

- Multi-network resolution: `PaymentGate`, `AIEconomySDK` and `paid_mcp_session` accept `"mainnet"`, `"testnet"`, `"localnet"` and CAIP-2 ids.
- New network utilities: `resolve_network`, `endpoints_for`, `is_public` and `usdc_asset_id`.
- Identity proofs for browser wallets: `make_identity_txn`, `sign_identity_txn` and `verify_identity_txn`, producing zero-fee `X-Identity-Txn` proofs.
- Subscription issuer enforcement: `PaymentGate(subscription_issuer=...)` and `has_active_subscription(issuer=...)`.
- `paid_mcp_session` resolves algod endpoints from the network (AlgoNode for MainNet and TestNet).
- The 2,000 microALGO fee floor applies only to native ALGO prices.

## x402-algorand 0.1.4

- Licensed Apache-2.0 like the projects it derives from (GoPlausible/x402-avm, coinbase/x402). Ships `LICENSE` and `NOTICE`, and each file changed from x402-avm 2.0.2 says so. Releases 0.1.0 to 0.1.3 were labelled MIT by mistake.

## x402-algorand 0.1.3

- Package metadata update (README as the PyPI description). Network ids were still the long form `algorand:<full genesis hash>`.

## x402-avm-js 0.2.1

- The MIT `LICENSE` file is included in the published npm package.

## x402-avm-js 0.2.0

- No Node `Buffer` dependency: runs in browsers, workers and edge runtimes without polyfills.
- Network presets and helpers: `MAINNET`, `TESTNET`, `LOCALNET_ENDPOINTS`, `resolveNetwork`, `networkFromAlgod`, `networkFromGenesisHash`, `algodClient` and `selectRequirement`.
- `payForRequirement` checks that the algod's network matches the server's offers and throws when none matches.
- Read-only `PUBLIC_NETS=1` tests on MainNet and TestNet.
- Published package manifest with an `exports` map, types, and build and tests in `prepublishOnly`.

## 2026-11-17 (ai-economy-sdk 0.2.0, x402-avm-js 0.1.0)

## ai-economy-sdk 0.2.0

- Settle-on-success: `PaymentGate` verifies payments before the tool runs and settles only after the tool succeeds.
- Replay protection: `ReplayStore`, in memory or SQLite in WAL mode for several processes.
- Fee floor: ALGO prices at or below 2,000 microALGO are rejected at start-up unless `allow_loss=True`.
- Caller identity: `sign_identity` and `verify_identity`.

## x402-avm-js 0.1.0

- First implementation of the Algorand exact-scheme client: parse `PAYMENT-REQUIRED`, build the transaction group, sign through a wallet callback and encode `PAYMENT-SIGNATURE`.

## x402-algorand 0.1.0 to 0.1.2 (Earlier releases)

- A fork of GoPlausible/x402-avm 2.0.2 (Python, the whole x402 SDK): native ALGO payments (asset 0), an algod token parameter, any `algorand:<genesis hash>` network (LocalNet or private), and facilitator fixes for sync facilitators and streaming (SSE) responses.

Source: https://x402-avm.github.io/resources/changelog
