fix(branta): align brantaService with Branta SDK v3 types#409
Closed
spe1020 wants to merge 1 commit into
Closed
Conversation
The v3 SDK upgrade left brantaService.server.ts straddling the deprecated
`@branta-ops/branta/v2` entry point and the v3 root, producing 9 svelte-check
errors. Consolidate entirely onto the v3 root (per the SDK's own guidance;
`/v2` is removed in v4) and align to its types:
- Import BrantaService + all types from the package root, not `/v2`.
- baseUrl: v3 types it as the resolved URL string, so map the environment
name through the BrantaServerBaseUrl const instead of passing 'Production'.
(Import it as a value, not a type.)
- Destination: v2 `isZk` -> v3 `zk`.
- Payment.metadata: v3 is Record<string, string> (was a stringified blob);
coerce the metadata object's values to strings.
- addPayment result: v3 moved `verifyUrl` off ZKPaymentResult onto the
returned Payment -> use result.payment.verifyUrl.
- getPayments / getPaymentsByQRCode: v3 returns { payments, verifyUrl }
(v2 was { data, url }); the existing reads now match, and the QR method
is getPaymentsByQRCode (capital QR).
api/branta/register's root import of DestinationType now resolves cleanly
(it was cascading off the broken v2 import). No other files reference the
changed shapes. svelte-check: 0 errors (was 9); tests 151/151.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
zapcooking-frontend | 67cc2b4 | May 30 2026, 01:58 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
frontend | 67cc2b4 | May 30 2026, 01:59 PM |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Branta SDK v3 upgrade (#401) left
src/lib/brantaService.server.tsusing v2 field/method shapes that no longer match the installed@branta-ops/branta@3.xtypes, producing 9svelte-checkerrors onmain(cascading intoapi/branta/register). This aligns the code to the SDK's actual v3 type surface.Key correction
In v3 (3.0.2 installed), the service class and
Payment/Destination/DestinationTypetypes are still exported from the/v2entry point — only the client-options classes (BrantaClientOptions,BrantaServerBaseUrl) live at the package root. So this keeps the split import and fixes the type mismatches, rather than moving everything to the root.Fixes (verified against the installed
.d.ts)DestinationTypeimported from root (not exported there)@branta-ops/branta/v2(both files)BrantaServerBaseUrlused as a typeBRANTA_ENVIRONMENTto the matching member; don't annotate with itDestination.isZkzkPayment.metadata = JSON.stringify(...)Record<string, string>→ coerce object values to stringsresult.verifyUrlonaddPaymentZKPaymentResulthas noverifyUrl→ useresult.verifyLinkgetPayments/getPaymentsByQRCodetreated as{ payments, verifyUrl }Payment[]directly → index the array;verifyUrllives on eachPaymentgetPaymentsByQrCodegetPaymentsByQRCode(capital QR)Scope / safety
src/lib/brantaService.server.tsandsrc/routes/api/branta/register/+server.ts(import path only).Verification
pnpm check— 0 errors (was 9); 128 pre-existing warnings unchanged.pnpm test— 151/151 pass.🤖 Generated with Claude Code