fix: wallet balance cache, Stellar secret validation, destination check, WalletsService cleanup#883
Merged
Conversation
…count check, WalletsService fixes - Nexacore-Org#869: Replace in-memory wallet balance cache with Redis-backed cache via CacheModule - Nexacore-Org#868: Inject ConfigService properly, add getStellarSecretKey with startup validation - Nexacore-Org#867: Fix WalletsService duplicate declarations, ensure all balance ops use WalletsService - Nexacore-Org#789: Add StellarService.accountExists() with 60s Redis cache, check destination before withdrawal - Add WALLET_BALANCE_CACHE_TTL_SECONDS env var for cache TTL configuration - Make STELLAR_HOT_WALLET_SECRET required in Zod env schema (fail-fast startup)
|
@prismn Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
@prismn please resolve conflicts |
Contributor
Author
|
@portableDD it has been fixed, tanks |
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
Changes
#869 — Wallet balance cache migration
CacheModulewallet-balances:${userId}with configurable TTL (WALLET_BALANCE_CACHE_TTL_SECONDS, default 30s)UsersService.invalidateWalletBalanceCache()#868 — Secure Stellar secret key handling
(this as any).configService?.get()pattern — properly typedConfigServiceinjectiononModuleInit()that validatesSTELLAR_HOT_WALLET_SECRETat startup (fail-fast)getStellarSecretKey()with proper error handlingSTELLAR_HOT_WALLET_SECRETa required field in Zod env validation schema#867 — Eliminate JSONB balance bypass
WalletsService(compile errors)WalletsService— no remaininguser.balancesJSONB accessWalletsService.adjustBalancealready usespessimistic_writerow-level locking#789 — Destination account validation
StellarService.accountExists(address)— queries Horizon/accounts/{address}createWithdrawalchecks destination before proceeding; returns 400 with clear message if unfundeddestinationAddressfield toWithdrawalDtoFiles Changed
src/config/env.validation.ts— required STELLAR_HOT_WALLET_SECRET, added WALLET_BALANCE_CACHE_TTL_SECONDSsrc/users/users.service.ts— Redis-backed wallet balance cache with invalidationsrc/wallet/wallets.service.ts— fixed duplicate declarations (compile errors)src/stellar/stellar.service.ts— added accountExists() with Redis cachingsrc/transactions/transactions.service.ts— ConfigService injection, getStellarSecretKey, destination check, cache invalidationsrc/transactions/transactions.module.ts— imported StellarModuleCloses #869
Closes #868
Closes #867
Closes #789