dApp Kit
WalletProvider

WalletProvider

The WalletProvider is used to setup the necessary context for you React application. It should be at the root of your application, so that you can use any of the Sui Wallet Kit components underneath it.

import { WalletProvider } from '@mysten/dapp-kit';
 
function App() {
  return (
    <WalletProvider>
      <YourApp />
    <WalletProvider />
  );
};

The WalletProvider manages all wallet state for you, and makes the current wallet state available to other dApp Kit hooks and components.

Props

All props are optional.

  • preferredWallets - A list of wallets that are sorted to the top of the wallet list, if they are
  • requiredFeatures - A list of features that are required for the dApp to function. This filters the list of wallets presented to users when selecting a wallet to connect from, ensuring that only wallets that meet the dApps requirements can connect.
  • enableUnsafeBurner - Enables the development-only unsafe burner wallet, which can be useful for testing.
  • autoConnect - Enables automatically reconnecting to the most recently used wallet account upon mounting
  • storage - Configures how the most recently connected to wallet account is stored. Defaults to using localStorage.
  • storageKey - The key to use to store the most recently connected wallet account.
  • theme - The theme to use for styling UI components. Defaults to using the light theme.