Skip to content

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

Open
davedumto wants to merge 1 commit 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 1 commit 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, enabling connections across mainnet and Sepolia networks.
    • Enhanced wallet selection with automatic discovery of injected connectors and prioritized recommendations for improved user onboarding.

Review Change Stack

…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

📝 Walkthrough

Walkthrough

This PR integrates Cartridge wallet support into the application's wallet provider. Cartridge connector and controller dependencies are added, then a configured Cartridge connector instance is combined with auto-discovered injected Starknet wallets (Argent and Braavos) into a single memoized connectors list wired into 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.
Cartridge connector configuration and integration
src/providers/wallet-provider.tsx
Module-scoped Cartridge connector is configured with mainnet and sepolia RPC endpoints and defaultChainId. WalletProvider imports updated to include useMemo and wallet helper functions. Injected connectors are auto-discovered with argent and braavos as recommended and always included; a memoized combined connectors array appends the Cartridge connector after injected connectors. StarknetConfig JSX uses the new combined connectors while maintaining existing chains, provider, and explorer configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A rabbit hops through wallets wide,
Cartridge joins the treasure trove!
Connectors dance side by side,
Users choose, the wallets move. 🪙✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR addresses core requirements: integrates Cartridge connector, auto-discovers injected wallets, and maintains existing functionality. Verify that live Cartridge login/transaction flows work correctly and confirm a demo (loom/video) has been provided for PR verification as required.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly aligns with the main changes: adding Cartridge support and auto-discovering all installed Starknet wallets.
Out of Scope Changes check ✅ Passed All changes are scoped to adding Cartridge support and surfacing injected wallets; no unrelated modifications 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

const { connectors: injectedConnectors } = useInjectedConnectors({
recommended: [argent(), braavos()],
includeRecommended: "always",
order: "random",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚖️ Poor tradeoff

Random order will cause hydration mismatches in SSR.

The order: "random" option produces different connector sequences on each execution. In Next.js App Router with SSR:

  1. Server render generates one random order
  2. Client hydration generates a different random order
  3. React detects mismatch and logs hydration warnings
  4. UI flashes as React corrects the DOM

Use order: "alphabetical" or order: "recommended" for deterministic ordering, or implement client-only randomization after initial hydration.

♻️ Suggested fix for deterministic ordering
   const { connectors: injectedConnectors } = useInjectedConnectors({
     recommended: [argent(), braavos()],
     includeRecommended: "always",
-    order: "random",
+    order: "alphabetical",
   });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
order: "random",
const { connectors: injectedConnectors } = useInjectedConnectors({
recommended: [argent(), braavos()],
includeRecommended: "always",
order: "alphabetical",
});
🤖 Prompt for 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.

In `@src/providers/wallet-provider.tsx` at 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.

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