Skip to content

fix(onramp): Meld popoup opens without url parameters#4564

Merged
arein merged 5 commits intomainfrom
devin/APKT-3118-1750782588
Jun 26, 2025
Merged

fix(onramp): Meld popoup opens without url parameters#4564
arein merged 5 commits intomainfrom
devin/APKT-3118-1750782588

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

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 in OnRampController.ts, which was using AccountController.state.address directly instead of the proper chain-aware address retrieval approach required by AppKit's multi-chain architecture.

Solution

  • Updated setSelectedProvider method in packages/controllers/src/controllers/OnRampController.ts:

    • Replaced const address = AccountController.state.address ?? '' with const address = ChainController.getAccountProp('address', activeChain) ?? ''
    • Added proper activeChain definition: const activeChain = ChainController.state.activeChain
    • Removed unused AccountController import
  • Updated test file packages/controllers/tests/controllers/OnRampController.test.ts:

    • Modified the Meld URL configuration test to use ChainController.getAccountProp mock instead of setting AccountController.state.address
    • Added proper verification that the method is called with correct parameters
    • Removed unused AccountController import

Testing

  • ✅ All existing OnRampController tests pass (11/11)
  • ✅ Build completes successfully (pnpm build)
  • ✅ Code formatting passes (pnpm run prettier:format)
  • ✅ Updated test properly mocks the new chain-aware approach

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

  • ✅ Verified the OnRampController tests all pass with the new implementation
  • ✅ Confirmed the build process completes without errors
  • ✅ Ensured code formatting is correct
  • ✅ Validated that the test properly mocks ChainController.getAccountProp
  • ✅ Checked that unused imports were removed

What I Did Not Check

  • ❌ Did not test the actual Meld onramp flow in a running application
  • ❌ Did not verify the integration works with real wallet connections
  • ❌ Did not test across different blockchain networks (EVM vs Solana)

Reviewer Action Items:

  • Please test the Meld onramp integration with actual wallet connections
  • Verify that wallet addresses are correctly pre-filled in the Meld interface
  • Test across different supported networks (Ethereum, Polygon, Solana, etc.)

Fixes: APKT-3118
Link to Devin run: https://app.devin.ai/sessions/13c21e6719a44926b551afd3a37e6472
Requested by: derek@reown.com

- 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>
@vercel
Copy link
Copy Markdown

vercel bot commented Jun 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
appkit-basic-html ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 9:53am
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 9:53am
appkit-laboratory ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 9:53am
10 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-basic-example ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
appkit-basic-sign-client-example ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
appkit-basic-up-example ⬜️ Ignored (Inspect) Visit Preview Jun 26, 2025 9:53am
appkit-ethers5-bera ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
appkit-nansen-demo ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
appkit-vue-solana ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
appkit-wagmi-cdn-example ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
ethereum-provider-wagmi-example ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
next-wagmi-solana-bitcoin-example ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am
vue-wagmi-example ⬜️ Ignored (Inspect) Jun 26, 2025 9:53am

@linear
Copy link
Copy Markdown

linear bot commented Jun 24, 2025

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jun 24, 2025

🦋 Changeset detected

Latest commit: a8114b8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@reown/appkit-controllers Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-ui Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-cdn Patch
@reown/appkit-testing Patch

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-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 24, 2025

Warnings
⚠️

🔑 Potential High‑entropy string detected in packages/controllers/src/controllers/OnRampController.ts (line 50): 0xA0b86991c6218b36c1...

⚠️

🔑 Potential High‑entropy string detected in packages/controllers/src/controllers/OnRampController.ts (line 56): 0x2791Bca1f2de4661ED...

⚠️

🔑 Potential UUID detected in packages/controllers/src/controllers/OnRampController.ts (line 42): 2b92315d-eab7-5bef-8...

Generated by 🚫 dangerJS against a8114b8

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 24, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.74% 30616 / 39378
🔵 Statements 77.74% 30616 / 39378
🔵 Functions 68.6% 2528 / 3685
🔵 Branches 84.38% 6363 / 7540
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/controllers/src/controllers/OnRampController.ts 99.27% 84.84% 80.95% 99.27% 141
packages/scaffold-ui/src/views/w3m-onramp-providers-view/index.ts 92% 63.15% 87.5% 92% 36, 66, 87, 118-119, 122-123, 133
Generated in workflow #12981 for commit a8114b8 by the Vitest Coverage Report Action

@arein
Copy link
Copy Markdown
Contributor

arein commented Jun 24, 2025

The value in "Copy Link" in the Meld modal is correct (https://meldcrypto.com/?publicKey=WXETMuFUQmqqybHuRkSgxv%3A25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU&destinationCurrencyCode=USDC&walletAddress=0x840D2F8a06627E03b0b331c56df61BBd6a11F0AF&externalCustomerId=702e2d45d9debca66795614cddb5c1ca) but the popup just opens with https://meldcrypto.com/. So the bug seems to be that the popup is opened without the URL parameters

Screenshot 2025-06-24 at 6 47 23 PM

- 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>
@arein arein changed the title Fix Meld onramp integration for multi-chain architecture fix(onramp): Meld popoup opens without url parameters Jun 24, 2025
@arein arein requested review from a team and enesozturk June 24, 2025 18:07
@arein
Copy link
Copy Markdown
Contributor

arein commented Jun 24, 2025

@enesozturk I've manually tested this so good for review

@arein arein enabled auto-merge June 25, 2025 08:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.getAccountProp and removing the obsolete AccountController import.
  • 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.

Comment thread packages/controllers/src/controllers/OnRampController.ts Outdated
Comment thread .changeset/cool-llamas-ask.md Outdated
Comment thread packages/controllers/tests/controllers/OnRampController.test.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@arein arein added this pull request to the merge queue Jun 26, 2025
Merged via the queue into main with commit 22f7796 Jun 26, 2025
40 of 41 checks passed
@arein arein deleted the devin/APKT-3118-1750782588 branch June 26, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants