Skip to main content

SuiProvider

SuiProvider is a React component that sets up the necessary providers for Sui blockchain integration in your application. It combines React Query, Sui Client, and Wallet providers in a single wrapper component.

Usage

import { SuiProvider } from '@suiware/kit';

function App() {
return (
<SuiProvider>
{/* Your app components */}
</SuiProvider>
);
}

Props

PropTypeDescriptionDefault
customQueryClientQueryClientCustom React Query client instancenew QueryClient()
customNetworkConfigRecord<string, NetworkConfig | SuiClient>Custom network configurationsundefined
defaultNetworkstringThe default network to connect toundefined
walletAutoConnectbooleanWhether to automatically connect to the walletundefined
walletStashedNamestringName of the stashed wallet'Sui Wallet'
themeSettingsTheme | nullCustom theme settings for the wallet UIundefined

Example with Custom Configuration

import { SuiProvider } from '@suiware/kit';
import { QueryClient } from '@tanstack/react-query';
import { getFullnodeUrl } from '@mysten/sui/client';

const queryClient = new QueryClient();
const networkConfig = {
devnet: { url: getFullnodeUrl('devnet') },
testnet: { url: getFullnodeUrl('testnet') },
};

function App() {
return (
<SuiProvider
customQueryClient={queryClient}
customNetworkConfig={networkConfig}
defaultNetwork="devnet"
walletAutoConnect={true}
walletStashedName="My Sui Wallet"
>
{/* Your app components */}
</SuiProvider>
);
}