Skip to content

[codex] record wallet connection analytics - #1685

Draft
MuncleUscles wants to merge 2 commits into
v0.121from
codex/wallet-connect-analytics
Draft

[codex] record wallet connection analytics#1685
MuncleUscles wants to merge 2 commits into
v0.121from
codex/wallet-connect-analytics

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Summary

Adds analytics-only wallet connection recording for Studio, keyed by normalized wallet address instead of user accounts.

  • Adds a wallet_connection_analytics table with first/last connection timestamps, connect count, server-observed IP, user agent, and origin metadata.
  • Adds /api/analytics/wallet-connections as a focused FastAPI endpoint that derives IP from trusted proxy handling and does not trust client-supplied IP.
  • Calls the endpoint from the frontend wallet sync path after connect/account changes without blocking wallet UX.
  • Extracts the existing trusted-proxy client IP resolver so rate limiting and analytics use the same behavior.

Privacy / Product Notes

This is analytics-only. The stored wallet address and request metadata are not authentication or identity proof, and wallet addresses can be spoofed by client-side calls. Metadata is limited to IP, user agent, and Origin headers with bounded lengths; no request body beyond the wallet address is collected.

Validation

  • /Users/edgars/Dev/genlayer-studio/.venv/bin/python -m pytest tests/unit/test_wallet_connection_analytics_service.py tests/unit/test_wallet_analytics_router.py tests/unit/test_rate_limit_middleware.py
  • npm run test -- --run test/unit/hooks/useWalletSync.test.ts test/unit/services/walletAnalytics.test.ts
  • /Users/edgars/Dev/genlayer-studio/.venv/bin/python -m black --check backend/protocol_rpc/client_ip.py backend/protocol_rpc/rate_limit_middleware.py backend/protocol_rpc/analytics_router.py backend/services/wallet_connection_analytics_service.py backend/database_handler/models.py tests/unit/test_wallet_connection_analytics_service.py tests/unit/test_wallet_analytics_router.py
  • /Users/edgars/Dev/genlayer-studio/frontend/node_modules/.bin/prettier --check src/hooks/useWalletSync.ts src/services/walletAnalytics.ts test/unit/hooks/useWalletSync.test.ts test/unit/services/walletAnalytics.test.ts

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: df14f563-d1a4-4f6d-9119-ecb95734fe2f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/wallet-connect-analytics

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@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