/// <reference types="react" />
import { BigNumberish } from '@ethersproject/bignumber';
import { JsonRpcProvider } from '@ethersproject/providers';
import { Provider } from '@web3-react/types';
export { Provider as Eip1193Provider } from '@web3-react/types';
import { ErrorInfo } from 'react';
export { Provider as EthersProvider } from '@ethersproject/abstract-provider';
export { TokenInfo } from '@uniswap/token-lists';

declare type LpInfo = {
    lpChainId: number;
    currencyAAddress: string;
    currencyBAddress: string;
    routerAddress: string;
    tokenPairName: string;
};

interface FeeOptions {
    convenienceFee?: number;
    convenienceFeeRecipient?: string | string | {
        [chainId: number]: string;
    };
}

interface ICall {
    _to: string;
    _value: BigNumberish;
    _calldata: string;
}

interface SwapProps extends FeeOptions {
    onConnectWallet?: () => void;
    destinationChainId?: number;
    outputTokenAddress?: string;
    price?: number;
    calls?: ICall[];
    title?: string;
    widgetMode?: string;
    lpInfo?: LpInfo;
    baseColor?: string;
    hoverColor?: string;
}

/**
 * List of all the networks supported by the Uniswap Interface
 */
declare enum SupportedChainId {
    MAINNET = 1,
    ROPSTEN = 3,
    RINKEBY = 4,
    GOERLI = 5,
    KOVAN = 42,
    ARBITRUM_ONE = 42161,
    ARBITRUM_RINKEBY = 421611,
    OPTIMISM = 10,
    OPTIMISTIC_KOVAN = 69,
    POLYGON = 137,
    POLYGON_MUMBAI = 80001,
    AVALANCHE = 43114,
    SOLANA = 12345
}

declare const SUPPORTED_LOCALES: string[];
declare type SupportedLocale = typeof SUPPORTED_LOCALES[number] | 'pseudo';
declare const DEFAULT_LOCALE: SupportedLocale;

declare type OnTxSubmit = (srcChainId?: number, srcHash?: string, isCrossChain?: boolean) => void;
declare type OnTxSuccess = (srcChainId?: number, srcHash?: string, isCrossChain?: boolean) => void;
declare type OnTxFail = (srcChainId?: number, srcHash?: string, isCrossChain?: boolean) => void;
interface TransactionEventHandlers {
    onTxSubmit?: OnTxSubmit;
    onTxSuccess?: OnTxSuccess;
    onTxFail?: OnTxFail;
    isCrossChain?: boolean;
}

declare type OnError = (error: Error, info: ErrorInfo) => void;

interface WidgetProps extends TransactionEventHandlers {
    locale?: SupportedLocale;
    provider?: Provider | JsonRpcProvider;
    width?: string | number;
    dialog?: HTMLDivElement | null;
    className?: string;
    onError?: OnError;
    jsonRpcEndpoints: Partial<Record<SupportedChainId, string>>;
    destinationChainId?: SupportedChainId;
    darkMode?: boolean;
    baseColor?: string;
    hoverColor?: string;
}

declare type DefaultAddress = string | {
    [chainId: number]: string | 'NATIVE';
} | 'NATIVE';
interface TokenDefaults {
    outputTokenAddress?: DefaultAddress;
    price?: number | string;
    destinationChainId?: number;
    widgetMode?: string;
}

interface Colors {
    accent: string;
    container: string;
    module: string;
    interactive: string;
    link: string;
    buttonInteractive: string;
    outline: string;
    dialog: string;
    disabled: string;
    primary: string;
    onAccent: string;
    secondary: string;
    hint: string;
    onInteractive: string;
    active: string;
    success: string;
    warning: string;
    error: string;
    currentColor: string;
    borderColor: string;
    bgBoardColor: string;
    bgBoardColor2: string;
    blurSize: string;
    borderRadius: string;
    gradientBG: string;
    cardTransparency1: string;
    cardTransparency2: string;
    networkSelector: string;
}
interface Attributes {
    borderRadius: boolean | number | string;
    fontFamily: string | {
        font: string;
        variable: string;
    };
    fontFamilyCode: string;
    tokenColorExtraction: boolean;
}
interface Theme extends Partial<Attributes>, Partial<Omit<Colors, 'borderRadius'>> {
}

declare const lightTheme: Colors;
declare const darkTheme: Colors;
declare const defaultTheme: {
    borderRadius: string;
    accent: string;
    container: string;
    module: string;
    interactive: string;
    link: string;
    buttonInteractive: string;
    outline: string;
    dialog: string;
    disabled: string;
    primary: string;
    onAccent: string;
    secondary: string;
    hint: string;
    onInteractive: string;
    active: string;
    success: string;
    warning: string;
    error: string;
    currentColor: string;
    borderColor: string;
    bgBoardColor: string;
    bgBoardColor2: string;
    blurSize: string;
    gradientBG: string;
    cardTransparency1: string;
    cardTransparency2: string;
    networkSelector: string;
    fontFamily: {
        font: string;
        variable: string;
    };
    fontFamilyCode: string;
    tokenColorExtraction: boolean;
};

declare type BrydgeWidgetProps = SwapProps & WidgetProps;

declare function BrydgeWidget(props: BrydgeWidgetProps): JSX.Element;

export { BrydgeWidget, BrydgeWidgetProps, DEFAULT_LOCALE, DefaultAddress, FeeOptions, ICall, LpInfo, OnError, SUPPORTED_LOCALES, SupportedChainId, SupportedLocale, Theme, TokenDefaults, darkTheme, defaultTheme, lightTheme };
