Skip to content

Conversation

@arein
Copy link
Contributor

@arein arein commented Oct 4, 2025

Defers Coinbase SDK initialization until user explicitly connects, reducing bundle size and improving initial load performance across all adapters. Improves UX/privacy as it removes ~3 HTTP calls to Coinbase.

Changes:

  • ethers & ethers5: Extract getCoinbaseProvider as lazy class method, store options reference, instantiate SDK only on connect
  • wagmi: Skip getProvider() call during connector setup for Coinbase, resolve lazily in connect flow
  • Add security scanning utility script

Description

Please include a brief summary of the change.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-xxx
For GH issues: closes #...

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

arein and others added 2 commits October 4, 2025 09:40
Defers Coinbase SDK initialization until user explicitly connects, reducing bundle size and improving initial load performance across all EVM adapters.

Changes:
- ethers & ethers5: Extract getCoinbaseProvider as lazy class method, store options reference, instantiate SDK only on connect
- wagmi: Skip getProvider() call during connector setup for Coinbase, resolve lazily in connect flow
- Add security scanning utility script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@Copilot Copilot AI review requested due to automatic review settings October 4, 2025 05:42
@changeset-bot
Copy link

changeset-bot bot commented Oct 4, 2025

🦋 Changeset detected

Latest commit: 3c080bd

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

This PR includes changesets to release 25 packages
Name Type
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-wagmi Patch
pay-test-exchange Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-solana Patch
@reown/appkit Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch
@reown/appkit-common Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-testing Patch
@reown/appkit-ui Patch
@reown/appkit-universal-connector Patch
@reown/appkit-wallet Patch
@reown/appkit-wallet-button 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

@vercel
Copy link

vercel bot commented Oct 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Oct 4, 2025 6:04am
appkit-demo Ready Ready Preview Comment Oct 4, 2025 6:04am
appkit-gallery Ready Ready Preview Comment Oct 4, 2025 6:04am
appkit-laboratory Ready Ready Preview Comment Oct 4, 2025 6:04am
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Oct 4, 2025 6:04am
appkit-basic-sign-client-example Ignored Ignored Oct 4, 2025 6:04am
appkit-basic-up-example Ignored Ignored Oct 4, 2025 6:04am
appkit-ethers5-bera Ignored Ignored Oct 4, 2025 6:04am
appkit-nansen-demo Ignored Ignored Oct 4, 2025 6:04am
appkit-vue-solana Ignored Ignored Oct 4, 2025 6:04am
appkit-wagmi-cdn-example Ignored Ignored Oct 4, 2025 6:04am
ethereum-provider-wagmi-example Ignored Ignored Oct 4, 2025 6:04am
next-wagmi-solana-bitcoin-example Ignored Ignored Oct 4, 2025 6:04am
vue-wagmi-example Ignored Ignored Oct 4, 2025 6:04am

Copy link
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 pull request implements lazy-loading for the Coinbase Wallet SDK to reduce initial bundle size and improve load performance. The change defers SDK initialization until the user explicitly connects to Coinbase wallet.

  • Extracted Coinbase provider initialization into lazy class methods across ethers and ethers5 adapters
  • Modified wagmi adapter to skip getProvider() calls during setup for Coinbase connectors
  • Updated connection flow to resolve Coinbase provider only when needed

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/adapters/wagmi/src/client.ts Skip getProvider() during Coinbase connector setup, resolve lazily in connect flow
packages/adapters/ethers5/src/client.ts Extract getCoinbaseProviderLazy method and defer SDK initialization until connect
packages/adapters/ethers/src/client.ts Extract getCoinbaseProviderLazy method and defer SDK initialization until connect

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +126 to +127
// Register Coinbase connector without instantiating SDK yet (lazy-load on connect)
providers.coinbase = undefined
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Setting providers.coinbase to undefined may cause issues downstream. Consider using a placeholder object or lazy provider wrapper instead of undefined to maintain consistent provider interface expectations.

Suggested change
// Register Coinbase connector without instantiating SDK yet (lazy-load on connect)
providers.coinbase = undefined
// Register Coinbase connector with a lazy provider wrapper (lazy-load on connect)
providers.coinbase = {
getProvider: () => this.getCoinbaseProviderLazy()
}

Copilot uses AI. Check for mistakes.
Comment on lines +124 to +125
// Register Coinbase connector without instantiating SDK yet (lazy-load on connect)
providers.coinbase = undefined
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Setting providers.coinbase to undefined may cause issues downstream. Consider using a placeholder object or lazy provider wrapper instead of undefined to maintain consistent provider interface expectations.

Suggested change
// Register Coinbase connector without instantiating SDK yet (lazy-load on connect)
providers.coinbase = undefined
// Register Coinbase connector with a lazy provider getter function
providers.coinbase = this.getCoinbaseProviderLazy.bind(this)

Copilot uses AI. Check for mistakes.
Comment on lines +467 to +469
// Persist on the connector so listeners work normally
// eslint-disable-next-line no-param-reassign
connector.provider = selectedProvider
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Directly mutating the connector parameter violates immutability principles. Consider using a more functional approach or documenting why this mutation is necessary for the architecture.

Suggested change
// Persist on the connector so listeners work normally
// eslint-disable-next-line no-param-reassign
connector.provider = selectedProvider
// Create a new connector object with the updated provider to preserve immutability
connector = { ...connector, provider: selectedProvider }

Copilot uses AI. Check for mistakes.
Comment on lines +466 to +467
// eslint-disable-next-line no-param-reassign
connector.provider = selectedProvider
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Directly mutating the connector parameter violates immutability principles. Consider using a more functional approach or documenting why this mutation is necessary for the architecture.

Suggested change
// eslint-disable-next-line no-param-reassign
connector.provider = selectedProvider
// Use a new connector object to preserve immutability
const updatedConnector = { ...connector, provider: selectedProvider }
connector = updatedConnector

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.77% 36524 / 45785
🔵 Statements 79.77% 36524 / 45785
🔵 Functions 78.31% 4017 / 5129
🔵 Branches 86.58% 8809 / 10174
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/ethers/src/client.ts 61.36% 72.03% 65.71% 61.36% 50-75, 85-86, 89-90, 97-99, 153-154, 167-168, 191-192, 206-229, 242-278, 285-286, 293-310, 378-400, 403-408, 421-422, 432-453, 460-461, 463-469, 472-473, 498, 527-528, 537-538, 566-571, 590-636, 643-644, 666, 695-696, 707-708, 742-743, 747, 774-779, 788-806, 812-813, 822-823, 834-835, 841-853
packages/adapters/ethers5/src/client.ts 55.17% 69.6% 60% 55.17% 51-76, 82-139, 155-156, 169-170, 193-194, 208-231, 244-280, 287-288, 295-312, 380-402, 405-410, 423-424, 434-455, 462-463, 465-471, 474-475, 500, 529-530, 539-540, 568-573, 577-623, 645-646, 668, 697-698, 710-711, 748-749, 753, 772-786, 794-812, 818-819, 828-829, 840-841, 847-859
packages/adapters/wagmi/src/client.ts 75.64% 64.59% 80.95% 75.64% 122-123, 128-129, 140-142, 144, 206-207, 247-250, 351-352, 366, 386-387, 462-463, 474-475, 514-515, 532-533, 547-564, 584-585, 598-607, 618-619, 623-624, 629-661, 673-692, 696-702, 705-716, 725-726, 737-738, 759-761, 775-776, 789-790, 805-806, 855-856, 869-870, 878-879, 884-885, 892-893, 901-902, 907-908, 917-918, 926-927, 932-933, 939-961, 964-977
Generated in workflow #15548 for commit 3c080bd by the Vitest Coverage Report Action

@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2025

Warnings
⚠️

🔑 Potential UUID detected in packages/adapters/ethers/src/tests/client.test.ts (line 979): ba0ba0cd-17c6-4806-a...

Generated by 🚫 dangerJS against 3c080bd

@arein
Copy link
Contributor Author

arein commented Oct 4, 2025

@claude review

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.

1 participant