Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Circle faucet URL for Monad Testnet (`eip155:10143`) to the embedded paywall faucet map so browser paywalls render the faucet link instead of "No faucet configured."
2 changes: 1 addition & 1 deletion python/x402/http/paywall/evm_paywall_template.py

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions python/x402/tests/unit/http/test_paywall.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@

from __future__ import annotations

import json
import re

from x402.http.paywall import (
EvmPaywallHandler,
PaywallBuilder,
SvmPaywallHandler,
)
from x402.http.paywall.evm_paywall_template import EVM_PAYWALL_TEMPLATE
from x402.schemas import (
PaymentRequired,
PaymentRequirements,
ResourceInfo,
)

_EMBEDDED_FAUCET_MAP_RE = re.compile(r"\$xt=(\{.*?\})")


def _embedded_faucet_map(template: str) -> dict[str, str]:
match = _EMBEDDED_FAUCET_MAP_RE.search(template)
assert match is not None, "embedded paywall $xt faucet map not found"
parsed = json.loads(match.group(1))
assert isinstance(parsed, dict)
return parsed


def _make_evm_payment_required() -> PaymentRequired:
return PaymentRequired(
Expand Down Expand Up @@ -139,3 +153,8 @@ def test_provider_runtime_faucet_urls_override_builder_faucet_urls() -> None:
)
assert "https://example.com/runtime" in html
assert "https://example.com/builder" not in html


def test_evm_embedded_faucet_map_includes_monad_testnet_circle_faucet() -> None:
faucet_map = _embedded_faucet_map(EVM_PAYWALL_TEMPLATE)
assert faucet_map["eip155:10143"] == "https://faucet.circle.com/"
Loading