Skip to content

Comments

feat: support custom wagmi connectors in WagmiAdapter#530

Merged
ignaciosantise merged 2 commits intodevelopfrom
custom-connectors
Feb 12, 2026
Merged

feat: support custom wagmi connectors in WagmiAdapter#530
ignaciosantise merged 2 commits intodevelopfrom
custom-connectors

Conversation

@ignaciosantise
Copy link
Collaborator

@ignaciosantise ignaciosantise commented Feb 12, 2026

Summary

Enables users to pass custom Wagmi connectors when initializing the WagmiAdapter. This change removes the redundant connectors?: Connector[] override from ConfigParams and instead uses wagmi's native CreateConnectorFn[] type, allowing developers to customize connector configuration while maintaining backward compatibility.

Changes

  • Removed explicit connectors type override from ConfigParams
  • Updated connector configuration to pass through user-provided connectors
  • Falls back to empty array when no custom connectors are provided
  • Fixes type inconsistency (was incorrectly typed as Connector[] instead of factory functions)

Closes

#529


Note

Low Risk
Small config wiring/type-surface change limited to connector initialization; main risk is unexpected connector ordering/behavior differences for consumers providing custom connectors.

Overview
WagmiAdapter now forwards any user-provided wagmi connectors from ConfigParams into createConfig, instead of always initializing with an empty connector list.

Adds a changeset for @reown/appkit-wagmi-react-native and removes the prior security-vulnerability changeset entry.

Written by Cursor Bugbot for commit 3bd49d8. This will update automatically on new commits. Configure here.

Enables users to pass custom Wagmi connectors when initializing the WagmiAdapter. Removes the redundant connectors override from ConfigParams to use wagmi's native CreateConnectorFn[] type. Users can now provide custom connector factories via the config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 12, 2026 17:28
@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 3bd49d8

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

This PR includes changesets to release 1 package
Name Type
@reown/appkit-wagmi-react-native 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

@claude
Copy link

claude bot commented Feb 12, 2026

Claude finished @ignaciosantise's task —— View job


PR Review Complete ✅

Reviewed PR: feat: support custom wagmi connectors in WagmiAdapter

Todo List:

  • Read changed files to understand modifications
  • Analyze type safety and correctness
  • Check backward compatibility
  • Review security implications
  • Assess test coverage needs
  • Provide review feedback

Review Feedback

Issues Found

1. Type Inconsistency in Implementation (packages/wagmi/src/adapter.ts:56)

The change correctly passes through user-provided connectors, but there's a subtle type mismatch:

connectors: [...(configParams.connectors ?? [])]

The issue is that configParams extends Partial<CreateConfigParameters>, which means configParams.connectors should be CreateConnectorFn[] (factory functions), not Connector[] instances. The spread operator [...] is unnecessary here since configParams.connectors is already an array.

Recommendation:

connectors: configParams.connectors ?? []

The spread operator adds no value and could cause confusion. If connectors is undefined, use an empty array; if defined, pass it through directly.

2. Missing Documentation

The PR removes explicit type override but doesn't document the new capability. Users need to know:

  • That they can now pass custom connectors
  • The correct type to use (CreateConnectorFn[] from wagmi)
  • How these interact with the internal UniversalConnector

Recommendation: Add JSDoc comments to the ConfigParams type explaining connector usage:

type ConfigParams = Partial<CreateConfigParameters> & {
  networks: readonly [Chain, ...Chain[]];
  projectId: string;
  /** 
   * Optional custom Wagmi connector factory functions.
   * These will be added to the Wagmi config alongside the internal UniversalConnector.
   * @example
   * const adapter = new WagmiAdapter({
   *   projectId,
   *   networks,
   *   connectors: [injected(), walletConnect({ projectId })]
   * });
   */
};

3. Potential Connector Collision (packages/wagmi/src/adapter.ts:164-169)

The adapter dynamically adds the UniversalConnector in the init method after config creation. If users provide their own connectors with conflicting IDs or functionality, there could be unexpected behavior.

Recommendation: Document this behavior or add validation to warn about potential conflicts.

4. Changeset Scope Mismatch (.changeset/fix-security-vulnerabilities.md)

This changeset appears to be unrelated to the PR's stated purpose (custom connectors). Including security fixes in a feature PR makes it harder to:

  • Track what changed for which reason
  • Cherry-pick fixes to release branches
  • Understand the scope of changes

Recommendation: Split security fixes into a separate PR for cleaner history and easier maintenance.


Positive Observations (Not Issues)

  • ✅ Backward compatible: Falls back to empty array when no connectors provided
  • ✅ Type safety improved: Removes incorrect Connector[] override
  • ✅ Aligns with Wagmi conventions: Uses native CreateConnectorFn[] type
  • ✅ Existing usage preserved: Both example apps continue working without changes

Summary

The core change is sound and improves type correctness. Main concerns:

  1. Remove unnecessary spread operator in connector assignment
  2. Add documentation for the new capability
  3. Consider warning about connector ID conflicts
  4. Split unrelated security changeset into separate PR

Copy link

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

Enables passing Wagmi-native custom connector factory functions into WagmiAdapter so consumers can customize connector configuration while keeping the adapter’s existing “programmatic connect” flow intact.

Changes:

  • Removes the incorrect connectors?: Connector[] override from ConfigParams and relies on CreateConfigParameters’ native connectors type.
  • Passes through user-provided connectors into createConfig, defaulting to an empty array when unspecified.
  • Adds a changeset entry documenting the new capability (and a minor formatting tweak in an existing security changeset).

Reviewed changes

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

File Description
packages/wagmi/src/adapter.ts Accepts Wagmi connector factory functions via configParams.connectors and forwards them to createConfig.
.changeset/fix-security-vulnerabilities.md Minor Markdown formatting adjustment (blank line before list).
.changeset/custom-wagmi-connectors.md Adds a changeset documenting support for custom Wagmi connectors in WagmiAdapter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The security fixes in PR #522 only affected resolutions/overrides in the
root package.json and sample app — no SDK source code changed, so bumping
all 9 published packages is not needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

@ignaciosantise ignaciosantise merged commit c032ff9 into develop Feb 12, 2026
11 checks passed
@ignaciosantise ignaciosantise deleted the custom-connectors branch February 12, 2026 19:59
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant