Skip to content

feat(wallet): add Cartridge support and surface all installed Starknet wallets#53

Open
davedumto wants to merge 2 commits into
Fundable-Protocol:mainfrom
davedumto:feat/cartridge-wallet-support
Open

feat(wallet): add Cartridge support and surface all installed Starknet wallets#53
davedumto wants to merge 2 commits into
Fundable-Protocol:mainfrom
davedumto:feat/cartridge-wallet-support

Conversation

@davedumto
Copy link
Copy Markdown

@davedumto davedumto commented May 30, 2026

Summary

Adds Cartridge wallet support to the Starknet wallet picker and ensures every wallet the user has installed (Argent X, Braavos, and any other get-starknet-compatible browser wallet) shows up in the connect modal, not just a hard-coded subset.

Closes #34

Changes

  • src/providers/wallet-provider.tsx
    • Wire in ControllerConnector from @cartridge/connector/controller, configured once at module scope (so it isn't re-instantiated on every render).
    • Keep useInjectedConnectors so the picker continues to auto-discover every installed Starknet wallet, with argent() and braavos() marked includeRecommended: "always" so they still surface even when the user hasn't installed them yet.
    • Merge the injected connectors with the Cartridge connector via a useMemo so the array identity is stable across renders.
  • package.json + lockfiles
    • Add @cartridge/connector and @cartridge/controller pinned to 0.8.0. (Newer 0.9.x / 0.10.x+ releases declare a peer dep on @starknet-react/core@4.x beta; this project is on ^3.7.2, so 0.8.0 is the latest version that's peer-compatible.)
    • Both pnpm-lock.yaml and package-lock.json are updated since both are tracked on main.

Why this approach

The previous attempt (#50) replaced the dynamic useInjectedConnectors discovery with a hard-coded [argent(), braavos(), injected({ id: "injected" }), controller] list. That works for the named wallets but loses auto-discovery of every other Starknet wallet the user might have installed - which is exactly what the issue asks for. Keeping useInjectedConnectors and appending Cartridge satisfies both requirements with the smallest surface-area change.

Testing notes

  • Local next build compiles successfully; it only fails on a pre-existing @typescript-eslint/no-explicit-any error in src/components/molecules/LineChart.tsx that is already red on main (unrelated to this PR).
  • pnpm install resolves cleanly; remaining peer warnings (starknetkit -> @argent/x-ui, react-native, etc.) are pre-existing on main.
  • I cannot exercise a live Cartridge controller login from this machine, so behavioral verification of the Cartridge tile in the picker is best done by a reviewer who can run the dev server.

Checklist

  • Cartridge wallet is selectable from the connect modal
  • All installed injected Starknet wallets continue to appear
  • No changes to existing connect/disconnect flow (ConnectWalletButton, setWalletState)
  • No new lint errors introduced

Summary by CodeRabbit

  • New Features

    • Added Cartridge wallet connector support for Mainnet and Sepolia and integrated it into the wallet selector.
    • Automatic discovery of injected wallets with prioritized recommendations for smoother onboarding.
  • Chores

    • Included updated connector packages to enable the new Cartridge integration.

…t wallets

Integrate the Cartridge ControllerConnector alongside the existing
useInjectedConnectors discovery so the wallet picker lists every
Starknet wallet the user has installed (Argent X, Braavos, and any
other get-starknet-compatible wallet) in addition to Cartridge.

- Add @cartridge/connector and @cartridge/controller as dependencies
  (pinned to 0.8.0 for compatibility with @starknet-react/core 3.7.x).
- Configure ControllerConnector once at module scope to avoid
  re-instantiation on every render.
- Mark argent() and braavos() as recommended so they still surface
  prominently in the starknetkit picker even when not yet installed.

Closes Fundable-Protocol#34
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

@davedumto is attempting to deploy a commit to the Fundable Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dc81e1e7-83a4-445c-a128-29185c483716

📥 Commits

Reviewing files that changed from the base of the PR and between 3bc2416 and f74f726.

📒 Files selected for processing (1)
  • src/providers/wallet-provider.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/providers/wallet-provider.tsx

📝 Walkthrough

Walkthrough

Adds Cartridge connector dependencies and configures a module-scoped Cartridge ControllerConnector; WalletProvider now auto-discovers injected Starknet connectors (Argent, Braavos), appends the Cartridge connector, memoizes the list, and passes it to StarknetConfig.

Changes

Cartridge Wallet Integration

Layer / File(s) Summary
Cartridge dependencies
package.json
@cartridge/connector and @cartridge/controller version 0.8.0 are added to runtime dependencies.
WalletProvider imports, Cartridge connector, and connectors wiring
src/providers/wallet-provider.tsx
Adds "use client" and useMemo import; adds argent, braavos, and useInjectedConnectors; creates a module-scoped ControllerConnector with mainnet and sepolia RPC endpoints and defaultChainId; auto-discovers injected connectors with recommended Argent and Braavos (always included) ordered alphabetically; memoizes connectors as injected connectors plus the Cartridge connector and passes them into StarknetConfig while keeping existing chains/provider/explorer.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I found a new Cartridge by the stream,
connectors glowing like a dream.
Argent, Braavos, and Cartridge in line,
users pick, the balances shine.
hop—connect—transactions hum in time.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR successfully integrates Cartridge wallet support via ControllerConnector and auto-discovers all injected Starknet wallets. However, linked issue #34 explicitly requires a demo (loom/video) for PR verification, which is not evident in the PR summary. Provide a loom URL or video demonstrating the wallet connect flow showing Cartridge integration and all discovered wallets as required by issue #34.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding Cartridge wallet support and auto-discovering all installed Starknet wallets instead of using a hard-coded subset.
Out of Scope Changes check ✅ Passed All code changes are directly related to the PR objectives: adding Cartridge support, auto-discovering injected wallets, and fixing SSR hydration via alphabetical ordering. No unrelated changes detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/providers/wallet-provider.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/providers/wallet-provider.tsx`:
- Line 35: The non-deterministic setting order: "random" in the connectors
configuration (in the WalletProvider / connectors setup) causes SSR hydration
mismatches; change order to a deterministic value such as "alphabetical" or
"recommended" (e.g., order: "alphabetical") in the connectors/options object, or
move any randomization to run only on the client after hydration (e.g., perform
random shuffle in a useEffect and update the client-only state), ensuring the
initial server-rendered order matches the client during hydration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f2d9d4a0-42d3-4cd3-b97d-3434355cfbfa

📥 Commits

Reviewing files that changed from the base of the PR and between f8f1f34 and 3bc2416.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • src/providers/wallet-provider.tsx

Comment thread src/providers/wallet-provider.tsx Outdated
…n mismatch

order: "random" produces different connector sequences on server vs. client,
causing React hydration warnings and UI flash. Switched to "alphabetical" for
a deterministic, SSR-safe order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Feat: Add Cartridge Wallet Support and Display All Supported Wallets

1 participant