///
import { JsonRpcProvider } from '@ethersproject/providers';
export { JsonRpcProvider } from '@ethersproject/providers';
import { Provider } from '@web3-react/types';
export { Provider as Eip1193Provider } from '@web3-react/types';
import { Currency, TradeType, Percent, CurrencyAmount } from '@uniswap/sdk-core';
export { Currency, TradeType } from '@uniswap/sdk-core';
import { TokenInfo } from '@uniswap/token-lists';
export { TokenInfo } from '@uniswap/token-lists';
import { TransactionReceipt, TransactionResponse } from '@ethersproject/abstract-provider';
export { Provider as EthersProvider } from '@ethersproject/abstract-provider';
import { Trade } from '@uniswap/router-sdk';
import { ErrorInfo } from 'react';
interface Slippage {
auto: boolean;
max: string | undefined;
}
interface Settings {
slippage: Slippage;
transactionTtl: number | undefined;
}
declare enum Field {
INPUT = "INPUT",
OUTPUT = "OUTPUT"
}
interface Swap {
type: TradeType;
amount: string;
[Field.INPUT]?: Currency;
[Field.OUTPUT]?: Currency;
}
/** An integration hook called when the user resets settings. */
declare type OnSettingsReset = () => void;
/** An integration hook called when the user changes slippage settings. */
declare type OnSlippageChange = (slippage: Slippage) => void;
/** An integration hook called when the user changes transaction deadline settings. */
declare type OnTransactionDeadlineChange = (ttl: number | undefined) => void;
/** An integration hook called when the user selects a new token. */
declare type OnTokenChange = (field: Field, token: Currency) => void;
/** An integration hook called when the user enters a new amount. */
declare type OnAmountChange = (field: Field, amount: string) => void;
/** An integration hook called when the user switches the tokens. */
declare type OnSwitchTokens = () => void;
/**
* An integration hook called when the user clicks 'Review swap'.
* If the hook resolves to false or rejects, the review dialog will not open.
*/
declare type OnReviewSwapClick = () => void | boolean | Promise;
/**
* An integration hook called when the user clicks the token selector.
* If the hook resolve to false or rejects, the token selector will not open.
*/
declare type OnTokenSelectorClick = (field: Field) => void | boolean | Promise;
interface SwapEventHandlers {
onSettingsReset?: OnSettingsReset;
onSlippageChange?: OnSlippageChange;
onTransactionDeadlineChange?: OnTransactionDeadlineChange;
onTokenChange?: OnTokenChange;
onAmountChange?: OnAmountChange;
onSwitchTokens?: OnSwitchTokens;
onReviewSwapClick?: OnReviewSwapClick;
onTokenSelectorClick?: OnTokenSelectorClick;
}
declare type SwapSettingsController = Settings;
declare type SwapController = Swap;
interface FeeOptions {
convenienceFee?: number;
convenienceFeeRecipient?: string | string | {
[chainId: number]: string;
};
}
declare type DefaultAddress = string | {
[chainId: number]: string | 'NATIVE';
} | 'NATIVE';
interface TokenDefaults {
defaultInputTokenAddress?: DefaultAddress;
defaultInputAmount?: number | string;
defaultOutputTokenAddress?: DefaultAddress;
defaultOutputAmount?: number | string;
}
interface BrandingSettings {
disableBranding?: boolean;
}
declare type OnConnectWalletClick = () => void | boolean | Promise;
interface WidgetEventHandlers {
onConnectWalletClick?: OnConnectWalletClick;
}
interface SwapProps extends BrandingSettings, FeeOptions, SwapEventHandlers, TokenDefaults, WidgetEventHandlers {
hideConnectionUI?: boolean;
provider?: Provider | JsonRpcProvider;
routerUrl?: string;
settings?: SwapSettingsController;
value?: SwapController;
}
/**
* 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
}
declare const SUPPORTED_LOCALES: string[];
declare type SupportedLocale = typeof SUPPORTED_LOCALES[number] | 'pseudo';
declare const DEFAULT_LOCALE: SupportedLocale;
declare enum TransactionType {
APPROVAL = 0,
SWAP = 1,
WRAP = 2,
UNWRAP = 3
}
interface BaseTransactionInfo {
type: TransactionType;
response: TransactionResponse;
}
interface ApprovalTransactionInfo extends BaseTransactionInfo {
type: TransactionType.APPROVAL;
tokenAddress: string;
spenderAddress: string;
}
interface SwapTransactionInfo extends BaseTransactionInfo {
type: TransactionType.SWAP;
tradeType: TradeType;
trade: Trade;
slippageTolerance: Percent;
}
interface ExactInputSwapTransactionInfo extends SwapTransactionInfo {
tradeType: TradeType.EXACT_INPUT;
}
interface ExactOutputSwapTransactionInfo extends SwapTransactionInfo {
tradeType: TradeType.EXACT_OUTPUT;
}
interface WrapTransactionInfo extends BaseTransactionInfo {
type: TransactionType.WRAP;
amount: CurrencyAmount;
}
interface UnwrapTransactionInfo extends BaseTransactionInfo {
type: TransactionType.UNWRAP;
amount: CurrencyAmount;
}
declare type TransactionInfo = ApprovalTransactionInfo | SwapTransactionInfo | WrapTransactionInfo | UnwrapTransactionInfo;
interface Transaction {
addedTime: number;
lastCheckedBlockNumber?: number;
receipt?: TransactionReceipt;
info: T;
}
declare type OnTxSubmit = (hash: string, tx: Transaction) => void;
declare type OnTxSuccess = (hash: string, receipt: TransactionReceipt) => void;
declare type OnTxFail = (hash: string, receipt: TransactionReceipt) => void;
interface TransactionEventHandlers {
onTxSubmit?: OnTxSubmit;
onTxSuccess?: OnTxSuccess;
onTxFail?: OnTxFail;
}
declare type JsonRpcUrlMap = {
[chainId: number]: string | string[];
};
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, Partial {
}
declare const lightTheme: Colors;
declare const darkTheme: Colors;
declare const defaultTheme: {
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";
borderRadius: number;
fontFamily: {
font: string;
variable: string;
};
fontFamilyCode: string;
tokenColorExtraction: boolean;
};
declare type ErrorHandler = (error: Error, info: ErrorInfo) => void;
interface WidgetProps extends BrandingSettings, TransactionEventHandlers {
theme?: Theme;
locale?: SupportedLocale;
provider?: Provider | JsonRpcProvider;
jsonRpcUrlMap?: JsonRpcUrlMap;
defaultChainId?: SupportedChainId;
tokenList?: string | TokenInfo[];
width?: string | number;
dialog?: HTMLDivElement | null;
className?: string;
onError?: ErrorHandler;
}
declare function invertTradeType(tradeType: TradeType): TradeType;
declare function toTradeType(modifiedField: Field): TradeType;
declare type SwapWidgetProps = SwapProps & WidgetProps;
declare function SwapWidget(props: SwapWidgetProps): JSX.Element;
export { ApprovalTransactionInfo, DEFAULT_LOCALE, DefaultAddress, ErrorHandler, ExactInputSwapTransactionInfo, ExactOutputSwapTransactionInfo, FeeOptions, Field, JsonRpcUrlMap, OnAmountChange, OnConnectWalletClick, OnReviewSwapClick, OnSettingsReset, OnSlippageChange, OnSwitchTokens, OnTokenChange, OnTokenSelectorClick, OnTransactionDeadlineChange, OnTxFail, OnTxSubmit, OnTxSuccess, SUPPORTED_LOCALES, Slippage, SupportedChainId, SupportedLocale, SwapController, SwapEventHandlers, SwapSettingsController, SwapTransactionInfo, SwapWidget, SwapWidgetProps, Theme, TokenDefaults, Transaction, TransactionEventHandlers, TransactionInfo, TransactionType, UnwrapTransactionInfo, WidgetEventHandlers, WrapTransactionInfo, darkTheme, defaultTheme, invertTradeType, lightTheme, toTradeType };