/// <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';

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

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

interface FeeOptions {
    convenienceFee?: number;
    convenienceFeeRecipient?: string | string | {
        [chainId: number]: 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;
    testMode?: boolean;
}

/**
 * List of all the networks supported by brydge-network
 */
declare enum SupportedChainId {
    MAINNET = 1,
    ARBITRUM_ONE = 42161,
    OPTIMISM = 10,
    POLYGON = 137,
    AVALANCHE = 43114
}

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;
declare type OnApproval = (srcChainId?: number, hash?: string) => void;
interface TransactionEventHandlers {
    onTxSubmit?: OnTxSubmit;
    onTxSuccess?: OnTxSuccess;
    onTxFail?: OnTxFail;
    onApproval?: OnApproval;
    isCrossChain?: boolean;
}

interface Colors {
    accent: string;
    container: string;
    module: string;
    interactive: string;
    outline: string;
    dialog: string;
    primary: string;
    onAccent: string;
    secondary: string;
    hint: string;
    onInteractive: string;
    active: string;
    success: string;
    warning: string;
    error: string;
    currentColor: 'currentColor';
}
interface Attributes {
    borderRadius: boolean | number;
    fontFamily: string | {
        font: string;
        variable: string;
    };
    fontFamilyCode: string;
    tokenColorExtraction: boolean;
}
interface Theme extends Partial<Attributes>, Partial<Colors> {
}

declare const lightTheme: Colors;
declare const darkTheme: Colors;
declare const defaultTheme: Required<Theme>;

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

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

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

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 };
