sorokit-ui — Minimal React UI kit for Stellar applications built on top of sorokit-core. Provides reusable components for wallet connection, accounts, transactions, and network switching. Built with shadcn/ui, Tailwind CSS, and Radix primitives. Strictly presentation layer with no blockchain logic inside.
React component library for Stellar.
Drop-in UI primitives for wallet connection, transaction flows,
account display, and Soroban contract interaction — powered by sorokit-core.
Part of the sorokit ecosystem.
sorokit-ui is the React layer of the sorokit ecosystem. It provides ready-to-use components that connect directly to sorokit-core — so you can add wallet connection, balance display, payment flows, and Soroban contract interaction to your app without building any of the wiring yourself.
All components are unstyled by default and accept a className prop, making them compatible with Tailwind, CSS Modules, or any styling approach you already use.
npm install sorokit-ui sorokit-core @creit.tech/stellar-wallets-kit
Both sorokit-core and @creit.tech/stellar-wallets-kit are required peer dependencies.
Wrap your app in SorokitProvider, then use components anywhere in the tree:
import {
SorokitProvider,
ConnectWalletButton,
AccountBalance,
} from "sorokit-ui";
function App() {
return (
<SorokitProvider network="testnet">
<ConnectWalletButton />
<AccountBalance />
</SorokitProvider>
);
}
SorokitProvider initialises a sorokit-core client and makes it available to all child components via context.
import { SorokitProvider } from "sorokit-ui";
<SorokitProvider
network="testnet" // "mainnet" | "testnet" | "futurenet"
horizonUrl="https://..." // optional: override Horizon URL
rpcUrl="https://..." // optional: override Soroban RPC URL
>
{children}
</SorokitProvider>;
The package ships a broad set of reusable UI building blocks for wallets, accounts, transactions, Soroban flows, and shared layout primitives.
| Category | Component | Purpose |
|---|---|---|
| Wallet | WalletConnectButton | Connect or disconnect a Stellar wallet with a ready-to-use button. |
| AddressDisplay | Render and format a wallet or account address. | |
| WalletConnectModal | Modal for wallet connection with multiple adapter support. | |
| WalletStatusBadge | Display current wallet connection status indicator. | |
| Account | AccountCard | Display account summary information in a compact card. |
| AccountBalanceChart | Visual chart of account balance history. | |
| AccountSidebar | Account information sidebar with quick stats. | |
| BalanceList | Present the connected account's balances in a list. | |
| AssetBadge | Show an asset code and related badge styling. | |
| AssetFilter | Filter and search assets by code or issuer. | |
| ClaimableBalanceCard | Display claimable balance details in a card. | |
| Transactions | TransactionHistory | Show recent account transactions. |
| TransactionHistoryTable | Enhanced table view of transaction history with filters. | |
| TransactionPanel | Manage transaction submission and status details. | |
| TransactionStatusTracker | Real-time transaction status monitoring. | |
| TransactionFeeCalculator | Calculate and display transaction fees. | |
| TransactionConfirmModal | Confirmation dialog for transaction submission. | |
| FeeEstimator | Estimate fees for a proposed transaction. | |
| BatchPaymentProcessor | Process and manage batch payments. | |
| MultiSigTransactionBuilder | Build multi-signature transactions. | |
| QRCode | Render a QR code for addresses or payment requests. | |
| Soroban | SorobanPanel | Provide a full Soroban contract interaction experience. |
| SorobanInvokeButton |
Add SorokitProvider tests for concurrent wallet/account/network state updates
https://github.com/Sorokit/ui/issues/1133
Labels: Stellar Wave, tests, dx
Implement "Favorites" for addresses — quick access to frequently-used recipients
https://github.com/Sorokit/ui/issues/1125
Labels: Stellar Wave, frontend, ux
Add E2E test for full staking flow — delegate → claim rewards → undelegate
https://github.com/Sorokit/ui/issues/1078
Labels: Stellar Wave, frontend, tests
Add mock-client.ts test coverage for operation.getTimeline — ensures grouped timeline format matches expected shape
https://github.com/Sorokit/ui/issues/1077
Labels: Stellar Wave, tests, dx
Add Radix UI component integration tests — Dropdown, Dialog, Select work together without conflicts
https://github.com/Sorokit/ui/issues/1076
Labels: Stellar Wave, frontend, tests
Add Dashboard tests for screen visibility tracking — visited screens kept mounted, others hidden
https://github.com/Sorokit/ui/issues/1074
Labels: Stellar Wave, frontend, tests
npm install
npm run dev
git checkout -b feat/your-featuregit commit -m "feat: description"git push origin feat/your-featureRun the full test suite:
npm run test
Run tests in watch mode:
npm run test:watch
Run tests with coverage:
npm run test:coverage
Open the interactive Vitest UI:
npm run test:ui
Vitest, React Testing Library and jsdom are configured in the test block of
vite.config.ts. The shared setup file is src/test/setup.ts: it registers the
jest-dom matchers, cleans the DOM between tests, and provides the jsdom shims
(localStorage, ResizeObserver, pointer capture) the component suite needs.
Add new environment-level shims there rather than at the top of individual test
files, and keep src/test/placeholder.test.tsx passing as a quick check that
the harness itself still works.
src/components/MyComponent.test.ts.test.ts or .test.tsx extension@testing-library/react for component testsMost components require SorokitProvider context. Use the renderWithProvider helper:
import { render } from '@testing-library/react';
import { renderWithProvider } from './test-utils';
import { MyComponent } from './MyComponent';
describe('MyComponent', () => {
it('should render with provider', () => {
const { getByText } = renderWithProvider(<MyComponent />);
expect(getByText('content')).toBeInTheDocument();
});
});
Always test error states and recovery paths in your tests. This ensures the UI gracefully handles failures:
describe('MyComponent Error Handling', () => {
it('displays error message when API call fails', async () => {
const failingClient = {
account: {
getAccount: vi.fn().mockResolvedValue({
data: null,
error: 'Failed to fetch account'
})
}
};
renderWithProvider(<MyComponent />, { client: failingClient });
await waitFor(() => {
expect(screen.getByText(/failed to fetch/i)).toBeInTheDocument();
});
});
it('allows retry after a failed operation', async () => {
const flakeyClient = {
account: {
getAccount: vi
.fn()
.mockResolvedValueOnce({ data: null, error: 'Network error' })
.mockResolvedValueOnce({ data: { sequence: '123' }, error: null })
}
};
renderWithProvider(<MyComponent />, { client: flakeyClient });
// First attempt fails
await waitFor(() => {
expect(screen.getByText(/network error/i)).toBeInTheDocument();
});
// User clicks retry
fireEvent.click(screen.getByRole('button', { name: /retry/i }));
// Second attempt succeeds
await waitFor(() => {
expect(screen.getByText('123')).toBeInTheDocument();
});
});
});
Mock the Sorokit client for isolated component tests:
import { vi } from 'vitest';
import { getClient } from '../lib/client';
vi.mock('../lib/client', () => ({
getClient: vi.fn(() => ({
connect: vi.fn().mockResolvedValue('G...'),
invokeContract: vi.fn().mockResolvedValue({ data: null }),
getEvents: vi.fn().mockResolvedValue([]),
})),
}));
describe('MyComponent', () => {
it('should call client on mount', async () => {
renderWithProvider(<MyComponent />);
await waitFor(() => {
expect(getClient).toHaveBeenCalled();
});
});
});
For full integration tests, use renderWithProvider:
import { renderWithProvider } from './test-utils';
const mockClient = {
connect: vi.fn().mockResolvedValue('GBRP...'),
invokeContract: vi.fn().mockResolvedValue({ data: { value: '123' } }),
};
describe('MyComponent', () => {
it('should display contract data', async () => {
const { getByText } = renderWithProvider(
<MyComponent />,
{ client: mockClient }
);
await waitFor(() => {
expect(getByText('123')).toBeInTheDocument();
});
});
});
Every push and pull request runs .github/workflows/test.yml, which enforces
the following checks (all must pass before a PR can be merged):
| Step | Command | Purpose |
|---|---|---|
| Lint | npm run lint | ESLint over .ts/.tsx sources. |
| Typecheck | npm run typecheck | Catches type errors across the full source tree, not just the build entrypoint. |
| Build | npm run build | Produces the library bundle in dist/. |
| Bundle size | npm run size | Fails if the published bundle exceeds the 50 KB gzipped budget. |
| Verify exports | npm run test:exports | Type-checks src/verify-exports.ts so the public API can't silently break. |
| Tests | npm test | Runs the Vitest suite. |
Bundle size is tracked with [size-limit](https://github.com/a