Files
impersonator/app/providers.tsx

102 lines
3.1 KiB
TypeScript
Raw Permalink Normal View History

2024-05-07 00:18:18 +10:00
"use client";
2023-09-21 18:06:01 +05:30
import "@rainbow-me/rainbowkit/styles.css";
2024-05-07 00:18:18 +10:00
import { CacheProvider } from "@chakra-ui/next-js";
2021-08-22 03:44:44 +05:30
import { ChakraProvider } from "@chakra-ui/react";
2023-09-21 18:06:01 +05:30
import {
connectorsForWallets,
RainbowKitProvider,
darkTheme,
} from "@rainbow-me/rainbowkit";
import {
metaMaskWallet,
walletConnectWallet,
rainbowWallet,
} from "@rainbow-me/rainbowkit/wallets";
import { configureChains, createConfig, WagmiConfig } from "wagmi";
import { mainnet, optimism, base, arbitrum } from "wagmi/chains";
import { publicProvider } from "wagmi/providers/public";
2024-05-07 00:18:18 +10:00
import theme from "@/style/theme";
import { SafeInjectProvider } from "@/contexts/SafeInjectContext";
feat: comprehensive project improvements and fixes - Fix all TypeScript compilation errors (40+ fixes) - Add missing type definitions (TransactionRequest, SafeInfo) - Fix TransactionRequestStatus vs TransactionStatus confusion - Fix import paths and provider type issues - Fix test file errors and mock providers - Implement comprehensive security features - AES-GCM encryption with PBKDF2 key derivation - Input validation and sanitization - Rate limiting and nonce management - Replay attack prevention - Access control and authorization - Add comprehensive test suite - Integration tests for transaction flow - Security validation tests - Wallet management tests - Encryption and rate limiter tests - E2E tests with Playwright - Add extensive documentation - 12 numbered guides (setup, development, API, security, etc.) - Security documentation and audit reports - Code review and testing reports - Project organization documentation - Update dependencies - Update axios to latest version (security fix) - Update React types to v18 - Fix peer dependency warnings - Add development tooling - CI/CD workflows (GitHub Actions) - Pre-commit hooks (Husky) - Linting and formatting (Prettier, ESLint) - Security audit workflow - Performance benchmarking - Reorganize project structure - Move reports to docs/reports/ - Clean up root directory - Organize documentation - Add new features - Smart wallet management (Gnosis Safe, ERC4337) - Transaction execution and approval workflows - Balance management and token support - Error boundary and monitoring (Sentry) - Fix WalletConnect configuration - Handle missing projectId gracefully - Add environment variable template
2026-01-14 02:17:26 -08:00
import { SmartWalletProvider } from "@/contexts/SmartWalletContext";
import { TransactionProvider } from "@/contexts/TransactionContext";
import ErrorBoundary from "@/components/ErrorBoundary";
import { monitoring } from "@/utils/monitoring";
// Initialize error tracking if Sentry is available
if (typeof window !== "undefined" && process.env.NEXT_PUBLIC_SENTRY_DSN) {
try {
// Dynamic import to avoid bundling Sentry in client if not needed
import("@sentry/nextjs").then((Sentry) => {
monitoring.initErrorTracking(Sentry);
}).catch(() => {
// Sentry not available, continue without it
console.warn("Sentry not available, continuing without error tracking");
});
} catch (error) {
console.warn("Failed to initialize Sentry:", error);
}
}
2021-08-22 03:44:44 +05:30
2023-09-21 18:06:01 +05:30
const { chains, publicClient } = configureChains(
// the first chain is used by rainbowWallet to determine which chain to use
[mainnet, optimism, base, arbitrum],
[publicProvider()]
);
feat: comprehensive project improvements and fixes - Fix all TypeScript compilation errors (40+ fixes) - Add missing type definitions (TransactionRequest, SafeInfo) - Fix TransactionRequestStatus vs TransactionStatus confusion - Fix import paths and provider type issues - Fix test file errors and mock providers - Implement comprehensive security features - AES-GCM encryption with PBKDF2 key derivation - Input validation and sanitization - Rate limiting and nonce management - Replay attack prevention - Access control and authorization - Add comprehensive test suite - Integration tests for transaction flow - Security validation tests - Wallet management tests - Encryption and rate limiter tests - E2E tests with Playwright - Add extensive documentation - 12 numbered guides (setup, development, API, security, etc.) - Security documentation and audit reports - Code review and testing reports - Project organization documentation - Update dependencies - Update axios to latest version (security fix) - Update React types to v18 - Fix peer dependency warnings - Add development tooling - CI/CD workflows (GitHub Actions) - Pre-commit hooks (Husky) - Linting and formatting (Prettier, ESLint) - Security audit workflow - Performance benchmarking - Reorganize project structure - Move reports to docs/reports/ - Clean up root directory - Organize documentation - Add new features - Smart wallet management (Gnosis Safe, ERC4337) - Transaction execution and approval workflows - Balance management and token support - Error boundary and monitoring (Sentry) - Fix WalletConnect configuration - Handle missing projectId gracefully - Add environment variable template
2026-01-14 02:17:26 -08:00
// WalletConnect projectId - required for WalletConnect v2
// Get one from https://cloud.walletconnect.com/
const projectId = process.env.NEXT_PUBLIC_WC_PROJECT_ID || "demo-project-id";
// Only include WalletConnect wallets if projectId is set (not demo)
const wallets = projectId && projectId !== "demo-project-id"
? [
2023-09-21 18:06:01 +05:30
metaMaskWallet({ projectId, chains }),
walletConnectWallet({ projectId, chains }),
rainbowWallet({ projectId, chains }),
feat: comprehensive project improvements and fixes - Fix all TypeScript compilation errors (40+ fixes) - Add missing type definitions (TransactionRequest, SafeInfo) - Fix TransactionRequestStatus vs TransactionStatus confusion - Fix import paths and provider type issues - Fix test file errors and mock providers - Implement comprehensive security features - AES-GCM encryption with PBKDF2 key derivation - Input validation and sanitization - Rate limiting and nonce management - Replay attack prevention - Access control and authorization - Add comprehensive test suite - Integration tests for transaction flow - Security validation tests - Wallet management tests - Encryption and rate limiter tests - E2E tests with Playwright - Add extensive documentation - 12 numbered guides (setup, development, API, security, etc.) - Security documentation and audit reports - Code review and testing reports - Project organization documentation - Update dependencies - Update axios to latest version (security fix) - Update React types to v18 - Fix peer dependency warnings - Add development tooling - CI/CD workflows (GitHub Actions) - Pre-commit hooks (Husky) - Linting and formatting (Prettier, ESLint) - Security audit workflow - Performance benchmarking - Reorganize project structure - Move reports to docs/reports/ - Clean up root directory - Organize documentation - Add new features - Smart wallet management (Gnosis Safe, ERC4337) - Transaction execution and approval workflows - Balance management and token support - Error boundary and monitoring (Sentry) - Fix WalletConnect configuration - Handle missing projectId gracefully - Add environment variable template
2026-01-14 02:17:26 -08:00
]
: [
metaMaskWallet({ projectId: "demo-project-id", chains }),
];
const connectors = connectorsForWallets([
{
groupName: "Recommended",
wallets,
2023-09-21 18:06:01 +05:30
},
]);
export const wagmiConfig = createConfig({
autoConnect: false,
connectors,
publicClient,
});
2024-05-07 00:18:18 +10:00
export const Providers = ({ children }: { children: React.ReactNode }) => {
return (
<CacheProvider>
<ChakraProvider theme={theme}>
<WagmiConfig config={wagmiConfig}>
<RainbowKitProvider
chains={chains}
theme={darkTheme()}
modalSize={"compact"}
>
feat: comprehensive project improvements and fixes - Fix all TypeScript compilation errors (40+ fixes) - Add missing type definitions (TransactionRequest, SafeInfo) - Fix TransactionRequestStatus vs TransactionStatus confusion - Fix import paths and provider type issues - Fix test file errors and mock providers - Implement comprehensive security features - AES-GCM encryption with PBKDF2 key derivation - Input validation and sanitization - Rate limiting and nonce management - Replay attack prevention - Access control and authorization - Add comprehensive test suite - Integration tests for transaction flow - Security validation tests - Wallet management tests - Encryption and rate limiter tests - E2E tests with Playwright - Add extensive documentation - 12 numbered guides (setup, development, API, security, etc.) - Security documentation and audit reports - Code review and testing reports - Project organization documentation - Update dependencies - Update axios to latest version (security fix) - Update React types to v18 - Fix peer dependency warnings - Add development tooling - CI/CD workflows (GitHub Actions) - Pre-commit hooks (Husky) - Linting and formatting (Prettier, ESLint) - Security audit workflow - Performance benchmarking - Reorganize project structure - Move reports to docs/reports/ - Clean up root directory - Organize documentation - Add new features - Smart wallet management (Gnosis Safe, ERC4337) - Transaction execution and approval workflows - Balance management and token support - Error boundary and monitoring (Sentry) - Fix WalletConnect configuration - Handle missing projectId gracefully - Add environment variable template
2026-01-14 02:17:26 -08:00
<ErrorBoundary>
<SafeInjectProvider>
<SmartWalletProvider>
<TransactionProvider>
{children}
</TransactionProvider>
</SmartWalletProvider>
</SafeInjectProvider>
</ErrorBoundary>
2024-05-07 00:18:18 +10:00
</RainbowKitProvider>
</WagmiConfig>
</ChakraProvider>
</CacheProvider>
);
};