Conversation
Update currencies.ts to use SCREAMING_SNAKE_CASE payment rail values that match the PaymentRail enum in the OpenAPI spec (e.g., FEDNOW, FASTER_PAYMENTS, SEPA_INSTANT, BANK_TRANSFER, MOBILE_MONEY). Add paymentRails field to generated external account creation requests in code-generator.ts to match documented workflow examples. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR syncs the Grid Visualizer with the new Confidence Score: 4/5The currencies.ts enum update is safe, but code-generator.ts injects a response-only field into create request bodies which would produce incorrect example code. One P1 finding: paymentRails is injected into accountInfo for external account creation requests, but the field is absent from all create-request schemas (*AccountInfoBase). This generates misleading or broken example API calls, which is the core purpose of this visualizer. The P2 (enum values in prose) is minor. Score is 4 until the P1 is resolved. components/grid-visualizer/src/lib/code-generator.ts — paymentRails field placement in buildAccountInfoBody
|
| Filename | Overview |
|---|---|
| components/grid-visualizer/src/data/currencies.ts | Rail values updated to SCREAMING_SNAKE_CASE matching the PaymentRail enum; all new values (FEDNOW, WIRE, SEPA_INSTANT, FASTER_PAYMENTS, BANK_TRANSFER, MOBILE_MONEY, PAYNOW) are valid enum members. |
| components/grid-visualizer/src/lib/code-generator.ts | Adds paymentRails to accountInfo in external account create requests, but this field exists only in response schemas (*AccountInfo), not create request schemas (*AccountInfoBase) — the generated example code would send an undocumented field to the API. |
Sequence Diagram
sequenceDiagram
participant UI as Grid Visualizer UI
participant CG as code-generator.ts
participant CUR as currencies.ts (PaymentRail enum)
participant API as Grid API
UI->>CG: generateSteps(source, destination)
CG->>CUR: find(c => c.code === sel.code)
CUR-->>CG: fiat.allRails (SCREAMING_SNAKE_CASE)
CG->>CG: buildAccountInfoBody() sets info.paymentRails = allRails
CG-->>UI: ApiStep with accountInfo.paymentRails
UI->>API: POST /customers/external-accounts { accountInfo: { ..., paymentRails: [...] } }
Note over API: paymentRails not in create schema, only in response schema
Comments Outside Diff (1)
-
components/grid-visualizer/src/lib/code-generator.ts, line 309 (link)Raw enum values in user-facing note text
getJitPaymentMethod()now returns strings like"FEDNOW transfer"or"SEPA_INSTANT transfer"fromfiat.instantRails[0], which appear directly in the step note shown to the user: "Trigger the payment by sending a SEPA_INSTANT transfer to the deposit address...". The previous human-readable names (FedNow,SEPA Instant) were better suited for this prose context.Consider either keeping a separate display-name map for prose use or adding a formatting helper that converts
SEPA_INSTANT→SEPA Instantfor the note text.Prompt To Fix With AI
This is a comment left during a code review. Path: components/grid-visualizer/src/lib/code-generator.ts Line: 309 Comment: **Raw enum values in user-facing note text** `getJitPaymentMethod()` now returns strings like `"FEDNOW transfer"` or `"SEPA_INSTANT transfer"` from `fiat.instantRails[0]`, which appear directly in the step note shown to the user: *"Trigger the payment by sending a SEPA_INSTANT transfer to the deposit address..."*. The previous human-readable names (`FedNow`, `SEPA Instant`) were better suited for this prose context. Consider either keeping a separate display-name map for prose use or adding a formatting helper that converts `SEPA_INSTANT` → `SEPA Instant` for the note text. How can I resolve this? If you propose a fix, please make it concise.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
This is a comment left during a code review.
Path: components/grid-visualizer/src/lib/code-generator.ts
Line: 51-57
Comment:
**`paymentRails` is a response-only field**
`paymentRails` is not part of the external account creation request schema. Every `*ExternalAccountCreateInfo` schema (e.g. `UsdExternalAccountCreateInfo`) extends `*AccountInfoBase`, and none of those base schemas include `paymentRails`. The field only appears in the response-side `*AccountInfo` schemas (e.g. `UsdAccountInfo`) that the API returns after creation.
Sending `paymentRails` inside `accountInfo` will either cause a 400 validation error or be silently ignored — either way it generates misleading example code for developers using this visualizer as a reference. The OpenAPI spec examples in `customers_external_accounts.yaml` also omit it from create request bodies.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: components/grid-visualizer/src/lib/code-generator.ts
Line: 309
Comment:
**Raw enum values in user-facing note text**
`getJitPaymentMethod()` now returns strings like `"FEDNOW transfer"` or `"SEPA_INSTANT transfer"` from `fiat.instantRails[0]`, which appear directly in the step note shown to the user: *"Trigger the payment by sending a SEPA_INSTANT transfer to the deposit address..."*. The previous human-readable names (`FedNow`, `SEPA Instant`) were better suited for this prose context.
Consider either keeping a separate display-name map for prose use or adding a formatting helper that converts `SEPA_INSTANT` → `SEPA Instant` for the note text.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "Sync Grid Visualizer with PaymentRail en..." | Re-trigger Greptile
| // Add paymentRails for fiat currencies | ||
| if (sel.type === 'fiat') { | ||
| const fiat = currencies.find((c) => c.code === sel.code); | ||
| if (fiat && fiat.allRails.length > 0) { | ||
| info.paymentRails = fiat.allRails; | ||
| } | ||
| } |
There was a problem hiding this comment.
paymentRails is a response-only field
paymentRails is not part of the external account creation request schema. Every *ExternalAccountCreateInfo schema (e.g. UsdExternalAccountCreateInfo) extends *AccountInfoBase, and none of those base schemas include paymentRails. The field only appears in the response-side *AccountInfo schemas (e.g. UsdAccountInfo) that the API returns after creation.
Sending paymentRails inside accountInfo will either cause a 400 validation error or be silently ignored — either way it generates misleading example code for developers using this visualizer as a reference. The OpenAPI spec examples in customers_external_accounts.yaml also omit it from create request bodies.
Prompt To Fix With AI
This is a comment left during a code review.
Path: components/grid-visualizer/src/lib/code-generator.ts
Line: 51-57
Comment:
**`paymentRails` is a response-only field**
`paymentRails` is not part of the external account creation request schema. Every `*ExternalAccountCreateInfo` schema (e.g. `UsdExternalAccountCreateInfo`) extends `*AccountInfoBase`, and none of those base schemas include `paymentRails`. The field only appears in the response-side `*AccountInfo` schemas (e.g. `UsdAccountInfo`) that the API returns after creation.
Sending `paymentRails` inside `accountInfo` will either cause a 400 validation error or be silently ignored — either way it generates misleading example code for developers using this visualizer as a reference. The OpenAPI spec examples in `customers_external_accounts.yaml` also omit it from create request bodies.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Syncs the Grid Visualizer with the new PaymentRail enum added in #347:
FEDNOWinstead ofFedNow,FASTER_PAYMENTSinstead ofFaster Payments,SEPA_INSTANTinstead ofSEPA Instant,BANK_TRANSFERinstead ofBank Transfer,MOBILE_MONEYinstead ofMobile Money)paymentRailsarray to generated external account creation requests, matching the documented workflow examples in.claude/skills/grid-api/references/workflows.mdTrigger
OpenAPI schema changes in commit 4d89702:
openapi/components/schemas/common/PaymentRail.yaml(new enum)openapi/components/schemas/exchange_rates/ExchangeRate.yaml(addeddestinationPaymentRail)openapi/components/schemas/quotes/AccountDestination.yaml(added optionalpaymentRail)Test plan
paymentRailsin request body🤖 Generated with Claude Code