Tezos LogoTezos Boilerplate

Tezos Wallet Boilerplate Docs

Components

Pre-built React components for common Tezos dApp functionality.

WalletConnection

Modern wallet connection component with automatic state restoration and multi-wallet support.

Wallet Connection

Supports Temple, Kukai, Umami & more

Features

  • โœ… Automatic wallet detection and initialization
  • โœ… Persistent connections across page refreshes
  • โœ… Loading states and error handling
  • โœ… Multi-wallet support (Beacon + Kukai)
  • โœ… Responsive design with mobile support

Usage

import WalletConnection from "@/components/layout/connect/WalletConnection";

export function Header() {
  return (
    <header className="flex justify-between items-center p-4">
      <h1>My Tezos DApp</h1>
      <WalletConnection />
    </header>
  );
}

WalletProvider

Root provider component that handles wallet initialization and state management for the entire app.

Setup in Layout

// app/layout.tsx
import { WalletProvider } from "@/components/providers/wallet-provider";

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        <ThemeProvider>
          <WalletProvider>
            {children}
          </WalletProvider>
        </ThemeProvider>
      </body>
    </html>
  );
}

โšก Auto-Initialization

The WalletProvider automatically checks for existing wallet connections on app startup and restores the user's wallet state without requiring re-connection.

TransactionForm

A form component for sending XTZ transactions with validation, gas estimation, and confirmation tracking.

Send XTZ

Props

onSuccessFunction - Callback when transaction succeeds
onErrorFunction - Callback when transaction fails
defaultRecipientstring - Pre-fill recipient address
disabledboolean - Disable the form

Code Example

import { TransactionForm } from "@/components/transaction-form";

export function SendPage() {
  const handleSuccess = (opHash: string) => {
    console.log("Transaction successful:", opHash);
  };

  const handleError = (error: Error) => {
    console.error("Transaction failed:", error);
  };

  return (
    <div className="max-w-md mx-auto">
      <TransactionForm 
        onSuccess={handleSuccess}
        onError={handleError}
      />
    </div>
  );
}

SmartContractInteraction

Component for interacting with SmartPy contracts - call methods, view storage, and handle parameters. Includes examples of classic SmartPy contracts.

Contract Interaction

Props

contractAddressstring - Tezos contract address (KT1...)
onSuccessFunction - Callback when operation succeeds
onErrorFunction - Callback when operation fails
entryPointsstring[] - Available contract entry points

NFTGallery

Display and manage FA2 tokens (NFTs) with metadata, images, and transfer functionality.

NFT Collection

NFT #1

Token #1

Demo Collection

NFT #2

Token #2

Demo Collection

NFT #3

Token #3

Demo Collection

Props

walletAddressstring - Owner wallet address
contractAddressesstring[] - FA2 contract addresses to query
onTransferFunction - Callback for NFT transfers
showTransferButtonboolean - Show transfer functionality

useTezos Hook

The main hook for accessing Tezos functionality throughout your app.

Basic Usage

import { useTezos } from "@/lib/tezos/useTezos";

export function MyComponent() {
  const { 
    Tezos, 
    address, 
    wallet, 
    isInitialized, 
    connectWallet, 
    disconnectWallet 
  } = useTezos();

  if (!isInitialized) {
    return <div>Initializing wallets...</div>;
  }

  return (
    <div>
      {address ? (
        <div>Connected: {address}</div>
      ) : (
        <button onClick={connectWallet}>
          Connect Wallet
        </button>
      )}
    </div>
  );
}

Returned Properties

TezosTezosToolkit - Main Taquito instance
addressstring | null - Connected wallet address
walletBeaconWallet | null - Beacon wallet instance
kukaiKukaiEmbed | null - Kukai wallet instance
isInitializedboolean - Whether wallets are initialized
connectWallet() => Promise<void> - Connect Beacon wallet
connectKukai() => Promise<void> - Connect Kukai wallet
disconnectWallet() => Promise<void> - Disconnect wallet

Next Steps

๐Ÿ’ก Examples

See these components in action with working examples

View examples โ†’

๐Ÿ  Home

Try the components on the home page demo

Go to demo โ†’