Skip to content

Comments

feat/migrate-to-stellar#260

Open
Franklivania wants to merge 1 commit intoStreamFi-x:devfrom
Franklivania:feat/migrate-to-stellar
Open

feat/migrate-to-stellar#260
Franklivania wants to merge 1 commit intoStreamFi-x:devfrom
Franklivania:feat/migrate-to-stellar

Conversation

@Franklivania
Copy link
Contributor

@Franklivania Franklivania commented Feb 20, 2026

feat: migrate wallet integration from StarkNet to Stellar (#239)

Description

Closes #239

Migrates the entire StreamFi frontend from StarkNet (@starknet-react/core) wallet integration to Stellar (@creit.tech/stellar-wallets-kit, @stellar/freighter-api, @stellar/stellar-sdk).

Introduces a single, globally available Stellar wallet context consumed by all components. No component imports from @starknet-react/core or interacts directly with the Stellar SDK.


Changes Proposed

What were you told to do?

Update Profile Dropdown disconnect logic for Stellar — replace all @starknet-react/core imports across the codebase with a unified Stellar wallet context, starting with profileDropdown.tsx and extending to every file that consumed StarkNet hooks.


What did you do?

1. Created contexts/stellar-wallet-context.tsx

  • Implemented a new Stellar wallet context using @creit.tech/stellar-wallets-kit
  • Used dynamic imports to prevent SSR crashes
  • Exposes:
    StellarWalletProvider
    useStellarWallet()
  • Hook returns:

    {
      isConnected,
      address,
      connect,
      disconnect,
      isLoading
    }
  • Added modalOpenRef guard to prevent double-open errors from the kit’s wallet selection modal


2. Updated components/providers.tsx

  • Removed:

    • StarknetConfig
    • @starknet-react/chains
    • All StarkNet connector setup
  • Replaced with StellarWalletProvider wrapping:

    • ThemeProvider
    • AuthProvider

3. Updated components/ui/profileDropdown.tsx

  • Replaced:

    useAccount
    useDisconnect

    with:

    useStellarWallet()
  • Disconnect menu item now calls disconnect() from Stellar context

  • No UI or layout changes


4. Updated components/auth/auth-provider.tsx

  • Replaced StarkNet hooks with useStellarWallet()

  • Mapped:

    • statusisStellarLoading
    • isConnected
  • Renamed localStorage keys:

    starknet_* → stellar_*
    

5. Rewrote components/connectWallet.tsx

  • Removed StarkNet:

    • useConnect
    • useAccount
    • Connector list UI
  • Delegated wallet selection to Stellar Wallets Kit modal via connect()

  • Added:

    • "No wallet selected" warning
    • Close confirmation dialog
    • Guard against reopening modal while already open

6. Updated components/auth/ProtectedRoute.tsx

  • Replaced useAccount with useStellarWallet()

  • Mapped:

    status === "disconnected"

    to:

    !isConnected && !isStellarLoading
  • Updated localStorage keys to stellar_*


7. Updated components/explore/Navbar.tsx

  • Replaced:

    useAccount
    useDisconnect

    with:

    useStellarWallet()

8. Updated 12 additional files

All files that previously consumed useAccount for address and/or isConnected were migrated to useStellarWallet():

  • components/stream/view-stream.tsx
  • components/explore/ProfileModal.tsx
  • components/explore/quick-actions.tsx
  • components/dashboard/stream-manager/Chat.tsx
  • components/dashboard/stream-manager/StreamPreview.tsx
  • components/dashboard/stream-manager/StreamControls.tsx
  • components/settings/stream-channel-preferences/stream-preference.tsx
  • hooks/useProfileModal.ts
  • app/browse/category/[title]/page.tsx
  • app/browse/live/page.tsx
  • app/dashboard/stream-manager/page.tsx
  • app/explore/page.tsx
  • app/explore/trending/page.tsx
  • app/explore/live/page.tsx

All changes were straight swaps to useStellarWallet().


Notes

  • StarkNet packages were not removed from package.json yet.

  • This will be handled in a follow-up PR after:

    • API routes are migrated
    • Database schema fields (e.g., starknet_address) are updated

Checklist

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit message style matches the requested structure.
  • My code additions will fail neither code linting checks nor unit tests.
  • I am only making changes to files I was requested to.

Screenshots / Videos

Loom video link:
https://www.loom.com/share/40c88338320241a69e046ae58cbe69db


Suggested Commit Message

feat: migrate wallet integration from StarkNet to Stellar

- Create StellarWalletProvider context with dynamic kit imports (SSR-safe)
- Replace all @starknet-react/core usage across 20 files with useStellarWallet()
- Rewrite connectWallet modal to use Stellar Wallets Kit modal flow
- Update auth-provider and ProtectedRoute status logic for Stellar
- Add modal double-open guard and close confirmation UX

Closes #239

@vercel
Copy link

vercel bot commented Feb 20, 2026

@Franklivania is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@davedumto davedumto left a comment

Choose a reason for hiding this comment

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

Review — Changes Requested

The stellar-wallet-context.tsx implementation looks solid and the profileDropdown.tsx change is correct. However, there's a critical bug and several scope concerns.


1. Critical Bug — Provider ordering in providers.tsx

<AuthProvider>
  <StellarWalletProvider>{children}</StellarWalletProvider>
</AuthProvider>

AuthProvider calls useStellarWallet() internally, but it's outside StellarWalletProvider — so it will only ever see the default context values (isConnected: false, address: null). The wallet context will never reach AuthProvider.

Fix: Swap the ordering so StellarWalletProvider wraps AuthProvider:

<StellarWalletProvider>
  <AuthProvider>{children}</AuthProvider>
</StellarWalletProvider>

This is a blocker — nothing will work without this fix.


2. Scope — Issue #239 asks for 1 file, PR touches 23

Issue #239 specifically scopes to components/ui/profileDropdown.tsx. This PR migrates the entire frontend from StarkNet to Stellar — auth-provider.tsx, ProtectedRoute.tsx, connectWallet.tsx, providers.tsx, and 12+ page/component files.

Creating stellar-wallet-context.tsx is a valid prerequisite — but the full migration across all files should either reference a broader umbrella issue or be split into focused PRs. This makes review harder and increases merge conflict risk with other contributors.


3. Breaking change in useProfileModal.ts

The refreshUser parameter was removed from the function signature:

- onNextStep: (step: "profile" | "verify" | "success") => void,
- refreshUser?: () => Promise<any>
+ onNextStep: (step: "profile" | "verify" | "success") => void

If any caller passes refreshUser, it will silently be ignored. Please verify no callers depend on this, or keep the parameter.


4. Error message leaks internals in useProfileModal.ts

- setRegistrationError("An unexpected error occurred");
+ setRegistrationError(`An unexpected error occurred: ${error}`);

This exposes raw error objects to users. Keep the generic message for the UI and log the details to console instead:

console.error("Registration error:", error);
setRegistrationError("An unexpected error occurred");

5. Unrelated .gitignore change

Adding bun.lock to .gitignore is not related to #239. Please revert or move to a separate commit.


TL;DR: Fix the provider ordering (item 1) — that's a blocker. Address items 3–5, and consider scoping the PR down to match issue #239 or referencing the correct umbrella issue.

@davedumto
Copy link
Contributor

Clarification on the provider ordering (item 1 from review)

To expand on why this is a blocker — this is about React context tree mechanics, not about auth flow.

AuthProvider internally calls useStellarWallet() to read address, isConnected, isStellarLoading, and disconnect. For useStellarWallet() to return real values, the component calling it must be a descendant of StellarWalletProvider in the React tree.

Current ordering (broken):

AuthProvider              ← useStellarWallet() here only sees defaults (null, false)
  └─ StellarWalletProvider  ← real wallet state lives here, but AuthProvider is above it
       └─ children

AuthProvider will always see isConnected: false and address: null — it can never detect a wallet connection.

Correct ordering:

StellarWalletProvider       ← wallet state available from here down
  └─ AuthProvider           ← useStellarWallet() now returns real values
       └─ children

This doesn't change the auth flow at all. StellarWalletProvider only exposes connection state — it doesn't gate anything. AuthProvider still controls authentication. The wallet provider just needs to be higher in the tree so AuthProvider can read from it.

@davedumto
Copy link
Contributor

@Franklivania also fix the conflicts too

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.

Update Profile Dropdown disconnect logic for Stellar

2 participants