refactor(billing): cleans up top up master wallets#2246
Conversation
60031fd to
af059b2
Compare
WalkthroughThis PR removes UAKT and USDC top-up master wallet support throughout the billing and deployment services, including environment variables, provider registrations, wallet type definitions, and related services. The system transitions to a managed-wallet-only architecture for handling deployments. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/api/src/billing/providers/signing-client.provider.ts (1)
6-24: Managed‑only wiring looks consistent; InjectSigningClient is now effectively constantThe import cleanup to only
MANAGED_MASTER_WALLETand the remainingMANAGED_MASTER_SIGNING_CLIENTregistration are consistent with dropping the top‑up master wallets; DI wiring here still looks sound.Given
MasterWalletTypeis now just"MANAGED",InjectSigningClienteffectively always resolves the same token. That’s fine and keeps the API future‑proof, but if you don’t anticipate re‑adding more master wallet types, you could simplify this to a plaininject(MANAGED_MASTER_SIGNING_CLIENT)and adjust call sites in a follow‑up to reduce indirection. Not blocking for this PR.apps/api/src/deployment/services/top-up-managed-deployments/top-up-managed-deployments.service.ts (1)
166-189: “Master wallet” naming may now be misleading after moving to managed walletsThe log event
MASTER_WALLET_INSUFFICIENT_FUNDSandchainErrorService.isMasterWalletInsufficientFundsErrorstill refer to a “master wallet”, while this PR’s goal is to move to a managed‑wallet‑only model. Functionally this likely still works (error classification by content), but the naming can confuse future readers about where funds actually come from.I’d leave behavior as‑is for this PR and track a separate follow‑up to rename these to something like
MANAGED_WALLET_INSUFFICIENT_FUNDS/isManagedWalletInsufficientFundsError(and update any shared enums/metrics) so terminology matches the new architecture. Based on learnings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
apps/api/env/.env.functional.test(0 hunks)apps/api/env/.env.local.sample(0 hunks)apps/api/env/.env.unit.test(0 hunks)apps/api/src/billing/config/env.config.ts(0 hunks)apps/api/src/billing/providers/signing-client.provider.ts(1 hunks)apps/api/src/billing/providers/wallet.provider.ts(0 hunks)apps/api/src/billing/types/wallet.type.ts(1 hunks)apps/api/src/deployment/services/top-up-custodial-balance/top-up-custodial-balance.service.ts(0 hunks)apps/api/src/deployment/services/top-up-managed-deployments/top-up-managed-deployments.service.spec.ts(0 hunks)apps/api/src/deployment/services/top-up-managed-deployments/top-up-managed-deployments.service.ts(1 hunks)apps/api/src/deployment/services/top-up-tools/top-up-tools.service.ts(0 hunks)
💤 Files with no reviewable changes (8)
- apps/api/src/billing/providers/wallet.provider.ts
- apps/api/src/deployment/services/top-up-custodial-balance/top-up-custodial-balance.service.ts
- apps/api/env/.env.functional.test
- apps/api/src/deployment/services/top-up-tools/top-up-tools.service.ts
- apps/api/src/billing/config/env.config.ts
- apps/api/src/deployment/services/top-up-managed-deployments/top-up-managed-deployments.service.spec.ts
- apps/api/env/.env.local.sample
- apps/api/env/.env.unit.test
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
apps/api/src/billing/types/wallet.type.ts (1)
1-1: Type‑level narrowing to managed‑only is aligned with the refactorRestricting
MasterWalletTypeto"MANAGED"matches the removal of top‑up master wallets and gives you nice compile‑time guarantees that no other master wallet types are used anymore. Looks good and consistent with the DI/provider changes.apps/api/src/deployment/services/top-up-managed-deployments/top-up-managed-deployments.service.ts (1)
1-8: Barrel import for billing services looks good; just watch for module cyclesSwitching to
@src/billing/servicesforDepositDeploymentMsgOptionsandRpcMessageServicehelps centralize billing exports and keeps this service clean. Please just double‑check that the billingservicesbarrel doesn’t import anything back from@src/deployment/..., to avoid introducing a subtle circular dependency between billing and deployment modules.
Summary by CodeRabbit