Skip to content

feat: implement wallet session management - #166

Merged
ibrahimmosouf-png merged 4 commits into
OrbitChainLabs:mainfrom
cristianFleita:feat/wallet-session-management
Jul 23, 2026
Merged

feat: implement wallet session management#166
ibrahimmosouf-png merged 4 commits into
OrbitChainLabs:mainfrom
cristianFleita:feat/wallet-session-management

Conversation

@cristianFleita

@cristianFleita cristianFleita commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds persistent wallet session management to the wallet-connect demo, including Freighter connection, verified auto-reconnection, manual fallback, and disconnect lifecycle handling.

Related Issues

Closes #143

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Tests / tooling

Changes

  • Persist the connected public key and wallet source in localStorage.
  • Load the official Freighter browser API (6.0.1).
  • Open Freighter authorization instead of incorrectly falling back to manual input.
  • Re-fetch the current Freighter public key when restoring a session.
  • Show Reconnect Wallet when a previous session cannot be restored automatically.
  • Require explicit reconnection for manually entered addresses.
  • Clear persisted session data on disconnect.
  • Emit lifecycle events:
    • wallet:connected
    • wallet:reconnected
    • wallet:disconnected
  • Move wallet logic from inline HTML into wallet_connect.js.
  • Add an accessible live status region.
  • Add dependency-free Node.js regression tests.

Security

Only public wallet information is persisted:

{
  "publicKey": "G...",
  "source": "freighter"
}

Secret keys and signing credentials are never requested or stored.

Testing

  • Freighter authorization popup opens.
  • Connected public key is persisted.
  • Reload automatically reconnects and re-fetches the current Freighter address.
  • Manual sessions display Reconnect Wallet after reload.
  • Disconnect removes the persisted session.
  • Connect, reconnect, and disconnect events are emitted.
  • JavaScript syntax validation passes.
node --test wallet_connect.test.js

Copy link
Copy Markdown
Contributor

Thanks for picking up wallet session management — this has been a long-awaited feature and the PR structure looks solid. 🙌

CI is showing some test failures right now. New session lifecycle code often interacts with existing connection, authorization, or re-entrancy tests in unexpected ways, so it's usually one of those.

Could you:

  1. Run the failing tests locally with cargo test -p orbitchain-tools (and any other workspace member they touch).
  2. Update the relevant assertions to reflect the new session states, or add new tests for the session lifecycle (start / refresh / expire / revoke).
  3. Push the fixes and CI should turn green.

If you want a second pair of eyes on any of the failing cases, paste the output here and I'll jump in.

@cristianFleita

Copy link
Copy Markdown
Contributor Author

Thanks for picking up wallet session management — this has been a long-awaited feature and the PR structure looks solid. 🙌

CI is showing some test failures right now. New session lifecycle code often interacts with existing connection, authorization, or re-entrancy tests in unexpected ways, so it's usually one of those.

Could you:

  1. Run the failing tests locally with cargo test -p orbitchain-tools (and any other workspace member they touch).
  2. Update the relevant assertions to reflect the new session states, or add new tests for the session lifecycle (start / refresh / expire / revoke).
  3. Push the fixes and CI should turn green.

If you want a second pair of eyes on any of the failing cases, paste the output here and I'll jump in.

Done!

Copy link
Copy Markdown
Contributor

Clean wallet session management implementation. CI green, landed. 🎉

Copy link
Copy Markdown
Contributor

Heads up — landing the recent batch (CI/coverage/multi-OS) introduced merge conflicts with main. Could you rebase (or merge from main) and push? CI is clean; once the conflicts clear we are good to go. 🙏

@ibrahimmosouf-png ibrahimmosouf-png left a comment

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.

LGTM

@ibrahimmosouf-png
ibrahimmosouf-png merged commit 3a83c9f into OrbitChainLabs:main Jul 23, 2026
12 checks passed
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.

Add wallet session management (connect / reconnect / disconnect events)

2 participants