refactor: migrate API client to joinmarket-ng-api-ts #1305
Open
kishore08-07 wants to merge 9 commits into
Open
refactor: migrate API client to joinmarket-ng-api-ts #1305kishore08-07 wants to merge 9 commits into
kishore08-07 wants to merge 9 commits into
Conversation
- Uninstall legacy (v0.3.0). - Install new (v1.0.0). - Update package.json for to apply to the new ng-api package. Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
…bility - Remove ErrorMessage type imports from @joinmarket-webui/joinmarket-ng-api-ts/jm across the codebase. - Update error types in React Query hooks (useQuery, useMutation) and context states to use unknown instead of ErrorMessage. - Update error handler callbacks (onError) to accept unknown type, adapting to the error type changes in the generated ng-api client. Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
- Add nullish/undefined checks for sessionInfo.wallet_name in create, import, and login flows. - Handle nullable progress field in rescanInfo by checking != null and defaulting to undefined. - Fallback block_height to undefined if nullish in layout and session contexts. - Default walletInfo.accounts to an empty array to prevent mapping errors if nullish. Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the frontend from @joinmarket-webui/joinmarket-api-ts to @joinmarket-webui/joinmarket-ng-api-ts, updating API imports/mocks across the app and adapting a few flows (notably Sweep scheduler) to the new NG endpoints and types.
Changes:
- Replace old JoinMarket API TS client/react-query helpers with
joinmarket-ng-api-tsthroughout application code and tests. - Update Sweep scheduler flow to use tumbler plan/start/status/stop APIs and convert tumbler status into the existing
Scheduleshape for UI. - Normalize error handling/type expectations in several components/hooks (moving away from the removed
ErrorMessagetype and usinggetErrorReasonin UI).
Reviewed changes
Copilot reviewed 70 out of 71 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/stories/stories.test.ts | Update API package mocks to NG package paths. |
| src/store/jmTxStore.ts | Update API type import to NG package. |
| src/store/jmSessionStore.ts | Update API type import to NG package. |
| src/store/jmSessionStore.test.ts | Update API type import to NG package. |
| src/store/authStore.ts | Update API type import to NG package. |
| src/lib/config.ts | Switch client/types imports to NG package. |
| src/lib/config.test.ts | Update createClient mock import path to NG package. |
| src/hooks/useUtxoSelectionDialog.ts | Update react-query helper import to NG package. |
| src/hooks/useUtxoSelectionDialog.test.ts | Update react-query helper mock to NG package. |
| src/hooks/useRefreshSession.ts | Update session options/type imports to NG package. |
| src/hooks/useRefreshSession.test.ts | Update session/react-query helper mocks to NG package. |
| src/hooks/useQueryUtxos.ts | Update listutxos options + adjust local UTXO typing/error type. |
| src/hooks/useQueryUtxos.test.ts | Update listutxos options mock import path to NG package. |
| src/hooks/useQueryJmInfo.ts | Update version options/type imports to NG package. |
| src/hooks/useQueryJmInfo.test.ts | Update version options mock import path to NG package. |
| src/hooks/useQueryDisplayWallet.ts | Update displaywallet options/type imports to NG package. |
| src/hooks/useJmConfig.ts | Update config mutation helper import to NG package. |
| src/hooks/useJmConfig.test.ts | Update config mutation helper mock to NG package. |
| src/context/JamWalletInfoContextProvider.tsx | Tolerate missing accounts + adapt branch parsing without non-null assertion. |
| src/context/JamWalletInfoContext.ts | Update wallet display types and relax error typing to unknown. |
| src/context/JamSessionInfoContextProvider.tsx | Update rescan options import + tweak progress/blockHeight handling. |
| src/context/JamSessionInfoContextProvider.test.tsx | Update rescan options mock/type import to NG package. |
| src/components/wallet/WalletJarsDetailsContent.tsx | Update freeze mutation helper import to NG package. |
| src/components/wallet/WalletJarsDetailsContent.test.tsx | Update react-query helper mock + adjust meta typings in test fixtures. |
| src/components/sweep/SweepPage.tsx | Replace schedule APIs with tumbler plan/start/status/stop and convert plan → schedule. |
| src/components/sweep/SweepPage.test.tsx | Update sweep tests to mock tumbler APIs and plan/status behavior. |
| src/components/settings/SeedPhraseDialog.tsx | Update seed options import + use getErrorReason for error display. |
| src/components/settings/SeedPhraseDialog.test.tsx | Update seed options mock import path to NG package. |
| src/components/settings/RescanChainPage.tsx | Update rescan API import to NG package. |
| src/components/settings/RescanChainPage.test.tsx | Update rescan API mock import path to NG package. |
| src/components/settings/fees/FeeConfigDialog.tsx | Update config mutation helper import to NG package. |
| src/components/settings/fees/FeeConfigDialog.test.tsx | Update config mutation helper mock to NG package. |
| src/components/settings/AccountXpubsDialog.tsx | Update seed options import + use getErrorReason for error display. |
| src/components/settings/AccountXpubsDialog.test.tsx | Update seed options mock import path to NG package. |
| src/components/send/SendPage.tsx | Update send mutations/types import to NG package; relax mutation error generics. |
| src/components/send/SendPage.test.tsx | Update send react-query helper mocks to NG package. |
| src/components/send/SendForm.tsx | Update getaddress import + relax callback error type to unknown. |
| src/components/send/SendForm.test.tsx | Update getaddress mock import path to NG package. |
| src/components/send/collaborativeSend.ts | Update request type imports to NG package. |
| src/components/receive/ReceivePage.tsx | Update getaddress imports to NG package; relax onError typing. |
| src/components/receive/ReceivePage.test.tsx | Update getaddress and query-key helper mocks to NG package. |
| src/components/MainWalletPage.tsx | Use getErrorReason for wallet load error message formatting. |
| src/components/login/LoginPage.tsx | Update wallet list/unlock helpers to NG package; tighten active-wallet detection. |
| src/components/login/LoginPage.test.tsx | Update login react-query helper mocks to NG package. |
| src/components/login/LoginCard.tsx | Relax list-wallet error type to unknown and render via getErrorReason. |
| src/components/layout/Layout.tsx | Normalize optional blockHeight to undefined when absent. |
| src/components/layout/AppNavbar.tsx | Update session type import; handle rescan progress via isValidNumber. |
| src/components/import/ImportWalletPage.tsx | Update wallet import flows to NG package APIs/helpers. |
| src/components/import/ImportWalletPage.test.tsx | Update import flow mocks to NG package. |
| src/components/import/ImportStepWalletDetails.tsx | Treat session active only when wallet name is present. |
| src/components/import/ImportStepImportDetails.tsx | Treat session active only when wallet name is present. |
| src/components/earn/report/hooks/useQueryYieldgenReport.ts | Update yieldgen imports to NG package and adjust response parsing. |
| src/components/earn/report/hooks/useQueryYieldgenReport.test.ts | Update mocks to NG package. |
| src/components/earn/RenewBondDialog.tsx | Update earn mutations/types imports; relax onError typing. |
| src/components/earn/RenewBondDialog.test.tsx | Update earn react-query helper mocks to NG package. |
| src/components/earn/OfferCard.tsx | Harden string coercion for offer fields under new typings. |
| src/components/earn/OfferCard.test.tsx | Adjust test fixtures typing for new Offer shape. |
| src/components/earn/MoveToJarDialog.tsx | Update earn mutations/types imports; relax onError typing. |
| src/components/earn/MoveToJarDialog.test.tsx | Update earn react-query helper mocks to NG package. |
| src/components/earn/EarnPage.tsx | Update maker start/stop helpers/types; relax onError typing. |
| src/components/earn/EarnPage.test.tsx | Update earn page helper mocks to NG package. |
| src/components/earn/CreateFidelityBondDialog/useCreateFidelityBondWizard.ts | Update fidelity bond helpers/types; relax onError typing. |
| src/components/earn/CreateFidelityBondDialog/useCreateFidelityBondWizard.test.ts | Update helper mocks to NG package. |
| src/components/earn/CreateFidelityBondDialog/CreateFidelityBondDialogSteps.test.tsx | Update test fixture to satisfy new tx result shape. |
| src/components/create/CreateWalletPage.tsx | Update create wallet flow to NG package APIs/helpers. |
| src/components/create/CreateWalletPage.test.tsx | Update create flow mocks to NG package. |
| src/components/create/CreateStepWalletDetails.tsx | Only show “other wallet active” when a wallet name is present. |
| src/App.tsx | Update lockwallet/token imports; use getErrorReason for token refresh errors. |
| src/App.test.tsx | Update app-level API mocks to NG package. |
| package.json | Replace dependency/override from joinmarket-api-ts to joinmarket-ng-api-ts. |
| package-lock.json | Lockfile updates reflecting joinmarket-ng-api-ts@1.0.0 and dependency graph changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
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
This PR implements the migration from the legacy
@joinmarket-webui/joinmarket-api-tsAPI client package to@joinmarket-webui/joinmarket-ng-api-ts.Key Changes
Global Error Type refactoring (replacing
ErrorMessagewithunknown / FastAPI-style errors).SweepPageadaptations around Tumbler API endpoints:SweepPageto utilize the new Tumbler API endpoints:tumblerplan,tumblerstart,tumblerstatus, andtumblerstop(replacing the oldgetschedule/runschedule/stopcoinjoinoptionsendpoints).SweepPage.tsx(toSchedule mapper) that maps the newTumblerPlanResponsephases into the existing 7-tuple ScheduleEntry formats.SweepPage.test.tsxto match the new Tumbler API methods.Test updates to mock the new endpoints and packages.