fix(onramp): Meld popoup opens without url parameters#4564
Conversation
- Replace AccountController.state.address with ChainController.getAccountProp('address', activeChain)
- Update setSelectedProvider method to properly handle multi-chain architecture
- Update test to mock ChainController.getAccountProp instead of setting AccountController state
- Remove unused AccountController import from OnRampController.ts and test file
Fixes APKT-3118
Co-Authored-By: derek@reown.com <alexanderderekrein@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
10 Skipped Deployments
|
🦋 Changeset detectedLatest commit: a8114b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 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 |
🤖 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:
|
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
- Update onClickProvider to use OnRampController.state.selectedProvider.url instead of provider.url - This ensures popup opens with wallet address and network parameters - Update test to verify parameterized URL is used for popup opening - Addresses GitHub comment about popup bypassing parameterized URL Co-Authored-By: derek@reown.com <alexanderderekrein@gmail.com>
|
@enesozturk I've manually tested this so good for review |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the Meld onramp integration so that wallet addresses and network information are correctly included in the popup URL under a multi-chain setup. Key changes include:
- Switching address lookup to
ChainController.getAccountPropand removing the obsoleteAccountControllerimport. - Updating UI code to open the popup with the fully parameterized URL.
- Adjusting and extending tests to mock and verify the new chain-aware address retrieval.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/controllers/src/controllers/OnRampController.ts | Replaced AccountController with ChainController.getAccountProp and removed unused import. |
| packages/controllers/tests/controllers/OnRampController.test.ts | Updated test to mock ChainController.getAccountProp, verify its call, and restore the spy. |
| packages/scaffold-ui/src/views/w3m-onramp-providers-view/index.ts | Changed openHref call to use state.selectedProvider.url when available. |
| packages/scaffold-ui/test/views/w3m-onramp-providers-view.test.ts | Added a mock state for OnRampController.state to include full URL parameters and verify opening. |
| .changeset/cool-llamas-ask.md | Added a changeset entry for the onramp fix. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Fix Meld onramp integration for multi-chain architecture
Problem
The Meld onramp integration in AppKit was not correctly passing wallet addresses and network information to the Meld interface. The issue was in the
setSelectedProvider()method inOnRampController.ts, which was usingAccountController.state.addressdirectly instead of the proper chain-aware address retrieval approach required by AppKit's multi-chain architecture.Solution
Updated
setSelectedProvidermethod inpackages/controllers/src/controllers/OnRampController.ts:const address = AccountController.state.address ?? ''withconst address = ChainController.getAccountProp('address', activeChain) ?? ''activeChaindefinition:const activeChain = ChainController.state.activeChainAccountControllerimportUpdated test file
packages/controllers/tests/controllers/OnRampController.test.ts:ChainController.getAccountPropmock instead of settingAccountController.state.addressAccountControllerimportTesting
pnpm build)pnpm run prettier:format)Technical Details
This change aligns the Meld onramp integration with AppKit's multi-chain architecture where addresses are managed per-chain through ChainController rather than globally through AccountController. The fix ensures that when users connect their wallet and select the Meld onramp, their wallet address and network information are correctly passed to the Meld interface.
Testing Transparency
What I Actually Checked
ChainController.getAccountPropWhat I Did Not Check
Reviewer Action Items:
Fixes: APKT-3118
Link to Devin run: https://app.devin.ai/sessions/13c21e6719a44926b551afd3a37e6472
Requested by: derek@reown.com