Merged
Conversation
Framework-agnostic API client and type definitions extracted from @dfx.swiss/react. Provides DfxApiClient class with typed methods for all DFX API endpoints (auth, buy, sell, swap, asset, fiat, country, user, kyc, transaction, support, payment links/routes, settings, bank accounts). Zero external dependencies — only requires a global fetch function. Enables non-React consumers (React Native, Node.js, CLI tools) to integrate with DFX API without reimplementing types and HTTP logic.
- KycApi: add all step data methods with x-kyc-code header auth (setContactData, setPersonalData, setFinancialData, etc.) - KycApi: add kycRequest() using requestAbsolute() for full URLs - DfxHttpClient: add custom headers support and specialHandling callback for status-code-specific actions (e.g. HTTP 202) - DfxHttpClient: add requestAbsolute() for non-versioned URLs - UserApi: fix changeAddress (POST v1, returns SignIn) - UserApi: add updateCallSettings(), fix return types (User) - BankAccountApi: add active/default to UpdateBankAccount - TransactionApi: fix invoice/receipt to return PdfDocument, fix history/CSV to use TEXT response type, add date serialization - Add Utils module (groupBy, formatAmount, isJwt, buildQueryParams) - Add Validations module (Mail, Phone, Iban with blocked list) - Add blocked-iban.json data file - Add ibantools and libphonenumber-js dependencies
- BuyPaymentInfo: add targetAddress field (used by wallet integrations) - SellPaymentInfo: make iban optional, add sourceAddress and paymentMethod fields (wallet integrations send address, not IBAN) - AuthApi: replace catch(e: any) with proper ApiException type guard, add typed SignUpRequest interface instead of Record<string, any> - TransactionApi: fix empty query string on getSingle, exportCsv, getHistory when no params provided
- Remove unused CustomFile import from TransactionApi - Fix Asset export in definitions/index.ts (export type, not value) - Move typescript from dependencies to devDependencies
- TransactionRefundTarget.refundTarget: required -> optional (matches react's optional field) - UserKyc: add missing phoneCallAccepted field - PhoneCallStatus: remove ACCEPTED/REJECTED values not in react
- AuthApi.authenticate: first call now uses default auth token, retry on 409 uses token: false (was no-op before, both had token: false) - PaymentLinksApi.list: add missing externalPaymentId parameter, fix return type to PaymentLink | PaymentLink[] - SellUrl.confirm / SwapUrl.confirm: change from string with :id placeholder to template literal function, consistent with BuyUrl.confirm pattern - Regenerate package-lock.json (typescript now in devDependencies)
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.
Summary
@dfx.swiss/corepackage: framework-agnostic API client and TypeScript type definitions@dfx.swiss/react(zero React dependency)DfxApiClientclass with typed methods for all DFX API endpoints (auth, buy, sell, swap, asset, fiat, country, user, kyc, transaction, support, payment links/routes, settings, bank accounts)fetchfunction@dfx.swiss/coreMotivation
Currently, any non-React consumer (Edge Wallet, CLI tools, React Native apps, Node.js backends) must reimplement DFX API types and HTTP calls from scratch. This package provides a single source of truth for the DFX API contract.
Usage
Follow-ups
@dfx.swiss/reactto consume types/client from coreUtilsandValidationsto core (currently still in react)@dfx.swiss/coreTest plan
tscbuild succeeds with zero errors@dfx.swiss/reacttypes (synced with latest develop)