Skip to content

fix(frontend): remove unsafe non-null assertion on WalletConnect publicKey - #338

Open
VedantMadane wants to merge 1 commit into
Trellis-Ecosystem:masterfrom
VedantMadane:fix/frontend-wallet-non-null-assertion
Open

fix(frontend): remove unsafe non-null assertion on WalletConnect publicKey#338
VedantMadane wants to merge 1 commit into
Trellis-Ecosystem:masterfrom
VedantMadane:fix/frontend-wallet-non-null-assertion

Conversation

@VedantMadane

@VedantMadane VedantMadane commented Aug 26, 2026

Copy link
Copy Markdown

Description

WalletConnect.tsx used publicKey! when rendering the connected wallet UI. If status is connected but publicKey is unexpectedly null/undefined, that assertion would throw at runtime.

This change:

  • Guards on publicKey before truncating/rendering the address
  • Shows an Address unavailable fallback (and still allows Disconnect)
  • Logs a console.warn in dev mode for the edge case
  • Adds unit tests covering connected-with-key, connected-without-key, and disconnected states
  • Bumps frontend patch version 0.1.00.1.1

Related Issues

Fixes #274

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Infrastructure / tooling

Testing Done

cd frontend
npm ci
npx vitest run src/components/WalletConnect.test.tsx
# ✓ 3 tests passed

Pre-existing baseline npm run typecheck / full suite failures are unrelated to this change.

Checklist

  • Code follows the project's style guidelines
  • Tests pass locally (WalletConnect suite)
  • Documentation updated (N/A — internal null-safety fix)
  • No breaking changes without prior notice in the description above

…icKey with proper null handling

Replace publicKey! with a null guard, fallback label, and dev-mode
console.warn so a connected state without a key cannot crash render.

Fixes Trellis-Ecosystem#274

Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>
@VedantMadane
VedantMadane force-pushed the fix/frontend-wallet-non-null-assertion branch from 51b5680 to 5911c20 Compare August 31, 2026 03:27
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.

Fix WalletConnect publicKey Non-Null Assertion That Could Cause Runtime Crash

1 participant