Import
Signature
Constructor parameters
Signer (e.g.,
DefaultAvmSigner) providing merchant keys and node
connection to sponsor transaction fees as fee payer.Tool pricing mapping or callable with signature
(tool, args, sender) -> int.ChainReader (or compatible object) for subscriptions, past usage, and passes.If False, rejects or clamps ALGO prices in (0, 2000] that fail to cover
the 2-transaction fee-payer cost.
Raises
ConfigurationError: (aValueError) Ifallow_loss=False,asset_id=0, and any configured price is in the loss-making range(0, 2 * min_fee_per_txn]; or ifsubscription_issueris set butchain.has_active_subscriptionhas noissuerparameter.
Examples
Methods
price_for
allow_loss=False.
Parameters
Returns
Effective price in base units (microALGO for ALGO, base units for ASA).
Returns 0 if the call is free, covered by a pass, or covered by subscription.
middleware
POST (any path,
any transport) and gates each tools/call. Use it directly when you build
the FastMCP HTTP app yourself, together with SettleOnSuccessMiddleware
(priced calls are refused with HTTP 500 until that middleware exists)::
mcp.add_middleware(SettleOnSuccessMiddleware(gate))
app = mcp.http_app(middleware=gate.middleware())
wrap does both steps for you.
Returns
wrap
SettleOnSuccessMiddleware to mcp and builds the FastMCP HTTP
app with the gate’s ASGI middleware.
Parameters
HTTP transport to serve.
"streamable-http" (alias "http") serves the
MCP Streamable HTTP transport at /mcp; "sse" serves the legacy SSE
transport at /sse + /messages/. When omitted, SSE is used (the
0.4 behaviour) and a FutureWarning is emitted: the default will change
to "streamable-http" in a future release.ConfigurationError: Iftransportis not one of the supported values.
close
See also
AIEconomySDK: High-level builder encapsulating PaymentGate.DefaultAvmSigner: Default signing implementation.