githubEdit

Provider Configuration

This guide covers how to set up and configure the VeChainKitProvider in your application.

Basic Setup

Wrap your app with the VeChainKitProvider:

'use client';

import { VeChainKitProvider } from "@vechain/vechain-kit";

export function Providers({ children }) {
  return (
    <VeChainKitProvider>
      {children}
    </VeChainKitProvider>
  );
}

Next.js Configuration

For Next.js applications, dynamically import the provider to avoid SSR issues:

import dynamic from 'next/dynamic';

const VeChainKitProvider = dynamic(
  async () => (await import('@vechain/vechain-kit')).VeChainKitProvider,
  { ssr: false }
);

export function Providers({ children }) {
  return (
    <VeChainKitProvider>
      {children}
    </VeChainKitProvider>
  );
}

Complete Configuration Example

Here's a comprehensive example with all available options:

Configuration Options

Network Configuration

Fee Delegation

Configure transaction fee sponsorship:

Login Methods

Configure available authentication methods with a flexible grid layout:

Grid Layout: The gridColumn property determines the width of each login option in the modal (based on a 4-column grid).

Contract Address Overrides

Override default contract addresses for custom deployments on solo or testnet. Only the provided fields are overridden; the rest use the network defaults.

This is useful when you deploy your own contract instances (e.g., B3TR, VOT3) and need the kit to use those addresses instead of the built-in defaults:

To access the merged config (network defaults + your overrides) in your components, use the useAppConfig hook:

Privy Integration (Optional)

To enable social login methods with your own Privy account:

Ecosystem Apps Configuration

Customize which ecosystem apps appear in the login modal:

Best Practices

  1. Dynamic Import: Always use dynamic import in Next.js to avoid SSR issues

  2. Environment Variables: Store sensitive configuration in environment variables

  3. Fee Delegation: Consider your fee delegation strategy based on user experience needs

  4. Login Methods: Choose login methods that match your target audience

  5. Metadata: Provide clear app metadata for wallet connection requests

Next Steps

  • Implement Authentication Methods

  • Customize UI Theme

  • Handle Wallet Interactions

Last updated

Was this helpful?