Skip to content

feat: add @autonomys/auto-wallet and @autonomys/auto-wallet-react packages#511

Merged
jim-counter merged 12 commits intomainfrom
feat/auto-wallet-packages
Feb 10, 2026
Merged

feat: add @autonomys/auto-wallet and @autonomys/auto-wallet-react packages#511
jim-counter merged 12 commits intomainfrom
feat/auto-wallet-packages

Conversation

@jim-counter
Copy link
Copy Markdown
Member

@jim-counter jim-counter commented Feb 7, 2026

Summary

  • Adds @autonomys/auto-wallet — framework-agnostic core package with a configurable Zustand store factory (createWalletStore), wallet detection/connection logic, TypeScript types, and utilities like shortenAddress
  • Adds @autonomys/auto-wallet-react — React package with WalletProvider, useWallet hook, and pre-built components (WalletButton, WalletModal, WalletOption) using shadcn-style Tailwind
  • All wallet behavior is configurable per-app via WalletConfig (dappName, ss58Prefix, storageKey, supportedWallets, connectionTimeout, installUrls)

Consumer usage

import { WalletProvider, WalletButton, WalletModal, useWallet } from '@autonomys/auto-wallet-react';

<WalletProvider config={{ dappName: 'My App', ss58Prefix: 6094 }}>
  <MyApp />
</WalletProvider>

Consumers need Tailwind CSS 3.x with shadcn-style CSS variables and must add node_modules/@autonomys/auto-wallet-react/dist/**/*.{js,mjs} to their Tailwind content config.

Test plan

  • Both packages build cleanly in the monorepo (yarn build)
  • Integrated into the beneficiary verification app via file: links
  • TypeScript type-check and production build pass
  • Manual browser testing with Talisman, SubWallet, Polkadot.js

🤖 Generated with Claude Code

…kages

Extract reusable wallet connection functionality into two new packages:

- @autonomys/auto-wallet: Framework-agnostic core with configurable
  Zustand store factory, wallet detection/connection, types, and utils.
  Supports configurable dappName, ss58Prefix, storageKey, and more.

- @autonomys/auto-wallet-react: React components (WalletProvider,
  WalletButton, WalletModal, WalletOption) and useWallet hook. Bundles
  its own shadcn UI primitives. Consumers provide Tailwind + CSS vars.

Designed to be consumed by multiple Autonomys dApps (beneficiary portal,
staking portal, etc.) with per-app configuration via WalletProvider.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jim-counter and others added 2 commits February 7, 2026 21:22
Add --passWithNoTests to jest so the test step doesn't fail with exit
code 1 when no test files exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update selectedAccount with fresh data on reconnection so it stays
  in sync with the accounts array (stale metadata bug)
- Track lastFailedWallet explicitly so the retry button reconnects to
  the correct wallet instead of always picking the first one on timeout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jim-counter
Copy link
Copy Markdown
Member Author

bugbot run

- Clear timeout timer on successful wallet connection to prevent
  unhandled promise rejection (connect.ts)
- Use .catch() instead of try/catch for async initializeConnection
  call in onRehydrateStorage callback (store.ts)
- Fix unicode × symbol rendered literally in JSX close button
  (wallet-modal.tsx)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jim-counter
Copy link
Copy Markdown
Member Author

@cursor review

jim-counter and others added 2 commits February 7, 2026 22:04
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show a disabled "Unavailable" button instead of rendering an anchor
tag with a missing href when a wallet has no installUrl configured.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jim-counter
Copy link
Copy Markdown
Member Author

bugbot run

Swap bg-white, text-gray-*, hover:bg-gray-* with bg-background,
text-muted-foreground, hover:bg-accent etc. across AccountDropdown,
WalletModal, and WalletOption so components respect dark mode theming.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jim-counter
Copy link
Copy Markdown
Member Author

bugbot run

- connectWallet now throws when already loading so the modal catch
  block fires instead of silently closing the modal on a no-op return.
- Both connectWallet and initializeConnection check that isLoading is
  still true after the async connectToWallet call, so a disconnect
  issued mid-flight is not overwritten by the late-arriving success.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jim-counter
Copy link
Copy Markdown
Member Author

bugbot run

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Copy link
Copy Markdown
Member

@EmilFattakhov EmilFattakhov left a comment

Choose a reason for hiding this comment

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

There's one question from me and 3 suggestions from the review I did with the Clade Code, I found the review/suggestions rather interesting

jim-counter and others added 4 commits February 10, 2026 07:20
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the isLoading guard with a monotonically-increasing
_connectionSeq counter so that only the latest connection attempt
can write state. Disconnect also bumps the counter, invalidating
any in-flight connection that resolves after the user disconnected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously selectedWallet and selectedAccount were kept after a
failed reconnection attempt, creating an inconsistent state where
selectedAccount referenced an account not present in accounts[].
Now all state is cleared so the user starts from a clean slate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@EmilFattakhov EmilFattakhov left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jim-counter!

@jim-counter jim-counter merged commit ecae120 into main Feb 10, 2026
3 checks passed
@jim-counter jim-counter deleted the feat/auto-wallet-packages branch February 10, 2026 14:24
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.

2 participants