Package com.tnsai.payment.x402


package com.tnsai.payment.x402
x402 adapter for the PaymentBroker SPI shipped by tnsai-core in v0.9.4 (TNS-298).

This module is the first concrete payment-rail adapter under TNS-449. It lives in its own Maven module on purpose — the EVM crypto stack adds non-trivial transitive surface, and the framework's "lightweight by default" promise means agents that don't pay shouldn't compile-time-pull web3 deps.

What's shipped in P2 (this version)

  • Network — EVM / Solana network catalogue.
  • EIP712TypedData — the 32-byte domain-separator + struct-hash pair the wallet needs to sign.
  • Wallet — SPI a payer plugs their signing strategy into, with a Wallet.Factory and ServiceLoader-based discover().
  • WalletSpec — config bag the factory reads to instantiate a wallet.
  • InMemoryWallet — test-only impl that returns a deterministic non-cryptographic byte array; for unit tests and quick assertions only, not a real signer.
  • X402Config — the config record the upcoming X402PaymentBroker will consume.

What's deferred to later phases

  • P3 — actual X402PaymentBroker implementation, web3j-crypto dependency, EIP-712 hashing, secp256k1 signing, HTTP 402 replay loop.
  • P4 — production-grade EnvKeystoreWallet + DelegatedWallet, mandate enforcement via AuthorityScope.spendCeiling, liability record emission.
  • P5 — reference dogfood wiring.
  • P6 — Base mainnet flag + production-readiness checklist.
Since:
0.10.5 (TNS-449 P2)