refactor BWS server support methods#4148
Open
tmcollins4 wants to merge 2 commits intobitpay:masterfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refactors WalletService server-support logic out of the monolithic server.ts into dedicated helper modules, keeping the public WalletService API as delegating wrappers.
Changes:
- Extracted upgrade checks, request arg validation, and multiple server support methods into new
src/lib/server/*.tshelper modules. - Updated
WalletServiceto delegate to these helper modules (auth, logging, notifications, services, moralis, notes, advertisements). - Centralized shared helpers/constants (
checkRequired,UPGRADES) inserver/shared.ts.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bitcore-wallet-service/src/lib/server/upgrade.ts | New module implementing upgrade-path evaluation + logging. |
| packages/bitcore-wallet-service/src/lib/server/shared.ts | New shared helpers/constants (checkRequired, UPGRADES). |
| packages/bitcore-wallet-service/src/lib/server/services.ts | New module for fiat/services/config/cache helpers. |
| packages/bitcore-wallet-service/src/lib/server/notifications.ts | New module for notification + subscription helpers. |
| packages/bitcore-wallet-service/src/lib/server/notes.ts | New module for tx note helpers. |
| packages/bitcore-wallet-service/src/lib/server/moralis.ts | New module for Moralis helper methods. |
| packages/bitcore-wallet-service/src/lib/server/logging.ts | New module for lock + logger helper methods. |
| packages/bitcore-wallet-service/src/lib/server/auth.ts | New module for instance/auth/session/version helpers. |
| packages/bitcore-wallet-service/src/lib/server/advertisements.ts | New module for advertisement helpers. |
| packages/bitcore-wallet-service/src/lib/server.ts | Rewired WalletService to delegate to helper modules; removed inlined implementations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+86
to
+88
| export function getAllAdverts(service: WalletService, opts, cb: Callback) { | ||
| service._runLocked(cb, next => { | ||
| service.getAllAdverts(opts, next); |
Comment on lines
+44
to
+55
| service._runLocked( | ||
| cb, | ||
| next => { | ||
| checkIfAdvertExistsAlready(opts.adId, (err, advert) => { | ||
| if (err) throw err; | ||
| if (advert) { | ||
| service.storage.storeAdvert(advert, next); | ||
| } | ||
| }); | ||
| }, | ||
| 10 * 1000 | ||
| ); |
| } | ||
|
|
||
| export function getServicesData(_service: WalletService, opts, cb: Callback) { | ||
| const externalServicesConfig: ExternalServicesConfig = structuredClone(config.services); |
|
|
||
| const { Utils } = Common; | ||
|
|
||
| export function checkRequired(obj, args, cb?: (e: any) => void) { |
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.
Description
Refactors
WalletServiceserver-support methods out of the largeserver.tsfile into focused helper modules.Changelog
server/advertisements.ts.server/auth.ts.server/logging.ts.server/moralis.ts.server/notes.ts.server/notifications.ts.server/services.ts.server/shared.tsandserver/upgrade.ts.WalletServicepublic methods as delegating wrappers to preserve the existing API.Testing Notes
Checklist