Skip to content

feat: add wallet-safe pay-to address display, copy button, and test c…#106

Open
TheWeirdDee wants to merge 4 commits into
emrekayat:mainfrom
TheWeirdDee:feat/wallet-safe-payto
Open

feat: add wallet-safe pay-to address display, copy button, and test c…#106
TheWeirdDee wants to merge 4 commits into
emrekayat:mainfrom
TheWeirdDee:feat/wallet-safe-payto

Conversation

@TheWeirdDee

Copy link
Copy Markdown

Resolves #90

This PR adds a wallet-safe, compact pay-to public Stellar address display to the Control Deck page and query signals output next to paid-query evidence and provider pricing.

Key Changes

  • Safe Configuration Exposure: Exposes the safe payToAddress (Stellar public key) in the ConfigSnapshot returned by /health without leaking credentials. Made the API env schema for X402_PAY_TO_ADDRESS optional to prevent server launch failure when missing.
  • Preflight Display: Renders the shortened payee address with a clipboard copy button in the "Preflight details" box. Shows a Testnet label if Stellar testnet is active.
  • Results Evidence Display: Adds the payee address to the query results trace-box next to payment transaction details.
  • Missing Address Warning: Displays a distinct warning badge ⚠️ Missing pay-to address in both sections if the payee address configuration is not found on the server, avoiding blank states.
  • Type safety & Fixes: Fixed TS compile errors for optional payToAddress configurations and resolving pre-existing test runner environment timing/path format issues on Windows.

Verification

  • Unit Tests: Added coverage for /health with both configured and missing payee address states.
  • Automated Verification: Runs and passes 100% of test suites (146 tests in shared, api, and agent-client workspaces).

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@TheWeirdDee is attempting to deploy a commit to the emrekayat's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@TheWeirdDee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@emrekayat

Copy link
Copy Markdown
Owner

Thanks for the PR. I rechecked the merge ref from the maintainer account. The focused checks pass:

git diff --check main...pr-106-merge
npm run test --workspace @query402/api -- src/routes/public.test.ts src/lib/storage/memory.test.ts
npm run test --workspace @query402/agent-client -- src/cli.test.ts
npm run typecheck --workspace @query402/api
npm run typecheck --workspace @query402/web
npm run typecheck --workspace @query402/agent-client

Results: API tests pass (20), agent CLI tests pass (3), and all three typechecks pass.

I still cannot merge this exact branch because the missing-address UI change also weakens payment configuration at runtime. The PR makes X402_PAY_TO_ADDRESS optional and then passes config.X402_PAY_TO_ADDRESS ?? "" into demo evidence, persistence, and the x402 payment requirements. That means a misconfigured paid route can continue with an empty payTo instead of failing safely.

For #90, please expose a safe public payToAddress for display/warning, but keep paid execution configuration strict: if a real paid x402 route is enabled without a valid pay-to address, it should fail closed rather than generate payment requirements/evidence with an empty pay-to. After that I can rerun the same checks.

@emrekayat

emrekayat commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Rechecked: after the other PRs were merged this one now has merge conflicts with main, so I cannot merge it as-is. Could you rebase/merge the latest main, resolve the conflicts and push? I will take another look and merge afterwards.

TheWeirdDee and others added 3 commits July 8, 2026 09:06
Resolves conflicts:
- memory.test.ts: take upstream cross-platform path assertions
- ControlDeckPage.tsx: keep upstream fetchHealth/fetchSponsorshipEnabled
  bootstrap, layer pay-to diagnostics on top; dedupe lucide icon imports
- styles.css: keep both pay-to display styles and payment banner styles
- types.ts: extend HealthResponse with network + diagnostics for the
  pay-to display

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per review feedback on emrekayat#106: keep X402_PAY_TO_ADDRESS optional so the
server can boot for display/diagnostics, but never generate payment
requirements, evidence, or persisted payment attempts with an empty
pay-to address.

- add requirePayToAddress() which throws when the address is missing
- real (non-demo) x402 middleware now fails at startup if paid routes
  are enabled without a pay-to address
- demo-mode /x402/* requests return 503 instead of advertising empty
  payTo requirements or recording empty-payTo demo evidence
- demo evidence and payment-attempt persistence use requirePayToAddress
  instead of falling back to ""
- add tests for the 503 demo-mode behavior and the startup failure

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- pricing.test.ts: add the missing closing brace for the "x402
  cross-layer price consistency" describe block; the file did not parse,
  which broke typecheck and vitest for the whole API workspace
- urlSafety.test.ts: import vitest globals and use an explicit .js
  extension so the file compiles under NodeNext module resolution
- urlSafety.ts: strip the brackets Node's URL.hostname keeps around IPv6
  hosts before prefix checks, so IPv6 link-local/ULA addresses (e.g.
  fe80::) are actually blocked as the tests expect

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add wallet-safe pay-to address display and validation copy

2 participants