For the complete documentation index, see llms.txt. This page is also available as Markdown.

Context API

Providers that you'll need.

Overview

This section will show the code for the providers we will use, such as for tabs, wallet and escrows .

Tabs Global State Management

Tabs global state management involves maintaining and synchronizing the state of tab components across an application to ensure consistency and efficiency.

"use client";

import { createContext, useContext, useState, ReactNode } from "react";

type Tabs = "deploy" | "escrow" | "helper";

interface TabsContextType {
  activeTab: Tabs;
  setActiveTab: (tab: Tabs) => void;
}

const TabsContext = createContext<TabsContextType | undefined>(undefined);

export function useTabsContext() {
  const context = useContext(TabsContext);
  if (!context) {
    throw new Error("useTabsContext must be used within TabsProvider");
  }
  return context;
}

export function TabsProvider({ children }: { children: ReactNode }) {
  const [activeTab, setActiveTab] = useState<Tabs>("deploy");

  return (
    <TabsContext.Provider value={{ activeTab, setActiveTab }}>
      {children}
    </TabsContext.Provider>
  );
}

Escrow Global State Management

Escrow global state management involves handling the state related to escrow functionalities within an application. It ensures that all components engaging with escrow operations maintain a synchronized state.

Wallet Global State Management

Wallet global state management ensures the consistent handling of wallet-related states across the application.

Global Provider

We built a global provider in order to manage the providers.