Getting Started
Installation
npm i @mysten/dev-wallet@mysten/sui is a required peer dependency. For WebCrypto adapter support, also install
@mysten/signers. For React integration, install react and @lit/react.
Subpath Exports
| Import Path | Description |
|---|---|
@mysten/dev-wallet | Core DevWallet class and types |
@mysten/dev-wallet/adapters | Signer adapters (InMemory, WebCrypto, Passkey, RemoteCli) |
@mysten/dev-wallet/ui | Lit Web Components and mountDevWallet |
@mysten/dev-wallet/react | React hooks, context, and component wrappers |
@mysten/dev-wallet/client | DevWalletClient for connecting to a standalone wallet |
@mysten/dev-wallet/server | Request handling and CLI signing middleware |
Using with dApp Kit
devWalletInitializer registers the wallet through dApp Kit's plugin system, so it inherits dApp
Kit's network configuration and client factory:
import { createDAppKit, DAppKitProvider } from '@mysten/dapp-kit-react';
import { ConnectButton } from '@mysten/dapp-kit-react/ui';
import { devWalletInitializer } from '@mysten/dev-wallet';
import { WebCryptoSignerAdapter } from '@mysten/dev-wallet/adapters';
import { SuiGrpcClient } from '@mysten/sui/grpc';
const dAppKit = createDAppKit({
networks: ['devnet'],
createClient: (network) =>
new SuiGrpcClient({
network,
baseUrl: 'https://fullnode.devnet.sui.io:443',
}),
walletInitializers: [
devWalletInitializer({
adapters: [new WebCryptoSignerAdapter()],
autoConnect: true,
mountUI: true,
}),
],
});
function App() {
return (
<DAppKitProvider dAppKit={dAppKit}>
<ConnectButton />
{/* Dev Wallet appears in the wallet picker */}
</DAppKitProvider>
);
}You can also use the useDevWallet React hook for finer control — see React
Integration.
Standalone Wallet
Run the wallet as a separate web app with zero code changes to your dApp:
npx @mysten/dev-wallet serveThis starts a full wallet UI at http://localhost:5174 with WebCrypto and InMemory adapters. If
sui is on your PATH, your CLI keystore accounts are available too.
Register it through walletInitializers using devWalletClientInitializer:
import { createDAppKit } from '@mysten/dapp-kit-react';
import { devWalletClientInitializer } from '@mysten/dev-wallet/client';
const dAppKit = createDAppKit({
networks: ['devnet'],
walletInitializers: [devWalletClientInitializer({ origin: 'http://localhost:5174' })],
});Or register it directly without dApp Kit:
import { DevWalletClient } from '@mysten/dev-wallet/client';
DevWalletClient.register({ origin: 'http://localhost:5174' });The default port is 5174 (Vite's default). If the port is already in use, Vite picks the next
available port — check the terminal output and update the origin accordingly. You can also set a
fixed port with npx @mysten/dev-wallet serve --port 5174.
Signing works via popup windows — same flow as a production browser wallet. See Standalone Mode for full options.
Vanilla JavaScript Setup
import { DevWallet } from '@mysten/dev-wallet';
import { WebCryptoSignerAdapter } from '@mysten/dev-wallet/adapters';
import { mountDevWallet } from '@mysten/dev-wallet/ui';
// 1. Create and initialize an adapter
const adapter = new WebCryptoSignerAdapter();
await adapter.initialize();
await adapter.createAccount({ label: 'Dev Account' });
// 2. Create the wallet
const wallet = new DevWallet({
adapters: [adapter],
networks: {
devnet: 'https://fullnode.devnet.sui.io:443',
testnet: 'https://fullnode.testnet.sui.io:443',
},
});
// 3. Register with wallet-standard (makes it appear in dApp Kit)
const unregister = wallet.register();
// 4. Mount the floating panel UI
const unmountUI = mountDevWallet(wallet);
// Cleanup when done
// unmountUI();
// unregister();
// wallet.destroy();React Setup
import { useDevWallet } from '@mysten/dev-wallet/react';
import { WebCryptoSignerAdapter } from '@mysten/dev-wallet/adapters';
import { useMemo } from 'react';
function App() {
// Stable adapter reference — create once
const adapters = useMemo(() => [new WebCryptoSignerAdapter()], []);
const { wallet, error, loading } = useDevWallet({
adapters,
name: 'Dev Wallet',
createInitialAccount: true, // Auto-create first account
mountUI: true, // Show floating panel
autoConnect: true, // Skip account picker
});
if (loading) return <div>Initializing wallet...</div>;
if (error) return <div>Error: {error.message}</div>;
return <div>Wallet ready: {wallet?.accounts.length} accounts</div>;
}Always create adapters outside your component or wrap them in useMemo. Creating adapters inside
render causes infinite re-initialization loops.
Default Networks
If you don't provide a networks config, Dev Wallet includes these defaults:
| Network | URL |
|---|---|
| devnet | https://fullnode.devnet.sui.io:443 |
| testnet | https://fullnode.testnet.sui.io:443 |
| localnet | http://127.0.0.1:9000 |
Funding Your Wallet
After setup, request test coins from the faucet so you can send transactions:
import { requestSuiFromFaucetV2, getFaucetHost } from '@mysten/sui/faucet';
await requestSuiFromFaucetV2({
host: getFaucetHost('devnet'),
recipient: wallet.accounts[0].address,
});With WebCryptoSignerAdapter, you only need to faucet once — the coins persist across page reloads.
Next
- Writing e2e tests? E2E Testing
- Publishing contracts with
sui move? CLI Signing - Sharing one wallet across apps? Standalone Mode
- Choosing an adapter? Adapters