wallets: throw error for testnet in prod, auto-convert mainnet in staging#1584
Merged
albertoelias-crossmint merged 5 commits intomainfrom Feb 24, 2026
Merged
Conversation
…net in staging Co-Authored-By: Alberto Elias <alberto.elias@paella.dev>
Contributor
Original prompt from Alberto Elias |
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 35985ba The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Alberto Elias <alberto.elias@paella.dev>
Contributor
🔥 Smoke Test Results✅ Status: Passed Statistics
✅ All smoke tests passed!All critical flows are working correctly. This is a non-blocking smoke test. Full regression tests run separately. |
Co-Authored-By: Alberto Elias <alberto.elias@paella.dev>
Contributor
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/wallets/src/wallets/wallet-factory.test.ts
Line: 656
Comment:
tests spy on `warn` but implementation uses `debug` on lines 419 and 427 of wallet-factory.ts
```suggestion
warnSpy = vi.spyOn(walletsLogger, "debug");
```
How can I resolve this? If you propose a fix, please make it concise. |
Co-Authored-By: Alberto Elias <alberto.elias@paella.dev>
Co-Authored-By: Alberto Elias <alberto.elias@paella.dev>
guilleasz-crossmint
approved these changes
Feb 24, 2026
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
Upgrades chain environment validation from warning-only to enforcing behavior:
InvalidEnvironmentErrorinstead of logging a warning. This is a breaking change for any consumers currently passing testnet chains with production API keys.MAINNET_TO_TESTNET_MAP(15 chains mapped). Logs a warning about the conversion. If no testnet mapping exists, falls back to a warning without conversion.validateChainEnvironmentnow returns the (potentially converted) chain, and all three callers (getOrCreateWallet,getWallet,createWallet) apply the returned value.Things for reviewer to verify
return testnetEquivalent as unknown as C— the genericCwill still reflect the original mainnet type at the call site even though the runtime value is now a testnet chain. Confirm this doesn't cause issues downstream.ethereumis absent — confirm it's not inPRODUCTION_AA_CHAINS).Test plan
InvalidEnvironmentErrorthrown; mainnet-in-staging/dev tests expect auto-conversion with warning log; new test for mainnet with no testnet equivalent (arbitrumnova)biome check)Package updates
Changeset still needs to be added via
pnpm change:add.Link to Devin run | Requested by @albertoelias-crossmint