Skip to content

🇧🇷 Eulen (DePix): Integration Implementation v2 - #135

Open
TomasCast wants to merge 7 commits into
developfrom
feat/eulen-depix-integration-v2
Open

TomasCast wants to merge 7 commits into
developfrom
feat/eulen-depix-integration-v2

Conversation

@TomasCast

@TomasCast TomasCast commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Restore PIX → DePix in the local MCP/CLI so agents can KYC, charge, list, and track deposits through Ankara — never Eulen — without handling identity PII.

Noviuz hosted KYC (aligned with Ankara PR #689)

Ankara's /eulen/kyc/session/ now needs verification_methods and returns a verification_url (operator_id is gone). This branch follows that contract:

  • eulen_kyc_session sends verification_methods (otp default, pix, or both). With pix it also sends amount_brl_cents and a destination_wallet taken from a local mainnet wallet; the caller can't pass a raw address. It returns verification_url to open in the default browser.
  • The pix destination address is reserved per account and wallet for 30 minutes (~/.aqua/pix_kyc_addresses.json, 0o600), so a retry sends identical parameters and gets Ankara's same session and URL instead of a new one.
  • 409 EULEN_KYC_ALREADY_VERIFIED comes back as status: "already_verified".
  • eulen_kyc_confirm handles every session_status (created, under_review, approved, rejected, expired, not_found, identity_conflict) and returns is_final, is_success and poll_after_seconds (15 while created). under_review is never treated as verified; an unknown status raises.
  • 429 Retry-After is passed through as retry_after_seconds in the error envelope.
  • CLI: aqua eulen kyc-session --method otp|pix --amount-cents --wallet-name, and aqua eulen kyc-confirm --wait (polls every 15 s, up to 30 minutes).
  • session_id and verification_url are redacted from logs.

Screenshots / logs / tests (optional but encouraged whenever possible)

  • Unit tests: tests/test_pix.py (KYC, receive, pix_list filters, pix_status by deposit_id, email normalize).
  • Manual: staging ANKARA_API_URL=https://test.aquabtc.com; Cursor MCP (aqua-staging-dev); pix_receive + pix_list (today) + pix_status with required email. Ankara GET /eulen/deposits/?deposit_id= is the source of truth (no Eulen /deposit/{id}/status/ poll).
  • Smoke-test prompt: scripts/prompts/prompt_test_real_pix.md (updated for verification_url, the pix method and the new statuses).
  • KYC changes: unit-tested in tests/test_pix.py (request bodies, validation, address reuse, already-verified, every session_status, Retry-After, CLI --wait). The Ankara side isn't on staging yet; a manual run against a local Ankara is still pending.

Tested in ankara STG.
image
image

AI review (etiquette before requesting human review)

Bugbot (/review) on this branch: 2 findings, both addressed in 6882bdb (normalize PIX emails before persist; ignore .uv-bin/).

@TomasCast TomasCast self-assigned this Sep 21, 2026
@TomasCast
TomasCast requested review from andycreed0x and coelhogonzalo and removed request for andycreed0x September 21, 2026 13:19
Comment thread src/aqua/pix.py Outdated
Comment thread src/aqua/pix.py Outdated
Comment thread src/aqua/pix.py Outdated
Comment thread src/aqua/pix.py Outdated
Comment thread src/aqua/pix.py
Comment thread src/aqua/pix.py
Comment thread src/aqua/pix.py Outdated
Comment thread src/aqua/pix.py
Comment thread src/aqua/pix.py
Comment thread src/aqua/pix.py Outdated
Keep the PIX docs and examples alongside develop's L-BTC WapuPay copy, and keep lightning_receive as the only tool that ships disabled.
@coelhogonzalo
coelhogonzalo removed their request for review September 28, 2026 16:41
Ankara's KYC session endpoint now requires verification_methods (otp/pix,
plus amount_brl_cents + destination_wallet for pix) and returns a
verification_url instead of operator_id.

- eulen_kyc_session: send verification_methods / amount / a local wallet
  address, return verification_url, map 409 EULEN_KYC_ALREADY_VERIFIED to
  status=already_verified. The pix destination address is reserved per
  account+wallet for 30 min so retries hit Ankara's same-session reuse.
- eulen_kyc_confirm: explicit handling of every session_status (incl.
  not_found, identity_conflict) with is_final/is_success/poll_after_seconds;
  unknown statuses raise.
- Surface Retry-After as retry_after_seconds on error envelopes.
- CLI: kyc-session --method/--amount-cents/--wallet-name, kyc-confirm --wait.
- Redact session_id and verification_url from logs.
- Update tool schemas, MCP instructions, prompts and docs.

This branch has not been deployed

No deployments
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.

2 participants