import { createContext, useMemo, useState, useEffect, useCallback, useContext } from 'react';
import { createThirdwebClient } from 'thirdweb';
import { ThirdwebProvider } from 'thirdweb/react';
import { inAppWallet, smartWallet } from 'thirdweb/wallets';
export { inAppWallet, smartWallet } from 'thirdweb/wallets';
import { base } from 'thirdweb/chains';
export { arbitrum, base, ethereum, optimism, polygon } from 'thirdweb/chains';
import { jsx } from 'react/jsx-runtime';

// src/config/index.ts
var DEFAULT_ENGINE_URL = "https://api.one23.io";
var DEFAULT_CLIENT_ID = "one_pk_e8f647bfa643fdcfaa3a23f760488e49be09f929296eed4a6c399d437d907f60";
var config = null;
function initOneSDK(options) {
  const engineUrl = options.oneEngineUrl || DEFAULT_ENGINE_URL;
  const clientId = options.oneClientId || DEFAULT_CLIENT_ID;
  config = {
    ...options,
    oneEngineUrl: engineUrl,
    oneClientId: clientId
  };
}
function getConfig() {
  if (!config) {
    throw new Error("ONE SDK not initialized. Call initOneSDK() first.");
  }
  return config;
}

// src/services/engine.ts
var OneEngineClient = class {
  constructor(options) {
    const config2 = getConfig();
    this.baseUrl = options?.baseUrl || config2.oneEngineUrl;
    this.clientId = options?.clientId || config2.oneClientId || "";
    this.secretKey = options?.secretKey || config2.oneSecretKey;
  }
  /**
   * Set access token for authenticated requests
   */
  setAccessToken(token) {
    this.accessToken = token;
  }
  /**
   * Clear access token
   */
  clearAccessToken() {
    this.accessToken = void 0;
  }
  getHeaders(includeSecret = false) {
    const headers = {
      "Content-Type": "application/json",
      "x-client-id": this.clientId
    };
    if (this.accessToken) {
      headers["Authorization"] = `Bearer ${this.accessToken}`;
    }
    if (includeSecret && this.secretKey) {
      headers["x-secret-key"] = this.secretKey;
    }
    return headers;
  }
  async request(endpoint, options = {}, includeSecret = false) {
    try {
      const response = await fetch(`${this.baseUrl}${endpoint}`, {
        ...options,
        headers: {
          ...this.getHeaders(includeSecret),
          ...options.headers
        }
      });
      const data = await response.json();
      if (!response.ok) {
        return {
          success: false,
          error: {
            code: data.error?.code || `HTTP_${response.status}`,
            message: data.error?.message || "Request failed"
          }
        };
      }
      return {
        success: true,
        data: data.data || data
      };
    } catch (error) {
      return {
        success: false,
        error: {
          code: "NETWORK_ERROR",
          message: error instanceof Error ? error.message : "Network request failed"
        }
      };
    }
  }
  // ===============================
  // AUTH ENDPOINTS
  // ===============================
  /**
   * Send OTP to email for authentication
   */
  async sendEmailOtp(email) {
    return this.request("/api/v1/auth/otp", {
      method: "POST",
      body: JSON.stringify({ email })
    });
  }
  /**
   * Verify OTP and get access token
   */
  async verifyEmailOtp(email, otp) {
    return this.request("/api/v1/auth/otp/verify", {
      method: "POST",
      body: JSON.stringify({ email, otp })
    });
  }
  /**
   * Authenticate with wallet signature
   */
  async authWithWallet(walletAddress, signature, message) {
    return this.request("/api/v1/auth/wallet", {
      method: "POST",
      body: JSON.stringify({ walletAddress, signature, message })
    });
  }
  /**
   * Refresh access token
   */
  async refreshToken(refreshToken) {
    return this.request("/api/v1/auth/refresh", {
      method: "POST",
      body: JSON.stringify({ refreshToken })
    });
  }
  /**
   * Get current user
   */
  async getCurrentUser() {
    return this.request("/api/v1/auth/me", { method: "GET" });
  }
  /**
   * Sign out
   */
  async signOut() {
    return this.request("/api/v1/auth/logout", { method: "POST" });
  }
  // ===============================
  // WALLET/ASSETS ENDPOINTS
  // ===============================
  /**
   * Get wallet balance across all chains
   */
  async getWalletBalance(walletAddress, chains) {
    const params = new URLSearchParams({ address: walletAddress });
    if (chains?.length && chains.length > 0) {
      params.set("chainId", chains[0].toString());
    }
    return this.request(`/api/v1/assets?${params}`, { method: "GET" });
  }
  /**
   * Get portfolio summary
   */
  async getPortfolioSummary(walletAddress) {
    const params = new URLSearchParams({ address: walletAddress });
    return this.request(`/api/v1/assets/portfolio?${params}`, { method: "GET" });
  }
  /**
   * Get user's wallets
   */
  async getUserWallets(chainId) {
    const params = chainId ? `?chainId=${chainId}` : "";
    return this.request(`/api/v1/wallet${params}`, { method: "GET" });
  }
  /**
   * Create a new wallet
   */
  async createWallet(chainId = 8453, type = "smart") {
    return this.request("/api/v1/wallet", {
      method: "POST",
      body: JSON.stringify({ chainId, type })
    });
  }
  /**
   * Get wallet transactions (placeholder - needs endpoint)
   */
  async getWalletTransactions(walletAddress, options) {
    const params = new URLSearchParams({ address: walletAddress });
    if (options?.limit) params.set("limit", options.limit.toString());
    if (options?.offset) params.set("offset", options.offset.toString());
    if (options?.chainId) params.set("chainId", options.chainId.toString());
    return this.request(`/api/v1/assets/transactions?${params}`, { method: "GET" });
  }
  /**
   * Send native token or ERC20
   */
  async sendTransaction(request) {
    return this.request("/api/v1/wallet/send", {
      method: "POST",
      body: JSON.stringify(request)
    });
  }
  /**
   * Get transaction status
   */
  async getTransactionStatus(txId) {
    return this.request(`/api/v1/wallet/transaction/${txId}`, { method: "GET" });
  }
  // ===============================
  // ONRAMP ENDPOINTS (Fiat-to-Crypto)
  // ===============================
  /**
   * Get onramp quote
   */
  async getOnrampQuote(fiatCurrency, fiatAmount, cryptoCurrency, paymentMethod) {
    const params = new URLSearchParams({
      fiatCurrency,
      fiatAmount: fiatAmount.toString(),
      cryptoCurrency
    });
    if (paymentMethod) params.set("paymentMethod", paymentMethod);
    return this.request(`/api/v1/fiat/onramp/quote?${params}`, { method: "GET" });
  }
  /**
   * Create onramp session (returns widget URL)
   */
  async createOnrampSession(request) {
    return this.request("/api/v1/fiat/onramp", {
      method: "POST",
      body: JSON.stringify({
        fiatCurrency: request.fiatCurrency || "USD",
        fiatAmount: request.fiatAmount || 100,
        cryptoCurrency: request.cryptoCurrency || "ETH",
        walletAddress: request.walletAddress,
        chainId: 8453
        // Default to Base
      })
    });
  }
  /**
   * Get onramp session status
   */
  async getOnrampStatus(sessionId) {
    return this.request(`/api/v1/fiat/onramp/${sessionId}`, { method: "GET" });
  }
  /**
   * Get supported currencies (fiat + crypto)
   */
  async getSupportedCurrencies() {
    return this.request("/api/v1/fiat/onramp", { method: "GET" });
  }
  /**
   * Get supported fiat currencies
   */
  async getSupportedFiatCurrencies() {
    const result = await this.getSupportedCurrencies();
    if (result.success && result.data) {
      return { success: true, data: result.data.fiatCurrencies };
    }
    return { success: false, error: result.error };
  }
  /**
   * Get supported payment methods
   */
  async getSupportedPaymentMethods(country) {
    return { success: true, data: ["card", "bank_transfer", "apple_pay", "google_pay"] };
  }
  // ===============================
  // SWAP ENDPOINTS
  // ===============================
  /**
   * Get swap quote
   */
  async getSwapQuote(request) {
    return this.request("/api/v1/swap/quote", {
      method: "POST",
      body: JSON.stringify(request)
    });
  }
  /**
   * Execute swap
   */
  async executeSwap(request) {
    return this.request("/api/v1/swap/execute", {
      method: "POST",
      body: JSON.stringify(request)
    });
  }
  /**
   * Get swap status
   */
  async getSwapStatus(swapId) {
    return this.request(`/api/v1/swap/${swapId}`, { method: "GET" });
  }
  /**
   * Get supported tokens for swap
   */
  async getSupportedSwapTokens(chainId) {
    const params = chainId ? `?chainId=${chainId}` : "";
    return this.request(`/api/v1/swap/tokens${params}`, { method: "GET" });
  }
  /**
   * Get supported chains for swap
   */
  async getSupportedSwapChains() {
    return this.request("/api/v1/swap/chains", { method: "GET" });
  }
  // ===============================
  // AI TRADING/QUANT ENDPOINTS
  // ===============================
  /**
   * Get available AI trading strategies
   */
  async getStrategies() {
    return this.request("/api/v1/quant/strategies", { method: "GET" });
  }
  /**
   * Get strategy details
   */
  async getStrategy(strategyId) {
    return this.request(`/api/v1/quant/strategies/${strategyId}`, { method: "GET" });
  }
  /**
   * Get user's positions
   */
  async getPositions() {
    return this.request("/api/v1/quant/positions", { method: "GET" });
  }
  /**
   * Create investment order
   */
  async createOrder(strategyId, amount, currency) {
    return this.request("/api/v1/trading/orders", {
      method: "POST",
      body: JSON.stringify({ strategyId, amount, currency })
    });
  }
  /**
   * Get user's orders
   */
  async getUserOrders() {
    return this.request("/api/v1/trading/orders", { method: "GET" });
  }
  /**
   * Get user's portfolio stats from positions
   */
  async getPortfolioStats() {
    const positionsResult = await this.getPositions();
    if (positionsResult.success && positionsResult.data) {
      const positions = positionsResult.data;
      const totalInvested = positions.reduce((sum, p) => sum + (p.investedAmount || 0), 0);
      const totalValue = positions.reduce((sum, p) => sum + (p.currentValue || 0), 0);
      const totalPnl = totalValue - totalInvested;
      const totalPnlPercent = totalInvested > 0 ? totalPnl / totalInvested * 100 : 0;
      return {
        success: true,
        data: {
          totalInvested,
          totalValue,
          totalPnl,
          totalPnlPercent,
          activePositions: positions.filter((p) => p.status === "active").length
        }
      };
    }
    return {
      success: true,
      data: { totalInvested: 0, totalValue: 0, totalPnl: 0, totalPnlPercent: 0, activePositions: 0 }
    };
  }
  // ===============================
  // MARKET/PRICE ENDPOINTS
  // ===============================
  /**
   * Get token prices
   */
  async getTokenPrices(symbols) {
    const bybitSymbols = symbols.map((s) => {
      const upper = s.toUpperCase();
      if (upper.endsWith("USDT")) return upper;
      return `${upper}USDT`;
    });
    const result = await this.request(
      `/api/v1/trading/market?symbols=${bybitSymbols.join(",")}`,
      { method: "GET" }
    );
    if (result.success && result.data?.markets) {
      const prices = {};
      for (const market of result.data.markets) {
        const symbol = market.symbol?.replace("USDT", "") || "";
        prices[symbol] = {
          price: parseFloat(market.lastPrice) || 0,
          change24h: parseFloat(market.price24hPcnt) * 100 || 0,
          marketCap: void 0
          // Bybit doesn't provide this
        };
      }
      return { success: true, data: prices };
    }
    return { success: false, error: result.error };
  }
  /**
   * Get market data overview
   */
  async getMarketData() {
    const result = await this.request("/api/v1/trading/market", { method: "GET" });
    if (result.success && result.data?.markets) {
      return {
        success: true,
        data: {
          totalMarketCap: 0,
          // Would need separate API
          totalVolume24h: result.data.markets.reduce((sum, m) => sum + (parseFloat(m.volume24h) || 0), 0),
          btcDominance: 0,
          // Would need separate API
          markets: result.data.markets
        }
      };
    }
    return { success: false, error: result.error };
  }
  // ===============================
  // NFT ENDPOINTS
  // ===============================
  /**
   * Get user's NFTs
   */
  async getUserNFTs(walletAddress, options) {
    const params = new URLSearchParams({ address: walletAddress });
    if (options?.chainId) params.set("chainId", options.chainId.toString());
    if (options?.limit) params.set("limit", options.limit.toString());
    if (options?.offset) params.set("offset", options.offset.toString());
    return this.request(`/api/v1/assets/nfts?${params}`, { method: "GET" });
  }
  /**
   * Get NFT details
   */
  async getNFTDetails(contractAddress, tokenId, chainId) {
    return this.request(`/api/v1/assets/nfts/${contractAddress}/${tokenId}?chainId=${chainId}`, { method: "GET" });
  }
  /**
   * Get NFT collection
   */
  async getNFTCollection(contractAddress, chainId) {
    return this.request(`/api/v1/assets/nfts/collection/${contractAddress}?chainId=${chainId}`, { method: "GET" });
  }
  /**
   * Transfer NFT
   */
  async transferNFT(params) {
    return this.request("/api/v1/assets/nfts/transfer", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  // ===============================
  // CONTRACT ENDPOINTS
  // ===============================
  /**
   * Get user's contracts
   */
  async getUserContracts(options) {
    const params = new URLSearchParams();
    if (options?.chainId) params.set("chainId", options.chainId.toString());
    if (options?.limit) params.set("limit", options.limit.toString());
    if (options?.offset) params.set("offset", options.offset.toString());
    return this.request(`/api/v1/contracts?${params}`, { method: "GET" });
  }
  /**
   * Get contract details
   */
  async getContractDetails(address, chainId) {
    return this.request(`/api/v1/contracts/${address}?chainId=${chainId}`, { method: "GET" });
  }
  /**
   * Read contract (call view function)
   */
  async readContract(params) {
    return this.request("/api/v1/contracts/read", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Write to contract (execute transaction)
   */
  async writeContract(params) {
    return this.request("/api/v1/contracts/write", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Deploy contract
   */
  async deployContract(params) {
    return this.request("/api/v1/contracts/deploy", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  // ===============================
  // OFFRAMP ENDPOINTS (Crypto-to-Fiat)
  // ===============================
  /**
   * Get offramp quote
   */
  async getOfframpQuote(cryptoCurrency, cryptoAmount, fiatCurrency, payoutMethod) {
    const params = new URLSearchParams({
      cryptoCurrency,
      cryptoAmount: cryptoAmount.toString(),
      fiatCurrency
    });
    if (payoutMethod) params.set("payoutMethod", payoutMethod);
    return this.request(`/api/v1/fiat/offramp/quote?${params}`, { method: "GET" });
  }
  /**
   * Create offramp transaction
   */
  async createOfframpTransaction(request) {
    return this.request("/api/v1/fiat/offramp", {
      method: "POST",
      body: JSON.stringify(request)
    });
  }
  /**
   * Get offramp transaction status
   */
  async getOfframpStatus(transactionId) {
    return this.request(`/api/v1/fiat/offramp/${transactionId}`, { method: "GET" });
  }
  /**
   * Get supported payout methods
   */
  async getSupportedPayoutMethods(country) {
    const params = country ? `?country=${country}` : "";
    return this.request(`/api/v1/fiat/offramp/methods${params}`, { method: "GET" });
  }
  // ===============================
  // BILL PAYMENT ENDPOINTS
  // ===============================
  /**
   * Get bill providers
   */
  async getBillProviders(country, category) {
    const params = new URLSearchParams();
    if (country) params.set("country", country);
    if (category) params.set("category", category);
    return this.request(`/api/v1/bills/providers?${params}`, { method: "GET" });
  }
  /**
   * Get bill details/validate account
   */
  async validateBillAccount(providerId, accountNumber) {
    return this.request("/api/v1/bills/validate", {
      method: "POST",
      body: JSON.stringify({ providerId, accountNumber })
    });
  }
  /**
   * Pay bill
   */
  async payBill(params) {
    return this.request("/api/v1/bills/pay", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Get bill payment history
   */
  async getBillHistory(options) {
    const params = new URLSearchParams();
    if (options?.limit) params.set("limit", options.limit.toString());
    if (options?.offset) params.set("offset", options.offset.toString());
    return this.request(`/api/v1/bills/history?${params}`, { method: "GET" });
  }
  // ===============================
  // STAKING ENDPOINTS
  // ===============================
  /**
   * Get staking pools
   */
  async getStakingPools(chainId) {
    const params = chainId ? `?chainId=${chainId}` : "";
    return this.request(`/api/v1/staking/pools${params}`, { method: "GET" });
  }
  /**
   * Get user's staking positions
   */
  async getStakingPositions() {
    return this.request("/api/v1/staking/positions", { method: "GET" });
  }
  /**
   * Stake tokens
   */
  async stake(params) {
    return this.request("/api/v1/staking/stake", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Unstake tokens
   */
  async unstake(params) {
    return this.request("/api/v1/staking/unstake", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Claim staking rewards
   */
  async claimStakingRewards(positionId) {
    return this.request("/api/v1/staking/claim", {
      method: "POST",
      body: JSON.stringify({ positionId })
    });
  }
  // ===============================
  // USER PROFILE ENDPOINTS
  // ===============================
  /**
   * Get user profile
   */
  async getUserProfile() {
    return this.request("/api/v1/user/profile", { method: "GET" });
  }
  /**
   * Update user profile
   */
  async updateUserProfile(updates) {
    return this.request("/api/v1/user/profile", {
      method: "PATCH",
      body: JSON.stringify(updates)
    });
  }
  /**
   * Get user settings
   */
  async getUserSettings() {
    return this.request("/api/v1/user/settings", { method: "GET" });
  }
  /**
   * Update user settings
   */
  async updateUserSettings(updates) {
    return this.request("/api/v1/user/settings", {
      method: "PATCH",
      body: JSON.stringify(updates)
    });
  }
  // ===============================
  // NOTIFICATION ENDPOINTS
  // ===============================
  /**
   * Get notifications
   */
  async getNotifications(options) {
    const params = new URLSearchParams();
    if (options?.unreadOnly) params.set("unreadOnly", "true");
    if (options?.limit) params.set("limit", options.limit.toString());
    if (options?.offset) params.set("offset", options.offset.toString());
    return this.request(`/api/v1/notifications?${params}`, { method: "GET" });
  }
  /**
   * Mark notification as read
   */
  async markNotificationRead(notificationId) {
    return this.request(`/api/v1/notifications/${notificationId}/read`, { method: "POST" });
  }
  /**
   * Mark all notifications as read
   */
  async markAllNotificationsRead() {
    return this.request("/api/v1/notifications/read-all", { method: "POST" });
  }
  // ===============================
  // REFERRAL ENDPOINTS
  // ===============================
  /**
   * Get referral info
   */
  async getReferralInfo() {
    return this.request("/api/v1/referral", { method: "GET" });
  }
  /**
   * Get referred users
   */
  async getReferrals() {
    return this.request("/api/v1/referral/list", { method: "GET" });
  }
  /**
   * Apply referral code
   */
  async applyReferralCode(code) {
    return this.request("/api/v1/referral/apply", {
      method: "POST",
      body: JSON.stringify({ code })
    });
  }
  /**
   * Claim referral rewards
   */
  async claimReferralRewards() {
    return this.request("/api/v1/referral/claim", { method: "POST" });
  }
  // ===============================
  // KYC ENDPOINTS
  // ===============================
  /**
   * Get KYC status
   */
  async getKycStatus() {
    return this.request("/api/v1/kyc/status", { method: "GET" });
  }
  /**
   * Start KYC verification
   */
  async startKycVerification(level) {
    return this.request("/api/v1/kyc/start", {
      method: "POST",
      body: JSON.stringify({ level })
    });
  }
  /**
   * Submit KYC documents
   */
  async submitKycDocuments(params) {
    return this.request("/api/v1/kyc/submit", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  // ===============================
  // BRIDGE ENDPOINTS
  // ===============================
  /**
   * Get bridge quote
   */
  async getBridgeQuote(params) {
    return this.request("/api/v1/bridge/quote", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Execute bridge transaction
   */
  async executeBridge(params) {
    return this.request("/api/v1/bridge/execute", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Get bridge transaction status
   */
  async getBridgeStatus(bridgeId) {
    return this.request(`/api/v1/bridge/${bridgeId}`, { method: "GET" });
  }
  /**
   * Get supported bridge routes
   */
  async getSupportedBridgeRoutes() {
    return this.request("/api/v1/bridge/routes", { method: "GET" });
  }
  // ===============================
  // GAS ENDPOINTS
  // ===============================
  /**
   * Get gas estimate for transaction
   */
  async getGasEstimate(params) {
    return this.request("/api/v1/gas/estimate", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Get current gas prices for chain
   */
  async getGasPrice(chainId) {
    return this.request(`/api/v1/gas/price?chainId=${chainId}`, { method: "GET" });
  }
  // ===============================
  // WALLET IMPORT/EXPORT ENDPOINTS
  // ===============================
  /**
   * Import wallet from private key or mnemonic
   */
  async importWallet(request) {
    return this.request("/api/v1/wallet/import", {
      method: "POST",
      body: JSON.stringify(request)
    }, true);
  }
  /**
   * Export wallet (get encrypted private key)
   * Requires additional authentication
   */
  async exportWallet(walletId, pin) {
    return this.request("/api/v1/wallet/export", {
      method: "POST",
      body: JSON.stringify({ walletId, pin })
    }, true);
  }
  /**
   * Generate new mnemonic phrase
   */
  async generateMnemonic() {
    return this.request("/api/v1/wallet/generate-mnemonic", { method: "POST" }, true);
  }
  /**
   * Validate mnemonic phrase
   */
  async validateMnemonic(mnemonic) {
    return this.request("/api/v1/wallet/validate-mnemonic", {
      method: "POST",
      body: JSON.stringify({ mnemonic })
    });
  }
  // ===============================
  // PORTFOLIO ANALYTICS ENDPOINTS
  // ===============================
  /**
   * Get portfolio analytics with historical data
   */
  async getPortfolioAnalytics(walletAddress, period = "30d") {
    const params = new URLSearchParams({ address: walletAddress, period });
    return this.request(`/api/v1/analytics/portfolio?${params}`, { method: "GET" });
  }
  /**
   * Get transaction analytics
   */
  async getTransactionAnalytics(walletAddress, period = "30d") {
    const params = new URLSearchParams({ address: walletAddress, period });
    return this.request(`/api/v1/analytics/transactions?${params}`, { method: "GET" });
  }
  // ===============================
  // ADVANCED TRADING ENDPOINTS
  // ===============================
  /**
   * Create limit order
   */
  async createLimitOrder(params) {
    return this.request("/api/v1/trading/limit-orders", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Get user's limit orders
   */
  async getLimitOrders(status) {
    const params = status ? `?status=${status}` : "";
    return this.request(`/api/v1/trading/limit-orders${params}`, { method: "GET" });
  }
  /**
   * Cancel limit order
   */
  async cancelLimitOrder(orderId) {
    return this.request(`/api/v1/trading/limit-orders/${orderId}`, { method: "DELETE" });
  }
  /**
   * Set price alert
   */
  async setPriceAlert(params) {
    return this.request("/api/v1/trading/alerts", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Get price alerts
   */
  async getPriceAlerts() {
    return this.request("/api/v1/trading/alerts", { method: "GET" });
  }
  /**
   * Delete price alert
   */
  async deletePriceAlert(alertId) {
    return this.request(`/api/v1/trading/alerts/${alertId}`, { method: "DELETE" });
  }
  // ===============================
  // SESSION MANAGEMENT
  // ===============================
  /**
   * Get active sessions
   */
  async getActiveSessions() {
    return this.request("/api/v1/auth/sessions", { method: "GET" });
  }
  /**
   * Revoke session
   */
  async revokeSession(sessionId) {
    return this.request(`/api/v1/auth/sessions/${sessionId}`, { method: "DELETE" });
  }
  /**
   * Revoke all other sessions
   */
  async revokeAllOtherSessions() {
    return this.request("/api/v1/auth/sessions/revoke-all", { method: "POST" });
  }
  // ========== Webhooks ==========
  /**
   * List webhooks for the project
   */
  async listWebhooks(options) {
    const params = new URLSearchParams();
    if (options?.isActive !== void 0) params.set("isActive", String(options.isActive));
    const query = params.toString();
    return this.request(`/api/v1/webhooks${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get webhook by ID
   */
  async getWebhook(webhookId) {
    return this.request(`/api/v1/webhooks/${webhookId}`, { method: "GET" });
  }
  /**
   * Create a webhook
   */
  async createWebhook(input) {
    return this.request("/api/v1/webhooks", {
      method: "POST",
      body: JSON.stringify(input)
    });
  }
  /**
   * Update a webhook
   */
  async updateWebhook(webhookId, input) {
    return this.request(`/api/v1/webhooks/${webhookId}`, {
      method: "PATCH",
      body: JSON.stringify(input)
    });
  }
  /**
   * Delete a webhook
   */
  async deleteWebhook(webhookId) {
    return this.request(`/api/v1/webhooks/${webhookId}`, { method: "DELETE" });
  }
  /**
   * Get webhook deliveries
   */
  async getWebhookDeliveries(webhookId, options) {
    const params = new URLSearchParams();
    if (options?.status) params.set("status", options.status);
    if (options?.limit) params.set("limit", String(options.limit));
    if (options?.offset) params.set("offset", String(options.offset));
    const query = params.toString();
    return this.request(`/api/v1/webhooks/${webhookId}/deliveries${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Test a webhook
   */
  async testWebhook(webhookId) {
    return this.request(`/api/v1/webhooks/${webhookId}/test`, { method: "POST" });
  }
  // ========== Admin (requires admin role) ==========
  /**
   * List all users (admin only)
   */
  async adminListUsers(options) {
    const params = new URLSearchParams();
    if (options?.page) params.set("page", String(options.page));
    if (options?.limit) params.set("limit", String(options.limit));
    if (options?.search) params.set("search", options.search);
    if (options?.sortBy) params.set("sortBy", options.sortBy);
    if (options?.sortOrder) params.set("sortOrder", options.sortOrder);
    if (options?.role) params.set("role", options.role);
    if (options?.kycStatus) params.set("kycStatus", options.kycStatus);
    if (options?.isActive !== void 0) params.set("isActive", String(options.isActive));
    const query = params.toString();
    return this.request(`/api/v1/admin/users${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get user by ID (admin only)
   */
  async adminGetUser(userId) {
    return this.request(`/api/v1/admin/users/${userId}`, { method: "GET" });
  }
  /**
   * Update user (admin only)
   */
  async adminUpdateUser(userId, data) {
    return this.request(`/api/v1/admin/users/${userId}`, {
      method: "PATCH",
      body: JSON.stringify(data)
    });
  }
  /**
   * List all projects (admin only)
   */
  async adminListProjects(options) {
    const params = new URLSearchParams();
    if (options?.page) params.set("page", String(options.page));
    if (options?.limit) params.set("limit", String(options.limit));
    if (options?.search) params.set("search", options.search);
    if (options?.sortBy) params.set("sortBy", options.sortBy);
    if (options?.sortOrder) params.set("sortOrder", options.sortOrder);
    if (options?.isActive !== void 0) params.set("isActive", String(options.isActive));
    const query = params.toString();
    return this.request(`/api/v1/admin/projects${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get project by ID (admin only)
   */
  async adminGetProject(projectId) {
    return this.request(`/api/v1/admin/projects/${projectId}`, { method: "GET" });
  }
  /**
   * Update project (admin only)
   */
  async adminUpdateProject(projectId, data) {
    return this.request(`/api/v1/admin/projects/${projectId}`, {
      method: "PATCH",
      body: JSON.stringify(data)
    });
  }
  /**
   * Regenerate project API key (admin only)
   */
  async adminRegenerateApiKey(projectId) {
    return this.request(`/api/v1/admin/projects/${projectId}/regenerate-key`, { method: "POST" });
  }
  /**
   * Get system statistics (admin only)
   */
  async adminGetStats(days) {
    const query = days ? `?days=${days}` : "";
    return this.request(`/api/v1/admin/stats${query}`, { method: "GET" });
  }
  /**
   * Get system logs (admin only)
   */
  async adminGetLogs(options) {
    const params = new URLSearchParams();
    if (options?.level) params.set("level", options.level);
    if (options?.service) params.set("service", options.service);
    if (options?.limit) params.set("limit", String(options.limit));
    if (options?.offset) params.set("offset", String(options.offset));
    if (options?.startDate) params.set("startDate", options.startDate);
    if (options?.endDate) params.set("endDate", options.endDate);
    const query = params.toString();
    return this.request(`/api/v1/admin/logs${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get rate limit status (admin only)
   */
  async adminGetRateLimits(options) {
    const params = new URLSearchParams();
    if (options?.identifier) params.set("identifier", options.identifier);
    if (options?.limit) params.set("limit", String(options.limit));
    const query = params.toString();
    return this.request(`/api/v1/admin/rate-limits${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Clear rate limits for an identifier (admin only)
   */
  async adminClearRateLimits(identifier) {
    return this.request(`/api/v1/admin/rate-limits/${identifier}`, { method: "DELETE" });
  }
  // ========== AI Agent Configuration ==========
  /**
   * Get all AI agent configurations
   * This returns the full agent setup including tiers, cycles, and trading parameters
   */
  async getAgentConfigs(options) {
    const params = new URLSearchParams();
    if (options?.includeInactive) params.set("includeInactive", "true");
    if (options?.agentId) params.set("agentId", options.agentId);
    const query = params.toString();
    return this.request(`/api/v1/agents${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Calculate subscription parameters for an agent
   */
  async calculateAgentParams(params) {
    return this.request("/api/v1/agents/calculate", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Get supported trading pairs from agents
   */
  async getTradingPairs() {
    const result = await this.getAgentConfigs();
    if (result.success && result.data?.agents) {
      const allPairs = /* @__PURE__ */ new Set();
      const byAgent = {};
      for (const agent of result.data.agents) {
        byAgent[agent.id] = agent.supported_pairs;
        agent.supported_pairs.forEach((p) => allPairs.add(p));
      }
      return { success: true, data: { pairs: Array.from(allPairs), byAgent } };
    }
    return { success: false, error: result.error };
  }
  // ========== AI Quant Trading ==========
  /**
   * Get all AI trading strategies
   */
  async getAIStrategies(filters) {
    const params = new URLSearchParams();
    if (filters?.category) params.set("category", filters.category);
    if (filters?.riskLevel) params.set("risk_level", String(filters.riskLevel));
    if (filters?.minTvl) params.set("min_tvl", String(filters.minTvl));
    if (filters?.isActive !== void 0) params.set("is_active", String(filters.isActive));
    const query = params.toString();
    return this.request(`/api/v1/ai-quant/strategies${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get AI strategy details
   */
  async getAIStrategy(strategyId, include) {
    const params = new URLSearchParams();
    if (include?.length) params.set("include", include.join(","));
    const query = params.toString();
    return this.request(`/api/v1/ai-quant/strategies/${strategyId}${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get strategy performance history
   */
  async getAIStrategyPerformance(strategyId, days = 30) {
    return this.request(`/api/v1/ai-quant/strategies/${strategyId}?include=performance&days=${days}`, { method: "GET" });
  }
  /**
   * Get real-time market data for strategy pairs
   */
  async getAIStrategyMarketData(strategyId) {
    return this.request(`/api/v1/ai-quant/strategies/${strategyId}?include=market`, { method: "GET" });
  }
  /**
   * Create AI trading order
   */
  async createAIOrder(request) {
    return this.request("/api/v1/ai-quant/orders", {
      method: "POST",
      body: JSON.stringify(request)
    });
  }
  /**
   * Get user's AI orders
   */
  async getAIOrders(filters) {
    const params = new URLSearchParams();
    if (filters?.strategyId) params.set("strategy_id", filters.strategyId);
    if (filters?.status) params.set("status", filters.status);
    const query = params.toString();
    return this.request(`/api/v1/ai-quant/orders${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get AI order details
   */
  async getAIOrder(orderId) {
    return this.request(`/api/v1/ai-quant/orders/${orderId}`, { method: "GET" });
  }
  /**
   * Pause AI order
   */
  async pauseAIOrder(orderId) {
    return this.request(`/api/v1/ai-quant/orders/${orderId}/pause`, { method: "POST" });
  }
  /**
   * Resume AI order
   */
  async resumeAIOrder(orderId) {
    return this.request(`/api/v1/ai-quant/orders/${orderId}/resume`, { method: "POST" });
  }
  /**
   * Request redemption for AI order
   */
  async redeemAIOrder(orderId) {
    return this.request(`/api/v1/ai-quant/orders/${orderId}/redeem`, { method: "POST" });
  }
  /**
   * Get AI portfolio summary
   */
  async getAIPortfolio(include) {
    const params = new URLSearchParams();
    if (include?.length) params.set("include", include.join(","));
    const query = params.toString();
    return this.request(`/api/v1/ai-quant/portfolio${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Get user's trade allocations
   */
  async getAITradeAllocations(limit = 50) {
    return this.request(`/api/v1/ai-quant/portfolio?include=allocations&limit=${limit}`, { method: "GET" });
  }
  /**
   * Get trade history for a strategy
   */
  async getAITradeHistory(strategyId, limit = 50) {
    return this.request(`/api/v1/ai-quant/strategies/${strategyId}?include=trades&limit=${limit}`, { method: "GET" });
  }
  /**
   * Execute AI signals for a strategy (admin only)
   */
  async executeAISignals(strategyId) {
    return this.request("/api/v1/ai-quant/execute", {
      method: "POST",
      body: JSON.stringify({ strategyId })
    });
  }
  // ========== Free Price APIs (No API Key Required) ==========
  /**
   * Get cryptocurrency prices (FREE - uses CoinGecko/Binance/CoinCap)
   */
  async getCryptoPrices(symbols) {
    return this.request(`/api/v1/prices?symbols=${symbols.join(",")}`, { method: "GET" });
  }
  /**
   * Get single cryptocurrency price (FREE)
   */
  async getCryptoPrice(symbol) {
    return this.request(`/api/v1/prices/${symbol}`, { method: "GET" });
  }
  /**
   * Get OHLCV candles for charting (FREE - from Binance)
   */
  async getCryptoCandles(symbol, interval = "1h", limit = 100) {
    return this.request(`/api/v1/prices/${symbol}?candles=true&interval=${interval}&limit=${limit}`, { method: "GET" });
  }
  /**
   * Get top cryptocurrencies by market cap (FREE)
   */
  async getTopCryptos(limit = 20) {
    return this.request(`/api/v1/prices?type=top&limit=${limit}`, { method: "GET" });
  }
  /**
   * Get crypto market overview (FREE)
   */
  async getCryptoMarketOverview() {
    return this.request("/api/v1/prices?type=overview", { method: "GET" });
  }
  // ========== Project Management ==========
  /**
   * Get user's projects
   */
  async getProjects(options) {
    const params = new URLSearchParams();
    if (options?.isActive !== void 0) params.set("isActive", String(options.isActive));
    const query = params.toString();
    return this.request(`/api/v1/projects${query ? `?${query}` : ""}`, { method: "GET" });
  }
  /**
   * Create a new project for ecosystem partners
   */
  async createProject(params) {
    return this.request("/api/v1/projects", {
      method: "POST",
      body: JSON.stringify(params)
    });
  }
  /**
   * Get project details
   */
  async getProject(projectId) {
    return this.request(`/api/v1/projects/${projectId}`, { method: "GET" });
  }
  /**
   * Update project settings
   */
  async updateProject(projectId, updates) {
    return this.request(`/api/v1/projects/${projectId}`, {
      method: "PATCH",
      body: JSON.stringify(updates)
    });
  }
  /**
   * Get project features status
   */
  async getProjectFeatures(projectId) {
    return this.request(`/api/v1/projects/${projectId}/features`, { method: "GET" });
  }
  /**
   * Enable/disable features for a project
   */
  async updateProjectFeatures(projectId, features) {
    return this.request(`/api/v1/projects/${projectId}/features`, {
      method: "PATCH",
      body: JSON.stringify(features)
    });
  }
  /**
   * Regenerate project API key
   */
  async regenerateProjectApiKey(projectId) {
    return this.request(`/api/v1/projects/${projectId}/api-key`, { method: "POST" });
  }
  /**
   * Delete project
   */
  async deleteProject(projectId) {
    return this.request(`/api/v1/projects/${projectId}`, { method: "DELETE" });
  }
};
function createOneEngineClient(options) {
  return new OneEngineClient(options);
}
var OneContext = createContext(null);
var DEFAULT_AUTH_OPTIONS = {
  email: true,
  phone: false,
  google: true,
  apple: true,
  facebook: false,
  discord: false,
  passkey: true,
  guest: false
};
function createWalletConfig(config2) {
  const authOptions = { ...DEFAULT_AUTH_OPTIONS, ...config2.authOptions };
  const authMethods = [];
  if (authOptions.google) authMethods.push("google");
  if (authOptions.apple) authMethods.push("apple");
  if (authOptions.facebook) authMethods.push("facebook");
  if (authOptions.discord) authMethods.push("discord");
  if (authOptions.passkey) authMethods.push("passkey");
  const inApp = inAppWallet({
    auth: {
      options: authMethods
    },
    metadata: config2.appName ? {
      name: config2.appName,
      image: config2.appIcon ? { src: config2.appIcon, width: 100, height: 100 } : void 0
    } : void 0
  });
  if (config2.sponsorGas) {
    const chain = config2.defaultChain || base;
    return [
      smartWallet({
        chain,
        sponsorGas: true
      })
    ];
  }
  return [inApp];
}
function OneProvider({
  children,
  config: config2,
  thirdweb: thirdwebConfig = {},
  autoFetchBalance = true
}) {
  useMemo(() => {
    initOneSDK(config2);
  }, [config2]);
  const [isInitialized, setIsInitialized] = useState(true);
  const engine = useMemo(() => createOneEngineClient({
    baseUrl: config2.oneEngineUrl,
    clientId: config2.oneClientId,
    secretKey: config2.oneSecretKey
  }), [config2]);
  const [thirdwebClientId, setThirdwebClientId] = useState(null);
  const [thirdwebLoading, setThirdwebLoading] = useState(true);
  const [thirdwebError, setThirdwebError] = useState(null);
  useEffect(() => {
    const fetchClientConfig = async () => {
      try {
        const response = await fetch(`${config2.oneEngineUrl}/api/v1/config/thirdweb`);
        if (response.ok) {
          const data = await response.json();
          if (data.success && data.data?.clientId) {
            setThirdwebClientId(data.data.clientId);
          } else {
            const envClientId = typeof window !== "undefined" ? window.__NEXT_PUBLIC_THIRDWEB_CLIENT_ID : process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
            if (envClientId) {
              setThirdwebClientId(envClientId);
            } else {
              setThirdwebError("Failed to load wallet configuration");
            }
          }
        } else {
          const envClientId = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
          if (envClientId) {
            setThirdwebClientId(envClientId);
          } else {
            setThirdwebError("Wallet service unavailable");
          }
        }
      } catch (err) {
        const envClientId = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
        if (envClientId) {
          setThirdwebClientId(envClientId);
        } else {
          console.warn("Failed to fetch thirdweb config:", err);
        }
      } finally {
        setThirdwebLoading(false);
      }
    };
    fetchClientConfig();
  }, [config2.oneEngineUrl]);
  const thirdwebClient = useMemo(() => {
    if (!thirdwebClientId) return null;
    return createThirdwebClient({ clientId: thirdwebClientId });
  }, [thirdwebClientId]);
  useMemo(() => createWalletConfig(thirdwebConfig), [thirdwebConfig]);
  const [user, setUser] = useState(null);
  const [accessToken, setAccessToken] = useState(null);
  const [authLoading, setAuthLoading] = useState(true);
  const sendOtp = useCallback(async (email) => {
    const result = await engine.sendEmailOtp(email);
    if (!result.success) {
      return { success: false, error: result.error?.message };
    }
    return { success: true };
  }, [engine]);
  const verifyOtp = useCallback(async (email, otp) => {
    const result = await engine.verifyEmailOtp(email, otp);
    if (!result.success || !result.data) {
      return { success: false, error: result.error?.message };
    }
    const { user: authUser, accessToken: token } = result.data;
    setUser(authUser);
    setAccessToken(token);
    engine.setAccessToken(token);
    return { success: true };
  }, [engine]);
  const signOut = useCallback(async () => {
    await engine.signOut();
    setUser(null);
    setAccessToken(null);
    engine.clearAccessToken();
  }, [engine]);
  const refreshUser = useCallback(async () => {
    try {
      if (accessToken) {
        engine.setAccessToken(accessToken);
        const result = await engine.getCurrentUser();
        if (result.success && result.data) {
          setUser(result.data);
        }
      }
    } finally {
      setAuthLoading(false);
    }
  }, [engine, accessToken]);
  useEffect(() => {
    refreshUser();
  }, []);
  const [walletAddress, setWalletAddress] = useState(null);
  const [walletBalance, setWalletBalance] = useState(null);
  const [walletLoading, setWalletLoading] = useState(false);
  const [walletError, setWalletError] = useState(null);
  const fetchBalance = useCallback(async (chains) => {
    if (!walletAddress) return;
    setWalletLoading(true);
    setWalletError(null);
    try {
      const result = await engine.getWalletBalance(walletAddress, chains);
      if (result.success && result.data) {
        setWalletBalance(result.data);
      } else {
        setWalletError(result.error?.message || "Failed to fetch balance");
      }
    } catch (error) {
      setWalletError(error instanceof Error ? error.message : "Failed to fetch balance");
    } finally {
      setWalletLoading(false);
    }
  }, [walletAddress, engine]);
  const refreshBalance = useCallback(async () => {
    await fetchBalance();
  }, [fetchBalance]);
  useEffect(() => {
    if (autoFetchBalance && walletAddress && isInitialized) {
      fetchBalance();
    }
  }, [walletAddress, autoFetchBalance, isInitialized, fetchBalance]);
  const [onrampOpen, setOnrampOpen] = useState(false);
  const [onrampUrl, setOnrampUrl] = useState(null);
  const [onrampSessionId, setOnrampSessionId] = useState(null);
  const openOnramp = useCallback(async (options) => {
    if (!walletAddress) return;
    const result = await engine.createOnrampSession({
      walletAddress,
      fiatCurrency: "USD",
      cryptoCurrency: "ETH",
      ...options
    });
    if (result.success && result.data) {
      setOnrampUrl(result.data.widgetUrl);
      setOnrampSessionId(result.data.sessionId);
      setOnrampOpen(true);
    }
  }, [walletAddress, engine]);
  const closeOnramp = useCallback(() => {
    setOnrampOpen(false);
    setOnrampUrl(null);
  }, []);
  const getOnrampQuote = useCallback(async (fiatCurrency, fiatAmount, cryptoCurrency) => {
    const result = await engine.getOnrampQuote(fiatCurrency, fiatAmount, cryptoCurrency);
    return result.success ? result.data : null;
  }, [engine]);
  const getSwapQuote = useCallback(async (request) => {
    const result = await engine.getSwapQuote(request);
    return result.success ? result.data || null : null;
  }, [engine]);
  const executeSwap = useCallback(async (quoteId) => {
    if (!walletAddress) return null;
    const result = await engine.executeSwap({ quoteId, walletAddress });
    return result.success ? result.data : null;
  }, [engine, walletAddress]);
  const getSupportedTokens = useCallback(async (chainId) => {
    const result = await engine.getSupportedSwapTokens(chainId);
    return result.success && result.data ? result.data.tokens : [];
  }, [engine]);
  const getSupportedChains = useCallback(async () => {
    const result = await engine.getSupportedSwapChains();
    return result.success && result.data ? result.data.chains : [];
  }, [engine]);
  const [strategies, setStrategies] = useState([]);
  const [orders, setOrders] = useState([]);
  const [portfolioStats, setPortfolioStats] = useState(null);
  const [tradingLoading, setTradingLoading] = useState(false);
  const fetchStrategies = useCallback(async () => {
    setTradingLoading(true);
    try {
      const result = await engine.getStrategies();
      if (result.success && result.data) {
        setStrategies(result.data);
      }
    } finally {
      setTradingLoading(false);
    }
  }, [engine]);
  const fetchOrders = useCallback(async () => {
    const result = await engine.getUserOrders();
    if (result.success && result.data) {
      setOrders(result.data);
    }
  }, [engine]);
  const fetchPortfolio = useCallback(async () => {
    const result = await engine.getPortfolioStats();
    if (result.success && result.data) {
      setPortfolioStats(result.data);
    }
  }, [engine]);
  const createOrder = useCallback(async (strategyId, amount, currency) => {
    const result = await engine.createOrder(strategyId, amount, currency);
    if (result.success) {
      await fetchOrders();
      await fetchPortfolio();
    }
    return result;
  }, [engine, fetchOrders, fetchPortfolio]);
  const contextValue = useMemo(() => ({
    isInitialized,
    config: isInitialized ? config2 : null,
    engine,
    thirdwebClient,
    auth: {
      user,
      isAuthenticated: !!user,
      isLoading: authLoading,
      accessToken,
      sendOtp,
      verifyOtp,
      signOut,
      refreshUser
    },
    wallet: {
      address: walletAddress,
      balance: walletBalance,
      tokens: walletBalance?.tokens || [],
      totalUsd: walletBalance?.totalUsd || 0,
      isLoading: walletLoading,
      error: walletError,
      setAddress: setWalletAddress,
      fetchBalance,
      refreshBalance,
      thirdwebClient,
      isThirdwebReady: !thirdwebLoading && !!thirdwebClient
    },
    onramp: {
      isOpen: onrampOpen,
      widgetUrl: onrampUrl,
      sessionId: onrampSessionId,
      openOnramp,
      closeOnramp,
      getQuote: getOnrampQuote
    },
    swap: {
      getQuote: getSwapQuote,
      executeSwap,
      getSupportedTokens,
      getSupportedChains
    },
    trading: {
      strategies,
      orders,
      portfolioStats,
      isLoading: tradingLoading,
      fetchStrategies,
      fetchOrders,
      fetchPortfolio,
      createOrder
    }
  }), [
    isInitialized,
    config2,
    engine,
    thirdwebClient,
    thirdwebLoading,
    user,
    authLoading,
    accessToken,
    sendOtp,
    verifyOtp,
    signOut,
    refreshUser,
    walletAddress,
    walletBalance,
    walletLoading,
    walletError,
    fetchBalance,
    refreshBalance,
    onrampOpen,
    onrampUrl,
    onrampSessionId,
    openOnramp,
    closeOnramp,
    getOnrampQuote,
    getSwapQuote,
    executeSwap,
    getSupportedTokens,
    getSupportedChains,
    strategies,
    orders,
    portfolioStats,
    tradingLoading,
    fetchStrategies,
    fetchOrders,
    fetchPortfolio,
    createOrder
  ]);
  const content = /* @__PURE__ */ jsx(OneContext.Provider, { value: contextValue, children });
  if (thirdwebClient) {
    return /* @__PURE__ */ jsx(ThirdwebProvider, { children: content });
  }
  return content;
}
function useOne() {
  const context = useContext(OneContext);
  if (!context) {
    throw new Error("useOne must be used within a OneProvider");
  }
  return context;
}
function useOneAuth() {
  const { auth } = useOne();
  return auth;
}
function useOneWallet() {
  const { wallet } = useOne();
  return wallet;
}
function useOneOnramp() {
  const { onramp } = useOne();
  return onramp;
}
function useOneSwap() {
  const { swap } = useOne();
  return swap;
}
function useOneTrading() {
  const { trading } = useOne();
  return trading;
}
function useOneEngine() {
  const { engine } = useOne();
  return engine;
}
function useThirdwebClient() {
  const { thirdwebClient } = useOne();
  return thirdwebClient;
}

export { OneContext, OneProvider, OneProvider as OneThirdwebProvider, useOne, useOneAuth, useOneEngine, useOneOnramp, useOneSwap, useOneTrading, useOneWallet, useThirdwebClient };
//# sourceMappingURL=index.mjs.map
//# sourceMappingURL=index.mjs.map