Skip to content

Add WalletConnect logger option#558

Draft
ignaciosantise wants to merge 2 commits into
developfrom
disable-walletconnect-core-logs
Draft

Add WalletConnect logger option#558
ignaciosantise wants to merge 2 commits into
developfrom
disable-walletconnect-core-logs

Conversation

@ignaciosantise
Copy link
Copy Markdown
Collaborator

This adds a logger option to createAppKit and forwards it through connector initialization into @walletconnect/universal-provider, with a changeset for the release.
The public types now accept WalletConnect logger levels including fatal or a pino-compatible logger shape instead of a generic object, so consumers can disable WalletConnect core logs without passing invalid logger values.
This gives SDK integrators explicit control over WalletConnect logging while preserving the default behavior when logger is omitted.
Validation: yarn format, yarn lint, and yarn test.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

🦋 Changeset detected

Latest commit: e5bd7ae

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

This PR includes changesets to release 9 packages
Name Type
@reown/appkit-bitcoin-react-native Patch
@reown/appkit-coinbase-react-native Patch
@reown/appkit-common-react-native Patch
@reown/appkit-core-react-native Patch
@reown/appkit-ethers-react-native Patch
@reown/appkit-solana-react-native Patch
@reown/appkit-ui-react-native Patch
@reown/appkit-wagmi-react-native Patch
@reown/appkit-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
Copy Markdown

claude Bot commented May 15, 2026

Claude finished @ignaciosantise's task in 2m 4s —— View job


PR Review

  • Gather context
  • Read changed files
  • Run data classification subagent — no issues found
  • Run breaking changes subagent — no issues found
  • Post consolidated review

Found 2 issue(s)

Issue 1: Type duplication — WalletConnectLoggerLevel and WalletConnectLogger redefined locally instead of imported

ID: types-logger-type-duplication-a3f1
File: packages/appkit/src/types.ts:16-26
Severity: MEDIUM
Category: code_quality

Context:

  • Pattern: WalletConnectLoggerLevel (line 16) and WalletConnectLogger (lines 18–26) are defined as local private types in types.ts, byte-for-byte copies of the types exported from packages/common/src/types/wallet/connector.ts (lines 35–53), which are re-exported through the @reown/appkit-common-react-native package already imported at the top of types.ts.
  • Risk: Two canonical definitions of the same type in the same repo. If one is updated (e.g., a new log level added to WalletConnectLoggerLevel), the other silently falls out of sync without a compile error, because the local types in types.ts are private and not structurally checked against the exported ones.
  • Impact: Silent drift between the public API type (AppKitConfig.logger) and the internal connector type (ConnectorInitOptions.logger), leading to consumers being able to pass values that the connector rejects at runtime.
  • Trigger: Any future change to WalletConnectLoggerLevel or WalletConnectLogger in connector.ts that isn't mirrored in types.ts.

Recommendation: Import from common instead of redefining:

import {
  // ...existing imports...
  type WalletConnectLoggerLevel,
  type WalletConnectLogger,
} from '@reown/appkit-common-react-native';

Fix this →


Issue 2: Unsafe type cast bridges structural mismatch silently

ID: wc-connector-logger-cast-b2e7
File: packages/appkit/src/connectors/WalletConnectConnector.ts:37
Severity: LOW
Category: code_quality

Context:

  • Pattern: ops.logger as UniversalProviderOpts['logger'] asserts the custom WalletConnectLogger shape into WalletConnect's internal logger type without structural verification. UniversalProviderOpts['logger'] is pino's Logger, which has additional members beyond the subset defined in WalletConnectLogger (e.g., level, silent, levelVal, isLevelEnabled, serializers, etc.).
  • Risk: A consumer passing a minimal custom logger object (matching only WalletConnectLogger) will pass TypeScript compilation but may cause a runtime error if WalletConnect internally accesses pino-specific fields like .level or .isLevelEnabled.
  • Impact: Runtime crash or silent no-op when a consumer passes a custom logger object and WalletConnect tries to introspect it.
  • Trigger: Consumer passes a custom logger object (not a string level); WalletConnect internally reads pino-specific fields on it.

Recommendation: Narrow the cast or validate at the boundary:

// Option A: use `unknown` cast chain to make the assertion explicit
logger: ops.logger as unknown as UniversalProviderOpts['logger']

// Option B: accept only string levels for now if full pino Logger is too broad for the type
logger?: WalletConnectLoggerLevel  // drop custom logger object support until types align

@ignaciosantise ignaciosantise changed the title [codex] Add WalletConnect logger option Add WalletConnect logger option May 15, 2026
@sonarqubecloud
Copy link
Copy Markdown

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