Wallet Kit
Programmatic Connection

Programmatic Connection

While we provide the ConnectButton to allow you to get started quickly, you can also use the useWalletKit hook to programmatically connect to a wallet, which allows you to build your own connection UI.

import { useWalletKit } from '@mysten/wallet-kit';
 
function MyConnectButton() {
	const { wallets, connect } = useWalletKit();
 
	const handleClick = () => {
		// Connect to the first wallet:
		connect(wallets[0].name);
	};
 
	return <button onClick={handleClick}>Connect</button>;
}