Skip to content

Drop the SDK's Pix key pre-check before BRL offramp registration - #1478

Merged
ebma merged 4 commits into
stagingfrom
fix/sdk-drop-pix-precheck
Nov 23, 2026
Merged

ebma merged 4 commits into
stagingfrom
fix/sdk-drop-pix-precheck

Conversation

@ebma

@ebma ebma commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

BrlHandler.registerBrlOfframp called GET /v1/brla/validatePixKey before every BRL offramp registration (assertValidPixKey). That check is redundant:

  • Registration does the same lookup. validateAveniaOfframpRecipient (apps/api/src/api/services/phases/blocks/core/avenia-registration.ts) resolves the Pix key with Avenia and also checks that its owner matches the receiver's tax ID. It rejects a bad key with 400 "Invalid pixKey or receiverTaxId.", which parseAPIError already maps to InvalidPixKeyError.
  • The pre-check doubled the provider lookups. Each offramp made two Avenia DICT lookups instead of one.
  • It reported other failures as a bad key. It mapped any 4xx from the check, including the API's own rate limit, to InvalidPixKeyError.

This PR removes the automatic pre-check. ApiService.validateBrlPixKey and the /v1/brla/validatePixKey route stay, for anyone who calls them directly, so this is the only SDK request that changes. The vortex-integration skill no longer tells integrators to validate keys through that route; it now explains what InvalidPixKeyError means. Its note on the missing-parameter errors is corrected too, and the route's comment says only older SDK versions pre-check the key.

Merge order

Merge after #1477. Until that lands, registration also answers a lookup outage with 400 "Invalid pixKey or receiverTaxId.", which the removed check reported as a provider failure.

Behavior change

  • A bad Pix key still surfaces as InvalidPixKeyError. It now comes from registerRamp, after the BRL limit pre-check, rather than first.
  • A user who is both over the limit and using a bad key now sees AmountExceedsLimitError first.
  • Nothing is stored before registration (ephemerals are stored only after registerRamp succeeds), so a rejected key leaves nothing behind.

Testing

  • handlers.flow.test.ts:
    • The offramp flow no longer calls validateBrlPixKey, even when that call would fail with 429.
    • A registration rejection 400 "Invalid pixKey or receiverTaxId." surfaces as InvalidPixKeyError, with nothing stored after it.
  • vortexSdk.lazyNetworks.test.ts: a BRL offramp registers without requesting the route.
  • Fails without the change: all 4 updated tests.
  • Also passing:
    • The SDK bun test suite (190 tests, plus the build and dist smoke-load), ESLint, typecheck and wire-contract:check.
    • test:stocks, test:gold and test:consumer-kit.
    • The API's stocks-app.e2e and brl-offramp.scenario tests (69 pass).

ebma added 2 commits November 23, 2026 10:57
registerBrlOfframp called GET /v1/brla/validatePixKey before
registering. Registration validates the same key server-side, and also
checks that its owner matches the receiver's tax ID, so the pre-check
doubled the provider lookups per offramp. It also reported any 4xx from
the check, including a rate limit, as InvalidPixKeyError. A bad key now
surfaces from registration as the same InvalidPixKeyError.
The integration skill told agents to validate Pix keys through
GET /v1/brla/validatePixKey before registering and after an
InvalidPixKeyError. Registration is the check, so the guidance now says
what InvalidPixKeyError means and to correct the key.
@netlify

netlify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vrtx-dashboard canceled.

Name Link
🔨 Latest commit 008e243
🔍 Latest deploy log https://app.netlify.com/projects/vrtx-dashboard/deploys/6b04633f7f51d9440287f7ba

@netlify

netlify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 008e243
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6b04633f2b04f1b05c7c529f
😎 Deploy Preview https://deploy-preview-1478--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortexfi canceled.

Name Link
🔨 Latest commit 008e243
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6b04633fdc3fc8f4c0803568

ebma added 2 commits November 23, 2026 16:57
The integration skill said MissingBrlOfframpParametersError never fires
for a missing pixDestination, but parseAPIError maps that message to it.
It also quoted a walletAddress message that EVM offramps don't send.
@ebma
ebma merged commit 7518170 into staging Nov 23, 2026
6 checks passed
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.

1 participant