diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000000..3bd30f55095 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + // "presets": [["react-app", { "flow": false, "typescript": false, "absoluteRuntime": true }]] +} diff --git a/.env b/.env index 9285b9c4a23..b281d877c93 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -REACT_APP_INFURA_KEY="4bf032f2d38a4ed6bb975b80d6340847" \ No newline at end of file +REACT_APP_INFURA_KEY="4bf032f2d38a4ed6bb975b80d6340847" +NODE_ENV="development" \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index 5497c9c6d18..f8f7b32d3bd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -44,7 +44,7 @@ "plugins": ["simple-import-sort", "unused-imports"], "rules": { "unused-imports/no-unused-imports": "error", - "simple-import-sort/imports": "error", + "simple-import-sort/imports": "off", "simple-import-sort/exports": "error", "@typescript-eslint/explicit-function-return-type": "off", "prettier/prettier": "error", @@ -53,6 +53,7 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "react/react-in-jsx-scope": "off", + "react/prop-types": "off", "object-shorthand": ["error", "always"], "no-restricted-imports": [ "error", diff --git a/dist2/055f83ffb7252729.svg b/dist2/055f83ffb7252729.svg new file mode 100644 index 00000000000..953202dc6a5 --- /dev/null +++ b/dist2/055f83ffb7252729.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/dist2/10f062d02df4af77.png b/dist2/10f062d02df4af77.png new file mode 100644 index 00000000000..09e9137752f Binary files /dev/null and b/dist2/10f062d02df4af77.png differ diff --git a/dist2/c2cd04251aa24c34.png b/dist2/c2cd04251aa24c34.png new file mode 100644 index 00000000000..86e43cb899b Binary files /dev/null and b/dist2/c2cd04251aa24c34.png differ diff --git a/dist2/d13f13f5694ec91f.svg b/dist2/d13f13f5694ec91f.svg new file mode 100644 index 00000000000..04e9f49b0c8 --- /dev/null +++ b/dist2/d13f13f5694ec91f.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/dist2/f158a440053a5ad2.png b/dist2/f158a440053a5ad2.png new file mode 100644 index 00000000000..33a64890cb0 Binary files /dev/null and b/dist2/f158a440053a5ad2.png differ diff --git a/dist2/f89237c6bc3f84db.png b/dist2/f89237c6bc3f84db.png new file mode 100644 index 00000000000..85714ea2908 Binary files /dev/null and b/dist2/f89237c6bc3f84db.png differ diff --git a/dist2/snowflake.esm.js b/dist2/snowflake.esm.js new file mode 100644 index 00000000000..5bf782315ea --- /dev/null +++ b/dist2/snowflake.esm.js @@ -0,0 +1,24388 @@ +import { jsx, jsxs, Fragment } from 'react/jsx-runtime' +import styled, { + keyframes, + css, + createGlobalStyle, + ThemeProvider as ThemeProvider$1, + ThemeContext, + useTheme as useTheme$1, +} from 'styled-components/macro' +import * as React from 'react' +import React__default, { + useMemo, + useEffect, + useState, + useCallback, + useContext, + useRef, + useLayoutEffect, + memo, + Suspense, +} from 'react' +import { useDispatch, useSelector, shallowEqual, Provider as Provider$1 } from 'react-redux' +import { createAction, createSlice, nanoid, createReducer, configureStore } from '@reduxjs/toolkit' +import qs, { parse, stringify } from 'qs' +import { + useLocation, + Link as Link$1, + useHistory, + NavLink, + Redirect, + Route as Route$3, + Switch, + HashRouter, +} from 'react-router-dom' +import { getAddress, isAddress as isAddress$1 } from '@ethersproject/address' +import { Trans, t, Plural } from '@lingui/macro' +import { useWeb3React, UnsupportedChainIdError, createWeb3ReactRoot, Web3ReactProvider } from '@web3-react/core' +import { + Percent, + Token, + WETH9, + NativeCurrency, + Ether, + CurrencyAmount, + TradeType, + Price, + Fraction, +} from '@uniswap/sdk-core' +import JSBI from 'jsbi' +import { Text as Text$1, Box as Box$1 } from 'rebass' +import { AddressZero, MaxUint256 } from '@ethersproject/constants' +import { Contract } from '@ethersproject/contracts' +import { atom } from 'jotai' +import { useAtomValue, useUpdateAtom, atomWithDefault } from 'jotai/utils' +import { createMulticall, NEVER_RELOAD } from '@uniswap/redux-multicall' +import { FACTORY_ADDRESS, Pair, computePairAddress, Trade, Route as Route$2, Router } from '@uniswap/v2-sdk' +import { + FACTORY_ADDRESS as FACTORY_ADDRESS$1, + Pool as Pool$1, + computePoolAddress, + FeeAmount, + Route as Route$1, + SwapQuoter, + toHex, + Trade as Trade$2, + SwapRouter, +} from '@uniswap/v3-sdk' +import { combineReducers, createStore } from 'redux' +import { namehash } from '@ethersproject/hash' +import { initializeApp } from 'firebase/app' +import { getDatabase, push, ref } from 'firebase/database' +import { arrayify, hexZeroPad, hexStripZeros, splitSignature } from '@ethersproject/bytes' +import { parseBytes32String } from '@ethersproject/strings' +import { initializeConnector } from 'widgets-web3-react/core' +import { EMPTY } from 'widgets-web3-react/empty' +import CID from 'cids' +import { getNameFromData, rmPrefix } from 'multicodec' +import { decode, toB58String } from 'multihashes' +import { Interface } from '@ethersproject/abi' +import { + X, + ExternalLink as ExternalLink$1, + Trash, + Check, + ArrowDown, + Info, + HelpCircle, + Coffee, + MessageCircle, + Globe, + Moon, + Sun, + BookOpen, + FileText, + ChevronLeft, + AlertTriangle, + CheckCircle, + Copy as Copy$1, + Triangle, + ArrowLeft, + ArrowRight, + Activity, + ArrowDownCircle, + ChevronDown, + AlertOctagon, + Heart, + AlertCircle, + ArrowUpRight, + Slash, + Plus, + Edit, + Settings, + Lock, + ArrowUpCircle, +} from 'react-feather' +import ReactGA from 'react-ga' +import { Box, Button as Button$1 } from 'rebass/styled-components' +import { darken, transparentize, readableColor, shade } from 'polished' +import ReactConfetti from 'react-confetti' +import { DialogOverlay, DialogContent } from '@reach/dialog' +import { animated, useTransition, useSpring } from 'react-spring' +import { useGesture } from 'react-use-gesture' +import { UAParser } from 'ua-parser-js' +import { createApi, fetchBaseQuery, skipToken, setupListeners } from '@reduxjs/toolkit/query/react' +import { save, load } from 'redux-localstorage-simple' +import { gql, ClientError, GraphQLClient } from 'graphql-request' +import { getVersionUpgrade, VersionUpgrade, minVersionBump } from '@uniswap/token-lists' +import { Protocol, Trade as Trade$1, SwapRouter as SwapRouter$1 } from '@uniswap/router-sdk' +import ms from 'ms.macro' +import { parseUnits } from '@ethersproject/units' +import useScrollPosition from '@react-hook/window-scroll' +import Portal from '@reach/portal' +import { usePopper } from 'react-popper' +import { SafeAppConnector } from '@gnosis.pm/safe-apps-web3-react' +import { InjectedConnector } from '@web3-react/injected-connector' +import { PortisConnector } from '@web3-react/portis-connector' +import { WalletConnectConnector } from '@web3-react/walletconnect-connector' +import { WalletLinkConnector } from '@web3-react/walletlink-connector' +import { Web3Provider } from '@ethersproject/providers' +import { FortmaticConnector as FortmaticConnector$1 } from '@web3-react/fortmatic-connector' +import { AbstractConnector } from '@web3-react/abstract-connector' +import invariant from 'tiny-invariant' +import jazzicon from '@metamask/jazzicon' +import { BigNumber } from '@ethersproject/bignumber' +import copy from 'copy-to-clipboard' +import { useSpring as useSpring$1 } from 'react-spring/web' +import useResizeObserver from 'use-resize-observer' +import AutoSizer from 'react-virtualized-auto-sizer' +import { FixedSizeList } from 'react-window' +import Vibrant from 'node-vibrant/lib/bundle' +import { hex } from 'wcag-contrast' +import { i18n } from '@lingui/core' +import { I18nProvider } from '@lingui/react' +import { + af, + ar, + ca, + cs, + da, + de, + el, + en, + es, + fi, + fr, + he, + hu, + id, + it, + ja, + ko, + nl, + no, + pl, + pt, + ro, + ru, + sr, + sv, + sw, + tr, + uk, + vi, + zh, +} from 'make-plural/plurals' +import { ChainId, routeAmountsToString, IMetric, setGlobalMetric, AlphaRouter } from '@uniswap/smart-order-router' +import { providers } from 'ethers/lib/ethers' + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function (d, b) { + extendStatics = + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && + function (d, b) { + d.__proto__ = b + }) || + function (d, b) { + for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p] + } + return extendStatics(d, b) +} + +function __extends(d, b) { + if (typeof b !== 'function' && b !== null) + throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null') + extendStatics(d, b) + function __() { + this.constructor = d + } + d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __()) +} + +var __assign = function () { + __assign = + Object.assign || + function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i] + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p] + } + return t + } + return __assign.apply(this, arguments) +} + +function __rest(s, e) { + var t = {} + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p] + if (s != null && typeof Object.getOwnPropertySymbols === 'function') + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]] + } + return t +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P + ? value + : new P(function (resolve) { + resolve(value) + }) + } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)) + } catch (e) { + reject(e) + } + } + function rejected(value) { + try { + step(generator['throw'](value)) + } catch (e) { + reject(e) + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected) + } + step((generator = generator.apply(thisArg, _arguments || [])).next()) + }) +} + +function __generator(thisArg, body) { + var _ = { + label: 0, + sent() { + if (t[0] & 1) throw t[1] + return t[1] + }, + trys: [], + ops: [], + }, + f, + y, + t, + g + return ( + (g = { next: verb(0), throw: verb(1), return: verb(2) }), + typeof Symbol === 'function' && + (g[Symbol.iterator] = function () { + return this + }), + g + ) + function verb(n) { + return function (v) { + return step([n, v]) + } + } + function step(op) { + if (f) throw new TypeError('Generator is already executing.') + while (_) + try { + if ( + ((f = 1), + y && + (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && + !(t = t.call(y, op[1])).done) + ) + return t + if (((y = 0), t)) op = [op[0] & 2, t.value] + switch (op[0]) { + case 0: + case 1: + t = op + break + case 4: + _.label++ + return { value: op[1], done: false } + case 5: + _.label++ + y = op[1] + op = [0] + continue + case 7: + op = _.ops.pop() + _.trys.pop() + continue + default: + if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) { + _ = 0 + continue + } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { + _.label = op[1] + break + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1] + t = op + break + } + if (t && _.label < t[2]) { + _.label = t[2] + _.ops.push(op) + break + } + if (t[2]) _.ops.pop() + _.trys.pop() + continue + } + op = body.call(thisArg, _) + } catch (e) { + op = [6, e] + y = 0 + } finally { + f = t = 0 + } + if (op[0] & 5) throw op[1] + return { value: op[0] ? op[1] : void 0, done: true } + } +} + +function __values(o) { + var s = typeof Symbol === 'function' && Symbol.iterator, + m = s && o[s], + i = 0 + if (m) return m.call(o) + if (o && typeof o.length === 'number') + return { + next() { + if (o && i >= o.length) o = void 0 + return { value: o && o[i++], done: !o } + }, + } + throw new TypeError(s ? 'Object is not iterable.' : 'Symbol.iterator is not defined.') +} + +function __read(o, n) { + var m = typeof Symbol === 'function' && o[Symbol.iterator] + if (!m) return o + var i = m.call(o), + r, + ar = [], + e + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value) + } catch (error) { + e = { error } + } finally { + try { + if (r && !r.done && (m = i['return'])) m.call(i) + } finally { + if (e) throw e.error + } + } + return ar +} + +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i) + ar[i] = from[i] + } + } + return to.concat(ar || Array.prototype.slice.call(from)) +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, 'raw', { value: raw }) + } else { + cooked.raw = raw + } + return cooked +} + +var rotate$2 = keyframes( + templateObject_1$1n || + (templateObject_1$1n = __makeTemplateObject( + ['\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n'], + ['\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n'] + )) +) +var StyledSVG = styled.svg( + templateObject_2$11 || + (templateObject_2$11 = __makeTemplateObject( + ['\n animation: 2s ', ' linear infinite;\n height: ', ';\n width: ', ';\n path {\n stroke: ', ';\n }\n'], + [ + '\n animation: 2s ', + ' linear infinite;\n height: ', + ';\n width: ', + ';\n path {\n stroke: ', + ';\n }\n', + /** + * Takes in custom size and stroke for circle color, default to primary color as fill, + * need ...rest for layered styles on top + */ + ] + )), + rotate$2, + function (_a) { + var size = _a.size + return size + }, + function (_a) { + var size = _a.size + return size + }, + function (_a) { + var stroke = _a.stroke, + theme = _a.theme + return stroke !== null && stroke !== void 0 ? stroke : theme.primary1 + } +) +/** + * Takes in custom size and stroke for circle color, default to primary color as fill, + * need ...rest for layered styles on top + */ +function Loader(_a) { + var _b = _a.size, + size = _b === void 0 ? '16px' : _b, + stroke = _a.stroke, + rest = __rest(_a, ['size', 'stroke']) + return jsx( + StyledSVG, + __assign({ viewBox: '0 0 24 24', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', size, stroke }, rest, { + children: jsx( + 'path', + { + d: 'M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 9.27455 20.9097 6.80375 19.1414 5', + strokeWidth: '2.5', + strokeLinecap: 'round', + strokeLinejoin: 'round', + }, + void 0 + ), + }), + void 0 + ) +} +var templateObject_1$1n, templateObject_2$11 + +var useAppDispatch = function () { + return useDispatch() +} +var useAppSelector = useSelector + +var updateMatchesDarkMode = createAction('user/updateMatchesDarkMode') +var updateUserDarkMode = createAction('user/updateUserDarkMode') +var updateUserExpertMode = createAction('user/updateUserExpertMode') +var updateUserLocale = createAction('user/updateUserLocale') +var updateShowSurveyPopup = createAction('user/updateShowSurveyPopup') +var updateUserClientSideRouter = createAction('user/updateUserClientSideRouter') +var updateHideClosedPositions = createAction('user/hideClosedPositions') +var updateUserSlippageTolerance = createAction('user/updateUserSlippageTolerance') +var updateUserDeadline = createAction('user/updateUserDeadline') +var addSerializedToken = createAction('user/addSerializedToken') +var removeSerializedToken = createAction('user/removeSerializedToken') +var addSerializedPair = createAction('user/addSerializedPair') +var removeSerializedPair = createAction('user/removeSerializedPair') + +function parsedQueryString(search) { + if (!search) { + // react-router-dom places search string in the hash + var hash = window.location.hash + search = hash.substr(hash.indexOf('?')) + } + return search && search.length > 1 ? parse(search, { parseArrays: false, ignoreQueryPrefix: true }) : {} +} +function useParsedQueryString() { + var search = useLocation().search + return useMemo( + function () { + return parsedQueryString(search) + }, + [search] + ) +} + +function ApeModeQueryParamReader() { + useApeModeQueryParamReader() + return null +} +function useApeModeQueryParamReader() { + var dispatch = useAppDispatch() + var ape = useParsedQueryString().ape + useEffect(function () { + if (typeof ape !== 'string') return + if (ape === '' || ape.toLowerCase() === 'true') { + dispatch(updateUserExpertMode({ userExpertMode: true })) + } + }) +} + +var NetworkContextName = 'NETWORK' +var IS_IN_IFRAME = window.parent !== window +// 30 minutes, denominated in seconds +var DEFAULT_DEADLINE_FROM_NOW = 60 * 30 +var L2_DEADLINE_FROM_NOW = 60 * 5 +// transaction popup dismisal amounts +var DEFAULT_TXN_DISMISS_MS = 25000 +var L2_TXN_DISMISS_MS = 5000 +// used for rewards deadlines +JSBI.BigInt(60 * 60 * 24 * 7) +JSBI.BigInt(0) +// one basis JSBI.BigInt +var BIPS_BASE = JSBI.BigInt(10000) +new Percent(JSBI.BigInt(1), BIPS_BASE) +// used for warning states +var ALLOWED_PRICE_IMPACT_LOW = new Percent(JSBI.BigInt(100), BIPS_BASE) // 1% +var ALLOWED_PRICE_IMPACT_MEDIUM = new Percent(JSBI.BigInt(300), BIPS_BASE) // 3% +var ALLOWED_PRICE_IMPACT_HIGH = new Percent(JSBI.BigInt(500), BIPS_BASE) // 5% +// if the price slippage exceeds this number, force the user to type 'confirm' to execute +var PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN = new Percent(JSBI.BigInt(1000), BIPS_BASE) // 10% +// for non expert mode disable swaps above this +var BLOCKED_PRICE_IMPACT_NON_EXPERT = new Percent(JSBI.BigInt(1500), BIPS_BASE) // 15% +var BETTER_TRADE_LESS_HOPS_THRESHOLD = new Percent(JSBI.BigInt(50), BIPS_BASE) +var ZERO_PERCENT = new Percent('0') +new Percent(JSBI.BigInt(200), BIPS_BASE) +var ONE_HUNDRED_PERCENT = new Percent('1') + +function useActiveWeb3React() { + // if (false) { + // return useWidgetsWeb3React() + // } + var interfaceContext = useWeb3React() + var interfaceNetworkContext = useWeb3React(NetworkContextName) + if (interfaceContext.active) { + return interfaceContext + } + return interfaceNetworkContext +} + +var Circle$1 = + 'data:image/svg+xml,%3Csvg%20width%3D%2294%22%20height%3D%2294%22%20viewBox%3D%220%200%2094%2094%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cpath%20d%3D%22M92%2047C92%2022.1472%2071.8528%202%2047%202C22.1472%202%202%2022.1472%202%2047C2%2071.8528%2022.1472%2092%2047%2092%22%20stroke%3D%22%232172E5%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E' + +var tokenLogo = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAABJCAYAAABxcwvcAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAB01SURBVHgBvVxpkB1XdT6n+71ZJMsaCVs2BKxxEjCb8DhUGbPYlpMKwWBjuRI2Y4NJBYhZYlNFwpYqSVXEbD9sA2bJUsg2XqBCxXihIPzQyMYUkFRpJCAGUimPnAQvAWskjTTLe9035zvL7X4jL7IWd9Wbee/17b73fvcs3znn9mN6ho+53XPjJVXr5e0Ec7E21WmcUhorSh5PiYmqioi16QwTz6SUpqkoZqjq76B+Pdk5eWyKmWfoGTyYjvGRdqexHs1voILO5VRvECDGipQoFYX0nqSBvPryKpIOR0DDX3lb2Lm6JipL+b7OAy665VTVr7fxcOf27orRSTrGxzEDaW73vvXdTndjSvUE1WmsrmzeNn/ptgYwAQopCCIhClDC9335DCBxTt/btTpkgIe2wLkoptNQZ7JcPrRZrp+mY3AcdZD6e+cul38bZe7jOitMzOaUgUCvhUgHQKIWYNZWQIOklQWlXmXXCUgAU8+hCYAVAPW7vqDfKfR6LostvZm9m0dPffY0HcXjqIHU37t/g+jFNTKdcZWG2gECJqwT0ImphrV7VanwwTC7WrF/NkDyB+1IegCIAKeyFUgLAuZwx0CU/yJhW4rjlx01yTpikNLc3HivT18TaVivElMy1WJjVGAAjKyyqRHp5FShUu29uxTx4HAADDQthWoF2G2AcQuoIECb7/tXtd6fAZ6Mg4fKTeWq5ZvpCI8jAml+z+xVZdHZKEMfSzEZOYpOKepUKCjWCef32qOqVzYybr/tvQLJnO/l6Jodq1p2LNQU0gdAFwWoHqQr8EvWTbec7pXleaOrRqfpMI/DAik9sHusf+LIv6SK1kMqcBMdtEwcAOWlD2DIv4LdkJG7kmQwktuajI1+B/vlQNbNaDnULiXvpdUP3vZEnuYWTXUDcOm3HBvdxMPdw5Kqpw2SqlePtkrn42oXwt50BSCVGL9rzHagqzQAitmZlO0Nx+QrMvHyf3VIUspGzmiCq583NVWszR5CBbmq9f5J/gtAxCOda8uVyz5ET/N4WiDN7t49MdQZ3Qr1YjcSXJQ2gVCjuGttq5hhSgP645NtfY+JBT2g9vXu7gMIByxVKfAy494SQ7NdrJ6vnusRixrWsHPDYgaWDU/y2OjFT4eQHjJIs7tnJ4a73a1gxzoUBscrGtftQOj0Y0LkQhJG1tu4HFCmCNT2ZJxtUDb01AK/GhDVDKq2TX5NySo9qoxyvt43b5/RVgx9MTo8VZy4/LxDBao4lEaLAKjsbE1uoOGmS9ieGKtzGApHhbvCu4SkmG5lHpQCrJCcFJrETXtIj0tS1twU3zdjU4lKnJ2DmrGaTML9vjzatesUKBj53kTafWBr8gU/YpAQazEkqOQxcu5TQr9j4nUzqdQWoSxdDpSrwVLhTUEk/QykgOO+3r5IDRVQosnu4gOtwtWNzSZiEfUV6Mv35fEjA8BXe+Ym6v2L19CRgpQQjHZ5a6qqMQsNWPVajWG47X0L3ji5p7H3hFXzgcfSJ3KDDZ4U19cNompw+3VWr5ikEkxuBFJ1vXaDDpXv1Rbj1bVLctFIZDgJfFw+rOcYjgF9/d/s5SJVTwnUk4LU7xTXSMfj5G4U7l3jqWR6pp3vErXetadZfQWEm3DDp8uuKuG4ySmATrJt8PE5ZpXcvnW8z1C3oAyuh0nv6wvBjRdkau6t/YKCiBYoz+oWCn7/13uvSgv9DXQ4IPX2LyA43VBAtyGu3dI6806Nw8iAXnYS0V33U7rz/rC+S+yUG18OrXTVQuylEpmy9HG0ofakHYzQ0hZppdK8HLsxBLtXCfZ7JTBwkNqCnWuZuhXHDakDMONO4FVfk3GMPxEWj+vdlAvVxQMqwskYdASmJkEuEamlRh/+LtGY6P0n1mc7wK6WmUhCdXY8TPTgDDHanj3eMHFygAFeZRkAhl0pY4LBrQq3OQhd2D4nAyoFVQgVxpglP5WclOq5sjAhlVgq7V/UvqDi3VNWTfLo0HmHDNLivvntcmJCF9DVbNBL1dRoTYv3vOlWuepkoo+d6yDRYDiye55oj7xOWUl0zzTxvbuoxjw/cBbRimFrlnyymBdW20fIdSNAmbln72o5JwusHVCMGWRXbVZlasiUFxjXV/M98UyLErp0TNrWrHhXZ6izZSkeB6lbf1ZSHUwTOIOVKsqWEYwVyu6aqCGJ0vE/iGrf8QtKb7nNAKHUqBiu3fEQ0YuvIz7/RqLxVZRE6hhe53U3mHSpWrp09pPbF5uYp0LsnrWfwz13PtJIrQmaDW2x8mElamcZMtdCCDVi1EBpBDIJ+xaueTxacBBINfNG5RdV45ozMw5xzsbR3/v5dLxIw/cE452iUudvoSQGXRXBSWICIGh677ScF2D2iGd8/yuIv3qRApd++nADasnZfpPHYWZvbJJqtQDczx9pqEBtr+TqHXYxObfScVRur9wesQCVPGUs3GlMyOZVTwrSIqSoEgMWnrto2G5qUSDmMK/OnWvKgaTyEAFK1ep1W4imd+cMY3Hqqow5i1fkm7bbHV96EqWvvFGAukFtVtq1m0hUMd00RfzDB0U1H5BVXjR1wZj+41GiL/7I2kw9ZDQkMgOQpNqBsHxLEyfC/rgChHEvlg2pxzMrIuHLvrkrl0oTD4I0/4B8Ma5GsVPkyWUjOKBefoNETUQPyHbPCSWQSUKqXn+jNbr1zcRnPMf4jqgWbJGCfeFplG55S151vv7HlD76vYHBpfb/U8YovWYt0aWnE8t/BfHj36f0kXOIrzjT2HTtUlTVrTRx4/XU9hBnpqKzEdWsf3vApFeSduXJKzYLcJsOkqTe3Nx6ueG4ulSIZ6dsDZabTGOw40hzhCo50+WVw2pfaNUyou+8w0CEKt243e50wQsbAyxgKQJ91xFRPZLJcmv12v8T7nvLDmKA/9IvEAEotP/MNqJv7NRcEoeaRtag4FxEgBHX8zFrzLM2laOh0pwGPN6BxSupdWSQ6h5dHuIcaYlMw1rmJ+t57Rynbbfc8PIFLyK68xfEp66mdN97iNeKN3vvt4n/Tibz9gn1bjrpGVHJ6Rm7R9g2eMaXnew9N0ebKukBwE7/ooJOVwi4K0Yo/e8et0vhCl1qcH8nj5nDweYiScdI//aQnMtENs32EKOuHwAJZR+RjHfGMJSAReJd7UxqiX6zztxe8laQq+IjQKRtDxCtHhWJklu/4TSiqycpfUlsyW2iYivNiPOXf5JVQSc3NqrqmUS1BkBZAlpAkEAM14qtO//5xE4jlMk5G89j6rtJqHyB2dl57cR4qPTCQkIAjFDnnQMg9UqpiwXVp+ATLTXzLyxopCa6z8y6ca8qslBZIYoML4ZzQhxZgEkfP5f46m1mk+57twF5/Y+If/aoz7owYJ4rknb3ZXJ+bAAQboEVL4bRft7xom4/pSQgRZynHCrzgdry6pHkg8q5VKm+wH7BBkPtlnXMQ+6f3zAoScwbNAWiqYTUisHMc9kqh1fz5FioRytJpoOLceFaURsWEJKnbBmqhImLKuI///xKtVtJOFOkaHXyuCfa3S3n3vACSi1wuA0YQAYxRdsr7hAq8W9N4SGoPgCqYj462cbOFSZFRi9ca/oeyswuZpXraONE55o/hKqVLXk2IGpBvWiFC7oqCBcqyt4ueV4op4QKtzkiObTuJJNKxHewJWev1YnUGBC8VbhsBzoyLvQ8kajb3qq8KglJpR/sIvrZIw1gawWclaMKkB6fuYfokpepRHGypJsKEJxQ5WN2Vs4uZSCdLPbIclHyvxLeJNlMWoSK1pCmSUZCTSj99uAZxVCnIY4+mpTf0IBPVtXKxM0/h6TNihq88qvKh1JLZeDC+VbYpGEz8sGe05J6G1b/vyW7cOFNRF96I6Wznpd5kGYesAB7FygJH0Mf9HNR2Zt3iOE/h+hvzmnoCl4RNUTuylO7FBVifAUOpRTmgMZyGEq5dvWk8KjzOkXZHU9sDZQXMeXBJgcrVCmMNy0Rf0091MZBOETpk5M6GW2DQFakKV1wmr4nv2Yg4VZ4oOp2LqdlAcAbbjSOJKSTzz5F/p+sINMrnqtSYOour48KOJd8U0A6uxlklMzLVuUFEoXr1JT44mDuaCdxHBUC4AJKVP0JVbc6VetNrVxM6kaKErXcu0sUpEVtY6tPpmayGT3hM3rcJXblnHHnLA78gyIhdwlFANO+70Ehgq8QL9V1dWADG/eArRKVUklBbCev9J1fDnq9V51ilAHe8xxR3Rv/zMIdGPHsnVue2aUktEWnV9kcVR4wjwVpIyoqage7NA4zPc7ZEHPLhTQ+JBvpOggsZ0Nr2DLVLamin0o8JerA4uZ5/anU5Ip8UFd8mxLsy15R/Lt/SSQ0wErgJoV6z8q9zl+eOYB9+71+RtjyFaERUMt1X1AVpOVDeW3JjbZ5szSoDu3MaHszB6Su4zZX8hqFiOFK81hxA16iVqzlmLhZUXJuq/aHDanCTZZ2NG1qBq7TsF4npxgrMpl3/ZLSJd+QKF5itZeuaRYnaEfHKioJRPEjZzeTzq0OVn9IKJ37j0Sf+4F5tbhC84Ns0t4t842QabDVZc8MyPuhwiTvQE9empoe68hqnRpRcmbaqSWOVd1ImU+SIoHlRslSHE4TcNqj+SRMO6Vmdla9lS/AgW7eKZI2ROltpyuBzLWzqLdF1RYSINQhiaejT99L9D97qC1NA6oXx2fFyx0vget7z7RQiUryKqdJSRDlIc+T9eoMJO5XSWGzqCLOo3FY6rVaamnt5rBlcpdeFA15JPd0la8jtwy8ixG2zMAe6cdXr/VzyTKOyQcC1/2Jc4ned5bGeLbPyO2ierZK1YOdEesLYN55GbG4+CcDKEvWZ+/V7ACH5NRuY/t1tp8JxrnvZaa+Y+DCkkYkETenGzHGCgommqgp+fh/jhitldA3ozQ4oFyCBmOWQBYeSWGEN2vZOvbUqZEvBxfp1cptWWX3AiHMgRCInUsrw95cdyHR1PuFpL5RedTSI5tUtP3Sj/UbLcfnmLRlFtjtj/eZz7HtTDFCSiuLdkEw5cS9eazUNuQtKhBtGxX14UmaJH1qm7W/dEJs0iq7N/S97zX5XHGtcwKPvaiYCWVyj1n7f3XR8u9W8ZhdeS8eEVJK299P6YY/tfc0aJ+0l+/+p+ayc0XGKQc7aHqvdjBceI4MC1Ny1p5CS8NR+WDrKjSEw5gHEKW3i6xlMtKXt8J8+h5j1DiQ30mNC2SnM1E4tN4L9yacFyLvBaDGo+qCwSQgkYd07WdElSa+QElUCjSC7rxUAeO3rMsg6fRARsG2exW1eAC1Q5QwG22bqEUC5L89+oDfnTGVo4xoJN9NLJMPOTXRurtOA9HVT2I0kghfuwVvWXdyo2aFgauqpGP0QFYBIwMgx4gpG/sU9qK2ImSSSdNjB5oxwe5cfAvR13eY6n3+AslYXmgBcgy9b5xHs5Iha+y7XzxgVxLZYWfjpFQExQENeIUSF3VV74nyb+ZFA3LbzgQUjR6TVx3wDm78I9/LwGZqQCYJKeyPexeL1Jkiga/xon9OOTBN2U7orZAGBrcCrWjbIkjuX91F6Q+uJ/r1XjHwYthvfpMyckY7z1KSL1Dkkjjv5k2NSVmofJFqXzhXNykXPaDcUKXEBx62KFyySmbLbgWgbHY/vfWbDaYK2iMWXzm3yhtwCuMmKll1ZB0MWgWuqt3BcWMDo5R+2bckHfwClRKStG8sSO5XOFK66OtKZOnFwrveKoHuujV2fbj6RAOhkM3H51qZVqSe78VM2UFNFYLaLtW2iGMcyfYIOEbkF7Prg2J5604vB9GgS0YMheR9mN7SHWnR7DnK5WscXmlNviNXA1xILBi1sOm0R3Lnn/xjAuWhN62z2K116HADKEjXKyUgfvM66z/KSxHcRkZVOVlqVBKhiPJCaSvuX3ejSCgNnzKlsystdWEqwDkz2aiAmy3s91FRdXqw8yEbwNtPt/gpBoyy0mv+Xo2nHv3aKxjkVQvLAJAbcnA1RhpEQhQUA1gmm9Z+zgB6iQS2wpE0lsNNVo2q/WkvSjb3MO6fFcZ9/mnG03DvFqPVxaJYcPIUSmFZAZwXYqnSJDyJlml4M9URdZuusSmzspBDgai9zOzJNspcR/JKtQEVFVWeWTA7hLK1VC00FgtAsaLrPm+pDgGR3TOy2yW9HnwG0ojyN6TkuGFL7aI9UrOvktTKqpEcrOrTA1h95LZffYoGyNFfBu27v5L1/yOiE5bZQrSLq7FvKmhBVFJ8X5NyqvB0TNPY6NUpF4cmE8JgSFKqnbNY/sWcXcOdUpsmlDbhnNSHDfrqT6gx/61Bf+xfRSJeaPlr3YdNTUoFqvreM91OJNtezM5foqSFRXOekzfMo4frRJr+8J8sqG2pnUoTjPjqEbWbJi3RoBmZPY3gktzpaGkJWwdJcmpqqo4f2WFauoqhc1MZj8o3kxMF48wcw9yql5zIJpoky6iHBKxaN2uBE2AhMYYkme7wd8ARL+k7VHWRd0IaBKXx8N1FawuOEz3LMxVuZEnTKFpdoYPVToFL3IRbUd0BYH13Eu58FKDau8K+AEg7FpTodvzR9K1cv03AmVBQdJOBb9TKLDv2TlMT2AaHR+0LbvnBmQGA2vZCL5Fipe5lhHf7oRQC7v4V8c1TGj4MGHxRL3rbOg18YwOpEcK+e5tmG48C9+cv1wWi+3bRIFqctcG4o1ebI9ovzONFmUnXZnbRPmMxrfIyqd0oUseN3q7py2QuOurk2kMQLF/gYMeaZggmcPVrB6RnABwM78tS60dFV3iOGuQLbpLvfnwQQHo7AZA+eBfx336fIthUxhy0INXN7lvNMsoUPvwaOuh4zvFmJgofeMfjnm6m/rrinINzuefeOVU5bTPSmY7HLmxtujxZjAzN5JCgXV6qUvO4Al59l0tuAElib5J4krbx1HOoiMArCWehT0g5WtKwSLaF3Wq3ZXfpGTQk0kR9c15aH5FIgyzeo3aN3doE8yVrbHtPhFPMTWgSsZqXu0lUTVO2ngtXmUA1d6R7Q9wuV3D7/d51wXLBKzylb5Pg1lq76GrJOAgn2n36tdYWEgPAbnmzuPQP6kYtgtSgBkdZ+JoDDPnf30d0g6Rdb3+7fs7nP3dvC3F/g1jRPVyOBHBIGjc3QzYToIQoRx7JF12P2vkRJEoquOmRWZWgGl4dUki0pTVr716quP3+7O7Iw2rVBPFMa5NWDkOokYQUW1nwecdDlLBzRIxx2FyLu7wBDLTYIYaUhEfa8QHjVLBrCDvAtXAeLxzfvlSJYd4s6tyKigjK3e6IiqJASVJVoTsupfajFrnGBbuGeYU58bAHjB57vblv9qo443e2iaqtp6WSBC8nYjcJBgovUPf7RizVyCnJsNx2tK8beYhMZpKglkH0IhAO9hqkDXQB3uied+fqbAInwjUvWmNSJ4l++uuzG0YtWc7skQpj6SlLBlFOvYK0Qs0Q4EZbtkW0jmoDJWcg2O4r96of22/URObMz1Yp2kSto2h/KJePbFZ67jkdVbsQV7LB5UchmJo4zlUwDZDF5HGR787PsRgZQJAQFB+R9jjrFNskesf9ZnAB3Hu8AIC8dRRMex6Udk0abD+l9AeAkHn41iVy/QrKT0D1vHwd1/omMPYnA1CtxXbAqPDyUBeZUhjsyTYuA94Xh4jd1urAwno9JTfBJnErQIb7Dw4Vm0tb7tiNbIoEF0cnbCnZlvtWoEEkRU2SqBujEvv65xN96k/sWuxzevn1tsHrjssayQ0pCtVR4GuTpjKXPChTlBD1nEMiozlOEeq98xaK4Mmm8dVUnLQCz53c/qQgYedttXdxuyTixoB+MRJbUopGv90gxaMKMTA9XddNmrRO2c5nFQg1adMMGaieQxiSmqGlq7cSX/NDTajpzpGwSUEmQ2XioWaXrAxU1Ng6RRPZs0sVhPNAX0vaCf1j89bLn7tFAHrXUkyKpV/w6Oi00PHrOFIFqm6tFSka/5Q80OXY1+MhgybLQMhKl7ZY/WSMPmc2NTflrHv5UH5cNMgqY7vz+SJd7/hnov96LOeF6P5HbWz+XEmzeO6xiH3HLdFAyqU2O6mgLVT6XJxuKEV5//dWo9PN9DgHP96X2DNY71vYXu9fGCfvR/cVdlirnamIQDg1ohxGHmSU6lxUyHnzzIA5S377uZQsXVEfa2350WrwbTttiyEynn8hLHv1MgttknnPHA9ik2inbGwlupeqCHsKRg/Y2kdnzTPChkrFpnj+CZvl+k2HDJICNbs40T8wv12rmLD62PAuq+3knqLSGtqhxjoeEkxNhSXTBS9h5xV18qbve64WYVPaJMNTuCFgeXNWLkBQAzCEqFs0BDRUPLX2hs8LQL+ZNWmCR1vWpfL3T5yS0tMZT4RF8UQnJE0xVRw38iGFBD9egLlJVZOKJrjVdkweJtSZG8Uu3BzSaGiRPA1RNyQPR0woPxqWBjBSl+/7rjny4ApKau4TAfGAypGFFy7pkfbR5B08L4JuXLZ29bT0cTE9ycH0FEc1v3htPTN3pcY0bkNK5HzMCFm93LkL58HaowiQPo388ZWGEUYUFJRe3bJxS0YUYKjaGai4Xlv2/Wc6wpG0QS/NFlEExKAK4TlEDWtRMfWS/UrpSXHaiYj2z5AFnXoyDAp6iqMcGbpK4pjJsBVYTTyyGc/vR32Kw76k5LtZnMN03DOGq1bkrW2Kqm6nVQgI8DohGeylJ2q8VfCgkhsbFh6127E+hjpNXzjxm/1mizQrKjGaZDkFoA89FUCHBJICtXL04mKkO0VRy4cu718wshYOyUs/oXZqg4LxMnu5nLPHiW08Jh2NVOmusyp5/ocdCGuTwqOFgV/07EAEwJiQ57ryI2HStsauXPx2gNb/JaA9YTnxSStgqK89lPk/pbrFoR4Pj2TuX5zI+4e6XmKKDVHkvy8SRtbTpQ2Zc9cc+TRqSYKmQ1oere354nEJSGmklWOnSJgBSF6vaqJ7DAMb2FFpwc7a+UXjcr/7LCrWHPeEnuyIQAqgxPB9rd67sKHuVzYHrAz+I3EO29S3xLp6OCTYhgqKDfRqC3AucsghGWFLws5kirBkhF6oUNC6vg8yEvkBEr6HOZiZs8fe8aQnpAj9vnANPPS7ZCxb6GkcTwukDNZCb1P12IGNOmiPylnzwmIMR4eayUf+hlyYwiZFfIiPtRviruWYI1mvbTzNmkcangzR+pBnAep6cEsNANlrqWJ7fq7U+xUvWjNNI92LD8UGHRWQcPQX+5cXBxY31nvmx9WDQZJCYrARCqCF7aDmWQ6TDuUJtmkiDHXXDXxrw2fYwPwTHG7cLVXCTQiC9kIY64f3SXghfG7eqj+Q2gIB88nHbRNPezkf5g+8HDZIOLCfUFKw19a/3X9R7RPWjVFOD4rlwzZJ8Cy3LwMd1hHeeJU39lSz2zO3LbF7VtUnPFrfwov02JzN4sAi1QJUAXoidgglrmLts2Z4efeQDfQTHUcEUhwyscsFqI0SyoxrzAYpcpulE4Y9wE/3dMpMMI27BCXwJJrXvlRNkB4JVQp2HUxdbE4NwHTnBxuL7hb5aUo+4ThkF7eJpzxs6WkfRwWkOKr9C5toduGdab43jl1ixXAn/0AUBxsWm5V/kQuSEPme2OCFD/CAvp0nzRvY2A6jhl8qGuBAHOrZs1+7UdV69gq4920C8KalOaEjOY4qSDj8qej1tG9+Y71/cRy2QrfdDdv2urwvUyaGZ3tV4qScrL+B5JlHEgnJYU7s2Ic0Spuk2ixtUHXGjzhI7KUPPa9aBsk5quDEcdRBah94NkPivcu5178ozS6MJTwlwOaq9bFOJOAdBPJ9mxrK+FY83X9ZWRjBw67CABI1emx/Xrlsl7j4LdLVtXwMfzHwmILUPvxhlg0SWE4IIKfrRnJkK7F3E8+iieE1rkTmJTW/JMCJ8VePOdoBKdwlwE0q+5faCh+jH7pbejxjIC09BDQ8koBqwLi/xvwVx7S8ZvwFUKb5Gf59yTj+Hw/7ALl9bHOSAAAAAElFTkSuQmCC' + +// returns the checksummed address if the address is valid, otherwise returns false +function isAddress(value) { + try { + return getAddress(value) + } catch (_a) { + return false + } +} +// shorten the checksummed version of the input address to have 0x + 4 characters at start and end +function shortenAddress(address, chars) { + if (chars === void 0) { + chars = 4 + } + var parsed = isAddress(address) + if (!parsed) { + throw Error("Invalid 'address' parameter '" + address + "'.") + } + return parsed.substring(0, chars + 2) + '...' + parsed.substring(42 - chars) +} +// account is not optional +function getSigner(library, account) { + return library.getSigner(account).connectUnchecked() +} +// account is optional +function getProviderOrSigner(library, account) { + return account ? getSigner(library, account) : library +} +// account is optional +function getContract(address, ABI, library, account) { + if (!isAddress(address) || address === AddressZero) { + throw Error("Invalid 'address' parameter '" + address + "'.") + } + return new Contract(address, ABI, getProviderOrSigner(library, account)) +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string +} +function isTokenOnList(chainTokenMap, token) { + var _a + return Boolean( + (token === null || token === void 0 ? void 0 : token.isToken) && + ((_a = chainTokenMap[token.chainId]) === null || _a === void 0 ? void 0 : _a[token.address]) + ) +} + +/** + * Debounces updates to a value. + * Non-primitives *must* wrap the value in useMemo, or the value will be updated due to referential inequality. + */ +// modified from https://usehooks.com/useDebounce/ +function useDebounce(value, delay) { + var _a = __read(useState(value), 2), + debouncedValue = _a[0], + setDebouncedValue = _a[1] + useEffect( + function () { + // Update debounced value after delay + var handler = setTimeout(function () { + setDebouncedValue(value) + }, delay) + // Cancel the timeout if value changes (also on delay change or unmount) + // This is how we prevent debounced value from updating if value is changed ... + // .. within the delay period. Timeout gets cleared and restarted. + return function () { + clearTimeout(handler) + } + }, + [value, delay] + ) + return debouncedValue +} + +var VISIBILITY_STATE_SUPPORTED = 'visibilityState' in document +function isWindowVisible() { + return !VISIBILITY_STATE_SUPPORTED || document.visibilityState !== 'hidden' +} +/** + * Returns whether the window is currently visible to the user. + */ +function useIsWindowVisible() { + var _a = __read(useState(isWindowVisible()), 2), + focused = _a[0], + setFocused = _a[1] + var listener = useCallback( + function () { + setFocused(isWindowVisible()) + }, + [setFocused] + ) + useEffect( + function () { + if (!VISIBILITY_STATE_SUPPORTED) return undefined + document.addEventListener('visibilitychange', listener) + return function () { + document.removeEventListener('visibilitychange', listener) + } + }, + [listener] + ) + return focused +} + +function useBlock() { + var _a = useActiveWeb3React(), + chainId = _a.chainId, + library = _a.library + var windowVisible = useIsWindowVisible() + var _b = __read(useState({ chainId }), 2), + state = _b[0], + setState = _b[1] + var onBlock = useCallback( + function (block) { + setState(function (state) { + if (state.chainId === chainId) { + if (typeof state.block !== 'number') return { chainId, block } + return { chainId, block: Math.max(block, state.block) } + } + return state + }) + }, + [chainId] + ) + useEffect( + function () { + if (library && chainId && windowVisible) { + setState({ chainId }) + library + .getBlockNumber() + .then(onBlock) + .catch(function (error) { + console.error('Failed to get block number for chainId ' + chainId, error) + }) + library.on('block', onBlock) + return function () { + library.removeListener('block', onBlock) + } + } + return undefined + }, + [chainId, library, onBlock, windowVisible] + ) + var debouncedBlock = useDebounce(state.block, 100) + return state.block ? debouncedBlock : undefined +} +var blockAtom = atom(undefined) +function BlockUpdater() { + var setBlock = useUpdateAtom(blockAtom) + var block = useBlock() + useEffect( + function () { + setBlock(block) + }, + [block, setBlock] + ) + return null +} +/** Requires that BlockUpdater be installed in the DOM tree. */ +function useBlockNumber() { + var chainId = useActiveWeb3React().chainId + var block = useAtomValue(blockAtom) + return chainId ? block : undefined +} +function useFastForwardBlockNumber() { + return useUpdateAtom(blockAtom) +} + +var abi$6 = [ + { + inputs: [ + { + internalType: 'address', + name: '_rewardsDistribution', + type: 'address', + }, + { + internalType: 'address', + name: '_rewardsToken', + type: 'address', + }, + { + internalType: 'address', + name: '_stakingToken', + type: 'address', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'reward', + type: 'uint256', + }, + ], + name: 'RewardAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'reward', + type: 'uint256', + }, + ], + name: 'RewardPaid', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Staked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Withdrawn', + type: 'event', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'earned', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'exit', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'getReward', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getRewardForDuration', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'lastTimeRewardApplicable', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'lastUpdateTime', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'uint256', + name: 'reward', + type: 'uint256', + }, + ], + name: 'notifyRewardAmount', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'periodFinish', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'rewardPerToken', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'rewardPerTokenStored', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'rewardRate', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'rewards', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'rewardsDistribution', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'rewardsDuration', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'rewardsToken', + outputs: [ + { + internalType: 'contract IERC20', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'stake', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'stakeWithPermit', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'stakingToken', + outputs: [ + { + internalType: 'contract IERC20', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'userRewardPerTokenPaid', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'withdraw', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, +] + +var abi$5 = [ + { + inputs: [ + { + internalType: 'address', + name: 'token_', + type: 'address', + }, + { + internalType: 'bytes32', + name: 'merkleRoot_', + type: 'bytes32', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'index', + type: 'uint256', + }, + { + indexed: false, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Claimed', + type: 'event', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'index', + type: 'uint256', + }, + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'bytes32[]', + name: 'merkleProof', + type: 'bytes32[]', + }, + ], + name: 'claim', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'index', + type: 'uint256', + }, + ], + name: 'isClaimed', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'merkleRoot', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'token', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] + +var abi$4 = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount0', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount1', + type: 'uint256', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + ], + name: 'Burn', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount0', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount1', + type: 'uint256', + }, + ], + name: 'Mint', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount0In', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount1In', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount0Out', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount1Out', + type: 'uint256', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + ], + name: 'Swap', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint112', + name: 'reserve0', + type: 'uint112', + }, + { + indexed: false, + internalType: 'uint112', + name: 'reserve1', + type: 'uint112', + }, + ], + name: 'Sync', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + constant: true, + inputs: [], + name: 'DOMAIN_SEPARATOR', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'MINIMUM_LIQUIDITY', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'PERMIT_TYPEHASH', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + ], + name: 'burn', + outputs: [ + { + internalType: 'uint256', + name: 'amount0', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount1', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'factory', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getReserves', + outputs: [ + { + internalType: 'uint112', + name: 'reserve0', + type: 'uint112', + }, + { + internalType: 'uint112', + name: 'reserve1', + type: 'uint112', + }, + { + internalType: 'uint32', + name: 'blockTimestampLast', + type: 'uint32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'initialize', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'kLast', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + ], + name: 'mint', + outputs: [ + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'nonces', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'permit', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'price0CumulativeLast', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'price1CumulativeLast', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + ], + name: 'skim', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'uint256', + name: 'amount0Out', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount1Out', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'swap', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'sync', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'token0', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'token1', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, +] + +var abi$3 = [ + { + inputs: [], + name: 'WETH', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'tokenA', + type: 'address', + }, + { + internalType: 'address', + name: 'tokenB', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amountADesired', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountBDesired', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountAMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountBMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'addLiquidity', + outputs: [ + { + internalType: 'uint256', + name: 'amountA', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountB', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amountTokenDesired', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountTokenMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETHMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'addLiquidityETH', + outputs: [ + { + internalType: 'uint256', + name: 'amountToken', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETH', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'factory', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveOut', + type: 'uint256', + }, + ], + name: 'getAmountIn', + outputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveOut', + type: 'uint256', + }, + ], + name: 'getAmountOut', + outputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + ], + name: 'getAmountsIn', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + ], + name: 'getAmountsOut', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountA', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveA', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'reserveB', + type: 'uint256', + }, + ], + name: 'quote', + outputs: [ + { + internalType: 'uint256', + name: 'amountB', + type: 'uint256', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'tokenA', + type: 'address', + }, + { + internalType: 'address', + name: 'tokenB', + type: 'address', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountAMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountBMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'removeLiquidity', + outputs: [ + { + internalType: 'uint256', + name: 'amountA', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountB', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountTokenMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETHMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'removeLiquidityETH', + outputs: [ + { + internalType: 'uint256', + name: 'amountToken', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETH', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountTokenMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETHMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'removeLiquidityETHSupportingFeeOnTransferTokens', + outputs: [ + { + internalType: 'uint256', + name: 'amountETH', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountTokenMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETHMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'approveMax', + type: 'bool', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'removeLiquidityETHWithPermit', + outputs: [ + { + internalType: 'uint256', + name: 'amountToken', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETH', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountTokenMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountETHMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'approveMax', + type: 'bool', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'removeLiquidityETHWithPermitSupportingFeeOnTransferTokens', + outputs: [ + { + internalType: 'uint256', + name: 'amountETH', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'tokenA', + type: 'address', + }, + { + internalType: 'address', + name: 'tokenB', + type: 'address', + }, + { + internalType: 'uint256', + name: 'liquidity', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountAMin', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountBMin', + type: 'uint256', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'approveMax', + type: 'bool', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'removeLiquidityWithPermit', + outputs: [ + { + internalType: 'uint256', + name: 'amountA', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountB', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapETHForExactTokens', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountOutMin', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapExactETHForTokens', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountOutMin', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapExactETHForTokensSupportingFeeOnTransferTokens', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountOutMin', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapExactTokensForETH', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountOutMin', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapExactTokensForETHSupportingFeeOnTransferTokens', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountOutMin', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapExactTokensForTokens', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountOutMin', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapExactTokensForTokensSupportingFeeOnTransferTokens', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountInMax', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapTokensForExactETH', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amountInMax', + type: 'uint256', + }, + { + internalType: 'address[]', + name: 'path', + type: 'address[]', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + ], + name: 'swapTokensForExactTokens', + outputs: [ + { + internalType: 'uint256[]', + name: 'amounts', + type: 'uint256[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, +] + +var abi$2 = [ + { + inputs: [ + { + internalType: 'address', + name: '_factory', + type: 'address', + }, + { + internalType: 'address', + name: '_WETH9', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [], + name: 'WETH9', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'factory', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: 'path', + type: 'bytes', + }, + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + ], + name: 'quoteExactInput', + outputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'tokenIn', + type: 'address', + }, + { + internalType: 'address', + name: 'tokenOut', + type: 'address', + }, + { + internalType: 'uint24', + name: 'fee', + type: 'uint24', + }, + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + { + internalType: 'uint160', + name: 'sqrtPriceLimitX96', + type: 'uint160', + }, + ], + name: 'quoteExactInputSingle', + outputs: [ + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: 'path', + type: 'bytes', + }, + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + ], + name: 'quoteExactOutput', + outputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'tokenIn', + type: 'address', + }, + { + internalType: 'address', + name: 'tokenOut', + type: 'address', + }, + { + internalType: 'uint24', + name: 'fee', + type: 'uint24', + }, + { + internalType: 'uint256', + name: 'amountOut', + type: 'uint256', + }, + { + internalType: 'uint160', + name: 'sqrtPriceLimitX96', + type: 'uint160', + }, + ], + name: 'quoteExactOutputSingle', + outputs: [ + { + internalType: 'uint256', + name: 'amountIn', + type: 'uint256', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'int256', + name: 'amount0Delta', + type: 'int256', + }, + { + internalType: 'int256', + name: 'amount1Delta', + type: 'int256', + }, + { + internalType: 'bytes', + name: 'path', + type: 'bytes', + }, + ], + name: 'uniswapV3SwapCallback', + outputs: [], + stateMutability: 'view', + type: 'function', + }, +] + +var abi$1 = [ + { + inputs: [], + name: 'getCurrentBlockTimestamp', + outputs: [ + { + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'addr', + type: 'address', + }, + ], + name: 'getEthBalance', + outputs: [ + { + internalType: 'uint256', + name: 'balance', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + { + internalType: 'uint256', + name: 'gasLimit', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'callData', + type: 'bytes', + }, + ], + internalType: 'struct UniswapInterfaceMulticall.Call[]', + name: 'calls', + type: 'tuple[]', + }, + ], + name: 'multicall', + outputs: [ + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + { + components: [ + { + internalType: 'bool', + name: 'success', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'gasUsed', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'returnData', + type: 'bytes', + }, + ], + internalType: 'struct UniswapInterfaceMulticall.Result[]', + name: 'returnData', + type: 'tuple[]', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, +] + +var ARGENT_WALLET_DETECTOR_ABI = [ + { + inputs: [ + { + internalType: 'bytes32[]', + name: '_codes', + type: 'bytes32[]', + }, + { + internalType: 'address[]', + name: '_implementations', + type: 'address[]', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'code', + type: 'bytes32', + }, + ], + name: 'CodeAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'implementation', + type: 'address', + }, + ], + name: 'ImplementationAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: '_newOwner', + type: 'address', + }, + ], + name: 'OwnerChanged', + type: 'event', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + name: 'acceptedCodes', + outputs: [ + { + internalType: 'bool', + name: 'exists', + type: 'bool', + }, + { + internalType: 'uint128', + name: 'index', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'acceptedImplementations', + outputs: [ + { + internalType: 'bool', + name: 'exists', + type: 'bool', + }, + { + internalType: 'uint128', + name: 'index', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: '_code', + type: 'bytes32', + }, + ], + name: 'addCode', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_argentWallet', + type: 'address', + }, + ], + name: 'addCodeAndImplementationFromWallet', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_impl', + type: 'address', + }, + ], + name: 'addImplementation', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_newOwner', + type: 'address', + }, + ], + name: 'changeOwner', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'getCodes', + outputs: [ + { + internalType: 'bytes32[]', + name: '', + type: 'bytes32[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getImplementations', + outputs: [ + { + internalType: 'address[]', + name: '', + type: 'address[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_wallet', + type: 'address', + }, + ], + name: 'isArgentWallet', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] + +var EIP_2612 = [ + { + constant: true, + inputs: [ + { + name: 'owner', + type: 'address', + }, + ], + name: 'nonces', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'DOMAIN_SEPARATOR', + outputs: [ + { + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, +] + +var ENS_PUBLIC_RESOLVER_ABI = [ + { + inputs: [ + { + internalType: 'contract ENS', + name: '_ens', + type: 'address', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'uint256', + name: 'contentType', + type: 'uint256', + }, + ], + name: 'ABIChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'a', + type: 'address', + }, + ], + name: 'AddrChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'uint256', + name: 'coinType', + type: 'uint256', + }, + { + indexed: false, + internalType: 'bytes', + name: 'newAddress', + type: 'bytes', + }, + ], + name: 'AddressChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'target', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'isAuthorised', + type: 'bool', + }, + ], + name: 'AuthorisationChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'bytes', + name: 'hash', + type: 'bytes', + }, + ], + name: 'ContenthashChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'bytes', + name: 'name', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint16', + name: 'resource', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bytes', + name: 'record', + type: 'bytes', + }, + ], + name: 'DNSRecordChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'bytes', + name: 'name', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint16', + name: 'resource', + type: 'uint16', + }, + ], + name: 'DNSRecordDeleted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'DNSZoneCleared', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes4', + name: 'interfaceID', + type: 'bytes4', + }, + { + indexed: false, + internalType: 'address', + name: 'implementer', + type: 'address', + }, + ], + name: 'InterfaceChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'string', + name: 'name', + type: 'string', + }, + ], + name: 'NameChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'bytes32', + name: 'x', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'bytes32', + name: 'y', + type: 'bytes32', + }, + ], + name: 'PubkeyChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'string', + name: 'indexedKey', + type: 'string', + }, + { + indexed: false, + internalType: 'string', + name: 'key', + type: 'string', + }, + ], + name: 'TextChanged', + type: 'event', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'contentTypes', + type: 'uint256', + }, + ], + name: 'ABI', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'addr', + outputs: [ + { + internalType: 'address payable', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'authorisations', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'clearDNSZone', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'contenthash', + outputs: [ + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'name', + type: 'bytes32', + }, + { + internalType: 'uint16', + name: 'resource', + type: 'uint16', + }, + ], + name: 'dnsRecord', + outputs: [ + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'name', + type: 'bytes32', + }, + ], + name: 'hasDNSRecords', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes4', + name: 'interfaceID', + type: 'bytes4', + }, + ], + name: 'interfaceImplementer', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'pubkey', + outputs: [ + { + internalType: 'bytes32', + name: 'x', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'y', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'contentType', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'setABI', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'coinType', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'a', + type: 'bytes', + }, + ], + name: 'setAddr', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'a', + type: 'address', + }, + ], + name: 'setAddr', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'target', + type: 'address', + }, + { + internalType: 'bool', + name: 'isAuthorised', + type: 'bool', + }, + ], + name: 'setAuthorisation', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes', + name: 'hash', + type: 'bytes', + }, + ], + name: 'setContenthash', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'setDNSRecords', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes4', + name: 'interfaceID', + type: 'bytes4', + }, + { + internalType: 'address', + name: 'implementer', + type: 'address', + }, + ], + name: 'setInterface', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'string', + name: 'name', + type: 'string', + }, + ], + name: 'setName', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'x', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'y', + type: 'bytes32', + }, + ], + name: 'setPubkey', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'string', + name: 'key', + type: 'string', + }, + { + internalType: 'string', + name: 'value', + type: 'string', + }, + ], + name: 'setText', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes4', + name: 'interfaceID', + type: 'bytes4', + }, + ], + name: 'supportsInterface', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'string', + name: 'key', + type: 'string', + }, + ], + name: 'text', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, +] + +var ENS_ABI = [ + { + inputs: [ + { + internalType: 'contract ENS', + name: '_old', + type: 'address', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'operator', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'approved', + type: 'bool', + }, + ], + name: 'ApprovalForAll', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'label', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'NewOwner', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'resolver', + type: 'address', + }, + ], + name: 'NewResolver', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'uint64', + name: 'ttl', + type: 'uint64', + }, + ], + name: 'NewTTL', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + constant: true, + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'operator', + type: 'address', + }, + ], + name: 'isApprovedForAll', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'old', + outputs: [ + { + internalType: 'contract ENS', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'recordExists', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'resolver', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'address', + name: 'operator', + type: 'address', + }, + { + internalType: 'bool', + name: 'approved', + type: 'bool', + }, + ], + name: 'setApprovalForAll', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'setOwner', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'resolver', + type: 'address', + }, + { + internalType: 'uint64', + name: 'ttl', + type: 'uint64', + }, + ], + name: 'setRecord', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'resolver', + type: 'address', + }, + ], + name: 'setResolver', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'label', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'setSubnodeOwner', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'label', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'resolver', + type: 'address', + }, + { + internalType: 'uint64', + name: 'ttl', + type: 'uint64', + }, + ], + name: 'setSubnodeRecord', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + { + internalType: 'uint64', + name: 'ttl', + type: 'uint64', + }, + ], + name: 'setTTL', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'ttl', + outputs: [ + { + internalType: 'uint64', + name: '', + type: 'uint64', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, +] + +var ERC20ABI = [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_spender', + type: 'address', + }, + { + name: '_value', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_from', + type: 'address', + }, + { + name: '_to', + type: 'address', + }, + { + name: '_value', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [ + { + name: '', + type: 'uint8', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '_owner', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + name: 'balance', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: '_to', + type: 'address', + }, + { + name: '_value', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '_owner', + type: 'address', + }, + { + name: '_spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + payable: true, + stateMutability: 'payable', + type: 'fallback', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: 'owner', + type: 'address', + }, + { + indexed: true, + name: 'spender', + type: 'address', + }, + { + indexed: false, + name: 'value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: 'from', + type: 'address', + }, + { + indexed: true, + name: 'to', + type: 'address', + }, + { + indexed: false, + name: 'value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, +] + +var ERC20_BYTES32_ABI = [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [ + { + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [ + { + name: '', + type: 'bytes32', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, +] + +var ERC721_ABI = [ + { + inputs: [ + { + internalType: 'uint256', + name: 'tokenId', + type: 'uint256', + }, + ], + name: 'ownerOf', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'tokenId', + type: 'uint256', + }, + ], + name: 'tokenURI', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] + +var ERC1155_ABI = [ + { + constant: true, + inputs: [ + { + internalType: 'address', + name: '_owner', + type: 'address', + }, + { + internalType: 'uint256', + name: '_id', + type: 'uint256', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + internalType: 'uint256', + name: '_id', + type: 'uint256', + }, + ], + name: 'uri', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, +] + +var WETH_ABI = [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'guy', + type: 'address', + }, + { + name: 'wad', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'src', + type: 'address', + }, + { + name: 'dst', + type: 'address', + }, + { + name: 'wad', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'wad', + type: 'uint256', + }, + ], + name: 'withdraw', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [ + { + name: '', + type: 'uint8', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [ + { + name: '', + type: 'string', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { + name: 'dst', + type: 'address', + }, + { + name: 'wad', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + name: '', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'deposit', + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: '', + type: 'address', + }, + { + name: '', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + name: '', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + payable: true, + stateMutability: 'payable', + type: 'fallback', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: 'src', + type: 'address', + }, + { + indexed: true, + name: 'guy', + type: 'address', + }, + { + indexed: false, + name: 'wad', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: 'src', + type: 'address', + }, + { + indexed: true, + name: 'dst', + type: 'address', + }, + { + indexed: false, + name: 'wad', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: 'dst', + type: 'address', + }, + { + indexed: false, + name: 'wad', + type: 'uint256', + }, + ], + name: 'Deposit', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + name: 'src', + type: 'address', + }, + { + indexed: false, + name: 'wad', + type: 'uint256', + }, + ], + name: 'Withdrawal', + type: 'event', + }, +] + +var _a$h +/** + * List of all the networks supported by the Uniswap Interface + */ +var SupportedChainId +;(function (SupportedChainId) { + SupportedChainId[(SupportedChainId['MAINNET'] = 1)] = 'MAINNET' + SupportedChainId[(SupportedChainId['ROPSTEN'] = 3)] = 'ROPSTEN' + SupportedChainId[(SupportedChainId['RINKEBY'] = 4)] = 'RINKEBY' + SupportedChainId[(SupportedChainId['GOERLI'] = 5)] = 'GOERLI' + SupportedChainId[(SupportedChainId['KOVAN'] = 42)] = 'KOVAN' + SupportedChainId[(SupportedChainId['ARBITRUM_ONE'] = 42161)] = 'ARBITRUM_ONE' + SupportedChainId[(SupportedChainId['ARBITRUM_RINKEBY'] = 421611)] = 'ARBITRUM_RINKEBY' + SupportedChainId[(SupportedChainId['OPTIMISM'] = 10)] = 'OPTIMISM' + SupportedChainId[(SupportedChainId['OPTIMISTIC_KOVAN'] = 69)] = 'OPTIMISTIC_KOVAN' + SupportedChainId[(SupportedChainId['POLYGON'] = 137)] = 'POLYGON' + SupportedChainId[(SupportedChainId['POLYGON_MUMBAI'] = 80001)] = 'POLYGON_MUMBAI' +})(SupportedChainId || (SupportedChainId = {})) +var CHAIN_IDS_TO_NAMES = + ((_a$h = {}), + (_a$h[SupportedChainId.MAINNET] = 'mainnet'), + (_a$h[SupportedChainId.ROPSTEN] = 'ropsten'), + (_a$h[SupportedChainId.RINKEBY] = 'rinkeby'), + (_a$h[SupportedChainId.GOERLI] = 'goerli'), + (_a$h[SupportedChainId.KOVAN] = 'kovan'), + (_a$h[SupportedChainId.POLYGON] = 'polygon'), + (_a$h[SupportedChainId.POLYGON_MUMBAI] = 'polygon_mumbai'), + (_a$h[SupportedChainId.ARBITRUM_ONE] = 'arbitrum'), + (_a$h[SupportedChainId.ARBITRUM_RINKEBY] = 'arbitrum_rinkeby'), + (_a$h[SupportedChainId.OPTIMISM] = 'optimism'), + (_a$h[SupportedChainId.OPTIMISTIC_KOVAN] = 'optimistic_kovan'), + _a$h) +/** + * Array of all the supported chain IDs + */ +var ALL_SUPPORTED_CHAIN_IDS = Object.values(SupportedChainId).filter(function (id) { + return typeof id === 'number' +}) +var SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [SupportedChainId.MAINNET, SupportedChainId.POLYGON] +/** + * All the chain IDs that are running the Ethereum protocol. + */ +;[ + SupportedChainId.MAINNET, + SupportedChainId.ROPSTEN, + SupportedChainId.RINKEBY, + SupportedChainId.GOERLI, + SupportedChainId.KOVAN, + SupportedChainId.POLYGON, + SupportedChainId.POLYGON_MUMBAI, +] +/** + * Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior. + * The expectation is that all of these networks have immediate transaction confirmation. + */ +var L2_CHAIN_IDS = [ + SupportedChainId.ARBITRUM_ONE, + SupportedChainId.ARBITRUM_RINKEBY, + SupportedChainId.OPTIMISM, + SupportedChainId.OPTIMISTIC_KOVAN, +] + +var DEFAULT_NETWORKS = [ + SupportedChainId.MAINNET, + SupportedChainId.ROPSTEN, + SupportedChainId.RINKEBY, + SupportedChainId.GOERLI, + SupportedChainId.KOVAN, +] +function constructSameAddressMap(address, additionalNetworks) { + if (additionalNetworks === void 0) { + additionalNetworks = [] + } + return DEFAULT_NETWORKS.concat(additionalNetworks).reduce(function (memo, chainId) { + memo[chainId] = address + return memo + }, {}) +} + +var _a$g, _b$6, _c$4, _d$3, _e$2, _f$1, _g$1, _h$1 +var UNI_ADDRESS = constructSameAddressMap('0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984') +var MULTICALL_ADDRESS = __assign( + __assign( + {}, + constructSameAddressMap('0x1F98415757620B543A52E61c46B32eB19261F984', [ + SupportedChainId.OPTIMISTIC_KOVAN, + SupportedChainId.OPTIMISM, + SupportedChainId.POLYGON_MUMBAI, + SupportedChainId.POLYGON, + ]) + ), + ((_a$g = {}), + (_a$g[SupportedChainId.ARBITRUM_ONE] = '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB'), + (_a$g[SupportedChainId.ARBITRUM_RINKEBY] = '0xa501c031958F579dB7676fF1CE78AD305794d579'), + _a$g) +) +var V2_FACTORY_ADDRESSES = constructSameAddressMap(FACTORY_ADDRESS) +var V2_ROUTER_ADDRESS = constructSameAddressMap('0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D') +var V3_ROUTER_ADDRESS = constructSameAddressMap('0xE592427A0AEce92De3Edee1F18E0157C05861564', [ + SupportedChainId.OPTIMISM, + SupportedChainId.OPTIMISTIC_KOVAN, + SupportedChainId.ARBITRUM_ONE, + SupportedChainId.ARBITRUM_RINKEBY, + SupportedChainId.POLYGON, + SupportedChainId.POLYGON_MUMBAI, +]) +var SWAP_ROUTER_ADDRESSES = constructSameAddressMap('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', [ + SupportedChainId.OPTIMISM, + SupportedChainId.OPTIMISTIC_KOVAN, + SupportedChainId.ARBITRUM_ONE, + SupportedChainId.ARBITRUM_RINKEBY, + SupportedChainId.POLYGON, + SupportedChainId.POLYGON_MUMBAI, +]) +/** + * The oldest V0 governance address + */ +constructSameAddressMap('0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F') +/** + * The older V1 governance address + */ +;(_b$6 = {}), (_b$6[SupportedChainId.MAINNET] = '0xC4e172459f1E7939D522503B81AFAaC1014CE6F6'), _b$6 +/** + * The latest governor bravo that is currently admin of timelock + */ +;(_c$4 = {}), (_c$4[SupportedChainId.MAINNET] = '0x408ED6354d4973f66138C91495F2f2FCbd8724C3'), _c$4 +constructSameAddressMap('0x1a9C8182C09F50C8318d769245beA52c32BE35BC') +var MERKLE_DISTRIBUTOR_ADDRESS = + ((_d$3 = {}), (_d$3[SupportedChainId.MAINNET] = '0x090D4613473dEE047c3f2706764f49E0821D256e'), _d$3) +var ARGENT_WALLET_DETECTOR_ADDRESS = + ((_e$2 = {}), (_e$2[SupportedChainId.MAINNET] = '0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8'), _e$2) +var V3_CORE_FACTORY_ADDRESSES = constructSameAddressMap(FACTORY_ADDRESS$1, [ + SupportedChainId.OPTIMISM, + SupportedChainId.OPTIMISTIC_KOVAN, + SupportedChainId.ARBITRUM_ONE, + SupportedChainId.ARBITRUM_RINKEBY, + SupportedChainId.POLYGON_MUMBAI, + SupportedChainId.POLYGON, +]) +var QUOTER_ADDRESSES = constructSameAddressMap('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6', [ + SupportedChainId.OPTIMISM, + SupportedChainId.OPTIMISTIC_KOVAN, + SupportedChainId.ARBITRUM_ONE, + SupportedChainId.ARBITRUM_RINKEBY, + SupportedChainId.POLYGON_MUMBAI, + SupportedChainId.POLYGON, +]) +constructSameAddressMap('0xC36442b4a4522E871399CD717aBDD847Ab11FE88', [ + SupportedChainId.OPTIMISM, + SupportedChainId.OPTIMISTIC_KOVAN, + SupportedChainId.ARBITRUM_ONE, + SupportedChainId.ARBITRUM_RINKEBY, + SupportedChainId.POLYGON_MUMBAI, + SupportedChainId.POLYGON, +]) +var ENS_REGISTRAR_ADDRESSES = + ((_f$1 = {}), + (_f$1[SupportedChainId.MAINNET] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'), + (_f$1[SupportedChainId.ROPSTEN] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'), + (_f$1[SupportedChainId.GOERLI] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'), + (_f$1[SupportedChainId.RINKEBY] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'), + _f$1) +var SOCKS_CONTROLLER_ADDRESSES = + ((_g$1 = {}), (_g$1[SupportedChainId.MAINNET] = '0x65770b5283117639760beA3F867b69b3697a91dd'), _g$1) +constructSameAddressMap('0xA5644E29708357803b5A882D272c41cC0dF92B34', [ + SupportedChainId.ARBITRUM_ONE, + SupportedChainId.ARBITRUM_RINKEBY, + SupportedChainId.POLYGON_MUMBAI, + SupportedChainId.POLYGON, +]) +;(_h$1 = {}), + (_h$1[SupportedChainId.ARBITRUM_ONE] = '0xbfd8137f7d1516D3ea5cA83523914859ec47F573'), + (_h$1[SupportedChainId.ARBITRUM_RINKEBY] = '0xbfd8137f7d1516D3ea5cA83523914859ec47F573'), + _h$1 + +var _a$f, _b$5 +var AMPL = new Token(SupportedChainId.MAINNET, '0xD46bA6D942050d489DBd938a2C909A5d5039A161', 9, 'AMPL', 'Ampleforth') +var DAI = new Token(SupportedChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'Dai Stablecoin') +var DAI_ARBITRUM_ONE = new Token( + SupportedChainId.ARBITRUM_ONE, + '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', + 18, + 'DAI', + 'Dai stable coin' +) +var DAI_OPTIMISM = new Token( + SupportedChainId.OPTIMISM, + '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', + 18, + 'DAI', + 'Dai stable coin' +) +var USDC = new Token(SupportedChainId.MAINNET, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 6, 'USDC', 'USD//C') +var USDC_ARBITRUM = new Token( + SupportedChainId.ARBITRUM_ONE, + '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + 6, + 'USDC', + 'USD//C' +) +var USDC_POLYGON = new Token( + SupportedChainId.POLYGON, + '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', + 6, + 'USDC', + 'USD//C' +) +var DAI_POLYGON = new Token( + SupportedChainId.POLYGON, + '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + 18, + 'DAI', + 'Dai Stablecoin' +) +var USDT_POLYGON = new Token( + SupportedChainId.POLYGON, + '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', + 6, + 'USDT', + 'Tether USD' +) +var WBTC_POLYGON = new Token( + SupportedChainId.POLYGON, + '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', + 8, + 'WBTC', + 'Wrapped BTC' +) +var USDC_OPTIMISM = new Token( + SupportedChainId.OPTIMISM, + '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', + 6, + 'USDC', + 'USD//C' +) +var USDT = new Token(SupportedChainId.MAINNET, '0xdAC17F958D2ee523a2206206994597C13D831ec7', 6, 'USDT', 'Tether USD') +var USDT_ARBITRUM_ONE = new Token( + SupportedChainId.ARBITRUM_ONE, + '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', + 6, + 'USDT', + 'Tether USD' +) +var USDT_OPTIMISM = new Token( + SupportedChainId.OPTIMISM, + '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', + 6, + 'USDT', + 'Tether USD' +) +var WBTC = new Token(SupportedChainId.MAINNET, '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', 8, 'WBTC', 'Wrapped BTC') +var WBTC_ARBITRUM_ONE = new Token( + SupportedChainId.ARBITRUM_ONE, + '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', + 8, + 'WBTC', + 'Wrapped BTC' +) +var WBTC_OPTIMISM = new Token( + SupportedChainId.OPTIMISM, + '0x68f180fcCe6836688e9084f035309E29Bf0A2095', + 8, + 'WBTC', + 'Wrapped BTC' +) +var FEI = new Token(SupportedChainId.MAINNET, '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', 18, 'FEI', 'Fei USD') +var TRIBE = new Token(SupportedChainId.MAINNET, '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B', 18, 'TRIBE', 'Tribe') +var FRAX = new Token(SupportedChainId.MAINNET, '0x853d955aCEf822Db058eb8505911ED77F175b99e', 18, 'FRAX', 'Frax') +var FXS = new Token(SupportedChainId.MAINNET, '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', 18, 'FXS', 'Frax Share') +var renBTC = new Token(SupportedChainId.MAINNET, '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D', 8, 'renBTC', 'renBTC') +var ETH2X_FLI = new Token( + SupportedChainId.MAINNET, + '0xAa6E8127831c9DE45ae56bB1b0d4D4Da6e5665BD', + 18, + 'ETH2x-FLI', + 'ETH 2x Flexible Leverage Index' +) +var sETH2 = new Token( + SupportedChainId.MAINNET, + '0xFe2e637202056d30016725477c5da089Ab0A043A', + 18, + 'sETH2', + 'StakeWise Staked ETH2' +) +var rETH2 = new Token( + SupportedChainId.MAINNET, + '0x20BC832ca081b91433ff6c17f85701B6e92486c5', + 18, + 'rETH2', + 'StakeWise Reward ETH2' +) +var SWISE = new Token(SupportedChainId.MAINNET, '0x48C3399719B582dD63eB5AADf12A40B4C3f52FA2', 18, 'SWISE', 'StakeWise') +var WETH_POLYGON_MUMBAI = new Token( + SupportedChainId.POLYGON_MUMBAI, + '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', + 18, + 'WETH', + 'Wrapped Ether' +) +var WETH_POLYGON = new Token( + SupportedChainId.POLYGON, + '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', + 18, + 'WETH', + 'Wrapped Ether' +) +var UNI = + ((_a$f = {}), + (_a$f[SupportedChainId.MAINNET] = new Token(SupportedChainId.MAINNET, UNI_ADDRESS[1], 18, 'UNI', 'Uniswap')), + (_a$f[SupportedChainId.RINKEBY] = new Token(SupportedChainId.RINKEBY, UNI_ADDRESS[4], 18, 'UNI', 'Uniswap')), + (_a$f[SupportedChainId.ROPSTEN] = new Token(SupportedChainId.ROPSTEN, UNI_ADDRESS[3], 18, 'UNI', 'Uniswap')), + (_a$f[SupportedChainId.GOERLI] = new Token(SupportedChainId.GOERLI, UNI_ADDRESS[5], 18, 'UNI', 'Uniswap')), + (_a$f[SupportedChainId.KOVAN] = new Token(SupportedChainId.KOVAN, UNI_ADDRESS[42], 18, 'UNI', 'Uniswap')), + _a$f) +var WRAPPED_NATIVE_CURRENCY = __assign( + __assign({}, WETH9), + ((_b$5 = {}), + (_b$5[SupportedChainId.OPTIMISM] = new Token( + SupportedChainId.OPTIMISM, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + )), + (_b$5[SupportedChainId.OPTIMISTIC_KOVAN] = new Token( + SupportedChainId.OPTIMISTIC_KOVAN, + '0x4200000000000000000000000000000000000006', + 18, + 'WETH', + 'Wrapped Ether' + )), + (_b$5[SupportedChainId.ARBITRUM_ONE] = new Token( + SupportedChainId.ARBITRUM_ONE, + '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', + 18, + 'WETH', + 'Wrapped Ether' + )), + (_b$5[SupportedChainId.ARBITRUM_RINKEBY] = new Token( + SupportedChainId.ARBITRUM_RINKEBY, + '0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681', + 18, + 'WETH', + 'Wrapped Ether' + )), + (_b$5[SupportedChainId.POLYGON] = new Token( + SupportedChainId.POLYGON, + '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + 18, + 'WMATIC', + 'Wrapped MATIC' + )), + (_b$5[SupportedChainId.POLYGON_MUMBAI] = new Token( + SupportedChainId.POLYGON_MUMBAI, + '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', + 18, + 'WMATIC', + 'Wrapped MATIC' + )), + _b$5) +) +function isMatic(chainId) { + return chainId === SupportedChainId.POLYGON_MUMBAI || chainId === SupportedChainId.POLYGON +} +var MaticNativeCurrency = /** @class */ (function (_super) { + __extends(MaticNativeCurrency, _super) + function MaticNativeCurrency(chainId) { + var _this = this + if (!isMatic(chainId)) throw new Error('Not matic') + _this = _super.call(this, chainId, 18, 'MATIC', 'Polygon Matic') || this + return _this + } + MaticNativeCurrency.prototype.equals = function (other) { + return other.isNative && other.chainId === this.chainId + } + Object.defineProperty(MaticNativeCurrency.prototype, 'wrapped', { + get() { + if (!isMatic(this.chainId)) throw new Error('Not matic') + return WRAPPED_NATIVE_CURRENCY[this.chainId] + }, + enumerable: false, + configurable: true, + }) + return MaticNativeCurrency +})(NativeCurrency) +var ExtendedEther = /** @class */ (function (_super) { + __extends(ExtendedEther, _super) + function ExtendedEther() { + return (_super !== null && _super.apply(this, arguments)) || this + } + Object.defineProperty(ExtendedEther.prototype, 'wrapped', { + get() { + if (this.chainId in WRAPPED_NATIVE_CURRENCY) return WRAPPED_NATIVE_CURRENCY[this.chainId] + throw new Error('Unsupported chain ID') + }, + enumerable: false, + configurable: true, + }) + ExtendedEther.onChain = function (chainId) { + var _a + return (_a = this._cachedExtendedEther[chainId]) !== null && _a !== void 0 + ? _a + : (this._cachedExtendedEther[chainId] = new ExtendedEther(chainId)) + } + ExtendedEther._cachedExtendedEther = {} + return ExtendedEther +})(Ether) +var cachedNativeCurrency = {} +function nativeOnChain(chainId) { + var _a + return (_a = cachedNativeCurrency[chainId]) !== null && _a !== void 0 + ? _a + : (cachedNativeCurrency[chainId] = isMatic(chainId) + ? new MaticNativeCurrency(chainId) + : ExtendedEther.onChain(chainId)) +} + +// returns null on errors +function useContract(addressOrAddressMap, ABI, withSignerIfPossible) { + if (withSignerIfPossible === void 0) { + withSignerIfPossible = true + } + var _a = useActiveWeb3React(), + library = _a.library, + account = _a.account, + chainId = _a.chainId + return useMemo( + function () { + if (!addressOrAddressMap || !ABI || !library || !chainId) return null + var address + if (typeof addressOrAddressMap === 'string') address = addressOrAddressMap + else address = addressOrAddressMap[chainId] + if (!address) return null + try { + return getContract(address, ABI, library, withSignerIfPossible && account ? account : undefined) + } catch (error) { + console.error('Failed to get contract', error) + return null + } + }, + [addressOrAddressMap, ABI, library, chainId, withSignerIfPossible, account] + ) +} +function useTokenContract(tokenAddress, withSignerIfPossible) { + return useContract(tokenAddress, ERC20ABI, withSignerIfPossible) +} +function useWETHContract(withSignerIfPossible) { + var _a + var chainId = useActiveWeb3React().chainId + return useContract( + chainId ? ((_a = WRAPPED_NATIVE_CURRENCY[chainId]) === null || _a === void 0 ? void 0 : _a.address) : undefined, + WETH_ABI, + withSignerIfPossible + ) +} +function useERC721Contract(nftAddress) { + return useContract(nftAddress, ERC721_ABI, false) +} +function useERC1155Contract(nftAddress) { + return useContract(nftAddress, ERC1155_ABI, false) +} +function useArgentWalletDetectorContract() { + return useContract(ARGENT_WALLET_DETECTOR_ADDRESS, ARGENT_WALLET_DETECTOR_ABI, false) +} +function useENSRegistrarContract(withSignerIfPossible) { + return useContract(ENS_REGISTRAR_ADDRESSES, ENS_ABI, withSignerIfPossible) +} +function useENSResolverContract(address, withSignerIfPossible) { + return useContract(address, ENS_PUBLIC_RESOLVER_ABI, withSignerIfPossible) +} +function useBytes32TokenContract(tokenAddress, withSignerIfPossible) { + return useContract(tokenAddress, ERC20_BYTES32_ABI, withSignerIfPossible) +} +function useEIP2612Contract(tokenAddress) { + return useContract(tokenAddress, EIP_2612, false) +} +function useV2RouterContract() { + return useContract(V2_ROUTER_ADDRESS, abi$3, true) +} +function useInterfaceMulticall() { + return useContract(MULTICALL_ADDRESS, abi$1, false) +} +function useMerkleDistributorContract() { + return useContract(MERKLE_DISTRIBUTOR_ADDRESS, abi$5, true) +} +function useV3Quoter() { + return useContract(QUOTER_ADDRESSES, abi$2) +} + +var _a$e +var multicall = createMulticall() +var reducer = combineReducers(((_a$e = {}), (_a$e[multicall.reducerPath] = multicall.reducer), _a$e)) +createStore(reducer) +function MulticallUpdater() { + var latestBlockNumber = useBlockNumber() + var chainId = useActiveWeb3React().chainId + var contract = useInterfaceMulticall() + return jsx(multicall.Updater, { chainId, latestBlockNumber, contract }, void 0) +} + +function useMultipleContractSingleData() { + var _a + var args = [] + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i] + } + var _b = useCallContext(), + chainId = _b.chainId, + latestBlock = _b.latestBlock + return (_a = multicall.hooks).useMultipleContractSingleData.apply( + _a, + __spreadArray([chainId, latestBlock], __read(args), false) + ) +} +function useSingleCallResult() { + var _a + var args = [] + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i] + } + var _b = useCallContext(), + chainId = _b.chainId, + latestBlock = _b.latestBlock + return (_a = multicall.hooks).useSingleCallResult.apply( + _a, + __spreadArray([chainId, latestBlock], __read(args), false) + ) +} +function useSingleContractMultipleData() { + var _a + var args = [] + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i] + } + var _b = useCallContext(), + chainId = _b.chainId, + latestBlock = _b.latestBlock + return (_a = multicall.hooks).useSingleContractMultipleData.apply( + _a, + __spreadArray([chainId, latestBlock], __read(args), false) + ) +} +function useSingleContractWithCallData() { + var _a + var args = [] + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i] + } + var _b = useCallContext(), + chainId = _b.chainId, + latestBlock = _b.latestBlock + return (_a = multicall.hooks).useSingleContractWithCallData.apply( + _a, + __spreadArray([chainId, latestBlock], __read(args), false) + ) +} +function useCallContext() { + var chainId = useActiveWeb3React().chainId + var latestBlock = useBlockNumber() + return { chainId, latestBlock } +} + +function safeNamehash(name) { + if (name === undefined) return undefined + try { + return namehash(name) + } catch (error) { + console.debug(error) + return undefined + } +} + +/** + * Returns true if the string value is zero in hex + * @param hexNumberString + */ +function isZero(hexNumberString) { + return /^0x0*$/.test(hexNumberString) +} + +/** + * Does a lookup for an ENS name to find its address. + */ +function useENSAddress(ensName) { + var _a + var debouncedName = useDebounce(ensName, 200) + var ensNodeArgument = useMemo( + function () { + return [debouncedName === null ? undefined : safeNamehash(debouncedName)] + }, + [debouncedName] + ) + var registrarContract = useENSRegistrarContract(false) + var resolverAddress = useSingleCallResult(registrarContract, 'resolver', ensNodeArgument) + var resolverAddressResult = (_a = resolverAddress.result) === null || _a === void 0 ? void 0 : _a[0] + var resolverContract = useENSResolverContract( + resolverAddressResult && !isZero(resolverAddressResult) ? resolverAddressResult : undefined, + false + ) + var addr = useSingleCallResult(resolverContract, 'addr', ensNodeArgument) + var changed = debouncedName !== ensName + return useMemo( + function () { + var _a, _b + return { + address: changed + ? null + : (_b = (_a = addr.result) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 + ? _b + : null, + loading: changed || resolverAddress.loading || addr.loading, + } + }, + [addr.loading, addr.result, changed, resolverAddress.loading] + ) +} + +/** + * Does a reverse lookup for an address to find its ENS name. + * Note this is not the same as looking up an ENS name to find an address. + */ +function useENSName(address) { + var _a, _b + var debouncedAddress = useDebounce(address, 200) + var ensNodeArgument = useMemo( + function () { + if (!debouncedAddress || !isAddress(debouncedAddress)) return [undefined] + return [namehash(debouncedAddress.toLowerCase().substr(2) + '.addr.reverse')] + }, + [debouncedAddress] + ) + var registrarContract = useENSRegistrarContract(false) + var resolverAddress = useSingleCallResult(registrarContract, 'resolver', ensNodeArgument) + var resolverAddressResult = (_a = resolverAddress.result) === null || _a === void 0 ? void 0 : _a[0] + var resolverContract = useENSResolverContract( + resolverAddressResult && !isZero(resolverAddressResult) ? resolverAddressResult : undefined, + false + ) + var nameCallRes = useSingleCallResult(resolverContract, 'name', ensNodeArgument) + var name = (_b = nameCallRes.result) === null || _b === void 0 ? void 0 : _b[0] + /* ENS does not enforce that an address owns a .eth domain before setting it as a reverse proxy + and recommends that you perform a match on the forward resolution + see: https://docs.ens.domains/dapp-developer-guide/resolving-names#reverse-resolution + */ + var fwdAddr = useENSAddress(name) + var checkedName = address === (fwdAddr === null || fwdAddr === void 0 ? void 0 : fwdAddr.address) ? name : null + var changed = debouncedAddress !== address + return useMemo( + function () { + return { + ENSName: changed ? null : checkedName, + loading: changed || resolverAddress.loading || nameCallRes.loading, + } + }, + [changed, nameCallRes.loading, checkedName, resolverAddress.loading] + ) +} + +/** + * Given a name or address, does a lookup to resolve to an address and name + * @param nameOrAddress ENS name or address + */ +function useENS(nameOrAddress) { + var validated = isAddress(nameOrAddress) + var reverseLookup = useENSName(validated ? validated : undefined) + var lookup = useENSAddress(nameOrAddress) + return useMemo( + function () { + return { + loading: reverseLookup.loading || lookup.loading, + address: validated ? validated : lookup.address, + name: reverseLookup.ENSName + ? reverseLookup.ENSName + : !validated && lookup.address + ? nameOrAddress || null + : null, + } + }, + [lookup.address, lookup.loading, nameOrAddress, reverseLookup.ENSName, reverseLookup.loading, validated] + ) +} + +/** + * Returns the gas value plus a margin for unexpected or variable gas costs + * @param value the gas value to pad + */ +function calculateGasMargin(value) { + return value.mul(120).div(100) +} + +/** + * Be careful adding to this enum, always assign a unique value (typescript will not prevent duplicate values). + * These values is persisted in state and if you change the value it will cause errors + */ +var TransactionType +;(function (TransactionType) { + TransactionType[(TransactionType['APPROVAL'] = 0)] = 'APPROVAL' + TransactionType[(TransactionType['SWAP'] = 1)] = 'SWAP' + TransactionType[(TransactionType['DEPOSIT_LIQUIDITY_STAKING'] = 2)] = 'DEPOSIT_LIQUIDITY_STAKING' + TransactionType[(TransactionType['WITHDRAW_LIQUIDITY_STAKING'] = 3)] = 'WITHDRAW_LIQUIDITY_STAKING' + TransactionType[(TransactionType['CLAIM'] = 4)] = 'CLAIM' + TransactionType[(TransactionType['VOTE'] = 5)] = 'VOTE' + TransactionType[(TransactionType['DELEGATE'] = 6)] = 'DELEGATE' + TransactionType[(TransactionType['WRAP'] = 7)] = 'WRAP' + TransactionType[(TransactionType['CREATE_V3_POOL'] = 8)] = 'CREATE_V3_POOL' + TransactionType[(TransactionType['ADD_LIQUIDITY_V3_POOL'] = 9)] = 'ADD_LIQUIDITY_V3_POOL' + TransactionType[(TransactionType['ADD_LIQUIDITY_V2_POOL'] = 10)] = 'ADD_LIQUIDITY_V2_POOL' + TransactionType[(TransactionType['MIGRATE_LIQUIDITY_V3'] = 11)] = 'MIGRATE_LIQUIDITY_V3' + TransactionType[(TransactionType['COLLECT_FEES'] = 12)] = 'COLLECT_FEES' + TransactionType[(TransactionType['REMOVE_LIQUIDITY_V3'] = 13)] = 'REMOVE_LIQUIDITY_V3' + TransactionType[(TransactionType['SUBMIT_PROPOSAL'] = 14)] = 'SUBMIT_PROPOSAL' +})(TransactionType || (TransactionType = {})) +var addTransaction = createAction('transactions/addTransaction') +var clearAllTransactions = createAction('transactions/clearAllTransactions') +var finalizeTransaction = createAction('transactions/finalizeTransaction') +var checkedTransaction = createAction('transactions/checkedTransaction') + +var SUPPORTED_TRANSACTION_TYPES = [ + TransactionType.ADD_LIQUIDITY_V2_POOL, + TransactionType.ADD_LIQUIDITY_V3_POOL, + TransactionType.CREATE_V3_POOL, + TransactionType.REMOVE_LIQUIDITY_V3, + TransactionType.SWAP, +] +var FIREBASE_API_KEY = process.env.REACT_APP_FIREBASE_KEY +var firebaseEnabled = typeof FIREBASE_API_KEY !== 'undefined' +if (firebaseEnabled) initializeFirebase() +function useMonitoringEventCallback() { + var chainId = useActiveWeb3React().chainId + return useCallback( + function log(type, _a) { + var transactionResponse = _a.transactionResponse, + walletAddress = _a.walletAddress + return __awaiter(this, void 0, void 0, function () { + var db + return __generator(this, function (_b) { + if (!firebaseEnabled) return [2 /*return*/] + db = getDatabase() + if (!walletAddress) { + console.debug('Wallet address required to log monitoring events.') + return [2 /*return*/] + } + try { + push(ref(db, 'trm'), { + chainId, + origin: window.location.origin, + timestamp: Date.now(), + tx: transactionResponse, + type, + walletAddress, + }) + } catch (e) { + console.debug('Error adding document: ', e) + } + return [2 /*return*/] + }) + }) + }, + [chainId] + ) +} +function useTransactionMonitoringEventCallback() { + var account = useActiveWeb3React().account + var log = useMonitoringEventCallback() + return useCallback( + function (info, transactionResponse) { + if (SUPPORTED_TRANSACTION_TYPES.includes(info.type)) { + log(TransactionType[info.type], { + transactionResponse: (function (_a) { + var hash = _a.hash, + v = _a.v, + r = _a.r, + s = _a.s + return { hash, v, r, s } + })(transactionResponse), + walletAddress: account !== null && account !== void 0 ? account : undefined, + }) + } + }, + [account, log] + ) +} +function useWalletConnectMonitoringEventCallback() { + var log = useMonitoringEventCallback() + return useCallback( + function (walletAddress) { + log('WALLET_CONNECTED', { transactionResponse: { hash: '', r: '', s: '', v: -1 }, walletAddress }) + }, + [log] + ) +} +function initializeFirebase() { + initializeApp({ + apiKey: process.env.REACT_APP_FIREBASE_KEY, + authDomain: 'interface-monitoring.firebaseapp.com', + databaseURL: 'https://interface-monitoring-default-rtdb.firebaseio.com', + projectId: 'interface-monitoring', + storageBucket: 'interface-monitoring.appspot.com', + messagingSenderId: '968187720053', + appId: '1:968187720053:web:acedf72dce629d470be33c', + }) +} + +// helper that can take a ethers library transaction response and add it to the list of transactions +function useTransactionAdder() { + var _a = useActiveWeb3React(), + chainId = _a.chainId, + account = _a.account + var dispatch = useAppDispatch() + var logMonitoringEvent = useTransactionMonitoringEventCallback() + return useCallback( + function (response, info) { + if (!account) return + if (!chainId) return + var hash = response.hash + if (!hash) { + throw Error('No transaction hash found.') + } + dispatch(addTransaction({ hash, from: account, info, chainId })) + logMonitoringEvent(info, response) + }, + [account, chainId, dispatch, logMonitoringEvent] + ) +} +// returns all the transactions for the current chain +function useAllTransactions() { + var _a + var chainId = useActiveWeb3React().chainId + var state = useAppSelector(function (state) { + return state.transactions + }) + return chainId ? ((_a = state[chainId]) !== null && _a !== void 0 ? _a : {}) : {} +} +function useTransaction(transactionHash) { + var allTransactions = useAllTransactions() + if (!transactionHash) { + return undefined + } + return allTransactions[transactionHash] +} +function useIsTransactionPending(transactionHash) { + var transactions = useAllTransactions() + if (!transactionHash || !transactions[transactionHash]) return false + return !transactions[transactionHash].receipt +} +function useIsTransactionConfirmed(transactionHash) { + var transactions = useAllTransactions() + if (!transactionHash || !transactions[transactionHash]) return false + return Boolean(transactions[transactionHash].receipt) +} +/** + * Returns whether a transaction happened in the last day (86400 seconds * 1000 milliseconds / second) + * @param tx to check for recency + */ +function isTransactionRecent(tx) { + return new Date().getTime() - tx.addedTime < 86400000 +} +// returns whether a token has a pending approval transaction +function useHasPendingApproval(token, spender) { + var allTransactions = useAllTransactions() + return useMemo( + function () { + return ( + typeof (token === null || token === void 0 ? void 0 : token.address) === 'string' && + typeof spender === 'string' && + Object.keys(allTransactions).some(function (hash) { + var tx = allTransactions[hash] + if (!tx) return false + if (tx.receipt) { + return false + } else { + if (tx.info.type !== TransactionType.APPROVAL) return false + return tx.info.spender === spender && tx.info.tokenAddress === token.address && isTransactionRecent(tx) + } + }) + ) + }, + [allTransactions, spender, token === null || token === void 0 ? void 0 : token.address] + ) +} +// watch for submissions to claim +// return null if not done loading, return undefined if not found +function useUserHasSubmittedClaim(account) { + var allTransactions = useAllTransactions() + // get the txn if it has been submitted + var claimTxn = useMemo( + function () { + var txnIndex = Object.keys(allTransactions).find(function (hash) { + var tx = allTransactions[hash] + return tx.info.type === TransactionType.CLAIM && tx.info.recipient === account + }) + return txnIndex && allTransactions[txnIndex] ? allTransactions[txnIndex] : undefined + }, + [account, allTransactions] + ) + return { claimSubmitted: Boolean(claimTxn), claimTxn } +} + +var FETCH_CLAIM_MAPPING_PROMISE = null +function fetchClaimMapping() { + return FETCH_CLAIM_MAPPING_PROMISE !== null && FETCH_CLAIM_MAPPING_PROMISE !== void 0 + ? FETCH_CLAIM_MAPPING_PROMISE + : (FETCH_CLAIM_MAPPING_PROMISE = fetch( + 'https://raw.githubusercontent.com/Uniswap/mrkl-drop-data-chunks/final/chunks/mapping.json' + ) + .then(function (res) { + return res.json() + }) + .catch(function (error) { + console.error('Failed to get claims mapping', error) + FETCH_CLAIM_MAPPING_PROMISE = null + })) +} +var FETCH_CLAIM_FILE_PROMISES = {} +function fetchClaimFile(key) { + var _a + return (_a = FETCH_CLAIM_FILE_PROMISES[key]) !== null && _a !== void 0 + ? _a + : (FETCH_CLAIM_FILE_PROMISES[key] = fetch( + 'https://raw.githubusercontent.com/Uniswap/mrkl-drop-data-chunks/final/chunks/' + key + '.json' + ) + .then(function (res) { + return res.json() + }) + .catch(function (error) { + console.error('Failed to get claim file mapping for starting address ' + key, error) + delete FETCH_CLAIM_FILE_PROMISES[key] + })) +} +var FETCH_CLAIM_PROMISES = {} +// returns the claim for the given address, or null if not valid +function fetchClaim(account) { + var _a + var formatted = isAddress(account) + if (!formatted) return Promise.reject(new Error('Invalid address')) + return (_a = FETCH_CLAIM_PROMISES[account]) !== null && _a !== void 0 + ? _a + : (FETCH_CLAIM_PROMISES[account] = fetchClaimMapping() + .then(function (mapping) { + var e_1, _a + var sorted = Object.keys(mapping).sort(function (a, b) { + return a.toLowerCase() < b.toLowerCase() ? -1 : 1 + }) + try { + for ( + var sorted_1 = __values(sorted), sorted_1_1 = sorted_1.next(); + !sorted_1_1.done; + sorted_1_1 = sorted_1.next() + ) { + var startingAddress = sorted_1_1.value + var lastAddress = mapping[startingAddress] + if (startingAddress.toLowerCase() <= formatted.toLowerCase()) { + if (formatted.toLowerCase() <= lastAddress.toLowerCase()) { + return startingAddress + } + } else { + throw new Error('Claim for ' + formatted + ' was not found in partial search') + } + } + } catch (e_1_1) { + e_1 = { error: e_1_1 } + } finally { + try { + if (sorted_1_1 && !sorted_1_1.done && (_a = sorted_1.return)) _a.call(sorted_1) + } finally { + if (e_1) throw e_1.error + } + } + throw new Error('Claim for ' + formatted + ' was not found after searching all mappings') + }) + .then(fetchClaimFile) + .then(function (result) { + if (result[formatted]) return result[formatted] + throw new Error('Claim for ' + formatted + ' was not found in claim file!') + }) + .catch(function (error) { + console.debug('Claim fetch failed', error) + throw error + })) +} +// parse distributorContract blob and detect if user has claim data +// null means we know it does not +function useUserClaimData(account) { + var chainId = useActiveWeb3React().chainId + var _a = __read(useState({}), 2), + claimInfo = _a[0], + setClaimInfo = _a[1] + useEffect( + function () { + if (!account || chainId !== 1) return + fetchClaim(account) + .then(function (accountClaimInfo) { + return setClaimInfo(function (claimInfo) { + var _a + return __assign(__assign({}, claimInfo), ((_a = {}), (_a[account] = accountClaimInfo), _a)) + }) + }) + .catch(function () { + setClaimInfo(function (claimInfo) { + var _a + return __assign(__assign({}, claimInfo), ((_a = {}), (_a[account] = null), _a)) + }) + }) + }, + [account, chainId] + ) + return account && chainId === 1 ? claimInfo[account] : null +} +// check if user is in blob and has not yet claimed UNI +function useUserHasAvailableClaim(account) { + var _a + var userClaimData = useUserClaimData(account) + var distributorContract = useMerkleDistributorContract() + var isClaimedResult = useSingleCallResult(distributorContract, 'isClaimed', [ + userClaimData === null || userClaimData === void 0 ? void 0 : userClaimData.index, + ]) + // user is in blob and contract marks as unclaimed + return Boolean( + userClaimData && + !isClaimedResult.loading && + ((_a = isClaimedResult.result) === null || _a === void 0 ? void 0 : _a[0]) === false + ) +} +function useUserUnclaimedAmount(account) { + var chainId = useActiveWeb3React().chainId + var userClaimData = useUserClaimData(account) + var canClaim = useUserHasAvailableClaim(account) + var uni = chainId ? UNI[chainId] : undefined + if (!uni) return undefined + if (!canClaim || !userClaimData) { + return CurrencyAmount.fromRawAmount(uni, JSBI.BigInt(0)) + } + return CurrencyAmount.fromRawAmount(uni, JSBI.BigInt(userClaimData.amount)) +} +function useClaimCallback(account) { + // get claim data for this account + var _a = useActiveWeb3React(), + library = _a.library, + chainId = _a.chainId + var claimData = useUserClaimData(account) + // used for popup summary + var unclaimedAmount = useUserUnclaimedAmount(account) + var addTransaction = useTransactionAdder() + var distributorContract = useMerkleDistributorContract() + var claimCallback = function () { + return __awaiter(this, void 0, void 0, function () { + var args + var _a + return __generator(this, function (_b) { + if (!claimData || !account || !library || !chainId || !distributorContract) return [2 /*return*/] + args = [claimData.index, account, claimData.amount, claimData.proof] + return [ + 2 /*return*/, + (_a = distributorContract.estimateGas)['claim'] + .apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{}], false)) + .then(function (estimatedGasLimit) { + return distributorContract.claim + .apply( + distributorContract, + __spreadArray( + __spreadArray([], __read(args), false), + [{ value: null, gasLimit: calculateGasMargin(estimatedGasLimit) }], + false + ) + ) + .then(function (response) { + addTransaction(response, { + type: TransactionType.CLAIM, + recipient: account, + uniAmountRaw: + unclaimedAmount === null || unclaimedAmount === void 0 + ? void 0 + : unclaimedAmount.quotient.toString(), + }) + return response.hash + }) + }), + ] + }) + }) + } + return { claimCallback } +} + +var _a$d, _b$4, _c$3, _d$2, _e$1, _f, _g, _h +var WRAPPED_NATIVE_CURRENCIES_ONLY = Object.fromEntries( + Object.entries(WRAPPED_NATIVE_CURRENCY).map(function (_a) { + var _b = __read(_a, 2), + key = _b[0], + value = _b[1] + return [key, [value]] + }) +) +// used to construct intermediary pairs for trading +var BASES_TO_CHECK_TRADES_AGAINST = __assign( + __assign({}, WRAPPED_NATIVE_CURRENCIES_ONLY), + ((_a$d = {}), + (_a$d[SupportedChainId.MAINNET] = __spreadArray( + __spreadArray([], __read(WRAPPED_NATIVE_CURRENCIES_ONLY[SupportedChainId.MAINNET]), false), + [DAI, USDC, USDT, WBTC], + false + )), + (_a$d[SupportedChainId.OPTIMISM] = __spreadArray( + __spreadArray([], __read(WRAPPED_NATIVE_CURRENCIES_ONLY[SupportedChainId.OPTIMISM]), false), + [DAI_OPTIMISM, USDT_OPTIMISM, WBTC_OPTIMISM], + false + )), + (_a$d[SupportedChainId.ARBITRUM_ONE] = __spreadArray( + __spreadArray([], __read(WRAPPED_NATIVE_CURRENCIES_ONLY[SupportedChainId.ARBITRUM_ONE]), false), + [DAI_ARBITRUM_ONE, USDT_ARBITRUM_ONE, WBTC_ARBITRUM_ONE], + false + )), + (_a$d[SupportedChainId.POLYGON] = __spreadArray( + __spreadArray([], __read(WRAPPED_NATIVE_CURRENCIES_ONLY[SupportedChainId.POLYGON]), false), + [DAI_POLYGON, USDC_POLYGON, USDT_POLYGON, WETH_POLYGON], + false + )), + _a$d) +) +var ADDITIONAL_BASES = + ((_b$4 = {}), + (_b$4[SupportedChainId.MAINNET] = + ((_c$3 = { + '0xF16E4d813f4DcfDe4c5b44f305c908742De84eF0': [ETH2X_FLI], + }), + (_c$3[rETH2.address] = [sETH2]), + (_c$3[SWISE.address] = [sETH2]), + (_c$3[FEI.address] = [TRIBE]), + (_c$3[TRIBE.address] = [FEI]), + (_c$3[FRAX.address] = [FXS]), + (_c$3[FXS.address] = [FRAX]), + (_c$3[WBTC.address] = [renBTC]), + (_c$3[renBTC.address] = [WBTC]), + _c$3)), + _b$4) +/** + * Some tokens can only be swapped via certain pairs, so we override the list of bases that are considered for these + * tokens. + */ +var CUSTOM_BASES = + ((_d$2 = {}), + (_d$2[SupportedChainId.MAINNET] = + ((_e$1 = {}), (_e$1[AMPL.address] = [DAI, WRAPPED_NATIVE_CURRENCY[SupportedChainId.MAINNET]]), _e$1)), + _d$2) +/** + * Shows up in the currency select for swap and add liquidity + */ +var COMMON_BASES = + ((_f = {}), + (_f[SupportedChainId.MAINNET] = [ + nativeOnChain(SupportedChainId.MAINNET), + DAI, + USDC, + USDT, + WBTC, + WRAPPED_NATIVE_CURRENCY[SupportedChainId.MAINNET], + ]), + (_f[SupportedChainId.ROPSTEN] = [ + nativeOnChain(SupportedChainId.ROPSTEN), + WRAPPED_NATIVE_CURRENCY[SupportedChainId.ROPSTEN], + ]), + (_f[SupportedChainId.RINKEBY] = [ + nativeOnChain(SupportedChainId.RINKEBY), + WRAPPED_NATIVE_CURRENCY[SupportedChainId.RINKEBY], + ]), + (_f[SupportedChainId.GOERLI] = [ + nativeOnChain(SupportedChainId.GOERLI), + WRAPPED_NATIVE_CURRENCY[SupportedChainId.GOERLI], + ]), + (_f[SupportedChainId.KOVAN] = [ + nativeOnChain(SupportedChainId.KOVAN), + WRAPPED_NATIVE_CURRENCY[SupportedChainId.KOVAN], + ]), + (_f[SupportedChainId.ARBITRUM_ONE] = [ + nativeOnChain(SupportedChainId.ARBITRUM_ONE), + DAI_ARBITRUM_ONE, + USDC_ARBITRUM, + USDT_ARBITRUM_ONE, + WBTC_ARBITRUM_ONE, + WRAPPED_NATIVE_CURRENCY[SupportedChainId.ARBITRUM_ONE], + ]), + (_f[SupportedChainId.ARBITRUM_RINKEBY] = [ + nativeOnChain(SupportedChainId.ARBITRUM_RINKEBY), + WRAPPED_NATIVE_CURRENCY[SupportedChainId.ARBITRUM_RINKEBY], + ]), + (_f[SupportedChainId.OPTIMISM] = [ + nativeOnChain(SupportedChainId.OPTIMISM), + DAI_OPTIMISM, + USDC_OPTIMISM, + USDT_OPTIMISM, + WBTC_OPTIMISM, + ]), + (_f[SupportedChainId.OPTIMISTIC_KOVAN] = [nativeOnChain(SupportedChainId.OPTIMISTIC_KOVAN)]), + (_f[SupportedChainId.POLYGON] = [ + nativeOnChain(SupportedChainId.POLYGON), + WETH_POLYGON, + USDC_POLYGON, + DAI_POLYGON, + USDT_POLYGON, + WBTC_POLYGON, + ]), + (_f[SupportedChainId.POLYGON_MUMBAI] = [ + nativeOnChain(SupportedChainId.POLYGON_MUMBAI), + WRAPPED_NATIVE_CURRENCY[SupportedChainId.POLYGON_MUMBAI], + WETH_POLYGON_MUMBAI, + ]), + _f) +// used to construct the list of all pairs we consider by default in the frontend +__assign( + __assign({}, WRAPPED_NATIVE_CURRENCIES_ONLY), + ((_g = {}), + (_g[SupportedChainId.MAINNET] = __spreadArray( + __spreadArray([], __read(WRAPPED_NATIVE_CURRENCIES_ONLY[SupportedChainId.MAINNET]), false), + [DAI, USDC, USDT, WBTC], + false + )), + _g) +) +;(_h = {}), + (_h[SupportedChainId.MAINNET] = [ + [ + new Token(SupportedChainId.MAINNET, '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', 8, 'cDAI', 'Compound Dai'), + new Token( + SupportedChainId.MAINNET, + '0x39AA39c021dfbaE8faC545936693aC917d5E7563', + 8, + 'cUSDC', + 'Compound USD Coin' + ), + ], + [USDC, USDT], + [DAI, USDT], + ]), + _h + +var EthereumLogo = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC' + +var arbitrumLogoUrl = + 'data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20viewBox%3D%220%200%20470.287%20514.251%22%20enable-background%3D%22new%200%200%20470.287%20514.251%22%20xml%3Aspace%3D%22preserve%22%3E%3Cg%20id%3D%22Background%22%3E%3C%2Fg%3E%3Cg%20id%3D%22Logos_and_symbols%22%3E%20%3Cg%20id%3D%22SYMBOL_VER_3%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_3_3_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_4%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_4_1_%22%3E%20%20%3Cg%20id%3D%22SYMBOL_VER_4_3_%22%3E%20%20%3C%2Fg%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_5_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22off_2_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22VER_3_1_%22%3E%20%20%3Cg%20id%3D%22SYMBOL_VER_2_1_%22%3E%20%20%3C%2Fg%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22VER_3%22%3E%20%20%3Cg%20id%3D%22SYMBOL_VER_2%22%3E%20%20%3C%2Fg%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22off_2%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_5%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1_3_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1_2_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1_1_%22%3E%20%20%3Cg%20id%3D%22_x31_-3%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_14_%22%3E%20%20%20%3Cpath%20fill%3D%22%232D374B%22%20d%3D%22M291.134%2C237.469l35.654-60.5l96.103%2C149.684l0.046%2C28.727l-0.313-197.672%20%20%20%20c-0.228-4.832-2.794-9.252-6.887-11.859L242.715%2C46.324c-4.045-1.99-9.18-1.967-13.22%2C0.063c-0.546%2C0.272-1.06%2C0.57-1.548%2C0.895%20%20%20%20l-0.604%2C0.379L59.399%2C144.983l-0.651%2C0.296c-0.838%2C0.385-1.686%2C0.875-2.48%2C1.444c-3.185%2C2.283-5.299%2C5.66-5.983%2C9.448%20%20%20%20c-0.103%2C0.574-0.179%2C1.158-0.214%2C1.749l0.264%2C161.083l89.515-138.745c11.271-18.397%2C35.825-24.323%2C58.62-24.001l26.753%2C0.706%20%20%20%20L67.588%2C409.765l18.582%2C10.697L245.692%2C157.22l70.51-0.256L157.091%2C426.849l66.306%2C38.138l7.922%2C4.556%20%20%20%20c3.351%2C1.362%2C7.302%2C1.431%2C10.681%2C0.21l175.453-101.678l-33.544%2C19.438L291.134%2C237.469z%20M304.736%2C433.395l-66.969-105.108%20%20%20%20l40.881-69.371l87.952%2C138.628L304.736%2C433.395z%22%2F%3E%20%20%20%3Cpolygon%20fill%3D%22%2328A0F0%22%20points%3D%22237.768%2C328.286%20304.736%2C433.395%20366.601%2C397.543%20278.648%2C258.915%20%20%20%20%22%2F%3E%20%20%20%3Cpath%20fill%3D%22%2328A0F0%22%20d%3D%22M422.937%2C355.379l-0.046-28.727l-96.103-149.684l-35.654%2C60.5l92.774%2C150.043l33.544-19.438%20%20%20%20c3.29-2.673%2C5.281-6.594%2C5.49-10.825L422.937%2C355.379z%22%2F%3E%20%20%20%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M20.219%2C382.469l47.369%2C27.296l157.634-252.801l-26.753-0.706c-22.795-0.322-47.35%2C5.604-58.62%2C24.001%20%20%20%20L50.334%2C319.004l-30.115%2C46.271V382.469z%22%2F%3E%20%20%20%3Cpolygon%20fill%3D%22%23FFFFFF%22%20points%3D%22316.202%2C156.964%20245.692%2C157.22%2086.17%2C420.462%20141.928%2C452.565%20157.091%2C426.849%20%20%20%20%22%2F%3E%20%20%20%3Cpath%20fill%3D%22%2396BEDC%22%20d%3D%22M452.65%2C156.601c-0.59-14.746-8.574-28.245-21.08-36.104L256.28%2C19.692%20%20%20%20c-12.371-6.229-27.825-6.237-40.218-0.004c-1.465%2C0.739-170.465%2C98.752-170.465%2C98.752c-2.339%2C1.122-4.592%2C2.458-6.711%2C3.975%20%20%20%20c-11.164%2C8.001-17.969%2C20.435-18.668%2C34.095v208.765l30.115-46.271L50.07%2C157.921c0.035-0.589%2C0.109-1.169%2C0.214-1.741%20%20%20%20c0.681-3.79%2C2.797-7.171%2C5.983-9.456c0.795-0.569%2C172.682-100.064%2C173.228-100.337c4.04-2.029%2C9.175-2.053%2C13.22-0.063%20%20%20%20l173.022%2C99.523c4.093%2C2.607%2C6.659%2C7.027%2C6.887%2C11.859v199.542c-0.209%2C4.231-1.882%2C8.152-5.172%2C10.825l-33.544%2C19.438%20%20%20%20l-17.308%2C10.031l-61.864%2C35.852l-62.737%2C36.357c-3.379%2C1.221-7.33%2C1.152-10.681-0.21l-74.228-42.693l-15.163%2C25.717%20%20%20%20l66.706%2C38.406c2.206%2C1.255%2C4.171%2C2.367%2C5.784%2C3.272c2.497%2C1.4%2C4.199%2C2.337%2C4.8%2C2.629c4.741%2C2.303%2C11.563%2C3.643%2C17.71%2C3.643%20%20%20%20c5.636%2C0%2C11.132-1.035%2C16.332-3.072l182.225-105.531c10.459-8.104%2C16.612-20.325%2C17.166-33.564V156.601z%22%2F%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_13_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_6_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_4_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22One_color_version_-_White_3_%22%3E%20%20%20%3Cg%20id%3D%22Symbol_-_Original_15_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22One_color_version_-_White%22%3E%20%20%20%3Cg%20id%3D%22Symbol_-_Original%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Monochromatic_3_%22%3E%20%20%20%3Cg%20id%3D%22_x33__7_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Monochromatic%22%3E%20%20%20%3Cg%20id%3D%22_x33__3_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22_x33__2_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22_x33__1_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22_x33_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_10_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_1_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_2_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22_x34__1_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Monochromatic_2_%22%3E%20%20%20%3Cg%20id%3D%22_x33__6_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22One_color_version_-_White_2_%22%3E%20%20%20%3Cg%20id%3D%22Symbol_-_Original_11_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22Symbol_-_Original_5_%22%3E%20%20%20%3Cg%20id%3D%22Symbol_-_Original_12_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22One_color_version_-_White_1_%22%3E%20%20%20%3Cg%20id%3D%22Symbol_-_Original_9_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1_2_%22%3E%20%20%3Cg%20id%3D%22SYMBOL_VER_2_4_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22SYMBOL_VER_2-1-1_1_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22SYMBOL_VER_2-2-1_1_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22SYMBOL_VER_2-3-1_4_%22%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22New_Symbol_1_%22%3E%20%20%20%3Cg%20id%3D%22SYMBOL_VER_2-3-1_3_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%20%3Cg%20id%3D%22New_Symbol%22%3E%20%20%20%3Cg%20id%3D%22SYMBOL_VER_2-3-1_1_%22%3E%20%20%20%3C%2Fg%3E%20%20%3C%2Fg%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_2_2_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_4_2_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_3_2_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_3_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1-1_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1-1%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1-1_2_2_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1-1_2%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_1-1-1_2_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22Symbol_-_Original_7_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22Symbol_-_Original_8_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_2-1-1%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_2-2-1%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_2-3-1%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_5-1_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_5-1%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_5-2_1_%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22SYMBOL_VER_5-2%22%3E%20%3C%2Fg%3E%20%3Cg%20id%3D%22Symbol_-_Monochromatic_1_%22%3E%20%20%3Cg%20id%3D%22_x33__4_%22%3E%20%20%3C%2Fg%3E%20%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E' + +var optimismLogoUrl = + 'data:image/svg+xml,%3Csvg%20width%3D%22170%22%20height%3D%22168%22%20viewBox%3D%220%200%20170%20168%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url%28%23clip0%29%22%3E%3Cpath%20opacity%3D%220.6%22%20d%3D%22M85.05%20168C132.022%20168%20170.1%20130.105%20170.1%2083.3593C170.1%2036.6135%200%2036.6135%200%2083.3593C0%20130.105%2038.0782%20168%2085.05%20168Z%22%20fill%3D%22%23FF505F%22%2F%3E%3Cpath%20opacity%3D%220.6%22%20d%3D%22M85.05%20168C132.022%20168%20170.1%20130.105%20170.1%2083.3593C170.1%2036.6135%200%2036.6135%200%2083.3593C0%20130.105%2038.0782%20168%2085.05%20168Z%22%20fill%3D%22%23FF0320%22%2F%3E%3Cpath%20d%3D%22M85.05%200C132.022%200%20170.1%2037.8949%20170.1%2084.6407C170.1%20131.386%200%20131.386%200%2084.6407C0%2037.8949%2038.0782%200%2085.05%200Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M144.665%2064.0394L112.444%2012.3742L89.0263%2078.9477L144.665%2064.0394Z%22%20fill%3D%22%23FF4E65%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M143.777%2064.215L112.444%2012.3742L165.349%2058.4347L143.777%2064.215Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M144.551%2063.613L142.479%20124.467L88.912%2078.5213L144.551%2063.613Z%22%20fill%3D%22%23D0001A%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M143.663%2063.7886L142.479%20124.467L165.235%2058.0083L143.663%2063.7886Z%22%20fill%3D%22%23FF697B%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0%22%3E%3Crect%20width%3D%22170%22%20height%3D%22168%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E' + +var polygonMaticLogo = + 'data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20viewBox%3D%220%200%2038.4%2033.5%22%20style%3D%22enable-background%3Anew%200%200%2038.4%2033.5%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%20.st0%7Bfill%3A%238247E5%3B%7D%3C%2Fstyle%3E%3Cg%3E%20%3Cpath%20class%3D%22st0%22%20d%3D%22M29%2C10.2c-0.7-0.4-1.6-0.4-2.4%2C0L21%2C13.5l-3.8%2C2.1l-5.5%2C3.3c-0.7%2C0.4-1.6%2C0.4-2.4%2C0L5%2C16.3%20%20c-0.7-0.4-1.2-1.2-1.2-2.1v-5c0-0.8%2C0.4-1.6%2C1.2-2.1l4.3-2.5c0.7-0.4%2C1.6-0.4%2C2.4%2C0L16%2C7.2c0.7%2C0.4%2C1.2%2C1.2%2C1.2%2C2.1v3.3l3.8-2.2V7%20%20c0-0.8-0.4-1.6-1.2-2.1l-8-4.7c-0.7-0.4-1.6-0.4-2.4%2C0L1.2%2C5C0.4%2C5.4%2C0%2C6.2%2C0%2C7v9.4c0%2C0.8%2C0.4%2C1.6%2C1.2%2C2.1l8.1%2C4.7%20%20c0.7%2C0.4%2C1.6%2C0.4%2C2.4%2C0l5.5-3.2l3.8-2.2l5.5-3.2c0.7-0.4%2C1.6-0.4%2C2.4%2C0l4.3%2C2.5c0.7%2C0.4%2C1.2%2C1.2%2C1.2%2C2.1v5c0%2C0.8-0.4%2C1.6-1.2%2C2.1%20%20L29%2C28.8c-0.7%2C0.4-1.6%2C0.4-2.4%2C0l-4.3-2.5c-0.7-0.4-1.2-1.2-1.2-2.1V21l-3.8%2C2.2v3.3c0%2C0.8%2C0.4%2C1.6%2C1.2%2C2.1l8.1%2C4.7%20%20c0.7%2C0.4%2C1.6%2C0.4%2C2.4%2C0l8.1-4.7c0.7-0.4%2C1.2-1.2%2C1.2-2.1V17c0-0.8-0.4-1.6-1.2-2.1L29%2C10.2z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E' + +var UNI_LIST = 'https://tokens.uniswap.org' +var AAVE_LIST = 'tokenlist.aave.eth' +var BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json' +var CMC_ALL_LIST = 'https://api.coinmarketcap.com/data-api/v3/uniswap/all.json' +var COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json' +var COMPOUND_LIST = 'https://raw.githubusercontent.com/compound-finance/token-list/master/compound.tokenlist.json' +var GEMINI_LIST = 'https://www.gemini.com/uniswap/manifest.json' +var ARBITRUM_LIST = 'https://bridge.arbitrum.io/token-list-42161.json' +var KLEROS_LIST = 't2crtokens.eth' +var OPTIMISM_LIST = 'https://static.optimism.io/optimism.tokenlist.json' +var ROLL_LIST = 'https://app.tryroll.com/tokens.json' +var SET_LIST = 'https://raw.githubusercontent.com/SetProtocol/uniswap-tokenlist/main/set.tokenlist.json' +var WRAPPED_LIST = 'wrapped.tokensoft.eth' +var UNSUPPORTED_LIST_URLS = [BA_LIST] +// this is the default list of lists that are exposed to users +// lower index == higher priority for token import +var DEFAULT_LIST_OF_LISTS_TO_DISPLAY = [ + UNI_LIST, + COMPOUND_LIST, + AAVE_LIST, + CMC_ALL_LIST, + COINGECKO_LIST, + KLEROS_LIST, + GEMINI_LIST, + WRAPPED_LIST, + SET_LIST, + ROLL_LIST, + ARBITRUM_LIST, + OPTIMISM_LIST, +] +var DEFAULT_LIST_OF_LISTS = __spreadArray( + __spreadArray([], __read(DEFAULT_LIST_OF_LISTS_TO_DISPLAY), false), + __read(UNSUPPORTED_LIST_URLS), + false +) +// default lists to be 'active' aka searched across +var DEFAULT_ACTIVE_LIST_URLS = [UNI_LIST, GEMINI_LIST] + +var _a$c, _b$3 +var INFURA_KEY = process.env.REACT_APP_INFURA_KEY +if (typeof INFURA_KEY === 'undefined') { + throw new Error('REACT_APP_INFURA_KEY must be a defined environment variable') +} +/** + * These are the network URLs used by the interface when there is not another available source of chain data + */ +var INFURA_NETWORK_URLS = + ((_a$c = {}), + (_a$c[SupportedChainId.MAINNET] = 'https://mainnet.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.RINKEBY] = 'https://rinkeby.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.ROPSTEN] = 'https://ropsten.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.GOERLI] = 'https://goerli.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.KOVAN] = 'https://kovan.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.OPTIMISM] = 'https://optimism-mainnet.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.OPTIMISTIC_KOVAN] = 'https://optimism-kovan.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.ARBITRUM_ONE] = 'https://arbitrum-mainnet.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.ARBITRUM_RINKEBY] = 'https://arbitrum-rinkeby.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.POLYGON] = 'https://polygon-mainnet.infura.io/v3/' + INFURA_KEY), + (_a$c[SupportedChainId.POLYGON_MUMBAI] = 'https://polygon-mumbai.infura.io/v3/' + INFURA_KEY), + _a$c) +var NetworkType +;(function (NetworkType) { + NetworkType[(NetworkType['L1'] = 0)] = 'L1' + NetworkType[(NetworkType['L2'] = 1)] = 'L2' +})(NetworkType || (NetworkType = {})) +var CHAIN_INFO = + ((_b$3 = {}), + (_b$3[SupportedChainId.MAINNET] = { + networkType: NetworkType.L1, + docs: 'https://docs.uniswap.org/', + explorer: 'https://etherscan.io/', + infoLink: 'https://info.uniswap.org/#/', + label: 'Ethereum', + logoUrl: EthereumLogo, + addNetworkInfo: { + nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, + rpcUrl: INFURA_NETWORK_URLS[SupportedChainId.MAINNET], + }, + }), + (_b$3[SupportedChainId.RINKEBY] = { + networkType: NetworkType.L1, + docs: 'https://docs.uniswap.org/', + explorer: 'https://rinkeby.etherscan.io/', + infoLink: 'https://info.uniswap.org/#/', + label: 'Rinkeby', + logoUrl: EthereumLogo, + addNetworkInfo: { + nativeCurrency: { name: 'Rinkeby Ether', symbol: 'rETH', decimals: 18 }, + rpcUrl: INFURA_NETWORK_URLS[SupportedChainId.RINKEBY], + }, + }), + (_b$3[SupportedChainId.ROPSTEN] = { + networkType: NetworkType.L1, + docs: 'https://docs.uniswap.org/', + explorer: 'https://ropsten.etherscan.io/', + infoLink: 'https://info.uniswap.org/#/', + label: 'Ropsten', + logoUrl: EthereumLogo, + addNetworkInfo: { + nativeCurrency: { name: 'Ropsten Ether', symbol: 'ropETH', decimals: 18 }, + rpcUrl: INFURA_NETWORK_URLS[SupportedChainId.ROPSTEN], + }, + }), + (_b$3[SupportedChainId.KOVAN] = { + networkType: NetworkType.L1, + docs: 'https://docs.uniswap.org/', + explorer: 'https://kovan.etherscan.io/', + infoLink: 'https://info.uniswap.org/#/', + label: 'Kovan', + logoUrl: EthereumLogo, + addNetworkInfo: { + nativeCurrency: { name: 'Kovan Ether', symbol: 'kovETH', decimals: 18 }, + rpcUrl: INFURA_NETWORK_URLS[SupportedChainId.KOVAN], + }, + }), + (_b$3[SupportedChainId.GOERLI] = { + networkType: NetworkType.L1, + docs: 'https://docs.uniswap.org/', + explorer: 'https://goerli.etherscan.io/', + infoLink: 'https://info.uniswap.org/#/', + label: 'Görli', + logoUrl: EthereumLogo, + addNetworkInfo: { + nativeCurrency: { name: 'Görli Ether', symbol: 'görETH', decimals: 18 }, + rpcUrl: INFURA_NETWORK_URLS[SupportedChainId.GOERLI], + }, + }), + (_b$3[SupportedChainId.OPTIMISM] = { + networkType: NetworkType.L2, + blockWaitMsBeforeWarning: ms(templateObject_1$1m || (templateObject_1$1m = __makeTemplateObject(['25m'], ['25m']))), + bridge: 'https://gateway.optimism.io/?chainId=1', + defaultListUrl: OPTIMISM_LIST, + docs: 'https://optimism.io/', + explorer: 'https://optimistic.etherscan.io/', + infoLink: 'https://info.uniswap.org/#/optimism/', + label: 'Optimism', + logoUrl: optimismLogoUrl, + statusPage: 'https://optimism.io/status', + helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ', + addNetworkInfo: { + nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, + rpcUrl: 'https://mainnet.optimism.io', + }, + }), + (_b$3[SupportedChainId.OPTIMISTIC_KOVAN] = { + networkType: NetworkType.L2, + blockWaitMsBeforeWarning: ms(templateObject_2$10 || (templateObject_2$10 = __makeTemplateObject(['25m'], ['25m']))), + bridge: 'https://gateway.optimism.io/', + defaultListUrl: OPTIMISM_LIST, + docs: 'https://optimism.io/', + explorer: 'https://optimistic.etherscan.io/', + infoLink: 'https://info.uniswap.org/#/optimism/', + label: 'Optimistic Kovan', + logoUrl: optimismLogoUrl, + statusPage: 'https://optimism.io/status', + helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ', + addNetworkInfo: { + nativeCurrency: { name: 'Optimistic Kovan Ether', symbol: 'kovOpETH', decimals: 18 }, + rpcUrl: 'https://kovan.optimism.io', + }, + }), + (_b$3[SupportedChainId.ARBITRUM_ONE] = { + networkType: NetworkType.L2, + blockWaitMsBeforeWarning: ms(templateObject_3$T || (templateObject_3$T = __makeTemplateObject(['10m'], ['10m']))), + bridge: 'https://bridge.arbitrum.io/', + docs: 'https://offchainlabs.com/', + explorer: 'https://arbiscan.io/', + infoLink: 'https://info.uniswap.org/#/arbitrum', + label: 'Arbitrum', + logoUrl: arbitrumLogoUrl, + defaultListUrl: ARBITRUM_LIST, + helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum', + addNetworkInfo: { + nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, + rpcUrl: 'https://arb1.arbitrum.io/rpc', + }, + }), + (_b$3[SupportedChainId.ARBITRUM_RINKEBY] = { + networkType: NetworkType.L2, + blockWaitMsBeforeWarning: ms(templateObject_4$H || (templateObject_4$H = __makeTemplateObject(['10m'], ['10m']))), + bridge: 'https://bridge.arbitrum.io/', + docs: 'https://offchainlabs.com/', + explorer: 'https://rinkeby-explorer.arbitrum.io/', + infoLink: 'https://info.uniswap.org/#/arbitrum/', + label: 'Arbitrum Rinkeby', + logoUrl: arbitrumLogoUrl, + defaultListUrl: ARBITRUM_LIST, + helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum', + addNetworkInfo: { + nativeCurrency: { name: 'Rinkeby Arbitrum Ether', symbol: 'rinkArbETH', decimals: 18 }, + rpcUrl: 'https://rinkeby.arbitrum.io/rpc', + }, + }), + (_b$3[SupportedChainId.POLYGON] = { + networkType: NetworkType.L1, + blockWaitMsBeforeWarning: ms(templateObject_5$y || (templateObject_5$y = __makeTemplateObject(['10m'], ['10m']))), + bridge: 'https://wallet.polygon.technology/bridge', + docs: 'https://polygon.io/', + explorer: 'https://polygonscan.com/', + infoLink: 'https://info.uniswap.org/#/polygon/', + label: 'Polygon', + logoUrl: polygonMaticLogo, + addNetworkInfo: { + rpcUrl: 'https://polygon-rpc.com/', + nativeCurrency: { name: 'Polygon Matic', symbol: 'MATIC', decimals: 18 }, + }, + }), + (_b$3[SupportedChainId.POLYGON_MUMBAI] = { + networkType: NetworkType.L1, + blockWaitMsBeforeWarning: ms(templateObject_6$p || (templateObject_6$p = __makeTemplateObject(['10m'], ['10m']))), + bridge: 'https://wallet.polygon.technology/bridge', + docs: 'https://polygon.io/', + explorer: 'https://mumbai.polygonscan.com/', + infoLink: 'https://info.uniswap.org/#/polygon/', + label: 'Polygon Mumbai', + logoUrl: polygonMaticLogo, + addNetworkInfo: { + nativeCurrency: { name: 'Polygon Mumbai Matic', symbol: 'mMATIC', decimals: 18 }, + rpcUrl: 'https://rpc-endpoints.superfluid.dev/mumbai', + }, + }), + _b$3) +var templateObject_1$1m, + templateObject_2$10, + templateObject_3$T, + templateObject_4$H, + templateObject_5$y, + templateObject_6$p + +function useNativeCurrency() { + var chainId = useActiveWeb3React().chainId + return useMemo( + function () { + return chainId + ? nativeOnChain(chainId) + : // display mainnet when not connected + nativeOnChain(SupportedChainId.MAINNET) + }, + [chainId] + ) +} + +var EMPTY_CONNECTOR = initializeConnector(function () { + return EMPTY +}) +atomWithDefault(function () { + return EMPTY_CONNECTOR +}) +atomWithDefault(function () { + return EMPTY_CONNECTOR +}) + +var REGISTRAR_ABI = [ + { + constant: true, + inputs: [ + { + name: 'node', + type: 'bytes32', + }, + ], + name: 'resolver', + outputs: [ + { + name: 'resolverAddress', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, +] +var REGISTRAR_ADDRESS = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' +var RESOLVER_ABI = [ + { + constant: true, + inputs: [ + { + internalType: 'bytes32', + name: 'node', + type: 'bytes32', + }, + ], + name: 'contenthash', + outputs: [ + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, +] +// cache the resolver contracts since most of them are the public resolver +function resolverContract(resolverAddress, provider) { + return new Contract(resolverAddress, RESOLVER_ABI, provider) +} +/** + * Fetches and decodes the result of an ENS contenthash lookup on mainnet to a URI + * @param ensName to resolve + * @param provider provider to use to fetch the data + */ +function resolveENSContentHash(ensName, provider) { + return __awaiter(this, void 0, void 0, function () { + var ensRegistrarContract, hash, resolverAddress + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + ensRegistrarContract = new Contract(REGISTRAR_ADDRESS, REGISTRAR_ABI, provider) + hash = namehash(ensName) + return [4 /*yield*/, ensRegistrarContract.resolver(hash)] + case 1: + resolverAddress = _a.sent() + return [2 /*return*/, resolverContract(resolverAddress, provider).contenthash(hash)] + } + }) + }) +} + +function hexToUint8Array(hex) { + hex = hex.startsWith('0x') ? hex.substr(2) : hex + if (hex.length % 2 !== 0) throw new Error('hex must have length that is multiple of 2') + var arr = new Uint8Array(hex.length / 2) + for (var i = 0; i < arr.length; i++) { + arr[i] = parseInt(hex.substr(i * 2, 2), 16) + } + return arr +} +var UTF_8_DECODER = new TextDecoder('utf-8') +/** + * Returns the URI representation of the content hash for supported codecs + * @param contenthash to decode + */ +function contenthashToUri(contenthash) { + var data = hexToUint8Array(contenthash) + var codec = getNameFromData(data) + switch (codec) { + case 'ipfs-ns': { + var unprefixedData = rmPrefix(data) + var cid = new CID(unprefixedData) + return 'ipfs://' + toB58String(cid.multihash) + } + case 'ipns-ns': { + var unprefixedData = rmPrefix(data) + var cid = new CID(unprefixedData) + var multihash = decode(cid.multihash) + if (multihash.name === 'identity') { + return 'ipns://' + UTF_8_DECODER.decode(multihash.digest).trim() + } else { + return 'ipns://' + toB58String(cid.multihash) + } + } + default: + throw new Error('Unrecognized codec: ' + codec) + } +} + +var ENS_NAME_REGEX$1 = /^(([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\.)+)eth(\/.*)?$/ +function parseENSAddress(ensAddress) { + var match = ensAddress.match(ENS_NAME_REGEX$1) + if (!match) return undefined + return { ensName: match[1].toLowerCase() + 'eth', ensPath: match[4] } +} + +/** + * Given a URI that may be ipfs, ipns, http, https, ar, or data protocol, return the fetch-able http(s) URLs for the same content + * @param uri to convert to fetch-able http url + */ +function uriToHttp(uri) { + var _a, _b, _c + var protocol = uri.split(':')[0].toLowerCase() + switch (protocol) { + case 'data': + return [uri] + case 'https': + return [uri] + case 'http': + return ['https' + uri.substr(4), uri] + case 'ipfs': + var hash = (_a = uri.match(/^ipfs:(\/\/)?(.*)$/i)) === null || _a === void 0 ? void 0 : _a[2] + return ['https://cloudflare-ipfs.com/ipfs/' + hash + '/', 'https://ipfs.io/ipfs/' + hash + '/'] + case 'ipns': + var name_1 = (_b = uri.match(/^ipns:(\/\/)?(.*)$/i)) === null || _b === void 0 ? void 0 : _b[2] + return ['https://cloudflare-ipfs.com/ipns/' + name_1 + '/', 'https://ipfs.io/ipns/' + name_1 + '/'] + case 'ar': + var tx = (_c = uri.match(/^ar:(\/\/)?(.*)$/i)) === null || _c === void 0 ? void 0 : _c[2] + return ['https://arweave.net/' + tx] + default: + return [] + } +} + +var ValidationSchema +;(function (ValidationSchema) { + ValidationSchema['LIST'] = 'list' + ValidationSchema['TOKENS'] = 'tokens' +})(ValidationSchema || (ValidationSchema = {})) +var validator = new Promise(function (resolve) { + return __awaiter(void 0, void 0, void 0, function () { + var _a, ajv, schema, validator + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + return [ + 4 /*yield*/, + Promise.all([ + import('ajv'), + Promise.resolve().then(function () { + return tokenlist_schema$1 + }), + ]), + ] + case 1: + ;(_a = __read.apply(void 0, [_b.sent(), 2])), (ajv = _a[0]), (schema = _a[1]) + validator = new ajv.default({ allErrors: true }) + .addSchema(schema, ValidationSchema.LIST) + // Adds a meta scheme of Pick + .addSchema( + __assign(__assign({}, schema), { $id: schema.$id + '#tokens', required: ['tokens'] }), + ValidationSchema.TOKENS + ) + resolve(validator) + return [2 /*return*/] + } + }) + }) +}) +function getValidationErrors(validate) { + var _a, _b + return (_b = + (_a = validate === null || validate === void 0 ? void 0 : validate.errors) === null || _a === void 0 + ? void 0 + : _a + .map(function (error) { + return [error.dataPath, error.message].filter(Boolean).join(' ') + }) + .join('; ')) !== null && _b !== void 0 + ? _b + : 'unknown error' +} +/** + * Validates a token list. + * @param json the TokenList to validate + */ +function validateTokenList(json) { + return __awaiter(this, void 0, void 0, function () { + var validate + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, validator] + case 1: + validate = _a.sent().getSchema(ValidationSchema.LIST) + if (validate === null || validate === void 0 ? void 0 : validate(json)) { + return [2 /*return*/, json] + } + throw new Error('Token list failed validation: ' + getValidationErrors(validate)) + } + }) + }) +} + +var listCache = new Map() +/** Fetches and validates a token list. */ +function fetchTokenList$1(listUrl, resolveENSContentHash) { + var _a + return __awaiter(this, void 0, void 0, function () { + var cached, + urls, + parsedENS, + contentHashUri, + error_1, + message, + translatedUri, + message, + i, + url, + isLast, + response, + error_2, + message, + message, + json, + list + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + cached = listCache === null || listCache === void 0 ? void 0 : listCache.get(listUrl) // avoid spurious re-fetches + if (cached) { + return [2 /*return*/, cached] + } + parsedENS = parseENSAddress(listUrl) + if (!parsedENS) return [3 /*break*/, 5] + contentHashUri = void 0 + _b.label = 1 + case 1: + _b.trys.push([1, 3, , 4]) + return [4 /*yield*/, resolveENSContentHash(parsedENS.ensName)] + case 2: + contentHashUri = _b.sent() + return [3 /*break*/, 4] + case 3: + error_1 = _b.sent() + message = 'failed to resolve ENS name: ' + parsedENS.ensName + console.debug(message, error_1) + throw new Error(message) + case 4: + translatedUri = void 0 + try { + translatedUri = contenthashToUri(contentHashUri) + } catch (error) { + message = 'failed to translate contenthash to URI: ' + contentHashUri + console.debug(message, error) + throw new Error(message) + } + urls = uriToHttp('' + translatedUri + ((_a = parsedENS.ensPath) !== null && _a !== void 0 ? _a : '')) + return [3 /*break*/, 6] + case 5: + urls = uriToHttp(listUrl) + _b.label = 6 + case 6: + i = 0 + _b.label = 7 + case 7: + if (!(i < urls.length)) return [3 /*break*/, 15] + url = urls[i] + isLast = i === urls.length - 1 + response = void 0 + _b.label = 8 + case 8: + _b.trys.push([8, 10, , 11]) + return [4 /*yield*/, fetch(url, { credentials: 'omit' })] + case 9: + response = _b.sent() + return [3 /*break*/, 11] + case 10: + error_2 = _b.sent() + message = 'failed to fetch list: ' + listUrl + console.debug(message, error_2) + if (isLast) throw new Error(message) + return [3 /*break*/, 14] + case 11: + if (!response.ok) { + message = 'failed to fetch list: ' + listUrl + console.debug(message, response.statusText) + if (isLast) throw new Error(message) + return [3 /*break*/, 14] + } + return [4 /*yield*/, response.json()] + case 12: + json = _b.sent() + return [4 /*yield*/, validateTokenList(json)] + case 13: + list = _b.sent() + listCache === null || listCache === void 0 ? void 0 : listCache.set(listUrl, list) + return [2 /*return*/, list] + case 14: + i++ + return [3 /*break*/, 7] + case 15: + throw new Error('Unrecognized list URL protocol.') + } + }) + }) +} + +/** + * Returns a map of the given addresses to their eventually consistent ETH balances. + */ +function useNativeCurrencyBalances(uncheckedAddresses) { + var chainId = useActiveWeb3React().chainId + var multicallContract = useInterfaceMulticall() + var validAddressInputs = useMemo( + function () { + return uncheckedAddresses + ? uncheckedAddresses + .map(isAddress) + .filter(function (a) { + return a !== false + }) + .sort() + .map(function (addr) { + return [addr] + }) + : [] + }, + [uncheckedAddresses] + ) + var results = useSingleContractMultipleData(multicallContract, 'getEthBalance', validAddressInputs) + return useMemo( + function () { + return validAddressInputs.reduce(function (memo, _a, i) { + var _b, _c + var _d = __read(_a, 1), + address = _d[0] + var value = + (_c = + (_b = results === null || results === void 0 ? void 0 : results[i]) === null || _b === void 0 + ? void 0 + : _b.result) === null || _c === void 0 + ? void 0 + : _c[0] + if (value && chainId) + memo[address] = CurrencyAmount.fromRawAmount(nativeOnChain(chainId), JSBI.BigInt(value.toString())) + return memo + }, {}) + }, + [validAddressInputs, chainId, results] + ) +} +var ERC20Interface = new Interface(ERC20ABI) +var tokenBalancesGasRequirement = { gasRequired: 125000 } +/** + * Returns a map of token addresses to their eventually consistent token balances for a single account. + */ +function useTokenBalancesWithLoadingIndicator(address, tokens) { + var validatedTokens = useMemo( + function () { + var _a + return (_a = + tokens === null || tokens === void 0 + ? void 0 + : tokens.filter(function (t) { + return isAddress(t === null || t === void 0 ? void 0 : t.address) !== false + })) !== null && _a !== void 0 + ? _a + : [] + }, + [tokens] + ) + var validatedTokenAddresses = useMemo( + function () { + return validatedTokens.map(function (vt) { + return vt.address + }) + }, + [validatedTokens] + ) + var balances = useMultipleContractSingleData( + validatedTokenAddresses, + ERC20Interface, + 'balanceOf', + useMemo( + function () { + return [address] + }, + [address] + ), + tokenBalancesGasRequirement + ) + var anyLoading = useMemo( + function () { + return balances.some(function (callState) { + return callState.loading + }) + }, + [balances] + ) + return useMemo( + function () { + return [ + address && validatedTokens.length > 0 + ? validatedTokens.reduce(function (memo, token, i) { + var _a, _b + var value = + (_b = + (_a = balances === null || balances === void 0 ? void 0 : balances[i]) === null || _a === void 0 + ? void 0 + : _a.result) === null || _b === void 0 + ? void 0 + : _b[0] + var amount = value ? JSBI.BigInt(value.toString()) : undefined + if (amount) { + memo[token.address] = CurrencyAmount.fromRawAmount(token, amount) + } + return memo + }, {}) + : {}, + anyLoading, + ] + }, + [address, validatedTokens, anyLoading, balances] + ) +} +function useTokenBalances(address, tokens) { + return useTokenBalancesWithLoadingIndicator(address, tokens)[0] +} +// get the balance for a single token/account combo +function useTokenBalance(account, token) { + var tokenBalances = useTokenBalances( + account, + useMemo( + function () { + return [token] + }, + [token] + ) + ) + if (!token) return undefined + return tokenBalances[token.address] +} +function useCurrencyBalances(account, currencies) { + var tokens = useMemo( + function () { + var _a + return (_a = + currencies === null || currencies === void 0 + ? void 0 + : currencies.filter(function (currency) { + var _a + return (_a = currency === null || currency === void 0 ? void 0 : currency.isToken) !== null && + _a !== void 0 + ? _a + : false + })) !== null && _a !== void 0 + ? _a + : [] + }, + [currencies] + ) + var tokenBalances = useTokenBalances(account, tokens) + var containsETH = useMemo( + function () { + var _a + return (_a = + currencies === null || currencies === void 0 + ? void 0 + : currencies.some(function (currency) { + return currency === null || currency === void 0 ? void 0 : currency.isNative + })) !== null && _a !== void 0 + ? _a + : false + }, + [currencies] + ) + var ethBalance = useNativeCurrencyBalances( + useMemo( + function () { + return containsETH ? [account] : [] + }, + [containsETH, account] + ) + ) + return useMemo( + function () { + var _a + return (_a = + currencies === null || currencies === void 0 + ? void 0 + : currencies.map(function (currency) { + if (!account || !currency) return undefined + if (currency.isToken) return tokenBalances[currency.address] + if (currency.isNative) return ethBalance[account] + return undefined + })) !== null && _a !== void 0 + ? _a + : [] + }, + [account, currencies, ethBalance, tokenBalances] + ) +} +function useCurrencyBalance(account, currency) { + return useCurrencyBalances( + account, + useMemo( + function () { + return [currency] + }, + [currency] + ) + )[0] +} + +var alwaysTrue = function () { + return true +} +/** Creates a filter function that filters tokens that do not match the query. */ +function getTokenFilter(query) { + var searchingAddress = isAddress(query) + if (searchingAddress) { + var address_1 = searchingAddress.toLowerCase() + return function (t) { + return 'address' in t && address_1 === t.address.toLowerCase() + } + } + var queryParts = query + .toLowerCase() + .split(/\s+/) + .filter(function (s) { + return s.length > 0 + }) + if (queryParts.length === 0) return alwaysTrue + var match = function (s) { + var parts = s + .toLowerCase() + .split(/\s+/) + .filter(function (s) { + return s.length > 0 + }) + return queryParts.every(function (p) { + return ( + p.length === 0 || + parts.some(function (sp) { + return sp.startsWith(p) || sp.endsWith(p) + }) + ) + }) + } + return function (_a) { + var name = _a.name, + symbol = _a.symbol + return Boolean((symbol && match(symbol)) || (name && match(name))) + } +} + +/** Sorts currency amounts (descending). */ +function balanceComparator(a, b) { + if (a && b) { + return a.greaterThan(b) ? -1 : a.equalTo(b) ? 0 : 1 + } else if (a === null || a === void 0 ? void 0 : a.greaterThan('0')) { + return -1 + } else if (b === null || b === void 0 ? void 0 : b.greaterThan('0')) { + return 1 + } + return 0 +} +/** Sorts tokens by currency amount (descending), then symbol (ascending). */ +function tokenComparator(balances, a, b) { + // Sorts by balances + var balanceComparison = balanceComparator(balances[a.address], balances[b.address]) + if (balanceComparison !== 0) return balanceComparison + // Sorts by symbol + if (a.symbol && b.symbol) { + return a.symbol.toLowerCase() < b.symbol.toLowerCase() ? -1 : 1 + } + return -1 +} +/** Sorts tokens by query, giving precedence to exact matches and partial matches. */ +function useSortTokensByQuery(query, tokens) { + return useMemo( + function () { + if (!tokens) { + return [] + } + var matches = query + .toLowerCase() + .split(/\s+/) + .filter(function (s) { + return s.length > 0 + }) + if (matches.length > 1) { + return tokens + } + var exactMatches = [] + var symbolSubtrings = [] + var rest = [] + // sort tokens by exact match -> subtring on symbol match -> rest + tokens.map(function (token) { + var _a, _b + if (((_a = token.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === matches[0]) { + return exactMatches.push(token) + } else if ( + (_b = token.symbol) === null || _b === void 0 + ? void 0 + : _b.toLowerCase().startsWith(query.toLowerCase().trim()) + ) { + return symbolSubtrings.push(token) + } else { + return rest.push(token) + } + }) + return __spreadArray( + __spreadArray(__spreadArray([], __read(exactMatches), false), __read(symbolSubtrings), false), + __read(rest), + false + ) + }, + [tokens, query] + ) +} + +/** + * Token instances created from token info on a token list. + */ +var WrappedTokenInfo = /** @class */ (function () { + function WrappedTokenInfo(tokenInfo, list) { + this.isNative = false + this.isToken = true + this._checksummedAddress = null + this._tags = null + this.tokenInfo = tokenInfo + this.list = list + } + Object.defineProperty(WrappedTokenInfo.prototype, 'address', { + get() { + if (this._checksummedAddress) return this._checksummedAddress + var checksummedAddress = isAddress(this.tokenInfo.address) + if (!checksummedAddress) throw new Error('Invalid token address: ' + this.tokenInfo.address) + return (this._checksummedAddress = checksummedAddress) + }, + enumerable: false, + configurable: true, + }) + Object.defineProperty(WrappedTokenInfo.prototype, 'chainId', { + get() { + return this.tokenInfo.chainId + }, + enumerable: false, + configurable: true, + }) + Object.defineProperty(WrappedTokenInfo.prototype, 'decimals', { + get() { + return this.tokenInfo.decimals + }, + enumerable: false, + configurable: true, + }) + Object.defineProperty(WrappedTokenInfo.prototype, 'name', { + get() { + return this.tokenInfo.name + }, + enumerable: false, + configurable: true, + }) + Object.defineProperty(WrappedTokenInfo.prototype, 'symbol', { + get() { + return this.tokenInfo.symbol + }, + enumerable: false, + configurable: true, + }) + Object.defineProperty(WrappedTokenInfo.prototype, 'logoURI', { + get() { + return this.tokenInfo.logoURI + }, + enumerable: false, + configurable: true, + }) + Object.defineProperty(WrappedTokenInfo.prototype, 'tags', { + get() { + var _a + if (this._tags !== null) return this._tags + if (!this.tokenInfo.tags) return (this._tags = []) + var listTags = (_a = this.list) === null || _a === void 0 ? void 0 : _a.tags + if (!listTags) return (this._tags = []) + return (this._tags = this.tokenInfo.tags.map(function (tagId) { + return __assign(__assign({}, listTags[tagId]), { id: tagId }) + })) + }, + enumerable: false, + configurable: true, + }) + WrappedTokenInfo.prototype.equals = function (other) { + return other.chainId === this.chainId && other.isToken && other.address.toLowerCase() === this.address.toLowerCase() + } + WrappedTokenInfo.prototype.sortsBefore = function (other) { + if (this.equals(other)) throw new Error('Addresses should not be equal') + return this.address.toLowerCase() < other.address.toLowerCase() + } + Object.defineProperty(WrappedTokenInfo.prototype, 'wrapped', { + get() { + return this + }, + enumerable: false, + configurable: true, + }) + return WrappedTokenInfo +})() + +var mapCache = typeof WeakMap !== 'undefined' ? new WeakMap() : null +function tokensToChainTokenMap(tokens) { + var cached = mapCache === null || mapCache === void 0 ? void 0 : mapCache.get(tokens) + if (cached) return cached + var _a = __read(Array.isArray(tokens) ? [undefined, tokens] : [tokens, tokens.tokens], 2), + list = _a[0], + infos = _a[1] + var map = infos.reduce(function (map, info) { + var _a + var token = new WrappedTokenInfo(info, list) + if (((_a = map[token.chainId]) === null || _a === void 0 ? void 0 : _a[token.address]) !== undefined) { + console.warn('Duplicate token skipped: ' + token.address) + return map + } + if (!map[token.chainId]) { + map[token.chainId] = {} + } + map[token.chainId][token.address] = { token, list } + return map + }, {}) + mapCache === null || mapCache === void 0 ? void 0 : mapCache.set(tokens, map) + return map +} + +atom({}) + +// parse a name or symbol from a token response +var BYTES32_REGEX = /^0x[a-fA-F0-9]{64}$/ +function parseStringOrBytes32(str, bytes32, defaultValue) { + return str && str.length > 0 + ? str + : // need to check for proper bytes string and valid terminator + bytes32 && BYTES32_REGEX.test(bytes32) && arrayify(bytes32)[31] === 0 + ? parseBytes32String(bytes32) + : defaultValue +} +/** + * Returns a Token from the tokenAddress. + * Returns null if token is loading or null was passed. + * Returns undefined if tokenAddress is invalid or token does not exist. + */ +function useTokenFromMap(tokens, tokenAddress) { + var chainId = useActiveWeb3React().chainId + var address = isAddress(tokenAddress) + var tokenContract = useTokenContract(address ? address : undefined, false) + var tokenContractBytes32 = useBytes32TokenContract(address ? address : undefined, false) + var token = address ? tokens[address] : undefined + var tokenName = useSingleCallResult(token ? undefined : tokenContract, 'name', undefined, NEVER_RELOAD) + var tokenNameBytes32 = useSingleCallResult(token ? undefined : tokenContractBytes32, 'name', undefined, NEVER_RELOAD) + var symbol = useSingleCallResult(token ? undefined : tokenContract, 'symbol', undefined, NEVER_RELOAD) + var symbolBytes32 = useSingleCallResult(token ? undefined : tokenContractBytes32, 'symbol', undefined, NEVER_RELOAD) + var decimals = useSingleCallResult(token ? undefined : tokenContract, 'decimals', undefined, NEVER_RELOAD) + return useMemo( + function () { + var _a, _b, _c, _d + if (token) return token + if (tokenAddress === null) return null + if (!chainId || !address) return undefined + if (decimals.loading || symbol.loading || tokenName.loading) return null + if (decimals.result) { + return new Token( + chainId, + address, + decimals.result[0], + parseStringOrBytes32( + (_a = symbol.result) === null || _a === void 0 ? void 0 : _a[0], + (_b = symbolBytes32.result) === null || _b === void 0 ? void 0 : _b[0], + 'UNKNOWN' + ), + parseStringOrBytes32( + (_c = tokenName.result) === null || _c === void 0 ? void 0 : _c[0], + (_d = tokenNameBytes32.result) === null || _d === void 0 ? void 0 : _d[0], + 'Unknown Token' + ) + ) + } + return undefined + }, + [ + address, + chainId, + decimals.loading, + decimals.result, + symbol.loading, + symbol.result, + symbolBytes32.result, + token, + tokenAddress, + tokenName.loading, + tokenName.result, + tokenNameBytes32.result, + ] + ) +} +/** + * Returns a Currency from the currencyId. + * Returns null if currency is loading or null was passed. + * Returns undefined if currencyId is invalid or token does not exist. + */ +function useCurrencyFromMap(tokens, currencyId) { + var _a + var nativeCurrency = useNativeCurrency() + var isNative = Boolean( + nativeCurrency && (currencyId === null || currencyId === void 0 ? void 0 : currencyId.toUpperCase()) === 'ETH' + ) + var token = useTokenFromMap(tokens, isNative ? undefined : currencyId) + if (currencyId === null || currencyId === undefined) return currencyId + // this case so we use our builtin wrapped token instead of wrapped tokens on token lists + var wrappedNative = nativeCurrency === null || nativeCurrency === void 0 ? void 0 : nativeCurrency.wrapped + if ( + ((_a = wrappedNative === null || wrappedNative === void 0 ? void 0 : wrappedNative.address) === null || + _a === void 0 + ? void 0 + : _a.toUpperCase()) === (currencyId === null || currencyId === void 0 ? void 0 : currencyId.toUpperCase()) + ) + return wrappedNative + return isNative ? nativeCurrency : token +} + +var DEFAULT_LIST_PRIORITIES = DEFAULT_LIST_OF_LISTS.reduce(function (memo, listUrl, index) { + memo[listUrl] = index + 1 + return memo +}, {}) +// use ordering of default list of lists to assign priority +function sortByListPriority(urlA, urlB) { + if (DEFAULT_LIST_PRIORITIES[urlA] && DEFAULT_LIST_PRIORITIES[urlB]) { + return DEFAULT_LIST_PRIORITIES[urlA] - DEFAULT_LIST_PRIORITIES[urlB] + } + return 0 +} + +var name$1 = 'Broken Token List' +var timestamp$1 = '2021-01-05T20:47:02.923Z' +var version$1 = { + major: 1, + minor: 0, + patch: 0, +} +var tags$1 = {} +var logoURI$1 = 'ipfs://QmNa8mQkrNKp1WEEeGjFezDmDeodkWRevGFN8JCV7b4Xir' +var keywords$1 = ['uniswap', 'broken'] +var tokens$1 = [ + { + name: 'UNI HODL', + address: '0x4bf5dc91E2555449293D7824028Eb8Fe5879B689', + symbol: 'UniH', + decimals: 18, + chainId: 1, + logoURI: '', + }, +] +var BROKEN_LIST = { + name: name$1, + timestamp: timestamp$1, + version: version$1, + tags: tags$1, + logoURI: logoURI$1, + keywords: keywords$1, + tokens: tokens$1, +} + +var name = 'Unsupported Tokens' +var timestamp = '2021-01-05T20:47:02.923Z' +var version = { + major: 1, + minor: 0, + patch: 0, +} +var tags = {} +var logoURI = 'ipfs://QmNa8mQkrNKp1WEEeGjFezDmDeodkWRevGFN8JCV7b4Xir' +var keywords = ['uniswap', 'unsupported'] +var tokens = [ + { + name: 'Gold Tether', + address: '0x4922a015c4407F87432B179bb209e125432E4a2A', + symbol: 'XAUt', + decimals: 6, + chainId: 1, + logoURI: + 'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x4922a015c4407F87432B179bb209e125432E4a2A/logo.png', + }, + { + name: 'Grump Cat', + address: '0x93B2FfF814FCaEFFB01406e80B4Ecd89Ca6A021b', + symbol: 'GRUMPY', + decimals: 9, + chainId: 1, + logoURI: + 'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x4922a015c4407F87432B179bb209e125432E4a2A/logo.png', + }, + { + name: 'apeUSD-UMA Synthetic USD (Dec 2021)', + address: '0xfA5e27893aee4805283D86e4283Da64F8c72dd56', + symbol: 'apeUSD-UMA-DEC21', + decimals: 18, + chainId: 1, + logoURI: '', + }, + { + chainId: 1, + address: '0xc6b11850241c5127eab73af4b6c68bc267cbbff4', + name: 'oWETHp Put 360 DEC2520', + symbol: 'oWETH-360P-12/25/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oYFIp Put 25000 OCT0220', + address: '0x452b421be5b30f0c6ad8c3f03c06bdaab4f5c56c', + symbol: 'oYFI-25000P-10/02/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oWETHp Put 360 OCT3020', + address: '0x0578779e746d7186253a36cf651ea786acfcf087', + symbol: 'oWETH-360P-10/30/20', + decimals: 7, + }, + { + chainId: 1, + name: 'ETHc Call 500 OCT3020', + address: '0xf9aba2e43fb19184408ea3b572a0fd672946f87b', + symbol: 'oETH-500C-10/30/20', + decimals: 6, + }, + { + chainId: 1, + name: 'oBALp Put 22 OCT0220', + address: '0xdb0991dfc7e828b5a2837dc82d68e16490562c8d', + symbol: 'oBAL-22P-10/02/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oCOMPp Put 150 SEP2520', + address: '0xe951ebe6b4420ab3f4844cf36dedd263d095b416', + symbol: 'oCOMP-150P-09/25/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oCRVp Put 3 SEP252020', + address: '0x9215bd49b59748419eac6bad9dbe247df06ebdb9', + symbol: 'oCRV-3P-09/25/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oETHp Put 180 SEP2520', + address: '0xE3A2c34Fa2F59ffa95C4ACd1E5663633d45Bc3AD', + symbol: 'oETH-180P-09/25/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oETHc Call 400 SEP2520', + address: '0x05977EBC26825C0CD6097E0Ad7204721516711Eb', + symbol: 'oETH-400C-09/25/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oWETHp Put 380 SEP1820', + address: '0x31f88266301b08631f9f0e33fd5c43c2a5d1e5b2', + symbol: 'oWETH-380P-09/18/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oYFIp Put 8500 SEP1820', + address: '0xd1cec2f67fdc4c60e0963515dfc3343f31e32e47', + symbol: 'oYFI-8500P-09/18/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oWETHp Put 370 SEP1120', + address: '0x15844029b2c2bf24506e9937739a9a912f1e4354', + symbol: 'oWETH-370P-09/11/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oWETHp Put 400 SEP0420', + address: '0x5562c33c383f6386be4f6dcdbd35a3a99bbcfde6', + symbol: 'oWETH-400P-09/04/20', + decimals: 7, + }, + { + chainId: 1, + name: 'oETHp Put 200 AUG2820', + address: '0x3CBFC1397deF0602c2d211c70A1c0c38CEDB5448', + symbol: 'oWETH-400P-09/04/20', + decimals: 7, + }, + { + chainId: 1, + name: 'Opyn cDai Insurance', + symbol: 'ocDai', + address: '0x98cc3bd6af1880fcfda17ac477b2f612980e5e33', + decimals: 8, + }, + { + chainId: 1, + name: 'Opyn cUSDC Insurance', + symbol: 'ocUSDC', + address: '0x8ED9f862363fFdFD3a07546e618214b6D59F03d4', + decimals: 8, + }, + { + chainId: 1, + address: '0x176C674Ee533C6139B0dc8b458D72A93dCB3e705', + symbol: 'iAAVE', + name: 'Synth Inverse Aave', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iAAVE.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x8A8079c7149B8A1611e5C5d978DCA3bE16545F83', + symbol: 'iADA', + name: 'Synth Inverse Cardano', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iADA.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xAFD870F32CE54EfdBF677466B612bf8ad164454B', + symbol: 'iBNB', + name: 'Synth Inverse Binance Coin', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iBNB.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xD6014EA05BDe904448B743833dDF07c3C7837481', + symbol: 'iBTC', + name: 'Synth Inverse Bitcoin', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iBTC.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x336213e1DDFC69f4701Fc3F86F4ef4A160c1159d', + symbol: 'iCEX', + name: 'Synth Inverse Centralised Exchange Index', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iCEX.svg', + tags: ['index', 'inverse', 'synth'], + }, + { + chainId: 1, + address: '0x6345728B1ccE16E6f8C509950b5c84FFF88530d9', + symbol: 'iCOMP', + name: 'Synth Inverse Compound', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iCOMP.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xCB98f42221b2C251A4E74A1609722eE09f0cc08E', + symbol: 'iDASH', + name: 'Synth Inverse Dash', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iDASH.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x14d10003807AC60d07BB0ba82cAeaC8d2087c157', + symbol: 'iDEFI', + name: 'Synth Inverse DeFi Index', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iDEFI.svg', + tags: ['index', 'inverse', 'synth'], + }, + { + chainId: 1, + address: '0x46a97629C9C1F58De6EC18C7F536e7E6d6A6ecDe', + symbol: 'iDOT', + name: 'Synth Inverse Polkadot', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iDOT.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xF4EebDD0704021eF2a6Bbe993fdf93030Cd784b4', + symbol: 'iEOS', + name: 'Synth Inverse EOS', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iEOS.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xd50c1746D835d2770dDA3703B69187bFfeB14126', + symbol: 'iETC', + name: 'Synth Inverse Ethereum Classic', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iETC.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xA9859874e1743A32409f75bB11549892138BBA1E', + symbol: 'iETH', + name: 'Synth Inverse Ether', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iETH.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x2d7aC061fc3db53c39fe1607fB8cec1B2C162B01', + symbol: 'iLINK', + name: 'Synth Inverse Chainlink', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iLINK.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x79da1431150C9b82D2E5dfc1C68B33216846851e', + symbol: 'iLTC', + name: 'Synth Inverse Litecoin', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iLTC.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xA5a5DF41883Cdc00c4cCC6E8097130535399d9a3', + symbol: 'iOIL', + name: 'Synth Inverse Perpetual Oil Futures', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iOIL.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x0fEd38108bdb8e62ef7b5680E8E0726E2F29e0De', + symbol: 'iREN', + name: 'Synth Inverse Ren', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iREN.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xC5807183a9661A533CB08CbC297594a0B864dc12', + symbol: 'iTRX', + name: 'Synth Inverse TRON', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iTRX.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x36A00FF9072570eF4B9292117850B8FE08d96cce', + symbol: 'iUNI', + name: 'Synth Inverse Uniswap', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iUNI.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x4AdF728E2Df4945082cDD6053869f51278fae196', + symbol: 'iXMR', + name: 'Synth Inverse Monero', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iXMR.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x27269b3e45A4D3E79A3D6BFeE0C8fB13d0D711A6', + symbol: 'iXRP', + name: 'Synth Inverse Ripple', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iXRP.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x8deef89058090ac5655A99EEB451a4f9183D1678', + symbol: 'iXTZ', + name: 'Synth Inverse Tezos', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iXTZ.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0x592244301CeA952d6daB2fdC1fE6bd9E53917306', + symbol: 'iYFI', + name: 'Synth Inverse yearn.finance', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/iYFI.svg', + tags: ['inverse', 'synth'], + }, + { + chainId: 1, + address: '0xcD39b5434a0A92cf47D1F567a7dF84bE356814F0', + symbol: 's1INCH', + name: 'Synth 1inch', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/s1INCH.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x7537AAe01f3B218DAE75e10d952473823F961B87', + symbol: 'sAAPL', + name: 'Synth Apple', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sAAPL.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xd2dF355C19471c8bd7D8A3aa27Ff4e26A21b4076', + symbol: 'sAAVE', + name: 'Synth Aave', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sAAVE.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xe36E2D3c7c34281FA3bC737950a68571736880A1', + symbol: 'sADA', + name: 'Synth Cardano', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sADA.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x9CF7E61853ea30A41b02169391b393B901eac457', + symbol: 'sAMZN', + name: 'Synth Amazon', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sAMZN.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xF48e200EAF9906362BB1442fca31e0835773b8B4', + symbol: 'sAUD', + name: 'Synth Australian Dollars', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sAUD.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x617aeCB6137B5108D1E7D4918e3725C8cEbdB848', + symbol: 'sBNB', + name: 'Synth Binance Coin', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sBNB.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6', + symbol: 'sBTC', + name: 'Synth Bitcoin', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sBTC.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xeABACD844A196D7Faf3CE596edeBF9900341B420', + symbol: 'sCEX', + name: 'Synth Centralised Exchange Index', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sCEX.svg', + tags: ['index', 'synth'], + }, + { + chainId: 1, + address: '0x0F83287FF768D1c1e17a42F44d644D7F22e8ee1d', + symbol: 'sCHF', + name: 'Synth Swiss Franc', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sCHF.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x9EeF4CA7aB9fa8bc0650127341C2d3F707a40f8A', + symbol: 'sCOIN', + name: 'Synth Coinbase', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sCOIN.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xEb029507d3e043DD6C87F2917C4E82B902c35618', + symbol: 'sCOMP', + name: 'Synth Compound', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sCOMP.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xD38aEb759891882e78E957c80656572503D8c1B1', + symbol: 'sCRV', + name: 'Synth Curve DAO Token', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sCRV.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xfE33ae95A9f0DA8A845aF33516EDc240DCD711d6', + symbol: 'sDASH', + name: 'Synth Dash', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sDASH.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xe1aFe1Fd76Fd88f78cBf599ea1846231B8bA3B6B', + symbol: 'sDEFI', + name: 'Synth DeFi Index', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sDEFI.svg', + tags: ['index', 'synth'], + }, + { + chainId: 1, + address: '0x1715AC0743102BF5Cd58EfBB6Cf2dC2685d967b6', + symbol: 'sDOT', + name: 'Synth Polkadot', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sDOT.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x88C8Cf3A212c0369698D13FE98Fcb76620389841', + symbol: 'sEOS', + name: 'Synth EOS', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sEOS.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x22602469d704BfFb0936c7A7cfcD18f7aA269375', + symbol: 'sETC', + name: 'Synth Ethereum Classic', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sETC.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb', + symbol: 'sETH', + name: 'Synth Ether', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sETH.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xD71eCFF9342A5Ced620049e616c5035F1dB98620', + symbol: 'sEUR', + name: 'Synth Euros', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sEUR.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xf50B5e535F62a56A9BD2d8e2434204E726c027Fa', + symbol: 'sFB', + name: 'Synth Facebook', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sFB.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x23348160D7f5aca21195dF2b70f28Fce2B0be9fC', + symbol: 'sFTSE', + name: 'Synth FTSE 100 Index', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sFTSE.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x97fe22E7341a0Cd8Db6F6C021A24Dc8f4DAD855F', + symbol: 'sGBP', + name: 'Synth Pound Sterling', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sGBP.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xC63B8ECCE56aB9C46184eC6aB85e4771fEa4c8AD', + symbol: 'sGOOG', + name: 'Synth Alphabet', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sGOOG.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xF6b1C627e95BFc3c1b4c9B825a032Ff0fBf3e07d', + symbol: 'sJPY', + name: 'Synth Japanese Yen', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sJPY.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x269895a3dF4D73b077Fc823dD6dA1B95f72Aaf9B', + symbol: 'sKRW', + name: 'Synth South Korean Won', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sKRW.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xbBC455cb4F1B9e4bFC4B73970d360c8f032EfEE6', + symbol: 'sLINK', + name: 'Synth Chainlink', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sLINK.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xC14103C2141E842e228FBaC594579e798616ce7A', + symbol: 'sLTC', + name: 'Synth Litecoin', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sLTC.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x745a824D6aBBD236AA794b5530062778A6Ad7523', + symbol: 'sMSFT', + name: 'Synth Microsoft', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sMSFT.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x5A7E3c07604EB515C16b36cd51906a65f021F609', + symbol: 'sNFLX', + name: 'Synth Netflix', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sNFLX.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x757de3ac6B830a931eF178C6634c5C551773155c', + symbol: 'sNIKKEI', + name: 'Synth Nikkei 225 Index', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sNIKKEI.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x6d16cF3EC5F763d4d99cB0B0b110eefD93B11B56', + symbol: 'sOIL', + name: 'Synth Perpetual Oil Futures', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sOIL.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xD31533E8d0f3DF62060e94B3F1318137bB6E3525', + symbol: 'sREN', + name: 'Synth Ren', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sREN.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x0352557B007A4Aae1511C114409b932F06F9E2f4', + symbol: 'sRUNE', + name: 'Synth THORChain', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sRUNE.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xf2E08356588EC5cd9E437552Da87C0076b4970B0', + symbol: 'sTRX', + name: 'Synth TRON', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sTRX.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x918dA91Ccbc32B7a6A0cc4eCd5987bbab6E31e6D', + symbol: 'sTSLA', + name: 'Synth Tesla', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sTSLA.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x30635297E450b930f8693297eBa160D9e6c8eBcf', + symbol: 'sUNI', + name: 'Synth Uniswap', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sUNI.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x6A22e5e94388464181578Aa7A6B869e00fE27846', + symbol: 'sXAG', + name: 'Synth Silver Ounce', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sXAG.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x261EfCdD24CeA98652B9700800a13DfBca4103fF', + symbol: 'sXAU', + name: 'Synth Gold Ounce', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sXAU.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x5299d6F7472DCc137D7f3C4BcfBBB514BaBF341A', + symbol: 'sXMR', + name: 'Synth Monero', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sXMR.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0xa2B0fDe6D710e201d0d608e924A484d1A5fEd57c', + symbol: 'sXRP', + name: 'Synth Ripple', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sXRP.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x2e59005c5c0f0a4D77CcA82653d48b46322EE5Cd', + symbol: 'sXTZ', + name: 'Synth Tezos', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sXTZ.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x992058B7DB08F9734d84485bfbC243C4ee6954A7', + symbol: 'sYFI', + name: 'Synth yearn.finance', + decimals: 18, + logoURI: 'https://raw.githubusercontent.com/Synthetixio/synthetix-assets/v2.0.10/synths/sYFI.svg', + tags: ['synth'], + }, + { + chainId: 1, + address: '0x81ab848898b5ffD3354dbbEfb333D5D183eEDcB5', + name: 'yUSD Synthetic Expiring 1 September 2020', + symbol: 'yUSDSEP20', + decimals: 18, + }, + { + chainId: 1, + address: '0xB2FdD60AD80ca7bA89B9BAb3b5336c2601C020b4', + name: 'yUSD Synthetic Expiring 1 October 2020', + symbol: 'yUSDOCT20', + decimals: 18, + }, + { + chainId: 1, + address: '0x208d174775dc39fe18b1b374972f77ddec6c0f73', + name: 'uUSDrBTC Synthetic Expiring 1 Oct 2020', + symbol: 'uUSDrBTC-OCT', + decimals: 18, + }, + { + chainId: 1, + address: '0xf06ddacf71e2992e2122a1a0168c6967afdf63ce', + name: 'uUSDrBTC Synthetic Expiring 31 Dec 2020', + symbol: 'uUSDrBTC-DEC', + decimals: 18, + }, + { + chainId: 1, + address: '0xd16c79c8a39d44b2f3eb45d2019cd6a42b03e2a9', + name: 'uUSDwETH Synthetic Expiring 31 Dec 2020', + symbol: 'uUSDwETH-DEC', + decimals: 18, + }, + { + chainId: 1, + address: '0x3d995510f8d82c2ea341845932b5ddde0bead9a3', + name: 'uGAS-JAN21 Token Expiring 31 Jan 2021', + symbol: 'uGAS-JAN21', + decimals: 18, + }, + { + chainId: 1, + address: '0x90f802c7e8fb5d40b0de583e34c065a3bd2020d8', + name: 'YD-ETH-MAR21 Token Expiring 31 Mar 2021', + symbol: 'YD-ETH-MAR21', + decimals: 18, + }, + { + chainId: 1, + address: '0x002f0b1a71c5730cf2f4da1970a889207bdb6d0d', + name: 'YD-BTC-MAR21 Token Expiring 31 Mar 2021', + symbol: 'YD-BTC-MAR21', + decimals: 18, + }, + { + chainId: 1, + address: '0x1062ad0e59fa67fa0b27369113098cc941dd0d5f', + name: 'UMA 35 Call Expirying 30 Apr 2021', + symbol: 'UMAc35-0421', + decimals: 18, + }, + { + chainId: 1, + address: '0xf93340b1a3adf7eedcaec25fae8171d4b736e89f', + name: 'pxUSD Synthetic USD Expiring 1 April 2021', + symbol: 'pxUSD_MAR2021', + decimals: 18, + }, + { + chainId: 1, + address: '0x84bd083b1c8bf929f39c98bc17cf518f40154f58', + name: 'Mario Cash Synthetic Token Expiring 15 January 2021', + symbol: 'Mario Cash-JAN-2021', + decimals: 18, + }, + { + chainId: 1, + address: '0x81fab276aec924fbde190cf379783526d413cf70', + name: 'uGAS-FEB21 Token Expiring 28 Feb 2021', + symbol: 'uGAS-FEB21', + decimals: 18, + }, + { + chainId: 1, + address: '0x4e110603e70b0b5f1c403ee543b37e1f1244cf28', + name: 'uGAS-MAR21 Token Expiring 31 Mar 2021', + symbol: 'uGAS-MAR21', + decimals: 18, + }, + { + chainId: 1, + address: '0xcf55a7f92d5e0c6683debbc1fc20c0a6e056df13', + name: 'Zelda Elastic Cash', + symbol: 'Zelda Elastic Cash', + decimals: 18, + }, + { + chainId: 1, + address: '0x654eebac62240e6c56bab5f6adf7cfa74a894510', + name: 'Zelda Spring Nuts Cash', + symbol: 'Zelda Spring Nuts Cash', + decimals: 18, + }, + { + chainId: 1, + address: '0xa48920cc1ad85d8ea13af5d7be180c0338c306dd', + name: 'Zelda Summer Nuts Cash', + symbol: 'Zelda Summer Nuts Cash', + decimals: 18, + }, + { + chainId: 1, + address: '0x249a198d59b57fda5dda90630febc86fd8c7594c', + name: 'Zelda Whirlwind Cash', + symbol: 'Zelda Whirlwind Cash', + decimals: 18, + }, + { + chainId: 1, + address: '0x5ed1406873c9eb91f6f9a67ac4e152387c1132e7', + name: 'Zelda Reinforced Cash', + symbol: 'Zelda Reinforced Cash', + decimals: 18, + }, + { + chainId: 1, + address: '0x8104c9f13118320eefe5fbea8a44d600b85981ef', + name: 'Mini Mario Summer Cash', + symbol: 'Mini Mario Summer Cash', + decimals: 18, + }, + { + chainId: 1, + address: '0x69746c719e59674b147df25f50e7cfa0673cb625', + name: 'Mini Mario Spring Cash', + symbol: 'Mini Mario Spring Cash', + decimals: 18, + }, + { + chainId: 1, + address: '0x6b1257641d18791141f025eab36fb567c4b564ff', + name: 'Bitcoin Dominance Token 31 March 2021', + symbol: 'BTCDOM-MAR2021', + decimals: 18, + }, + { + chainId: 1, + address: '0x4e83b6287588a96321b2661c5e041845ff7814af', + name: 'Altcoin Dominance Token 31 March 2021', + symbol: 'ALTDOM-MAR2021', + decimals: 18, + }, + { + chainId: 1, + address: '0x59fec83ec709c893aedd1a144cf1828eb04127cd', + name: 'pxGOLD Synthetic GOLD Expiring 31 May 2021', + symbol: 'pxGOLD_MAY2021', + decimals: 18, + }, + { + chainId: 1, + address: '0x89337BFb7938804c3776C9FB921EccAf5ab76758', + name: 'Compound Annualized Rate Future Expiring 28 March 2021', + symbol: 'CAR-USDC-MAR21', + decimals: 18, + }, + { + chainId: 1, + address: '0xec58d3aefc9aaa2e0036fa65f70d569f49d9d1ed', + name: 'uSTONKS Index Token April 2021', + symbol: 'uSTONKS_APR21', + decimals: 6, + }, + { + chainId: 1, + address: '0xa6B9d7E3d76cF23549293Fb22c488E0Ea591A44e', + name: 'uGAS-JUN21 Token Expiring 30 Jun 2021', + symbol: 'uGAS-JUN21', + decimals: 18, + }, + { + chainId: 1, + address: '0xe813b65da6c38a04591aed3f082d32db7d53c382', + name: 'Yield Dollar [WETH Dec 2021]', + symbol: 'YD-ETH-DEC21', + decimals: 18, + }, + { + chainId: 1, + address: '0x4b606e9eb2228c70f44453afe5a73e1fea258ce1', + name: 'pxUSD Synthetic USD Expiring 31 Mar 2022', + symbol: 'pxUSD_MAR2022', + decimals: 18, + }, + { + chainId: 1, + address: '0x5247c0db4044fb6f97f32c7e1b48758019a5a912', + name: 'pxGOLD Synthetic Gold Expiring 31 Mar 2022', + symbol: 'pxGOLD_MAR2022', + decimals: 18, + }, + { + chainId: 1, + address: '0x56fb1acaff95c0b6ebcd17c8361a63d98b1a5a11', + name: 'uForex CNYUSD Synthetic Token April 2021', + symbol: 'uCNYUSD-APR', + decimals: 6, + }, + { + chainId: 1, + address: '0xd49fa405dce086c65d66ca1ca41f8e98583812b4', + name: 'uForex EURUSD Synthetic Token April 2021', + symbol: 'uEURUSD-APR', + decimals: 6, + }, + { + chainId: 1, + address: '0x29dddacba3b231ee8d673dd0f0fa759ea145561b', + name: 'DEFI_PULSE_TOTAL_TVL Synthetic Token Expiring 15 April 2021', + symbol: 'TVL_ALL_APRIL15', + decimals: 6, + }, + { + chainId: 1, + address: '0xcbe430927370e95b4b10cfc702c6017ec7abefc3', + name: 'Yield Dollar [WETH Jun 2021]', + symbol: 'YD-ETH-JUN21', + decimals: 18, + }, + { + chainId: 1, + address: '0x4b7fb448df91c8ed973494f8c8c4f12daf3a8521', + name: 'Yield Dollar [renBTC Jun 2021]', + symbol: 'YD-BTC-JUN21', + decimals: 8, + }, + { + chainId: 1, + address: '0x3108c33b6fb38efedaefd8b5f7ca01d5f5c7372d', + name: 'Yield Dollar UMA 21', + symbol: 'yUMA21', + decimals: 18, + }, + { + chainId: 1, + address: '0x0cae9e4d663793c2a2A0b211c1Cf4bBca2B9cAa7', + name: 'Mirrored Amazon', + symbol: 'MAMZN', + decimals: 18, + }, + { + chainId: 1, + address: '0x31c63146a635EB7465e5853020b39713AC356991', + name: 'M US Oil', + symbol: 'MUSO', + decimals: 18, + }, + { + chainId: 1, + address: '0x59A921Db27Dd6d4d974745B7FfC5c33932653442', + name: 'M Google', + symbol: 'MGOOGL', + decimals: 18, + }, + { + chainId: 1, + address: '0xf72FCd9DCF0190923Fadd44811E240Ef4533fc86', + name: 'Mirrored ProShares', + symbol: 'MVIXY', + decimals: 18, + }, + { + chainId: 1, + address: '0x56aA298a19C93c6801FDde870fA63EF75Cc0aF72', + name: 'Mirrored Alibaba', + symbol: 'MBABA', + decimals: 18, + }, + { + chainId: 1, + address: '0x0e99cC0535BB6251F6679Fa6E65d6d3b430e840B', + name: 'Mirrored Facebook', + symbol: 'MFB', + decimals: 18, + }, + { + chainId: 1, + address: '0x13B02c8dE71680e71F0820c996E4bE43c2F57d15', + name: 'Mirrored Invesco QQ', + symbol: 'MQQQ', + decimals: 18, + }, + { + chainId: 1, + address: '0x41BbEDd7286dAab5910a1f15d12CBda839852BD7', + name: 'Mirrored Microsoft', + symbol: 'MMSFT', + decimals: 18, + }, + { + chainId: 1, + address: '0x9d1555d8cB3C846Bb4f7D5B1B1080872c3166676', + name: 'Mirrored iShares Si', + symbol: 'MSLV', + decimals: 18, + }, + { + chainId: 1, + address: '0x21cA39943E91d704678F5D00b6616650F066fD63', + name: 'Mirrored Tesla', + symbol: 'MTSLA', + decimals: 18, + }, + { + chainId: 1, + address: '0xe82bbB62fA81d0701643d1675FB50ec52fD3Df92', + name: 'DYDX Token', + symbol: 'DYDX', + decimals: 18, + }, + { + chainId: 10, + address: '0xE405de8F52ba7559f9df3C368500B6E6ae6Cee49', + name: 'sETH', + symbol: 'Synth Ether', + decimals: 18, + }, + { + chainId: 10, + address: '0x298B9B95708152ff6968aafd889c6586e9169f1D', + name: 'sBTC', + symbol: 'Synth Bitcoin', + decimals: 18, + }, + { + chainId: 10, + address: '0xc5Db22719A06418028A40A9B5E9A7c02959D0d08', + name: 'sLINK', + symbol: 'Synth Link', + decimals: 18, + }, + { + chainId: 1, + address: '0x6B60eE11b73230045cF9095E6e43AE9Ea638e172', + name: 'Shatner', + symbol: 'SHAT', + decimals: 18, + }, + { + chainId: 1, + address: '0x7277a44D1325D81Ac58893002a1B40a41bea43fe', + name: 'FAANG Index', + symbol: 'FAANG', + decimals: 18, + }, + { + chainId: 1, + address: '0x76175599887730786bdA1545D0D7AcE8737fEBB1', + name: 'ENS DAO', + symbol: 'ENS', + decimals: 18, + }, + { + chainId: 1, + address: '0xa82AA729AE2F0d78e961D66db53949e27a9E866d', + name: 'BMEX', + symbol: 'BMEX', + decimals: 18, + }, +] +var UNSUPPORTED_TOKEN_LIST = { + name, + timestamp, + version, + tags, + logoURI, + keywords, + tokens, +} + +function useAllLists() { + return useAppSelector(function (state) { + return state.lists.byUrl + }) +} +/** + * Combine the tokens in map2 with the tokens on map1, where tokens on map1 take precedence + * @param map1 the base token map + * @param map2 the map of additioanl tokens to add to the base map + */ +function combineMaps(map1, map2) { + var chainIds = Object.keys( + Object.keys(map1) + .concat(Object.keys(map2)) + .reduce(function (memo, value) { + memo[value] = true + return memo + }, {}) + ).map(function (id) { + return parseInt(id) + }) + return chainIds.reduce(function (memo, chainId) { + memo[chainId] = __assign(__assign({}, map2[chainId]), map1[chainId]) + return memo + }, {}) +} +// merge tokens contained within lists from urls +function useCombinedTokenMapFromUrls(urls) { + var lists = useAllLists() + return useMemo( + function () { + if (!urls) return {} + return ( + urls + .slice() + // sort by priority so top priority goes last + .sort(sortByListPriority) + .reduce(function (allTokens, currentUrl) { + var _a + var current = (_a = lists[currentUrl]) === null || _a === void 0 ? void 0 : _a.current + if (!current) return allTokens + try { + return combineMaps(allTokens, tokensToChainTokenMap(current)) + } catch (error) { + console.error('Could not show token list due to error', error) + return allTokens + } + }, {}) + ) + }, + [lists, urls] + ) +} +// filter out unsupported lists +function useActiveListUrls() { + var activeListUrls = useAppSelector(function (state) { + return state.lists.activeListUrls + }) + return useMemo( + function () { + return activeListUrls === null || activeListUrls === void 0 + ? void 0 + : activeListUrls.filter(function (url) { + return !UNSUPPORTED_LIST_URLS.includes(url) + }) + }, + [activeListUrls] + ) +} +function useInactiveListUrls() { + var lists = useAllLists() + var allActiveListUrls = useActiveListUrls() + return useMemo( + function () { + return Object.keys(lists).filter(function (url) { + return ( + !(allActiveListUrls === null || allActiveListUrls === void 0 ? void 0 : allActiveListUrls.includes(url)) && + !UNSUPPORTED_LIST_URLS.includes(url) + ) + }) + }, + [lists, allActiveListUrls] + ) +} +// get all the tokens from active lists, combine with local default tokens +function useCombinedActiveList() { + var activeListUrls = useActiveListUrls() + var activeTokens = useCombinedTokenMapFromUrls(activeListUrls) + return activeTokens +} +// list of tokens not supported on interface for various reasons, used to show warnings and prevent swaps and adds +function useUnsupportedTokenList() { + // get hard-coded broken tokens + var brokenListMap = useMemo(function () { + return tokensToChainTokenMap(BROKEN_LIST) + }, []) + // get hard-coded list of unsupported tokens + var localUnsupportedListMap = useMemo(function () { + return tokensToChainTokenMap(UNSUPPORTED_TOKEN_LIST) + }, []) + // get dynamic list of unsupported tokens + var loadedUnsupportedListMap = useCombinedTokenMapFromUrls(UNSUPPORTED_LIST_URLS) + // format into one token address map + return useMemo( + function () { + return combineMaps(brokenListMap, combineMaps(localUnsupportedListMap, loadedUnsupportedListMap)) + }, + [brokenListMap, localUnsupportedListMap, loadedUnsupportedListMap] + ) +} +function useIsListActive(url) { + var activeListUrls = useActiveListUrls() + return Boolean(activeListUrls === null || activeListUrls === void 0 ? void 0 : activeListUrls.includes(url)) +} + +// reduce token map into standard address <-> Token mapping, optionally include user added tokens +function useTokensFromMap(tokenMap, includeUserAdded) { + var chainId = useActiveWeb3React().chainId + var userAddedTokens = useUserAddedTokens() + return useMemo( + function () { + var _a + if (!chainId) return {} + // reduce to just tokens + var mapWithoutUrls = Object.keys((_a = tokenMap[chainId]) !== null && _a !== void 0 ? _a : {}).reduce(function ( + newMap, + address + ) { + newMap[address] = tokenMap[chainId][address].token + return newMap + }, + {}) + if (includeUserAdded) { + return ( + userAddedTokens + // reduce into all ALL_TOKENS filtered by the current chain + .reduce(function (tokenMap, token) { + tokenMap[token.address] = token + return tokenMap + }, __assign({}, mapWithoutUrls)) + ) + } + return mapWithoutUrls + }, + [chainId, userAddedTokens, tokenMap, includeUserAdded] + ) +} +function useAllTokens() { + var allTokens = useCombinedActiveList() + return useTokensFromMap(allTokens, true) +} +function useUnsupportedTokens() { + var chainId = useActiveWeb3React().chainId + var listsByUrl = useAllLists() + var unsupportedTokensMap = useUnsupportedTokenList() + var unsupportedTokens = useTokensFromMap(unsupportedTokensMap, false) + // checks the default L2 lists to see if `bridgeInfo` has an L1 address value that is unsupported + var l2InferredBlockedTokens = useMemo( + function () { + if (!chainId || !L2_CHAIN_IDS.includes(chainId)) { + return {} + } + if (!listsByUrl) { + return {} + } + var listUrl = CHAIN_INFO[chainId].defaultListUrl + var list = listsByUrl[listUrl].current + if (!list) { + return {} + } + var unsupportedSet = new Set(Object.keys(unsupportedTokens)) + return list.tokens.reduce(function (acc, tokenInfo) { + var _a + var _b + var bridgeInfo = (_b = tokenInfo.extensions) === null || _b === void 0 ? void 0 : _b.bridgeInfo + if ( + bridgeInfo && + bridgeInfo[SupportedChainId.MAINNET] && + bridgeInfo[SupportedChainId.MAINNET].tokenAddress && + unsupportedSet.has(bridgeInfo[SupportedChainId.MAINNET].tokenAddress) + ) { + var address = bridgeInfo[SupportedChainId.MAINNET].tokenAddress + // don't rely on decimals--it's possible that a token could be bridged w/ different decimals on the L2 + return __assign( + __assign({}, acc), + ((_a = {}), (_a[address] = new Token(SupportedChainId.MAINNET, address, tokenInfo.decimals)), _a) + ) + } + return acc + }, {}) + }, + [chainId, listsByUrl, unsupportedTokens] + ) + return __assign(__assign({}, unsupportedTokens), l2InferredBlockedTokens) +} +function useSearchInactiveTokenLists(search, minResults) { + if (minResults === void 0) { + minResults = 10 + } + var lists = useAllLists() + var inactiveUrls = useInactiveListUrls() + var chainId = useActiveWeb3React().chainId + var activeTokens = useAllTokens() + return useMemo( + function () { + var e_1, _a, e_2, _b + if (!search || search.trim().length === 0) return [] + var tokenFilter = getTokenFilter(search) + var result = [] + var addressSet = {} + try { + for ( + var inactiveUrls_1 = __values(inactiveUrls), inactiveUrls_1_1 = inactiveUrls_1.next(); + !inactiveUrls_1_1.done; + inactiveUrls_1_1 = inactiveUrls_1.next() + ) { + var url = inactiveUrls_1_1.value + var list = lists[url].current + if (!list) continue + try { + for (var _c = ((e_2 = void 0), __values(list.tokens)), _d = _c.next(); !_d.done; _d = _c.next()) { + var tokenInfo = _d.value + if (tokenInfo.chainId === chainId && tokenFilter(tokenInfo)) { + var wrapped = new WrappedTokenInfo(tokenInfo, list) + if (!(wrapped.address in activeTokens) && !addressSet[wrapped.address]) { + addressSet[wrapped.address] = true + result.push(wrapped) + if (result.length >= minResults) return result + } + } + } + } catch (e_2_1) { + e_2 = { error: e_2_1 } + } finally { + try { + if (_d && !_d.done && (_b = _c.return)) _b.call(_c) + } finally { + if (e_2) throw e_2.error + } + } + } + } catch (e_1_1) { + e_1 = { error: e_1_1 } + } finally { + try { + if (inactiveUrls_1_1 && !inactiveUrls_1_1.done && (_a = inactiveUrls_1.return)) _a.call(inactiveUrls_1) + } finally { + if (e_1) throw e_1.error + } + } + return result + }, + [activeTokens, chainId, inactiveUrls, lists, minResults, search] + ) +} +function useIsTokenActive(token) { + var activeTokens = useAllTokens() + if (!activeTokens || !token) { + return false + } + return !!activeTokens[token.address] +} +// Check if currency is included in custom list from user storage +function useIsUserAddedToken(currency) { + var userAddedTokens = useUserAddedTokens() + if (!currency) { + return false + } + return !!userAddedTokens.find(function (token) { + return currency.equals(token) + }) +} +// undefined if invalid or does not exist +// null if loading or null was passed +// otherwise returns the token +function useToken(tokenAddress) { + var tokens = useAllTokens() + return useTokenFromMap(tokens, tokenAddress) +} +function useCurrency(currencyId) { + var tokens = useAllTokens() + return useCurrencyFromMap(tokens, currencyId) +} + +function serializeToken(token) { + return { + chainId: token.chainId, + address: token.address, + decimals: token.decimals, + symbol: token.symbol, + name: token.name, + } +} +function deserializeToken(serializedToken) { + return new Token( + serializedToken.chainId, + serializedToken.address, + serializedToken.decimals, + serializedToken.symbol, + serializedToken.name + ) +} +function useIsDarkMode() { + var _a = useAppSelector(function (_a) { + var _b = _a.user, + matchesDarkMode = _b.matchesDarkMode, + userDarkMode = _b.userDarkMode + return { + userDarkMode, + matchesDarkMode, + } + }, shallowEqual), + userDarkMode = _a.userDarkMode, + matchesDarkMode = _a.matchesDarkMode + return userDarkMode === null ? matchesDarkMode : userDarkMode +} +function useDarkModeManager() { + var dispatch = useAppDispatch() + var darkMode = useIsDarkMode() + var toggleSetDarkMode = useCallback( + function () { + dispatch(updateUserDarkMode({ userDarkMode: !darkMode })) + }, + [darkMode, dispatch] + ) + return [darkMode, toggleSetDarkMode] +} +function useUserLocale() { + return useAppSelector(function (state) { + return state.user.userLocale + }) +} +function useUserLocaleManager() { + var dispatch = useAppDispatch() + var locale = useUserLocale() + var setLocale = useCallback( + function (newLocale) { + dispatch(updateUserLocale({ userLocale: newLocale })) + }, + [dispatch] + ) + return [locale, setLocale] +} +function useIsExpertMode() { + return useAppSelector(function (state) { + return state.user.userExpertMode + }) +} +function useExpertModeManager() { + var dispatch = useAppDispatch() + var expertMode = useIsExpertMode() + var toggleSetExpertMode = useCallback( + function () { + dispatch(updateUserExpertMode({ userExpertMode: !expertMode })) + }, + [expertMode, dispatch] + ) + return [expertMode, toggleSetExpertMode] +} +function useShowSurveyPopup() { + var dispatch = useAppDispatch() + var showSurveyPopup = useAppSelector(function (state) { + return state.user.showSurveyPopup + }) + var toggleShowSurveyPopup = useCallback( + function (showPopup) { + dispatch(updateShowSurveyPopup({ showSurveyPopup: showPopup })) + }, + [dispatch] + ) + return [showSurveyPopup, toggleShowSurveyPopup] +} +function useClientSideRouter() { + var dispatch = useAppDispatch() + var clientSideRouter = useAppSelector(function (state) { + return Boolean(state.user.userClientSideRouter) + }) + var setClientSideRouter = useCallback( + function (newClientSideRouter) { + dispatch(updateUserClientSideRouter({ userClientSideRouter: newClientSideRouter })) + }, + [dispatch] + ) + return [clientSideRouter, setClientSideRouter] +} +function useSetUserSlippageTolerance() { + var dispatch = useAppDispatch() + return useCallback( + function (userSlippageTolerance) { + var value + try { + value = + userSlippageTolerance === 'auto' ? 'auto' : JSBI.toNumber(userSlippageTolerance.multiply(10000).quotient) + } catch (error) { + value = 'auto' + } + dispatch( + updateUserSlippageTolerance({ + userSlippageTolerance: value, + }) + ) + }, + [dispatch] + ) +} +/** + * Return the user's slippage tolerance, from the redux store, and a function to update the slippage tolerance + */ +function useUserSlippageTolerance() { + var userSlippageTolerance = useAppSelector(function (state) { + return state.user.userSlippageTolerance + }) + return useMemo( + function () { + return userSlippageTolerance === 'auto' ? 'auto' : new Percent(userSlippageTolerance, 10000) + }, + [userSlippageTolerance] + ) +} +/** + * Same as above but replaces the auto with a default value + * @param defaultSlippageTolerance the default value to replace auto with + */ +function useUserSlippageToleranceWithDefault(defaultSlippageTolerance) { + var allowedSlippage = useUserSlippageTolerance() + return useMemo( + function () { + return allowedSlippage === 'auto' ? defaultSlippageTolerance : allowedSlippage + }, + [allowedSlippage, defaultSlippageTolerance] + ) +} +function useUserTransactionTTL() { + var chainId = useActiveWeb3React().chainId + var dispatch = useAppDispatch() + var userDeadline = useAppSelector(function (state) { + return state.user.userDeadline + }) + var onL2 = Boolean(chainId && L2_CHAIN_IDS.includes(chainId)) + var deadline = onL2 ? L2_DEADLINE_FROM_NOW : userDeadline + var setUserDeadline = useCallback( + function (userDeadline) { + dispatch(updateUserDeadline({ userDeadline })) + }, + [dispatch] + ) + return [deadline, setUserDeadline] +} +function useAddUserToken() { + var dispatch = useAppDispatch() + return useCallback( + function (token) { + dispatch(addSerializedToken({ serializedToken: serializeToken(token) })) + }, + [dispatch] + ) +} +function useRemoveUserAddedToken() { + var dispatch = useAppDispatch() + return useCallback( + function (chainId, address) { + dispatch(removeSerializedToken({ chainId, address })) + }, + [dispatch] + ) +} +function useUserAddedTokens() { + var chainId = useActiveWeb3React().chainId + var serializedTokensMap = useAppSelector(function (_a) { + var tokens = _a.user.tokens + return tokens + }) + return useMemo( + function () { + if (!chainId) return [] + var tokenMap = ( + serializedTokensMap === null || serializedTokensMap === void 0 ? void 0 : serializedTokensMap[chainId] + ) + ? Object.values(serializedTokensMap[chainId]).map(deserializeToken) + : [] + return tokenMap + }, + [serializedTokensMap, chainId] + ) +} +function useURLWarningVisible() { + return useAppSelector(function (state) { + return state.user.URLWarningVisible + }) +} + +var EXPLORER_HOSTNAMES = { + 'etherscan.io': true, + 'ropsten.etherscan.io': true, + 'rinkeby.etherscan.io': true, + 'kovan.etherscan.io': true, + 'goerli.etherscan.io': true, + 'optimistic.etherscan.io': true, + 'kovan-optimistic.etherscan.io': true, + 'rinkeby-explorer.arbitrum.io': true, + 'arbiscan.io': true, +} +/** + * Returns the anonymized version of the given href, i.e. one that does not leak user information + * @param href the link to anonymize, i.e. remove any personal data from + * @return string anonymized version of the given href + */ +function anonymizeLink(href) { + try { + var url = new URL(href) + if (EXPLORER_HOSTNAMES[url.hostname]) { + var pathPieces = url.pathname.split('/') + var anonymizedPath = pathPieces + .map(function (pc) { + return /0x[a-fA-F0-9]+/.test(pc) ? '***' : pc + }) + .join('/') + return url.protocol + '//' + url.hostname + anonymizedPath + } + return href + } catch (error) { + return href + } +} + +var ButtonText = styled.button( + templateObject_1$1l || + (templateObject_1$1l = __makeTemplateObject( + [ + '\n outline: none;\n border: none;\n font-size: inherit;\n padding: 0;\n margin: 0;\n background: none;\n cursor: pointer;\n\n :hover {\n opacity: 0.7;\n }\n\n :focus {\n text-decoration: underline;\n }\n', + ], + [ + '\n outline: none;\n border: none;\n font-size: inherit;\n padding: 0;\n margin: 0;\n background: none;\n cursor: pointer;\n\n :hover {\n opacity: 0.7;\n }\n\n :focus {\n text-decoration: underline;\n }\n', + ] + )) +) +var CloseIcon$2 = styled(X)( + templateObject_2$$ || + (templateObject_2$$ = __makeTemplateObject( + ['\n cursor: pointer;\n'], + [ + '\n cursor: pointer;\n', + // for wrapper react feather icons + ] + )) +) +// for wrapper react feather icons +var IconWrapper$4 = styled.div( + templateObject_3$S || + (templateObject_3$S = __makeTemplateObject( + [ + '\n display: flex;\n align-items: center;\n justify-content: center;\n width: ', + ';\n height: ', + ';\n margin-right: ', + ';\n margin-left: ', + ';\n & > * {\n stroke: ', + ';\n }\n', + ], + [ + '\n display: flex;\n align-items: center;\n justify-content: center;\n width: ', + ';\n height: ', + ';\n margin-right: ', + ';\n margin-left: ', + ';\n & > * {\n stroke: ', + ';\n }\n', + // A button that triggers some onClick result, but looks like a link. + ] + )), + function (_a) { + var size = _a.size + return size !== null && size !== void 0 ? size : '20px' + }, + function (_a) { + var size = _a.size + return size !== null && size !== void 0 ? size : '20px' + }, + function (_a) { + var marginRight = _a.marginRight + return marginRight !== null && marginRight !== void 0 ? marginRight : 0 + }, + function (_a) { + var marginLeft = _a.marginLeft + return marginLeft !== null && marginLeft !== void 0 ? marginLeft : 0 + }, + function (_a) { + var theme = _a.theme, + stroke = _a.stroke + return stroke !== null && stroke !== void 0 ? stroke : theme.blue1 + } +) +// A button that triggers some onClick result, but looks like a link. +var LinkStyledButton = styled.button( + templateObject_4$G || + (templateObject_4$G = __makeTemplateObject( + [ + '\n border: none;\n text-decoration: none;\n background: none;\n\n cursor: ', + ';\n color: ', + ';\n font-weight: 500;\n\n :hover {\n text-decoration: ', + ';\n }\n\n :focus {\n outline: none;\n text-decoration: ', + ';\n }\n\n :active {\n text-decoration: none;\n }\n', + ], + [ + '\n border: none;\n text-decoration: none;\n background: none;\n\n cursor: ', + ';\n color: ', + ';\n font-weight: 500;\n\n :hover {\n text-decoration: ', + ';\n }\n\n :focus {\n outline: none;\n text-decoration: ', + ';\n }\n\n :active {\n text-decoration: none;\n }\n', + // An internal link from the react-router-dom library that is correctly styled + ] + )), + function (_a) { + var disabled = _a.disabled + return disabled ? 'default' : 'pointer' + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return disabled ? theme.text2 : theme.primary1 + }, + function (_a) { + var disabled = _a.disabled + return disabled ? null : 'underline' + }, + function (_a) { + var disabled = _a.disabled + return disabled ? null : 'underline' + } +) +// An internal link from the react-router-dom library that is correctly styled +var StyledInternalLink = styled(Link$1)( + templateObject_5$x || + (templateObject_5$x = __makeTemplateObject( + [ + '\n text-decoration: none;\n cursor: pointer;\n color: ', + ';\n font-weight: 500;\n\n :hover {\n text-decoration: underline;\n }\n\n :focus {\n outline: none;\n text-decoration: underline;\n }\n\n :active {\n text-decoration: none;\n }\n', + ], + [ + '\n text-decoration: none;\n cursor: pointer;\n color: ', + ';\n font-weight: 500;\n\n :hover {\n text-decoration: underline;\n }\n\n :focus {\n outline: none;\n text-decoration: underline;\n }\n\n :active {\n text-decoration: none;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary1 + } +) +var StyledLink = styled.a( + templateObject_6$o || + (templateObject_6$o = __makeTemplateObject( + [ + '\n text-decoration: none;\n cursor: pointer;\n color: ', + ';\n font-weight: 500;\n\n :hover {\n text-decoration: underline;\n }\n\n :focus {\n outline: none;\n text-decoration: underline;\n }\n\n :active {\n text-decoration: none;\n }\n', + ], + [ + '\n text-decoration: none;\n cursor: pointer;\n color: ', + ';\n font-weight: 500;\n\n :hover {\n text-decoration: underline;\n }\n\n :focus {\n outline: none;\n text-decoration: underline;\n }\n\n :active {\n text-decoration: none;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary1 + } +) +var LinkIconWrapper = styled.a( + templateObject_7$k || + (templateObject_7$k = __makeTemplateObject( + [ + '\n text-decoration: none;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n display: flex;\n\n :hover {\n text-decoration: none;\n opacity: 0.7;\n }\n\n :focus {\n outline: none;\n text-decoration: none;\n }\n\n :active {\n text-decoration: none;\n }\n', + ], + [ + '\n text-decoration: none;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n display: flex;\n\n :hover {\n text-decoration: none;\n opacity: 0.7;\n }\n\n :focus {\n outline: none;\n text-decoration: none;\n }\n\n :active {\n text-decoration: none;\n }\n', + ] + )) +) +var LinkIcon = styled(ExternalLink$1)( + templateObject_8$h || + (templateObject_8$h = __makeTemplateObject( + ['\n height: 16px;\n width: 18px;\n margin-left: 10px;\n stroke: ', ';\n'], + ['\n height: 16px;\n width: 18px;\n margin-left: 10px;\n stroke: ', ';\n'] + )), + function (_a) { + var theme = _a.theme + return theme.blue1 + } +) +var TrashIcon = styled(Trash)( + templateObject_9$g || + (templateObject_9$g = __makeTemplateObject( + [ + '\n height: 16px;\n width: 18px;\n margin-left: 10px;\n stroke: ', + ';\n\n cursor: pointer;\n align-items: center;\n justify-content: center;\n display: flex;\n\n :hover {\n opacity: 0.7;\n }\n', + ], + [ + '\n height: 16px;\n width: 18px;\n margin-left: 10px;\n stroke: ', + ';\n\n cursor: pointer;\n align-items: center;\n justify-content: center;\n display: flex;\n\n :hover {\n opacity: 0.7;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.text3 + } +) +var rotateImg = keyframes( + templateObject_10$c || + (templateObject_10$c = __makeTemplateObject( + [ + '\n 0% {\n transform: perspective(1000px) rotateY(0deg);\n }\n\n 100% {\n transform: perspective(1000px) rotateY(360deg);\n }\n', + ], + [ + '\n 0% {\n transform: perspective(1000px) rotateY(0deg);\n }\n\n 100% {\n transform: perspective(1000px) rotateY(360deg);\n }\n', + ] + )) +) +var UniTokenAnimated = styled.img( + templateObject_11$a || + (templateObject_11$a = __makeTemplateObject( + [ + '\n animation: ', + ' 5s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n padding: 2rem 0 0 0;\n filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.15));\n', + ], + [ + '\n animation: ', + ' 5s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n padding: 2rem 0 0 0;\n filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.15));\n', + ] + )), + rotateImg +) +function handleClickExternalLink(event) { + var _a = event.currentTarget, + target = _a.target, + href = _a.href + var anonymizedHref = anonymizeLink(href) + // don't prevent default, don't redirect if it's a new tab + if (target === '_blank' || event.ctrlKey || event.metaKey) { + ReactGA.outboundLink({ label: anonymizedHref }, function () { + console.debug('Fired outbound link event', anonymizedHref) + }) + } else { + event.preventDefault() + // send a ReactGA event and then trigger a location change + ReactGA.outboundLink({ label: anonymizedHref }, function () { + window.location.href = anonymizedHref + }) + } +} +/** + * Outbound link that handles firing google analytics events + */ +function ExternalLink(_a) { + var _b = _a.target, + target = _b === void 0 ? '_blank' : _b, + href = _a.href, + _c = _a.rel, + rel = _c === void 0 ? 'noopener noreferrer' : _c, + rest = __rest(_a, ['target', 'href', 'rel']) + return jsx(StyledLink, __assign({ target, rel, href, onClick: handleClickExternalLink }, rest), void 0) +} +function ExternalLinkIcon(_a) { + var _b = _a.target, + target = _b === void 0 ? '_blank' : _b, + href = _a.href, + _c = _a.rel, + rel = _c === void 0 ? 'noopener noreferrer' : _c, + rest = __rest(_a, ['target', 'href', 'rel']) + return jsx( + LinkIconWrapper, + __assign({ target, rel, href, onClick: handleClickExternalLink }, rest, { + children: jsx(LinkIcon, {}, void 0), + }), + void 0 + ) +} +var rotate$1 = keyframes( + templateObject_12$a || + (templateObject_12$a = __makeTemplateObject( + ['\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n'], + ['\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n'] + )) +) +var Spinner$2 = styled.img( + templateObject_13$6 || + (templateObject_13$6 = __makeTemplateObject( + ['\n animation: 2s ', ' linear infinite;\n width: 16px;\n height: 16px;\n'], + ['\n animation: 2s ', ' linear infinite;\n width: 16px;\n height: 16px;\n'] + )), + rotate$1 +) +styled(StyledInternalLink)( + templateObject_14$6 || (templateObject_14$6 = __makeTemplateObject(['\n color: ', ';\n'], ['\n color: ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.text1 + } +) +var CustomLightSpinner = styled(Spinner$2)( + templateObject_15$4 || + (templateObject_15$4 = __makeTemplateObject( + ['\n height: ', ';\n width: ', ';\n'], + ['\n height: ', ';\n width: ', ';\n'] + )), + function (_a) { + var size = _a.size + return size + }, + function (_a) { + var size = _a.size + return size + } +) +var HideSmall = styled.span( + templateObject_17$2 || (templateObject_17$2 = __makeTemplateObject(['\n ', ';\n'], ['\n ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.mediaWidth.upToSmall( + templateObject_16$3 || + (templateObject_16$3 = __makeTemplateObject(['\n display: none;\n '], ['\n display: none;\n '])) + ) + } +) +styled.span( + templateObject_19$2 || (templateObject_19$2 = __makeTemplateObject(['\n ', ';\n'], ['\n ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.mediaWidth.upToExtraSmall( + templateObject_18$2 || + (templateObject_18$2 = __makeTemplateObject(['\n display: none;\n '], ['\n display: none;\n '])) + ) + } +) +styled.span( + templateObject_21$1 || + (templateObject_21$1 = __makeTemplateObject(['\n display: none;\n ', ';\n'], ['\n display: none;\n ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.mediaWidth.upToSmall( + templateObject_20$1 || + (templateObject_20$1 = __makeTemplateObject(['\n display: block;\n '], ['\n display: block;\n '])) + ) + } +) +var Separator$1 = styled.div( + templateObject_22 || + (templateObject_22 = __makeTemplateObject( + ['\n width: 100%;\n height: 1px;\n background-color: ', ';\n'], + ['\n width: 100%;\n height: 1px;\n background-color: ', ';\n'] + )), + function (_a) { + var theme = _a.theme + return theme.bg2 + } +) +var templateObject_1$1l, + templateObject_2$$, + templateObject_3$S, + templateObject_4$G, + templateObject_5$x, + templateObject_6$o, + templateObject_7$k, + templateObject_8$h, + templateObject_9$g, + templateObject_10$c, + templateObject_11$a, + templateObject_12$a, + templateObject_13$6, + templateObject_14$6, + templateObject_15$4, + templateObject_16$3, + templateObject_17$2, + templateObject_18$2, + templateObject_19$2, + templateObject_20$1, + templateObject_21$1, + templateObject_22 + +var MEDIA_WIDTHS = { + upToExtraSmall: 500, + upToSmall: 720, + upToMedium: 960, + upToLarge: 1280, +} +// Migrating to a standard z-index system https://getbootstrap.com/docs/5.0/layout/z-index/ +// Please avoid using deprecated numbers +var Z_INDEX +;(function (Z_INDEX) { + Z_INDEX[(Z_INDEX['deprecated_zero'] = 0)] = 'deprecated_zero' + Z_INDEX[(Z_INDEX['deprecated_content'] = 1)] = 'deprecated_content' + Z_INDEX[(Z_INDEX['dropdown'] = 1000)] = 'dropdown' + Z_INDEX[(Z_INDEX['sticky'] = 1020)] = 'sticky' + Z_INDEX[(Z_INDEX['fixed'] = 1030)] = 'fixed' + Z_INDEX[(Z_INDEX['modalBackdrop'] = 1040)] = 'modalBackdrop' + Z_INDEX[(Z_INDEX['offcanvas'] = 1050)] = 'offcanvas' + Z_INDEX[(Z_INDEX['modal'] = 1060)] = 'modal' + Z_INDEX[(Z_INDEX['popover'] = 1070)] = 'popover' + Z_INDEX[(Z_INDEX['tooltip'] = 1080)] = 'tooltip' +})(Z_INDEX || (Z_INDEX = {})) +var mediaWidthTemplates = Object.keys(MEDIA_WIDTHS).reduce(function (accumulator, size) { + accumulator[size] = function (a, b, c) { + return css( + templateObject_1$1k || + (templateObject_1$1k = __makeTemplateObject( + ['\n @media (max-width: ', 'px) {\n ', '\n }\n '], + ['\n @media (max-width: ', 'px) {\n ', '\n }\n '] + )), + MEDIA_WIDTHS[size], + css(a, b, c) + ) + } + return accumulator +}, {}) +var white = '#FFFFFF' +var black = '#000000' +function colors(darkMode) { + return { + darkMode, + // base + white, + black, + // text + text1: darkMode ? '#FFFFFF' : '#000000', + text2: darkMode ? '#C3C5CB' : '#565A69', + text3: darkMode ? '#8F96AC' : '#6E727D', + text4: darkMode ? '#B2B9D2' : '#C3C5CB', + text5: darkMode ? '#2C2F36' : '#EDEEF2', + // backgrounds / greys + bg0: darkMode ? '#191B1F' : '#FFF', + bg1: darkMode ? '#212429' : '#F7F8FA', + bg2: darkMode ? '#2C2F36' : '#EDEEF2', + bg3: darkMode ? '#40444F' : '#CED0D9', + bg4: darkMode ? '#565A69' : '#888D9B', + bg5: darkMode ? '#6C7284' : '#888D9B', + bg6: darkMode ? '#1A2028' : '#6C7284', + //specialty colors + modalBG: darkMode ? 'rgba(0,0,0,.425)' : 'rgba(0,0,0,0.3)', + advancedBG: darkMode ? 'rgba(0,0,0,0.1)' : 'rgba(255,255,255,0.6)', + //primary colors + primary1: darkMode ? '#2172E5' : '#E8006F', + primary2: darkMode ? '#3680E7' : '#FF8CC3', + primary3: darkMode ? '#4D8FEA' : '#FF99C9', + primary4: darkMode ? '#376bad70' : '#F6DDE8', + primary5: darkMode ? '#153d6f70' : '#FDEAF1', + // color text + primaryText1: darkMode ? '#5090ea' : '#D50066', + // secondary colors + secondary1: darkMode ? '#2172E5' : '#E8006F', + secondary2: darkMode ? '#17000b26' : '#F6DDE8', + secondary3: darkMode ? '#17000b26' : '#FDEAF1', + // other + red1: darkMode ? '#FF4343' : '#DA2D2B', + red2: darkMode ? '#F82D3A' : '#DF1F38', + red3: '#D60000', + green1: darkMode ? '#27AE60' : '#007D35', + yellow1: '#E3A507', + yellow2: '#FF8F00', + yellow3: '#F3B71E', + blue1: darkMode ? '#2172E5' : '#0068FC', + blue2: darkMode ? '#5199FF' : '#0068FC', + error: darkMode ? '#FD4040' : '#DF1F38', + success: darkMode ? '#27AE60' : '#007D35', + warning: '#FF8F00', + // dont wanna forget these blue yet + blue4: darkMode ? '#153d6f70' : '#C4D9F8', + // blue5: darkMode ? '#153d6f70' : '#EBF4FF', + } +} +function theme(darkMode) { + return __assign(__assign({}, colors(darkMode)), { + grids: { + sm: 8, + md: 12, + lg: 24, + }, + //shadows + shadow1: darkMode ? '#000' : '#2F80ED', + // media queries + mediaWidth: mediaWidthTemplates, + // css snippets + flexColumnNoWrap: css( + templateObject_2$_ || + (templateObject_2$_ = __makeTemplateObject( + ['\n display: flex;\n flex-flow: column nowrap;\n '], + ['\n display: flex;\n flex-flow: column nowrap;\n '] + )) + ), + flexRowNoWrap: css( + templateObject_3$R || + (templateObject_3$R = __makeTemplateObject( + ['\n display: flex;\n flex-flow: row nowrap;\n '], + ['\n display: flex;\n flex-flow: row nowrap;\n '] + )) + ), + }) +} +function ThemeProvider(_a) { + var children = _a.children + var darkMode = useIsDarkMode() + var themeObject = useMemo( + function () { + return theme(darkMode) + }, + [darkMode] + ) + return jsx(ThemeProvider$1, __assign({ theme: themeObject }, { children }), void 0) +} +var TextWrapper$1 = styled(Text$1)( + templateObject_4$F || + (templateObject_4$F = __makeTemplateObject( + ['\n color: ', ';\n'], + [ + '\n color: ', + ';\n', + /** + * Preset styles of the Rebass Text component + */ + ] + )), + function (_a) { + var color = _a.color, + theme = _a.theme + return theme[color] + } +) +/** + * Preset styles of the Rebass Text component + */ +var ThemedText = { + Main(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'text2' }, props), void 0) + }, + Link(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'primary1' }, props), void 0) + }, + Label(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 600, color: 'text1' }, props), void 0) + }, + Black(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'text1' }, props), void 0) + }, + White(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'white' }, props), void 0) + }, + Body(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 400, fontSize: 16, color: 'text1' }, props), void 0) + }, + LargeHeader(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 600, fontSize: 24 }, props), void 0) + }, + MediumHeader(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, fontSize: 20 }, props), void 0) + }, + SubHeader(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 400, fontSize: 14 }, props), void 0) + }, + Small(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, fontSize: 11 }, props), void 0) + }, + Blue(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'blue1' }, props), void 0) + }, + Yellow(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'yellow3' }, props), void 0) + }, + DarkGray(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'text3' }, props), void 0) + }, + Gray(props) { + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: 'bg3' }, props), void 0) + }, + Italic(props) { + return jsx( + TextWrapper$1, + __assign({ fontWeight: 500, fontSize: 12, fontStyle: 'italic', color: 'text2' }, props), + void 0 + ) + }, + Error(_a) { + var error = _a.error, + props = __rest(_a, ['error']) + return jsx(TextWrapper$1, __assign({ fontWeight: 500, color: error ? 'red1' : 'text2' }, props), void 0) + }, +} +var ThemedGlobalStyle = createGlobalStyle( + templateObject_5$w || + (templateObject_5$w = __makeTemplateObject( + ['\nhtml {\n color: ', ';\n background-color: ', ' !important;\n}\n\na {\n color: ', '; \n}\n'], + ['\nhtml {\n color: ', ';\n background-color: ', ' !important;\n}\n\na {\n color: ', '; \n}\n'] + )), + function (_a) { + var theme = _a.theme + return theme.text1 + }, + function (_a) { + var theme = _a.theme + return theme.bg1 + }, + function (_a) { + var theme = _a.theme + return theme.blue1 + } +) +var templateObject_1$1k, templateObject_2$_, templateObject_3$R, templateObject_4$F, templateObject_5$w + +var _a$b +var ETHERSCAN_PREFIXES = + ((_a$b = {}), + (_a$b[SupportedChainId.MAINNET] = 'https://etherscan.io'), + (_a$b[SupportedChainId.ROPSTEN] = 'https://ropsten.etherscan.io'), + (_a$b[SupportedChainId.RINKEBY] = 'https://rinkeby.etherscan.io'), + (_a$b[SupportedChainId.GOERLI] = 'https://goerli.etherscan.io'), + (_a$b[SupportedChainId.KOVAN] = 'https://kovan.etherscan.io'), + (_a$b[SupportedChainId.OPTIMISM] = 'https://optimistic.etherscan.io'), + (_a$b[SupportedChainId.OPTIMISTIC_KOVAN] = 'https://kovan-optimistic.etherscan.io'), + (_a$b[SupportedChainId.POLYGON_MUMBAI] = 'https://mumbai.polygonscan.com'), + (_a$b[SupportedChainId.POLYGON] = 'https://polygonscan.com'), + _a$b) +var ExplorerDataType +;(function (ExplorerDataType) { + ExplorerDataType['TRANSACTION'] = 'transaction' + ExplorerDataType['TOKEN'] = 'token' + ExplorerDataType['ADDRESS'] = 'address' + ExplorerDataType['BLOCK'] = 'block' +})(ExplorerDataType || (ExplorerDataType = {})) +/** + * Return the explorer link for the given data and data type + * @param chainId the ID of the chain for which to return the data + * @param data the data to return a link for + * @param type the type of the data + */ +function getExplorerLink(chainId, data, type) { + var _a + if (chainId === SupportedChainId.ARBITRUM_ONE) { + switch (type) { + case ExplorerDataType.TRANSACTION: + return 'https://arbiscan.io/tx/' + data + case ExplorerDataType.ADDRESS: + case ExplorerDataType.TOKEN: + return 'https://arbiscan.io/address/' + data + case ExplorerDataType.BLOCK: + return 'https://arbiscan.io/block/' + data + default: + return 'https://arbiscan.io/' + } + } + if (chainId === SupportedChainId.ARBITRUM_RINKEBY) { + switch (type) { + case ExplorerDataType.TRANSACTION: + return 'https://rinkeby-explorer.arbitrum.io/tx/' + data + case ExplorerDataType.ADDRESS: + case ExplorerDataType.TOKEN: + return 'https://rinkeby-explorer.arbitrum.io/address/' + data + case ExplorerDataType.BLOCK: + return 'https://rinkeby-explorer.arbitrum.io/block/' + data + default: + return 'https://rinkeby-explorer.arbitrum.io/' + } + } + var prefix = (_a = ETHERSCAN_PREFIXES[chainId]) !== null && _a !== void 0 ? _a : 'https://etherscan.io' + switch (type) { + case ExplorerDataType.TRANSACTION: + return prefix + '/tx/' + data + case ExplorerDataType.TOKEN: + return prefix + '/token/' + data + case ExplorerDataType.BLOCK: + if (chainId === SupportedChainId.OPTIMISM || chainId === SupportedChainId.OPTIMISTIC_KOVAN) { + return prefix + '/tx/' + data + } + return prefix + '/block/' + data + case ExplorerDataType.ADDRESS: + return prefix + '/address/' + data + default: + return '' + prefix + } +} + +var Column = styled.div( + templateObject_1$1j || + (templateObject_1$1j = __makeTemplateObject( + ['\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n'], + ['\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n'] + )) +) +var ColumnCenter = styled(Column)( + templateObject_2$Z || + (templateObject_2$Z = __makeTemplateObject( + ['\n width: 100%;\n align-items: center;\n'], + ['\n width: 100%;\n align-items: center;\n'] + )) +) +var AutoColumn = styled.div( + templateObject_3$Q || + (templateObject_3$Q = __makeTemplateObject( + ['\n display: grid;\n grid-auto-rows: auto;\n grid-row-gap: ', ';\n justify-items: ', ';\n'], + ['\n display: grid;\n grid-auto-rows: auto;\n grid-row-gap: ', ';\n justify-items: ', ';\n'] + )), + function (_a) { + var gap = _a.gap + return (gap === 'sm' && '8px') || (gap === 'md' && '12px') || (gap === 'lg' && '24px') || gap + }, + function (_a) { + var justify = _a.justify + return justify && justify + } +) +var templateObject_1$1j, templateObject_2$Z, templateObject_3$Q + +var Row$1 = styled(Box)( + templateObject_1$1i || + (templateObject_1$1i = __makeTemplateObject( + [ + '\n width: ', + ';\n display: flex;\n padding: 0;\n align-items: ', + ';\n justify-content: ', + ';\n padding: ', + ';\n border: ', + ';\n border-radius: ', + ';\n', + ], + [ + '\n width: ', + ';\n display: flex;\n padding: 0;\n align-items: ', + ';\n justify-content: ', + ';\n padding: ', + ';\n border: ', + ';\n border-radius: ', + ';\n', + ] + )), + function (_a) { + var width = _a.width + return width !== null && width !== void 0 ? width : '100%' + }, + function (_a) { + var align = _a.align + return align !== null && align !== void 0 ? align : 'center' + }, + function (_a) { + var justify = _a.justify + return justify !== null && justify !== void 0 ? justify : 'flex-start' + }, + function (_a) { + var padding = _a.padding + return padding + }, + function (_a) { + var border = _a.border + return border + }, + function (_a) { + var borderRadius = _a.borderRadius + return borderRadius + } +) +var RowBetween = styled(Row$1)( + templateObject_2$Y || + (templateObject_2$Y = __makeTemplateObject( + ['\n justify-content: space-between;\n'], + ['\n justify-content: space-between;\n'] + )) +) +styled.div( + templateObject_3$P || + (templateObject_3$P = __makeTemplateObject( + ['\n display: flex;\n align-items: flex-end;\n'], + ['\n display: flex;\n align-items: flex-end;\n'] + )) +) +var AutoRow = styled(Row$1)( + templateObject_4$E || + (templateObject_4$E = __makeTemplateObject( + [ + '\n flex-wrap: wrap;\n margin: ', + ';\n justify-content: ', + ';\n\n & > * {\n margin: ', + ' !important;\n }\n', + ], + [ + '\n flex-wrap: wrap;\n margin: ', + ';\n justify-content: ', + ';\n\n & > * {\n margin: ', + ' !important;\n }\n', + ] + )), + function (_a) { + var gap = _a.gap + return gap && '-' + gap + }, + function (_a) { + var justify = _a.justify + return justify && justify + }, + function (_a) { + var gap = _a.gap + return gap + } +) +var RowFixed = styled(Row$1)( + templateObject_5$v || + (templateObject_5$v = __makeTemplateObject( + ['\n width: fit-content;\n margin: ', ';\n'], + ['\n width: fit-content;\n margin: ', ';\n'] + )), + function (_a) { + var gap = _a.gap + return gap && '-' + gap + } +) +var templateObject_1$1i, templateObject_2$Y, templateObject_3$P, templateObject_4$E, templateObject_5$v + +var InputPanel$1 = styled.div( + templateObject_1$1h || + (templateObject_1$1h = __makeTemplateObject( + [ + '\n ', + '\n position: relative;\n border-radius: 1.25rem;\n background-color: ', + ';\n z-index: 1;\n width: 100%;\n', + ], + [ + '\n ', + '\n position: relative;\n border-radius: 1.25rem;\n background-color: ', + ';\n z-index: 1;\n width: 100%;\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.flexColumnNoWrap + }, + function (_a) { + var theme = _a.theme + return theme.bg1 + } +) +var ContainerRow = styled.div( + templateObject_2$X || + (templateObject_2$X = __makeTemplateObject( + [ + '\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 1.25rem;\n border: 1px solid ', + ';\n transition: border-color 300ms ', + ',\n color 500ms ', + ';\n background-color: ', + ';\n', + ], + [ + '\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 1.25rem;\n border: 1px solid ', + ';\n transition: border-color 300ms ', + ',\n color 500ms ', + ';\n background-color: ', + ';\n', + ] + )), + function (_a) { + var error = _a.error, + theme = _a.theme + return error ? theme.red1 : theme.bg2 + }, + function (_a) { + var error = _a.error + return error ? 'step-end' : 'step-start' + }, + function (_a) { + var error = _a.error + return error ? 'step-end' : 'step-start' + }, + function (_a) { + var theme = _a.theme + return theme.bg1 + } +) +var InputContainer = styled.div( + templateObject_3$O || + (templateObject_3$O = __makeTemplateObject( + ['\n flex: 1;\n padding: 1rem;\n'], + ['\n flex: 1;\n padding: 1rem;\n'] + )) +) +var Input$2 = styled.input( + templateObject_4$D || + (templateObject_4$D = __makeTemplateObject( + [ + '\n font-size: 1.25rem;\n outline: none;\n border: none;\n flex: 1 1 auto;\n width: 0;\n background-color: ', + ';\n transition: color 300ms ', + ';\n color: ', + ';\n overflow: hidden;\n text-overflow: ellipsis;\n font-weight: 500;\n width: 100%;\n ::placeholder {\n color: ', + ';\n }\n padding: 0px;\n -webkit-appearance: textfield;\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n\n ::placeholder {\n color: ', + ';\n }\n', + ], + [ + '\n font-size: 1.25rem;\n outline: none;\n border: none;\n flex: 1 1 auto;\n width: 0;\n background-color: ', + ';\n transition: color 300ms ', + ';\n color: ', + ';\n overflow: hidden;\n text-overflow: ellipsis;\n font-weight: 500;\n width: 100%;\n ::placeholder {\n color: ', + ';\n }\n padding: 0px;\n -webkit-appearance: textfield;\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n\n ::placeholder {\n color: ', + ';\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.bg1 + }, + function (_a) { + var error = _a.error + return error ? 'step-end' : 'step-start' + }, + function (_a) { + var error = _a.error, + theme = _a.theme + return error ? theme.red1 : theme.text1 + }, + function (_a) { + var theme = _a.theme + return theme.text4 + }, + function (_a) { + var theme = _a.theme + return theme.text4 + } +) +function AddressInputPanel(_a) { + var id = _a.id, + _b = _a.className, + className = _b === void 0 ? 'recipient-address-input' : _b, + label = _a.label, + placeholder = _a.placeholder, + value = _a.value, + onChange = _a.onChange + var chainId = useActiveWeb3React().chainId + var theme = useContext(ThemeContext) + var _c = useENS(value), + address = _c.address, + loading = _c.loading, + name = _c.name + var handleInput = useCallback( + function (event) { + var input = event.target.value + var withoutSpaces = input.replace(/\s+/g, '') + onChange(withoutSpaces) + }, + [onChange] + ) + var error = Boolean(value.length > 0 && !loading && !address) + return jsx( + InputPanel$1, + __assign( + { id }, + { + children: jsx( + ContainerRow, + __assign( + { error }, + { + children: jsx( + InputContainer, + { + children: jsxs( + AutoColumn, + __assign( + { gap: 'md' }, + { + children: [ + jsxs( + RowBetween, + { + children: [ + jsx( + ThemedText.Black, + __assign( + { color: theme.text2, fontWeight: 500, fontSize: 14 }, + { + children: + label !== null && label !== void 0 + ? label + : jsx(Trans, { children: 'Recipient' }, void 0), + } + ), + void 0 + ), + address && + chainId && + jsx( + ExternalLink, + __assign( + { + href: getExplorerLink( + chainId, + name !== null && name !== void 0 ? name : address, + ExplorerDataType.ADDRESS + ), + style: { fontSize: '14px' }, + }, + { children: jsx(Trans, { children: '(View on Explorer)' }, void 0) } + ), + void 0 + ), + ], + }, + void 0 + ), + jsx( + Input$2, + { + className, + type: 'text', + autoComplete: 'off', + autoCorrect: 'off', + autoCapitalize: 'off', + spellCheck: 'false', + placeholder: + placeholder !== null && placeholder !== void 0 + ? placeholder + : t( + templateObject_5$u || + (templateObject_5$u = __makeTemplateObject( + ['Wallet Address or ENS name'], + ['Wallet Address or ENS name'] + )) + ), + error, + pattern: '^(0x[a-fA-F0-9]{40})$', + onChange: handleInput, + value, + }, + void 0 + ), + ], + } + ), + void 0 + ), + }, + void 0 + ), + } + ), + void 0 + ), + } + ), + void 0 + ) +} +var templateObject_1$1h, templateObject_2$X, templateObject_3$O, templateObject_4$D, templateObject_5$u + +function useTheme() { + return useContext(ThemeContext) +} + +var BaseButton = styled(Button$1)( + templateObject_1$1g || + (templateObject_1$1g = __makeTemplateObject( + [ + '\n padding: ', + ';\n width: ', + ';\n font-weight: 500;\n text-align: center;\n border-radius: ', + ';\n outline: none;\n border: 1px solid transparent;\n color: ', + ';\n text-decoration: none;\n display: flex;\n justify-content: center;\n flex-wrap: nowrap;\n align-items: center;\n cursor: pointer;\n position: relative;\n z-index: 1;\n &:disabled {\n opacity: 50%;\n cursor: auto;\n pointer-events: none;\n }\n\n will-change: transform;\n transition: transform 450ms ease;\n transform: perspective(1px) translateZ(0);\n\n > * {\n user-select: none;\n }\n\n > a {\n text-decoration: none;\n }\n', + ], + [ + '\n padding: ', + ';\n width: ', + ';\n font-weight: 500;\n text-align: center;\n border-radius: ', + ';\n outline: none;\n border: 1px solid transparent;\n color: ', + ';\n text-decoration: none;\n display: flex;\n justify-content: center;\n flex-wrap: nowrap;\n align-items: center;\n cursor: pointer;\n position: relative;\n z-index: 1;\n &:disabled {\n opacity: 50%;\n cursor: auto;\n pointer-events: none;\n }\n\n will-change: transform;\n transition: transform 450ms ease;\n transform: perspective(1px) translateZ(0);\n\n > * {\n user-select: none;\n }\n\n > a {\n text-decoration: none;\n }\n', + ] + )), + function (_a) { + var padding = _a.padding + return padding !== null && padding !== void 0 ? padding : '16px' + }, + function (_a) { + var width = _a.width + return width !== null && width !== void 0 ? width : '100%' + }, + function (_a) { + var $borderRadius = _a.$borderRadius + return $borderRadius !== null && $borderRadius !== void 0 ? $borderRadius : '20px' + }, + function (_a) { + var theme = _a.theme + return theme.text1 + } +) +var ButtonPrimary = styled(BaseButton)( + templateObject_2$W || + (templateObject_2$W = __makeTemplateObject( + [ + '\n background-color: ', + ';\n color: white;\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:disabled {\n background-color: ', + ';\n color: ', + ';\n cursor: auto;\n box-shadow: none;\n border: 1px solid transparent;\n outline: none;\n }\n', + ], + [ + '\n background-color: ', + ';\n color: white;\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:disabled {\n background-color: ', + ';\n color: ', + ';\n cursor: auto;\n box-shadow: none;\n border: 1px solid transparent;\n outline: none;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary1 + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.primary1) + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.primary1) + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.primary1) + }, + function (_a) { + var theme = _a.theme + return darken(0.1, theme.primary1) + }, + function (_a) { + var theme = _a.theme + return darken(0.1, theme.primary1) + }, + function (_a) { + var theme = _a.theme, + altDisabledStyle = _a.altDisabledStyle, + disabled = _a.disabled + return altDisabledStyle ? (disabled ? theme.primary1 : theme.bg2) : theme.bg2 + }, + function (_a) { + var altDisabledStyle = _a.altDisabledStyle, + disabled = _a.disabled, + theme = _a.theme + return altDisabledStyle ? (disabled ? theme.white : theme.text2) : theme.text2 + } +) +var ButtonLight = styled(BaseButton)( + templateObject_3$N || + (templateObject_3$N = __makeTemplateObject( + [ + '\n background-color: ', + ';\n color: ', + ';\n font-size: 16px;\n font-weight: 500;\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n :disabled {\n opacity: 0.4;\n :hover {\n cursor: auto;\n background-color: ', + ';\n box-shadow: none;\n border: 1px solid transparent;\n outline: none;\n }\n }\n', + ], + [ + '\n background-color: ', + ';\n color: ', + ';\n font-size: 16px;\n font-weight: 500;\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n :disabled {\n opacity: 0.4;\n :hover {\n cursor: auto;\n background-color: ', + ';\n box-shadow: none;\n border: 1px solid transparent;\n outline: none;\n }\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary5 + }, + function (_a) { + var theme = _a.theme + return theme.primaryText1 + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return !disabled && darken(0.03, theme.primary5) + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return !disabled && darken(0.03, theme.primary5) + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return !disabled && darken(0.03, theme.primary5) + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return !disabled && darken(0.05, theme.primary5) + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return !disabled && darken(0.05, theme.primary5) + }, + function (_a) { + var theme = _a.theme + return theme.primary5 + } +) +var ButtonGray = styled(BaseButton)( + templateObject_4$C || + (templateObject_4$C = __makeTemplateObject( + [ + '\n background-color: ', + ';\n color: ', + ';\n font-size: 16px;\n font-weight: 500;\n\n &:hover {\n background-color: ', + ';\n }\n &:active {\n background-color: ', + ';\n }\n', + ], + [ + '\n background-color: ', + ';\n color: ', + ';\n font-size: 16px;\n font-weight: 500;\n\n &:hover {\n background-color: ', + ';\n }\n &:active {\n background-color: ', + ';\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.bg1 + }, + function (_a) { + var theme = _a.theme + return theme.text2 + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return !disabled && darken(0.05, theme.bg2) + }, + function (_a) { + var theme = _a.theme, + disabled = _a.disabled + return !disabled && darken(0.1, theme.bg2) + } +) +var ButtonSecondary = styled(BaseButton)( + templateObject_5$t || + (templateObject_5$t = __makeTemplateObject( + [ + '\n border: 1px solid ', + ';\n color: ', + ';\n background-color: transparent;\n font-size: 16px;\n border-radius: 12px;\n padding: ', + ';\n\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n border: 1px solid ', + ';\n }\n &:hover {\n border: 1px solid ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n border: 1px solid ', + ';\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n a:hover {\n text-decoration: none;\n }\n', + ], + [ + '\n border: 1px solid ', + ';\n color: ', + ';\n background-color: transparent;\n font-size: 16px;\n border-radius: 12px;\n padding: ', + ';\n\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n border: 1px solid ', + ';\n }\n &:hover {\n border: 1px solid ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n border: 1px solid ', + ';\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n a:hover {\n text-decoration: none;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary4 + }, + function (_a) { + var theme = _a.theme + return theme.primary1 + }, + function (_a) { + var padding = _a.padding + return padding ? padding : '10px' + }, + function (_a) { + var theme = _a.theme + return theme.primary4 + }, + function (_a) { + var theme = _a.theme + return theme.primary3 + }, + function (_a) { + var theme = _a.theme + return theme.primary3 + }, + function (_a) { + var theme = _a.theme + return theme.primary4 + }, + function (_a) { + var theme = _a.theme + return theme.primary3 + } +) +var ButtonOutlined = styled(BaseButton)( + templateObject_6$n || + (templateObject_6$n = __makeTemplateObject( + [ + '\n border: 1px solid ', + ';\n background-color: transparent;\n color: ', + ';\n &:focus {\n box-shadow: 0 0 0 1px ', + ';\n }\n &:hover {\n box-shadow: 0 0 0 1px ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1px ', + ';\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n', + ], + [ + '\n border: 1px solid ', + ';\n background-color: transparent;\n color: ', + ';\n &:focus {\n box-shadow: 0 0 0 1px ', + ';\n }\n &:hover {\n box-shadow: 0 0 0 1px ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1px ', + ';\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.bg2 + }, + function (_a) { + var theme = _a.theme + return theme.text1 + }, + function (_a) { + var theme = _a.theme + return theme.bg4 + }, + function (_a) { + var theme = _a.theme + return theme.bg4 + }, + function (_a) { + var theme = _a.theme + return theme.bg4 + } +) +styled(BaseButton)( + templateObject_7$j || + (templateObject_7$j = __makeTemplateObject( + [ + '\n background-color: ', + ';\n color: white;\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:disabled {\n background-color: ', + ';\n opacity: 50%;\n cursor: auto;\n }\n', + ], + [ + '\n background-color: ', + ';\n color: white;\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:disabled {\n background-color: ', + ';\n opacity: 50%;\n cursor: auto;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.yellow3 + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.yellow3) + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.yellow3) + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.yellow3) + }, + function (_a) { + var theme = _a.theme + return darken(0.1, theme.yellow3) + }, + function (_a) { + var theme = _a.theme + return darken(0.1, theme.yellow3) + }, + function (_a) { + var theme = _a.theme + return theme.yellow3 + } +) +var ButtonEmpty = styled(BaseButton)( + templateObject_8$g || + (templateObject_8$g = __makeTemplateObject( + [ + '\n background-color: transparent;\n color: ', + ';\n display: flex;\n justify-content: center;\n align-items: center;\n\n &:focus {\n text-decoration: underline;\n }\n &:hover {\n text-decoration: none;\n }\n &:active {\n text-decoration: none;\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n', + ], + [ + '\n background-color: transparent;\n color: ', + ';\n display: flex;\n justify-content: center;\n align-items: center;\n\n &:focus {\n text-decoration: underline;\n }\n &:hover {\n text-decoration: none;\n }\n &:active {\n text-decoration: none;\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary1 + } +) +styled(BaseButton)( + templateObject_9$f || + (templateObject_9$f = __makeTemplateObject( + [ + '\n padding: 0;\n width: fit-content;\n background: none;\n text-decoration: none;\n &:focus {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n text-decoration: underline;\n }\n &:hover {\n // text-decoration: underline;\n opacity: 0.9;\n }\n &:active {\n text-decoration: underline;\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n', + ], + [ + '\n padding: 0;\n width: fit-content;\n background: none;\n text-decoration: none;\n &:focus {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n text-decoration: underline;\n }\n &:hover {\n // text-decoration: underline;\n opacity: 0.9;\n }\n &:active {\n text-decoration: underline;\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n }\n', + ] + )) +) +var ButtonConfirmedStyle = styled(BaseButton)( + templateObject_10$b || + (templateObject_10$b = __makeTemplateObject( + [ + '\n background-color: ', + ';\n color: ', + ';\n /* border: 1px solid ', + '; */\n\n &:disabled {\n opacity: 50%;\n background-color: ', + ';\n color: ', + ';\n cursor: auto;\n }\n', + ], + [ + '\n background-color: ', + ';\n color: ', + ';\n /* border: 1px solid ', + '; */\n\n &:disabled {\n opacity: 50%;\n background-color: ', + ';\n color: ', + ';\n cursor: auto;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.bg3 + }, + function (_a) { + var theme = _a.theme + return theme.text1 + }, + function (_a) { + var theme = _a.theme + return theme.green1 + }, + function (_a) { + var theme = _a.theme + return theme.bg2 + }, + function (_a) { + var theme = _a.theme + return theme.text2 + } +) +var ButtonErrorStyle = styled(BaseButton)( + templateObject_11$9 || + (templateObject_11$9 = __makeTemplateObject( + [ + '\n background-color: ', + ';\n border: 1px solid ', + ';\n\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n box-shadow: none;\n background-color: ', + ';\n border: 1px solid ', + ';\n }\n', + ], + [ + '\n background-color: ', + ';\n border: 1px solid ', + ';\n\n &:focus {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:hover {\n background-color: ', + ';\n }\n &:active {\n box-shadow: 0 0 0 1pt ', + ';\n background-color: ', + ';\n }\n &:disabled {\n opacity: 50%;\n cursor: auto;\n box-shadow: none;\n background-color: ', + ';\n border: 1px solid ', + ';\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.red1 + }, + function (_a) { + var theme = _a.theme + return theme.red1 + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.red1) + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.red1) + }, + function (_a) { + var theme = _a.theme + return darken(0.05, theme.red1) + }, + function (_a) { + var theme = _a.theme + return darken(0.1, theme.red1) + }, + function (_a) { + var theme = _a.theme + return darken(0.1, theme.red1) + }, + function (_a) { + var theme = _a.theme + return theme.red1 + }, + function (_a) { + var theme = _a.theme + return theme.red1 + } +) +function ButtonConfirmed(_a) { + var confirmed = _a.confirmed, + altDisabledStyle = _a.altDisabledStyle, + rest = __rest(_a, ['confirmed', 'altDisabledStyle']) + if (confirmed) { + return jsx(ButtonConfirmedStyle, __assign({}, rest), void 0) + } else { + return jsx(ButtonPrimary, __assign({}, rest, { altDisabledStyle }), void 0) + } +} +function ButtonError(_a) { + var error = _a.error, + rest = __rest(_a, ['error']) + if (error) { + return jsx(ButtonErrorStyle, __assign({}, rest), void 0) + } else { + return jsx(ButtonPrimary, __assign({}, rest), void 0) + } +} +styled(ButtonOutlined)( + templateObject_12$9 || + (templateObject_12$9 = __makeTemplateObject( + ['\n border: 1px solid;\n border-color: ', ';\n'], + ['\n border: 1px solid;\n border-color: ', ';\n'] + )), + function (_a) { + var theme = _a.theme + return theme.primary1 + } +) +styled.div( + templateObject_13$5 || + (templateObject_13$5 = __makeTemplateObject( + [ + '\n height: 17px;\n width: 17px;\n border-radius: 50%;\n background-color: ', + ';\n display: flex;\n align-items: center;\n justify-content: center;\n', + ], + [ + '\n height: 17px;\n width: 17px;\n border-radius: 50%;\n background-color: ', + ';\n display: flex;\n align-items: center;\n justify-content: center;\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary1 + } +) +styled.div( + templateObject_14$5 || + (templateObject_14$5 = __makeTemplateObject( + ['\n width: 20px;\n padding: 0 10px;\n position: absolute;\n top: 11px;\n right: 15px;\n'], + ['\n width: 20px;\n padding: 0 10px;\n position: absolute;\n top: 11px;\n right: 15px;\n'] + )) +) +styled(Check)( + templateObject_15$3 || (templateObject_15$3 = __makeTemplateObject(['\n size: 13px;\n'], ['\n size: 13px;\n'])) +) +var templateObject_1$1g, + templateObject_2$W, + templateObject_3$N, + templateObject_4$C, + templateObject_5$t, + templateObject_6$n, + templateObject_7$j, + templateObject_8$g, + templateObject_9$f, + templateObject_10$b, + templateObject_11$9, + templateObject_12$9, + templateObject_13$5, + templateObject_14$5, + templateObject_15$3 + +var isClient = typeof window === 'object' +function getSize() { + return { + width: isClient ? window.innerWidth : undefined, + height: isClient ? window.innerHeight : undefined, + } +} +// https://usehooks.com/useWindowSize/ +function useWindowSize() { + var _a = __read(useState(getSize), 2), + windowSize = _a[0], + setWindowSize = _a[1] + useEffect(function () { + function handleResize() { + setWindowSize(getSize()) + } + if (isClient) { + window.addEventListener('resize', handleResize) + return function () { + window.removeEventListener('resize', handleResize) + } + } + return undefined + }, []) + return windowSize +} + +// eslint-disable-next-line react/prop-types +function Confetti(_a) { + var start = _a.start, + variant = _a.variant + var _b = useWindowSize(), + width = _b.width, + height = _b.height + var _variant = variant ? variant : height && width && height > 1.5 * width ? 'bottom' : variant + return start && width && height + ? jsx( + ReactConfetti, + { + style: { zIndex: 1401 }, + numberOfPieces: 400, + recycle: false, + run: true, + width, + height, + confettiSource: { + h: height, + w: width, + x: 0, + y: _variant === 'top' ? height * 0.25 : _variant === 'bottom' ? height * 0.75 : height * 0.5, + }, + initialVelocityX: 15, + initialVelocityY: 30, + gravity: 0.45, + tweenDuration: 100, + wind: 0.05, + }, + void 0 + ) + : null +} + +var uImage = '10f062d02df4af77.png' + +var noise = 'f158a440053a5ad2.png' + +var xlUnicorn = 'c2cd04251aa24c34.png' + +var DataCard = styled(AutoColumn)( + templateObject_1$1f || + (templateObject_1$1f = __makeTemplateObject( + [ + '\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #2172e5 100%);\n border-radius: 12px;\n width: 100%;\n position: relative;\n overflow: hidden;\n', + ], + [ + '\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #2172e5 100%);\n border-radius: 12px;\n width: 100%;\n position: relative;\n overflow: hidden;\n', + ] + )) +) +var CardBGImage = styled.span( + templateObject_2$V || + (templateObject_2$V = __makeTemplateObject( + [ + '\n background: url(', + ');\n width: 1000px;\n height: 600px;\n position: absolute;\n border-radius: 12px;\n opacity: 0.4;\n top: -100px;\n left: -100px;\n transform: rotate(-15deg);\n user-select: none;\n ', + '\n', + ], + [ + '\n background: url(', + ');\n width: 1000px;\n height: 600px;\n position: absolute;\n border-radius: 12px;\n opacity: 0.4;\n top: -100px;\n left: -100px;\n transform: rotate(-15deg);\n user-select: none;\n ', + '\n', + ] + )), + uImage, + function (_a) { + var desaturate = _a.desaturate + return desaturate && 'filter: saturate(0)' + } +) +var CardBGImageSmaller = styled.span( + templateObject_3$M || + (templateObject_3$M = __makeTemplateObject( + [ + '\n background: url(', + ');\n width: 1200px;\n height: 1200px;\n position: absolute;\n border-radius: 12px;\n top: -300px;\n left: -300px;\n opacity: 0.4;\n user-select: none;\n\n ', + '\n', + ], + [ + '\n background: url(', + ');\n width: 1200px;\n height: 1200px;\n position: absolute;\n border-radius: 12px;\n top: -300px;\n left: -300px;\n opacity: 0.4;\n user-select: none;\n\n ', + '\n', + ] + )), + xlUnicorn, + function (_a) { + var desaturate = _a.desaturate + return desaturate && 'filter: saturate(0)' + } +) +var CardNoise = styled.span( + templateObject_4$B || + (templateObject_4$B = __makeTemplateObject( + [ + '\n background: url(', + ');\n background-size: cover;\n mix-blend-mode: overlay;\n border-radius: 12px;\n width: 100%;\n height: 100%;\n opacity: 0.15;\n position: absolute;\n top: 0;\n left: 0;\n user-select: none;\n', + ], + [ + '\n background: url(', + ');\n background-size: cover;\n mix-blend-mode: overlay;\n border-radius: 12px;\n width: 100%;\n height: 100%;\n opacity: 0.15;\n position: absolute;\n top: 0;\n left: 0;\n user-select: none;\n', + ] + )), + noise +) +var CardSection = styled(AutoColumn)( + templateObject_5$s || + (templateObject_5$s = __makeTemplateObject( + ['\n padding: 1rem;\n z-index: 1;\n opacity: ', ';\n'], + ['\n padding: 1rem;\n z-index: 1;\n opacity: ', ';\n'] + )), + function (_a) { + var disabled = _a.disabled + return disabled && '0.4' + } +) +var Break$1 = styled.div( + templateObject_6$m || + (templateObject_6$m = __makeTemplateObject( + ['\n width: 100%;\n background-color: rgba(255, 255, 255, 0.2);\n height: 1px;\n'], + ['\n width: 100%;\n background-color: rgba(255, 255, 255, 0.2);\n height: 1px;\n'] + )) +) +var templateObject_1$1f, + templateObject_2$V, + templateObject_3$M, + templateObject_4$B, + templateObject_5$s, + templateObject_6$m + +var parser = new UAParser(window.navigator.userAgent) +var type$1 = parser.getDevice().type +var userAgent = parser.getResult() +var isMobile = type$1 === 'mobile' || type$1 === 'tablet' + +var AnimatedDialogOverlay = animated(DialogOverlay) +// eslint-disable-next-line @typescript-eslint/no-unused-vars +var StyledDialogOverlay = styled(AnimatedDialogOverlay)( + templateObject_1$1e || + (templateObject_1$1e = __makeTemplateObject( + [ + '\n &[data-reach-dialog-overlay] {\n z-index: 2;\n background-color: transparent;\n overflow: hidden;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n background-color: ', + ';\n }\n', + ], + [ + '\n &[data-reach-dialog-overlay] {\n z-index: 2;\n background-color: transparent;\n overflow: hidden;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n background-color: ', + ';\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.modalBG + } +) +var AnimatedDialogContent = animated(DialogContent) +// destructure to not pass custom props to Dialog DOM element +// eslint-disable-next-line @typescript-eslint/no-unused-vars +var StyledDialogContent = styled(function (_a) { + _a.minHeight + _a.maxHeight + _a.mobile + _a.isOpen + var rest = __rest(_a, ['minHeight', 'maxHeight', 'mobile', 'isOpen']) + return jsx(AnimatedDialogContent, __assign({}, rest), void 0) +}).attrs({ + 'aria-label': 'dialog', +})( + templateObject_7$i || + (templateObject_7$i = __makeTemplateObject( + [ + '\n overflow-y: auto;\n\n &[data-reach-dialog-content] {\n margin: 0 0 2rem 0;\n background-color: ', + ';\n border: 1px solid ', + ';\n box-shadow: 0 4px 8px 0 ', + ';\n padding: 0px;\n width: 50vw;\n overflow-y: auto;\n overflow-x: hidden;\n\n align-self: ', + ';\n\n max-width: 420px;\n ', + '\n ', + '\n display: flex;\n border-radius: 20px;\n ', + '\n ', + '\n }\n', + ], + [ + '\n overflow-y: auto;\n\n &[data-reach-dialog-content] {\n margin: 0 0 2rem 0;\n background-color: ', + ';\n border: 1px solid ', + ';\n box-shadow: 0 4px 8px 0 ', + ';\n padding: 0px;\n width: 50vw;\n overflow-y: auto;\n overflow-x: hidden;\n\n align-self: ', + ';\n\n max-width: 420px;\n ', + '\n ', + '\n display: flex;\n border-radius: 20px;\n ', + '\n ', + '\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.bg0 + }, + function (_a) { + var theme = _a.theme + return theme.bg1 + }, + function (_a) { + var theme = _a.theme + return transparentize(0.95, theme.shadow1) + }, + function (_a) { + var mobile = _a.mobile + return mobile ? 'flex-end' : 'center' + }, + function (_a) { + var maxHeight = _a.maxHeight + return ( + maxHeight && + css( + templateObject_2$U || + (templateObject_2$U = __makeTemplateObject( + ['\n max-height: ', 'vh;\n '], + ['\n max-height: ', 'vh;\n '] + )), + maxHeight + ) + ) + }, + function (_a) { + var minHeight = _a.minHeight + return ( + minHeight && + css( + templateObject_3$L || + (templateObject_3$L = __makeTemplateObject( + ['\n min-height: ', 'vh;\n '], + ['\n min-height: ', 'vh;\n '] + )), + minHeight + ) + ) + }, + function (_a) { + var theme = _a.theme + return theme.mediaWidth.upToMedium( + templateObject_4$A || + (templateObject_4$A = __makeTemplateObject( + ['\n width: 65vw;\n margin: 0;\n '], + ['\n width: 65vw;\n margin: 0;\n '] + )) + ) + }, + function (_a) { + var theme = _a.theme, + mobile = _a.mobile + return theme.mediaWidth.upToSmall( + templateObject_6$l || + (templateObject_6$l = __makeTemplateObject( + ['\n width: 85vw;\n ', '\n '], + ['\n width: 85vw;\n ', '\n '] + )), + mobile && + css( + templateObject_5$r || + (templateObject_5$r = __makeTemplateObject( + [ + '\n width: 100vw;\n border-radius: 20px;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n ', + ], + [ + '\n width: 100vw;\n border-radius: 20px;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n ', + ] + )) + ) + ) + } +) +function Modal(_a) { + var isOpen = _a.isOpen, + onDismiss = _a.onDismiss, + _b = _a.minHeight, + minHeight = _b === void 0 ? false : _b, + _c = _a.maxHeight, + maxHeight = _c === void 0 ? 90 : _c, + initialFocusRef = _a.initialFocusRef, + children = _a.children + var fadeTransition = useTransition(isOpen, null, { + config: { duration: 200 }, + from: { opacity: 0 }, + enter: { opacity: 1 }, + leave: { opacity: 0 }, + }) + var _d = __read( + useSpring(function () { + return { y: 0, config: { mass: 1, tension: 210, friction: 20 } } + }), + 2 + ), + y = _d[0].y, + set = _d[1] + var bind = useGesture({ + onDrag(state) { + set({ + y: state.down ? state.movement[1] : 0, + }) + if (state.movement[1] > 300 || (state.velocity > 3 && state.direction[1] > 0)) { + onDismiss() + } + }, + }) + return jsx( + Fragment, + { + children: fadeTransition.map(function (_a) { + var item = _a.item, + key = _a.key, + props = _a.props + return ( + item && + jsx( + StyledDialogOverlay, + __assign( + { + style: props, + onDismiss, + initialFocusRef, + unstable_lockFocusAcrossFrames: false, + }, + { + children: jsxs( + StyledDialogContent, + __assign( + {}, + isMobile + ? __assign(__assign({}, bind()), { + style: { + transform: y.interpolate(function (y) { + return 'translateY(' + (y > 0 ? y : 0) + 'px)' + }), + }, + }) + : {}, + { 'aria-label': 'dialog content', minHeight, maxHeight, mobile: isMobile }, + { children: [!initialFocusRef && isMobile ? jsx('div', { tabIndex: 1 }, void 0) : null, children] } + ), + void 0 + ), + } + ), + key + ) + ) + }), + }, + void 0 + ) +} +var templateObject_1$1e, + templateObject_2$U, + templateObject_3$L, + templateObject_4$A, + templateObject_5$r, + templateObject_6$l, + templateObject_7$i + +var ContentWrapper$4 = styled(AutoColumn)( + templateObject_1$1d || (templateObject_1$1d = __makeTemplateObject(['\n width: 100%;\n'], ['\n width: 100%;\n'])) +) +var ModalUpper$1 = styled(DataCard)( + templateObject_2$T || + (templateObject_2$T = __makeTemplateObject( + [ + '\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #021d43 100%);\n', + ], + [ + '\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #021d43 100%);\n', + ] + )) +) +var ConfirmOrLoadingWrapper$1 = styled.div( + templateObject_3$K || + (templateObject_3$K = __makeTemplateObject( + ['\n width: 100%;\n padding: 24px;\n position: relative;\n background: ', ';\n'], + ['\n width: 100%;\n padding: 24px;\n position: relative;\n background: ', ';\n'] + )), + function (_a) { + var activeBG = _a.activeBG + return ( + activeBG && + 'radial-gradient(76.02% 75.41% at 1.84% 0%, rgba(255, 0, 122, 0.2) 0%, rgba(33, 114, 229, 0.2) 100%), #FFFFFF;' + ) + } +) +var ConfirmedIcon$2 = styled(ColumnCenter)( + templateObject_4$z || + (templateObject_4$z = __makeTemplateObject(['\n padding: 60px 0;\n'], ['\n padding: 60px 0;\n'])) +) +function AddressClaimModal(_a) { + var _b, _c + var isOpen = _a.isOpen, + onDismiss = _a.onDismiss + var chainId = useActiveWeb3React().chainId + // state for smart contract input + var _d = __read(useState(''), 2), + typed = _d[0], + setTyped = _d[1] + function handleRecipientType(val) { + setTyped(val) + } + // monitor for third party recipient of claim + var parsedAddress = useENS(typed).address + // used for UI loading states + var _e = __read(useState(false), 2), + attempting = _e[0], + setAttempting = _e[1] + // monitor the status of the claim from contracts and txns + var claimCallback = useClaimCallback(parsedAddress).claimCallback + var unclaimedAmount = useUserUnclaimedAmount(parsedAddress) + // check if the user has something available + var hasAvailableClaim = useUserHasAvailableClaim(parsedAddress) + var _f = __read(useState(), 2), + hash = _f[0], + setHash = _f[1] + // monitor the status of the claim from contracts and txns + var claimPending = useIsTransactionPending(hash !== null && hash !== void 0 ? hash : '') + var claimConfirmed = hash && !claimPending + // use the hash to monitor this txn + function onClaim() { + setAttempting(true) + claimCallback() + .then(function (hash) { + setHash(hash) + }) + // reset modal and log error + .catch(function (error) { + setAttempting(false) + console.log(error) + }) + } + function wrappedOnDismiss() { + setAttempting(false) + setHash(undefined) + setTyped('') + onDismiss() + } + return jsxs( + Modal, + __assign( + { isOpen, onDismiss: wrappedOnDismiss, maxHeight: 90 }, + { + children: [ + jsx(Confetti, { start: Boolean(isOpen && claimConfirmed && attempting) }, void 0), + !attempting && + jsxs( + ContentWrapper$4, + __assign( + { gap: 'lg' }, + { + children: [ + jsxs( + ModalUpper$1, + { + children: [ + jsx(CardBGImage, {}, void 0), + jsx(CardNoise, {}, void 0), + jsxs( + CardSection, + __assign( + { gap: 'md' }, + { + children: [ + jsxs( + RowBetween, + { + children: [ + jsx( + ThemedText.White, + __assign( + { fontWeight: 500 }, + { children: jsx(Trans, { children: 'Claim UNI Token' }, void 0) } + ), + void 0 + ), + jsx( + CloseIcon$2, + { onClick: wrappedOnDismiss, style: { zIndex: 99 }, stroke: 'white' }, + void 0 + ), + ], + }, + void 0 + ), + jsx( + ThemedText.White, + __assign( + { fontWeight: 700, fontSize: 36 }, + { + children: jsxs( + Trans, + { + children: [ + unclaimedAmount === null || unclaimedAmount === void 0 + ? void 0 + : unclaimedAmount.toFixed( + 0, + (_b = { groupSeparator: ',' }) !== null && _b !== void 0 ? _b : '-' + ), + ' UNI', + ], + }, + void 0 + ), + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + jsx(Break$1, {}, void 0), + ], + }, + void 0 + ), + jsxs( + AutoColumn, + __assign( + { gap: 'md', style: { padding: '1rem', paddingTop: '0' }, justify: 'center' }, + { + children: [ + jsx( + ThemedText.SubHeader, + __assign( + { fontWeight: 500 }, + { + children: jsx( + Trans, + { + children: + 'Enter an address to trigger a UNI claim. If the address has any claimable UNI it will be sent to them on submission.', + }, + void 0 + ), + } + ), + void 0 + ), + jsx(AddressInputPanel, { value: typed, onChange: handleRecipientType }, void 0), + parsedAddress && + !hasAvailableClaim && + jsx( + ThemedText.Error, + __assign( + { error: true }, + { children: jsx(Trans, { children: 'Address has no available claim' }, void 0) } + ), + void 0 + ), + jsx( + ButtonPrimary, + __assign( + { + disabled: + !isAddress$1( + parsedAddress !== null && parsedAddress !== void 0 ? parsedAddress : '' + ) || !hasAvailableClaim, + padding: '16px 16px', + width: '100%', + $borderRadius: '12px', + mt: '1rem', + onClick: onClaim, + }, + { children: jsx(Trans, { children: 'Claim UNI' }, void 0) } + ), + void 0 + ), + ], + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + (attempting || claimConfirmed) && + jsxs( + ConfirmOrLoadingWrapper$1, + __assign( + { activeBG: true }, + { + children: [ + jsx(CardNoise, {}, void 0), + jsx(CardBGImageSmaller, { desaturate: true }, void 0), + jsxs( + RowBetween, + { + children: [ + jsx('div', {}, void 0), + jsx( + CloseIcon$2, + { onClick: wrappedOnDismiss, style: { zIndex: 99 }, stroke: 'black' }, + void 0 + ), + ], + }, + void 0 + ), + jsx( + ConfirmedIcon$2, + { + children: !claimConfirmed + ? jsx(CustomLightSpinner, { src: Circle$1, alt: 'loader', size: '90px' }, void 0) + : jsx(UniTokenAnimated, { width: '72px', src: tokenLogo, alt: 'UNI logo' }, void 0), + }, + void 0 + ), + jsxs( + AutoColumn, + __assign( + { gap: '100px', justify: 'center' }, + { + children: [ + jsxs( + AutoColumn, + __assign( + { gap: '12px', justify: 'center' }, + { + children: [ + jsx( + ThemedText.LargeHeader, + __assign( + { fontWeight: 600, color: 'black' }, + { + children: claimConfirmed + ? jsx(Trans, { children: 'Claimed' }, void 0) + : jsx(Trans, { children: 'Claiming' }, void 0), + } + ), + void 0 + ), + !claimConfirmed && + jsx( + Text$1, + __assign( + { fontSize: 36, color: '#ff007a', fontWeight: 800 }, + { + children: jsxs( + Trans, + { + children: [ + unclaimedAmount === null || unclaimedAmount === void 0 + ? void 0 + : unclaimedAmount.toFixed( + 0, + (_c = { groupSeparator: ',' }) !== null && _c !== void 0 + ? _c + : '-' + ), + ' UNI', + ], + }, + void 0 + ), + } + ), + void 0 + ), + parsedAddress && + jsx( + ThemedText.LargeHeader, + __assign( + { fontWeight: 600, color: 'black' }, + { + children: jsxs( + Trans, + { children: ['for ', shortenAddress(parsedAddress)] }, + void 0 + ), + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + claimConfirmed && + jsx( + Fragment, + { + children: jsxs( + ThemedText.SubHeader, + __assign( + { fontWeight: 500, color: 'black' }, + { + children: [ + jsxs( + 'span', + __assign( + { role: 'img', 'aria-label': 'party-hat' }, + { children: ['\uD83C\uDF89', ' '] } + ), + void 0 + ), + jsx(Trans, { children: 'Welcome to team Unicorn :) ' }, void 0), + jsx( + 'span', + __assign( + { role: 'img', 'aria-label': 'party-hat' }, + { children: '\uD83C\uDF89' } + ), + void 0 + ), + ], + } + ), + void 0 + ), + }, + void 0 + ), + attempting && + !hash && + jsx( + ThemedText.SubHeader, + __assign( + { color: 'black' }, + { + children: jsx( + Trans, + { children: 'Confirm this transaction in your wallet' }, + void 0 + ), + } + ), + void 0 + ), + attempting && + hash && + !claimConfirmed && + chainId && + hash && + jsx( + ExternalLink, + __assign( + { + href: getExplorerLink(chainId, hash, ExplorerDataType.TRANSACTION), + style: { zIndex: 99 }, + }, + { children: jsx(Trans, { children: 'View transaction on Explorer' }, void 0) } + ), + void 0 + ), + ], + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + ], + } + ), + void 0 + ) +} +var templateObject_1$1d, templateObject_2$T, templateObject_3$K, templateObject_4$z + +var _a$a +var ApplicationModal +;(function (ApplicationModal) { + ApplicationModal[(ApplicationModal['WALLET'] = 0)] = 'WALLET' + ApplicationModal[(ApplicationModal['SETTINGS'] = 1)] = 'SETTINGS' + ApplicationModal[(ApplicationModal['SELF_CLAIM'] = 2)] = 'SELF_CLAIM' + ApplicationModal[(ApplicationModal['ADDRESS_CLAIM'] = 3)] = 'ADDRESS_CLAIM' + ApplicationModal[(ApplicationModal['CLAIM_POPUP'] = 4)] = 'CLAIM_POPUP' + ApplicationModal[(ApplicationModal['MENU'] = 5)] = 'MENU' + ApplicationModal[(ApplicationModal['DELEGATE'] = 6)] = 'DELEGATE' + ApplicationModal[(ApplicationModal['VOTE'] = 7)] = 'VOTE' + ApplicationModal[(ApplicationModal['POOL_OVERVIEW_OPTIONS'] = 8)] = 'POOL_OVERVIEW_OPTIONS' + ApplicationModal[(ApplicationModal['NETWORK_SELECTOR'] = 9)] = 'NETWORK_SELECTOR' + ApplicationModal[(ApplicationModal['PRIVACY_POLICY'] = 10)] = 'PRIVACY_POLICY' +})(ApplicationModal || (ApplicationModal = {})) +var initialState$8 = { + chainId: null, + openModal: null, + popupList: [], +} +var applicationSlice = createSlice({ + name: 'application', + initialState: initialState$8, + reducers: { + updateChainId(state, action) { + var chainId = action.payload.chainId + state.chainId = chainId + }, + setOpenModal(state, action) { + state.openModal = action.payload + }, + addPopup(state, _a) { + var _b = _a.payload, + content = _b.content, + key = _b.key, + _c = _b.removeAfterMs, + removeAfterMs = _c === void 0 ? DEFAULT_TXN_DISMISS_MS : _c + state.popupList = ( + key + ? state.popupList.filter(function (popup) { + return popup.key !== key + }) + : state.popupList + ).concat([ + { + key: key || nanoid(), + show: true, + content, + removeAfterMs, + }, + ]) + }, + removePopup(state, _a) { + var key = _a.payload.key + state.popupList.forEach(function (p) { + if (p.key === key) { + p.show = false + } + }) + }, + }, +}) +var updateChainId = ((_a$a = applicationSlice.actions), _a$a.updateChainId), + setOpenModal = _a$a.setOpenModal, + addPopup = _a$a.addPopup, + removePopup = _a$a.removePopup +var application = applicationSlice.reducer + +var Field$3 +;(function (Field) { + Field['LIQUIDITY_PERCENT'] = 'LIQUIDITY_PERCENT' + Field['LIQUIDITY'] = 'LIQUIDITY' + Field['CURRENCY_A'] = 'CURRENCY_A' + Field['CURRENCY_B'] = 'CURRENCY_B' +})(Field$3 || (Field$3 = {})) +var typeInput$3 = createAction('burn/typeInputBurn') + +var initialState$7 = { + independentField: Field$3.LIQUIDITY_PERCENT, + typedValue: '0', +} +var burn = createReducer(initialState$7, function (builder) { + return builder.addCase(typeInput$3, function (state, _a) { + var _b = _a.payload, + field = _b.field, + typedValue = _b.typedValue + return __assign(__assign({}, state), { independentField: field, typedValue }) + }) +}) + +var selectPercent = createAction('burnV3/selectBurnPercent') + +var initialState$6 = { + percent: 0, +} +var burnV3 = createReducer(initialState$6, function (builder) { + return builder.addCase(selectPercent, function (state, _a) { + var percent = _a.payload.percent + return __assign(__assign({}, state), { percent }) + }) +}) + +var _a$9 +// List of supported subgraphs. Note that the app currently only support one active subgraph at a time +var CHAIN_SUBGRAPH_URL = + ((_a$9 = {}), + (_a$9[SupportedChainId.MAINNET] = 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3'), + (_a$9[SupportedChainId.RINKEBY] = 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3'), + (_a$9[SupportedChainId.ARBITRUM_ONE] = 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-minimal'), + (_a$9[SupportedChainId.OPTIMISM] = 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-optimism-dev'), + (_a$9[SupportedChainId.POLYGON] = 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon'), + _a$9) +var api$1 = createApi({ + reducerPath: 'dataApi', + baseQuery: graphqlRequestBaseQuery(), + endpoints(builder) { + return { + allV3Ticks: builder.query({ + query(_a) { + var poolAddress = _a.poolAddress, + _b = _a.skip, + skip = _b === void 0 ? 0 : _b + return { + document: gql( + templateObject_1$1c || + (templateObject_1$1c = __makeTemplateObject( + [ + '\n query allV3Ticks($poolAddress: String!, $skip: Int!) {\n ticks(first: 1000, skip: $skip, where: { poolAddress: $poolAddress }, orderBy: tickIdx) {\n tick: tickIdx\n liquidityNet\n price0\n price1\n }\n }\n ', + ], + [ + '\n query allV3Ticks($poolAddress: String!, $skip: Int!) {\n ticks(first: 1000, skip: $skip, where: { poolAddress: $poolAddress }, orderBy: tickIdx) {\n tick: tickIdx\n liquidityNet\n price0\n price1\n }\n }\n ', + ] + )) + ), + variables: { + poolAddress, + skip, + }, + } + }, + }), + feeTierDistribution: builder.query({ + query(_a) { + var token0 = _a.token0, + token1 = _a.token1 + return { + document: gql( + templateObject_2$S || + (templateObject_2$S = __makeTemplateObject( + [ + '\n query feeTierDistribution($token0: String!, $token1: String!) {\n _meta {\n block {\n number\n }\n }\n asToken0: pools(\n orderBy: totalValueLockedToken0\n orderDirection: desc\n where: { token0: $token0, token1: $token1 }\n ) {\n feeTier\n totalValueLockedToken0\n totalValueLockedToken1\n }\n asToken1: pools(\n orderBy: totalValueLockedToken0\n orderDirection: desc\n where: { token0: $token1, token1: $token0 }\n ) {\n feeTier\n totalValueLockedToken0\n totalValueLockedToken1\n }\n }\n ', + ], + [ + '\n query feeTierDistribution($token0: String!, $token1: String!) {\n _meta {\n block {\n number\n }\n }\n asToken0: pools(\n orderBy: totalValueLockedToken0\n orderDirection: desc\n where: { token0: $token0, token1: $token1 }\n ) {\n feeTier\n totalValueLockedToken0\n totalValueLockedToken1\n }\n asToken1: pools(\n orderBy: totalValueLockedToken0\n orderDirection: desc\n where: { token0: $token1, token1: $token0 }\n ) {\n feeTier\n totalValueLockedToken0\n totalValueLockedToken1\n }\n }\n ', + ] + )) + ), + variables: { + token0, + token1, + }, + } + }, + }), + } + }, +}) +// Graphql query client wrapper that builds a dynamic url based on chain id +function graphqlRequestBaseQuery() { + var _this = this + return function (_a, _b) { + var document = _a.document, + variables = _a.variables + var getState = _b.getState + return __awaiter(_this, void 0, void 0, function () { + var chainId, subgraphUrl, error_1, name_1, message, stack, request, response + var _c + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + _d.trys.push([0, 2, , 3]) + chainId = getState().application.chainId + subgraphUrl = chainId ? CHAIN_SUBGRAPH_URL[chainId] : undefined + if (!subgraphUrl) { + return [ + 2 /*return*/, + { + error: { + name: 'UnsupportedChainId', + message: 'Subgraph queries against ChainId ' + chainId + ' are not supported.', + stack: '', + }, + }, + ] + } + _c = {} + return [4 /*yield*/, new GraphQLClient(subgraphUrl).request(document, variables)] + case 1: + return [2 /*return*/, ((_c.data = _d.sent()), (_c.meta = {}), _c)] + case 2: + error_1 = _d.sent() + if (error_1 instanceof ClientError) { + ;(name_1 = error_1.name), + (message = error_1.message), + (stack = error_1.stack), + (request = error_1.request), + (response = error_1.response) + return [ + 2 /*return*/, + { + error: { name: name_1, message, stack }, + meta: { request, response }, + }, + ] + } + throw error_1 + case 3: + return [2 /*return*/] + } + }) + }) + } +} +var templateObject_1$1c, templateObject_2$S + +// fired once when the app reloads but before the app renders +// allows any updates to be applied to store data loaded from localStorage +var updateVersion = createAction('global/updateVersion') + +var fetchTokenList = { + pending: createAction('lists/fetchTokenList/pending'), + fulfilled: createAction('lists/fetchTokenList/fulfilled'), + rejected: createAction('lists/fetchTokenList/rejected'), +} +// add and remove from list options +var addList = createAction('lists/addList') +var removeList = createAction('lists/removeList') +// select which lists to search across from loaded lists +var enableList = createAction('lists/enableList') +var disableList = createAction('lists/disableList') +// versioning +var acceptListUpdate = createAction('lists/acceptListUpdate') + +var NEW_LIST_STATE = { + error: null, + current: null, + loadingRequestId: null, + pendingUpdate: null, +} +var initialState$5 = { + lastInitializedDefaultListOfLists: DEFAULT_LIST_OF_LISTS, + byUrl: __assign( + {}, + DEFAULT_LIST_OF_LISTS.reduce(function (memo, listUrl) { + memo[listUrl] = NEW_LIST_STATE + return memo + }, {}) + ), + activeListUrls: DEFAULT_ACTIVE_LIST_URLS, +} +var lists = createReducer(initialState$5, function (builder) { + return builder + .addCase(fetchTokenList.pending, function (state, _a) { + var _b, _c, _d, _e + var _f = _a.payload, + requestId = _f.requestId, + url = _f.url + var current = + (_c = (_b = state.byUrl[url]) === null || _b === void 0 ? void 0 : _b.current) !== null && _c !== void 0 + ? _c + : null + var pendingUpdate = + (_e = (_d = state.byUrl[url]) === null || _d === void 0 ? void 0 : _d.pendingUpdate) !== null && _e !== void 0 + ? _e + : null + state.byUrl[url] = { + current, + pendingUpdate, + loadingRequestId: requestId, + error: null, + } + }) + .addCase(fetchTokenList.fulfilled, function (state, _a) { + var _b, _c, _d + var _e = _a.payload, + requestId = _e.requestId, + tokenList = _e.tokenList, + url = _e.url + var current = (_b = state.byUrl[url]) === null || _b === void 0 ? void 0 : _b.current + var loadingRequestId = (_c = state.byUrl[url]) === null || _c === void 0 ? void 0 : _c.loadingRequestId + // no-op if update does nothing + if (current) { + var upgradeType = getVersionUpgrade(current.version, tokenList.version) + if (upgradeType === VersionUpgrade.NONE) return + if (loadingRequestId === null || loadingRequestId === requestId) { + state.byUrl[url] = { + current, + pendingUpdate: tokenList, + loadingRequestId: null, + error: null, + } + } + } else { + // activate if on default active + if (DEFAULT_ACTIVE_LIST_URLS.includes(url)) { + ;(_d = state.activeListUrls) === null || _d === void 0 ? void 0 : _d.push(url) + } + state.byUrl[url] = { + current: tokenList, + pendingUpdate: null, + loadingRequestId: null, + error: null, + } + } + }) + .addCase(fetchTokenList.rejected, function (state, _a) { + var _b + var _c = _a.payload, + url = _c.url, + requestId = _c.requestId, + errorMessage = _c.errorMessage + if (((_b = state.byUrl[url]) === null || _b === void 0 ? void 0 : _b.loadingRequestId) !== requestId) { + // no-op since it's not the latest request + return + } + state.byUrl[url] = { + current: state.byUrl[url].current ? state.byUrl[url].current : null, + pendingUpdate: null, + loadingRequestId: null, + error: errorMessage, + } + }) + .addCase(addList, function (state, _a) { + var url = _a.payload + if (!state.byUrl[url]) { + state.byUrl[url] = NEW_LIST_STATE + } + }) + .addCase(removeList, function (state, _a) { + var url = _a.payload + if (state.byUrl[url]) { + delete state.byUrl[url] + } + // remove list from active urls if needed + if (state.activeListUrls && state.activeListUrls.includes(url)) { + state.activeListUrls = state.activeListUrls.filter(function (u) { + return u !== url + }) + } + }) + .addCase(enableList, function (state, _a) { + var url = _a.payload + if (!state.byUrl[url]) { + state.byUrl[url] = NEW_LIST_STATE + } + if (state.activeListUrls && !state.activeListUrls.includes(url)) { + state.activeListUrls.push(url) + } + if (!state.activeListUrls) { + state.activeListUrls = [url] + } + }) + .addCase(disableList, function (state, _a) { + var url = _a.payload + if (state.activeListUrls && state.activeListUrls.includes(url)) { + state.activeListUrls = state.activeListUrls.filter(function (u) { + return u !== url + }) + } + }) + .addCase(acceptListUpdate, function (state, _a) { + var _b + var url = _a.payload + if (!((_b = state.byUrl[url]) === null || _b === void 0 ? void 0 : _b.pendingUpdate)) { + throw new Error('accept list update called without pending update') + } + state.byUrl[url] = __assign(__assign({}, state.byUrl[url]), { + current: state.byUrl[url].pendingUpdate, + pendingUpdate: null, + }) + }) + .addCase(updateVersion, function (state) { + // state loaded from localStorage, but new lists have never been initialized + if (!state.lastInitializedDefaultListOfLists) { + state.byUrl = initialState$5.byUrl + state.activeListUrls = initialState$5.activeListUrls + } else if (state.lastInitializedDefaultListOfLists) { + var lastInitializedSet_1 = state.lastInitializedDefaultListOfLists.reduce(function (s, l) { + return s.add(l) + }, new Set()) + var newListOfListsSet_1 = DEFAULT_LIST_OF_LISTS.reduce(function (s, l) { + return s.add(l) + }, new Set()) + DEFAULT_LIST_OF_LISTS.forEach(function (listUrl) { + if (!lastInitializedSet_1.has(listUrl)) { + state.byUrl[listUrl] = NEW_LIST_STATE + } + }) + state.lastInitializedDefaultListOfLists.forEach(function (listUrl) { + if (!newListOfListsSet_1.has(listUrl)) { + delete state.byUrl[listUrl] + } + }) + } + state.lastInitializedDefaultListOfLists = DEFAULT_LIST_OF_LISTS + // if no active lists, activate defaults + if (!state.activeListUrls) { + state.activeListUrls = DEFAULT_ACTIVE_LIST_URLS + // for each list on default list, initialize if needed + DEFAULT_ACTIVE_LIST_URLS.map(function (listUrl) { + if (!state.byUrl[listUrl]) { + state.byUrl[listUrl] = NEW_LIST_STATE + } + return true + }) + } + }) +}) + +/** + * Converts a filter to the corresponding string key + * @param filter the filter to convert + */ +function filterToKey(filter) { + var _a, _b, _c, _d + return ( + ((_a = filter.address) !== null && _a !== void 0 ? _a : '') + + ':' + + ((_d = + (_c = + (_b = filter.topics) === null || _b === void 0 + ? void 0 + : _b.map(function (topic) { + return topic ? (Array.isArray(topic) ? topic.join(';') : topic) : '\0' + })) === null || _c === void 0 + ? void 0 + : _c.join('-')) !== null && _d !== void 0 + ? _d + : '') + ) +} +/** + * Convert a filter key to the corresponding filter + * @param key key to convert + */ +function keyToFilter(key) { + var pcs = key.split(':') + var address = pcs[0] + var topics = pcs[1].split('-').map(function (topic) { + if (topic === '\0') return null + var parts = topic.split(';') + if (parts.length === 1) return parts[0] + return parts + }) + return { + address: address.length === 0 ? undefined : address, + topics, + } +} + +var _a$8 +var slice = createSlice({ + name: 'logs', + initialState: {}, + reducers: { + addListener(state, _a) { + var _b = _a.payload, + chainId = _b.chainId, + filter = _b.filter + if (!state[chainId]) state[chainId] = {} + var key = filterToKey(filter) + if (!state[chainId][key]) + state[chainId][key] = { + listeners: 1, + } + else state[chainId][key].listeners++ + }, + fetchingLogs(state, _a) { + var e_1, _b + var _c = _a.payload, + chainId = _c.chainId, + filters = _c.filters, + blockNumber = _c.blockNumber + if (!state[chainId]) return + try { + for ( + var filters_1 = __values(filters), filters_1_1 = filters_1.next(); + !filters_1_1.done; + filters_1_1 = filters_1.next() + ) { + var filter = filters_1_1.value + var key = filterToKey(filter) + if (!state[chainId][key]) continue + state[chainId][key].fetchingBlockNumber = blockNumber + } + } catch (e_1_1) { + e_1 = { error: e_1_1 } + } finally { + try { + if (filters_1_1 && !filters_1_1.done && (_b = filters_1.return)) _b.call(filters_1) + } finally { + if (e_1) throw e_1.error + } + } + }, + fetchedLogs(state, _a) { + var _b = _a.payload, + chainId = _b.chainId, + filter = _b.filter, + results = _b.results + if (!state[chainId]) return + var key = filterToKey(filter) + var fetchState = state[chainId][key] + if (!fetchState || (fetchState.results && fetchState.results.blockNumber > results.blockNumber)) return + fetchState.results = results + }, + fetchedLogsError(state, _a) { + var _b = _a.payload, + chainId = _b.chainId, + filter = _b.filter, + blockNumber = _b.blockNumber + if (!state[chainId]) return + var key = filterToKey(filter) + var fetchState = state[chainId][key] + if (!fetchState || (fetchState.results && fetchState.results.blockNumber > blockNumber)) return + fetchState.results = { + blockNumber, + error: true, + } + }, + removeListener(state, _a) { + var _b = _a.payload, + chainId = _b.chainId, + filter = _b.filter + if (!state[chainId]) return + var key = filterToKey(filter) + if (!state[chainId][key]) return + state[chainId][key].listeners-- + }, + }, +}) +var logs = slice.reducer +;(_a$8 = slice.actions), _a$8.addListener +_a$8.removeListener +var fetchedLogs = _a$8.fetchedLogs, + fetchedLogsError = _a$8.fetchedLogsError, + fetchingLogs = _a$8.fetchingLogs + +var Field$2 +;(function (Field) { + Field['CURRENCY_A'] = 'CURRENCY_A' + Field['CURRENCY_B'] = 'CURRENCY_B' +})(Field$2 || (Field$2 = {})) +var typeInput$2 = createAction('mint/typeInputMint') +var resetMintState$1 = createAction('mint/resetMintState') + +var initialState$4 = { + independentField: Field$2.CURRENCY_A, + typedValue: '', + otherTypedValue: '', + startPriceTypedValue: '', + leftRangeTypedValue: '', + rightRangeTypedValue: '', +} +var mint = createReducer(initialState$4, function (builder) { + return builder + .addCase(resetMintState$1, function () { + return initialState$4 + }) + .addCase(typeInput$2, function (state, _a) { + var _b = _a.payload, + field = _b.field, + typedValue = _b.typedValue, + noLiquidity = _b.noLiquidity + if (noLiquidity) { + // they're typing into the field they've last typed in + if (field === state.independentField) { + return __assign(__assign({}, state), { independentField: field, typedValue }) + } + // they're typing into a new field, store the other value + else { + return __assign(__assign({}, state), { + independentField: field, + typedValue, + otherTypedValue: state.typedValue, + }) + } + } else { + return __assign(__assign({}, state), { independentField: field, typedValue, otherTypedValue: '' }) + } + }) +}) + +var Field$1 +;(function (Field) { + Field['CURRENCY_A'] = 'CURRENCY_A' + Field['CURRENCY_B'] = 'CURRENCY_B' +})(Field$1 || (Field$1 = {})) +var Bound +;(function (Bound) { + Bound['LOWER'] = 'LOWER' + Bound['UPPER'] = 'UPPER' +})(Bound || (Bound = {})) +var typeInput$1 = createAction('mintV3/typeInputMint') +var typeStartPriceInput = createAction('mintV3/typeStartPriceInput') +var typeLeftRangeInput = createAction('mintV3/typeLeftRangeInput') +var typeRightRangeInput = createAction('mintV3/typeRightRangeInput') +var resetMintState = createAction('mintV3/resetMintState') +var setFullRange = createAction('mintV3/setFullRange') + +var initialState$3 = { + independentField: Field$1.CURRENCY_A, + typedValue: '', + startPriceTypedValue: '', + leftRangeTypedValue: '', + rightRangeTypedValue: '', +} +var mintV3 = createReducer(initialState$3, function (builder) { + return builder + .addCase(resetMintState, function () { + return initialState$3 + }) + .addCase(setFullRange, function (state) { + return __assign(__assign({}, state), { leftRangeTypedValue: true, rightRangeTypedValue: true }) + }) + .addCase(typeStartPriceInput, function (state, _a) { + var typedValue = _a.payload.typedValue + return __assign(__assign({}, state), { startPriceTypedValue: typedValue }) + }) + .addCase(typeLeftRangeInput, function (state, _a) { + var typedValue = _a.payload.typedValue + return __assign(__assign({}, state), { leftRangeTypedValue: typedValue }) + }) + .addCase(typeRightRangeInput, function (state, _a) { + var typedValue = _a.payload.typedValue + return __assign(__assign({}, state), { rightRangeTypedValue: typedValue }) + }) + .addCase(typeInput$1, function (state, _a) { + var _b = _a.payload, + field = _b.field, + typedValue = _b.typedValue, + noLiquidity = _b.noLiquidity + if (noLiquidity) { + // they're typing into the field they've last typed in + if (field === state.independentField) { + return __assign(__assign({}, state), { independentField: field, typedValue }) + } + // they're typing into a new field, store the other value + else { + return __assign(__assign({}, state), { independentField: field, typedValue }) + } + } else { + return __assign(__assign({}, state), { independentField: field, typedValue }) + } + }) +}) + +var protocols = [Protocol.V2, Protocol.V3] +var DEFAULT_QUERY_PARAMS = { + protocols: protocols + .map(function (p) { + return p.toLowerCase() + }) + .join(','), + // example other params + // forceCrossProtocol: 'true', + // minSplits: '5', +} +function getClientSideQuote(_a) { + var tokenInAddress = _a.tokenInAddress, + tokenInChainId = _a.tokenInChainId, + tokenInDecimals = _a.tokenInDecimals, + tokenInSymbol = _a.tokenInSymbol, + tokenOutAddress = _a.tokenOutAddress, + tokenOutChainId = _a.tokenOutChainId, + tokenOutDecimals = _a.tokenOutDecimals, + tokenOutSymbol = _a.tokenOutSymbol, + amount = _a.amount, + type = _a.type + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + return [ + 4 /*yield*/, + Promise.resolve().then(function () { + return index + }), + ] + case 1: + return [ + 2 /*return*/, + _b.sent().getQuote( + { + type, + chainId: tokenInChainId, + tokenIn: { + address: tokenInAddress, + chainId: tokenInChainId, + decimals: tokenInDecimals, + symbol: tokenInSymbol, + }, + tokenOut: { + address: tokenOutAddress, + chainId: tokenOutChainId, + decimals: tokenOutDecimals, + symbol: tokenOutSymbol, + }, + amount, + }, + { protocols } + ), + ] + } + }) + }) +} +var routingApi = createApi({ + reducerPath: 'routingApi', + baseQuery: fetchBaseQuery({ + baseUrl: 'https://api.uniswap.org/v1/', + }), + endpoints(build) { + return { + getQuote: build.query({ + queryFn(args, _api, _extraOptions, fetch) { + return __awaiter(this, void 0, void 0, function () { + var tokenInAddress, + tokenInChainId, + tokenOutAddress, + tokenOutChainId, + amount, + useClientSideRouter, + type, + result, + query, + e_1 + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + ;(tokenInAddress = args.tokenInAddress), + (tokenInChainId = args.tokenInChainId), + (tokenOutAddress = args.tokenOutAddress), + (tokenOutChainId = args.tokenOutChainId), + (amount = args.amount), + (useClientSideRouter = args.useClientSideRouter), + (type = args.type) + _a.label = 1 + case 1: + _a.trys.push([1, 6, , 7]) + if (!useClientSideRouter) return [3 /*break*/, 3] + return [4 /*yield*/, getClientSideQuote(args)] + case 2: + result = _a.sent() + return [3 /*break*/, 5] + case 3: + query = qs.stringify( + __assign(__assign({}, DEFAULT_QUERY_PARAMS), { + tokenInAddress, + tokenInChainId, + tokenOutAddress, + tokenOutChainId, + amount, + type, + }) + ) + return [4 /*yield*/, fetch('quote?' + query)] + case 4: + result = _a.sent() + _a.label = 5 + case 5: + return [2 /*return*/, { data: result.data }] + case 6: + e_1 = _a.sent() + // TODO: fall back to client-side quoter when auto router fails. + // deprecate 'legacy' v2/v3 routers first. + return [2 /*return*/, { error: e_1 }] + case 7: + return [2 /*return*/] + } + }) + }) + }, + keepUnusedDataFor: ms(templateObject_1$1b || (templateObject_1$1b = __makeTemplateObject(['10s'], ['10s']))), + extraOptions: { + maxRetries: 0, + }, + }), + } + }, +}) +var useGetQuoteQuery = routingApi.useGetQuoteQuery +var templateObject_1$1b + +var Field +;(function (Field) { + Field['INPUT'] = 'INPUT' + Field['OUTPUT'] = 'OUTPUT' +})(Field || (Field = {})) +var selectCurrency = createAction('swap/selectCurrency') +var switchCurrencies = createAction('swap/switchCurrencies') +var typeInput = createAction('swap/typeInput') +var replaceSwapState = createAction('swap/replaceSwapState') +var setRecipient = createAction('swap/setRecipient') + +var CHAIN_DATA_ABI = [ + { + inputs: [], + name: 'latestAnswer', + outputs: [{ internalType: 'int256', name: '', type: 'int256' }], + stateMutability: 'view', + type: 'function', + }, +] +/** + * Returns the price of 1 gas in WEI for the currently selected network using the chainlink fast gas price oracle + */ +function useGasPrice() { + var _a, _b + var address = useENSAddress('fast-gas-gwei.data.eth').address + var contract = useContract(address !== null && address !== void 0 ? address : undefined, CHAIN_DATA_ABI, false) + var resultStr = + (_b = (_a = useSingleCallResult(contract, 'latestAnswer').result) === null || _a === void 0 ? void 0 : _a[0]) === + null || _b === void 0 + ? void 0 + : _b.toString() + return typeof resultStr === 'string' ? JSBI.BigInt(resultStr) : undefined +} + +/** + * Parses a CurrencyAmount from the passed string. + * Returns the CurrencyAmount, or undefined if parsing fails. + */ +function tryParseCurrencyAmount(value, currency) { + if (!value || !currency) { + return undefined + } + try { + var typedValueParsed = parseUnits(value, currency.decimals).toString() + if (typedValueParsed !== '0') { + return CurrencyAmount.fromRawAmount(currency, JSBI.BigInt(typedValueParsed)) + } + } catch (error) { + // fails if the user specifies too many decimal places of precision (or maybe exceed max uint?) + console.debug('Failed to parse input amount: "' + value + '"', error) + } + return undefined +} + +// returns whether tradeB is better than tradeA by at least a threshold percentage amount +// only used by v2 hooks +function isTradeBetter(tradeA, tradeB, minimumDelta) { + if (minimumDelta === void 0) { + minimumDelta = ZERO_PERCENT + } + if (tradeA && !tradeB) return false + if (tradeB && !tradeA) return true + if (!tradeA || !tradeB) return undefined + if ( + tradeA.tradeType !== tradeB.tradeType || + !tradeA.inputAmount.currency.equals(tradeB.inputAmount.currency) || + !tradeA.outputAmount.currency.equals(tradeB.outputAmount.currency) + ) { + throw new Error('Comparing incomparable trades') + } + if (minimumDelta.equalTo(ZERO_PERCENT)) { + return tradeA.executionPrice.lessThan(tradeB.executionPrice) + } else { + return tradeA.executionPrice.asFraction + .multiply(minimumDelta.add(ONE_HUNDRED_PERCENT)) + .lessThan(tradeB.executionPrice) + } +} + +function useAllCurrencyCombinations(currencyA, currencyB) { + var chainId = currencyA === null || currencyA === void 0 ? void 0 : currencyA.chainId + var _a = __read( + chainId + ? [ + currencyA === null || currencyA === void 0 ? void 0 : currencyA.wrapped, + currencyB === null || currencyB === void 0 ? void 0 : currencyB.wrapped, + ] + : [undefined, undefined], + 2 + ), + tokenA = _a[0], + tokenB = _a[1] + var bases = useMemo( + function () { + var _a, _b, _c, _d, _e + if (!chainId || chainId !== (tokenB === null || tokenB === void 0 ? void 0 : tokenB.chainId)) return [] + var common = (_a = BASES_TO_CHECK_TRADES_AGAINST[chainId]) !== null && _a !== void 0 ? _a : [] + var additionalA = tokenA + ? (_c = (_b = ADDITIONAL_BASES[chainId]) === null || _b === void 0 ? void 0 : _b[tokenA.address]) !== null && + _c !== void 0 + ? _c + : [] + : [] + var additionalB = tokenB + ? (_e = (_d = ADDITIONAL_BASES[chainId]) === null || _d === void 0 ? void 0 : _d[tokenB.address]) !== null && + _e !== void 0 + ? _e + : [] + : [] + return __spreadArray( + __spreadArray(__spreadArray([], __read(common), false), __read(additionalA), false), + __read(additionalB), + false + ) + }, + [chainId, tokenA, tokenB] + ) + var basePairs = useMemo( + function () { + return ( + bases + .flatMap(function (base) { + return bases.map(function (otherBase) { + return [base, otherBase] + }) + }) + // though redundant with the first filter below, that expression runs more often, so this is probably worthwhile + .filter(function (_a) { + var _b = __read(_a, 2), + t0 = _b[0], + t1 = _b[1] + return !t0.equals(t1) + }) + ) + }, + [bases] + ) + return useMemo( + function () { + return tokenA && tokenB + ? __spreadArray( + __spreadArray( + __spreadArray( + [ + // the direct pair + [tokenA, tokenB], + ], + __read( + bases.map(function (base) { + return [tokenA, base] + }) + ), + false + ), + __read( + bases.map(function (base) { + return [tokenB, base] + }) + ), + false + ), + __read(basePairs), + false + ) + .filter(function (_a) { + var _b = __read(_a, 2), + t0 = _b[0], + t1 = _b[1] + return !t0.equals(t1) + }) + // filter out duplicate pairs + .filter(function (_a, i, otherPairs) { + var _b = __read(_a, 2), + t0 = _b[0], + t1 = _b[1] + // find the first index in the array at which there are the same 2 tokens as the current + var firstIndexInOtherPairs = otherPairs.findIndex(function (_a) { + var _b = __read(_a, 2), + t0Other = _b[0], + t1Other = _b[1] + return (t0.equals(t0Other) && t1.equals(t1Other)) || (t0.equals(t1Other) && t1.equals(t0Other)) + }) + // only accept the first occurrence of the same 2 tokens + return firstIndexInOtherPairs === i + }) + // optionally filter out some pairs for tokens with custom bases defined + .filter(function (_a) { + var _b = __read(_a, 2), + tokenA = _b[0], + tokenB = _b[1] + if (!chainId) return true + var customBases = CUSTOM_BASES[chainId] + var customBasesA = customBases === null || customBases === void 0 ? void 0 : customBases[tokenA.address] + var customBasesB = customBases === null || customBases === void 0 ? void 0 : customBases[tokenB.address] + if (!customBasesA && !customBasesB) return true + if ( + customBasesA && + !customBasesA.find(function (base) { + return tokenB.equals(base) + }) + ) + return false + if ( + customBasesB && + !customBasesB.find(function (base) { + return tokenA.equals(base) + }) + ) + return false + return true + }) + : [] + }, + [tokenA, tokenB, bases, basePairs, chainId] + ) +} + +var PAIR_INTERFACE = new Interface(abi$4) +var PairState +;(function (PairState) { + PairState[(PairState['LOADING'] = 0)] = 'LOADING' + PairState[(PairState['NOT_EXISTS'] = 1)] = 'NOT_EXISTS' + PairState[(PairState['EXISTS'] = 2)] = 'EXISTS' + PairState[(PairState['INVALID'] = 3)] = 'INVALID' +})(PairState || (PairState = {})) +function useV2Pairs(currencies) { + var tokens = useMemo( + function () { + return currencies.map(function (_a) { + var _b = __read(_a, 2), + currencyA = _b[0], + currencyB = _b[1] + return [ + currencyA === null || currencyA === void 0 ? void 0 : currencyA.wrapped, + currencyB === null || currencyB === void 0 ? void 0 : currencyB.wrapped, + ] + }) + }, + [currencies] + ) + var pairAddresses = useMemo( + function () { + return tokens.map(function (_a) { + var _b = __read(_a, 2), + tokenA = _b[0], + tokenB = _b[1] + return tokenA && + tokenB && + tokenA.chainId === tokenB.chainId && + !tokenA.equals(tokenB) && + V2_FACTORY_ADDRESSES[tokenA.chainId] + ? computePairAddress({ factoryAddress: V2_FACTORY_ADDRESSES[tokenA.chainId], tokenA, tokenB }) + : undefined + }) + }, + [tokens] + ) + var results = useMultipleContractSingleData(pairAddresses, PAIR_INTERFACE, 'getReserves') + return useMemo( + function () { + return results.map(function (result, i) { + var reserves = result.result, + loading = result.loading + var tokenA = tokens[i][0] + var tokenB = tokens[i][1] + if (loading) return [PairState.LOADING, null] + if (!tokenA || !tokenB || tokenA.equals(tokenB)) return [PairState.INVALID, null] + if (!reserves) return [PairState.NOT_EXISTS, null] + var reserve0 = reserves.reserve0, + reserve1 = reserves.reserve1 + var _a = __read(tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA], 2), + token0 = _a[0], + token1 = _a[1] + return [ + PairState.EXISTS, + new Pair( + CurrencyAmount.fromRawAmount(token0, reserve0.toString()), + CurrencyAmount.fromRawAmount(token1, reserve1.toString()) + ), + ] + }) + }, + [results, tokens] + ) +} + +function useAllCommonPairs(currencyA, currencyB) { + var allCurrencyCombinations = useAllCurrencyCombinations(currencyA, currencyB) + var allPairs = useV2Pairs(allCurrencyCombinations) + return useMemo( + function () { + return Object.values( + allPairs + // filter out invalid pairs + .filter(function (result) { + return Boolean(result[0] === PairState.EXISTS && result[1]) + }) + .map(function (_a) { + var _b = __read(_a, 2), + pair = _b[1] + return pair + }) + ) + }, + [allPairs] + ) +} +var MAX_HOPS = 3 +/** + * Returns the best v2 trade for a desired swap + * @param tradeType whether the swap is an exact in/out + * @param amountSpecified the exact amount to swap in/out + * @param otherCurrency the desired output/payment currency + */ +function useBestV2Trade(tradeType, amountSpecified, otherCurrency, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.maxHops, + maxHops = _c === void 0 ? MAX_HOPS : _c + var _d = __read( + useMemo( + function () { + return tradeType === TradeType.EXACT_INPUT + ? [ + amountSpecified === null || amountSpecified === void 0 ? void 0 : amountSpecified.currency, + otherCurrency, + ] + : [ + otherCurrency, + amountSpecified === null || amountSpecified === void 0 ? void 0 : amountSpecified.currency, + ] + }, + [tradeType, amountSpecified, otherCurrency] + ), + 2 + ), + currencyIn = _d[0], + currencyOut = _d[1] + var allowedPairs = useAllCommonPairs(currencyIn, currencyOut) + return useMemo( + function () { + var _a, _b, _c, _d + if (amountSpecified && currencyIn && currencyOut && allowedPairs.length > 0) { + if (maxHops === 1) { + var options = { maxHops: 1, maxNumResults: 1 } + if (tradeType === TradeType.EXACT_INPUT) { + var amountIn = amountSpecified + return (_a = Trade.bestTradeExactIn(allowedPairs, amountIn, currencyOut, options)[0]) !== null && + _a !== void 0 + ? _a + : null + } else { + var amountOut = amountSpecified + return (_b = Trade.bestTradeExactOut(allowedPairs, currencyIn, amountOut, options)[0]) !== null && + _b !== void 0 + ? _b + : null + } + } + // search through trades with varying hops, find best trade out of them + var bestTradeSoFar = null + for (var i = 1; i <= maxHops; i++) { + var options = { maxHops: i, maxNumResults: 1 } + var currentTrade = void 0 + if (tradeType === TradeType.EXACT_INPUT) { + var amountIn = amountSpecified + currentTrade = + (_c = Trade.bestTradeExactIn(allowedPairs, amountIn, currencyOut, options)[0]) !== null && _c !== void 0 + ? _c + : null + } else { + var amountOut = amountSpecified + currentTrade = + (_d = Trade.bestTradeExactOut(allowedPairs, currencyIn, amountOut, options)[0]) !== null && _d !== void 0 + ? _d + : null + } + // if current trade is best yet, save it + if (isTradeBetter(bestTradeSoFar, currentTrade, BETTER_TRADE_LESS_HOPS_THRESHOLD)) { + bestTradeSoFar = currentTrade + } + } + return bestTradeSoFar + } + return null + }, + [tradeType, amountSpecified, currencyIn, currencyOut, allowedPairs, maxHops] + ) +} + +var TradeState +;(function (TradeState) { + TradeState[(TradeState['LOADING'] = 0)] = 'LOADING' + TradeState[(TradeState['INVALID'] = 1)] = 'INVALID' + TradeState[(TradeState['NO_ROUTE_FOUND'] = 2)] = 'NO_ROUTE_FOUND' + TradeState[(TradeState['VALID'] = 3)] = 'VALID' + TradeState[(TradeState['SYNCING'] = 4)] = 'SYNCING' +})(TradeState || (TradeState = {})) +var InterfaceTrade = /** @class */ (function (_super) { + __extends(InterfaceTrade, _super) + function InterfaceTrade(_a) { + var gasUseEstimateUSD = _a.gasUseEstimateUSD, + routes = __rest(_a, ['gasUseEstimateUSD']) + var _this = _super.call(this, routes) || this + _this.gasUseEstimateUSD = gasUseEstimateUSD + return _this + } + return InterfaceTrade +})(Trade$1) + +var abi = [ + { + inputs: [], + name: 'feeGrowthGlobal0X128', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'feeGrowthGlobal1X128', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'liquidity', + outputs: [ + { + internalType: 'uint128', + name: '', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'index', + type: 'uint256', + }, + ], + name: 'observations', + outputs: [ + { + internalType: 'uint32', + name: 'blockTimestamp', + type: 'uint32', + }, + { + internalType: 'int56', + name: 'tickCumulative', + type: 'int56', + }, + { + internalType: 'uint160', + name: 'secondsPerLiquidityCumulativeX128', + type: 'uint160', + }, + { + internalType: 'bool', + name: 'initialized', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'key', + type: 'bytes32', + }, + ], + name: 'positions', + outputs: [ + { + internalType: 'uint128', + name: '_liquidity', + type: 'uint128', + }, + { + internalType: 'uint256', + name: 'feeGrowthInside0LastX128', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'feeGrowthInside1LastX128', + type: 'uint256', + }, + { + internalType: 'uint128', + name: 'tokensOwed0', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'tokensOwed1', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'protocolFees', + outputs: [ + { + internalType: 'uint128', + name: 'token0', + type: 'uint128', + }, + { + internalType: 'uint128', + name: 'token1', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'slot0', + outputs: [ + { + internalType: 'uint160', + name: 'sqrtPriceX96', + type: 'uint160', + }, + { + internalType: 'int24', + name: 'tick', + type: 'int24', + }, + { + internalType: 'uint16', + name: 'observationIndex', + type: 'uint16', + }, + { + internalType: 'uint16', + name: 'observationCardinality', + type: 'uint16', + }, + { + internalType: 'uint16', + name: 'observationCardinalityNext', + type: 'uint16', + }, + { + internalType: 'uint8', + name: 'feeProtocol', + type: 'uint8', + }, + { + internalType: 'bool', + name: 'unlocked', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'int16', + name: 'wordPosition', + type: 'int16', + }, + ], + name: 'tickBitmap', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'int24', + name: 'tick', + type: 'int24', + }, + ], + name: 'ticks', + outputs: [ + { + internalType: 'uint128', + name: 'liquidityGross', + type: 'uint128', + }, + { + internalType: 'int128', + name: 'liquidityNet', + type: 'int128', + }, + { + internalType: 'uint256', + name: 'feeGrowthOutside0X128', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'feeGrowthOutside1X128', + type: 'uint256', + }, + { + internalType: 'int56', + name: 'tickCumulativeOutside', + type: 'int56', + }, + { + internalType: 'uint160', + name: 'secondsPerLiquidityOutsideX128', + type: 'uint160', + }, + { + internalType: 'uint32', + name: 'secondsOutside', + type: 'uint32', + }, + { + internalType: 'bool', + name: 'initialized', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] + +var POOL_STATE_INTERFACE = new Interface(abi) +var PoolState +;(function (PoolState) { + PoolState[(PoolState['LOADING'] = 0)] = 'LOADING' + PoolState[(PoolState['NOT_EXISTS'] = 1)] = 'NOT_EXISTS' + PoolState[(PoolState['EXISTS'] = 2)] = 'EXISTS' + PoolState[(PoolState['INVALID'] = 3)] = 'INVALID' +})(PoolState || (PoolState = {})) +function usePools(poolKeys) { + var chainId = useActiveWeb3React().chainId + var transformed = useMemo( + function () { + return poolKeys.map(function (_a) { + var _b = __read(_a, 3), + currencyA = _b[0], + currencyB = _b[1], + feeAmount = _b[2] + if (!chainId || !currencyA || !currencyB || !feeAmount) return null + var tokenA = currencyA === null || currencyA === void 0 ? void 0 : currencyA.wrapped + var tokenB = currencyB === null || currencyB === void 0 ? void 0 : currencyB.wrapped + if (!tokenA || !tokenB || tokenA.equals(tokenB)) return null + var _c = __read(tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA], 2), + token0 = _c[0], + token1 = _c[1] + return [token0, token1, feeAmount] + }) + }, + [chainId, poolKeys] + ) + var poolAddresses = useMemo( + function () { + var v3CoreFactoryAddress = chainId && V3_CORE_FACTORY_ADDRESSES[chainId] + return transformed.map(function (value) { + if (!v3CoreFactoryAddress || !value) return undefined + return computePoolAddress({ + factoryAddress: v3CoreFactoryAddress, + tokenA: value[0], + tokenB: value[1], + fee: value[2], + }) + }) + }, + [chainId, transformed] + ) + var slot0s = useMultipleContractSingleData(poolAddresses, POOL_STATE_INTERFACE, 'slot0') + var liquidities = useMultipleContractSingleData(poolAddresses, POOL_STATE_INTERFACE, 'liquidity') + return useMemo( + function () { + return poolKeys.map(function (_key, index) { + var _a + var _b = __read((_a = transformed[index]) !== null && _a !== void 0 ? _a : [], 3), + token0 = _b[0], + token1 = _b[1], + fee = _b[2] + if (!token0 || !token1 || !fee) return [PoolState.INVALID, null] + var _c = slot0s[index], + slot0 = _c.result, + slot0Loading = _c.loading, + slot0Valid = _c.valid + var _d = liquidities[index], + liquidity = _d.result, + liquidityLoading = _d.loading, + liquidityValid = _d.valid + if (!slot0Valid || !liquidityValid) return [PoolState.INVALID, null] + if (slot0Loading || liquidityLoading) return [PoolState.LOADING, null] + if (!slot0 || !liquidity) return [PoolState.NOT_EXISTS, null] + if (!slot0.sqrtPriceX96 || slot0.sqrtPriceX96.eq(0)) return [PoolState.NOT_EXISTS, null] + try { + return [PoolState.EXISTS, new Pool$1(token0, token1, fee, slot0.sqrtPriceX96, liquidity[0], slot0.tick)] + } catch (error) { + console.error('Error when constructing the pool', error) + return [PoolState.NOT_EXISTS, null] + } + }) + }, + [liquidities, poolKeys, slot0s, transformed] + ) +} + +/** + * Returns all the existing pools that should be considered for swapping between an input currency and an output currency + * @param currencyIn the input currency + * @param currencyOut the output currency + */ +function useV3SwapPools(currencyIn, currencyOut) { + var chainId = useActiveWeb3React().chainId + var allCurrencyCombinations = useAllCurrencyCombinations(currencyIn, currencyOut) + var allCurrencyCombinationsWithAllFees = useMemo( + function () { + return allCurrencyCombinations.reduce(function (list, _a) { + var _b = __read(_a, 2), + tokenA = _b[0], + tokenB = _b[1] + return chainId === SupportedChainId.MAINNET + ? list.concat([ + [tokenA, tokenB, FeeAmount.LOW], + [tokenA, tokenB, FeeAmount.MEDIUM], + [tokenA, tokenB, FeeAmount.HIGH], + ]) + : list.concat([ + [tokenA, tokenB, FeeAmount.LOWEST], + [tokenA, tokenB, FeeAmount.LOW], + [tokenA, tokenB, FeeAmount.MEDIUM], + [tokenA, tokenB, FeeAmount.HIGH], + ]) + }, []) + }, + [allCurrencyCombinations, chainId] + ) + var pools = usePools(allCurrencyCombinationsWithAllFees) + return useMemo( + function () { + return { + pools: pools + .filter(function (tuple) { + return tuple[0] === PoolState.EXISTS && tuple[1] !== null + }) + .map(function (_a) { + var _b = __read(_a, 2), + pool = _b[1] + return pool + }), + loading: pools.some(function (_a) { + var _b = __read(_a, 1), + state = _b[0] + return state === PoolState.LOADING + }), + } + }, + [pools] + ) +} + +/** + * Returns true if poolA is equivalent to poolB + * @param poolA one of the two pools + * @param poolB the other pool + */ +function poolEquals(poolA, poolB) { + return ( + poolA === poolB || + (poolA.token0.equals(poolB.token0) && poolA.token1.equals(poolB.token1) && poolA.fee === poolB.fee) + ) +} +function computeAllRoutes(currencyIn, currencyOut, pools, chainId, currentPath, allPaths, startCurrencyIn, maxHops) { + var e_1, _a + if (currentPath === void 0) { + currentPath = [] + } + if (allPaths === void 0) { + allPaths = [] + } + if (startCurrencyIn === void 0) { + startCurrencyIn = currencyIn + } + if (maxHops === void 0) { + maxHops = 2 + } + var tokenIn = currencyIn === null || currencyIn === void 0 ? void 0 : currencyIn.wrapped + var tokenOut = currencyOut === null || currencyOut === void 0 ? void 0 : currencyOut.wrapped + if (!tokenIn || !tokenOut) throw new Error('Missing tokenIn/tokenOut') + var _loop_1 = function (pool) { + if ( + !pool.involvesToken(tokenIn) || + currentPath.find(function (pathPool) { + return poolEquals(pool, pathPool) + }) + ) + return 'continue' + var outputToken = pool.token0.equals(tokenIn) ? pool.token1 : pool.token0 + if (outputToken.equals(tokenOut)) { + allPaths.push( + new Route$1( + __spreadArray(__spreadArray([], __read(currentPath), false), [pool], false), + startCurrencyIn, + currencyOut + ) + ) + } else if (maxHops > 1) { + computeAllRoutes( + outputToken, + currencyOut, + pools, + chainId, + __spreadArray(__spreadArray([], __read(currentPath), false), [pool], false), + allPaths, + startCurrencyIn, + maxHops - 1 + ) + } + } + try { + for (var pools_1 = __values(pools), pools_1_1 = pools_1.next(); !pools_1_1.done; pools_1_1 = pools_1.next()) { + var pool = pools_1_1.value + _loop_1(pool) + } + } catch (e_1_1) { + e_1 = { error: e_1_1 } + } finally { + try { + if (pools_1_1 && !pools_1_1.done && (_a = pools_1.return)) _a.call(pools_1) + } finally { + if (e_1) throw e_1.error + } + } + return allPaths +} +/** + * Returns all the routes from an input currency to an output currency + * @param currencyIn the input currency + * @param currencyOut the output currency + */ +function useAllV3Routes(currencyIn, currencyOut) { + var chainId = useActiveWeb3React().chainId + var _a = useV3SwapPools(currencyIn, currencyOut), + pools = _a.pools, + poolsLoading = _a.loading + return useMemo( + function () { + if (poolsLoading || !chainId || !pools || !currencyIn || !currencyOut) return { loading: true, routes: [] } + var routes = computeAllRoutes(currencyIn, currencyOut, pools, chainId, [], [], currencyIn, 2) + return { loading: false, routes } + }, + [chainId, currencyIn, currencyOut, pools, poolsLoading] + ) +} + +var _a$7 +var QUOTE_GAS_OVERRIDES = + ((_a$7 = {}), + (_a$7[SupportedChainId.ARBITRUM_ONE] = 25000000), + (_a$7[SupportedChainId.ARBITRUM_RINKEBY] = 25000000), + _a$7) +var DEFAULT_GAS_QUOTE = 2000000 +/** + * Returns the best v3 trade for a desired swap + * @param tradeType whether the swap is an exact in/out + * @param amountSpecified the exact amount to swap in/out + * @param otherCurrency the desired output/payment currency + */ +function useClientSideV3Trade(tradeType, amountSpecified, otherCurrency) { + var _a + var _b = __read( + useMemo( + function () { + return tradeType === TradeType.EXACT_INPUT + ? [ + amountSpecified === null || amountSpecified === void 0 ? void 0 : amountSpecified.currency, + otherCurrency, + ] + : [ + otherCurrency, + amountSpecified === null || amountSpecified === void 0 ? void 0 : amountSpecified.currency, + ] + }, + [tradeType, amountSpecified, otherCurrency] + ), + 2 + ), + currencyIn = _b[0], + currencyOut = _b[1] + var _c = useAllV3Routes(currencyIn, currencyOut), + routes = _c.routes, + routesLoading = _c.loading + var quoter = useV3Quoter() + var chainId = useActiveWeb3React().chainId + var quotesResults = useSingleContractWithCallData( + quoter, + amountSpecified + ? routes.map(function (route) { + return SwapQuoter.quoteCallParameters(route, amountSpecified, tradeType).calldata + }) + : [], + { + gasRequired: chainId + ? (_a = QUOTE_GAS_OVERRIDES[chainId]) !== null && _a !== void 0 + ? _a + : DEFAULT_GAS_QUOTE + : undefined, + } + ) + return useMemo( + function () { + if ( + !amountSpecified || + !currencyIn || + !currencyOut || + quotesResults.some(function (_a) { + var valid = _a.valid + return !valid + }) || + // skip when tokens are the same + (tradeType === TradeType.EXACT_INPUT + ? amountSpecified.currency.equals(currencyOut) + : amountSpecified.currency.equals(currencyIn)) + ) { + return { + state: TradeState.INVALID, + trade: undefined, + } + } + if ( + routesLoading || + quotesResults.some(function (_a) { + var loading = _a.loading + return loading + }) + ) { + return { + state: TradeState.LOADING, + trade: undefined, + } + } + var _a = quotesResults.reduce( + function (currentBest, _a, i) { + var result = _a.result + if (!result) return currentBest + // overwrite the current best if it's not defined or if this route is better + if (tradeType === TradeType.EXACT_INPUT) { + var amountOut_1 = CurrencyAmount.fromRawAmount(currencyOut, result.amountOut.toString()) + if ( + currentBest.amountOut === null || + JSBI.lessThan(currentBest.amountOut.quotient, amountOut_1.quotient) + ) { + return { + bestRoute: routes[i], + amountIn: amountSpecified, + amountOut: amountOut_1, + } + } + } else { + var amountIn_1 = CurrencyAmount.fromRawAmount(currencyIn, result.amountIn.toString()) + if ( + currentBest.amountIn === null || + JSBI.greaterThan(currentBest.amountIn.quotient, amountIn_1.quotient) + ) { + return { + bestRoute: routes[i], + amountIn: amountIn_1, + amountOut: amountSpecified, + } + } + } + return currentBest + }, + { + bestRoute: null, + amountIn: null, + amountOut: null, + } + ), + bestRoute = _a.bestRoute, + amountIn = _a.amountIn, + amountOut = _a.amountOut + if (!bestRoute || !amountIn || !amountOut) { + return { + state: TradeState.NO_ROUTE_FOUND, + trade: undefined, + } + } + return { + state: TradeState.VALID, + trade: new InterfaceTrade({ + v2Routes: [], + v3Routes: [ + { + routev3: bestRoute, + inputAmount: amountIn, + outputAmount: amountOut, + }, + ], + tradeType, + }), + } + }, + [amountSpecified, currencyIn, currencyOut, quotesResults, routes, routesLoading, tradeType] + ) +} + +var _a$6 +// Stablecoin amounts used when calculating spot price for a given currency. +// The amount is large enough to filter low liquidity pairs. +var STABLECOIN_AMOUNT_OUT = + ((_a$6 = {}), + (_a$6[SupportedChainId.MAINNET] = CurrencyAmount.fromRawAmount(USDC, 100000000000)), + (_a$6[SupportedChainId.ARBITRUM_ONE] = CurrencyAmount.fromRawAmount(USDC_ARBITRUM, 10000000000)), + (_a$6[SupportedChainId.OPTIMISM] = CurrencyAmount.fromRawAmount(DAI_OPTIMISM, 1e22)), + (_a$6[SupportedChainId.POLYGON] = CurrencyAmount.fromRawAmount(USDC_POLYGON, 10000000000)), + _a$6) +/** + * Returns the price in USDC of the input currency + * @param currency currency to compute the USDC price of + */ +function useUSDCPrice(currency) { + var chainId = currency === null || currency === void 0 ? void 0 : currency.chainId + var amountOut = chainId ? STABLECOIN_AMOUNT_OUT[chainId] : undefined + var stablecoin = amountOut === null || amountOut === void 0 ? void 0 : amountOut.currency + // TODO(#2808): remove dependency on useBestV2Trade + var v2USDCTrade = useBestV2Trade(TradeType.EXACT_OUTPUT, amountOut, currency, { + maxHops: 2, + }) + var v3USDCTrade = useClientSideV3Trade(TradeType.EXACT_OUTPUT, amountOut, currency) + return useMemo( + function () { + if (!currency || !stablecoin) { + return undefined + } + // handle usdc + if (currency === null || currency === void 0 ? void 0 : currency.wrapped.equals(stablecoin)) { + return new Price(stablecoin, stablecoin, '1', '1') + } + // use v2 price if available, v3 as fallback + if (v2USDCTrade) { + var _a = v2USDCTrade.route.midPrice, + numerator = _a.numerator, + denominator = _a.denominator + return new Price(currency, stablecoin, denominator, numerator) + } else if (v3USDCTrade.trade) { + var _b = v3USDCTrade.trade.routes[0].midPrice, + numerator = _b.numerator, + denominator = _b.denominator + return new Price(currency, stablecoin, denominator, numerator) + } + return undefined + }, + [currency, stablecoin, v2USDCTrade, v3USDCTrade.trade] + ) +} +function useUSDCValue(currencyAmount) { + var price = useUSDCPrice(currencyAmount === null || currencyAmount === void 0 ? void 0 : currencyAmount.currency) + return useMemo( + function () { + if (!price || !currencyAmount) return null + try { + return price.quote(currencyAmount) + } catch (error) { + return null + } + }, + [currencyAmount, price] + ) +} +/** + * + * @param fiatValue string representation of a USD amount + * @returns CurrencyAmount where currency is stablecoin on active chain + */ +function useStablecoinAmountFromFiatValue(fiatValue) { + var _a + var chainId = useActiveWeb3React().chainId + var stablecoin = chainId + ? (_a = STABLECOIN_AMOUNT_OUT[chainId]) === null || _a === void 0 + ? void 0 + : _a.currency + : undefined + if (fiatValue === null || fiatValue === undefined || !chainId || !stablecoin) { + return undefined + } + // trim for decimal precision when parsing + var parsedForDecimals = parseFloat(fiatValue).toFixed(stablecoin.decimals).toString() + try { + // parse USD string into CurrencyAmount based on stablecoin decimals + return tryParseCurrencyAmount(parsedForDecimals, stablecoin) + } catch (error) { + return undefined + } +} + +var V3_SWAP_DEFAULT_SLIPPAGE = new Percent(50, 10000) // .50% +var ONE_TENTHS_PERCENT = new Percent(10, 10000) // .10% +/** + * Return a guess of the gas cost used in computing slippage tolerance for a given trade + * @param trade the trade for which to _guess_ the amount of gas it would cost to execute + */ +function guesstimateGas(trade) { + if (!!trade) { + return ( + 100000 + + trade.swaps.reduce(function (memo, swap) { + return swap.route.pools.length + memo + }, 0) * + 30000 + ) + } + return undefined +} +var MIN_AUTO_SLIPPAGE_TOLERANCE = new Percent(5, 1000) // 0.5% +var MAX_AUTO_SLIPPAGE_TOLERANCE = new Percent(25, 100) // 25% +/** + * Returns slippage tolerance based on values from current trade, gas estimates from api, and active network. + */ +function useAutoSlippageTolerance(trade) { + var chainId = useActiveWeb3React().chainId + var onL2 = chainId && L2_CHAIN_IDS.includes(chainId) + var outputDollarValue = useUSDCValue(trade === null || trade === void 0 ? void 0 : trade.outputAmount) + var nativeGasPrice = useGasPrice() + var gasEstimate = guesstimateGas(trade) + var nativeCurrency = useNativeCurrency() + var nativeCurrencyPrice = useUSDCPrice( + nativeCurrency !== null && nativeCurrency !== void 0 ? nativeCurrency : undefined + ) + return useMemo( + function () { + if (!trade || onL2) return ONE_TENTHS_PERCENT + var nativeGasCost = + nativeGasPrice && typeof gasEstimate === 'number' + ? JSBI.multiply(nativeGasPrice, JSBI.BigInt(gasEstimate)) + : undefined + var dollarGasCost = + nativeCurrency && nativeGasCost && nativeCurrencyPrice + ? nativeCurrencyPrice.quote(CurrencyAmount.fromRawAmount(nativeCurrency, nativeGasCost)) + : undefined + // if valid estimate from api and using api trade, use gas estimate from api + // NOTE - dont use gas estimate for L2s yet - need to verify accuracy + // if not, use local heuristic + var dollarCostToUse = + chainId && + SUPPORTED_GAS_ESTIMATE_CHAIN_IDS.includes(chainId) && + (trade === null || trade === void 0 ? void 0 : trade.gasUseEstimateUSD) + ? trade.gasUseEstimateUSD + : dollarGasCost + if (outputDollarValue && dollarCostToUse) { + // the rationale is that a user will not want their trade to fail for a loss due to slippage that is less than + // the cost of the gas of the failed transaction + var fraction = dollarCostToUse.asFraction.divide(outputDollarValue.asFraction) + var result = new Percent(fraction.numerator, fraction.denominator) + if (result.greaterThan(MAX_AUTO_SLIPPAGE_TOLERANCE)) return MAX_AUTO_SLIPPAGE_TOLERANCE + if (result.lessThan(MIN_AUTO_SLIPPAGE_TOLERANCE)) return MIN_AUTO_SLIPPAGE_TOLERANCE + return result + } + return V3_SWAP_DEFAULT_SLIPPAGE + }, + [trade, onL2, nativeGasPrice, gasEstimate, nativeCurrency, nativeCurrencyPrice, chainId, outputDollarValue] + ) +} + +/** + * Transforms a Routing API quote into an array of routes that can be used to create + * a `Trade`. + */ +function computeRoutes(currencyIn, currencyOut, tradeType, quoteResult) { + if (!quoteResult || !quoteResult.route || !currencyIn || !currencyOut) return undefined + if (quoteResult.route.length === 0) return [] + var parsedTokenIn = parseToken(quoteResult.route[0][0].tokenIn) + var parsedTokenOut = parseToken(quoteResult.route[0][quoteResult.route[0].length - 1].tokenOut) + if (parsedTokenIn.address !== currencyIn.wrapped.address) return undefined + if (parsedTokenOut.address !== currencyOut.wrapped.address) return undefined + var parsedCurrencyIn = currencyIn.isNative ? nativeOnChain(currencyIn.chainId) : parsedTokenIn + var parsedCurrencyOut = currencyOut.isNative ? nativeOnChain(currencyOut.chainId) : parsedTokenOut + try { + return quoteResult.route.map(function (route) { + if (route.length === 0) { + throw new Error('Expected route to have at least one pair or pool') + } + var rawAmountIn = route[0].amountIn + var rawAmountOut = route[route.length - 1].amountOut + if (!rawAmountIn || !rawAmountOut) { + throw new Error('Expected both amountIn and amountOut to be present') + } + return { + routev3: isV3Route(route) ? new Route$1(route.map(parsePool), parsedCurrencyIn, parsedCurrencyOut) : null, + routev2: !isV3Route(route) ? new Route$2(route.map(parsePair), parsedCurrencyIn, parsedCurrencyOut) : null, + inputAmount: CurrencyAmount.fromRawAmount(parsedCurrencyIn, rawAmountIn), + outputAmount: CurrencyAmount.fromRawAmount(parsedCurrencyOut, rawAmountOut), + } + }) + } catch (e) { + // `Route` constructor may throw if inputs/outputs are temporarily out of sync + // (RTK-Query always returns the latest data which may not be the right inputs/outputs) + // This is not fatal and will fix itself in future render cycles + console.error(e) + return undefined + } +} +function transformRoutesToTrade(route, tradeType, gasUseEstimateUSD) { + var _a, _b + return new InterfaceTrade({ + v2Routes: + (_a = + route === null || route === void 0 + ? void 0 + : route + .filter(function (r) { + return r.routev2 !== null + }) + .map(function (_a) { + var routev2 = _a.routev2, + inputAmount = _a.inputAmount, + outputAmount = _a.outputAmount + return { routev2, inputAmount, outputAmount } + })) !== null && _a !== void 0 + ? _a + : [], + v3Routes: + (_b = + route === null || route === void 0 + ? void 0 + : route + .filter(function (r) { + return r.routev3 !== null + }) + .map(function (_a) { + var routev3 = _a.routev3, + inputAmount = _a.inputAmount, + outputAmount = _a.outputAmount + return { routev3, inputAmount, outputAmount } + })) !== null && _b !== void 0 + ? _b + : [], + tradeType, + gasUseEstimateUSD, + }) +} +var parseToken = function (_a) { + var address = _a.address, + chainId = _a.chainId, + decimals = _a.decimals, + symbol = _a.symbol + return new Token(chainId, address, parseInt(decimals.toString()), symbol) +} +var parsePool = function (_a) { + var fee = _a.fee, + sqrtRatioX96 = _a.sqrtRatioX96, + liquidity = _a.liquidity, + tickCurrent = _a.tickCurrent, + tokenIn = _a.tokenIn, + tokenOut = _a.tokenOut + return new Pool$1( + parseToken(tokenIn), + parseToken(tokenOut), + parseInt(fee), + sqrtRatioX96, + liquidity, + parseInt(tickCurrent) + ) +} +var parsePair = function (_a) { + var reserve0 = _a.reserve0, + reserve1 = _a.reserve1 + return new Pair( + CurrencyAmount.fromRawAmount(parseToken(reserve0.token), reserve0.quotient), + CurrencyAmount.fromRawAmount(parseToken(reserve1.token), reserve1.quotient) + ) +} +function isV3Route(route) { + return route[0].type === 'v3-pool' +} + +function useFreshData(data, dataBlockNumber, maxBlockAge) { + if (maxBlockAge === void 0) { + maxBlockAge = 10 + } + var localBlockNumber = useBlockNumber() + if (!localBlockNumber) return undefined + if (localBlockNumber - dataBlockNumber > maxBlockAge) { + return undefined + } + return data +} +/** + * Returns query arguments for the Routing API query or undefined if the + * query should be skipped. + */ +function useRoutingAPIArguments(_a) { + var tokenIn = _a.tokenIn, + tokenOut = _a.tokenOut, + amount = _a.amount, + tradeType = _a.tradeType + var _b = __read(useClientSideRouter(), 1), + clientSideRouter = _b[0] + return useMemo( + function () { + return !tokenIn || !tokenOut || !amount || tokenIn.equals(tokenOut) + ? undefined + : { + amount: amount.quotient.toString(), + tokenInAddress: tokenIn.wrapped.address, + tokenInChainId: tokenIn.wrapped.chainId, + tokenInDecimals: tokenIn.wrapped.decimals, + tokenInSymbol: tokenIn.wrapped.symbol, + tokenOutAddress: tokenOut.wrapped.address, + tokenOutChainId: tokenOut.wrapped.chainId, + tokenOutDecimals: tokenOut.wrapped.decimals, + tokenOutSymbol: tokenOut.wrapped.symbol, + useClientSideRouter: clientSideRouter, + type: tradeType === TradeType.EXACT_INPUT ? 'exactIn' : 'exactOut', + } + }, + [amount, clientSideRouter, tokenIn, tokenOut, tradeType] + ) +} +/** + * Returns the best trade by invoking the routing api or the smart order router on the client + * @param tradeType whether the swap is an exact in/out + * @param amountSpecified the exact amount to swap in/out + * @param otherCurrency the desired output/payment currency + */ +function useRoutingAPITrade(tradeType, amountSpecified, otherCurrency) { + var _a + var _b = __read( + useMemo( + function () { + return tradeType === TradeType.EXACT_INPUT + ? [ + amountSpecified === null || amountSpecified === void 0 ? void 0 : amountSpecified.currency, + otherCurrency, + ] + : [ + otherCurrency, + amountSpecified === null || amountSpecified === void 0 ? void 0 : amountSpecified.currency, + ] + }, + [amountSpecified, otherCurrency, tradeType] + ), + 2 + ), + currencyIn = _b[0], + currencyOut = _b[1] + var queryArgs = useRoutingAPIArguments({ + tokenIn: currencyIn, + tokenOut: currencyOut, + amount: amountSpecified, + tradeType, + }) + var _c = useGetQuoteQuery(queryArgs !== null && queryArgs !== void 0 ? queryArgs : skipToken, { + pollingInterval: ms(templateObject_1$1a || (templateObject_1$1a = __makeTemplateObject(['15s'], ['15s']))), + refetchOnFocus: true, + }), + isLoading = _c.isLoading, + isError = _c.isError, + data = _c.data + var quoteResult = useFreshData(data, Number(data === null || data === void 0 ? void 0 : data.blockNumber) || 0) + var route = useMemo( + function () { + return computeRoutes(currencyIn, currencyOut, tradeType, quoteResult) + }, + [currencyIn, currencyOut, quoteResult, tradeType] + ) + // get USD gas cost of trade in active chains stablecoin amount + var gasUseEstimateUSD = + (_a = useStablecoinAmountFromFiatValue( + quoteResult === null || quoteResult === void 0 ? void 0 : quoteResult.gasUseEstimateUSD + )) !== null && _a !== void 0 + ? _a + : null + return useMemo( + function () { + if (!currencyIn || !currencyOut) { + return { + state: TradeState.INVALID, + trade: undefined, + } + } + if (isLoading && !quoteResult) { + // only on first hook render + return { + state: TradeState.LOADING, + trade: undefined, + } + } + var otherAmount = + tradeType === TradeType.EXACT_INPUT + ? currencyOut && quoteResult + ? CurrencyAmount.fromRawAmount(currencyOut, quoteResult.quote) + : undefined + : currencyIn && quoteResult + ? CurrencyAmount.fromRawAmount(currencyIn, quoteResult.quote) + : undefined + if (isError || !otherAmount || !route || route.length === 0 || !queryArgs) { + return { + state: TradeState.NO_ROUTE_FOUND, + trade: undefined, + } + } + try { + var trade = transformRoutesToTrade(route, tradeType, gasUseEstimateUSD) + return { + // always return VALID regardless of isFetching status + state: TradeState.VALID, + trade, + } + } catch (e) { + console.debug('transformRoutesToTrade failed: ', e) + return { state: TradeState.INVALID, trade: undefined } + } + }, + [currencyIn, currencyOut, isLoading, quoteResult, tradeType, isError, route, queryArgs, gasUseEstimateUSD] + ) +} +var templateObject_1$1a + +var AUTO_ROUTER_SUPPORTED_CHAINS = Object.values(ChainId) + +function useAutoRouterSupported() { + var chainId = useActiveWeb3React().chainId + return Boolean(chainId && AUTO_ROUTER_SUPPORTED_CHAINS.includes(chainId)) +} + +/** + * Returns the best v2+v3 trade for a desired swap. + * @param tradeType whether the swap is an exact in/out + * @param amountSpecified the exact amount to swap in/out + * @param otherCurrency the desired output/payment currency + */ +function useBestTrade(tradeType, amountSpecified, otherCurrency) { + var autoRouterSupported = useAutoRouterSupported() + var isWindowVisible = useIsWindowVisible() + var _a = __read( + useDebounce( + useMemo( + function () { + return [amountSpecified, otherCurrency] + }, + [amountSpecified, otherCurrency] + ), + 200 + ), + 2 + ), + debouncedAmount = _a[0], + debouncedOtherCurrency = _a[1] + var routingAPITrade = useRoutingAPITrade( + tradeType, + autoRouterSupported && isWindowVisible ? debouncedAmount : undefined, + debouncedOtherCurrency + ) + var isLoading = amountSpecified !== undefined && debouncedAmount === undefined + // consider trade debouncing when inputs/outputs do not match + var debouncing = + routingAPITrade.trade && + amountSpecified && + (tradeType === TradeType.EXACT_INPUT + ? !routingAPITrade.trade.inputAmount.equalTo(amountSpecified) || + !amountSpecified.currency.equals(routingAPITrade.trade.inputAmount.currency) || + !(debouncedOtherCurrency === null || debouncedOtherCurrency === void 0 + ? void 0 + : debouncedOtherCurrency.equals(routingAPITrade.trade.outputAmount.currency)) + : !routingAPITrade.trade.outputAmount.equalTo(amountSpecified) || + !amountSpecified.currency.equals(routingAPITrade.trade.outputAmount.currency) || + !(debouncedOtherCurrency === null || debouncedOtherCurrency === void 0 + ? void 0 + : debouncedOtherCurrency.equals(routingAPITrade.trade.inputAmount.currency))) + var useFallback = !autoRouterSupported || (!debouncing && routingAPITrade.state === TradeState.NO_ROUTE_FOUND) + // only use client side router if routing api trade failed or is not supported + var bestV3Trade = useClientSideV3Trade( + tradeType, + useFallback ? debouncedAmount : undefined, + useFallback ? debouncedOtherCurrency : undefined + ) + // only return gas estimate from api if routing api trade is used + return useMemo( + function () { + return __assign( + __assign( + __assign({}, useFallback ? bestV3Trade : routingAPITrade), + debouncing ? { state: TradeState.SYNCING } : {} + ), + isLoading ? { state: TradeState.LOADING } : {} + ) + }, + [bestV3Trade, debouncing, isLoading, routingAPITrade, useFallback] + ) +} + +// gets the current timestamp from the blockchain +function useCurrentBlockTimestamp() { + var _a, _b + var multicall = useInterfaceMulticall() + return (_b = + (_a = useSingleCallResult(multicall, 'getCurrentBlockTimestamp')) === null || _a === void 0 + ? void 0 + : _a.result) === null || _b === void 0 + ? void 0 + : _b[0] +} + +new Interface(abi$6) +;({ + 1: [ + { + tokens: [WRAPPED_NATIVE_CURRENCY[1], DAI], + stakingRewardAddress: '0xa1484C3aa22a66C62b77E0AE78E15258bd0cB711', + }, + { + tokens: [WRAPPED_NATIVE_CURRENCY[1], USDC], + stakingRewardAddress: '0x7FBa4B8Dc5E7616e59622806932DBea72537A56b', + }, + { + tokens: [WRAPPED_NATIVE_CURRENCY[1], USDT], + stakingRewardAddress: '0x6C3e4cb2E96B01F4b866965A91ed4437839A121a', + }, + { + tokens: [WRAPPED_NATIVE_CURRENCY[1], WBTC], + stakingRewardAddress: '0xCA35e32e7926b96A9988f61d510E038108d8068e', + }, + ], +}) + +// mimics useAllBalances +function useAllTokenBalances() { + var account = useActiveWeb3React().account + var allTokens = useAllTokens() + var allTokensArray = useMemo( + function () { + return Object.values(allTokens !== null && allTokens !== void 0 ? allTokens : {}) + }, + [allTokens] + ) + var balances = useTokenBalances(account !== null && account !== void 0 ? account : undefined, allTokensArray) + return balances !== null && balances !== void 0 ? balances : {} +} + +function useSwapState() { + return useAppSelector(function (state) { + return state.swap + }) +} +function useSwapActionHandlers() { + var dispatch = useAppDispatch() + var onCurrencySelection = useCallback( + function (field, currency) { + dispatch( + selectCurrency({ + field, + currencyId: currency.isToken ? currency.address : currency.isNative ? 'ETH' : '', + }) + ) + }, + [dispatch] + ) + var onSwitchTokens = useCallback( + function () { + dispatch(switchCurrencies()) + }, + [dispatch] + ) + var onUserInput = useCallback( + function (field, typedValue) { + dispatch(typeInput({ field, typedValue })) + }, + [dispatch] + ) + var onChangeRecipient = useCallback( + function (recipient) { + dispatch(setRecipient({ recipient })) + }, + [dispatch] + ) + return { + onSwitchTokens, + onCurrencySelection, + onUserInput, + onChangeRecipient, + } +} +var BAD_RECIPIENT_ADDRESSES = { + '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f': true, + '0xf164fC0Ec4E93095b804a4795bBe1e041497b92a': true, + '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D': true, // v2 router 02 +} +// from the current swap inputs, compute the best trade and return it. +function useDerivedSwapInfo() { + var _a, _b + var account = useActiveWeb3React().account + var _c = useSwapState(), + independentField = _c.independentField, + typedValue = _c.typedValue, + _d = Field.INPUT, + inputCurrencyId = _c[_d].currencyId, + _e = Field.OUTPUT, + outputCurrencyId = _c[_e].currencyId, + recipient = _c.recipient + var inputCurrency = useCurrency(inputCurrencyId) + var outputCurrency = useCurrency(outputCurrencyId) + var recipientLookup = useENS(recipient !== null && recipient !== void 0 ? recipient : undefined) + var to = (_a = recipient === null ? account : recipientLookup.address) !== null && _a !== void 0 ? _a : null + var relevantTokenBalances = useCurrencyBalances( + account !== null && account !== void 0 ? account : undefined, + useMemo( + function () { + return [ + inputCurrency !== null && inputCurrency !== void 0 ? inputCurrency : undefined, + outputCurrency !== null && outputCurrency !== void 0 ? outputCurrency : undefined, + ] + }, + [inputCurrency, outputCurrency] + ) + ) + var isExactIn = independentField === Field.INPUT + var parsedAmount = useMemo( + function () { + var _a + return tryParseCurrencyAmount( + typedValue, + (_a = isExactIn ? inputCurrency : outputCurrency) !== null && _a !== void 0 ? _a : undefined + ) + }, + [inputCurrency, isExactIn, outputCurrency, typedValue] + ) + var trade = useBestTrade( + isExactIn ? TradeType.EXACT_INPUT : TradeType.EXACT_OUTPUT, + parsedAmount, + (_b = isExactIn ? outputCurrency : inputCurrency) !== null && _b !== void 0 ? _b : undefined + ) + var currencyBalances = useMemo( + function () { + var _a + return (_a = {}), (_a[Field.INPUT] = relevantTokenBalances[0]), (_a[Field.OUTPUT] = relevantTokenBalances[1]), _a + }, + [relevantTokenBalances] + ) + var currencies = useMemo( + function () { + var _a + return (_a = {}), (_a[Field.INPUT] = inputCurrency), (_a[Field.OUTPUT] = outputCurrency), _a + }, + [inputCurrency, outputCurrency] + ) + // allowed slippage is either auto slippage, or custom user defined slippage if auto slippage disabled + var autoSlippageTolerance = useAutoSlippageTolerance(trade.trade) + var allowedSlippage = useUserSlippageToleranceWithDefault(autoSlippageTolerance) + var inputError = useMemo( + function () { + var _a + var inputError + if (!account) { + inputError = jsx(Trans, { children: 'Connect Wallet' }, void 0) + } + if (!currencies[Field.INPUT] || !currencies[Field.OUTPUT]) { + inputError = + inputError !== null && inputError !== void 0 ? inputError : jsx(Trans, { children: 'Select a token' }, void 0) + } + if (!parsedAmount) { + inputError = + inputError !== null && inputError !== void 0 + ? inputError + : jsx(Trans, { children: 'Enter an amount' }, void 0) + } + var formattedTo = isAddress(to) + if (!to || !formattedTo) { + inputError = + inputError !== null && inputError !== void 0 + ? inputError + : jsx(Trans, { children: 'Enter a recipient' }, void 0) + } else { + if (BAD_RECIPIENT_ADDRESSES[formattedTo]) { + inputError = + inputError !== null && inputError !== void 0 + ? inputError + : jsx(Trans, { children: 'Invalid recipient' }, void 0) + } + } + // compare input balance to max input based on version + var _b = __read( + [ + currencyBalances[Field.INPUT], + (_a = trade.trade) === null || _a === void 0 ? void 0 : _a.maximumAmountIn(allowedSlippage), + ], + 2 + ), + balanceIn = _b[0], + amountIn = _b[1] + if (balanceIn && amountIn && balanceIn.lessThan(amountIn)) { + inputError = jsxs(Trans, { children: ['Insufficient ', amountIn.currency.symbol, ' balance'] }, void 0) + } + return inputError + }, + [account, allowedSlippage, currencies, currencyBalances, parsedAmount, to, trade.trade] + ) + return useMemo( + function () { + return { + currencies, + currencyBalances, + parsedAmount, + inputError, + trade, + allowedSlippage, + } + }, + [allowedSlippage, currencies, currencyBalances, inputError, parsedAmount, trade] + ) +} +function parseCurrencyFromURLParameter(urlParam) { + if (typeof urlParam === 'string') { + var valid = isAddress(urlParam) + if (valid) return valid + if (urlParam.toUpperCase() === 'ETH') return 'ETH' + } + return '' +} +function parseTokenAmountURLParameter(urlParam) { + return typeof urlParam === 'string' && !isNaN(parseFloat(urlParam)) ? urlParam : '' +} +function parseIndependentFieldURLParameter(urlParam) { + return typeof urlParam === 'string' && urlParam.toLowerCase() === 'output' ? Field.OUTPUT : Field.INPUT +} +var ENS_NAME_REGEX = /^[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)?$/ +var ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/ +function validatedRecipient(recipient) { + if (typeof recipient !== 'string') return null + var address = isAddress(recipient) + if (address) return address + if (ENS_NAME_REGEX.test(recipient)) return recipient + if (ADDRESS_REGEX.test(recipient)) return recipient + return null +} +function queryParametersToSwapState(parsedQs) { + var _a + var inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency) + var outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency) + if (inputCurrency === '' && outputCurrency === '') { + // default to ETH input + inputCurrency = 'ETH' + } else if (inputCurrency === outputCurrency) { + // clear output if identical + outputCurrency = '' + } + var recipient = validatedRecipient(parsedQs.recipient) + return ( + (_a = {}), + (_a[Field.INPUT] = { + currencyId: + inputCurrency === '' ? null : inputCurrency !== null && inputCurrency !== void 0 ? inputCurrency : null, + }), + (_a[Field.OUTPUT] = { + currencyId: + outputCurrency === '' ? null : outputCurrency !== null && outputCurrency !== void 0 ? outputCurrency : null, + }), + (_a.typedValue = parseTokenAmountURLParameter(parsedQs.exactAmount)), + (_a.independentField = parseIndependentFieldURLParameter(parsedQs.exactField)), + (_a.recipient = recipient), + _a + ) +} +// updates the swap state to use the defaults for a given network +function useDefaultsFromURLSearch() { + var chainId = useActiveWeb3React().chainId + var dispatch = useAppDispatch() + var parsedQs = useParsedQueryString() + var _a = __read(useState(), 2), + result = _a[0], + setResult = _a[1] + useEffect( + function () { + var _a, _b + if (!chainId) return + var parsed = queryParametersToSwapState(parsedQs) + var inputCurrencyId = (_a = parsed[Field.INPUT].currencyId) !== null && _a !== void 0 ? _a : undefined + var outputCurrencyId = (_b = parsed[Field.OUTPUT].currencyId) !== null && _b !== void 0 ? _b : undefined + dispatch( + replaceSwapState({ + typedValue: parsed.typedValue, + field: parsed.independentField, + inputCurrencyId, + outputCurrencyId, + recipient: parsed.recipient, + }) + ) + setResult({ inputCurrencyId, outputCurrencyId }) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, + [dispatch, chainId] + ) + return result +} + +var initialState$2 = queryParametersToSwapState(parsedQueryString()) +var swap = createReducer(initialState$2, function (builder) { + return builder + .addCase(replaceSwapState, function (state, _a) { + var _b + var _c = _a.payload, + typedValue = _c.typedValue, + recipient = _c.recipient, + field = _c.field, + inputCurrencyId = _c.inputCurrencyId, + outputCurrencyId = _c.outputCurrencyId + return ( + (_b = {}), + (_b[Field.INPUT] = { + currencyId: inputCurrencyId !== null && inputCurrencyId !== void 0 ? inputCurrencyId : null, + }), + (_b[Field.OUTPUT] = { + currencyId: outputCurrencyId !== null && outputCurrencyId !== void 0 ? outputCurrencyId : null, + }), + (_b.independentField = field), + (_b.typedValue = typedValue), + (_b.recipient = recipient), + _b + ) + }) + .addCase(selectCurrency, function (state, _a) { + var _b, _c + var _d = _a.payload, + currencyId = _d.currencyId, + field = _d.field + var otherField = field === Field.INPUT ? Field.OUTPUT : Field.INPUT + if (currencyId === state[otherField].currencyId) { + // the case where we have to swap the order + return __assign( + __assign({}, state), + ((_b = { independentField: state.independentField === Field.INPUT ? Field.OUTPUT : Field.INPUT }), + (_b[field] = { currencyId }), + (_b[otherField] = { currencyId: state[field].currencyId }), + _b) + ) + } else { + // the normal case + return __assign(__assign({}, state), ((_c = {}), (_c[field] = { currencyId }), _c)) + } + }) + .addCase(switchCurrencies, function (state) { + var _a + return __assign( + __assign({}, state), + ((_a = { independentField: state.independentField === Field.INPUT ? Field.OUTPUT : Field.INPUT }), + (_a[Field.INPUT] = { currencyId: state[Field.OUTPUT].currencyId }), + (_a[Field.OUTPUT] = { currencyId: state[Field.INPUT].currencyId }), + _a) + ) + }) + .addCase(typeInput, function (state, _a) { + var _b = _a.payload, + field = _b.field, + typedValue = _b.typedValue + return __assign(__assign({}, state), { independentField: field, typedValue }) + }) + .addCase(setRecipient, function (state, _a) { + var recipient = _a.payload.recipient + state.recipient = recipient + }) +}) + +var now = function () { + return new Date().getTime() +} +var initialState$1 = {} +var transactions = createReducer(initialState$1, function (builder) { + return builder + .addCase(updateVersion, function (transactions) { + // in case there are any transactions in the store with the old format, remove them + Object.keys(transactions).forEach(function (chainId) { + var chainTransactions = transactions[chainId] + Object.keys(chainTransactions).forEach(function (hash) { + if (!('info' in chainTransactions[hash])) { + // clear old transactions that don't have the right format + delete chainTransactions[hash] + } + }) + }) + }) + .addCase(addTransaction, function (transactions, _a) { + var _b, _c + var _d = _a.payload, + chainId = _d.chainId, + from = _d.from, + hash = _d.hash, + info = _d.info + if ((_b = transactions[chainId]) === null || _b === void 0 ? void 0 : _b[hash]) { + throw Error('Attempted to add existing transaction.') + } + var txs = (_c = transactions[chainId]) !== null && _c !== void 0 ? _c : {} + txs[hash] = { hash, info, from, addedTime: now() } + transactions[chainId] = txs + }) + .addCase(clearAllTransactions, function (transactions, _a) { + var chainId = _a.payload.chainId + if (!transactions[chainId]) return + transactions[chainId] = {} + }) + .addCase(checkedTransaction, function (transactions, _a) { + var _b + var _c = _a.payload, + chainId = _c.chainId, + hash = _c.hash, + blockNumber = _c.blockNumber + var tx = (_b = transactions[chainId]) === null || _b === void 0 ? void 0 : _b[hash] + if (!tx) { + return + } + if (!tx.lastCheckedBlockNumber) { + tx.lastCheckedBlockNumber = blockNumber + } else { + tx.lastCheckedBlockNumber = Math.max(blockNumber, tx.lastCheckedBlockNumber) + } + }) + .addCase(finalizeTransaction, function (transactions, _a) { + var _b + var _c = _a.payload, + hash = _c.hash, + chainId = _c.chainId, + receipt = _c.receipt + var tx = (_b = transactions[chainId]) === null || _b === void 0 ? void 0 : _b[hash] + if (!tx) { + return + } + tx.receipt = receipt + tx.confirmedTime = now() + }) +}) + +var currentTimestamp = function () { + return new Date().getTime() +} +function pairKey(token0Address, token1Address) { + return token0Address + ';' + token1Address +} +var initialState = { + matchesDarkMode: false, + userDarkMode: null, + userExpertMode: false, + userLocale: null, + userClientSideRouter: false, + userHideClosedPositions: false, + userSlippageTolerance: 'auto', + userSlippageToleranceHasBeenMigratedToAuto: true, + userDeadline: DEFAULT_DEADLINE_FROM_NOW, + tokens: {}, + pairs: {}, + timestamp: currentTimestamp(), + URLWarningVisible: true, + showSurveyPopup: undefined, +} +var user = createReducer(initialState, function (builder) { + return builder + .addCase(updateVersion, function (state) { + // slippage isnt being tracked in local storage, reset to default + // noinspection SuspiciousTypeOfGuard + if ( + typeof state.userSlippageTolerance !== 'number' || + !Number.isInteger(state.userSlippageTolerance) || + state.userSlippageTolerance < 0 || + state.userSlippageTolerance > 5000 + ) { + state.userSlippageTolerance = 'auto' + } else { + if ( + !state.userSlippageToleranceHasBeenMigratedToAuto && + [10, 50, 100].indexOf(state.userSlippageTolerance) !== -1 + ) { + state.userSlippageTolerance = 'auto' + state.userSlippageToleranceHasBeenMigratedToAuto = true + } + } + // deadline isnt being tracked in local storage, reset to default + // noinspection SuspiciousTypeOfGuard + if ( + typeof state.userDeadline !== 'number' || + !Number.isInteger(state.userDeadline) || + state.userDeadline < 60 || + state.userDeadline > 180 * 60 + ) { + state.userDeadline = DEFAULT_DEADLINE_FROM_NOW + } + state.lastUpdateVersionTimestamp = currentTimestamp() + }) + .addCase(updateUserDarkMode, function (state, action) { + state.userDarkMode = action.payload.userDarkMode + state.timestamp = currentTimestamp() + }) + .addCase(updateMatchesDarkMode, function (state, action) { + state.matchesDarkMode = action.payload.matchesDarkMode + state.timestamp = currentTimestamp() + }) + .addCase(updateUserExpertMode, function (state, action) { + state.userExpertMode = action.payload.userExpertMode + state.timestamp = currentTimestamp() + }) + .addCase(updateUserLocale, function (state, action) { + state.userLocale = action.payload.userLocale + state.timestamp = currentTimestamp() + }) + .addCase(updateUserSlippageTolerance, function (state, action) { + state.userSlippageTolerance = action.payload.userSlippageTolerance + state.timestamp = currentTimestamp() + }) + .addCase(updateUserDeadline, function (state, action) { + state.userDeadline = action.payload.userDeadline + state.timestamp = currentTimestamp() + }) + .addCase(updateUserClientSideRouter, function (state, action) { + state.userClientSideRouter = action.payload.userClientSideRouter + }) + .addCase(updateHideClosedPositions, function (state, action) { + state.userHideClosedPositions = action.payload.userHideClosedPositions + }) + .addCase(updateShowSurveyPopup, function (state, action) { + state.showSurveyPopup = action.payload.showSurveyPopup + }) + .addCase(addSerializedToken, function (state, _a) { + var serializedToken = _a.payload.serializedToken + if (!state.tokens) { + state.tokens = {} + } + state.tokens[serializedToken.chainId] = state.tokens[serializedToken.chainId] || {} + state.tokens[serializedToken.chainId][serializedToken.address] = serializedToken + state.timestamp = currentTimestamp() + }) + .addCase(removeSerializedToken, function (state, _a) { + var _b = _a.payload, + address = _b.address, + chainId = _b.chainId + if (!state.tokens) { + state.tokens = {} + } + state.tokens[chainId] = state.tokens[chainId] || {} + delete state.tokens[chainId][address] + state.timestamp = currentTimestamp() + }) + .addCase(addSerializedPair, function (state, _a) { + var serializedPair = _a.payload.serializedPair + if ( + serializedPair.token0.chainId === serializedPair.token1.chainId && + serializedPair.token0.address !== serializedPair.token1.address + ) { + var chainId = serializedPair.token0.chainId + state.pairs[chainId] = state.pairs[chainId] || {} + state.pairs[chainId][pairKey(serializedPair.token0.address, serializedPair.token1.address)] = serializedPair + } + state.timestamp = currentTimestamp() + }) + .addCase(removeSerializedPair, function (state, _a) { + var _b = _a.payload, + chainId = _b.chainId, + tokenAAddress = _b.tokenAAddress, + tokenBAddress = _b.tokenBAddress + if (state.pairs[chainId]) { + // just delete both keys if either exists + delete state.pairs[chainId][pairKey(tokenAAddress, tokenBAddress)] + delete state.pairs[chainId][pairKey(tokenBAddress, tokenAAddress)] + } + state.timestamp = currentTimestamp() + }) +}) + +var _a$5 +var PERSISTED_KEYS = ['user', 'transactions', 'lists'] +var store = configureStore({ + reducer: + ((_a$5 = { + application, + user, + transactions, + swap, + mint, + mintV3, + burn, + burnV3, + multicall: multicall.reducer, + lists, + logs, + }), + (_a$5[api$1.reducerPath] = api$1.reducer), + (_a$5[routingApi.reducerPath] = routingApi.reducer), + _a$5), + middleware(getDefaultMiddleware) { + return getDefaultMiddleware({ thunk: true }) + .concat(api$1.middleware) + .concat(routingApi.middleware) + .concat(save({ states: PERSISTED_KEYS, debounce: 1000 })) + }, + preloadedState: load({ states: PERSISTED_KEYS, disableWarnings: process.env.NODE_ENV === 'test' }), +}) +store.dispatch(updateVersion()) +setupListeners(store.dispatch) + +var FallbackWrapper = styled.div( + templateObject_1$19 || + (templateObject_1$19 = __makeTemplateObject( + ['\n display: flex;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 1;\n'], + ['\n display: flex;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 1;\n'] + )) +) +var BodyWrapper$2 = styled.div( + templateObject_2$R || + (templateObject_2$R = __makeTemplateObject( + ['\n padding: 1rem;\n width: 100%;\n white-space: ;\n'], + ['\n padding: 1rem;\n width: 100%;\n white-space: ;\n'] + )) +) +var CodeBlockWrapper = styled.div( + templateObject_3$J || + (templateObject_3$J = __makeTemplateObject( + [ + '\n background: ', + ';\n overflow: auto;\n white-space: pre;\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 24px;\n padding: 18px 24px;\n color: ', + ';\n', + ], + [ + '\n background: ', + ';\n overflow: auto;\n white-space: pre;\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 24px;\n padding: 18px 24px;\n color: ', + ';\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.bg0 + }, + function (_a) { + var theme = _a.theme + return theme.text1 + } +) +var LinkWrapper = styled.div( + templateObject_4$y || + (templateObject_4$y = __makeTemplateObject( + ['\n color: ', ';\n padding: 6px 24px;\n'], + ['\n color: ', ';\n padding: 6px 24px;\n'] + )), + function (_a) { + var theme = _a.theme + return theme.blue1 + } +) +var SomethingWentWrongWrapper = styled.div( + templateObject_5$q || + (templateObject_5$q = __makeTemplateObject(['\n padding: 6px 24px;\n'], ['\n padding: 6px 24px;\n'])) +) +var IS_UNISWAP = window.location.hostname === 'app.uniswap.org' +var ErrorBoundary = /** @class */ (function (_super) { + __extends(ErrorBoundary, _super) + function ErrorBoundary(props) { + var _this = _super.call(this, props) || this + _this.state = { error: null } + return _this + } + ErrorBoundary.getDerivedStateFromError = function (error) { + return { error } + } + ErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) { + ReactGA.exception(__assign(__assign(__assign({}, error), errorInfo), { fatal: true })) + } + ErrorBoundary.prototype.render = function () { + var error = this.state.error + if (error !== null) { + var encodedBody = encodeURIComponent(issueBody(error)) + return jsx( + FallbackWrapper, + { + children: jsx( + BodyWrapper$2, + { + children: jsxs( + AutoColumn, + __assign( + { gap: 'md' }, + { + children: [ + jsx( + SomethingWentWrongWrapper, + { + children: jsx( + ThemedText.Label, + __assign( + { fontSize: 24, fontWeight: 600 }, + { children: jsx(Trans, { children: 'Something went wrong' }, void 0) } + ), + void 0 + ), + }, + void 0 + ), + jsx( + CodeBlockWrapper, + { + children: jsx( + 'code', + { + children: jsx( + ThemedText.Main, + __assign({ fontSize: 10 }, { children: error.stack }), + void 0 + ), + }, + void 0 + ), + }, + void 0 + ), + IS_UNISWAP + ? jsxs( + AutoRow, + { + children: [ + jsx( + LinkWrapper, + { + children: jsx( + ExternalLink, + __assign( + { + id: 'create-github-issue-link', + href: + 'https://github.com/Uniswap/uniswap-interface/issues/new?assignees=&labels=bug&body=' + + encodedBody + + '&title=' + + encodeURIComponent( + 'Crash report: `' + + error.name + + (error.message && ': ' + error.message) + + '`' + ), + target: '_blank', + }, + { + children: jsxs( + ThemedText.Link, + __assign( + { fontSize: 16 }, + { + children: [ + jsx(Trans, { children: 'Create an issue on GitHub' }, void 0), + jsx('span', { children: '\u2197' }, void 0), + ], + } + ), + void 0 + ), + } + ), + void 0 + ), + }, + void 0 + ), + jsx( + LinkWrapper, + { + children: jsx( + ExternalLink, + __assign( + { + id: 'get-support-on-discord', + href: 'https://discord.gg/FCfyBSbCU5', + target: '_blank', + }, + { + children: jsxs( + ThemedText.Link, + __assign( + { fontSize: 16 }, + { + children: [ + jsx(Trans, { children: 'Get support on Discord' }, void 0), + jsx('span', { children: '\u2197' }, void 0), + ], + } + ), + void 0 + ), + } + ), + void 0 + ), + }, + void 0 + ), + ], + }, + void 0 + ) + : null, + ], + } + ), + void 0 + ), + }, + void 0 + ), + }, + void 0 + ) + } + return this.props.children + } + return ErrorBoundary +})(React__default.Component) +function getRelevantState() { + var path = window.location.hash + if (!path.startsWith('#/')) { + return null + } + var pieces = path.substring(2).split(/[/\\?]/) + switch (pieces[0]) { + case 'swap': + return 'swap' + case 'add': + if (pieces[1] === 'v2') return 'mint' + else return 'mintV3' + case 'remove': + if (pieces[1] === 'v2') return 'burn' + else return 'burnV3' + } + return null +} +function issueBody(error) { + var relevantState = getRelevantState() + var deviceData = userAgent + return ( + '## URL\n \n' + + window.location.href + + '\n\n' + + (relevantState + ? '## `' + + relevantState + + '` state\n \n```json\n' + + JSON.stringify(store.getState()[relevantState], null, 2) + + '\n```\n' + : '') + + '\n' + + (error.name && '## Error\n\n```\n' + error.name + (error.message && ': ' + error.message) + '\n```\n') + + '\n' + + (error.stack && '## Stacktrace\n\n```\n' + error.stack + '\n```\n') + + '\n' + + (deviceData && '## Device data\n\n```json\n' + JSON.stringify(deviceData, null, 2) + '\n```\n') + + '\n' + ) +} +var templateObject_1$19, templateObject_2$R, templateObject_3$J, templateObject_4$y, templateObject_5$q + +function useModalOpen(modal) { + var openModal = useAppSelector(function (state) { + return state.application.openModal + }) + return openModal === modal +} +function useToggleModal(modal) { + var open = useModalOpen(modal) + var dispatch = useAppDispatch() + return useCallback( + function () { + return dispatch(setOpenModal(open ? null : modal)) + }, + [dispatch, modal, open] + ) +} +function useWalletModalToggle() { + return useToggleModal(ApplicationModal.WALLET) +} +function useToggleSettingsMenu() { + return useToggleModal(ApplicationModal.SETTINGS) +} +function useShowClaimPopup() { + return useModalOpen(ApplicationModal.CLAIM_POPUP) +} +function useToggleShowClaimPopup() { + return useToggleModal(ApplicationModal.CLAIM_POPUP) +} +function useToggleSelfClaimModal() { + return useToggleModal(ApplicationModal.SELF_CLAIM) +} +function useTogglePrivacyPolicy() { + return useToggleModal(ApplicationModal.PRIVACY_POLICY) +} +// returns a function that allows adding a popup +function useAddPopup() { + var dispatch = useAppDispatch() + return useCallback( + function (content, key, removeAfterMs) { + dispatch( + addPopup({ + content, + key, + removeAfterMs: removeAfterMs !== null && removeAfterMs !== void 0 ? removeAfterMs : DEFAULT_TXN_DISMISS_MS, + }) + ) + }, + [dispatch] + ) +} +// returns a function that allows removing a popup via its key +function useRemovePopup() { + var dispatch = useAppDispatch() + return useCallback( + function (key) { + dispatch(removePopup({ key })) + }, + [dispatch] + ) +} +// get the list of active popups +function useActivePopups() { + var list = useAppSelector(function (state) { + return state.application.popupList + }) + return useMemo( + function () { + return list.filter(function (item) { + return item.show + }) + }, + [list] + ) +} + +var _path$5, _path2$2, _path3$1, _path4, _path5, _path6, _path7, _path8, _path9 + +function _extends$7() { + _extends$7 = + Object.assign || + function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + return target + } + return _extends$7.apply(this, arguments) +} + +const SvgLogo = (props) => + /*#__PURE__*/ React.createElement( + 'svg', + _extends$7( + { + width: 14, + height: 15, + viewBox: '0 0 14 15', + fill: 'black', + xmlns: 'http://www.w3.org/2000/svg', + }, + props + ), + /*#__PURE__*/ React.createElement( + 'g', + { + style: { + mixBlendMode: 'darken', + }, + }, + _path$5 || + (_path$5 = /*#__PURE__*/ React.createElement('path', { + d: 'M4.15217 1.55141C3.96412 1.52242 3.95619 1.51902 4.04468 1.5055C4.21427 1.47958 4.61472 1.51491 4.89067 1.58012C5.53489 1.73232 6.12109 2.12221 6.74683 2.81466L6.91307 2.99862L7.15088 2.96062C8.15274 2.8006 9.17194 2.92778 10.0244 3.31918C10.2589 3.42686 10.6287 3.64121 10.6749 3.69629C10.6896 3.71384 10.7166 3.82684 10.7349 3.94742C10.7982 4.36458 10.7665 4.68434 10.6382 4.92317C10.5683 5.05313 10.5644 5.09432 10.6114 5.20554C10.6489 5.2943 10.7534 5.35999 10.8569 5.35985C11.0687 5.35956 11.2968 5.0192 11.4024 4.54561L11.4444 4.3575L11.5275 4.45109C11.9835 4.96459 12.3417 5.66488 12.4032 6.16335L12.4192 6.29332L12.3426 6.17517C12.2107 5.97186 12.0781 5.83346 11.9084 5.72183C11.6024 5.52062 11.2789 5.45215 10.4222 5.40727C9.64839 5.36675 9.21045 5.30106 8.77621 5.16032C8.03738 4.9209 7.66493 4.60204 6.78729 3.4576C6.39748 2.94928 6.15654 2.66804 5.91687 2.44155C5.37228 1.92691 4.83716 1.65701 4.15217 1.55141Z', + })), + _path2$2 || + (_path2$2 = /*#__PURE__*/ React.createElement('path', { + d: 'M10.8494 2.68637C10.8689 2.34575 10.9153 2.12108 11.0088 1.9159C11.0458 1.83469 11.0804 1.76822 11.0858 1.76822C11.0911 1.76822 11.075 1.82816 11.05 1.90142C10.9821 2.10054 10.9709 2.3729 11.0177 2.68978C11.0771 3.09184 11.1109 3.14985 11.5385 3.58416C11.739 3.78788 11.9723 4.0448 12.0568 4.15511L12.2106 4.35568L12.0568 4.21234C11.8688 4.03705 11.4364 3.6952 11.3409 3.64633C11.2768 3.61356 11.2673 3.61413 11.2278 3.65321C11.1914 3.68922 11.1837 3.74333 11.1787 3.99915C11.1708 4.39786 11.1161 4.65377 10.9842 4.90965C10.9128 5.04805 10.9015 5.01851 10.9661 4.8623C11.0143 4.74566 11.0192 4.69439 11.0189 4.30842C11.0181 3.53291 10.9255 3.34647 10.3823 3.02709C10.2447 2.94618 10.0179 2.8295 9.87839 2.76778C9.73887 2.70606 9.62805 2.6523 9.63208 2.64828C9.64746 2.63307 10.1772 2.78675 10.3905 2.86828C10.7077 2.98954 10.76 3.00526 10.7985 2.99063C10.8244 2.98082 10.8369 2.90608 10.8494 2.68637Z', + })), + _path3$1 || + (_path3$1 = /*#__PURE__*/ React.createElement('path', { + d: 'M4.51745 4.01304C4.13569 3.49066 3.89948 2.68973 3.95062 2.091L3.96643 1.90572L4.05333 1.92148C4.21652 1.95106 4.49789 2.05515 4.62964 2.13469C4.9912 2.35293 5.14773 2.64027 5.30697 3.37811C5.35362 3.59423 5.41482 3.8388 5.44298 3.9216C5.48831 4.05487 5.65962 4.36617 5.7989 4.56834C5.89922 4.71395 5.83258 4.78295 5.61082 4.76305C5.27215 4.73267 4.8134 4.41799 4.51745 4.01304Z', + })), + _path4 || + (_path4 = /*#__PURE__*/ React.createElement('path', { + d: 'M10.3863 7.90088C8.60224 7.18693 7.97389 6.56721 7.97389 5.52157C7.97389 5.36769 7.97922 5.24179 7.98571 5.24179C7.99221 5.24179 8.06124 5.29257 8.1391 5.35465C8.50088 5.64305 8.906 5.76623 10.0275 5.92885C10.6875 6.02455 11.0589 6.10185 11.4015 6.21477C12.4904 6.57371 13.1641 7.30212 13.3248 8.29426C13.3715 8.58255 13.3441 9.12317 13.2684 9.4081C13.2087 9.63315 13.0263 10.0388 12.9779 10.0544C12.9645 10.0587 12.9514 10.0076 12.9479 9.93809C12.9296 9.56554 12.7402 9.20285 12.4221 8.93116C12.0604 8.62227 11.5745 8.37633 10.3863 7.90088Z', + })), + _path5 || + (_path5 = /*#__PURE__*/ React.createElement('path', { + d: 'M9.13385 8.19748C9.11149 8.06527 9.07272 7.89643 9.04769 7.82228L9.00217 7.68748L9.08672 7.7818C9.20374 7.91233 9.2962 8.07937 9.37457 8.30185C9.43438 8.47165 9.44111 8.52215 9.44066 8.79807C9.4402 9.06896 9.43273 9.12575 9.3775 9.27858C9.29042 9.51959 9.18233 9.69048 9.00097 9.87391C8.67507 10.2036 8.25607 10.3861 7.65143 10.4618C7.54633 10.4749 7.24 10.4971 6.97069 10.511C6.292 10.5461 5.84531 10.6186 5.44393 10.7587C5.38623 10.7788 5.3347 10.7911 5.32947 10.7859C5.31323 10.7698 5.58651 10.6079 5.81223 10.4998C6.1305 10.3474 6.44733 10.2643 7.15719 10.1468C7.50785 10.0887 7.86998 10.0183 7.96194 9.99029C8.83033 9.72566 9.27671 9.04276 9.13385 8.19748Z', + })), + _path6 || + (_path6 = /*#__PURE__*/ React.createElement('path', { + d: 'M9.95169 9.64109C9.71465 9.13463 9.66022 8.64564 9.79009 8.18961C9.80399 8.14088 9.82632 8.101 9.83976 8.101C9.85319 8.101 9.90913 8.13105 9.96404 8.16777C10.0733 8.24086 10.2924 8.36395 10.876 8.68023C11.6043 9.0749 12.0196 9.3805 12.302 9.72965C12.5493 10.0354 12.7023 10.3837 12.776 10.8084C12.8177 11.0489 12.7932 11.6277 12.7311 11.8699C12.5353 12.6337 12.0802 13.2336 11.4311 13.5837C11.336 13.635 11.2506 13.6771 11.2414 13.6773C11.2321 13.6775 11.2668 13.5899 11.3184 13.4827C11.5367 13.029 11.5616 12.5877 11.3965 12.0965C11.2954 11.7957 11.0893 11.4287 10.6732 10.8084C10.1893 10.0873 10.0707 9.89539 9.95169 9.64109Z', + })), + _path7 || + (_path7 = /*#__PURE__*/ React.createElement('path', { + d: 'M3.25046 12.3737C3.91252 11.8181 4.73629 11.4234 5.48666 11.3022C5.81005 11.25 6.34877 11.2707 6.64823 11.3469C7.12824 11.469 7.55763 11.7425 7.78094 12.0683C7.99918 12.3867 8.09281 12.6642 8.19029 13.2816C8.22875 13.5252 8.27057 13.7697 8.28323 13.8251C8.35644 14.1451 8.4989 14.4008 8.67544 14.5293C8.95583 14.7333 9.43865 14.7459 9.91362 14.5618C9.99423 14.5305 10.0642 14.5089 10.0691 14.5138C10.0864 14.5308 9.84719 14.6899 9.67847 14.7737C9.45143 14.8864 9.2709 14.93 9.03102 14.93C8.59601 14.93 8.23486 14.7101 7.9335 14.2616C7.87419 14.1733 7.7409 13.909 7.63729 13.6741C7.3191 12.9528 7.16199 12.7331 6.79255 12.4926C6.47104 12.2834 6.05641 12.2459 5.74449 12.3979C5.33475 12.5976 5.22043 13.118 5.51389 13.4478C5.63053 13.5789 5.84803 13.6919 6.02588 13.7139C6.35861 13.7551 6.64455 13.5035 6.64455 13.1696C6.64455 12.9528 6.56071 12.8291 6.34966 12.7344C6.0614 12.6051 5.75156 12.7562 5.75304 13.0254C5.75368 13.1402 5.80396 13.2122 5.91971 13.2643C5.99397 13.2977 5.99569 13.3003 5.93514 13.2878C5.67066 13.2333 5.6087 12.9164 5.82135 12.706C6.07667 12.4535 6.60461 12.5649 6.78591 12.9097C6.86208 13.0545 6.87092 13.3429 6.80451 13.517C6.6559 13.9068 6.22256 14.1117 5.78297 14.0002C5.48368 13.9242 5.36181 13.842 5.00097 13.4726C4.37395 12.8306 4.13053 12.7062 3.22657 12.566L3.05335 12.5391L3.25046 12.3737Z', + })), + _path8 || + (_path8 = /*#__PURE__*/ React.createElement('path', { + fillRule: 'evenodd', + clipRule: 'evenodd', + d: 'M0.308383 0.883984C2.40235 3.40996 3.84457 4.45213 4.00484 4.67231C4.13717 4.85412 4.08737 5.01757 3.86067 5.14567C3.7346 5.21689 3.47541 5.28905 3.34564 5.28905C3.19887 5.28905 3.14847 5.23278 3.14847 5.23278C3.06337 5.15255 3.01544 5.16658 2.5784 4.39555C1.97166 3.45981 1.46389 2.68357 1.45004 2.67057C1.41801 2.64052 1.41856 2.64153 2.51654 4.59413C2.69394 5.0011 2.55182 5.15049 2.55182 5.20845C2.55182 5.32636 2.51946 5.38834 2.37311 5.55059C2.12914 5.8211 2.02008 6.12505 1.94135 6.7541C1.8531 7.45926 1.60492 7.95737 0.917156 8.80989C0.514562 9.30893 0.448686 9.4004 0.3471 9.60153C0.219144 9.85482 0.183961 9.99669 0.169701 10.3165C0.154629 10.6547 0.183983 10.8732 0.287934 11.1965C0.378939 11.4796 0.473932 11.6665 0.716778 12.0403C0.926351 12.3629 1.04702 12.6027 1.04702 12.6965C1.04702 12.7711 1.06136 12.7712 1.38611 12.6983C2.16328 12.5239 2.79434 12.2171 3.14925 11.8411C3.36891 11.6084 3.42048 11.4799 3.42215 11.1611C3.42325 10.9525 3.41587 10.9088 3.35914 10.7888C3.2668 10.5935 3.09869 10.4311 2.72817 10.1794C2.2427 9.84953 2.03534 9.58398 1.97807 9.21878C1.93108 8.91913 1.98559 8.70771 2.25416 8.14825C2.53214 7.56916 2.60103 7.32239 2.64763 6.73869C2.67773 6.36158 2.71941 6.21286 2.82842 6.09348C2.94212 5.969 3.04447 5.92684 3.32584 5.88863C3.78457 5.82635 4.07667 5.70839 4.31677 5.48849C4.52505 5.29772 4.61221 5.11391 4.62558 4.8372L4.63574 4.62747L4.51934 4.49259C4.09783 4.00411 0.0261003 0.5 0.000160437 0.5C-0.00538105 0.5 0.133325 0.672804 0.308383 0.883984ZM1.28364 10.6992C1.37894 10.5314 1.3283 10.3158 1.16889 10.2104C1.01827 10.1109 0.78428 10.1578 0.78428 10.2875C0.78428 10.3271 0.806303 10.3559 0.855937 10.3813C0.939514 10.424 0.945581 10.4721 0.879823 10.5703C0.81323 10.6698 0.818604 10.7573 0.894991 10.8167C1.0181 10.9125 1.19237 10.8598 1.28364 10.6992Z', + })), + _path9 || + (_path9 = /*#__PURE__*/ React.createElement('path', { + fillRule: 'evenodd', + clipRule: 'evenodd', + d: 'M4.92523 5.99865C4.70988 6.06439 4.50054 6.29124 4.43574 6.5291C4.39621 6.67421 4.41864 6.92875 4.47785 7.00736C4.57351 7.13433 4.66602 7.16778 4.91651 7.16603C5.40693 7.16263 5.83327 6.95358 5.88284 6.69224C5.92347 6.47801 5.73622 6.18112 5.4783 6.05078C5.34521 5.98355 5.06217 5.95688 4.92523 5.99865ZM5.49853 6.44422C5.57416 6.33741 5.54107 6.22198 5.41245 6.14391C5.1675 5.99525 4.79708 6.11827 4.79708 6.34826C4.79708 6.46274 4.99025 6.58765 5.16731 6.58765C5.28516 6.58765 5.44644 6.5178 5.49853 6.44422Z', + })) + ) + ) +var UNISWAP_LOGO_URL = + 'data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2215%22%20viewBox%3D%220%200%2014%2015%22%20fill%3D%22black%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22mix-blend-mode%3Adarken%22%3E%3Cpath%20d%3D%22M4.15217%201.55141C3.96412%201.52242%203.95619%201.51902%204.04468%201.5055C4.21427%201.47958%204.61472%201.51491%204.89067%201.58012C5.53489%201.73232%206.12109%202.12221%206.74683%202.81466L6.91307%202.99862L7.15088%202.96062C8.15274%202.8006%209.17194%202.92778%2010.0244%203.31918C10.2589%203.42686%2010.6287%203.64121%2010.6749%203.69629C10.6896%203.71384%2010.7166%203.82684%2010.7349%203.94742C10.7982%204.36458%2010.7665%204.68434%2010.6382%204.92317C10.5683%205.05313%2010.5644%205.09432%2010.6114%205.20554C10.6489%205.2943%2010.7534%205.35999%2010.8569%205.35985C11.0687%205.35956%2011.2968%205.0192%2011.4024%204.54561L11.4444%204.3575L11.5275%204.45109C11.9835%204.96459%2012.3417%205.66488%2012.4032%206.16335L12.4192%206.29332L12.3426%206.17517C12.2107%205.97186%2012.0781%205.83346%2011.9084%205.72183C11.6024%205.52062%2011.2789%205.45215%2010.4222%205.40727C9.64839%205.36675%209.21045%205.30106%208.77621%205.16032C8.03738%204.9209%207.66493%204.60204%206.78729%203.4576C6.39748%202.94928%206.15654%202.66804%205.91687%202.44155C5.37228%201.92691%204.83716%201.65701%204.15217%201.55141Z%22%2F%3E%3Cpath%20d%3D%22M10.8494%202.68637C10.8689%202.34575%2010.9153%202.12108%2011.0088%201.9159C11.0458%201.83469%2011.0804%201.76822%2011.0858%201.76822C11.0911%201.76822%2011.075%201.82816%2011.05%201.90142C10.9821%202.10054%2010.9709%202.3729%2011.0177%202.68978C11.0771%203.09184%2011.1109%203.14985%2011.5385%203.58416C11.739%203.78788%2011.9723%204.0448%2012.0568%204.15511L12.2106%204.35568L12.0568%204.21234C11.8688%204.03705%2011.4364%203.6952%2011.3409%203.64633C11.2768%203.61356%2011.2673%203.61413%2011.2278%203.65321C11.1914%203.68922%2011.1837%203.74333%2011.1787%203.99915C11.1708%204.39786%2011.1161%204.65377%2010.9842%204.90965C10.9128%205.04805%2010.9015%205.01851%2010.9661%204.8623C11.0143%204.74566%2011.0192%204.69439%2011.0189%204.30842C11.0181%203.53291%2010.9255%203.34647%2010.3823%203.02709C10.2447%202.94618%2010.0179%202.8295%209.87839%202.76778C9.73887%202.70606%209.62805%202.6523%209.63208%202.64828C9.64746%202.63307%2010.1772%202.78675%2010.3905%202.86828C10.7077%202.98954%2010.76%203.00526%2010.7985%202.99063C10.8244%202.98082%2010.8369%202.90608%2010.8494%202.68637Z%22%2F%3E%3Cpath%20d%3D%22M4.51745%204.01304C4.13569%203.49066%203.89948%202.68973%203.95062%202.091L3.96643%201.90572L4.05333%201.92148C4.21652%201.95106%204.49789%202.05515%204.62964%202.13469C4.9912%202.35293%205.14773%202.64027%205.30697%203.37811C5.35362%203.59423%205.41482%203.8388%205.44298%203.9216C5.48831%204.05487%205.65962%204.36617%205.7989%204.56834C5.89922%204.71395%205.83258%204.78295%205.61082%204.76305C5.27215%204.73267%204.8134%204.41799%204.51745%204.01304Z%22%2F%3E%3Cpath%20d%3D%22M10.3863%207.90088C8.60224%207.18693%207.97389%206.56721%207.97389%205.52157C7.97389%205.36769%207.97922%205.24179%207.98571%205.24179C7.99221%205.24179%208.06124%205.29257%208.1391%205.35465C8.50088%205.64305%208.906%205.76623%2010.0275%205.92885C10.6875%206.02455%2011.0589%206.10185%2011.4015%206.21477C12.4904%206.57371%2013.1641%207.30212%2013.3248%208.29426C13.3715%208.58255%2013.3441%209.12317%2013.2684%209.4081C13.2087%209.63315%2013.0263%2010.0388%2012.9779%2010.0544C12.9645%2010.0587%2012.9514%2010.0076%2012.9479%209.93809C12.9296%209.56554%2012.7402%209.20285%2012.4221%208.93116C12.0604%208.62227%2011.5745%208.37633%2010.3863%207.90088Z%22%2F%3E%3Cpath%20d%3D%22M9.13385%208.19748C9.11149%208.06527%209.07272%207.89643%209.04769%207.82228L9.00217%207.68748L9.08672%207.7818C9.20374%207.91233%209.2962%208.07937%209.37457%208.30185C9.43438%208.47165%209.44111%208.52215%209.44066%208.79807C9.4402%209.06896%209.43273%209.12575%209.3775%209.27858C9.29042%209.51959%209.18233%209.69048%209.00097%209.87391C8.67507%2010.2036%208.25607%2010.3861%207.65143%2010.4618C7.54633%2010.4749%207.24%2010.4971%206.97069%2010.511C6.292%2010.5461%205.84531%2010.6186%205.44393%2010.7587C5.38623%2010.7788%205.3347%2010.7911%205.32947%2010.7859C5.31323%2010.7698%205.58651%2010.6079%205.81223%2010.4998C6.1305%2010.3474%206.44733%2010.2643%207.15719%2010.1468C7.50785%2010.0887%207.86998%2010.0183%207.96194%209.99029C8.83033%209.72566%209.27671%209.04276%209.13385%208.19748Z%22%2F%3E%3Cpath%20d%3D%22M9.95169%209.64109C9.71465%209.13463%209.66022%208.64564%209.79009%208.18961C9.80399%208.14088%209.82632%208.101%209.83976%208.101C9.85319%208.101%209.90913%208.13105%209.96404%208.16777C10.0733%208.24086%2010.2924%208.36395%2010.876%208.68023C11.6043%209.0749%2012.0196%209.3805%2012.302%209.72965C12.5493%2010.0354%2012.7023%2010.3837%2012.776%2010.8084C12.8177%2011.0489%2012.7932%2011.6277%2012.7311%2011.8699C12.5353%2012.6337%2012.0802%2013.2336%2011.4311%2013.5837C11.336%2013.635%2011.2506%2013.6771%2011.2414%2013.6773C11.2321%2013.6775%2011.2668%2013.5899%2011.3184%2013.4827C11.5367%2013.029%2011.5616%2012.5877%2011.3965%2012.0965C11.2954%2011.7957%2011.0893%2011.4287%2010.6732%2010.8084C10.1893%2010.0873%2010.0707%209.89539%209.95169%209.64109Z%22%2F%3E%3Cpath%20d%3D%22M3.25046%2012.3737C3.91252%2011.8181%204.73629%2011.4234%205.48666%2011.3022C5.81005%2011.25%206.34877%2011.2707%206.64823%2011.3469C7.12824%2011.469%207.55763%2011.7425%207.78094%2012.0683C7.99918%2012.3867%208.09281%2012.6642%208.19029%2013.2816C8.22875%2013.5252%208.27057%2013.7697%208.28323%2013.8251C8.35644%2014.1451%208.4989%2014.4008%208.67544%2014.5293C8.95583%2014.7333%209.43865%2014.7459%209.91362%2014.5618C9.99423%2014.5305%2010.0642%2014.5089%2010.0691%2014.5138C10.0864%2014.5308%209.84719%2014.6899%209.67847%2014.7737C9.45143%2014.8864%209.2709%2014.93%209.03102%2014.93C8.59601%2014.93%208.23486%2014.7101%207.9335%2014.2616C7.87419%2014.1733%207.7409%2013.909%207.63729%2013.6741C7.3191%2012.9528%207.16199%2012.7331%206.79255%2012.4926C6.47104%2012.2834%206.05641%2012.2459%205.74449%2012.3979C5.33475%2012.5976%205.22043%2013.118%205.51389%2013.4478C5.63053%2013.5789%205.84803%2013.6919%206.02588%2013.7139C6.35861%2013.7551%206.64455%2013.5035%206.64455%2013.1696C6.64455%2012.9528%206.56071%2012.8291%206.34966%2012.7344C6.0614%2012.6051%205.75156%2012.7562%205.75304%2013.0254C5.75368%2013.1402%205.80396%2013.2122%205.91971%2013.2643C5.99397%2013.2977%205.99569%2013.3003%205.93514%2013.2878C5.67066%2013.2333%205.6087%2012.9164%205.82135%2012.706C6.07667%2012.4535%206.60461%2012.5649%206.78591%2012.9097C6.86208%2013.0545%206.87092%2013.3429%206.80451%2013.517C6.6559%2013.9068%206.22256%2014.1117%205.78297%2014.0002C5.48368%2013.9242%205.36181%2013.842%205.00097%2013.4726C4.37395%2012.8306%204.13053%2012.7062%203.22657%2012.566L3.05335%2012.5391L3.25046%2012.3737Z%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M0.308383%200.883984C2.40235%203.40996%203.84457%204.45213%204.00484%204.67231C4.13717%204.85412%204.08737%205.01757%203.86067%205.14567C3.7346%205.21689%203.47541%205.28905%203.34564%205.28905C3.19887%205.28905%203.14847%205.23278%203.14847%205.23278C3.06337%205.15255%203.01544%205.16658%202.5784%204.39555C1.97166%203.45981%201.46389%202.68357%201.45004%202.67057C1.41801%202.64052%201.41856%202.64153%202.51654%204.59413C2.69394%205.0011%202.55182%205.15049%202.55182%205.20845C2.55182%205.32636%202.51946%205.38834%202.37311%205.55059C2.12914%205.8211%202.02008%206.12505%201.94135%206.7541C1.8531%207.45926%201.60492%207.95737%200.917156%208.80989C0.514562%209.30893%200.448686%209.4004%200.3471%209.60153C0.219144%209.85482%200.183961%209.99669%200.169701%2010.3165C0.154629%2010.6547%200.183983%2010.8732%200.287934%2011.1965C0.378939%2011.4796%200.473932%2011.6665%200.716778%2012.0403C0.926351%2012.3629%201.04702%2012.6027%201.04702%2012.6965C1.04702%2012.7711%201.06136%2012.7712%201.38611%2012.6983C2.16328%2012.5239%202.79434%2012.2171%203.14925%2011.8411C3.36891%2011.6084%203.42048%2011.4799%203.42215%2011.1611C3.42325%2010.9525%203.41587%2010.9088%203.35914%2010.7888C3.2668%2010.5935%203.09869%2010.4311%202.72817%2010.1794C2.2427%209.84953%202.03534%209.58398%201.97807%209.21878C1.93108%208.91913%201.98559%208.70771%202.25416%208.14825C2.53214%207.56916%202.60103%207.32239%202.64763%206.73869C2.67773%206.36158%202.71941%206.21286%202.82842%206.09348C2.94212%205.969%203.04447%205.92684%203.32584%205.88863C3.78457%205.82635%204.07667%205.70839%204.31677%205.48849C4.52505%205.29772%204.61221%205.11391%204.62558%204.8372L4.63574%204.62747L4.51934%204.49259C4.09783%204.00411%200.0261003%200.5%200.000160437%200.5C-0.00538105%200.5%200.133325%200.672804%200.308383%200.883984ZM1.28364%2010.6992C1.37894%2010.5314%201.3283%2010.3158%201.16889%2010.2104C1.01827%2010.1109%200.78428%2010.1578%200.78428%2010.2875C0.78428%2010.3271%200.806303%2010.3559%200.855937%2010.3813C0.939514%2010.424%200.945581%2010.4721%200.879823%2010.5703C0.81323%2010.6698%200.818604%2010.7573%200.894991%2010.8167C1.0181%2010.9125%201.19237%2010.8598%201.28364%2010.6992Z%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.92523%205.99865C4.70988%206.06439%204.50054%206.29124%204.43574%206.5291C4.39621%206.67421%204.41864%206.92875%204.47785%207.00736C4.57351%207.13433%204.66602%207.16778%204.91651%207.16603C5.40693%207.16263%205.83327%206.95358%205.88284%206.69224C5.92347%206.47801%205.73622%206.18112%205.4783%206.05078C5.34521%205.98355%205.06217%205.95688%204.92523%205.99865ZM5.49853%206.44422C5.57416%206.33741%205.54107%206.22198%205.41245%206.14391C5.1675%205.99525%204.79708%206.11827%204.79708%206.34826C4.79708%206.46274%204.99025%206.58765%205.16731%206.58765C5.28516%206.58765%205.44644%206.5178%205.49853%206.44422Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E' + +var ContentWrapper$3 = styled(AutoColumn)( + templateObject_1$18 || (templateObject_1$18 = __makeTemplateObject(['\n width: 100%;\n'], ['\n width: 100%;\n'])) +) +var ModalUpper = styled(DataCard)( + templateObject_2$Q || + (templateObject_2$Q = __makeTemplateObject( + [ + '\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #021d43 100%);\n', + ], + [ + '\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #021d43 100%);\n', + ] + )) +) +var ConfirmOrLoadingWrapper = styled.div( + templateObject_3$I || + (templateObject_3$I = __makeTemplateObject( + ['\n width: 100%;\n padding: 24px;\n position: relative;\n background: ', ';\n'], + ['\n width: 100%;\n padding: 24px;\n position: relative;\n background: ', ';\n'] + )), + function (_a) { + var activeBG = _a.activeBG + return ( + activeBG && + 'radial-gradient(76.02% 75.41% at 1.84% 0%, rgba(255, 0, 122, 0.2) 0%, rgba(33, 114, 229, 0.2) 100%), #FFFFFF;' + ) + } +) +var ConfirmedIcon$1 = styled(ColumnCenter)( + templateObject_4$x || + (templateObject_4$x = __makeTemplateObject(['\n padding: 60px 0;\n'], ['\n padding: 60px 0;\n'])) +) +var SOCKS_AMOUNT = 1000 +var USER_AMOUNT = 400 +function ClaimModal() { + var _a, _b, _c, _d, _e, _f, _g + var isOpen = useModalOpen(ApplicationModal.SELF_CLAIM) + var toggleClaimModal = useToggleSelfClaimModal() + var _h = useActiveWeb3React(), + account = _h.account, + chainId = _h.chainId + // used for UI loading states + var _j = __read(useState(false), 2), + attempting = _j[0], + setAttempting = _j[1] + // get user claim data + var userClaimData = useUserClaimData(account) + // monitor the status of the claim from contracts and txns + var claimCallback = useClaimCallback(account).claimCallback + var unclaimedAmount = useUserUnclaimedAmount(account) + var _k = useUserHasSubmittedClaim(account !== null && account !== void 0 ? account : undefined), + claimSubmitted = _k.claimSubmitted, + claimTxn = _k.claimTxn + var claimConfirmed = Boolean(claimTxn === null || claimTxn === void 0 ? void 0 : claimTxn.receipt) + function onClaim() { + setAttempting(true) + claimCallback() + // reset modal and log error + .catch(function (error) { + setAttempting(false) + console.log(error) + }) + } + // once confirmed txn is found, if modal is closed open, mark as not attempting regradless + useEffect( + function () { + if (claimConfirmed && claimSubmitted && attempting) { + setAttempting(false) + if (!isOpen) { + toggleClaimModal() + } + } + }, + [attempting, claimConfirmed, claimSubmitted, isOpen, toggleClaimModal] + ) + var nonLPAmount = JSBI.multiply( + JSBI.BigInt( + (( + (_a = userClaimData === null || userClaimData === void 0 ? void 0 : userClaimData.flags) === null || + _a === void 0 + ? void 0 + : _a.isSOCKS + ) + ? SOCKS_AMOUNT + : 0) + + (( + (_b = userClaimData === null || userClaimData === void 0 ? void 0 : userClaimData.flags) === null || + _b === void 0 + ? void 0 + : _b.isUser + ) + ? USER_AMOUNT + : 0) + ), + JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(18)) + ) + return jsxs( + Modal, + __assign( + { isOpen, onDismiss: toggleClaimModal, maxHeight: 90 }, + { + children: [ + jsx(Confetti, { start: Boolean(isOpen && claimConfirmed) }, void 0), + !attempting && + !claimConfirmed && + jsxs( + ContentWrapper$3, + __assign( + { gap: 'lg' }, + { + children: [ + jsxs( + ModalUpper, + { + children: [ + jsx(CardBGImage, {}, void 0), + jsx(CardNoise, {}, void 0), + jsxs( + CardSection, + __assign( + { gap: 'md' }, + { + children: [ + jsxs( + RowBetween, + { + children: [ + jsx( + ThemedText.White, + __assign( + { fontWeight: 500 }, + { children: jsx(Trans, { children: 'Claim UNI' }, void 0) } + ), + void 0 + ), + jsx( + CloseIcon$2, + { onClick: toggleClaimModal, style: { zIndex: 99 }, color: 'white' }, + void 0 + ), + ], + }, + void 0 + ), + jsx( + ThemedText.White, + __assign( + { fontWeight: 700, fontSize: 36 }, + { + children: jsxs( + Trans, + { + children: [ + unclaimedAmount === null || unclaimedAmount === void 0 + ? void 0 + : unclaimedAmount.toFixed( + 0, + (_c = { groupSeparator: ',' }) !== null && _c !== void 0 ? _c : '-' + ), + ' UNI', + ], + }, + void 0 + ), + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + jsx(Break$1, {}, void 0), + jsxs( + CardSection, + __assign( + { gap: 'sm' }, + { + children: [ + ((_d = + userClaimData === null || userClaimData === void 0 + ? void 0 + : userClaimData.flags) === null || _d === void 0 + ? void 0 + : _d.isSOCKS) && + jsxs( + RowBetween, + { + children: [ + jsx( + ThemedText.SubHeader, + __assign({ color: 'white' }, { children: 'SOCKS' }), + void 0 + ), + jsx( + ThemedText.SubHeader, + __assign( + { color: 'white' }, + { children: jsxs(Trans, { children: [SOCKS_AMOUNT, ' UNI'] }, void 0) } + ), + void 0 + ), + ], + }, + void 0 + ), + ((_e = + userClaimData === null || userClaimData === void 0 + ? void 0 + : userClaimData.flags) === null || _e === void 0 + ? void 0 + : _e.isLP) && + unclaimedAmount && + JSBI.greaterThanOrEqual(unclaimedAmount.quotient, nonLPAmount) && + jsxs( + RowBetween, + { + children: [ + jsx( + ThemedText.SubHeader, + __assign( + { color: 'white' }, + { children: jsx(Trans, { children: 'Liquidity' }, void 0) } + ), + void 0 + ), + jsx( + ThemedText.SubHeader, + __assign( + { color: 'white' }, + { + children: jsxs( + Trans, + { + children: [ + unclaimedAmount + .subtract( + CurrencyAmount.fromRawAmount( + unclaimedAmount.currency, + nonLPAmount + ) + ) + .toFixed(0, { groupSeparator: ',' }), + ' ', + 'UNI', + ], + }, + void 0 + ), + } + ), + void 0 + ), + ], + }, + void 0 + ), + ((_f = + userClaimData === null || userClaimData === void 0 + ? void 0 + : userClaimData.flags) === null || _f === void 0 + ? void 0 + : _f.isUser) && + jsxs( + RowBetween, + { + children: [ + jsx( + ThemedText.SubHeader, + __assign( + { color: 'white' }, + { children: jsx(Trans, { children: 'User' }, void 0) } + ), + void 0 + ), + jsx( + ThemedText.SubHeader, + __assign( + { color: 'white' }, + { children: jsxs(Trans, { children: [USER_AMOUNT, ' UNI'] }, void 0) } + ), + void 0 + ), + ], + }, + void 0 + ), + ], + } + ), + void 0 + ), + ], + }, + void 0 + ), + jsxs( + AutoColumn, + __assign( + { gap: 'md', style: { padding: '1rem', paddingTop: '0' }, justify: 'center' }, + { + children: [ + jsx( + ThemedText.SubHeader, + __assign( + { fontWeight: 500 }, + { + children: jsxs( + Trans, + { + children: [ + 'As a member of the Uniswap community you may claim UNI to be used for voting and governance.', + jsx('br', {}, void 0), + jsx('br', {}, void 0), + jsx( + ExternalLink, + __assign( + { href: 'https://uniswap.org/blog/uni' }, + { children: 'Read more about UNI' } + ), + void 0 + ), + ], + }, + void 0 + ), + } + ), + void 0 + ), + jsx( + ButtonPrimary, + __assign( + { + disabled: !isAddress$1(account !== null && account !== void 0 ? account : ''), + padding: '16px 16px', + width: '100%', + $borderRadius: '12px', + mt: '1rem', + onClick: onClaim, + }, + { children: jsx(Trans, { children: 'Claim UNI' }, void 0) } + ), + void 0 + ), + ], + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + (attempting || claimConfirmed) && + jsxs( + ConfirmOrLoadingWrapper, + __assign( + { activeBG: true }, + { + children: [ + jsx(CardNoise, {}, void 0), + jsx(CardBGImageSmaller, { desaturate: true }, void 0), + jsxs( + RowBetween, + { + children: [ + jsx('div', {}, void 0), + jsx( + CloseIcon$2, + { onClick: toggleClaimModal, style: { zIndex: 99 }, stroke: 'black' }, + void 0 + ), + ], + }, + void 0 + ), + jsx( + ConfirmedIcon$1, + { + children: !claimConfirmed + ? jsx(CustomLightSpinner, { src: Circle$1, alt: 'loader', size: '90px' }, void 0) + : jsx(UniTokenAnimated, { width: '72px', src: tokenLogo, alt: 'UNI' }, void 0), + }, + void 0 + ), + jsxs( + AutoColumn, + __assign( + { gap: '100px', justify: 'center' }, + { + children: [ + jsxs( + AutoColumn, + __assign( + { gap: '12px', justify: 'center' }, + { + children: [ + jsx( + ThemedText.LargeHeader, + __assign( + { fontWeight: 600, color: 'black' }, + { + children: claimConfirmed + ? jsx(Trans, { children: 'Claimed!' }, void 0) + : jsx(Trans, { children: 'Claiming' }, void 0), + } + ), + void 0 + ), + !claimConfirmed && + jsx( + Text$1, + __assign( + { fontSize: 36, color: '#ff007a', fontWeight: 800 }, + { + children: jsxs( + Trans, + { + children: [ + unclaimedAmount === null || unclaimedAmount === void 0 + ? void 0 + : unclaimedAmount.toFixed( + 0, + (_g = { groupSeparator: ',' }) !== null && _g !== void 0 + ? _g + : '-' + ), + ' UNI', + ], + }, + void 0 + ), + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + claimConfirmed && + jsx( + Fragment, + { + children: jsx( + ThemedText.SubHeader, + __assign( + { fontWeight: 500, color: 'black' }, + { + children: jsxs( + Trans, + { + children: [ + jsxs( + 'span', + __assign( + { role: 'img', 'aria-label': 'party-hat' }, + { children: ['\uD83C\uDF89', ' '] } + ), + void 0 + ), + 'Welcome to team Unicorn :)', + ' ', + jsx( + 'span', + __assign( + { role: 'img', 'aria-label': 'party-hat' }, + { children: '\uD83C\uDF89' } + ), + void 0 + ), + ], + }, + void 0 + ), + } + ), + void 0 + ), + }, + void 0 + ), + attempting && + !claimSubmitted && + jsx( + ThemedText.SubHeader, + __assign( + { color: 'black' }, + { + children: jsx( + Trans, + { children: 'Confirm this transaction in your wallet' }, + void 0 + ), + } + ), + void 0 + ), + attempting && + claimSubmitted && + !claimConfirmed && + chainId && + (claimTxn === null || claimTxn === void 0 ? void 0 : claimTxn.hash) && + jsx( + ExternalLink, + __assign( + { + href: getExplorerLink( + chainId, + claimTxn === null || claimTxn === void 0 ? void 0 : claimTxn.hash, + ExplorerDataType.TRANSACTION + ), + style: { zIndex: 99 }, + }, + { children: jsx(Trans, { children: 'View transaction on Explorer' }, void 0) } + ), + void 0 + ), + ], + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + ], + } + ), + void 0 + ) +} +var templateObject_1$18, templateObject_2$Q, templateObject_3$I, templateObject_4$x + +var Card = styled(Box)( + templateObject_1$17 || + (templateObject_1$17 = __makeTemplateObject( + ['\n width: ', ';\n padding: ', ';\n border-radius: ', ';\n border: ', ';\n'], + ['\n width: ', ';\n padding: ', ';\n border-radius: ', ';\n border: ', ';\n'] + )), + function (_a) { + var width = _a.width + return width !== null && width !== void 0 ? width : '100%' + }, + function (_a) { + var padding = _a.padding + return padding !== null && padding !== void 0 ? padding : '1rem' + }, + function (_a) { + var $borderRadius = _a.$borderRadius + return $borderRadius !== null && $borderRadius !== void 0 ? $borderRadius : '16px' + }, + function (_a) { + var border = _a.border + return border + } +) +var LightCard = styled(Card)( + templateObject_2$P || + (templateObject_2$P = __makeTemplateObject( + ['\n border: 1px solid ', ';\n background-color: ', ';\n'], + ['\n border: 1px solid ', ';\n background-color: ', ';\n'] + )), + function (_a) { + var theme = _a.theme + return theme.bg2 + }, + function (_a) { + var theme = _a.theme + return theme.bg1 + } +) +var LightGreyCard = styled(Card)( + templateObject_3$H || + (templateObject_3$H = __makeTemplateObject(['\n background-color: ', ';\n'], ['\n background-color: ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.bg2 + } +) +var GreyCard = styled(Card)( + templateObject_4$w || + (templateObject_4$w = __makeTemplateObject(['\n background-color: ', ';\n'], ['\n background-color: ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.bg3 + } +) +var DarkGreyCard = styled(Card)( + templateObject_5$p || + (templateObject_5$p = __makeTemplateObject(['\n background-color: ', ';\n'], ['\n background-color: ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.bg2 + } +) +styled(Card)( + templateObject_6$k || + (templateObject_6$k = __makeTemplateObject(['\n background-color: ', ';\n'], ['\n background-color: ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.bg0 + } +) +var OutlineCard = styled(Card)( + templateObject_7$h || + (templateObject_7$h = __makeTemplateObject(['\n border: 1px solid ', ';\n'], ['\n border: 1px solid ', ';\n'])), + function (_a) { + var theme = _a.theme + return theme.bg3 + } +) +styled(Card)( + templateObject_8$f || + (templateObject_8$f = __makeTemplateObject( + ['\n background-color: rgba(243, 132, 30, 0.05);\n color: ', ';\n font-weight: 500;\n'], + ['\n background-color: rgba(243, 132, 30, 0.05);\n color: ', ';\n font-weight: 500;\n'] + )), + function (_a) { + var theme = _a.theme + return theme.yellow3 + } +) +styled(Card)( + templateObject_9$e || + (templateObject_9$e = __makeTemplateObject( + ['\n background-color: ', ';\n color: ', ';\n border-radius: 12px;\n'], + ['\n background-color: ', ';\n color: ', ';\n border-radius: 12px;\n'] + )), + function (_a) { + var theme = _a.theme + return theme.primary5 + }, + function (_a) { + var theme = _a.theme + return theme.blue2 + } +) +var templateObject_1$17, + templateObject_2$P, + templateObject_3$H, + templateObject_4$w, + templateObject_5$p, + templateObject_6$k, + templateObject_7$h, + templateObject_8$f, + templateObject_9$e + +var Wrapper$h = styled.div( + templateObject_1$16 || + (templateObject_1$16 = __makeTemplateObject( + ['\n max-height: 70vh;\n overflow: auto;\n padding: 0 1rem;\n'], + ['\n max-height: 70vh;\n overflow: auto;\n padding: 0 1rem;\n'] + )) +) +var StyledExternalCard = styled(Card)( + templateObject_2$O || + (templateObject_2$O = __makeTemplateObject( + [ + '\n background-color: ', + ';\n padding: 0.5rem;\n width: 100%;\n\n :hover,\n :focus,\n :active {\n background-color: ', + ';\n }\n', + ], + [ + '\n background-color: ', + ';\n padding: 0.5rem;\n width: 100%;\n\n :hover,\n :focus,\n :active {\n background-color: ', + ';\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.primary5 + }, + function (_a) { + var theme = _a.theme + return theme.primary4 + } +) +var HoverText$1 = styled.div( + templateObject_3$G || + (templateObject_3$G = __makeTemplateObject( + [ + '\n text-decoration: none;\n color: ', + ';\n display: flex;\n align-items: center;\n\n :hover {\n cursor: pointer;\n }\n', + ], + [ + '\n text-decoration: none;\n color: ', + ';\n display: flex;\n align-items: center;\n\n :hover {\n cursor: pointer;\n }\n', + ] + )), + function (_a) { + var theme = _a.theme + return theme.text1 + } +) +var StyledLinkOut = styled(ArrowDown)( + templateObject_4$v || + (templateObject_4$v = __makeTemplateObject( + ['\n transform: rotate(230deg);\n'], + ['\n transform: rotate(230deg);\n'] + )) +) +var EXTERNAL_APIS = [ + { + name: 'Auto Router', + description: jsx( + Trans, + { children: 'The app fetches the optimal trade route from a Uniswap Labs server.' }, + void 0 + ), + }, + { + name: 'Infura', + description: jsx( + Trans, + { children: 'The app fetches on-chain data and constructs contract calls with an Infura API.' }, + void 0 + ), + }, + { + name: 'TRM Labs', + description: jsxs( + Fragment, + { + children: [ + jsx( + Trans, + { + children: + 'The app securely collects your wallet address and shares it with TRM Labs Inc. for risk and compliance reasons.', + }, + void 0 + ), + ' ', + jsx( + ExternalLink, + __assign( + { href: 'https://help.uniswap.org/en/articles/5675203-terms-of-service-faq' }, + { children: jsx(Trans, { children: 'Learn more' }, void 0) } + ), + void 0 + ), + ], + }, + void 0 + ), + }, + { + name: 'Google Analytics', + description: jsx( + Trans, + { children: 'The app logs anonymized usage statistics in order to improve over time.' }, + void 0 + ), + }, + { + name: 'The Graph', + description: jsx( + Trans, + { children: 'The app fetches blockchain data from The Graph\u2019s hosted service.' }, + void 0 + ), + }, +] +function PrivacyPolicyModal() { + var node = useRef() + var open = useModalOpen(ApplicationModal.PRIVACY_POLICY) + var toggle = useTogglePrivacyPolicy() + useEffect( + function () { + if (!open) return + ReactGA.event({ + category: 'Modal', + action: 'Show Legal', + }) + }, + [open] + ) + return jsx( + Modal, + __assign( + { + isOpen: open, + onDismiss() { + return toggle() + }, + }, + { + children: jsxs( + AutoColumn, + __assign( + { gap: '12px', ref: node }, + { + children: [ + jsxs( + RowBetween, + __assign( + { padding: '1rem 1rem 0.5rem 1rem' }, + { + children: [ + jsx( + ThemedText.MediumHeader, + { children: jsx(Trans, { children: 'Legal & Privacy' }, void 0) }, + void 0 + ), + jsx( + HoverText$1, + __assign( + { + onClick() { + return toggle() + }, + }, + { children: jsx(X, { size: 24 }, void 0) } + ), + void 0 + ), + ], + } + ), + void 0 + ), + jsx(PrivacyPolicy, {}, void 0), + ], + } + ), + void 0 + ), + } + ), + void 0 + ) +} +function PrivacyPolicy() { + return jsx( + Wrapper$h, + __assign( + { + draggable: 'true', + onTouchMove(e) { + // prevent modal gesture handler from dismissing modal when content is scrolling + if (isMobile) { + e.stopPropagation() + } + }, + }, + { + children: jsxs( + AutoColumn, + __assign( + { gap: '16px' }, + { + children: [ + jsxs( + AutoColumn, + __assign( + { gap: '8px', style: { width: '100%' } }, + { + children: [ + jsx( + StyledExternalCard, + { + children: jsx( + ExternalLink, + __assign( + { href: 'https://uniswap.org/terms-of-service' }, + { + children: jsxs( + RowBetween, + { + children: [ + jsxs( + AutoRow, + __assign( + { gap: '4px' }, + { + children: [ + jsx(Info, { size: 20 }, void 0), + jsx( + ThemedText.Main, + __assign( + { fontSize: 14, color: 'primaryText1' }, + { + children: jsx( + Trans, + { children: "Uniswap Labs' Terms of Service" }, + void 0 + ), + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + jsx(StyledLinkOut, { size: 20 }, void 0), + ], + }, + void 0 + ), + } + ), + void 0 + ), + }, + void 0 + ), + jsx( + StyledExternalCard, + { + children: jsx( + ExternalLink, + __assign( + { href: 'https://uniswap.org/disclaimer/' }, + { + children: jsxs( + RowBetween, + { + children: [ + jsxs( + AutoRow, + __assign( + { gap: '4px' }, + { + children: [ + jsx(Info, { size: 20 }, void 0), + jsx( + ThemedText.Main, + __assign( + { fontSize: 14, color: 'primaryText1' }, + { + children: jsx(Trans, { children: 'Protocol Disclaimer' }, void 0), + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + jsx(StyledLinkOut, { size: 20 }, void 0), + ], + }, + void 0 + ), + } + ), + void 0 + ), + }, + void 0 + ), + ], + } + ), + void 0 + ), + jsx( + ThemedText.Main, + __assign( + { fontSize: 14 }, + { children: jsx(Trans, { children: 'This app uses the following third-party APIs:' }, void 0) } + ), + void 0 + ), + jsxs( + AutoColumn, + __assign( + { gap: '12px' }, + { + children: [ + EXTERNAL_APIS.map(function (_a, i) { + var name = _a.name, + description = _a.description + return jsx( + DarkGreyCard, + { + children: jsxs( + AutoColumn, + __assign( + { gap: '8px' }, + { + children: [ + jsxs( + AutoRow, + __assign( + { gap: '4px' }, + { + children: [ + jsx(Info, { size: 18 }, void 0), + jsx( + ThemedText.Main, + __assign({ fontSize: 14, color: 'text1' }, { children: name }), + void 0 + ), + ], + } + ), + void 0 + ), + jsx( + ThemedText.Main, + __assign({ fontSize: 14 }, { children: description }), + void 0 + ), + ], + } + ), + void 0 + ), + }, + i + ) + }), + jsx( + Row$1, + __assign( + { justify: 'center', marginBottom: '1rem' }, + { + children: jsx( + ExternalLink, + __assign( + { href: 'https://help.uniswap.org/en/articles/5675203-terms-of-service-faq' }, + { children: jsx(Trans, { children: 'Learn more' }, void 0) } + ), + void 0 + ), + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + ], + } + ), + void 0 + ), + } + ), + void 0 + ) +} +var templateObject_1$16, templateObject_2$O, templateObject_3$G, templateObject_4$v + +/*eslint-disable*/module.exports={messages:{"$-":"$-","$<0/>":"$<0/>","${0}":["$",["0"]],"(${0})":["($",["0"],")"],"(View on Explorer)":"(View on Explorer)","(clear all)":"(clear all)","(edit)":"(edit)","- Remove recipient":"- Remove recipient","0 UNI / week":"0 UNI / week","25%":"25%","50%":"50%","75%":"75%","<0/> All Proposals":"<0/> All Proposals","<0/> Votes":"<0/> Votes","<0>Account analytics and accrued fees<1> ↗ ":"<0>Account analytics and accrued fees<1> ↗ ","<0>Current Price:<1><2/><3>{0} per {1}":["<0>Current Price:<1><2/><3>",["0"]," per ",["1"],""],"<0>Tip: Removing pool tokens converts your position back into underlying tokens at the current rate, proportional to your share of the pool. Accrued fees are included in the amounts you receive.":"<0>Tip: Removing pool tokens converts your position back into underlying tokens at the current rate, proportional to your share of the pool. Accrued fees are included in the amounts you receive.","<0>Tip: Select an action and describe your proposal for the community. The proposal cannot be modified after submission, so please verify all information before submitting. The voting period will begin immediately and last for 7 days. To propose a custom action, <1>read the docs.":"<0>Tip: Select an action and describe your proposal for the community. The proposal cannot be modified after submission, so please verify all information before submitting. The voting period will begin immediately and last for 7 days. To propose a custom action, <1>read the docs.","<0>Tip: Use this tool to find v2 pools that don't automatically appear in the interface.":"<0>Tip: Use this tool to find v2 pools that don't automatically appear in the interface.","<0>Tip: When you add liquidity, you will receive pool tokens representing your position. These tokens automatically earn fees proportional to your share of the pool, and can be redeemed at any time.":"<0>Tip: When you add liquidity, you will receive pool tokens representing your position. These tokens automatically earn fees proportional to your share of the pool, and can be redeemed at any time.","<0>Unlock voting to prepare for the next proposal.":"<0>Unlock voting to prepare for the next proposal.","<0>🎉 Welcome to team Unicorn :) <1>🎉":"<0>🎉 Welcome to team Unicorn :) <1>🎉","A minimum threshold of 0.25% of the total UNI supply is required to submit proposals":"A minimum threshold of 0.25% of the total UNI supply is required to submit proposals","About":"About","Accept":"Accept","Account":"Account","Active":"Active","Add":"Add","Add <0/> and <1/> to Uniswap V2":"Add <0/> and <1/> to Uniswap V2","Add Delegate +":"Add Delegate +","Add Liquidity":"Add Liquidity","Add V2 Liquidity":"Add V2 Liquidity","Add liquidity.":"Add liquidity.","Add more liquidity":"Add more liquidity","Add {0} to Metamask <0/>":["Add ",["0"]," to Metamask <0/>"],"Add {0}-{1} liquidity":["Add ",["0"],"-",["1"]," liquidity"],"Add {0}/{1} V3 liquidity":["Add ",["0"],"/",["1"]," V3 liquidity"],"Added {0}":["Added ",["0"]],"Address has no available claim":"Address has no available claim","Against":"Against","Allow LP token migration":"Allow LP token migration","Allow high price impact trades and skip the confirm screen. Use at your own risk.":"Allow high price impact trades and skip the confirm screen. Use at your own risk.","Allow the Uniswap Protocol to use your {0}":["Allow the Uniswap Protocol to use your ",["0"]],"Allowed":"Allowed","Amount":"Amount","An error occurred when trying to execute this swap. You may need to increase your slippage tolerance. If that does not work, there may be an incompatibility with the token you are trading. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.":"An error occurred when trying to execute this swap. You may need to increase your slippage tolerance. If that does not work, there may be an incompatibility with the token you are trading. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.","Approval pending <0/>":"Approval pending <0/>","Approve":"Approve","Approve Token":"Approve Token","Approve {0}":["Approve ",["0"]],"Approve {0} first":["Approve ",["0"]," first"],"Approved":"Approved","Approving":"Approving","Approving {0}":["Approving ",["0"]],"Arbiscan":"Arbiscan","Arbitrum Bridge":"Arbitrum Bridge","Arbitrum is in Beta and may experience downtime. During downtime, your position will not earn fees and you will be unable to remove liquidity. <0>Read more.":"Arbitrum is in Beta and may experience downtime. During downtime, your position will not earn fees and you will be unable to remove liquidity. <0>Read more.","Are you sure?":"Are you sure?","As a member of the Uniswap community you may claim UNI to be used for voting and governance.<0/><1/><2>Read more about UNI":"As a member of the Uniswap community you may claim UNI to be used for voting and governance.<0/><1/><2>Read more about UNI","At least {0} {1} and {2} {3} will be refunded to your wallet due to selected price range.":["At least ",["0"]," ",["1"]," and ",["2"]," ",["3"]," will be refunded to your wallet due to selected price range."],"Auto":"Auto","Auto Router API":"Auto Router API","Available to deposit: {0}":["Available to deposit: ",["0"]],"Balance: {0}":["Balance: ",["0"]],"Best for exotic pairs.":"Best for exotic pairs.","Best for most pairs.":"Best for most pairs.","Best for stable pairs.":"Best for stable pairs.","Best for very stable pairs.":"Best for very stable pairs.","Best price route costs ~{formattedGasPriceString} in gas.":["Best price route costs ~",["formattedGasPriceString"]," in gas."],"Blocked address":"Blocked address","Bridge":"Bridge","By adding liquidity you'll earn 0.3% of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.":"By adding liquidity you'll earn 0.3% of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.","By adding this list you are implicitly trusting that the data is correct. Anyone can create a list, including creating fake versions of existing lists and lists that claim to represent projects that do not have one.":"By adding this list you are implicitly trusting that the data is correct. Anyone can create a list, including creating fake versions of existing lists and lists that claim to represent projects that do not have one.","By connecting a wallet, you agree to Uniswap Labs’ <0>Terms of Service and acknowledge that you have read and understand the Uniswap <1>Protocol Disclaimer.":"By connecting a wallet, you agree to Uniswap Labs’ <0>Terms of Service and acknowledge that you have read and understand the Uniswap <1>Protocol Disclaimer.","Canceled":"Canceled","Change":"Change","Charts":"Charts","Check network status":"Check network status","Check out our v3 LP walkthrough and migration guides.":"Check out our v3 LP walkthrough and migration guides.","Claim":"Claim","Claim <0/> for {0}":["Claim <0/> for ",["0"]],"Claim UNI":"Claim UNI","Claim UNI Token":"Claim UNI Token","Claim UNI reward for {0}":["Claim UNI reward for ",["0"]],"Claim fees":"Claim fees","Claim your UNI tokens":"Claim your UNI tokens","Claimed":"Claimed","Claimed UNI!":"Claimed UNI!","Claimed!":"Claimed!","Claiming":"Claiming","Claiming UNI":"Claiming UNI","Claiming {0} UNI":["Claiming ",["0"]," UNI"],"Clear All":"Clear All","Clear all":"Clear all","Close":"Close","Closed":"Closed","Collect":"Collect","Collect as WETH":"Collect as WETH","Collect fees":"Collect fees","Collect {0}/{1} fees":["Collect ",["0"],"/",["1"]," fees"],"Collected":"Collected","Collecting":"Collecting","Collecting fees":"Collecting fees","Collecting fees will withdraw currently available fees for you.":"Collecting fees will withdraw currently available fees for you.","Confirm":"Confirm","Confirm Supply":"Confirm Supply","Confirm Swap":"Confirm Swap","Confirm swap":"Confirm swap","Confirm this transaction in your wallet":"Confirm this transaction in your wallet","Confirm transaction in wallet":"Confirm transaction in wallet","Connect Wallet":"Connect Wallet","Connect a wallet":"Connect a wallet","Connect to a wallet to find pools":"Connect to a wallet to find pools","Connect to a wallet to view your V2 liquidity.":"Connect to a wallet to view your V2 liquidity.","Connect to a wallet to view your liquidity.":"Connect to a wallet to view your liquidity.","Connect wallet to swap":"Connect wallet to swap","Connected with {name}":["Connected with ",["name"]],"Copied":"Copied","Copy Address":"Copy Address","Create Pool & Supply":"Create Pool & Supply","Create Proposal":"Create Proposal","Create a pair":"Create a pair","Create a pool":"Create a pool","Create an issue on GitHub":"Create an issue on GitHub","Create pool and add {0}/{1} V3 liquidity":["Create pool and add ",["0"],"/",["1"]," V3 liquidity"],"Create pool.":"Create pool.","Create {0}/{1} V3 pool":["Create ",["0"],"/",["1"]," V3 pool"],"Current price":"Current price","Current {0} Price:":["Current ",["0"]," Price:"],"Custom":"Custom","Dark Theme":"Dark Theme","Defeated":"Defeated","Delegate Votes":"Delegate Votes","Delegate voting power to {0}":["Delegate voting power to ",["0"]],"Delegated to:":"Delegated to:","Delegating votes":"Delegating votes","Deposit":"Deposit","Deposit Amounts":"Deposit Amounts","Deposit UNI-V2 LP Tokens":"Deposit UNI-V2 LP Tokens","Deposit liquidity":"Deposit liquidity","Deposit tokens to the {label} network.":["Deposit tokens to the ",["label"]," network."],"Deposit your Liquidity Provider tokens to receive UNI, the Uniswap protocol governance token.":"Deposit your Liquidity Provider tokens to receive UNI, the Uniswap protocol governance token.","Deposited liquidity:":"Deposited liquidity:","Deposited {0} UNI-V2":["Deposited ",["0"]," UNI-V2"],"Depositing Liquidity":"Depositing Liquidity","Description":"Description","Detailed":"Detailed","Details":"Details","Disconnect":"Disconnect","Discord":"Discord","Dismiss":"Dismiss","Docs":"Docs","Don’t see one of your v2 positions? <0>Import it.":"Don’t see one of your v2 positions? <0>Import it.","Earned UNI tokens represent voting shares in Uniswap governance.":"Earned UNI tokens represent voting shares in Uniswap governance.","Edit":"Edit","Efficiency Comparison":"Efficiency Comparison","Enter a percent":"Enter a percent","Enter a recipient":"Enter a recipient","Enter a valid slippage percentage":"Enter a valid slippage percentage","Enter an address to trigger a UNI claim. If the address has any claimable UNI it will be sent to them on submission.":"Enter an address to trigger a UNI claim. If the address has any claimable UNI it will be sent to them on submission.","Enter an amount":"Enter an amount","Enter valid list location":"Enter valid list location","Enter valid token address":"Enter valid token address","Enter {0} amount":["Enter ",["0"]," amount"],"Error":"Error","Error connecting":"Error connecting","Error connecting. Try refreshing the page.":"Error connecting. Try refreshing the page.","Error details":"Error details","Error importing list":"Error importing list","Estimate may differ due to your wallet gas settings":"Estimate may differ due to your wallet gas settings","Estimated network fee":"Estimated network fee","Etherscan":"Etherscan","Executed":"Executed","Expanded results from inactive Token Lists":"Expanded results from inactive Token Lists","Expected Output":"Expected Output","Expert Mode":"Expert Mode","Expert mode turns off the confirm transaction prompt and allows high slippage trades that often result in bad rates and lost funds.":"Expert mode turns off the confirm transaction prompt and allows high slippage trades that often result in bad rates and lost funds.","Expired":"Expired","Explore Uniswap Analytics.":"Explore Uniswap Analytics.","Failed to switch networks from the Uniswap Interface. In order to use Uniswap on {0}, you must change the network in your wallet.":["Failed to switch networks from the Uniswap Interface. In order to use Uniswap on ",["0"],", you must change the network in your wallet."],"Fee Tier":"Fee Tier","Fee tier":"Fee tier","Fetching best price...":"Fetching best price...","Fetching best price…":"Fetching best price…","For":"For","For each pool shown below, click migrate to remove your liquidity from Uniswap V2 and deposit it into Uniswap V3.":"For each pool shown below, click migrate to remove your liquidity from Uniswap V2 and deposit it into Uniswap V3.","From":"From","From (at most)":"From (at most)","Full Range":"Full Range","Full range positions may earn less fees than concentrated positions. Learn more <0>here.":"Full range positions may earn less fees than concentrated positions. Learn more <0>here.","Get support on Discord":"Get support on Discord","Help Center":"Help Center","Hide":"Hide","Hide closed positions":"Hide closed positions","High Price Impact":"High Price Impact","How this app uses APIs":"How this app uses APIs","I understand":"I understand","If you purchase a token from this list, you may not be able to sell it back.":"If you purchase a token from this list, you may not be able to sell it back.","Import":"Import","Import List":"Import List","Import Pool":"Import Pool","Import V2 Pool":"Import V2 Pool","Import at your own risk":"Import at your own risk","In range":"In range","Increase Liquidity":"Increase Liquidity","Initial prices and pool share":"Initial prices and pool share","Initializing...":"Initializing...","Input is estimated. You will sell at most <0>{0} {1} or the transaction will revert.":["Input is estimated. You will sell at most <0>",["0"]," ",["1"]," or the transaction will revert."],"Install Metamask":"Install Metamask","Insufficient liquidity for this trade.":"Insufficient liquidity for this trade.","Insufficient {0}":["Insufficient ",["0"]],"Insufficient {0} balance":["Insufficient ",["0"]," balance"],"Interface Settings":"Interface Settings","Invalid pair":"Invalid pair","Invalid pair.":"Invalid pair.","Invalid price input":"Invalid price input","Invalid range selected. The min price must be lower than the max price.":"Invalid range selected. The min price must be lower than the max price.","Invalid recipient":"Invalid recipient","Language":"Language","Learn":"Learn","Learn about providing liquidity":"Learn about providing liquidity","Learn more":"Learn more","Legal & Privacy":"Legal & Privacy","Light Theme":"Light Theme","Liquidity":"Liquidity","Liquidity data not available.":"Liquidity data not available.","Liquidity provider rewards":"Liquidity provider rewards","Liquidity providers earn a 0.3% fee on all trades proportional to their share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.":"Liquidity providers earn a 0.3% fee on all trades proportional to their share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.","Lists":"Lists","Loaded":"Loaded","Loading":"Loading","MAX":"MAX","Manage":"Manage","Manage Liquidity in Rewards Pool":"Manage Liquidity in Rewards Pool","Manage Token Lists":"Manage Token Lists","Manage this pool.":"Manage this pool.","Max":"Max","Max Price":"Max Price","Max price":"Max price","Max slippage":"Max slippage","Max:":"Max:","Maximum sent":"Maximum sent","Menu":"Menu","Migrate":"Migrate","Migrate Liquidity to V3":"Migrate Liquidity to V3","Migrate V2 Liquidity":"Migrate V2 Liquidity","Migrate your liquidity tokens from Uniswap V2 to Uniswap V3.":"Migrate your liquidity tokens from Uniswap V2 to Uniswap V3.","Migrate {0}/{1} liquidity to V3":["Migrate ",["0"],"/",["1"]," liquidity to V3"],"Migrating":"Migrating","Min Price":"Min Price","Min price":"Min price","Min:":"Min:","Minimum received":"Minimum received","Missing dependencies":"Missing dependencies","Mock Toggle":"Mock Toggle","More":"More","Network Fee":"Network Fee","Network Warning":"Network Warning","Network fees exceed 50% of the swap amount!":"Network fees exceed 50% of the swap amount!","New Position":"New Position","No V2 Liquidity found.":"No V2 Liquidity found.","No active pools":"No active pools","No data":"No data","No description.":"No description.","No liquidity found.":"No liquidity found.","No pool found.":"No pool found.","No proposals found.":"No proposals found.","No results found.":"No results found.","Not created":"Not created","OFF":"OFF","ON":"ON","ONLY USE THIS MODE IF YOU KNOW WHAT YOU ARE DOING.":"ONLY USE THIS MODE IF YOU KNOW WHAT YOU ARE DOING.","Off":"Off","On":"On","Once you are happy with the rate click supply to review.":"Once you are happy with the rate click supply to review.","Only UNI votes that were self delegated or delegated to another address before block {0} are eligible for voting.":["Only UNI votes that were self delegated or delegated to another address before block ",["0"]," are eligible for voting."],"Oops! An unknown error occurred. Please refresh the page, or visit from another browser or device.":"Oops! An unknown error occurred. Please refresh the page, or visit from another browser or device.","Optimism Gateway":"Optimism Gateway","Optimism is in Beta and may experience downtime. Optimism expects planned downtime to upgrade the network in the near future. During downtime, your position will not earn fees and you will be unable to remove liquidity. <0>Read more.":"Optimism is in Beta and may experience downtime. Optimism expects planned downtime to upgrade the network in the near future. During downtime, your position will not earn fees and you will be unable to remove liquidity. <0>Read more.","Optimistic Etherscan":"Optimistic Etherscan","Out of range":"Out of range","Output is estimated.":"Output is estimated.","Output is estimated. If the price changes by more than {0}% your transaction will revert.":["Output is estimated. If the price changes by more than ",["0"],"% your transaction will revert."],"Output is estimated. You will receive at least <0>{0} {1} or the transaction will revert.":["Output is estimated. You will receive at least <0>",["0"]," ",["1"]," or the transaction will revert."],"Output will be sent to <0>{0}":["Output will be sent to <0>",["0"],""],"Owner":"Owner","Participating pools":"Participating pools","Pending":"Pending","Please confirm you would like to remove this list by typing REMOVE":"Please confirm you would like to remove this list by typing REMOVE","Please connect to Layer 1 Ethereum":"Please connect to Layer 1 Ethereum","Please connect to a supported network in the dropdown menu or in your wallet.":"Please connect to a supported network in the dropdown menu or in your wallet.","Please type the word \"{confirmWord}\" to enable expert mode.":["Please type the word \"",["confirmWord"],"\" to enable expert mode."],"Polygon Bridge":"Polygon Bridge","Polygonscan":"Polygonscan","Pool":"Pool","Pool Found!":"Pool Found!","Pool Rate":"Pool Rate","Pool rate":"Pool rate","Pool tokens in rewards pool:":"Pool tokens in rewards pool:","Pooled {0}:":["Pooled ",["0"],":"],"Pools Overview":"Pools Overview","Preview":"Preview","Price":"Price","Price Difference:":"Price Difference:","Price Impact":"Price Impact","Price Impact Too High":"Price Impact Too High","Price Updated":"Price Updated","Price impact":"Price impact","Price range":"Price range","Price updated":"Price updated","Price:":"Price:","Prices and pool share":"Prices and pool share","Proposal":"Proposal","Proposal Submitted":"Proposal Submitted","Proposal Title":"Proposal Title","Proposals":"Proposals","Proposals submitted by community members will appear here.":"Proposals submitted by community members will appear here.","Proposed Action":"Proposed Action","Proposer":"Proposer","Protocol Disclaimer":"Protocol Disclaimer","Queued":"Queued","Rates":"Rates","Read more about UNI":"Read more about UNI","Read more about Uniswap governance":"Read more about Uniswap governance","Read more about providing liquidity":"Read more about providing liquidity","Read more about unsupported assets":"Read more about unsupported assets","Recent Transactions":"Recent Transactions","Recent transactions":"Recent transactions","Recipient":"Recipient","Reload the page":"Reload the page","Remove":"Remove","Remove <0/> and <1/>":"Remove <0/> and <1/>","Remove Amount":"Remove Amount","Remove Delegate":"Remove Delegate","Remove Liquidity":"Remove Liquidity","Remove list":"Remove list","Removing {0} {1} and {2} {3}":["Removing ",["0"]," ",["1"]," and ",["2"]," ",["3"]],"Removing {0} {1} and{2} {3}":["Removing ",["0"]," ",["1"]," and",["2"]," ",["3"]],"Request Features":"Request Features","Reset":"Reset","Return":"Return","Review swap":"Review swap","Search by token name or address":"Search by token name or address","Search name or paste address":"Search name or paste address","Select Pair":"Select Pair","Select a network":"Select a network","Select a token":"Select a token","Select a token to find your v2 liquidity.":"Select a token to find your v2 liquidity.","Select an action":"Select an action","Selected Range":"Selected Range","Self":"Self","Self Delegate":"Self Delegate","Set Price Range":"Set Price Range","Set Starting Price":"Set Starting Price","Settings":"Settings","Share of Pool":"Share of Pool","Share of Pool:":"Share of Pool:","Show Portis":"Show Portis","Show closed positions":"Show closed positions","Simple":"Simple","Slippage tolerance":"Slippage tolerance","Some assets are not available through this interface because they may not work well with the smart contracts or we are unable to allow trading for legal reasons.":"Some assets are not available through this interface because they may not work well with the smart contracts or we are unable to allow trading for legal reasons.","Something went wrong":"Something went wrong","Something went wrong.":"Something went wrong.","Step 1. Get UNI-V2 Liquidity tokens":"Step 1. Get UNI-V2 Liquidity tokens","Submit new proposal":"Submit new proposal","Submitting Proposal":"Submitting Proposal","Submitting Vote":"Submitting Vote","Succeeded":"Succeeded","Success":"Success","Supply":"Supply","Supplying {0} {1} and {2} {3}":["Supplying ",["0"]," ",["1"]," and ",["2"]," ",["3"]],"Swap":"Swap","Swap <0/> for exactly <1/>":"Swap <0/> for exactly <1/>","Swap Anyway":"Swap Anyway","Swap details":"Swap details","Swap exactly <0/> for <1/>":"Swap exactly <0/> for <1/>","Swap failed: {0}":["Swap failed: ",["0"]],"Swap summary":"Swap summary","Swapping {0} {1} for {2} {3}":["Swapping ",["0"]," ",["1"]," for ",["2"]," ",["3"]],"Take a 10 minute survey to help us improve your experience in the Uniswap app.":"Take a 10 minute survey to help us improve your experience in the Uniswap app.","Tell us what you think ↗":"Tell us what you think ↗","Thanks for being part of the Uniswap community <0/>":"Thanks for being part of the Uniswap community <0/>","The % you will earn in fees.":"The % you will earn in fees.","The Uniswap invariant x*y=k was not satisfied by the swap. This usually means one of the tokens you are swapping incorporates custom behavior on transfer.":"The Uniswap invariant x*y=k was not satisfied by the swap. This usually means one of the tokens you are swapping incorporates custom behavior on transfer.","The app fetches blockchain data from The Graph’s hosted service.":"The app fetches blockchain data from The Graph’s hosted service.","The app fetches on-chain data and constructs contract calls with an Infura API.":"The app fetches on-chain data and constructs contract calls with an Infura API.","The app fetches the optimal trade route from a Uniswap Labs server.":"The app fetches the optimal trade route from a Uniswap Labs server.","The app logs anonymized usage statistics in order to improve over time.":"The app logs anonymized usage statistics in order to improve over time.","The app securely collects your wallet address and shares it with TRM Labs Inc. for risk and compliance reasons.":"The app securely collects your wallet address and shares it with TRM Labs Inc. for risk and compliance reasons.","The cost of sending this transaction is more than half of the value of the input amount.":"The cost of sending this transaction is more than half of the value of the input amount.","The current fast gas amount for sending a transaction on L1. Gas fees are paid in Ethereum's native currency Ether (ETH) and denominated in GWEI.":"The current fast gas amount for sending a transaction on L1. Gas fees are paid in Ethereum's native currency Ether (ETH) and denominated in GWEI.","The estimated difference between the USD values of input and output amounts.":"The estimated difference between the USD values of input and output amounts.","The input token cannot be transferred. There may be an issue with the input token.":"The input token cannot be transferred. There may be an issue with the input token.","The market price is outside your specified price range. Single-asset deposit only.":"The market price is outside your specified price range. Single-asset deposit only.","The most recent block number on this network. Prices update on every block.":"The most recent block number on this network. Prices update on every block.","The output token cannot be transferred. There may be an issue with the output token.":"The output token cannot be transferred. There may be an issue with the output token.","The output token cannot be transferred. There may be an issue with the output token. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.":"The output token cannot be transferred. There may be an issue with the output token. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.","The price of this pool is outside of your selected range. Your position is not currently earning fees.":"The price of this pool is outside of your selected range. Your position is not currently earning fees.","The price of this pool is within your selected range. Your position is currently earning fees.":"The price of this pool is within your selected range. Your position is currently earning fees.","The ratio of tokens you add will set the price of this pool.":"The ratio of tokens you add will set the price of this pool.","The transaction could not be sent because the deadline has passed. Please check that your transaction deadline is not too low.":"The transaction could not be sent because the deadline has passed. Please check that your transaction deadline is not too low.","There is no liquidity data.":"There is no liquidity data.","This app uses the following third-party APIs:":"This app uses the following third-party APIs:","This pool must be initialized before you can add liquidity. To initialize, select a starting price for the pool. Then, enter your liquidity price range and deposit amount. Gas fees will be higher than usual due to the initialization transaction.":"This pool must be initialized before you can add liquidity. To initialize, select a starting price for the pool. Then, enter your liquidity price range and deposit amount. Gas fees will be higher than usual due to the initialization transaction.","This route optimizes your total output by considering split routes, multiple hops, and the gas cost of each step.":"This route optimizes your total output by considering split routes, multiple hops, and the gas cost of each step.","This token doesn't appear on the active token list(s). Make sure this is the token that you want to trade.":"This token doesn't appear on the active token list(s). Make sure this is the token that you want to trade.","This token is not supported in the Uniswap Labs app":"This token is not supported in the Uniswap Labs app","This tool will safely migrate your {0} liquidity to V3. The process is completely trustless thanks to the":["This tool will safely migrate your ",["0"]," liquidity to V3. The process is completely trustless thanks to the"],"This transaction will not succeed due to price movement. Try increasing your slippage tolerance. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.":"This transaction will not succeed due to price movement. Try increasing your slippage tolerance. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.","This transaction will not succeed either due to price movement or fee on transfer. Try increasing your slippage tolerance.":"This transaction will not succeed either due to price movement or fee on transfer. Try increasing your slippage tolerance.","Tip: Custom tokens are stored locally in your browser":"Tip: Custom tokens are stored locally in your browser","To":"To","To (at least)":"To (at least)","Token not supported":"Token not supported","Tokens":"Tokens","Tokens from inactive lists. Import specific tokens below or click Manage to activate more lists.":"Tokens from inactive lists. Import specific tokens below or click Manage to activate more lists.","Top pools":"Top pools","Total deposited":"Total deposited","Total deposits":"Total deposits","Trade Route":"Trade Route","Trading":"Trading","Transaction Settings":"Transaction Settings","Transaction Submitted":"Transaction Submitted","Transaction completed in":"Transaction completed in","Transaction deadline":"Transaction deadline","Transaction pending":"Transaction pending","Transaction rejected.":"Transaction rejected.","Transaction submitted":"Transaction submitted","Transfer Token":"Transfer Token","Try Again":"Try Again","Try increasing your slippage tolerance.<0/>NOTE: Fee on transfer and rebase tokens are incompatible with Uniswap V3.":"Try increasing your slippage tolerance.<0/>NOTE: Fee on transfer and rebase tokens are incompatible with Uniswap V3.","Turn On Expert Mode":"Turn On Expert Mode","UNI has arrived":"UNI has arrived","UNI tokens represent voting shares in Uniswap governance. You can vote on each proposal yourself or delegate your votes to a third party.":"UNI tokens represent voting shares in Uniswap governance. You can vote on each proposal yourself or delegate your votes to a third party.","UNI {0}/{1} Burned":["UNI ",["0"],"/",["1"]," Burned"],"UNI-V2 LP tokens are required. Once you've added liquidity to the {0}-{1} pool you can stake your liquidity tokens on this page.":["UNI-V2 LP tokens are required. Once you've added liquidity to the ",["0"],"-",["1"]," pool you can stake your liquidity tokens on this page."],"UNI-V2 {0}-{1}":["UNI-V2 ",["0"],"-",["1"]],"Unclaimed UNI":"Unclaimed UNI","Unclaimed fees":"Unclaimed fees","Undetermined":"Undetermined","Unexpected error. Could not estimate gas for the swap.":"Unexpected error. Could not estimate gas for the swap.","Unexpected issue with estimating the gas. Please try again.":"Unexpected issue with estimating the gas. Please try again.","Uniswap Governance":"Uniswap Governance","Uniswap Labs' Terms of Service":"Uniswap Labs' Terms of Service","Uniswap available in: <0>{0}":["Uniswap available in: <0>",["0"],""],"Uniswap governance is only available on Layer 1. Switch your network to Ethereum Mainnet to view Proposals and Vote.":"Uniswap governance is only available on Layer 1. Switch your network to Ethereum Mainnet to view Proposals and Vote.","Uniswap liquidity mining":"Uniswap liquidity mining","Uniswap migration contract↗":"Uniswap migration contract↗","Unknown Source":"Unknown Source","Unknown error{0}. Try increasing your slippage tolerance. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.":["Unknown error",["0"],". Try increasing your slippage tolerance. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3."],"Unlock Votes":"Unlock Votes","Unlock Voting":"Unlock Voting","Unlocking Votes":"Unlocking Votes","Unsupported Asset":"Unsupported Asset","Unsupported Assets":"Unsupported Assets","Unsupported network–switch to another to trade.":"Unsupported network–switch to another to trade.","Untitled":"Untitled","Unwrap":"Unwrap","Unwrap <0/> to {0}":["Unwrap <0/> to ",["0"]],"Update Delegation":"Update Delegation","Update list":"Update list","Use the Uniswap Labs API to get faster quotes.":"Use the Uniswap Labs API to get faster quotes.","User":"User","V2 is not available on Layer 2. Switch to Layer 1 Ethereum.":"V2 is not available on Layer 2. Switch to Layer 1 Ethereum.","V2 liquidity":"V2 liquidity","V3 {0} Price:":["V3 ",["0"]," Price:"],"View accrued fees and analytics<0>↗":"View accrued fees and analytics<0>↗","View list":"View list","View on Etherscan":"View on Etherscan","View on Explorer":"View on Explorer","View transaction on Explorer":"View transaction on Explorer","Vote":"Vote","Vote Against":"Vote Against","Vote For":"Vote For","Vote against proposal {proposalId}":["Vote against proposal ",["proposalId"]],"Vote against proposal {proposalKey}":["Vote against proposal ",["proposalKey"]],"Vote against proposal {proposalKey} with reason \"{0}\"":["Vote against proposal ",["proposalKey"]," with reason \"",["0"],"\""],"Vote for proposal {proposalId}":["Vote for proposal ",["proposalId"]],"Vote for proposal {proposalKey}":["Vote for proposal ",["proposalKey"]],"Vote for proposal {proposalKey} with reason \"{0}\"":["Vote for proposal ",["proposalKey"]," with reason \"",["0"],"\""],"Vote to abstain on proposal {proposalId}":["Vote to abstain on proposal ",["proposalId"]],"Vote to abstain on proposal {proposalKey}":["Vote to abstain on proposal ",["proposalKey"]],"Vote to abstain on proposal {proposalKey} with reason \"{0}\"":["Vote to abstain on proposal ",["proposalKey"]," with reason \"",["0"],"\""],"Voting ended {0}":["Voting ended ",["0"]],"Voting ends approximately {0}":["Voting ends approximately ",["0"]],"Voting starts approximately {0}":["Voting starts approximately ",["0"]],"Waiting For Confirmation":"Waiting For Confirmation","Wallet Address or ENS name":"Wallet Address or ENS name","Weekly Rewards":"Weekly Rewards","Welcome to team Unicorn :)":"Welcome to team Unicorn :)","When you claim without withdrawing your liquidity remains in the mining pool.":"When you claim without withdrawing your liquidity remains in the mining pool.","When you withdraw, the contract will automagically claim UNI on your behalf!":"When you withdraw, the contract will automagically claim UNI on your behalf!","When you withdraw, your UNI is claimed and your liquidity is removed from the mining pool.":"When you withdraw, your UNI is claimed and your liquidity is removed from the mining pool.","Withdraw":"Withdraw","Withdraw & Claim":"Withdraw & Claim","Withdraw deposited liquidity":"Withdraw deposited liquidity","Withdrawing {0} UNI-V2":["Withdrawing ",["0"]," UNI-V2"],"Withdrew UNI-V2!":"Withdrew UNI-V2!","Wrap":"Wrap","Wrap <0/> to {0}":["Wrap <0/> to ",["0"]],"Wrong Network":"Wrong Network","You already have an active or pending proposal":"You already have an active or pending proposal","You are creating a pool":"You are creating a pool","You are the first liquidity provider for this Uniswap V3 pool. Your liquidity will migrate at the current {0} price.":["You are the first liquidity provider for this Uniswap V3 pool. Your liquidity will migrate at the current ",["0"]," price."],"You are the first liquidity provider.":"You are the first liquidity provider.","You can either vote on each proposal yourself or delegate your votes to a third party.":"You can either vote on each proposal yourself or delegate your votes to a third party.","You can now trade {0}":["You can now trade ",["0"]],"You don't have enough votes to submit a proposal":"You don't have enough votes to submit a proposal","You don’t have liquidity in this pool yet.":"You don’t have liquidity in this pool yet.","You may have lost your network connection, or {label} might be down right now.":["You may have lost your network connection, or ",["label"]," might be down right now."],"You may have lost your network connection.":"You may have lost your network connection.","You might consider waiting until the network fees go down to complete this transaction.":"You might consider waiting until the network fees go down to complete this transaction.","You must connect an account.":"You must connect an account.","You must give the Uniswap smart contracts permission to use your {0}. You only have to do this once per token.":["You must give the Uniswap smart contracts permission to use your ",["0"],". You only have to do this once per token."],"You must have {formattedProposalThreshold} votes to submit a proposal":["You must have ",["formattedProposalThreshold"]," votes to submit a proposal"],"You should only deposit liquidity into Uniswap V3 at a price you believe is correct. <0/>If the price seems incorrect, you can either make a swap to move the price or wait for someone else to do so.":"You should only deposit liquidity into Uniswap V3 at a price you believe is correct. <0/>If the price seems incorrect, you can either make a swap to move the price or wait for someone else to do so.","You will also collect fees earned from this position.":"You will also collect fees earned from this position.","You will receive":"You will receive","You will receive at least {0} {1} or the transaction will revert.":["You will receive at least ",["0"]," ",["1"]," or the transaction will revert."],"You will send at most {0} {1} or the transaction will revert.":["You will send at most ",["0"]," ",["1"]," or the transaction will revert."],"Your V2 liquidity":"Your V2 liquidity","Your active V3 liquidity positions will appear here.":"Your active V3 liquidity positions will appear here.","Your liquidity deposits":"Your liquidity deposits","Your pool share:":"Your pool share:","Your position":"Your position","Your position has 0 liquidity, and is not earning fees.":"Your position has 0 liquidity, and is not earning fees.","Your position will appear here.":"Your position will appear here.","Your position will be 100% composed of {0} at this price":["Your position will be 100% composed of ",["0"]," at this price"],"Your position will be 100% {0} at this price.":["Your position will be 100% ",["0"]," at this price."],"Your position will not earn fees or be used in trades until the market price moves into your range.":"Your position will not earn fees or be used in trades until the market price moves into your range.","Your positions":"Your positions","Your rate":"Your rate","Your total pool tokens:":"Your total pool tokens:","Your transaction cost will be much higher as it includes the gas to create the pool.":"Your transaction cost will be much higher as it includes the gas to create the pool.","Your transaction may be frontrun":"Your transaction may be frontrun","Your transaction may fail":"Your transaction may fail","Your transaction will revert if it has been pending for longer than this period of time.":"Your transaction will revert if it has been pending for longer than this period of time.","Your transaction will revert if it is pending for more than this period of time.":"Your transaction will revert if it is pending for more than this period of time.","Your transaction will revert if the price changes unfavorably by more than this percentage.":"Your transaction will revert if the price changes unfavorably by more than this percentage.","Your transactions will appear here...":"Your transactions will appear here...","Your unclaimed UNI":"Your unclaimed UNI","after slippage":"after slippage","confirm":"confirm","for {0}":["for ",["0"]],"gwei":"gwei","has socks emoji":"has socks emoji","here.":"here.","https:// or ipfs:// or ENS name":"https:// or ipfs:// or ENS name","minutes":"minutes","via {0}":["via ",["0"]],"via {0} token list":["via ",["0"]," token list"],"{0, plural, one {Import token} other {Import tokens}}":[["0","plural",{one:"Import token",other:"Import tokens"}]],"{0}":[["0"]],"{0} %":[["0"]," %"],"{0} <0/> per <1/>":[["0"]," <0/> per <1/>"],"{0} Custom Tokens":[["0"]," Custom Tokens"],"{0} Deposited":[["0"]," Deposited"],"{0} ETH":[["0"]," ETH"],"{0} Fees Earned:":[["0"]," Fees Earned:"],"{0} Pending":[["0"]," Pending"],"{0} UNI":[["0"]," UNI"],"{0} UNI / week":[["0"]," UNI / week"],"{0} UNI-V2":[["0"]," UNI-V2"],"{0} UNI-V2 LP tokens available":[["0"]," UNI-V2 LP tokens available"],"{0} Votes":[["0"]," Votes"],"{0} per {1}":[["0"]," per ",["1"]],"{0} tokens":[["0"]," tokens"],"{0} {1} Price:":[["0"]," ",["1"]," Price:"],"{0} {nativeCurrencySymbol}":[["0"]," ",["nativeCurrencySymbol"]],"{0} • Added by user":[["0"]," • Added by user"],"{0}%":[["0"],"%"],"{0}% fee tier":[["0"],"% fee tier"],"{0}% pool":[["0"],"% pool"],"{0}% select":[["0"],"% select"],"{0}-{1} Liquidity Mining":[["0"],"-",["1"]," Liquidity Mining"],"{0}/{1} LP NFT":[["0"],"/",["1"]," LP NFT"],"{0}/{1} LP Tokens":[["0"],"/",["1"]," LP Tokens"],"{SOCKS_AMOUNT} UNI":[["SOCKS_AMOUNT"]," UNI"],"{USER_AMOUNT} UNI":[["USER_AMOUNT"]," UNI"],"{activeTokensOnThisChain} tokens":[["activeTokensOnThisChain"]," tokens"],"{integrator} fee":[["integrator"]," fee"],"{label} token bridge":[["label"]," token bridge"],"{min}m {sec}s":[["min"],"m ",["sec"],"s"],"{percentForSlider}%":[["percentForSlider"],"%"],"{sec}s":[["sec"],"s"],"{tokenB} per {tokenA}":[["tokenB"]," per ",["tokenA"]],"← Back to Pools Overview":"← Back to Pools Overview"}}; + +var enUS = /*#__PURE__*/Object.freeze({ + __proto__: null +}); + +var SUPPORTED_LOCALES = [ + // order as they appear in the language dropdown + 'en-US', + 'af-ZA', + 'ar-SA', + 'ca-ES', + 'cs-CZ', + 'da-DK', + 'de-DE', + 'el-GR', + 'es-ES', + 'fi-FI', + 'fr-FR', + 'he-IL', + 'hu-HU', + 'id-ID', + 'it-IT', + 'ja-JP', + 'ko-KR', + 'nl-NL', + 'no-NO', + 'pl-PL', + 'pt-BR', + 'pt-PT', + 'ro-RO', + 'ru-RU', + 'sr-SP', + 'sv-SE', + 'sw-TZ', + 'tr-TR', + 'uk-UA', + 'vi-VN', + 'zh-CN', + 'zh-TW', +]; +var DEFAULT_LOCALE = 'en-US'; +var DEFAULT_CATALOG = enUS; +var LOCALE_LABEL = { + 'af-ZA': 'Afrikaans', + 'ar-SA': 'العربية', + 'ca-ES': 'Català', + 'cs-CZ': 'čeština', + 'da-DK': 'dansk', + 'de-DE': 'Deutsch', + 'el-GR': 'ελληνικά', + 'en-US': 'English', + 'es-ES': 'Español', + 'fi-FI': 'suomi', + 'fr-FR': 'français', + 'he-IL': 'עִברִית', + 'hu-HU': 'Magyar', + 'id-ID': 'bahasa Indonesia', + 'it-IT': 'Italiano', + 'ja-JP': '日本語', + 'ko-KR': '한국어', + 'nl-NL': 'Nederlands', + 'no-NO': 'norsk', + 'pl-PL': 'Polskie', + 'pt-BR': 'português', + 'pt-PT': 'português', + 'ro-RO': 'Română', + 'ru-RU': 'русский', + 'sr-SP': 'Српски', + 'sv-SE': 'svenska', + 'sw-TZ': 'Kiswahili', + 'tr-TR': 'Türkçe', + 'uk-UA': 'Український', + 'vi-VN': 'Tiếng Việt', + 'zh-CN': '简体中文', + 'zh-TW': '繁体中文', + pseudo: 'ƥƨèúδô', +}; + +var _a$4, _b$2, _c$2; +/** + * Given a locale string (e.g. from user agent), return the best match for corresponding SupportedLocale + * @param maybeSupportedLocale the fuzzy locale identifier + */ +function parseLocale(maybeSupportedLocale) { + if (typeof maybeSupportedLocale !== 'string') + return undefined; + var lowerMaybeSupportedLocale = maybeSupportedLocale.toLowerCase(); + return SUPPORTED_LOCALES.find(function (locale) { return locale.toLowerCase() === lowerMaybeSupportedLocale || locale.split('-')[0] === lowerMaybeSupportedLocale; }); +} +/** + * Returns the supported locale read from the user agent (navigator) + */ +function navigatorLocale() { + var _a; + if (!navigator.language) + return undefined; + var _b = __read(navigator.language.split('-'), 2), language = _b[0], region = _b[1]; + if (region) { + return (_a = parseLocale(language + "-" + region.toUpperCase())) !== null && _a !== void 0 ? _a : parseLocale(language); + } + return parseLocale(language); +} +function storeLocale() { + var _a; + return (_a = store.getState().user.userLocale) !== null && _a !== void 0 ? _a : undefined; +} +var initialLocale = (_c$2 = (_b$2 = (_a$4 = parseLocale(parsedQueryString().lng)) !== null && _a$4 !== void 0 ? _a$4 : storeLocale()) !== null && _b$2 !== void 0 ? _b$2 : navigatorLocale()) !== null && _c$2 !== void 0 ? _c$2 : DEFAULT_LOCALE; +function useUrlLocale() { + var parsed = useParsedQueryString(); + return parseLocale(parsed.lng); +} +/** + * Returns the currently active locale, from a combination of user agent, query string, and user settings stored in redux + * Stores the query string locale in redux (if set) to persist across sessions + */ +function useActiveLocale() { + var urlLocale = useUrlLocale(); + var userLocale = useUserLocale(); + return useMemo(function () { var _a, _b; return (_b = (_a = urlLocale !== null && urlLocale !== void 0 ? urlLocale : userLocale) !== null && _a !== void 0 ? _a : navigatorLocale()) !== null && _b !== void 0 ? _b : DEFAULT_LOCALE; }, [urlLocale, userLocale]); +} + +function useLocationLinkProps(locale) { + var location = useLocation(); + var qs = useParsedQueryString(); + var activeLocale = useActiveLocale(); + return useMemo(function () { + return !locale + ? {} + : { + to: __assign(__assign({}, location), { search: stringify(__assign(__assign({}, qs), { lng: locale })) }), + onClick: function () { + ReactGA.event({ + category: 'Localization', + action: 'Switch Locale', + label: activeLocale + " -> " + locale, + }); + }, + }; + }, [location, qs, activeLocale, locale]); +} + +var _path$4, _path2$1, _path3; + +function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); } + +const SvgMenu = props => /*#__PURE__*/React.createElement("svg", _extends$6({ + width: 24, + height: 24, + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", { + d: "M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z", + stroke: "black", + strokeWidth: 2, + strokeLinecap: "round", + strokeLinejoin: "round" +})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", { + d: "M19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11C18.4477 11 18 11.4477 18 12C18 12.5523 18.4477 13 19 13Z", + stroke: "black", + strokeWidth: 2, + strokeLinecap: "round", + strokeLinejoin: "round" +})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", { + d: "M5 13C5.55228 13 6 12.5523 6 12C6 11.4477 5.55228 11 5 11C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13Z", + stroke: "black", + strokeWidth: 2, + strokeLinecap: "round", + strokeLinejoin: "round" +}))); + +function useOnClickOutside(node, handler) { + var handlerRef = useRef(handler); + useEffect(function () { + handlerRef.current = handler; + }, [handler]); + useEffect(function () { + var handleClickOutside = function (e) { + var _a, _b; + if ((_b = (_a = node.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) !== null && _b !== void 0 ? _b : false) { + return; + } + if (handlerRef.current) + handlerRef.current(); + }; + document.addEventListener('mousedown', handleClickOutside); + return function () { + document.removeEventListener('mousedown', handleClickOutside); + }; + }, [node]); +} + +var FlyoutAlignment; +(function (FlyoutAlignment) { + FlyoutAlignment["LEFT"] = "LEFT"; + FlyoutAlignment["RIGHT"] = "RIGHT"; +})(FlyoutAlignment || (FlyoutAlignment = {})); +var StyledMenuIcon$1 = styled(SvgMenu)(templateObject_1$15 || (templateObject_1$15 = __makeTemplateObject(["\n path {\n stroke: ", ";\n }\n"], ["\n path {\n stroke: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var StyledMenuButton$1 = styled.button(templateObject_2$N || (templateObject_2$N = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n border: none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n height: 40px;\n background-color: ", ";\n border: 1px solid ", ";\n padding: 0.15rem 0.5rem;\n border-radius: 16px;\n\n :hover,\n :focus {\n cursor: pointer;\n outline: none;\n border: 1px solid ", ";\n }\n\n svg {\n margin-top: 2px;\n }\n"], ["\n width: 100%;\n height: 100%;\n border: none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n height: 40px;\n background-color: ", ";\n border: 1px solid ", ";\n padding: 0.15rem 0.5rem;\n border-radius: 16px;\n\n :hover,\n :focus {\n cursor: pointer;\n outline: none;\n border: 1px solid ", ";\n }\n\n svg {\n margin-top: 2px;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var UNIbutton = styled(ButtonPrimary)(templateObject_3$F || (templateObject_3$F = __makeTemplateObject(["\n background-color: ", ";\n background: radial-gradient(174.47% 188.91% at 1.84% 0%, #ff007a 0%, #2172e5 100%), #edeef2;\n border: none;\n"], ["\n background-color: ", ";\n background: radial-gradient(174.47% 188.91% at 1.84% 0%, #ff007a 0%, #2172e5 100%), #edeef2;\n border: none;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var StyledMenu$2 = styled.div(templateObject_4$u || (templateObject_4$u = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n border: none;\n text-align: left;\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n border: none;\n text-align: left;\n"]))); +var MenuFlyout$1 = styled.span(templateObject_8$e || (templateObject_8$e = __makeTemplateObject(["\n min-width: 196px;\n max-height: 350px;\n overflow: auto;\n background-color: ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border: 1px solid ", ";\n border-radius: 12px;\n padding: 0.5rem;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n position: absolute;\n top: 3rem;\n z-index: 100;\n\n ", ";\n ", ";\n"], ["\n min-width: 196px;\n max-height: 350px;\n overflow: auto;\n background-color: ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border: 1px solid ", ";\n border-radius: 12px;\n padding: 0.5rem;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n position: absolute;\n top: 3rem;\n z-index: 100;\n\n ", ";\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var _b = _a.flyoutAlignment, flyoutAlignment = _b === void 0 ? FlyoutAlignment.RIGHT : _b; + return flyoutAlignment === FlyoutAlignment.RIGHT + ? css(templateObject_5$o || (templateObject_5$o = __makeTemplateObject(["\n right: 0rem;\n "], ["\n right: 0rem;\n "]))) : css(templateObject_6$j || (templateObject_6$j = __makeTemplateObject(["\n left: 0rem;\n "], ["\n left: 0rem;\n "]))); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_7$g || (templateObject_7$g = __makeTemplateObject(["\n bottom: unset;\n right: 0;\n left: unset;\n "], ["\n bottom: unset;\n right: 0;\n left: unset;\n "]))); +}); +var MenuItem$1 = styled(ExternalLink)(templateObject_9$d || (templateObject_9$d = __makeTemplateObject(["\n display: flex;\n flex: 1;\n flex-direction: row;\n align-items: center;\n padding: 0.5rem 0.5rem;\n justify-content: space-between;\n color: ", ";\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n"], ["\n display: flex;\n flex: 1;\n flex-direction: row;\n align-items: center;\n padding: 0.5rem 0.5rem;\n justify-content: space-between;\n color: ", ";\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}, function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var InternalMenuItem = styled(Link$1)(templateObject_10$a || (templateObject_10$a = __makeTemplateObject(["\n flex: 1;\n padding: 0.5rem 0.5rem;\n color: ", ";\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n > svg {\n margin-right: 8px;\n }\n"], ["\n flex: 1;\n padding: 0.5rem 0.5rem;\n color: ", ";\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n > svg {\n margin-right: 8px;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}, function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var InternalLinkMenuItem = styled(InternalMenuItem)(templateObject_11$8 || (templateObject_11$8 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0.5rem 0.5rem;\n justify-content: space-between;\n text-decoration: none;\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0.5rem 0.5rem;\n justify-content: space-between;\n text-decoration: none;\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var ToggleMenuItem = styled.button(templateObject_12$8 || (templateObject_12$8 = __makeTemplateObject(["\n background-color: transparent;\n margin: 0;\n padding: 0;\n border: none;\n display: flex;\n flex: 1;\n flex-direction: row;\n align-items: center;\n padding: 0.5rem 0.5rem;\n justify-content: space-between;\n font-size: 1rem;\n font-weight: 500;\n color: ", ";\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n"], ["\n background-color: transparent;\n margin: 0;\n padding: 0;\n border: none;\n display: flex;\n flex: 1;\n flex-direction: row;\n align-items: center;\n padding: 0.5rem 0.5rem;\n justify-content: space-between;\n font-size: 1rem;\n font-weight: 500;\n color: ", ";\n :hover {\n color: ", ";\n cursor: pointer;\n text-decoration: none;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}, function (_a) { + var theme = _a.theme; + return theme.text1; +}); +function LanguageMenuItem(_a) { + var locale = _a.locale, active = _a.active, key = _a.key; + var _b = useLocationLinkProps(locale), to = _b.to, onClick = _b.onClick; + if (!to) + return null; + return (jsxs(InternalLinkMenuItem, __assign({ onClick: onClick, to: to }, { children: [jsx("div", { children: LOCALE_LABEL[locale] }, void 0), active && jsx(Check, { opacity: 0.6, size: 16 }, void 0)] }), key)); +} +function LanguageMenu(_a) { + var close = _a.close; + var activeLocale = useActiveLocale(); + return (jsxs(MenuFlyout$1, { children: [jsx(ToggleMenuItem, __assign({ onClick: close }, { children: jsx(ChevronLeft, { size: 16 }, void 0) }), void 0), SUPPORTED_LOCALES.map(function (locale) { return (jsx(LanguageMenuItem, { locale: locale, active: activeLocale === locale }, locale)); })] }, void 0)); +} +function Menu() { + var _a = useActiveWeb3React(), account = _a.account, chainId = _a.chainId; + var node = useRef(); + var open = useModalOpen(ApplicationModal.MENU); + var toggleMenu = useToggleModal(ApplicationModal.MENU); + useOnClickOutside(node, open ? toggleMenu : undefined); + var togglePrivacyPolicy = useToggleModal(ApplicationModal.PRIVACY_POLICY); + var openClaimModal = useToggleModal(ApplicationModal.ADDRESS_CLAIM); + var showUNIClaimOption = Boolean(!!account && !!chainId && !L2_CHAIN_IDS.includes(chainId)); + var _b = __read(useDarkModeManager(), 2), darkMode = _b[0], toggleDarkMode = _b[1]; + var _c = __read(useState('main'), 2), menu = _c[0], setMenu = _c[1]; + useEffect(function () { + setMenu('main'); + }, [open]); + return (jsxs(Fragment, { children: [jsxs(StyledMenu$2, __assign({ ref: node }, { children: [jsx(StyledMenuButton$1, __assign({ onClick: toggleMenu, "aria-label": t(templateObject_13$4 || (templateObject_13$4 = __makeTemplateObject(["Menu"], ["Menu"]))) }, { children: jsx(StyledMenuIcon$1, {}, void 0) }), void 0), open && + (function () { + switch (menu) { + case 'lang': + return jsx(LanguageMenu, { close: function () { return setMenu('main'); } }, void 0); + case 'main': + default: + return (jsxs(MenuFlyout$1, { children: [jsxs(MenuItem$1, __assign({ href: "https://uniswap.org/" }, { children: [jsx("div", { children: jsx(Trans, { children: "About" }, void 0) }, void 0), jsx(Info, { opacity: 0.6, size: 16 }, void 0)] }), void 0), jsxs(MenuItem$1, __assign({ href: "https://help.uniswap.org/" }, { children: [jsx("div", { children: jsx(Trans, { children: "Help Center" }, void 0) }, void 0), jsx(HelpCircle, { opacity: 0.6, size: 16 }, void 0)] }), void 0), jsxs(MenuItem$1, __assign({ href: "https://uniswap.canny.io/feature-requests" }, { children: [jsx("div", { children: jsx(Trans, { children: "Request Features" }, void 0) }, void 0), jsx(Coffee, { opacity: 0.6, size: 16 }, void 0)] }), void 0), jsxs(MenuItem$1, __assign({ href: "https://discord.gg/FCfyBSbCU5" }, { children: [jsx("div", { children: jsx(Trans, { children: "Discord" }, void 0) }, void 0), jsx(MessageCircle, { opacity: 0.6, size: 16 }, void 0)] }), void 0), jsxs(ToggleMenuItem, __assign({ onClick: function () { return setMenu('lang'); } }, { children: [jsx("div", { children: jsx(Trans, { children: "Language" }, void 0) }, void 0), jsx(Globe, { opacity: 0.6, size: 16 }, void 0)] }), void 0), jsxs(ToggleMenuItem, __assign({ onClick: function () { return toggleDarkMode(); } }, { children: [jsx("div", { children: darkMode ? jsx(Trans, { children: "Light Theme" }, void 0) : jsx(Trans, { children: "Dark Theme" }, void 0) }, void 0), darkMode ? jsx(Moon, { opacity: 0.6, size: 16 }, void 0) : jsx(Sun, { opacity: 0.6, size: 16 }, void 0)] }), void 0), jsxs(MenuItem$1, __assign({ href: "https://docs.uniswap.org/" }, { children: [jsx("div", { children: jsx(Trans, { children: "Docs" }, void 0) }, void 0), jsx(BookOpen, { opacity: 0.6, size: 16 }, void 0)] }), void 0), jsxs(ToggleMenuItem, __assign({ onClick: function () { return togglePrivacyPolicy(); } }, { children: [jsx("div", { children: jsx(Trans, { children: "Legal & Privacy" }, void 0) }, void 0), jsx(FileText, { opacity: 0.6, size: 16 }, void 0)] }), void 0), showUNIClaimOption && (jsx(UNIbutton, __assign({ onClick: openClaimModal, padding: "8px 16px", width: "100%", "$borderRadius": "12px", mt: "0.5rem" }, { children: jsx(Trans, { children: "Claim UNI" }, void 0) }), void 0))] }, void 0)); + } + })()] }), void 0), jsx(PrivacyPolicyModal, {}, void 0)] }, void 0)); +} +styled(MenuFlyout$1)(templateObject_14$4 || (templateObject_14$4 = __makeTemplateObject(["\n top: 3rem !important;\n"], ["\n top: 3rem !important;\n"]))); +styled(InternalMenuItem)(templateObject_15$2 || (templateObject_15$2 = __makeTemplateObject(["\n width: max-content;\n text-decoration: none;\n"], ["\n width: max-content;\n text-decoration: none;\n"]))); +styled(MenuItem$1)(templateObject_16$2 || (templateObject_16$2 = __makeTemplateObject(["\n width: max-content;\n text-decoration: none;\n"], ["\n width: max-content;\n text-decoration: none;\n"]))); +var templateObject_1$15, templateObject_2$N, templateObject_3$F, templateObject_4$u, templateObject_5$o, templateObject_6$j, templateObject_7$g, templateObject_8$e, templateObject_9$d, templateObject_10$a, templateObject_11$8, templateObject_12$8, templateObject_13$4, templateObject_14$4, templateObject_15$2, templateObject_16$2; + +var loadingAnimation = keyframes(templateObject_1$14 || (templateObject_1$14 = __makeTemplateObject(["\n 0% {\n background-position: 100% 50%;\n }\n 100% {\n background-position: 0% 50%;\n }\n"], ["\n 0% {\n background-position: 100% 50%;\n }\n 100% {\n background-position: 0% 50%;\n }\n"]))); +var LoadingRows = styled.div(templateObject_2$M || (templateObject_2$M = __makeTemplateObject(["\n display: grid;\n\n & > div {\n animation: ", " 1.5s infinite;\n animation-fill-mode: both;\n background: linear-gradient(\n to left,\n ", " 25%,\n ", " 50%,\n ", " 75%\n );\n background-size: 400%;\n border-radius: 12px;\n height: 2.4em;\n will-change: background-position;\n }\n"], ["\n display: grid;\n\n & > div {\n animation: ", " 1.5s infinite;\n animation-fill-mode: both;\n background: linear-gradient(\n to left,\n ", " 25%,\n ", " 50%,\n ", " 75%\n );\n background-size: 400%;\n border-radius: 12px;\n height: 2.4em;\n will-change: background-position;\n }\n"])), loadingAnimation, function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var theme = _a.theme; + return theme.bg1; +}); +var loadingOpacityMixin = css(templateObject_3$E || (templateObject_3$E = __makeTemplateObject(["\n filter: ", ";\n opacity: ", ";\n transition: opacity 0.2s ease-in-out;\n"], ["\n filter: ", ";\n opacity: ", ";\n transition: opacity 0.2s ease-in-out;\n"])), function (_a) { + var $loading = _a.$loading; + return ($loading ? 'grayscale(1)' : 'none'); +}, function (_a) { + var $loading = _a.$loading; + return ($loading ? '0.4' : '1'); +}); +var LoadingOpacityContainer = styled.div(templateObject_4$t || (templateObject_4$t = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), loadingOpacityMixin); +var templateObject_1$14, templateObject_2$M, templateObject_3$E, templateObject_4$t; + +/** + * Invokes callback repeatedly over an interval defined by the delay + * @param callback + * @param delay if null, the callback will not be invoked + * @param leading if true, the callback will be invoked immediately (on the leading edge); otherwise, it will be invoked after delay + */ +function useInterval(callback, delay, leading) { + if (leading === void 0) { leading = true; } + var savedCallback = useRef(); + // Remember the latest callback. + useEffect(function () { + savedCallback.current = callback; + }, [callback]); + // Set up the interval. + useEffect(function () { + function tick() { + var current = savedCallback.current; + current && current(); + } + if (delay !== null) { + if (leading) + tick(); + var id_1 = setInterval(tick, delay); + return function () { return clearInterval(id_1); }; + } + return; + }, [delay, leading]); +} + +var PopoverContainer$1 = styled.div(templateObject_1$13 || (templateObject_1$13 = __makeTemplateObject(["\n z-index: 9999;\n visibility: ", ";\n opacity: ", ";\n transition: visibility 150ms linear, opacity 150ms linear;\n color: ", ";\n"], ["\n z-index: 9999;\n visibility: ", ";\n opacity: ", ";\n transition: visibility 150ms linear, opacity 150ms linear;\n color: ", ";\n"])), function (props) { return (props.show ? 'visible' : 'hidden'); }, function (props) { return (props.show ? 1 : 0); }, function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var ReferenceElement = styled.div(templateObject_2$L || (templateObject_2$L = __makeTemplateObject(["\n display: inline-block;\n"], ["\n display: inline-block;\n"]))); +var Arrow = styled.div(templateObject_3$D || (templateObject_3$D = __makeTemplateObject(["\n width: 8px;\n height: 8px;\n z-index: 9998;\n\n ::before {\n position: absolute;\n width: 8px;\n height: 8px;\n z-index: 9998;\n\n content: '';\n border: 1px solid ", ";\n transform: rotate(45deg);\n background: ", ";\n }\n\n &.arrow-top {\n bottom: -5px;\n ::before {\n border-top: none;\n border-left: none;\n }\n }\n\n &.arrow-bottom {\n top: -5px;\n ::before {\n border-bottom: none;\n border-right: none;\n }\n }\n\n &.arrow-left {\n right: -5px;\n\n ::before {\n border-bottom: none;\n border-left: none;\n }\n }\n\n &.arrow-right {\n left: -5px;\n ::before {\n border-right: none;\n border-top: none;\n }\n }\n"], ["\n width: 8px;\n height: 8px;\n z-index: 9998;\n\n ::before {\n position: absolute;\n width: 8px;\n height: 8px;\n z-index: 9998;\n\n content: '';\n border: 1px solid ", ";\n transform: rotate(45deg);\n background: ", ";\n }\n\n &.arrow-top {\n bottom: -5px;\n ::before {\n border-top: none;\n border-left: none;\n }\n }\n\n &.arrow-bottom {\n top: -5px;\n ::before {\n border-bottom: none;\n border-right: none;\n }\n }\n\n &.arrow-left {\n right: -5px;\n\n ::before {\n border-bottom: none;\n border-left: none;\n }\n }\n\n &.arrow-right {\n left: -5px;\n ::before {\n border-right: none;\n border-top: none;\n }\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}); +function Popover(_a) { + var _b, _c; + var content = _a.content, show = _a.show, children = _a.children, _d = _a.placement, placement = _d === void 0 ? 'auto' : _d; + var _e = __read(useState(null), 2), referenceElement = _e[0], setReferenceElement = _e[1]; + var _f = __read(useState(null), 2), popperElement = _f[0], setPopperElement = _f[1]; + var _g = __read(useState(null), 2), arrowElement = _g[0], setArrowElement = _g[1]; + var options = useMemo(function () { return ({ + placement: placement, + strategy: 'fixed', + modifiers: [ + { name: 'offset', options: { offset: [8, 8] } }, + { name: 'arrow', options: { element: arrowElement } }, + { name: 'preventOverflow', options: { padding: 8 } }, + ], + }); }, [arrowElement, placement]); + var _h = usePopper(referenceElement, popperElement, options), styles = _h.styles, update = _h.update, attributes = _h.attributes; + var updateCallback = useCallback(function () { + update && update(); + }, [update]); + useInterval(updateCallback, show ? 100 : null); + return (jsxs(Fragment, { children: [jsx(ReferenceElement, __assign({ ref: setReferenceElement }, { children: children }), void 0), jsx(Portal, { children: jsxs(PopoverContainer$1, __assign({ show: show, ref: setPopperElement, style: styles.popper }, attributes.popper, { children: [content, jsx(Arrow, __assign({ className: "arrow-" + ((_c = (_b = attributes.popper) === null || _b === void 0 ? void 0 : _b['data-popper-placement']) !== null && _c !== void 0 ? _c : ''), ref: setArrowElement, style: styles.arrow }, attributes.arrow), void 0)] }), void 0) }, void 0)] }, void 0)); +} +var templateObject_1$13, templateObject_2$L, templateObject_3$D; + +var TooltipContainer = styled.div(templateObject_1$12 || (templateObject_1$12 = __makeTemplateObject(["\n max-width: 256px;\n padding: 0.6rem 1rem;\n font-weight: 400;\n word-break: break-word;\n\n background: ", ";\n border-radius: 12px;\n border: 1px solid ", ";\n box-shadow: 0 4px 8px 0 ", ";\n"], ["\n max-width: 256px;\n padding: 0.6rem 1rem;\n font-weight: 400;\n word-break: break-word;\n\n background: ", ";\n border-radius: 12px;\n border: 1px solid ", ";\n box-shadow: 0 4px 8px 0 ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var theme = _a.theme; + return transparentize(0.9, theme.shadow1); +}); +function Tooltip(_a) { + var text = _a.text, rest = __rest(_a, ["text"]); + return jsx(Popover, __assign({ content: jsx(TooltipContainer, { children: text }, void 0) }, rest), void 0); +} +function TooltipContent(_a) { + var content = _a.content, _b = _a.wrap, wrap = _b === void 0 ? false : _b, rest = __rest(_a, ["content", "wrap"]); + return jsx(Popover, __assign({ content: wrap ? jsx(TooltipContainer, { children: content }, void 0) : content }, rest), void 0); +} +function MouseoverTooltip(_a) { + var children = _a.children, rest = __rest(_a, ["children"]); + var _b = __read(useState(false), 2), show = _b[0], setShow = _b[1]; + var open = useCallback(function () { return setShow(true); }, [setShow]); + var close = useCallback(function () { return setShow(false); }, [setShow]); + return (jsx(Tooltip, __assign({}, rest, { show: show }, { children: jsx("div", __assign({ onMouseEnter: open, onMouseLeave: close }, { children: children }), void 0) }), void 0)); +} +function MouseoverTooltipContent(_a) { + var content = _a.content, children = _a.children, _b = _a.onOpen, openCallback = _b === void 0 ? undefined : _b, disableHover = _a.disableHover, rest = __rest(_a, ["content", "children", "onOpen", "disableHover"]); + var _c = __read(useState(false), 2), show = _c[0], setShow = _c[1]; + var open = useCallback(function () { + setShow(true); + openCallback === null || openCallback === void 0 ? void 0 : openCallback(); + }, [openCallback]); + var close = useCallback(function () { return setShow(false); }, [setShow]); + return (jsx(TooltipContent, __assign({}, rest, { show: show, content: disableHover ? null : content }, { children: jsx("div", __assign({ style: { display: 'inline-block', lineHeight: 0, padding: '0.25rem' }, onMouseEnter: open, onMouseLeave: close }, { children: children }), void 0) }), void 0)); +} +var templateObject_1$12; + +var StyledPriceContainer = styled.button(templateObject_1$11 || (templateObject_1$11 = __makeTemplateObject(["\n background-color: transparent;\n border: none;\n cursor: pointer;\n align-items: center;\n justify-content: flex-start;\n padding: 0;\n grid-template-columns: 1fr auto;\n grid-gap: 0.25rem;\n display: flex;\n flex-direction: row;\n text-align: left;\n flex-wrap: wrap;\n padding: 8px 0;\n user-select: text;\n"], ["\n background-color: transparent;\n border: none;\n cursor: pointer;\n align-items: center;\n justify-content: flex-start;\n padding: 0;\n grid-template-columns: 1fr auto;\n grid-gap: 0.25rem;\n display: flex;\n flex-direction: row;\n text-align: left;\n flex-wrap: wrap;\n padding: 8px 0;\n user-select: text;\n"]))); +function TradePrice(_a) { + var _b, _c, _d, _e, _f, _g; + var price = _a.price, showInverted = _a.showInverted, setShowInverted = _a.setShowInverted; + var theme = useContext(ThemeContext); + var usdcPrice = useUSDCPrice(showInverted ? price.baseCurrency : price.quoteCurrency); + var formattedPrice; + try { + formattedPrice = showInverted ? price.toSignificant(4) : (_b = price.invert()) === null || _b === void 0 ? void 0 : _b.toSignificant(4); + } + catch (error) { + formattedPrice = '0'; + } + var label = showInverted ? "" + ((_c = price.quoteCurrency) === null || _c === void 0 ? void 0 : _c.symbol) : ((_d = price.baseCurrency) === null || _d === void 0 ? void 0 : _d.symbol) + " "; + var labelInverted = showInverted ? ((_e = price.baseCurrency) === null || _e === void 0 ? void 0 : _e.symbol) + " " : "" + ((_f = price.quoteCurrency) === null || _f === void 0 ? void 0 : _f.symbol); + var flipPrice = useCallback(function () { return setShowInverted(!showInverted); }, [setShowInverted, showInverted]); + var text = ((_g = '1 ' + labelInverted + ' = ' + formattedPrice) !== null && _g !== void 0 ? _g : '-') + " " + label; + return (jsxs(StyledPriceContainer, __assign({ onClick: function (e) { + e.stopPropagation(); // dont want this click to affect dropdowns / hovers + flipPrice(); + }, title: text }, { children: [jsx(Text$1, __assign({ fontWeight: 500, color: theme.text1 }, { children: text }), void 0), ' ', usdcPrice && (jsx(ThemedText.DarkGray, { children: jsxs(Trans, { children: ["($", usdcPrice.toSignificant(6, { groupSeparator: ',' }), ")"] }, void 0) }, void 0))] }), void 0)); +} +var templateObject_1$11; + +var Wrapper$g = styled.div(templateObject_1$10 || (templateObject_1$10 = __makeTemplateObject(["\n position: relative;\n padding: 8px;\n"], ["\n position: relative;\n padding: 8px;\n"]))); +var ArrowWrapper$1 = styled.div(templateObject_3$C || (templateObject_3$C = __makeTemplateObject(["\n padding: 4px;\n border-radius: 12px;\n height: 32px;\n width: 32px;\n position: relative;\n margin-top: -14px;\n margin-bottom: -14px;\n left: calc(50% - 16px);\n /* transform: rotate(90deg); */\n background-color: ", ";\n border: 4px solid ", ";\n z-index: 2;\n ", "\n"], ["\n padding: 4px;\n border-radius: 12px;\n height: 32px;\n width: 32px;\n position: relative;\n margin-top: -14px;\n margin-bottom: -14px;\n left: calc(50% - 16px);\n /* transform: rotate(90deg); */\n background-color: ", ";\n border: 4px solid ", ";\n z-index: 2;\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var clickable = _a.clickable; + return clickable + ? css(templateObject_2$K || (templateObject_2$K = __makeTemplateObject(["\n :hover {\n cursor: pointer;\n opacity: 0.8;\n }\n "], ["\n :hover {\n cursor: pointer;\n opacity: 0.8;\n }\n "]))) : null; +}); +var SectionBreak = styled.div(templateObject_4$s || (templateObject_4$s = __makeTemplateObject(["\n height: 1px;\n width: 100%;\n background-color: ", ";\n"], ["\n height: 1px;\n width: 100%;\n background-color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var ErrorText = styled(Text$1)(templateObject_5$n || (templateObject_5$n = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), function (_a) { + var theme = _a.theme, severity = _a.severity; + return severity === 3 || severity === 4 + ? theme.red1 + : severity === 2 + ? theme.yellow2 + : severity === 1 + ? theme.text1 + : theme.text2; +}); +var TruncatedText = styled(Text$1)(templateObject_6$i || (templateObject_6$i = __makeTemplateObject(["\n text-overflow: ellipsis;\n max-width: 220px;\n overflow: hidden;\n text-align: right;\n"], ["\n text-overflow: ellipsis;\n max-width: 220px;\n overflow: hidden;\n text-align: right;\n" + // styles +]))); +// styles +var Dots = styled.span(templateObject_7$f || (templateObject_7$f = __makeTemplateObject(["\n &::after {\n display: inline-block;\n animation: ellipsis 1.25s infinite;\n content: '.';\n width: 1em;\n text-align: left;\n }\n @keyframes ellipsis {\n 0% {\n content: '.';\n }\n 33% {\n content: '..';\n }\n 66% {\n content: '...';\n }\n }\n"], ["\n &::after {\n display: inline-block;\n animation: ellipsis 1.25s infinite;\n content: '.';\n width: 1em;\n text-align: left;\n }\n @keyframes ellipsis {\n 0% {\n content: '.';\n }\n 33% {\n content: '..';\n }\n 66% {\n content: '...';\n }\n }\n"]))); +var SwapCallbackErrorInner = styled.div(templateObject_8$d || (templateObject_8$d = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 1rem;\n display: flex;\n align-items: center;\n font-size: 0.825rem;\n width: 100%;\n padding: 3rem 1.25rem 1rem 1rem;\n margin-top: -2rem;\n color: ", ";\n z-index: -1;\n p {\n padding: 0;\n margin: 0;\n font-weight: 500;\n }\n"], ["\n background-color: ", ";\n border-radius: 1rem;\n display: flex;\n align-items: center;\n font-size: 0.825rem;\n width: 100%;\n padding: 3rem 1.25rem 1rem 1rem;\n margin-top: -2rem;\n color: ", ";\n z-index: -1;\n p {\n padding: 0;\n margin: 0;\n font-weight: 500;\n }\n"])), function (_a) { + var theme = _a.theme; + return transparentize(0.9, theme.red1); +}, function (_a) { + var theme = _a.theme; + return theme.red1; +}); +var SwapCallbackErrorInnerAlertTriangle = styled.div(templateObject_9$c || (templateObject_9$c = __makeTemplateObject(["\n background-color: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n border-radius: 12px;\n min-width: 48px;\n height: 48px;\n"], ["\n background-color: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n border-radius: 12px;\n min-width: 48px;\n height: 48px;\n"])), function (_a) { + var theme = _a.theme; + return transparentize(0.9, theme.red1); +}); +function SwapCallbackError(_a) { + var error = _a.error; + return (jsxs(SwapCallbackErrorInner, { children: [jsx(SwapCallbackErrorInnerAlertTriangle, { children: jsx(AlertTriangle, { size: 24 }, void 0) }, void 0), jsx("p", __assign({ style: { wordBreak: 'break-word' } }, { children: error }), void 0)] }, void 0)); +} +var SwapShowAcceptChanges = styled(AutoColumn)(templateObject_10$9 || (templateObject_10$9 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n padding: 0.5rem;\n border-radius: 12px;\n margin-top: 8px;\n"], ["\n background-color: ", ";\n color: ", ";\n padding: 0.5rem;\n border-radius: 12px;\n margin-top: 8px;\n"])), function (_a) { + var theme = _a.theme; + return transparentize(0.95, theme.primary3); +}, function (_a) { + var theme = _a.theme; + return theme.primaryText1; +}); +styled(ThemedText.Black)(templateObject_11$7 || (templateObject_11$7 = __makeTemplateObject(["\n border-bottom: 1px solid ", ";\n padding-bottom: 0.5rem;\n"], ["\n border-bottom: 1px solid ", ";\n padding-bottom: 0.5rem;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}); +var ResponsiveTooltipContainer = styled(TooltipContainer)(templateObject_13$3 || (templateObject_13$3 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid ", ";\n padding: 1rem;\n width: ", ";\n\n ", "\n"], ["\n background-color: ", ";\n border: 1px solid ", ";\n padding: 1rem;\n width: ", ";\n\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var width = _a.width; + return width !== null && width !== void 0 ? width : 'auto'; +}, function (_a) { + var theme = _a.theme, origin = _a.origin; + return theme.mediaWidth.upToExtraSmall(templateObject_12$7 || (templateObject_12$7 = __makeTemplateObject(["\n transform: scale(0.8);\n transform-origin: ", ";\n "], ["\n transform: scale(0.8);\n transform-origin: ", ";\n "])), origin !== null && origin !== void 0 ? origin : 'top left'); +}); +styled(TradePrice)(templateObject_14$3 || (templateObject_14$3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), loadingOpacityMixin); +var templateObject_1$10, templateObject_2$K, templateObject_3$C, templateObject_4$s, templateObject_5$n, templateObject_6$i, templateObject_7$f, templateObject_8$d, templateObject_9$c, templateObject_10$9, templateObject_11$7, templateObject_12$7, templateObject_13$3, templateObject_14$3; + +// technically a 721, not an ERC20, but suffices for our purposes +var SOCKS = new Token(SupportedChainId.MAINNET, SOCKS_CONTROLLER_ADDRESSES[SupportedChainId.MAINNET], 0); +function useHasSocks() { + var _a = useActiveWeb3React(), account = _a.account, chainId = _a.chainId; + var balance = useTokenBalance(account !== null && account !== void 0 ? account : undefined, chainId === SupportedChainId.MAINNET ? SOCKS : undefined); + return useMemo(function () { return Boolean(balance === null || balance === void 0 ? void 0 : balance.greaterThan(0)); }, [balance]); +} + +var COINBASE_ICON_URL = "d13f13f5694ec91f.svg"; + +var FORTMATIC_ICON_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIcAAACHCAYAAAFL4HqcAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAh6ADAAQAAAABAAAAhwAAAAD59IYWAAAHcklEQVR4Ae2dz4scRRTHX81ugqISCQT8gYfoX6AXQfQihFVvuQl6MhBzCHgVUdiDgkEPakj2B4kH8aAEJIjZX1lFlPgLg0hglYgBZZWAbtBdDZtNpsvXu1vk+XbWma1uu6qmvn3YftU71e/V5327urqme9o8/Yi1VHFpVay/Wr3PdjLYicnYlDGdtm+2LQcmuu3dBJkjE60bzSgaJr9XisRYusJN3WV0+7RGeilXisQ56LOdbOiUtLBcu/9r3e9MdNv3P2YvmIJ26+2ynBuT8Qlzt2z/viG7c9DQgtxWmQmfKi9W3snolLm90k7cIVJLpyT5+NqVWuPrtFM9BKKpbOhf9QfKshNUp//VtQ2p0SSjIdKTRnT0utzLOUnX0eVoiCCQaFNTi1j1YEG3ttPgQX8mCo2UPXctRHTrei7zVM3Y9NocQpBAxqaIM8HXaWKJYmDETM5GoZESDAIR8lg1QQRENAFdjkYjXXvWdpsOHjttjugW1F2OhggC0akFERDRBHS5az+iK3QqV54Kt/QlxKrJggiIaAK6DI1oIrV0aN2mP7t2eC2aiyI1pk3vRRHI6Iz5IIZALpd6CR4I6+um4IHwdMR97uip5ahxO9vKeruhHYcnzaKrEyKQzzkdD7gA3DqKGSMXTOh1VDNXoWE4/8F7ERdILGsAUZkAEABRBFQRCgEQRUAVaxkQ8e3Tky1DX6l9J1fku61+rQVIUdCp8QZmx5sgjD5EUQYQAFEEVBEKARBFQBWhEABRBFSxlnGI2qdXsY77LL0cy0oxfYMn4wppow9R9AEEQBQBVYRCAEQRUEUoRAGJZhzS7RZ6FfeGYi+32G+opDbwF1VtKERAMS06CSAOiKWrIxPmFQBZB8KHy0hpAkhJoaAX+UncZ0ozmk61DKbphWfZr9y2TDcPf2yuOd95ArFkuQN9aHTSnHEg3DovIJam+JmuR13jO61rATIwQP96bquToya28SFQ8JdmP7Cv7wtDc4WlV49Pm0tb8Y07iK7TKnCGuQ4Dp1vBAjAAQxIQNvoMwBAEhAllAIYgIEwoAzAEAWFCGYAhCAgTygAMQUCYUAZgCALCrD7bZWmZp98PiX0maVpDRXUYRMs89T6cJAEVNPoMAQQwAEMQECaUARiCgDChDMAQBIQJZQCGICBMKAMwBAFhQhmAIQgIE8oADEFAmHXMZ4jd+ZkHHrZ32u0071e7tlq4nVqiRJ8haAAGYAgCwoQyAEMQECaUARiCgDChDMAQBIQJZQCGICBMKAMwBAFhQhmAIQgIM4rJndGPzC8cEz9m5r/sH7LH+Q6ip7z3wE/a9c1hwo9pVoLJIFf6Boa3ItYr8pOPgOEgQhmORLk2dA6HyTqQok3PAUYJw9Lf4zMmnnc4rScoyIr7i7dLx1AG0RLf1HsAMNbU8GQJolyiGIGuhdL8Xx5bnByZNu87zzkfJvPj02avA1Gu84Rh6AK/gecuCSJLGOWhMTZp7tEgynJOfcYK/xLTHh5PfNIJRB4w+IfK+Op8L/cPpzaD4Lb3jTJswb+2RHSJrzHm2D7PDZs5OmPedQ3tZY3f3OmFUn6fKXhU/k2eZ9f8ku3VYojDC1selSCOPPLs1UqIwwtbHpUgjjzy7NVKiMMLWx6VII488uzVSojDC1selSCOPPLs1UqIwwtbHpUgjjzy7NVKiMMLWx6VII488uzVSojDC1selSCOPPLs1UqIwwtbHpXiuPPJ0h/tgp4/dtocyQN7Gq1Ez5FGnoJECXEEwZ6GU4gjjTwFiRLiCII9DacQRxp5ChIlxBEEexpOIY408hQkSogjCPY0nEIcaeQpSJQQRxDsaTiFONLIU5AoIY4g2NNwCnGkkacgUUIcQbCn4RTiSCNPQaKEOIJgT8NpHDf7RMKqfDdYcQN9agraHUlIocJo84+Pfo2eIxT+BPxCHAkkKVSIEEco8gn4hTgSSFKoECGOUOQT8AtxJJCkUCFCHKHIJ+AX4kggSaFChDhCkU/AL8SRQJJChQhxhCKfgF+II4EkhQoR4ghFPgG/EEcCSQoVIsQRinwCfnE/h0jSyhVaHNxGb/Bbim4Vm5s1Dd3Ib6Dbw07vbdbxRm8Qh2Dy5hmzxMXXxKbGzX1Ddudgi3bxzTYhxdHmhv+G00rj6U/AIb+ynl8c+B3EkUCuAoS4wm+WnIM4ApCP3qWhy9sMzUIc0Weq2QCNpUV+Ie3I4UkzD3E0yz5ub5b4Qol+vmOSXi4DhTjiTlfT0V3ky9fHh4kfzuAFl7JN44/RH3cXpkU/8TjjwfJ04kKEOByJXNd8KuGmn99xle4/NGv+lBggDkkjP3uJpfH62Ix5oVPTIY5OVPp/W8HzGN9evkp73vrQLGzWXIhjMzIBt9uCLH+/878sfKm6wL3FwdEZ8043BxBHN0IB/s+DQ7M6EqjJNwviGg8sztoWPTE2ZX7sdbcQR6+kEvwci+IvFsTowi307IkTpvwybUsLxLElXNF/eIV7nM948uqlkWkzWzVaiKMqwRD1y4tPQ8sshC94qntigGh6ZIrO8cbyP7Ut/wACdD2e0mLveQAAAABJRU5ErkJggg=="; + +var PORTIS_ICON_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gMdDiIcy6bS3gAAIABJREFUeNrt3XucXHV9//HPmetesjuz991c9pKQiwmXREBCSEmwYiHeYotVW9uEQqlCKKtEEc2vbmvR+it9dBXEVlADVdRWDRBEfqJABCTcIYAJ2UCyySbZzd5mdmbnei6/P5JNc9nZ7OzO5Vxez8ejj0cNuex+Znbe8/3O+5yvCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARXXjQ7vXf+JrD25mEoC9uRgBYF/tW/YGDUXp1GKJq65o/04rEwEIdAAWpHq0DhEJGGKUuzRPJxMBCHQAFnP9L3cvFTFuOv4LhnzkgxvuXs1kAAIdgJV+uHXltBW5LrKZyQAEOgCLuPGh3etFZNU4/6llzYa7O5gQQKADMLmxItxEv4WCHECgAzA51ZPuFJHABL8lQEEOINABmNiGrV2rRZR1Z/yNFOQAAh2AqU165U1BDiDQAZjQDQ93tYvIeVn8EQpyAIEOwEzat+wNKoZMJZwpyAEEOgCzmEQRLhMKcgCBDsAMJl2Ey4SCHECgAzCFaa+wdZHNa9t/EGSUAIEOoAimUITLpCWlqu1MFCDQARTYNIpwmXyFghxAoAMosGkU4TK/IKiezUwWINABFMi0i3CZrbpywz1rmTBAoAMojLxdaqaI0UlBDiDQAeRZDotwmVCQAwh0APmUhyJcJhTkAAIdQL7kowiX8cWBghxAoAPIvTwW4TKhIAcQ6ADyoOD3XKcgBxDoAHKoAEW4TCjIAQQ6gFxo37KztUBFuEwoyAEEOoDp0ryeghXhMr5QUJADCHQAU7dha9dqw5CPmOBLoSAHEOgApsE0K2MKcgCBDmBqq/MOEWkx0ZdEQQ4g0AFko33LzlYRMWN4UpADCHQAk2WGIlzGFw0KcgCBDuDMTFSEy2TVmhu/u55HCiDQAUzM/CtgQ6EgBxDoACZYnXeIuYpwmQRSqtbBIwYQ6ABOYeIiXKZl+k1rrv/uUh45gEAHcAIzF+Eyv4IonTxyAIEO4BgLFOEyoSAHEOgATrDZsl85BTmAQAdgqSJcJhTkAAIdcDbrFeEyLtMpyAEEOuBclizCZXw1oSAHEOiAA1m4CJcJBTmAQAecpX3L3qBYuQiXCQU5gEAHnET1qO1i7SJcJhTkAAIdcMrqfGeriHzFvt8hBTmAQAccsTp3wPGjFOQAAh2wsw1b96wVkVUO+FYpyAEEOmBPR4twhnNWrhTkAAIdsCMbF+EyoSAHEOiA3Vbndi/CZVymU5ADCHTATqtzBxThMr/KbOYZABDogOU5qAiXgXLeB264u51nAkCgA5bluCJcBoYiHRTkAAIdsCwHFuEyCSRVlWvTAQIdsOLq3KlFuPEpIus+uOHu1UwCINABi63OHVyEy0Dn4weAQAeshCJcxnU6BTmAQAesgSLcxCjIAQQ6YAkU4c6IghxAoANmX51ThJsMCnIAgQ6YfHVOEW6yKMgBBDpgSjc+tHu9UITLZp1OQQ4g0AFzad+yN2goCivOLFGQAwh0wFRUj9YhIgEmkTUKcgCBDpjD9b/cvVTEuIlJTA0FOYBAB8zxQ6Sz1T5dFOQAAh0oKopwOVunU5ADCHSgOCjC5RYFOYBAB4qCIlzOBVKaupkxAAQ6UDAU4fK1TJePUJADCHSgcD84FOHyRhdhlQ4Q6ED+UYTLu5Y1G+7uYAwAgQ7kDUW4wo36ivbvtDIGgEAH8oIiXMEEXJqHN04AgQ7kHkW4AqMgBxDoQF5+WCjCFRwFOYBAB3KKIlzRUJADCHQgNyjCFf8hoCAHEOjAtFGEKzoKcgCBDkzPhq1dqynCmQAFOYBAB6aJlaFJUJADCHRgSm54uKtdRM5jEqZBQQ4g0IHstG/ZG1QMITxM+NBQkAMIdGDSVE+6UyjCmREFOYBABybnaBFOWcckTIqCHECgA5PECtDkKMgBBDowIYpwlkFBDiDQgfFRhLOcr1CQAwh04DQU4Sz4AqZ6NjMFgEAHjqMIZ1mrrtxwz1rGABDowBiKcBaliNG5tv0HQSYBAh1wOIpwlteSUtV2xgACHXAwinC2QUEOBDojgJNRhLPRixkFORDogDNRhLMdCnIg0AGHoghnMxTkQKADDkMRzrYoyIFAB5yifcvOVopwtkZBDgQ64ASa10MRzu4vbBTkQKAD9rZha9dqw5CPMAnboyAHAh2wOVZuDkFBDgQ6YN/VeYeItDAJx6AgBwIdsJv2LTtbRYQXd+ehIAcCHbATinAOfpGjIAcCHbAHinCOR0EOBDpgE6zQHE4RYzMFORDogLVX5x1CEQ4igZSqdTAGEOiABVGEw8mMm9Zc/92lzAEEOmAxFOFw+iuewoE8INABK6EIhwxWrbnxu+sZAwh0wDo2MwKMy1C4gxwIdMAiq/MOoQiHzCjIgUAHzI4iHCa5TKcgBwIdMDOKcJj8qx8FORDogClRhEOWKMiBQAfMpn3L3qBQhEO2KMiBQAfMRfWo7UIRDtmjIAcCHTDP6nxnq4h8hUlgist0CnIg0AFzrM45HhPTfSWkIAcCHSiqDVv3rBWRVUwC00RBDgQ6UCxHi3AGKyvkBgU5EOhAcVCEQ45RkAOBDhR+dU4RDnlZplOQA4EOFHZ1ThEOeXtV5LkFAh0oBIpwyC/lvA/ccDfnAYBAB/KJIhwKwVCkg4IcCHQgjyjCoUACSVXljSMIdCA/q3OKcCgcRWTdBzfcvZpJgEAHcr46pwiHwtL5eAcEOpBbFOFQpHU6BTkQ6ECuUIRDMVGQA4EO5AhFOBQZBTkQ6MD0V+cU4VB8FORAoAPTXp1ThIM5UJADgQ5M0Y0P7V4vFOFgnnU6BTkQ6EC22rfsDRqKwooIpkJBDgQ6kCXVo3WISIBJwGQoyIFABybr+l/uXipi3MQkYEYU5ECgA5N9UupstcPcKMiBQAfOgCIcLLJOpyAHAh3IhCIcrISCHAh0IAOKcLCYQEpTNzMGEOjACSjCwZrLdPkIBTkQ6MCJT0SKcLAoXYRVOgh0QIQiHCyvZc2GuzsYAwh0OBpFONjlqXxF+3daGQMIdDgWRTjYRMCleXhjCgIdzkQRDrZCQQ4EOhz75KMIB5uhIAcCHY5DEQ42RUEOBDqcgyIc7P4UpyAHAh2OQBEONkdBDgQ67G/D1q7VFOFgexTkQKDDAVi5wBEoyIFAh23d8HBXu4icxyTgEBTkQKDDftq37A0qhvDiBsc99SnIgUCHraiedKdQhIPzUJADgQ77OFqEU9YxCTgSBTkQ6LARVihwNApyINBheRThABGhIAcCHVZGEQ44yVcoyIFAhyVRhANOecFVPZuZAgh0WApFOGBcq67ccM9axgACHVZCEQ4YhyJG59r2HwSZBAh0mB5FOGBCLSlVbWcMINBhahThgEmhIAcCHeZGEc6cDDXJEMz24ktBDgQ6zIoinAnfYIX69Z4nHpVDu5/XdE0NMxFToSCHnFIYAXIY6K8Kn52bQmzfLqO/6x0ldPiwiIgMh/bLkCZSWV4psxoX9vn9MxqYkil0+zyepQ90Xh1iFJguDyNALtzwcFe7GIR5sYVe324MHuhVogOD475ZHxkdkZG3X2goLymXhrrWvsqKeoK9uMYKch2MAqzQUXTtW3a2qh7Pq8Jn58WRjOnDXW+4enftkVQsPu5vGVuhn8rv80tDTfNAVXBmuaK4Shlmcegete3Rzs/sYxJghY6i0ryeTjEI82IEed+rL7r639nr0tLq1P6KVFL2H+6qPXhkrzTWzA7XVM3RXW5PFcMtrGMFudVMAqzQUTRHi3DyBJMoHDXUr/e+8pJr8MDBSf+ZTCv08dQFG+JNDQtSLreHN2kFZIjy0V/dee0DTAIEOooV6PtEpIVJ5N+pRbdsZBPoYyjQFRwFOUwLW+6YTph3EOb5d6aiW75QoCs4CnJghY7CowiXZ8lRY7jrTWWiolu+V+inokBXGBTkwAodBUURLj+MRFSOvPay9L+zV5lq0S1v7zEo0BUEBTmwQkfBUITLvXSoT3pfeVWGDvTk5e/PxQp9PBTo8vTGjoIcCHQUKND3CZ+d58Ro9y4Z2P2OTKXoZoZAH0OBLufCPo+nlYIcssGWO7IN8w7CPAcB+/p2GTrQK9GBQVt8P2MFOr/PL7MazqJAN32BlKp1iAjHrIIVOnKPItz0GImohPbslN5dXTkpuplphX4qv88vtcGmcG1Ni48C3TToxrJH7rruVQYBVujIKYpwUw/yY0U3MVvRLV+SqaQcPLIv0DvYI3XBxuH62jYXn7NPgUvpFApyYIWOXKIIl718F93MvEIfT12wIV5f1zbq9ZbW8uzI5lXauPqRO67bzCBAoCNXgb5P+Ox8UgpVdLNaoI+hQJc1CnKYFLbcMZkw7yDMJxGaNiu65QsFuqxRkAMrdExf+5adrZrb/ZqhKJVM43TFLLpZdYV+Kgp0k0RBDqzQMR2a19NpGEKYjxPkTiu65QsFusnxuuROEVnJJMAKHVmjCHc6MxXd7LJCHw8Fukyv2BTkQKAjS+1b9gb9WmTfqL+UlZKYs+hm50AfQ4HuZH7DSBlebwMFOYyHLXeMq+3Qrs1dzWc5PswpuhUXBbqTJRXFtyA68t8i8n6eHWCFjjO6r+O+lc+ff/FTTv3+jURUht9+S/p2vmXqopsTVuinrVAp0ImIyOqBgU984Se3/pRXK7BCx4QONbdudWqQU3Qz+QqVAp2IiOyvrPgPESHQcRI3I8CJvve1n3x9d9uC9znpe06H+uTQs8/IvmeflejgkBi6brvvMZEIS9yw0ZsvQ5dofKS0b3B/iZaOx0tLZoTdbm+ZU56zw25PyboFl855fMdjD/GqhTFsueO4H335Ry07z1m0J1Re6YidG6sX3bIKAJtsuU/EaQW6cl03Lgr1t228f1M3r14QYcsdJxipmXGvE8J8+I0XZGDPPomNjPCg2+n567AC3ajLpQz7yh8QkWU8+mCFjuPsXoQzElEZ+MNrMvBOt22KbqzQJ+aUAh0FObBCx0nsWoRTh3tlcPduim4O5JQC3e5A5Q+EghyEUhzEnkW4saLb/hdesm3RLRt2K8Vlw+4Fuojb7f2rhauWPrHj14S6w7Hl7nB2K8KNdu+S3jd3cSOYUzhxy30idivQUZCDCFvujtdf7f+RHcKcohuyYbcC3ajLpRzxz/itiJzFo8sKHQ70hb/bdFXsg+v+x6pfv9OLbqzQc8cuBTqXyGUP3/m3T/KIskKHw4wuPvfHVnxHR9ENuWaXAp0uRqeILOURdSZKcQ618aav/lw7//IlVvqaKbpNnZNLcdmwfoFOaVxw4YfDXS9s3c6j6TxsuTvQLdfdck5kxZ/scNXMscZOAkW3aWPLfeosWKAL+zyeVo5YdR623B0oXl3zayuEOUU3mIEFC3SBpKp2ish6Hj1W6LCxL/z1TRtiH9twh1m/PopurNDNzu32SGPNbNMX6CjIsUKHzY2ef8m/m/FdHEU3WIWmqccLdNUVNfGmhgUpMxboKMg58M0mI3COz9182zZ92fvazPQ1UXQrDEpxuWcYusQSo96xAp3fVzrk8fhmmOcrpCDnNGy5O8Qt191yTvR9f75DKa00x04BRbeCYsu9MCrLK6Wxft6BstKgWUoqFOQchC13h4jPnPNbM4Q5RTfY2cjoiIzsfWWOiQp0FORYocNOvviZTbdE16z7l2L9+xTdWKE7lVkKdBTkWKHDJiKLzv3nYrxzo+gGpzNLgY6CnEPeQDICeytGEY6im/lQiiuu4hfoKMg5AVvuNlboIhxFN/Niy918ilCgoyBnc2y521ihinAU3YDsFaFAF0hp6mYRWcv0WaHDQvJdhKPoxgoduVWoAh0FOVbosJh8FeEougH5UagCnS6yWURambgN3xQyAvvJRxGOopu1UYqzjgIU6ILz3/Nhpev5razSbYYtd5vJdRGOops9sOVubXko0IV1j7r00c7P7GO69sGWu83kqghH0Q0wjzwU6AIuzdMpFORYocOcpluEMxJROfLayzJ0oIeiGyt0mFiuCnQU5Fihw6SmWoRLh/qk/40dMnTgEEU3wAJyVaCjIGezN3qMwB7+vv0ft8v572/O5s8kevfK4Reel/0vvCix4TBFNxujFGdPOSjQUZCzEbbcbSDbIhxFN+dhy905plCgoyBnE2y520C0YeZTkwnz4TdekN5dXXw+DtjYFAp0FORYocMMNl7z+X9NrL1uY6b/TtENrNCdbbIFOgpyrNBRZPELV31uvHdlFN0AiEy+QEdBzgZv3hiBdX32lv+7Qz97ZeOJv0bRDeOhFIdJFOgoyFkcW+4WdWoRjqIbJsKWO8YzToGOgpyFseVuUbGWs55RSispugGYsvEKdBTkWKGjgP781jsuUTxlTw/sp+gGVujInbECXYmv/NKn7vvyDiZiscePEVjPm0//6sDy8upEJJ1arbr9LiaCM+EzdEyGYWivjcYj69/Y0vkc02CFjgL75Jq/2dZbWnmp6iphGGCFjqkKKyLtBx+/fzOjsC5Wdxb340e+v2p+PHRuXay/m2kAmMKq7ps+3ddKmLNCh4lce+XVV+33lf447quk7AhW6DjTi/820aX94JP3v8o0CHSY1F+uufrnh0oDf8o2PAh0jKNbEelgRW4/bLnb0I8e+cGfjW3DKwZ3iQNw3D/6dN9SwpwVOizo2iuvvuqQ1//DiD/oZxqs0OHYF/ptmq6v733yJ/uYBoEOi1t3xfo795cHb2AbnkCHo3SLYrQf+u2PH2AUBDps5k8/cM2+gdKqFkOhN0egw8bCItLp032d+57cHGIcBDps6ro168855PY9Ey6prmAaBDps96r+oK7p7WyvE+hwkHVXrL+zp7TiMylPOeVIAh3W1+1yudb3/OaHTzIKAh0O9ecfuHZHb2nwHLbhCXRYUlhEOg89fn8Ho3A2VmaQ//7lPecuig2cWxUf6GcagIUYxr0+3ddKmIMVOk5zzZXrbzngK/tn7jbHCh2mTvLXXC53O9vrINBxRp9c8zfbDpZVX8o2PIEOUwkbonQcfvxHnYwCp+L4VIyrN1CzT0aHzm5UjJlJ/wwGYnEcn2p9Wiomaiz0kpaIPBI/vHcXEwErdGQUXLo66PZ614phdIhIy9ivN/tKpbZutiR8AYbECh0Fpqsp0RJR0fWTbuPcbYh06qq6OfTqk1xnDgIdx4J8+RWt7nS6XRRlvYhkTO3zA7WSDjYKd5sj0JF/hhiixyOiphMT/bawKMoDmtvdEdr+6D6mRqDDoWoveN9qQ1HWi2Gsm+yfqXF7ZX5Vg4xUNDJAAh15oqVioiVGxZCsPid5UBHpHHjxN08yQQIdDlFz4eXrDV1vVxTlvKn+Hc2+UqmvmSmxkioGSqAjR3Q1JVo8IroxrQerWxSlQ0unH2A7nkCHDQWXrg56PJ52Q6RdJthWz9a5M4IiNbPZhifQMQ2GoYkWj4qmJnP514YVkU7V49nMdjyBDhuou/DypbpIezbb6lOxvHa2RGbUCpe5EejIjpYcFS0Zy3Z7PctXeuVexTA2sx1PoMOCai68fL0YxnoRWVWof7PZVyqNVQ0SLavlASDQcaYgVxOix0enu72e5U6A8ZricnUOvvDYZh4BAh0mFly6OujyeNYrR7fVW4r1dZw7IyiuqkZJebh+nUDH6aGqiRaLiKalivllHN2OV9VOPmcn0GGmIF9+Ratb0zrEMNZKDj8fn67lNU0SqWhgG55Ahxy7DC0ZEzU5arIUUO51iXT2v/DYqzxKBDqKpPaC9602RDqkgNvq2apxe2Ve7Sy24Ql0R9PScdETsYJur0/BNlGUzWzHE+go1Go8w93czG5haYWUVzdytzkC3Vmrck0VLREt9vZ6trgLHYGOvAb5JO/mZnbvqWqQ0UAT2/AEur2DXAzRE1FRU3ErfxvchY5ARy5N5W5uZlfj9sr8miYZKa/nASbQbUdLx0WLR/N7GVrhbVNEOrjsjUDHFH1g0z1PxUfDK3c9/4QkkwnbfX9swxPodqKrKdGTMattr0+K1+OXmc1ni9vjf/mF+//pfB5tc2Lf08Qq6hsXt7WtkgUrLpeXf/UTeXvH87b6/t6KR0QORjj0BZY2yUNULKuuvk3mNC8Vr8cn8VRsLo84gY4pKK+uD4iIeEpK5T0fvVrmLr1YXv5/P5PBvoO2+j5fCg9ITTTMoS+wnCkeomIJZaWVMm/BxVJWGjz+a6W+siCPunm5GYE5XfHl761sOGvRNSf9gFXVyrwLLpUSr18GD+4VTVNt8/3GDV16YiNSGhuWyhK/qG5W67mUSIQlbjCHXNHVlKixsGg2XJV7PX6Z07pU5s27SLze038OaxZdtKvntcff5FnACh2T/aEqLVuf6b/Nv+RyaTt/pbz5+IPyhxe22er73p+Ky/6DXRz6AlPK0yEqptE0c6E0zVwsXo8v4+9xebyfEJGf8mwg0DFJ/pLSCYsnnpJSOW/NJ6Rt2Qp56dH/lt79b9vq+98RDYlEQxz6AtMoyCEqRTKjsk7a2t590vZ6Jm6X5xyeDebkYgTmVFpZ0TqZ31fZ1CyXXb1RVnzoU+L32281u32gRyKH3pKyxDBPChSFrqYkHRkUNWm/z8q9Hr/MnX+xLFn83kmFuYiI3+2fybOCFTqyEGhqzqp80vLuS2TW4nfbdxv+8Nsc+oKCMskhKnnTNHOhzJ59jrhc2VWpfF5/Kc8Oc6IUZ0JX/sP3P149q+WqbP+cy+OVxvlny7ylF0v4cLdEw/Za1falEtI7MiDz3IakfGUiChtMk0UpLosgP3aISjoWFsOw38X7wepZsvBdq6SmulmUKf4MVS+8KHxwx+PbebaYC6+IZnyX5fEtnc6fLwvWyGVXb5TVH7tOKgNVtpvP9sHD0nvgTZkRG+DJgpzS1ISokSHznYiWA16PX+YvulQWLlgpJb7y6b1Geb2reLaYD1vuJuQrKb04F39P0+Jl8idzF8nu3z8mrz31K1vNaFBLy2DfPjl3RohteEx/VW7z7fXZzedIU+PCrLfXMwY6xTgCHZNTHgyel7MHuKRUFr/3w9L67kvklV/9VPbvft1Wsxprw3PoC6YU5PY4RCWjYPUsmTv3PRNehjal1xWXp4ZnD4GOSfCXV+Z8uVkWrJFLPnm9LNy7S5578D4Zsdnn688P90nNyBCHvmDSbHqIytGf99JKaZl7gVRW1OXl7+eOcebE4SwmtGFrV95fYf7w+EPCoS/OweEsJ6zKrXlG+aS1zD1f6mvbcra9nsnhob7WV+7f1M0zyjxouZvMVBvu2aprWygtZ18oajwqwza7N/ygmpLDkSFpUzTRfX7R2Yan5S7/e4hKOhGxbXt98ZL3SaCibsrt9WykUqPdNN3NhVc6k3G5PE2F+rfKgjW2PvTl+DY8h744ntMOUSnIa5XbczbPLAIdE/CXla8t9L9Z27ZI3v/pTdL1zGPy+lOP2GobflBLy+BAjzSPDEpt3Wy24R1GV1OiJaKi66rtvrexM8ob688qyr/vVlxn8Qwj0DHhCt1dtMQZO/TFjmevjx36wtnrzmAYmuiJUUecUV608HD7FvJMI9Axgcnewz1vT4gTzl5//cmHbXfoy0vhAZHwAIe+2BiHqBSG4lJ4V0ygwwpq2xbJZW2LpPvlZ+SlX//Mdm347ce24etrZkqspIoH3AZ0NSVaPCK6DQtvXo9f5rS9W+pqmk3zNfm9fj6/ItAxkWwPZck3pxz6wtnr1uWEM8qncohKvrkUN5c9mwwPiMkU4hr0qRo5vN+WZ6+PWV7TJJGKBltuw9vxOvSxQ1Tsur0erJ4lc+acbYrt9Uy4Ft1cuA7dRK748vdWVs9u+Ruzfn3+ioC0LVshtfWzZOjgO7bbhu+JR0WPDEqj1yMpb5mtvje7XYeuqQnRRkdsuSr3evwyb8ElMmfWEvF6zb1rxLXo5sKWu5neXXm9F1jh6+TQFxRtVc4hKgCBjhw/cU449OW5LT+w3Tb82KEvdt6Gt1SQH9tet+OxpiJHt9dbWpdN+1jTQuPmMgQ6Mv1weLyW++EYO3t9wKaHvmwfPCw1oQEOfSkiux+iMqtlqVQHmyz59XNzGZNlCCMwD6/PZ9kfjtq2RfKB9q/JeX90pfj99mqLD2pp2X5kv2i9b0lJKswTtVCrck0VdTQkajxiyzBvmXu+LDnn/ZYNc7BCh83Z+ez1t+IRkYMRzl7Pd5BzRjlAoMMcHHP2Ooe+5JzdD1HJ5xnlRQkQbv9KoGN8xbyPez6MbcNz6AvOhENUrInbvxLoyKDY93HPFw59QSZjZ5RziApAoMMqT7QTDn2x49nrL4UHpCYalvlVDRz6Mkl2PkSlWGeUg0AHCmbs7HU7Hvpy4jY8h75kxiEqAIEOG+HQF+fhEBWAQIddn3wlpXLemk9I27IVtjz05fjd5jh7nTPKgQLgxjIousqmZrns6o2y4kOfst1NaUSOnr0eOfSWzIgNOC/I1YSkI4OiJu13KZrX45e58y+WJYvfS5iDFTpworFteDse+rI/FZf9Djr0hUNUAAIdTn9CcuiLtYOcQ1QAAh040dihL4f/8Iq8/Ov/se2hL/NqZ0m0rNYW35OWjoueiNm2vd561kXcdx0EOjBVJ569vuv5J+x3mVvfPllYOijl1Y2WvducoamiJaK23V5vmXu+1Ne2sb0OAh2Y9pP0hG14Dn0xUZBziApAoANT4ZhDXyxw9rrdzyi32yEqINABUxo79OUPjz9kz234I/tljvugVNY3i1FSY6qvzwmHqLC9DgId05aKxwZFhAtaJ2nxez8sC1ZcbstDXw5omsjhvbK4pFeU+rliuEuL+vVwiApAoCML6WSqR0TmMYksnsA2P/TlD4m4VPfslJkVAdGri/PUsPsZ5RyiArvgTnGwhbFDXy5435/a7m5zQ7oub4SHJbL/FVESgwX7d3U1JenokKiJqC3v8tYzwWiXAAAVqklEQVQy93w557wrCfPpvNnT0vuYAit0IC/sfPb62Db8Qv8h8TSclbdteCccotI0czHb67l406frYaZAoAP5e1If24ZftPyPbXnoy1vJpMj+N+XsQJUYVc1iKN7crbg4RAWwLLbcTSQZG32AKeSO3Q99eSM8LCMH3hDXaO/0V1pqikNUAFbogLnZ+ez1A5omB470yEJ/v3jqWsTwVmb15+1+iApnlOdXWk2xCCHQgQI/0Y+dvT5/xeW2PPTlrWRSpGe3nD2jUozatjNuw3OICmA/CiMwlw1buwymkH92PfRFRKTa5ZJZ1fWiVcw+/mvDof0ydOzMFE1NiB4f5RAVTNvQSN8ntt+36adMgkAHgV5UaiJuy7PXxyz0+8VTPVOMkhoZDu2XwZS9D1HhjPLCe+TOvyVDTIQtd5NJjITUksogj0shnvx2P/QlmRQ5vFeWlB8Rn6FIKha15ePIISoAgW5KydGRaEllkCpuAdn90Jc3R+35OTmHqBRXKp2MMwVz4bI1k9HTNr1ZtgWMHfpy3h9dacvL3OykZe75suSc9xPmRaQZWpIpsELHBOKjo29ViTQyieKx8za81bG9bqJA57avBDomlk6l9ojIKiZRXCduw9vx0BfLPR4comI63PbVfNhyN9sPiZp+gymYh50PfbECDlEx8wpdfZYpEOiYgJFObWEK5jP/ksvlw+1fk3nnvodhFEhdfZucs3SNNNafxTDMuPgw9D6mYC5cQ2hCXItubgN7d8nrTz5su7vNmQWHqFgD16CbD5+hm1D48P5QoKmZVzOTqm1bJJe1LZLul5+Rl379M0kmuTAhF7wev8xpe7fU1TQzDJNTtbTKFAh0TEIqHhsUEQLd5Ox86EuhcYiKtaS1dJQpEOiYzA9LMtUjIvOYhAV+gI4d+tK2bIUtz17Pt2D1LJkz52y21632GpVOvsYUzIdSnAlxLrr1jJ29vvpj10lloIqBnIHX45f5iy6VhQtWEuYWpBn6HqbACh2TcKzp/u9MwnqaFi+TP5m7yNaHvkwXh6jY4DVKVx9jCuZDS9GkPvOzHbrbX8rjY2Gx0KAtz16fKs4otw8a7ubElrtJRYf6uQuTxZUFa9iGl6N3eRvbXifMrS+eioWYAoGOLIyGQpRObKJp8TLHHvoydohKdbCJJ4JNcA938+IzdJM6Vozjnu424qRDXzhExb7SmvoSU2CFjixwC1h7Gjv05fK/vsmW2/BlpZXyriXvlYULVhLmdg30VOIXTMGcKDaY2LU/eiFdUhlkF8XGup55TF5/6hHL323O6/HLzOazue+6zemGZjz67U+zEDQpwsLEIgO93SWVQW4wY2PzL7lc2s5fKS//6ify9o7nLfk91NW3yZzmpazIHSCRTHAgC4GOqYhFok8Kd4yz/w9hSam856NXy9ylF1vq7HXOKHeelJ7czhTMi60TE0vHY5uZgnOMnb2+4kOfMnUb3uvxy9z5F3NGuQPpavonTMG8+Azd5Pgc3ZnURNyUh75wiIqDw5zPz02PoDA5Pkd36A+myQ594Yxy8Pm5+fFuy+SOfY4Ohxo79KVY2/Bj2+tLFr+XMHc4Pj9nhY5p0uKjXxWRa5iEs42dvV7IQ184RAUn4vNz8+MzdAtYv/np2IyahlImAZH8H/rCISo4laql1V9/53ovkzA3ttwtYORI3/NMAWPydejLiWeUE+Y4UTwd72YK5seWuxV+mKLh7wj3dccpTjx7fdfzT0zrbnMtc8+X+to2ttcx/go9lfwfpmB+bLlbBOejYyKx0OCUDn3hEBVMBuefWwNb7hYxdLD7HaaATLI99IVDVDDpN4uJ0V6mQKAjh0bDYba8cEa1bYsmPHvd6/EfP6O8sqKOgeGMkmril0zBGthGsRC23ZENNRE/6dAXDlHBVBwe6mt95f5NlOIIdOTSx7+5dU/d3EXcNQ5ZGdi7S468+baUeGmuIzuxxGjvk/e0NzEJa2DL3ULYdsdUVM5qIcwxJWy3E+jIk4f/4VO3asm4wSSQjVQiJrqiMwhkLZFSv8oUCHTkCW13ZCsaCfPhGrIWS4z28tk5gY58vjgPD9/JFJCNtJoWo4wiHLKTTMU2MwVr4X27BXFGOrKx/8BuUWIpSe8bYBiYFM4+Z4WOAhk6uP8ZpoBJ/5D7vKL4OFcDkzeaHOWjPQIdhRALhzYxBUxGKhU/+v+w5Y4spFPxLzMF62HL3aL+6ru/HQ40NQeZBCYSGjwkUTUpIiLxHXvFrfMeHmd4E5hOxn/znxvKmAQrdBTqhfrIkZ8zBZxJLBb73/9RyiodZzaajN7PFAh0FNDWTZ+8lmvScSaq/O/1574AN5fBxHRDM7j2nEBHEfS90/U7poBMDF0T1wllOPcMdlFxptX56Dtce06gowgox2EiqXTi5F8o84khbOogs3gs8vdMgUBHETx62zVP97+z620mgfEMD/Sdvmrn6jVkCvNULPTi/R2PMAkCHUXCneOQSVpNn/ZrSlkJg8G4EonR/2AK1sZlazbAJWwYT0/f3tNX6JGEpN/uYzg4iaql1V9/53r2b1iho9i4hA2nOn5DmVPfwVewQsfpIvGRe5kCgQ4T2Lrpk9cmRkIqk8CY8FB/xv+muzhKFSc8H7hUjUCHufTt3cM7bByXSMYz/jelopQB4bhobOR3XKpGoINVOkxKKcl8Vzh/QzUDwvHV+WgytY5JEOgwGU5hg4hIMjk68W/genSwOifQYW6J8PA6bgeL8a4/PxXXo4PVOYEOE3vktmu7uR0sUvqZP3nx1nGVI6tzVucEOky/SuezdOfStPRJ92/PxB2YwbBYnbM6J9Bh+lU6jXfHioT6J/cb/R4xuHyN1TkIdJgbjXcHv1CPRif/m8u5yQyrcxDoMD1W6c5j6JqIf/JtN39TDUNzoJF4+EFW5/bEvdxtjHu8O2x1PjIoofhIVn8m8do+cRm8DDgF92xnhQ6LGjp08B+ZgnOEQoPZv6Of4WdwDhIZDd3OFFihw6L+8tuPHq5qntfIJOzN0DU52L8/+z8YS0lq92EG6ADxVCz0xHdvqmISrNBhUYOHDn6MKdjfaDQ0tT9Y5hNd4V5Ejgj0ROTTTIFAh4U9ets1Tx/auWMbk7C3qWy3j2Hb3f4iiZG3t9+36adMgkCHxXGzGXvLtt1+Ktru9qYbmhGNxf+YSRDosIFHbru2u/fttyjD2FR4uG96fwHb7rbGZWrOQSnOQbiMzZ4OHNgtim96VyKlewbEGBhlmDZDEY4VOmyqv3vfhziNzV40LT3tMBfhsBbbBjpFOAId9vTobdc8zWls9jI0kKNLzvwe0b2817OTkdHhbRThCHTY2C++8Gero4N9cSZhkxWYls7Z3+WfVcdAbULV0ir3ayfQ4QB97+y+milYX3RkUFzu3P0IK8FyynE2EY4OfZ4inPO4GYHz7Nn24Juzl62+rKKuoZVpWNeRIz0i7tz+CBvJlEiCKxwt/UYvHn7195u/yJt2VuhwCrberU1NJ0V8uT9jw9tYzXCt/LzQ0moknljLJAh0OAxb79bV338oP3+x3yOan6tZrYqtdmdjy93B9mx78M2Z5/3R0sr6pkVMwzo0LS0jiZG8/f3e8lLRBqMM2mJGRoe3PXvvrVym5mC8FQc3nLGYoYGDEtNSef03Em90i4uP0i0jlU7Gf/OfG8qYhLOx5Q4Z7N67lBvOWIOhaxJNJfL+7/hbGhi2ReiGZkTiofczCbDlDul66qFw49mXlASbZq9kGuY2PHhYVNHz/u8ofo+k+0KisIlneqHR4e9vv/dLdzIJ8NOK4666/YFXGhcuWcokzLs6P9C7L6fXnk9EOxIS7VCYwZtYJDHy9lP33HwWk4AIW+44wc82rl3GpWwmXp0P9RYszEVE3PVBbjRjYql0Ms6xqCDQkdHO555dzufp5lydF+Kz81N5m+hKmpFuaEY0HrqaS9Rw0ptwRoATHXzxsb6GxReHq2bOuYJpmGh1XqDPzk97x19eIumBsCg6j4GZDI4M3Pncf226nUmAQMeEup7csp3r0821Oh8ID4jiKk7lxV1aIvowZ6WbxbFbu3I3OJyGUhwy+vg3t+6pm7toHpMorsOH9opW5LfeyTf3i5Lmk5hii6dioSe+e1MVk8B4+AwdGUWO9P0xJbniUtPJooe5iIj/rJk8GEWWSifjoWiEq1BAoCN7j9x2bfeRrl3voiRXPL29Juk8+T1iVPh4QIqEEhwmg8/QMaGupx4K1y26cFegtv7PXB4vH9EUUCwyJHE9bZ4Xi0C5aEdG+JyuCIZG+j/33H9t+h6TAIGOadmz7cE3m869dE6wcea7mUZhGLomfUO9RSvCjUdxKaK4RIxIkgeogIajg9/bft+XvsQkQKAjJ3Y//vOHGpasINQLZOBIj2gm/EDMVV4i6uAIl7EVSHh08Lnfb/7ih5kEJvWmmxEgGzTf8y+VisuR4V7zfoFJVZI7e7jPe55xW1dk/YabESAbP73pQ2f1v7PrbSaRH4auSd+RHnN/kX6PuBsCPFh5FEuM9hLmINBRkFAf3v92L5PIvf7+HlG8HtN/nZ6mKjHoSOZFKp2Mh2PR5UwCBDoKYvhQz3KuUc+t6MigpMQ6H077Fs0WrmfMfZgPRkLv4vI0EOgomLFr1An13FDTSRmKDFvqa1bcLvHNa+DBI8xBoINQh8jRz80P93aLy2O9i06UihJRqkp5EAlzEOgg1NHf3yOKz2vZr9/bUi9GCVfAEuYg0EGoO9jQwEFLfW6eiW/+TNHJdMIcBDoIdSeKjgxKTEvZ4ntR3C4pWTBLDGpyhDkIdBDqjnoxT8UlFB+x1zfl94h/wUxCnTAHgQ5C3RnUdFJ6Bw7Z85sr8xHqhDmKhE+9kHNdTz0UnrlkxQ/VVOJD5VW11Uzk5DA/1N8jLreN30t73eKpLBN1MMLtYQlzFBA/bcgr7v3usDA/USwlyd2HCPVjIomRtw8MHLhg3wOdIaYBAh2WdNXtD7zSuHDJUifPIDoyaL/PzAn1rMKce7Mj3/gMHXn3s41rl3W/9uL3nPr9j4T7nRnmIsc/U9cV536mHooNPUCYoxD4DB0Fsfvxnz9U/66LSiqqay5xeZxzqseRvm6JqUlnP/het7jrKkUbjjjqHHXd0IzQ6PD3n/3BF/+SVwAQ6LBXqD/xi9/WLbpwV1lFYK3HX2Lr3SFNS8vBw3tFd/GploiI4lLEUx8QdTQuSkpzRphHBj65/d4vfZ1HHwX7OWMEKLQ1X76nJdDcujPYMLPU7fba7vuLjgzKUGTYkvdmL8ibnYGwqD0h2774pI104vBQz0Vv/PhrO3i0QaDDEa74xk/2lVUEWmobZonPZ/0DPjQtLUeO9IhGM+WMDE2XVNchURL2Wa3rHhFthvfQaHxgxe//bSOXpYFAh7OsvPWue6qaW69xG4bU1c8Sv7/ckt/H0MBBiSbjrMqzDfZIQpLv9IrLsO5LkVHqFv+cehnuPfjAtq/93Ud5VEGgw7GWf/6Oj1fPmfNDX1mZR0+lZUZpuQSq6sUK2/HRkUEZHhkSxevhgZyGdPcR0Ydjlrm8TVcMcQfLxNtYLZpiGAPv7P3cs7dv6OSRBIEOx1tx8+0tZVUN22c0NjQe/8VkWoLBGimfERTFZa6VL0Geh5WupovaM2DqYNf8ipQ01YgSPLqTFBscCkWP9Cxlix0EOnCKVV/6zy1Vc9vWnrQa0nTxaIZUBqqKGu6alpahgcMS19LOudtbsYLzSEjU3mFR9OLPWfca4q0LiqumUpQTHveh7u5tv/vq367m0QKBDmSw/PN3fDzY0HhfSTDgG3cll0hJib9UAtV1eS/TqemkREcGJRKLiuLz8uAUWlKVdH9I9KFIwcJdVwwxyrxSUhc8vhI/USoWU/v27PnMS9/aeA8PEAh04AxW3Hx7i39G8IHAnOYz3jJWiyfE7/XLjIqA+ErKphzyhq5JWk1JeKhfkqmE6B43K3GThbsWjkpqcESUlCYuY/qPjSGG6C5DpMwnJbVBUUr9Iv7MH6NEe/t6Y8N9y9liB4EOZLta/2znprr58//J7cv+7nJaPCEiIi7FJV7P6atrVVdF045eNuUuLWHYFmREjj7GqYGQ6JomYohIPHX6b/S6j/6fiJTUBkXcbpEy30lb6BM+l1JpY6h73zee+cYNtzJ1EOjANFbrpxXmgAJhVQ4CHcixS2759terW1pvmcpqHcgWq3IQ6ECeV+uT/WwdYFUOAh0wuYs33tkemNn4tZLKylKmgVxJxWLq8P6ez3OTGBDoQIGtvPU7j1bNaX4/2/CYDi2VNsKHD/2O68pBoANFdPa1t51b3zz7F5Uzm+YxDWQr2tvXGxke+thz/3bT00wDBDpgAhdvvLO9oq72K2U11UGmgTNJjIzEw4d6v8T2Ogh0wKSW33zHt6pb5nzGV1bGjdZxmlQspo4cPnTv01+//lqmAQIdsICVt951T6Cx6WpveTm3ewOfk4NAB6ysdW17sPmcJQ8EmmZeSnHO2UGuxsLruAwNBDpgcStuvr3FUxa4l2AnyAECHbBJsLt8Zf+nsmnmOj5jt6dULKZG+/ufIchBoAMOsfLWu+6ZUVf/F9ycxvrUeEp0Q6XsBgIdcLKLP3fnnRW11X9RVl9bxTSsJTk8IpGB4VAiFv3Ri3d8dgMTAYEOQC648d+vKg8G/nlGXc0Cb1kpPxsmpauaxPuHjejQ0IF0Mn3zi3d99mdMBSDQgfFX7Rvv+nlFdfC9ZfW13KTGJNKRmIz0Homl4vHfP/etmy5nIgCBDmS1ai+rqNhYXlN1gT9Q4WYihaXGUxIfHNYiw+E9ejq9idU4QKAD07b8pm/dUhasvL6spmqWp6yUcM8TXdVktHdAi4XDB1Op5F0vffvmbzAVgEAH8hPun7/j46VlpV/0VwQWlwQDPiYyfalYTI0PDrwRj8X/Zfu/3vhTJgIQ6EBBXXTzN1eW+Etu9peXXVLW0FDHRCYn3j8sWjo1kk7EHk8kE//GaWcAgQ6YysUb7/p52YyyZb6Kiln+QAWr92PSkZjEhkOpxGjsoJpMvaKL3vHSnZ97nckABDpgeituvr1F8ZR+2u32XFYSCCx02tGuscGhUDoW3ZdKJB811Ph/cOc2gEAHbGP55+/4uKLIR0pKS9/lLZvRapeQjw0OhdRkclBLJF5PpdLbOGccINABx7no5m+udCnuC7yl/rUer2+2x++v8VdUBMx2kIyWShvJSCSsJpODajrVo6VSz2q6/iolNoBABzCZFb2hNLm9rrNdHu9ZIiIlMyrOG/vvLre7bLpN+0QonNI1LXb8f0cjr4mI6Gp6j5bW3zAU4zChDQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACYnv8P8S6c/DUC+IQAAAAASUVORK5CYII="; + +var WALLETCONNECT_ICON_URL = "data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%20%20%3Crect%20width%3D%2224%22%20height%3D%2215.0867%22%20fill%3D%22url%28%23pattern0%29%22%2F%3E%20%20%3Cdefs%3E%20%20%20%20%3Cpattern%20id%3D%22pattern0%22%20patternContentUnits%3D%22objectBoundingBox%22%20width%3D%221%22%20height%3D%221%22%3E%20%20%20%20%20%20%3Cuse%20xlink%3Ahref%3D%22%23image0%22%20transform%3D%22translate%28-0.00968744%29%20scale%280.00339792%200.00540541%29%22%2F%3E%20%20%20%20%3C%2Fpattern%3E%20%20%20%20%3Cimage%20id%3D%22image0%22%20width%3D%22300%22%20height%3D%22185%22%20xlink%3Ahref%3D%22data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAASwAAAC5CAYAAACSoQIxAAAgAElEQVR4Ae19fZgdVZnn761TnQ%2FCtwmugxhkGPXZDIjDoENIuu9twsAm4CS7EpFhWHYktN23AwzC6Dg6xI%2FVWcGsk%2FTtNgQ0MogQ9lkQDAtLTN%2FuhDjIk5koG10eWRwQdAjRYBLIR9epd5%2B3um%2FS6dx7%2B35U3Vt16tx%2Fqu6pc96P33vqd8%2BtOu85BPuxCFRAYF4%2Fn%2BJ4ONNV3izt0AzycRwRzQBjBgPHEfszfMIMIjqOGDNAmAHguDGRb4HxJhPeZOa3yMFe%2BM5%2BR74DbzHzmyC8ST7vZXJ%2Fs9fFL7Z10e8qmGMvpRwBSrn%2F1n0AF97Np07d753rK2eOw%2F4fENG7ffCZYDrTIZzYTJAY%2BB3AvwDoX5nk6PxcaWfHb2fgJ9v%2FC73RTFusrvghYAkrfjGJ1KL21XyO4%2BgPMvhch%2BhcAHMAzIpUaUjCmfEagP8D4ucA2u6z%2BtFwjn4WkngrJgEIWMJKQJDqNfE%2FfJNnvXVQz3OYLwToAmZ8iAjT65UXy3aMfSD8E3x%2BlhVtPdimtv7wevptLG21RjWMgCWshiGMj4DzvsUnn3RAZx2NLDvcSSAZPaXq4zN8Av8YwCZi2rST1PCOHO1LFQgGO2sJK%2BHB7cjzBWDvcihc7jD9UcLdicR8Zv4hkfOY1s73h5fTc5EosUKbgoAlrKbAHJ6Ss1fx1He26UvIx4dBuBzAO8KTbr4kZvwrgx91GI%2FyLneosII88702x0NLWAmJZTCSIn29A3wMwAkJMTvWZjLjN8z8bZrmDhSupxdibaw1LkDAElaMO8JF9%2FAJ6qB%2FrQP%2FegKdF2NTE28ag7cw0V2vjqj1L9xIBxPvkKEOWMKKYWDb8zzXgV5GhKsATIuhicaa5DP2EHAvjai%2BwZvpeWMdTahjlrBiEjgZTU095P9nH%2F4NxHROTMxKtRkMfpqJ1thRV3y6gSWsFsciczefjUP6UwRcY0dTLQ5GGfWjoy6%2BS7vuys1d9Osy1WxxExCwhNUEkEupGCOqLzJjqUNwStWxZTFDgHGQgbXaVV%2B2xNWa2FjCajLulqiaDHgU6ixxRYFqVTItYVUFU%2BOV2vN8hkP6y2N%2F%2FRoXaCXEAgFm%2FgeP3M9v6aHdsTDIcCMsYUUcYHmY7h7yPuv4dBMIUyNWZ8W3AgHGbhB9aY9yVm%2FropFWmJAWnZawIop0ZgW7fJrf7YD%2FDsDMiNRYsXFCgPGiT%2Fj0UI%2F7UJzMMskWS1gRRDPbN3Kx76DfAb0nAvFWZMwRkEmo2nG7Nn%2BCfhpzUxNnniWsEEMmy7nsP6BXEYIJnyFKtqIShwDDA%2FF%2F36PcFdu66K3E2R9Tgy1hhREYZur8hp%2Fzmb9EwElhiLQyjEHgZQDLB3vcR43xqIWOWMJqEPxsH89h8tYR0R83KMo2NxuBR5lVVyFH%2F2a2m9F6ZwmrXnxXsJM9zf%2B0D77dAabUK8a2Sw8CPvBbYvQUcu6D6fE6XE8tYdWB5%2BjkT%2B8BAp1fR3PbJO0IMP7nm6xu%2BFEv%2FSbtUNTqv00JqQUxZmrP65twUP%2FEklUtwNm6RyFA%2BI%2FTSf80kx%2B57Khy%2B2VSBOwIa1KIRitk1vBMaL2egGyVTWw1i8CkCDCj7%2FVZ6pM7ltKhSSvbCrCEVUUnyPTzn4D1I0R4exXVbRWLQE0IMPO%2F%2BFPc%2FzS8jH5RU8MUVrZ%2FCSsFnZkyffqzBL3FklUloOy1RhAgog%2BoEf3jbL%2F34UbkpKGtHWGVifIH%2B%2Fhtx5F%2BkAgXl6liiy0CoSPgM68ayrXdFLpgQwRawioRyMwafh95%2Bn%2BDcEaJy7bIIhApAj54q4Z7uV0B4liY7V%2FCCZhk%2B7yF5OlnLVlNAMZ%2BbRoCDmiuy%2Fqf5YezaUoTosgS1rhAZfv1Z9jB90E4flyxPbUINB0BIpwpP5zyA9p05TFWaP8SjgUn2%2B99B8DVMY6VNS2lCDDRrYVu9bWUun%2BU26knrGAnZaUfI8IlRyFjv1gEYoQAg79e6Gn7qxiZ1BJTUk1YQlZnuPoJAJmWoG%2BVWgRqQMBnfHOoR10PIq6hmVFVU0tYF67k6dOm6cctWRnVn9PgzEO8U11dWEFeGpyd6GMqH7rPyfPxU6Z5Gy1ZTewO9nsCELgSp%2BlH5d9BAmwN3cTUjbDOvZdnnLrXe4qILgwdTSvQItAkBJh58%2BtwF%2B7I0b4mqYyFmlQR1odW8YnTlfcDu9heCH2PsY%2BB34H4DTkS6HeQ74w34PDosik%2BvQ2EkwGcxOCT4ONkIjopWJXVTh1pOAjM%2FE%2F7tXvpMzfSnoaFJURAaghLUm2mO94mB3RuQmLTOjODjUL5ZSJ6yWe87BC9xOCXoPklV7kvezvxcqPPUGRXIecdmA3fm%2B379C44NJuYZ%2Fs%2BZpOD2QycYRdGnLwLMHj7fs%2FtSAtppYKw%2FnSATzvke1uI6A8m7wKprLELjGENGoZ2hod%2Fix9jBfktRWI9q8xr%2BABcv4OY28GYD8IpLbUppsqFtDy4nWlI5TGesC65h3%2FPO6i3AHh3TPtbK8z6FQPDTDTskzOUiO2omGn%2BAM5xMEpgDLQ7hNNaAV4cdTJ4B5SbKXTRrjjaF5ZNRhPWgjX8Lq31ZgDvCguwBMt5GeAHR%2BA%2BuKWHtiXYj1HTmakjjz8BeVc5oKUg%2FLvE%2B9SgA8z8PFx3nsmkZSxhtef5DEX6GQDvaLAfJLn56wz%2Bjtbu%2F9i8nJ5OsiOT2d45MNKpmT7qMK5M819H%2BXtY6Gn7wGR4JfW6sYSVyY88m9K3gW%2BCcT85%2FMCm7rZNSe2YjdgdJAw7wWa2f9GInMS29fkrg71tn0ms%2FRUMN5KwMnnvOiJ8q4LfJl76NTOt3K%2Bdu9LyxmiyIMqb4RmOn%2FPBNznAqZPVN%2Bj6G4M9rpEvKIwkrGy%2F9z0AqVhulsE%2FZqb%2FNpRzv2vQDRe6K5m893Em%2FmsH9J7QhcdRoK%2F%2BcLCXdsTRtEZschtpHNe2zHwWkZFcPB7yR4n4HwZT%2BrdvPBDVnBdy7j0A7sn2eX%2FGxJ8kovnVtEtqHQLellTbK9ltJGGBYGxiKDMe86E%2BNZyjn1UKrL1WGoHBXldG39%2Bbv4o%2FqFxvJYEuKl0z4aUK%2Fy%2FhHpQ030zCAv1fAOeV9DihhcEra0JvIdcmSdv20yACm2%2BkHwGYlxnwroKPO4lweoMiY9NcUnYGe%2BjV2BgUoiFGrtbgAPeGiFFLRTHjNz5RTyHX9r5CjyWrsINR6HYfwHHqbPbpc8zYH7b8Vshjh77aCr3N0Gnsg56O%2FpGnZTH%2FZoAYlQ5ZZXKvclds6woSi6NSY%2BWOITB%2FDb%2FD9fTfg3BtYkFhfGcw516TWPsnMdxYwjp%2FDR93gqcfTei%2BggXtqBuGP0E%2FnyR%2B9nIECMzr5%2FNdePcQ6P0RiI9OJGP9YM79aHQKWi%2FZyL%2BEAuu2LnrrFa0WMeOp1sNcnQU%2Bw2fmzw%2FuVBdbsqoOsyhqSerSK577IWZ8Iwr5Uchk4IHBWcr4TVSMHWEVO8X5a7jtBE9viPsmE8x4zYX6yMYcSaK2%2FcQEgUy%2Ft5gY%2Fxjnrd%2BErArd6uo0rPVuPGFJvw9IS%2BuHCVgUk%2FvgKDMYGIRSS01OWj3K4YR9yQzwmWDvkVj%2BRWTcO9ijrksDWUm3SQVhiaOyYBxm6fVEWBKb%2B4XhMdFnC93OV9PS4WKDfY2GjI7UvTuI6KYam0ZXnbF2sEd1panvpIawir0m0%2B89QEDLH0wy4RVPq49s6SVZUcJ%2BEoJAZsC7HIz7gmWeW2gzM%2FoKOXd5C01oiWpjH7qXQ7MwU%2F25%2FOcvd70Z5T74J8pVf2zJqhloh6uj0O1%2B33PVBwG8HK7k6qWllawEodSNsIJuwUyZAX0%2FIViCpPqeEkJNeV61V6nL5S1mCOKsiBYhkFnDM6G9Jwh0fjNNSDNZCc7pJCzxnJmy%2FXpdUycJygPSWeovsZR0Mzu51RUNAplv8TTs1w8RcHk0Go6Wysx3FnJttx1dmq5v6SUsifMoaa0BYVn0YafbB3vUF6LXYzU0FQFZqvkb3t87TH8dpV6Zn1fIta2IUkcSZKebsMYilM17d0VFWgyMyCguyFlLQo%2BwNtaFQHveu1YRvglA1SWgQiNmuq2QU3dWqJKaS5awxkKdyY98PYJX1geIeFFalypOzV005mhnfuRPmUiWr5kWnu%2F0ycEetTI8ecmWZAlrXPwyeW81EXrHFdV%2FytinoS4dztHW%2BoXYlklDoD3Pcx3ojUSY3qjtRLR8U7fqa1SOSe0tYU2IZiY%2FIpMDb51QXNtXxj4fqnMoR8%2FW1tDWNgGBMEjLZ9wwlHPXmoBHmD6kbh7WZODJWxh5wDlZvXLXfcYeS1bl0ElHuYyqfagFYOyr1WMG2JJVedTsCKsMNpm8vpWI7yhzuXQxYzdDdRZytL10BVuaJgQ68nyBA72p2sTpMbK6bjjnGrMAZdjxtoRVAdEaSWsXfJUxcaeSChDZS5MgIKQF6I0O4cRKVYWsQLjavk2uhFKaJ45WxuXw1c4B3cvMqw8XlD7ZhUNq3uDN9Hzpy7Y0zQhk8nweQw9VIC3NhGssWU3eS%2BwIa3KM0JH3ljmEu0pVlXWsaER1WLIqhY4tKyJQgbS0T7hyqNt9uFjXHssjYB%2B6l8fm8BV5W0Og7sMFR05%2B5Ss135LVEUDsWWkE5LkmQXXIKh3jarzpM5ZYshqHyCSndoQ1CUDjL49NDPwbBhOBdrpT1c1PfZx%2BNb6OPbcIVELgvG%2FxySfv84It6BzX%2FfmmbjO346qEgb1mEbAIWAQsAhYBi4BFwCJgEbAIWAQsAhaBOhCI5BnWJffw740c8JaDcGFgE9Mb5PDAYHfbk3XYaJskBIHsKn4%2FlL6FiWeLycT0kvbVncPL6bmEuGDNrAOB7MDIpexTN4hPDuLuY6vX5q7e3EW%2FrkNcxSahE1YmP3InEX2ylFYGb%2FMd92N2z71S6CS37Pw1fNIJWq8jYHEZLx7ao9Qyu4N1GXQSWjz%2FG%2FzvHd%2F7rgM6t6QLPn9lsLftMyWv1VkYGmFVu5WW5NoBaoFNDK4zYjFrdvFafrs%2B5A0R0XsrmcbMz6spbscPltFrlerZa8lAoIYZ%2FBv2KrVkWxeNhOFZKPOwzl7FU4PNSqvY909m%2B0p%2B1ajDYbhgZbQKgc4BPt0%2FpLdORlZin9SRukJwrbLX6g0HgbHVKDZVmLl%2FWJHsBSrcIBxxuLCBk4ZHWGLIGa5%2BQrb%2Bq8kOu15UTXDFrXJAVqyfJiB4XlW1fYwXyVHtdv5R1YjFqmIDS%2BcUfumpy164kQ424lBDhHXhSp4%2BbZp%2BvGayGrOYGfvh88LC8rZCI07Yts1FoPNunu0f0kM1k1Ux7sBLzhTVsel6eqm5llttjSCQWT2SgUOPN7A4YeHAAbXwh7fQ%2FnrtqPsv4Zw8Hz9lmrexXrISg8VxcuiJAIh6PbDtmopAQFYH6xhZjbNSiM4%2FqJ8WWeOK7WmMEejoG7lE7tUGyEq8ywhnCHfU62pdI6wPreITp7veRgJdUK%2Fio9oxDvrMVwz1tj11VLn9EisEFvTzWR7rYSKcHoZhzHjVJdW%2BsYdeDEOelRENAmNktYGAtjA0MPjZ%2FZ674JkbaU%2Bt8momrHn9fIoLbxOBgnyoWhWWqy%2B7yxCwZLDH3VCuji1vHQLZr%2FN7uU0PESHUh%2Bay2oVLaq4lrdbFtpLmbL%2B3iIGHwyKroi4Gb9%2FvuR21klZNhDVGVpsJNKeoONQjwwNhsSWtUFFtWJiQFaboLQBmNiyshAC7RE8JUGJQJGQFxiMguFGYI6Tlwe3c0kO7q5Vf9TMs2ZrbhRcdWYnFAgzjkY4Bb0m1Dth60SKQ7eM5UZJVEHYZtU3RWwJd0bpjpVeJQHAPRkhWQdxB5wmnCLdUaRaqIqxg7oznbYlsZDXeWoLrMB6ypDUelNacy6JzIL05qpHVBK9mii5LWhNQacHXzIB3ldyDUY2sxrsUcIrnbal2ft6kfwllvg37ehiEs8YrasK5XTa2CSCXU1FhhcxyTcIptxt5hINjnVKErMC4n5q9fDrjRWeKmjtZJkTFEVZxcmALyErgVgKcbAFeJ%2Fa2WZ0ISBbCJGuQ1ym5imaEU0S3zYSoAquQqwT3WivISvwgnCWZEMI5ldwqS1jBfJt6ZjJX0lbjNWF5h7DOklaNwDVQXYhCUqeqSbtoQE3FpjZ9qyI8kVwc27dAEtgn%2FdcViQEiVEiLK8%2FPK0lYMt9GJvbVO5M5TIeKpCWAhinXyjoWgWKOWLX76B0rIcQSwvFCnGJTiFKtqBIIFDdZaSlZjdlVnFQsHFTC1GMfussrbI8loTWcyYGllNZaNkZad8mWW7W2tfWrQ0CyDRzojbEgq6LJo6S10ZJWEZDwj3JPldsRKnxt1UkU7hEOCqbTTGhy1PAv6vk2E3TX9ZWIlm%2FqVn11NbaNSiIgZCVpFyCEklFfUkkDhTbntAHwKjStcs%2FNChIiv3TMfp%2BH%2FxI2Y75NGO7JpqayI3MYsqwMoJgjFleykhgVc07FVhuzcBCQe6iKDYLDUVa%2FlJkT5%2BcFI6yArJxgJnOwxGn98pvZkv52sEd9uZkaTdOV7fMWwkGiUqEIWLipx%2F1fpsWimf5k%2BvRnyeEvNlNng7re8Bx10eZP0E%2Bd89fwcXD0YwASRFbiPv%2FXzMDIlxoEIrXNs33enyWNrIKoA49n%2B70PpzZwDTqe7Rv5csLISjw%2BWfn6UTlxTvD8vwLw7gZxaElzYvrbTH7kKy1RnmClmbz3ETh4JMEufC%2FT75VbPz7BbkVrekffyNfg0N9EqyUa6QT8frZf3%2BIAfqIDT0Sflo0vooHJPKmZvPdRIjyUdM8IeDjb5y1Nuh%2FNsr9jYGSl49AtzdIXjR6%2BwiGis6MR3jypsktPJu%2Btbp7GZGqStAsifCeZ1pew2sH9QSpJiUu26AgC2bx3l8Mk%2F6SS%2FWG8T94Sesn2YtR6IvRKYMB81FQNE3wLw4di2kWQ8hSGwHjICNK3LGmVCQYzBfcEwYhJ1z7gOMz8szLuJq%2BYsCwzoO9KnuHRWpzJex9XhG%2FHYSZz2J6KT8T4bvuA95dhy066vGy%2FXgtDyEpiQcBzDoiMusEJuL4j792T9M4Wlv3ZvO4hwt1hyYurHMW4J9uvb4irfc22K9vv3QvCx5utN0p9BPSPzsPq92Qt9QVRKmu2bAbuK%2FS4f9FsvXHS19GvlzvgVXGyKWpbNKh3uEflo9YTZ%2FnZvHcfCH8eZxtrtY2B7xd63CuCme67p6srmflfahUS5%2FoEXJPp974bZxujtG30FXC6yErwVOC%2Bzn59c5TYxll2Nu89aBpZ%2BcT%2FvN9TAQEffkAd%2Bk44MYkqMx7G62ppYQUZ8XKhGlgl7YKI76imrql1mOm2Qk6lZrpLZgW7mKXXE8Go5cUn7rBzmLCk48p%2BYbMo2BEnnO27YnI3MLABO9XiNJBWdkB%2FDsxfiAn0LTUjLaR1%2FhpuO0Fr2dlmUUsBD1m5D966i91Ld%2BRoX1H04eRnKZALr7PbKRWLFUw4BoE8TT8igTXBn3I%2BZPIjd1iyOoKOjDIzA%2Fr2IyXmnQVk5WnZM9A4sjp0wF0wnqwkekcRlhRIBakIwKjt4yWgJ3h6w9mrOJZLqDR6KwlZEZFdxWICkMS8IiDyCeUmfJW%2BLH2aCKatYlEQDiq1pf1RfwnHB1HAeKfSj5kIxi89ddkLN9LB8f4m%2BVxm%2BcvE2ST7ELXtzHxnIdd2W9R6miX%2FwpU8fdo0%2Fbhs%2F94snc3Qw4ynXtHqinL3Z1nCEuMODzcNZPADB9TCUgzejKCEqcOSVfVoMqOvkHOXV98injWFrKZM8zY6IKOWjxay2uuqRdu6aKQc8hUJSxqZ%2FECv3LCzHFixKpe0i369xqSZzE3Bl7F2MOcmdoKpvBibSd6TxpEVsGGvUksqkZX0j2OeYU3sNIGAnWpxMD1g4sUEf5eAy6%2BUdIDEuTFKVussWdUROcKypOacFt%2FiG0dWMvVop1o8GVlJtCcdYR3uEutZZXbp%2Bwi46nCZAScT53nE3qUjZGX3a2wkWIx7B3vUdUEmYiNymtTW2HmSwAOFmeoaLCVdDZTVE5ZIY6bMgJZdYU0jre37PbfjmRtpTzWgtayOoT8arcKT5WbpVlfHnbTm9fMpLoL5kee1Cqso9NaDf22EJVYb%2BgvP4O0e3M4tPbQ7iuA0LFPI6nX9kGkzmRvGpUEBwU1Twy98g%2Bpqbj5GVpsJNKfmxnFuUOcIt3bCEhAMfeDL4B1QbqbQRbviFGtT0y7igrE8ny3MUldW%2B7ekWXZn1vBMaK9gIFmtHexRXfWMbOsjrLGImbQ4WLETMvPzcN15cSGtgKxO04%2BYNpO5iHdcjnHLOb14Lb9dH%2FKGiOi9ccEoDDsanVrSEGGJAybOAxLSUlPcjh8so9fCCFK9MkydUlIvHlG3k5zTal6tR22HkJV%2FSG8FoeR27VHrj0p%2Bo2Qldk06rWEy42Uinswinqxekq7Lr5p0GOk4rbL7cNqFYTlircKzGr3F9C35oaimfhR1Ogf4dDPJSjINGp%2B02zBhSdAk5cH3DVshgHCWdBzpQFF0zEoyhazOcPUTBqZFVXI7FtcE81blnHbezbN91k%2BbN7Liz4eVFtXwX8LxvczEdZgYeMmZojo2XU8vjfc1qnNTc8SiwitCuYVm5pwGZHVQP02Epv9ARoihvJ8LdV2yUAlLHDeStBivOlPVRVGTlqlpF1HeEBHLLjQj53RBP5%2FlsR42jayIaPmmbtUXZoxCJywxrnNA9zKzUfsEMuNVl1T7xh56McwAFGUV0y4IZNTiiUX%2FknostYhcmL6MkdVWIrTseWmY%2FhRlRUFWIjsSwhLBHXlvGRHWmLS1FDNec0nNDZu0TE27KHbepB8lfUsWtpy4mFyjfmW%2Fzu%2FlNj1kElmxzNJkdA3l3LWN4lOqfWSEJcpk806HsM400qIR1TF4Mz1fCtBay0xNu6gVh7jXDzvnNNvHc%2BBoWSRzZtx9r9Y%2BISufcd1wzr232ja11gvlLWE5pYHhDKM2uAx%2BDafozZkB%2FsNyfldbfuHdfKpL3hCBjMoR88E%2FYeLnqsUhCfXkr%2Fp05RXkB6ZRe9tX8zm%2Bo4dNIivBJGqyEh2REpYoKOTcdRpm7ZEGYBazHsqu4vfX23kl7WLKIW%2BQmM6pV0Yc2zFj3VBP2%2FsL3W3nAvh2HG2s1yYi%2BoAkITdCWvP7%2BI%2BUo4cc4NR67YhjOyZ8LMqRVdHnSP8SFpXIsWPAW%2BL4WA%2BCO7480eeM3QzVWcjR9lr8CHLEPG%2BLaWkXmJjQam6ifF05px15vgDQGx3CibX0l1jXZXi%2Bg6VD3e7DzbAz8hFW0YnAIcJiMMzZH5BwCkMPjXbEoqeVj8HseTPJShJaj15fioiDMkYkD2ArIx3d1SAZ2fO2BD88VaqRPuJAbzKNrEBY3CyyEqibRliibLDH3SAOMlB2zeYq4x%2BbatIBpSNWQ1rFtAvTRlaSIxYsO0zExwRGSCvn3iB1jrmW4IIghp63pZr0rfY8z5U%2BAkLyVrctE6PgHiYsDu7pMnWiKG4qYYkD4iD7vAgMY3atkY4oHVI6ZrkgBWRlZtpFVTliJuecVkrfGiOrjSaRldy7cg83m6zk3mo6YYnSod62p9jnywwkrY2lSKuYI0bA7HKElsTyWrfOknwy0xLlJe9P8v9KkVZm9UjGgd5IhOlJjG8pm5mxX%2B5duYdLXY%2B6rCWEJU4VlrcVxHEBIGonmyVfOqZ0UOmoRZ0yk9mXHDHDyApEf1dPQutoGzJqN2aJbUBad%2FPhH6SOvpFLyCFJYDeKrHyoBXLvFvt3s49Ne0tYzrH5q%2Fki19FPGDVkBg744JUM51cO8%2BdMmskscQwjoTXbr28D%2BKvl%2BkUiyxn%2F5jv0BdL%2BbHLoU4n0oZzRjH0a6tLhHG0tV6UZ5S0nLHHSyNe9zYheC3SEmSNmYs5pC0ISuUqfsQdQC4Zy9GzkyiZREAvCEhszeT5PpggY9dp3EvCTdDmqHDHJOXUIdyUJi1TZWudcw6gwig1hiYNCWjT6%2Brfh9IeoAEuj3KhzxExMlDeinzB2g9X8wV7aERd%2FYkVYAoqJSaFxCXY9dkRNVkWbTEyUL%2FqW0OMu%2BCoTJ7ISHGNHWGKUictuJLTTaiZcU%2Bh2H2iG%2FZkB7ypi3AdANUOf1VEaAVlGKcwVSUprqa80loQlrpi6sFl9YWpBqybniBU9DHJOGQ9Z0ioi0txjVGu%2BheVFy%2BZhTeaALJIni%2BXJSp%2BT1bXXQ0ZA8j2bnCNW9EDy0nzClUblnBadi%2FlxbFXd0BeoDNPt2I6wik4Gs8QP6SHjJl4WHYzZUXLECFjSirSL8VBk%2B71FDDxMQMu23Bpvj%2Bnnzd5spV48YzvCKjokGz84pC4CI5K11It67FFmhLYuR2wi%2FkbmnE50Mi7fGS%2FKPRb1JithuBv7EVbRSVN3wy361%2BpjkCLl88JWpl2UwkDSnCTFBYSppa7bsgYRELKaoua2epfzar2I%2FQir6IgAKsDKNvLFMnsMCQHGvlbniJXzxMSc03K%2BNrtc7qUkkZXgk5gRVjGYwaJp2isEi6gVC%2B2xfgRGyaozDmkXlZyQVTAU9JOG5ZxWcjnSawyua9XUSI2qQnjiCEt8GttpZrMlrSoiXKFKnHLEKph5%2BJLNOT0MRUMnDN7uwe3c0kO7GxLUgsaJJCzByW6P1WBviVmOWLXe2PStapEqXU%2FIar%2FndjxzI%2B0pXSPepYl5hjURRvl1EOBlv7iJ1%2Bz3SRHYJTlitW6eManUJlQIbGY1H5LnZj81ITC2t2JiyUqcTewIqxgp2eJ9JnlPOqCyyxMX69pjgMAuHFLzwtoItlWY2pzT2pD3wVt3sXtp2LtX12ZF47UTO8Iqui4BOHTAXSABKZbZY2kEJO3CBLIS74Kk3ENqXuBTaXdt6REECnKPJJ2sxJ3Ej7CKMblwJU%2BfNk0%2FLqvUFMvs8QgCY2kX7ZLydKQ0%2BWdjOafDRDg9%2Bd5E4kHhl5667IUbyYhNX4whLAn12at46qA5Wb8AAAVoSURBVDuVfowIl0QS%2BoQKTUraRb3wBulbsm6%2BJa2jIGTGU69odYUpZCXOJf4v4fgISWD2ukpy0DaML0%2F1eYLSLuqNU5C%2BNVVdJMRcrwzT2sk9IPeCSWQlMTKKsMShbV00gp1KNmu1pDWWdrGpm4xf8cLmnB6h3KDv71SLg3vhSLERZ8YRlkSlsIK8gLQYDxsRpTqcSGLaRR1uHtVEiDnt6VssfX6nWhzcA0ehY8YXo55hHROS9awyu%2FR9BFx1zDWDC5KadhFWSIL0Lc%2FbEmwnH5bQBMhh4IHCTHUNlpJOgLl1mWg2YQkkzJTt1%2BtAuLYuhBLWKMlpF2FCnbqcU8a9gz3qOhBxmDjGTZb5hCWIp4S0kp52EfbNkZr0rZSQlfQPI59hHdPxiTj49WGsPeaaIQUmpF2EHYpUpG8x1qZhZFXsG%2BkYYRW9DfY%2B9FYToXdcUeJPTUm7iCoQpqZvMaOvkHOXR4VbHOWmY4Q1DnkJsAR6XFHST41Ju4gqECambzHznWkjK%2BkfqRthFW%2BKTH7kDiK6tfg9iUcTZzJHGQdT0rdGyarttiixiqvs1BKWBCQzoG8n5hVxDU4lu4SsZCaziZMDK%2Fnd6LXkp2%2FR7YM96guN4pDU9qkmLAlaJq9vJeI7khTAIO1CqSWWrOqL2vlruO0ErWULsUX1SWhNK2a6rZBTd7ZGezy0pu4Z1kTYpQMQUWIeXBZnMluymhjJ6r8H2CUsfUv6aNrJSiKc%2BhFWsZt3DuheZl5d%2FB7HYxpmMjcT98wKdjFLryfCkmbqrVWXz7hhKOcaOyWnFjwsYY1DqyPvLSPCGoohkQdk1a2uNn0m87hwNOc0xulbLFOeGV2WrI50BUtYR7AIztrz3rUOYV2sSCtFM5knhKM5X2OYCSFk5TOuG8659zYHhGRosYRVIk6ZAe8qMO6PBWmNzmTusiOrEoEKsyhGpCVkBcLVhW73gTBdNEFW6h%2B6lwpi0FEIVwNoada7THAdzLk3WLIqFaWQy%2BKTvqUtWZWPrR1hlccGHQPeEsfHehDcCtUiuZTmyYGRAFqD0Ey%2BRelbDM93sHSo203tOm6ThcmOsCogFHQcgqxeOlKhWuiXLFmFDmlNAkfTt7ip852CPkZYbMmqcqgsYVXGB4M97gb2WdaJbxJp0e2FXDrTLiYJRVMvBzFg%2FmIzlErfkj4mfa0Z%2BpKsw%2F4lrDJ6HX0jlzhEj4EwtcomNVezM5lrhizyBpFnQjAO%2BsxXDPW2PRW5MwYosIRVQxAzq0cycOhxIkyvoVlVVWUm86ZuZdIqElX5nYRKUZEWM%2FbD54WF5W2FJOAQBxstYdUYhfY8z3WgN4ZJWnYmc41BaEH10DMhGPs01KXDObI7ltcQT0tYNYBVrCqkpaCfBOH4Ylk9RzuTuR7UWtcmtEwIxj4fqnMoR8%2B2zptkaraEVWfcOvJ8AaA3OoQT6xFhZzLXg1rr2zSaCeEz9gBqgSWr%2BmJpCas%2B3IJWmTyfR9CbQDilRjGaCdfYmcw1ohaT6nWTFmM3Q3UWcrQ9Jq4kzgxLWA2GLNvHc0B6c9WkZScHNoh4PJpL%2BhYx7gOgqrRoF3yVGeylHVXWt9VKIGAJqwQotRYFpOVoedMzs2JbhgfCYjvfpiJKiblYQybELhxS8wZvpucT41xMDbUTR0MIjPxqakfN9X3%2BaVlxjN0%2B80JLVmURStwFmZVO4EWjz6VKmy%2B7cEvfsGRVGp9aS%2B0Iq1bEJqnfPqC7iP1bHNB7pCozXiOiVXuUk9%2FWRb%2BbpLm9nEAEZMPWNvJ7wSwr184K4g7%2BGZi%2BVsi59yTQJWty2hBoX8vvnt%2FP56bN77T7KzHvvJtnpx2HqPz%2F%2F6omxnsqyGCHAAAAAElFTkSuQmCC%22%2F%3E%20%20%3C%2Fdefs%3E%3C%2Fsvg%3E"; + +var _a$3; +var NETWORK_POLLING_INTERVALS = (_a$3 = {}, + _a$3[SupportedChainId.ARBITRUM_ONE] = ms(templateObject_1$$ || (templateObject_1$$ = __makeTemplateObject(["1s"], ["1s"]))), + _a$3[SupportedChainId.ARBITRUM_RINKEBY] = ms(templateObject_2$J || (templateObject_2$J = __makeTemplateObject(["1s"], ["1s"]))), + _a$3[SupportedChainId.OPTIMISM] = ms(templateObject_3$B || (templateObject_3$B = __makeTemplateObject(["1s"], ["1s"]))), + _a$3[SupportedChainId.OPTIMISTIC_KOVAN] = ms(templateObject_4$r || (templateObject_4$r = __makeTemplateObject(["1s"], ["1s"]))), + _a$3); +function getLibrary(provider) { + var library = new Web3Provider(provider, typeof provider.chainId === 'number' + ? provider.chainId + : typeof provider.chainId === 'string' + ? parseInt(provider.chainId) + : 'any'); + library.pollingInterval = 15000; + library.detectNetwork().then(function (network) { + var networkPollingInterval = NETWORK_POLLING_INTERVALS[network.chainId]; + if (networkPollingInterval) { + console.debug('Setting polling interval', networkPollingInterval); + library.pollingInterval = networkPollingInterval; + } + }); + return library; +} +var templateObject_1$$, templateObject_2$J, templateObject_3$B, templateObject_4$r; + +var OVERLAY_READY = 'OVERLAY_READY'; +var CHAIN_ID_NETWORK_ARGUMENT = { + 1: undefined, + 3: 'ropsten', + 4: 'rinkeby', + 42: 'kovan', +}; +var FortmaticConnector = /** @class */ (function (_super) { + __extends(FortmaticConnector, _super); + function FortmaticConnector() { + return _super !== null && _super.apply(this, arguments) || this; + } + FortmaticConnector.prototype.activate = function () { + return __awaiter(this, void 0, void 0, function () { + var Fortmatic, _a, apiKey, chainId, provider, pollForOverlayReady, _b, account; + var _this = this; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + if (!!this.fortmatic) return [3 /*break*/, 2]; + return [4 /*yield*/, Promise.resolve().then(function () { return fortmatic; })]; + case 1: + Fortmatic = (_c.sent()).default; + _a = this, apiKey = _a.apiKey, chainId = _a.chainId; + if (chainId in CHAIN_ID_NETWORK_ARGUMENT) { + this.fortmatic = new Fortmatic(apiKey, CHAIN_ID_NETWORK_ARGUMENT[chainId]); + } + else { + throw new Error("Unsupported network ID: " + chainId); + } + _c.label = 2; + case 2: + provider = this.fortmatic.getProvider(); + pollForOverlayReady = new Promise(function (resolve) { + var interval = setInterval(function () { + if (provider.overlayReady) { + clearInterval(interval); + _this.emit(OVERLAY_READY); + resolve(); + } + }, 200); + }); + return [4 /*yield*/, Promise.all([ + provider.enable().then(function (accounts) { return accounts[0]; }), + pollForOverlayReady, + ])]; + case 3: + _b = __read.apply(void 0, [_c.sent(), 1]), account = _b[0]; + return [2 /*return*/, { provider: this.fortmatic.getProvider(), chainId: this.chainId, account: account }]; + } + }); + }); + }; + return FortmaticConnector; +}(FortmaticConnector$1)); + +var RequestError = /** @class */ (function (_super) { + __extends(RequestError, _super); + function RequestError(message, code, data) { + var _this = _super.call(this, message) || this; + _this.code = code; + _this.data = data; + return _this; + } + return RequestError; +}(Error)); +var MiniRpcProvider = /** @class */ (function () { + function MiniRpcProvider(connector, chainId, url, batchWaitTimeMs) { + var _this = this; + this.isMetaMask = false; + this.nextId = 1; + this.batchTimeoutId = null; + this.batch = []; + this.clearBatch = function () { return __awaiter(_this, void 0, void 0, function () { + var batch, response, json, byKey, json_1, json_1_1, result, _a, resolve, reject, method; + var e_1, _b; + var _this = this; + var _c, _d, _e; + return __generator(this, function (_f) { + switch (_f.label) { + case 0: + console.debug('Clearing batch', this.batch); + batch = this.batch; + batch = batch.filter(function (b) { + if (b.request.method === 'wallet_switchEthereumChain') { + try { + _this.connector.changeChainId(parseInt(b.request.params[0].chainId)); + b.resolve({ id: b.request.id }); + } + catch (error) { + b.reject(error); + } + return false; + } + return true; + }); + this.batch = []; + this.batchTimeoutId = null; + _f.label = 1; + case 1: + _f.trys.push([1, 3, , 4]); + return [4 /*yield*/, fetch(this.url, { + method: 'POST', + headers: { 'content-type': 'application/json', accept: 'application/json' }, + body: JSON.stringify(batch.map(function (item) { return item.request; })), + })]; + case 2: + response = _f.sent(); + return [3 /*break*/, 4]; + case 3: + _f.sent(); + batch.forEach(function (_a) { + var reject = _a.reject; + return reject(new Error('Failed to send batch call')); + }); + return [2 /*return*/]; + case 4: + if (!response.ok) { + batch.forEach(function (_a) { + var reject = _a.reject; + return reject(new RequestError(response.status + ": " + response.statusText, -32000)); + }); + return [2 /*return*/]; + } + _f.label = 5; + case 5: + _f.trys.push([5, 7, , 8]); + return [4 /*yield*/, response.json()]; + case 6: + json = _f.sent(); + return [3 /*break*/, 8]; + case 7: + _f.sent(); + batch.forEach(function (_a) { + var reject = _a.reject; + return reject(new Error('Failed to parse JSON response')); + }); + return [2 /*return*/]; + case 8: + byKey = batch.reduce(function (memo, current) { + memo[current.request.id] = current; + return memo; + }, {}); + try { + for (json_1 = __values(json), json_1_1 = json_1.next(); !json_1_1.done; json_1_1 = json_1.next()) { + result = json_1_1.value; + _a = byKey[result.id], resolve = _a.resolve, reject = _a.reject, method = _a.request.method; + if ('error' in result) { + reject(new RequestError((_c = result === null || result === void 0 ? void 0 : result.error) === null || _c === void 0 ? void 0 : _c.message, (_d = result === null || result === void 0 ? void 0 : result.error) === null || _d === void 0 ? void 0 : _d.code, (_e = result === null || result === void 0 ? void 0 : result.error) === null || _e === void 0 ? void 0 : _e.data)); + } + else if ('result' in result && resolve) { + resolve(result.result); + } + else { + reject(new RequestError("Received unexpected JSON-RPC response to " + method + " request.", -32000, result)); + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (json_1_1 && !json_1_1.done && (_b = json_1.return)) _b.call(json_1); + } + finally { if (e_1) throw e_1.error; } + } + return [2 /*return*/]; + } + }); + }); }; + this.sendAsync = function (request, callback) { + _this.request(request.method, request.params) + .then(function (result) { return callback(null, { jsonrpc: '2.0', id: request.id, result: result }); }) + .catch(function (error) { return callback(error, null); }); + }; + this.request = function (method, params) { return __awaiter(_this, void 0, void 0, function () { + var promise; + var _this = this; + var _a; + return __generator(this, function (_b) { + if (typeof method !== 'string') { + return [2 /*return*/, this.request(method.method, method.params)]; + } + if (method === 'eth_chainId') { + return [2 /*return*/, "0x" + this.chainId.toString(16)]; + } + promise = new Promise(function (resolve, reject) { + _this.batch.push({ + request: { + jsonrpc: '2.0', + id: _this.nextId++, + method: method, + params: params, + }, + resolve: resolve, + reject: reject, + }); + }); + this.batchTimeoutId = (_a = this.batchTimeoutId) !== null && _a !== void 0 ? _a : setTimeout(this.clearBatch, this.batchWaitTimeMs); + return [2 /*return*/, promise]; + }); + }); }; + this.connector = connector; + this.chainId = chainId; + this.url = url; + var parsed = new URL(url); + this.host = parsed.host; + this.path = parsed.pathname; + // how long to wait to batch calls + this.batchWaitTimeMs = batchWaitTimeMs !== null && batchWaitTimeMs !== void 0 ? batchWaitTimeMs : 50; + } + return MiniRpcProvider; +}()); +var NetworkConnector = /** @class */ (function (_super) { + __extends(NetworkConnector, _super); + function NetworkConnector(_a) { + var urls = _a.urls, defaultChainId = _a.defaultChainId; + var _this = this; + invariant(defaultChainId || Object.keys(urls).length === 1, 'defaultChainId is a required argument with >1 url'); + _this = _super.call(this, { supportedChainIds: Object.keys(urls).map(function (k) { return Number(k); }) }) || this; + _this.currentChainId = defaultChainId !== null && defaultChainId !== void 0 ? defaultChainId : Number(Object.keys(urls)[0]); + _this.providers = Object.keys(urls).reduce(function (accumulator, chainId) { + accumulator[Number(chainId)] = new MiniRpcProvider(_this, Number(chainId), urls[Number(chainId)]); + return accumulator; + }, {}); + return _this; + } + Object.defineProperty(NetworkConnector.prototype, "provider", { + get: function () { + return this.providers[this.currentChainId]; + }, + enumerable: false, + configurable: true + }); + NetworkConnector.prototype.activate = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, { provider: this.providers[this.currentChainId], chainId: this.currentChainId, account: null }]; + }); + }); + }; + NetworkConnector.prototype.getProvider = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.providers[this.currentChainId]]; + }); + }); + }; + NetworkConnector.prototype.getChainId = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.currentChainId]; + }); + }); + }; + NetworkConnector.prototype.getAccount = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, null]; + }); + }); + }; + NetworkConnector.prototype.deactivate = function () { + return; + }; + /** + * Meant to be called only by MiniRpcProvider + * @param chainId the new chain id + */ + NetworkConnector.prototype.changeChainId = function (chainId) { + if (chainId in this.providers) { + this.currentChainId = chainId; + this.emitUpdate({ + chainId: chainId, + account: null, + provider: this.providers[chainId], + }); + } + else { + throw new Error("Unsupported chain ID: " + chainId); + } + }; + return NetworkConnector; +}(AbstractConnector)); + +var FORMATIC_KEY = process.env.REACT_APP_FORTMATIC_KEY; +var PORTIS_ID = process.env.REACT_APP_PORTIS_ID; +var network = new NetworkConnector({ + urls: INFURA_NETWORK_URLS, + defaultChainId: 1, +}); +var networkLibrary; +function getNetworkLibrary() { + return (networkLibrary = networkLibrary !== null && networkLibrary !== void 0 ? networkLibrary : getLibrary(network.provider)); +} +var injected = new InjectedConnector({ + supportedChainIds: ALL_SUPPORTED_CHAIN_IDS, +}); +var gnosisSafe = new SafeAppConnector(); +var walletconnect = new WalletConnectConnector({ + supportedChainIds: ALL_SUPPORTED_CHAIN_IDS, + rpc: INFURA_NETWORK_URLS, + qrcode: true, +}); +// mainnet only +var fortmatic$1 = new FortmaticConnector({ + apiKey: FORMATIC_KEY !== null && FORMATIC_KEY !== void 0 ? FORMATIC_KEY : '', + chainId: 1, +}); +// mainnet only +var portis = new PortisConnector({ + dAppId: PORTIS_ID !== null && PORTIS_ID !== void 0 ? PORTIS_ID : '', + networks: [1], +}); +var walletlink = new WalletLinkConnector({ + url: INFURA_NETWORK_URLS[SupportedChainId.MAINNET], + appName: 'Uniswap', + appLogoUrl: UNISWAP_LOGO_URL, + supportedChainIds: [SupportedChainId.MAINNET, SupportedChainId.POLYGON], +}); + +/** + * Returns the ENS avatar URI, if available. + * Spec: https://gist.github.com/Arachnid/9db60bd75277969ee1689c8742b75182. + */ +function useENSAvatar(address, enforceOwnership) { + if (enforceOwnership === void 0) { enforceOwnership = true; } + var debouncedAddress = useDebounce(address, 200); + var node = useMemo(function () { + if (!debouncedAddress || !isAddress(debouncedAddress)) + return undefined; + return namehash(debouncedAddress.toLowerCase().substr(2) + ".addr.reverse"); + }, [debouncedAddress]); + var addressAvatar = useAvatarFromNode(node); + var ENSName = useENSName(address).ENSName; + var nameAvatar = useAvatarFromNode(ENSName === null ? undefined : safeNamehash(ENSName)); + var avatar = addressAvatar.avatar || nameAvatar.avatar; + var nftAvatar = useAvatarFromNFT(avatar, enforceOwnership); + avatar = nftAvatar.avatar || avatar; + var http = avatar && uriToHttp(avatar)[0]; + var changed = debouncedAddress !== address; + return useMemo(function () { return ({ + avatar: changed ? null : http !== null && http !== void 0 ? http : null, + loading: changed || addressAvatar.loading || nameAvatar.loading || nftAvatar.loading, + }); }, [addressAvatar.loading, changed, http, nameAvatar.loading, nftAvatar.loading]); +} +function useAvatarFromNode(node) { + var _a; + var nodeArgument = useMemo(function () { return [node]; }, [node]); + var textArgument = useMemo(function () { return [node, 'avatar']; }, [node]); + var registrarContract = useENSRegistrarContract(false); + var resolverAddress = useSingleCallResult(registrarContract, 'resolver', nodeArgument); + var resolverAddressResult = (_a = resolverAddress.result) === null || _a === void 0 ? void 0 : _a[0]; + var resolverContract = useENSResolverContract(resolverAddressResult && !isZero(resolverAddressResult) ? resolverAddressResult : undefined, false); + var avatar = useSingleCallResult(resolverContract, 'text', textArgument); + return useMemo(function () { + var _a; + return ({ + avatar: (_a = avatar.result) === null || _a === void 0 ? void 0 : _a[0], + loading: resolverAddress.loading || avatar.loading, + }); + }, [avatar.loading, avatar.result, resolverAddress.loading]); +} +function useAvatarFromNFT(nftUri, enforceOwnership) { + var _a, _b, _c, _d; + if (nftUri === void 0) { nftUri = ''; } + var parts = nftUri.toLowerCase().split(':'); + var protocol = parts[0]; + // ignore the chain from eip155 + // TODO: when we are able, pull only from the specified chain + var _e = __read((_b = (_a = parts[1]) === null || _a === void 0 ? void 0 : _a.split('/')) !== null && _b !== void 0 ? _b : [], 2), erc = _e[1]; + var _f = __read((_d = (_c = parts[2]) === null || _c === void 0 ? void 0 : _c.split('/')) !== null && _d !== void 0 ? _d : [], 2), contractAddress = _f[0], id = _f[1]; + var isERC721 = protocol === 'eip155' && erc === 'erc721'; + var isERC1155 = protocol === 'eip155' && erc === 'erc1155'; + var erc721 = useERC721Uri(isERC721 ? contractAddress : undefined, id, enforceOwnership); + var erc1155 = useERC1155Uri(isERC1155 ? contractAddress : undefined, id, enforceOwnership); + var uri = erc721.uri || erc1155.uri; + var http = uri && uriToHttp(uri)[0]; + var _g = __read(useState(false), 2), loading = _g[0], setLoading = _g[1]; + var _h = __read(useState(undefined), 2), avatar = _h[0], setAvatar = _h[1]; + useEffect(function () { + setAvatar(undefined); + if (http) { + setLoading(true); + fetch(http) + .then(function (res) { return res.json(); }) + .then(function (_a) { + var image = _a.image; + setAvatar(image); + }) + .catch(function (e) { return console.warn(e); }) + .finally(function () { + setLoading(false); + }); + } + }, [http]); + return useMemo(function () { return ({ avatar: avatar, loading: erc721.loading || erc1155.loading || loading }); }, [avatar, erc1155.loading, erc721.loading, loading]); +} +function useERC721Uri(contractAddress, id, enforceOwnership) { + var idArgument = useMemo(function () { return [id]; }, [id]); + var account = useActiveWeb3React().account; + var contract = useERC721Contract(contractAddress); + var owner = useSingleCallResult(contract, 'ownerOf', idArgument); + var uri = useSingleCallResult(contract, 'tokenURI', idArgument); + return useMemo(function () { + var _a, _b; + return ({ + uri: !enforceOwnership || account === ((_a = owner.result) === null || _a === void 0 ? void 0 : _a[0]) ? (_b = uri.result) === null || _b === void 0 ? void 0 : _b[0] : undefined, + loading: owner.loading || uri.loading, + }); + }, [account, enforceOwnership, owner.loading, owner.result, uri.loading, uri.result]); +} +function useERC1155Uri(contractAddress, id, enforceOwnership) { + var account = useActiveWeb3React().account; + var idArgument = useMemo(function () { return [id]; }, [id]); + var accountArgument = useMemo(function () { return [account || '', id]; }, [account, id]); + var contract = useERC1155Contract(contractAddress); + var balance = useSingleCallResult(contract, 'balanceOf', accountArgument); + var uri = useSingleCallResult(contract, 'uri', idArgument); + // ERC-1155 allows a generic {id} in the URL, so prepare to replace if relevant, + // in lowercase hexadecimal (with no 0x prefix) and leading zero padded to 64 hex characters. + var idHex = id ? hexZeroPad(BigNumber.from(id).toHexString(), 32).substring(2) : id; + return useMemo(function () { + var _a, _b, _c; + return ({ + uri: !enforceOwnership || ((_a = balance.result) === null || _a === void 0 ? void 0 : _a[0]) > 0 ? (_c = (_b = uri.result) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.replaceAll('{id}', idHex) : undefined, + loading: balance.loading || uri.loading, + }); + }, [balance.loading, balance.result, enforceOwnership, uri.loading, uri.result, idHex]); +} + +var StyledIdenticon = styled.div(templateObject_1$_ || (templateObject_1$_ = __makeTemplateObject(["\n height: 1rem;\n width: 1rem;\n border-radius: 1.125rem;\n background-color: ", ";\n font-size: initial;\n"], ["\n height: 1rem;\n width: 1rem;\n border-radius: 1.125rem;\n background-color: ", ";\n font-size: initial;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg4; +}); +var StyledAvatar = styled.img(templateObject_2$I || (templateObject_2$I = __makeTemplateObject(["\n height: inherit;\n width: inherit;\n border-radius: inherit;\n"], ["\n height: inherit;\n width: inherit;\n border-radius: inherit;\n"]))); +function Identicon() { + var account = useActiveWeb3React().account; + var avatar = useENSAvatar(account !== null && account !== void 0 ? account : undefined).avatar; + var _a = __read(useState(true), 2), fetchable = _a[0], setFetchable = _a[1]; + var icon = useMemo(function () { return account && jazzicon(16, parseInt(account.slice(2, 10), 16)); }, [account]); + var iconRef = useRef(null); + useLayoutEffect(function () { + var current = iconRef.current; + if (icon) { + current === null || current === void 0 ? void 0 : current.appendChild(icon); + return function () { + try { + current === null || current === void 0 ? void 0 : current.removeChild(icon); + } + catch (e) { + console.error('Avatar icon not found'); + } + }; + } + return; + }, [icon, iconRef]); + return (jsx(StyledIdenticon, { children: avatar && fetchable ? (jsx(StyledAvatar, { alt: "avatar", src: avatar, onError: function () { return setFetchable(false); } }, void 0)) : (jsx("span", { ref: iconRef }, void 0)) }, void 0)); +} +var templateObject_1$_, templateObject_2$I; + +function StatusIcon(_a) { + var connector = _a.connector; + switch (connector) { + case injected: + return jsx(Identicon, {}, void 0); + case walletconnect: + return jsx("img", { src: WALLETCONNECT_ICON_URL, alt: 'WalletConnect' }, void 0); + case walletlink: + return jsx("img", { src: COINBASE_ICON_URL, alt: 'Coinbase Wallet' }, void 0); + case fortmatic$1: + return jsx("img", { src: FORTMATIC_ICON_URL, alt: 'Fortmatic' }, void 0); + case portis: + return jsx("img", { src: PORTIS_ICON_URL, alt: 'Portis' }, void 0); + default: + return null; + } +} + +var MetaMaskLogo = "f89237c6bc3f84db.png"; + +var _line$2, _line2$1; + +function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); } + +const SvgX = props => /*#__PURE__*/React.createElement("svg", _extends$5({ + xmlns: "http://www.w3.org/2000/svg", + width: 20, + height: 20, + viewBox: "0 0 20 20", + fill: "none", + stroke: "currentColor", + strokeWidth: 2, + strokeLinecap: "round", + strokeLinejoin: "round", + className: "feather feather-x" +}, props), _line$2 || (_line$2 = /*#__PURE__*/React.createElement("line", { + x1: 18, + y1: 6, + x2: 6, + y2: 18 +})), _line2$1 || (_line2$1 = /*#__PURE__*/React.createElement("line", { + x1: 6, + y1: 6, + x2: 18, + y2: 18 +}))); + +var INJECTED_ICON_URL = "data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9.79261%2016.1108L17.5398%208.36364L9.79261%200.616477L8.25852%202.15057L13.3807%207.25568H0V9.47159H13.3807L8.25852%2014.5852L9.79261%2016.1108Z%22%20fill%3D%22%23333639%22%2F%3E%3C%2Fsvg%3E"; + +var SUPPORTED_WALLETS = { + INJECTED: { + connector: injected, + name: 'Injected', + iconURL: INJECTED_ICON_URL, + description: 'Injected web3 provider.', + href: null, + color: '#010101', + primary: true, + }, + METAMASK: { + connector: injected, + name: 'MetaMask', + iconURL: MetaMaskLogo, + description: 'Easy-to-use browser extension.', + href: null, + color: '#E8831D', + }, + WALLET_CONNECT: { + connector: walletconnect, + name: 'WalletConnect', + iconURL: WALLETCONNECT_ICON_URL, + description: 'Connect to Trust Wallet, Rainbow Wallet and more...', + href: null, + color: '#4196FC', + mobile: true, + }, + WALLET_LINK: { + connector: walletlink, + name: 'Coinbase Wallet', + iconURL: COINBASE_ICON_URL, + description: 'Use Coinbase Wallet app on mobile device', + href: null, + color: '#315CF5', + }, + COINBASE_LINK: { + name: 'Open in Coinbase Wallet', + iconURL: COINBASE_ICON_URL, + description: 'Open in Coinbase Wallet app.', + href: 'https://go.cb-w.com/mtUDhEZPy1', + color: '#315CF5', + mobile: true, + mobileOnly: true, + }, + FORTMATIC: { + connector: fortmatic$1, + name: 'Fortmatic', + iconURL: FORTMATIC_ICON_URL, + description: 'Login using Fortmatic hosted wallet', + href: null, + color: '#6748FF', + mobile: true, + }, + Portis: { + connector: portis, + name: 'Portis', + iconURL: PORTIS_ICON_URL, + description: 'Login using Portis hosted wallet', + href: null, + color: '#4A6C9B', + mobile: true, + }, +}; + +// modified from https://usehooks.com/usePrevious/ +function usePrevious(value) { + // The ref object is a generic container whose current property is mutable ... + // ... and can hold any value, similar to an instance property on a class + var ref = useRef(); + // Store current value in ref + useEffect(function () { + ref.current = value; + }, [value]); // Only re-run if value changes + // Return previous value (happens before update in useEffect above) + return ref.current; +} + +function useCopyClipboard(timeout) { + if (timeout === void 0) { timeout = 500; } + var _a = __read(useState(false), 2), isCopied = _a[0], setIsCopied = _a[1]; + var staticCopy = useCallback(function (text) { + var didCopy = copy(text); + setIsCopied(didCopy); + }, []); + useEffect(function () { + if (isCopied) { + var hide_1 = setTimeout(function () { + setIsCopied(false); + }, timeout); + return function () { + clearTimeout(hide_1); + }; + } + return undefined; + }, [isCopied, setIsCopied, timeout]); + return [isCopied, staticCopy]; +} + +var CopyIcon = styled(LinkStyledButton)(templateObject_1$Z || (templateObject_1$Z = __makeTemplateObject(["\n color: ", ";\n flex-shrink: 0;\n display: flex;\n text-decoration: none;\n font-size: 0.825rem;\n :hover,\n :active,\n :focus {\n text-decoration: none;\n color: ", ";\n }\n"], ["\n color: ", ";\n flex-shrink: 0;\n display: flex;\n text-decoration: none;\n font-size: 0.825rem;\n :hover,\n :active,\n :focus {\n text-decoration: none;\n color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var TransactionStatusText$1 = styled.span(templateObject_2$H || (templateObject_2$H = __makeTemplateObject(["\n margin-left: 0.25rem;\n font-size: 0.825rem;\n ", ";\n align-items: center;\n"], ["\n margin-left: 0.25rem;\n font-size: 0.825rem;\n ", ";\n align-items: center;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}); +function CopyHelper(props) { + var _a = __read(useCopyClipboard(), 2), isCopied = _a[0], setCopied = _a[1]; + return (jsxs(CopyIcon, __assign({ onClick: function () { return setCopied(props.toCopy); } }, { children: [isCopied ? (jsxs(TransactionStatusText$1, { children: [jsx(CheckCircle, { size: '16' }, void 0), jsx(TransactionStatusText$1, { children: jsx(Trans, { children: "Copied" }, void 0) }, void 0)] }, void 0)) : (jsx(TransactionStatusText$1, { children: jsx(Copy$1, { size: '16' }, void 0) }, void 0)), isCopied ? '' : props.children] }), void 0)); +} +var templateObject_1$Z, templateObject_2$H; + +var VoteOption; +(function (VoteOption) { + VoteOption[VoteOption["Against"] = 0] = "Against"; + VoteOption[VoteOption["For"] = 1] = "For"; + VoteOption[VoteOption["Abstain"] = 2] = "Abstain"; +})(VoteOption || (VoteOption = {})); + +function formatAmount(amountRaw, decimals, sigFigs) { + return new Fraction(amountRaw, JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(decimals))).toSignificant(sigFigs); +} +function FormattedCurrencyAmount(_a) { + var rawAmount = _a.rawAmount, symbol = _a.symbol, decimals = _a.decimals, sigFigs = _a.sigFigs; + return (jsxs(Fragment, { children: [formatAmount(rawAmount, decimals, sigFigs), " ", symbol] }, void 0)); +} +function FormattedCurrencyAmountManaged(_a) { + var _b; + var rawAmount = _a.rawAmount, currencyId = _a.currencyId, _c = _a.sigFigs, sigFigs = _c === void 0 ? 6 : _c; + var currency = useCurrency(currencyId); + return currency ? (jsx(FormattedCurrencyAmount, { rawAmount: rawAmount, decimals: currency.decimals, sigFigs: sigFigs, symbol: (_b = currency.symbol) !== null && _b !== void 0 ? _b : '???' }, void 0)) : null; +} +function ClaimSummary(_a) { + var _b = _a.info, recipient = _b.recipient, uniAmountRaw = _b.uniAmountRaw; + var ENSName = useENSName().ENSName; + return typeof uniAmountRaw === 'string' ? (jsxs(Trans, { children: ["Claim ", jsx(FormattedCurrencyAmount, { rawAmount: uniAmountRaw, symbol: 'UNI', decimals: 18, sigFigs: 4 }, void 0), " for", ' ', ENSName !== null && ENSName !== void 0 ? ENSName : recipient] }, void 0)) : (jsxs(Trans, { children: ["Claim UNI reward for ", ENSName !== null && ENSName !== void 0 ? ENSName : recipient] }, void 0)); +} +function SubmitProposalTransactionSummary(_) { + return jsx(Trans, { children: "Submit new proposal" }, void 0); +} +function ApprovalSummary(_a) { + var info = _a.info; + var token = useToken(info.tokenAddress); + return jsxs(Trans, { children: ["Approve ", token === null || token === void 0 ? void 0 : token.symbol] }, void 0); +} +function VoteSummary(_a) { + var info = _a.info; + var proposalKey = info.governorAddress + "/" + info.proposalId; + if (info.reason && info.reason.trim().length > 0) { + switch (info.decision) { + case VoteOption.For: + return jsxs(Trans, { children: ["Vote for proposal ", proposalKey] }, void 0); + case VoteOption.Abstain: + return jsxs(Trans, { children: ["Vote to abstain on proposal ", proposalKey] }, void 0); + case VoteOption.Against: + return jsxs(Trans, { children: ["Vote against proposal ", proposalKey] }, void 0); + } + } + else { + switch (info.decision) { + case VoteOption.For: + return (jsxs(Trans, { children: ["Vote for proposal ", proposalKey, " with reason \"", info.reason, "\""] }, void 0)); + case VoteOption.Abstain: + return (jsxs(Trans, { children: ["Vote to abstain on proposal ", proposalKey, " with reason \"", info.reason, "\""] }, void 0)); + case VoteOption.Against: + return (jsxs(Trans, { children: ["Vote against proposal ", proposalKey, " with reason \"", info.reason, "\""] }, void 0)); + } + } +} +function DelegateSummary(_a) { + var delegatee = _a.info.delegatee; + var ENSName = useENSName(delegatee).ENSName; + return jsxs(Trans, { children: ["Delegate voting power to ", ENSName !== null && ENSName !== void 0 ? ENSName : delegatee] }, void 0); +} +function WrapSummary(_a) { + var _b, _c, _d, _e, _f, _g; + var _h = _a.info, chainId = _h.chainId, currencyAmountRaw = _h.currencyAmountRaw, unwrapped = _h.unwrapped; + var native = chainId ? nativeOnChain(chainId) : undefined; + if (unwrapped) { + return (jsxs(Trans, { children: ["Unwrap", ' ', jsx(FormattedCurrencyAmount, { rawAmount: currencyAmountRaw, symbol: (_c = (_b = native === null || native === void 0 ? void 0 : native.wrapped) === null || _b === void 0 ? void 0 : _b.symbol) !== null && _c !== void 0 ? _c : 'WETH', decimals: 18, sigFigs: 6 }, void 0), ' ', "to ", (_d = native === null || native === void 0 ? void 0 : native.symbol) !== null && _d !== void 0 ? _d : 'ETH'] }, void 0)); + } + else { + return (jsxs(Trans, { children: ["Wrap", ' ', jsx(FormattedCurrencyAmount, { rawAmount: currencyAmountRaw, symbol: (_e = native === null || native === void 0 ? void 0 : native.symbol) !== null && _e !== void 0 ? _e : 'ETH', decimals: 18, sigFigs: 6 }, void 0), ' ', "to ", (_g = (_f = native === null || native === void 0 ? void 0 : native.wrapped) === null || _f === void 0 ? void 0 : _f.symbol) !== null && _g !== void 0 ? _g : 'WETH'] }, void 0)); + } +} +function DepositLiquidityStakingSummary(_) { + // not worth rendering the tokens since you can should no longer deposit liquidity in the staking contracts + // todo: deprecate and delete the code paths that allow this, show user more information + return jsx(Trans, { children: "Deposit liquidity" }, void 0); +} +function WithdrawLiquidityStakingSummary(_) { + return jsx(Trans, { children: "Withdraw deposited liquidity" }, void 0); +} +function MigrateLiquidityToV3Summary(_a) { + var _b = _a.info, baseCurrencyId = _b.baseCurrencyId, quoteCurrencyId = _b.quoteCurrencyId; + var baseCurrency = useCurrency(baseCurrencyId); + var quoteCurrency = useCurrency(quoteCurrencyId); + return (jsxs(Trans, { children: ["Migrate ", baseCurrency === null || baseCurrency === void 0 ? void 0 : baseCurrency.symbol, "/", quoteCurrency === null || quoteCurrency === void 0 ? void 0 : quoteCurrency.symbol, " liquidity to V3"] }, void 0)); +} +function CreateV3PoolSummary(_a) { + var _b = _a.info, quoteCurrencyId = _b.quoteCurrencyId, baseCurrencyId = _b.baseCurrencyId; + var baseCurrency = useCurrency(baseCurrencyId); + var quoteCurrency = useCurrency(quoteCurrencyId); + return (jsxs(Trans, { children: ["Create ", baseCurrency === null || baseCurrency === void 0 ? void 0 : baseCurrency.symbol, "/", quoteCurrency === null || quoteCurrency === void 0 ? void 0 : quoteCurrency.symbol, " V3 pool"] }, void 0)); +} +function CollectFeesSummary(_a) { + var _b = _a.info, currencyId0 = _b.currencyId0, currencyId1 = _b.currencyId1; + var currency0 = useCurrency(currencyId0); + var currency1 = useCurrency(currencyId1); + return (jsxs(Trans, { children: ["Collect ", currency0 === null || currency0 === void 0 ? void 0 : currency0.symbol, "/", currency1 === null || currency1 === void 0 ? void 0 : currency1.symbol, " fees"] }, void 0)); +} +function RemoveLiquidityV3Summary(_a) { + var _b = _a.info, baseCurrencyId = _b.baseCurrencyId, quoteCurrencyId = _b.quoteCurrencyId, expectedAmountBaseRaw = _b.expectedAmountBaseRaw, expectedAmountQuoteRaw = _b.expectedAmountQuoteRaw; + return (jsxs(Trans, { children: ["Remove", ' ', jsx(FormattedCurrencyAmountManaged, { rawAmount: expectedAmountBaseRaw, currencyId: baseCurrencyId, sigFigs: 3 }, void 0), " and", ' ', jsx(FormattedCurrencyAmountManaged, { rawAmount: expectedAmountQuoteRaw, currencyId: quoteCurrencyId, sigFigs: 3 }, void 0)] }, void 0)); +} +function AddLiquidityV3PoolSummary(_a) { + var _b = _a.info, createPool = _b.createPool, quoteCurrencyId = _b.quoteCurrencyId, baseCurrencyId = _b.baseCurrencyId; + var baseCurrency = useCurrency(baseCurrencyId); + var quoteCurrency = useCurrency(quoteCurrencyId); + return createPool ? (jsxs(Trans, { children: ["Create pool and add ", baseCurrency === null || baseCurrency === void 0 ? void 0 : baseCurrency.symbol, "/", quoteCurrency === null || quoteCurrency === void 0 ? void 0 : quoteCurrency.symbol, " V3 liquidity"] }, void 0)) : (jsxs(Trans, { children: ["Add ", baseCurrency === null || baseCurrency === void 0 ? void 0 : baseCurrency.symbol, "/", quoteCurrency === null || quoteCurrency === void 0 ? void 0 : quoteCurrency.symbol, " V3 liquidity"] }, void 0)); +} +function AddLiquidityV2PoolSummary(_a) { + var _b = _a.info, quoteCurrencyId = _b.quoteCurrencyId, expectedAmountBaseRaw = _b.expectedAmountBaseRaw, expectedAmountQuoteRaw = _b.expectedAmountQuoteRaw, baseCurrencyId = _b.baseCurrencyId; + return (jsxs(Trans, { children: ["Add ", jsx(FormattedCurrencyAmountManaged, { rawAmount: expectedAmountBaseRaw, currencyId: baseCurrencyId, sigFigs: 3 }, void 0), ' ', "and ", jsx(FormattedCurrencyAmountManaged, { rawAmount: expectedAmountQuoteRaw, currencyId: quoteCurrencyId, sigFigs: 3 }, void 0), ' ', "to Uniswap V2"] }, void 0)); +} +function SwapSummary(_a) { + var info = _a.info; + if (info.tradeType === TradeType.EXACT_INPUT) { + return (jsxs(Trans, { children: ["Swap exactly", ' ', jsx(FormattedCurrencyAmountManaged, { rawAmount: info.inputCurrencyAmountRaw, currencyId: info.inputCurrencyId, sigFigs: 6 }, void 0), ' ', "for", ' ', jsx(FormattedCurrencyAmountManaged, { rawAmount: info.expectedOutputCurrencyAmountRaw, currencyId: info.outputCurrencyId, sigFigs: 6 }, void 0)] }, void 0)); + } + else { + return (jsxs(Trans, { children: ["Swap", ' ', jsx(FormattedCurrencyAmountManaged, { rawAmount: info.expectedInputCurrencyAmountRaw, currencyId: info.inputCurrencyId, sigFigs: 6 }, void 0), ' ', "for exactly", ' ', jsx(FormattedCurrencyAmountManaged, { rawAmount: info.outputCurrencyAmountRaw, currencyId: info.outputCurrencyId, sigFigs: 6 }, void 0)] }, void 0)); + } +} +function TransactionSummary(_a) { + var info = _a.info; + switch (info.type) { + case TransactionType.ADD_LIQUIDITY_V3_POOL: + return jsx(AddLiquidityV3PoolSummary, { info: info }, void 0); + case TransactionType.ADD_LIQUIDITY_V2_POOL: + return jsx(AddLiquidityV2PoolSummary, { info: info }, void 0); + case TransactionType.CLAIM: + return jsx(ClaimSummary, { info: info }, void 0); + case TransactionType.DEPOSIT_LIQUIDITY_STAKING: + return jsx(DepositLiquidityStakingSummary, { info: info }, void 0); + case TransactionType.WITHDRAW_LIQUIDITY_STAKING: + return jsx(WithdrawLiquidityStakingSummary, { info: info }, void 0); + case TransactionType.SWAP: + return jsx(SwapSummary, { info: info }, void 0); + case TransactionType.APPROVAL: + return jsx(ApprovalSummary, { info: info }, void 0); + case TransactionType.VOTE: + return jsx(VoteSummary, { info: info }, void 0); + case TransactionType.DELEGATE: + return jsx(DelegateSummary, { info: info }, void 0); + case TransactionType.WRAP: + return jsx(WrapSummary, { info: info }, void 0); + case TransactionType.CREATE_V3_POOL: + return jsx(CreateV3PoolSummary, { info: info }, void 0); + case TransactionType.MIGRATE_LIQUIDITY_V3: + return jsx(MigrateLiquidityToV3Summary, { info: info }, void 0); + case TransactionType.COLLECT_FEES: + return jsx(CollectFeesSummary, { info: info }, void 0); + case TransactionType.REMOVE_LIQUIDITY_V3: + return jsx(RemoveLiquidityV3Summary, { info: info }, void 0); + case TransactionType.SUBMIT_PROPOSAL: + return jsx(SubmitProposalTransactionSummary, { info: info }, void 0); + } +} + +var TransactionStatusText = styled.div(templateObject_1$Y || (templateObject_1$Y = __makeTemplateObject(["\n margin-right: 0.5rem;\n display: flex;\n align-items: center;\n :hover {\n text-decoration: underline;\n }\n"], ["\n margin-right: 0.5rem;\n display: flex;\n align-items: center;\n :hover {\n text-decoration: underline;\n }\n"]))); +var TransactionState = styled(ExternalLink)(templateObject_2$G || (templateObject_2$G = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n text-decoration: none !important;\n border-radius: 0.5rem;\n padding: 0.25rem 0rem;\n font-weight: 500;\n font-size: 0.825rem;\n color: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n text-decoration: none !important;\n border-radius: 0.5rem;\n padding: 0.25rem 0rem;\n font-weight: 500;\n font-size: 0.825rem;\n color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.primary1; +}); +var IconWrapper$3 = styled.div(templateObject_3$A || (templateObject_3$A = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), function (_a) { + var pending = _a.pending, success = _a.success, theme = _a.theme; + return (pending ? theme.primary1 : success ? theme.green1 : theme.red1); +}); +function Transaction(_a) { + var _b, _c; + var hash = _a.hash; + var chainId = useActiveWeb3React().chainId; + var allTransactions = useAllTransactions(); + var tx = allTransactions === null || allTransactions === void 0 ? void 0 : allTransactions[hash]; + var info = tx === null || tx === void 0 ? void 0 : tx.info; + var pending = !(tx === null || tx === void 0 ? void 0 : tx.receipt); + var success = !pending && tx && (((_b = tx.receipt) === null || _b === void 0 ? void 0 : _b.status) === 1 || typeof ((_c = tx.receipt) === null || _c === void 0 ? void 0 : _c.status) === 'undefined'); + if (!chainId) + return null; + return (jsx("div", { children: jsxs(TransactionState, __assign({ href: getExplorerLink(chainId, hash, ExplorerDataType.TRANSACTION), pending: pending, success: success }, { children: [jsx(RowFixed, { children: jsxs(TransactionStatusText, { children: [jsx(TransactionSummary, { info: info }, void 0), " \u2197"] }, void 0) }, void 0), jsx(IconWrapper$3, __assign({ pending: pending, success: success }, { children: pending ? jsx(Loader, {}, void 0) : success ? jsx(CheckCircle, { size: "16" }, void 0) : jsx(Triangle, { size: "16" }, void 0) }), void 0)] }), void 0) }, void 0)); +} +var templateObject_1$Y, templateObject_2$G, templateObject_3$A; + +var HeaderRow$1 = styled.div(templateObject_2$F || (templateObject_2$F = __makeTemplateObject(["\n ", ";\n padding: 1rem 1rem;\n font-weight: 500;\n color: ", ";\n ", ";\n"], ["\n ", ";\n padding: 1rem 1rem;\n font-weight: 500;\n color: ", ";\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (props) { return (props.color === 'blue' ? function (_a) { + var theme = _a.theme; + return theme.primary1; +} : 'inherit'); }, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_1$X || (templateObject_1$X = __makeTemplateObject(["\n padding: 1rem;\n "], ["\n padding: 1rem;\n "]))); +}); +var UpperSection$1 = styled.div(templateObject_3$z || (templateObject_3$z = __makeTemplateObject(["\n position: relative;\n\n h5 {\n margin: 0;\n margin-bottom: 0.5rem;\n font-size: 1rem;\n font-weight: 400;\n }\n\n h5:last-child {\n margin-bottom: 0px;\n }\n\n h4 {\n margin-top: 0;\n font-weight: 500;\n }\n"], ["\n position: relative;\n\n h5 {\n margin: 0;\n margin-bottom: 0.5rem;\n font-size: 1rem;\n font-weight: 400;\n }\n\n h5:last-child {\n margin-bottom: 0px;\n }\n\n h4 {\n margin-top: 0;\n font-weight: 500;\n }\n"]))); +var InfoCard$1 = styled.div(templateObject_4$q || (templateObject_4$q = __makeTemplateObject(["\n padding: 1rem;\n border: 1px solid ", ";\n border-radius: 20px;\n position: relative;\n display: grid;\n grid-row-gap: 12px;\n margin-bottom: 20px;\n"], ["\n padding: 1rem;\n border: 1px solid ", ";\n border-radius: 20px;\n position: relative;\n display: grid;\n grid-row-gap: 12px;\n margin-bottom: 20px;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var AccountGroupingRow = styled.div(templateObject_5$m || (templateObject_5$m = __makeTemplateObject(["\n ", ";\n justify-content: space-between;\n align-items: center;\n font-weight: 400;\n color: ", ";\n\n div {\n ", "\n align-items: center;\n }\n"], ["\n ", ";\n justify-content: space-between;\n align-items: center;\n font-weight: 400;\n color: ", ";\n\n div {\n ", "\n align-items: center;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}); +var AccountSection = styled.div(templateObject_7$e || (templateObject_7$e = __makeTemplateObject(["\n padding: 0rem 1rem;\n ", ";\n"], ["\n padding: 0rem 1rem;\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_6$h || (templateObject_6$h = __makeTemplateObject(["padding: 0rem 1rem 1.5rem 1rem;"], ["padding: 0rem 1rem 1.5rem 1rem;"]))); +}); +var YourAccount = styled.div(templateObject_8$c || (templateObject_8$c = __makeTemplateObject(["\n h5 {\n margin: 0 0 1rem 0;\n font-weight: 400;\n }\n\n h4 {\n margin: 0;\n font-weight: 500;\n }\n"], ["\n h5 {\n margin: 0 0 1rem 0;\n font-weight: 400;\n }\n\n h4 {\n margin: 0;\n font-weight: 500;\n }\n"]))); +var LowerSection = styled.div(templateObject_9$b || (templateObject_9$b = __makeTemplateObject(["\n ", "\n padding: 1.5rem;\n flex-grow: 1;\n overflow: auto;\n background-color: ", ";\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n\n h5 {\n margin: 0;\n font-weight: 400;\n color: ", ";\n }\n"], ["\n ", "\n padding: 1.5rem;\n flex-grow: 1;\n overflow: auto;\n background-color: ", ";\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n\n h5 {\n margin: 0;\n font-weight: 400;\n color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}, function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var theme = _a.theme; + return theme.text3; +}); +var AccountControl = styled.div(templateObject_10$8 || (templateObject_10$8 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n min-width: 0;\n width: 100%;\n\n font-weight: 500;\n font-size: 1.25rem;\n\n a:hover {\n text-decoration: underline;\n }\n\n p {\n min-width: 0;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"], ["\n display: flex;\n justify-content: space-between;\n min-width: 0;\n width: 100%;\n\n font-weight: 500;\n font-size: 1.25rem;\n\n a:hover {\n text-decoration: underline;\n }\n\n p {\n min-width: 0;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"]))); +var AddressLink = styled(ExternalLink)(templateObject_11$6 || (templateObject_11$6 = __makeTemplateObject(["\n font-size: 0.825rem;\n color: ", ";\n margin-left: 1rem;\n font-size: 0.825rem;\n display: flex;\n :hover {\n color: ", ";\n }\n"], ["\n font-size: 0.825rem;\n color: ", ";\n margin-left: 1rem;\n font-size: 0.825rem;\n display: flex;\n :hover {\n color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var CloseIcon$1 = styled.div(templateObject_12$6 || (templateObject_12$6 = __makeTemplateObject(["\n position: absolute;\n right: 1rem;\n top: 14px;\n &:hover {\n cursor: pointer;\n opacity: 0.6;\n }\n"], ["\n position: absolute;\n right: 1rem;\n top: 14px;\n &:hover {\n cursor: pointer;\n opacity: 0.6;\n }\n"]))); +var CloseColor$1 = styled(SvgX)(templateObject_13$2 || (templateObject_13$2 = __makeTemplateObject(["\n path {\n stroke: ", ";\n }\n"], ["\n path {\n stroke: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text4; +}); +var WalletName = styled.div(templateObject_14$2 || (templateObject_14$2 = __makeTemplateObject(["\n width: initial;\n font-size: 0.825rem;\n font-weight: 500;\n color: ", ";\n"], ["\n width: initial;\n font-size: 0.825rem;\n font-weight: 500;\n color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}); +var IconWrapper$2 = styled.div(templateObject_16$1 || (templateObject_16$1 = __makeTemplateObject(["\n ", ";\n align-items: center;\n justify-content: center;\n margin-right: 8px;\n & > img,\n span {\n height: ", ";\n width: ", ";\n }\n ", ";\n"], ["\n ", ";\n align-items: center;\n justify-content: center;\n margin-right: 8px;\n & > img,\n span {\n height: ", ";\n width: ", ";\n }\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}, function (_a) { + var size = _a.size; + return (size ? size + 'px' : '32px'); +}, function (_a) { + var size = _a.size; + return (size ? size + 'px' : '32px'); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_15$1 || (templateObject_15$1 = __makeTemplateObject(["\n align-items: flex-end;\n "], ["\n align-items: flex-end;\n "]))); +}); +function WrappedStatusIcon$1(_a) { + var connector = _a.connector; + return (jsxs(IconWrapper$2, __assign({ size: 16 }, { children: [jsx(StatusIcon, { connector: connector }, void 0), connector === portis && (jsx(MainWalletAction, __assign({ onClick: function () { + portis.portis.showPortis(); + } }, { children: jsx(Trans, { children: "Show Portis" }, void 0) }), void 0))] }), void 0)); +} +var TransactionListWrapper = styled.div(templateObject_17$1 || (templateObject_17$1 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}); +var WalletAction = styled(ButtonSecondary)(templateObject_18$1 || (templateObject_18$1 = __makeTemplateObject(["\n width: fit-content;\n font-weight: 400;\n margin-left: 8px;\n font-size: 0.825rem;\n padding: 4px 6px;\n :hover {\n cursor: pointer;\n text-decoration: underline;\n }\n"], ["\n width: fit-content;\n font-weight: 400;\n margin-left: 8px;\n font-size: 0.825rem;\n padding: 4px 6px;\n :hover {\n cursor: pointer;\n text-decoration: underline;\n }\n"]))); +var MainWalletAction = styled(WalletAction)(templateObject_19$1 || (templateObject_19$1 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.primary1; +}); +function renderTransactions(transactions) { + return (jsx(TransactionListWrapper, { children: transactions.map(function (hash, i) { + return jsx(Transaction, { hash: hash }, i); + }) }, void 0)); +} +function AccountDetails(_a) { + var toggleWalletModal = _a.toggleWalletModal, pendingTransactions = _a.pendingTransactions, confirmedTransactions = _a.confirmedTransactions, ENSName = _a.ENSName, openOptions = _a.openOptions; + var _b = useActiveWeb3React(), chainId = _b.chainId, account = _b.account, connector = _b.connector; + var theme = useContext(ThemeContext); + var dispatch = useAppDispatch(); + function formatConnectorName() { + var ethereum = window.ethereum; + var isMetaMask = !!(ethereum && ethereum.isMetaMask); + var name = Object.keys(SUPPORTED_WALLETS) + .filter(function (k) { + return SUPPORTED_WALLETS[k].connector === connector && (connector !== injected || isMetaMask === (k === 'METAMASK')); + }) + .map(function (k) { return SUPPORTED_WALLETS[k].name; })[0]; + return (jsx(WalletName, { children: jsxs(Trans, { children: ["Connected with ", name] }, void 0) }, void 0)); + } + var clearAllTransactionsCallback = useCallback(function () { + if (chainId) + dispatch(clearAllTransactions({ chainId: chainId })); + }, [dispatch, chainId]); + return (jsxs(Fragment, { children: [jsxs(UpperSection$1, { children: [jsx(CloseIcon$1, __assign({ onClick: toggleWalletModal }, { children: jsx(CloseColor$1, {}, void 0) }), void 0), jsx(HeaderRow$1, { children: jsx(Trans, { children: "Account" }, void 0) }, void 0), jsx(AccountSection, { children: jsx(YourAccount, { children: jsxs(InfoCard$1, { children: [jsxs(AccountGroupingRow, { children: [formatConnectorName(), jsxs("div", { children: [connector !== injected && connector !== walletlink && (jsx(WalletAction, __assign({ style: { fontSize: '.825rem', fontWeight: 400, marginRight: '8px' }, onClick: function () { + connector.close(); + } }, { children: jsx(Trans, { children: "Disconnect" }, void 0) }), void 0)), jsx(WalletAction, __assign({ style: { fontSize: '.825rem', fontWeight: 400 }, onClick: function () { + openOptions(); + } }, { children: jsx(Trans, { children: "Change" }, void 0) }), void 0)] }, void 0)] }, void 0), jsx(AccountGroupingRow, __assign({ id: "web3-account-identifier-row" }, { children: jsx(AccountControl, { children: ENSName ? (jsx(Fragment, { children: jsxs("div", { children: [connector && jsx(WrappedStatusIcon$1, { connector: connector }, void 0), jsxs("p", { children: [" ", ENSName] }, void 0)] }, void 0) }, void 0)) : (jsx(Fragment, { children: jsxs("div", { children: [connector && jsx(WrappedStatusIcon$1, { connector: connector }, void 0), jsxs("p", { children: [" ", account && shortenAddress(account)] }, void 0)] }, void 0) }, void 0)) }, void 0) }), void 0), jsx(AccountGroupingRow, { children: ENSName ? (jsx(Fragment, { children: jsx(AccountControl, { children: jsxs("div", { children: [account && (jsx(CopyHelper, __assign({ toCopy: account }, { children: jsx("span", __assign({ style: { marginLeft: '4px' } }, { children: jsx(Trans, { children: "Copy Address" }, void 0) }), void 0) }), void 0)), chainId && account && (jsxs(AddressLink, __assign({ hasENS: !!ENSName, isENS: true, href: getExplorerLink(chainId, ENSName, ExplorerDataType.ADDRESS) }, { children: [jsx(ExternalLink$1, { size: 16 }, void 0), jsx("span", __assign({ style: { marginLeft: '4px' } }, { children: jsx(Trans, { children: "View on Explorer" }, void 0) }), void 0)] }), void 0))] }, void 0) }, void 0) }, void 0)) : (jsx(Fragment, { children: jsx(AccountControl, { children: jsxs("div", { children: [account && (jsx(CopyHelper, __assign({ toCopy: account }, { children: jsx("span", __assign({ style: { marginLeft: '4px' } }, { children: jsx(Trans, { children: "Copy Address" }, void 0) }), void 0) }), void 0)), chainId && account && (jsxs(AddressLink, __assign({ hasENS: !!ENSName, isENS: false, href: getExplorerLink(chainId, account, ExplorerDataType.ADDRESS) }, { children: [jsx(ExternalLink$1, { size: 16 }, void 0), jsx("span", __assign({ style: { marginLeft: '4px' } }, { children: jsx(Trans, { children: "View on Explorer" }, void 0) }), void 0)] }), void 0))] }, void 0) }, void 0) }, void 0)) }, void 0)] }, void 0) }, void 0) }, void 0)] }, void 0), !!pendingTransactions.length || !!confirmedTransactions.length ? (jsxs(LowerSection, { children: [jsxs(AutoRow, __assign({ mb: '1rem', style: { justifyContent: 'space-between' } }, { children: [jsx(ThemedText.Body, { children: jsx(Trans, { children: "Recent Transactions" }, void 0) }, void 0), jsx(LinkStyledButton, __assign({ onClick: clearAllTransactionsCallback }, { children: jsx(Trans, { children: "(clear all)" }, void 0) }), void 0)] }), void 0), renderTransactions(pendingTransactions), renderTransactions(confirmedTransactions)] }, void 0)) : (jsx(LowerSection, { children: jsx(ThemedText.Body, __assign({ color: theme.text1 }, { children: jsx(Trans, { children: "Your transactions will appear here..." }, void 0) }), void 0) }, void 0))] }, void 0)); +} +var templateObject_1$X, templateObject_2$F, templateObject_3$z, templateObject_4$q, templateObject_5$m, templateObject_6$h, templateObject_7$e, templateObject_8$c, templateObject_9$b, templateObject_10$8, templateObject_11$6, templateObject_12$6, templateObject_13$2, templateObject_14$2, templateObject_15$1, templateObject_16$1, templateObject_17$1, templateObject_18$1, templateObject_19$1; + +var InfoCard = styled.button(templateObject_1$W || (templateObject_1$W = __makeTemplateObject(["\n background-color: ", ";\n padding: 1rem;\n outline: none;\n border: 1px solid;\n border-radius: 12px;\n width: 100% !important;\n &:focus {\n box-shadow: 0 0 0 1px ", ";\n }\n border-color: ", ";\n"], ["\n background-color: ", ";\n padding: 1rem;\n outline: none;\n border: 1px solid;\n border-radius: 12px;\n width: 100% !important;\n &:focus {\n box-shadow: 0 0 0 1px ", ";\n }\n border-color: ", ";\n"])), function (_a) { + var theme = _a.theme, active = _a.active; + return (active ? theme.bg3 : theme.bg2); +}, function (_a) { + var theme = _a.theme; + return theme.primary1; +}, function (_a) { + var theme = _a.theme, active = _a.active; + return (active ? 'transparent' : theme.bg3); +}); +var OptionCard = styled(InfoCard)(templateObject_2$E || (templateObject_2$E = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n margin-top: 2rem;\n padding: 1rem;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n margin-top: 2rem;\n padding: 1rem;\n"]))); +var OptionCardLeft = styled.div(templateObject_3$y || (templateObject_3$y = __makeTemplateObject(["\n ", ";\n justify-content: center;\n height: 100%;\n"], ["\n ", ";\n justify-content: center;\n height: 100%;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}); +var OptionCardClickable = styled(OptionCard)(templateObject_4$p || (templateObject_4$p = __makeTemplateObject(["\n margin-top: 0;\n &:hover {\n cursor: ", ";\n border: ", ";\n }\n opacity: ", ";\n"], ["\n margin-top: 0;\n &:hover {\n cursor: ", ";\n border: ", ";\n }\n opacity: ", ";\n"])), function (_a) { + var clickable = _a.clickable; + return (clickable ? 'pointer' : ''); +}, function (_a) { + var clickable = _a.clickable, theme = _a.theme; + return (clickable ? "1px solid " + theme.primary1 : ""); +}, function (_a) { + var disabled = _a.disabled; + return (disabled ? '0.5' : '1'); +}); +var GreenCircle = styled.div(templateObject_5$l || (templateObject_5$l = __makeTemplateObject(["\n ", "\n justify-content: center;\n align-items: center;\n\n &:first-child {\n height: 8px;\n width: 8px;\n margin-right: 8px;\n background-color: ", ";\n border-radius: 50%;\n }\n"], ["\n ", "\n justify-content: center;\n align-items: center;\n\n &:first-child {\n height: 8px;\n width: 8px;\n margin-right: 8px;\n background-color: ", ";\n border-radius: 50%;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (_a) { + var theme = _a.theme; + return theme.green1; +}); +var CircleWrapper = styled.div(templateObject_6$g || (templateObject_6$g = __makeTemplateObject(["\n color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n"], ["\n color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n"])), function (_a) { + var theme = _a.theme; + return theme.green1; +}); +var HeaderText = styled.div(templateObject_7$d || (templateObject_7$d = __makeTemplateObject(["\n ", ";\n color: ", ";\n font-size: 1rem;\n font-weight: 500;\n"], ["\n ", ";\n color: ", ";\n font-size: 1rem;\n font-weight: 500;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (props) { return (props.color === 'blue' ? function (_a) { + var theme = _a.theme; + return theme.primary1; +} : function (_a) { + var theme = _a.theme; + return theme.text1; +}); }); +var SubHeader = styled.div(templateObject_8$b || (templateObject_8$b = __makeTemplateObject(["\n color: ", ";\n margin-top: 10px;\n font-size: 12px;\n"], ["\n color: ", ";\n margin-top: 10px;\n font-size: 12px;\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var IconWrapper$1 = styled.div(templateObject_10$7 || (templateObject_10$7 = __makeTemplateObject(["\n ", ";\n align-items: center;\n justify-content: center;\n & > img,\n span {\n height: ", ";\n width: ", ";\n }\n ", ";\n"], ["\n ", ";\n align-items: center;\n justify-content: center;\n & > img,\n span {\n height: ", ";\n width: ", ";\n }\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}, function (_a) { + var size = _a.size; + return (size ? size + 'px' : '24px'); +}, function (_a) { + var size = _a.size; + return (size ? size + 'px' : '24px'); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_9$a || (templateObject_9$a = __makeTemplateObject(["\n align-items: flex-end;\n "], ["\n align-items: flex-end;\n "]))); +}); +function Option$1(_a) { + var _b = _a.link, link = _b === void 0 ? null : _b, _c = _a.clickable, clickable = _c === void 0 ? true : _c, size = _a.size, _d = _a.onClick, onClick = _d === void 0 ? null : _d, color = _a.color, header = _a.header, _e = _a.subheader, subheader = _e === void 0 ? null : _e, icon = _a.icon, _f = _a.active, active = _f === void 0 ? false : _f, id = _a.id; + var content = (jsxs(OptionCardClickable, __assign({ id: id, onClick: onClick, clickable: clickable && !active, active: active }, { children: [jsxs(OptionCardLeft, { children: [jsxs(HeaderText, __assign({ color: color }, { children: [active ? (jsx(CircleWrapper, { children: jsx(GreenCircle, { children: jsx("div", {}, void 0) }, void 0) }, void 0)) : (''), header] }), void 0), subheader && jsx(SubHeader, { children: subheader }, void 0)] }, void 0), jsx(IconWrapper$1, __assign({ size: size }, { children: jsx("img", { src: icon, alt: 'Icon' }, void 0) }), void 0)] }), void 0)); + if (link) { + return jsx(ExternalLink, __assign({ href: link }, { children: content }), void 0); + } + return content; +} +var templateObject_1$W, templateObject_2$E, templateObject_3$y, templateObject_4$p, templateObject_5$l, templateObject_6$g, templateObject_7$d, templateObject_8$b, templateObject_9$a, templateObject_10$7; + +var PendingSection = styled.div(templateObject_1$V || (templateObject_1$V = __makeTemplateObject(["\n ", ";\n align-items: center;\n justify-content: center;\n width: 100%;\n & > * {\n width: 100%;\n }\n"], ["\n ", ";\n align-items: center;\n justify-content: center;\n width: 100%;\n & > * {\n width: 100%;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}); +var StyledLoader = styled(Loader)(templateObject_2$D || (templateObject_2$D = __makeTemplateObject(["\n margin-right: 1rem;\n"], ["\n margin-right: 1rem;\n"]))); +var LoadingMessage = styled.div(templateObject_3$x || (templateObject_3$x = __makeTemplateObject(["\n ", ";\n align-items: center;\n justify-content: flex-start;\n border-radius: 12px;\n margin-bottom: 20px;\n color: ", ";\n border: 1px solid ", ";\n\n & > * {\n padding: 1rem;\n }\n"], ["\n ", ";\n align-items: center;\n justify-content: flex-start;\n border-radius: 12px;\n margin-bottom: 20px;\n color: ", ";\n border: 1px solid ", ";\n\n & > * {\n padding: 1rem;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (_a) { + var theme = _a.theme, error = _a.error; + return (error ? theme.red1 : 'inherit'); +}, function (_a) { + var theme = _a.theme, error = _a.error; + return (error ? theme.red1 : theme.text4); +}); +var ErrorGroup = styled.div(templateObject_4$o || (templateObject_4$o = __makeTemplateObject(["\n ", ";\n align-items: center;\n justify-content: flex-start;\n"], ["\n ", ";\n align-items: center;\n justify-content: flex-start;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}); +var ErrorButton = styled.div(templateObject_5$k || (templateObject_5$k = __makeTemplateObject(["\n border-radius: 8px;\n font-size: 12px;\n color: ", ";\n background-color: ", ";\n margin-left: 1rem;\n padding: 0.5rem;\n font-weight: 600;\n user-select: none;\n\n &:hover {\n cursor: pointer;\n background-color: ", ";\n }\n"], ["\n border-radius: 8px;\n font-size: 12px;\n color: ", ";\n background-color: ", ";\n margin-left: 1rem;\n padding: 0.5rem;\n font-weight: 600;\n user-select: none;\n\n &:hover {\n cursor: pointer;\n background-color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return theme.bg4; +}, function (_a) { + var theme = _a.theme; + return darken(0.1, theme.text4); +}); +var LoadingWrapper = styled.div(templateObject_6$f || (templateObject_6$f = __makeTemplateObject(["\n ", ";\n align-items: center;\n justify-content: center;\n"], ["\n ", ";\n align-items: center;\n justify-content: center;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}); +function PendingView(_a) { + var _b; + var connector = _a.connector, _c = _a.error, error = _c === void 0 ? false : _c, setPendingError = _a.setPendingError, tryActivation = _a.tryActivation; + var isMetamask = (_b = window === null || window === void 0 ? void 0 : window.ethereum) === null || _b === void 0 ? void 0 : _b.isMetaMask; + return (jsxs(PendingSection, { children: [jsx(LoadingMessage, __assign({ error: error }, { children: jsx(LoadingWrapper, { children: error ? (jsxs(ErrorGroup, { children: [jsx("div", { children: jsx(Trans, { children: "Error connecting" }, void 0) }, void 0), jsx(ErrorButton, __assign({ onClick: function () { + setPendingError(false); + connector && tryActivation(connector); + } }, { children: jsx(Trans, { children: "Try Again" }, void 0) }), void 0)] }, void 0)) : (jsxs(Fragment, { children: [jsx(StyledLoader, {}, void 0), jsx(Trans, { children: "Initializing..." }, void 0)] }, void 0)) }, void 0) }), void 0), Object.keys(SUPPORTED_WALLETS).map(function (key) { + var option = SUPPORTED_WALLETS[key]; + if (option.connector === connector) { + if (option.connector === injected) { + if (isMetamask && option.name !== 'MetaMask') { + return null; + } + if (!isMetamask && option.name === 'MetaMask') { + return null; + } + } + return (jsx(Option$1, { id: "connect-" + key, clickable: false, color: option.color, header: option.name, subheader: option.description, icon: option.iconURL }, key)); + } + return null; + })] }, void 0)); +} +var templateObject_1$V, templateObject_2$D, templateObject_3$x, templateObject_4$o, templateObject_5$k, templateObject_6$f; + +var CloseIcon = styled.div(templateObject_1$U || (templateObject_1$U = __makeTemplateObject(["\n position: absolute;\n right: 1rem;\n top: 14px;\n &:hover {\n cursor: pointer;\n opacity: 0.6;\n }\n"], ["\n position: absolute;\n right: 1rem;\n top: 14px;\n &:hover {\n cursor: pointer;\n opacity: 0.6;\n }\n"]))); +var CloseColor = styled(SvgX)(templateObject_2$C || (templateObject_2$C = __makeTemplateObject(["\n path {\n stroke: ", ";\n }\n"], ["\n path {\n stroke: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text4; +}); +var Wrapper$f = styled.div(templateObject_3$w || (templateObject_3$w = __makeTemplateObject(["\n ", "\n margin: 0;\n padding: 0;\n width: 100%;\n"], ["\n ", "\n margin: 0;\n padding: 0;\n width: 100%;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}); +var HeaderRow = styled.div(templateObject_5$j || (templateObject_5$j = __makeTemplateObject(["\n ", ";\n padding: 1rem 1rem;\n font-weight: 500;\n color: ", ";\n ", ";\n"], ["\n ", ";\n padding: 1rem 1rem;\n font-weight: 500;\n color: ", ";\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (props) { return (props.color === 'blue' ? function (_a) { + var theme = _a.theme; + return theme.primary1; +} : 'inherit'); }, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_4$n || (templateObject_4$n = __makeTemplateObject(["\n padding: 1rem;\n "], ["\n padding: 1rem;\n "]))); +}); +var ContentWrapper$2 = styled.div(templateObject_7$c || (templateObject_7$c = __makeTemplateObject(["\n background-color: ", ";\n padding: 0 1rem 1rem 1rem;\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n\n ", ";\n"], ["\n background-color: ", ";\n padding: 0 1rem 1rem 1rem;\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_6$e || (templateObject_6$e = __makeTemplateObject(["padding: 0 1rem 1rem 1rem"], ["padding: 0 1rem 1rem 1rem"]))); +}); +var UpperSection = styled.div(templateObject_8$a || (templateObject_8$a = __makeTemplateObject(["\n position: relative;\n\n h5 {\n margin: 0;\n margin-bottom: 0.5rem;\n font-size: 1rem;\n font-weight: 400;\n }\n\n h5:last-child {\n margin-bottom: 0px;\n }\n\n h4 {\n margin-top: 0;\n font-weight: 500;\n }\n"], ["\n position: relative;\n\n h5 {\n margin: 0;\n margin-bottom: 0.5rem;\n font-size: 1rem;\n font-weight: 400;\n }\n\n h5:last-child {\n margin-bottom: 0px;\n }\n\n h4 {\n margin-top: 0;\n font-weight: 500;\n }\n"]))); +var OptionGrid = styled.div(templateObject_10$6 || (templateObject_10$6 = __makeTemplateObject(["\n display: grid;\n grid-gap: 10px;\n ", ";\n"], ["\n display: grid;\n grid-gap: 10px;\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_9$9 || (templateObject_9$9 = __makeTemplateObject(["\n grid-template-columns: 1fr;\n grid-gap: 10px;\n "], ["\n grid-template-columns: 1fr;\n grid-gap: 10px;\n "]))); +}); +var HoverText = styled.div(templateObject_11$5 || (templateObject_11$5 = __makeTemplateObject(["\n text-decoration: none;\n color: ", ";\n display: flex;\n align-items: center;\n\n :hover {\n cursor: pointer;\n }\n"], ["\n text-decoration: none;\n color: ", ";\n display: flex;\n align-items: center;\n\n :hover {\n cursor: pointer;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var LinkCard = styled(Card)(templateObject_12$5 || (templateObject_12$5 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n\n :hover {\n cursor: pointer;\n filter: brightness(0.9);\n }\n"], ["\n background-color: ", ";\n color: ", ";\n\n :hover {\n cursor: pointer;\n filter: brightness(0.9);\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return theme.text3; +}); +var WALLET_VIEWS = { + OPTIONS: 'options', + OPTIONS_SECONDARY: 'options_secondary', + ACCOUNT: 'account', + PENDING: 'pending', + LEGAL: 'legal', +}; +function WalletModal(_a) { + var _this = this; + var pendingTransactions = _a.pendingTransactions, confirmedTransactions = _a.confirmedTransactions, ENSName = _a.ENSName; + // important that these are destructed from the account-specific web3-react context + var _b = useWeb3React(), active = _b.active, account = _b.account, connector = _b.connector, activate = _b.activate, error = _b.error; + var _c = __read(useState(WALLET_VIEWS.ACCOUNT), 2), walletView = _c[0], setWalletView = _c[1]; + var previousWalletView = usePrevious(walletView); + var _d = __read(useState(), 2), pendingWallet = _d[0], setPendingWallet = _d[1]; + var _e = __read(useState(), 2), pendingError = _e[0], setPendingError = _e[1]; + var walletModalOpen = useModalOpen(ApplicationModal.WALLET); + var toggleWalletModal = useWalletModalToggle(); + var previousAccount = usePrevious(account); + var logMonitoringEvent = useWalletConnectMonitoringEventCallback(); + // close on connection, when logged out before + useEffect(function () { + if (account && !previousAccount && walletModalOpen) { + toggleWalletModal(); + } + }, [account, previousAccount, toggleWalletModal, walletModalOpen]); + // always reset to account view + useEffect(function () { + if (walletModalOpen) { + setPendingError(false); + setWalletView(WALLET_VIEWS.ACCOUNT); + } + }, [walletModalOpen]); + // close modal when a connection is successful + var activePrevious = usePrevious(active); + var connectorPrevious = usePrevious(connector); + useEffect(function () { + if (walletModalOpen && ((active && !activePrevious) || (connector && connector !== connectorPrevious && !error))) { + setWalletView(WALLET_VIEWS.ACCOUNT); + } + }, [setWalletView, active, error, connector, walletModalOpen, activePrevious, connectorPrevious]); + var tryActivation = function (connector) { return __awaiter(_this, void 0, void 0, function () { + var name; + var _this = this; + return __generator(this, function (_a) { + name = ''; + Object.keys(SUPPORTED_WALLETS).map(function (key) { + if (connector === SUPPORTED_WALLETS[key].connector) { + return (name = SUPPORTED_WALLETS[key].name); + } + return true; + }); + // log selected wallet + ReactGA.event({ + category: 'Wallet', + action: 'Change Wallet', + label: name, + }); + setPendingWallet(connector); // set wallet for pending view + setWalletView(WALLET_VIEWS.PENDING); + // if the connector is walletconnect and the user has already tried to connect, manually reset the connector + if (connector instanceof WalletConnectConnector) { + connector.walletConnectProvider = undefined; + } + connector && + activate(connector, undefined, true) + .then(function () { return __awaiter(_this, void 0, void 0, function () { + var walletAddress; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, connector.getAccount()]; + case 1: + walletAddress = _a.sent(); + logMonitoringEvent({ walletAddress: walletAddress }); + return [2 /*return*/]; + } + }); + }); }) + .catch(function (error) { + if (error instanceof UnsupportedChainIdError) { + activate(connector); // a little janky...can't use setError because the connector isn't set + } + else { + setPendingError(true); + } + }); + return [2 /*return*/]; + }); + }); }; + // close wallet modal if fortmatic modal is active + useEffect(function () { + fortmatic$1.on(OVERLAY_READY, function () { + toggleWalletModal(); + }); + }, [toggleWalletModal]); + // get wallets user can switch too, depending on device/browser + function getOptions() { + var isMetamask = window.ethereum && window.ethereum.isMetaMask; + return Object.keys(SUPPORTED_WALLETS).map(function (key) { + var option = SUPPORTED_WALLETS[key]; + // check for mobile options + if (isMobile) { + //disable portis on mobile for now + if (option.connector === portis) { + return null; + } + if (!window.web3 && !window.ethereum && option.mobile) { + return (jsx(Option$1, { onClick: function () { + option.connector !== connector && !option.href && tryActivation(option.connector); + }, id: "connect-" + key, active: option.connector && option.connector === connector, color: option.color, link: option.href, header: option.name, subheader: null, icon: option.iconURL }, key)); + } + return null; + } + // overwrite injected when needed + if (option.connector === injected) { + // don't show injected if there's no injected provider + if (!(window.web3 || window.ethereum)) { + if (option.name === 'MetaMask') { + return (jsx(Option$1, { id: "connect-" + key, color: '#E8831D', header: jsx(Trans, { children: "Install Metamask" }, void 0), subheader: null, link: 'https://metamask.io/', icon: MetaMaskLogo }, key)); + } + else { + return null; //dont want to return install twice + } + } + // don't return metamask if injected provider isn't metamask + else if (option.name === 'MetaMask' && !isMetamask) { + return null; + } + // likewise for generic + else if (option.name === 'Injected' && isMetamask) { + return null; + } + } + // return rest of options + return (!isMobile && + !option.mobileOnly && (jsx(Option$1, { id: "connect-" + key, onClick: function () { + option.connector === connector + ? setWalletView(WALLET_VIEWS.ACCOUNT) + : !option.href && tryActivation(option.connector); + }, active: option.connector === connector, color: option.color, link: option.href, header: option.name, subheader: null, icon: option.iconURL }, key))); + }); + } + function getModalContent() { + if (error) { + return (jsxs(UpperSection, { children: [jsx(CloseIcon, __assign({ onClick: toggleWalletModal }, { children: jsx(CloseColor, {}, void 0) }), void 0), jsx(HeaderRow, { children: error instanceof UnsupportedChainIdError ? jsx(Trans, { children: "Wrong Network" }, void 0) : jsx(Trans, { children: "Error connecting" }, void 0) }, void 0), jsx(ContentWrapper$2, { children: error instanceof UnsupportedChainIdError ? (jsx("h5", { children: jsx(Trans, { children: "Please connect to a supported network in the dropdown menu or in your wallet." }, void 0) }, void 0)) : (jsx(Trans, { children: "Error connecting. Try refreshing the page." }, void 0)) }, void 0)] }, void 0)); + } + if (walletView === WALLET_VIEWS.LEGAL) { + return (jsxs(UpperSection, { children: [jsxs(HeaderRow, { children: [jsx(HoverText, __assign({ onClick: function () { + var _a; + setWalletView((_a = (previousWalletView === WALLET_VIEWS.LEGAL ? WALLET_VIEWS.ACCOUNT : previousWalletView)) !== null && _a !== void 0 ? _a : WALLET_VIEWS.ACCOUNT); + } }, { children: jsx(ArrowLeft, {}, void 0) }), void 0), jsx(Row$1, __assign({ justify: "center" }, { children: jsx(ThemedText.MediumHeader, { children: jsx(Trans, { children: "Legal & Privacy" }, void 0) }, void 0) }), void 0)] }, void 0), jsx(PrivacyPolicy, {}, void 0)] }, void 0)); + } + if (account && walletView === WALLET_VIEWS.ACCOUNT) { + return (jsx(AccountDetails, { toggleWalletModal: toggleWalletModal, pendingTransactions: pendingTransactions, confirmedTransactions: confirmedTransactions, ENSName: ENSName, openOptions: function () { return setWalletView(WALLET_VIEWS.OPTIONS); } }, void 0)); + } + return (jsxs(UpperSection, { children: [jsx(CloseIcon, __assign({ onClick: toggleWalletModal }, { children: jsx(CloseColor, {}, void 0) }), void 0), walletView !== WALLET_VIEWS.ACCOUNT ? (jsx(HeaderRow, __assign({ color: "blue" }, { children: jsx(HoverText, __assign({ onClick: function () { + setPendingError(false); + setWalletView(WALLET_VIEWS.ACCOUNT); + } }, { children: jsx(ArrowLeft, {}, void 0) }), void 0) }), void 0)) : (jsx(HeaderRow, { children: jsx(HoverText, { children: jsx(Trans, { children: "Connect a wallet" }, void 0) }, void 0) }, void 0)), jsx(ContentWrapper$2, { children: jsxs(AutoColumn, __assign({ gap: "16px" }, { children: [jsx(LightCard, { children: jsx(AutoRow, __assign({ style: { flexWrap: 'nowrap' } }, { children: jsx(ThemedText.Black, __assign({ fontSize: 14 }, { children: jsxs(Trans, { children: ["By connecting a wallet, you agree to Uniswap Labs\u2019", ' ', jsx(ExternalLink, __assign({ href: "https://uniswap.org/terms-of-service/" }, { children: "Terms of Service" }), void 0), " and acknowledge that you have read and understand the Uniswap", ' ', jsx(ExternalLink, __assign({ href: "https://uniswap.org/disclaimer/" }, { children: "Protocol Disclaimer" }), void 0), "."] }, void 0) }), void 0) }), void 0) }, void 0), walletView === WALLET_VIEWS.PENDING ? (jsx(PendingView, { connector: pendingWallet, error: pendingError, setPendingError: setPendingError, tryActivation: tryActivation }, void 0)) : (jsx(OptionGrid, { children: getOptions() }, void 0)), jsx(LinkCard, __assign({ padding: ".5rem", "$borderRadius": ".75rem", onClick: function () { return setWalletView(WALLET_VIEWS.LEGAL); } }, { children: jsxs(RowBetween, { children: [jsxs(AutoRow, __assign({ gap: "4px" }, { children: [jsx(Info, { size: 20 }, void 0), jsx(ThemedText.Label, __assign({ fontSize: 14 }, { children: jsx(Trans, { children: "How this app uses APIs" }, void 0) }), void 0)] }), void 0), jsx(ArrowRight, { size: 16 }, void 0)] }, void 0) }), void 0)] }), void 0) }, void 0)] }, void 0)); + } + return (jsx(Modal, __assign({ isOpen: walletModalOpen, onDismiss: toggleWalletModal, minHeight: false, maxHeight: 90 }, { children: jsx(Wrapper$f, { children: getModalContent() }, void 0) }), void 0)); +} +var templateObject_1$U, templateObject_2$C, templateObject_3$w, templateObject_4$n, templateObject_5$j, templateObject_6$e, templateObject_7$c, templateObject_8$a, templateObject_9$9, templateObject_10$6, templateObject_11$5, templateObject_12$5; + +var IconWrapper = styled.div(templateObject_1$T || (templateObject_1$T = __makeTemplateObject(["\n ", ";\n align-items: center;\n justify-content: center;\n & > * {\n height: ", ";\n width: ", ";\n }\n"], ["\n ", ";\n align-items: center;\n justify-content: center;\n & > * {\n height: ", ";\n width: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}, function (_a) { + var size = _a.size; + return (size ? size + 'px' : '32px'); +}, function (_a) { + var size = _a.size; + return (size ? size + 'px' : '32px'); +}); +var Web3StatusGeneric = styled(ButtonSecondary)(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["\n ", "\n width: 100%;\n align-items: center;\n padding: 0.5rem;\n border-radius: 14px;\n cursor: pointer;\n user-select: none;\n height: 36px;\n margin-right: 2px;\n margin-left: 1px;\n :focus {\n outline: none;\n }\n"], ["\n ", "\n width: 100%;\n align-items: center;\n padding: 0.5rem;\n border-radius: 14px;\n cursor: pointer;\n user-select: none;\n height: 36px;\n margin-right: 2px;\n margin-left: 1px;\n :focus {\n outline: none;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}); +var Web3StatusError = styled(Web3StatusGeneric)(templateObject_3$v || (templateObject_3$v = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid ", ";\n color: ", ";\n font-weight: 500;\n :hover,\n :focus {\n background-color: ", ";\n }\n"], ["\n background-color: ", ";\n border: 1px solid ", ";\n color: ", ";\n font-weight: 500;\n :hover,\n :focus {\n background-color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.red1; +}, function (_a) { + var theme = _a.theme; + return theme.red1; +}, function (_a) { + var theme = _a.theme; + return theme.white; +}, function (_a) { + var theme = _a.theme; + return darken(0.1, theme.red1); +}); +var Web3StatusConnect = styled(Web3StatusGeneric)(templateObject_5$i || (templateObject_5$i = __makeTemplateObject(["\n background-color: ", ";\n border: none;\n\n color: ", ";\n font-weight: 500;\n\n :hover,\n :focus {\n border: 1px solid ", ";\n color: ", ";\n }\n\n ", "\n"], ["\n background-color: ", ";\n border: none;\n\n color: ", ";\n font-weight: 500;\n\n :hover,\n :focus {\n border: 1px solid ", ";\n color: ", ";\n }\n\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.primary4; +}, function (_a) { + var theme = _a.theme; + return theme.primaryText1; +}, function (_a) { + var theme = _a.theme; + return darken(0.05, theme.primary4); +}, function (_a) { + var theme = _a.theme; + return theme.primaryText1; +}, function (_a) { + var faded = _a.faded; + return faded && css(templateObject_4$m || (templateObject_4$m = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid ", ";\n color: ", ";\n\n :hover,\n :focus {\n border: 1px solid ", ";\n color: ", ";\n }\n "], ["\n background-color: ", ";\n border: 1px solid ", ";\n color: ", ";\n\n :hover,\n :focus {\n border: 1px solid ", ";\n color: ", ";\n }\n "])), function (_a) { + var theme = _a.theme; + return theme.primary5; + }, function (_a) { + var theme = _a.theme; + return theme.primary5; + }, function (_a) { + var theme = _a.theme; + return theme.primaryText1; + }, function (_a) { + var theme = _a.theme; + return darken(0.05, theme.primary4); + }, function (_a) { + var theme = _a.theme; + return darken(0.05, theme.primaryText1); + }); +}); +var Web3StatusConnected = styled(Web3StatusGeneric)(templateObject_6$d || (templateObject_6$d = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid ", ";\n color: ", ";\n font-weight: 500;\n :hover,\n :focus {\n border: 1px solid ", ";\n\n :focus {\n border: 1px solid ", ";\n }\n }\n"], ["\n background-color: ", ";\n border: 1px solid ", ";\n color: ", ";\n font-weight: 500;\n :hover,\n :focus {\n border: 1px solid ", ";\n\n :focus {\n border: 1px solid ", ";\n }\n }\n"])), function (_a) { + var pending = _a.pending, theme = _a.theme; + return (pending ? theme.primary1 : theme.bg1); +}, function (_a) { + var pending = _a.pending, theme = _a.theme; + return (pending ? theme.primary1 : theme.bg1); +}, function (_a) { + var pending = _a.pending, theme = _a.theme; + return (pending ? theme.white : theme.text1); +}, function (_a) { + var theme = _a.theme; + return darken(0.05, theme.bg3); +}, function (_a) { + var pending = _a.pending, theme = _a.theme; + return (pending ? darken(0.1, theme.primary1) : darken(0.1, theme.bg2)); +}); +var Text = styled.p(templateObject_7$b || (templateObject_7$b = __makeTemplateObject(["\n flex: 1 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: 0 0.5rem 0 0.25rem;\n font-size: 1rem;\n width: fit-content;\n font-weight: 500;\n"], ["\n flex: 1 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: 0 0.5rem 0 0.25rem;\n font-size: 1rem;\n width: fit-content;\n font-weight: 500;\n"]))); +var NetworkIcon = styled(Activity)(templateObject_8$9 || (templateObject_8$9 = __makeTemplateObject(["\n margin-left: 0.25rem;\n margin-right: 0.5rem;\n width: 16px;\n height: 16px;\n"], ["\n margin-left: 0.25rem;\n margin-right: 0.5rem;\n width: 16px;\n height: 16px;\n" + // we want the latest one to come first, so return negative if a is after b +]))); +// we want the latest one to come first, so return negative if a is after b +function newTransactionsFirst(a, b) { + return b.addedTime - a.addedTime; +} +function Sock() { + return (jsx("span", __assign({ role: "img", "aria-label": t(templateObject_9$8 || (templateObject_9$8 = __makeTemplateObject(["has socks emoji"], ["has socks emoji"]))), style: { marginTop: -4, marginBottom: -4 } }, { children: "\uD83E\uDDE6" }), void 0)); +} +function WrappedStatusIcon(_a) { + var connector = _a.connector; + return (jsx(IconWrapper, __assign({ size: 16 }, { children: jsx(StatusIcon, { connector: connector }, void 0) }), void 0)); +} +function Web3StatusInner() { + var _a = useWeb3React(), account = _a.account, connector = _a.connector, error = _a.error; + var ENSName = useENSName(account !== null && account !== void 0 ? account : undefined).ENSName; + var allTransactions = useAllTransactions(); + var sortedRecentTransactions = useMemo(function () { + var txs = Object.values(allTransactions); + return txs.filter(isTransactionRecent).sort(newTransactionsFirst); + }, [allTransactions]); + var pending = sortedRecentTransactions.filter(function (tx) { return !tx.receipt; }).map(function (tx) { return tx.hash; }); + var hasPendingTransactions = !!pending.length; + var hasSocks = useHasSocks(); + var toggleWalletModal = useWalletModalToggle(); + if (account) { + return (jsxs(Web3StatusConnected, __assign({ id: "web3-status-connected", onClick: toggleWalletModal, pending: hasPendingTransactions }, { children: [hasPendingTransactions ? (jsxs(RowBetween, { children: [jsx(Text, { children: jsxs(Trans, { children: [pending === null || pending === void 0 ? void 0 : pending.length, " Pending"] }, void 0) }, void 0), ' ', jsx(Loader, { stroke: "white" }, void 0)] }, void 0)) : (jsxs(Fragment, { children: [hasSocks ? jsx(Sock, {}, void 0) : null, jsx(Text, { children: ENSName || shortenAddress(account) }, void 0)] }, void 0)), !hasPendingTransactions && connector && jsx(WrappedStatusIcon, { connector: connector }, void 0)] }), void 0)); + } + else if (error) { + return (jsxs(Web3StatusError, __assign({ onClick: toggleWalletModal }, { children: [jsx(NetworkIcon, {}, void 0), jsx(Text, { children: error instanceof UnsupportedChainIdError ? jsx(Trans, { children: "Wrong Network" }, void 0) : jsx(Trans, { children: "Error" }, void 0) }, void 0)] }), void 0)); + } + else { + return (jsx(Web3StatusConnect, __assign({ id: "connect-wallet", onClick: toggleWalletModal, faded: !account }, { children: jsx(Text, { children: jsx(Trans, { children: "Connect Wallet" }, void 0) }, void 0) }), void 0)); + } +} +function Web3Status() { + var _a = useWeb3React(), active = _a.active, account = _a.account; + var contextNetwork = useWeb3React(NetworkContextName); + var ENSName = useENSName(account !== null && account !== void 0 ? account : undefined).ENSName; + var allTransactions = useAllTransactions(); + var sortedRecentTransactions = useMemo(function () { + var txs = Object.values(allTransactions); + return txs.filter(isTransactionRecent).sort(newTransactionsFirst); + }, [allTransactions]); + var pending = sortedRecentTransactions.filter(function (tx) { return !tx.receipt; }).map(function (tx) { return tx.hash; }); + var confirmed = sortedRecentTransactions.filter(function (tx) { return tx.receipt; }).map(function (tx) { return tx.hash; }); + return (jsxs(Fragment, { children: [jsx(Web3StatusInner, {}, void 0), (contextNetwork.active || active) && (jsx(WalletModal, { ENSName: ENSName !== null && ENSName !== void 0 ? ENSName : undefined, pendingTransactions: pending, confirmedTransactions: confirmed }, void 0))] }, void 0)); +} +var templateObject_1$T, templateObject_2$B, templateObject_3$v, templateObject_4$m, templateObject_5$i, templateObject_6$d, templateObject_7$b, templateObject_8$9, templateObject_9$8; + +var SantaHat = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAA3CAYAAACxUDzgAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAaGVYSWZNTQAqAAAACAAEAQYAAwAAAAEAAgAAARIAAwAAAAEAAQAAASgAAwAAAAEAAgAAh2kABAAAAAEAAAA+AAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAABGoAMABAAAAAEAAAA3AAAAAChoTFwAAALiaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA2LjAuMCI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjE8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOlBob3RvbWV0cmljSW50ZXJwcmV0YXRpb24+MjwvdGlmZjpQaG90b21ldHJpY0ludGVycHJldGF0aW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+NzA8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjE8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjU1PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Ckc5sDAAAA1xSURBVGgF5VsJVJRlF74D4wCyCyqrjqDgEiimhkguGJpLSAue3LI8lcuvlZobZmmpebSjx0RNzVRyATUFFwwRAYN+UBRFlkASkCWVRfad+f7nnYJGZr4Zlhl+Ot1zvjMf73rf+9333ufe90VAnUAcxwnWr1/vJBaLdYYNG1Y1cuTITIFAUNUJU7d7CmG7e7ay465duyxHjBgRmJSQ8HI39OFEIrKwtq51cnK6a2Vllaanp3dHIpHEBwcHx0JYja0cVuPNBJqcISIiwmDDhg1hwsRE169sbak3hFJQX0+pVVWUV1dHD2pq6HZlJaXj19TMrFIoFN6CwLL69u0bsWjRohAItFCT/CkbW6OCcXV13ZebkLA42MGBzLoxfZEnbDMql0gorbqaHkJAYaWllAzBlQiFDaampreHDBlyq1evXqHHjx8PhUbVy4+gmRKNCebDDz/8z8+BgXsOWlkJBurptYn7WggqG0JKgLAiIKgbeHRMTCr79+8fbmxsfGLjxo3R7u7u+W0atI2NNSKYjz766EV/f/+IL01MDL169GgjS/LNSxsa6B60KAoCiigvp1J9/XpQyPTp08+cOHHiJDSJk+/VsRK1C+bQoUM2W7ZsifKsrrbztbYmtU+A9cZXVNBPxcUUXVZGBVpaWQ4ODtcsLS39Q0NDf+mYOP7urVa+mVsePXp0UG1iolcA7IqOltbfM2ngrQ5bLhGadKKgQGqbdExN0wcMGHBy8+bNfq+88kpRR6ZUq2AmT57se/f69S0/OTqSDTxQZ1JJYyOdLyqigMJCyu/WrRpY6XjPnj33BgYG3msPH2oTzOLFi1/+KSDg2m5zc9FoQ8P28KKWPg3wcnew1fyhRdENDRJzC4sQGOotR48ejW3LBGoRDFypzerVq2Pekkj6rLCyasv8Gm2bBc/m9/gxhXNcw6BBgzbGxMRsba2h7rBgYFe0PD09o+ri4tx/sLcnoYbtSnsk+SuM9LLsbOo3dOjq+Pj4Ha0ZQ7s1jZS1SUxMXBMfFrbgewjFWKjxCEMZK7x1tjo65IDnh4yMl5ctW3YuNjZWJaLukGAWLlw4OvTy5aO7LC2FQ7p352WsK1T009WllIoKYVxenrC4uPiSKp7a7U+BGXpduXLF30ck0nE3MlI1T5eo9zEzo6KiojdPnz6t0mXy6v7WrVvNEKMMs7e3T5swYUKu7MoYXhk1atT2HoWF/T8GXvmnEPuAXHa2+fnz50eB52hlfCsUzKxZszz27t0bVFFRYaitrV2HYDAYaHb5xIkT89hga9euXfowIWH+2U4AccqYb2udSCCgYdjycXFxHuirVDByW8nb21t86dKlsxCO4ZMnTygyMlJUU1PjA6MVu2/fvinLly+3O3DgwKa1cMts3/7TiGkN1uOpim85d40wP7xfv34eFy9elPZFEokNRJ988glduHCBBWtlY+vrjbf37UvABKrG73L1KQgh3s7Lq0xOSelpa2tbzcfgc14J6NUbyaV1586dI3Nzc8rMzKQxY8ZQnz59aM2aNfT06VPB/YgI3f1wzd21n+vKN36XKzcBpPg+N1f05NmzGwkJCb/zMfjc6uDGLs6ZM6cHHml7AwMD0gJgW7duHV2/fp0uBAWRHyLmAW3Mr/BNrulylvgybYGttKHlvyB1kVFenllQUBDJx0OzjbGxsRlfVVXV/7PPPmtu2w1Zt6VLl9L9+/fphRdeIAlqrpaUUCHyI12dMpDkeicjg+phClrSBNiZyspK5pl4qVkwubm57yLeITP4+pbEttX27dsJiJEqJ06kKampdAiGmWXauipdxgccrq9P3RSEKGKg4JKSktEMdvDx3ywY2JEZQLJ87aTlAwcOpFOnTtGZsDAKw5aaBAGFPHtGmEBpv86uZBH2SaQf3lLwkRkvboj+BXV1Bps2bbLl461JMO8iHWnSvZWwfty4cRQdHU2ffvMNfY79OhcqmwrV7Sr0C4JGpsu9YF+8fvuNypGrkSXmOEwlEm04memy5bLvUsHAbc2fN2+ebLnK9yb7k5KSQi7z55P377+TLyLYgi5gf84iYWWP7TIHH8wVDgQoVW49o1AO8GonV/FXAROMeNq0aeMB//naKC1Hloz27NlDt+Lj6fHQoTQVgmJJoob/k/2pwbwsJ3wLD4uNfG1sFPI/AOAUcZObwkoUMsGMB6rlq291OQ7KKDw8nH44f54CsIenQ4VjoNKdTWzORrjknWIxrYUd5CNnmI2ysrJBCCjl1QmdtGbOnPnx4MGD+fq3uRxHGnT79m1aAi+2El9t8cOHlAE80Vl0Cd7oTVNTmqHi2IadddVVVxvduXNHoQHW6t279zB1M60LNWVamJSUREMXLaKZQNBf5eTQExzPapIqYGTDcfb0KgSjipgB7iGRaMGJjFTUVsvPzy97yZIlBNSrqL5DZQwTff311xQZF0eFbm70GrbX98A/mrI/LAmuC9zCtokqEmK7OQPnlJaWKtYY3DZwwxHDKdgIbv/+/VRbW6tqzDbXM/sThHDiaHAwBUCFPYF/IvFl1U1RsC9e0BYG+1tD7IgH8d8IRW21EAbkQ1tm4yRvLJBvEs5jCJk5YlG1umnKlCmEHDEt3LSJVsIWzH3wQHrjQV3z3ACmGtuGbKIjtjy2/RBF80txDKuAwYxGYsopJyfnHS8vr/ypU6dKF6GoU0fKoKHSSP3u3bvkDOzkA9uzMiuL2FFHRygdADMXV0ucWrGNmuZh+SSEBn2Tk5PlUp3NgmlqjIY/7ty5cxCyXH64n9Iwd+5cQhzVVK22XwSthCwh/Qr7Y+ztTbPy82kVBMTuzrSH/gtteRE2o2U0rWwsa2yl2spKI+SvDVq2U+jDsZVqkZy6IhKJfkxNTTUFgHOG7REgxUkM8aqTGECcMWMGvfbGG5QEoWyIiaEoxDm6sBN2+KJarbQXe/74g9JhH8uBvC3BI8u7qCJ9eKbDjx8LDMzMwpBByJRtr1AwTQ0aGhpK8AThFO9yWFiYGAICr7qCoUC4uP3U1Ewtv8yDse373nvvURkEcgCpjt1padKbV0yt2SK6w+MoyhqyoPEbaNz8Tz+le3DZO5OT6T6MOwsW9RRE17IMX0IQnFNREQcUfEu2XKlgmhrCcv8BjTmOK2ChCLysjh071l9HR0eANKjaNYglx1iQyiL9cZMmUR5sxvFHj2gbMBG7bcW0iqUnWRIqCxqSg+cGvNEVbCW2PWEn6WRAAH1x+DC5QsB9EDPxEfNdLHQoNzO7hfx2lGy71vk12R54R054ErJfXyBP47Zy5UrpItS9xVpMSQ+BoO/du0csaH0Ab5aNgLUOxhYXiAhbnvFEdnZ29NJLL0lzSh7ATbjQJ9W0lmPJ/v0FjP8VgeAYPv67suXtEkzTAPi6b4Oxz2EnBvn6+tIHH3yg9i3WNFdbfrdt20afg5+DENQEY2OlXY88fUrHhMKwrKysSbIN5bySbKWqd6htAIz0kPLy8pk4VrmLwzk6DBXWBEhUxYtsPewh2Ts6Ji3LyeFuY6soI2sYavArF212SDBsQnatArD6DAZ3gaGesWLFil9x9Yt2796tkTBD2SJZHXK50hQsgtn3zSwtt76PPFGmEozELiLgw1opS3OqmrPV9bhd6WpkZPSzhYUFt2rVKi4/Px/zdg6dPXuWw8XqR5hN+tERJO900NXl4p2duazhw+UeVm5oaFgVEhLy3AF8hzVGkbQyMjJiket4FXnkkd99991FGEZuwYIF9BuCSE0TBMPCmWvQZGlMc+TIkXWN1tbRW2BkGxXkpgUoq66o0APy7ynLm0YE0zTBzZs346GmXsAog5FEP4g4rIiBOZbQ0oQdwlaW5oLwQQKbeAA2qh0+fLhPlECQdRiRfUsyBj4yANaBrZQ/HmnZWFN/+/j49ESedT7c632mRTjD4h49YlqvHkpPT+dwm7wMORa5S4AeHh5uuiJR3RF7e+l2eujiwgU7OnL7wAdywhwOGbcjZrLQ1NpbPS4wxzQI6TQQdA2+KnfmzBkO2KhDEkLuh8PN8et8TDg7O6/HyQG3F8JAzoa15XDtlQOg5NiHgk0sx5WXrcBJ/KiQb3B1lyPcsGR4CKHGDRMTk9rx48dzCC45RPltFhIWxeGe8ZfKeITHTMIxEfftt99ySLc0z4GtxF29epUDeuZwy3OfsjE6vU4sFlvAHi2DJoXq6+sXwzZws2fP5nD9hIOac3DFHAxr82JkX4BcObZg/A/DQD7GYduscVRUx8bjI6BrDh+qsUPIl48BdZTj1oUQZ13uhYWFkxsbG8fA/TsjBDDEwrRYTAQhSkMBLEJ6MyMNASdiuCS0ceKb38XFZR7G8mfJer4gmIUYjo6OkeoNkfk4akc5tgW7ORD510MQkODgwYNGwEWOeLfC4iwBLMXQEn3cyGDaJMIR8jV2AYGP4CHH4Yocr1BYv2d/Hjkf67KCabk4hrBRxhLFN4GRmqtl35UJhXXAGMWqUrY4HCDETZHNE/wbXsaOHYvMZ/da2BqFJgbbl8OWDfo3yEJujbBNy2HYG3fs2MHBHkkFxDwSTiQ5eMUG5Jjc5Tr9Wwpwfc4T8CAe6RLJ66+/ziErwCGflIYYq/nS4v8AgsAjVwwQxfAAAAAASUVORK5CYII="; + +var SantaHatImage = styled.img(templateObject_1$S || (templateObject_1$S = __makeTemplateObject(["\n position: absolute;\n top: -4px;\n right: -4px;\n height: 18px;\n"], ["\n position: absolute;\n top: -4px;\n right: -4px;\n height: 18px;\n"]))); +var Christmas = jsx(SantaHatImage, { src: SantaHat, alt: "Santa hat" }, void 0); +var DATE_TO_ORNAMENT = { + '12-24': Christmas, + '12-25': Christmas, +}; +var HolidayOrnament = function () { + // months in javascript are 0 indexed... + var today = new Date().getMonth() + 1 + "-" + new Date().getDate(); + return DATE_TO_ORNAMENT[today] || null; +}; +var templateObject_1$S; + +var replaceURLParam = function (search, param, newValue) { + var searchParams = new URLSearchParams(search); + searchParams.set(param, newValue); + return searchParams.toString(); +}; + +// provider.request returns Promise, but wallet_switchEthereumChain must return null or throw +// see https://github.com/rekmarks/EIPs/blob/3326-create/EIPS/eip-3326.md for more info on wallet_switchEthereumChain +function switchToNetwork(_a) { + var _b; + var library = _a.library, chainId = _a.chainId; + return __awaiter(this, void 0, void 0, function () { + var formattedChainId, error_1, info, error_2; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + if (!((_b = library === null || library === void 0 ? void 0 : library.provider) === null || _b === void 0 ? void 0 : _b.request)) { + return [2 /*return*/]; + } + formattedChainId = hexStripZeros(BigNumber.from(chainId).toHexString()); + _c.label = 1; + case 1: + _c.trys.push([1, 3, , 11]); + return [4 /*yield*/, library.provider.request({ + method: 'wallet_switchEthereumChain', + params: [{ chainId: formattedChainId }], + })]; + case 2: + _c.sent(); + return [3 /*break*/, 11]; + case 3: + error_1 = _c.sent(); + if (!(error_1.code === 4902)) return [3 /*break*/, 9]; + info = CHAIN_INFO[chainId]; + return [4 /*yield*/, library.provider.request({ + method: 'wallet_addEthereumChain', + params: [ + { + chainId: formattedChainId, + chainName: info.label, + rpcUrls: [info.addNetworkInfo.rpcUrl], + nativeCurrency: info.addNetworkInfo.nativeCurrency, + blockExplorerUrls: [info.explorer], + }, + ], + }) + // metamask (only known implementer) automatically switches after a network is added + // the second call is done here because that behavior is not a part of the spec and cannot be relied upon in the future + // metamask's behavior when switching to the current network is just to return null (a no-op) + ]; + case 4: + _c.sent(); + _c.label = 5; + case 5: + _c.trys.push([5, 7, , 8]); + return [4 /*yield*/, library.provider.request({ + method: 'wallet_switchEthereumChain', + params: [{ chainId: formattedChainId }], + })]; + case 6: + _c.sent(); + return [3 /*break*/, 8]; + case 7: + error_2 = _c.sent(); + console.debug('Added network but could not switch chains', error_2); + return [3 /*break*/, 8]; + case 8: return [3 /*break*/, 10]; + case 9: throw error_1; + case 10: return [3 /*break*/, 11]; + case 11: return [2 /*return*/]; + } + }); + }); +} + +var ActiveRowLinkList = styled.div(templateObject_1$R || (templateObject_1$R = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n padding: 0 8px;\n & > a {\n align-items: center;\n color: ", ";\n display: flex;\n flex-direction: row;\n font-size: 14px;\n font-weight: 500;\n justify-content: space-between;\n padding: 8px 0 4px;\n text-decoration: none;\n }\n & > a:first-child {\n margin: 0;\n margin-top: 0px;\n padding-top: 10px;\n }\n"], ["\n display: flex;\n flex-direction: column;\n padding: 0 8px;\n & > a {\n align-items: center;\n color: ", ";\n display: flex;\n flex-direction: row;\n font-size: 14px;\n font-weight: 500;\n justify-content: space-between;\n padding: 8px 0 4px;\n text-decoration: none;\n }\n & > a:first-child {\n margin: 0;\n margin-top: 0px;\n padding-top: 10px;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var ActiveRowWrapper = styled.div(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 8px;\n cursor: pointer;\n padding: 8px;\n width: 100%;\n"], ["\n background-color: ", ";\n border-radius: 8px;\n cursor: pointer;\n padding: 8px;\n width: 100%;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}); +var FlyoutHeader = styled.div(templateObject_3$u || (templateObject_3$u = __makeTemplateObject(["\n color: ", ";\n font-weight: 400;\n"], ["\n color: ", ";\n font-weight: 400;\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var FlyoutMenu = styled.div(templateObject_4$l || (templateObject_4$l = __makeTemplateObject(["\n align-items: flex-start;\n background-color: ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 20px;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n overflow: auto;\n padding: 16px;\n position: absolute;\n top: 64px;\n width: 272px;\n z-index: 99;\n & > *:not(:last-child) {\n margin-bottom: 12px;\n }\n @media screen and (min-width: ", "px) {\n top: 50px;\n }\n"], ["\n align-items: flex-start;\n background-color: ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 20px;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n overflow: auto;\n padding: 16px;\n position: absolute;\n top: 64px;\n width: 272px;\n z-index: 99;\n & > *:not(:last-child) {\n margin-bottom: 12px;\n }\n @media screen and (min-width: ", "px) {\n top: 50px;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, MEDIA_WIDTHS.upToSmall); +var FlyoutRow = styled.div(templateObject_5$h || (templateObject_5$h = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n font-weight: 500;\n justify-content: space-between;\n padding: 6px 8px;\n text-align: left;\n width: 100%;\n"], ["\n align-items: center;\n background-color: ", ";\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n font-weight: 500;\n justify-content: space-between;\n padding: 6px 8px;\n text-align: left;\n width: 100%;\n"])), function (_a) { + var active = _a.active, theme = _a.theme; + return (active ? theme.bg1 : 'transparent'); +}); +var FlyoutRowActiveIndicator = styled.div(templateObject_6$c || (templateObject_6$c = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 50%;\n height: 9px;\n width: 9px;\n"], ["\n background-color: ", ";\n border-radius: 50%;\n height: 9px;\n width: 9px;\n"])), function (_a) { + var theme = _a.theme; + return theme.green1; +}); +var LinkOutCircle = styled(ArrowDownCircle)(templateObject_7$a || (templateObject_7$a = __makeTemplateObject(["\n transform: rotate(230deg);\n width: 16px;\n height: 16px;\n"], ["\n transform: rotate(230deg);\n width: 16px;\n height: 16px;\n"]))); +var Logo$1 = styled.img(templateObject_8$8 || (templateObject_8$8 = __makeTemplateObject(["\n height: 20px;\n width: 20px;\n margin-right: 8px;\n"], ["\n height: 20px;\n width: 20px;\n margin-right: 8px;\n"]))); +var NetworkLabel = styled.div(templateObject_9$7 || (templateObject_9$7 = __makeTemplateObject(["\n flex: 1 1 auto;\n"], ["\n flex: 1 1 auto;\n"]))); +var SelectorLabel = styled(NetworkLabel)(templateObject_10$5 || (templateObject_10$5 = __makeTemplateObject(["\n display: none;\n @media screen and (min-width: ", "px) {\n display: block;\n margin-right: 8px;\n }\n"], ["\n display: none;\n @media screen and (min-width: ", "px) {\n display: block;\n margin-right: 8px;\n }\n"])), MEDIA_WIDTHS.upToSmall); +var SelectorControls = styled.div(templateObject_11$4 || (templateObject_11$4 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border: 2px solid ", ";\n border-radius: 16px;\n color: ", ";\n cursor: ", ";\n display: flex;\n font-weight: 500;\n justify-content: space-between;\n padding: 6px 8px;\n"], ["\n align-items: center;\n background-color: ", ";\n border: 2px solid ", ";\n border-radius: 16px;\n color: ", ";\n cursor: ", ";\n display: flex;\n font-weight: 500;\n justify-content: space-between;\n padding: 6px 8px;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var interactive = _a.interactive; + return (interactive ? 'pointer' : 'auto'); +}); +var SelectorLogo = styled(Logo$1)(templateObject_12$4 || (templateObject_12$4 = __makeTemplateObject(["\n margin-right: ", "px;\n @media screen and (min-width: ", "px) {\n margin-right: 8px;\n }\n"], ["\n margin-right: ", "px;\n @media screen and (min-width: ", "px) {\n margin-right: 8px;\n }\n"])), function (_a) { + var interactive = _a.interactive; + return (interactive ? 8 : 0); +}, MEDIA_WIDTHS.upToSmall); +var SelectorWrapper = styled.div(templateObject_13$1 || (templateObject_13$1 = __makeTemplateObject(["\n @media screen and (min-width: ", "px) {\n position: relative;\n }\n"], ["\n @media screen and (min-width: ", "px) {\n position: relative;\n }\n"])), MEDIA_WIDTHS.upToSmall); +var StyledChevronDown = styled(ChevronDown)(templateObject_14$1 || (templateObject_14$1 = __makeTemplateObject(["\n width: 16px;\n"], ["\n width: 16px;\n"]))); +var BridgeLabel = function (_a) { + var chainId = _a.chainId; + switch (chainId) { + case SupportedChainId.ARBITRUM_ONE: + case SupportedChainId.ARBITRUM_RINKEBY: + return jsx(Trans, { children: "Arbitrum Bridge" }, void 0); + case SupportedChainId.OPTIMISM: + case SupportedChainId.OPTIMISTIC_KOVAN: + return jsx(Trans, { children: "Optimism Gateway" }, void 0); + case SupportedChainId.POLYGON: + case SupportedChainId.POLYGON_MUMBAI: + return jsx(Trans, { children: "Polygon Bridge" }, void 0); + default: + return jsx(Trans, { children: "Bridge" }, void 0); + } +}; +var ExplorerLabel = function (_a) { + var chainId = _a.chainId; + switch (chainId) { + case SupportedChainId.ARBITRUM_ONE: + case SupportedChainId.ARBITRUM_RINKEBY: + return jsx(Trans, { children: "Arbiscan" }, void 0); + case SupportedChainId.OPTIMISM: + case SupportedChainId.OPTIMISTIC_KOVAN: + return jsx(Trans, { children: "Optimistic Etherscan" }, void 0); + case SupportedChainId.POLYGON: + case SupportedChainId.POLYGON_MUMBAI: + return jsx(Trans, { children: "Polygonscan" }, void 0); + default: + return jsx(Trans, { children: "Etherscan" }, void 0); + } +}; +function Row(_a) { + var targetChain = _a.targetChain, onSelectChain = _a.onSelectChain; + var _b = useActiveWeb3React(), library = _b.library, chainId = _b.chainId; + if (!library || !chainId) { + return null; + } + var active = chainId === targetChain; + var _c = CHAIN_INFO[targetChain], helpCenterUrl = _c.helpCenterUrl, explorer = _c.explorer, bridge = _c.bridge, label = _c.label, logoUrl = _c.logoUrl; + var rowContent = (jsxs(FlyoutRow, __assign({ onClick: function () { return onSelectChain(targetChain); }, active: active }, { children: [jsx(Logo$1, { src: logoUrl }, void 0), jsx(NetworkLabel, { children: label }, void 0), chainId === targetChain && jsx(FlyoutRowActiveIndicator, {}, void 0)] }), void 0)); + if (active) { + return (jsxs(ActiveRowWrapper, { children: [rowContent, jsxs(ActiveRowLinkList, { children: [bridge ? (jsxs(ExternalLink, __assign({ href: bridge }, { children: [jsx(BridgeLabel, { chainId: chainId }, void 0), " ", jsx(LinkOutCircle, {}, void 0)] }), void 0)) : null, explorer ? (jsxs(ExternalLink, __assign({ href: explorer }, { children: [jsx(ExplorerLabel, { chainId: chainId }, void 0), " ", jsx(LinkOutCircle, {}, void 0)] }), void 0)) : null, helpCenterUrl ? (jsxs(ExternalLink, __assign({ href: helpCenterUrl }, { children: [jsx(Trans, { children: "Help Center" }, void 0), " ", jsx(LinkOutCircle, {}, void 0)] }), void 0)) : null] }, void 0)] }, void 0)); + } + return rowContent; +} +var getParsedChainId = function (parsedQs) { + var chain = parsedQs === null || parsedQs === void 0 ? void 0 : parsedQs.chain; + if (!chain || typeof chain !== 'string') + return { urlChain: undefined, urlChainId: undefined }; + return { urlChain: chain.toLowerCase(), urlChainId: getChainIdFromName(chain) }; +}; +var getChainIdFromName = function (name) { + var entry = Object.entries(CHAIN_IDS_TO_NAMES).find(function (_a) { + var _b = __read(_a, 2); _b[0]; var n = _b[1]; + return n === name; + }); + var chainId = entry === null || entry === void 0 ? void 0 : entry[0]; + return chainId ? parseInt(chainId) : undefined; +}; +var getChainNameFromId = function (id) { + // casting here may not be right but fine to return undefined if it's not a supported chain ID + return CHAIN_IDS_TO_NAMES[id] || ''; +}; +function NetworkSelector() { + var _a = useActiveWeb3React(), chainId = _a.chainId, library = _a.library; + var parsedQs = useParsedQueryString(); + var _b = getParsedChainId(parsedQs), urlChain = _b.urlChain, urlChainId = _b.urlChainId; + var prevChainId = usePrevious(chainId); + var node = useRef(); + var open = useModalOpen(ApplicationModal.NETWORK_SELECTOR); + var toggle = useToggleModal(ApplicationModal.NETWORK_SELECTOR); + useOnClickOutside(node, open ? toggle : undefined); + var history = useHistory(); + var info = chainId ? CHAIN_INFO[chainId] : undefined; + var dispatch = useAppDispatch(); + var handleChainSwitch = useCallback(function (targetChain, skipToggle) { + if (!library) + return; + switchToNetwork({ library: library, chainId: targetChain }) + .then(function () { + if (!skipToggle) { + toggle(); + } + history.replace({ + search: replaceURLParam(history.location.search, 'chain', getChainNameFromId(targetChain)), + }); + }) + .catch(function (error) { + console.error('Failed to switch networks', error); + // we want app network <-> chainId param to be in sync, so if user changes the network by changing the URL + // but the request fails, revert the URL back to current chainId + if (chainId) { + history.replace({ search: replaceURLParam(history.location.search, 'chain', getChainNameFromId(chainId)) }); + } + if (!skipToggle) { + toggle(); + } + dispatch(addPopup({ content: { failedSwitchNetwork: targetChain }, key: "failed-network-switch" })); + }); + }, [dispatch, library, toggle, history, chainId]); + useEffect(function () { + if (!chainId || !prevChainId) + return; + // when network change originates from wallet or dropdown selector, just update URL + if (chainId !== prevChainId) { + history.replace({ search: replaceURLParam(history.location.search, 'chain', getChainNameFromId(chainId)) }); + // otherwise assume network change originates from URL + } + else if (urlChainId && urlChainId !== chainId) { + handleChainSwitch(urlChainId, true); + } + }, [chainId, urlChainId, prevChainId, handleChainSwitch, history]); + // set chain parameter on initial load if not there + useEffect(function () { + if (chainId && !urlChainId) { + history.replace({ search: replaceURLParam(history.location.search, 'chain', getChainNameFromId(chainId)) }); + } + }, [chainId, history, urlChainId, urlChain]); + if (!chainId || !info || !library) { + return null; + } + return (jsxs(SelectorWrapper, __assign({ ref: node }, { children: [jsxs(SelectorControls, __assign({ onClick: toggle, interactive: true }, { children: [jsx(SelectorLogo, { interactive: true, src: info.logoUrl }, void 0), jsx(SelectorLabel, { children: info.label }, void 0), jsx(StyledChevronDown, {}, void 0)] }), void 0), open && (jsxs(FlyoutMenu, __assign({ onMouseLeave: toggle }, { children: [jsx(FlyoutHeader, { children: jsx(Trans, { children: "Select a network" }, void 0) }, void 0), jsx(Row, { onSelectChain: handleChainSwitch, targetChain: SupportedChainId.MAINNET }, void 0), jsx(Row, { onSelectChain: handleChainSwitch, targetChain: SupportedChainId.POLYGON }, void 0), jsx(Row, { onSelectChain: handleChainSwitch, targetChain: SupportedChainId.OPTIMISM }, void 0), jsx(Row, { onSelectChain: handleChainSwitch, targetChain: SupportedChainId.ARBITRUM_ONE }, void 0)] }), void 0))] }), void 0)); +} +var templateObject_1$R, templateObject_2$A, templateObject_3$u, templateObject_4$l, templateObject_5$h, templateObject_6$c, templateObject_7$a, templateObject_8$8, templateObject_9$7, templateObject_10$5, templateObject_11$4, templateObject_12$4, templateObject_13$1, templateObject_14$1; + +var HeaderFrame = styled.div(templateObject_4$k || (templateObject_4$k = __makeTemplateObject(["\n display: grid;\n grid-template-columns: 120px 1fr 120px;\n align-items: center;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n top: 0;\n position: relative;\n padding: 1rem;\n z-index: 21;\n position: relative;\n /* Background slide effect on scroll. */\n background-image: ", ";\n background-position: ", ";\n background-size: 100% 200%;\n box-shadow: 0px 0px 0px 1px ", ";\n transition: background-position 0.1s, box-shadow 0.1s;\n background-blend-mode: hard-light;\n\n ", ";\n\n ", ";\n\n ", ";\n"], ["\n display: grid;\n grid-template-columns: 120px 1fr 120px;\n align-items: center;\n justify-content: space-between;\n align-items: center;\n flex-direction: row;\n width: 100%;\n top: 0;\n position: relative;\n padding: 1rem;\n z-index: 21;\n position: relative;\n /* Background slide effect on scroll. */\n background-image: ", ";\n background-position: ", ";\n background-size: 100% 200%;\n box-shadow: 0px 0px 0px 1px ", ";\n transition: background-position 0.1s, box-shadow 0.1s;\n background-blend-mode: hard-light;\n\n ", ";\n\n ", ";\n\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return "linear-gradient(to bottom, transparent 50%, " + theme.bg0 + " 50% )}}"; +}, function (_a) { + var showBackground = _a.showBackground; + return (showBackground ? '0 -100%' : '0 0'); +}, function (_a) { + var theme = _a.theme, showBackground = _a.showBackground; + return (showBackground ? theme.bg2 : 'transparent;'); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToLarge(templateObject_1$Q || (templateObject_1$Q = __makeTemplateObject(["\n grid-template-columns: 48px 1fr 1fr;\n "], ["\n grid-template-columns: 48px 1fr 1fr;\n "]))); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["\n padding: 1rem;\n grid-template-columns: 1fr 1fr;\n "], ["\n padding: 1rem;\n grid-template-columns: 1fr 1fr;\n "]))); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_3$t || (templateObject_3$t = __makeTemplateObject(["\n padding: 1rem;\n grid-template-columns: 36px 1fr;\n "], ["\n padding: 1rem;\n grid-template-columns: 36px 1fr;\n "]))); +}); +var HeaderControls = styled.div(templateObject_5$g || (templateObject_5$g = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-self: flex-end;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-self: flex-end;\n"]))); +var HeaderElement = styled.div(templateObject_7$9 || (templateObject_7$9 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n\n &:not(:first-child) {\n margin-left: 0.5em;\n }\n\n /* addresses safari's lack of support for \"gap\" */\n & > *:not(:first-child) {\n margin-left: 8px;\n }\n\n ", ";\n"], ["\n display: flex;\n align-items: center;\n\n &:not(:first-child) {\n margin-left: 0.5em;\n }\n\n /* addresses safari's lack of support for \"gap\" */\n & > *:not(:first-child) {\n margin-left: 8px;\n }\n\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_6$b || (templateObject_6$b = __makeTemplateObject(["\n align-items: center;\n "], ["\n align-items: center;\n "]))); +}); +var HeaderLinks = styled(Row$1)(templateObject_11$3 || (templateObject_11$3 = __makeTemplateObject(["\n justify-self: center;\n background-color: ", ";\n width: fit-content;\n padding: 2px;\n border-radius: 16px;\n display: grid;\n grid-auto-flow: column;\n grid-gap: 10px;\n overflow: auto;\n align-items: center;\n ", ";\n ", ";\n ", ";\n"], ["\n justify-self: center;\n background-color: ", ";\n width: fit-content;\n padding: 2px;\n border-radius: 16px;\n display: grid;\n grid-auto-flow: column;\n grid-gap: 10px;\n overflow: auto;\n align-items: center;\n ", ";\n ", ";\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToLarge(templateObject_8$7 || (templateObject_8$7 = __makeTemplateObject(["\n justify-self: start; \n "], ["\n justify-self: start; \n "]))); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_9$6 || (templateObject_9$6 = __makeTemplateObject(["\n justify-self: center;\n "], ["\n justify-self: center;\n "]))); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_10$4 || (templateObject_10$4 = __makeTemplateObject(["\n flex-direction: row;\n justify-content: space-between;\n justify-self: center;\n z-index: 99;\n position: fixed;\n bottom: 0; right: 50%;\n transform: translate(50%,-50%);\n margin: 0 auto;\n background-color: ", ";\n border: 1px solid ", ";\n box-shadow: 0px 6px 10px rgb(0 0 0 / 2%);\n "], ["\n flex-direction: row;\n justify-content: space-between;\n justify-self: center;\n z-index: 99;\n position: fixed;\n bottom: 0; right: 50%;\n transform: translate(50%,-50%);\n margin: 0 auto;\n background-color: ", ";\n border: 1px solid ", ";\n box-shadow: 0px 6px 10px rgb(0 0 0 / 2%);\n "])), function (_a) { + var theme = _a.theme; + return theme.bg0; + }, function (_a) { + var theme = _a.theme; + return theme.bg2; + }); +}); +var AccountElement = styled.div(templateObject_12$3 || (templateObject_12$3 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n border-radius: 16px;\n white-space: nowrap;\n width: 100%;\n height: 40px;\n\n :focus {\n border: 1px solid blue;\n }\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n border-radius: 16px;\n white-space: nowrap;\n width: 100%;\n height: 40px;\n\n :focus {\n border: 1px solid blue;\n }\n"])), function (_a) { + var theme = _a.theme, active = _a.active; + return (!active ? theme.bg0 : theme.bg0); +}); +var UNIAmount = styled(AccountElement)(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n color: white;\n padding: 4px 8px;\n height: 36px;\n font-weight: 500;\n background-color: ", ";\n background: radial-gradient(174.47% 188.91% at 1.84% 0%, #ff007a 0%, #2172e5 100%), #edeef2;\n"], ["\n color: white;\n padding: 4px 8px;\n height: 36px;\n font-weight: 500;\n background-color: ", ";\n background: radial-gradient(174.47% 188.91% at 1.84% 0%, #ff007a 0%, #2172e5 100%), #edeef2;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var UNIWrapper = styled.span(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n width: fit-content;\n position: relative;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n\n :active {\n opacity: 0.9;\n }\n"], ["\n width: fit-content;\n position: relative;\n cursor: pointer;\n\n :hover {\n opacity: 0.8;\n }\n\n :active {\n opacity: 0.9;\n }\n"]))); +var BalanceText = styled(Text$1)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToExtraSmall(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "]))); +}); +var Title = styled.a(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n pointer-events: auto;\n justify-self: flex-start;\n margin-right: 12px;\n ", ";\n :hover {\n cursor: pointer;\n }\n"], ["\n display: flex;\n align-items: center;\n pointer-events: auto;\n justify-self: flex-start;\n margin-right: 12px;\n ", ";\n :hover {\n cursor: pointer;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n justify-self: center;\n "], ["\n justify-self: center;\n "]))); +}); +var UniIcon = styled.div(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n transition: transform 0.3s ease;\n :hover {\n transform: rotate(-5deg);\n }\n\n position: relative;\n"], ["\n transition: transform 0.3s ease;\n :hover {\n transform: rotate(-5deg);\n }\n\n position: relative;\n"]))); +var activeClassName = 'ACTIVE'; +var StyledNavLink = styled(NavLink).attrs({ + activeClassName: activeClassName, +})(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n ", "\n align-items: left;\n border-radius: 3rem;\n outline: none;\n cursor: pointer;\n text-decoration: none;\n color: ", ";\n font-size: 1rem;\n font-weight: 500;\n padding: 8px 12px;\n word-break: break-word;\n overflow: hidden;\n white-space: nowrap;\n &.", " {\n border-radius: 14px;\n font-weight: 600;\n justify-content: center;\n color: ", ";\n background-color: ", ";\n }\n\n :hover,\n :focus {\n color: ", ";\n }\n"], ["\n ", "\n align-items: left;\n border-radius: 3rem;\n outline: none;\n cursor: pointer;\n text-decoration: none;\n color: ", ";\n font-size: 1rem;\n font-weight: 500;\n padding: 8px 12px;\n word-break: break-word;\n overflow: hidden;\n white-space: nowrap;\n &.", " {\n border-radius: 14px;\n font-weight: 600;\n justify-content: center;\n color: ", ";\n background-color: ", ";\n }\n\n :hover,\n :focus {\n color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}, activeClassName, function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return darken(0.1, theme.text1); +}); +var StyledExternalLink = styled(ExternalLink).attrs({ + activeClassName: activeClassName, +})(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n ", "\n align-items: left;\n border-radius: 3rem;\n outline: none;\n cursor: pointer;\n text-decoration: none;\n color: ", ";\n font-size: 1rem;\n width: fit-content;\n margin: 0 12px;\n font-weight: 500;\n\n &.", " {\n border-radius: 14px;\n font-weight: 600;\n color: ", ";\n }\n\n :hover,\n :focus {\n color: ", ";\n text-decoration: none;\n }\n"], ["\n ", "\n align-items: left;\n border-radius: 3rem;\n outline: none;\n cursor: pointer;\n text-decoration: none;\n color: ", ";\n font-size: 1rem;\n width: fit-content;\n margin: 0 12px;\n font-weight: 500;\n\n &.", " {\n border-radius: 14px;\n font-weight: 600;\n color: ", ";\n }\n\n :hover,\n :focus {\n color: ", ";\n text-decoration: none;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}, activeClassName, function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return darken(0.1, theme.text1); +}); +function Header$2() { + var _a; + var _b = useActiveWeb3React(), account = _b.account, chainId = _b.chainId; + var userEthBalance = (_a = useNativeCurrencyBalances(account ? [account] : [])) === null || _a === void 0 ? void 0 : _a[account !== null && account !== void 0 ? account : '']; + var _c = __read(useDarkModeManager(), 1), darkMode = _c[0]; + var _d = useTheme(), white = _d.white, black = _d.black; + var toggleClaimModal = useToggleSelfClaimModal(); + var availableClaim = useUserHasAvailableClaim(account); + var claimTxn = useUserHasSubmittedClaim(account !== null && account !== void 0 ? account : undefined).claimTxn; + var showClaimPopup = useShowClaimPopup(); + var scrollY = useScrollPosition(); + var _e = CHAIN_INFO[chainId ? chainId : SupportedChainId.MAINNET], infoLink = _e.infoLink, nativeCurrencySymbol = _e.addNetworkInfo.nativeCurrency.symbol; + return (jsxs(HeaderFrame, __assign({ showBackground: scrollY > 45 }, { children: [jsx(ClaimModal, {}, void 0), jsx(Title, __assign({ href: "." }, { children: jsxs(UniIcon, { children: [jsx(SvgLogo, { fill: darkMode ? white : black, width: "24px", height: "100%", title: "logo" }, void 0), jsx(HolidayOrnament, {}, void 0)] }, void 0) }), void 0), jsxs(HeaderLinks, { children: [jsx(StyledNavLink, __assign({ id: "swap-nav-link", to: '/swap' }, { children: jsx(Trans, { children: "Swap" }, void 0) }), void 0), jsx(StyledNavLink, __assign({ id: "pool-nav-link", to: '/pool', isActive: function (match, _a) { + var pathname = _a.pathname; + return Boolean(match) || + pathname.startsWith('/add') || + pathname.startsWith('/remove') || + pathname.startsWith('/increase') || + pathname.startsWith('/find'); + } }, { children: jsx(Trans, { children: "Pool" }, void 0) }), void 0), (!chainId || chainId === SupportedChainId.MAINNET) && (jsx(StyledNavLink, __assign({ id: "vote-nav-link", to: '/vote' }, { children: jsx(Trans, { children: "Vote" }, void 0) }), void 0)), jsxs(StyledExternalLink, __assign({ id: "charts-nav-link", href: infoLink }, { children: [jsx(Trans, { children: "Charts" }, void 0), jsx("sup", { children: "\u2197" }, void 0)] }), void 0)] }, void 0), jsxs(HeaderControls, { children: [jsx(HeaderElement, { children: jsx(NetworkSelector, {}, void 0) }, void 0), jsxs(HeaderElement, { children: [availableClaim && !showClaimPopup && (jsxs(UNIWrapper, __assign({ onClick: toggleClaimModal }, { children: [jsx(UNIAmount, __assign({ active: !!account && !availableClaim, style: { pointerEvents: 'auto' } }, { children: jsx(ThemedText.White, __assign({ padding: "0 2px" }, { children: claimTxn && !(claimTxn === null || claimTxn === void 0 ? void 0 : claimTxn.receipt) ? (jsx(Dots, { children: jsx(Trans, { children: "Claiming UNI" }, void 0) }, void 0)) : (jsx(Trans, { children: "Claim UNI" }, void 0)) }), void 0) }), void 0), jsx(CardNoise, {}, void 0)] }), void 0)), jsxs(AccountElement, __assign({ active: !!account }, { children: [account && userEthBalance ? (jsx(BalanceText, __assign({ style: { flexShrink: 0, userSelect: 'none' }, pl: "0.75rem", pr: "0.5rem", fontWeight: 500 }, { children: jsxs(Trans, { children: [userEthBalance === null || userEthBalance === void 0 ? void 0 : userEthBalance.toSignificant(3), " ", nativeCurrencySymbol] }, void 0) }), void 0)) : null, jsx(Web3Status, {}, void 0)] }), void 0)] }, void 0), jsx(HeaderElement, { children: jsx(Menu, {}, void 0) }, void 0)] }, void 0)] }), void 0)); +} +var templateObject_1$Q, templateObject_2$z, templateObject_3$t, templateObject_4$k, templateObject_5$g, templateObject_6$b, templateObject_7$9, templateObject_8$7, templateObject_9$6, templateObject_10$4, templateObject_11$3, templateObject_12$3, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21; + +var useMachineTimeMs = function (updateInterval) { + var _a = __read(useState(Date.now()), 2), now = _a[0], setNow = _a[1]; + useInterval(function () { + setNow(Date.now()); + }, updateInterval); + return now; +}; + +var BodyRow = styled.div(templateObject_1$P || (templateObject_1$P = __makeTemplateObject(["\n color: ", ";\n font-size: 12px;\n"], ["\n color: ", ";\n font-size: 12px;\n"])), function (_a) { + var theme = _a.theme; + return theme.black; +}); +var CautionIcon = styled(AlertOctagon)(templateObject_2$y || (templateObject_2$y = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.black; +}); +var Link = styled(ExternalLink)(templateObject_3$s || (templateObject_3$s = __makeTemplateObject(["\n color: ", ";\n text-decoration: underline;\n"], ["\n color: ", ";\n text-decoration: underline;\n"])), function (_a) { + var theme = _a.theme; + return theme.black; +}); +var TitleRow = styled.div(templateObject_4$j || (templateObject_4$j = __makeTemplateObject(["\n align-items: center;\n display: flex;\n justify-content: flex-start;\n margin-bottom: 8px;\n"], ["\n align-items: center;\n display: flex;\n justify-content: flex-start;\n margin-bottom: 8px;\n"]))); +var TitleText = styled.div(templateObject_5$f || (templateObject_5$f = __makeTemplateObject(["\n color: black;\n font-weight: 600;\n font-size: 16px;\n line-height: 20px;\n margin: 0px 12px;\n"], ["\n color: black;\n font-weight: 600;\n font-size: 16px;\n line-height: 20px;\n margin: 0px 12px;\n"]))); +var Wrapper$e = styled.div(templateObject_6$a || (templateObject_6$a = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 12px;\n bottom: 60px;\n display: none;\n max-width: 348px;\n padding: 16px 20px;\n position: absolute;\n right: 16px;\n @media screen and (min-width: ", "px) {\n display: block;\n }\n"], ["\n background-color: ", ";\n border-radius: 12px;\n bottom: 60px;\n display: none;\n max-width: 348px;\n padding: 16px 20px;\n position: absolute;\n right: 16px;\n @media screen and (min-width: ", "px) {\n display: block;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.yellow3; +}, MEDIA_WIDTHS.upToMedium); +function ChainConnectivityWarning() { + var chainId = useActiveWeb3React().chainId; + var info = CHAIN_INFO[chainId !== null && chainId !== void 0 ? chainId : SupportedChainId.MAINNET]; + var label = info === null || info === void 0 ? void 0 : info.label; + return (jsxs(Wrapper$e, { children: [jsxs(TitleRow, { children: [jsx(CautionIcon, {}, void 0), jsx(TitleText, { children: jsx(Trans, { children: "Network Warning" }, void 0) }, void 0)] }, void 0), jsxs(BodyRow, { children: [chainId === SupportedChainId.MAINNET ? (jsx(Trans, { children: "You may have lost your network connection." }, void 0)) : (jsxs(Trans, { children: ["You may have lost your network connection, or ", label, " might be down right now."] }, void 0)), ' ', info.statusPage !== undefined && (jsxs("span", { children: [jsx(Trans, { children: "Check network status" }, void 0), ' ', jsx(Link, __assign({ href: info.statusPage || '' }, { children: jsx(Trans, { children: "here." }, void 0) }), void 0)] }, void 0))] }, void 0)] }, void 0)); +} +var templateObject_1$P, templateObject_2$y, templateObject_3$s, templateObject_4$j, templateObject_5$f, templateObject_6$a; + +var StyledPolling$1 = styled.div(templateObject_2$x || (templateObject_2$x = __makeTemplateObject(["\n position: fixed;\n display: flex;\n align-items: center;\n right: 0;\n bottom: 0;\n padding: 1rem;\n color: ", ";\n transition: 250ms ease color;\n\n ", "\n"], ["\n position: fixed;\n display: flex;\n align-items: center;\n right: 0;\n bottom: 0;\n padding: 1rem;\n color: ", ";\n transition: 250ms ease color;\n\n ", "\n"])), function (_a) { + var theme = _a.theme, warning = _a.warning; + return (warning ? theme.yellow3 : theme.green1); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_1$O || (templateObject_1$O = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "]))); +}); +var StyledPollingNumber = styled(ThemedText.Small)(templateObject_3$r || (templateObject_3$r = __makeTemplateObject(["\n transition: opacity 0.25s ease;\n opacity: ", ";\n :hover {\n opacity: 1;\n }\n\n a {\n color: unset;\n }\n a:hover {\n text-decoration: none;\n color: unset;\n }\n"], ["\n transition: opacity 0.25s ease;\n opacity: ", ";\n :hover {\n opacity: 1;\n }\n\n a {\n color: unset;\n }\n a:hover {\n text-decoration: none;\n color: unset;\n }\n"])), function (_a) { + var breathe = _a.breathe, hovering = _a.hovering; + return (hovering ? 0.7 : breathe ? 1 : 0.5); +}); +var StyledPollingDot$1 = styled.div(templateObject_4$i || (templateObject_4$i = __makeTemplateObject(["\n width: 8px;\n height: 8px;\n min-height: 8px;\n min-width: 8px;\n border-radius: 50%;\n position: relative;\n background-color: ", ";\n transition: 250ms ease background-color;\n"], ["\n width: 8px;\n height: 8px;\n min-height: 8px;\n min-width: 8px;\n border-radius: 50%;\n position: relative;\n background-color: ", ";\n transition: 250ms ease background-color;\n"])), function (_a) { + var theme = _a.theme, warning = _a.warning; + return (warning ? theme.yellow3 : theme.green1); +}); +var StyledGasDot = styled.div(templateObject_5$e || (templateObject_5$e = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 50%;\n height: 4px;\n min-height: 4px;\n min-width: 4px;\n position: relative;\n transition: 250ms ease background-color;\n width: 4px;\n"], ["\n background-color: ", ";\n border-radius: 50%;\n height: 4px;\n min-height: 4px;\n min-width: 4px;\n position: relative;\n transition: 250ms ease background-color;\n width: 4px;\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}); +var rotate360$1 = keyframes(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n"], ["\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n"]))); +var Spinner$1 = styled.div(templateObject_7$8 || (templateObject_7$8 = __makeTemplateObject(["\n animation: ", " 1s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n transform: translateZ(0);\n\n border-top: 1px solid transparent;\n border-right: 1px solid transparent;\n border-bottom: 1px solid transparent;\n border-left: 2px solid ", ";\n background: transparent;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n position: relative;\n transition: 250ms ease border-color;\n\n left: -3px;\n top: -3px;\n"], ["\n animation: ", " 1s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n transform: translateZ(0);\n\n border-top: 1px solid transparent;\n border-right: 1px solid transparent;\n border-bottom: 1px solid transparent;\n border-left: 2px solid ", ";\n background: transparent;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n position: relative;\n transition: 250ms ease border-color;\n\n left: -3px;\n top: -3px;\n"])), rotate360$1, function (_a) { + var theme = _a.theme, warning = _a.warning; + return (warning ? theme.yellow3 : theme.green1); +}); +var DEFAULT_MS_BEFORE_WARNING = ms(templateObject_8$6 || (templateObject_8$6 = __makeTemplateObject(["10m"], ["10m"]))); +var NETWORK_HEALTH_CHECK_MS = ms(templateObject_9$5 || (templateObject_9$5 = __makeTemplateObject(["10s"], ["10s"]))); +function Polling() { + var _a, _b; + var chainId = useActiveWeb3React().chainId; + var blockNumber = useBlockNumber(); + var _c = __read(useState(false), 2), isMounting = _c[0], setIsMounting = _c[1]; + var _d = __read(useState(false), 2), isHover = _d[0], setIsHover = _d[1]; + var machineTime = useMachineTimeMs(NETWORK_HEALTH_CHECK_MS); + var blockTime = useCurrentBlockTimestamp(); + var theme = useTheme(); + var ethGasPrice = useGasPrice(); + var priceGwei = ethGasPrice ? JSBI.divide(ethGasPrice, JSBI.BigInt(1000000000)) : undefined; + var waitMsBeforeWarning = (_b = (chainId ? (_a = CHAIN_INFO[chainId]) === null || _a === void 0 ? void 0 : _a.blockWaitMsBeforeWarning : DEFAULT_MS_BEFORE_WARNING)) !== null && _b !== void 0 ? _b : DEFAULT_MS_BEFORE_WARNING; + var warning = Boolean(!!blockTime && machineTime - blockTime.mul(1000).toNumber() > waitMsBeforeWarning); + useEffect(function () { + if (!blockNumber) { + return; + } + setIsMounting(true); + var mountingTimer = setTimeout(function () { return setIsMounting(false); }, 1000); + // this will clear Timeout when component unmount like in willComponentUnmount + return function () { + clearTimeout(mountingTimer); + }; + }, [blockNumber] //useEffect will run only one time + //if you pass a value to array, like this [data] than clearTimeout will run every time this value changes (useEffect re-run) + ); + //TODO - chainlink gas oracle is really slow. Can we get a better data source? + return (jsx(Fragment, { children: jsxs(RowFixed, { children: [jsxs(StyledPolling$1, __assign({ onMouseEnter: function () { return setIsHover(true); }, onMouseLeave: function () { return setIsHover(false); }, warning: warning }, { children: [jsx(ExternalLink, __assign({ href: 'https://etherscan.io/gastracker' }, { children: priceGwei ? (jsxs(RowFixed, __assign({ style: { marginRight: '8px' } }, { children: [jsx(ThemedText.Main, __assign({ fontSize: "11px", mr: "8px", color: theme.text3 }, { children: jsxs(MouseoverTooltip, __assign({ text: jsx(Trans, { children: "The current fast gas amount for sending a transaction on L1. Gas fees are paid in Ethereum's native currency Ether (ETH) and denominated in GWEI." }, void 0) }, { children: [priceGwei.toString(), " ", jsx(Trans, { children: "gwei" }, void 0)] }), void 0) }), void 0), jsx(StyledGasDot, {}, void 0)] }), void 0)) : null }), void 0), jsx(StyledPollingNumber, __assign({ breathe: isMounting, hovering: isHover }, { children: jsx(ExternalLink, __assign({ href: chainId && blockNumber ? getExplorerLink(chainId, blockNumber.toString(), ExplorerDataType.BLOCK) : '' }, { children: jsxs(MouseoverTooltip, __assign({ text: jsx(Trans, { children: "The most recent block number on this network. Prices update on every block." }, void 0) }, { children: [blockNumber, "\u2002"] }), void 0) }), void 0) }), void 0), jsx(StyledPollingDot$1, __assign({ warning: warning }, { children: isMounting && jsx(Spinner$1, { warning: warning }, void 0) }), void 0), ' '] }), void 0), warning && jsx(ChainConnectivityWarning, {}, void 0)] }, void 0) }, void 0)); +} +var templateObject_1$O, templateObject_2$x, templateObject_3$r, templateObject_4$i, templateObject_5$e, templateObject_6$9, templateObject_7$8, templateObject_8$6, templateObject_9$5; + +var StyledClaimPopup = styled(AutoColumn)(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #021d43 100%);\n border-radius: 20px;\n padding: 1.5rem;\n overflow: hidden;\n position: relative;\n max-width: 360px;\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n"], ["\n background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #021d43 100%);\n border-radius: 20px;\n padding: 1.5rem;\n overflow: hidden;\n position: relative;\n max-width: 360px;\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n"]))); +var StyledClose$1 = styled(X)(templateObject_2$w || (templateObject_2$w = __makeTemplateObject(["\n position: absolute;\n right: 10px;\n top: 10px;\n\n :hover {\n cursor: pointer;\n }\n"], ["\n position: absolute;\n right: 10px;\n top: 10px;\n\n :hover {\n cursor: pointer;\n }\n"]))); +var rotate = keyframes(templateObject_3$q || (templateObject_3$q = __makeTemplateObject(["\n 0% {\n transform: perspective(1000px) rotateY(0deg);\n }\n\n 100% {\n transform: perspective(1000px) rotateY(360deg);\n }\n"], ["\n 0% {\n transform: perspective(1000px) rotateY(0deg);\n }\n\n 100% {\n transform: perspective(1000px) rotateY(360deg);\n }\n"]))); +var UniToken = styled.img(templateObject_4$h || (templateObject_4$h = __makeTemplateObject(["\n animation: ", " 5s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n"], ["\n animation: ", " 5s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n"])), rotate); +function ClaimPopup() { + var _a; + var account = useActiveWeb3React().account; + // dont store these in persisted state yet + var showClaimPopup = useShowClaimPopup(); + var toggleShowClaimPopup = useToggleShowClaimPopup(); + // toggle for showing this modal + var showClaimModal = useModalOpen(ApplicationModal.SELF_CLAIM); + var toggleSelfClaimModal = useToggleSelfClaimModal(); + var handleToggleSelfClaimModal = useCallback(function () { + ReactGA.event({ + category: 'MerkleDrop', + action: 'Toggle self claim modal', + }); + toggleSelfClaimModal(); + }, [toggleSelfClaimModal]); + // const userHasAvailableclaim = useUserHasAvailableClaim() + var userHasAvailableclaim = useUserHasAvailableClaim(account); + var unclaimedAmount = useUserUnclaimedAmount(account); + // listen for available claim and show popup if needed + useEffect(function () { + if (userHasAvailableclaim) { + ReactGA.event({ + category: 'MerkleDrop', + action: 'Show claim popup', + }); + toggleShowClaimPopup(); + } + // the toggleShowClaimPopup function changes every time the popup changes, so this will cause an infinite loop. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [userHasAvailableclaim]); + return (jsx(Fragment, { children: showClaimPopup && !showClaimModal && (jsxs(StyledClaimPopup, __assign({ gap: "md" }, { children: [jsx(CardBGImage, {}, void 0), jsx(CardNoise, {}, void 0), jsx(StyledClose$1, { stroke: "white", onClick: toggleShowClaimPopup }, void 0), jsxs(AutoColumn, __assign({ style: { padding: '2rem 0', zIndex: 10 }, justify: "center" }, { children: [jsx(UniToken, { width: "48px", src: tokenLogo }, void 0), ' ', jsxs(ThemedText.White, __assign({ style: { marginTop: '1rem' }, fontSize: 36, fontWeight: 600 }, { children: [unclaimedAmount === null || unclaimedAmount === void 0 ? void 0 : unclaimedAmount.toFixed(0, (_a = { groupSeparator: ',' }) !== null && _a !== void 0 ? _a : '-'), " UNI"] }), void 0), jsxs(ThemedText.White, __assign({ style: { paddingTop: '1.25rem', textAlign: 'center' }, fontWeight: 600, color: "white" }, { children: [jsx("span", __assign({ role: "img", "aria-label": "party" }, { children: "\uD83C\uDF89" }), void 0), ' ', jsx(Trans, { children: "UNI has arrived" }, void 0), ' ', jsx("span", __assign({ role: "img", "aria-label": "party" }, { children: "\uD83C\uDF89" }), void 0)] }), void 0), jsx(ThemedText.SubHeader, __assign({ style: { paddingTop: '0.5rem', textAlign: 'center' }, color: "white" }, { children: jsxs(Trans, { children: ["Thanks for being part of the Uniswap community ", jsx(Heart, { size: 12 }, void 0)] }, void 0) }), void 0)] }), void 0), jsx(AutoColumn, __assign({ style: { zIndex: 10 }, justify: "center" }, { children: jsx(ButtonPrimary, __assign({ padding: "8px", "$borderRadius": "8px", width: 'fit-content', onClick: handleToggleSelfClaimModal }, { children: jsx(Trans, { children: "Claim your UNI tokens" }, void 0) }), void 0) }), void 0)] }), void 0)) }, void 0)); +} +var templateObject_1$N, templateObject_2$w, templateObject_3$q, templateObject_4$h; + +var RowNoFlex$1 = styled(AutoRow)(templateObject_1$M || (templateObject_1$M = __makeTemplateObject(["\n flex-wrap: nowrap;\n"], ["\n flex-wrap: nowrap;\n"]))); +function FailedNetworkSwitchPopup(_a) { + var chainId = _a.chainId; + var chainInfo = CHAIN_INFO[chainId]; + var theme = useContext(ThemeContext); + return (jsxs(RowNoFlex$1, { children: [jsx("div", __assign({ style: { paddingRight: 16 } }, { children: jsx(AlertCircle, { color: theme.red1, size: 24 }, void 0) }), void 0), jsx(AutoColumn, __assign({ gap: "8px" }, { children: jsx(ThemedText.Body, __assign({ fontWeight: 500 }, { children: jsxs(Trans, { children: ["Failed to switch networks from the Uniswap Interface. In order to use Uniswap on ", chainInfo.label, ", you must change the network in your wallet."] }, void 0) }), void 0) }), void 0)] }, void 0)); +} +var templateObject_1$M; + +var RowNoFlex = styled(AutoRow)(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["\n flex-wrap: nowrap;\n"], ["\n flex-wrap: nowrap;\n"]))); +function TransactionPopup(_a) { + var hash = _a.hash; + var chainId = useActiveWeb3React().chainId; + var tx = useTransaction(hash); + var theme = useContext(ThemeContext); + if (!tx) + return null; + var success = Boolean(tx.receipt && tx.receipt.status === 1); + return (jsxs(RowNoFlex, { children: [jsx("div", __assign({ style: { paddingRight: 16 } }, { children: success ? jsx(CheckCircle, { color: theme.green1, size: 24 }, void 0) : jsx(AlertCircle, { color: theme.red1, size: 24 }, void 0) }), void 0), jsxs(AutoColumn, __assign({ gap: "8px" }, { children: [jsx(ThemedText.Body, __assign({ fontWeight: 500 }, { children: jsx(TransactionSummary, { info: tx.info }, void 0) }), void 0), chainId && (jsx(ExternalLink, __assign({ href: getExplorerLink(chainId, hash, ExplorerDataType.TRANSACTION) }, { children: "View on Explorer" }), void 0))] }), void 0)] }, void 0)); +} +var templateObject_1$L; + +var StyledClose = styled(X)(templateObject_1$K || (templateObject_1$K = __makeTemplateObject(["\n position: absolute;\n right: 10px;\n top: 10px;\n\n :hover {\n cursor: pointer;\n }\n"], ["\n position: absolute;\n right: 10px;\n top: 10px;\n\n :hover {\n cursor: pointer;\n }\n"]))); +var Popup = styled.div(templateObject_3$p || (templateObject_3$p = __makeTemplateObject(["\n display: inline-block;\n width: 100%;\n padding: 1em;\n background-color: ", ";\n position: relative;\n border-radius: 10px;\n padding: 20px;\n padding-right: 35px;\n overflow: hidden;\n\n ", "\n"], ["\n display: inline-block;\n width: 100%;\n padding: 1em;\n background-color: ", ";\n position: relative;\n border-radius: 10px;\n padding: 20px;\n padding-right: 35px;\n overflow: hidden;\n\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_2$v || (templateObject_2$v = __makeTemplateObject(["\n min-width: 290px;\n &:not(:last-of-type) {\n margin-right: 20px;\n }\n "], ["\n min-width: 290px;\n &:not(:last-of-type) {\n margin-right: 20px;\n }\n "]))); +}); +var Fader = styled.div(templateObject_4$g || (templateObject_4$g = __makeTemplateObject(["\n position: absolute;\n bottom: 0px;\n left: 0px;\n width: 100%;\n height: 2px;\n background-color: ", ";\n"], ["\n position: absolute;\n bottom: 0px;\n left: 0px;\n width: 100%;\n height: 2px;\n background-color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var AnimatedFader = animated(Fader); +function PopupItem(_a) { + var removeAfterMs = _a.removeAfterMs, content = _a.content, popKey = _a.popKey; + var removePopup = useRemovePopup(); + var removeThisPopup = useCallback(function () { return removePopup(popKey); }, [popKey, removePopup]); + useEffect(function () { + if (removeAfterMs === null) + return undefined; + var timeout = setTimeout(function () { + removeThisPopup(); + }, removeAfterMs); + return function () { + clearTimeout(timeout); + }; + }, [removeAfterMs, removeThisPopup]); + var theme = useContext(ThemeContext); + var popupContent; + if ('txn' in content) { + var hash = content.txn.hash; + popupContent = jsx(TransactionPopup, { hash: hash }, void 0); + } + else if ('failedSwitchNetwork' in content) { + popupContent = jsx(FailedNetworkSwitchPopup, { chainId: content.failedSwitchNetwork }, void 0); + } + var faderStyle = useSpring$1({ + from: { width: '100%' }, + to: { width: '0%' }, + config: { duration: removeAfterMs !== null && removeAfterMs !== void 0 ? removeAfterMs : undefined }, + }); + return (jsxs(Popup, { children: [jsx(StyledClose, { color: theme.text2, onClick: removeThisPopup }, void 0), popupContent, removeAfterMs !== null ? jsx(AnimatedFader, { style: faderStyle }, void 0) : null] }, void 0)); +} +var templateObject_1$K, templateObject_2$v, templateObject_3$p, templateObject_4$g; + +var BGImage = "055f83ffb7252729.svg"; + +var Wrapper$d = styled(AutoColumn)(templateObject_2$u || (templateObject_2$u = __makeTemplateObject(["\n background: #edeef2;\n position: relative;\n border-radius: 12px;\n padding: 18px;\n max-width: 360px;\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n color: ", ";\n overflow: hidden;\n\n ", "\n"], ["\n background: #edeef2;\n position: relative;\n border-radius: 12px;\n padding: 18px;\n max-width: 360px;\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);\n color: ", ";\n overflow: hidden;\n\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_1$J || (templateObject_1$J = __makeTemplateObject(["\n max-width: 100%;\n "], ["\n max-width: 100%;\n "]))); +}); +var BGOrb = styled.img(templateObject_3$o || (templateObject_3$o = __makeTemplateObject(["\n position: absolute;\n right: -64px;\n top: -64px;\n width: 180px;\n z-index: ", ";\n"], ["\n position: absolute;\n right: -64px;\n top: -64px;\n width: 180px;\n z-index: ", ";\n"])), Z_INDEX.sticky); +var WrappedCloseIcon = styled(X)(templateObject_4$f || (templateObject_4$f = __makeTemplateObject(["\n position: absolute;\n top: 10px;\n right: 10px;\n width: 20px;\n height: 20px;\n stroke: #7c7c80;\n z-index: ", ";\n :hover {\n cursor: pointer;\n opacity: 0.8;\n }\n"], ["\n position: absolute;\n top: 10px;\n right: 10px;\n width: 20px;\n height: 20px;\n stroke: #7c7c80;\n z-index: ", ";\n :hover {\n cursor: pointer;\n opacity: 0.8;\n }\n"])), Z_INDEX.fixed); +var END_TIMESTAMP = 1642272346; // Jan 15th +function SurveyPopup() { + var theme = useTheme(); + var _a = __read(useShowSurveyPopup(), 2), showPopup = _a[0], setShowSurveyPopup = _a[1]; + // show popup to 1% of users + useEffect(function () { + // has not visited page during A/B testing if undefined + if (showPopup === undefined) { + if (Math.random() < 0.01) { + setShowSurveyPopup(true); + // log a case of succesful view + ReactGA.event({ + category: 'Survey', + action: 'Saw Survey', + }); + } + } + }, [setShowSurveyPopup, showPopup]); + // limit survey to 24 hours based on timestamps + var timestamp = useCurrentBlockTimestamp(); + var durationOver = timestamp ? timestamp.toNumber() > END_TIMESTAMP : false; + return (jsx(Fragment, { children: !showPopup || durationOver ? null : (jsxs(Wrapper$d, __assign({ gap: "10px" }, { children: [jsx(WrappedCloseIcon, { onClick: function () { + ReactGA.event({ + category: 'Survey', + action: 'Clicked Survey Link', + }); + setShowSurveyPopup(false); + } }, void 0), jsx(BGOrb, { src: BGImage }, void 0), jsx(ExternalLink, __assign({ href: "https://www.surveymonkey.com/r/YGWV9VD" }, { children: jsxs(RowFixed, { children: [jsx(MessageCircle, { stroke: theme.black, size: "20px", strokeWidth: "1px" }, void 0), jsx(ThemedText.White, __assign({ fontWeight: 600, color: theme.black, ml: "6px" }, { children: jsx(Trans, { children: "Tell us what you think \u2197" }, void 0) }), void 0)] }, void 0) }), void 0), jsx(ThemedText.Black, __assign({ style: { zIndex: Z_INDEX.fixed }, fontWeight: 400, fontSize: "12px", color: theme.black }, { children: jsx(Trans, { children: "Take a 10 minute survey to help us improve your experience in the Uniswap app." }, void 0) }), void 0)] }), void 0)) }, void 0)); +} +var templateObject_1$J, templateObject_2$u, templateObject_3$o, templateObject_4$f; + +var MobilePopupWrapper = styled.div(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["\n position: relative;\n max-width: 100%;\n height: ", ";\n margin: ", ";\n margin-bottom: ", "};\n\n display: none;\n ", ";\n"], ["\n position: relative;\n max-width: 100%;\n height: ", ";\n margin: ", ";\n margin-bottom: ", "};\n\n display: none;\n ", ";\n"])), function (_a) { + var height = _a.height; + return height; +}, function (_a) { + var height = _a.height; + return (height ? '0 auto;' : 0); +}, function (_a) { + var height = _a.height; + return (height ? '20px' : 0); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n display: block;\n "], ["\n display: block;\n "]))); +}); +var MobilePopupInner = styled.div(templateObject_3$n || (templateObject_3$n = __makeTemplateObject(["\n height: 99%;\n overflow-x: auto;\n overflow-y: hidden;\n display: flex;\n flex-direction: row;\n -webkit-overflow-scrolling: touch;\n ::-webkit-scrollbar {\n display: none;\n }\n"], ["\n height: 99%;\n overflow-x: auto;\n overflow-y: hidden;\n display: flex;\n flex-direction: row;\n -webkit-overflow-scrolling: touch;\n ::-webkit-scrollbar {\n display: none;\n }\n"]))); +var StopOverflowQuery = "@media screen and (min-width: " + (MEDIA_WIDTHS.upToMedium + 1) + "px) and (max-width: " + (MEDIA_WIDTHS.upToMedium + 500) + "px)"; +var FixedPopupColumn = styled(AutoColumn)(templateObject_5$d || (templateObject_5$d = __makeTemplateObject(["\n position: fixed;\n top: ", ";\n right: 1rem;\n max-width: 355px !important;\n width: 100%;\n z-index: 3;\n\n ", ";\n\n ", " {\n top: ", ";\n }\n"], ["\n position: fixed;\n top: ", ";\n right: 1rem;\n max-width: 355px !important;\n width: 100%;\n z-index: 3;\n\n ", ";\n\n ", " {\n top: ", ";\n }\n"])), function (_a) { + var extraPadding = _a.extraPadding; + return (extraPadding ? '64px' : '56px'); +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "]))); +}, StopOverflowQuery, function (_a) { + var extraPadding = _a.extraPadding, xlPadding = _a.xlPadding; + return (xlPadding ? '64px' : extraPadding ? '64px' : '56px'); +}); +function Popups() { + // get all popups + var activePopups = useActivePopups(); + // show survey popup if user has not closed + var _a = __read(useShowSurveyPopup(), 1), showSurveyPopup = _a[0]; + var urlWarningActive = useURLWarningVisible(); + // need extra padding if network is not L1 Ethereum + var chainId = useActiveWeb3React().chainId; + var isNotOnMainnet = Boolean(chainId && chainId !== SupportedChainId.MAINNET); + return (jsxs(Fragment, { children: [jsxs(FixedPopupColumn, __assign({ gap: "20px", extraPadding: urlWarningActive, xlPadding: isNotOnMainnet }, { children: [jsx(ClaimPopup, {}, void 0), jsx(SurveyPopup, {}, void 0), activePopups.map(function (item) { return (jsx(PopupItem, { content: item.content, popKey: item.key, removeAfterMs: item.removeAfterMs }, item.key)); })] }), void 0), jsx(MobilePopupWrapper, __assign({ height: (activePopups === null || activePopups === void 0 ? void 0 : activePopups.length) > 0 || showSurveyPopup ? 'fit-content' : 0 }, { children: jsxs(MobilePopupInner, { children: [jsx(SurveyPopup, {}, void 0), activePopups // reverse so new items up front + .slice(0) + .reverse() + .map(function (item) { return (jsx(PopupItem, { content: item.content, popKey: item.key, removeAfterMs: item.removeAfterMs }, item.key)); })] }, void 0) }), void 0)] }, void 0)); +} +var templateObject_1$I, templateObject_2$t, templateObject_3$n, templateObject_4$e, templateObject_5$d; + +function useEagerConnect() { + var _a = useWeb3React(), activate = _a.activate, active = _a.active; + var _b = __read(useState(false), 2), tried = _b[0], setTried = _b[1]; + // gnosisSafe.isSafeApp() races a timeout against postMessage, so it delays pageload if we are not in a safe app; + // if we are not embedded in an iframe, it is not worth checking + var _c = __read(useState(!IS_IN_IFRAME), 2), triedSafe = _c[0], setTriedSafe = _c[1]; + // first, try connecting to a gnosis safe + useEffect(function () { + if (!triedSafe) { + gnosisSafe.isSafeApp().then(function (loadedInSafe) { + if (loadedInSafe) { + activate(gnosisSafe, undefined, true).catch(function () { + setTriedSafe(true); + }); + } + else { + setTriedSafe(true); + } + }); + } + }, [activate, setTriedSafe, triedSafe]); + // then, if that fails, try connecting to an injected connector + useEffect(function () { + if (!active && triedSafe) { + injected.isAuthorized().then(function (isAuthorized) { + if (isAuthorized) { + activate(injected, undefined, true).catch(function () { + setTried(true); + }); + } + else { + if (isMobile && window.ethereum) { + activate(injected, undefined, true).catch(function () { + setTried(true); + }); + } + else { + setTried(true); + } + } + }); + } + }, [activate, active, triedSafe]); + // wait until we get confirmation of a connection to flip the flag + useEffect(function () { + if (active) { + setTried(true); + } + }, [active]); + return tried; +} +/** + * Use for network and injected - logs user in + * and out after checking what network theyre on + */ +function useInactiveListener(suppress) { + if (suppress === void 0) { suppress = false; } + var _a = useWeb3React(), active = _a.active, error = _a.error, activate = _a.activate; + useEffect(function () { + var ethereum = window.ethereum; + if (ethereum && ethereum.on && !active && !error && !suppress) { + var handleChainChanged_1 = function () { + // eat errors + activate(injected, undefined, true).catch(function (error) { + console.error('Failed to activate after chain changed', error); + }); + }; + var handleAccountsChanged_1 = function (accounts) { + if (accounts.length > 0) { + // eat errors + activate(injected, undefined, true).catch(function (error) { + console.error('Failed to activate after accounts changed', error); + }); + } + }; + ethereum.on('chainChanged', handleChainChanged_1); + ethereum.on('accountsChanged', handleAccountsChanged_1); + return function () { + if (ethereum.removeListener) { + ethereum.removeListener('chainChanged', handleChainChanged_1); + ethereum.removeListener('accountsChanged', handleAccountsChanged_1); + } + }; + } + return undefined; + }, [active, error, suppress, activate]); +} + +var MessageWrapper = styled.div(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 20rem;\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 20rem;\n"]))); +var Message = styled.h2(templateObject_2$s || (templateObject_2$s = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.secondary1; +}); +function Web3ReactManager(_a) { + var children = _a.children; + var active = useWeb3React().active; + var _b = useWeb3React(NetworkContextName), networkActive = _b.active, networkError = _b.error, activateNetwork = _b.activate; + // try to eagerly connect to an injected provider, if it exists and has granted access already + var triedEager = useEagerConnect(); + // after eagerly trying injected, if the network connect ever isn't active or in an error state, activate itd + useEffect(function () { + if (triedEager && !networkActive && !networkError && !active) { + activateNetwork(network); + } + }, [triedEager, networkActive, networkError, activateNetwork, active]); + // when there's no account connected, react to logins (broadly speaking) on the injected provider, if it exists + useInactiveListener(!triedEager); + // if the account context isn't active, and there's an error on the network context, it's an irrecoverable error + if (triedEager && !active && networkError) { + return (jsx(MessageWrapper, { children: jsx(Message, { children: jsx(Trans, { children: "Oops! An unknown error occurred. Please refresh the page, or visit from another browser or device." }, void 0) }, void 0) }, void 0)); + } + return children; +} +var templateObject_1$H, templateObject_2$s; + +function DarkModeQueryParamReader(_a) { + var search = _a.location.search; + var dispatch = useAppDispatch(); + useEffect(function () { + if (!search) + return; + if (search.length < 2) + return; + var parsed = parse(search, { + parseArrays: false, + ignoreQueryPrefix: true, + }); + var theme = parsed.theme; + if (typeof theme !== 'string') + return; + if (theme.toLowerCase() === 'light') { + dispatch(updateUserDarkMode({ userDarkMode: false })); + } + else if (theme.toLowerCase() === 'dark') { + dispatch(updateUserDarkMode({ userDarkMode: true })); + } + }, [dispatch, search]); + return null; +} + +var _a$2, _b$1, _c$1, _d$1; +var L2Icon = styled.img(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n width: 24px;\n height: 24px;\n margin-right: 16px;\n"], ["\n width: 24px;\n height: 24px;\n margin-right: 16px;\n"]))); +styled.div(templateObject_2$r || (templateObject_2$r = __makeTemplateObject(["\n align-items: center;\n display: flex;\n justify-content: flex-start;\n padding: 0 20px 20px 20px;\n"], ["\n align-items: center;\n display: flex;\n justify-content: flex-start;\n padding: 0 20px 20px 20px;\n"]))); +var BodyText = styled.div(templateObject_3$m || (templateObject_3$m = __makeTemplateObject(["\n color: ", ";\n display: flex;\n align-items: center;\n justify-content: flex-start;\n margin: 8px;\n font-size: 14px;\n"], ["\n color: ", ";\n display: flex;\n align-items: center;\n justify-content: flex-start;\n margin: 8px;\n font-size: 14px;\n"])), function (_a) { + var color = _a.color; + return color; +}); +var RootWrapper = styled.div(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\n position: relative;\n margin-top: 16px;\n"], ["\n position: relative;\n margin-top: 16px;\n"]))); +var SHOULD_SHOW_ALERT = (_a$2 = {}, + _a$2[SupportedChainId.OPTIMISM] = true, + _a$2[SupportedChainId.OPTIMISTIC_KOVAN] = true, + _a$2[SupportedChainId.ARBITRUM_ONE] = true, + _a$2[SupportedChainId.ARBITRUM_RINKEBY] = true, + _a$2[SupportedChainId.POLYGON] = true, + _a$2[SupportedChainId.POLYGON_MUMBAI] = true, + _a$2); +var BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID = { + dark: (_b$1 = {}, + _b$1[SupportedChainId.POLYGON] = 'radial-gradient(100% 93.36% at 0% 6.64%, rgba(160, 108, 247, 0.1) 0%, rgba(82, 32, 166, 0.1) 100%)', + _b$1[SupportedChainId.POLYGON_MUMBAI] = 'radial-gradient(100% 93.36% at 0% 6.64%, rgba(160, 108, 247, 0.1) 0%, rgba(82, 32, 166, 0.1) 100%)', + _b$1[SupportedChainId.OPTIMISM] = 'radial-gradient(948% 292% at 42% 0%, rgba(255, 58, 212, 0.01) 0%, rgba(255, 255, 255, 0.04) 100%),radial-gradient(98% 96% at 2% 0%, rgba(255, 39, 39, 0.01) 0%, rgba(235, 0, 255, 0.01) 96%)', + _b$1[SupportedChainId.OPTIMISTIC_KOVAN] = 'radial-gradient(948% 292% at 42% 0%, rgba(255, 58, 212, 0.04) 0%, rgba(255, 255, 255, 0.04) 100%),radial-gradient(98% 96% at 2% 0%, rgba(255, 39, 39, 0.04) 0%, rgba(235, 0, 255, 0.01 96%)', + _b$1[SupportedChainId.ARBITRUM_ONE] = 'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.01) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(75% 75% at 0% 0%, rgba(150, 190, 220, 0.05) 0%, rgba(33, 114, 229, 0.05) 100%), hsla(0, 0%, 100%, 0.05)', + _b$1[SupportedChainId.ARBITRUM_RINKEBY] = 'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.05) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(75% 75% at 0% 0%, rgba(150, 190, 220, 0.05) 0%, rgba(33, 114, 229, 0.1) 100%), hsla(0, 0%, 100%, 0.05)', + _b$1), + light: (_c$1 = {}, + _c$1[SupportedChainId.POLYGON] = 'radial-gradient(182.71% 205.59% at 2.81% 7.69%, rgba(130, 71, 229, 0.2) 0%, rgba(167, 202, 255, 0.2) 100%)', + _c$1[SupportedChainId.POLYGON_MUMBAI] = 'radial-gradient(182.71% 205.59% at 2.81% 7.69%, rgba(130, 71, 229, 0.2) 0%, rgba(167, 202, 255, 0.2) 100%)', + _c$1[SupportedChainId.OPTIMISM] = 'radial-gradient(92% 105% at 50% 7%, rgba(255, 58, 212, 0.04) 0%, rgba(255, 255, 255, 0.03) 100%),radial-gradient(100% 97% at 0% 12%, rgba(235, 0, 255, 0.1) 0%, rgba(243, 19, 19, 0.1) 100%), hsla(0, 0%, 100%, 0.1)', + _c$1[SupportedChainId.OPTIMISTIC_KOVAN] = 'radial-gradient(92% 105% at 50% 7%, rgba(255, 58, 212, 0.04) 0%, rgba(255, 255, 255, 0.03) 100%),radial-gradient(100% 97% at 0% 12%, rgba(235, 0, 255, 0.1) 0%, rgba(243, 19, 19, 0.1) 100%), hsla(0, 0%, 100%, 0.1)', + _c$1[SupportedChainId.ARBITRUM_ONE] = 'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.1) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(circle at top left, hsla(206, 50%, 75%, 0.01), hsla(215, 79%, 51%, 0.12)), hsla(0, 0%, 100%, 0.1)', + _c$1[SupportedChainId.ARBITRUM_RINKEBY] = 'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.1) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(circle at top left, hsla(206, 50%, 75%, 0.01), hsla(215, 79%, 51%, 0.12)), hsla(0, 0%, 100%, 0.1)', + _c$1), +}; +var ContentWrapper$1 = styled.div(templateObject_5$c || (templateObject_5$c = __makeTemplateObject(["\n background: ", ";\n border-radius: 20px;\n display: flex;\n flex-direction: row;\n overflow: hidden;\n position: relative;\n width: 100%;\n\n :before {\n background-image: url(", ");\n background-repeat: no-repeat;\n background-size: 300px;\n content: '';\n height: 300px;\n opacity: 0.1;\n position: absolute;\n transform: rotate(25deg) translate(-90px, -40px);\n width: 300px;\n z-index: -1;\n }\n"], ["\n background: ", ";\n border-radius: 20px;\n display: flex;\n flex-direction: row;\n overflow: hidden;\n position: relative;\n width: 100%;\n\n :before {\n background-image: url(", ");\n background-repeat: no-repeat;\n background-size: 300px;\n content: '';\n height: 300px;\n opacity: 0.1;\n position: absolute;\n transform: rotate(25deg) translate(-90px, -40px);\n width: 300px;\n z-index: -1;\n }\n"])), function (_a) { + var chainId = _a.chainId, darkMode = _a.darkMode; + return BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID[darkMode ? 'dark' : 'light'][chainId]; +}, function (_a) { + var logoUrl = _a.logoUrl; + return logoUrl; +}); +var Header$1 = styled.h2(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n font-weight: 600;\n font-size: 16px;\n margin: 0;\n"], ["\n font-weight: 600;\n font-size: 16px;\n margin: 0;\n"]))); +var LinkOutToBridge = styled(ExternalLink)(templateObject_7$7 || (templateObject_7$7 = __makeTemplateObject(["\n align-items: center;\n border-radius: 8px;\n color: white;\n display: flex;\n font-size: 16px;\n justify-content: space-between;\n padding: 6px 8px;\n margin-right: 12px;\n text-decoration: none !important;\n width: 100%;\n"], ["\n align-items: center;\n border-radius: 8px;\n color: white;\n display: flex;\n font-size: 16px;\n justify-content: space-between;\n padding: 6px 8px;\n margin-right: 12px;\n text-decoration: none !important;\n width: 100%;\n"]))); +var StyledArrowUpRight = styled(ArrowUpRight)(templateObject_8$5 || (templateObject_8$5 = __makeTemplateObject(["\n margin-left: 12px;\n width: 24px;\n height: 24px;\n"], ["\n margin-left: 12px;\n width: 24px;\n height: 24px;\n"]))); +var TEXT_COLORS = (_d$1 = {}, + _d$1[SupportedChainId.POLYGON] = 'rgba(130, 71, 229)', + _d$1[SupportedChainId.POLYGON_MUMBAI] = 'rgba(130, 71, 229)', + _d$1[SupportedChainId.OPTIMISM] = '#ff3856', + _d$1[SupportedChainId.OPTIMISTIC_KOVAN] = '#ff3856', + _d$1[SupportedChainId.ARBITRUM_ONE] = '#0490ed', + _d$1[SupportedChainId.ARBITRUM_RINKEBY] = '#0490ed', + _d$1); +function shouldShowAlert(chainId) { + return Boolean(chainId && SHOULD_SHOW_ALERT[chainId]); +} +function NetworkAlert() { + var chainId = useActiveWeb3React().chainId; + var _a = __read(useDarkModeManager(), 1), darkMode = _a[0]; + if (!shouldShowAlert(chainId)) { + return null; + } + var _b = CHAIN_INFO[chainId], label = _b.label, logoUrl = _b.logoUrl, bridge = _b.bridge; + var textColor = TEXT_COLORS[chainId]; + return bridge ? (jsx(RootWrapper, { children: jsx(ContentWrapper$1, __assign({ chainId: chainId, darkMode: darkMode, logoUrl: logoUrl }, { children: jsxs(LinkOutToBridge, __assign({ href: bridge }, { children: [jsxs(BodyText, __assign({ color: textColor }, { children: [jsx(L2Icon, { src: logoUrl }, void 0), jsxs(AutoRow, { children: [jsx(Header$1, { children: jsxs(Trans, { children: [label, " token bridge"] }, void 0) }, void 0), jsx(HideSmall, { children: jsxs(Trans, { children: ["Deposit tokens to the ", label, " network."] }, void 0) }, void 0)] }, void 0)] }), void 0), jsx(StyledArrowUpRight, { color: textColor }, void 0)] }), void 0) }), void 0) }, void 0)) : null; +} +var templateObject_1$G, templateObject_2$r, templateObject_3$m, templateObject_4$d, templateObject_5$c, templateObject_6$8, templateObject_7$7, templateObject_8$5; + +/** + * @param open conditional to show content or hide + * @returns Wrapper to smoothly hide and expand content + */ +function AnimatedDropdown(_a) { + var open = _a.open, children = _a.children; + var _b = useResizeObserver(), ref = _b.ref, height = _b.height; + var props = useSpring({ + height: open ? height !== null && height !== void 0 ? height : 0 : 0, + config: { + mass: 1.2, + tension: 300, + friction: 20, + clamp: true, + velocity: 0.01, + }, + }); + return (jsx(animated.div, __assign({ style: __assign(__assign({}, props), { overflow: 'hidden', width: '100%', willChange: 'height' }) }, { children: jsx("div", __assign({ ref: ref }, { children: children }), void 0) }), void 0)); +} + +var THIRTY_BIPS_FEE = new Percent(JSBI.BigInt(30), JSBI.BigInt(10000)); +var INPUT_FRACTION_AFTER_FEE = ONE_HUNDRED_PERCENT.subtract(THIRTY_BIPS_FEE); +// computes realized lp fee as a percent +function computeRealizedLPFeePercent(trade) { + var e_1, _a; + var percent; + // Since routes are either all v2 or all v3 right now, calculate separately + if (trade.swaps[0].route.pools instanceof Pair) { + // for each hop in our trade, take away the x*y=k price impact from 0.3% fees + // e.g. for 3 tokens/2 hops: 1 - ((1 - .03) * (1-.03)) + percent = ONE_HUNDRED_PERCENT.subtract(trade.swaps.reduce(function (currentFee) { return currentFee.multiply(INPUT_FRACTION_AFTER_FEE); }, ONE_HUNDRED_PERCENT)); + } + else { + percent = ZERO_PERCENT; + try { + for (var _b = __values(trade.swaps), _c = _b.next(); !_c.done; _c = _b.next()) { + var swap = _c.value; + var _d = swap.inputAmount.divide(trade.inputAmount), numerator = _d.numerator, denominator = _d.denominator; + var overallPercent = new Percent(numerator, denominator); + var routeRealizedLPFeePercent = overallPercent.multiply(ONE_HUNDRED_PERCENT.subtract(swap.route.pools.reduce(function (currentFee, pool) { + var fee = pool instanceof Pair + ? // not currently possible given protocol check above, but not fatal + FeeAmount.MEDIUM + : pool.fee; + return currentFee.multiply(ONE_HUNDRED_PERCENT.subtract(new Fraction(fee, 1000000))); + }, ONE_HUNDRED_PERCENT))); + percent = percent.add(routeRealizedLPFeePercent); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } + return new Percent(percent.numerator, percent.denominator); +} +var IMPACT_TIERS = [ + BLOCKED_PRICE_IMPACT_NON_EXPERT, + ALLOWED_PRICE_IMPACT_HIGH, + ALLOWED_PRICE_IMPACT_MEDIUM, + ALLOWED_PRICE_IMPACT_LOW, +]; +function warningSeverity(priceImpact) { + var e_2, _a; + if (!priceImpact) + return 4; + var impact = IMPACT_TIERS.length; + try { + for (var IMPACT_TIERS_1 = __values(IMPACT_TIERS), IMPACT_TIERS_1_1 = IMPACT_TIERS_1.next(); !IMPACT_TIERS_1_1.done; IMPACT_TIERS_1_1 = IMPACT_TIERS_1.next()) { + var impactLevel = IMPACT_TIERS_1_1.value; + if (impactLevel.lessThan(priceImpact)) + return impact; + impact--; + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (IMPACT_TIERS_1_1 && !IMPACT_TIERS_1_1.done && (_a = IMPACT_TIERS_1.return)) _a.call(IMPACT_TIERS_1); + } + finally { if (e_2) throw e_2.error; } + } + return 0; +} + +/** + * Formatted version of price impact text with warning colors + */ +function FormattedPriceImpact(_a) { + var priceImpact = _a.priceImpact; + return (jsx(ErrorText, __assign({ fontWeight: 500, fontSize: 14, severity: warningSeverity(priceImpact) }, { children: priceImpact ? priceImpact.multiply(-1).toFixed(2) + "%" : '-' }), void 0)); +} + +var StyledCard$1 = styled(Card)(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["\n padding: 0;\n"], ["\n padding: 0;\n"]))); +function TextWithLoadingPlaceholder(_a) { + var syncing = _a.syncing, width = _a.width, children = _a.children; + return syncing ? (jsx(LoadingRows, { children: jsx("div", { style: { height: '15px', width: width + "px" } }, void 0) }, void 0)) : (children); +} +function AdvancedSwapDetails(_a) { + var trade = _a.trade, allowedSlippage = _a.allowedSlippage, _b = _a.syncing, syncing = _b === void 0 ? false : _b; + var theme = useContext(ThemeContext); + var chainId = useActiveWeb3React().chainId; + var _c = useMemo(function () { + if (!trade) + return { expectedOutputAmount: undefined, priceImpact: undefined }; + var expectedOutputAmount = trade.outputAmount; + var realizedLpFeePercent = computeRealizedLPFeePercent(trade); + var priceImpact = trade.priceImpact.subtract(realizedLpFeePercent); + return { expectedOutputAmount: expectedOutputAmount, priceImpact: priceImpact }; + }, [trade]), expectedOutputAmount = _c.expectedOutputAmount, priceImpact = _c.priceImpact; + return !trade ? null : (jsx(StyledCard$1, { children: jsxs(AutoColumn, __assign({ gap: "8px" }, { children: [jsxs(RowBetween, { children: [jsx(RowFixed, { children: jsx(ThemedText.SubHeader, __assign({ color: theme.text1 }, { children: jsx(Trans, { children: "Expected Output" }, void 0) }), void 0) }, void 0), jsx(TextWithLoadingPlaceholder, __assign({ syncing: syncing, width: 65 }, { children: jsx(ThemedText.Black, __assign({ textAlign: "right", fontSize: 14 }, { children: expectedOutputAmount + ? expectedOutputAmount.toSignificant(6) + " " + expectedOutputAmount.currency.symbol + : '-' }), void 0) }), void 0)] }, void 0), jsxs(RowBetween, { children: [jsx(RowFixed, { children: jsx(ThemedText.SubHeader, __assign({ color: theme.text1 }, { children: jsx(Trans, { children: "Price Impact" }, void 0) }), void 0) }, void 0), jsx(TextWithLoadingPlaceholder, __assign({ syncing: syncing, width: 50 }, { children: jsx(ThemedText.Black, __assign({ textAlign: "right", fontSize: 14 }, { children: jsx(FormattedPriceImpact, { priceImpact: priceImpact }, void 0) }), void 0) }), void 0)] }, void 0), jsx(Separator$1, {}, void 0), jsxs(RowBetween, { children: [jsx(RowFixed, __assign({ style: { marginRight: '20px' } }, { children: jsxs(ThemedText.SubHeader, __assign({ color: theme.text3 }, { children: [trade.tradeType === TradeType.EXACT_INPUT ? (jsx(Trans, { children: "Minimum received" }, void 0)) : (jsx(Trans, { children: "Maximum sent" }, void 0)), ' ', jsx(Trans, { children: "after slippage" }, void 0), " (", allowedSlippage.toFixed(2), "%)"] }), void 0) }), void 0), jsx(TextWithLoadingPlaceholder, __assign({ syncing: syncing, width: 70 }, { children: jsx(ThemedText.Black, __assign({ textAlign: "right", fontSize: 14, color: theme.text3 }, { children: trade.tradeType === TradeType.EXACT_INPUT + ? trade.minimumAmountOut(allowedSlippage).toSignificant(6) + " " + trade.outputAmount.currency.symbol + : trade.maximumAmountIn(allowedSlippage).toSignificant(6) + " " + trade.inputAmount.currency.symbol }), void 0) }), void 0)] }, void 0), !(trade === null || trade === void 0 ? void 0 : trade.gasUseEstimateUSD) || !chainId || !SUPPORTED_GAS_ESTIMATE_CHAIN_IDS.includes(chainId) ? null : (jsxs(RowBetween, { children: [jsx(ThemedText.SubHeader, __assign({ color: theme.text3 }, { children: jsx(Trans, { children: "Network Fee" }, void 0) }), void 0), jsx(TextWithLoadingPlaceholder, __assign({ syncing: syncing, width: 50 }, { children: jsxs(ThemedText.Black, __assign({ textAlign: "right", fontSize: 14, color: theme.text3 }, { children: ["~$", trade.gasUseEstimateUSD.toFixed(2)] }), void 0) }), void 0)] }, void 0))] }), void 0) }, void 0)); +} +var templateObject_1$F; + +var _path$3, _line$1, _line2, _path2; + +function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); } + +const SvgGasIcon = props => /*#__PURE__*/React.createElement("svg", _extends$4({ + width: 16, + height: 16, + viewBox: "0 0 16 16", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", { + d: "M10.0047 9.26921H10.2714C11.0078 9.26921 11.6047 9.86617 11.6047 10.6025V12.1359C11.6047 12.7987 12.142 13.3359 12.8047 13.3359C13.4675 13.3359 14.0047 12.7995 14.0047 12.1367V5.22059C14.0047 4.86697 13.7758 4.56227 13.5258 4.31223L10.6714 1.33594M4.00472 2.00254H8.00472C8.7411 2.00254 9.33805 2.59949 9.33805 3.33587V14.0015H2.67139V3.33587C2.67139 2.59949 3.26834 2.00254 4.00472 2.00254ZM14.0047 5.33587C14.0047 6.07225 13.4078 6.66921 12.6714 6.66921C11.935 6.66921 11.3381 6.07225 11.3381 5.33587C11.3381 4.59949 11.935 4.00254 12.6714 4.00254C13.4078 4.00254 14.0047 4.59949 14.0047 5.33587Z", + stroke: "white" +})), _line$1 || (_line$1 = /*#__PURE__*/React.createElement("line", { + x1: 4, + y1: 9.99414, + x2: 8, + y2: 9.99414, + stroke: "white" +})), _line2 || (_line2 = /*#__PURE__*/React.createElement("line", { + x1: 4, + y1: 11.9941, + x2: 8, + y2: 11.9941, + stroke: "white" +})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", { + d: "M4 8.16113H8", + stroke: "white" +}))); + +var BadgeVariant; +(function (BadgeVariant) { + BadgeVariant["DEFAULT"] = "DEFAULT"; + BadgeVariant["NEGATIVE"] = "NEGATIVE"; + BadgeVariant["POSITIVE"] = "POSITIVE"; + BadgeVariant["PRIMARY"] = "PRIMARY"; + BadgeVariant["WARNING"] = "WARNING"; + BadgeVariant["WARNING_OUTLINE"] = "WARNING_OUTLINE"; +})(BadgeVariant || (BadgeVariant = {})); +function pickBackgroundColor(variant, theme) { + switch (variant) { + case BadgeVariant.NEGATIVE: + return theme.error; + case BadgeVariant.POSITIVE: + return theme.success; + case BadgeVariant.PRIMARY: + return theme.primary1; + case BadgeVariant.WARNING: + return theme.warning; + case BadgeVariant.WARNING_OUTLINE: + return 'transparent'; + default: + return theme.bg2; + } +} +function pickBorder(variant, theme) { + switch (variant) { + case BadgeVariant.WARNING_OUTLINE: + return "1px solid " + theme.warning; + default: + return 'unset'; + } +} +function pickFontColor(variant, theme) { + switch (variant) { + case BadgeVariant.NEGATIVE: + return readableColor(theme.error); + case BadgeVariant.POSITIVE: + return readableColor(theme.success); + case BadgeVariant.WARNING: + return readableColor(theme.warning); + case BadgeVariant.WARNING_OUTLINE: + return theme.warning; + default: + return readableColor(theme.bg2); + } +} +var Badge = styled.div(templateObject_1$E || (templateObject_1$E = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n border: ", ";\n border-radius: 0.5rem;\n color: ", ";\n display: inline-flex;\n padding: 4px 6px;\n justify-content: center;\n font-weight: 500;\n"], ["\n align-items: center;\n background-color: ", ";\n border: ", ";\n border-radius: 0.5rem;\n color: ", ";\n display: inline-flex;\n padding: 4px 6px;\n justify-content: center;\n font-weight: 500;\n"])), function (_a) { + var theme = _a.theme, variant = _a.variant; + return pickBackgroundColor(variant, theme); +}, function (_a) { + var theme = _a.theme, variant = _a.variant; + return pickBorder(variant, theme); +}, function (_a) { + var theme = _a.theme, variant = _a.variant; + return pickFontColor(variant, theme); +}); +var templateObject_1$E; + +/** + * Does a lookup for an ENS name to find its contenthash. + */ +function useENSContentHash(ensName) { + var _a; + var ensNodeArgument = useMemo(function () { return [ensName === null ? undefined : safeNamehash(ensName)]; }, [ensName]); + var registrarContract = useENSRegistrarContract(false); + var resolverAddressResult = useSingleCallResult(registrarContract, 'resolver', ensNodeArgument); + var resolverAddress = (_a = resolverAddressResult.result) === null || _a === void 0 ? void 0 : _a[0]; + var resolverContract = useENSResolverContract(resolverAddress && isZero(resolverAddress) ? undefined : resolverAddress, false); + var contenthash = useSingleCallResult(resolverContract, 'contenthash', ensNodeArgument); + return useMemo(function () { + var _a, _b; + return ({ + contenthash: (_b = (_a = contenthash.result) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null, + loading: resolverAddressResult.loading || contenthash.loading, + }); + }, [contenthash.loading, contenthash.result, resolverAddressResult.loading]); +} + +function useHttpLocations(uri) { + var ens = useMemo(function () { return (uri ? parseENSAddress(uri) : undefined); }, [uri]); + var resolvedContentHash = useENSContentHash(ens === null || ens === void 0 ? void 0 : ens.ensName); + return useMemo(function () { + if (ens) { + return resolvedContentHash.contenthash ? uriToHttp(contenthashToUri(resolvedContentHash.contenthash)) : []; + } + else { + return uri ? uriToHttp(uri) : []; + } + }, [ens, resolvedContentHash.contenthash, uri]); +} + +var MaticLogo = "data:image/svg+xml,%3Csvg%20width%3D%221024%22%20height%3D%221024%22%20viewBox%3D%220%200%201024%201024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%22512%22%20cy%3D%22512%22%20r%3D%22512%22%20fill%3D%22%238247E5%22%2F%3E%3Cpath%20d%3D%22M681.469%20402.456C669.189%20395.312%20653.224%20395.312%20639.716%20402.456L543.928%20457.228L478.842%20492.949L383.055%20547.721C370.774%20554.865%20354.81%20554.865%20341.301%20547.721L265.162%20504.856C252.882%20497.712%20244.286%20484.614%20244.286%20470.325V385.786C244.286%20371.498%20251.654%20358.4%20265.162%20351.256L340.073%20309.581C352.353%20302.437%20368.318%20302.437%20381.827%20309.581L456.737%20351.256C469.018%20358.4%20477.614%20371.498%20477.614%20385.786V440.558L542.7%20403.646V348.874C542.7%20334.586%20535.332%20321.488%20521.824%20314.344L383.055%20235.758C370.774%20228.614%20354.81%20228.614%20341.301%20235.758L200.076%20314.344C186.567%20321.488%20179.199%20334.586%20179.199%20348.874V507.237C179.199%20521.525%20186.567%20534.623%20200.076%20541.767L341.301%20620.353C353.582%20627.498%20369.546%20627.498%20383.055%20620.353L478.842%20566.772L543.928%20529.86L639.716%20476.279C651.996%20469.135%20667.961%20469.135%20681.469%20476.279L756.38%20517.953C768.66%20525.098%20777.257%20538.195%20777.257%20552.484V637.023C777.257%20651.312%20769.888%20664.409%20756.38%20671.553L681.469%20714.419C669.189%20721.563%20653.224%20721.563%20639.716%20714.419L564.805%20672.744C552.525%20665.6%20543.928%20652.502%20543.928%20638.214V583.442L478.842%20620.353V675.125C478.842%20689.414%20486.21%20702.512%20499.719%20709.656L640.944%20788.242C653.224%20795.386%20669.189%20795.386%20682.697%20788.242L823.922%20709.656C836.203%20702.512%20844.799%20689.414%20844.799%20675.125V516.763C844.799%20502.474%20837.431%20489.377%20823.922%20482.232L681.469%20402.456Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E"; + +function chainIdToNetworkName(networkId) { + switch (networkId) { + case SupportedChainId.MAINNET: + return 'ethereum'; + case SupportedChainId.ARBITRUM_ONE: + return 'arbitrum'; + case SupportedChainId.OPTIMISM: + return 'optimism'; + default: + return 'ethereum'; + } +} +function getNativeLogoURI(chainId) { + if (chainId === void 0) { chainId = SupportedChainId.MAINNET; } + switch (chainId) { + case SupportedChainId.POLYGON_MUMBAI: + case SupportedChainId.POLYGON: + return MaticLogo; + default: + return EthereumLogo; + } +} +function getTokenLogoURI(address, chainId) { + if (chainId === void 0) { chainId = SupportedChainId.MAINNET; } + var networkName = chainIdToNetworkName(chainId); + var networksWithUrls = [SupportedChainId.ARBITRUM_ONE, SupportedChainId.MAINNET, SupportedChainId.OPTIMISM]; + if (networksWithUrls.includes(chainId)) { + return "https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/" + networkName + "/assets/" + address + "/logo.png"; + } +} +function useCurrencyLogoURIs(currency) { + var locations = useHttpLocations(currency instanceof WrappedTokenInfo ? currency.logoURI : undefined); + return useMemo(function () { + var logoURIs = __spreadArray([], __read(locations), false); + if (currency) { + if (currency.isNative) { + logoURIs.push(getNativeLogoURI(currency.chainId)); + } + else if (currency.isToken) { + var logoURI = getTokenLogoURI(currency.address, currency.chainId); + if (logoURI) { + logoURIs.push(logoURI); + } + } + } + return logoURIs; + }, [currency, locations]); +} + +var BAD_SRCS = {}; +/** + * Renders an image by sequentially trying a list of URIs, and then eventually a fallback triangle alert + */ +function Logo(_a) { + var srcs = _a.srcs, alt = _a.alt, style = _a.style, rest = __rest(_a, ["srcs", "alt", "style"]); + var _b = __read(useState(0), 2), refresh = _b[1]; + var theme = useTheme(); + var src = srcs.find(function (src) { return !BAD_SRCS[src]; }); + if (src) { + return (jsx("img", __assign({}, rest, { alt: alt, src: src, style: style, onError: function () { + if (src) + BAD_SRCS[src] = true; + refresh(function (i) { return i + 1; }); + } }), void 0)); + } + return jsx(Slash, __assign({}, rest, { style: __assign(__assign({}, style), { color: theme.bg4 }) }), void 0); +} + +var StyledLogo$1 = styled(Logo)(templateObject_1$D || (templateObject_1$D = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n background: radial-gradient(white 50%, #ffffff00 calc(75% + 1px), #ffffff00 100%);\n border-radius: 50%;\n -mox-box-shadow: 0 0 1px ", ";\n -webkit-box-shadow: 0 0 1px ", ";\n box-shadow: 0 0 1px ", ";\n border: 0px solid rgba(255, 255, 255, 0);\n"], ["\n width: ", ";\n height: ", ";\n background: radial-gradient(white 50%, #ffffff00 calc(75% + 1px), #ffffff00 100%);\n border-radius: 50%;\n -mox-box-shadow: 0 0 1px ", ";\n -webkit-box-shadow: 0 0 1px ", ";\n box-shadow: 0 0 1px ", ";\n border: 0px solid rgba(255, 255, 255, 0);\n"])), function (_a) { + var size = _a.size; + return size; +}, function (_a) { + var size = _a.size; + return size; +}, function (_a) { + var native = _a.native; + return (native ? 'white' : 'black'); +}, function (_a) { + var native = _a.native; + return (native ? 'white' : 'black'); +}, function (_a) { + var native = _a.native; + return (native ? 'white' : 'black'); +}); +function CurrencyLogo(_a) { + var _b, _c; + var currency = _a.currency, _d = _a.size, size = _d === void 0 ? '24px' : _d, style = _a.style, rest = __rest(_a, ["currency", "size", "style"]); + var logoURIs = useCurrencyLogoURIs(currency); + return (jsx(StyledLogo$1, __assign({ size: size, native: (_b = currency === null || currency === void 0 ? void 0 : currency.isNative) !== null && _b !== void 0 ? _b : false, srcs: logoURIs, alt: ((_c = currency === null || currency === void 0 ? void 0 : currency.symbol) !== null && _c !== void 0 ? _c : 'token') + " logo", style: style }, rest), void 0)); +} +var templateObject_1$D; + +var Wrapper$c = styled.div(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-direction: row;\n margin-left: ", ";\n"], ["\n position: relative;\n display: flex;\n flex-direction: row;\n margin-left: ", ";\n"])), function (_a) { + var sizeraw = _a.sizeraw, margin = _a.margin; + return margin && (sizeraw / 3 + 8).toString() + 'px'; +}); +var HigherLogo = styled(CurrencyLogo)(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n z-index: 2;\n"], ["\n z-index: 2;\n"]))); +var CoveredLogo = styled(CurrencyLogo)(templateObject_3$l || (templateObject_3$l = __makeTemplateObject(["\n position: absolute;\n left: ", " !important;\n"], ["\n position: absolute;\n left: ", " !important;\n"])), function (_a) { + var sizeraw = _a.sizeraw; + return '-' + (sizeraw / 2).toString() + 'px'; +}); +function DoubleCurrencyLogo(_a) { + var currency0 = _a.currency0, currency1 = _a.currency1, _b = _a.size, size = _b === void 0 ? 16 : _b, _c = _a.margin, margin = _c === void 0 ? false : _c; + return (jsxs(Wrapper$c, __assign({ sizeraw: size, margin: margin }, { children: [currency0 && jsx(HigherLogo, { currency: currency0, size: size.toString() + 'px' }, void 0), currency1 && jsx(CoveredLogo, { currency: currency1, size: size.toString() + 'px', sizeraw: size }, void 0)] }), void 0)); +} +var templateObject_1$C, templateObject_2$q, templateObject_3$l; + +/** + * Returns a WrappedTokenInfo from the active token lists when possible, + * or the passed token otherwise. */ +function useTokenInfoFromActiveList(currency) { + var chainId = useActiveWeb3React().chainId; + var activeList = useCombinedActiveList(); + return useMemo(function () { + if (!chainId) + return; + if (currency.isNative) + return currency; + try { + return activeList[chainId][currency.wrapped.address].token; + } + catch (e) { + return currency; + } + }, [activeList, chainId, currency]); +} + +var _line; + +function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); } + +const SvgDotLine = props => /*#__PURE__*/React.createElement("svg", _extends$3({ + width: "100%", + height: 35, + viewBox: "800 0 300 200", + xmlns: "http://www.w3.org/2000/svg" +}, props), _line || (_line = /*#__PURE__*/React.createElement("line", { + x1: 0, + x2: 2000, + y1: 100, + y2: 100, + stroke: "currentColor", + strokeWidth: 20, + strokeLinecap: "round", + strokeDasharray: "1, 45" +}))); + +var Wrapper$b = styled(Box$1)(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["\n align-items: center;\n width: 100%;\n"], ["\n align-items: center;\n width: 100%;\n"]))); +var RouteContainerRow = styled(Row$1)(templateObject_2$p || (templateObject_2$p = __makeTemplateObject(["\n display: grid;\n grid-template-columns: 24px 1fr 24px;\n"], ["\n display: grid;\n grid-template-columns: 24px 1fr 24px;\n"]))); +var RouteRow = styled(Row$1)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n align-items: center;\n display: flex;\n justify-content: center;\n padding: 0.1rem 0.5rem;\n position: relative;\n"], ["\n align-items: center;\n display: flex;\n justify-content: center;\n padding: 0.1rem 0.5rem;\n position: relative;\n"]))); +var PoolBadge = styled(Badge)(templateObject_4$c || (templateObject_4$c = __makeTemplateObject(["\n display: flex;\n padding: 4px 4px;\n"], ["\n display: flex;\n padding: 4px 4px;\n"]))); +var DottedLine = styled.div(templateObject_5$b || (templateObject_5$b = __makeTemplateObject(["\n display: flex;\n align-items: center;\n position: absolute;\n width: calc(100%);\n z-index: 1;\n opacity: 0.5;\n"], ["\n display: flex;\n align-items: center;\n position: absolute;\n width: calc(100%);\n z-index: 1;\n opacity: 0.5;\n"]))); +var DotColor = styled(SvgDotLine)(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n path {\n stroke: ", ";\n }\n"], ["\n path {\n stroke: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.bg4; +}); +var OpaqueBadge = styled(Badge)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 8px;\n display: grid;\n font-size: 12px;\n grid-gap: 4px;\n grid-auto-flow: column;\n justify-content: start;\n padding: 4px 6px 4px 4px;\n z-index: ", ";\n"], ["\n background-color: ", ";\n border-radius: 8px;\n display: grid;\n font-size: 12px;\n grid-gap: 4px;\n grid-auto-flow: column;\n justify-content: start;\n padding: 4px 6px 4px 4px;\n z-index: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}, Z_INDEX.sticky); +var ProtocolBadge = styled(Badge)(templateObject_8$4 || (templateObject_8$4 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 4px;\n color: ", ";\n font-size: 10px;\n padding: 2px 4px;\n z-index: ", ";\n"], ["\n background-color: ", ";\n border-radius: 4px;\n color: ", ";\n font-size: 10px;\n padding: 2px 4px;\n z-index: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}, Z_INDEX.sticky + 1); +var BadgeText = styled(ThemedText.Small)(templateObject_9$4 || (templateObject_9$4 = __makeTemplateObject(["\n word-break: normal;\n"], ["\n word-break: normal;\n"]))); +function RoutingDiagram(_a) { + var currencyIn = _a.currencyIn, currencyOut = _a.currencyOut, routes = _a.routes; + var tokenIn = useTokenInfoFromActiveList(currencyIn); + var tokenOut = useTokenInfoFromActiveList(currencyOut); + return (jsx(Wrapper$b, { children: routes.map(function (entry, index) { return (jsxs(RouteContainerRow, { children: [jsx(CurrencyLogo, { currency: tokenIn, size: '20px' }, void 0), jsx(Route, { entry: entry }, void 0), jsx(CurrencyLogo, { currency: tokenOut, size: '20px' }, void 0)] }, index)); }) }, void 0)); +} +function Route(_a) { + var _b = _a.entry, percent = _b.percent, path = _b.path, protocol = _b.protocol; + return (jsxs(RouteRow, { children: [jsx(DottedLine, { children: jsx(DotColor, {}, void 0) }, void 0), jsxs(OpaqueBadge, { children: [jsx(ProtocolBadge, { children: jsx(BadgeText, __assign({ fontSize: 12 }, { children: protocol.toUpperCase() }), void 0) }, void 0), jsxs(BadgeText, __assign({ fontSize: 14, style: { minWidth: 'auto' } }, { children: [percent.toSignificant(2), "%"] }), void 0)] }, void 0), jsx(AutoRow, __assign({ gap: "1px", width: "100%", style: { justifyContent: 'space-evenly', zIndex: 2 } }, { children: path.map(function (_a, index) { + var _b = __read(_a, 3), currency0 = _b[0], currency1 = _b[1], feeAmount = _b[2]; + return (jsx(Pool, { currency0: currency0, currency1: currency1, feeAmount: feeAmount }, index)); + }) }), void 0)] }, void 0)); +} +function Pool(_a) { + var currency0 = _a.currency0, currency1 = _a.currency1, feeAmount = _a.feeAmount; + var tokenInfo0 = useTokenInfoFromActiveList(currency0); + var tokenInfo1 = useTokenInfoFromActiveList(currency1); + // TODO - link pool icon to info.uniswap.org via query params + return (jsx(MouseoverTooltip, __assign({ text: jsxs(Trans, { children: [(tokenInfo0 === null || tokenInfo0 === void 0 ? void 0 : tokenInfo0.symbol) + '/' + (tokenInfo1 === null || tokenInfo1 === void 0 ? void 0 : tokenInfo1.symbol) + ' ' + feeAmount / 10000, "% pool"] }, void 0) }, { children: jsxs(PoolBadge, { children: [jsx(Box$1, __assign({ margin: "0 4px 0 12px" }, { children: jsx(DoubleCurrencyLogo, { currency0: tokenInfo1, currency1: tokenInfo0, size: 20 }, void 0) }), void 0), jsxs(ThemedText.Small, __assign({ fontSize: 14 }, { children: [feeAmount / 10000, "%"] }), void 0)] }, void 0) }), void 0)); +} +var templateObject_1$B, templateObject_2$p, templateObject_3$k, templateObject_4$c, templateObject_5$b, templateObject_6$7, templateObject_7$6, templateObject_8$4, templateObject_9$4; + +var _defs, _path$2; + +function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); } + +const SvgAutoRouter = props => /*#__PURE__*/React.createElement("svg", _extends$2({ + width: 23, + height: 20, + viewBox: "0 0 23 20", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}, props), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", { + id: "gradient1", + x1: 0, + y1: 0, + x2: 1, + y2: 0, + gradientTransform: "rotate(95)" +}, /*#__PURE__*/React.createElement("stop", { + id: "stop1", + offset: 0, + stopColor: "#2274E2" +}), /*#__PURE__*/React.createElement("stop", { + id: "stop1", + offset: 0.5, + stopColor: "#2274E2" +}), /*#__PURE__*/React.createElement("stop", { + id: "stop2", + offset: 1, + stopColor: "#3FB672" +})))), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", { + d: "M16 16C10 16 9 10 5 10M16 16C16 17.6569 17.3431 19 19 19C20.6569 19 22 17.6569 22 16C22 14.3431 20.6569 13 19 13C17.3431 13 16 14.3431 16 16ZM5 10C9 10 10 4 16 4M5 10H1.5M16 4C16 5.65685 17.3431 7 19 7C20.6569 7 22 5.65685 22 4C22 2.34315 20.6569 1 19 1C17.3431 1 16 2.34315 16 4Z", + strokeWidth: 2, + strokeLinecap: "round", + strokeLinejoin: "round", + stroke: "url(#gradient1)" +}))); + +var _path$1; + +function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); } + +const SvgStaticRoute = props => /*#__PURE__*/React.createElement("svg", _extends$1({ + width: 20, + height: 20, + viewBox: "0 0 20 22", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", { + d: "M19 18C19 18.5523 18.5523 19 18 19V21C19.6569 21 21 19.6569 21 18H19ZM18 19C17.4477 19 17 18.5523 17 18H15C15 19.6569 16.3431 21 18 21V19ZM17 18C17 17.4477 17.4477 17 18 17V15C16.3431 15 15 16.3431 15 18H17ZM18 17C18.5523 17 19 17.4477 19 18H21C21 16.3431 19.6569 15 18 15V17ZM8 7H16V5H8V7ZM16 11H8V13H16V11ZM8 19H16V17H8V19ZM4 15C4 17.2091 5.79086 19 8 19V17C6.89543 17 6 16.1046 6 15H4ZM8 11C5.79086 11 4 12.7909 4 15H6C6 13.8954 6.89543 13 8 13V11ZM18 9C18 10.1046 17.1046 11 16 11V13C18.2091 13 20 11.2091 20 9H18ZM16 7C17.1046 7 18 7.89543 18 9H20C20 6.79086 18.2091 5 16 5V7ZM7 6C7 6.55228 6.55228 7 6 7V9C7.65685 9 9 7.65685 9 6H7ZM6 7C5.44772 7 5 6.55228 5 6H3C3 7.65685 4.34315 9 6 9V7ZM5 6C5 5.44772 5.44772 5 6 5V3C4.34315 3 3 4.34315 3 6H5ZM6 5C6.55228 5 7 5.44772 7 6H9C9 4.34315 7.65685 3 6 3V5Z" +}))); + +var StyledAutoRouterIcon = styled(SvgAutoRouter)(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n height: 16px;\n width: 16px;\n\n :hover {\n filter: brightness(1.3);\n }\n"], ["\n height: 16px;\n width: 16px;\n\n :hover {\n filter: brightness(1.3);\n }\n"]))); +var StyledStaticRouterIcon = styled(SvgStaticRoute)(templateObject_2$o || (templateObject_2$o = __makeTemplateObject(["\n height: 16px;\n width: 16px;\n\n fill: ", ";\n\n :hover {\n filter: brightness(1.3);\n }\n"], ["\n height: 16px;\n width: 16px;\n\n fill: ", ";\n\n :hover {\n filter: brightness(1.3);\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}); +var StyledAutoRouterLabel = styled(ThemedText.Black)(templateObject_3$j || (templateObject_3$j = __makeTemplateObject(["\n line-height: 1rem;\n\n /* fallback color */\n color: ", ";\n\n @supports (-webkit-background-clip: text) and (-webkit-text-fill-color: transparent) {\n background-image: linear-gradient(90deg, #2172e5 0%, #54e521 163.16%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n"], ["\n line-height: 1rem;\n\n /* fallback color */\n color: ", ";\n\n @supports (-webkit-background-clip: text) and (-webkit-text-fill-color: transparent) {\n background-image: linear-gradient(90deg, #2172e5 0%, #54e521 163.16%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.green1; +}); +function AutoRouterLogo() { + var autoRouterSupported = useAutoRouterSupported(); + return autoRouterSupported ? jsx(StyledAutoRouterIcon, {}, void 0) : jsx(StyledStaticRouterIcon, {}, void 0); +} +function AutoRouterLabel() { + var autoRouterSupported = useAutoRouterSupported(); + return autoRouterSupported ? (jsx(StyledAutoRouterLabel, __assign({ fontSize: 14 }, { children: "Auto Router" }), void 0)) : (jsx(ThemedText.Black, __assign({ fontSize: 14 }, { children: jsx(Trans, { children: "Trade Route" }, void 0) }), void 0)); +} +var templateObject_1$A, templateObject_2$o, templateObject_3$j; + +var Wrapper$a = styled(AutoColumn)(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["\n padding: ", ";\n border-radius: 16px;\n border: 1px solid ", ";\n cursor: pointer;\n"], ["\n padding: ", ";\n border-radius: 16px;\n border: 1px solid ", ";\n cursor: pointer;\n"])), function (_a) { + var fixedOpen = _a.fixedOpen; + return (fixedOpen ? '12px' : '12px 8px 12px 12px'); +}, function (_a) { + var theme = _a.theme, fixedOpen = _a.fixedOpen; + return (fixedOpen ? 'transparent' : theme.bg2); +}); +var OpenCloseIcon = styled(Plus)(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n margin-left: 8px;\n height: 20px;\n stroke-width: 2px;\n transition: transform 0.1s;\n transform: ", ";\n stroke: ", ";\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n"], ["\n margin-left: 8px;\n height: 20px;\n stroke-width: 2px;\n transition: transform 0.1s;\n transform: ", ";\n stroke: ", ";\n cursor: pointer;\n :hover {\n opacity: 0.8;\n }\n"])), function (_a) { + var open = _a.open; + return (open ? 'rotate(45deg)' : 'none'); +}, function (_a) { + var theme = _a.theme; + return theme.text3; +}); +var V2_DEFAULT_FEE_TIER = 3000; +var SwapRoute = memo(function SwapRoute(_a) { + var trade = _a.trade, syncing = _a.syncing, _b = _a.fixedOpen, fixedOpen = _b === void 0 ? false : _b, rest = __rest(_a, ["trade", "syncing", "fixedOpen"]); + var autoRouterSupported = useAutoRouterSupported(); + var routes = getTokenPath(trade); + var _c = __read(useState(false), 2), open = _c[0], setOpen = _c[1]; + var chainId = useActiveWeb3React().chainId; + var _d = __read(useDarkModeManager(), 1), darkMode = _d[0]; + var formattedGasPriceString = (trade === null || trade === void 0 ? void 0 : trade.gasUseEstimateUSD) + ? trade.gasUseEstimateUSD.toFixed(2) === '0.00' + ? '<$0.01' + : '$' + trade.gasUseEstimateUSD.toFixed(2) + : undefined; + return (jsxs(Wrapper$a, __assign({}, rest, { darkMode: darkMode, fixedOpen: fixedOpen }, { children: [jsxs(RowBetween, __assign({ onClick: function () { return setOpen(!open); } }, { children: [jsxs(AutoRow, __assign({ gap: "4px", width: "auto" }, { children: [jsx(AutoRouterLogo, {}, void 0), jsx(AutoRouterLabel, {}, void 0)] }), void 0), fixedOpen ? null : jsx(OpenCloseIcon, { open: open }, void 0)] }), void 0), jsx(AnimatedDropdown, __assign({ open: open || fixedOpen }, { children: jsxs(AutoRow, __assign({ gap: "4px", width: "auto", style: { paddingTop: '12px', margin: 0 } }, { children: [syncing ? (jsx(LoadingRows, { children: jsx("div", { style: { width: '400px', height: '30px' } }, void 0) }, void 0)) : (jsx(RoutingDiagram, { currencyIn: trade.inputAmount.currency, currencyOut: trade.outputAmount.currency, routes: routes }, void 0)), autoRouterSupported && (jsxs(Fragment, { children: [jsx(Separator$1, {}, void 0), syncing ? (jsx(LoadingRows, { children: jsx("div", { style: { width: '250px', height: '15px' } }, void 0) }, void 0)) : (jsxs(ThemedText.Main, __assign({ fontSize: 12, width: 400, margin: 0 }, { children: [(trade === null || trade === void 0 ? void 0 : trade.gasUseEstimateUSD) && chainId && SUPPORTED_GAS_ESTIMATE_CHAIN_IDS.includes(chainId) ? (jsxs(Trans, { children: ["Best price route costs ~", formattedGasPriceString, " in gas. "] }, void 0)) : null, ' ', jsx(Trans, { children: "This route optimizes your total output by considering split routes, multiple hops, and the gas cost of each step." }, void 0)] }), void 0))] }, void 0))] }), void 0) }), void 0)] }), void 0)); +}); +function getTokenPath(trade) { + return trade.swaps.map(function (_a) { + var _b = _a.route, tokenPath = _b.path, pools = _b.pools, protocol = _b.protocol, inputAmount = _a.inputAmount, outputAmount = _a.outputAmount; + var portion = trade.tradeType === TradeType.EXACT_INPUT + ? inputAmount.divide(trade.inputAmount) + : outputAmount.divide(trade.outputAmount); + var percent = new Percent(portion.numerator, portion.denominator); + var path = []; + for (var i = 0; i < pools.length; i++) { + var nextPool = pools[i]; + var tokenIn = tokenPath[i]; + var tokenOut = tokenPath[i + 1]; + var entry = [ + tokenIn, + tokenOut, + nextPool instanceof Pair ? V2_DEFAULT_FEE_TIER : nextPool.fee, + ]; + path.push(entry); + } + return { + percent: percent, + path: path, + protocol: protocol, + }; + }); +} +var templateObject_1$z, templateObject_2$n; + +var GasWrapper = styled(RowFixed)(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n border-radius: 8px;\n padding: 4px 6px;\n height: 24px;\n color: ", ";\n background-color: ", ";\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n"], ["\n border-radius: 8px;\n padding: 4px 6px;\n height: 24px;\n color: ", ";\n background-color: ", ";\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}, function (_a) { + var theme = _a.theme; + return theme.bg1; +}); +var StyledGasIcon = styled(SvgGasIcon)(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n margin-right: 4px;\n height: 14px;\n & > * {\n stroke: ", ";\n }\n"], ["\n margin-right: 4px;\n height: 14px;\n & > * {\n stroke: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}); +function GasEstimateBadge(_a) { + var _b; + var trade = _a.trade, loading = _a.loading, showRoute = _a.showRoute, disableHover = _a.disableHover; + var formattedGasPriceString = (trade === null || trade === void 0 ? void 0 : trade.gasUseEstimateUSD) + ? trade.gasUseEstimateUSD.toFixed(2) === '0.00' + ? '<$0.01' + : '$' + trade.gasUseEstimateUSD.toFixed(2) + : undefined; + return (jsx(MouseoverTooltipContent, __assign({ wrap: false, disableHover: disableHover, content: loading ? null : (jsx(ResponsiveTooltipContainer, __assign({ origin: "top right", style: { + padding: showRoute ? '0' : '12px', + border: 'none', + borderRadius: showRoute ? '16px' : '12px', + maxWidth: '400px', + } }, { children: showRoute ? (trade ? (jsx(SwapRoute, { trade: trade, syncing: loading, fixedOpen: showRoute }, void 0)) : null) : (jsxs(AutoColumn, __assign({ gap: "4px", justify: "center" }, { children: [jsx(ThemedText.Main, __assign({ fontSize: "12px", textAlign: "center" }, { children: jsx(Trans, { children: "Estimated network fee" }, void 0) }), void 0), jsx(ThemedText.Body, __assign({ textAlign: "center", fontWeight: 500, style: { userSelect: 'none' } }, { children: jsxs(Trans, { children: ["$", (_b = trade === null || trade === void 0 ? void 0 : trade.gasUseEstimateUSD) === null || _b === void 0 ? void 0 : _b.toFixed(2)] }, void 0) }), void 0), jsx(ThemedText.Main, __assign({ fontSize: "10px", textAlign: "center", maxWidth: "140px", color: "text3" }, { children: jsx(Trans, { children: "Estimate may differ due to your wallet gas settings" }, void 0) }), void 0)] }), void 0)) }), void 0)), placement: "bottom", onOpen: function () { + return ReactGA.event({ + category: 'Gas', + action: 'Gas Details Tooltip Open', + }); + } }, { children: jsx(LoadingOpacityContainer, __assign({ "$loading": loading }, { children: jsxs(GasWrapper, { children: [jsx(StyledGasIcon, {}, void 0), formattedGasPriceString !== null && formattedGasPriceString !== void 0 ? formattedGasPriceString : null] }, void 0) }), void 0) }), void 0)); +} +var templateObject_1$y, templateObject_2$m; + +var Wrapper$9 = styled(Row$1)(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n width: 100%;\n justify-content: center;\n"], ["\n width: 100%;\n justify-content: center;\n"]))); +var StyledInfoIcon = styled(Info)(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n height: 16px;\n width: 16px;\n margin-right: 4px;\n color: ", ";\n"], ["\n height: 16px;\n width: 16px;\n margin-right: 4px;\n color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.text3; +}); +var StyledCard = styled(OutlineCard)(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n padding: 12px;\n border: 1px solid ", ";\n"], ["\n padding: 12px;\n border: 1px solid ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}); +var StyledHeaderRow = styled(RowBetween)(templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["\n padding: 4px 8px;\n border-radius: 12px;\n background-color: ", ";\n align-items: center;\n cursor: ", ";\n min-height: 40px;\n\n :hover {\n background-color: ", ";\n }\n"], ["\n padding: 4px 8px;\n border-radius: 12px;\n background-color: ", ";\n align-items: center;\n cursor: ", ";\n min-height: 40px;\n\n :hover {\n background-color: ", ";\n }\n"])), function (_a) { + var open = _a.open, theme = _a.theme; + return (open ? theme.bg1 : 'transparent'); +}, function (_a) { + var disabled = _a.disabled; + return (disabled ? 'initial' : 'pointer'); +}, function (_a) { + var theme = _a.theme, disabled = _a.disabled; + return (disabled ? theme.bg1 : darken(0.015, theme.bg1)); +}); +var RotatingArrow = styled(ChevronDown)(templateObject_5$a || (templateObject_5$a = __makeTemplateObject(["\n transform: ", ";\n transition: transform 0.1s linear;\n"], ["\n transform: ", ";\n transition: transform 0.1s linear;\n"])), function (_a) { + var open = _a.open; + return (open ? 'rotate(180deg)' : 'none'); +}); +var StyledPolling = styled.div(templateObject_7$5 || (templateObject_7$5 = __makeTemplateObject(["\n display: flex;\n height: 16px;\n width: 16px;\n margin-right: 2px;\n margin-left: 10px;\n align-items: center;\n color: ", ";\n transition: 250ms ease color;\n\n ", "\n"], ["\n display: flex;\n height: 16px;\n width: 16px;\n margin-right: 2px;\n margin-left: 10px;\n align-items: center;\n color: ", ";\n transition: 250ms ease color;\n\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_6$6 || (templateObject_6$6 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "]))); +}); +var StyledPollingDot = styled.div(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["\n width: 8px;\n height: 8px;\n min-height: 8px;\n min-width: 8px;\n border-radius: 50%;\n position: relative;\n background-color: ", ";\n transition: 250ms ease background-color;\n"], ["\n width: 8px;\n height: 8px;\n min-height: 8px;\n min-width: 8px;\n border-radius: 50%;\n position: relative;\n background-color: ", ";\n transition: 250ms ease background-color;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}); +var rotate360 = keyframes(templateObject_9$3 || (templateObject_9$3 = __makeTemplateObject(["\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n"], ["\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n"]))); +var Spinner = styled.div(templateObject_10$3 || (templateObject_10$3 = __makeTemplateObject(["\n animation: ", " 1s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n transform: translateZ(0);\n border-top: 1px solid transparent;\n border-right: 1px solid transparent;\n border-bottom: 1px solid transparent;\n border-left: 2px solid ", ";\n background: transparent;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n position: relative;\n transition: 250ms ease border-color;\n left: -3px;\n top: -3px;\n"], ["\n animation: ", " 1s cubic-bezier(0.83, 0, 0.17, 1) infinite;\n transform: translateZ(0);\n border-top: 1px solid transparent;\n border-right: 1px solid transparent;\n border-bottom: 1px solid transparent;\n border-left: 2px solid ", ";\n background: transparent;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n position: relative;\n transition: 250ms ease border-color;\n left: -3px;\n top: -3px;\n"])), rotate360, function (_a) { + var theme = _a.theme; + return theme.text1; +}); +function SwapDetailsDropdown(_a) { + var trade = _a.trade, syncing = _a.syncing, loading = _a.loading, showInverted = _a.showInverted, setShowInverted = _a.setShowInverted, allowedSlippage = _a.allowedSlippage; + var theme = useTheme$1(); + var chainId = useActiveWeb3React().chainId; + var _b = __read(useState(false), 2), showDetails = _b[0], setShowDetails = _b[1]; + return (jsx(Wrapper$9, { children: jsxs(AutoColumn, __assign({ gap: '8px', style: { width: '100%', marginBottom: '-8px' } }, { children: [jsxs(StyledHeaderRow, __assign({ onClick: function () { return setShowDetails(!showDetails); }, disabled: !trade, open: showDetails }, { children: [jsxs(RowFixed, __assign({ style: { position: 'relative' } }, { children: [loading || syncing ? (jsx(StyledPolling, { children: jsx(StyledPollingDot, { children: jsx(Spinner, {}, void 0) }, void 0) }, void 0)) : (jsx(HideSmall, { children: jsx(MouseoverTooltipContent, __assign({ wrap: false, content: jsx(ResponsiveTooltipContainer, __assign({ origin: "top right", style: { padding: '0' } }, { children: jsx(Card, __assign({ padding: "12px" }, { children: jsx(AdvancedSwapDetails, { trade: trade, allowedSlippage: allowedSlippage, syncing: syncing }, void 0) }), void 0) }), void 0), placement: "bottom", disableHover: showDetails }, { children: jsx(StyledInfoIcon, { color: trade ? theme.text3 : theme.bg3 }, void 0) }), void 0) }, void 0)), trade ? (jsx(LoadingOpacityContainer, __assign({ "$loading": syncing }, { children: jsx(TradePrice, { price: trade.executionPrice, showInverted: showInverted, setShowInverted: setShowInverted }, void 0) }), void 0)) : loading || syncing ? (jsx(ThemedText.Main, __assign({ fontSize: 14 }, { children: jsx(Trans, { children: "Fetching best price..." }, void 0) }), void 0)) : null] }), void 0), jsxs(RowFixed, { children: [!(trade === null || trade === void 0 ? void 0 : trade.gasUseEstimateUSD) || + showDetails || + !chainId || + !SUPPORTED_GAS_ESTIMATE_CHAIN_IDS.includes(chainId) ? null : (jsx(GasEstimateBadge, { trade: trade, loading: syncing || loading, showRoute: !showDetails, disableHover: showDetails }, void 0)), jsx(RotatingArrow, { stroke: trade ? theme.text3 : theme.bg3, open: Boolean(trade && showDetails) }, void 0)] }, void 0)] }), void 0), jsx(AnimatedDropdown, __assign({ open: showDetails }, { children: jsxs(AutoColumn, __assign({ gap: '8px', style: { padding: '0', paddingBottom: '8px' } }, { children: [trade ? (jsx(StyledCard, { children: jsx(AdvancedSwapDetails, { trade: trade, allowedSlippage: allowedSlippage, syncing: syncing }, void 0) }, void 0)) : null, trade ? jsx(SwapRoute, { trade: trade, syncing: syncing }, void 0) : null] }), void 0) }), void 0)] }), void 0) }, void 0)); +} +var templateObject_1$x, templateObject_2$l, templateObject_3$i, templateObject_4$b, templateObject_5$a, templateObject_6$6, templateObject_7$5, templateObject_8$3, templateObject_9$3, templateObject_10$3; + +var DetailsFooter = styled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n padding-top: calc(16px + 2rem);\n padding-bottom: 20px;\n margin-left: auto;\n margin-right: auto;\n margin-top: -2rem;\n width: 100%;\n max-width: 400px;\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n color: ", ";\n background-color: ", ";\n z-index: ", ";\n\n transform: ", ";\n transition: transform 300ms ease-in-out;\n text-align: center;\n"], ["\n padding-top: calc(16px + 2rem);\n padding-bottom: 20px;\n margin-left: auto;\n margin-right: auto;\n margin-top: -2rem;\n width: 100%;\n max-width: 400px;\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n color: ", ";\n background-color: ", ";\n z-index: ", ";\n\n transform: ", ";\n transition: transform 300ms ease-in-out;\n text-align: center;\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}, function (_a) { + var theme = _a.theme; + return theme.advancedBG; +}, Z_INDEX.deprecated_zero, function (_a) { + var show = _a.show; + return (show ? 'translateY(0%)' : 'translateY(-100%)'); +}); +var StyledButtonEmpty = styled(ButtonEmpty)(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\n text-decoration: none;\n"], ["\n text-decoration: none;\n"]))); +var AddressText$1 = styled(ThemedText.Blue)(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\n font-size: 12px;\n\n ", "\n"], ["\n font-size: 12px;\n\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_3$h || (templateObject_3$h = __makeTemplateObject(["\n font-size: 10px;\n"], ["\n font-size: 10px;\n"]))); +}); +function UnsupportedCurrencyFooter(_a) { + var show = _a.show, currencies = _a.currencies; + var chainId = useActiveWeb3React().chainId; + var _b = __read(useState(false), 2), showDetails = _b[0], setShowDetails = _b[1]; + var tokens = chainId && currencies + ? currencies.map(function (currency) { + return currency === null || currency === void 0 ? void 0 : currency.wrapped; + }) + : []; + var unsupportedTokens = useUnsupportedTokens(); + return (jsxs(DetailsFooter, __assign({ show: show }, { children: [jsx(Modal, __assign({ isOpen: showDetails, onDismiss: function () { return setShowDetails(false); } }, { children: jsx(Card, __assign({ padding: "2rem" }, { children: jsxs(AutoColumn, __assign({ gap: "lg" }, { children: [jsxs(RowBetween, { children: [jsx(ThemedText.MediumHeader, { children: jsx(Trans, { children: "Unsupported Assets" }, void 0) }, void 0), jsx(CloseIcon$2, { onClick: function () { return setShowDetails(false); } }, void 0)] }, void 0), tokens.map(function (token) { + var _a; + return (token && + unsupportedTokens && + Object.keys(unsupportedTokens).includes(token.address) && (jsx(OutlineCard, { children: jsxs(AutoColumn, __assign({ gap: "10px" }, { children: [jsxs(AutoRow, __assign({ gap: "5px", align: "center" }, { children: [jsx(CurrencyLogo, { currency: token, size: '24px' }, void 0), jsx(ThemedText.Body, __assign({ fontWeight: 500 }, { children: token.symbol }), void 0)] }), void 0), chainId && (jsx(ExternalLink, __assign({ href: getExplorerLink(chainId, token.address, ExplorerDataType.ADDRESS) }, { children: jsx(AddressText$1, { children: token.address }, void 0) }), void 0))] }), void 0) }, (_a = token.address) === null || _a === void 0 ? void 0 : _a.concat('not-supported')))); + }), jsx(AutoColumn, __assign({ gap: "lg" }, { children: jsx(ThemedText.Body, __assign({ fontWeight: 500 }, { children: jsx(Trans, { children: "Some assets are not available through this interface because they may not work well with the smart contracts or we are unable to allow trading for legal reasons." }, void 0) }), void 0) }), void 0)] }), void 0) }), void 0) }), void 0), jsx(StyledButtonEmpty, __assign({ padding: '0', onClick: function () { return setShowDetails(true); } }, { children: jsx(ThemedText.Blue, { children: jsx(Trans, { children: "Read more about unsupported assets" }, void 0) }, void 0) }), void 0)] }), void 0)); +} +var templateObject_1$w, templateObject_2$k, templateObject_3$h, templateObject_4$a; + +var ERC20_INTERFACE = new Interface([ + { + constant: false, + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'approve', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, +]); +function approveAmountCalldata(amount, spender) { + if (!amount.currency.isToken) + throw new Error('Must call with an amount of token'); + var approveData = ERC20_INTERFACE.encodeFunctionData('approve', [spender, toHex(amount.quotient)]); + return { + to: amount.currency.address, + data: approveData, + value: '0x0', + }; +} + +var ArgentWalletContractABI = [ + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "_transactions", + type: "tuple[]" + } + ], + name: "wc_multiCall", + outputs: [ + { + internalType: "bytes[]", + name: "", + type: "bytes[]" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_msgHash", + type: "bytes32" + }, + { + internalType: "bytes", + name: "_signature", + type: "bytes" + } + ], + name: "isValidSignature", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "view", + type: "function" + } +]; + +function useIsArgentWallet() { + var _a, _b; + var account = useActiveWeb3React().account; + var argentWalletDetector = useArgentWalletDetectorContract(); + var inputs = useMemo(function () { return [account !== null && account !== void 0 ? account : undefined]; }, [account]); + var call = useSingleCallResult(argentWalletDetector, 'isArgentWallet', inputs, NEVER_RELOAD); + return (_b = (_a = call === null || call === void 0 ? void 0 : call.result) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : false; +} + +function useArgentWalletContract() { + var account = useActiveWeb3React().account; + var isArgentWallet = useIsArgentWallet(); + return useContract(isArgentWallet ? account !== null && account !== void 0 ? account : undefined : undefined, ArgentWalletContractABI, true); +} + +/** + * Returns the swap calls that can be used to make the trade + * @param trade trade to execute + * @param allowedSlippage user allowed slippage + * @param recipientAddressOrName the ENS name or address of the recipient of the swap output + * @param signatureData the signature data of the permit of the input token amount, if available + */ +function useSwapCallArguments(trade, allowedSlippage, recipientAddressOrName, signatureData, deadline) { + var _a = useActiveWeb3React(), account = _a.account, chainId = _a.chainId, library = _a.library; + var recipientAddress = useENS(recipientAddressOrName).address; + var recipient = recipientAddressOrName === null ? account : recipientAddress; + var routerContract = useV2RouterContract(); + var argentWalletContract = useArgentWalletContract(); + return useMemo(function () { + if (!trade || !recipient || !library || !account || !chainId || !deadline) + return []; + if (trade instanceof Trade) { + if (!routerContract) + return []; + var swapMethods = []; + swapMethods.push(Router.swapCallParameters(trade, { + feeOnTransfer: false, + allowedSlippage: allowedSlippage, + recipient: recipient, + deadline: deadline.toNumber(), + })); + if (trade.tradeType === TradeType.EXACT_INPUT) { + swapMethods.push(Router.swapCallParameters(trade, { + feeOnTransfer: true, + allowedSlippage: allowedSlippage, + recipient: recipient, + deadline: deadline.toNumber(), + })); + } + return swapMethods.map(function (_a) { + var methodName = _a.methodName, args = _a.args, value = _a.value; + if (argentWalletContract && trade.inputAmount.currency.isToken) { + return { + address: argentWalletContract.address, + calldata: argentWalletContract.interface.encodeFunctionData('wc_multiCall', [ + [ + approveAmountCalldata(trade.maximumAmountIn(allowedSlippage), routerContract.address), + { + to: routerContract.address, + value: value, + data: routerContract.interface.encodeFunctionData(methodName, args), + }, + ], + ]), + value: '0x0', + }; + } + else { + return { + address: routerContract.address, + calldata: routerContract.interface.encodeFunctionData(methodName, args), + value: value, + }; + } + }); + } + else { + // swap options shared by v3 and v2+v3 swap routers + var sharedSwapOptions = __assign({ recipient: recipient, slippageTolerance: allowedSlippage }, (signatureData + ? { + inputTokenPermit: 'allowed' in signatureData + ? { + expiry: signatureData.deadline, + nonce: signatureData.nonce, + s: signatureData.s, + r: signatureData.r, + v: signatureData.v, + } + : { + deadline: signatureData.deadline, + amount: signatureData.amount, + s: signatureData.s, + r: signatureData.r, + v: signatureData.v, + }, + } + : {})); + var swapRouterAddress = chainId + ? trade instanceof Trade$2 + ? V3_ROUTER_ADDRESS[chainId] + : SWAP_ROUTER_ADDRESSES[chainId] + : undefined; + if (!swapRouterAddress) + return []; + var _a = trade instanceof Trade$2 + ? SwapRouter.swapCallParameters(trade, __assign(__assign({}, sharedSwapOptions), { deadline: deadline.toString() })) + : SwapRouter$1.swapCallParameters(trade, __assign(__assign({}, sharedSwapOptions), { deadlineOrPreviousBlockhash: deadline.toString() })), value = _a.value, calldata = _a.calldata; + if (argentWalletContract && trade.inputAmount.currency.isToken) { + return [ + { + address: argentWalletContract.address, + calldata: argentWalletContract.interface.encodeFunctionData('wc_multiCall', [ + [ + approveAmountCalldata(trade.maximumAmountIn(allowedSlippage), swapRouterAddress), + { + to: swapRouterAddress, + value: value, + data: calldata, + }, + ], + ]), + value: '0x0', + }, + ]; + } + return [ + { + address: swapRouterAddress, + calldata: calldata, + value: value, + }, + ]; + } + }, [ + trade, + recipient, + library, + account, + chainId, + deadline, + routerContract, + allowedSlippage, + argentWalletContract, + signatureData, + ]); +} + +/** + * This is hacking out the revert reason from the ethers provider thrown error however it can. + * This object seems to be undocumented by ethers. + * @param error an error from the ethers provider + */ +function swapErrorToUserReadableMessage(error) { + var _a, _b, _c, _d; + var reason; + while (Boolean(error)) { + reason = (_b = (_a = error.reason) !== null && _a !== void 0 ? _a : error.message) !== null && _b !== void 0 ? _b : reason; + error = (_c = error.error) !== null && _c !== void 0 ? _c : (_d = error.data) === null || _d === void 0 ? void 0 : _d.originalError; + } + if ((reason === null || reason === void 0 ? void 0 : reason.indexOf('execution reverted: ')) === 0) + reason = reason.substr('execution reverted: '.length); + switch (reason) { + case 'UniswapV2Router: EXPIRED': + return (jsx(Trans, { children: "The transaction could not be sent because the deadline has passed. Please check that your transaction deadline is not too low." }, void 0)); + case 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT': + case 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT': + return (jsx(Trans, { children: "This transaction will not succeed either due to price movement or fee on transfer. Try increasing your slippage tolerance." }, void 0)); + case 'TransferHelper: TRANSFER_FROM_FAILED': + return jsx(Trans, { children: "The input token cannot be transferred. There may be an issue with the input token." }, void 0); + case 'UniswapV2: TRANSFER_FAILED': + return jsx(Trans, { children: "The output token cannot be transferred. There may be an issue with the output token." }, void 0); + case 'UniswapV2: K': + return (jsx(Trans, { children: "The Uniswap invariant x*y=k was not satisfied by the swap. This usually means one of the tokens you are swapping incorporates custom behavior on transfer." }, void 0)); + case 'Too little received': + case 'Too much requested': + case 'STF': + return (jsx(Trans, { children: "This transaction will not succeed due to price movement. Try increasing your slippage tolerance. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3." }, void 0)); + case 'TF': + return (jsx(Trans, { children: "The output token cannot be transferred. There may be an issue with the output token. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3." }, void 0)); + default: + if ((reason === null || reason === void 0 ? void 0 : reason.indexOf('undefined is not an object')) !== -1) { + console.error(error, reason); + return (jsx(Trans, { children: "An error occurred when trying to execute this swap. You may need to increase your slippage tolerance. If that does not work, there may be an incompatibility with the token you are trading. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3." }, void 0)); + } + return (jsxs(Trans, { children: ["Unknown error", reason ? ": \"" + reason + "\"" : '', ". Try increasing your slippage tolerance. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3."] }, void 0)); + } +} + +// returns a function that will execute a swap, if the parameters are all valid +function useSendSwapTransaction(account, chainId, library, trade, // trade to execute, required +swapCalls) { + return useMemo(function () { + if (!trade || !library || !account || !chainId) { + return { callback: null }; + } + return { + callback: function onSwap() { + return __awaiter(this, void 0, void 0, function () { + var estimatedCalls, bestCallOption, errorCalls, firstNoErrorCall, _a, address, calldata, value; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: return [4 /*yield*/, Promise.all(swapCalls.map(function (call) { + var address = call.address, calldata = call.calldata, value = call.value; + var tx = !value || isZero(value) + ? { from: account, to: address, data: calldata } + : { + from: account, + to: address, + data: calldata, + value: value, + }; + return library + .estimateGas(tx) + .then(function (gasEstimate) { + return { + call: call, + gasEstimate: gasEstimate, + }; + }) + .catch(function (gasError) { + console.debug('Gas estimate failed, trying eth_call to extract error', call); + return library + .call(tx) + .then(function (result) { + console.debug('Unexpected successful call after failed estimate gas', call, gasError, result); + return { call: call, error: jsx(Trans, { children: "Unexpected issue with estimating the gas. Please try again." }, void 0) }; + }) + .catch(function (callError) { + console.debug('Call threw error', call, callError); + return { call: call, error: swapErrorToUserReadableMessage(callError) }; + }); + }); + })) + // a successful estimation is a bignumber gas estimate and the next call is also a bignumber gas estimate + ]; + case 1: + estimatedCalls = _b.sent(); + bestCallOption = estimatedCalls.find(function (el, ix, list) { + return 'gasEstimate' in el && (ix === list.length - 1 || 'gasEstimate' in list[ix + 1]); + }); + // check if any calls errored with a recognizable error + if (!bestCallOption) { + errorCalls = estimatedCalls.filter(function (call) { return 'error' in call; }); + if (errorCalls.length > 0) + throw errorCalls[errorCalls.length - 1].error; + firstNoErrorCall = estimatedCalls.find(function (call) { return !('error' in call); }); + if (!firstNoErrorCall) + throw new Error(t(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["Unexpected error. Could not estimate gas for the swap."], ["Unexpected error. Could not estimate gas for the swap."])))); + bestCallOption = firstNoErrorCall; + } + _a = bestCallOption.call, address = _a.address, calldata = _a.calldata, value = _a.value; + return [2 /*return*/, library + .getSigner() + .sendTransaction(__assign(__assign({ from: account, to: address, data: calldata }, ('gasEstimate' in bestCallOption ? { gasLimit: calculateGasMargin(bestCallOption.gasEstimate) } : {})), (value && !isZero(value) ? { value: value } : {}))) + .then(function (response) { + return response; + }) + .catch(function (error) { + // if the user rejected the tx, pass this along + if ((error === null || error === void 0 ? void 0 : error.code) === 4001) { + throw new Error(t(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["Transaction rejected."], ["Transaction rejected."])))); + } + else { + // otherwise, the error was unexpected and we need to convey that + console.error("Swap failed", error, address, calldata, value); + throw new Error(t(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["Swap failed: ", ""], ["Swap failed: ", ""])), swapErrorToUserReadableMessage(error))); + } + })]; + } + }); + }); + }, + }; + }, [account, chainId, library, swapCalls, trade]); +} +var templateObject_1$v, templateObject_2$j, templateObject_3$g; + +var SwapCallbackState; +(function (SwapCallbackState) { + SwapCallbackState[SwapCallbackState["INVALID"] = 0] = "INVALID"; + SwapCallbackState[SwapCallbackState["LOADING"] = 1] = "LOADING"; + SwapCallbackState[SwapCallbackState["VALID"] = 2] = "VALID"; +})(SwapCallbackState || (SwapCallbackState = {})); +// returns a function that will execute a swap, if the parameters are all valid +// and the user has approved the slippage adjusted input amount for the trade +function useSwapCallback$1(trade, // trade to execute, required +allowedSlippage, // in bips +recipientAddressOrName, // the ENS name or address of the recipient of the trade, or null if swap should be returned to sender +signatureData, deadline) { + var _a = useActiveWeb3React(), account = _a.account, chainId = _a.chainId, library = _a.library; + var swapCalls = useSwapCallArguments(trade, allowedSlippage, recipientAddressOrName, signatureData, deadline); + var callback = useSendSwapTransaction(account, chainId, library, trade, swapCalls).callback; + var recipientAddress = useENS(recipientAddressOrName).address; + var recipient = recipientAddressOrName === null ? account : recipientAddress; + return useMemo(function () { + if (!trade || !library || !account || !chainId || !callback) { + return { state: SwapCallbackState.INVALID, callback: null, error: jsx(Trans, { children: "Missing dependencies" }, void 0) }; + } + if (!recipient) { + if (recipientAddressOrName !== null) { + return { state: SwapCallbackState.INVALID, callback: null, error: jsx(Trans, { children: "Invalid recipient" }, void 0) }; + } + else { + return { state: SwapCallbackState.LOADING, callback: null, error: null }; + } + } + return { + state: SwapCallbackState.VALID, + callback: function onSwap() { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, callback().then(function (response) { + return response; + })]; + }); + }); + }, + error: null, + }; + }, [trade, library, account, chainId, callback, recipient, recipientAddressOrName]); +} + +function currencyId(currency) { + if (currency.isNative) + return 'ETH'; + if (currency.isToken) + return currency.address; + throw new Error('invalid currency'); +} + +// combines the block timestamp with the user setting to give the deadline that should be used for any submitted transaction +function useTransactionDeadline() { + var chainId = useActiveWeb3React().chainId; + var ttl = useAppSelector(function (state) { return state.user.userDeadline; }); + var blockTimestamp = useCurrentBlockTimestamp(); + return useMemo(function () { + if (blockTimestamp && chainId && L2_CHAIN_IDS.includes(chainId)) + return blockTimestamp.add(L2_DEADLINE_FROM_NOW); + if (blockTimestamp && ttl) + return blockTimestamp.add(ttl); + return undefined; + }, [blockTimestamp, chainId, ttl]); +} + +// eslint-disable-next-line no-restricted-imports +// returns a function that will execute a swap, if the parameters are all valid +// and the user has approved the slippage adjusted input amount for the trade +function useSwapCallback(trade, // trade to execute, required +allowedSlippage, // in bips +recipientAddressOrName, // the ENS name or address of the recipient of the trade, or null if swap should be returned to sender +signatureData) { + var account = useActiveWeb3React().account; + var deadline = useTransactionDeadline(); + var addTransaction = useTransactionAdder(); + var recipientAddress = useENS(recipientAddressOrName).address; + var recipient = recipientAddressOrName === null ? account : recipientAddress; + var _a = useSwapCallback$1(trade, allowedSlippage, recipient, signatureData, deadline), state = _a.state, libCallback = _a.callback, error = _a.error; + var callback = useMemo(function () { + if (!libCallback || !trade) { + return null; + } + return function () { + return libCallback().then(function (response) { + addTransaction(response, trade.tradeType === TradeType.EXACT_INPUT + ? { + type: TransactionType.SWAP, + tradeType: TradeType.EXACT_INPUT, + inputCurrencyId: currencyId(trade.inputAmount.currency), + inputCurrencyAmountRaw: trade.inputAmount.quotient.toString(), + expectedOutputCurrencyAmountRaw: trade.outputAmount.quotient.toString(), + outputCurrencyId: currencyId(trade.outputAmount.currency), + minimumOutputCurrencyAmountRaw: trade.minimumAmountOut(allowedSlippage).quotient.toString(), + } + : { + type: TransactionType.SWAP, + tradeType: TradeType.EXACT_OUTPUT, + inputCurrencyId: currencyId(trade.inputAmount.currency), + maximumInputCurrencyAmountRaw: trade.maximumAmountIn(allowedSlippage).quotient.toString(), + outputCurrencyId: currencyId(trade.outputAmount.currency), + outputCurrencyAmountRaw: trade.outputAmount.quotient.toString(), + expectedInputCurrencyAmountRaw: trade.inputAmount.quotient.toString(), + }); + return response.hash; + }); + }; + }, [addTransaction, allowedSlippage, libCallback, trade]); + return { + state: state, + callback: callback, + error: error, + }; +} + +function formatCurrencyAmount(amount, sigFigs) { + if (!amount) { + return '-'; + } + if (JSBI.equal(amount.quotient, JSBI.BigInt(0))) { + return '0'; + } + if (amount.divide(amount.decimalScale).lessThan(new Fraction(1, 100000))) { + return '<0.00001'; + } + return amount.toSignificant(sigFigs); +} + +var _path; + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +const SvgDropdown = props => /*#__PURE__*/React.createElement("svg", _extends({ + width: 12, + height: 7, + viewBox: "0 0 12 7", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}, props), _path || (_path = /*#__PURE__*/React.createElement("path", { + d: "M0.97168 1L6.20532 6L11.439 1", + stroke: "#AEAEAE" +}))); + +var StyledInput = styled.input(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n color: ", ";\n width: 0;\n position: relative;\n font-weight: 500;\n outline: none;\n border: none;\n flex: 1 1 auto;\n background-color: ", ";\n font-size: ", ";\n text-align: ", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 0px;\n -webkit-appearance: textfield;\n text-align: right;\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n [type='number'] {\n -moz-appearance: textfield;\n }\n\n ::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n\n ::placeholder {\n color: ", ";\n }\n"], ["\n color: ", ";\n width: 0;\n position: relative;\n font-weight: 500;\n outline: none;\n border: none;\n flex: 1 1 auto;\n background-color: ", ";\n font-size: ", ";\n text-align: ", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 0px;\n -webkit-appearance: textfield;\n text-align: right;\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n [type='number'] {\n -moz-appearance: textfield;\n }\n\n ::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n\n ::placeholder {\n color: ", ";\n }\n"])), function (_a) { + var error = _a.error, theme = _a.theme; + return (error ? theme.red1 : theme.text1); +}, function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var fontSize = _a.fontSize; + return fontSize !== null && fontSize !== void 0 ? fontSize : '28px'; +}, function (_a) { + var align = _a.align; + return align && align; +}, function (_a) { + var theme = _a.theme; + return theme.text4; +}); +var inputRegex = RegExp("^\\d*(?:\\\\[.])?\\d*$"); // match escaped "." characters via in a non-capturing group +var Input$1 = React__default.memo(function InnerInput(_a) { + var value = _a.value, onUserInput = _a.onUserInput, placeholder = _a.placeholder, prependSymbol = _a.prependSymbol, rest = __rest(_a, ["value", "onUserInput", "placeholder", "prependSymbol"]); + var enforcer = function (nextUserInput) { + if (nextUserInput === '' || inputRegex.test(escapeRegExp(nextUserInput))) { + onUserInput(nextUserInput); + } + }; + return (jsx(StyledInput, __assign({}, rest, { value: prependSymbol && value ? prependSymbol + value : value, onChange: function (event) { + if (prependSymbol) { + var value_1 = event.target.value; + // cut off prepended symbol + var formattedValue = value_1.toString().includes(prependSymbol) + ? value_1.toString().slice(1, value_1.toString().length + 1) + : value_1; + // replace commas with periods, because uniswap exclusively uses period as the decimal separator + enforcer(formattedValue.replace(/,/g, '.')); + } + else { + enforcer(event.target.value.replace(/,/g, '.')); + } + }, + // universal input options + inputMode: "decimal", autoComplete: "off", autoCorrect: "off", + // text-specific options + type: "text", pattern: "^[0-9]*[.,]?[0-9]*$", placeholder: placeholder || '0.0', minLength: 1, maxLength: 79, spellCheck: "false" }), void 0)); +}); +var templateObject_1$u; + +/** + * Returns the last value of type T that passes a filter function + * @param value changing value + * @param filterFn function that determines whether a given value should be considered for the last value + */ +function useLast(value, filterFn) { + var _a = __read(useState(filterFn && filterFn(value) ? value : undefined), 2), last = _a[0], setLast = _a[1]; + useEffect(function () { + setLast(function (last) { + var shouldUse = filterFn ? filterFn(value) : true; + if (shouldUse) + return value; + return last; + }); + }, [filterFn, value]); + return last; +} + +function useToggle(initialState) { + if (initialState === void 0) { initialState = false; } + var _a = __read(useState(initialState), 2), state = _a[0], setState = _a[1]; + var toggle = useCallback(function () { return setState(function (state) { return !state; }); }, []); + return [state, toggle]; +} + +var MobileWrapper = styled(AutoColumn)(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "]))); +}); +var BaseWrapper = styled.div(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n border: 1px solid ", ";\n border-radius: 10px;\n display: flex;\n padding: 6px;\n\n align-items: center;\n :hover {\n cursor: ", ";\n background-color: ", ";\n }\n\n color: ", ";\n background-color: ", ";\n filter: ", ";\n"], ["\n border: 1px solid ", ";\n border-radius: 10px;\n display: flex;\n padding: 6px;\n\n align-items: center;\n :hover {\n cursor: ", ";\n background-color: ", ";\n }\n\n color: ", ";\n background-color: ", ";\n filter: ", ";\n"])), function (_a) { + var theme = _a.theme, disable = _a.disable; + return (disable ? 'transparent' : theme.bg3); +}, function (_a) { + var disable = _a.disable; + return !disable && 'pointer'; +}, function (_a) { + var theme = _a.theme, disable = _a.disable; + return !disable && theme.bg2; +}, function (_a) { + var theme = _a.theme, disable = _a.disable; + return disable && theme.text3; +}, function (_a) { + var theme = _a.theme, disable = _a.disable; + return disable && theme.bg3; +}, function (_a) { + var disable = _a.disable; + return disable && 'grayscale(1)'; +}); +function CommonBases(_a) { + var _b; + var chainId = _a.chainId, onSelect = _a.onSelect, selectedCurrency = _a.selectedCurrency; + var bases = typeof chainId !== 'undefined' ? (_b = COMMON_BASES[chainId]) !== null && _b !== void 0 ? _b : [] : []; + return bases.length > 0 ? (jsx(MobileWrapper, __assign({ gap: "md" }, { children: jsx(AutoRow, __assign({ gap: "4px" }, { children: bases.map(function (currency) { + var isSelected = selectedCurrency === null || selectedCurrency === void 0 ? void 0 : selectedCurrency.equals(currency); + return (jsxs(BaseWrapper, __assign({ onClick: function () { return !isSelected && onSelect(currency); }, disable: isSelected }, { children: [jsx(CurrencyLogoFromList, { currency: currency }, void 0), jsx(Text$1, __assign({ fontWeight: 500, fontSize: 16 }, { children: currency.symbol }), void 0)] }), currencyId(currency))); + }) }), void 0) }), void 0)) : null; +} +/** helper component to retrieve a base currency from the active token lists */ +function CurrencyLogoFromList(_a) { + var currency = _a.currency; + var token = useTokenInfoFromActiveList(currency); + return jsx(CurrencyLogo, { currency: token, style: { marginRight: 8 } }, void 0); +} +var templateObject_1$t, templateObject_2$i, templateObject_3$f; + +var QuestionWrapper = styled.div(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0px;\n width: 18px;\n height: 18px;\n border: none;\n background: none;\n outline: none;\n cursor: default;\n border-radius: 36px;\n font-size: 12px;\n background-color: ", ";\n color: ", ";\n\n :hover,\n :focus {\n opacity: 0.7;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0px;\n width: 18px;\n height: 18px;\n border: none;\n background: none;\n outline: none;\n cursor: default;\n border-radius: 36px;\n font-size: 12px;\n background-color: ", ";\n color: ", ";\n\n :hover,\n :focus {\n opacity: 0.7;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var QuestionMark = styled.span(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\n font-size: 14px;\n"], ["\n font-size: 14px;\n"]))); +function QuestionHelper(_a) { + var text = _a.text; + var _b = __read(useState(false), 2), show = _b[0], setShow = _b[1]; + var open = useCallback(function () { return setShow(true); }, [setShow]); + var close = useCallback(function () { return setShow(false); }, [setShow]); + return (jsx("span", __assign({ style: { marginLeft: 4, display: 'flex', alignItems: 'center' } }, { children: jsx(Tooltip, __assign({ text: text, show: show }, { children: jsx(QuestionWrapper, __assign({ onClick: open, onMouseEnter: open, onMouseLeave: close }, { children: jsx(QuestionMark, { children: "?" }, void 0) }), void 0) }), void 0) }), void 0)); +} +var templateObject_1$s, templateObject_2$h; + +var TokenListLogo = "data:image/svg+xml,%3Csvg%20width%3D%22225%22%20height%3D%22225%22%20viewBox%3D%220%200%20225%20225%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M74.8125%20190.529C65.7561%20190.513%2055.5298%20183.748%2051.9715%20175.42L19.9417%20100.456C16.3834%2092.1277%2020.8404%2085.39%2029.8968%2085.4068L111.417%2085.5579C120.473%2085.5747%20130.699%2092.3395%20134.258%20100.668L166.288%20175.632C169.846%20183.96%20165.389%20190.697%20156.332%20190.681L74.8125%20190.529Z%22%20fill%3D%22%23131313%22%2F%3E%3Cpath%20d%3D%22M92.1541%20164.065C83.0977%20164.049%2072.8715%20157.284%2069.3132%20148.956L28.3003%2052.9672C24.7419%2044.6391%2029.199%2037.9015%2038.2554%2037.9182L142.638%2038.1117C151.695%2038.1285%20161.921%2044.8933%20165.479%2053.2214L206.492%20149.21C210.051%20157.538%20205.594%20164.276%20196.537%20164.259L92.1541%20164.065Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M92.1541%20164.065C83.0977%20164.049%2072.8715%20157.284%2069.3132%20148.956L28.3003%2052.9672C24.7419%2044.6391%2029.199%2037.9015%2038.2554%2037.9182L142.638%2038.1117C151.695%2038.1285%20161.921%2044.8933%20165.479%2053.2214L206.492%20149.21C210.051%20157.538%20205.594%20164.276%20196.537%20164.259L92.1541%20164.065Z%22%20fill%3D%22url%28%23paint0_radial%29%22%2F%3E%3Cpath%20d%3D%22M92.1541%20164.065C83.0977%20164.049%2072.8715%20157.284%2069.3132%20148.956L28.3003%2052.9672C24.7419%2044.6391%2029.199%2037.9015%2038.2554%2037.9182L142.638%2038.1117C151.695%2038.1285%20161.921%2044.8933%20165.479%2053.2214L206.492%20149.21C210.051%20157.538%20205.594%20164.276%20196.537%20164.259L92.1541%20164.065Z%22%20fill%3D%22url%28%23paint1_radial%29%22%2F%3E%3Cpath%20d%3D%22M92.1541%20164.065C83.0977%20164.049%2072.8715%20157.284%2069.3132%20148.956L28.3003%2052.9672C24.7419%2044.6391%2029.199%2037.9015%2038.2554%2037.9182L142.638%2038.1117C151.695%2038.1285%20161.921%2044.8933%20165.479%2053.2214L206.492%20149.21C210.051%20157.538%20205.594%20164.276%20196.537%20164.259L92.1541%20164.065Z%22%20fill%3D%22url%28%23paint2_radial%29%22%2F%3E%3Cpath%20d%3D%22M92.1541%20164.065C83.0977%20164.049%2072.8715%20157.284%2069.3132%20148.956L28.3003%2052.9672C24.7419%2044.6391%2029.199%2037.9015%2038.2554%2037.9182L142.638%2038.1117C151.695%2038.1285%20161.921%2044.8933%20165.479%2053.2214L206.492%20149.21C210.051%20157.538%20205.594%20164.276%20196.537%20164.259L92.1541%20164.065Z%22%20fill%3D%22url%28%23paint3_radial%29%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M92.958%20165.95C82.7695%20165.931%2071.265%20158.321%2067.2619%20148.952L26.2489%2052.9632C22.2458%2043.5941%2027.26%2036.0143%2037.4485%2036.0332L141.832%2036.2266C152.02%2036.2455%20163.525%2043.8559%20167.528%2053.225L208.541%20149.214C212.544%20158.583%20207.53%20166.163%20197.341%20166.144L92.958%20165.95ZM71.3614%20148.959C74.475%20156.246%2083.4229%20162.166%2091.3473%20162.18L195.73%20162.374C203.655%20162.388%20207.555%20156.493%20204.441%20149.206L163.428%2053.2174C160.315%2045.9304%20151.367%2040.0111%20143.442%2039.9964L39.0592%2039.803C31.1349%2039.7883%2027.2349%2045.6837%2030.3485%2052.9708L71.3614%20148.959Z%22%20fill%3D%22%23131313%22%2F%3E%3Cpath%20d%3D%22M68.565%2053.3425C81.1781%2053.3659%2095.4205%2062.7875%20100.376%2074.3862C105.332%2085.985%2099.1246%2095.3687%2086.5115%2095.3454C73.8984%2095.322%2059.6559%2085.9004%2054.7001%2074.3016C49.7443%2062.7028%2055.9518%2053.3191%2068.565%2053.3425Z%22%20fill%3D%22%23131313%22%2F%3E%3Cpath%20d%3D%22M90.6891%20104.981C103.302%20105.004%20117.545%20114.425%20122.5%20126.024C127.456%20137.623%20121.249%20147.007%20108.636%20146.983C96.0225%20146.96%2081.7801%20137.538%2076.8243%20125.94C71.8685%20114.341%2078.076%20104.957%2090.6891%20104.981Z%22%20fill%3D%22%23131313%22%2F%3E%3Cpath%20d%3D%22M147.538%20105.142C160.151%20105.166%20174.394%20114.587%20179.349%20126.186C184.305%20137.785%20178.098%20147.168%20165.485%20147.145C152.871%20147.122%20138.629%20137.7%20133.673%20126.101C128.717%20114.503%20134.925%20105.119%20147.538%20105.142Z%22%20fill%3D%22%23131313%22%2F%3E%3Cdefs%3E%3CradialGradient%20id%3D%22paint0_radial%22%20cx%3D%220%22%20cy%3D%220%22%20r%3D%221%22%20gradientUnits%3D%22userSpaceOnUse%22%20gradientTransform%3D%22translate%28134.41%2068.3006%29%20rotate%28-33.9533%29%20scale%2890.6795%2083.3208%29%22%3E%3Cstop%20offset%3D%220.661458%22%20stop-color%3D%22%23C4FCF8%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%20stop-opacity%3D%220%22%2F%3E%3C%2FradialGradient%3E%3CradialGradient%20id%3D%22paint1_radial%22%20cx%3D%220%22%20cy%3D%220%22%20r%3D%221%22%20gradientUnits%3D%22userSpaceOnUse%22%20gradientTransform%3D%22translate%2842.7873%20129.218%29%20rotate%28-24.1606%29%20scale%28213.359%20196.045%29%22%3E%3Cstop%20stop-color%3D%22%23FF0099%22%20stop-opacity%3D%220.9%22%2F%3E%3Cstop%20offset%3D%220.770833%22%20stop-color%3D%22white%22%20stop-opacity%3D%220%22%2F%3E%3C%2FradialGradient%3E%3CradialGradient%20id%3D%22paint2_radial%22%20cx%3D%220%22%20cy%3D%220%22%20r%3D%221%22%20gradientUnits%3D%22userSpaceOnUse%22%20gradientTransform%3D%22translate%28176.854%20148.655%29%20rotate%28-53.4908%29%20scale%28107.342%2098.6309%29%22%3E%3Cstop%20stop-color%3D%22%23FFEC43%22%2F%3E%3Cstop%20offset%3D%220.805707%22%20stop-color%3D%22%23FFF6A8%22%20stop-opacity%3D%220%22%2F%3E%3C%2FradialGradient%3E%3CradialGradient%20id%3D%22paint3_radial%22%20cx%3D%220%22%20cy%3D%220%22%20r%3D%221%22%20gradientUnits%3D%22userSpaceOnUse%22%20gradientTransform%3D%22translate%2857.5443%2053.4752%29%20rotate%2820.3896%29%20scale%28137.027%20125.907%29%22%3E%3Cstop%20offset%3D%220.125%22%20stop-color%3D%22%235886FE%22%20stop-opacity%3D%220.46%22%2F%3E%3Cstop%20offset%3D%220.673044%22%20stop-color%3D%22white%22%20stop-opacity%3D%220%22%2F%3E%3C%2FradialGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"; + +var StyledListLogo = styled(Logo)(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n"], ["\n width: ", ";\n height: ", ";\n"])), function (_a) { + var size = _a.size; + return size; +}, function (_a) { + var size = _a.size; + return size; +}); +function ListLogo(_a) { + var logoURI = _a.logoURI, style = _a.style, _b = _a.size, size = _b === void 0 ? '24px' : _b, alt = _a.alt; + var srcs = useHttpLocations(logoURI); + return jsx(StyledListLogo, { alt: alt, size: size, srcs: srcs, style: style }, void 0); +} +var templateObject_1$r; + +var TokenSection = styled.div(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n padding: 4px 20px;\n height: 56px;\n display: grid;\n grid-template-columns: auto minmax(auto, 1fr) auto;\n grid-gap: 16px;\n align-items: center;\n\n opacity: ", ";\n"], ["\n padding: 4px 20px;\n height: 56px;\n display: grid;\n grid-template-columns: auto minmax(auto, 1fr) auto;\n grid-gap: 16px;\n align-items: center;\n\n opacity: ", ";\n"])), function (_a) { + var dim = _a.dim; + return (dim ? '0.4' : '1'); +}); +var CheckIcon = styled(CheckCircle)(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n height: 16px;\n width: 16px;\n margin-right: 6px;\n stroke: ", ";\n"], ["\n height: 16px;\n width: 16px;\n margin-right: 6px;\n stroke: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.green1; +}); +var NameOverflow = styled.div(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 140px;\n font-size: 12px;\n"], ["\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 140px;\n font-size: 12px;\n"]))); +function ImportRow(_a) { + var token = _a.token, style = _a.style, dim = _a.dim, showImportView = _a.showImportView, setImportToken = _a.setImportToken; + var theme = useTheme(); + // check if already active on list or local storage tokens + var isAdded = useIsUserAddedToken(token); + var isActive = useIsTokenActive(token); + var list = token instanceof WrappedTokenInfo ? token.list : undefined; + return (jsxs(TokenSection, __assign({ style: style }, { children: [jsx(CurrencyLogo, { currency: token, size: '24px', style: { opacity: dim ? '0.6' : '1' } }, void 0), jsxs(AutoColumn, __assign({ gap: "4px", style: { opacity: dim ? '0.6' : '1' } }, { children: [jsxs(AutoRow, { children: [jsx(ThemedText.Body, __assign({ fontWeight: 500 }, { children: token.symbol }), void 0), jsx(ThemedText.DarkGray, __assign({ ml: "8px", fontWeight: 300 }, { children: jsx(NameOverflow, __assign({ title: token.name }, { children: token.name }), void 0) }), void 0)] }, void 0), list && list.logoURI && (jsxs(RowFixed, { children: [jsx(ThemedText.Small, __assign({ mr: "4px", color: theme.text3 }, { children: jsxs(Trans, { children: ["via ", list.name, " "] }, void 0) }), void 0), jsx(ListLogo, { logoURI: list.logoURI, size: "12px" }, void 0)] }, void 0))] }), void 0), !isActive && !isAdded ? (jsx(ButtonPrimary, __assign({ width: "fit-content", padding: "6px 12px", fontWeight: 500, fontSize: "14px", onClick: function () { + setImportToken && setImportToken(token); + showImportView(); + } }, { children: jsx(Trans, { children: "Import" }, void 0) }), void 0)) : (jsxs(RowFixed, __assign({ style: { minWidth: 'fit-content' } }, { children: [jsx(CheckIcon, {}, void 0), jsx(ThemedText.Main, __assign({ color: theme.green1 }, { children: jsx(Trans, { children: "Active" }, void 0) }), void 0)] }), void 0))] }), void 0)); +} +var templateObject_1$q, templateObject_2$g, templateObject_3$e; + +var TextDot = styled.div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n height: 3px;\n width: 3px;\n background-color: ", ";\n border-radius: 50%;\n"], ["\n height: 3px;\n width: 3px;\n background-color: ", ";\n border-radius: 50%;\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var Checkbox = styled.input(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\n border: 1px solid ", ";\n height: 20px;\n margin: 0;\n"], ["\n border: 1px solid ", ";\n height: 20px;\n margin: 0;\n"])), function (_a) { + var theme = _a.theme; + return theme.red3; +}); +var PaddedColumn = styled(AutoColumn)(templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["\n padding: 20px;\n"], ["\n padding: 20px;\n"]))); +var MenuItem = styled(RowBetween)(templateObject_4$9 || (templateObject_4$9 = __makeTemplateObject(["\n padding: 4px 20px;\n height: 56px;\n display: grid;\n grid-template-columns: auto minmax(auto, 1fr) auto minmax(0, 72px);\n grid-gap: 16px;\n cursor: ", ";\n pointer-events: ", ";\n :hover {\n background-color: ", ";\n }\n opacity: ", ";\n"], ["\n padding: 4px 20px;\n height: 56px;\n display: grid;\n grid-template-columns: auto minmax(auto, 1fr) auto minmax(0, 72px);\n grid-gap: 16px;\n cursor: ", ";\n pointer-events: ", ";\n :hover {\n background-color: ", ";\n }\n opacity: ", ";\n"])), function (_a) { + var disabled = _a.disabled; + return !disabled && 'pointer'; +}, function (_a) { + var disabled = _a.disabled; + return disabled && 'none'; +}, function (_a) { + var theme = _a.theme, disabled = _a.disabled; + return !disabled && theme.bg2; +}, function (_a) { + var disabled = _a.disabled, selected = _a.selected; + return (disabled || selected ? 0.5 : 1); +}); +var SearchInput = styled.input(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n position: relative;\n display: flex;\n padding: 16px;\n align-items: center;\n width: 100%;\n white-space: nowrap;\n background: none;\n border: none;\n outline: none;\n border-radius: 20px;\n color: ", ";\n border-style: solid;\n border: 1px solid ", ";\n -webkit-appearance: none;\n\n font-size: 18px;\n\n ::placeholder {\n color: ", ";\n }\n transition: border 100ms;\n :focus {\n border: 1px solid ", ";\n outline: none;\n }\n"], ["\n position: relative;\n display: flex;\n padding: 16px;\n align-items: center;\n width: 100%;\n white-space: nowrap;\n background: none;\n border: none;\n outline: none;\n border-radius: 20px;\n color: ", ";\n border-style: solid;\n border: 1px solid ", ";\n -webkit-appearance: none;\n\n font-size: 18px;\n\n ::placeholder {\n color: ", ";\n }\n transition: border 100ms;\n :focus {\n border: 1px solid ", ";\n outline: none;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return theme.bg3; +}, function (_a) { + var theme = _a.theme; + return theme.text3; +}, function (_a) { + var theme = _a.theme; + return theme.primary1; +}); +var Separator = styled.div(templateObject_6$5 || (templateObject_6$5 = __makeTemplateObject(["\n width: 100%;\n height: 1px;\n background-color: ", ";\n"], ["\n width: 100%;\n height: 1px;\n background-color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}); +var SeparatorDark = styled.div(templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["\n width: 100%;\n height: 1px;\n background-color: ", ";\n"], ["\n width: 100%;\n height: 1px;\n background-color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var templateObject_1$p, templateObject_2$f, templateObject_3$d, templateObject_4$9, templateObject_5$9, templateObject_6$5, templateObject_7$4; + +function currencyKey(currency) { + return currency.isToken ? currency.address : 'ETHER'; +} +var StyledBalanceText = styled(Text$1)(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n white-space: nowrap;\n overflow: hidden;\n max-width: 5rem;\n text-overflow: ellipsis;\n"], ["\n white-space: nowrap;\n overflow: hidden;\n max-width: 5rem;\n text-overflow: ellipsis;\n"]))); +var Tag = styled.div(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n font-size: 14px;\n border-radius: 4px;\n padding: 0.25rem 0.3rem 0.25rem 0.3rem;\n max-width: 6rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n justify-self: flex-end;\n margin-right: 4px;\n"], ["\n background-color: ", ";\n color: ", ";\n font-size: 14px;\n border-radius: 4px;\n padding: 0.25rem 0.3rem 0.25rem 0.3rem;\n max-width: 6rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n justify-self: flex-end;\n margin-right: 4px;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var FixedContentRow = styled.div(templateObject_3$c || (templateObject_3$c = __makeTemplateObject(["\n padding: 4px 20px;\n height: 56px;\n display: grid;\n grid-gap: 16px;\n align-items: center;\n"], ["\n padding: 4px 20px;\n height: 56px;\n display: grid;\n grid-gap: 16px;\n align-items: center;\n"]))); +function Balance(_a) { + var balance = _a.balance; + return jsx(StyledBalanceText, __assign({ title: balance.toExact() }, { children: balance.toSignificant(4) }), void 0); +} +var TagContainer = styled.div(templateObject_4$8 || (templateObject_4$8 = __makeTemplateObject(["\n display: flex;\n justify-content: flex-end;\n"], ["\n display: flex;\n justify-content: flex-end;\n"]))); +var TokenListLogoWrapper = styled.img(templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["\n height: 20px;\n"], ["\n height: 20px;\n"]))); +function TokenTags(_a) { + var currency = _a.currency; + if (!(currency instanceof WrappedTokenInfo)) { + return jsx("span", {}, void 0); + } + var tags = currency.tags; + if (!tags || tags.length === 0) + return jsx("span", {}, void 0); + var tag = tags[0]; + return (jsxs(TagContainer, { children: [jsx(MouseoverTooltip, __assign({ text: tag.description }, { children: jsx(Tag, { children: tag.name }, tag.id) }), void 0), tags.length > 1 ? (jsx(MouseoverTooltip, __assign({ text: tags + .slice(1) + .map(function (_a) { + var name = _a.name, description = _a.description; + return name + ": " + description; + }) + .join('; \n') }, { children: jsx(Tag, { children: "..." }, void 0) }), void 0)) : null] }, void 0)); +} +function CurrencyRow(_a) { + var currency = _a.currency, onSelect = _a.onSelect, isSelected = _a.isSelected, otherSelected = _a.otherSelected, style = _a.style, showCurrencyAmount = _a.showCurrencyAmount; + var account = useActiveWeb3React().account; + var key = currencyKey(currency); + var selectedTokenList = useCombinedActiveList(); + var isOnSelectedList = isTokenOnList(selectedTokenList, currency.isToken ? currency : undefined); + var customAdded = useIsUserAddedToken(currency); + var balance = useCurrencyBalance(account !== null && account !== void 0 ? account : undefined, currency); + // only show add or remove buttons if not on selected list + return (jsxs(MenuItem, __assign({ style: style, className: "token-item-" + key, onClick: function () { return (isSelected ? null : onSelect()); }, disabled: isSelected, selected: otherSelected }, { children: [jsx(CurrencyLogo, { currency: currency, size: '24px' }, void 0), jsxs(Column, { children: [jsx(Text$1, __assign({ title: currency.name, fontWeight: 500 }, { children: currency.symbol }), void 0), jsx(ThemedText.DarkGray, __assign({ ml: "0px", fontSize: '12px', fontWeight: 300 }, { children: !currency.isNative && !isOnSelectedList && customAdded ? (jsxs(Trans, { children: [currency.name, " \u2022 Added by user"] }, void 0)) : (currency.name) }), void 0)] }, void 0), jsx(TokenTags, { currency: currency }, void 0), showCurrencyAmount && (jsx(RowFixed, __assign({ style: { justifySelf: 'flex-end' } }, { children: balance ? jsx(Balance, { balance: balance }, void 0) : account ? jsx(Loader, {}, void 0) : null }), void 0))] }), void 0)); +} +var BREAK_LINE = 'BREAK'; +function isBreakLine(x) { + return x === BREAK_LINE; +} +function BreakLineComponent(_a) { + var style = _a.style; + var theme = useTheme(); + return (jsx(FixedContentRow, __assign({ style: style }, { children: jsx(LightGreyCard, __assign({ padding: "8px 12px", "$borderRadius": "8px" }, { children: jsxs(RowBetween, { children: [jsxs(RowFixed, { children: [jsx(TokenListLogoWrapper, { src: TokenListLogo }, void 0), jsx(ThemedText.Main, __assign({ ml: "6px", fontSize: "12px", color: theme.text1 }, { children: jsx(Trans, { children: "Expanded results from inactive Token Lists" }, void 0) }), void 0)] }, void 0), jsx(QuestionHelper, { text: jsx(Trans, { children: "Tokens from inactive lists. Import specific tokens below or click Manage to activate more lists." }, void 0) }, void 0)] }, void 0) }), void 0) }), void 0)); +} +function CurrencyList(_a) { + var height = _a.height, currencies = _a.currencies, otherListTokens = _a.otherListTokens, selectedCurrency = _a.selectedCurrency, onCurrencySelect = _a.onCurrencySelect, otherCurrency = _a.otherCurrency, fixedListRef = _a.fixedListRef, showImportView = _a.showImportView, setImportToken = _a.setImportToken, showCurrencyAmount = _a.showCurrencyAmount; + var itemData = useMemo(function () { + if (otherListTokens && (otherListTokens === null || otherListTokens === void 0 ? void 0 : otherListTokens.length) > 0) { + return __spreadArray(__spreadArray(__spreadArray([], __read(currencies), false), [BREAK_LINE], false), __read(otherListTokens), false); + } + return currencies; + }, [currencies, otherListTokens]); + var Row = useCallback(function TokenRow(_a) { + var data = _a.data, index = _a.index, style = _a.style; + var row = data[index]; + if (isBreakLine(row)) { + return jsx(BreakLineComponent, { style: style }, void 0); + } + var currency = row; + var isSelected = Boolean(currency && selectedCurrency && selectedCurrency.equals(currency)); + var otherSelected = Boolean(currency && otherCurrency && otherCurrency.equals(currency)); + var handleSelect = function () { return currency && onCurrencySelect(currency); }; + var token = currency === null || currency === void 0 ? void 0 : currency.wrapped; + var showImport = index > currencies.length; + if (showImport && token) { + return (jsx(ImportRow, { style: style, token: token, showImportView: showImportView, setImportToken: setImportToken, dim: true }, void 0)); + } + else if (currency) { + return (jsx(CurrencyRow, { style: style, currency: currency, isSelected: isSelected, onSelect: handleSelect, otherSelected: otherSelected, showCurrencyAmount: showCurrencyAmount }, void 0)); + } + else { + return null; + } + }, [ + currencies.length, + onCurrencySelect, + otherCurrency, + selectedCurrency, + setImportToken, + showImportView, + showCurrencyAmount, + ]); + var itemKey = useCallback(function (index, data) { + var currency = data[index]; + if (isBreakLine(currency)) + return BREAK_LINE; + return currencyKey(currency); + }, []); + return (jsx(FixedSizeList, __assign({ height: height, ref: fixedListRef, width: "100%", itemData: itemData, itemCount: itemData.length, itemSize: 56, itemKey: itemKey }, { children: Row }), void 0)); +} +var templateObject_1$o, templateObject_2$e, templateObject_3$c, templateObject_4$8, templateObject_5$8; + +var ContentWrapper = styled(Column)(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\n width: 100%;\n flex: 1 1;\n position: relative;\n"], ["\n width: 100%;\n flex: 1 1;\n position: relative;\n"]))); +var Footer$1 = styled.div(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\n width: 100%;\n border-radius: 20px;\n padding: 20px;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n background-color: ", ";\n border-top: 1px solid ", ";\n"], ["\n width: 100%;\n border-radius: 20px;\n padding: 20px;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n background-color: ", ";\n border-top: 1px solid ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return theme.bg2; +}); +function CurrencySearch(_a) { + var selectedCurrency = _a.selectedCurrency, onCurrencySelect = _a.onCurrencySelect, otherSelectedCurrency = _a.otherSelectedCurrency, showCommonBases = _a.showCommonBases, showCurrencyAmount = _a.showCurrencyAmount, disableNonToken = _a.disableNonToken, onDismiss = _a.onDismiss, isOpen = _a.isOpen, showManageView = _a.showManageView, showImportView = _a.showImportView, setImportToken = _a.setImportToken; + var chainId = useActiveWeb3React().chainId; + var theme = useTheme(); + // refs for fixed size lists + var fixedList = useRef(); + var _b = __read(useState(''), 2), searchQuery = _b[0], setSearchQuery = _b[1]; + var debouncedQuery = useDebounce(searchQuery, 200); + var allTokens = useAllTokens(); + // if they input an address, use it + var isAddressSearch = isAddress(debouncedQuery); + var searchToken = useToken(debouncedQuery); + var searchTokenIsAdded = useIsUserAddedToken(searchToken); + useEffect(function () { + if (isAddressSearch) { + ReactGA.event({ + category: 'Currency Select', + action: 'Search by address', + label: isAddressSearch, + }); + } + }, [isAddressSearch]); + var filteredTokens = useMemo(function () { + return Object.values(allTokens).filter(getTokenFilter(debouncedQuery)); + }, [allTokens, debouncedQuery]); + var balances = useAllTokenBalances(); + var sortedTokens = useMemo(function () { + return filteredTokens.sort(tokenComparator.bind(null, balances)); + }, [balances, filteredTokens]); + var filteredSortedTokens = useSortTokensByQuery(debouncedQuery, sortedTokens); + var native = useNativeCurrency(); + var filteredSortedTokensWithETH = useMemo(function () { + var _a, _b; + if (!native) + return filteredSortedTokens; + var s = debouncedQuery.toLowerCase().trim(); + if (((_b = (_a = native.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.indexOf(s)) !== -1) { + return native ? __spreadArray([native], __read(filteredSortedTokens), false) : filteredSortedTokens; + } + return filteredSortedTokens; + }, [debouncedQuery, native, filteredSortedTokens]); + var handleCurrencySelect = useCallback(function (currency) { + onCurrencySelect(currency); + onDismiss(); + }, [onDismiss, onCurrencySelect]); + // clear the input on open + useEffect(function () { + if (isOpen) + setSearchQuery(''); + }, [isOpen]); + // manage focus on modal show + var inputRef = useRef(); + var handleInput = useCallback(function (event) { + var _a; + var input = event.target.value; + var checksummedInput = isAddress(input); + setSearchQuery(checksummedInput || input); + (_a = fixedList.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0); + }, []); + var handleEnter = useCallback(function (e) { + var _a, _b; + if (e.key === 'Enter') { + var s = debouncedQuery.toLowerCase().trim(); + if (s === ((_a = native === null || native === void 0 ? void 0 : native.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase())) { + handleCurrencySelect(native); + } + else if (filteredSortedTokensWithETH.length > 0) { + if (((_b = filteredSortedTokensWithETH[0].symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === debouncedQuery.trim().toLowerCase() || + filteredSortedTokensWithETH.length === 1) { + handleCurrencySelect(filteredSortedTokensWithETH[0]); + } + } + } + }, [debouncedQuery, native, filteredSortedTokensWithETH, handleCurrencySelect]); + // menu ui + var _c = __read(useToggle(false), 2), open = _c[0], toggle = _c[1]; + var node = useRef(); + useOnClickOutside(node, open ? toggle : undefined); + // if no results on main list, show option to expand into inactive + var filteredInactiveTokens = useSearchInactiveTokenLists(filteredTokens.length === 0 || (debouncedQuery.length > 2 && !isAddressSearch) ? debouncedQuery : undefined); + return (jsxs(ContentWrapper, { children: [jsxs(PaddedColumn, __assign({ gap: "16px" }, { children: [jsxs(RowBetween, { children: [jsx(Text$1, __assign({ fontWeight: 500, fontSize: 16 }, { children: jsx(Trans, { children: "Select a token" }, void 0) }), void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }, void 0), jsx(Row$1, { children: jsx(SearchInput, { type: "text", id: "token-search-input", placeholder: t(templateObject_3$b || (templateObject_3$b = __makeTemplateObject(["Search name or paste address"], ["Search name or paste address"]))), autoComplete: "off", value: searchQuery, ref: inputRef, onChange: handleInput, onKeyDown: handleEnter }, void 0) }, void 0), showCommonBases && (jsx(CommonBases, { chainId: chainId, onSelect: handleCurrencySelect, selectedCurrency: selectedCurrency }, void 0))] }), void 0), jsx(Separator, {}, void 0), searchToken && !searchTokenIsAdded ? (jsx(Column, __assign({ style: { padding: '20px 0', height: '100%' } }, { children: jsx(ImportRow, { token: searchToken, showImportView: showImportView, setImportToken: setImportToken }, void 0) }), void 0)) : (filteredSortedTokens === null || filteredSortedTokens === void 0 ? void 0 : filteredSortedTokens.length) > 0 || (filteredInactiveTokens === null || filteredInactiveTokens === void 0 ? void 0 : filteredInactiveTokens.length) > 0 ? (jsx("div", __assign({ style: { flex: '1' } }, { children: jsx(AutoSizer, __assign({ disableWidth: true }, { children: function (_a) { + var height = _a.height; + return (jsx(CurrencyList, { height: height, currencies: disableNonToken ? filteredSortedTokens : filteredSortedTokensWithETH, otherListTokens: filteredInactiveTokens, onCurrencySelect: handleCurrencySelect, otherCurrency: otherSelectedCurrency, selectedCurrency: selectedCurrency, fixedListRef: fixedList, showImportView: showImportView, setImportToken: setImportToken, showCurrencyAmount: showCurrencyAmount }, void 0)); + } }), void 0) }), void 0)) : (jsx(Column, __assign({ style: { padding: '20px', height: '100%' } }, { children: jsx(ThemedText.Main, __assign({ color: theme.text3, textAlign: "center", mb: "20px" }, { children: jsx(Trans, { children: "No results found." }, void 0) }), void 0) }), void 0)), jsx(Footer$1, { children: jsx(Row$1, __assign({ justify: "center" }, { children: jsx(ButtonText, __assign({ onClick: showManageView, color: theme.primary1, className: "list-token-manage-button" }, { children: jsxs(RowFixed, { children: [jsx(IconWrapper$4, __assign({ size: "16px", marginRight: "6px", stroke: theme.primaryText1 }, { children: jsx(Edit, {}, void 0) }), void 0), jsx(ThemedText.Main, __assign({ color: theme.primaryText1 }, { children: jsx(Trans, { children: "Manage Token Lists" }, void 0) }), void 0)] }, void 0) }), void 0) }), void 0) }, void 0)] }, void 0)); +} +var templateObject_1$n, templateObject_2$d, templateObject_3$b; + +function useFetchListCallback() { + var _this = this; + var _a = useActiveWeb3React(), chainId = _a.chainId, library = _a.library; + var dispatch = useAppDispatch(); + var ensResolver = useCallback(function (ensName) { return __awaiter(_this, void 0, void 0, function () { + var networkLibrary, network; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(!library || chainId !== 1)) return [3 /*break*/, 2]; + networkLibrary = getNetworkLibrary(); + return [4 /*yield*/, networkLibrary.getNetwork()]; + case 1: + network = _a.sent(); + if (networkLibrary && network.chainId === 1) { + return [2 /*return*/, resolveENSContentHash(ensName, networkLibrary)]; + } + throw new Error('Could not construct mainnet ENS resolver'); + case 2: return [2 /*return*/, resolveENSContentHash(ensName, library)]; + } + }); + }); }, [chainId, library]); + // note: prevent dispatch if using for list search or unsupported list + return useCallback(function (listUrl, sendDispatch) { + if (sendDispatch === void 0) { sendDispatch = true; } + return __awaiter(_this, void 0, void 0, function () { + var requestId; + return __generator(this, function (_a) { + requestId = nanoid(); + sendDispatch && dispatch(fetchTokenList.pending({ requestId: requestId, url: listUrl })); + return [2 /*return*/, fetchTokenList$1(listUrl, ensResolver) + .then(function (tokenList) { + sendDispatch && dispatch(fetchTokenList.fulfilled({ url: listUrl, tokenList: tokenList, requestId: requestId })); + return tokenList; + }) + .catch(function (error) { + console.debug("Failed to get list at url " + listUrl, error); + sendDispatch && dispatch(fetchTokenList.rejected({ url: listUrl, requestId: requestId, errorMessage: error.message })); + throw error; + })]; + }); + }); + }, [dispatch, ensResolver]); +} + +var Wrapper$8 = styled.div(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n position: relative;\n width: 100%;\n overflow: auto;\n"], ["\n position: relative;\n width: 100%;\n overflow: auto;\n"]))); +function ImportList(_a) { + var _b; + var listURL = _a.listURL, list = _a.list, setModalView = _a.setModalView, onDismiss = _a.onDismiss; + var theme = useTheme(); + var dispatch = useAppDispatch(); + // user must accept + var _c = __read(useState(false), 2), confirmed = _c[0], setConfirmed = _c[1]; + var lists = useAllLists(); + var fetchList = useFetchListCallback(); + // monitor is list is loading + var adding = Boolean((_b = lists[listURL]) === null || _b === void 0 ? void 0 : _b.loadingRequestId); + var _d = __read(useState(null), 2), addError = _d[0], setAddError = _d[1]; + var handleAddList = useCallback(function () { + if (adding) + return; + setAddError(null); + fetchList(listURL) + .then(function () { + ReactGA.event({ + category: 'Lists', + action: 'Add List', + label: listURL, + }); + // turn list on + dispatch(enableList(listURL)); + // go back to lists + setModalView(CurrencyModalView.manage); + }) + .catch(function (error) { + ReactGA.event({ + category: 'Lists', + action: 'Add List Failed', + label: listURL, + }); + setAddError(error.message); + dispatch(removeList(listURL)); + }); + }, [adding, dispatch, fetchList, listURL, setModalView]); + return (jsxs(Wrapper$8, { children: [jsx(PaddedColumn, __assign({ gap: "14px", style: { width: '100%', flex: '1 1' } }, { children: jsxs(RowBetween, { children: [jsx(ArrowLeft, { style: { cursor: 'pointer' }, onClick: function () { return setModalView(CurrencyModalView.manage); } }, void 0), jsx(ThemedText.MediumHeader, { children: jsx(Trans, { children: "Import List" }, void 0) }, void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }, void 0) }), void 0), jsx(SectionBreak, {}, void 0), jsx(PaddedColumn, __assign({ gap: "md" }, { children: jsxs(AutoColumn, __assign({ gap: "md" }, { children: [jsx(Card, __assign({ backgroundColor: theme.bg2, padding: "12px 20px" }, { children: jsx(RowBetween, { children: jsxs(RowFixed, { children: [list.logoURI && jsx(ListLogo, { logoURI: list.logoURI, size: "40px" }, void 0), jsxs(AutoColumn, __assign({ gap: "sm", style: { marginLeft: '20px' } }, { children: [jsxs(RowFixed, { children: [jsx(ThemedText.Body, __assign({ fontWeight: 600, mr: "6px" }, { children: list.name }), void 0), jsx(TextDot, {}, void 0), jsx(ThemedText.Main, __assign({ fontSize: '16px', ml: "6px" }, { children: jsxs(Trans, { children: [list.tokens.length, " tokens"] }, void 0) }), void 0)] }, void 0), jsx(ExternalLink, __assign({ href: "https://tokenlists.org/token-list?url=" + listURL }, { children: jsx(ThemedText.Main, __assign({ fontSize: '12px', color: theme.blue1 }, { children: listURL }), void 0) }), void 0)] }), void 0)] }, void 0) }, void 0) }), void 0), jsxs(Card, __assign({ style: { backgroundColor: transparentize(0.8, theme.red1) } }, { children: [jsxs(AutoColumn, __assign({ justify: "center", style: { textAlign: 'center', gap: '16px', marginBottom: '12px' } }, { children: [jsx(AlertTriangle, { stroke: theme.red1, size: 32 }, void 0), jsx(ThemedText.Body, __assign({ fontWeight: 500, fontSize: 20, color: theme.red1 }, { children: jsx(Trans, { children: "Import at your own risk" }, void 0) }), void 0)] }), void 0), jsxs(AutoColumn, __assign({ style: { textAlign: 'center', gap: '16px', marginBottom: '12px' } }, { children: [jsx(ThemedText.Body, __assign({ fontWeight: 500, color: theme.red1 }, { children: jsx(Trans, { children: "By adding this list you are implicitly trusting that the data is correct. Anyone can create a list, including creating fake versions of existing lists and lists that claim to represent projects that do not have one." }, void 0) }), void 0), jsx(ThemedText.Body, __assign({ fontWeight: 600, color: theme.red1 }, { children: jsx(Trans, { children: "If you purchase a token from this list, you may not be able to sell it back." }, void 0) }), void 0)] }), void 0), jsxs(AutoRow, __assign({ justify: "center", style: { cursor: 'pointer' }, onClick: function () { return setConfirmed(!confirmed); } }, { children: [jsx(Checkbox, { name: "confirmed", type: "checkbox", checked: confirmed, onChange: function () { return setConfirmed(!confirmed); } }, void 0), jsx(ThemedText.Body, __assign({ ml: "10px", fontSize: "16px", color: theme.red1, fontWeight: 500 }, { children: jsx(Trans, { children: "I understand" }, void 0) }), void 0)] }), void 0)] }), void 0), jsx(ButtonPrimary, __assign({ disabled: !confirmed, altDisabledStyle: true, "$borderRadius": "20px", padding: "10px 1rem", onClick: handleAddList }, { children: jsx(Trans, { children: "Import" }, void 0) }), void 0), addError ? (jsx(ThemedText.Error, __assign({ title: addError, style: { textOverflow: 'ellipsis', overflow: 'hidden' }, error: true }, { children: addError }), void 0)) : null] }), void 0) }), void 0)] }, void 0)); +} +var templateObject_1$m; + +var WarningWrapper = styled(Card)(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n background-color: ", ";\n width: fit-content;\n"], ["\n background-color: ", ";\n width: fit-content;\n"])), function (_a) { + var theme = _a.theme, highWarning = _a.highWarning; + return highWarning ? transparentize(0.8, theme.red1) : transparentize(0.8, theme.yellow2); +}); +var AddressText = styled(ThemedText.Blue)(templateObject_3$a || (templateObject_3$a = __makeTemplateObject(["\n font-size: 12px;\n word-break: break-all;\n\n ", "\n"], ["\n font-size: 12px;\n word-break: break-all;\n\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\n font-size: 10px;\n "], ["\n font-size: 10px;\n "]))); +}); +var TokenImportCard = function (_a) { + var list = _a.list, token = _a.token; + var theme = useTheme$1(); + var chainId = useActiveWeb3React().chainId; + return (jsx(Card, __assign({ backgroundColor: theme.bg2, padding: "2rem" }, { children: jsxs(AutoColumn, __assign({ gap: "10px", justify: "center" }, { children: [jsx(CurrencyLogo, { currency: token, size: '32px' }, void 0), jsxs(AutoColumn, __assign({ gap: "4px", justify: "center" }, { children: [jsx(ThemedText.Body, __assign({ ml: "8px", mr: "8px", fontWeight: 500, fontSize: 20 }, { children: token.symbol }), void 0), jsx(ThemedText.DarkGray, __assign({ fontWeight: 400, fontSize: 14 }, { children: token.name }), void 0)] }), void 0), chainId && (jsx(ExternalLink, __assign({ href: getExplorerLink(chainId, token.address, ExplorerDataType.ADDRESS) }, { children: jsx(AddressText, __assign({ fontSize: 12 }, { children: token.address }), void 0) }), void 0)), list !== undefined ? (jsxs(RowFixed, { children: [list.logoURI && jsx(ListLogo, { logoURI: list.logoURI, size: "16px" }, void 0), jsx(ThemedText.Small, __assign({ ml: "6px", fontSize: 14, color: theme.text3 }, { children: jsxs(Trans, { children: ["via ", list.name, " token list"] }, void 0) }), void 0)] }, void 0)) : (jsx(WarningWrapper, __assign({ "$borderRadius": "4px", padding: "4px", highWarning: true }, { children: jsxs(RowFixed, { children: [jsx(AlertCircle, { stroke: theme.red1, size: "10px" }, void 0), jsx(ThemedText.Body, __assign({ color: theme.red1, ml: "4px", fontSize: "10px", fontWeight: 500 }, { children: jsx(Trans, { children: "Unknown Source" }, void 0) }), void 0)] }, void 0) }), void 0))] }), void 0) }), void 0)); +}; +var templateObject_1$l, templateObject_2$c, templateObject_3$a; + +var Wrapper$7 = styled.div(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n align-items: center;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n height: 100%;\n width: 100%;\n"], ["\n align-items: center;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n height: 100%;\n width: 100%;\n"]))); +var Button = styled(ButtonPrimary)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n margin-top: 1em;\n padding: 10px 1em;\n"], ["\n margin-top: 1em;\n padding: 10px 1em;\n"]))); +var Content = styled.div(templateObject_3$9 || (templateObject_3$9 = __makeTemplateObject(["\n padding: 1em;\n"], ["\n padding: 1em;\n"]))); +var Copy = styled(ThemedText.Body)(templateObject_4$7 || (templateObject_4$7 = __makeTemplateObject(["\n text-align: center;\n margin: 0 2em 1em !important;\n font-weight: 400;\n font-size: 16px;\n"], ["\n text-align: center;\n margin: 0 2em 1em !important;\n font-weight: 400;\n font-size: 16px;\n"]))); +var Header = styled.div(templateObject_5$7 || (templateObject_5$7 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n gap: 14px;\n justify-content: space-between;\n padding: 20px;\n width: 100%;\n"], ["\n align-items: center;\n display: flex;\n gap: 14px;\n justify-content: space-between;\n padding: 20px;\n width: 100%;\n"]))); +var Icon = styled(AlertCircle)(templateObject_6$4 || (templateObject_6$4 = __makeTemplateObject(["\n stroke: ", ";\n width: 48px;\n height: 48px;\n"], ["\n stroke: ", ";\n width: 48px;\n height: 48px;\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var BlockedToken = function (_a) { + var onBack = _a.onBack, onDismiss = _a.onDismiss, blockedTokens = _a.blockedTokens; + return (jsxs(Wrapper$7, { children: [jsxs(Header, { children: [onBack ? jsx(ArrowLeft, { style: { cursor: 'pointer' }, onClick: onBack }, void 0) : jsx("div", {}, void 0), jsx(ThemedText.MediumHeader, { children: jsx(Trans, { children: "Token not supported" }, void 0) }, void 0), onDismiss ? jsx(CloseIcon$2, { onClick: onDismiss }, void 0) : jsx("div", {}, void 0)] }, void 0), jsx(Icon, {}, void 0), jsxs(Content, { children: [jsx(Copy, { children: jsx(Trans, { children: "This token is not supported in the Uniswap Labs app" }, void 0) }, void 0), jsx(TokenImportCard, { token: blockedTokens[0] }, void 0), jsx(Button, __assign({ disabled: true }, { children: jsx(Trans, { children: "Import" }, void 0) }), void 0)] }, void 0)] }, void 0)); +}; +var templateObject_1$k, templateObject_2$b, templateObject_3$9, templateObject_4$7, templateObject_5$7, templateObject_6$4; + +var Wrapper$6 = styled.div(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n position: relative;\n width: 100%;\n overflow: auto;\n"], ["\n position: relative;\n width: 100%;\n overflow: auto;\n"]))); +function ImportToken(props) { + var tokens = props.tokens, list = props.list, onBack = props.onBack, onDismiss = props.onDismiss, handleCurrencySelect = props.handleCurrencySelect; + var theme = useTheme(); + var addToken = useAddUserToken(); + var unsupportedTokens = useUnsupportedTokens(); + var unsupportedSet = new Set(Object.keys(unsupportedTokens)); + var intersection = new Set(tokens.filter(function (token) { return unsupportedSet.has(token.address); })); + if (intersection.size > 0) { + return jsx(BlockedToken, { onBack: onBack, onDismiss: onDismiss, blockedTokens: Array.from(intersection) }, void 0); + } + return (jsxs(Wrapper$6, { children: [jsx(PaddedColumn, __assign({ gap: "14px", style: { width: '100%', flex: '1 1' } }, { children: jsxs(RowBetween, { children: [onBack ? jsx(ArrowLeft, { style: { cursor: 'pointer' }, onClick: onBack }, void 0) : jsx("div", {}, void 0), jsx(ThemedText.MediumHeader, { children: jsx(Plural, { value: tokens.length, one: "Import token", other: "Import tokens" }, void 0) }, void 0), onDismiss ? jsx(CloseIcon$2, { onClick: onDismiss }, void 0) : jsx("div", {}, void 0)] }, void 0) }), void 0), jsx(SectionBreak, {}, void 0), jsxs(AutoColumn, __assign({ gap: "md", style: { marginBottom: '32px', padding: '1rem' } }, { children: [jsxs(AutoColumn, __assign({ justify: "center", style: { textAlign: 'center', gap: '16px', padding: '1rem' } }, { children: [jsx(AlertCircle, { size: 48, stroke: theme.text2, strokeWidth: 1 }, void 0), jsx(ThemedText.Body, __assign({ fontWeight: 400, fontSize: 16 }, { children: jsx(Trans, { children: "This token doesn't appear on the active token list(s). Make sure this is the token that you want to trade." }, void 0) }), void 0)] }), void 0), tokens.map(function (token) { return (jsx(TokenImportCard, { token: token, list: list }, 'import' + token.address)); }), jsx(ButtonPrimary, __assign({ altDisabledStyle: true, "$borderRadius": "20px", padding: "10px 1rem", onClick: function () { + tokens.map(function (token) { return addToken(token); }); + handleCurrencySelect && handleCurrencySelect(tokens[0]); + }, className: ".token-dismiss-button" }, { children: jsx(Trans, { children: "Import" }, void 0) }), void 0)] }), void 0)] }, void 0)); +} +var templateObject_1$j; + +function getColorFromUriPath(uri) { + return __awaiter(this, void 0, void 0, function () { + var formattedPath, palette, detectedHex, AAscore; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + formattedPath = uriToHttp(uri)[0]; + return [4 /*yield*/, Vibrant.from(formattedPath).getPalette()]; + case 1: + palette = _a.sent(); + if (!(palette === null || palette === void 0 ? void 0 : palette.Vibrant)) { + return [2 /*return*/, null]; + } + detectedHex = palette.Vibrant.hex; + AAscore = hex(detectedHex, '#FFF'); + while (AAscore < 3) { + detectedHex = shade(0.005, detectedHex); + AAscore = hex(detectedHex, '#FFF'); + } + return [2 /*return*/, detectedHex]; + } + }); + }); +} +function useListColor(listImageUri) { + var _a = __read(useState('#2172E5'), 2), color = _a[0], setColor = _a[1]; + useLayoutEffect(function () { + var stale = false; + if (listImageUri) { + getColorFromUriPath(listImageUri).then(function (color) { + if (!stale && color !== null) { + setColor(color); + } + }); + } + return function () { + stale = true; + setColor('#2172E5'); + }; + }, [listImageUri]); + return color; +} + +function listVersionLabel(version) { + return "v" + version.major + "." + version.minor + "." + version.patch; +} + +var Wrapper$5 = styled.button(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n border-radius: 20px;\n border: none;\n background: ", ";\n display: flex;\n width: fit-content;\n cursor: pointer;\n outline: none;\n padding: 0.4rem 0.4rem;\n align-items: center;\n"], ["\n border-radius: 20px;\n border: none;\n background: ", ";\n display: flex;\n width: fit-content;\n cursor: pointer;\n outline: none;\n padding: 0.4rem 0.4rem;\n align-items: center;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}); +var ToggleElement$1 = styled.span(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n border-radius: 50%;\n height: 24px;\n width: 24px;\n background-color: ", ";\n :hover {\n opacity: 0.8;\n }\n"], ["\n border-radius: 50%;\n height: 24px;\n width: 24px;\n background-color: ", ";\n :hover {\n opacity: 0.8;\n }\n"])), function (_a) { + var isActive = _a.isActive, bgColor = _a.bgColor, theme = _a.theme; + return (isActive ? bgColor : theme.bg4); +}); +var StatusText = styled(ThemedText.Main)(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n margin: 0 10px;\n width: 24px;\n color: ", ";\n"], ["\n margin: 0 10px;\n width: 24px;\n color: ", ";\n"])), function (_a) { + var theme = _a.theme, isActive = _a.isActive; + return (isActive ? theme.text1 : theme.text3); +}); +function ListToggle(_a) { + var id = _a.id, isActive = _a.isActive, bgColor = _a.bgColor, toggle = _a.toggle; + return (jsxs(Wrapper$5, __assign({ id: id, isActive: isActive, onClick: toggle }, { children: [isActive && (jsx(StatusText, __assign({ fontWeight: "600", margin: "0 6px", isActive: true }, { children: jsx(Trans, { children: "ON" }, void 0) }), void 0)), jsx(ToggleElement$1, { isActive: isActive, bgColor: bgColor }, void 0), !isActive && (jsx(StatusText, __assign({ fontWeight: "600", margin: "0 6px", isActive: false }, { children: jsx(Trans, { children: "OFF" }, void 0) }), void 0))] }), void 0)); +} +var templateObject_1$i, templateObject_2$a, templateObject_3$8; + +var Wrapper$4 = styled(Column)(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n flex: 1;\n overflow-y: hidden;\n"], ["\n flex: 1;\n overflow-y: hidden;\n"]))); +var UnpaddedLinkStyledButton = styled(LinkStyledButton)(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n padding: 0;\n font-size: 1rem;\n opacity: ", ";\n"], ["\n padding: 0;\n font-size: 1rem;\n opacity: ", ";\n"])), function (_a) { + var disabled = _a.disabled; + return (disabled ? '0.4' : '1'); +}); +var PopoverContainer = styled.div(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n z-index: 100;\n visibility: ", ";\n opacity: ", ";\n transition: visibility 150ms linear, opacity 150ms linear;\n background: ", ";\n border: 1px solid ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n color: ", ";\n border-radius: 0.5rem;\n padding: 1rem;\n display: grid;\n grid-template-rows: 1fr;\n grid-gap: 8px;\n font-size: 1rem;\n text-align: left;\n"], ["\n z-index: 100;\n visibility: ", ";\n opacity: ", ";\n transition: visibility 150ms linear, opacity 150ms linear;\n background: ", ";\n border: 1px solid ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n color: ", ";\n border-radius: 0.5rem;\n padding: 1rem;\n display: grid;\n grid-template-rows: 1fr;\n grid-gap: 8px;\n font-size: 1rem;\n text-align: left;\n"])), function (props) { return (props.show ? 'visible' : 'hidden'); }, function (props) { return (props.show ? 1 : 0); }, function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var theme = _a.theme; + return theme.bg3; +}, function (_a) { + var theme = _a.theme; + return theme.text2; +}); +var StyledMenu$1 = styled.div(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n border: none;\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n border: none;\n"]))); +var StyledTitleText = styled.div(templateObject_5$6 || (templateObject_5$6 = __makeTemplateObject(["\n font-size: 16px;\n overflow: hidden;\n text-overflow: ellipsis;\n font-weight: 600;\n color: ", ";\n"], ["\n font-size: 16px;\n overflow: hidden;\n text-overflow: ellipsis;\n font-weight: 600;\n color: ", ";\n"])), function (_a) { + var theme = _a.theme, active = _a.active; + return (active ? theme.white : theme.text2); +}); +var StyledListUrlText = styled(ThemedText.Main)(templateObject_6$3 || (templateObject_6$3 = __makeTemplateObject(["\n font-size: 12px;\n color: ", ";\n"], ["\n font-size: 12px;\n color: ", ";\n"])), function (_a) { + var theme = _a.theme, active = _a.active; + return (active ? theme.white : theme.text2); +}); +var RowWrapper = styled(Row$1)(templateObject_7$3 || (templateObject_7$3 = __makeTemplateObject(["\n background-color: ", ";\n opacity: ", ";\n transition: 200ms;\n align-items: center;\n padding: 1rem;\n border-radius: 20px;\n"], ["\n background-color: ", ";\n opacity: ", ";\n transition: 200ms;\n align-items: center;\n padding: 1rem;\n border-radius: 20px;\n"])), function (_a) { + var bgColor = _a.bgColor, active = _a.active, theme = _a.theme; + return (active ? bgColor !== null && bgColor !== void 0 ? bgColor : 'transparent' : theme.bg2); +}, function (_a) { + var hasActiveTokens = _a.hasActiveTokens; + return (hasActiveTokens ? 1 : 0.4); +}); +function listUrlRowHTMLId(listUrl) { + return "list-row-" + listUrl.replace(/\./g, '-'); +} +var ListRow = memo(function ListRow(_a) { + var listUrl = _a.listUrl; + var chainId = useActiveWeb3React().chainId; + var listsByUrl = useAppSelector(function (state) { return state.lists.byUrl; }); + var dispatch = useAppDispatch(); + var _b = listsByUrl[listUrl], list = _b.current, pending = _b.pendingUpdate; + var activeTokensOnThisChain = useMemo(function () { + if (!list || !chainId) { + return 0; + } + return list.tokens.reduce(function (acc, cur) { return (cur.chainId === chainId ? acc + 1 : acc); }, 0); + }, [chainId, list]); + var theme = useTheme(); + var listColor = useListColor(list === null || list === void 0 ? void 0 : list.logoURI); + var isActive = useIsListActive(listUrl); + var _c = __read(useToggle(false), 2), open = _c[0], toggle = _c[1]; + var node = useRef(); + var _d = __read(useState(), 2), referenceElement = _d[0], setReferenceElement = _d[1]; + var _e = __read(useState(), 2), popperElement = _e[0], setPopperElement = _e[1]; + var _f = usePopper(referenceElement, popperElement, { + placement: 'auto', + strategy: 'fixed', + modifiers: [{ name: 'offset', options: { offset: [8, 8] } }], + }), styles = _f.styles, attributes = _f.attributes; + useOnClickOutside(node, open ? toggle : undefined); + var handleAcceptListUpdate = useCallback(function () { + if (!pending) + return; + ReactGA.event({ + category: 'Lists', + action: 'Update List from List Select', + label: listUrl, + }); + dispatch(acceptListUpdate(listUrl)); + }, [dispatch, listUrl, pending]); + var handleRemoveList = useCallback(function () { + ReactGA.event({ + category: 'Lists', + action: 'Start Remove List', + label: listUrl, + }); + if (window.prompt(t(templateObject_8$2 || (templateObject_8$2 = __makeTemplateObject(["Please confirm you would like to remove this list by typing REMOVE"], ["Please confirm you would like to remove this list by typing REMOVE"])))) === "REMOVE") { + ReactGA.event({ + category: 'Lists', + action: 'Confirm Remove List', + label: listUrl, + }); + dispatch(removeList(listUrl)); + } + }, [dispatch, listUrl]); + var handleEnableList = useCallback(function () { + ReactGA.event({ + category: 'Lists', + action: 'Enable List', + label: listUrl, + }); + dispatch(enableList(listUrl)); + }, [dispatch, listUrl]); + var handleDisableList = useCallback(function () { + ReactGA.event({ + category: 'Lists', + action: 'Disable List', + label: listUrl, + }); + dispatch(disableList(listUrl)); + }, [dispatch, listUrl]); + if (!list) + return null; + return (jsxs(RowWrapper, __assign({ active: isActive, hasActiveTokens: activeTokensOnThisChain > 0, bgColor: listColor, id: listUrlRowHTMLId(listUrl) }, { children: [list.logoURI ? (jsx(ListLogo, { size: "40px", style: { marginRight: '1rem' }, logoURI: list.logoURI, alt: list.name + " list logo" }, void 0)) : (jsx("div", { style: { width: '24px', height: '24px', marginRight: '1rem' } }, void 0)), jsxs(Column, __assign({ style: { flex: '1' } }, { children: [jsx(Row$1, { children: jsx(StyledTitleText, __assign({ active: isActive }, { children: list.name }), void 0) }, void 0), jsxs(RowFixed, __assign({ mt: "4px" }, { children: [jsx(StyledListUrlText, __assign({ active: isActive, mr: "6px" }, { children: jsxs(Trans, { children: [activeTokensOnThisChain, " tokens"] }, void 0) }), void 0), jsxs(StyledMenu$1, __assign({ ref: node }, { children: [jsx(ButtonEmpty, __assign({ onClick: toggle, ref: setReferenceElement, padding: "0" }, { children: jsx(Settings, { stroke: isActive ? theme.bg1 : theme.text1, size: 12 }, void 0) }), void 0), open && (jsxs(PopoverContainer, __assign({ show: true, ref: setPopperElement, style: styles.popper }, attributes.popper, { children: [jsx("div", { children: list && listVersionLabel(list.version) }, void 0), jsx(SeparatorDark, {}, void 0), jsx(ExternalLink, __assign({ href: "https://tokenlists.org/token-list?url=" + listUrl }, { children: jsx(Trans, { children: "View list" }, void 0) }), void 0), jsx(UnpaddedLinkStyledButton, __assign({ onClick: handleRemoveList, disabled: Object.keys(listsByUrl).length === 1 }, { children: jsx(Trans, { children: "Remove list" }, void 0) }), void 0), pending && (jsx(UnpaddedLinkStyledButton, __assign({ onClick: handleAcceptListUpdate }, { children: jsx(Trans, { children: "Update list" }, void 0) }), void 0))] }), void 0))] }), void 0)] }), void 0)] }), void 0), jsx(ListToggle, { isActive: isActive, bgColor: listColor, toggle: function () { + isActive ? handleDisableList() : handleEnableList(); + } }, void 0)] }), listUrl)); +}); +var ListContainer = styled.div(templateObject_9$2 || (templateObject_9$2 = __makeTemplateObject(["\n padding: 1rem;\n height: 100%;\n overflow: auto;\n flex: 1;\n"], ["\n padding: 1rem;\n height: 100%;\n overflow: auto;\n flex: 1;\n"]))); +function ManageLists(_a) { + var setModalView = _a.setModalView, setImportList = _a.setImportList, setListUrl = _a.setListUrl; + var chainId = useActiveWeb3React().chainId; + var theme = useTheme(); + var _b = __read(useState(''), 2), listUrlInput = _b[0], setListUrlInput = _b[1]; + var lists = useAllLists(); + var tokenCountByListName = useMemo(function () { + return Object.values(lists).reduce(function (acc, _a) { + var _b; + var list = _a.current; + if (!list) { + return acc; + } + return __assign(__assign({}, acc), (_b = {}, _b[list.name] = list.tokens.reduce(function (count, token) { return (token.chainId === chainId ? count + 1 : count); }, 0), _b)); + }, {}); + }, [chainId, lists]); + // sort by active but only if not visible + var activeListUrls = useActiveListUrls(); + var handleInput = useCallback(function (e) { + setListUrlInput(e.target.value); + }, []); + var fetchList = useFetchListCallback(); + var validUrl = useMemo(function () { + return uriToHttp(listUrlInput).length > 0 || Boolean(parseENSAddress(listUrlInput)); + }, [listUrlInput]); + var sortedLists = useMemo(function () { + var listUrls = Object.keys(lists); + return listUrls + .filter(function (listUrl) { + // only show loaded lists, hide unsupported lists + return Boolean(lists[listUrl].current) && !Boolean(UNSUPPORTED_LIST_URLS.includes(listUrl)); + }) + .sort(function (listUrlA, listUrlB) { + var listA = lists[listUrlA].current; + var listB = lists[listUrlB].current; + // first filter on active lists + if ((activeListUrls === null || activeListUrls === void 0 ? void 0 : activeListUrls.includes(listUrlA)) && !(activeListUrls === null || activeListUrls === void 0 ? void 0 : activeListUrls.includes(listUrlB))) { + return -1; + } + if (!(activeListUrls === null || activeListUrls === void 0 ? void 0 : activeListUrls.includes(listUrlA)) && (activeListUrls === null || activeListUrls === void 0 ? void 0 : activeListUrls.includes(listUrlB))) { + return 1; + } + if (listA && listB) { + if (tokenCountByListName[listA.name] > tokenCountByListName[listB.name]) { + return -1; + } + if (tokenCountByListName[listA.name] < tokenCountByListName[listB.name]) { + return 1; + } + return listA.name.toLowerCase() < listB.name.toLowerCase() + ? -1 + : listA.name.toLowerCase() === listB.name.toLowerCase() + ? 0 + : 1; + } + if (listA) + return -1; + if (listB) + return 1; + return 0; + }); + }, [lists, activeListUrls, tokenCountByListName]); + // temporary fetched list for import flow + var _c = __read(useState(), 2), tempList = _c[0], setTempList = _c[1]; + var _d = __read(useState(), 2), addError = _d[0], setAddError = _d[1]; + useEffect(function () { + function fetchTempList() { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + fetchList(listUrlInput, false) + .then(function (list) { return setTempList(list); }) + .catch(function () { return setAddError(t(templateObject_10$2 || (templateObject_10$2 = __makeTemplateObject(["Error importing list"], ["Error importing list"])))); }); + return [2 /*return*/]; + }); + }); + } + // if valid url, fetch details for card + if (validUrl) { + fetchTempList(); + } + else { + setTempList(undefined); + listUrlInput !== '' && setAddError(t(templateObject_11$2 || (templateObject_11$2 = __makeTemplateObject(["Enter valid list location"], ["Enter valid list location"])))); + } + // reset error + if (listUrlInput === '') { + setAddError(undefined); + } + }, [fetchList, listUrlInput, validUrl]); + // check if list is already imported + var isImported = Object.keys(lists).includes(listUrlInput); + // set list values and have parent modal switch to import list view + var handleImport = useCallback(function () { + if (!tempList) + return; + setImportList(tempList); + setModalView(CurrencyModalView.importList); + setListUrl(listUrlInput); + }, [listUrlInput, setImportList, setListUrl, setModalView, tempList]); + return (jsxs(Wrapper$4, { children: [jsxs(PaddedColumn, __assign({ gap: "14px" }, { children: [jsx(Row$1, { children: jsx(SearchInput, { type: "text", id: "list-add-input", placeholder: t(templateObject_12$2 || (templateObject_12$2 = __makeTemplateObject(["https:// or ipfs:// or ENS name"], ["https:// or ipfs:// or ENS name"]))), value: listUrlInput, onChange: handleInput }, void 0) }, void 0), addError ? (jsx(ThemedText.Error, __assign({ title: addError, style: { textOverflow: 'ellipsis', overflow: 'hidden' }, error: true }, { children: addError }), void 0)) : null] }), void 0), tempList && (jsx(PaddedColumn, __assign({ style: { paddingTop: 0 } }, { children: jsx(Card, __assign({ backgroundColor: theme.bg2, padding: "12px 20px" }, { children: jsxs(RowBetween, { children: [jsxs(RowFixed, { children: [tempList.logoURI && jsx(ListLogo, { logoURI: tempList.logoURI, size: "40px" }, void 0), jsxs(AutoColumn, __assign({ gap: "4px", style: { marginLeft: '20px' } }, { children: [jsx(ThemedText.Body, __assign({ fontWeight: 600 }, { children: tempList.name }), void 0), jsx(ThemedText.Main, __assign({ fontSize: '12px' }, { children: jsxs(Trans, { children: [tempList.tokens.length, " tokens"] }, void 0) }), void 0)] }), void 0)] }, void 0), isImported ? (jsxs(RowFixed, { children: [jsx(IconWrapper$4, __assign({ stroke: theme.text2, size: "16px", marginRight: '10px' }, { children: jsx(CheckCircle, {}, void 0) }), void 0), jsx(ThemedText.Body, __assign({ color: theme.text2 }, { children: jsx(Trans, { children: "Loaded" }, void 0) }), void 0)] }, void 0)) : (jsx(ButtonPrimary, __assign({ style: { fontSize: '14px' }, padding: "6px 8px", width: "fit-content", onClick: handleImport }, { children: jsx(Trans, { children: "Import" }, void 0) }), void 0))] }, void 0) }), void 0) }), void 0)), jsx(Separator, {}, void 0), jsx(ListContainer, { children: jsx(AutoColumn, __assign({ gap: "md" }, { children: sortedLists.map(function (listUrl) { return (jsx(ListRow, { listUrl: listUrl }, listUrl)); }) }), void 0) }, void 0)] }, void 0)); +} +var templateObject_1$h, templateObject_2$9, templateObject_3$7, templateObject_4$6, templateObject_5$6, templateObject_6$3, templateObject_7$3, templateObject_8$2, templateObject_9$2, templateObject_10$2, templateObject_11$2, templateObject_12$2; + +var Wrapper$3 = styled.div(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n width: 100%;\n height: calc(100% - 60px);\n position: relative;\n padding-bottom: 80px;\n"], ["\n width: 100%;\n height: calc(100% - 60px);\n position: relative;\n padding-bottom: 80px;\n"]))); +var Footer = styled.div(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n position: absolute;\n bottom: 0;\n width: 100%;\n border-radius: 20px;\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n border-top: 1px solid ", ";\n padding: 20px;\n text-align: center;\n"], ["\n position: absolute;\n bottom: 0;\n width: 100%;\n border-radius: 20px;\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n border-top: 1px solid ", ";\n padding: 20px;\n text-align: center;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +function ManageTokens(_a) { + var setModalView = _a.setModalView, setImportToken = _a.setImportToken; + var chainId = useActiveWeb3React().chainId; + var _b = __read(useState(''), 2), searchQuery = _b[0], setSearchQuery = _b[1]; + var theme = useTheme(); + // manage focus on modal show + var inputRef = useRef(); + var handleInput = useCallback(function (event) { + var input = event.target.value; + var checksummedInput = isAddress(input); + setSearchQuery(checksummedInput || input); + }, []); + // if they input an address, use it + var isAddressSearch = isAddress(searchQuery); + var searchToken = useToken(searchQuery); + // all tokens for local lisr + var userAddedTokens = useUserAddedTokens(); + var removeToken = useRemoveUserAddedToken(); + var handleRemoveAll = useCallback(function () { + if (chainId && userAddedTokens) { + userAddedTokens.map(function (token) { + return removeToken(chainId, token.address); + }); + } + }, [removeToken, userAddedTokens, chainId]); + var tokenList = useMemo(function () { + return (chainId && + userAddedTokens.map(function (token) { return (jsxs(RowBetween, __assign({ width: "100%" }, { children: [jsxs(RowFixed, { children: [jsx(CurrencyLogo, { currency: token, size: '20px' }, void 0), jsx(ExternalLink, __assign({ href: getExplorerLink(chainId, token.address, ExplorerDataType.ADDRESS) }, { children: jsx(ThemedText.Main, __assign({ ml: '10px', fontWeight: 600 }, { children: token.symbol }), void 0) }), void 0)] }, void 0), jsxs(RowFixed, { children: [jsx(TrashIcon, { onClick: function () { return removeToken(chainId, token.address); } }, void 0), jsx(ExternalLinkIcon, { href: getExplorerLink(chainId, token.address, ExplorerDataType.ADDRESS) }, void 0)] }, void 0)] }), token.address)); })); + }, [userAddedTokens, chainId, removeToken]); + return (jsxs(Wrapper$3, { children: [jsxs(Column, __assign({ style: { width: '100%', height: '100%', flex: '1 1' } }, { children: [jsxs(PaddedColumn, __assign({ gap: "14px" }, { children: [jsx(Row$1, { children: jsx(SearchInput, { type: "text", id: "token-search-input", placeholder: '0x0000', value: searchQuery, autoComplete: "off", ref: inputRef, onChange: handleInput }, void 0) }, void 0), searchQuery !== '' && !isAddressSearch && (jsx(ThemedText.Error, __assign({ error: true }, { children: jsx(Trans, { children: "Enter valid token address" }, void 0) }), void 0)), searchToken && (jsx(Card, __assign({ backgroundColor: theme.bg2, padding: "10px 0" }, { children: jsx(ImportRow, { token: searchToken, showImportView: function () { return setModalView(CurrencyModalView.importToken); }, setImportToken: setImportToken, style: { height: 'fit-content' } }, void 0) }), void 0))] }), void 0), jsx(Separator, {}, void 0), jsxs(PaddedColumn, __assign({ gap: "lg", style: { overflow: 'auto', marginBottom: '10px' } }, { children: [jsxs(RowBetween, { children: [jsx(ThemedText.Main, __assign({ fontWeight: 600 }, { children: jsxs(Trans, { children: [userAddedTokens === null || userAddedTokens === void 0 ? void 0 : userAddedTokens.length, " Custom Tokens"] }, void 0) }), void 0), userAddedTokens.length > 0 && (jsx(ButtonText, __assign({ onClick: handleRemoveAll }, { children: jsx(ThemedText.Blue, { children: jsx(Trans, { children: "Clear all" }, void 0) }, void 0) }), void 0))] }, void 0), tokenList] }), void 0)] }), void 0), jsx(Footer, { children: jsx(ThemedText.DarkGray, { children: jsx(Trans, { children: "Tip: Custom tokens are stored locally in your browser" }, void 0) }, void 0) }, void 0)] }, void 0)); +} +var templateObject_1$g, templateObject_2$8; + +var Wrapper$2 = styled.div(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n width: 100%;\n position: relative;\n display: flex;\n flex-flow: column;\n"], ["\n width: 100%;\n position: relative;\n display: flex;\n flex-flow: column;\n"]))); +var ToggleWrapper = styled(RowBetween)(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 12px;\n padding: 6px;\n"], ["\n background-color: ", ";\n border-radius: 12px;\n padding: 6px;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var ToggleOption = styled.div(templateObject_3$6 || (templateObject_3$6 = __makeTemplateObject(["\n width: 48%;\n padding: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 12px;\n font-weight: 600;\n background-color: ", ";\n color: ", ";\n user-select: none;\n\n :hover {\n cursor: pointer;\n opacity: 0.7;\n }\n"], ["\n width: 48%;\n padding: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 12px;\n font-weight: 600;\n background-color: ", ";\n color: ", ";\n user-select: none;\n\n :hover {\n cursor: pointer;\n opacity: 0.7;\n }\n"])), function (_a) { + var theme = _a.theme, active = _a.active; + return (active ? theme.bg1 : theme.bg3); +}, function (_a) { + var theme = _a.theme, active = _a.active; + return (active ? theme.text1 : theme.text2); +}); +function Manage(_a) { + var onDismiss = _a.onDismiss, setModalView = _a.setModalView, setImportList = _a.setImportList, setImportToken = _a.setImportToken, setListUrl = _a.setListUrl; + // toggle between tokens and lists + var _b = __read(useState(true), 2), showLists = _b[0], setShowLists = _b[1]; + return (jsxs(Wrapper$2, { children: [jsx(PaddedColumn, { children: jsxs(RowBetween, { children: [jsx(ArrowLeft, { style: { cursor: 'pointer' }, onClick: function () { return setModalView(CurrencyModalView.search); } }, void 0), jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20 }, { children: jsx(Trans, { children: "Manage" }, void 0) }), void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }, void 0) }, void 0), jsx(Separator, {}, void 0), jsx(PaddedColumn, __assign({ style: { paddingBottom: 0 } }, { children: jsxs(ToggleWrapper, { children: [jsx(ToggleOption, __assign({ onClick: function () { return setShowLists(!showLists); }, active: showLists }, { children: jsx(Trans, { children: "Lists" }, void 0) }), void 0), jsx(ToggleOption, __assign({ onClick: function () { return setShowLists(!showLists); }, active: !showLists }, { children: jsx(Trans, { children: "Tokens" }, void 0) }), void 0)] }, void 0) }), void 0), showLists ? (jsx(ManageLists, { setModalView: setModalView, setImportList: setImportList, setListUrl: setListUrl }, void 0)) : (jsx(ManageTokens, { setModalView: setModalView, setImportToken: setImportToken }, void 0))] }, void 0)); +} +var templateObject_1$f, templateObject_2$7, templateObject_3$6; + +var CurrencyModalView; +(function (CurrencyModalView) { + CurrencyModalView[CurrencyModalView["search"] = 0] = "search"; + CurrencyModalView[CurrencyModalView["manage"] = 1] = "manage"; + CurrencyModalView[CurrencyModalView["importToken"] = 2] = "importToken"; + CurrencyModalView[CurrencyModalView["importList"] = 3] = "importList"; +})(CurrencyModalView || (CurrencyModalView = {})); +function CurrencySearchModal(_a) { + var isOpen = _a.isOpen, onDismiss = _a.onDismiss, onCurrencySelect = _a.onCurrencySelect, selectedCurrency = _a.selectedCurrency, otherSelectedCurrency = _a.otherSelectedCurrency, _b = _a.showCommonBases, showCommonBases = _b === void 0 ? false : _b, _c = _a.showCurrencyAmount, showCurrencyAmount = _c === void 0 ? true : _c, _d = _a.disableNonToken, disableNonToken = _d === void 0 ? false : _d; + var _e = __read(useState(CurrencyModalView.manage), 2), modalView = _e[0], setModalView = _e[1]; + var lastOpen = useLast(isOpen); + useEffect(function () { + if (isOpen && !lastOpen) { + setModalView(CurrencyModalView.search); + } + }, [isOpen, lastOpen]); + var handleCurrencySelect = useCallback(function (currency) { + onCurrencySelect(currency); + onDismiss(); + }, [onDismiss, onCurrencySelect]); + // for token import view + var prevView = usePrevious(modalView); + // used for import token flow + var _f = __read(useState(), 2), importToken = _f[0], setImportToken = _f[1]; + // used for import list + var _g = __read(useState(), 2), importList = _g[0], setImportList = _g[1]; + var _h = __read(useState(), 2), listURL = _h[0], setListUrl = _h[1]; + var showImportView = useCallback(function () { return setModalView(CurrencyModalView.importToken); }, [setModalView]); + var showManageView = useCallback(function () { return setModalView(CurrencyModalView.manage); }, [setModalView]); + var handleBackImport = useCallback(function () { return setModalView(prevView && prevView !== CurrencyModalView.importToken ? prevView : CurrencyModalView.search); }, [setModalView, prevView]); + // change min height if not searching + var minHeight = modalView === CurrencyModalView.importToken || modalView === CurrencyModalView.importList ? 40 : 80; + var content = null; + switch (modalView) { + case CurrencyModalView.search: + content = (jsx(CurrencySearch, { isOpen: isOpen, onDismiss: onDismiss, onCurrencySelect: handleCurrencySelect, selectedCurrency: selectedCurrency, otherSelectedCurrency: otherSelectedCurrency, showCommonBases: showCommonBases, showCurrencyAmount: showCurrencyAmount, disableNonToken: disableNonToken, showImportView: showImportView, setImportToken: setImportToken, showManageView: showManageView }, void 0)); + break; + case CurrencyModalView.importToken: + if (importToken) { + content = (jsx(ImportToken, { tokens: [importToken], onDismiss: onDismiss, list: importToken instanceof WrappedTokenInfo ? importToken.list : undefined, onBack: handleBackImport, handleCurrencySelect: handleCurrencySelect }, void 0)); + } + break; + case CurrencyModalView.importList: + if (importList && listURL) { + content = jsx(ImportList, { list: importList, listURL: listURL, onDismiss: onDismiss, setModalView: setModalView }, void 0); + } + break; + case CurrencyModalView.manage: + content = (jsx(Manage, { onDismiss: onDismiss, setModalView: setModalView, setImportToken: setImportToken, setImportList: setImportList, setListUrl: setListUrl }, void 0)); + break; + } + return (jsx(Modal, __assign({ isOpen: isOpen, onDismiss: onDismiss, maxHeight: 80, minHeight: minHeight }, { children: content }), void 0)); +} + +var TextWrapper = styled.span(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n margin-left: ", ";\n color: ", ";\n font-size: ", ";\n\n @media screen and (max-width: 600px) {\n font-size: ", ";\n }\n"], ["\n margin-left: ", ";\n color: ", ";\n font-size: ", ";\n\n @media screen and (max-width: 600px) {\n font-size: ", ";\n }\n"])), function (_a) { + var margin = _a.margin; + return margin && '4px'; +}, function (_a) { + var theme = _a.theme, link = _a.link, textColor = _a.textColor; + return (link ? theme.blue1 : textColor !== null && textColor !== void 0 ? textColor : theme.text1); +}, function (_a) { + var fontSize = _a.fontSize; + return fontSize !== null && fontSize !== void 0 ? fontSize : 'inherit'; +}, function (_a) { + var adjustSize = _a.adjustSize; + return adjustSize && '12px'; +}); +var HoverInlineText = function (_a) { + var text = _a.text, _b = _a.maxCharacters, maxCharacters = _b === void 0 ? 20 : _b, _c = _a.margin, margin = _c === void 0 ? false : _c, _d = _a.adjustSize, adjustSize = _d === void 0 ? false : _d, fontSize = _a.fontSize, textColor = _a.textColor, link = _a.link, rest = __rest(_a, ["text", "maxCharacters", "margin", "adjustSize", "fontSize", "textColor", "link"]); + var _e = __read(useState(false), 2), showHover = _e[0], setShowHover = _e[1]; + if (!text) { + return jsx("span", {}, void 0); + } + if (text.length > maxCharacters) { + return (jsx(Tooltip, __assign({ text: text, show: showHover }, { children: jsx(TextWrapper, __assign({ onMouseEnter: function () { return setShowHover(true); }, onMouseLeave: function () { return setShowHover(false); }, margin: margin, adjustSize: adjustSize, textColor: textColor, link: link, fontSize: fontSize }, rest, { children: ' ' + text.slice(0, maxCharacters - 1) + '...' }), void 0) }), void 0)); + } + return (jsx(TextWrapper, __assign({ margin: margin, adjustSize: adjustSize, link: link, fontSize: fontSize, textColor: textColor }, rest, { children: text }), void 0)); +}; +var templateObject_1$e; + +function FiatValue(_a) { + var fiatValue = _a.fiatValue, priceImpact = _a.priceImpact; + var theme = useTheme(); + var priceImpactColor = useMemo(function () { + if (!priceImpact) + return undefined; + if (priceImpact.lessThan('0')) + return theme.green1; + var severity = warningSeverity(priceImpact); + if (severity < 1) + return theme.text3; + if (severity < 3) + return theme.yellow1; + return theme.red1; + }, [priceImpact, theme.green1, theme.red1, theme.text3, theme.yellow1]); + return (jsxs(ThemedText.Body, __assign({ fontSize: 14, color: fiatValue ? theme.text3 : theme.text4 }, { children: [fiatValue ? (jsxs(Trans, { children: ["$", jsx(HoverInlineText, { text: fiatValue === null || fiatValue === void 0 ? void 0 : fiatValue.toSignificant(6, { groupSeparator: ',' }), textColor: fiatValue ? theme.text3 : theme.text4 }, void 0)] }, void 0)) : (''), priceImpact ? (jsxs("span", __assign({ style: { color: priceImpactColor } }, { children: [' ', jsxs(MouseoverTooltip, __assign({ text: t(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["The estimated difference between the USD values of input and output amounts."], ["The estimated difference between the USD values of input and output amounts."]))) }, { children: ["(", jsxs(Trans, { children: [priceImpact.multiply(-1).toSignificant(3), "%"] }, void 0), ")"] }), void 0)] }), void 0)) : null] }), void 0)); +} +var templateObject_1$d; + +var InputPanel = styled.div(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n ", "\n position: relative;\n border-radius: ", ";\n background-color: ", ";\n z-index: 1;\n width: ", ";\n transition: height 1s ease;\n will-change: height;\n"], ["\n ", "\n position: relative;\n border-radius: ", ";\n background-color: ", ";\n z-index: 1;\n width: ", ";\n transition: height 1s ease;\n will-change: height;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexColumnNoWrap; +}, function (_a) { + var hideInput = _a.hideInput; + return (hideInput ? '16px' : '20px'); +}, function (_a) { + var theme = _a.theme, hideInput = _a.hideInput; + return (hideInput ? 'transparent' : theme.bg2); +}, function (_a) { + var hideInput = _a.hideInput; + return (hideInput ? '100%' : 'initial'); +}); +var FixedContainer = styled.div(templateObject_2$6 || (templateObject_2$6 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: 20px;\n background-color: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n"], ["\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: 20px;\n background-color: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}); +var Container$1 = styled.div(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n border-radius: ", ";\n border: 1px solid ", ";\n background-color: ", ";\n width: ", ";\n :focus,\n :hover {\n border: 1px solid ", ";\n }\n"], ["\n border-radius: ", ";\n border: 1px solid ", ";\n background-color: ", ";\n width: ", ";\n :focus,\n :hover {\n border: 1px solid ", ";\n }\n"])), function (_a) { + var hideInput = _a.hideInput; + return (hideInput ? '16px' : '20px'); +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}, function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var hideInput = _a.hideInput; + return (hideInput ? '100%' : 'initial'); +}, function (_a) { + var theme = _a.theme, hideInput = _a.hideInput; + return (hideInput ? ' transparent' : theme.bg3); +}); +var CurrencySelect = styled(ButtonGray)(templateObject_4$5 || (templateObject_4$5 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\n box-shadow: ", ";\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.075);\n color: ", ";\n cursor: pointer;\n border-radius: 16px;\n outline: none;\n user-select: none;\n border: none;\n font-size: 24px;\n font-weight: 500;\n height: ", ";\n width: ", ";\n padding: 0 8px;\n justify-content: space-between;\n margin-left: ", ";\n :focus,\n :hover {\n background-color: ", ";\n }\n visibility: ", ";\n"], ["\n align-items: center;\n background-color: ", ";\n box-shadow: ", ";\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.075);\n color: ", ";\n cursor: pointer;\n border-radius: 16px;\n outline: none;\n user-select: none;\n border: none;\n font-size: 24px;\n font-weight: 500;\n height: ", ";\n width: ", ";\n padding: 0 8px;\n justify-content: space-between;\n margin-left: ", ";\n :focus,\n :hover {\n background-color: ", ";\n }\n visibility: ", ";\n"])), function (_a) { + var selected = _a.selected, theme = _a.theme; + return (selected ? theme.bg2 : theme.primary1); +}, function (_a) { + var selected = _a.selected; + return (selected ? 'none' : '0px 6px 10px rgba(0, 0, 0, 0.075)'); +}, function (_a) { + var selected = _a.selected, theme = _a.theme; + return (selected ? theme.text1 : theme.white); +}, function (_a) { + var hideInput = _a.hideInput; + return (hideInput ? '2.8rem' : '2.4rem'); +}, function (_a) { + var hideInput = _a.hideInput; + return (hideInput ? '100%' : 'initial'); +}, function (_a) { + var hideInput = _a.hideInput; + return (hideInput ? '0' : '12px'); +}, function (_a) { + var selected = _a.selected, theme = _a.theme; + return (selected ? theme.bg3 : darken(0.05, theme.primary1)); +}, function (_a) { + var visible = _a.visible; + return (visible ? 'visible' : 'hidden'); +}); +var InputRow = styled.div(templateObject_5$5 || (templateObject_5$5 = __makeTemplateObject(["\n ", "\n align-items: center;\n justify-content: space-between;\n padding: ", ";\n"], ["\n ", "\n align-items: center;\n justify-content: space-between;\n padding: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (_a) { + var selected = _a.selected; + return (selected ? ' 1rem 1rem 0.75rem 1rem' : '1rem 1rem 1rem 1rem'); +}); +var LabelRow = styled.div(templateObject_6$2 || (templateObject_6$2 = __makeTemplateObject(["\n ", "\n align-items: center;\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding: 0 1rem 1rem;\n span:hover {\n cursor: pointer;\n color: ", ";\n }\n"], ["\n ", "\n align-items: center;\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding: 0 1rem 1rem;\n span:hover {\n cursor: pointer;\n color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}, function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return darken(0.2, theme.text2); +}); +var FiatRow = styled(LabelRow)(templateObject_7$2 || (templateObject_7$2 = __makeTemplateObject(["\n justify-content: flex-end;\n"], ["\n justify-content: flex-end;\n"]))); +var Aligner = styled.span(templateObject_8$1 || (templateObject_8$1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n"]))); +var StyledDropDown = styled(SvgDropdown)(templateObject_9$1 || (templateObject_9$1 = __makeTemplateObject(["\n margin: 0 0.25rem 0 0.35rem;\n height: 35%;\n\n path {\n stroke: ", ";\n stroke-width: 1.5px;\n }\n"], ["\n margin: 0 0.25rem 0 0.35rem;\n height: 35%;\n\n path {\n stroke: ", ";\n stroke-width: 1.5px;\n }\n"])), function (_a) { + var selected = _a.selected, theme = _a.theme; + return (selected ? theme.text1 : theme.white); +}); +var StyledTokenName = styled.span(templateObject_10$1 || (templateObject_10$1 = __makeTemplateObject(["\n ", "\n font-size: ", ";\n"], ["\n ", "\n font-size: ", ";\n"])), function (_a) { + var active = _a.active; + return (active ? ' margin: 0 0.25rem 0 0.25rem;' : ' margin: 0 0.25rem 0 0.25rem;'); +}, function (_a) { + var active = _a.active; + return (active ? '18px' : '18px'); +}); +var StyledBalanceMax = styled.button(templateObject_11$1 || (templateObject_11$1 = __makeTemplateObject(["\n background-color: transparent;\n background-color: ", ";\n border: none;\n border-radius: 12px;\n color: ", ";\n cursor: pointer;\n font-size: 11px;\n font-weight: 500;\n margin-left: 0.25rem;\n opacity: ", ";\n padding: 4px 6px;\n pointer-events: ", ";\n\n :hover {\n opacity: ", ";\n }\n\n :focus {\n outline: none;\n }\n"], ["\n background-color: transparent;\n background-color: ", ";\n border: none;\n border-radius: 12px;\n color: ", ";\n cursor: pointer;\n font-size: 11px;\n font-weight: 500;\n margin-left: 0.25rem;\n opacity: ", ";\n padding: 4px 6px;\n pointer-events: ", ";\n\n :hover {\n opacity: ", ";\n }\n\n :focus {\n outline: none;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.primary5; +}, function (_a) { + var theme = _a.theme; + return theme.primary1; +}, function (_a) { + var disabled = _a.disabled; + return (!disabled ? 1 : 0.4); +}, function (_a) { + var disabled = _a.disabled; + return (!disabled ? 'initial' : 'none'); +}, function (_a) { + var disabled = _a.disabled; + return (!disabled ? 0.8 : 0.4); +}); +var StyledNumericalInput = styled(Input$1)(templateObject_12$1 || (templateObject_12$1 = __makeTemplateObject(["\n ", ";\n text-align: left;\n"], ["\n ", ";\n text-align: left;\n"])), loadingOpacityMixin); +function CurrencyInputPanel(_a) { + var value = _a.value, onUserInput = _a.onUserInput, onMax = _a.onMax, showMaxButton = _a.showMaxButton, onCurrencySelect = _a.onCurrencySelect, currency = _a.currency, otherCurrency = _a.otherCurrency, id = _a.id, showCommonBases = _a.showCommonBases, showCurrencyAmount = _a.showCurrencyAmount, disableNonToken = _a.disableNonToken, renderBalance = _a.renderBalance, fiatValue = _a.fiatValue, priceImpact = _a.priceImpact, _b = _a.hideBalance, hideBalance = _b === void 0 ? false : _b, _c = _a.pair, pair = _c === void 0 ? null : _c, // used for double token logo + _d = _a.hideInput, // used for double token logo + hideInput = _d === void 0 ? false : _d, _e = _a.locked, locked = _e === void 0 ? false : _e, _f = _a.loading, loading = _f === void 0 ? false : _f, rest = __rest(_a, ["value", "onUserInput", "onMax", "showMaxButton", "onCurrencySelect", "currency", "otherCurrency", "id", "showCommonBases", "showCurrencyAmount", "disableNonToken", "renderBalance", "fiatValue", "priceImpact", "hideBalance", "pair", "hideInput", "locked", "loading"]); + var _g = __read(useState(false), 2), modalOpen = _g[0], setModalOpen = _g[1]; + var account = useActiveWeb3React().account; + var selectedCurrencyBalance = useCurrencyBalance(account !== null && account !== void 0 ? account : undefined, currency !== null && currency !== void 0 ? currency : undefined); + var theme = useTheme(); + var handleDismissSearch = useCallback(function () { + setModalOpen(false); + }, [setModalOpen]); + return (jsxs(InputPanel, __assign({ id: id, hideInput: hideInput }, rest, { children: [locked && (jsx(FixedContainer, { children: jsxs(AutoColumn, __assign({ gap: "sm", justify: "center" }, { children: [jsx(Lock, {}, void 0), jsx(ThemedText.Label, __assign({ fontSize: "12px", textAlign: "center", padding: "0 12px" }, { children: jsx(Trans, { children: "The market price is outside your specified price range. Single-asset deposit only." }, void 0) }), void 0)] }), void 0) }, void 0)), jsxs(Container$1, __assign({ hideInput: hideInput }, { children: [jsxs(InputRow, __assign({ style: hideInput ? { padding: '0', borderRadius: '8px' } : {}, selected: !onCurrencySelect }, { children: [!hideInput && (jsx(StyledNumericalInput, { className: "token-amount-input", value: value, onUserInput: onUserInput, "$loading": loading }, void 0)), jsx(CurrencySelect, __assign({ visible: currency !== undefined, selected: !!currency, hideInput: hideInput, className: "open-currency-select-button", onClick: function () { + if (onCurrencySelect) { + setModalOpen(true); + } + } }, { children: jsxs(Aligner, { children: [jsxs(RowFixed, { children: [pair ? (jsx("span", __assign({ style: { marginRight: '0.5rem' } }, { children: jsx(DoubleCurrencyLogo, { currency0: pair.token0, currency1: pair.token1, size: 24, margin: true }, void 0) }), void 0)) : currency ? (jsx(CurrencyLogo, { style: { marginRight: '0.5rem' }, currency: currency, size: '24px' }, void 0)) : null, pair ? (jsxs(StyledTokenName, __assign({ className: "pair-name-container" }, { children: [pair === null || pair === void 0 ? void 0 : pair.token0.symbol, ":", pair === null || pair === void 0 ? void 0 : pair.token1.symbol] }), void 0)) : (jsx(StyledTokenName, __assign({ className: "token-symbol-container", active: Boolean(currency && currency.symbol) }, { children: (currency && currency.symbol && currency.symbol.length > 20 + ? currency.symbol.slice(0, 4) + + '...' + + currency.symbol.slice(currency.symbol.length - 5, currency.symbol.length) + : currency === null || currency === void 0 ? void 0 : currency.symbol) || jsx(Trans, { children: "Select a token" }, void 0) }), void 0))] }, void 0), onCurrencySelect && jsx(StyledDropDown, { selected: !!currency }, void 0)] }, void 0) }), void 0)] }), void 0), !hideInput && !hideBalance && currency && (jsx(FiatRow, { children: jsxs(RowBetween, { children: [jsx(LoadingOpacityContainer, __assign({ "$loading": loading }, { children: jsx(FiatValue, { fiatValue: fiatValue, priceImpact: priceImpact }, void 0) }), void 0), account ? (jsxs(RowFixed, __assign({ style: { height: '17px' } }, { children: [jsx(ThemedText.Body, __assign({ onClick: onMax, color: theme.text3, fontWeight: 500, fontSize: 14, style: { display: 'inline', cursor: 'pointer' } }, { children: !hideBalance && currency && selectedCurrencyBalance ? (renderBalance ? (renderBalance(selectedCurrencyBalance)) : (jsxs(Trans, { children: ["Balance: ", formatCurrencyAmount(selectedCurrencyBalance, 4)] }, void 0))) : null }), void 0), showMaxButton && selectedCurrencyBalance ? (jsx(StyledBalanceMax, __assign({ onClick: onMax }, { children: jsx(Trans, { children: "MAX" }, void 0) }), void 0)) : null] }), void 0)) : (jsx("span", {}, void 0))] }, void 0) }, void 0))] }), void 0), onCurrencySelect && (jsx(CurrencySearchModal, { isOpen: modalOpen, onDismiss: handleDismissSearch, onCurrencySelect: onCurrencySelect, selectedCurrency: currency, otherSelectedCurrency: otherCurrency, showCommonBases: showCommonBases, showCurrencyAmount: showCurrencyAmount, disableNonToken: disableNonToken }, void 0))] }), void 0)); +} +var templateObject_1$c, templateObject_2$6, templateObject_3$5, templateObject_4$5, templateObject_5$5, templateObject_6$2, templateObject_7$2, templateObject_8$1, templateObject_9$1, templateObject_10$1, templateObject_11$1, templateObject_12$1; + +/** + * Given the price impact, get user confirmation. + * + * @param priceImpactWithoutFee price impact of the trade without the fee. + */ +function confirmPriceImpactWithoutFee(priceImpactWithoutFee) { + if (!priceImpactWithoutFee.lessThan(PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN)) { + return (window.prompt("This swap has a price impact of at least " + PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN.toFixed(0) + "%. Please type the word \"confirm\" to continue with this swap.") === 'confirm'); + } + else if (!priceImpactWithoutFee.lessThan(ALLOWED_PRICE_IMPACT_HIGH)) { + return window.confirm("This swap has a price impact of at least " + ALLOWED_PRICE_IMPACT_HIGH.toFixed(0) + "%. Please confirm that you would like to continue with this swap."); + } + return true; +} + +/** + * Returns true if the trade requires a confirmation of details before we can submit it + * @param args either a pair of V2 trades or a pair of V3 trades + */ +function tradeMeaningfullyDiffers() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var _a = __read(args, 2), tradeA = _a[0], tradeB = _a[1]; + return (tradeA.tradeType !== tradeB.tradeType || + !tradeA.inputAmount.currency.equals(tradeB.inputAmount.currency) || + !tradeA.inputAmount.equalTo(tradeB.inputAmount) || + !tradeA.outputAmount.currency.equals(tradeB.outputAmount.currency) || + !tradeA.outputAmount.equalTo(tradeB.outputAmount)); +} + +function useAddTokenToMetamask(currencyToAdd) { + var library = useActiveWeb3React().library; + var token = currencyToAdd === null || currencyToAdd === void 0 ? void 0 : currencyToAdd.wrapped; + var _a = __read(useState(), 2), success = _a[0], setSuccess = _a[1]; + var logoURL = useCurrencyLogoURIs(token)[0]; + var addToken = useCallback(function () { + if (library && library.provider.isMetaMask && library.provider.request && token) { + library.provider + .request({ + method: 'wallet_watchAsset', + params: { + //@ts-ignore // need this for incorrect ethers provider type + type: 'ERC20', + options: { + address: token.address, + symbol: token.symbol, + decimals: token.decimals, + image: logoURL, + }, + }, + }) + .then(function (success) { + setSuccess(success); + }) + .catch(function () { return setSuccess(false); }); + } + else { + setSuccess(false); + } + }, [library, logoURL, token]); + return { addToken: addToken, success: success }; +} + +var Wrapper$1 = styled.div(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n height: 90px;\n width: 90px;\n"], ["\n height: 90px;\n width: 90px;\n"]))); +var dash = keyframes(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n 0% {\n stroke-dashoffset: 1000;\n }\n 100% {\n stroke-dashoffset: 0;\n }\n"], ["\n 0% {\n stroke-dashoffset: 1000;\n }\n 100% {\n stroke-dashoffset: 0;\n }\n"]))); +var dashCheck = keyframes(templateObject_3$4 || (templateObject_3$4 = __makeTemplateObject(["\n 0% {\n stroke-dashoffset: -100;\n }\n 100% {\n stroke-dashoffset: 900;\n }\n"], ["\n 0% {\n stroke-dashoffset: -100;\n }\n 100% {\n stroke-dashoffset: 900;\n }\n"]))); +var Circle = styled.circle(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n stroke-dasharray: 1000;\n stroke-dashoffset: 0;\n -webkit-animation: ", " 0.9s ease-in-out;\n animation: ", " 0.9s ease-in-out;\n"], ["\n stroke-dasharray: 1000;\n stroke-dashoffset: 0;\n -webkit-animation: ", " 0.9s ease-in-out;\n animation: ", " 0.9s ease-in-out;\n"])), dash, dash); +var PolyLine = styled.polyline(templateObject_5$4 || (templateObject_5$4 = __makeTemplateObject(["\n stroke-dasharray: 1000;\n stroke-dashoffset: 0;\n stroke-dashoffset: -100;\n -webkit-animation: ", " 0.9s 0.35s ease-in-out forwards;\n animation: ", " 0.9s 0.35s ease-in-out forwards;\n"], ["\n stroke-dasharray: 1000;\n stroke-dashoffset: 0;\n stroke-dashoffset: -100;\n -webkit-animation: ", " 0.9s 0.35s ease-in-out forwards;\n animation: ", " 0.9s 0.35s ease-in-out forwards;\n"])), dashCheck, dashCheck); +function AnimatedConfirmation() { + var theme = useTheme(); + return (jsx(Wrapper$1, __assign({ className: "w4rAnimated_checkmark" }, { children: jsxs("svg", __assign({ version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 130.2 130.2" }, { children: [jsx(Circle, { className: "path circle", fill: "none", stroke: theme.green1, strokeWidth: "6", strokeMiterlimit: "10", cx: "65.1", cy: "65.1", r: "62.1" }, void 0), jsx(PolyLine, { className: "path check", fill: "none", stroke: theme.green1, strokeWidth: "6", strokeLinecap: "round", strokeMiterlimit: "10", points: "100.2,40.2 51.5,88.8 29.8,67.5 " }, void 0)] }), void 0) }), void 0)); +} +var templateObject_1$b, templateObject_2$5, templateObject_3$4, templateObject_4$4, templateObject_5$4; + +var Wrapper = styled.div(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n width: 100%;\n padding: 1rem;\n"], ["\n width: 100%;\n padding: 1rem;\n"]))); +var Section = styled(AutoColumn)(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n padding: ", ";\n"], ["\n padding: ", ";\n"])), function (_a) { + var inline = _a.inline; + return (inline ? '0' : '0'); +}); +var BottomSection = styled(Section)(templateObject_3$3 || (templateObject_3$3 = __makeTemplateObject(["\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n"], ["\n border-bottom-left-radius: 20px;\n border-bottom-right-radius: 20px;\n"]))); +var ConfirmedIcon = styled(ColumnCenter)(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n padding: ", ";\n"], ["\n padding: ", ";\n"])), function (_a) { + var inline = _a.inline; + return (inline ? '20px 0' : '32px 0;'); +}); +var StyledLogo = styled.img(templateObject_5$3 || (templateObject_5$3 = __makeTemplateObject(["\n height: 16px;\n width: 16px;\n margin-left: 6px;\n"], ["\n height: 16px;\n width: 16px;\n margin-left: 6px;\n"]))); +function ConfirmationPendingContent(_a) { + var onDismiss = _a.onDismiss, pendingText = _a.pendingText, inline = _a.inline; + return (jsx(Wrapper, { children: jsxs(AutoColumn, __assign({ gap: "md" }, { children: [!inline && (jsxs(RowBetween, { children: [jsx("div", {}, void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }, void 0)), jsx(ConfirmedIcon, __assign({ inline: inline }, { children: jsx(CustomLightSpinner, { src: Circle$1, alt: "loader", size: inline ? '40px' : '90px' }, void 0) }), void 0), jsxs(AutoColumn, __assign({ gap: "12px", justify: 'center' }, { children: [jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20, textAlign: "center" }, { children: jsx(Trans, { children: "Waiting For Confirmation" }, void 0) }), void 0), jsx(Text$1, __assign({ fontWeight: 400, fontSize: 16, textAlign: "center" }, { children: pendingText }), void 0), jsx(Text$1, __assign({ fontWeight: 500, fontSize: 14, color: "#565A69", textAlign: "center", marginBottom: "12px" }, { children: jsx(Trans, { children: "Confirm this transaction in your wallet" }, void 0) }), void 0)] }), void 0)] }), void 0) }, void 0)); +} +function TransactionSubmittedContent(_a) { + var _b; + var onDismiss = _a.onDismiss, chainId = _a.chainId, hash = _a.hash, currencyToAdd = _a.currencyToAdd, inline = _a.inline; + var theme = useContext(ThemeContext); + var library = useActiveWeb3React().library; + var _c = useAddTokenToMetamask(currencyToAdd), addToken = _c.addToken, success = _c.success; + return (jsx(Wrapper, { children: jsxs(Section, __assign({ inline: inline }, { children: [!inline && (jsxs(RowBetween, { children: [jsx("div", {}, void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }, void 0)), jsx(ConfirmedIcon, __assign({ inline: inline }, { children: jsx(ArrowUpCircle, { strokeWidth: 0.5, size: inline ? '40px' : '90px', color: theme.primary1 }, void 0) }), void 0), jsxs(AutoColumn, __assign({ gap: "12px", justify: 'center' }, { children: [jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20, textAlign: "center" }, { children: jsx(Trans, { children: "Transaction Submitted" }, void 0) }), void 0), chainId && hash && (jsx(ExternalLink, __assign({ href: getExplorerLink(chainId, hash, ExplorerDataType.TRANSACTION) }, { children: jsx(Text$1, __assign({ fontWeight: 500, fontSize: 14, color: theme.primary1 }, { children: jsx(Trans, { children: "View on Explorer" }, void 0) }), void 0) }), void 0)), currencyToAdd && ((_b = library === null || library === void 0 ? void 0 : library.provider) === null || _b === void 0 ? void 0 : _b.isMetaMask) && (jsx(ButtonLight, __assign({ mt: "12px", padding: "6px 12px", width: "fit-content", onClick: addToken }, { children: !success ? (jsx(RowFixed, { children: jsxs(Trans, { children: ["Add ", currencyToAdd.symbol, " to Metamask ", jsx(StyledLogo, { src: MetaMaskLogo }, void 0)] }, void 0) }, void 0)) : (jsxs(RowFixed, { children: [jsxs(Trans, { children: ["Added ", currencyToAdd.symbol, " "] }, void 0), jsx(CheckCircle, { size: '16px', stroke: theme.green1, style: { marginLeft: '6px' } }, void 0)] }, void 0)) }), void 0)), jsx(ButtonPrimary, __assign({ onClick: onDismiss, style: { margin: '20px 0 0 0' } }, { children: jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20 }, { children: inline ? jsx(Trans, { children: "Return" }, void 0) : jsx(Trans, { children: "Close" }, void 0) }), void 0) }), void 0)] }), void 0)] }), void 0) }, void 0)); +} +function ConfirmationModalContent(_a) { + var title = _a.title, bottomContent = _a.bottomContent, onDismiss = _a.onDismiss, topContent = _a.topContent; + return (jsxs(Wrapper, { children: [jsxs(Section, { children: [jsxs(RowBetween, { children: [jsx(Text$1, __assign({ fontWeight: 500, fontSize: 16 }, { children: title }), void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }, void 0), topContent()] }, void 0), bottomContent && jsx(BottomSection, __assign({ gap: "12px" }, { children: bottomContent() }), void 0)] }, void 0)); +} +function TransactionErrorContent(_a) { + var message = _a.message, onDismiss = _a.onDismiss; + var theme = useContext(ThemeContext); + return (jsxs(Wrapper, { children: [jsxs(Section, { children: [jsxs(RowBetween, { children: [jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20 }, { children: jsx(Trans, { children: "Error" }, void 0) }), void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }, void 0), jsxs(AutoColumn, __assign({ style: { marginTop: 20, padding: '2rem 0' }, gap: "24px", justify: "center" }, { children: [jsx(AlertTriangle, { color: theme.red1, style: { strokeWidth: 1.5 }, size: 64 }, void 0), jsx(Text$1, __assign({ fontWeight: 500, fontSize: 16, color: theme.red1, style: { textAlign: 'center', width: '85%', wordBreak: 'break-word' } }, { children: message }), void 0)] }), void 0)] }, void 0), jsx(BottomSection, __assign({ gap: "12px" }, { children: jsx(ButtonPrimary, __assign({ onClick: onDismiss }, { children: jsx(Trans, { children: "Dismiss" }, void 0) }), void 0) }), void 0)] }, void 0)); +} +function L2Content(_a) { + var _b; + var onDismiss = _a.onDismiss, chainId = _a.chainId, hash = _a.hash, pendingText = _a.pendingText, inline = _a.inline; + var theme = useContext(ThemeContext); + var transaction = useTransaction(hash); + var confirmed = useIsTransactionConfirmed(hash); + var transactionSuccess = ((_b = transaction === null || transaction === void 0 ? void 0 : transaction.receipt) === null || _b === void 0 ? void 0 : _b.status) === 1; + // convert unix time difference to seconds + var secondsToConfirm = (transaction === null || transaction === void 0 ? void 0 : transaction.confirmedTime) + ? (transaction.confirmedTime - transaction.addedTime) / 1000 + : undefined; + var info = CHAIN_INFO[chainId]; + return (jsx(Wrapper, { children: jsxs(Section, __assign({ inline: inline }, { children: [!inline && (jsxs(RowBetween, __assign({ mb: "16px" }, { children: [jsx(Badge, { children: jsxs(RowFixed, { children: [jsx(StyledLogo, { src: info.logoUrl, style: { margin: '0 8px 0 0' } }, void 0), info.label] }, void 0) }, void 0), jsx(CloseIcon$2, { onClick: onDismiss }, void 0)] }), void 0)), jsx(ConfirmedIcon, __assign({ inline: inline }, { children: confirmed ? (transactionSuccess ? ( + // + jsx(AnimatedConfirmation, {}, void 0)) : (jsx(AlertCircle, { strokeWidth: 1, size: inline ? '40px' : '90px', color: theme.red1 }, void 0))) : (jsx(CustomLightSpinner, { src: Circle$1, alt: "loader", size: inline ? '40px' : '90px' }, void 0)) }), void 0), jsxs(AutoColumn, __assign({ gap: "12px", justify: 'center' }, { children: [jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20, textAlign: "center" }, { children: !hash ? (jsx(Trans, { children: "Confirm transaction in wallet" }, void 0)) : !confirmed ? (jsx(Trans, { children: "Transaction Submitted" }, void 0)) : transactionSuccess ? (jsx(Trans, { children: "Success" }, void 0)) : (jsx(Trans, { children: "Error" }, void 0)) }), void 0), jsx(Text$1, __assign({ fontWeight: 400, fontSize: 16, textAlign: "center" }, { children: transaction ? jsx(TransactionSummary, { info: transaction.info }, void 0) : pendingText }), void 0), chainId && hash ? (jsx(ExternalLink, __assign({ href: getExplorerLink(chainId, hash, ExplorerDataType.TRANSACTION) }, { children: jsx(Text$1, __assign({ fontWeight: 500, fontSize: 14, color: theme.primary1 }, { children: jsx(Trans, { children: "View on Explorer" }, void 0) }), void 0) }), void 0)) : (jsx("div", { style: { height: '17px' } }, void 0)), jsx(Text$1, __assign({ color: theme.text3, style: { margin: '20px 0 0 0' }, fontSize: '14px' }, { children: !secondsToConfirm ? (jsx("div", { style: { height: '24px' } }, void 0)) : (jsxs("div", { children: [jsx(Trans, { children: "Transaction completed in " }, void 0), jsxs("span", __assign({ style: { fontWeight: 500, marginLeft: '4px', color: theme.text1 } }, { children: [secondsToConfirm, " seconds \uD83C\uDF89"] }), void 0)] }, void 0)) }), void 0), jsx(ButtonPrimary, __assign({ onClick: onDismiss, style: { margin: '4px 0 0 0' } }, { children: jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20 }, { children: inline ? jsx(Trans, { children: "Return" }, void 0) : jsx(Trans, { children: "Close" }, void 0) }), void 0) }), void 0)] }), void 0)] }), void 0) }, void 0)); +} +function TransactionConfirmationModal(_a) { + var isOpen = _a.isOpen, onDismiss = _a.onDismiss, attemptingTxn = _a.attemptingTxn, hash = _a.hash, pendingText = _a.pendingText, content = _a.content, currencyToAdd = _a.currencyToAdd; + var chainId = useActiveWeb3React().chainId; + var isL2 = Boolean(chainId && L2_CHAIN_IDS.includes(chainId)); + if (!chainId) + return null; + // confirmation screen + return (jsx(Modal, __assign({ isOpen: isOpen, onDismiss: onDismiss, maxHeight: 90 }, { children: isL2 && (hash || attemptingTxn) ? (jsx(L2Content, { chainId: chainId, hash: hash, onDismiss: onDismiss, pendingText: pendingText }, void 0)) : attemptingTxn ? (jsx(ConfirmationPendingContent, { onDismiss: onDismiss, pendingText: pendingText }, void 0)) : hash ? (jsx(TransactionSubmittedContent, { chainId: chainId, hash: hash, onDismiss: onDismiss, currencyToAdd: currencyToAdd }, void 0)) : (content()) }), void 0)); +} +var templateObject_1$a, templateObject_2$4, templateObject_3$3, templateObject_4$3, templateObject_5$3; + +function SwapModalFooter(_a) { + var onConfirm = _a.onConfirm, swapErrorMessage = _a.swapErrorMessage, disabledConfirm = _a.disabledConfirm; + return (jsx(Fragment, { children: jsxs(AutoRow, { children: [jsx(ButtonError, __assign({ onClick: onConfirm, disabled: disabledConfirm, style: { margin: '10px 0 0 0' }, id: "confirm-swap-or-send" }, { children: jsx(Text$1, __assign({ fontSize: 20, fontWeight: 500 }, { children: jsx(Trans, { children: "Confirm Swap" }, void 0) }), void 0) }), void 0), swapErrorMessage ? jsx(SwapCallbackError, { error: swapErrorMessage }, void 0) : null] }, void 0) }, void 0)); +} + +function computeFiatValuePriceImpact(fiatValueInput, fiatValueOutput) { + if (!fiatValueOutput || !fiatValueInput) + return undefined; + if (!fiatValueInput.currency.equals(fiatValueOutput.currency)) + return undefined; + if (JSBI.equal(fiatValueInput.quotient, JSBI.BigInt(0))) + return undefined; + var pct = ONE_HUNDRED_PERCENT.subtract(fiatValueOutput.divide(fiatValueInput)); + return new Percent(pct.numerator, pct.denominator); +} + +var ArrowWrapper = styled.div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n padding: 4px;\n border-radius: 12px;\n height: 32px;\n width: 32px;\n position: relative;\n margin-top: -18px;\n margin-bottom: -18px;\n left: calc(50% - 16px);\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: ", ";\n border: 4px solid;\n border-color: ", ";\n z-index: 2;\n"], ["\n padding: 4px;\n border-radius: 12px;\n height: 32px;\n width: 32px;\n position: relative;\n margin-top: -18px;\n margin-bottom: -18px;\n left: calc(50% - 16px);\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: ", ";\n border: 4px solid;\n border-color: ", ";\n z-index: 2;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}); +function SwapModalHeader(_a) { + var trade = _a.trade, allowedSlippage = _a.allowedSlippage, recipient = _a.recipient, showAcceptChanges = _a.showAcceptChanges, onAcceptChanges = _a.onAcceptChanges; + var theme = useContext(ThemeContext); + var _b = __read(useState(false), 2), showInverted = _b[0], setShowInverted = _b[1]; + var fiatValueInput = useUSDCValue(trade.inputAmount); + var fiatValueOutput = useUSDCValue(trade.outputAmount); + return (jsxs(AutoColumn, __assign({ gap: '4px', style: { marginTop: '1rem' } }, { children: [jsx(LightCard, __assign({ padding: "0.75rem 1rem" }, { children: jsxs(AutoColumn, __assign({ gap: '8px' }, { children: [jsxs(RowBetween, __assign({ align: "center" }, { children: [jsx(RowFixed, __assign({ gap: '0px' }, { children: jsx(TruncatedText, __assign({ fontSize: 24, fontWeight: 500, color: showAcceptChanges && trade.tradeType === TradeType.EXACT_OUTPUT ? theme.primary1 : '' }, { children: trade.inputAmount.toSignificant(6) }), void 0) }), void 0), jsxs(RowFixed, __assign({ gap: '0px' }, { children: [jsx(CurrencyLogo, { currency: trade.inputAmount.currency, size: '20px', style: { marginRight: '12px' } }, void 0), jsx(Text$1, __assign({ fontSize: 20, fontWeight: 500 }, { children: trade.inputAmount.currency.symbol }), void 0)] }), void 0)] }), void 0), jsx(RowBetween, { children: jsx(FiatValue, { fiatValue: fiatValueInput }, void 0) }, void 0)] }), void 0) }), void 0), jsx(ArrowWrapper, { children: jsx(ArrowDown, { size: "16", color: theme.text2 }, void 0) }, void 0), jsx(LightCard, __assign({ padding: "0.75rem 1rem", style: { marginBottom: '0.25rem' } }, { children: jsxs(AutoColumn, __assign({ gap: '8px' }, { children: [jsxs(RowBetween, __assign({ align: "flex-end" }, { children: [jsx(RowFixed, __assign({ gap: '0px' }, { children: jsx(TruncatedText, __assign({ fontSize: 24, fontWeight: 500 }, { children: trade.outputAmount.toSignificant(6) }), void 0) }), void 0), jsxs(RowFixed, __assign({ gap: '0px' }, { children: [jsx(CurrencyLogo, { currency: trade.outputAmount.currency, size: '20px', style: { marginRight: '12px' } }, void 0), jsx(Text$1, __assign({ fontSize: 20, fontWeight: 500 }, { children: trade.outputAmount.currency.symbol }), void 0)] }), void 0)] }), void 0), jsx(RowBetween, { children: jsx(ThemedText.Body, __assign({ fontSize: 14, color: theme.text3 }, { children: jsx(FiatValue, { fiatValue: fiatValueOutput, priceImpact: computeFiatValuePriceImpact(fiatValueInput, fiatValueOutput) }, void 0) }), void 0) }, void 0)] }), void 0) }), void 0), jsx(RowBetween, __assign({ style: { marginTop: '0.25rem', padding: '0 1rem' } }, { children: jsx(TradePrice, { price: trade.executionPrice, showInverted: showInverted, setShowInverted: setShowInverted }, void 0) }), void 0), jsx(LightCard, __assign({ style: { padding: '.75rem', marginTop: '0.5rem' } }, { children: jsx(AdvancedSwapDetails, { trade: trade, allowedSlippage: allowedSlippage }, void 0) }), void 0), showAcceptChanges ? (jsx(SwapShowAcceptChanges, __assign({ justify: "flex-start", gap: '0px' }, { children: jsxs(RowBetween, { children: [jsxs(RowFixed, { children: [jsx(AlertTriangle, { size: 20, style: { marginRight: '8px', minWidth: 24 } }, void 0), jsx(ThemedText.Main, __assign({ color: theme.primary1 }, { children: jsx(Trans, { children: "Price Updated" }, void 0) }), void 0)] }, void 0), jsx(ButtonPrimary, __assign({ style: { padding: '.5rem', width: 'fit-content', fontSize: '0.825rem', borderRadius: '12px' }, onClick: onAcceptChanges }, { children: jsx(Trans, { children: "Accept" }, void 0) }), void 0)] }, void 0) }), void 0)) : null, jsx(AutoColumn, __assign({ justify: "flex-start", gap: "sm", style: { padding: '.75rem 1rem' } }, { children: trade.tradeType === TradeType.EXACT_INPUT ? (jsx(ThemedText.Italic, __assign({ fontWeight: 400, textAlign: "left", style: { width: '100%' } }, { children: jsxs(Trans, { children: ["Output is estimated. You will receive at least", ' ', jsxs("b", { children: [trade.minimumAmountOut(allowedSlippage).toSignificant(6), " ", trade.outputAmount.currency.symbol] }, void 0), ' ', "or the transaction will revert."] }, void 0) }), void 0)) : (jsx(ThemedText.Italic, __assign({ fontWeight: 400, textAlign: "left", style: { width: '100%' } }, { children: jsxs(Trans, { children: ["Input is estimated. You will sell at most", ' ', jsxs("b", { children: [trade.maximumAmountIn(allowedSlippage).toSignificant(6), " ", trade.inputAmount.currency.symbol] }, void 0), ' ', "or the transaction will revert."] }, void 0) }), void 0)) }), void 0), recipient !== null ? (jsx(AutoColumn, __assign({ justify: "flex-start", gap: "sm", style: { padding: '12px 0 0 0px' } }, { children: jsx(ThemedText.Main, { children: jsxs(Trans, { children: ["Output will be sent to", ' ', jsx("b", __assign({ title: recipient }, { children: isAddress(recipient) ? shortenAddress(recipient) : recipient }), void 0)] }, void 0) }, void 0) }), void 0)) : null] }), void 0)); +} +var templateObject_1$9; + +function ConfirmSwapModal(_a) { + var _b, _c, _d, _e, _f, _g; + var trade = _a.trade, originalTrade = _a.originalTrade, onAcceptChanges = _a.onAcceptChanges, allowedSlippage = _a.allowedSlippage, onConfirm = _a.onConfirm, onDismiss = _a.onDismiss, recipient = _a.recipient, swapErrorMessage = _a.swapErrorMessage, isOpen = _a.isOpen, attemptingTxn = _a.attemptingTxn, txHash = _a.txHash; + var showAcceptChanges = useMemo(function () { return Boolean(trade && originalTrade && tradeMeaningfullyDiffers(trade, originalTrade)); }, [originalTrade, trade]); + var modalHeader = useCallback(function () { + return trade ? (jsx(SwapModalHeader, { trade: trade, allowedSlippage: allowedSlippage, recipient: recipient, showAcceptChanges: showAcceptChanges, onAcceptChanges: onAcceptChanges }, void 0)) : null; + }, [allowedSlippage, onAcceptChanges, recipient, showAcceptChanges, trade]); + var modalBottom = useCallback(function () { + return trade ? (jsx(SwapModalFooter, { onConfirm: onConfirm, trade: trade, disabledConfirm: showAcceptChanges, swapErrorMessage: swapErrorMessage }, void 0)) : null; + }, [onConfirm, showAcceptChanges, swapErrorMessage, trade]); + // text to show while loading + var pendingText = (jsxs(Trans, { children: ["Swapping ", (_b = trade === null || trade === void 0 ? void 0 : trade.inputAmount) === null || _b === void 0 ? void 0 : _b.toSignificant(6), " ", (_d = (_c = trade === null || trade === void 0 ? void 0 : trade.inputAmount) === null || _c === void 0 ? void 0 : _c.currency) === null || _d === void 0 ? void 0 : _d.symbol, " for", ' ', (_e = trade === null || trade === void 0 ? void 0 : trade.outputAmount) === null || _e === void 0 ? void 0 : _e.toSignificant(6), " ", (_g = (_f = trade === null || trade === void 0 ? void 0 : trade.outputAmount) === null || _f === void 0 ? void 0 : _f.currency) === null || _g === void 0 ? void 0 : _g.symbol] }, void 0)); + var confirmationContent = useCallback(function () { + return swapErrorMessage ? (jsx(TransactionErrorContent, { onDismiss: onDismiss, message: swapErrorMessage }, void 0)) : (jsx(ConfirmationModalContent, { title: jsx(Trans, { children: "Confirm Swap" }, void 0), onDismiss: onDismiss, topContent: modalHeader, bottomContent: modalBottom }, void 0)); + }, [onDismiss, modalBottom, modalHeader, swapErrorMessage]); + return (jsx(TransactionConfirmationModal, { isOpen: isOpen, onDismiss: onDismiss, attemptingTxn: attemptingTxn, hash: txHash, content: confirmationContent, pendingText: pendingText, currencyToAdd: trade === null || trade === void 0 ? void 0 : trade.outputAmount.currency }, void 0)); +} + +var ToggleElement = styled.span(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n padding: 0.25rem 0.6rem;\n border-radius: 9px;\n background: ", ";\n color: ", ";\n font-size: 14px;\n font-weight: ", ";\n :hover {\n user-select: ", ";\n background: ", ";\n color: ", ";\n }\n"], ["\n padding: 0.25rem 0.6rem;\n border-radius: 9px;\n background: ", ";\n color: ", ";\n font-size: 14px;\n font-weight: ", ";\n :hover {\n user-select: ", ";\n background: ", ";\n color: ", ";\n }\n"])), function (_a) { + var theme = _a.theme, isActive = _a.isActive, isOnSwitch = _a.isOnSwitch; + return (isActive ? (isOnSwitch ? theme.primary1 : theme.bg4) : 'none'); +}, function (_a) { + var theme = _a.theme, isActive = _a.isActive; + return (isActive ? theme.white : theme.text2); +}, function (_a) { + var isOnSwitch = _a.isOnSwitch; + return (isOnSwitch ? '500' : '400'); +}, function (_a) { + var isOnSwitch = _a.isOnSwitch; + return (isOnSwitch ? 'none' : 'initial'); +}, function (_a) { + var theme = _a.theme, isActive = _a.isActive, isOnSwitch = _a.isOnSwitch; + return isActive ? (isOnSwitch ? darken(0.05, theme.primary1) : darken(0.05, theme.bg4)) : 'none'; +}, function (_a) { + var theme = _a.theme, isActive = _a.isActive, isOnSwitch = _a.isOnSwitch; + return (isActive ? (isOnSwitch ? theme.white : theme.white) : theme.text3); +}); +var StyledToggle = styled.button(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n border-radius: 12px;\n border: none;\n background: ", ";\n display: flex;\n width: fit-content;\n cursor: pointer;\n outline: none;\n padding: 2px;\n"], ["\n border-radius: 12px;\n border: none;\n background: ", ";\n display: flex;\n width: fit-content;\n cursor: pointer;\n outline: none;\n padding: 2px;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg0; +}); +function Toggle(_a) { + var id = _a.id, isActive = _a.isActive, toggle = _a.toggle, _b = _a.checked, checked = _b === void 0 ? jsx(Trans, { children: "On" }, void 0) : _b, _c = _a.unchecked, unchecked = _c === void 0 ? jsx(Trans, { children: "Off" }, void 0) : _c; + return (jsxs(StyledToggle, __assign({ id: id, isActive: isActive, onClick: toggle }, { children: [jsx(ToggleElement, __assign({ isActive: isActive, isOnSwitch: true }, { children: checked }), void 0), jsx(ToggleElement, __assign({ isActive: !isActive, isOnSwitch: false }, { children: unchecked }), void 0)] }), void 0)); +} +var templateObject_1$8, templateObject_2$3; + +var SlippageError; +(function (SlippageError) { + SlippageError["InvalidInput"] = "InvalidInput"; +})(SlippageError || (SlippageError = {})); +var DeadlineError; +(function (DeadlineError) { + DeadlineError["InvalidInput"] = "InvalidInput"; +})(DeadlineError || (DeadlineError = {})); +var FancyButton = styled.button(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n color: ", ";\n align-items: center;\n height: 2rem;\n border-radius: 36px;\n font-size: 1rem;\n width: auto;\n min-width: 3.5rem;\n border: 1px solid ", ";\n outline: none;\n background: ", ";\n :hover {\n border: 1px solid ", ";\n }\n :focus {\n border: 1px solid ", ";\n }\n"], ["\n color: ", ";\n align-items: center;\n height: 2rem;\n border-radius: 36px;\n font-size: 1rem;\n width: auto;\n min-width: 3.5rem;\n border: 1px solid ", ";\n outline: none;\n background: ", ";\n :hover {\n border: 1px solid ", ";\n }\n :focus {\n border: 1px solid ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}, function (_a) { + var theme = _a.theme; + return theme.bg3; +}, function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme; + return theme.bg4; +}, function (_a) { + var theme = _a.theme; + return theme.primary1; +}); +var Option = styled(FancyButton)(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n margin-right: 8px;\n :hover {\n cursor: pointer;\n }\n background-color: ", ";\n color: ", ";\n"], ["\n margin-right: 8px;\n :hover {\n cursor: pointer;\n }\n background-color: ", ";\n color: ", ";\n"])), function (_a) { + var active = _a.active, theme = _a.theme; + return active && theme.primary1; +}, function (_a) { + var active = _a.active, theme = _a.theme; + return (active ? theme.white : theme.text1); +}); +var Input = styled.input(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n background: ", ";\n font-size: 16px;\n width: auto;\n outline: none;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n color: ", ";\n text-align: right;\n"], ["\n background: ", ";\n font-size: 16px;\n width: auto;\n outline: none;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n color: ", ";\n text-align: right;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg1; +}, function (_a) { + var theme = _a.theme, color = _a.color; + return (color === 'red' ? theme.red1 : theme.text1); +}); +var OptionCustom = styled(FancyButton)(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n height: 2rem;\n position: relative;\n padding: 0 0.75rem;\n flex: 1;\n border: ", ";\n :hover {\n border: ", ";\n }\n\n input {\n width: 100%;\n height: 100%;\n border: 0px;\n border-radius: 2rem;\n }\n"], ["\n height: 2rem;\n position: relative;\n padding: 0 0.75rem;\n flex: 1;\n border: ", ";\n :hover {\n border: ", ";\n }\n\n input {\n width: 100%;\n height: 100%;\n border: 0px;\n border-radius: 2rem;\n }\n"])), function (_a) { + var theme = _a.theme, active = _a.active, warning = _a.warning; + return active ? "1px solid " + (warning ? theme.red1 : theme.primary1) : warning && "1px solid " + theme.red1; +}, function (_a) { + var theme = _a.theme, active = _a.active, warning = _a.warning; + return active && "1px solid " + (warning ? darken(0.1, theme.red1) : darken(0.1, theme.primary1)); +}); +var SlippageEmojiContainer = styled.span(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["\n color: #f3841e;\n ", "\n"], ["\n color: #f3841e;\n ", "\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_5$2 || (templateObject_5$2 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "]))); +}); +var THREE_DAYS_IN_SECONDS = ms(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["3 days"], ["3 days"]))) / 1000; +function TransactionSettings(_a) { + var placeholderSlippage = _a.placeholderSlippage; + var chainId = useActiveWeb3React().chainId; + var theme = useContext(ThemeContext); + var userSlippageTolerance = useUserSlippageTolerance(); + var setUserSlippageTolerance = useSetUserSlippageTolerance(); + var _b = __read(useUserTransactionTTL(), 2), deadline = _b[0], setDeadline = _b[1]; + var _c = __read(useState(''), 2), slippageInput = _c[0], setSlippageInput = _c[1]; + var _d = __read(useState(false), 2), slippageError = _d[0], setSlippageError = _d[1]; + var _e = __read(useState(''), 2), deadlineInput = _e[0], setDeadlineInput = _e[1]; + var _f = __read(useState(false), 2), deadlineError = _f[0], setDeadlineError = _f[1]; + function parseSlippageInput(value) { + // populate what the user typed and clear the error + setSlippageInput(value); + setSlippageError(false); + if (value.length === 0) { + setUserSlippageTolerance('auto'); + } + else { + var parsed = Math.floor(Number.parseFloat(value) * 100); + if (!Number.isInteger(parsed) || parsed < 0 || parsed > 5000) { + setUserSlippageTolerance('auto'); + if (value !== '.') { + setSlippageError(SlippageError.InvalidInput); + } + } + else { + setUserSlippageTolerance(new Percent(parsed, 10000)); + } + } + } + var tooLow = userSlippageTolerance !== 'auto' && userSlippageTolerance.lessThan(new Percent(5, 10000)); + var tooHigh = userSlippageTolerance !== 'auto' && userSlippageTolerance.greaterThan(new Percent(1, 100)); + function parseCustomDeadline(value) { + // populate what the user typed and clear the error + setDeadlineInput(value); + setDeadlineError(false); + if (value.length === 0) { + setDeadline(DEFAULT_DEADLINE_FROM_NOW); + } + else { + try { + var parsed = Math.floor(Number.parseFloat(value) * 60); + if (!Number.isInteger(parsed) || parsed < 60 || parsed > THREE_DAYS_IN_SECONDS) { + setDeadlineError(DeadlineError.InvalidInput); + } + else { + setDeadline(parsed); + } + } + catch (error) { + console.error(error); + setDeadlineError(DeadlineError.InvalidInput); + } + } + } + var showCustomDeadlineRow = Boolean(chainId && !L2_CHAIN_IDS.includes(chainId)); + return (jsxs(AutoColumn, __assign({ gap: "md" }, { children: [jsxs(AutoColumn, __assign({ gap: "sm" }, { children: [jsxs(RowFixed, { children: [jsx(ThemedText.Black, __assign({ fontWeight: 400, fontSize: 14, color: theme.text2 }, { children: jsx(Trans, { children: "Slippage tolerance" }, void 0) }), void 0), jsx(QuestionHelper, { text: jsx(Trans, { children: "Your transaction will revert if the price changes unfavorably by more than this percentage." }, void 0) }, void 0)] }, void 0), jsxs(RowBetween, { children: [jsx(Option, __assign({ onClick: function () { + parseSlippageInput(''); + }, active: userSlippageTolerance === 'auto' }, { children: jsx(Trans, { children: "Auto" }, void 0) }), void 0), jsx(OptionCustom, __assign({ active: userSlippageTolerance !== 'auto', warning: !!slippageError, tabIndex: -1 }, { children: jsxs(RowBetween, { children: [tooLow || tooHigh ? (jsx(SlippageEmojiContainer, { children: jsx("span", __assign({ role: "img", "aria-label": "warning" }, { children: "\u26A0\uFE0F" }), void 0) }, void 0)) : null, jsx(Input, { placeholder: placeholderSlippage.toFixed(2), value: slippageInput.length > 0 + ? slippageInput + : userSlippageTolerance === 'auto' + ? '' + : userSlippageTolerance.toFixed(2), onChange: function (e) { return parseSlippageInput(e.target.value); }, onBlur: function () { + setSlippageInput(''); + setSlippageError(false); + }, color: slippageError ? 'red' : '' }, void 0), "%"] }, void 0) }), void 0)] }, void 0), slippageError || tooLow || tooHigh ? (jsx(RowBetween, __assign({ style: { + fontSize: '14px', + paddingTop: '7px', + color: slippageError ? 'red' : '#F3841E', + } }, { children: slippageError ? (jsx(Trans, { children: "Enter a valid slippage percentage" }, void 0)) : tooLow ? (jsx(Trans, { children: "Your transaction may fail" }, void 0)) : (jsx(Trans, { children: "Your transaction may be frontrun" }, void 0)) }), void 0)) : null] }), void 0), showCustomDeadlineRow && (jsxs(AutoColumn, __assign({ gap: "sm" }, { children: [jsxs(RowFixed, { children: [jsx(ThemedText.Black, __assign({ fontSize: 14, fontWeight: 400, color: theme.text2 }, { children: jsx(Trans, { children: "Transaction deadline" }, void 0) }), void 0), jsx(QuestionHelper, { text: jsx(Trans, { children: "Your transaction will revert if it is pending for more than this period of time." }, void 0) }, void 0)] }, void 0), jsxs(RowFixed, { children: [jsx(OptionCustom, __assign({ style: { width: '80px' }, warning: !!deadlineError, tabIndex: -1 }, { children: jsx(Input, { placeholder: (DEFAULT_DEADLINE_FROM_NOW / 60).toString(), value: deadlineInput.length > 0 + ? deadlineInput + : deadline === DEFAULT_DEADLINE_FROM_NOW + ? '' + : (deadline / 60).toString(), onChange: function (e) { return parseCustomDeadline(e.target.value); }, onBlur: function () { + setDeadlineInput(''); + setDeadlineError(false); + }, color: deadlineError ? 'red' : '' }, void 0) }), void 0), jsx(ThemedText.Body, __assign({ style: { paddingLeft: '8px' }, fontSize: 14 }, { children: jsx(Trans, { children: "minutes" }, void 0) }), void 0)] }, void 0)] }), void 0))] }), void 0)); +} +var templateObject_1$7, templateObject_2$2, templateObject_3$2, templateObject_4$2, templateObject_5$2, templateObject_6$1, templateObject_7$1; + +var StyledMenuIcon = styled(Settings)(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n height: 20px;\n width: 20px;\n\n > * {\n stroke: ", ";\n }\n\n :hover {\n opacity: 0.7;\n }\n"], ["\n height: 20px;\n width: 20px;\n\n > * {\n stroke: ", ";\n }\n\n :hover {\n opacity: 0.7;\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var StyledCloseIcon = styled(X)(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n height: 20px;\n width: 20px;\n :hover {\n cursor: pointer;\n }\n\n > * {\n stroke: ", ";\n }\n"], ["\n height: 20px;\n width: 20px;\n :hover {\n cursor: pointer;\n }\n\n > * {\n stroke: ", ";\n }\n"])), function (_a) { + var theme = _a.theme; + return theme.text1; +}); +var StyledMenuButton = styled.button(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n height: 100%;\n border: none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n border-radius: 0.5rem;\n height: 20px;\n\n :hover,\n :focus {\n cursor: pointer;\n outline: none;\n }\n"], ["\n position: relative;\n width: 100%;\n height: 100%;\n border: none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n border-radius: 0.5rem;\n height: 20px;\n\n :hover,\n :focus {\n cursor: pointer;\n outline: none;\n }\n"]))); +var EmojiWrapper = styled.div(templateObject_4$1 || (templateObject_4$1 = __makeTemplateObject(["\n position: absolute;\n bottom: -6px;\n right: 0px;\n font-size: 14px;\n"], ["\n position: absolute;\n bottom: -6px;\n right: 0px;\n font-size: 14px;\n"]))); +var StyledMenu = styled.div(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n margin-left: 0.5rem;\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n border: none;\n text-align: left;\n"], ["\n margin-left: 0.5rem;\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n border: none;\n text-align: left;\n"]))); +var MenuFlyout = styled.span(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n min-width: 20.125rem;\n background-color: ", ";\n border: 1px solid ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 12px;\n display: flex;\n flex-direction: column;\n font-size: 1rem;\n position: absolute;\n top: 2rem;\n right: 0rem;\n z-index: 100;\n\n ", ";\n\n user-select: none;\n"], ["\n min-width: 20.125rem;\n background-color: ", ";\n border: 1px solid ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 12px;\n display: flex;\n flex-direction: column;\n font-size: 1rem;\n position: absolute;\n top: 2rem;\n right: 0rem;\n z-index: 100;\n\n ", ";\n\n user-select: none;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}, function (_a) { + var theme = _a.theme; + return theme.bg3; +}, function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToMedium(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n min-width: 18.125rem;\n "], ["\n min-width: 18.125rem;\n "]))); +}); +var Break = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: 100%;\n height: 1px;\n background-color: ", ";\n"], ["\n width: 100%;\n height: 1px;\n background-color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.bg3; +}); +var ModalContentWrapper = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 2rem 0;\n background-color: ", ";\n border-radius: 20px;\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 2rem 0;\n background-color: ", ";\n border-radius: 20px;\n"])), function (_a) { + var theme = _a.theme; + return theme.bg2; +}); +function SettingsTab(_a) { + var placeholderSlippage = _a.placeholderSlippage; + var chainId = useActiveWeb3React().chainId; + var node = useRef(); + var open = useModalOpen(ApplicationModal.SETTINGS); + var toggle = useToggleSettingsMenu(); + var theme = useContext(ThemeContext); + var _b = __read(useExpertModeManager(), 2), expertMode = _b[0], toggleExpertMode = _b[1]; + var _c = __read(useClientSideRouter(), 2), clientSideRouter = _c[0], setClientSideRouter = _c[1]; + // show confirmation view before turning on + var _d = __read(useState(false), 2), showConfirmation = _d[0], setShowConfirmation = _d[1]; + useOnClickOutside(node, open ? toggle : undefined); + return ( + // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30451 + jsxs(StyledMenu, __assign({ ref: node }, { children: [jsx(Modal, __assign({ isOpen: showConfirmation, onDismiss: function () { return setShowConfirmation(false); }, maxHeight: 100 }, { children: jsx(ModalContentWrapper, { children: jsxs(AutoColumn, __assign({ gap: "lg" }, { children: [jsxs(RowBetween, __assign({ style: { padding: '0 2rem' } }, { children: [jsx("div", {}, void 0), jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20 }, { children: jsx(Trans, { children: "Are you sure?" }, void 0) }), void 0), jsx(StyledCloseIcon, { onClick: function () { return setShowConfirmation(false); } }, void 0)] }), void 0), jsx(Break, {}, void 0), jsxs(AutoColumn, __assign({ gap: "lg", style: { padding: '0 2rem' } }, { children: [jsx(Text$1, __assign({ fontWeight: 500, fontSize: 20 }, { children: jsx(Trans, { children: "Expert mode turns off the confirm transaction prompt and allows high slippage trades that often result in bad rates and lost funds." }, void 0) }), void 0), jsx(Text$1, __assign({ fontWeight: 600, fontSize: 20 }, { children: jsx(Trans, { children: "ONLY USE THIS MODE IF YOU KNOW WHAT YOU ARE DOING." }, void 0) }), void 0), jsx(ButtonError, __assign({ error: true, padding: '12px', onClick: function () { + var confirmWord = t(templateObject_10 || (templateObject_10 = __makeTemplateObject(["confirm"], ["confirm"]))); + if (window.prompt(t(templateObject_11 || (templateObject_11 = __makeTemplateObject(["Please type the word \"", "\" to enable expert mode."], ["Please type the word \"", "\" to enable expert mode."])), confirmWord)) === confirmWord) { + toggleExpertMode(); + setShowConfirmation(false); + } + } }, { children: jsx(Text$1, __assign({ fontSize: 20, fontWeight: 500, id: "confirm-expert-mode" }, { children: jsx(Trans, { children: "Turn On Expert Mode" }, void 0) }), void 0) }), void 0)] }), void 0)] }), void 0) }, void 0) }), void 0), jsxs(StyledMenuButton, __assign({ onClick: toggle, id: "open-settings-dialog-button", "aria-label": t(templateObject_12 || (templateObject_12 = __makeTemplateObject(["Transaction Settings"], ["Transaction Settings"]))) }, { children: [jsx(StyledMenuIcon, {}, void 0), expertMode ? (jsx(EmojiWrapper, { children: jsx("span", __assign({ role: "img", "aria-label": "wizard-icon" }, { children: "\uD83E\uDDD9" }), void 0) }, void 0)) : null] }), void 0), open && (jsx(MenuFlyout, { children: jsxs(AutoColumn, __assign({ gap: "md", style: { padding: '1rem' } }, { children: [jsx(Text$1, __assign({ fontWeight: 600, fontSize: 14 }, { children: jsx(Trans, { children: "Transaction Settings" }, void 0) }), void 0), jsx(TransactionSettings, { placeholderSlippage: placeholderSlippage }, void 0), jsx(Text$1, __assign({ fontWeight: 600, fontSize: 14 }, { children: jsx(Trans, { children: "Interface Settings" }, void 0) }), void 0), chainId && AUTO_ROUTER_SUPPORTED_CHAINS.includes(chainId) && (jsxs(RowBetween, { children: [jsxs(RowFixed, { children: [jsx(ThemedText.Black, __assign({ fontWeight: 400, fontSize: 14, color: theme.text2 }, { children: jsx(Trans, { children: "Auto Router API" }, void 0) }), void 0), jsx(QuestionHelper, { text: jsx(Trans, { children: "Use the Uniswap Labs API to get faster quotes." }, void 0) }, void 0)] }, void 0), jsx(Toggle, { id: "toggle-optimized-router-button", isActive: !clientSideRouter, toggle: function () { + ReactGA.event({ + category: 'Routing', + action: clientSideRouter ? 'enable routing API' : 'disable routing API', + }); + setClientSideRouter(!clientSideRouter); + } }, void 0)] }, void 0)), jsxs(RowBetween, { children: [jsxs(RowFixed, { children: [jsx(ThemedText.Black, __assign({ fontWeight: 400, fontSize: 14, color: theme.text2 }, { children: jsx(Trans, { children: "Expert Mode" }, void 0) }), void 0), jsx(QuestionHelper, { text: jsx(Trans, { children: "Allow high price impact trades and skip the confirm screen. Use at your own risk." }, void 0) }, void 0)] }, void 0), jsx(Toggle, { id: "toggle-expert-mode-button", isActive: expertMode, toggle: expertMode + ? function () { + toggleExpertMode(); + setShowConfirmation(false); + } + : function () { + toggle(); + setShowConfirmation(true); + } }, void 0)] }, void 0)] }), void 0) }, void 0))] }), void 0)); +} +var templateObject_1$6, templateObject_2$1, templateObject_3$1, templateObject_4$1, templateObject_5$1, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12; + +var StyledSwapHeader = styled.div(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n padding: 1rem 1.25rem 0.5rem 1.25rem;\n width: 100%;\n color: ", ";\n"], ["\n padding: 1rem 1.25rem 0.5rem 1.25rem;\n width: 100%;\n color: ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.text2; +}); +function SwapHeader(_a) { + var allowedSlippage = _a.allowedSlippage; + return (jsx(StyledSwapHeader, { children: jsxs(RowBetween, { children: [jsx(RowFixed, { children: jsx(ThemedText.Black, __assign({ fontWeight: 500, fontSize: 16, style: { marginRight: '8px' } }, { children: jsx(Trans, { children: "Swap" }, void 0) }), void 0) }, void 0), jsx(RowFixed, { children: jsx(SettingsTab, { placeholderSlippage: allowedSlippage }, void 0) }, void 0)] }, void 0) }, void 0)); +} +var templateObject_1$5; + +var Container = styled(ThemedText.Small)(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n opacity: 0.6;\n :hover {\n opacity: 1;\n }\n margin-top: 1rem !important;\n"], ["\n opacity: 0.6;\n :hover {\n opacity: 1;\n }\n margin-top: 1rem !important;\n"]))); +var useTargetLocale = function (activeLocale) { + var browserLocale = useMemo(function () { return navigatorLocale(); }, []); + if (browserLocale && (browserLocale !== DEFAULT_LOCALE || activeLocale !== DEFAULT_LOCALE)) { + if (activeLocale === browserLocale) { + return DEFAULT_LOCALE; + } + else { + return browserLocale; + } + } + return null; +}; +function SwitchLocaleLink() { + var activeLocale = useActiveLocale(); + var targetLocale = useTargetLocale(activeLocale); + var _a = useLocationLinkProps(targetLocale), to = _a.to, onClick = _a.onClick; + if (!targetLocale || !to) + return null; + return (jsx(Container, { children: jsxs(Trans, { children: ["Uniswap available in:", ' ', jsx(StyledInternalLink, __assign({ onClick: onClick, to: to }, { children: LOCALE_LABEL[targetLocale] }), void 0)] }, void 0) }, void 0)); +} +var templateObject_1$4; + +function TokenWarningModal(_a) { + var isOpen = _a.isOpen, tokens = _a.tokens, onConfirm = _a.onConfirm, onDismiss = _a.onDismiss; + return (jsx(Modal, __assign({ isOpen: isOpen, onDismiss: onDismiss, maxHeight: 100 }, { children: jsx(ImportToken, { tokens: tokens, handleCurrencySelect: onConfirm }, void 0) }), void 0)); +} + +function useTokenAllowance(token, owner, spender) { + var contract = useTokenContract(token === null || token === void 0 ? void 0 : token.address, false); + var inputs = useMemo(function () { return [owner, spender]; }, [owner, spender]); + var allowance = useSingleCallResult(contract, 'allowance', inputs).result; + return useMemo(function () { return (token && allowance ? CurrencyAmount.fromRawAmount(token, allowance.toString()) : undefined); }, [token, allowance]); +} + +var ApprovalState; +(function (ApprovalState) { + ApprovalState["UNKNOWN"] = "UNKNOWN"; + ApprovalState["NOT_APPROVED"] = "NOT_APPROVED"; + ApprovalState["PENDING"] = "PENDING"; + ApprovalState["APPROVED"] = "APPROVED"; +})(ApprovalState || (ApprovalState = {})); +function useApprovalStateForSpender(amountToApprove, spender, useIsPendingApproval) { + var _a; + var account = useActiveWeb3React().account; + var token = ((_a = amountToApprove === null || amountToApprove === void 0 ? void 0 : amountToApprove.currency) === null || _a === void 0 ? void 0 : _a.isToken) ? amountToApprove.currency : undefined; + var currentAllowance = useTokenAllowance(token, account !== null && account !== void 0 ? account : undefined, spender); + var pendingApproval = useIsPendingApproval(token, spender); + return useMemo(function () { + if (!amountToApprove || !spender) + return ApprovalState.UNKNOWN; + if (amountToApprove.currency.isNative) + return ApprovalState.APPROVED; + // we might not have enough data to know whether or not we need to approve + if (!currentAllowance) + return ApprovalState.UNKNOWN; + // amountToApprove will be defined if currentAllowance is + return currentAllowance.lessThan(amountToApprove) + ? pendingApproval + ? ApprovalState.PENDING + : ApprovalState.NOT_APPROVED + : ApprovalState.APPROVED; + }, [amountToApprove, currentAllowance, pendingApproval, spender]); +} +function useApproval(amountToApprove, spender, useIsPendingApproval) { + var _this = this; + var _a; + var chainId = useActiveWeb3React().chainId; + var token = ((_a = amountToApprove === null || amountToApprove === void 0 ? void 0 : amountToApprove.currency) === null || _a === void 0 ? void 0 : _a.isToken) ? amountToApprove.currency : undefined; + // check the current approval status + var approvalState = useApprovalStateForSpender(amountToApprove, spender, useIsPendingApproval); + var tokenContract = useTokenContract(token === null || token === void 0 ? void 0 : token.address); + var approve = useCallback(function () { return __awaiter(_this, void 0, void 0, function () { + function logFailure(error) { + console.warn(((token === null || token === void 0 ? void 0 : token.symbol) || 'Token') + " approval failed:", error); + return; + } + var useExact, estimatedGas; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + // Bail early if there is an issue. + if (approvalState !== ApprovalState.NOT_APPROVED) { + return [2 /*return*/, logFailure('approve was called unnecessarily')]; + } + else if (!chainId) { + return [2 /*return*/, logFailure('no chainId')]; + } + else if (!token) { + return [2 /*return*/, logFailure('no token')]; + } + else if (!tokenContract) { + return [2 /*return*/, logFailure('tokenContract is null')]; + } + else if (!amountToApprove) { + return [2 /*return*/, logFailure('missing amount to approve')]; + } + else if (!spender) { + return [2 /*return*/, logFailure('no spender')]; + } + useExact = false; + return [4 /*yield*/, tokenContract.estimateGas.approve(spender, MaxUint256).catch(function () { + // general fallback for tokens which restrict approval amounts + useExact = true; + return tokenContract.estimateGas.approve(spender, amountToApprove.quotient.toString()); + })]; + case 1: + estimatedGas = _a.sent(); + return [2 /*return*/, tokenContract + .approve(spender, useExact ? amountToApprove.quotient.toString() : MaxUint256, { + gasLimit: calculateGasMargin(estimatedGas), + }) + .then(function (response) { return ({ + response: response, + tokenAddress: token.address, + spenderAddress: spender, + }); }) + .catch(function (error) { + logFailure(error); + throw error; + })]; + } + }); + }); }, [approvalState, token, tokenContract, amountToApprove, spender, chainId]); + return [approvalState, approve]; +} + +var SwapRouterVersion; +(function (SwapRouterVersion) { + SwapRouterVersion[SwapRouterVersion["V2"] = 0] = "V2"; + SwapRouterVersion[SwapRouterVersion["V3"] = 1] = "V3"; + SwapRouterVersion[SwapRouterVersion["V2V3"] = 2] = "V2V3"; +})(SwapRouterVersion || (SwapRouterVersion = {})); +/** + * Returns the swap router that will result in the least amount of txs (less gas) for a given swap. + * Heuristic: + * - if trade contains a single v2-only trade & V2 SwapRouter is approved: use V2 SwapRouter + * - if trade contains only v3 & V3 SwapRouter is approved: use V3 SwapRouter + * - else: approve and use V2+V3 SwapRouter + */ +function getTxOptimizedSwapRouter(_a) { + var onlyV2Routes = _a.onlyV2Routes, onlyV3Routes = _a.onlyV3Routes, tradeHasSplits = _a.tradeHasSplits, approvalStates = _a.approvalStates; + if ([approvalStates.v2, approvalStates.v3, approvalStates.v2V3].includes(ApprovalState.PENDING)) + return undefined; + if (approvalStates.v2V3 === ApprovalState.APPROVED) + return SwapRouterVersion.V2V3; + if (approvalStates.v2 === ApprovalState.APPROVED && onlyV2Routes && !tradeHasSplits) + return SwapRouterVersion.V2; + if (approvalStates.v3 === ApprovalState.APPROVED && onlyV3Routes) + return SwapRouterVersion.V3; + return SwapRouterVersion.V2V3; +} + +/** Returns approval state for all known swap routers */ +function useSwapApprovalStates(trade, allowedSlippage, useIsPendingApproval) { + var chainId = useActiveWeb3React().chainId; + var amountToApprove = useMemo(function () { return (trade && trade.inputAmount.currency.isToken ? trade.maximumAmountIn(allowedSlippage) : undefined); }, [trade, allowedSlippage]); + var v2RouterAddress = chainId ? V2_ROUTER_ADDRESS[chainId] : undefined; + var v3RouterAddress = chainId ? V3_ROUTER_ADDRESS[chainId] : undefined; + var swapRouterAddress = chainId ? SWAP_ROUTER_ADDRESSES[chainId] : undefined; + var v2 = useApprovalStateForSpender(amountToApprove, v2RouterAddress, useIsPendingApproval); + var v3 = useApprovalStateForSpender(amountToApprove, v3RouterAddress, useIsPendingApproval); + var v2V3 = useApprovalStateForSpender(amountToApprove, swapRouterAddress, useIsPendingApproval); + return useMemo(function () { return ({ v2: v2, v3: v3, v2V3: v2V3 }); }, [v2, v2V3, v3]); +} +function useSwapRouterAddress(trade) { + var chainId = useActiveWeb3React().chainId; + return useMemo(function () { + return chainId + ? trade instanceof Trade + ? V2_ROUTER_ADDRESS[chainId] + : trade instanceof Trade$2 + ? V3_ROUTER_ADDRESS[chainId] + : SWAP_ROUTER_ADDRESSES[chainId] + : undefined; + }, [chainId, trade]); +} +// wraps useApproveCallback in the context of a swap +function useSwapApproval(trade, allowedSlippage, useIsPendingApproval) { + var amountToApprove = useMemo(function () { return (trade && trade.inputAmount.currency.isToken ? trade.maximumAmountIn(allowedSlippage) : undefined); }, [trade, allowedSlippage]); + var spender = useSwapRouterAddress(trade); + var approval = useApproval(amountToApprove, spender, useIsPendingApproval); + if (trade instanceof Trade || trade instanceof Trade$2) { + var approvalState = approval[0]; + invariant(approvalState === ApprovalState.APPROVED, 'Trying to approve legacy router'); + } + return approval; +} +function useSwapApprovalOptimizedTrade(trade, allowedSlippage, useIsPendingApproval) { + var _a; + var onlyV2Routes = trade === null || trade === void 0 ? void 0 : trade.routes.every(function (route) { return route.protocol === Protocol.V2; }); + var onlyV3Routes = trade === null || trade === void 0 ? void 0 : trade.routes.every(function (route) { return route.protocol === Protocol.V3; }); + var tradeHasSplits = ((_a = trade === null || trade === void 0 ? void 0 : trade.routes.length) !== null && _a !== void 0 ? _a : 0) > 1; + var approvalStates = useSwapApprovalStates(trade, allowedSlippage, useIsPendingApproval); + var optimizedSwapRouter = useMemo(function () { return getTxOptimizedSwapRouter({ onlyV2Routes: onlyV2Routes, onlyV3Routes: onlyV3Routes, tradeHasSplits: tradeHasSplits, approvalStates: approvalStates }); }, [approvalStates, tradeHasSplits, onlyV2Routes, onlyV3Routes]); + return useMemo(function () { + if (!trade) + return undefined; + try { + switch (optimizedSwapRouter) { + case SwapRouterVersion.V2V3: + return trade; + case SwapRouterVersion.V2: + var pairs = trade.swaps[0].route.pools.filter(function (pool) { return pool instanceof Pair; }); + var v2Route = new Route$2(pairs, trade.inputAmount.currency, trade.outputAmount.currency); + return new Trade(v2Route, trade.inputAmount, trade.tradeType); + case SwapRouterVersion.V3: + return Trade$2.createUncheckedTradeWithMultipleRoutes({ + routes: trade.swaps.map(function (_a) { + var route = _a.route, inputAmount = _a.inputAmount, outputAmount = _a.outputAmount; + return ({ + route: new Route$1(route.pools.filter(function (p) { return p instanceof Pool$1; }), inputAmount.currency, outputAmount.currency), + inputAmount: inputAmount, + outputAmount: outputAmount, + }); + }), + tradeType: trade.tradeType, + }); + default: + return undefined; + } + } + catch (e) { + // TODO(#2989): remove try-catch + console.debug(e); + return undefined; + } + }, [trade, optimizedSwapRouter]); +} + +function useGetAndTrackApproval(getApproval) { + var addTransaction = useTransactionAdder(); + return useCallback(function () { + return getApproval().then(function (pending) { + if (pending) { + var response = pending.response, tokenAddress = pending.tokenAddress, spender = pending.spenderAddress; + addTransaction(response, { type: TransactionType.APPROVAL, tokenAddress: tokenAddress, spender: spender }); + } + }); + }, [addTransaction, getApproval]); +} +function useApprovalOptimizedTrade(trade, allowedSlippage) { + return useSwapApprovalOptimizedTrade(trade, allowedSlippage, useHasPendingApproval); +} +function useApproveCallbackFromTrade(trade, allowedSlippage) { + var _a = __read(useSwapApproval(trade, allowedSlippage, useHasPendingApproval), 2), approval = _a[0], getApproval = _a[1]; + return [approval, useGetAndTrackApproval(getApproval)]; +} + +var _a$1, _b, _c, _d, _e; +var PermitType; +(function (PermitType) { + PermitType[PermitType["AMOUNT"] = 1] = "AMOUNT"; + PermitType[PermitType["ALLOWED"] = 2] = "ALLOWED"; +})(PermitType || (PermitType = {})); +// 20 minutes to submit after signing +var PERMIT_VALIDITY_BUFFER = 20 * 60; +// todo: read this information from extensions on token lists or elsewhere (permit registry?) +var PERMITTABLE_TOKENS = { + 1: (_a$1 = {}, + _a$1[USDC.address] = { type: PermitType.AMOUNT, name: 'USD Coin', version: '2' }, + _a$1[DAI.address] = { type: PermitType.ALLOWED, name: 'Dai Stablecoin', version: '1' }, + _a$1[UNI[1].address] = { type: PermitType.AMOUNT, name: 'Uniswap' }, + _a$1), + 4: (_b = { + '0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735': { type: PermitType.ALLOWED, name: 'Dai Stablecoin', version: '1' } + }, + _b[UNI[4].address] = { type: PermitType.AMOUNT, name: 'Uniswap' }, + _b), + 3: (_c = {}, + _c[UNI[3].address] = { type: PermitType.AMOUNT, name: 'Uniswap' }, + _c['0x07865c6E87B9F70255377e024ace6630C1Eaa37F'] = { type: PermitType.AMOUNT, name: 'USD Coin', version: '2' }, + _c), + 5: (_d = {}, + _d[UNI[5].address] = { type: PermitType.AMOUNT, name: 'Uniswap' }, + _d), + 42: (_e = {}, + _e[UNI[42].address] = { type: PermitType.AMOUNT, name: 'Uniswap' }, + _e), +}; +var UseERC20PermitState; +(function (UseERC20PermitState) { + // returned for any reason, e.g. it is an argent wallet, or the currency does not support it + UseERC20PermitState[UseERC20PermitState["NOT_APPLICABLE"] = 0] = "NOT_APPLICABLE"; + UseERC20PermitState[UseERC20PermitState["LOADING"] = 1] = "LOADING"; + UseERC20PermitState[UseERC20PermitState["NOT_SIGNED"] = 2] = "NOT_SIGNED"; + UseERC20PermitState[UseERC20PermitState["SIGNED"] = 3] = "SIGNED"; +})(UseERC20PermitState || (UseERC20PermitState = {})); +var EIP712_DOMAIN_TYPE = [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, +]; +var EIP712_DOMAIN_TYPE_NO_VERSION = [ + { name: 'name', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, +]; +var EIP2612_TYPE = [ + { name: 'owner', type: 'address' }, + { name: 'spender', type: 'address' }, + { name: 'value', type: 'uint256' }, + { name: 'nonce', type: 'uint256' }, + { name: 'deadline', type: 'uint256' }, +]; +var PERMIT_ALLOWED_TYPE = [ + { name: 'holder', type: 'address' }, + { name: 'spender', type: 'address' }, + { name: 'nonce', type: 'uint256' }, + { name: 'expiry', type: 'uint256' }, + { name: 'allowed', type: 'bool' }, +]; +function useERC20Permit(currencyAmount, spender, transactionDeadline, overridePermitInfo) { + var _a, _b; + var _c = useActiveWeb3React(), account = _c.account, chainId = _c.chainId, library = _c.library; + var tokenAddress = ((_a = currencyAmount === null || currencyAmount === void 0 ? void 0 : currencyAmount.currency) === null || _a === void 0 ? void 0 : _a.isToken) ? currencyAmount.currency.address : undefined; + var eip2612Contract = useEIP2612Contract(tokenAddress); + var isArgentWallet = useIsArgentWallet(); + var nonceInputs = useMemo(function () { return [account !== null && account !== void 0 ? account : undefined]; }, [account]); + var tokenNonceState = useSingleCallResult(eip2612Contract, 'nonces', nonceInputs); + var permitInfo = overridePermitInfo !== null && overridePermitInfo !== void 0 ? overridePermitInfo : (chainId && tokenAddress ? (_b = PERMITTABLE_TOKENS[chainId]) === null || _b === void 0 ? void 0 : _b[tokenAddress] : undefined); + var _d = __read(useState(null), 2), signatureData = _d[0], setSignatureData = _d[1]; + return useMemo(function () { + var _a, _b; + if (isArgentWallet || + !currencyAmount || + !eip2612Contract || + !account || + !chainId || + !transactionDeadline || + !library || + !tokenNonceState.valid || + !tokenAddress || + !spender || + !permitInfo) { + return { + state: UseERC20PermitState.NOT_APPLICABLE, + signatureData: null, + gatherPermitSignature: null, + }; + } + var nonceNumber = (_b = (_a = tokenNonceState.result) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toNumber(); + if (tokenNonceState.loading || typeof nonceNumber !== 'number') { + return { + state: UseERC20PermitState.LOADING, + signatureData: null, + gatherPermitSignature: null, + }; + } + var isSignatureDataValid = signatureData && + signatureData.owner === account && + signatureData.deadline >= transactionDeadline.toNumber() && + signatureData.tokenAddress === tokenAddress && + signatureData.nonce === nonceNumber && + signatureData.spender === spender && + ('allowed' in signatureData || JSBI.equal(JSBI.BigInt(signatureData.amount), currencyAmount.quotient)); + return { + state: isSignatureDataValid ? UseERC20PermitState.SIGNED : UseERC20PermitState.NOT_SIGNED, + signatureData: isSignatureDataValid ? signatureData : null, + gatherPermitSignature: function gatherPermitSignature() { + return __awaiter(this, void 0, void 0, function () { + var allowed, signatureDeadline, value, message, domain, data; + return __generator(this, function (_a) { + allowed = permitInfo.type === PermitType.ALLOWED; + signatureDeadline = transactionDeadline.toNumber() + PERMIT_VALIDITY_BUFFER; + value = currencyAmount.quotient.toString(); + message = allowed + ? { + holder: account, + spender: spender, + allowed: allowed, + nonce: nonceNumber, + expiry: signatureDeadline, + } + : { + owner: account, + spender: spender, + value: value, + nonce: nonceNumber, + deadline: signatureDeadline, + }; + domain = permitInfo.version + ? { + name: permitInfo.name, + version: permitInfo.version, + verifyingContract: tokenAddress, + chainId: chainId, + } + : { + name: permitInfo.name, + verifyingContract: tokenAddress, + chainId: chainId, + }; + data = JSON.stringify({ + types: { + EIP712Domain: permitInfo.version ? EIP712_DOMAIN_TYPE : EIP712_DOMAIN_TYPE_NO_VERSION, + Permit: allowed ? PERMIT_ALLOWED_TYPE : EIP2612_TYPE, + }, + domain: domain, + primaryType: 'Permit', + message: message, + }); + return [2 /*return*/, library + .send('eth_signTypedData_v4', [account, data]) + .then(splitSignature) + .then(function (signature) { + setSignatureData(__assign(__assign({ v: signature.v, r: signature.r, s: signature.s, deadline: signatureDeadline }, (allowed ? { allowed: allowed } : { amount: value })), { nonce: nonceNumber, chainId: chainId, owner: account, spender: spender, tokenAddress: tokenAddress, permitType: permitInfo.type })); + })]; + }); + }); + }, + }; + }, [ + currencyAmount, + eip2612Contract, + account, + chainId, + isArgentWallet, + transactionDeadline, + library, + tokenNonceState.loading, + tokenNonceState.valid, + tokenNonceState.result, + tokenAddress, + spender, + permitInfo, + signatureData, + ]); +} +function useERC20PermitFromTrade(trade, allowedSlippage, transactionDeadline) { + var chainId = useActiveWeb3React().chainId; + var swapRouterAddress = chainId + ? // v2 router does not support + trade instanceof Trade + ? undefined + : trade instanceof Trade$2 + ? V3_ROUTER_ADDRESS[chainId] + : SWAP_ROUTER_ADDRESSES[chainId] + : undefined; + var amountToApprove = useMemo(function () { return (trade ? trade.maximumAmountIn(allowedSlippage) : undefined); }, [trade, allowedSlippage]); + return useERC20Permit(amountToApprove, swapRouterAddress, transactionDeadline, null); +} + +/** + * Returns true if the input currency or output currency cannot be traded in the interface + * @param currencyIn the input currency to check + * @param currencyOut the output currency to check + */ +function useIsSwapUnsupported(currencyIn, currencyOut) { + var unsupportedTokens = useUnsupportedTokens(); + return useMemo(function () { + if (!unsupportedTokens) { + return false; + } + var currencyInUnsupported = Boolean((currencyIn === null || currencyIn === void 0 ? void 0 : currencyIn.isToken) && unsupportedTokens[currencyIn.address]); + var currencyOutUnsupported = Boolean((currencyOut === null || currencyOut === void 0 ? void 0 : currencyOut.isToken) && unsupportedTokens[currencyOut.address]); + return currencyInUnsupported || currencyOutUnsupported; + }, [currencyIn, currencyOut, unsupportedTokens]); +} + +var WrapType; +(function (WrapType) { + WrapType[WrapType["NOT_APPLICABLE"] = 0] = "NOT_APPLICABLE"; + WrapType[WrapType["WRAP"] = 1] = "WRAP"; + WrapType[WrapType["UNWRAP"] = 2] = "UNWRAP"; +})(WrapType || (WrapType = {})); +var NOT_APPLICABLE = { wrapType: WrapType.NOT_APPLICABLE }; +var WrapInputError; +(function (WrapInputError) { + WrapInputError[WrapInputError["NO_ERROR"] = 0] = "NO_ERROR"; + WrapInputError[WrapInputError["ENTER_NATIVE_AMOUNT"] = 1] = "ENTER_NATIVE_AMOUNT"; + WrapInputError[WrapInputError["ENTER_WRAPPED_AMOUNT"] = 2] = "ENTER_WRAPPED_AMOUNT"; + WrapInputError[WrapInputError["INSUFFICIENT_NATIVE_BALANCE"] = 3] = "INSUFFICIENT_NATIVE_BALANCE"; + WrapInputError[WrapInputError["INSUFFICIENT_WRAPPED_BALANCE"] = 4] = "INSUFFICIENT_WRAPPED_BALANCE"; +})(WrapInputError || (WrapInputError = {})); +function WrapErrorText(_a) { + var wrapInputError = _a.wrapInputError; + var native = useNativeCurrency(); + var wrapped = native === null || native === void 0 ? void 0 : native.wrapped; + switch (wrapInputError) { + case WrapInputError.NO_ERROR: + return null; + case WrapInputError.ENTER_NATIVE_AMOUNT: + return jsxs(Trans, { children: ["Enter ", native === null || native === void 0 ? void 0 : native.symbol, " amount"] }, void 0); + case WrapInputError.ENTER_WRAPPED_AMOUNT: + return jsxs(Trans, { children: ["Enter ", wrapped === null || wrapped === void 0 ? void 0 : wrapped.symbol, " amount"] }, void 0); + case WrapInputError.INSUFFICIENT_NATIVE_BALANCE: + return jsxs(Trans, { children: ["Insufficient ", native === null || native === void 0 ? void 0 : native.symbol, " balance"] }, void 0); + case WrapInputError.INSUFFICIENT_WRAPPED_BALANCE: + return jsxs(Trans, { children: ["Insufficient ", wrapped === null || wrapped === void 0 ? void 0 : wrapped.symbol, " balance"] }, void 0); + } +} +/** + * Given the selected input and output currency, return a wrap callback + * @param inputCurrency the selected input currency + * @param outputCurrency the selected output currency + * @param typedValue the user input value + */ +function useWrapCallback(inputCurrency, outputCurrency, typedValue) { + var _this = this; + var _a = useActiveWeb3React(), chainId = _a.chainId, account = _a.account; + var wethContract = useWETHContract(); + var balance = useCurrencyBalance(account !== null && account !== void 0 ? account : undefined, inputCurrency !== null && inputCurrency !== void 0 ? inputCurrency : undefined); + // we can always parse the amount typed as the input currency, since wrapping is 1:1 + var inputAmount = useMemo(function () { return tryParseCurrencyAmount(typedValue, inputCurrency !== null && inputCurrency !== void 0 ? inputCurrency : undefined); }, [inputCurrency, typedValue]); + var addTransaction = useTransactionAdder(); + return useMemo(function () { + if (!wethContract || !chainId || !inputCurrency || !outputCurrency) + return NOT_APPLICABLE; + var weth = WRAPPED_NATIVE_CURRENCY[chainId]; + if (!weth) + return NOT_APPLICABLE; + var hasInputAmount = Boolean(inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.greaterThan('0')); + var sufficientBalance = inputAmount && balance && !balance.lessThan(inputAmount); + if (inputCurrency.isNative && weth.equals(outputCurrency)) { + return { + wrapType: WrapType.WRAP, + execute: sufficientBalance && inputAmount + ? function () { return __awaiter(_this, void 0, void 0, function () { + var txReceipt, error_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, wethContract.deposit({ value: "0x" + inputAmount.quotient.toString(16) })]; + case 1: + txReceipt = _a.sent(); + addTransaction(txReceipt, { + type: TransactionType.WRAP, + unwrapped: false, + currencyAmountRaw: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.quotient.toString(), + chainId: chainId, + }); + return [3 /*break*/, 3]; + case 2: + error_1 = _a.sent(); + console.error('Could not deposit', error_1); + return [3 /*break*/, 3]; + case 3: return [2 /*return*/]; + } + }); + }); } + : undefined, + inputError: sufficientBalance + ? undefined + : hasInputAmount + ? WrapInputError.INSUFFICIENT_NATIVE_BALANCE + : WrapInputError.ENTER_NATIVE_AMOUNT, + }; + } + else if (weth.equals(inputCurrency) && outputCurrency.isNative) { + return { + wrapType: WrapType.UNWRAP, + execute: sufficientBalance && inputAmount + ? function () { return __awaiter(_this, void 0, void 0, function () { + var txReceipt, error_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, wethContract.withdraw("0x" + inputAmount.quotient.toString(16))]; + case 1: + txReceipt = _a.sent(); + addTransaction(txReceipt, { + type: TransactionType.WRAP, + unwrapped: true, + currencyAmountRaw: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.quotient.toString(), + chainId: chainId, + }); + return [3 /*break*/, 3]; + case 2: + error_2 = _a.sent(); + console.error('Could not withdraw', error_2); + return [3 /*break*/, 3]; + case 3: return [2 /*return*/]; + } + }); + }); } + : undefined, + inputError: sufficientBalance + ? undefined + : hasInputAmount + ? WrapInputError.INSUFFICIENT_WRAPPED_BALANCE + : WrapInputError.ENTER_WRAPPED_AMOUNT, + }; + } + else { + return NOT_APPLICABLE; + } + }, [wethContract, chainId, inputCurrency, outputCurrency, inputAmount, balance, addTransaction]); +} + +var MIN_NATIVE_CURRENCY_FOR_GAS = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(16)); // .01 ETH +/** + * Given some token amount, return the max that can be spent of it + * @param currencyAmount to return max of + */ +function maxAmountSpend(currencyAmount) { + if (!currencyAmount) + return undefined; + if (currencyAmount.currency.isNative) { + if (JSBI.greaterThan(currencyAmount.quotient, MIN_NATIVE_CURRENCY_FOR_GAS)) { + return CurrencyAmount.fromRawAmount(currencyAmount.currency, JSBI.subtract(currencyAmount.quotient, MIN_NATIVE_CURRENCY_FOR_GAS)); + } + else { + return CurrencyAmount.fromRawAmount(currencyAmount.currency, JSBI.BigInt(0)); + } + } + return currencyAmount; +} + +var BodyWrapper$1 = styled.main(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n position: relative;\n margin-top: ", ";\n max-width: ", ";\n width: 100%;\n background: ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 24px;\n margin-top: 1rem;\n margin-left: auto;\n margin-right: auto;\n z-index: ", ";\n"], ["\n position: relative;\n margin-top: ", ";\n max-width: ", ";\n width: 100%;\n background: ", ";\n box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),\n 0px 24px 32px rgba(0, 0, 0, 0.01);\n border-radius: 24px;\n margin-top: 1rem;\n margin-left: auto;\n margin-right: auto;\n z-index: ", ";\n" + /** + * The styled container element that wraps the content of most pages and the tabs. + */ +])), function (_a) { + var margin = _a.margin; + return margin !== null && margin !== void 0 ? margin : '0px'; +}, function (_a) { + var maxWidth = _a.maxWidth; + return maxWidth !== null && maxWidth !== void 0 ? maxWidth : '480px'; +}, function (_a) { + var theme = _a.theme; + return theme.bg0; +}, Z_INDEX.deprecated_content); +/** + * The styled container element that wraps the content of most pages and the tabs. + */ +function AppBody(_a) { + var children = _a.children, rest = __rest(_a, ["children"]); + return jsx(BodyWrapper$1, __assign({}, rest, { children: children }), void 0); +} +var templateObject_1$3; + +var AlertWrapper = styled.div(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n max-width: 460px;\n width: 100%;\n"], ["\n max-width: 460px;\n width: 100%;\n"]))); +function Swap(_a) { + var _this = this; + var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; + var history = _a.history; + var account = useActiveWeb3React().account; + var loadedUrlParams = useDefaultsFromURLSearch(); + // token warning stuff + var _m = __read([ + useCurrency(loadedUrlParams === null || loadedUrlParams === void 0 ? void 0 : loadedUrlParams.inputCurrencyId), + useCurrency(loadedUrlParams === null || loadedUrlParams === void 0 ? void 0 : loadedUrlParams.outputCurrencyId), + ], 2), loadedInputCurrency = _m[0], loadedOutputCurrency = _m[1]; + var _o = __read(useState(false), 2), dismissTokenWarning = _o[0], setDismissTokenWarning = _o[1]; + var urlLoadedTokens = useMemo(function () { var _a, _b; return (_b = (_a = [loadedInputCurrency, loadedOutputCurrency]) === null || _a === void 0 ? void 0 : _a.filter(function (c) { var _a; return (_a = c === null || c === void 0 ? void 0 : c.isToken) !== null && _a !== void 0 ? _a : false; })) !== null && _b !== void 0 ? _b : []; }, [loadedInputCurrency, loadedOutputCurrency]); + var handleConfirmTokenWarning = useCallback(function () { + setDismissTokenWarning(true); + }, []); + // dismiss warning if all imported tokens are in active lists + var defaultTokens = useAllTokens(); + var importTokensNotInDefault = useMemo(function () { + return urlLoadedTokens && + urlLoadedTokens.filter(function (token) { + return !Boolean(token.address in defaultTokens); + }); + }, [defaultTokens, urlLoadedTokens]); + var theme = useContext(ThemeContext); + // toggle wallet when disconnected + var toggleWalletModal = useWalletModalToggle(); + // for expert mode + var _p = __read(useExpertModeManager(), 1), isExpertMode = _p[0]; + // swap state + var _q = useSwapState(), independentField = _q.independentField, typedValue = _q.typedValue, recipient = _q.recipient; + var _r = useDerivedSwapInfo(), _s = _r.trade, tradeState = _s.state, trade = _s.trade, allowedSlippage = _r.allowedSlippage, currencyBalances = _r.currencyBalances, parsedAmount = _r.parsedAmount, currencies = _r.currencies, swapInputError = _r.inputError; + var _t = useWrapCallback(currencies[Field.INPUT], currencies[Field.OUTPUT], typedValue), wrapType = _t.wrapType, onWrap = _t.execute, wrapInputError = _t.inputError; + var showWrap = wrapType !== WrapType.NOT_APPLICABLE; + var recipientAddress = useENSAddress(recipient).address; + var parsedAmounts = useMemo(function () { + var _a, _b; + return showWrap + ? (_a = {}, + _a[Field.INPUT] = parsedAmount, + _a[Field.OUTPUT] = parsedAmount, + _a) : (_b = {}, + _b[Field.INPUT] = independentField === Field.INPUT ? parsedAmount : trade === null || trade === void 0 ? void 0 : trade.inputAmount, + _b[Field.OUTPUT] = independentField === Field.OUTPUT ? parsedAmount : trade === null || trade === void 0 ? void 0 : trade.outputAmount, + _b); + }, [independentField, parsedAmount, showWrap, trade]); + var _u = __read(useMemo(function () { return [!(trade === null || trade === void 0 ? void 0 : trade.swaps), TradeState.LOADING === tradeState, TradeState.SYNCING === tradeState]; }, [trade, tradeState]), 3), routeNotFound = _u[0], routeIsLoading = _u[1], routeIsSyncing = _u[2]; + var fiatValueInput = useUSDCValue(parsedAmounts[Field.INPUT]); + var fiatValueOutput = useUSDCValue(parsedAmounts[Field.OUTPUT]); + var priceImpact = useMemo(function () { return (routeIsSyncing ? undefined : computeFiatValuePriceImpact(fiatValueInput, fiatValueOutput)); }, [fiatValueInput, fiatValueOutput, routeIsSyncing]); + var _v = useSwapActionHandlers(), onSwitchTokens = _v.onSwitchTokens, onCurrencySelection = _v.onCurrencySelection, onUserInput = _v.onUserInput, onChangeRecipient = _v.onChangeRecipient; + var isValid = !swapInputError; + var dependentField = independentField === Field.INPUT ? Field.OUTPUT : Field.INPUT; + var handleTypeInput = useCallback(function (value) { + onUserInput(Field.INPUT, value); + }, [onUserInput]); + var handleTypeOutput = useCallback(function (value) { + onUserInput(Field.OUTPUT, value); + }, [onUserInput]); + // reset if they close warning without tokens in params + var handleDismissTokenWarning = useCallback(function () { + setDismissTokenWarning(true); + history.push('/swap/'); + }, [history]); + // modal and loading + var _w = __read(useState({ + showConfirm: false, + tradeToConfirm: undefined, + attemptingTxn: false, + swapErrorMessage: undefined, + txHash: undefined, + }), 2), _x = _w[0], showConfirm = _x.showConfirm, tradeToConfirm = _x.tradeToConfirm, swapErrorMessage = _x.swapErrorMessage, attemptingTxn = _x.attemptingTxn, txHash = _x.txHash, setSwapState = _w[1]; + var formattedAmounts = useMemo(function () { + var _a; + var _b, _c, _d, _e; + return (_a = {}, + _a[independentField] = typedValue, + _a[dependentField] = showWrap + ? (_c = (_b = parsedAmounts[independentField]) === null || _b === void 0 ? void 0 : _b.toExact()) !== null && _c !== void 0 ? _c : '' + : (_e = (_d = parsedAmounts[dependentField]) === null || _d === void 0 ? void 0 : _d.toSignificant(6)) !== null && _e !== void 0 ? _e : '', + _a); + }, [dependentField, independentField, parsedAmounts, showWrap, typedValue]); + var userHasSpecifiedInputOutput = Boolean(currencies[Field.INPUT] && currencies[Field.OUTPUT] && ((_b = parsedAmounts[independentField]) === null || _b === void 0 ? void 0 : _b.greaterThan(JSBI.BigInt(0)))); + var approvalOptimizedTrade = useApprovalOptimizedTrade(trade, allowedSlippage); + var approvalOptimizedTradeString = approvalOptimizedTrade instanceof Trade + ? 'V2SwapRouter' + : approvalOptimizedTrade instanceof Trade$2 + ? 'V3SwapRouter' + : 'SwapRouter'; + // check whether the user has approved the router on the input token + var _y = __read(useApproveCallbackFromTrade(approvalOptimizedTrade, allowedSlippage), 2), approvalState = _y[0], approveCallback = _y[1]; + var transactionDeadline = useTransactionDeadline(); + var _z = useERC20PermitFromTrade(approvalOptimizedTrade, allowedSlippage, transactionDeadline), signatureState = _z.state, signatureData = _z.signatureData, gatherPermitSignature = _z.gatherPermitSignature; + var handleApprove = useCallback(function () { return __awaiter(_this, void 0, void 0, function () { + var error_1; + var _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!(signatureState === UseERC20PermitState.NOT_SIGNED && gatherPermitSignature)) return [3 /*break*/, 7]; + _b.label = 1; + case 1: + _b.trys.push([1, 3, , 6]); + return [4 /*yield*/, gatherPermitSignature()]; + case 2: + _b.sent(); + return [3 /*break*/, 6]; + case 3: + error_1 = _b.sent(); + if (!((error_1 === null || error_1 === void 0 ? void 0 : error_1.code) !== 4001)) return [3 /*break*/, 5]; + return [4 /*yield*/, approveCallback()]; + case 4: + _b.sent(); + _b.label = 5; + case 5: return [3 /*break*/, 6]; + case 6: return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, approveCallback()]; + case 8: + _b.sent(); + ReactGA.event({ + category: 'Swap', + action: 'Approve', + label: [approvalOptimizedTradeString, (_a = approvalOptimizedTrade === null || approvalOptimizedTrade === void 0 ? void 0 : approvalOptimizedTrade.inputAmount) === null || _a === void 0 ? void 0 : _a.currency.symbol].join('/'), + }); + _b.label = 9; + case 9: return [2 /*return*/]; + } + }); + }); }, [ + signatureState, + gatherPermitSignature, + approveCallback, + approvalOptimizedTradeString, + (_c = approvalOptimizedTrade === null || approvalOptimizedTrade === void 0 ? void 0 : approvalOptimizedTrade.inputAmount) === null || _c === void 0 ? void 0 : _c.currency.symbol, + ]); + // check if user has gone through approval process, used to show two step buttons, reset on token change + var _0 = __read(useState(false), 2), approvalSubmitted = _0[0], setApprovalSubmitted = _0[1]; + // mark when a user has submitted an approval, reset onTokenSelection for input field + useEffect(function () { + if (approvalState === ApprovalState.PENDING) { + setApprovalSubmitted(true); + } + }, [approvalState, approvalSubmitted]); + var maxInputAmount = useMemo(function () { return maxAmountSpend(currencyBalances[Field.INPUT]); }, [currencyBalances]); + var showMaxButton = Boolean((maxInputAmount === null || maxInputAmount === void 0 ? void 0 : maxInputAmount.greaterThan(0)) && !((_d = parsedAmounts[Field.INPUT]) === null || _d === void 0 ? void 0 : _d.equalTo(maxInputAmount))); + // the callback to execute the swap + var _1 = useSwapCallback(approvalOptimizedTrade, allowedSlippage, recipient, signatureData), swapCallback = _1.callback, swapCallbackError = _1.error; + var handleSwap = useCallback(function () { + if (!swapCallback) { + return; + } + if (priceImpact && !confirmPriceImpactWithoutFee(priceImpact)) { + return; + } + setSwapState({ attemptingTxn: true, tradeToConfirm: tradeToConfirm, showConfirm: showConfirm, swapErrorMessage: undefined, txHash: undefined }); + swapCallback() + .then(function (hash) { + var _a, _b, _c, _d; + setSwapState({ attemptingTxn: false, tradeToConfirm: tradeToConfirm, showConfirm: showConfirm, swapErrorMessage: undefined, txHash: hash }); + ReactGA.event({ + category: 'Swap', + action: recipient === null + ? 'Swap w/o Send' + : (recipientAddress !== null && recipientAddress !== void 0 ? recipientAddress : recipient) === account + ? 'Swap w/o Send + recipient' + : 'Swap w/ Send', + label: [ + approvalOptimizedTradeString, + (_b = (_a = approvalOptimizedTrade === null || approvalOptimizedTrade === void 0 ? void 0 : approvalOptimizedTrade.inputAmount) === null || _a === void 0 ? void 0 : _a.currency) === null || _b === void 0 ? void 0 : _b.symbol, + (_d = (_c = approvalOptimizedTrade === null || approvalOptimizedTrade === void 0 ? void 0 : approvalOptimizedTrade.outputAmount) === null || _c === void 0 ? void 0 : _c.currency) === null || _d === void 0 ? void 0 : _d.symbol, + 'MH', + ].join('/'), + }); + }) + .catch(function (error) { + setSwapState({ + attemptingTxn: false, + tradeToConfirm: tradeToConfirm, + showConfirm: showConfirm, + swapErrorMessage: error.message, + txHash: undefined, + }); + }); + }, [ + swapCallback, + priceImpact, + tradeToConfirm, + showConfirm, + recipient, + recipientAddress, + account, + approvalOptimizedTradeString, + (_f = (_e = approvalOptimizedTrade === null || approvalOptimizedTrade === void 0 ? void 0 : approvalOptimizedTrade.inputAmount) === null || _e === void 0 ? void 0 : _e.currency) === null || _f === void 0 ? void 0 : _f.symbol, + (_h = (_g = approvalOptimizedTrade === null || approvalOptimizedTrade === void 0 ? void 0 : approvalOptimizedTrade.outputAmount) === null || _g === void 0 ? void 0 : _g.currency) === null || _h === void 0 ? void 0 : _h.symbol, + ]); + // errors + var _2 = __read(useState(false), 2), showInverted = _2[0], setShowInverted = _2[1]; + // warnings on the greater of fiat value price impact and execution price impact + var priceImpactSeverity = useMemo(function () { + var executionPriceImpact = trade === null || trade === void 0 ? void 0 : trade.priceImpact; + return warningSeverity(executionPriceImpact && priceImpact + ? executionPriceImpact.greaterThan(priceImpact) + ? executionPriceImpact + : priceImpact + : executionPriceImpact !== null && executionPriceImpact !== void 0 ? executionPriceImpact : priceImpact); + }, [priceImpact, trade]); + var isArgentWallet = useIsArgentWallet(); + // show approve flow when: no error on inputs, not approved or pending, or approved in current session + // never show if price impact is above threshold in non expert mode + var showApproveFlow = !isArgentWallet && + !swapInputError && + (approvalState === ApprovalState.NOT_APPROVED || + approvalState === ApprovalState.PENDING || + (approvalSubmitted && approvalState === ApprovalState.APPROVED)) && + !(priceImpactSeverity > 3 && !isExpertMode); + var handleConfirmDismiss = useCallback(function () { + setSwapState({ showConfirm: false, tradeToConfirm: tradeToConfirm, attemptingTxn: attemptingTxn, swapErrorMessage: swapErrorMessage, txHash: txHash }); + // if there was a tx hash, we want to clear the input + if (txHash) { + onUserInput(Field.INPUT, ''); + } + }, [attemptingTxn, onUserInput, swapErrorMessage, tradeToConfirm, txHash]); + var handleAcceptChanges = useCallback(function () { + setSwapState({ tradeToConfirm: trade, swapErrorMessage: swapErrorMessage, txHash: txHash, attemptingTxn: attemptingTxn, showConfirm: showConfirm }); + }, [attemptingTxn, showConfirm, swapErrorMessage, trade, txHash]); + var handleInputSelect = useCallback(function (inputCurrency) { + setApprovalSubmitted(false); // reset 2 step UI for approvals + onCurrencySelection(Field.INPUT, inputCurrency); + }, [onCurrencySelection]); + var handleMaxInput = useCallback(function () { + maxInputAmount && onUserInput(Field.INPUT, maxInputAmount.toExact()); + ReactGA.event({ + category: 'Swap', + action: 'Max', + }); + }, [maxInputAmount, onUserInput]); + var handleOutputSelect = useCallback(function (outputCurrency) { return onCurrencySelection(Field.OUTPUT, outputCurrency); }, [onCurrencySelection]); + var swapIsUnsupported = useIsSwapUnsupported(currencies[Field.INPUT], currencies[Field.OUTPUT]); + var priceImpactTooHigh = priceImpactSeverity > 3 && !isExpertMode; + return (jsxs(Fragment, { children: [jsx(TokenWarningModal, { isOpen: importTokensNotInDefault.length > 0 && !dismissTokenWarning, tokens: importTokensNotInDefault, onConfirm: handleConfirmTokenWarning, onDismiss: handleDismissTokenWarning }, void 0), jsxs(AppBody, { children: [jsx(SwapHeader, { allowedSlippage: allowedSlippage }, void 0), jsxs(Wrapper$g, __assign({ id: "swap-page" }, { children: [jsx(ConfirmSwapModal, { isOpen: showConfirm, trade: trade, originalTrade: tradeToConfirm, onAcceptChanges: handleAcceptChanges, attemptingTxn: attemptingTxn, txHash: txHash, recipient: recipient, allowedSlippage: allowedSlippage, onConfirm: handleSwap, swapErrorMessage: swapErrorMessage, onDismiss: handleConfirmDismiss }, void 0), jsxs(AutoColumn, __assign({ gap: 'sm' }, { children: [jsxs("div", __assign({ style: { display: 'relative' } }, { children: [jsx(CurrencyInputPanel, { label: independentField === Field.OUTPUT && !showWrap ? jsx(Trans, { children: "From (at most)" }, void 0) : jsx(Trans, { children: "From" }, void 0), value: formattedAmounts[Field.INPUT], showMaxButton: showMaxButton, currency: currencies[Field.INPUT], onUserInput: handleTypeInput, onMax: handleMaxInput, fiatValue: fiatValueInput !== null && fiatValueInput !== void 0 ? fiatValueInput : undefined, onCurrencySelect: handleInputSelect, otherCurrency: currencies[Field.OUTPUT], showCommonBases: true, id: "swap-currency-input", loading: independentField === Field.OUTPUT && routeIsSyncing }, void 0), jsx(ArrowWrapper$1, __assign({ clickable: true }, { children: jsx(ArrowDown, { size: "16", onClick: function () { + setApprovalSubmitted(false); // reset 2 step UI for approvals + onSwitchTokens(); + }, color: currencies[Field.INPUT] && currencies[Field.OUTPUT] ? theme.text1 : theme.text3 }, void 0) }), void 0), jsx(CurrencyInputPanel, { value: formattedAmounts[Field.OUTPUT], onUserInput: handleTypeOutput, label: independentField === Field.INPUT && !showWrap ? jsx(Trans, { children: "To (at least)" }, void 0) : jsx(Trans, { children: "To" }, void 0), showMaxButton: false, hideBalance: false, fiatValue: fiatValueOutput !== null && fiatValueOutput !== void 0 ? fiatValueOutput : undefined, priceImpact: priceImpact, currency: currencies[Field.OUTPUT], onCurrencySelect: handleOutputSelect, otherCurrency: currencies[Field.INPUT], showCommonBases: true, id: "swap-currency-output", loading: independentField === Field.INPUT && routeIsSyncing }, void 0)] }), void 0), recipient !== null && !showWrap ? (jsxs(Fragment, { children: [jsxs(AutoRow, __assign({ justify: "space-between", style: { padding: '0 1rem' } }, { children: [jsx(ArrowWrapper$1, __assign({ clickable: false }, { children: jsx(ArrowDown, { size: "16", color: theme.text2 }, void 0) }), void 0), jsx(LinkStyledButton, __assign({ id: "remove-recipient-button", onClick: function () { return onChangeRecipient(null); } }, { children: jsx(Trans, { children: "- Remove recipient" }, void 0) }), void 0)] }), void 0), jsx(AddressInputPanel, { id: "recipient", value: recipient, onChange: onChangeRecipient }, void 0)] }, void 0)) : null, !showWrap && userHasSpecifiedInputOutput && (trade || routeIsLoading || routeIsSyncing) && (jsx(SwapDetailsDropdown, { trade: trade, syncing: routeIsSyncing, loading: routeIsLoading, showInverted: showInverted, setShowInverted: setShowInverted, allowedSlippage: allowedSlippage }, void 0)), jsxs("div", { children: [swapIsUnsupported ? (jsx(ButtonPrimary, __assign({ disabled: true }, { children: jsx(ThemedText.Main, __assign({ mb: "4px" }, { children: jsx(Trans, { children: "Unsupported Asset" }, void 0) }), void 0) }), void 0)) : !account ? (jsx(ButtonLight, __assign({ onClick: toggleWalletModal }, { children: jsx(Trans, { children: "Connect Wallet" }, void 0) }), void 0)) : showWrap ? (jsx(ButtonPrimary, __assign({ disabled: Boolean(wrapInputError), onClick: onWrap }, { children: wrapInputError ? (jsx(WrapErrorText, { wrapInputError: wrapInputError }, void 0)) : wrapType === WrapType.WRAP ? (jsx(Trans, { children: "Wrap" }, void 0)) : wrapType === WrapType.UNWRAP ? (jsx(Trans, { children: "Unwrap" }, void 0)) : null }), void 0)) : routeNotFound && userHasSpecifiedInputOutput && !routeIsLoading && !routeIsSyncing ? (jsx(GreyCard, __assign({ style: { textAlign: 'center' } }, { children: jsx(ThemedText.Main, __assign({ mb: "4px" }, { children: jsx(Trans, { children: "Insufficient liquidity for this trade." }, void 0) }), void 0) }), void 0)) : showApproveFlow ? (jsx(AutoRow, __assign({ style: { flexWrap: 'nowrap', width: '100%' } }, { children: jsxs(AutoColumn, __assign({ style: { width: '100%' }, gap: "12px" }, { children: [jsx(ButtonConfirmed, __assign({ onClick: handleApprove, disabled: approvalState !== ApprovalState.NOT_APPROVED || + approvalSubmitted || + signatureState === UseERC20PermitState.SIGNED, width: "100%", altDisabledStyle: approvalState === ApprovalState.PENDING, confirmed: approvalState === ApprovalState.APPROVED || signatureState === UseERC20PermitState.SIGNED }, { children: jsxs(AutoRow, __assign({ justify: "space-between", style: { flexWrap: 'nowrap' } }, { children: [jsxs("span", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [jsx(CurrencyLogo, { currency: currencies[Field.INPUT], size: '20px', style: { marginRight: '8px', flexShrink: 0 } }, void 0), approvalState === ApprovalState.APPROVED || signatureState === UseERC20PermitState.SIGNED ? (jsxs(Trans, { children: ["You can now trade ", (_j = currencies[Field.INPUT]) === null || _j === void 0 ? void 0 : _j.symbol] }, void 0)) : (jsxs(Trans, { children: ["Allow the Uniswap Protocol to use your ", (_k = currencies[Field.INPUT]) === null || _k === void 0 ? void 0 : _k.symbol] }, void 0))] }), void 0), approvalState === ApprovalState.PENDING ? (jsx(Loader, { stroke: "white" }, void 0)) : (approvalSubmitted && approvalState === ApprovalState.APPROVED) || + signatureState === UseERC20PermitState.SIGNED ? (jsx(CheckCircle, { size: "20", color: theme.green1 }, void 0)) : (jsx(MouseoverTooltip, __assign({ text: jsxs(Trans, { children: ["You must give the Uniswap smart contracts permission to use your", ' ', (_l = currencies[Field.INPUT]) === null || _l === void 0 ? void 0 : _l.symbol, ". You only have to do this once per token."] }, void 0) }, { children: jsx(HelpCircle, { size: "20", color: 'white', style: { marginLeft: '8px' } }, void 0) }), void 0))] }), void 0) }), void 0), jsx(ButtonError, __assign({ onClick: function () { + if (isExpertMode) { + handleSwap(); + } + else { + setSwapState({ + tradeToConfirm: trade, + attemptingTxn: false, + swapErrorMessage: undefined, + showConfirm: true, + txHash: undefined, + }); + } + }, width: "100%", id: "swap-button", disabled: !isValid || + routeIsSyncing || + routeIsLoading || + (approvalState !== ApprovalState.APPROVED && signatureState !== UseERC20PermitState.SIGNED) || + priceImpactTooHigh, error: isValid && priceImpactSeverity > 2 }, { children: jsx(Text$1, __assign({ fontSize: 16, fontWeight: 500 }, { children: priceImpactTooHigh ? (jsx(Trans, { children: "High Price Impact" }, void 0)) : trade && priceImpactSeverity > 2 ? (jsx(Trans, { children: "Swap Anyway" }, void 0)) : (jsx(Trans, { children: "Swap" }, void 0)) }), void 0) }), void 0)] }), void 0) }), void 0)) : (jsx(ButtonError, __assign({ onClick: function () { + if (isExpertMode) { + handleSwap(); + } + else { + setSwapState({ + tradeToConfirm: trade, + attemptingTxn: false, + swapErrorMessage: undefined, + showConfirm: true, + txHash: undefined, + }); + } + }, id: "swap-button", disabled: !isValid || routeIsSyncing || routeIsLoading || priceImpactTooHigh || !!swapCallbackError, error: isValid && priceImpactSeverity > 2 && !swapCallbackError }, { children: jsx(Text$1, __assign({ fontSize: 20, fontWeight: 500 }, { children: swapInputError ? (swapInputError) : routeIsSyncing || routeIsLoading ? (jsx(Trans, { children: "Swap" }, void 0)) : priceImpactSeverity > 2 ? (jsx(Trans, { children: "Swap Anyway" }, void 0)) : priceImpactTooHigh ? (jsx(Trans, { children: "Price Impact Too High" }, void 0)) : (jsx(Trans, { children: "Swap" }, void 0)) }), void 0) }), void 0)), isExpertMode && swapErrorMessage ? jsx(SwapCallbackError, { error: swapErrorMessage }, void 0) : null] }, void 0)] }), void 0)] }), void 0)] }, void 0), jsx(AlertWrapper, { children: jsx(NetworkAlert, {}, void 0) }, void 0), jsx(SwitchLocaleLink, {}, void 0), !swapIsUnsupported ? null : (jsx(UnsupportedCurrencyFooter, { show: swapIsUnsupported, currencies: [currencies[Field.INPUT], currencies[Field.OUTPUT]] }, void 0))] }, void 0)); +} +var templateObject_1$2; + +// Redirects to swap but only replace the pathname +function RedirectPathToSwapOnly(_a) { + var location = _a.location; + return jsx(Redirect, { to: __assign(__assign({}, location), { pathname: '/swap' }) }, void 0); +} +// Redirects from the /swap/:outputCurrency path to the /swap?outputCurrency=:outputCurrency format +function RedirectToSwap(props) { + var search = props.location.search, outputCurrency = props.match.params.outputCurrency; + return (jsx(Redirect, { to: __assign(__assign({}, props.location), { pathname: '/swap', search: search && search.length > 1 + ? search + "&outputCurrency=" + outputCurrency + : "?outputCurrency=" + outputCurrency }) }, void 0)); +} + +// const Vote = lazy(() => import('./Vote')) +var AppWrapper = styled.div(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n align-items: flex-start;\n"], ["\n display: flex;\n flex-flow: column;\n align-items: flex-start;\n"]))); +var BodyWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 120px 16px 0px 16px;\n align-items: center;\n flex: 1;\n z-index: 1;\n\n ", ";\n"], ["\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 120px 16px 0px 16px;\n align-items: center;\n flex: 1;\n z-index: 1;\n\n ", ";\n"])), function (_a) { + var theme = _a.theme; + return theme.mediaWidth.upToSmall(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 4rem 8px 16px 8px;\n "], ["\n padding: 4rem 8px 16px 8px;\n "]))); +}); +var HeaderWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n width: 100%;\n justify-content: space-between;\n position: fixed;\n top: 0;\n z-index: 2;\n"], ["\n ", "\n width: 100%;\n justify-content: space-between;\n position: fixed;\n top: 0;\n z-index: 2;\n"])), function (_a) { + var theme = _a.theme; + return theme.flexRowNoWrap; +}); +var Marginer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-top: 5rem;\n"], ["\n margin-top: 5rem;\n"]))); +function TopLevelModals() { + var open = useModalOpen(ApplicationModal.ADDRESS_CLAIM); + var toggle = useToggleModal(ApplicationModal.ADDRESS_CLAIM); + return jsx(AddressClaimModal, { isOpen: open, onDismiss: toggle }, void 0); +} +function App() { + return (jsxs(ErrorBoundary, { children: [jsx(Route$3, { component: DarkModeQueryParamReader }, void 0), jsx(Route$3, { component: ApeModeQueryParamReader }, void 0), jsx(Web3ReactManager, { children: jsxs(AppWrapper, { children: [jsx(HeaderWrapper, { children: jsx(Header$2, {}, void 0) }, void 0), jsxs(BodyWrapper, { children: [jsx(Popups, {}, void 0), jsx(Polling, {}, void 0), jsx(TopLevelModals, {}, void 0), jsx(Suspense, __assign({ fallback: jsx(Loader, {}, void 0) }, { children: jsxs(Switch, { children: [jsx(Route$3, { exact: true, strict: true, path: "/swap/:outputCurrency", component: RedirectToSwap }, void 0), jsx(Route$3, { exact: true, strict: true, path: "/swap", component: Swap }, void 0), jsx(Route$3, { component: RedirectPathToSwapOnly }, void 0)] }, void 0) }), void 0), jsx(Marginer, {}, void 0)] }, void 0)] }, void 0) }, void 0)] }, void 0)); +} +var templateObject_1$1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +// This optional code is used to register a service worker. +// register() is not called by default. +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on subsequent visits to a page, after all the +// existing tabs open on the page have been closed, since previously cached +// resources are updated in the background. +// To learn more about the benefits of this model and instructions on how to +// opt-in, read https://cra.link/PWA +var isLocalhost = Boolean(window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.0/8 are considered localhost for IPv4. + window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)); +function registerValidSW(swUrl, config) { + navigator.serviceWorker + .register(swUrl) + .then(function (registration) { + registration.onupdatefound = function () { + var installingWorker = registration.installing; + if (installingWorker == null) { + return; + } + installingWorker.onstatechange = function () { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the updated precached content has been fetched, + // but the previous service worker will still serve the older + // content until all client tabs are closed. + console.log('New content is available and will be used when all ' + + 'tabs for this page are closed. See https://cra.link/PWA.'); + // Execute callback + if (config && config.onUpdate) { + config.onUpdate(registration); + } + } + else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); + // Execute callback + if (config && config.onSuccess) { + config.onSuccess(registration); + } + } + } + }; + }; + }) + .catch(function (error) { + console.error('Error during service worker registration:', error); + }); +} +function checkValidServiceWorker(swUrl, config) { + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl, { + headers: { 'Service-Worker': 'script' }, + }) + .then(function (response) { + // Ensure service worker exists, and that we really are getting a JS file. + var contentType = response.headers.get('content-type'); + if (response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1)) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then(function (registration) { + registration.unregister().then(function () { + window.location.reload(); + }); + }); + } + else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl, config); + } + }) + .catch(function () { + console.log('No internet connection found. App is running in offline mode.'); + }); +} +function register(config) { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + // The URL constructor is available in all browsers that support SW. + var publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebook/create-react-app/issues/2374 + return; + } + window.addEventListener('load', function () { + var swUrl = process.env.PUBLIC_URL + "/service-worker.js"; + if (isLocalhost) { + // This is running on localhost. Let's check if a service worker still exists or not. + checkValidServiceWorker(swUrl, config); + // Add some additional logging to localhost, pointing developers to the + // service worker/PWA documentation. + navigator.serviceWorker.ready.then(function () { + console.log('This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://cra.link/PWA'); + }); + } + else { + // Is not localhost. Just register service worker + registerValidSW(swUrl, config); + } + }); + } +} +function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready + .then(function (registration) { + registration.unregister(); + }) + .catch(function (error) { + console.error(error.message); + }); + } +} + +var serviceWorkerRegistration = /*#__PURE__*/Object.freeze({ + __proto__: null, + register: register, + unregister: unregister +}); + +// SDN OFAC addresses +var BLOCKED_ADDRESSES = [ + '0x7Db418b5D567A4e0E8c59Ad71BE1FcE48f3E6107', + '0x72a5843cc08275C8171E582972Aa4fDa8C397B2A', + '0x7F19720A857F834887FC9A7bC0a0fBe7Fc7f8102', + '0xA7e5d5A720f06526557c513402f2e6B5fA20b008', + '0x1da5821544e25c636c1417Ba96Ade4Cf6D2f9B5A', + '0x9F4cda013E354b8fC285BF4b9A60460cEe7f7Ea9', + '0x19Aa5Fe80D33a56D56c78e82eA5E50E5d80b4Dff', + '0x2f389cE8bD8ff92De3402FFCe4691d17fC4f6535', + '0xe7aa314c77F4233C18C6CC84384A9247c0cf367B', + '0x7F367cC41522cE07553e823bf3be79A889DEbe1B', + '0xd882cFc20F52f2599D84b8e8D58C7FB62cfE344b', + '0x901bb9583b24D97e995513C6778dc6888AB6870e', + '0x8576aCC5C05D6Ce88f4e49bf65BdF0C62F91353C', + '0xC8a65Fadf0e0dDAf421F28FEAb69Bf6E2E589963', + '0x308eD4B7b49797e1A98D3818bFF6fe5385410370', + '0x67d40EE1A85bf4a4Bb7Ffae16De985e8427B', + '0x6f1ca141a28907f78ebaa64fb83a9088b02a83', + '0x6acdfba02d390b97ac2b2d42a63e85293bcc1', + '0x48549a34ae37b12f6a30566245176994e17c6', + '0x5512d943ed1f7c8a43f3435c85f7ab68b30121', + '0xc455f7fd3e0e12afd51fba5c106909934d8a0e', + '0x3cbded43efdaf0fc77b9c55f6fc9988fcc9b757d', + '0x67d40EE1A85bf4a4Bb7Ffae16De985e8427B6b45', + '0x6f1ca141a28907f78ebaa64fb83a9088b02a8352', + '0x6acdfba02d390b97ac2b2d42a63e85293bcc160e', + '0x48549a34ae37b12f6a30566245176994e17c6b4a', + '0x5512d943ed1f7c8a43f3435c85f7ab68b30121b0', + '0xc455f7fd3e0e12afd51fba5c106909934d8a0e4a', +]; +function Blocklist(_a) { + var children = _a.children; + var account = useActiveWeb3React().account; + var blocked = useMemo(function () { return Boolean(account && BLOCKED_ADDRESSES.indexOf(account) !== -1); }, [account]); + if (blocked) { + return (jsx("div", { children: jsx(Trans, { children: "Blocked address" }, void 0) }, void 0)); + } + return jsx(Fragment, { children: children }, void 0); +} + +var plurals = { + 'af-ZA': af, + 'ar-SA': ar, + 'ca-ES': ca, + 'cs-CZ': cs, + 'da-DK': da, + 'de-DE': de, + 'el-GR': el, + 'en-US': en, + 'es-ES': es, + 'fi-FI': fi, + 'fr-FR': fr, + 'he-IL': he, + 'hu-HU': hu, + 'id-ID': id, + 'it-IT': it, + 'ja-JP': ja, + 'ko-KR': ko, + 'nl-NL': nl, + 'no-NO': no, + 'pl-PL': pl, + 'pt-BR': pt, + 'pt-PT': pt, + 'ro-RO': ro, + 'ru-RU': ru, + 'sr-SP': sr, + 'sv-SE': sv, + 'sw-TZ': sw, + 'tr-TR': tr, + 'uk-UA': uk, + 'vi-VN': vi, + 'zh-CN': zh, + 'zh-TW': zh, + pseudo: en, +}; +function dynamicActivate(locale) { + return __awaiter(this, void 0, void 0, function () { + var catalog, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + i18n.loadLocaleData(locale, { plurals: function () { return plurals[locale]; } }); + if (!(locale === DEFAULT_LOCALE)) return [3 /*break*/, 1]; + _a = DEFAULT_CATALOG; + return [3 /*break*/, 3]; + case 1: return [4 /*yield*/, import("locales/" + locale)]; + case 2: + _a = _b.sent(); + _b.label = 3; + case 3: + catalog = _a; + i18n.load(locale, catalog.messages); + i18n.activate(locale); + return [2 /*return*/]; + } + }); + }); +} +function Provider(_a) { + var locale = _a.locale, _b = _a.forceRenderAfterLocaleChange, forceRenderAfterLocaleChange = _b === void 0 ? true : _b, onActivate = _a.onActivate, children = _a.children; + useEffect(function () { + dynamicActivate(locale) + .then(function () { return onActivate === null || onActivate === void 0 ? void 0 : onActivate(locale); }) + .catch(function (error) { + console.error('Failed to activate locale', locale, error); + }); + }, [locale, onActivate]); + return (jsx(I18nProvider, __assign({ forceRenderOnLocaleChange: forceRenderAfterLocaleChange, i18n: i18n }, { children: children }), void 0)); +} + +dynamicActivate(initialLocale); +function LanguageProvider(_a) { + var children = _a.children; + var locale = useActiveLocale(); + var _b = __read(useUserLocaleManager(), 2), setUserLocale = _b[1]; + var onActivate = useCallback(function (locale) { + document.documentElement.setAttribute('lang', locale); + setUserLocale(locale); // stores the selected locale to persist across sessions + }, [setUserLocale]); + return (jsx(Provider, __assign({ locale: locale, forceRenderAfterLocaleChange: false, onActivate: onActivate }, { children: children }), void 0)); +} + +var Bundle_OrderBy; +(function (Bundle_OrderBy) { + Bundle_OrderBy["Id"] = "id"; + Bundle_OrderBy["EthPriceUsd"] = "ethPriceUSD"; +})(Bundle_OrderBy || (Bundle_OrderBy = {})); +var Burn_OrderBy; +(function (Burn_OrderBy) { + Burn_OrderBy["Id"] = "id"; + Burn_OrderBy["Transaction"] = "transaction"; + Burn_OrderBy["Pool"] = "pool"; + Burn_OrderBy["Token0"] = "token0"; + Burn_OrderBy["Token1"] = "token1"; + Burn_OrderBy["Timestamp"] = "timestamp"; + Burn_OrderBy["Owner"] = "owner"; + Burn_OrderBy["Origin"] = "origin"; + Burn_OrderBy["Amount"] = "amount"; + Burn_OrderBy["Amount0"] = "amount0"; + Burn_OrderBy["Amount1"] = "amount1"; + Burn_OrderBy["AmountUsd"] = "amountUSD"; + Burn_OrderBy["TickLower"] = "tickLower"; + Burn_OrderBy["TickUpper"] = "tickUpper"; + Burn_OrderBy["LogIndex"] = "logIndex"; +})(Burn_OrderBy || (Burn_OrderBy = {})); +var Collect_OrderBy; +(function (Collect_OrderBy) { + Collect_OrderBy["Id"] = "id"; + Collect_OrderBy["Transaction"] = "transaction"; + Collect_OrderBy["Timestamp"] = "timestamp"; + Collect_OrderBy["Pool"] = "pool"; + Collect_OrderBy["Owner"] = "owner"; + Collect_OrderBy["Amount0"] = "amount0"; + Collect_OrderBy["Amount1"] = "amount1"; + Collect_OrderBy["AmountUsd"] = "amountUSD"; + Collect_OrderBy["TickLower"] = "tickLower"; + Collect_OrderBy["TickUpper"] = "tickUpper"; + Collect_OrderBy["LogIndex"] = "logIndex"; +})(Collect_OrderBy || (Collect_OrderBy = {})); +var Factory_OrderBy; +(function (Factory_OrderBy) { + Factory_OrderBy["Id"] = "id"; + Factory_OrderBy["PoolCount"] = "poolCount"; + Factory_OrderBy["TxCount"] = "txCount"; + Factory_OrderBy["TotalVolumeUsd"] = "totalVolumeUSD"; + Factory_OrderBy["TotalVolumeEth"] = "totalVolumeETH"; + Factory_OrderBy["TotalFeesUsd"] = "totalFeesUSD"; + Factory_OrderBy["TotalFeesEth"] = "totalFeesETH"; + Factory_OrderBy["UntrackedVolumeUsd"] = "untrackedVolumeUSD"; + Factory_OrderBy["TotalValueLockedUsd"] = "totalValueLockedUSD"; + Factory_OrderBy["TotalValueLockedEth"] = "totalValueLockedETH"; + Factory_OrderBy["TotalValueLockedUsdUntracked"] = "totalValueLockedUSDUntracked"; + Factory_OrderBy["TotalValueLockedEthUntracked"] = "totalValueLockedETHUntracked"; + Factory_OrderBy["Owner"] = "owner"; +})(Factory_OrderBy || (Factory_OrderBy = {})); +var Flash_OrderBy; +(function (Flash_OrderBy) { + Flash_OrderBy["Id"] = "id"; + Flash_OrderBy["Transaction"] = "transaction"; + Flash_OrderBy["Timestamp"] = "timestamp"; + Flash_OrderBy["Pool"] = "pool"; + Flash_OrderBy["Sender"] = "sender"; + Flash_OrderBy["Recipient"] = "recipient"; + Flash_OrderBy["Amount0"] = "amount0"; + Flash_OrderBy["Amount1"] = "amount1"; + Flash_OrderBy["AmountUsd"] = "amountUSD"; + Flash_OrderBy["Amount0Paid"] = "amount0Paid"; + Flash_OrderBy["Amount1Paid"] = "amount1Paid"; + Flash_OrderBy["LogIndex"] = "logIndex"; +})(Flash_OrderBy || (Flash_OrderBy = {})); +var Mint_OrderBy; +(function (Mint_OrderBy) { + Mint_OrderBy["Id"] = "id"; + Mint_OrderBy["Transaction"] = "transaction"; + Mint_OrderBy["Timestamp"] = "timestamp"; + Mint_OrderBy["Pool"] = "pool"; + Mint_OrderBy["Token0"] = "token0"; + Mint_OrderBy["Token1"] = "token1"; + Mint_OrderBy["Owner"] = "owner"; + Mint_OrderBy["Sender"] = "sender"; + Mint_OrderBy["Origin"] = "origin"; + Mint_OrderBy["Amount"] = "amount"; + Mint_OrderBy["Amount0"] = "amount0"; + Mint_OrderBy["Amount1"] = "amount1"; + Mint_OrderBy["AmountUsd"] = "amountUSD"; + Mint_OrderBy["TickLower"] = "tickLower"; + Mint_OrderBy["TickUpper"] = "tickUpper"; + Mint_OrderBy["LogIndex"] = "logIndex"; +})(Mint_OrderBy || (Mint_OrderBy = {})); +var OrderDirection; +(function (OrderDirection) { + OrderDirection["Asc"] = "asc"; + OrderDirection["Desc"] = "desc"; +})(OrderDirection || (OrderDirection = {})); +var PoolDayData_OrderBy; +(function (PoolDayData_OrderBy) { + PoolDayData_OrderBy["Id"] = "id"; + PoolDayData_OrderBy["Date"] = "date"; + PoolDayData_OrderBy["Pool"] = "pool"; + PoolDayData_OrderBy["Liquidity"] = "liquidity"; + PoolDayData_OrderBy["SqrtPrice"] = "sqrtPrice"; + PoolDayData_OrderBy["Token0Price"] = "token0Price"; + PoolDayData_OrderBy["Token1Price"] = "token1Price"; + PoolDayData_OrderBy["Tick"] = "tick"; + PoolDayData_OrderBy["FeeGrowthGlobal0X128"] = "feeGrowthGlobal0X128"; + PoolDayData_OrderBy["FeeGrowthGlobal1X128"] = "feeGrowthGlobal1X128"; + PoolDayData_OrderBy["TvlUsd"] = "tvlUSD"; + PoolDayData_OrderBy["VolumeToken0"] = "volumeToken0"; + PoolDayData_OrderBy["VolumeToken1"] = "volumeToken1"; + PoolDayData_OrderBy["VolumeUsd"] = "volumeUSD"; + PoolDayData_OrderBy["FeesUsd"] = "feesUSD"; + PoolDayData_OrderBy["TxCount"] = "txCount"; + PoolDayData_OrderBy["Open"] = "open"; + PoolDayData_OrderBy["High"] = "high"; + PoolDayData_OrderBy["Low"] = "low"; + PoolDayData_OrderBy["Close"] = "close"; +})(PoolDayData_OrderBy || (PoolDayData_OrderBy = {})); +var PoolHourData_OrderBy; +(function (PoolHourData_OrderBy) { + PoolHourData_OrderBy["Id"] = "id"; + PoolHourData_OrderBy["PeriodStartUnix"] = "periodStartUnix"; + PoolHourData_OrderBy["Pool"] = "pool"; + PoolHourData_OrderBy["Liquidity"] = "liquidity"; + PoolHourData_OrderBy["SqrtPrice"] = "sqrtPrice"; + PoolHourData_OrderBy["Token0Price"] = "token0Price"; + PoolHourData_OrderBy["Token1Price"] = "token1Price"; + PoolHourData_OrderBy["Tick"] = "tick"; + PoolHourData_OrderBy["FeeGrowthGlobal0X128"] = "feeGrowthGlobal0X128"; + PoolHourData_OrderBy["FeeGrowthGlobal1X128"] = "feeGrowthGlobal1X128"; + PoolHourData_OrderBy["TvlUsd"] = "tvlUSD"; + PoolHourData_OrderBy["VolumeToken0"] = "volumeToken0"; + PoolHourData_OrderBy["VolumeToken1"] = "volumeToken1"; + PoolHourData_OrderBy["VolumeUsd"] = "volumeUSD"; + PoolHourData_OrderBy["FeesUsd"] = "feesUSD"; + PoolHourData_OrderBy["TxCount"] = "txCount"; + PoolHourData_OrderBy["Open"] = "open"; + PoolHourData_OrderBy["High"] = "high"; + PoolHourData_OrderBy["Low"] = "low"; + PoolHourData_OrderBy["Close"] = "close"; +})(PoolHourData_OrderBy || (PoolHourData_OrderBy = {})); +var Pool_OrderBy; +(function (Pool_OrderBy) { + Pool_OrderBy["Id"] = "id"; + Pool_OrderBy["CreatedAtTimestamp"] = "createdAtTimestamp"; + Pool_OrderBy["CreatedAtBlockNumber"] = "createdAtBlockNumber"; + Pool_OrderBy["Token0"] = "token0"; + Pool_OrderBy["Token1"] = "token1"; + Pool_OrderBy["FeeTier"] = "feeTier"; + Pool_OrderBy["Liquidity"] = "liquidity"; + Pool_OrderBy["SqrtPrice"] = "sqrtPrice"; + Pool_OrderBy["FeeGrowthGlobal0X128"] = "feeGrowthGlobal0X128"; + Pool_OrderBy["FeeGrowthGlobal1X128"] = "feeGrowthGlobal1X128"; + Pool_OrderBy["Token0Price"] = "token0Price"; + Pool_OrderBy["Token1Price"] = "token1Price"; + Pool_OrderBy["Tick"] = "tick"; + Pool_OrderBy["ObservationIndex"] = "observationIndex"; + Pool_OrderBy["VolumeToken0"] = "volumeToken0"; + Pool_OrderBy["VolumeToken1"] = "volumeToken1"; + Pool_OrderBy["VolumeUsd"] = "volumeUSD"; + Pool_OrderBy["UntrackedVolumeUsd"] = "untrackedVolumeUSD"; + Pool_OrderBy["FeesUsd"] = "feesUSD"; + Pool_OrderBy["TxCount"] = "txCount"; + Pool_OrderBy["CollectedFeesToken0"] = "collectedFeesToken0"; + Pool_OrderBy["CollectedFeesToken1"] = "collectedFeesToken1"; + Pool_OrderBy["CollectedFeesUsd"] = "collectedFeesUSD"; + Pool_OrderBy["TotalValueLockedToken0"] = "totalValueLockedToken0"; + Pool_OrderBy["TotalValueLockedToken1"] = "totalValueLockedToken1"; + Pool_OrderBy["TotalValueLockedEth"] = "totalValueLockedETH"; + Pool_OrderBy["TotalValueLockedUsd"] = "totalValueLockedUSD"; + Pool_OrderBy["TotalValueLockedUsdUntracked"] = "totalValueLockedUSDUntracked"; + Pool_OrderBy["LiquidityProviderCount"] = "liquidityProviderCount"; + Pool_OrderBy["PoolHourData"] = "poolHourData"; + Pool_OrderBy["PoolDayData"] = "poolDayData"; + Pool_OrderBy["Mints"] = "mints"; + Pool_OrderBy["Burns"] = "burns"; + Pool_OrderBy["Swaps"] = "swaps"; + Pool_OrderBy["Collects"] = "collects"; + Pool_OrderBy["Ticks"] = "ticks"; +})(Pool_OrderBy || (Pool_OrderBy = {})); +var PositionSnapshot_OrderBy; +(function (PositionSnapshot_OrderBy) { + PositionSnapshot_OrderBy["Id"] = "id"; + PositionSnapshot_OrderBy["Owner"] = "owner"; + PositionSnapshot_OrderBy["Pool"] = "pool"; + PositionSnapshot_OrderBy["Position"] = "position"; + PositionSnapshot_OrderBy["BlockNumber"] = "blockNumber"; + PositionSnapshot_OrderBy["Timestamp"] = "timestamp"; + PositionSnapshot_OrderBy["Liquidity"] = "liquidity"; + PositionSnapshot_OrderBy["DepositedToken0"] = "depositedToken0"; + PositionSnapshot_OrderBy["DepositedToken1"] = "depositedToken1"; + PositionSnapshot_OrderBy["WithdrawnToken0"] = "withdrawnToken0"; + PositionSnapshot_OrderBy["WithdrawnToken1"] = "withdrawnToken1"; + PositionSnapshot_OrderBy["CollectedFeesToken0"] = "collectedFeesToken0"; + PositionSnapshot_OrderBy["CollectedFeesToken1"] = "collectedFeesToken1"; + PositionSnapshot_OrderBy["Transaction"] = "transaction"; + PositionSnapshot_OrderBy["FeeGrowthInside0LastX128"] = "feeGrowthInside0LastX128"; + PositionSnapshot_OrderBy["FeeGrowthInside1LastX128"] = "feeGrowthInside1LastX128"; +})(PositionSnapshot_OrderBy || (PositionSnapshot_OrderBy = {})); +var Position_OrderBy; +(function (Position_OrderBy) { + Position_OrderBy["Id"] = "id"; + Position_OrderBy["Owner"] = "owner"; + Position_OrderBy["Pool"] = "pool"; + Position_OrderBy["Token0"] = "token0"; + Position_OrderBy["Token1"] = "token1"; + Position_OrderBy["TickLower"] = "tickLower"; + Position_OrderBy["TickUpper"] = "tickUpper"; + Position_OrderBy["Liquidity"] = "liquidity"; + Position_OrderBy["DepositedToken0"] = "depositedToken0"; + Position_OrderBy["DepositedToken1"] = "depositedToken1"; + Position_OrderBy["WithdrawnToken0"] = "withdrawnToken0"; + Position_OrderBy["WithdrawnToken1"] = "withdrawnToken1"; + Position_OrderBy["CollectedFeesToken0"] = "collectedFeesToken0"; + Position_OrderBy["CollectedFeesToken1"] = "collectedFeesToken1"; + Position_OrderBy["Transaction"] = "transaction"; + Position_OrderBy["FeeGrowthInside0LastX128"] = "feeGrowthInside0LastX128"; + Position_OrderBy["FeeGrowthInside1LastX128"] = "feeGrowthInside1LastX128"; +})(Position_OrderBy || (Position_OrderBy = {})); +var Swap_OrderBy; +(function (Swap_OrderBy) { + Swap_OrderBy["Id"] = "id"; + Swap_OrderBy["Transaction"] = "transaction"; + Swap_OrderBy["Timestamp"] = "timestamp"; + Swap_OrderBy["Pool"] = "pool"; + Swap_OrderBy["Token0"] = "token0"; + Swap_OrderBy["Token1"] = "token1"; + Swap_OrderBy["Sender"] = "sender"; + Swap_OrderBy["Recipient"] = "recipient"; + Swap_OrderBy["Origin"] = "origin"; + Swap_OrderBy["Amount0"] = "amount0"; + Swap_OrderBy["Amount1"] = "amount1"; + Swap_OrderBy["AmountUsd"] = "amountUSD"; + Swap_OrderBy["SqrtPriceX96"] = "sqrtPriceX96"; + Swap_OrderBy["Tick"] = "tick"; + Swap_OrderBy["LogIndex"] = "logIndex"; +})(Swap_OrderBy || (Swap_OrderBy = {})); +var TickDayData_OrderBy; +(function (TickDayData_OrderBy) { + TickDayData_OrderBy["Id"] = "id"; + TickDayData_OrderBy["Date"] = "date"; + TickDayData_OrderBy["Pool"] = "pool"; + TickDayData_OrderBy["Tick"] = "tick"; + TickDayData_OrderBy["LiquidityGross"] = "liquidityGross"; + TickDayData_OrderBy["LiquidityNet"] = "liquidityNet"; + TickDayData_OrderBy["VolumeToken0"] = "volumeToken0"; + TickDayData_OrderBy["VolumeToken1"] = "volumeToken1"; + TickDayData_OrderBy["VolumeUsd"] = "volumeUSD"; + TickDayData_OrderBy["FeesUsd"] = "feesUSD"; + TickDayData_OrderBy["FeeGrowthOutside0X128"] = "feeGrowthOutside0X128"; + TickDayData_OrderBy["FeeGrowthOutside1X128"] = "feeGrowthOutside1X128"; +})(TickDayData_OrderBy || (TickDayData_OrderBy = {})); +var TickHourData_OrderBy; +(function (TickHourData_OrderBy) { + TickHourData_OrderBy["Id"] = "id"; + TickHourData_OrderBy["PeriodStartUnix"] = "periodStartUnix"; + TickHourData_OrderBy["Pool"] = "pool"; + TickHourData_OrderBy["Tick"] = "tick"; + TickHourData_OrderBy["LiquidityGross"] = "liquidityGross"; + TickHourData_OrderBy["LiquidityNet"] = "liquidityNet"; + TickHourData_OrderBy["VolumeToken0"] = "volumeToken0"; + TickHourData_OrderBy["VolumeToken1"] = "volumeToken1"; + TickHourData_OrderBy["VolumeUsd"] = "volumeUSD"; + TickHourData_OrderBy["FeesUsd"] = "feesUSD"; +})(TickHourData_OrderBy || (TickHourData_OrderBy = {})); +var Tick_OrderBy; +(function (Tick_OrderBy) { + Tick_OrderBy["Id"] = "id"; + Tick_OrderBy["PoolAddress"] = "poolAddress"; + Tick_OrderBy["TickIdx"] = "tickIdx"; + Tick_OrderBy["Pool"] = "pool"; + Tick_OrderBy["LiquidityGross"] = "liquidityGross"; + Tick_OrderBy["LiquidityNet"] = "liquidityNet"; + Tick_OrderBy["Price0"] = "price0"; + Tick_OrderBy["Price1"] = "price1"; + Tick_OrderBy["VolumeToken0"] = "volumeToken0"; + Tick_OrderBy["VolumeToken1"] = "volumeToken1"; + Tick_OrderBy["VolumeUsd"] = "volumeUSD"; + Tick_OrderBy["UntrackedVolumeUsd"] = "untrackedVolumeUSD"; + Tick_OrderBy["FeesUsd"] = "feesUSD"; + Tick_OrderBy["CollectedFeesToken0"] = "collectedFeesToken0"; + Tick_OrderBy["CollectedFeesToken1"] = "collectedFeesToken1"; + Tick_OrderBy["CollectedFeesUsd"] = "collectedFeesUSD"; + Tick_OrderBy["CreatedAtTimestamp"] = "createdAtTimestamp"; + Tick_OrderBy["CreatedAtBlockNumber"] = "createdAtBlockNumber"; + Tick_OrderBy["LiquidityProviderCount"] = "liquidityProviderCount"; + Tick_OrderBy["FeeGrowthOutside0X128"] = "feeGrowthOutside0X128"; + Tick_OrderBy["FeeGrowthOutside1X128"] = "feeGrowthOutside1X128"; +})(Tick_OrderBy || (Tick_OrderBy = {})); +var TokenDayData_OrderBy; +(function (TokenDayData_OrderBy) { + TokenDayData_OrderBy["Id"] = "id"; + TokenDayData_OrderBy["Date"] = "date"; + TokenDayData_OrderBy["Token"] = "token"; + TokenDayData_OrderBy["Volume"] = "volume"; + TokenDayData_OrderBy["VolumeUsd"] = "volumeUSD"; + TokenDayData_OrderBy["UntrackedVolumeUsd"] = "untrackedVolumeUSD"; + TokenDayData_OrderBy["TotalValueLocked"] = "totalValueLocked"; + TokenDayData_OrderBy["TotalValueLockedUsd"] = "totalValueLockedUSD"; + TokenDayData_OrderBy["PriceUsd"] = "priceUSD"; + TokenDayData_OrderBy["FeesUsd"] = "feesUSD"; + TokenDayData_OrderBy["Open"] = "open"; + TokenDayData_OrderBy["High"] = "high"; + TokenDayData_OrderBy["Low"] = "low"; + TokenDayData_OrderBy["Close"] = "close"; +})(TokenDayData_OrderBy || (TokenDayData_OrderBy = {})); +var TokenHourData_OrderBy; +(function (TokenHourData_OrderBy) { + TokenHourData_OrderBy["Id"] = "id"; + TokenHourData_OrderBy["PeriodStartUnix"] = "periodStartUnix"; + TokenHourData_OrderBy["Token"] = "token"; + TokenHourData_OrderBy["Volume"] = "volume"; + TokenHourData_OrderBy["VolumeUsd"] = "volumeUSD"; + TokenHourData_OrderBy["UntrackedVolumeUsd"] = "untrackedVolumeUSD"; + TokenHourData_OrderBy["TotalValueLocked"] = "totalValueLocked"; + TokenHourData_OrderBy["TotalValueLockedUsd"] = "totalValueLockedUSD"; + TokenHourData_OrderBy["PriceUsd"] = "priceUSD"; + TokenHourData_OrderBy["FeesUsd"] = "feesUSD"; + TokenHourData_OrderBy["Open"] = "open"; + TokenHourData_OrderBy["High"] = "high"; + TokenHourData_OrderBy["Low"] = "low"; + TokenHourData_OrderBy["Close"] = "close"; +})(TokenHourData_OrderBy || (TokenHourData_OrderBy = {})); +var Token_OrderBy; +(function (Token_OrderBy) { + Token_OrderBy["Id"] = "id"; + Token_OrderBy["Symbol"] = "symbol"; + Token_OrderBy["Name"] = "name"; + Token_OrderBy["Decimals"] = "decimals"; + Token_OrderBy["TotalSupply"] = "totalSupply"; + Token_OrderBy["Volume"] = "volume"; + Token_OrderBy["VolumeUsd"] = "volumeUSD"; + Token_OrderBy["UntrackedVolumeUsd"] = "untrackedVolumeUSD"; + Token_OrderBy["FeesUsd"] = "feesUSD"; + Token_OrderBy["TxCount"] = "txCount"; + Token_OrderBy["PoolCount"] = "poolCount"; + Token_OrderBy["TotalValueLocked"] = "totalValueLocked"; + Token_OrderBy["TotalValueLockedUsd"] = "totalValueLockedUSD"; + Token_OrderBy["TotalValueLockedUsdUntracked"] = "totalValueLockedUSDUntracked"; + Token_OrderBy["DerivedEth"] = "derivedETH"; + Token_OrderBy["WhitelistPools"] = "whitelistPools"; + Token_OrderBy["TokenDayData"] = "tokenDayData"; +})(Token_OrderBy || (Token_OrderBy = {})); +var Transaction_OrderBy; +(function (Transaction_OrderBy) { + Transaction_OrderBy["Id"] = "id"; + Transaction_OrderBy["BlockNumber"] = "blockNumber"; + Transaction_OrderBy["Timestamp"] = "timestamp"; + Transaction_OrderBy["GasUsed"] = "gasUsed"; + Transaction_OrderBy["GasPrice"] = "gasPrice"; + Transaction_OrderBy["Mints"] = "mints"; + Transaction_OrderBy["Burns"] = "burns"; + Transaction_OrderBy["Swaps"] = "swaps"; + Transaction_OrderBy["Flashed"] = "flashed"; + Transaction_OrderBy["Collects"] = "collects"; +})(Transaction_OrderBy || (Transaction_OrderBy = {})); +var UniswapDayData_OrderBy; +(function (UniswapDayData_OrderBy) { + UniswapDayData_OrderBy["Id"] = "id"; + UniswapDayData_OrderBy["Date"] = "date"; + UniswapDayData_OrderBy["VolumeEth"] = "volumeETH"; + UniswapDayData_OrderBy["VolumeUsd"] = "volumeUSD"; + UniswapDayData_OrderBy["VolumeUsdUntracked"] = "volumeUSDUntracked"; + UniswapDayData_OrderBy["FeesUsd"] = "feesUSD"; + UniswapDayData_OrderBy["TxCount"] = "txCount"; + UniswapDayData_OrderBy["TvlUsd"] = "tvlUSD"; +})(UniswapDayData_OrderBy || (UniswapDayData_OrderBy = {})); +var _SubgraphErrorPolicy_; +(function (_SubgraphErrorPolicy_) { + /** Data will be returned even if the subgraph has indexing errors */ + _SubgraphErrorPolicy_["Allow"] = "allow"; + /** If the subgraph has indexing errors, data will be omitted. The default. */ + _SubgraphErrorPolicy_["Deny"] = "deny"; +})(_SubgraphErrorPolicy_ || (_SubgraphErrorPolicy_ = {})); +var AllV3TicksDocument = "\n query allV3Ticks($poolAddress: String!, $skip: Int!) {\n ticks(\n first: 1000\n skip: $skip\n where: {poolAddress: $poolAddress}\n orderBy: tickIdx\n ) {\n tick: tickIdx\n liquidityNet\n price0\n price1\n }\n}\n "; +var FeeTierDistributionDocument = "\n query feeTierDistribution($token0: String!, $token1: String!) {\n _meta {\n block {\n number\n }\n }\n asToken0: pools(\n orderBy: totalValueLockedToken0\n orderDirection: desc\n where: {token0: $token0, token1: $token1}\n ) {\n feeTier\n totalValueLockedToken0\n totalValueLockedToken1\n }\n asToken1: pools(\n orderBy: totalValueLockedToken0\n orderDirection: desc\n where: {token0: $token1, token1: $token0}\n ) {\n feeTier\n totalValueLockedToken0\n totalValueLockedToken1\n }\n}\n "; +var injectedRtkApi = api$1.injectEndpoints({ + endpoints: function (build) { return ({ + allV3Ticks: build.query({ + query: function (variables) { return ({ document: AllV3TicksDocument, variables: variables }); } + }), + feeTierDistribution: build.query({ + query: function (variables) { return ({ document: FeeTierDistributionDocument, variables: variables }); } + }), + }); }, +}); +injectedRtkApi.useAllV3TicksQuery; injectedRtkApi.useLazyAllV3TicksQuery; injectedRtkApi.useFeeTierDistributionQuery; injectedRtkApi.useLazyFeeTierDistributionQuery; + +// tag that should be applied to queries that need to be invalidated when the chain changes +var CHAIN_TAG = 'Chain'; +// enhanced api to provide/invalidate tags +var api = injectedRtkApi.enhanceEndpoints({ + addTagTypes: [CHAIN_TAG], + endpoints: { + allV3Ticks: { + providesTags: [CHAIN_TAG], + }, + feeTierDistribution: { + providesTags: [CHAIN_TAG], + }, + }, +}); +api.useAllV3TicksQuery; api.useFeeTierDistributionQuery; + +/** + * Returns the input chain ID if chain is supported. If not, return undefined + * @param chainId a chain ID, which will be returned if it is a supported chain ID + */ +function supportedChainId(chainId) { + if (chainId in SupportedChainId) { + return chainId; + } + return undefined; +} + +function useQueryCacheInvalidator() { + var dispatch = useAppDispatch(); + // subscribe to `chainId` changes in the redux store rather than Web3 + // this will ensure that when `invalidateTags` is called, the latest + // `chainId` is available in redux to build the subgraph url + var chainId = useAppSelector(function (state) { return state.application.chainId; }); + useEffect(function () { + dispatch(api.util.invalidateTags([CHAIN_TAG])); + }, [chainId, dispatch]); +} +function Updater$5() { + var _a = useActiveWeb3React(), chainId = _a.chainId, library = _a.library; + var dispatch = useAppDispatch(); + var windowVisible = useIsWindowVisible(); + var _b = __read(useState(chainId), 2), activeChainId = _b[0], setActiveChainId = _b[1]; + useQueryCacheInvalidator(); + useEffect(function () { + if (library && chainId && windowVisible) { + setActiveChainId(chainId); + } + }, [dispatch, chainId, library, windowVisible]); + var debouncedChainId = useDebounce(activeChainId, 100); + useEffect(function () { + var _a; + var chainId = debouncedChainId ? (_a = supportedChainId(debouncedChainId)) !== null && _a !== void 0 ? _a : null : null; + dispatch(updateChainId({ chainId: chainId })); + }, [dispatch, debouncedChainId]); + return null; +} + +function Updater$4() { + var _a = useActiveWeb3React(), chainId = _a.chainId, library = _a.library; + var dispatch = useAppDispatch(); + var isWindowVisible = useIsWindowVisible(); + // get all loaded lists, and the active urls + var lists = useAllLists(); + var activeListUrls = useActiveListUrls(); + var fetchList = useFetchListCallback(); + var fetchAllListsCallback = useCallback(function () { + if (!isWindowVisible) + return; + Object.keys(lists).forEach(function (url) { + return fetchList(url).catch(function (error) { return console.debug('interval list fetching error', error); }); + }); + }, [fetchList, isWindowVisible, lists]); + useEffect(function () { + if (chainId && [SupportedChainId.OPTIMISM, SupportedChainId.OPTIMISTIC_KOVAN].includes(chainId)) { + dispatch(enableList(OPTIMISM_LIST)); + } + if (chainId && [SupportedChainId.ARBITRUM_ONE, SupportedChainId.ARBITRUM_RINKEBY].includes(chainId)) { + dispatch(enableList(ARBITRUM_LIST)); + } + }, [chainId, dispatch]); + // fetch all lists every 10 minutes, but only after we initialize library + useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null); + // whenever a list is not loaded and not loading, try again to load it + useEffect(function () { + Object.keys(lists).forEach(function (listUrl) { + var list = lists[listUrl]; + if (!list.current && !list.loadingRequestId && !list.error) { + fetchList(listUrl).catch(function (error) { return console.debug('list added fetching error', error); }); + } + }); + }, [dispatch, fetchList, library, lists]); + // if any lists from unsupported lists are loaded, check them too (in case new updates since last visit) + useEffect(function () { + UNSUPPORTED_LIST_URLS.forEach(function (listUrl) { + var list = lists[listUrl]; + if (!list || (!list.current && !list.loadingRequestId && !list.error)) { + fetchList(listUrl).catch(function (error) { return console.debug('list added fetching error', error); }); + } + }); + }, [dispatch, fetchList, library, lists]); + // automatically update lists if versions are minor/patch + useEffect(function () { + Object.keys(lists).forEach(function (listUrl) { + var list = lists[listUrl]; + if (list.current && list.pendingUpdate) { + var bump = getVersionUpgrade(list.current.version, list.pendingUpdate.version); + switch (bump) { + case VersionUpgrade.NONE: + throw new Error('unexpected no version bump'); + case VersionUpgrade.PATCH: + case VersionUpgrade.MINOR: + var min = minVersionBump(list.current.tokens, list.pendingUpdate.tokens); + // automatically update minor/patch as long as bump matches the min update + if (bump >= min) { + dispatch(acceptListUpdate(listUrl)); + } + else { + console.error("List at url " + listUrl + " could not automatically update because the version bump was only PATCH/MINOR while the update had breaking changes and should have been MAJOR"); + } + break; + // update any active or inactive lists + case VersionUpgrade.MAJOR: + dispatch(acceptListUpdate(listUrl)); + } + } + }); + }, [dispatch, lists, activeListUrls]); + return null; +} + +function Updater$3() { + var dispatch = useAppDispatch(); + var state = useAppSelector(function (state) { return state.logs; }); + var _a = useActiveWeb3React(), chainId = _a.chainId, library = _a.library; + var blockNumber = useBlockNumber(); + var filtersNeedFetch = useMemo(function () { + if (!chainId || typeof blockNumber !== 'number') + return []; + var active = state[chainId]; + if (!active) + return []; + return Object.keys(active) + .filter(function (key) { + var _a = active[key], fetchingBlockNumber = _a.fetchingBlockNumber, results = _a.results, listeners = _a.listeners; + if (listeners === 0) + return false; + if (typeof fetchingBlockNumber === 'number' && fetchingBlockNumber >= blockNumber) + return false; + if (results && typeof results.blockNumber === 'number' && results.blockNumber >= blockNumber) + return false; + return true; + }) + .map(function (key) { return keyToFilter(key); }); + }, [blockNumber, chainId, state]); + useEffect(function () { + if (!library || !chainId || typeof blockNumber !== 'number' || filtersNeedFetch.length === 0) + return; + dispatch(fetchingLogs({ chainId: chainId, filters: filtersNeedFetch, blockNumber: blockNumber })); + filtersNeedFetch.forEach(function (filter) { + library + .getLogs(__assign(__assign({}, filter), { fromBlock: 0, toBlock: blockNumber })) + .then(function (logs) { + dispatch(fetchedLogs({ + chainId: chainId, + filter: filter, + results: { logs: logs, blockNumber: blockNumber }, + })); + }) + .catch(function (error) { + console.error('Failed to get logs', filter, error); + dispatch(fetchedLogsError({ + chainId: chainId, + filter: filter, + blockNumber: blockNumber, + })); + }); + }); + }, [blockNumber, chainId, dispatch, filtersNeedFetch, library]); + return null; +} + +function wait(ms) { + return new Promise(function (resolve) { return setTimeout(resolve, ms); }); +} +function waitRandom(min, max) { + return wait(min + Math.round(Math.random() * Math.max(0, max - min))); +} +/** + * This error is thrown if the function is cancelled before completing + */ +var CancelledError = /** @class */ (function (_super) { + __extends(CancelledError, _super); + function CancelledError() { + var _this = _super.call(this, 'Cancelled') || this; + _this.isCancelledError = true; + return _this; + } + return CancelledError; +}(Error)); +/** + * Throw this error if the function should retry + */ +var RetryableError = /** @class */ (function (_super) { + __extends(RetryableError, _super); + function RetryableError() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.isRetryableError = true; + return _this; + } + return RetryableError; +}(Error)); +/** + * Retries the function that returns the promise until the promise successfully resolves up to n retries + * @param fn function to retry + * @param n how many times to retry + * @param minWait min wait between retries in ms + * @param maxWait max wait between retries in ms + */ +function retry(fn, _a) { + var _this = this; + var n = _a.n, minWait = _a.minWait, maxWait = _a.maxWait; + var completed = false; + var rejectCancelled; + var promise = new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { + var result, error_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + rejectCancelled = reject; + _a.label = 1; + case 1: + result = void 0; + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 5]); + return [4 /*yield*/, fn()]; + case 3: + result = _a.sent(); + if (!completed) { + resolve(result); + completed = true; + } + return [3 /*break*/, 7]; + case 4: + error_1 = _a.sent(); + if (completed) { + return [3 /*break*/, 7]; + } + if (n <= 0 || !error_1.isRetryableError) { + reject(error_1); + completed = true; + return [3 /*break*/, 7]; + } + n--; + return [3 /*break*/, 5]; + case 5: return [4 /*yield*/, waitRandom(minWait, maxWait)]; + case 6: + _a.sent(); + return [3 /*break*/, 1]; + case 7: return [2 /*return*/]; + } + }); + }); }); + return { + promise: promise, + cancel: function () { + if (completed) + return; + completed = true; + rejectCancelled(new CancelledError()); + }, + }; +} + +var _a; +function shouldCheck(lastBlockNumber, tx) { + if (tx.receipt) + return false; + if (!tx.lastCheckedBlockNumber) + return true; + var blocksSinceCheck = lastBlockNumber - tx.lastCheckedBlockNumber; + if (blocksSinceCheck < 1) + return false; + var minutesPending = (new Date().getTime() - tx.addedTime) / ms(templateObject_1 || (templateObject_1 = __makeTemplateObject(["1m"], ["1m"]))); + if (minutesPending > 60) { + // every 10 blocks if pending longer than an hour + return blocksSinceCheck > 9; + } + else if (minutesPending > 5) { + // every 3 blocks if pending longer than 5 minutes + return blocksSinceCheck > 2; + } + else { + // otherwise every block + return true; + } +} +var RETRY_OPTIONS_BY_CHAIN_ID = (_a = {}, + _a[SupportedChainId.ARBITRUM_ONE] = { n: 10, minWait: 250, maxWait: 1000 }, + _a[SupportedChainId.ARBITRUM_RINKEBY] = { n: 10, minWait: 250, maxWait: 1000 }, + _a[SupportedChainId.OPTIMISTIC_KOVAN] = { n: 10, minWait: 250, maxWait: 1000 }, + _a[SupportedChainId.OPTIMISM] = { n: 10, minWait: 250, maxWait: 1000 }, + _a); +var DEFAULT_RETRY_OPTIONS = { n: 1, minWait: 0, maxWait: 0 }; +function Updater$2(_a) { + var pendingTransactions = _a.pendingTransactions, onCheck = _a.onCheck, onReceipt = _a.onReceipt; + var _b = useActiveWeb3React(), chainId = _b.chainId, library = _b.library; + var lastBlockNumber = useBlockNumber(); + var fastForwardBlockNumber = useFastForwardBlockNumber(); + var getReceipt = useCallback(function (hash) { + var _a; + if (!library || !chainId) + throw new Error('No library or chainId'); + var retryOptions = (_a = RETRY_OPTIONS_BY_CHAIN_ID[chainId]) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_OPTIONS; + return retry(function () { + return library.getTransactionReceipt(hash).then(function (receipt) { + if (receipt === null) { + console.debug("Retrying tranasaction receipt for " + hash); + throw new RetryableError(); + } + return receipt; + }); + }, retryOptions); + }, [chainId, library]); + useEffect(function () { + if (!chainId || !library || !lastBlockNumber) + return; + var cancels = Object.keys(pendingTransactions) + .filter(function (hash) { return shouldCheck(lastBlockNumber, pendingTransactions[hash]); }) + .map(function (hash) { + var _a = getReceipt(hash), promise = _a.promise, cancel = _a.cancel; + promise + .then(function (receipt) { + if (receipt) { + onReceipt({ chainId: chainId, hash: hash, receipt: receipt }); + } + else { + onCheck({ chainId: chainId, hash: hash, blockNumber: lastBlockNumber }); + } + }) + .catch(function (error) { + if (!error.isCancelledError) { + console.warn("Failed to get transaction receipt for " + hash, error); + } + }); + return cancel; + }); + return function () { + cancels.forEach(function (cancel) { return cancel(); }); + }; + }, [chainId, library, lastBlockNumber, getReceipt, fastForwardBlockNumber, onReceipt, onCheck, pendingTransactions]); + return null; +} +var templateObject_1; + +function Updater$1() { + var chainId = useActiveWeb3React().chainId; + var addPopup = useAddPopup(); + // speed up popup dismisall time if on L2 + var isL2 = Boolean(chainId && L2_CHAIN_IDS.includes(chainId)); + var dispatch = useAppDispatch(); + var onCheck = useCallback(function (_a) { + var chainId = _a.chainId, hash = _a.hash, blockNumber = _a.blockNumber; + return dispatch(checkedTransaction({ chainId: chainId, hash: hash, blockNumber: blockNumber })); + }, [dispatch]); + var onReceipt = useCallback(function (_a) { + var chainId = _a.chainId, hash = _a.hash, receipt = _a.receipt; + dispatch(finalizeTransaction({ + chainId: chainId, + hash: hash, + receipt: { + blockHash: receipt.blockHash, + blockNumber: receipt.blockNumber, + contractAddress: receipt.contractAddress, + from: receipt.from, + status: receipt.status, + to: receipt.to, + transactionHash: receipt.transactionHash, + transactionIndex: receipt.transactionIndex, + }, + })); + addPopup({ + txn: { hash: hash }, + }, hash, isL2 ? L2_TXN_DISMISS_MS : DEFAULT_TXN_DISMISS_MS); + }, [addPopup, dispatch, isL2]); + var state = useAppSelector(function (state) { return state.transactions; }); + var pendingTransactions = useMemo(function () { var _a; return (chainId ? (_a = state[chainId]) !== null && _a !== void 0 ? _a : {} : {}); }, [chainId, state]); + return jsx(Updater$2, { pendingTransactions: pendingTransactions, onCheck: onCheck, onReceipt: onReceipt }, void 0); +} + +function Updater() { + var dispatch = useAppDispatch(); + // keep dark mode in sync with the system + useEffect(function () { + var darkHandler = function (match) { + dispatch(updateMatchesDarkMode({ matchesDarkMode: match.matches })); + }; + var match = window === null || window === void 0 ? void 0 : window.matchMedia('(prefers-color-scheme: dark)'); + dispatch(updateMatchesDarkMode({ matchesDarkMode: match.matches })); + if (match === null || match === void 0 ? void 0 : match.addListener) { + match === null || match === void 0 ? void 0 : match.addListener(darkHandler); + } + else if (match === null || match === void 0 ? void 0 : match.addEventListener) { + match === null || match === void 0 ? void 0 : match.addEventListener('change', darkHandler); + } + return function () { + if (match === null || match === void 0 ? void 0 : match.removeListener) { + match === null || match === void 0 ? void 0 : match.removeListener(darkHandler); + } + else if (match === null || match === void 0 ? void 0 : match.removeEventListener) { + match === null || match === void 0 ? void 0 : match.removeEventListener('change', darkHandler); + } + }; + }, [dispatch]); + return null; +} + +var initialStyles = { + width: '200vw', + height: '200vh', + transform: 'translate(-50vw, -100vh)', + backgroundBlendMode: '', +}; +var backgroundResetStyles = { + width: '100vw', + height: '100vh', + transform: 'unset', + backgroundBlendMode: '', +}; +var backgroundRadialGradientElement = document.getElementById('background-radial-gradient'); +var setBackground = function (newValues) { + return Object.entries(newValues).forEach(function (_a) { + var _b = __read(_a, 2), key = _b[0], value = _b[1]; + if (backgroundRadialGradientElement) { + backgroundRadialGradientElement.style[key] = value; + } + }); +}; +function RadialGradientByChainUpdater() { + var chainId = useActiveWeb3React().chainId; + var _a = __read(useDarkModeManager(), 1), darkMode = _a[0]; + // manage background color + useEffect(function () { + if (!backgroundRadialGradientElement) { + return; + } + switch (chainId) { + case SupportedChainId.ARBITRUM_ONE: + case SupportedChainId.ARBITRUM_RINKEBY: + setBackground(backgroundResetStyles); + var arbitrumLightGradient = 'radial-gradient(150% 100% at 50% 0%, #CDE8FB 0%, #FCF3F9 50%, #FFFFFF 100%)'; + var arbitrumDarkGradient = 'radial-gradient(150% 100% at 50% 0%, #0A294B 0%, #221E30 50%, #1F2128 100%)'; + backgroundRadialGradientElement.style.background = darkMode ? arbitrumDarkGradient : arbitrumLightGradient; + break; + case SupportedChainId.OPTIMISM: + case SupportedChainId.OPTIMISTIC_KOVAN: + setBackground(backgroundResetStyles); + var optimismLightGradient = 'radial-gradient(150% 100% at 50% 0%, #FFFBF2 2%, #FFF4F9 53%, #FFFFFF 100%)'; + var optimismDarkGradient = 'radial-gradient(150% 100% at 50% 0%, #3E2E38 2%, #2C1F2D 53%, #1F2128 100%)'; + backgroundRadialGradientElement.style.background = darkMode ? optimismDarkGradient : optimismLightGradient; + break; + case SupportedChainId.POLYGON: + case SupportedChainId.POLYGON_MUMBAI: + setBackground(backgroundResetStyles); + var polygonLightGradient = 'radial-gradient(153.32% 100% at 47.26% 0%, rgba(130, 71, 229, 0.0864) 0%, rgba(0, 41, 255, 0.06) 48.19%, rgba(0, 41, 255, 0.012) 100%), #FFFFFF'; + var polygonDarkGradient = 'radial-gradient(150.6% 98.22% at 48.06% 0%, rgba(130, 71, 229, 0.6) 0%, rgba(200, 168, 255, 0) 100%), #1F2128'; + backgroundRadialGradientElement.style.background = darkMode ? polygonDarkGradient : polygonLightGradient; + backgroundRadialGradientElement.style.backgroundBlendMode = darkMode ? 'overlay,normal' : 'multiply,normal'; + break; + default: + setBackground(initialStyles); + backgroundRadialGradientElement.style.background = ''; + } + }, [darkMode, chainId]); + return null; +} + +function Updaters() { + return (jsxs(Fragment, { children: [jsx(RadialGradientByChainUpdater, {}, void 0), jsx(Updater$4, {}, void 0), jsx(Updater, {}, void 0), jsx(Updater$5, {}, void 0), jsx(Updater$1, {}, void 0), jsx(BlockUpdater, {}, void 0), jsx(MulticallUpdater, {}, void 0), jsx(Updater$3, {}, void 0)] }, void 0)); +} + +var Web3ProviderNetwork = createWeb3ReactRoot(NetworkContextName); +var Providers = function (props) { return (jsx(Provider$1, __assign({ store: store }, { children: jsx(HashRouter, { children: jsx(LanguageProvider, { children: jsx(Web3ReactProvider, __assign({ getLibrary: getLibrary }, { children: jsx(Web3ProviderNetwork, __assign({ getLibrary: getLibrary }, { children: jsxs(Blocklist, { children: [jsx(Updaters, {}, void 0), jsxs(ThemeProvider, { children: [jsx(ThemedGlobalStyle, {}, void 0), props.children] }, void 0)] }, void 0) }), void 0) }), void 0) }, void 0) }, void 0) }), void 0)); }; + +var $schema = "http://json-schema.org/draft-07/schema#"; +var $id = "https://uniswap.org/tokenlist.schema.json"; +var title = "Uniswap Token List"; +var description = "Schema for lists of tokens compatible with the Uniswap Interface"; +var definitions = { + Version: { + type: "object", + description: "The version of the list, used in change detection", + examples: [ + { + major: 1, + minor: 0, + patch: 0 + } + ], + additionalProperties: false, + properties: { + major: { + type: "integer", + description: "The major version of the list. Must be incremented when tokens are removed from the list or token addresses are changed.", + minimum: 0, + examples: [ + 1, + 2 + ] + }, + minor: { + type: "integer", + description: "The minor version of the list. Must be incremented when tokens are added to the list.", + minimum: 0, + examples: [ + 0, + 1 + ] + }, + patch: { + type: "integer", + description: "The patch version of the list. Must be incremented for any changes to the list.", + minimum: 0, + examples: [ + 0, + 1 + ] + } + }, + required: [ + "major", + "minor", + "patch" + ] + }, + TagIdentifier: { + type: "string", + description: "The unique identifier of a tag", + minLength: 1, + maxLength: 10, + pattern: "^[\\w]+$", + examples: [ + "compound", + "stablecoin" + ] + }, + ExtensionIdentifier: { + type: "string", + description: "The name of a token extension property", + minLength: 1, + maxLength: 40, + pattern: "^[\\w]+$", + examples: [ + "color", + "is_fee_on_transfer", + "aliases" + ] + }, + ExtensionMap: { + type: "object", + description: "An object containing any arbitrary or vendor-specific token metadata", + maxProperties: 10, + propertyNames: { + $ref: "#/definitions/ExtensionIdentifier" + }, + additionalProperties: { + $ref: "#/definitions/ExtensionValue" + }, + examples: [ + { + color: "#000000", + is_verified_by_me: true + }, + { + "x-bridged-addresses-by-chain": { + "1": { + bridgeAddress: "0x4200000000000000000000000000000000000010", + tokenAddress: "0x4200000000000000000000000000000000000010" + } + } + } + ] + }, + ExtensionPrimitiveValue: { + anyOf: [ + { + type: "string", + minLength: 1, + maxLength: 42, + examples: [ + "#00000" + ] + }, + { + type: "boolean", + examples: [ + true + ] + }, + { + type: "number", + examples: [ + 15 + ] + }, + { + type: "null" + } + ] + }, + ExtensionValue: { + anyOf: [ + { + $ref: "#/definitions/ExtensionPrimitiveValue" + }, + { + type: "object", + maxProperties: 10, + propertyNames: { + $ref: "#/definitions/ExtensionIdentifier" + }, + additionalProperties: { + $ref: "#/definitions/ExtensionValueInner0" + } + } + ] + }, + ExtensionValueInner0: { + anyOf: [ + { + $ref: "#/definitions/ExtensionPrimitiveValue" + }, + { + type: "object", + maxProperties: 10, + propertyNames: { + $ref: "#/definitions/ExtensionIdentifier" + }, + additionalProperties: { + $ref: "#/definitions/ExtensionValueInner1" + } + } + ] + }, + ExtensionValueInner1: { + anyOf: [ + { + $ref: "#/definitions/ExtensionPrimitiveValue" + } + ] + }, + TagDefinition: { + type: "object", + description: "Definition of a tag that can be associated with a token via its identifier", + additionalProperties: false, + properties: { + name: { + type: "string", + description: "The name of the tag", + pattern: "^[ \\w]+$", + minLength: 1, + maxLength: 20 + }, + description: { + type: "string", + description: "A user-friendly description of the tag", + pattern: "^[ \\w\\.,:]+$", + minLength: 1, + maxLength: 200 + } + }, + required: [ + "name", + "description" + ], + examples: [ + { + name: "Stablecoin", + description: "A token with value pegged to another asset" + } + ] + }, + TokenInfo: { + type: "object", + description: "Metadata for a single token in a token list", + additionalProperties: false, + properties: { + chainId: { + type: "integer", + description: "The chain ID of the Ethereum network where this token is deployed", + minimum: 1, + examples: [ + 1, + 42 + ] + }, + address: { + type: "string", + description: "The checksummed address of the token on the specified chain ID", + pattern: "^0x[a-fA-F0-9]{40}$", + examples: [ + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + ] + }, + decimals: { + type: "integer", + description: "The number of decimals for the token balance", + minimum: 0, + maximum: 255, + examples: [ + 18 + ] + }, + name: { + type: "string", + description: "The name of the token", + minLength: 1, + maxLength: 40, + pattern: "^[ \\w.'+\\-%/À-ÖØ-öø-ÿ:&\\[\\]\\(\\)]+$", + examples: [ + "USD Coin" + ] + }, + symbol: { + type: "string", + description: "The symbol for the token; must be alphanumeric", + pattern: "^[a-zA-Z0-9+\\-%/$.]+$", + minLength: 1, + maxLength: 20, + examples: [ + "USDC" + ] + }, + logoURI: { + type: "string", + description: "A URI to the token logo asset; if not set, interface will attempt to find a logo based on the token address; suggest SVG or PNG of size 64x64", + format: "uri", + examples: [ + "ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM" + ] + }, + tags: { + type: "array", + description: "An array of tag identifiers associated with the token; tags are defined at the list level", + items: { + $ref: "#/definitions/TagIdentifier" + }, + maxItems: 10, + examples: [ + "stablecoin", + "compound" + ] + }, + extensions: { + $ref: "#/definitions/ExtensionMap" + } + }, + required: [ + "chainId", + "address", + "decimals", + "name", + "symbol" + ] + } +}; +var type = "object"; +var additionalProperties = false; +var properties = { + name: { + type: "string", + description: "The name of the token list", + minLength: 1, + maxLength: 20, + pattern: "^[\\w ]+$", + examples: [ + "My Token List" + ] + }, + timestamp: { + type: "string", + format: "date-time", + description: "The timestamp of this list version; i.e. when this immutable version of the list was created" + }, + version: { + $ref: "#/definitions/Version" + }, + tokens: { + type: "array", + description: "The list of tokens included in the list", + items: { + $ref: "#/definitions/TokenInfo" + }, + minItems: 1, + maxItems: 10000 + }, + keywords: { + type: "array", + description: "Keywords associated with the contents of the list; may be used in list discoverability", + items: { + type: "string", + description: "A keyword to describe the contents of the list", + minLength: 1, + maxLength: 20, + pattern: "^[\\w ]+$", + examples: [ + "compound", + "lending", + "personal tokens" + ] + }, + maxItems: 20, + uniqueItems: true + }, + tags: { + type: "object", + description: "A mapping of tag identifiers to their name and description", + propertyNames: { + $ref: "#/definitions/TagIdentifier" + }, + additionalProperties: { + $ref: "#/definitions/TagDefinition" + }, + maxProperties: 20, + examples: [ + { + stablecoin: { + name: "Stablecoin", + description: "A token with value pegged to another asset" + } + } + ] + }, + logoURI: { + type: "string", + description: "A URI for the logo of the token list; prefer SVG or PNG of size 256x256", + format: "uri", + examples: [ + "ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM" + ] + } +}; +var required = [ + "name", + "timestamp", + "version", + "tokens" +]; +var tokenlist_schema = { + $schema: $schema, + $id: $id, + title: title, + description: description, + definitions: definitions, + type: type, + additionalProperties: additionalProperties, + properties: properties, + required: required +}; + +var tokenlist_schema$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + $schema: $schema, + $id: $id, + title: title, + description: description, + definitions: definitions, + type: type, + additionalProperties: additionalProperties, + properties: properties, + required: required, + 'default': tokenlist_schema +}); + +// from routing-api (https://github.com/Uniswap/routing-api/blob/main/lib/handlers/quote/quote.ts#L243-L311) +function transformSwapRouteToGetQuoteResult(type, amount, _a) { + var e_1, _b; + var quote = _a.quote, quoteGasAdjusted = _a.quoteGasAdjusted, route = _a.route, estimatedGasUsed = _a.estimatedGasUsed, estimatedGasUsedQuoteToken = _a.estimatedGasUsedQuoteToken, estimatedGasUsedUSD = _a.estimatedGasUsedUSD, gasPriceWei = _a.gasPriceWei, methodParameters = _a.methodParameters, blockNumber = _a.blockNumber; + var routeResponse = []; + try { + for (var route_1 = __values(route), route_1_1 = route_1.next(); !route_1_1.done; route_1_1 = route_1.next()) { + var subRoute = route_1_1.value; + var amount_1 = subRoute.amount, quote_1 = subRoute.quote, tokenPath = subRoute.tokenPath; + if (subRoute.protocol === Protocol.V3) { + var pools = subRoute.route.pools; + var curRoute = []; + for (var i = 0; i < pools.length; i++) { + var nextPool = pools[i]; + var tokenIn = tokenPath[i]; + var tokenOut = tokenPath[i + 1]; + var edgeAmountIn = undefined; + if (i === 0) { + edgeAmountIn = type === 'exactIn' ? amount_1.quotient.toString() : quote_1.quotient.toString(); + } + var edgeAmountOut = undefined; + if (i === pools.length - 1) { + edgeAmountOut = type === 'exactIn' ? quote_1.quotient.toString() : amount_1.quotient.toString(); + } + curRoute.push({ + type: 'v3-pool', + tokenIn: { + chainId: tokenIn.chainId, + decimals: tokenIn.decimals, + address: tokenIn.address, + symbol: tokenIn.symbol, + }, + tokenOut: { + chainId: tokenOut.chainId, + decimals: tokenOut.decimals, + address: tokenOut.address, + symbol: tokenOut.symbol, + }, + fee: nextPool.fee.toString(), + liquidity: nextPool.liquidity.toString(), + sqrtRatioX96: nextPool.sqrtRatioX96.toString(), + tickCurrent: nextPool.tickCurrent.toString(), + amountIn: edgeAmountIn, + amountOut: edgeAmountOut, + }); + } + routeResponse.push(curRoute); + } + else if (subRoute.protocol === Protocol.V2) { + var pools = subRoute.route.pairs; + var curRoute = []; + for (var i = 0; i < pools.length; i++) { + var nextPool = pools[i]; + var tokenIn = tokenPath[i]; + var tokenOut = tokenPath[i + 1]; + var edgeAmountIn = undefined; + if (i === 0) { + edgeAmountIn = type === 'exactIn' ? amount_1.quotient.toString() : quote_1.quotient.toString(); + } + var edgeAmountOut = undefined; + if (i === pools.length - 1) { + edgeAmountOut = type === 'exactIn' ? quote_1.quotient.toString() : amount_1.quotient.toString(); + } + var reserve0 = nextPool.reserve0; + var reserve1 = nextPool.reserve1; + curRoute.push({ + type: 'v2-pool', + tokenIn: { + chainId: tokenIn.chainId, + decimals: tokenIn.decimals, + address: tokenIn.address, + symbol: tokenIn.symbol, + }, + tokenOut: { + chainId: tokenOut.chainId, + decimals: tokenOut.decimals, + address: tokenOut.address, + symbol: tokenOut.symbol, + }, + reserve0: { + token: { + chainId: reserve0.currency.wrapped.chainId, + decimals: reserve0.currency.wrapped.decimals, + address: reserve0.currency.wrapped.address, + symbol: reserve0.currency.wrapped.symbol, + }, + quotient: reserve0.quotient.toString(), + }, + reserve1: { + token: { + chainId: reserve1.currency.wrapped.chainId, + decimals: reserve1.currency.wrapped.decimals, + address: reserve1.currency.wrapped.address, + symbol: reserve1.currency.wrapped.symbol, + }, + quotient: reserve1.quotient.toString(), + }, + amountIn: edgeAmountIn, + amountOut: edgeAmountOut, + }); + } + routeResponse.push(curRoute); + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (route_1_1 && !route_1_1.done && (_b = route_1.return)) _b.call(route_1); + } + finally { if (e_1) throw e_1.error; } + } + var result = { + methodParameters: methodParameters, + blockNumber: blockNumber.toString(), + amount: amount.quotient.toString(), + amountDecimals: amount.toExact(), + quote: quote.quotient.toString(), + quoteDecimals: quote.toExact(), + quoteGasAdjusted: quoteGasAdjusted.quotient.toString(), + quoteGasAdjustedDecimals: quoteGasAdjusted.toExact(), + gasUseEstimateQuote: estimatedGasUsedQuoteToken.quotient.toString(), + gasUseEstimateQuoteDecimals: estimatedGasUsedQuoteToken.toExact(), + gasUseEstimate: estimatedGasUsed.toString(), + gasUseEstimateUSD: estimatedGasUsedUSD.toExact(), + gasPriceWei: gasPriceWei.toString(), + route: routeResponse, + routeString: routeAmountsToString(route), + }; + return result; +} + +/** Minimal set of dependencies for the router to work locally. */ +function buildDependencies() { + var e_1, _a; + var dependenciesByChain = {}; + try { + for (var AUTO_ROUTER_SUPPORTED_CHAINS_1 = __values(AUTO_ROUTER_SUPPORTED_CHAINS), AUTO_ROUTER_SUPPORTED_CHAINS_1_1 = AUTO_ROUTER_SUPPORTED_CHAINS_1.next(); !AUTO_ROUTER_SUPPORTED_CHAINS_1_1.done; AUTO_ROUTER_SUPPORTED_CHAINS_1_1 = AUTO_ROUTER_SUPPORTED_CHAINS_1.next()) { + var chainId = AUTO_ROUTER_SUPPORTED_CHAINS_1_1.value; + var provider = new providers.JsonRpcProvider(INFURA_NETWORK_URLS[chainId]); + dependenciesByChain[chainId] = { + chainId: chainId, + provider: provider, + }; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (AUTO_ROUTER_SUPPORTED_CHAINS_1_1 && !AUTO_ROUTER_SUPPORTED_CHAINS_1_1.done && (_a = AUTO_ROUTER_SUPPORTED_CHAINS_1.return)) _a.call(AUTO_ROUTER_SUPPORTED_CHAINS_1); + } + finally { if (e_1) throw e_1.error; } + } + return dependenciesByChain; +} +var GAMetric = /** @class */ (function (_super) { + __extends(GAMetric, _super); + function GAMetric() { + return _super !== null && _super.apply(this, arguments) || this; + } + GAMetric.prototype.putDimensions = function () { + return; + }; + GAMetric.prototype.putMetric = function (key, value, unit) { + ReactGA.timing({ + category: 'Routing API', + variable: key + " | " + unit, + value: value, + label: 'client', + }); + }; + return GAMetric; +}(IMetric)); +setGlobalMetric(new GAMetric()); + +var routerParamsByChain = buildDependencies(); +function getQuote(_a, alphaRouterConfig) { + var type = _a.type, chainId = _a.chainId, tokenIn = _a.tokenIn, tokenOut = _a.tokenOut, amountRaw = _a.amount; + return __awaiter(this, void 0, void 0, function () { + var params, router, currencyIn, currencyOut, baseCurrency, quoteCurrency, amount, swapRoute; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + params = routerParamsByChain[chainId]; + if (!params) { + throw new Error('Router dependencies not initialized.'); + } + router = new AlphaRouter(params); + currencyIn = new Token(tokenIn.chainId, tokenIn.address, tokenIn.decimals, tokenIn.symbol); + currencyOut = new Token(tokenOut.chainId, tokenOut.address, tokenOut.decimals, tokenOut.symbol); + baseCurrency = type === 'exactIn' ? currencyIn : currencyOut; + quoteCurrency = type === 'exactIn' ? currencyOut : currencyIn; + amount = CurrencyAmount.fromRawAmount(baseCurrency, JSBI.BigInt(amountRaw)); + return [4 /*yield*/, router.route(amount, quoteCurrency, type === 'exactIn' ? TradeType.EXACT_INPUT : TradeType.EXACT_OUTPUT, + /*swapConfig=*/ undefined, alphaRouterConfig)]; + case 1: + swapRoute = _b.sent(); + if (!swapRoute) + throw new Error('Failed to generate client side quote'); + return [2 /*return*/, { data: transformSwapRouteToGetQuoteResult(type, amount, swapRoute) }]; + } + }); + }); +} + +var index = /*#__PURE__*/Object.freeze({ + __proto__: null, + getQuote: getQuote +}); + +module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}};},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};},function(e,t,r){function n(){return Math.floor(9e4*Math.random())+1e4}Object.defineProperty(t,"__esModule",{value:!0}),t.sendAsyncWrapper=function(e,t){var r=this;return new Promise(function(o,a){r.sendAsync({jsonrpc:"2.0",id:n(),method:e,params:t||[]},function(e,t){e?a(e):o(t.result);});})},t.sendFortmaticAsyncWrapper=function(e){var t=this;return new Promise(function(r,n){t.getProvider().sendFortmaticAsync(e,function(e,t){e?n(e):r(t?t.result:{});});})},t.randomId=n,t.findExistingResponse=function(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=new v(m);return t.params=[e],i.sendFortmaticAsyncWrapper.call(g,t)};};var v=function e(t,r){(0, o.default)(this,e),this.id=(0, i.randomId)(),this.method=t,this.params=r?[r]:[{}];};},function(e,t,r){var n=r(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(6)),a=n(r(9)),i=n(r(1)),s=n(r(10)),c=r(11),u=n(r(12)),l=r(2),f=function(){function e(t,r){if((0, i.default)(this,e),this.fortmaticClient=t,this.requests={},this.queue=[],this.account=null,this.network=null,this.isFortmatic=!0,this.overlayReady=!1,this.isLoggedIn=!1,this.postMessages={FORTMATIC_HANDLE_BATCH_REQUEST:"FORTMATIC_HANDLE_BATCH_REQUEST",FORTMATIC_HANDLE_REQUEST:"FORTMATIC_HANDLE_REQUEST",FORTMATIC_HANDLE_FORTMATIC_REQUEST:"FORTMATIC_HANDLE_FORTMATIC_REQUEST",FORTMATIC_HANDLE_RESPONSE:"FORTMATIC_HANDLE_RESPONSE",FORTMATIC_OVERLAY_READY:"FORTMATIC_OVERLAY_READY",FORTMATIC_SHOW_OVERLAY:"FORTMATIC_SHOW_OVERLAY",FORTMATIC_HIDE_OVERLAY:"FORTMATIC_HIDE_OVERLAY",FORTMATIC_USER_DENIED:"FORTMATIC_USER_DENIED",FORTMATIC_USER_LOGOUT:"FORTMATIC_USER_LOGOUT",FORTMATIC_UNAUTHORIZED_API_KEY:"FORTMATIC_UNAUTHORIZED_API_KEY"},!r.API_KEY)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.options={API_KEY:r.API_KEY,ETH_NETWORK:r.ETH_NETWORK,DOMAIN_ORIGIN:window.location?window.location.origin:"",version:c.version},this.queryParams=btoa(JSON.stringify(this.options)),this.constructPostMessage(),this.overlay=this.createOverlay(),this.listenMessage();}return (0, s.default)(e,[{key:"constructPostMessage",value:function(){var e=this;Object.keys(this.postMessages).map(function(t){e.postMessages[t]+="-".concat(e.queryParams);});}},{key:"createOverlay",value:function(){var e=this;return new Promise(function(t,r){var n=function(){if(function(){var t=!0,r=!1,n=void 0;try{for(var o,a=document.getElementsByClassName("fortmatic-iframe")[Symbol.iterator]();!(t=(o=a.next()).done);t=!0)if(o.value.src.includes(e.queryParams))return !1}catch(e){r=!0,n=e;}finally{try{t||null==a.return||a.return();}finally{if(r)throw n}}return !0}()){var r=document.createElement("style");r.innerHTML=u.default.css,r.type="text/css",document.head.appendChild(r);var n=document.createElement("iframe");n.className="fortmatic-iframe",n.src="".concat(e.fortmaticClient,"/send?params=").concat(e.queryParams),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),t({iframe:n});}else console.error("Fortmatic: Duplicate instances found.");};["loaded","interactive","complete"].indexOf(document.readyState)>-1?n():window.addEventListener("load",n.bind(e),!1);})}},{key:"showOverlay",value:function(){var e=(0, a.default)(o.default.mark(function e(){return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.overlay;case 2:e.sent.iframe.style.display="block";case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"hideOverlay",value:function(){var e=(0, a.default)(o.default.mark(function e(){return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.overlay;case 2:e.sent.iframe.style.display="none";case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"sendAsync",value:function(e,t){e.length>0?this.enqueue({payload:{id:(0, l.randomId)(),batch:e.map(function(e){return e.id=(0, l.randomId)(),e}),method:"eth_batchRequest"},cb:t}):this.enqueue({payload:e,cb:t});}},{key:"sendFortmaticAsync",value:function(e,t){this.enqueue({payload:e,cb:t,isNative:!0});}},{key:"send",value:function(e,t){if("string"==typeof e)return l.sendAsyncWrapper.call(this,e,t);if(!t){console.warn("Non-async web3 methods will be deprecated in web3 > 1.0, and are not supported by the Fortmatic provider. An async method to be used instead."),this.sendAsync(e,function(){});var r={};switch(e.method){case"eth_accounts":r=this.account?[this.account]:[];break;case"eth_coinbase":r=this.account;break;case"net_version":r=this.network||(this.options.API_KEY.startsWith("pk_live")?1:4);break;case"eth_uninstallFilter":r=!0;break;default:r={};}return {id:e.id,jsonrpc:e.jsonrpc,result:r}}this.sendAsync(e,t);}},{key:"enqueue",value:function(e){this.queue.push(e),this.overlayReady&&this.dequeue();}},{key:"dequeue",value:function(){var e=(0, a.default)(o.default.mark(function e(){var t,r,n,a=this;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.queue.length){e.next=2;break}return e.abrupt("return");case 2:if(!(t=this.queue.shift())){e.next=11;break}return r=t.payload,n=t.cb,r.id=(0, l.randomId)(),e.next=9,this.postMessage(t.isNative?this.postMessages.FORTMATIC_HANDLE_FORTMATIC_REQUEST:this.postMessages.FORTMATIC_HANDLE_REQUEST,t.payload);case 9:r.batch&&r.batch.length>0?(r.batch.forEach(function(e){a.requests[e.id]={parentId:r.id,payload:e,cb:function(e,t){var n=a.requests[r.id].batchResponse;if(e&&e.response&&!(0, l.findExistingResponse)(n,e.response.id))throw n.push({jsonrpc:"2.0",id:e.response.id,error:{code:e.response.code,message:e.response.message}}),a.requests[r.id].cb(null,n),e.response;if(t&&t.result&&!(0, l.findExistingResponse)(n,t.id))return n.push(t);throw new Error("Fortmatic: unexpected callback behavior")}};}),this.requests[r.id]={payload:r,cb:n,batchResponse:[]}):this.requests[r.id]={payload:r,cb:n},this.dequeue();case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"postMessage",value:function(){var e=(0, a.default)(o.default.mark(function e(t,r){var n;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.overlay;case 2:if(!(n=e.sent).iframe.contentWindow){e.next=7;break}n.iframe.contentWindow.postMessage({msgType:t,payload:r},"*"),e.next=8;break;case 7:throw new Error("Fortmatic: Modal is not ready.");case 8:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"enable",value:function(){return l.sendAsyncWrapper.call(this,"eth_accounts")}},{key:"listenMessage",value:function(){var e=this;window.addEventListener("message",function(t){if(t.origin===e.fortmaticClient){var r=t.data.response?t.data.response.id:null;switch(t.data.msgType){case e.postMessages.FORTMATIC_OVERLAY_READY:e.overlayReady=!0,e.dequeue();break;case e.postMessages.FORTMATIC_HANDLE_RESPONSE:try{e.requests[r].cb(null,t.data.response);var n=e.requests[r].parentId;n&&e.requests[n].payload.batch.length===e.requests[n].batchResponse.length&&e.requests[n].cb(null,e.requests[n].batchResponse),"eth_accounts"===e.requests[r].payload.method?e.account=t.data.response.result[0]:"eth_coinbase"===e.requests[r].payload.method?e.account=t.data.response.result:"net_version"===e.requests[r].payload.method&&(e.network=t.data.response.result);}catch(e){}e.isLoggedIn=!0,e.dequeue();break;case e.postMessages.FORTMATIC_HIDE_OVERLAY:e.hideOverlay();break;case e.postMessages.FORTMATIC_SHOW_OVERLAY:e.showOverlay();break;case e.postMessages.FORTMATIC_USER_LOGOUT:e.account=null,e.network=null,e.isLoggedIn=!1;break;case e.postMessages.FORTMATIC_UNAUTHORIZED_API_KEY:throw e.overlayReady=!1,new Error("Given API key is not authorized to access the resource.");case e.postMessages.FORTMATIC_USER_DENIED:if(r){var o=t.data.response&&t.data.response.message?t.data.response.message:"Fortmatic: Modal was closed without executing action!",a=t.data.response&&t.data.response.code?t.data.response.code:1;e.requests[r].cb({message:o,code:a,response:t.data.response});}else e.queue.forEach(function(e){return e.cb({message:"Fortmatic: Modal was closed without executing action!",code:1})});e.dequeue();}}});}}]),e}();t.default=f;},function(e,t,r){e.exports=r(7);},function(e,t,r){var n=function(){return this||"object"==typeof self&&self}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,a=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(8),o)n.regeneratorRuntime=a;else try{delete n.regeneratorRuntime;}catch(e){n.regeneratorRuntime=void 0;}},function(e,t){!function(t){var r,n=Object.prototype,o=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag",u="object"==typeof e,l=t.regeneratorRuntime;if(l)u&&(e.exports=l);else {(l=t.regeneratorRuntime=u?e.exports:{}).wrap=_;var f="suspendedStart",d="suspendedYield",h="executing",p="completed",m={},y={};y[i]=function(){return this};var v=Object.getPrototypeOf,g=v&&v(v(L([])));g&&g!==n&&o.call(g,i)&&(y=g);var b=A.prototype=w.prototype=Object.create(y);T.prototype=b.constructor=A,A.constructor=T,A[c]=T.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return !!t&&(t===T||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,A):(e.__proto__=A,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(b),e},l.awrap=function(e){return {__await:e}},O(R.prototype),R.prototype[s]=function(){return this},l.AsyncIterator=R,l.async=function(e,t,r,n){var o=new R(_(e,t,r,n));return l.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},O(b),b[c]="Generator",b[i]=function(){return this},b.toString=function(){return "[object Generator]"},l.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},l.values=L,F.prototype={constructor:F,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(M),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r);},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return s.type="throw",s.arg=e,t.next=n,o&&(t.method="next",t.arg=r),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),M(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;M(r);}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),m}};}function _(e,t,r,n){var o=t&&t.prototype instanceof w?t:w,a=Object.create(o.prototype),i=new F(n||[]);return a._invoke=function(e,t,r){var n=f;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw a;return k()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=I(i,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg);}else "return"===r.method&&r.abrupt("return",r.arg);n=h;var c=E(e,t,r);if("normal"===c.type){if(n=r.done?p:d,c.arg===m)continue;return {value:c.arg,done:r.done}}"throw"===c.type&&(n=p,r.method="throw",r.arg=c.arg);}}}(e,r,i),a}function E(e,t,r){try{return {type:"normal",arg:e.call(t,r)}}catch(e){return {type:"throw",arg:e}}}function w(){}function T(){}function A(){}function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)};});}function R(e){var t;this._invoke=function(r,n){function a(){return new Promise(function(t,a){!function t(r,n,a,i){var s=E(e[r],e,n);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==typeof u&&o.call(u,"__await")?Promise.resolve(u.__await).then(function(e){t("next",e,a,i);},function(e){t("throw",e,a,i);}):Promise.resolve(u).then(function(e){c.value=e,a(c);},function(e){return t("throw",e,a,i)})}i(s.arg);}(r,n,t,a);})}return t=t?t.then(a,a):a()};}function I(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,I(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method");}return m}var o=E(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,m;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,m):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t);}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t;}function F(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0);}function L(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n (https://fortmatic.com/)",license:"MIT",repository:{type:"git",url:"https://github.com/fortmatic/fortmatic-js"},keywords:["Auth","Login","Web3","Crypto","Ethereum","MetaMask","Wallet","Blockchain","Dapp"],homepage:"https://www.fortmatic.com",ava:{require:["@babel/register"],files:["test/**/*.spec.js"],babel:{testOptions:{presets:["@babel/env"],plugins:["@babel/plugin-proposal-function-bind","@babel/plugin-transform-runtime"]}},verbose:!0},nyc:{all:!1,"check-coverage":!0,"per-file":!0,lines:80,statements:80,functions:80,branches:80,include:["src/**/*.js"],exclude:["*/style.js"],require:[],reporter:["html","lcov"]},dependencies:{"@babel/runtime":"7.3.4"},devDependencies:{"@babel/core":"7.3.4","@babel/plugin-proposal-function-bind":"7.2.0","@babel/plugin-transform-modules-commonjs":"7.2.0","@babel/plugin-transform-runtime":"7.3.4","@babel/preset-env":"7.3.4","@babel/register":"7.0.0",ava:"2.2.0","babel-eslint":"10.0.1","babel-loader":"8.0.5",eslint:"5.9.0",lodash:"4.17.11",nyc:"13.1.0",sinon:"7.1.1",webpack:"4.26.1","webpack-cli":"3.1.2"}};},function(e,t,r){t.css="\n .fortmatic-iframe {\n display: none;\n position: fixed;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n border: none;\n border-radius: 0;\n z-index: 2147483647;\n }\n";}]); + +var fortmatic = /*#__PURE__*/Object.freeze({ + __proto__: null +}); + +export { App, INFURA_NETWORK_URLS, Providers, Swap, Updaters, serviceWorkerRegistration }; diff --git a/package.json b/package.json index c0b5442b0b4..6ef05d2de51 100644 --- a/package.json +++ b/package.json @@ -2,31 +2,86 @@ "name": "@uniswap/interface", "description": "Uniswap Interface", "homepage": ".", - "main": "dist/interface.js", - "module": "dist/interface.esm.js", - "types": "dist/index.d.ts", + "main": "dist2/snowflake.esm.js", + "module": "dist2/snowflake.esm.js", "files": [ - "lib", - "dist" + "dist2" ], - "private": true, - "devDependencies": { + "version": "1.0.5", + "private": false, + "resolutions": { + "@walletconnect/ethereum-provider": "1.7.1" + }, + "scripts": { + "contracts:compile:abi": "typechain --target ethers-v5 --out-dir src/abis/types \"./src/abis/**/*.json\"", + "contracts:compile:v3": "typechain --target ethers-v5 --out-dir src/types/v3 \"./node_modules/@uniswap/**/artifacts/contracts/**/*.json\"", + "contracts:compile": "yarn contracts:compile:abi && yarn contracts:compile:v3", + "graphql:generate": "graphql-codegen --config codegen.yml", + "prei18n:extract": "touch src/locales/en-US.po", + "i18n:extract": "lingui extract --locale en-US", + "i18n:compile": "yarn i18n:extract && lingui compile", + "i18n:pseudo": "lingui extract --locale pseudo && lingui compile", + "prestart": "yarn contracts:compile && yarn graphql:generate && yarn i18n:compile", + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --env=./custom-test-env.js", + "test:e2e": "start-server-and-test 'serve build -l 3000' http://localhost:3000 'cypress run --record'", + "widgets:start": "cosmos", + "widgets:build": "rollup --config --failAfterWarnings --configPlugin typescript2", + "snowflake:build": "rollup --config rollup.config.ts --configPlugin typescript2", + "build:tsc": "tsc" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "license": "GPL-3.0-or-later", + "peerDependencies": { + "styled-components": "5.3.0", + "widgets-web3-react/core": "npm:@web3-react/core@8.0.16-alpha.0", + "widgets-web3-react/eip1193": "npm:@web3-react/eip1193@8.0.16-alpha.0", + "widgets-web3-react/empty": "npm:@web3-react/empty@8.0.17-alpha.0", + "widgets-web3-react/metamask": "npm:@web3-react/metamask@8.0.16-alpha.0", + "widgets-web3-react/types": "npm:@web3-react/types@8.0.16-alpha.0", + "widgets-web3-react/url": "npm:@web3-react/url@8.0.17-alpha.0" + }, + "dependencies": { + "@babel/runtime": "^7.16.7", + "@ethersproject/abi": "^5.4.1", + "@ethersproject/abstract-provider": "^5.4.1", + "@ethersproject/address": "^5.4.0", + "@ethersproject/bignumber": "^5.4.2", + "@ethersproject/bytes": "^5.4.0", + "@ethersproject/constants": "^5.4.0", + "@ethersproject/contracts": "^5.4.1", "@ethersproject/experimental": "^5.4.0", + "@ethersproject/hash": "^5.4.0", + "@ethersproject/providers": "^5.4.5", + "@ethersproject/solidity": "^5.4.0", + "@ethersproject/strings": "^5.4.0", + "@ethersproject/units": "^5.4.0", + "@ethersproject/wallet": "^5.4.0", + "@fontsource/ibm-plex-mono": "^4.5.1", + "@fontsource/inter": "^4.5.1", "@gnosis.pm/safe-apps-web3-react": "^0.6.0", - "@graphql-codegen/cli": "1.21.5", - "@graphql-codegen/typescript": "1.22.3", - "@graphql-codegen/typescript-operations": "^1.18.2", - "@graphql-codegen/typescript-rtk-query": "^1.1.1", "@lingui/cli": "^3.9.0", + "@lingui/core": "^3.9.0", + "@lingui/macro": "^3.9.0", + "@lingui/react": "^3.9.0", "@metamask/jazzicon": "^2.0.0", + "@popperjs/core": "^2.4.4", "@reach/dialog": "^0.10.3", "@reach/portal": "^0.10.3", "@react-hook/window-scroll": "^1.3.0", "@reduxjs/toolkit": "^1.6.1", - "@rollup/plugin-eslint": "^8.0.1", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-replace": "^3.0.1", - "@rollup/plugin-url": "^6.1.0", "@svgr/rollup": "^6.2.0", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^12.0.0", @@ -50,6 +105,7 @@ "@types/react-virtualized-auto-sizer": "^1.0.0", "@types/react-window": "^1.8.2", "@types/rebass": "^4.0.7", + "@types/rollup-plugin-peer-deps-external": "^2.2.1", "@types/styled-components": "^5.1.0", "@types/testing-library__cypress": "^5.0.5", "@types/ua-parser-js": "^0.7.35", @@ -60,18 +116,27 @@ "@uniswap/governance": "^1.0.2", "@uniswap/liquidity-staker": "^1.0.2", "@uniswap/merkle-distributor": "1.0.1", + "@uniswap/redux-multicall": "^1.0.0", + "@uniswap/router-sdk": "^1.0.3", + "@uniswap/sdk-core": "^3.0.1", "@uniswap/smart-order-router": "^2.5.10", + "@uniswap/token-lists": "^1.0.0-beta.27", "@uniswap/v2-core": "1.0.0", "@uniswap/v2-periphery": "^1.1.0-beta.0", + "@uniswap/v2-sdk": "^3.0.1", "@uniswap/v3-core": "1.0.0", "@uniswap/v3-periphery": "^1.1.1", + "@uniswap/v3-sdk": "^3.7.1", + "@web3-react/core": "^6.0.9", "@web3-react/fortmatic-connector": "^6.0.9", "@web3-react/injected-connector": "^6.0.7", "@web3-react/portis-connector": "^6.0.9", "@web3-react/walletconnect-connector": "^7.0.2-alpha.0", "@web3-react/walletlink-connector": "^6.2.8", + "ajv": "^6.12.3", "array.prototype.flat": "^1.2.4", "array.prototype.flatmap": "^1.2.4", + "cids": "^1.0.0", "copy-to-clipboard": "^3.2.0", "cross-env": "^7.0.3", "cypress": "^7.7.0", @@ -87,129 +152,75 @@ "firebase": "^9.1.3", "graphql": "^15.5.0", "graphql-request": "^3.4.0", + "immer": "^9.0.6", "inter-ui": "^3.13.1", "jest-styled-components": "^7.0.5", + "jotai": "^1.3.7", + "jsbi": "^3.1.4", + "make-plural": "^7.0.0", + "ms.macro": "^2.0.0", + "multicodec": "^3.0.1", + "multihashes": "^4.0.2", + "node-vibrant": "^3.2.1-alpha.1", + "polished": "^3.3.2", "polyfill-object.fromentries": "^1.0.1", + "popper-max-size-modifier": "^0.2.0", "prettier": "^2.2.1", "qs": "^6.9.4", + "react": "^17.0.1", "react-confetti": "^6.0.0", "react-cosmos": "^5.6.6", + "react-dom": "^17.0.1", + "react-feather": "^2.0.8", "react-ga": "^2.5.7", "react-is": "^17.0.2", "react-markdown": "^4.3.1", + "react-popper": "^2.2.3", + "react-redux": "^7.2.2", "react-router-dom": "^5.0.0", "react-scripts": "^4.0.3", "react-spring": "^8.0.27", "react-use-gesture": "^6.0.14", + "react-virtualized-auto-sizer": "^1.0.2", + "react-window": "^1.8.5", + "rebass": "^4.0.7", + "redux": "^4.1.2", "redux-localstorage-simple": "^2.3.1", - "rollup": "^2.63.0", + "rollup": "^2.66.1", "rollup-plugin-dts": "^4.1.0", + "rollup-plugin-peer-deps-external": "^2.2.4", + "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-scss": "^3.0.0", + "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.31.1", "sass": "^1.45.1", "serve": "^11.3.2", "start-server-and-test": "^1.11.0", - "typechain": "^5.0.0", - "typescript": "^4.2.3", + "tiny-invariant": "^1.2.0", "ua-parser-js": "^0.7.28", "use-count-up": "^2.2.5", "use-resize-observer": "^8.0.0", "wcag-contrast": "^3.0.0", "web-vitals": "^2.1.0", + "wicg-inert": "^3.1.1", "workbox-core": "^6.1.0", "workbox-precaching": "^6.1.0", "workbox-routing": "^6.1.0" }, - "resolutions": { - "@walletconnect/ethereum-provider": "1.7.1" - }, - "scripts": { - "contracts:compile:abi": "typechain --target ethers-v5 --out-dir src/abis/types \"./src/abis/**/*.json\"", - "contracts:compile:v3": "typechain --target ethers-v5 --out-dir src/types/v3 \"./node_modules/@uniswap/**/artifacts/contracts/**/*.json\"", - "contracts:compile": "yarn contracts:compile:abi && yarn contracts:compile:v3", - "graphql:generate": "graphql-codegen --config codegen.yml", - "prei18n:extract": "touch src/locales/en-US.po", - "i18n:extract": "lingui extract --locale en-US", - "i18n:compile": "yarn i18n:extract && lingui compile", - "i18n:pseudo": "lingui extract --locale pseudo && lingui compile", - "postinstall": "yarn contracts:compile && yarn graphql:generate && yarn i18n:compile", - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test --env=./custom-test-env.js", - "test:e2e": "start-server-and-test 'serve build -l 3000' http://localhost:3000 'cypress run --record'", - "widgets:start": "cosmos", - "widgets:build": "rollup --config --failAfterWarnings --configPlugin typescript2" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, - "license": "GPL-3.0-or-later", - "dependencies": { - "@ethersproject/abi": "^5.4.1", - "@ethersproject/abstract-provider": "^5.4.1", - "@ethersproject/address": "^5.4.0", - "@ethersproject/bignumber": "^5.4.2", - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/constants": "^5.4.0", - "@ethersproject/contracts": "^5.4.1", - "@ethersproject/hash": "^5.4.0", - "@ethersproject/providers": "^5.4.5", - "@ethersproject/solidity": "^5.4.0", - "@ethersproject/strings": "^5.4.0", - "@ethersproject/units": "^5.4.0", - "@ethersproject/wallet": "^5.4.0", - "@fontsource/ibm-plex-mono": "^4.5.1", - "@fontsource/inter": "^4.5.1", - "@lingui/core": "^3.9.0", - "@lingui/macro": "^3.9.0", - "@lingui/react": "^3.9.0", - "@popperjs/core": "^2.4.4", - "@uniswap/redux-multicall": "^1.0.0", - "@uniswap/router-sdk": "^1.0.3", - "@uniswap/sdk-core": "^3.0.1", - "@uniswap/token-lists": "^1.0.0-beta.27", - "@uniswap/v2-sdk": "^3.0.1", - "@uniswap/v3-sdk": "^3.7.1", - "@web3-react/core": "^6.0.9", - "ajv": "^6.12.3", - "cids": "^1.0.0", - "immer": "^9.0.6", - "jotai": "^1.3.7", - "jsbi": "^3.1.4", - "make-plural": "^7.0.0", - "ms.macro": "^2.0.0", - "multicodec": "^3.0.1", - "multihashes": "^4.0.2", - "node-vibrant": "^3.2.1-alpha.1", - "polished": "^3.3.2", - "popper-max-size-modifier": "^0.2.0", - "react": "^17.0.1", - "react-dom": "^17.0.1", - "react-feather": "^2.0.8", - "react-popper": "^2.2.3", - "react-redux": "^7.2.2", - "react-virtualized-auto-sizer": "^1.0.2", - "react-window": "^1.8.5", - "rebass": "^4.0.7", - "redux": "^4.1.2", - "styled-components": "^5.3.0", - "tiny-invariant": "^1.2.0", - "wcag-contrast": "^3.0.0", - "wicg-inert": "^3.1.1", - "widgets-web3-react/core": "npm:@web3-react/core@8.0.16-alpha.0", - "widgets-web3-react/eip1193": "npm:@web3-react/eip1193@8.0.16-alpha.0", - "widgets-web3-react/empty": "npm:@web3-react/empty@8.0.17-alpha.0", - "widgets-web3-react/metamask": "npm:@web3-react/metamask@8.0.16-alpha.0", - "widgets-web3-react/types": "npm:@web3-react/types@8.0.16-alpha.0", - "widgets-web3-react/url": "npm:@web3-react/url@8.0.17-alpha.0" + "devDependencies": { + "rollup-plugin-node-polyfills": "^0.2.1", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-eslint": "^8.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "@rollup/plugin-replace": "^3.0.1", + "@rollup/plugin-url": "^6.1.0", + "typechain": "^5.0.0", + "typescript": "^4.2.3", + "@graphql-codegen/cli": "1.21.5", + "@graphql-codegen/typescript": "1.22.3", + "@graphql-codegen/typescript-operations": "^1.18.2", + "@graphql-codegen/typescript-rtk-query": "^1.1.1" } } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 00000000000..3de214f2780 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,122 @@ +/** + * Bundles the widgets library, which is released independently of the interface application. + * This library lives in src/lib, but shares code with the interface application. + */ +// import eslint from '@rollup/plugin-eslint' +// import babel from '@rollup/plugin-babel' +import nodePolyfills from 'rollup-plugin-node-polyfills' + +// import { getBabelOutputPlugin } from '@rollup/plugin-babel' +import json from '@rollup/plugin-json' +import url from '@rollup/plugin-url' +import svgr from '@svgr/rollup' +import dts from 'rollup-plugin-dts' +import sass from 'rollup-plugin-scss' +// import { DEFAULT_EXTENSIONS } from '@babel/core' +import typescript from 'rollup-plugin-typescript2' + +// import babel from '@rollup/plugin-babel' +// import { DEFAULT_EXTENSIONS } from '@babel/core' +import replace from '@rollup/plugin-replace' +require('dotenv').config() +// import external from 'rollup-plugin-peer-deps-external' + +// import { dependencies } from './package.json' + +// const deps = Object.keys(dependencies) +const extensions = ['.ts', '.tsx'] + +const replacements = { + 'process.env.REACT_APP_IS_WIDGET': false, +} + +// const ignore = ['styled-components'] + +const library = { + external: ['@babel/runtime', '@metamask/jazzicon'], + input: 'src/snowflake/index.ts', + output: [ + // { + // file: 'dist2/snowflake.js', + // format: 'cjs', + // inlineDynamicImports: true, + // sourcemap: true, + // }, + { + file: 'dist2/snowflake.esm.js', + format: 'esm', + inlineDynamicImports: true, + sourcemap: false, + plugins: [ + // getBabelOutputPlugin({ + // presets: [ + // [ + // 'react-app', + // { + // runtime: 'automatic', + // }, + // ], + // ], + // // include: ['./src/**'], + // // extensions, + // // babelHelpers: 'runtime', + // }), + ], + }, + ], + // necessary because some nested imports (eg jotai/*) would otherwise not resolve. + // external: (source: string) => Boolean(deps.find((dep) => source === dep || source.startsWith(dep + '/'))), + // external: (source: string) => ignore.includes(source), + plugins: [ + // external(), + // eslint({ include: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'] }), + nodePolyfills(), + // resolve({ + // extensions, + // browser: true, + // }), + // commonjs(), + + replace({ ...replacements, preventAssignment: true }), + + // babel({ + // presets: [['babel-preset-react-app/dependencies', { helpers: true }]], + // exclude: /@babel(?:\/|\\{1,2})runtime/, + // extensions: ['js', 'mjs'], + // babelHelpers: 'bundled', + // }), + + typescript({ tsconfig: './tsconfig.json', useTsconfigDeclarationDir: true }), + // commonjs({ esmExternals: true, requireReturnsDefault: false }), + // resolve(), + + // babel({ + // extensions: [...DEFAULT_EXTENSIONS, '.ts', 'tsx'], + // babelHelpers: 'runtime', + // exclude: /node_modules/, + // }), + // commonjs({ ignore: ['node_modules/styled-components/**/*.js'] }), + // eslint({ include: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'] }), + json(), // imports json + // replace({ ...replacements, preventAssignment: true }), + url(), // imports files (including svgs) as data URIs + svgr({ exportType: 'named', svgo: false }), // imports svgs as React components + sass(), // imports sass styles + ], +} + +const typings = { + input: 'dist2/types/snowflake.d.ts', + output: { + file: 'dist2/snowflake.d.ts', + format: 'es', + }, + external: (source) => source.endsWith('.scss'), + // plugins: [dts()], + plugins: [dts({ compilerOptions: { baseUrl: 'dist2/types' } })], +} + +// const config = [library, typings] +// const config = [library] + +export default library diff --git a/rollup.config.ts b/rollup.config.ts deleted file mode 100644 index 7da55cde6f8..00000000000 --- a/rollup.config.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Bundles the widgets library, which is released independently of the interface application. - * This library lives in src/lib, but shares code with the interface application. - */ - -import eslint from '@rollup/plugin-eslint' -import json from '@rollup/plugin-json' -import replace from '@rollup/plugin-replace' -import url from '@rollup/plugin-url' -import svgr from '@svgr/rollup' -import dts from 'rollup-plugin-dts' -import sass from 'rollup-plugin-scss' -import typescript from 'rollup-plugin-typescript2' - -import { dependencies } from './package.json' - -const deps = Object.keys(dependencies) - -const replacements = { - 'process.env.REACT_APP_IS_WIDGET': true, -} - -const library = { - input: 'src/lib/index.tsx', - output: [ - { - file: 'dist/widgets.js', - format: 'cjs', - inlineDynamicImports: true, - sourcemap: true, - }, - { - file: 'dist/widgets.esm.js', - format: 'esm', - inlineDynamicImports: true, - sourcemap: true, - }, - ], - // necessary because some nested imports (eg jotai/*) would otherwise not resolve. - external: (source: string) => Boolean(deps.find((dep) => source === dep || source.startsWith(dep + '/'))), - plugins: [ - eslint({ include: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'] }), - json(), // imports json - replace({ ...replacements, preventAssignment: true }), - url(), // imports files (including svgs) as data URIs - svgr({ exportType: 'named', svgo: false }), // imports svgs as React components - sass(), // imports sass styles - typescript({ tsconfig: './tsconfig.lib.json', useTsconfigDeclarationDir: true }), - ], -} - -const typings = { - input: 'dist/dts/lib/index.d.ts', - output: { - file: 'dist/widgets.d.ts', - format: 'es', - }, - external: (source: string) => source.endsWith('.scss'), - plugins: [dts({ compilerOptions: { baseUrl: 'dist/dts' } })], -} - -const config = [library, typings] -export default config diff --git a/src/hooks/useActiveWeb3React.ts b/src/hooks/useActiveWeb3React.ts index bf900ed8776..ed3cd50f5fd 100644 --- a/src/hooks/useActiveWeb3React.ts +++ b/src/hooks/useActiveWeb3React.ts @@ -1,14 +1,14 @@ /* eslint-disable react-hooks/rules-of-hooks */ import { Web3Provider } from '@ethersproject/providers' import { useWeb3React } from '@web3-react/core' -import { default as useWidgetsWeb3React } from 'lib/hooks/useActiveWeb3React' +// import { default as useWidgetsWeb3React } from 'lib/hooks/useActiveWeb3React' import { NetworkContextName } from '../constants/misc' export default function useActiveWeb3React() { - if (process.env.REACT_APP_IS_WIDGET) { - return useWidgetsWeb3React() - } + // if (process.env.REACT_APP_IS_WIDGET) { + // return useWidgetsWeb3React() + // } const interfaceContext = useWeb3React() const interfaceNetworkContext = useWeb3React( diff --git a/src/snowflake/App.tsx b/src/snowflake/App.tsx new file mode 100644 index 00000000000..90e072bdd0f --- /dev/null +++ b/src/snowflake/App.tsx @@ -0,0 +1,86 @@ +import Loader from 'components/Loader' +import ApeModeQueryParamReader from 'hooks/useApeModeQueryParamReader' +import { lazy, Suspense } from 'react' +import { Redirect, Route, Switch } from 'react-router-dom' +import styled from 'styled-components/macro' +import AddressClaimModal from '../components/claim/AddressClaimModal' +import ErrorBoundary from '../components/ErrorBoundary' +import Header from '../components/Header' +import Polling from '../components/Header/Polling' +import Popups from '../components/Popups' +import Web3ReactManager from '../components/Web3ReactManager' +import { useModalOpen, useToggleModal } from '../state/application/hooks' +import { ApplicationModal } from '../state/application/reducer' +import DarkModeQueryParamReader from '../theme/DarkModeQueryParamReader' +import Swap from '../pages/Swap' +import { OpenClaimAddressModalAndRedirectToSwap, RedirectPathToSwapOnly, RedirectToSwap } from '../pages/Swap/redirects' + +// const Vote = lazy(() => import('./Vote')) + +const AppWrapper = styled.div` + display: flex; + flex-flow: column; + align-items: flex-start; +` + +const BodyWrapper = styled.div` + display: flex; + flex-direction: column; + width: 100%; + padding: 120px 16px 0px 16px; + align-items: center; + flex: 1; + z-index: 1; + + ${({ theme }) => theme.mediaWidth.upToSmall` + padding: 4rem 8px 16px 8px; + `}; +` + +const HeaderWrapper = styled.div` + ${({ theme }) => theme.flexRowNoWrap} + width: 100%; + justify-content: space-between; + position: fixed; + top: 0; + z-index: 2; +` + +const Marginer = styled.div` + margin-top: 5rem; +` + +function TopLevelModals() { + const open = useModalOpen(ApplicationModal.ADDRESS_CLAIM) + const toggle = useToggleModal(ApplicationModal.ADDRESS_CLAIM) + return +} + +export default function App() { + return ( + + + + + + +
+ + + + + + }> + + + + + + + + + + + + ) +} diff --git a/src/snowflake/AppBody.tsx b/src/snowflake/AppBody.tsx new file mode 100644 index 00000000000..55f3f8f7b4d --- /dev/null +++ b/src/snowflake/AppBody.tsx @@ -0,0 +1,25 @@ +import React from 'react' +import styled from 'styled-components/macro' +import { Z_INDEX } from 'theme' + +export const BodyWrapper = styled.main<{ margin?: string; maxWidth?: string }>` + position: relative; + margin-top: ${({ margin }) => margin ?? '0px'}; + max-width: ${({ maxWidth }) => maxWidth ?? '480px'}; + width: 100%; + background: ${({ theme }) => theme.bg0}; + box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), + 0px 24px 32px rgba(0, 0, 0, 0.01); + border-radius: 24px; + margin-top: 1rem; + margin-left: auto; + margin-right: auto; + z-index: ${Z_INDEX.deprecated_content}; +` + +/** + * The styled container element that wraps the content of most pages and the tabs. + */ +export default function AppBody({ children, ...rest }: { children: React.ReactNode }) { + return {children} +} diff --git a/src/snowflake/Providers.tsx b/src/snowflake/Providers.tsx new file mode 100644 index 00000000000..d649f010aa5 --- /dev/null +++ b/src/snowflake/Providers.tsx @@ -0,0 +1,33 @@ +import { FunctionComponent } from 'react' +import { createWeb3ReactRoot, Web3ReactProvider } from '@web3-react/core' +import { Provider } from 'react-redux' +import { HashRouter } from 'react-router-dom' +import Blocklist from '../components/Blocklist' +import { NetworkContextName } from '../constants/misc' +import { LanguageProvider } from '../i18n' +import store from '../state' +import ThemeProvider, { ThemedGlobalStyle } from '../theme' +import getLibrary from '../utils/getLibrary' +import { Updaters } from './Updaters' + +const Web3ProviderNetwork = createWeb3ReactRoot(NetworkContextName) + +export const Providers: FunctionComponent = (props) => ( + + + + + + + + + + {props.children} + + + + + + + +) diff --git a/src/snowflake/Updaters.tsx b/src/snowflake/Updaters.tsx new file mode 100644 index 00000000000..2b460e019cd --- /dev/null +++ b/src/snowflake/Updaters.tsx @@ -0,0 +1,23 @@ +import { BlockUpdater } from 'lib/hooks/useBlockNumber' +import { MulticallUpdater } from 'lib/state/multicall' +import ApplicationUpdater from '../state/application/updater' +import ListsUpdater from '../state/lists/updater' +import LogsUpdater from '../state/logs/updater' +import TransactionUpdater from '../state/transactions/updater' +import UserUpdater from '../state/user/updater' +import RadialGradientByChainUpdater from '../theme/RadialGradientByChainUpdater' + +export function Updaters() { + return ( + <> + + + + + + + + + + ) +} diff --git a/src/snowflake/index.ts b/src/snowflake/index.ts new file mode 100644 index 00000000000..ec9a09e98eb --- /dev/null +++ b/src/snowflake/index.ts @@ -0,0 +1,8 @@ +// snowflake exports + +export { default as App } from './App' +export { default as Swap } from '../pages/Swap' +export * as serviceWorkerRegistration from '../serviceWorkerRegistration' +export * from './Providers' +export * from './Updaters' +export { INFURA_NETWORK_URLS } from 'constants/chainInfo' diff --git a/src/snowflake/styled.tsx b/src/snowflake/styled.tsx new file mode 100644 index 00000000000..b5c9bbd7988 --- /dev/null +++ b/src/snowflake/styled.tsx @@ -0,0 +1,12 @@ +import styled from 'styled-components/macro' + +export const IframeBodyWrapper = styled.div` + display: flex; + flex-direction: column; + width: 100%; + margin-top: 3rem; + padding: 1rem; + align-items: center; + flex: 1; + z-index: 1; +` diff --git a/tsconfig.base.json b/tsconfig.base.json index c92c0ef8310..c7dce16414a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -5,7 +5,6 @@ "allowJs": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "noEmit": true, "esModuleInterop": true, "module": "esnext", "strict": true, @@ -24,5 +23,5 @@ "allowSyntheticDefaultImports": true, "types": ["react-spring", "jest"] }, - "exclude": ["node_modules", "cypress"], + "exclude": ["node_modules", "cypress"] } diff --git a/tsconfig.json b/tsconfig.json index 2d36fd433fe..ec70a0b29b4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,15 @@ "extends": "./tsconfig.base.json", "compilerOptions": { "jsx": "react-jsx", - "baseUrl": "src" + "baseUrl": "src", + "noEmit": true }, - "exclude": ["node_modules", "cypress"], - "include": ["src/**/*"] + "exclude": [ + "node_modules", + "cypress", + "src/**/*.test.*" + ], + "include": [ + "src/**/*" + ] } diff --git a/tsconfig.lib.json b/tsconfig.lib.json index ec839e1b6c2..fa39e12c14d 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -3,7 +3,7 @@ "compilerOptions": { "jsx": "react-jsx", "declaration": true, - "declarationDir": "dist/dts", + "declarationDir": "dist2/dts", "baseUrl": "src/lib", "paths": { "lib/*": ["./*"], @@ -13,8 +13,8 @@ "hooks/*": ["../hooks/*"], "state/*": ["../state/*"], "types/*": ["../types/*"], - "utils/*": ["../utils/*"], - }, + "utils/*": ["../utils/*"] + } }, "exclude": ["node_modules", "src/lib/**/*.test.*"], "include": ["src/lib/**/*"] diff --git a/yarn.lock b/yarn.lock index ad9f3b687ef..374a02266de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -87,7 +87,7 @@ jsesc "^2.5.1" source-map "^0.5.0" -"@babel/helper-annotate-as-pure@^7.0.0", "@babel/helper-annotate-as-pure@^7.16.7": +"@babel/helper-annotate-as-pure@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" integrity sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw== @@ -205,7 +205,7 @@ dependencies: "@babel/types" "^7.16.7" -"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.12.1", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.13.12", "@babel/helper-module-imports@^7.16.7": +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.1", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.13.12", "@babel/helper-module-imports@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== @@ -1245,6 +1245,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.7.tgz#03ff99f64106588c9c403c6ecb8c3bafbbdff1fa" + integrity sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.10.4", "@babel/template@^7.16.7", "@babel/template@^7.3.3": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" @@ -1269,7 +1276,7 @@ globals "^11.1.0" lodash "^4.17.19" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.7.0": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.8.tgz#bab2f2b09a5fe8a8d9cad22cbfe3ba1d126fef9c" integrity sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ== @@ -1404,7 +1411,7 @@ resolved "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz" integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow== -"@emotion/is-prop-valid@0.8.8", "@emotion/is-prop-valid@^0.8.1", "@emotion/is-prop-valid@^0.8.8": +"@emotion/is-prop-valid@0.8.8", "@emotion/is-prop-valid@^0.8.1": version "0.8.8" resolved "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz" integrity sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA== @@ -1455,12 +1462,12 @@ "@emotion/styled-base" "^10.0.27" babel-plugin-emotion "^10.0.27" -"@emotion/stylis@0.8.5", "@emotion/stylis@^0.8.4": +"@emotion/stylis@0.8.5": version "0.8.5" resolved "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz" integrity sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ== -"@emotion/unitless@0.7.5", "@emotion/unitless@^0.7.4": +"@emotion/unitless@0.7.5": version "0.7.5" resolved "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz" integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== @@ -3313,11 +3320,6 @@ "@babel/runtime" "^7.11.2" "@lingui/core" "^3.9.0" -"@metamask/detect-provider@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@metamask/detect-provider/-/detect-provider-1.2.0.tgz#3667a7531f2a682e3c3a43eaf3a1958bdb42a696" - integrity sha512-ocA76vt+8D0thgXZ7LxFPyqw3H7988qblgzddTDA6B8a/yU0uKV42QR/DhA+Jh11rJjxW0jKvwb5htA6krNZDQ== - "@metamask/jazzicon@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@metamask/jazzicon/-/jazzicon-2.0.0.tgz#5615528e91c0fc5c9d79202d1f0954a7922525a0" @@ -3625,6 +3627,27 @@ redux-thunk "^2.3.0" reselect "^4.0.0" +"@rollup/plugin-babel@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz#9cb1c5146ddd6a4968ad96f209c50c62f92f9879" + integrity sha512-9uIC8HZOnVLrLHxayq/PTzw+uS25E14KPUBh5ktF+18Mjo5yK0ToMMx6epY0uEgkjwJw0aBW4x2horYXh8juWw== + dependencies: + "@babel/helper-module-imports" "^7.10.4" + "@rollup/pluginutils" "^3.1.0" + +"@rollup/plugin-commonjs@^21.0.1": + version "21.0.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-21.0.1.tgz#1e57c81ae1518e4df0954d681c642e7d94588fee" + integrity sha512-EA+g22lbNJ8p5kuZJUYyhhDK7WgJckW5g4pNN7n4mAFUM96VuwUnNT3xr2Db2iCZPI1pJPbGyfT5mS9T1dHfMg== + dependencies: + "@rollup/pluginutils" "^3.1.0" + commondir "^1.0.1" + estree-walker "^2.0.1" + glob "^7.1.6" + is-reference "^1.2.1" + magic-string "^0.25.7" + resolve "^1.17.0" + "@rollup/plugin-eslint@^8.0.1": version "8.0.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-eslint/-/plugin-eslint-8.0.1.tgz#bf7462f96027613729b8a805caaa951dc23c333e" @@ -3640,6 +3663,18 @@ dependencies: "@rollup/pluginutils" "^3.0.8" +"@rollup/plugin-node-resolve@^13.1.3": + version "13.1.3" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.1.3.tgz#2ed277fb3ad98745424c1d2ba152484508a92d79" + integrity sha512-BdxNk+LtmElRo5d06MGY4zoepyrXX1tkzX2hrnPEZ53k78GuOMWLqmJDGIIOPwVRIFZrLQOo+Yr6KtCuLIA0AQ== + dependencies: + "@rollup/pluginutils" "^3.1.0" + "@types/resolve" "1.17.1" + builtin-modules "^3.1.0" + deepmerge "^4.2.2" + is-module "^1.0.0" + resolve "^1.19.0" + "@rollup/plugin-node-resolve@^7.1.1": version "7.1.3" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz#80de384edfbd7bfc9101164910f86078151a3eca" @@ -4785,11 +4820,26 @@ dependencies: "@types/node" "*" +"@types/resolve@1.17.1": + version "1.17.1" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" + integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== + dependencies: + "@types/node" "*" + "@types/retry@*": version "0.12.1" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065" integrity sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g== +"@types/rollup-plugin-peer-deps-external@^2.2.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@types/rollup-plugin-peer-deps-external/-/rollup-plugin-peer-deps-external-2.2.1.tgz#7711fe77727c2ec920d3e096fa4e61d02734a23d" + integrity sha512-CUK4Mi3M3A/0coRUeo4McvUFOxR5H6UYd6Wt3D+K4c4fJupolMSoIxsZaBG1g/BJQOaujf78Pf7KhgfhrX1FZA== + dependencies: + "@types/node" "*" + rollup "^0.63.4" + "@types/scheduler@*": version "0.16.2" resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" @@ -5582,27 +5632,11 @@ "@web3-react/types" "^6.0.7" tiny-invariant "^1.0.6" -"@web3-react/store@^8.0.16-alpha.0": - version "8.0.16-alpha.0" - resolved "https://registry.yarnpkg.com/@web3-react/store/-/store-8.0.16-alpha.0.tgz#05b1a7ddfdaceba98bb9b878ea81616de88acce0" - integrity sha512-U5jX4kyaErGYyvxNv6FCb73OwqS6Wy/iQOut/JAzx1xJ/Gi31vsF1JyIt+y+z5YZty1hU1Bh5T0jNXp+9S75Rw== - dependencies: - "@ethersproject/address" "^5.4.0" - "@web3-react/types" "^8.0.16-alpha.0" - zustand "^4.0.0-beta.0" - "@web3-react/types@^6.0.7": version "6.0.7" resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-6.0.7.tgz#34a6204224467eedc6123abaf55fbb6baeb2809f" integrity sha512-ofGmfDhxmNT1/P/MgVa8IKSkCStFiyvXe+U5tyZurKdrtTDFU+wJ/LxClPDtFerWpczNFPUSrKcuhfPX1sI6+A== -"@web3-react/types@^8.0.16-alpha.0", "widgets-web3-react/types@npm:@web3-react/types@8.0.16-alpha.0": - version "8.0.16-alpha.0" - resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-8.0.16-alpha.0.tgz#bc9eeaf24d6a3e43cd262a90b4f48d1e4c95bfa4" - integrity sha512-vVVUeV0xNaYpn+35nbU2qmfELU5c6nioSTp5esRX3qChIc9eHss9r43AopTMOGiS6keC/fjzuSXOxK33nRBIyA== - dependencies: - zustand "^4.0.0-beta.0" - "@web3-react/walletconnect-connector@^7.0.2-alpha.0": version "7.0.2-alpha.0" resolved "https://registry.yarnpkg.com/@web3-react/walletconnect-connector/-/walletconnect-connector-7.0.2-alpha.0.tgz#dacd59db626b42137a1e4f34ea23ef1f04cc8b99" @@ -6707,16 +6741,6 @@ babel-plugin-polyfill-regenerator@^0.3.0: dependencies: "@babel/helper-define-polyfill-provider" "^0.3.0" -"babel-plugin-styled-components@>= 1.12.0": - version "1.13.1" - resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.13.1.tgz#5ecd28b207627c2a26ef8d5da401e9644065095a" - integrity sha512-iY11g5orsdBnvWtXKCFBzDyTxZ9jvmkcYCCs5ONlvASYltDRhieCVzeDC7Do0fSW7psAL0zfVoXB3FHz2CkUSg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-module-imports" "^7.0.0" - babel-plugin-syntax-jsx "^6.18.0" - lodash "^4.17.11" - babel-plugin-syntax-async-functions@^6.8.0: version "6.13.0" resolved "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz" @@ -7528,7 +7552,7 @@ browserslist@^3.2.6: caniuse-lite "^1.0.30000844" electron-to-chromium "^1.3.47" -browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.17.5, browserslist@^4.19.1, browserslist@^4.6.2, browserslist@^4.6.4: +browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.16.6, browserslist@^4.17.5, browserslist@^4.19.1, browserslist@^4.6.2, browserslist@^4.6.4: version "4.19.1" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.19.1.tgz#4ac0435b35ab655896c31d53018b6dd5e9e4c9a3" integrity sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A== @@ -7822,11 +7846,6 @@ camelcase@^6.0.0, camelcase@^6.1.0, camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -camelize@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz" - integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs= - caniuse-api@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0" @@ -8357,6 +8376,11 @@ color@^3.0.0: color-convert "^1.9.3" color-string "^1.6.0" +colord@^2.9.1: + version "2.9.2" + resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.2.tgz#25e2bacbbaa65991422c07ea209e2089428effb1" + integrity sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ== + colorette@^1.2.1, colorette@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" @@ -8498,6 +8522,13 @@ concat-stream@^1.5.0, concat-stream@^1.5.1: readable-stream "^2.2.2" typedarray "^0.0.6" +concat-with-sourcemaps@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz#d4ea93f05ae25790951b99e7b3b09e3908a4082e" + integrity sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg== + dependencies: + source-map "^0.6.1" + confusing-browser-globals@^1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz#30d1e7f3d1b882b25ec4933d1d1adac353d20a59" @@ -8818,11 +8849,6 @@ css-blank-pseudo@^0.1.4: dependencies: postcss "^7.0.5" -css-color-keywords@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz" - integrity sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU= - css-color-names@0.0.4, css-color-names@^0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" @@ -8836,6 +8862,13 @@ css-declaration-sorter@^4.0.1: postcss "^7.0.1" timsort "^0.3.0" +css-declaration-sorter@^6.0.3: + version "6.1.4" + resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-6.1.4.tgz#b9bfb4ed9a41f8dcca9bf7184d849ea94a8294b4" + integrity sha512-lpfkqS0fctcmZotJGhnxkIyJWvBXgpyi2wsFd4J8VB7wzyrT6Ch/3Q+FMNJpjK4gu1+GN5khOnpU2ZVKrLbhCw== + dependencies: + timsort "^0.3.0" + css-has-pseudo@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/css-has-pseudo/-/css-has-pseudo-0.10.0.tgz#3c642ab34ca242c59c41a125df9105841f6966ee" @@ -8895,15 +8928,6 @@ css-select@^4.1.3: domutils "^2.6.0" nth-check "^2.0.0" -css-to-react-native@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-3.0.0.tgz#62dbe678072a824a689bcfee011fc96e02a7d756" - integrity sha512-Ro1yETZA813eoyUp2GDBhG2j+YggidUmzO1/v9eYBKR2EHVEniE2MI/NqpTQ954BMpTPZFsGNPm46qFB9dpaPQ== - dependencies: - camelize "^1.0.0" - css-color-keywords "^1.0.0" - postcss-value-parser "^4.0.2" - css-tree@1.0.0-alpha.37: version "1.0.0-alpha.37" resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.37.tgz#98bebd62c4c1d9f960ec340cf9f7522e30709a22" @@ -9005,6 +9029,41 @@ cssnano-preset-default@^4.0.8: postcss-svgo "^4.0.3" postcss-unique-selectors "^4.0.1" +cssnano-preset-default@^5.1.11: + version "5.1.11" + resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.1.11.tgz#db10fb1ecee310e8285c5aca45bd8237be206828" + integrity sha512-ETet5hqHxmzQq2ynXMOQofKuLm7VOjMiOB7E2zdtm/hSeCKlD9fabzIUV4GoPcRyJRHi+4kGf0vsfGYbQ4nmPw== + dependencies: + css-declaration-sorter "^6.0.3" + cssnano-utils "^3.0.1" + postcss-calc "^8.2.0" + postcss-colormin "^5.2.4" + postcss-convert-values "^5.0.3" + postcss-discard-comments "^5.0.2" + postcss-discard-duplicates "^5.0.2" + postcss-discard-empty "^5.0.2" + postcss-discard-overridden "^5.0.3" + postcss-merge-longhand "^5.0.5" + postcss-merge-rules "^5.0.5" + postcss-minify-font-values "^5.0.3" + postcss-minify-gradients "^5.0.5" + postcss-minify-params "^5.0.4" + postcss-minify-selectors "^5.1.2" + postcss-normalize-charset "^5.0.2" + postcss-normalize-display-values "^5.0.2" + postcss-normalize-positions "^5.0.3" + postcss-normalize-repeat-style "^5.0.3" + postcss-normalize-string "^5.0.3" + postcss-normalize-timing-functions "^5.0.2" + postcss-normalize-unicode "^5.0.3" + postcss-normalize-url "^5.0.4" + postcss-normalize-whitespace "^5.0.3" + postcss-ordered-values "^5.0.4" + postcss-reduce-initial "^5.0.2" + postcss-reduce-transforms "^5.0.3" + postcss-svgo "^5.0.3" + postcss-unique-selectors "^5.0.3" + cssnano-util-get-arguments@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz#ed3a08299f21d75741b20f3b81f194ed49cc150f" @@ -9027,6 +9086,11 @@ cssnano-util-same-parent@^4.0.0: resolved "https://registry.yarnpkg.com/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz#574082fb2859d2db433855835d9a8456ea18bbf3" integrity sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q== +cssnano-utils@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/cssnano-utils/-/cssnano-utils-3.0.1.tgz#d3cc0a142d3d217f8736837ec0a2ccff6a89c6ea" + integrity sha512-VNCHL364lh++/ono+S3j9NlUK+d97KNkxI77NlqZU2W3xd2/qmyN61dsa47pTpb55zuU4G4lI7qFjAXZJH1OAQ== + cssnano@^4.1.10: version "4.1.11" resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-4.1.11.tgz#c7b5f5b81da269cb1fd982cb960c1200910c9a99" @@ -9037,6 +9101,15 @@ cssnano@^4.1.10: is-resolvable "^1.0.0" postcss "^7.0.0" +cssnano@^5.0.1: + version "5.0.16" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-5.0.16.tgz#4ee97d30411693f3de24cef70b36f7ae2a843e04" + integrity sha512-ryhRI9/B9VFCwPbb1z60LLK5/ldoExi7nwdnJzpkLZkm2/r7j2X3jfY+ZvDVJhC/0fPZlrAguYdHNFg0iglPKQ== + dependencies: + cssnano-preset-default "^5.1.11" + lilconfig "^2.0.3" + yaml "^1.10.2" + csso@^4.0.2, csso@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/csso/-/csso-4.2.0.tgz#ea3a561346e8dc9f546d6febedd50187cf389529" @@ -10958,7 +11031,7 @@ eventemitter2@^6.4.3: resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.4.tgz#aa96e8275c4dbeb017a5d0e03780c65612a1202b" integrity sha512-HLU3NDY6wARrLCEwyGKRBvuWYyvW6mHYv72SJJAH3iJN3a6eVUvkjFkcxah1bcTgGVBBrFdIopBJPhCQFMLyXw== -eventemitter3@4.0.7, eventemitter3@^4.0.0: +eventemitter3@4.0.7, eventemitter3@^4.0.0, eventemitter3@^4.0.4: version "4.0.7" resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== @@ -11747,6 +11820,13 @@ fuzzaldrin@^2.1.0: resolved "https://registry.npmjs.org/fuzzaldrin/-/fuzzaldrin-2.1.0.tgz" integrity sha1-kCBMPi/appQbso0WZF1BgGOpDps= +generic-names@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/generic-names/-/generic-names-4.0.0.tgz#0bd8a2fd23fe8ea16cbd0a279acd69c06933d9a3" + integrity sha512-ySFolZQfw9FoDb3ed9d80Cm9f0+r7qj+HJkWjeD9RBfpxEVTlVhol+gvaQB/78WbwYfbnNh8nWHHBSlg072y6A== + dependencies: + loader-utils "^3.2.0" + gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -12238,7 +12318,7 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: +hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -12490,6 +12570,11 @@ iconv-lite@0.6, iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" +icss-replace-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" + integrity sha1-Bupvg2ead0njhs/h/oEq5dsiPe0= + icss-utils@^4.0.0, icss-utils@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467" @@ -12497,6 +12582,11 @@ icss-utils@^4.0.0, icss-utils@^4.1.1: dependencies: postcss "^7.0.14" +icss-utils@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" + integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA== + idb@3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/idb/-/idb-3.0.2.tgz#c8e9122d5ddd40f13b60ae665e4862f8b13fa384" @@ -12571,6 +12661,13 @@ import-cwd@^2.0.0: dependencies: import-from "^2.1.0" +import-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-3.0.0.tgz#20845547718015126ea9b3676b7592fb8bd4cf92" + integrity sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg== + dependencies: + import-from "^3.0.0" + import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" @@ -13153,6 +13250,13 @@ is-promise@^2.1.0: resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== +is-reference@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" + integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== + dependencies: + "@types/estree" "*" + is-regex@^1.0.4, is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -13833,7 +13937,7 @@ jest-worker@^24.9.0: merge-stream "^2.0.0" supports-color "^6.1.0" -jest-worker@^26.5.0, jest-worker@^26.6.2: +jest-worker@^26.2.1, jest-worker@^26.5.0, jest-worker@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== @@ -14351,6 +14455,11 @@ lie@~3.3.0: dependencies: immediate "~3.0.5" +lilconfig@^2.0.3, lilconfig@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.4.tgz#f4507d043d7058b380b6a8f5cb7bcd4b34cee082" + integrity sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA== + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -14469,6 +14578,11 @@ loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0: emojis-list "^3.0.0" json5 "^1.0.1" +loader-utils@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-3.2.0.tgz#bcecc51a7898bee7473d4bc6b845b23af8304d4f" + integrity sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ== + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -14706,7 +14820,7 @@ lz-string@^1.4.4: resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY= -magic-string@^0.25.0, magic-string@^0.25.7: +magic-string@^0.25.0, magic-string@^0.25.3, magic-string@^0.25.7: version "0.25.7" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== @@ -15502,6 +15616,11 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a" integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA== +normalize-url@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" + integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -15895,6 +16014,14 @@ p-map@^4.0.0: dependencies: aggregate-error "^3.0.0" +p-queue@^6.6.2: + version "6.6.2" + resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-6.6.2.tgz#2068a9dcf8e67dd0ec3e7a2bcb76810faa85e426" + integrity sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ== + dependencies: + eventemitter3 "^4.0.4" + p-timeout "^3.2.0" + p-retry@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-3.0.1.tgz#316b4c8893e2c8dc1cfa891f406c4b422bebf328" @@ -15902,6 +16029,13 @@ p-retry@^3.0.1: dependencies: retry "^0.12.0" +p-timeout@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-3.2.0.tgz#c7e17abc971d2a7962ef83626b35d635acf23dfe" + integrity sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg== + dependencies: + p-finally "^1.0.0" + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" @@ -16404,6 +16538,14 @@ postcss-calc@^7.0.1: postcss-selector-parser "^6.0.2" postcss-value-parser "^4.0.2" +postcss-calc@^8.2.0: + version "8.2.2" + resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-8.2.2.tgz#9706e7399e8ec8b61a47830dcf1f21391af23373" + integrity sha512-B5R0UeB4zLJvxNt1FVCaDZULdzsKLPc6FhjFJ+xwFiq7VG4i9cuaJLxVjNtExNK8ocm3n2o4unXXLiVX1SCqxA== + dependencies: + postcss-selector-parser "^6.0.2" + postcss-value-parser "^4.0.2" + postcss-color-functional-notation@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/postcss-color-functional-notation/-/postcss-color-functional-notation-2.0.1.tgz#5efd37a88fbabeb00a2966d1e53d98ced93f74e0" @@ -16457,6 +16599,16 @@ postcss-colormin@^4.0.3: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-colormin@^5.2.4: + version "5.2.4" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-5.2.4.tgz#7726d3f3d24f111d39faff50a6500688225d5324" + integrity sha512-rYlC5015aNqVQt/B6Cy156g7sH5tRUJGmT9xeagYthtKehetbKx7jHxhyLpulP4bs4vbp8u/B2rac0J7S7qPQg== + dependencies: + browserslist "^4.16.6" + caniuse-api "^3.0.0" + colord "^2.9.1" + postcss-value-parser "^4.2.0" + postcss-convert-values@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/postcss-convert-values/-/postcss-convert-values-4.0.1.tgz#ca3813ed4da0f812f9d43703584e449ebe189a7f" @@ -16465,6 +16617,13 @@ postcss-convert-values@^4.0.1: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-convert-values@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-convert-values/-/postcss-convert-values-5.0.3.tgz#492db08a28af84d57651f10edc8f6c8fb2f6df40" + integrity sha512-fVkjHm2T0PSMqXUCIhHNWVGjhB9mHEWX2GboVs7j3iCgr6FpIl9c/IdXy0PHWZSQ9LFTRgmj98amxJE6KOnlsA== + dependencies: + postcss-value-parser "^4.2.0" + postcss-custom-media@^7.0.8: version "7.0.8" resolved "https://registry.yarnpkg.com/postcss-custom-media/-/postcss-custom-media-7.0.8.tgz#fffd13ffeffad73621be5f387076a28b00294e0c" @@ -16503,6 +16662,11 @@ postcss-discard-comments@^4.0.2: dependencies: postcss "^7.0.0" +postcss-discard-comments@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/postcss-discard-comments/-/postcss-discard-comments-5.0.2.tgz#811ed34e2b6c40713daab0beb4d7a04125927dcd" + integrity sha512-6VQ3pYTsJHEsN2Bic88Aa7J/Brn4Bv8j/rqaFQZkH+pcVkKYwxCIvoMQkykEW7fBjmofdTnQgcivt5CCBJhtrg== + postcss-discard-duplicates@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz#3fe133cd3c82282e550fc9b239176a9207b784eb" @@ -16510,6 +16674,11 @@ postcss-discard-duplicates@^4.0.2: dependencies: postcss "^7.0.0" +postcss-discard-duplicates@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-5.0.2.tgz#61076f3d256351bdaac8e20aade730fef0609f44" + integrity sha512-LKY81YjUjc78p6rbXIsnppsaFo8XzCoMZkXVILJU//sK0DgPkPSpuq/cZvHss3EtdKvWNYgWzQL+wiJFtEET4g== + postcss-discard-empty@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/postcss-discard-empty/-/postcss-discard-empty-4.0.1.tgz#c8c951e9f73ed9428019458444a02ad90bb9f765" @@ -16517,6 +16686,11 @@ postcss-discard-empty@^4.0.1: dependencies: postcss "^7.0.0" +postcss-discard-empty@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/postcss-discard-empty/-/postcss-discard-empty-5.0.2.tgz#0676a9bcfc44bb00d338352a45ab80845a31d8f0" + integrity sha512-SxBsbTjlsKUvZLL+dMrdWauuNZU8TBq5IOL/DHa6jBUSXFEwmDqeXRfTIK/FQpPTa8MJMxEHjSV3UbiuyLARPQ== + postcss-discard-overridden@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-4.0.1.tgz#652aef8a96726f029f5e3e00146ee7a4e755ff57" @@ -16524,6 +16698,11 @@ postcss-discard-overridden@^4.0.1: dependencies: postcss "^7.0.0" +postcss-discard-overridden@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-5.0.3.tgz#004b9818cabb407e60616509267567150b327a3f" + integrity sha512-yRTXknIZA4k8Yo4FiF1xbsLj/VBxfXEWxJNIrtIy6HC9KQ4xJxcPtoaaskh6QptCGrrcGnhKsTsENTRPZOBu4g== + postcss-double-position-gradients@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/postcss-double-position-gradients/-/postcss-double-position-gradients-1.0.0.tgz#fc927d52fddc896cb3a2812ebc5df147e110522e" @@ -16607,6 +16786,14 @@ postcss-load-config@^2.0.0: cosmiconfig "^5.0.0" import-cwd "^2.0.0" +postcss-load-config@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-3.1.1.tgz#2f53a17f2f543d9e63864460af42efdac0d41f87" + integrity sha512-c/9XYboIbSEUZpiD1UQD0IKiUe8n9WHYV7YFe7X7J+ZwCsEKkUJSFWjS9hBU1RR9THR7jMXst8sxiqP0jjo2mg== + dependencies: + lilconfig "^2.0.4" + yaml "^1.10.2" + postcss-loader@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-3.0.0.tgz#6b97943e47c72d845fa9e03f273773d4e8dd6c2d" @@ -16641,6 +16828,14 @@ postcss-merge-longhand@^4.0.11: postcss-value-parser "^3.0.0" stylehacks "^4.0.0" +postcss-merge-longhand@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-5.0.5.tgz#cbc217ca22fb5a3e6ee22a6a1aa6920ec1f3c628" + integrity sha512-R2BCPJJ/U2oh1uTWEYn9CcJ7MMcQ1iIbj9wfr2s/zHu5om5MP/ewKdaunpfJqR1WYzqCsgnXuRoVXPAzxdqy8g== + dependencies: + postcss-value-parser "^4.2.0" + stylehacks "^5.0.2" + postcss-merge-rules@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-4.0.3.tgz#362bea4ff5a1f98e4075a713c6cb25aefef9a650" @@ -16653,6 +16848,16 @@ postcss-merge-rules@^4.0.3: postcss-selector-parser "^3.0.0" vendors "^1.0.0" +postcss-merge-rules@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-5.0.5.tgz#2a18669ec214019884a60f0a0d356803a8138366" + integrity sha512-3Oa26/Pb9VOFVksJjFG45SNoe4nhGvJ2Uc6TlRimqF8uhfOCEhVCaJ3rvEat5UFOn2UZqTY5Da8dFgCh3Iq0Ug== + dependencies: + browserslist "^4.16.6" + caniuse-api "^3.0.0" + cssnano-utils "^3.0.1" + postcss-selector-parser "^6.0.5" + postcss-minify-font-values@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-minify-font-values/-/postcss-minify-font-values-4.0.2.tgz#cd4c344cce474343fac5d82206ab2cbcb8afd5a6" @@ -16661,6 +16866,13 @@ postcss-minify-font-values@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-minify-font-values@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-minify-font-values/-/postcss-minify-font-values-5.0.3.tgz#48c455c4cd980ecd07ac9bf3fc58e9d8a2ae4168" + integrity sha512-bC45rVzEwsLhv/cL1eCjoo2OOjbSk9I7HKFBYnBvtyuIZlf7uMipMATXtA0Fc3jwPo3wuPIW1jRJWKzflMh1sA== + dependencies: + postcss-value-parser "^4.2.0" + postcss-minify-gradients@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-4.0.2.tgz#93b29c2ff5099c535eecda56c4aa6e665a663471" @@ -16671,6 +16883,15 @@ postcss-minify-gradients@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-minify-gradients@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-5.0.5.tgz#a5572b9c98ed52cbd7414db24b873f8b9e418290" + integrity sha512-/YjvXs8PepsoiZAIpjstOO4IHKwFAqYNqbA1yVdqklM84tbUUneh6omJxGlRlF3mi6K5Pa067Mg6IwqEnYC8Zg== + dependencies: + colord "^2.9.1" + cssnano-utils "^3.0.1" + postcss-value-parser "^4.2.0" + postcss-minify-params@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz#6b9cef030c11e35261f95f618c90036d680db874" @@ -16683,6 +16904,15 @@ postcss-minify-params@^4.0.2: postcss-value-parser "^3.0.0" uniqs "^2.0.0" +postcss-minify-params@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-minify-params/-/postcss-minify-params-5.0.4.tgz#230a4d04456609e614db1d48c2eebc21f6490a45" + integrity sha512-Z0vjod9lRZEmEPfEmA2sCfjbfEEFKefMD3RDIQSUfXK4LpCyWkX1CniUgyNvnjJFLDPSxtgKzozhHhPHKoeGkg== + dependencies: + browserslist "^4.16.6" + cssnano-utils "^3.0.1" + postcss-value-parser "^4.2.0" + postcss-minify-selectors@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-minify-selectors/-/postcss-minify-selectors-4.0.2.tgz#e2e5eb40bfee500d0cd9243500f5f8ea4262fbd8" @@ -16693,6 +16923,13 @@ postcss-minify-selectors@^4.0.2: postcss "^7.0.0" postcss-selector-parser "^3.0.0" +postcss-minify-selectors@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/postcss-minify-selectors/-/postcss-minify-selectors-5.1.2.tgz#bc9698f713b9dab7f44f1ec30643fcbad9a043c0" + integrity sha512-gpn1nJDMCf3g32y/7kl+jsdamhiYT+/zmEt57RoT9GmzlixBNRPohI7k8UIHelLABhdLf3MSZhtM33xuH5eQOQ== + dependencies: + postcss-selector-parser "^6.0.5" + postcss-modules-extract-imports@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz#818719a1ae1da325f9832446b01136eeb493cd7e" @@ -16700,6 +16937,11 @@ postcss-modules-extract-imports@^2.0.0: dependencies: postcss "^7.0.5" +postcss-modules-extract-imports@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz#cda1f047c0ae80c97dbe28c3e76a43b88025741d" + integrity sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw== + postcss-modules-local-by-default@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.3.tgz#bb14e0cc78279d504dbdcbfd7e0ca28993ffbbb0" @@ -16710,6 +16952,15 @@ postcss-modules-local-by-default@^3.0.3: postcss-selector-parser "^6.0.2" postcss-value-parser "^4.1.0" +postcss-modules-local-by-default@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz#ebbb54fae1598eecfdf691a02b3ff3b390a5a51c" + integrity sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ== + dependencies: + icss-utils "^5.0.0" + postcss-selector-parser "^6.0.2" + postcss-value-parser "^4.1.0" + postcss-modules-scope@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.2.0.tgz#385cae013cc7743f5a7d7602d1073a89eaae62ee" @@ -16718,6 +16969,13 @@ postcss-modules-scope@^2.2.0: postcss "^7.0.6" postcss-selector-parser "^6.0.0" +postcss-modules-scope@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz#9ef3151456d3bbfa120ca44898dfca6f2fa01f06" + integrity sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg== + dependencies: + postcss-selector-parser "^6.0.4" + postcss-modules-values@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz#5b5000d6ebae29b4255301b4a3a54574423e7f10" @@ -16726,6 +16984,27 @@ postcss-modules-values@^3.0.0: icss-utils "^4.0.0" postcss "^7.0.6" +postcss-modules-values@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz#d7c5e7e68c3bb3c9b27cbf48ca0bb3ffb4602c9c" + integrity sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ== + dependencies: + icss-utils "^5.0.0" + +postcss-modules@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/postcss-modules/-/postcss-modules-4.3.0.tgz#1cb32f16a8cfffe2b989598f8135eb6427106ec7" + integrity sha512-zoUttLDSsbWDinJM9jH37o7hulLRyEgH6fZm2PchxN7AZ8rkdWiALyNhnQ7+jg7cX9f10m6y5VhHsrjO0Mf/DA== + dependencies: + generic-names "^4.0.0" + icss-replace-symbols "^1.1.0" + lodash.camelcase "^4.3.0" + postcss-modules-extract-imports "^3.0.0" + postcss-modules-local-by-default "^4.0.0" + postcss-modules-scope "^3.0.0" + postcss-modules-values "^4.0.0" + string-hash "^1.1.1" + postcss-nesting@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/postcss-nesting/-/postcss-nesting-7.0.1.tgz#b50ad7b7f0173e5b5e3880c3501344703e04c052" @@ -16740,6 +17019,11 @@ postcss-normalize-charset@^4.0.1: dependencies: postcss "^7.0.0" +postcss-normalize-charset@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-charset/-/postcss-normalize-charset-5.0.2.tgz#eb6130c8a8e950ce25f9ea512de1d9d6a6f81439" + integrity sha512-fEMhYXzO8My+gC009qDc/3bgnFP8Fv1Ic8uw4ec4YTlhIOw63tGPk1YFd7fk9bZUf1DAbkhiL/QPWs9JLqdF2g== + postcss-normalize-display-values@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.2.tgz#0dbe04a4ce9063d4667ed2be476bb830c825935a" @@ -16749,6 +17033,13 @@ postcss-normalize-display-values@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-display-values@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-display-values/-/postcss-normalize-display-values-5.0.2.tgz#8b5273c6c7d0a445e6ef226b8a5bb3204a55fb99" + integrity sha512-RxXoJPUR0shSjkMMzgEZDjGPrgXUVYyWA/YwQRicb48H15OClPuaDR7tYokLAlGZ2tCSENEN5WxjgxSD5m4cUw== + dependencies: + postcss-value-parser "^4.2.0" + postcss-normalize-positions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-normalize-positions/-/postcss-normalize-positions-4.0.2.tgz#05f757f84f260437378368a91f8932d4b102917f" @@ -16759,6 +17050,13 @@ postcss-normalize-positions@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-positions@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-positions/-/postcss-normalize-positions-5.0.3.tgz#b63fcc4ff5fbf65934fafaf83270b2da214711d1" + integrity sha512-U+rmhjrNBvIGYqr/1tD4wXPFFMKUbXsYXvlUCzLi0tOCUS6LoeEAnmVXXJY/MEB/1CKZZwBSs2tmzGawcygVBA== + dependencies: + postcss-value-parser "^4.2.0" + postcss-normalize-repeat-style@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.2.tgz#c4ebbc289f3991a028d44751cbdd11918b17910c" @@ -16769,6 +17067,13 @@ postcss-normalize-repeat-style@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-repeat-style@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.0.3.tgz#488c0ad8aac0fa4f66ef56cc8d604b3fd9bf705f" + integrity sha512-uk1+xYx0AMbA3nLSNhbDrqbf/rx+Iuq5tVad2VNyaxxJzx79oGieJ6D9F6AfOL2GtiIbP7vTYlpYHtG+ERFXTg== + dependencies: + postcss-value-parser "^4.2.0" + postcss-normalize-string@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-normalize-string/-/postcss-normalize-string-4.0.2.tgz#cd44c40ab07a0c7a36dc5e99aace1eca4ec2690c" @@ -16778,6 +17083,13 @@ postcss-normalize-string@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-string@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-string/-/postcss-normalize-string-5.0.3.tgz#49e0a1d58a119d5435ef21893ad03136a6e8f0e6" + integrity sha512-Mf2V4JbIDboNGQhW6xW0YREDiYXoX3WrD3EjKkjvnpAJ6W4qqjLnK/c9aioyVFaWWHVdP5zVRw/9DI5S3oLDFw== + dependencies: + postcss-value-parser "^4.2.0" + postcss-normalize-timing-functions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.2.tgz#8e009ca2a3949cdaf8ad23e6b6ab99cb5e7d28d9" @@ -16787,6 +17099,13 @@ postcss-normalize-timing-functions@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-timing-functions@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.0.2.tgz#db4f4f49721f47667afd1fdc5edb032f8d9cdb2e" + integrity sha512-Ao0PP6MoYsRU1LxeVUW740ioknvdIUmfr6uAA3xWlQJ9s69/Tupy8qwhuKG3xWfl+KvLMAP9p2WXF9cwuk/7Bg== + dependencies: + postcss-value-parser "^4.2.0" + postcss-normalize-unicode@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.1.tgz#841bd48fdcf3019ad4baa7493a3d363b52ae1cfb" @@ -16796,6 +17115,14 @@ postcss-normalize-unicode@^4.0.1: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-unicode@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-unicode/-/postcss-normalize-unicode-5.0.3.tgz#10f0d30093598a58c48a616491cc7fa53256dd43" + integrity sha512-uNC7BmS/7h6to2UWa4RFH8sOTzu2O9dVWPE/F9Vm9GdhONiD/c1kNaCLbmsFHlKWcEx7alNUChQ+jH/QAlqsQw== + dependencies: + browserslist "^4.16.6" + postcss-value-parser "^4.2.0" + postcss-normalize-url@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/postcss-normalize-url/-/postcss-normalize-url-4.0.1.tgz#10e437f86bc7c7e58f7b9652ed878daaa95faae1" @@ -16806,6 +17133,14 @@ postcss-normalize-url@^4.0.1: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-url@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-normalize-url/-/postcss-normalize-url-5.0.4.tgz#3b0322c425e31dd275174d0d5db0e466f50810fb" + integrity sha512-cNj3RzK2pgQQyNp7dzq0dqpUpQ/wYtdDZM3DepPmFjCmYIfceuD9VIAcOdvrNetjIU65g1B4uwdP/Krf6AFdXg== + dependencies: + normalize-url "^6.0.1" + postcss-value-parser "^4.2.0" + postcss-normalize-whitespace@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.2.tgz#bf1d4070fe4fcea87d1348e825d8cc0c5faa7d82" @@ -16814,6 +17149,13 @@ postcss-normalize-whitespace@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-normalize-whitespace@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.0.3.tgz#fb6bcc9ff2f834448b802657c7acd0956f4591d1" + integrity sha512-333JWRnX655fSoUbufJ10HJop3c8mrpKkCCUnEmgz/Cb/QEtW+/TMZwDAUt4lnwqP6tCCk0x0b58jqvDgiQm/A== + dependencies: + postcss-value-parser "^4.2.0" + postcss-normalize@8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/postcss-normalize/-/postcss-normalize-8.0.1.tgz#90e80a7763d7fdf2da6f2f0f82be832ce4f66776" @@ -16834,6 +17176,14 @@ postcss-ordered-values@^4.1.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-ordered-values@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/postcss-ordered-values/-/postcss-ordered-values-5.0.4.tgz#f799dca87a7f17526d31a20085e61768d0b00534" + integrity sha512-taKtGDZtyYUMVYkg+MuJeBUiTF6cGHZmo/qcW7ibvW79UlyKuSHbo6dpCIiqI+j9oJsXWzP+ovIxoyLDOeQFdw== + dependencies: + cssnano-utils "^3.0.1" + postcss-value-parser "^4.2.0" + postcss-overflow-shorthand@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/postcss-overflow-shorthand/-/postcss-overflow-shorthand-2.0.0.tgz#31ecf350e9c6f6ddc250a78f0c3e111f32dd4c30" @@ -16917,6 +17267,14 @@ postcss-reduce-initial@^4.0.3: has "^1.0.0" postcss "^7.0.0" +postcss-reduce-initial@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-5.0.2.tgz#fa424ce8aa88a89bc0b6d0f94871b24abe94c048" + integrity sha512-v/kbAAQ+S1V5v9TJvbGkV98V2ERPdU6XvMcKMjqAlYiJ2NtsHGlKYLPjWWcXlaTKNxooId7BGxeraK8qXvzKtw== + dependencies: + browserslist "^4.16.6" + caniuse-api "^3.0.0" + postcss-reduce-transforms@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.2.tgz#17efa405eacc6e07be3414a5ca2d1074681d4e29" @@ -16927,6 +17285,13 @@ postcss-reduce-transforms@^4.0.2: postcss "^7.0.0" postcss-value-parser "^3.0.0" +postcss-reduce-transforms@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-reduce-transforms/-/postcss-reduce-transforms-5.0.3.tgz#df60fab34698a43073e8b87938c71df7a3b040ac" + integrity sha512-yDnTUab5i7auHiNwdcL1f+pBnqQFf+7eC4cbC7D8Lc1FkvNZhtpkdad+9U4wDdFb84haupMf0rA/Zc5LcTe/3A== + dependencies: + postcss-value-parser "^4.2.0" + postcss-replace-overflow-wrap@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/postcss-replace-overflow-wrap/-/postcss-replace-overflow-wrap-3.0.0.tgz#61b360ffdaedca84c7c918d2b0f0d0ea559ab01c" @@ -16983,6 +17348,14 @@ postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2: cssesc "^3.0.0" util-deprecate "^1.0.2" +postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.0.5: + version "6.0.9" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.9.tgz#ee71c3b9ff63d9cd130838876c13a2ec1a992b2f" + integrity sha512-UO3SgnZOVTwu4kyLR22UQ1xZh086RyNZppb7lLAKBFK8a32ttG5i87Y/P3+2bRSjZNyJ1B7hfFNo273tKe9YxQ== + dependencies: + cssesc "^3.0.0" + util-deprecate "^1.0.2" + postcss-svgo@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-4.0.3.tgz#343a2cdbac9505d416243d496f724f38894c941e" @@ -16992,6 +17365,14 @@ postcss-svgo@^4.0.3: postcss-value-parser "^3.0.0" svgo "^1.0.0" +postcss-svgo@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-5.0.3.tgz#d945185756e5dfaae07f9edb0d3cae7ff79f9b30" + integrity sha512-41XZUA1wNDAZrQ3XgWREL/M2zSw8LJPvb5ZWivljBsUQAGoEKMYm6okHsTjJxKYI4M75RQEH4KYlEM52VwdXVA== + dependencies: + postcss-value-parser "^4.1.0" + svgo "^2.7.0" + postcss-unique-selectors@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/postcss-unique-selectors/-/postcss-unique-selectors-4.0.1.tgz#9446911f3289bfd64c6d680f073c03b1f9ee4bac" @@ -17001,6 +17382,13 @@ postcss-unique-selectors@^4.0.1: postcss "^7.0.0" uniqs "^2.0.0" +postcss-unique-selectors@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-unique-selectors/-/postcss-unique-selectors-5.0.3.tgz#07fd116a8fbd9202e7030f7c4952e7b52c26c63d" + integrity sha512-V5tX2hadSSn+miVCluuK1IDGy+7jAXSOfRZ2DQ+s/4uQZb/orDYBjH0CHgFrXsRw78p4QTuEFA9kI6C956UnHQ== + dependencies: + postcss-selector-parser "^6.0.5" + postcss-value-parser@^3.0.0: version "3.3.1" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" @@ -17011,6 +17399,11 @@ postcss-value-parser@^4.0.2, postcss-value-parser@^4.1.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb" integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ== +postcss-value-parser@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" + integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== + postcss-values-parser@^2.0.0, postcss-values-parser@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/postcss-values-parser/-/postcss-values-parser-2.0.1.tgz#da8b472d901da1e205b47bdc98637b9e9e550e5f" @@ -17166,6 +17559,11 @@ promise-to-callback@^1.0.0: is-fn "^1.0.0" set-immediate-shim "^1.0.1" +promise.series@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/promise.series/-/promise.series-0.2.0.tgz#2cc7ebe959fc3a6619c04ab4dbdc9e452d864bbd" + integrity sha1-LMfr6Vn8OmYZwEq029yeRS2GS70= + promise@^7.1.1: version "7.3.1" resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" @@ -18521,6 +18919,46 @@ rollup-plugin-dts@^4.1.0: optionalDependencies: "@babel/code-frame" "^7.16.0" +rollup-plugin-inject@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz#e4233855bfba6c0c12a312fd6649dff9a13ee9f4" + integrity sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w== + dependencies: + estree-walker "^0.6.1" + magic-string "^0.25.3" + rollup-pluginutils "^2.8.1" + +rollup-plugin-node-polyfills@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz#53092a2744837164d5b8a28812ba5f3ff61109fd" + integrity sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA== + dependencies: + rollup-plugin-inject "^3.0.0" + +rollup-plugin-peer-deps-external@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/rollup-plugin-peer-deps-external/-/rollup-plugin-peer-deps-external-2.2.4.tgz#8a420bbfd6dccc30aeb68c9bf57011f2f109570d" + integrity sha512-AWdukIM1+k5JDdAqV/Cxd+nejvno2FVLVeZ74NKggm3Q5s9cbbcOgUPGdbxPi4BXu7xGaZ8HG12F+thImYu/0g== + +rollup-plugin-postcss@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-postcss/-/rollup-plugin-postcss-4.0.2.tgz#15e9462f39475059b368ce0e49c800fa4b1f7050" + integrity sha512-05EaY6zvZdmvPUDi3uCcAQoESDcYnv8ogJJQRp6V5kZ6J6P7uAVJlrTZcaaA20wTH527YTnKfkAoPxWI/jPp4w== + dependencies: + chalk "^4.1.0" + concat-with-sourcemaps "^1.1.0" + cssnano "^5.0.1" + import-cwd "^3.0.0" + p-queue "^6.6.2" + pify "^5.0.0" + postcss-load-config "^3.0.0" + postcss-modules "^4.0.0" + promise.series "^0.2.0" + resolve "^1.19.0" + rollup-pluginutils "^2.8.2" + safe-identifier "^0.4.2" + style-inject "^0.3.0" + rollup-plugin-scss@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/rollup-plugin-scss/-/rollup-plugin-scss-3.0.0.tgz#35ad0adc614217e0278e702d8a674820faa0929e" @@ -18539,6 +18977,16 @@ rollup-plugin-terser@^5.3.1: serialize-javascript "^4.0.0" terser "^4.6.2" +rollup-plugin-terser@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" + integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ== + dependencies: + "@babel/code-frame" "^7.10.4" + jest-worker "^26.2.1" + serialize-javascript "^4.0.0" + terser "^5.0.0" + rollup-plugin-typescript2@^0.31.1: version "0.31.1" resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.31.1.tgz#3b3a0e29b29b2ed8244b1a78fd8e2cac93ab79a4" @@ -18558,6 +19006,14 @@ rollup-pluginutils@^2.3.3, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2: dependencies: estree-walker "^0.6.1" +rollup@^0.63.4: + version "0.63.5" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.63.5.tgz#5543eecac9a1b83b7e1be598b5be84c9c0a089db" + integrity sha512-dFf8LpUNzIj3oE0vCvobX6rqOzHzLBoblyFp+3znPbjiSmSvOoK2kMKx+Fv9jYduG1rvcCfCveSgEaQHjWRF6g== + dependencies: + "@types/estree" "0.0.39" + "@types/node" "*" + rollup@^1.31.1: version "1.32.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.32.1.tgz#4480e52d9d9e2ae4b46ba0d9ddeaf3163940f9c4" @@ -18567,10 +19023,10 @@ rollup@^1.31.1: "@types/node" "*" acorn "^7.1.0" -rollup@^2.63.0: - version "2.63.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.63.0.tgz#fe2f7fec2133f3fab9e022b9ac245628d817c6bb" - integrity sha512-nps0idjmD+NXl6OREfyYXMn/dar3WGcyKn+KBzPdaLecub3x/LrId0wUcthcr8oZUAcZAR8NKcfGGFlNgGL1kQ== +rollup@^2.66.1: + version "2.66.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.66.1.tgz#366b0404de353c4331d538c3ad2963934fcb4937" + integrity sha512-crSgLhSkLMnKr4s9iZ/1qJCplgAgrRY+igWv8KhG/AjKOJ0YX/WpmANyn8oxrw+zenF3BXWDLa7Xl/QZISH+7w== optionalDependencies: fsevents "~2.3.2" @@ -18632,6 +19088,11 @@ safe-event-emitter@^1.0.1: dependencies: events "^3.0.0" +safe-identifier@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/safe-identifier/-/safe-identifier-0.4.2.tgz#cf6bfca31c2897c588092d1750d30ef501d59fcb" + integrity sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w== + safe-json-stringify@~1: version "1.2.0" resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd" @@ -18980,11 +19441,6 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" -shallowequal@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" - integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== - shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -19500,6 +19956,11 @@ string-env-interpolation@1.0.1, string-env-interpolation@^1.0.1: resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152" integrity sha512-78lwMoCcn0nNu8LszbP1UA7g55OeE4v7rCeWnM5B453rnNr4aq+5it3FEYtZrSEiMvHZOZ9Jlqb0OD0M2VInqg== +string-hash@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b" + integrity sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs= + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -19695,6 +20156,11 @@ strip-json-comments@~2.0.1: resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +style-inject@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/style-inject/-/style-inject-0.3.0.tgz#d21c477affec91811cc82355832a700d22bf8dd3" + integrity sha512-IezA2qp+vcdlhJaVm5SOdPPTUu0FCEqfNSli2vRuSIBbu5Nq5UvygTk/VzeCqfLz2Atj3dVII5QBKGZRZ0edzw== + style-loader@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.3.0.tgz#828b4a3b3b7e7aa5847ce7bae9e874512114249e" @@ -19703,22 +20169,6 @@ style-loader@1.3.0: loader-utils "^2.0.0" schema-utils "^2.7.0" -styled-components@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.3.0.tgz#e47c3d3e9ddfff539f118a3dd0fd4f8f4fb25727" - integrity sha512-bPJKwZCHjJPf/hwTJl6TbkSZg/3evha+XPEizrZUGb535jLImwDUdjTNxXqjjaASt2M4qO4AVfoHJNe3XB/tpQ== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/traverse" "^7.4.5" - "@emotion/is-prop-valid" "^0.8.8" - "@emotion/stylis" "^0.8.4" - "@emotion/unitless" "^0.7.4" - babel-plugin-styled-components ">= 1.12.0" - css-to-react-native "^3.0.0" - hoist-non-react-statics "^3.0.0" - shallowequal "^1.1.0" - supports-color "^5.5.0" - styled-system@^5.0.0, styled-system@^5.1.5: version "5.1.5" resolved "https://registry.npmjs.org/styled-system/-/styled-system-5.1.5.tgz" @@ -19747,6 +20197,14 @@ stylehacks@^4.0.0: postcss "^7.0.0" postcss-selector-parser "^3.0.0" +stylehacks@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-5.0.2.tgz#fa10e5181c6e8dc0bddb4a3fb372e9ac42bba2ad" + integrity sha512-114zeJdOpTrbQYRD4OU5UWJ99LKUaqCPJTU1HQ/n3q3BwmllFN8kHENaLnOeqVq6AhXrWfxHNZTl33iJ4oy3cQ== + dependencies: + browserslist "^4.16.6" + postcss-selector-parser "^6.0.4" + subscriptions-transport-ws@^0.9.18: version "0.9.19" resolved "https://registry.yarnpkg.com/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.19.tgz#10ca32f7e291d5ee8eb728b9c02e43c52606cdcf" @@ -19763,7 +20221,7 @@ supports-color@^2.0.0: resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^5.3.0, supports-color@^5.5.0: +supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== @@ -19823,7 +20281,7 @@ svgo@^1.0.0, svgo@^1.2.2: unquote "~1.1.1" util.promisify "~1.0.0" -svgo@^2.5.0: +svgo@^2.5.0, svgo@^2.7.0: version "2.8.0" resolved "https://registry.yarnpkg.com/svgo/-/svgo-2.8.0.tgz#4ff80cce6710dc2795f0c7c74101e6764cfccd24" integrity sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg== @@ -19979,6 +20437,15 @@ terser@^4.1.2, terser@^4.6.2, terser@^4.6.3: source-map "~0.6.1" source-map-support "~0.5.12" +terser@^5.0.0: + version "5.10.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.10.0.tgz#b86390809c0389105eb0a0b62397563096ddafcc" + integrity sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA== + dependencies: + commander "^2.20.0" + source-map "~0.7.2" + source-map-support "~0.5.20" + terser@^5.3.4: version "5.9.0" resolved "https://registry.yarnpkg.com/terser/-/terser-5.9.0.tgz#47d6e629a522963240f2b55fcaa3c99083d2c351" @@ -20734,11 +21201,6 @@ use-sidecar@^1.0.1: detect-node-es "^1.1.0" tslib "^1.9.3" -use-sync-external-store@1.0.0-beta-96ca8d915-20211115: - version "1.0.0-beta-96ca8d915-20211115" - resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.0.0-beta-96ca8d915-20211115.tgz#80777c497f60b57ca23f52de760ff22080814a3c" - integrity sha512-Xkzd7SoZv29jYc95GO0k1v69oSHUdC+4nNaBQ309zvFFyvzYn+I87ee+OD1RKF8SGRwkEJQxjyFzYRcncdpSSg== - use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" @@ -21269,46 +21731,6 @@ widest-line@^3.1.0: dependencies: string-width "^4.0.0" -"widgets-web3-react/core@npm:@web3-react/core@8.0.16-alpha.0": - version "8.0.16-alpha.0" - resolved "https://registry.yarnpkg.com/@web3-react/core/-/core-8.0.16-alpha.0.tgz#7e8a2e28ee492f40e482f609fd8c353b0bafa8c3" - integrity sha512-eRkZxSdOR4c0U0IpRnWf/5djWfmtLQ52RmpwwvAozxIEyM6UANsfvuyV3j8LSNIC0kWwZNl5fcOWTHQB6vetcg== - dependencies: - "@web3-react/store" "^8.0.16-alpha.0" - "@web3-react/types" "^8.0.16-alpha.0" - zustand "^4.0.0-beta.0" - -"widgets-web3-react/eip1193@npm:@web3-react/eip1193@8.0.16-alpha.0": - version "8.0.16-alpha.0" - resolved "https://registry.yarnpkg.com/@web3-react/eip1193/-/eip1193-8.0.16-alpha.0.tgz#d0c7703804edc40c393086e5c136824cebb0d3e3" - integrity sha512-prHcUj3Te8lqowZ0DQX81qL50uYVq7242B1IX5l+kgFxMlO1lwTH1JHpIm4T/sjxQce93Y4896eu1naNM55QtA== - dependencies: - "@web3-react/types" "^8.0.16-alpha.0" - -"widgets-web3-react/empty@npm:@web3-react/empty@8.0.17-alpha.0": - version "8.0.17-alpha.0" - resolved "https://registry.yarnpkg.com/@web3-react/empty/-/empty-8.0.17-alpha.0.tgz#79a3d42a01f59b00106acb055bf1be90cdc1b5ce" - integrity sha512-XpbN5It5+ajNFOP/9HVCc5fiMIYTJtqKrvWEeGwz2cRSP1TSFFlPFgpHU2T9gwffXjWXDfxPM2oRTE9v1gQu/Q== - dependencies: - "@web3-react/types" "^8.0.16-alpha.0" - -"widgets-web3-react/metamask@npm:@web3-react/metamask@8.0.16-alpha.0": - version "8.0.16-alpha.0" - resolved "https://registry.yarnpkg.com/@web3-react/metamask/-/metamask-8.0.16-alpha.0.tgz#7870580484ea0872b3b5713440f1858b9b6b03b8" - integrity sha512-KizXfLb2NPwlrSn7oJ/hbMTRsUoBmMbN1Wuur1oI1pxbDlqRMkfAZpfibSEgTLuTye1uNI8XmWCLIbWzU4oOSA== - dependencies: - "@metamask/detect-provider" "^1.2.0" - "@web3-react/types" "^8.0.16-alpha.0" - -"widgets-web3-react/url@npm:@web3-react/url@8.0.17-alpha.0": - version "8.0.17-alpha.0" - resolved "https://registry.yarnpkg.com/@web3-react/url/-/url-8.0.17-alpha.0.tgz#799082966ba8e3f752b9cdd1991c8b8037bd96c9" - integrity sha512-bcHtkUUhW8hrLDnx3Y1q88LK1i5qtQKWQQnYiCd8963ayAP/XuxoKiR56a/H5v5ofl9f3EM7GMO3WwFNabD6iQ== - dependencies: - "@ethersproject/experimental" "^5.4.0" - "@ethersproject/providers" "^5.4.5" - "@web3-react/types" "^8.0.16-alpha.0" - word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz" @@ -21699,7 +22121,7 @@ yaml-ast-parser@^0.0.43: resolved "https://registry.yarnpkg.com/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== -yaml@^1.10.0, yaml@^1.7.2: +yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2: version "1.10.2" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== @@ -21806,10 +22228,3 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== - -zustand@^4.0.0-beta.0: - version "4.0.0-beta.0" - resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.0.0-beta.0.tgz#880bb21d9308ebc733a2ae07edd7c2c7b4f68eed" - integrity sha512-m7POAHkAeTEQqUdGC9M62/KXSsX6YQu6Gd4CiGZ6FOOTaUp1a0Hm9D8/fnBiMv8rGg0dfZu19JFSbRT9b+qQwA== - dependencies: - use-sync-external-store "1.0.0-beta-96ca8d915-20211115"