diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..5ec58a4 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "plugins": [] // "transform-jsbi-to-bigint" +} diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..b0c3092 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,43 @@ +name: CI +env: + CI: true + +on: + pull_request: + branches: + - v2 + push: + branches: + - v2 + +jobs: + test: + strategy: + matrix: + node: ['10.x', '12.x'] + os: [ubuntu-latest, macOS-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - run: npm install -g yarn + + - id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ matrix.os }}-yarn- + + - run: yarn + + - run: yarn lint + - run: yarn build + - run: yarn test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e212594 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +node_modules diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f776c8e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "solidity.compileUsingRemoteVersion": "v0.5.16+commit.9c3226ce" +} \ No newline at end of file diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 0000000..5455c6c --- /dev/null +++ b/.yarnrc @@ -0,0 +1 @@ +ignore-scripts true diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..93e6b30 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Noah Zinsmeister + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8f037d8 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# Uniswap SDK + +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) +[![Actions Status](https://github.com/Uniswap/uniswap-sdk/workflows/CI/badge.svg)](https://github.com/Uniswap/uniswap-sdk) +[![npm version](https://img.shields.io/npm/v/@uniswap/sdk/latest.svg)](https://www.npmjs.com/package/@uniswap/sdk/v/latest) +[![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/minzip/@uniswap/sdk/latest.svg)](https://bundlephobia.com/result?p=@uniswap/sdk@latest) + +In-depth documentation on this SDK is available at [uniswap.org](https://uniswap.org/docs/v2/SDK/getting-started/). + +## Running tests + +To run the tests, follow these steps. You must have at least node v10 and [yarn](https://yarnpkg.com/) installed. + +First clone the repository: + +```sh +git clone https://github.com/Uniswap/uniswap-sdk.git +``` + +Move into the uniswap-sdk working directory + +```sh +cd uniswap-sdk/ +``` + +Install dependencies + +```sh +yarn install +``` + +Run tests + +```sh +yarn test +``` + +You should see output like the following: + +```sh +yarn run v1.22.4 +$ tsdx test + PASS test/constants.test.ts + PASS test/pair.test.ts + PASS test/fraction.test.ts + PASS test/miscellaneous.test.ts + PASS test/entities.test.ts + PASS test/trade.test.ts + +Test Suites: 1 skipped, 6 passed, 6 of 7 total +Tests: 3 skipped, 82 passed, 85 total +Snapshots: 0 total +Time: 5.091s +Ran all test suites. +✨ Done in 6.61s. +``` diff --git a/dist/constants.d.ts b/dist/constants.d.ts new file mode 100644 index 0000000..2a8012a --- /dev/null +++ b/dist/constants.d.ts @@ -0,0 +1,40 @@ +import JSBI from 'jsbi'; +export declare type BigintIsh = JSBI | bigint | string; +export declare enum ChainId { + ENGRAM = 131, + MAINNET = 1, + ROPSTEN = 3, + RINKEBY = 4, + GÖRLI = 5, + KOVAN = 42, + TECO = 188355 +} +export declare enum TradeType { + EXACT_INPUT = 0, + EXACT_OUTPUT = 1 +} +export declare enum Rounding { + ROUND_DOWN = 0, + ROUND_HALF_UP = 1, + ROUND_UP = 2 +} +export declare const FACTORY_ADDRESS = "0x548C67Cbd80e8018b9792caeA0314569505F06B9"; +export declare const INIT_CODE_HASH = "0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4"; +export declare const MINIMUM_LIQUIDITY: JSBI; +export declare const ZERO: JSBI; +export declare const ONE: JSBI; +export declare const TWO: JSBI; +export declare const THREE: JSBI; +export declare const FIVE: JSBI; +export declare const TEN: JSBI; +export declare const _100: JSBI; +export declare const _997: JSBI; +export declare const _1000: JSBI; +export declare enum SolidityType { + uint8 = "uint8", + uint256 = "uint256" +} +export declare const SOLIDITY_TYPE_MAXIMA: { + uint8: JSBI; + uint256: JSBI; +}; diff --git a/dist/entities/currency.d.ts b/dist/entities/currency.d.ts new file mode 100644 index 0000000..535b464 --- /dev/null +++ b/dist/entities/currency.d.ts @@ -0,0 +1,23 @@ +/** + * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens. + * + * The only instance of the base class `Currency` is Ether. + */ +export declare class Currency { + readonly decimals: number; + readonly symbol?: string; + readonly name?: string; + /** + * The only instance of the base class `Currency`. + */ + static readonly ETHER: Currency; + /** + * Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`. + * @param decimals decimals of the currency + * @param symbol symbol of the currency + * @param name of the currency + */ + protected constructor(decimals: number, symbol?: string, name?: string); +} +declare const ETHER: Currency; +export { ETHER }; diff --git a/dist/entities/fractions/currencyAmount.d.ts b/dist/entities/fractions/currencyAmount.d.ts new file mode 100644 index 0000000..4795514 --- /dev/null +++ b/dist/entities/fractions/currencyAmount.d.ts @@ -0,0 +1,19 @@ +import { Currency } from '../currency'; +import JSBI from 'jsbi'; +import { BigintIsh, Rounding } from '../../constants'; +import { Fraction } from './fraction'; +export declare class CurrencyAmount extends Fraction { + readonly currency: Currency; + /** + * Helper that calls the constructor with the ETHER currency + * @param amount ether amount in wei + */ + static ether(amount: BigintIsh): CurrencyAmount; + protected constructor(currency: Currency, amount: BigintIsh); + get raw(): JSBI; + add(other: CurrencyAmount): CurrencyAmount; + subtract(other: CurrencyAmount): CurrencyAmount; + toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string; + toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string; + toExact(format?: object): string; +} diff --git a/dist/entities/fractions/fraction.d.ts b/dist/entities/fractions/fraction.d.ts new file mode 100644 index 0000000..c96d6cf --- /dev/null +++ b/dist/entities/fractions/fraction.d.ts @@ -0,0 +1,19 @@ +import JSBI from 'jsbi'; +import { BigintIsh, Rounding } from '../../constants'; +export declare class Fraction { + readonly numerator: JSBI; + readonly denominator: JSBI; + constructor(numerator: BigintIsh, denominator?: BigintIsh); + get quotient(): JSBI; + get remainder(): Fraction; + invert(): Fraction; + add(other: Fraction | BigintIsh): Fraction; + subtract(other: Fraction | BigintIsh): Fraction; + lessThan(other: Fraction | BigintIsh): boolean; + equalTo(other: Fraction | BigintIsh): boolean; + greaterThan(other: Fraction | BigintIsh): boolean; + multiply(other: Fraction | BigintIsh): Fraction; + divide(other: Fraction | BigintIsh): Fraction; + toSignificant(significantDigits: number, format?: object, rounding?: Rounding): string; + toFixed(decimalPlaces: number, format?: object, rounding?: Rounding): string; +} diff --git a/dist/entities/fractions/index.d.ts b/dist/entities/fractions/index.d.ts new file mode 100644 index 0000000..889aa69 --- /dev/null +++ b/dist/entities/fractions/index.d.ts @@ -0,0 +1,5 @@ +export * from './fraction'; +export * from './percent'; +export * from './tokenAmount'; +export * from './currencyAmount'; +export * from './price'; diff --git a/dist/entities/fractions/percent.d.ts b/dist/entities/fractions/percent.d.ts new file mode 100644 index 0000000..562421c --- /dev/null +++ b/dist/entities/fractions/percent.d.ts @@ -0,0 +1,6 @@ +import { Rounding } from '../../constants'; +import { Fraction } from './fraction'; +export declare class Percent extends Fraction { + toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string; + toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string; +} diff --git a/dist/entities/fractions/price.d.ts b/dist/entities/fractions/price.d.ts new file mode 100644 index 0000000..7dd9f0b --- /dev/null +++ b/dist/entities/fractions/price.d.ts @@ -0,0 +1,19 @@ +import { BigintIsh, Rounding } from '../../constants'; +import { Currency } from '../currency'; +import { Route } from '../route'; +import { Fraction } from './fraction'; +import { CurrencyAmount } from './currencyAmount'; +export declare class Price extends Fraction { + readonly baseCurrency: Currency; + readonly quoteCurrency: Currency; + readonly scalar: Fraction; + static fromRoute(route: Route): Price; + constructor(baseCurrency: Currency, quoteCurrency: Currency, denominator: BigintIsh, numerator: BigintIsh); + get raw(): Fraction; + get adjusted(): Fraction; + invert(): Price; + multiply(other: Price): Price; + quote(currencyAmount: CurrencyAmount): CurrencyAmount; + toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string; + toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string; +} diff --git a/dist/entities/fractions/tokenAmount.d.ts b/dist/entities/fractions/tokenAmount.d.ts new file mode 100644 index 0000000..96eeb14 --- /dev/null +++ b/dist/entities/fractions/tokenAmount.d.ts @@ -0,0 +1,9 @@ +import { CurrencyAmount } from './currencyAmount'; +import { Token } from '../token'; +import { BigintIsh } from '../../constants'; +export declare class TokenAmount extends CurrencyAmount { + readonly token: Token; + constructor(token: Token, amount: BigintIsh); + add(other: TokenAmount): TokenAmount; + subtract(other: TokenAmount): TokenAmount; +} diff --git a/dist/entities/index.d.ts b/dist/entities/index.d.ts new file mode 100644 index 0000000..724c769 --- /dev/null +++ b/dist/entities/index.d.ts @@ -0,0 +1,6 @@ +export * from './token'; +export * from './pair'; +export * from './route'; +export * from './trade'; +export * from './currency'; +export * from './fractions'; diff --git a/dist/entities/pair.d.ts b/dist/entities/pair.d.ts new file mode 100644 index 0000000..997505a --- /dev/null +++ b/dist/entities/pair.d.ts @@ -0,0 +1,41 @@ +import { Price } from './fractions/price'; +import { TokenAmount } from './fractions/tokenAmount'; +import { BigintIsh, ChainId } from '../constants'; +import { Token } from './token'; +export declare class Pair { + readonly liquidityToken: Token; + private readonly tokenAmounts; + static getAddress(tokenA: Token, tokenB: Token): string; + constructor(tokenAmountA: TokenAmount, tokenAmountB: TokenAmount); + /** + * Returns true if the token is either token0 or token1 + * @param token to check + */ + involvesToken(token: Token): boolean; + /** + * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0 + */ + get token0Price(): Price; + /** + * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1 + */ + get token1Price(): Price; + /** + * Return the price of the given token in terms of the other token in the pair. + * @param token token to return price of + */ + priceOf(token: Token): Price; + /** + * Returns the chain ID of the tokens in the pair. + */ + get chainId(): ChainId; + get token0(): Token; + get token1(): Token; + get reserve0(): TokenAmount; + get reserve1(): TokenAmount; + reserveOf(token: Token): TokenAmount; + getOutputAmount(inputAmount: TokenAmount): [TokenAmount, Pair]; + getInputAmount(outputAmount: TokenAmount): [TokenAmount, Pair]; + getLiquidityMinted(totalSupply: TokenAmount, tokenAmountA: TokenAmount, tokenAmountB: TokenAmount): TokenAmount; + getLiquidityValue(token: Token, totalSupply: TokenAmount, liquidity: TokenAmount, feeOn?: boolean, kLast?: BigintIsh): TokenAmount; +} diff --git a/dist/entities/route.d.ts b/dist/entities/route.d.ts new file mode 100644 index 0000000..7702303 --- /dev/null +++ b/dist/entities/route.d.ts @@ -0,0 +1,14 @@ +import { ChainId } from '../constants'; +import { Currency } from './currency'; +import { Token } from './token'; +import { Pair } from './pair'; +import { Price } from './fractions/price'; +export declare class Route { + readonly pairs: Pair[]; + readonly path: Token[]; + readonly input: Currency; + readonly output: Currency; + readonly midPrice: Price; + constructor(pairs: Pair[], input: Currency, output?: Currency); + get chainId(): ChainId; +} diff --git a/dist/entities/token.d.ts b/dist/entities/token.d.ts new file mode 100644 index 0000000..4ee8986 --- /dev/null +++ b/dist/entities/token.d.ts @@ -0,0 +1,35 @@ +import { ChainId } from '../constants'; +import { Currency } from './currency'; +/** + * Represents an ERC20 token with a unique address and some metadata. + */ +export declare class Token extends Currency { + readonly chainId: ChainId; + readonly address: string; + constructor(chainId: ChainId, address: string, decimals: number, symbol?: string, name?: string); + /** + * Returns true if the two tokens are equivalent, i.e. have the same chainId and address. + * @param other other token to compare + */ + equals(other: Token): boolean; + /** + * Returns true if the address of this token sorts before the address of the other token + * @param other other token to compare + * @throws if the tokens have the same address + * @throws if the tokens are on different chains + */ + sortsBefore(other: Token): boolean; +} +/** + * Compares two currencies for equality + */ +export declare function currencyEquals(currencyA: Currency, currencyB: Currency): boolean; +export declare const WETH: { + 1: Token; + 3: Token; + 4: Token; + 5: Token; + 42: Token; + 188355: Token; + 131: Token; +}; diff --git a/dist/entities/trade.d.ts b/dist/entities/trade.d.ts new file mode 100644 index 0000000..b69aa9b --- /dev/null +++ b/dist/entities/trade.d.ts @@ -0,0 +1,106 @@ +import { TradeType } from '../constants'; +import { Currency } from './currency'; +import { CurrencyAmount } from './fractions/currencyAmount'; +import { Percent } from './fractions/percent'; +import { Price } from './fractions/price'; +import { Pair } from './pair'; +import { Route } from './route'; +interface InputOutput { + readonly inputAmount: CurrencyAmount; + readonly outputAmount: CurrencyAmount; +} +export declare function inputOutputComparator(a: InputOutput, b: InputOutput): number; +export declare function tradeComparator(a: Trade, b: Trade): number; +export interface BestTradeOptions { + maxNumResults?: number; + maxHops?: number; +} +/** + * Represents a trade executed against a list of pairs. + * Does not account for slippage, i.e. trades that front run this trade and move the price. + */ +export declare class Trade { + /** + * The route of the trade, i.e. which pairs the trade goes through. + */ + readonly route: Route; + /** + * The type of the trade, either exact in or exact out. + */ + readonly tradeType: TradeType; + /** + * The input amount for the trade assuming no slippage. + */ + readonly inputAmount: CurrencyAmount; + /** + * The output amount for the trade assuming no slippage. + */ + readonly outputAmount: CurrencyAmount; + /** + * The price expressed in terms of output amount/input amount. + */ + readonly executionPrice: Price; + /** + * The mid price after the trade executes assuming no slippage. + */ + readonly nextMidPrice: Price; + /** + * The percent difference between the mid price before the trade and the trade execution price. + */ + readonly priceImpact: Percent; + /** + * Constructs an exact in trade with the given amount in and route + * @param route route of the exact in trade + * @param amountIn the amount being passed in + */ + static exactIn(route: Route, amountIn: CurrencyAmount): Trade; + /** + * Constructs an exact out trade with the given amount out and route + * @param route route of the exact out trade + * @param amountOut the amount returned by the trade + */ + static exactOut(route: Route, amountOut: CurrencyAmount): Trade; + constructor(route: Route, amount: CurrencyAmount, tradeType: TradeType); + /** + * Get the minimum amount that must be received from this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + minimumAmountOut(slippageTolerance: Percent): CurrencyAmount; + /** + * Get the maximum amount in that can be spent via this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + maximumAmountIn(slippageTolerance: Percent): CurrencyAmount; + /** + * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token + * amount to an output token, making at most `maxHops` hops. + * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyAmountIn exact amount of input currency to spend + * @param currencyOut the desired currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter + * @param bestTrades used in recursion; the current list of best trades + */ + static bestTradeExactIn(pairs: Pair[], currencyAmountIn: CurrencyAmount, currencyOut: Currency, { maxNumResults, maxHops }?: BestTradeOptions, currentPairs?: Pair[], originalAmountIn?: CurrencyAmount, bestTrades?: Trade[]): Trade[]; + /** + * similar to the above method but instead targets a fixed output amount + * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token + * to an output token amount, making at most `maxHops` hops + * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyIn the currency to spend + * @param currencyAmountOut the exact amount of currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter + * @param bestTrades used in recursion; the current list of best trades + */ + static bestTradeExactOut(pairs: Pair[], currencyIn: Currency, currencyAmountOut: CurrencyAmount, { maxNumResults, maxHops }?: BestTradeOptions, currentPairs?: Pair[], originalAmountOut?: CurrencyAmount, bestTrades?: Trade[]): Trade[]; +} +export {}; diff --git a/dist/errors.d.ts b/dist/errors.d.ts new file mode 100644 index 0000000..39ab4f1 --- /dev/null +++ b/dist/errors.d.ts @@ -0,0 +1,16 @@ +/** + * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be + * obtained by sending any amount of input. + */ +export declare class InsufficientReservesError extends Error { + readonly isInsufficientReservesError: true; + constructor(); +} +/** + * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less + * than the price of a single unit of output after fees. + */ +export declare class InsufficientInputAmountError extends Error { + readonly isInsufficientInputAmountError: true; + constructor(); +} diff --git a/dist/fetcher.d.ts b/dist/fetcher.d.ts new file mode 100644 index 0000000..2667e63 --- /dev/null +++ b/dist/fetcher.d.ts @@ -0,0 +1,28 @@ +import { Pair } from './entities/pair'; +import { ChainId } from './constants'; +import { Token } from './entities/token'; +/** + * Contains methods for constructing instances of pairs and tokens from on-chain data. + */ +export declare abstract class Fetcher { + /** + * Cannot be constructed. + */ + private constructor(); + /** + * Fetch information for a given token on the given chain, using the given ethers provider. + * @param chainId chain of the token + * @param address address of the token on the chain + * @param provider provider used to fetch the token + * @param symbol optional symbol of the token + * @param name optional name of the token + */ + static fetchTokenData(chainId: ChainId, address: string, provider?: import("@ethersproject/providers").BaseProvider, symbol?: string, name?: string): Promise; + /** + * Fetches information about a pair and constructs a pair from the given two tokens. + * @param tokenA first token + * @param tokenB second token + * @param provider the provider to use to fetch the data + */ + static fetchPairData(tokenA: Token, tokenB: Token, provider?: import("@ethersproject/providers").BaseProvider): Promise; +} diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..c974b02 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,7 @@ +import JSBI from 'jsbi'; +export { JSBI }; +export { BigintIsh, ChainId, TradeType, Rounding, FACTORY_ADDRESS, INIT_CODE_HASH, MINIMUM_LIQUIDITY } from './constants'; +export * from './errors'; +export * from './entities'; +export * from './router'; +export * from './fetcher'; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..2e12c95 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,8 @@ + +'use strict' + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./sdk.cjs.production.min.js') +} else { + module.exports = require('./sdk.cjs.development.js') +} diff --git a/dist/router.d.ts b/dist/router.d.ts new file mode 100644 index 0000000..92e68de --- /dev/null +++ b/dist/router.d.ts @@ -0,0 +1,63 @@ +import { Percent, Trade } from './entities'; +/** + * Options for producing the arguments to send call to the router. + */ +export interface TradeOptions { + /** + * How much the execution price is allowed to move unfavorably from the trade execution price. + */ + allowedSlippage: Percent; + /** + * How long the swap is valid until it expires, in seconds. + * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters + * are generated. + */ + ttl: number; + /** + * The account that should receive the output of the swap. + */ + recipient: string; + /** + * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods + */ + feeOnTransfer?: boolean; +} +export interface TradeOptionsDeadline extends Omit { + /** + * When the transaction expires. + * This is an atlernate to specifying the ttl, for when you do not want to use local time. + */ + deadline: number; +} +/** + * The parameters to use in the call to the Uniswap V2 Router to execute a trade. + */ +export interface SwapParameters { + /** + * The method to call on the Uniswap V2 Router. + */ + methodName: string; + /** + * The arguments to pass to the method, all hex encoded. + */ + args: (string | string[])[]; + /** + * The amount of wei to send in hex. + */ + value: string; +} +/** + * Represents the Uniswap V2 Router, and has static methods for helping execute trades. + */ +export declare abstract class Router { + /** + * Cannot be constructed. + */ + private constructor(); + /** + * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade. + * @param trade to produce call parameters for + * @param options options for the call parameters + */ + static swapCallParameters(trade: Trade, options: TradeOptions | TradeOptionsDeadline): SwapParameters; +} diff --git a/dist/sdk.cjs.development.js b/dist/sdk.cjs.development.js new file mode 100644 index 0000000..47df283 --- /dev/null +++ b/dist/sdk.cjs.development.js @@ -0,0 +1,1598 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var JSBI = _interopDefault(require('jsbi')); +var invariant = _interopDefault(require('tiny-invariant')); +var warning = _interopDefault(require('tiny-warning')); +var address = require('@ethersproject/address'); +var _Big = _interopDefault(require('big.js')); +var toFormat = _interopDefault(require('toformat')); +var _Decimal = _interopDefault(require('decimal.js-light')); +var solidity = require('@ethersproject/solidity'); +var contracts = require('@ethersproject/contracts'); +var networks = require('@ethersproject/networks'); +var providers = require('@ethersproject/providers'); +var IUniswapV2Pair = _interopDefault(require('@uniswap/v2-core/build/IUniswapV2Pair.json')); + +var _SOLIDITY_TYPE_MAXIMA; + +(function (ChainId) { + ChainId[ChainId["ENGRAM"] = 131] = "ENGRAM"; + ChainId[ChainId["MAINNET"] = 1] = "MAINNET"; + ChainId[ChainId["ROPSTEN"] = 3] = "ROPSTEN"; + ChainId[ChainId["RINKEBY"] = 4] = "RINKEBY"; + ChainId[ChainId["G\xD6RLI"] = 5] = "G\xD6RLI"; + ChainId[ChainId["KOVAN"] = 42] = "KOVAN"; + ChainId[ChainId["TECO"] = 188355] = "TECO"; +})(exports.ChainId || (exports.ChainId = {})); + +(function (TradeType) { + TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT"; + TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT"; +})(exports.TradeType || (exports.TradeType = {})); + +(function (Rounding) { + Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN"; + Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP"; + Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP"; +})(exports.Rounding || (exports.Rounding = {})); + +var FACTORY_ADDRESS = '0x548C67Cbd80e8018b9792caeA0314569505F06B9'; // need change + +var INIT_CODE_HASH = '0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4'; +var MINIMUM_LIQUIDITY = /*#__PURE__*/JSBI.BigInt(1000); // exports for internal consumption + +var ZERO = /*#__PURE__*/JSBI.BigInt(0); +var ONE = /*#__PURE__*/JSBI.BigInt(1); +var TWO = /*#__PURE__*/JSBI.BigInt(2); +var THREE = /*#__PURE__*/JSBI.BigInt(3); +var FIVE = /*#__PURE__*/JSBI.BigInt(5); +var TEN = /*#__PURE__*/JSBI.BigInt(10); +var _100 = /*#__PURE__*/JSBI.BigInt(100); +var _997 = /*#__PURE__*/JSBI.BigInt(997); +var _1000 = /*#__PURE__*/JSBI.BigInt(1000); +var SolidityType; + +(function (SolidityType) { + SolidityType["uint8"] = "uint8"; + SolidityType["uint256"] = "uint256"; +})(SolidityType || (SolidityType = {})); + +var SOLIDITY_TYPE_MAXIMA = (_SOLIDITY_TYPE_MAXIMA = {}, _SOLIDITY_TYPE_MAXIMA[SolidityType.uint8] = /*#__PURE__*/JSBI.BigInt('0xff'), _SOLIDITY_TYPE_MAXIMA[SolidityType.uint256] = /*#__PURE__*/JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'), _SOLIDITY_TYPE_MAXIMA); + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +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); +} + +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} + +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); +} + +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } +} + +function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); +} + +function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; +} + +function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); +} + +function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} + +function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + it = o[Symbol.iterator](); + return it.next.bind(it); +} + +// see https://stackoverflow.com/a/41102306 +var CAN_SET_PROTOTYPE = ('setPrototypeOf' in Object); +/** + * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be + * obtained by sending any amount of input. + */ + +var InsufficientReservesError = /*#__PURE__*/function (_Error) { + _inheritsLoose(InsufficientReservesError, _Error); + + function InsufficientReservesError() { + var _this; + + _this = _Error.call(this) || this; + _this.isInsufficientReservesError = true; + _this.name = _this.constructor.name; + if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof InsufficientReservesError ? this.constructor : void 0).prototype); + return _this; + } + + return InsufficientReservesError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); +/** + * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less + * than the price of a single unit of output after fees. + */ + +var InsufficientInputAmountError = /*#__PURE__*/function (_Error2) { + _inheritsLoose(InsufficientInputAmountError, _Error2); + + function InsufficientInputAmountError() { + var _this2; + + _this2 = _Error2.call(this) || this; + _this2.isInsufficientInputAmountError = true; + _this2.name = _this2.constructor.name; + if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(_assertThisInitialized(_this2), (this instanceof InsufficientInputAmountError ? this.constructor : void 0).prototype); + return _this2; + } + + return InsufficientInputAmountError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +function validateSolidityTypeInstance(value, solidityType) { + !JSBI.greaterThanOrEqual(value, ZERO) ? invariant(false, value + " is not a " + solidityType + ".") : void 0; + !JSBI.lessThanOrEqual(value, SOLIDITY_TYPE_MAXIMA[solidityType]) ? invariant(false, value + " is not a " + solidityType + ".") : void 0; +} // warns if addresses are not checksummed + +function validateAndParseAddress(address$1) { + try { + var checksummedAddress = address.getAddress(address$1); + "development" !== "production" ? warning(address$1 === checksummedAddress, address$1 + " is not checksummed.") : void 0; + return checksummedAddress; + } catch (error) { + invariant(false, address$1 + " is not a valid address.") ; + } +} +function parseBigintIsh(bigintIsh) { + return bigintIsh instanceof JSBI ? bigintIsh : typeof bigintIsh === 'bigint' ? JSBI.BigInt(bigintIsh.toString()) : JSBI.BigInt(bigintIsh); +} // mock the on-chain sqrt function + +function sqrt(y) { + validateSolidityTypeInstance(y, SolidityType.uint256); + var z = ZERO; + var x; + + if (JSBI.greaterThan(y, THREE)) { + z = y; + x = JSBI.add(JSBI.divide(y, TWO), ONE); + + while (JSBI.lessThan(x, z)) { + z = x; + x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO); + } + } else if (JSBI.notEqual(y, ZERO)) { + z = ONE; + } + + return z; +} // given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to +// `maxSize` by removing the last item + +function sortedInsert(items, add, maxSize, comparator) { + !(maxSize > 0) ? invariant(false, 'MAX_SIZE_ZERO') : void 0; // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize + + !(items.length <= maxSize) ? invariant(false, 'ITEMS_SIZE') : void 0; // short circuit first item add + + if (items.length === 0) { + items.push(add); + return null; + } else { + var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item + + if (isFull && comparator(items[items.length - 1], add) <= 0) { + return add; + } + + var lo = 0, + hi = items.length; + + while (lo < hi) { + var mid = lo + hi >>> 1; + + if (comparator(items[mid], add) <= 0) { + lo = mid + 1; + } else { + hi = mid; + } + } + + items.splice(lo, 0, add); + return isFull ? items.pop() : null; + } +} + +/** + * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens. + * + * The only instance of the base class `Currency` is Ether. + */ + +var Currency = +/** + * Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`. + * @param decimals decimals of the currency + * @param symbol symbol of the currency + * @param name of the currency + */ +function Currency(decimals, symbol, name) { + validateSolidityTypeInstance(JSBI.BigInt(decimals), SolidityType.uint8); + this.decimals = decimals; + this.symbol = symbol; + this.name = name; +}; +/** + * The only instance of the base class `Currency`. + */ + +Currency.ETHER = /*#__PURE__*/new Currency(18, 'ETH', 'Ether'); +var ETHER = Currency.ETHER; + +var _WETH; +/** + * Represents an ERC20 token with a unique address and some metadata. + */ + +var Token = /*#__PURE__*/function (_Currency) { + _inheritsLoose(Token, _Currency); + + function Token(chainId, address, decimals, symbol, name) { + var _this; + + _this = _Currency.call(this, decimals, symbol, name) || this; + _this.chainId = chainId; + _this.address = validateAndParseAddress(address); + return _this; + } + /** + * Returns true if the two tokens are equivalent, i.e. have the same chainId and address. + * @param other other token to compare + */ + + + var _proto = Token.prototype; + + _proto.equals = function equals(other) { + // short circuit on reference equality + if (this === other) { + return true; + } + + return this.chainId === other.chainId && this.address === other.address; + } + /** + * Returns true if the address of this token sorts before the address of the other token + * @param other other token to compare + * @throws if the tokens have the same address + * @throws if the tokens are on different chains + */ + ; + + _proto.sortsBefore = function sortsBefore(other) { + !(this.chainId === other.chainId) ? invariant(false, 'CHAIN_IDS') : void 0; + !(this.address !== other.address) ? invariant(false, 'ADDRESSES') : void 0; + return this.address.toLowerCase() < other.address.toLowerCase(); + }; + + return Token; +}(Currency); +/** + * Compares two currencies for equality + */ + +function currencyEquals(currencyA, currencyB) { + if (currencyA instanceof Token && currencyB instanceof Token) { + return currencyA.equals(currencyB); + } else if (currencyA instanceof Token) { + return false; + } else if (currencyB instanceof Token) { + return false; + } else { + return currencyA === currencyB; + } +} +var WETH = (_WETH = {}, _WETH[exports.ChainId.MAINNET] = /*#__PURE__*/new Token(exports.ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH', 'Wrapped Ether'), _WETH[exports.ChainId.ROPSTEN] = /*#__PURE__*/new Token(exports.ChainId.ROPSTEN, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[exports.ChainId.RINKEBY] = /*#__PURE__*/new Token(exports.ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[exports.ChainId.GÖRLI] = /*#__PURE__*/new Token(exports.ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'), _WETH[exports.ChainId.KOVAN] = /*#__PURE__*/new Token(exports.ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'), _WETH[exports.ChainId.TECO] = /*#__PURE__*/new Token(exports.ChainId.TECO, '0x65A98D861a1E8e9E1404EF5d19C24a70e022B935', 18, 'WETH', 'Wrapped Ether'), _WETH[exports.ChainId.ENGRAM] = /*#__PURE__*/new Token(exports.ChainId.ENGRAM, '0x7E3e3C50927F78ce0D2a1699d15d342c976A49B0', 18, 'WETH', 'Wrapped Ether'), _WETH); + +var _toSignificantRoundin, _toFixedRounding; +var Decimal = /*#__PURE__*/toFormat(_Decimal); +var Big = /*#__PURE__*/toFormat(_Big); +var toSignificantRounding = (_toSignificantRoundin = {}, _toSignificantRoundin[exports.Rounding.ROUND_DOWN] = Decimal.ROUND_DOWN, _toSignificantRoundin[exports.Rounding.ROUND_HALF_UP] = Decimal.ROUND_HALF_UP, _toSignificantRoundin[exports.Rounding.ROUND_UP] = Decimal.ROUND_UP, _toSignificantRoundin); +var toFixedRounding = (_toFixedRounding = {}, _toFixedRounding[exports.Rounding.ROUND_DOWN] = 0, _toFixedRounding[exports.Rounding.ROUND_HALF_UP] = 1, _toFixedRounding[exports.Rounding.ROUND_UP] = 3, _toFixedRounding); +var Fraction = /*#__PURE__*/function () { + function Fraction(numerator, denominator) { + if (denominator === void 0) { + denominator = ONE; + } + + this.numerator = parseBigintIsh(numerator); + this.denominator = parseBigintIsh(denominator); + } // performs floor division + + + var _proto = Fraction.prototype; + + _proto.invert = function invert() { + return new Fraction(this.denominator, this.numerator); + }; + + _proto.add = function add(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + + if (JSBI.equal(this.denominator, otherParsed.denominator)) { + return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator); + } + + return new Fraction(JSBI.add(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator)); + }; + + _proto.subtract = function subtract(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + + if (JSBI.equal(this.denominator, otherParsed.denominator)) { + return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator); + } + + return new Fraction(JSBI.subtract(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator)); + }; + + _proto.lessThan = function lessThan(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return JSBI.lessThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)); + }; + + _proto.equalTo = function equalTo(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return JSBI.equal(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)); + }; + + _proto.greaterThan = function greaterThan(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return JSBI.greaterThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)); + }; + + _proto.multiply = function multiply(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return new Fraction(JSBI.multiply(this.numerator, otherParsed.numerator), JSBI.multiply(this.denominator, otherParsed.denominator)); + }; + + _proto.divide = function divide(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return new Fraction(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(this.denominator, otherParsed.numerator)); + }; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (format === void 0) { + format = { + groupSeparator: '' + }; + } + + if (rounding === void 0) { + rounding = exports.Rounding.ROUND_HALF_UP; + } + + !Number.isInteger(significantDigits) ? invariant(false, significantDigits + " is not an integer.") : void 0; + !(significantDigits > 0) ? invariant(false, significantDigits + " is not positive.") : void 0; + Decimal.set({ + precision: significantDigits + 1, + rounding: toSignificantRounding[rounding] + }); + var quotient = new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits); + return quotient.toFormat(quotient.decimalPlaces(), format); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (format === void 0) { + format = { + groupSeparator: '' + }; + } + + if (rounding === void 0) { + rounding = exports.Rounding.ROUND_HALF_UP; + } + + !Number.isInteger(decimalPlaces) ? invariant(false, decimalPlaces + " is not an integer.") : void 0; + !(decimalPlaces >= 0) ? invariant(false, decimalPlaces + " is negative.") : void 0; + Big.DP = decimalPlaces; + Big.RM = toFixedRounding[rounding]; + return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format); + }; + + _createClass(Fraction, [{ + key: "quotient", + get: function get() { + return JSBI.divide(this.numerator, this.denominator); + } // remainder after floor division + + }, { + key: "remainder", + get: function get() { + return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator); + } + }]); + + return Fraction; +}(); + +var Big$1 = /*#__PURE__*/toFormat(_Big); +var CurrencyAmount = /*#__PURE__*/function (_Fraction) { + _inheritsLoose(CurrencyAmount, _Fraction); + + // amount _must_ be raw, i.e. in the native representation + function CurrencyAmount(currency, amount) { + var _this; + + var parsedAmount = parseBigintIsh(amount); + validateSolidityTypeInstance(parsedAmount, SolidityType.uint256); + _this = _Fraction.call(this, parsedAmount, JSBI.exponentiate(TEN, JSBI.BigInt(currency.decimals))) || this; + _this.currency = currency; + return _this; + } + /** + * Helper that calls the constructor with the ETHER currency + * @param amount ether amount in wei + */ + + + CurrencyAmount.ether = function ether(amount) { + return new CurrencyAmount(ETHER, amount); + }; + + var _proto = CurrencyAmount.prototype; + + _proto.add = function add(other) { + !currencyEquals(this.currency, other.currency) ? invariant(false, 'TOKEN') : void 0; + return new CurrencyAmount(this.currency, JSBI.add(this.raw, other.raw)); + }; + + _proto.subtract = function subtract(other) { + !currencyEquals(this.currency, other.currency) ? invariant(false, 'TOKEN') : void 0; + return new CurrencyAmount(this.currency, JSBI.subtract(this.raw, other.raw)); + }; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 6; + } + + if (rounding === void 0) { + rounding = exports.Rounding.ROUND_DOWN; + } + + return _Fraction.prototype.toSignificant.call(this, significantDigits, format, rounding); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = this.currency.decimals; + } + + if (rounding === void 0) { + rounding = exports.Rounding.ROUND_DOWN; + } + + !(decimalPlaces <= this.currency.decimals) ? invariant(false, 'DECIMALS') : void 0; + return _Fraction.prototype.toFixed.call(this, decimalPlaces, format, rounding); + }; + + _proto.toExact = function toExact(format) { + if (format === void 0) { + format = { + groupSeparator: '' + }; + } + + Big$1.DP = this.currency.decimals; + return new Big$1(this.numerator.toString()).div(this.denominator.toString()).toFormat(format); + }; + + _createClass(CurrencyAmount, [{ + key: "raw", + get: function get() { + return this.numerator; + } + }]); + + return CurrencyAmount; +}(Fraction); + +var TokenAmount = /*#__PURE__*/function (_CurrencyAmount) { + _inheritsLoose(TokenAmount, _CurrencyAmount); + + // amount _must_ be raw, i.e. in the native representation + function TokenAmount(token, amount) { + var _this; + + _this = _CurrencyAmount.call(this, token, amount) || this; + _this.token = token; + return _this; + } + + var _proto = TokenAmount.prototype; + + _proto.add = function add(other) { + !this.token.equals(other.token) ? invariant(false, 'TOKEN') : void 0; + return new TokenAmount(this.token, JSBI.add(this.raw, other.raw)); + }; + + _proto.subtract = function subtract(other) { + !this.token.equals(other.token) ? invariant(false, 'TOKEN') : void 0; + return new TokenAmount(this.token, JSBI.subtract(this.raw, other.raw)); + }; + + return TokenAmount; +}(CurrencyAmount); + +var Price = /*#__PURE__*/function (_Fraction) { + _inheritsLoose(Price, _Fraction); + + // denominator and numerator _must_ be raw, i.e. in the native representation + function Price(baseCurrency, quoteCurrency, denominator, numerator) { + var _this; + + _this = _Fraction.call(this, numerator, denominator) || this; + _this.baseCurrency = baseCurrency; + _this.quoteCurrency = quoteCurrency; + _this.scalar = new Fraction(JSBI.exponentiate(TEN, JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(TEN, JSBI.BigInt(quoteCurrency.decimals))); + return _this; + } + + Price.fromRoute = function fromRoute(route) { + var prices = []; + + for (var _iterator = _createForOfIteratorHelperLoose(route.pairs.entries()), _step; !(_step = _iterator()).done;) { + var _step$value = _step.value, + i = _step$value[0], + pair = _step$value[1]; + prices.push(route.path[i].equals(pair.token0) ? new Price(pair.reserve0.currency, pair.reserve1.currency, pair.reserve0.raw, pair.reserve1.raw) : new Price(pair.reserve1.currency, pair.reserve0.currency, pair.reserve1.raw, pair.reserve0.raw)); + } + + return prices.slice(1).reduce(function (accumulator, currentValue) { + return accumulator.multiply(currentValue); + }, prices[0]); + }; + + var _proto = Price.prototype; + + _proto.invert = function invert() { + return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator); + }; + + _proto.multiply = function multiply(other) { + !currencyEquals(this.quoteCurrency, other.baseCurrency) ? invariant(false, 'TOKEN') : void 0; + + var fraction = _Fraction.prototype.multiply.call(this, other); + + return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator); + } // performs floor division on overflow + ; + + _proto.quote = function quote(currencyAmount) { + !currencyEquals(currencyAmount.currency, this.baseCurrency) ? invariant(false, 'TOKEN') : void 0; + + if (this.quoteCurrency instanceof Token) { + return new TokenAmount(this.quoteCurrency, _Fraction.prototype.multiply.call(this, currencyAmount.raw).quotient); + } + + return CurrencyAmount.ether(_Fraction.prototype.multiply.call(this, currencyAmount.raw).quotient); + }; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 6; + } + + return this.adjusted.toSignificant(significantDigits, format, rounding); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = 4; + } + + return this.adjusted.toFixed(decimalPlaces, format, rounding); + }; + + _createClass(Price, [{ + key: "raw", + get: function get() { + return new Fraction(this.numerator, this.denominator); + } + }, { + key: "adjusted", + get: function get() { + return _Fraction.prototype.multiply.call(this, this.scalar); + } + }]); + + return Price; +}(Fraction); + +var PAIR_ADDRESS_CACHE = {}; +var Pair = /*#__PURE__*/function () { + function Pair(tokenAmountA, tokenAmountB) { + var tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks + ? [tokenAmountA, tokenAmountB] : [tokenAmountB, tokenAmountA]; + this.liquidityToken = new Token(tokenAmounts[0].token.chainId, Pair.getAddress(tokenAmounts[0].token, tokenAmounts[1].token), 18, 'UNI-V2', 'Uniswap V2'); + this.tokenAmounts = tokenAmounts; + } + + Pair.getAddress = function getAddress(tokenA, tokenB) { + var _PAIR_ADDRESS_CACHE, _PAIR_ADDRESS_CACHE$t; + + var tokens = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA]; // does safety checks + + if (((_PAIR_ADDRESS_CACHE = PAIR_ADDRESS_CACHE) === null || _PAIR_ADDRESS_CACHE === void 0 ? void 0 : (_PAIR_ADDRESS_CACHE$t = _PAIR_ADDRESS_CACHE[tokens[0].address]) === null || _PAIR_ADDRESS_CACHE$t === void 0 ? void 0 : _PAIR_ADDRESS_CACHE$t[tokens[1].address]) === undefined) { + var _PAIR_ADDRESS_CACHE2, _extends2, _extends3; + + PAIR_ADDRESS_CACHE = _extends({}, PAIR_ADDRESS_CACHE, (_extends3 = {}, _extends3[tokens[0].address] = _extends({}, (_PAIR_ADDRESS_CACHE2 = PAIR_ADDRESS_CACHE) === null || _PAIR_ADDRESS_CACHE2 === void 0 ? void 0 : _PAIR_ADDRESS_CACHE2[tokens[0].address], (_extends2 = {}, _extends2[tokens[1].address] = address.getCreate2Address(FACTORY_ADDRESS, solidity.keccak256(['bytes'], [solidity.pack(['address', 'address'], [tokens[0].address, tokens[1].address])]), INIT_CODE_HASH), _extends2)), _extends3)); + } + + return PAIR_ADDRESS_CACHE[tokens[0].address][tokens[1].address]; + } + /** + * Returns true if the token is either token0 or token1 + * @param token to check + */ + ; + + var _proto = Pair.prototype; + + _proto.involvesToken = function involvesToken(token) { + return token.equals(this.token0) || token.equals(this.token1); + } + /** + * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0 + */ + ; + + /** + * Return the price of the given token in terms of the other token in the pair. + * @param token token to return price of + */ + _proto.priceOf = function priceOf(token) { + !this.involvesToken(token) ? invariant(false, 'TOKEN') : void 0; + return token.equals(this.token0) ? this.token0Price : this.token1Price; + } + /** + * Returns the chain ID of the tokens in the pair. + */ + ; + + _proto.reserveOf = function reserveOf(token) { + !this.involvesToken(token) ? invariant(false, 'TOKEN') : void 0; + return token.equals(this.token0) ? this.reserve0 : this.reserve1; + }; + + _proto.getOutputAmount = function getOutputAmount(inputAmount) { + !this.involvesToken(inputAmount.token) ? invariant(false, 'TOKEN') : void 0; + + if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO)) { + throw new InsufficientReservesError(); + } + + var inputReserve = this.reserveOf(inputAmount.token); + var outputReserve = this.reserveOf(inputAmount.token.equals(this.token0) ? this.token1 : this.token0); + var inputAmountWithFee = JSBI.multiply(inputAmount.raw, _997); + var numerator = JSBI.multiply(inputAmountWithFee, outputReserve.raw); + var denominator = JSBI.add(JSBI.multiply(inputReserve.raw, _1000), inputAmountWithFee); + var outputAmount = new TokenAmount(inputAmount.token.equals(this.token0) ? this.token1 : this.token0, JSBI.divide(numerator, denominator)); + + if (JSBI.equal(outputAmount.raw, ZERO)) { + throw new InsufficientInputAmountError(); + } + + return [outputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]; + }; + + _proto.getInputAmount = function getInputAmount(outputAmount) { + !this.involvesToken(outputAmount.token) ? invariant(false, 'TOKEN') : void 0; + + if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO) || JSBI.greaterThanOrEqual(outputAmount.raw, this.reserveOf(outputAmount.token).raw)) { + throw new InsufficientReservesError(); + } + + var outputReserve = this.reserveOf(outputAmount.token); + var inputReserve = this.reserveOf(outputAmount.token.equals(this.token0) ? this.token1 : this.token0); + var numerator = JSBI.multiply(JSBI.multiply(inputReserve.raw, outputAmount.raw), _1000); + var denominator = JSBI.multiply(JSBI.subtract(outputReserve.raw, outputAmount.raw), _997); + var inputAmount = new TokenAmount(outputAmount.token.equals(this.token0) ? this.token1 : this.token0, JSBI.add(JSBI.divide(numerator, denominator), ONE)); + return [inputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]; + }; + + _proto.getLiquidityMinted = function getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB) { + !totalSupply.token.equals(this.liquidityToken) ? invariant(false, 'LIQUIDITY') : void 0; + var tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks + ? [tokenAmountA, tokenAmountB] : [tokenAmountB, tokenAmountA]; + !(tokenAmounts[0].token.equals(this.token0) && tokenAmounts[1].token.equals(this.token1)) ? invariant(false, 'TOKEN') : void 0; + var liquidity; + + if (JSBI.equal(totalSupply.raw, ZERO)) { + liquidity = JSBI.subtract(sqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY); + } else { + var amount0 = JSBI.divide(JSBI.multiply(tokenAmounts[0].raw, totalSupply.raw), this.reserve0.raw); + var amount1 = JSBI.divide(JSBI.multiply(tokenAmounts[1].raw, totalSupply.raw), this.reserve1.raw); + liquidity = JSBI.lessThanOrEqual(amount0, amount1) ? amount0 : amount1; + } + + if (!JSBI.greaterThan(liquidity, ZERO)) { + throw new InsufficientInputAmountError(); + } + + return new TokenAmount(this.liquidityToken, liquidity); + }; + + _proto.getLiquidityValue = function getLiquidityValue(token, totalSupply, liquidity, feeOn, kLast) { + if (feeOn === void 0) { + feeOn = false; + } + + !this.involvesToken(token) ? invariant(false, 'TOKEN') : void 0; + !totalSupply.token.equals(this.liquidityToken) ? invariant(false, 'TOTAL_SUPPLY') : void 0; + !liquidity.token.equals(this.liquidityToken) ? invariant(false, 'LIQUIDITY') : void 0; + !JSBI.lessThanOrEqual(liquidity.raw, totalSupply.raw) ? invariant(false, 'LIQUIDITY') : void 0; + var totalSupplyAdjusted; + + if (!feeOn) { + totalSupplyAdjusted = totalSupply; + } else { + !!!kLast ? invariant(false, 'K_LAST') : void 0; + var kLastParsed = parseBigintIsh(kLast); + + if (!JSBI.equal(kLastParsed, ZERO)) { + var rootK = sqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw)); + var rootKLast = sqrt(kLastParsed); + + if (JSBI.greaterThan(rootK, rootKLast)) { + var numerator = JSBI.multiply(totalSupply.raw, JSBI.subtract(rootK, rootKLast)); + var denominator = JSBI.add(JSBI.multiply(rootK, FIVE), rootKLast); + var feeLiquidity = JSBI.divide(numerator, denominator); + totalSupplyAdjusted = totalSupply.add(new TokenAmount(this.liquidityToken, feeLiquidity)); + } else { + totalSupplyAdjusted = totalSupply; + } + } else { + totalSupplyAdjusted = totalSupply; + } + } + + return new TokenAmount(token, JSBI.divide(JSBI.multiply(liquidity.raw, this.reserveOf(token).raw), totalSupplyAdjusted.raw)); + }; + + _createClass(Pair, [{ + key: "token0Price", + get: function get() { + return new Price(this.token0, this.token1, this.tokenAmounts[0].raw, this.tokenAmounts[1].raw); + } + /** + * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1 + */ + + }, { + key: "token1Price", + get: function get() { + return new Price(this.token1, this.token0, this.tokenAmounts[1].raw, this.tokenAmounts[0].raw); + } + }, { + key: "chainId", + get: function get() { + return this.token0.chainId; + } + }, { + key: "token0", + get: function get() { + return this.tokenAmounts[0].token; + } + }, { + key: "token1", + get: function get() { + return this.tokenAmounts[1].token; + } + }, { + key: "reserve0", + get: function get() { + return this.tokenAmounts[0]; + } + }, { + key: "reserve1", + get: function get() { + return this.tokenAmounts[1]; + } + }]); + + return Pair; +}(); + +var Route = /*#__PURE__*/function () { + function Route(pairs, input, output) { + !(pairs.length > 0) ? invariant(false, 'PAIRS') : void 0; + !pairs.every(function (pair) { + return pair.chainId === pairs[0].chainId; + }) ? invariant(false, 'CHAIN_IDS') : void 0; + !(input instanceof Token && pairs[0].involvesToken(input) || input === ETHER && pairs[0].involvesToken(WETH[pairs[0].chainId])) ? invariant(false, 'INPUT') : void 0; + !(typeof output === 'undefined' || output instanceof Token && pairs[pairs.length - 1].involvesToken(output) || output === ETHER && pairs[pairs.length - 1].involvesToken(WETH[pairs[0].chainId])) ? invariant(false, 'OUTPUT') : void 0; + var path = [input instanceof Token ? input : WETH[pairs[0].chainId]]; + + for (var _iterator = _createForOfIteratorHelperLoose(pairs.entries()), _step; !(_step = _iterator()).done;) { + var _step$value = _step.value, + i = _step$value[0], + pair = _step$value[1]; + var currentInput = path[i]; + !(currentInput.equals(pair.token0) || currentInput.equals(pair.token1)) ? invariant(false, 'PATH') : void 0; + + var _output = currentInput.equals(pair.token0) ? pair.token1 : pair.token0; + + path.push(_output); + } + + this.pairs = pairs; + this.path = path; + this.midPrice = Price.fromRoute(this); + this.input = input; + this.output = output !== null && output !== void 0 ? output : path[path.length - 1]; + } + + _createClass(Route, [{ + key: "chainId", + get: function get() { + return this.pairs[0].chainId; + } + }]); + + return Route; +}(); + +var _100_PERCENT = /*#__PURE__*/new Fraction(_100); + +var Percent = /*#__PURE__*/function (_Fraction) { + _inheritsLoose(Percent, _Fraction); + + function Percent() { + return _Fraction.apply(this, arguments) || this; + } + + var _proto = Percent.prototype; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 5; + } + + return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = 2; + } + + return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding); + }; + + return Percent; +}(Fraction); + +/** + * Returns the percent difference between the mid price and the execution price, i.e. price impact. + * @param midPrice mid price before the trade + * @param inputAmount the input amount of the trade + * @param outputAmount the output amount of the trade + */ + +function computePriceImpact(midPrice, inputAmount, outputAmount) { + var exactQuote = midPrice.raw.multiply(inputAmount.raw); // calculate slippage := (exactQuote - outputAmount) / exactQuote + + var slippage = exactQuote.subtract(outputAmount.raw).divide(exactQuote); + return new Percent(slippage.numerator, slippage.denominator); +} // comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts +// in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first + + +function inputOutputComparator(a, b) { + // must have same input and output token for comparison + !currencyEquals(a.inputAmount.currency, b.inputAmount.currency) ? invariant(false, 'INPUT_CURRENCY') : void 0; + !currencyEquals(a.outputAmount.currency, b.outputAmount.currency) ? invariant(false, 'OUTPUT_CURRENCY') : void 0; + + if (a.outputAmount.equalTo(b.outputAmount)) { + if (a.inputAmount.equalTo(b.inputAmount)) { + return 0; + } // trade A requires less input than trade B, so A should come first + + + if (a.inputAmount.lessThan(b.inputAmount)) { + return -1; + } else { + return 1; + } + } else { + // tradeA has less output than trade B, so should come second + if (a.outputAmount.lessThan(b.outputAmount)) { + return 1; + } else { + return -1; + } + } +} // extension of the input output comparator that also considers other dimensions of the trade in ranking them + +function tradeComparator(a, b) { + var ioComp = inputOutputComparator(a, b); + + if (ioComp !== 0) { + return ioComp; + } // consider lowest slippage next, since these are less likely to fail + + + if (a.priceImpact.lessThan(b.priceImpact)) { + return -1; + } else if (a.priceImpact.greaterThan(b.priceImpact)) { + return 1; + } // finally consider the number of hops since each hop costs gas + + + return a.route.path.length - b.route.path.length; +} +/** + * Given a currency amount and a chain ID, returns the equivalent representation as the token amount. + * In other words, if the currency is ETHER, returns the WETH token amount for the given chain. Otherwise, returns + * the input currency amount. + */ + +function wrappedAmount(currencyAmount, chainId) { + if (currencyAmount instanceof TokenAmount) return currencyAmount; + if (currencyAmount.currency === ETHER) return new TokenAmount(WETH[chainId], currencyAmount.raw); + invariant(false, 'CURRENCY') ; +} + +function wrappedCurrency(currency, chainId) { + if (currency instanceof Token) return currency; + if (currency === ETHER) return WETH[chainId]; + invariant(false, 'CURRENCY') ; +} +/** + * Represents a trade executed against a list of pairs. + * Does not account for slippage, i.e. trades that front run this trade and move the price. + */ + + +var Trade = /*#__PURE__*/function () { + function Trade(route, amount, tradeType) { + var amounts = new Array(route.path.length); + var nextPairs = new Array(route.pairs.length); + + if (tradeType === exports.TradeType.EXACT_INPUT) { + !currencyEquals(amount.currency, route.input) ? invariant(false, 'INPUT') : void 0; + amounts[0] = wrappedAmount(amount, route.chainId); + + for (var i = 0; i < route.path.length - 1; i++) { + var pair = route.pairs[i]; + + var _pair$getOutputAmount = pair.getOutputAmount(amounts[i]), + outputAmount = _pair$getOutputAmount[0], + nextPair = _pair$getOutputAmount[1]; + + amounts[i + 1] = outputAmount; + nextPairs[i] = nextPair; + } + } else { + !currencyEquals(amount.currency, route.output) ? invariant(false, 'OUTPUT') : void 0; + amounts[amounts.length - 1] = wrappedAmount(amount, route.chainId); + + for (var _i = route.path.length - 1; _i > 0; _i--) { + var _pair = route.pairs[_i - 1]; + + var _pair$getInputAmount = _pair.getInputAmount(amounts[_i]), + inputAmount = _pair$getInputAmount[0], + _nextPair = _pair$getInputAmount[1]; + + amounts[_i - 1] = inputAmount; + nextPairs[_i - 1] = _nextPair; + } + } + + this.route = route; + this.tradeType = tradeType; + this.inputAmount = tradeType === exports.TradeType.EXACT_INPUT ? amount : route.input === ETHER ? CurrencyAmount.ether(amounts[0].raw) : amounts[0]; + this.outputAmount = tradeType === exports.TradeType.EXACT_OUTPUT ? amount : route.output === ETHER ? CurrencyAmount.ether(amounts[amounts.length - 1].raw) : amounts[amounts.length - 1]; + this.executionPrice = new Price(this.inputAmount.currency, this.outputAmount.currency, this.inputAmount.raw, this.outputAmount.raw); + this.nextMidPrice = Price.fromRoute(new Route(nextPairs, route.input)); + this.priceImpact = computePriceImpact(route.midPrice, this.inputAmount, this.outputAmount); + } + /** + * Constructs an exact in trade with the given amount in and route + * @param route route of the exact in trade + * @param amountIn the amount being passed in + */ + + + Trade.exactIn = function exactIn(route, amountIn) { + return new Trade(route, amountIn, exports.TradeType.EXACT_INPUT); + } + /** + * Constructs an exact out trade with the given amount out and route + * @param route route of the exact out trade + * @param amountOut the amount returned by the trade + */ + ; + + Trade.exactOut = function exactOut(route, amountOut) { + return new Trade(route, amountOut, exports.TradeType.EXACT_OUTPUT); + } + /** + * Get the minimum amount that must be received from this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + ; + + var _proto = Trade.prototype; + + _proto.minimumAmountOut = function minimumAmountOut(slippageTolerance) { + !!slippageTolerance.lessThan(ZERO) ? invariant(false, 'SLIPPAGE_TOLERANCE') : void 0; + + if (this.tradeType === exports.TradeType.EXACT_OUTPUT) { + return this.outputAmount; + } else { + var slippageAdjustedAmountOut = new Fraction(ONE).add(slippageTolerance).invert().multiply(this.outputAmount.raw).quotient; + return this.outputAmount instanceof TokenAmount ? new TokenAmount(this.outputAmount.token, slippageAdjustedAmountOut) : CurrencyAmount.ether(slippageAdjustedAmountOut); + } + } + /** + * Get the maximum amount in that can be spent via this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + ; + + _proto.maximumAmountIn = function maximumAmountIn(slippageTolerance) { + !!slippageTolerance.lessThan(ZERO) ? invariant(false, 'SLIPPAGE_TOLERANCE') : void 0; + + if (this.tradeType === exports.TradeType.EXACT_INPUT) { + return this.inputAmount; + } else { + var slippageAdjustedAmountIn = new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.raw).quotient; + return this.inputAmount instanceof TokenAmount ? new TokenAmount(this.inputAmount.token, slippageAdjustedAmountIn) : CurrencyAmount.ether(slippageAdjustedAmountIn); + } + } + /** + * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token + * amount to an output token, making at most `maxHops` hops. + * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyAmountIn exact amount of input currency to spend + * @param currencyOut the desired currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter + * @param bestTrades used in recursion; the current list of best trades + */ + ; + + Trade.bestTradeExactIn = function bestTradeExactIn(pairs, currencyAmountIn, currencyOut, _temp, // used in recursion. + currentPairs, originalAmountIn, bestTrades) { + var _ref = _temp === void 0 ? {} : _temp, + _ref$maxNumResults = _ref.maxNumResults, + maxNumResults = _ref$maxNumResults === void 0 ? 3 : _ref$maxNumResults, + _ref$maxHops = _ref.maxHops, + maxHops = _ref$maxHops === void 0 ? 3 : _ref$maxHops; + + if (currentPairs === void 0) { + currentPairs = []; + } + + if (originalAmountIn === void 0) { + originalAmountIn = currencyAmountIn; + } + + if (bestTrades === void 0) { + bestTrades = []; + } + + !(pairs.length > 0) ? invariant(false, 'PAIRS') : void 0; + !(maxHops > 0) ? invariant(false, 'MAX_HOPS') : void 0; + !(originalAmountIn === currencyAmountIn || currentPairs.length > 0) ? invariant(false, 'INVALID_RECURSION') : void 0; + var chainId = currencyAmountIn instanceof TokenAmount ? currencyAmountIn.token.chainId : currencyOut instanceof Token ? currencyOut.chainId : undefined; + !(chainId !== undefined) ? invariant(false, 'CHAIN_ID') : void 0; + var amountIn = wrappedAmount(currencyAmountIn, chainId); + var tokenOut = wrappedCurrency(currencyOut, chainId); + + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; // pair irrelevant + + if (!pair.token0.equals(amountIn.token) && !pair.token1.equals(amountIn.token)) continue; + if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue; + var amountOut = void 0; + + try { + ; + + var _pair$getOutputAmount2 = pair.getOutputAmount(amountIn); + + amountOut = _pair$getOutputAmount2[0]; + } catch (error) { + // input too low + if (error.isInsufficientInputAmountError) { + continue; + } + + throw error; + } // we have arrived at the output token, so this is the final trade of one of the paths + + + if (amountOut.token.equals(tokenOut)) { + sortedInsert(bestTrades, new Trade(new Route([].concat(currentPairs, [pair]), originalAmountIn.currency, currencyOut), originalAmountIn, exports.TradeType.EXACT_INPUT), maxNumResults, tradeComparator); + } else if (maxHops > 1 && pairs.length > 1) { + var pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)); // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops + + Trade.bestTradeExactIn(pairsExcludingThisPair, amountOut, currencyOut, { + maxNumResults: maxNumResults, + maxHops: maxHops - 1 + }, [].concat(currentPairs, [pair]), originalAmountIn, bestTrades); + } + } + + return bestTrades; + } + /** + * similar to the above method but instead targets a fixed output amount + * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token + * to an output token amount, making at most `maxHops` hops + * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyIn the currency to spend + * @param currencyAmountOut the exact amount of currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter + * @param bestTrades used in recursion; the current list of best trades + */ + ; + + Trade.bestTradeExactOut = function bestTradeExactOut(pairs, currencyIn, currencyAmountOut, _temp2, // used in recursion. + currentPairs, originalAmountOut, bestTrades) { + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$maxNumResults = _ref2.maxNumResults, + maxNumResults = _ref2$maxNumResults === void 0 ? 3 : _ref2$maxNumResults, + _ref2$maxHops = _ref2.maxHops, + maxHops = _ref2$maxHops === void 0 ? 3 : _ref2$maxHops; + + if (currentPairs === void 0) { + currentPairs = []; + } + + if (originalAmountOut === void 0) { + originalAmountOut = currencyAmountOut; + } + + if (bestTrades === void 0) { + bestTrades = []; + } + + !(pairs.length > 0) ? invariant(false, 'PAIRS') : void 0; + !(maxHops > 0) ? invariant(false, 'MAX_HOPS') : void 0; + !(originalAmountOut === currencyAmountOut || currentPairs.length > 0) ? invariant(false, 'INVALID_RECURSION') : void 0; + var chainId = currencyAmountOut instanceof TokenAmount ? currencyAmountOut.token.chainId : currencyIn instanceof Token ? currencyIn.chainId : undefined; + !(chainId !== undefined) ? invariant(false, 'CHAIN_ID') : void 0; + var amountOut = wrappedAmount(currencyAmountOut, chainId); + var tokenIn = wrappedCurrency(currencyIn, chainId); + + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; // pair irrelevant + + if (!pair.token0.equals(amountOut.token) && !pair.token1.equals(amountOut.token)) continue; + if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue; + var amountIn = void 0; + + try { + ; + + var _pair$getInputAmount2 = pair.getInputAmount(amountOut); + + amountIn = _pair$getInputAmount2[0]; + } catch (error) { + // not enough liquidity in this pair + if (error.isInsufficientReservesError) { + continue; + } + + throw error; + } // we have arrived at the input token, so this is the first trade of one of the paths + + + if (amountIn.token.equals(tokenIn)) { + sortedInsert(bestTrades, new Trade(new Route([pair].concat(currentPairs), currencyIn, originalAmountOut.currency), originalAmountOut, exports.TradeType.EXACT_OUTPUT), maxNumResults, tradeComparator); + } else if (maxHops > 1 && pairs.length > 1) { + var pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)); // otherwise, consider all the other paths that arrive at this token as long as we have not exceeded maxHops + + Trade.bestTradeExactOut(pairsExcludingThisPair, currencyIn, amountIn, { + maxNumResults: maxNumResults, + maxHops: maxHops - 1 + }, [pair].concat(currentPairs), originalAmountOut, bestTrades); + } + } + + return bestTrades; + }; + + return Trade; +}(); + +function toHex(currencyAmount) { + return "0x" + currencyAmount.raw.toString(16); +} + +var ZERO_HEX = '0x0'; +/** + * Represents the Uniswap V2 Router, and has static methods for helping execute trades. + */ + +var Router = /*#__PURE__*/function () { + /** + * Cannot be constructed. + */ + function Router() {} + /** + * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade. + * @param trade to produce call parameters for + * @param options options for the call parameters + */ + + + Router.swapCallParameters = function swapCallParameters(trade, options) { + var etherIn = trade.inputAmount.currency === ETHER; + var etherOut = trade.outputAmount.currency === ETHER; // the router does not support both ether in and out + + !!(etherIn && etherOut) ? invariant(false, 'ETHER_IN_OUT') : void 0; + !(!('ttl' in options) || options.ttl > 0) ? invariant(false, 'TTL') : void 0; + var to = validateAndParseAddress(options.recipient); + var amountIn = toHex(trade.maximumAmountIn(options.allowedSlippage)); + var amountOut = toHex(trade.minimumAmountOut(options.allowedSlippage)); + var path = trade.route.path.map(function (token) { + return token.address; + }); + var deadline = 'ttl' in options ? "0x" + (Math.floor(new Date().getTime() / 1000) + options.ttl).toString(16) : "0x" + options.deadline.toString(16); + var useFeeOnTransfer = Boolean(options.feeOnTransfer); + var methodName; + var args; + var value; + + switch (trade.tradeType) { + case exports.TradeType.EXACT_INPUT: + if (etherIn) { + methodName = useFeeOnTransfer ? 'swapExactETHForTokensSupportingFeeOnTransferTokens' : 'swapExactETHForTokens'; // (uint amountOutMin, address[] calldata path, address to, uint deadline) + + args = [amountOut, path, to, deadline]; + value = amountIn; + } else if (etherOut) { + methodName = useFeeOnTransfer ? 'swapExactTokensForETHSupportingFeeOnTransferTokens' : 'swapExactTokensForETH'; // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) + + args = [amountIn, amountOut, path, to, deadline]; + value = ZERO_HEX; + } else { + methodName = useFeeOnTransfer ? 'swapExactTokensForTokensSupportingFeeOnTransferTokens' : 'swapExactTokensForTokens'; // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) + + args = [amountIn, amountOut, path, to, deadline]; + value = ZERO_HEX; + } + + break; + + case exports.TradeType.EXACT_OUTPUT: + !!useFeeOnTransfer ? invariant(false, 'EXACT_OUT_FOT') : void 0; + + if (etherIn) { + methodName = 'swapETHForExactTokens'; // (uint amountOut, address[] calldata path, address to, uint deadline) + + args = [amountOut, path, to, deadline]; + value = amountIn; + } else if (etherOut) { + methodName = 'swapTokensForExactETH'; // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) + + args = [amountOut, amountIn, path, to, deadline]; + value = ZERO_HEX; + } else { + methodName = 'swapTokensForExactTokens'; // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) + + args = [amountOut, amountIn, path, to, deadline]; + value = ZERO_HEX; + } + + break; + } + + return { + methodName: methodName, + args: args, + value: value + }; + }; + + return Router; +}(); + +var ERC20 = [ + { + 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" + } +]; + +var _TOKEN_DECIMALS_CACHE; +var TOKEN_DECIMALS_CACHE = (_TOKEN_DECIMALS_CACHE = {}, _TOKEN_DECIMALS_CACHE[exports.ChainId.MAINNET] = { + '0x8B8208f94Ef1AA6891463b43D30C351c9466b0f2': 18 // WGRAM + +}, _TOKEN_DECIMALS_CACHE); +/** + * Contains methods for constructing instances of pairs and tokens from on-chain data. + */ + +var Fetcher = /*#__PURE__*/function () { + /** + * Cannot be constructed. + */ + function Fetcher() {} + /** + * Fetch information for a given token on the given chain, using the given ethers provider. + * @param chainId chain of the token + * @param address address of the token on the chain + * @param provider provider used to fetch the token + * @param symbol optional symbol of the token + * @param name optional name of the token + */ + + + Fetcher.fetchTokenData = function fetchTokenData(chainId, address, provider, symbol, name) { + try { + var _TOKEN_DECIMALS_CACHE2, _TOKEN_DECIMALS_CACHE3; + + var _temp3 = function _temp3(parsedDecimals) { + return new Token(chainId, address, parsedDecimals, symbol, name); + }; + + if (provider === undefined) provider = providers.getDefaultProvider(networks.getNetwork(chainId)); + + var _temp4 = typeof ((_TOKEN_DECIMALS_CACHE2 = TOKEN_DECIMALS_CACHE) === null || _TOKEN_DECIMALS_CACHE2 === void 0 ? void 0 : (_TOKEN_DECIMALS_CACHE3 = _TOKEN_DECIMALS_CACHE2[chainId]) === null || _TOKEN_DECIMALS_CACHE3 === void 0 ? void 0 : _TOKEN_DECIMALS_CACHE3[address]) === 'number'; + + return Promise.resolve(_temp4 ? _temp3(TOKEN_DECIMALS_CACHE[chainId][address]) : Promise.resolve(new contracts.Contract(address, ERC20, provider).decimals().then(function (decimals) { + var _TOKEN_DECIMALS_CACHE4, _extends2, _extends3; + + TOKEN_DECIMALS_CACHE = _extends({}, TOKEN_DECIMALS_CACHE, (_extends3 = {}, _extends3[chainId] = _extends({}, (_TOKEN_DECIMALS_CACHE4 = TOKEN_DECIMALS_CACHE) === null || _TOKEN_DECIMALS_CACHE4 === void 0 ? void 0 : _TOKEN_DECIMALS_CACHE4[chainId], (_extends2 = {}, _extends2[address] = decimals, _extends2)), _extends3)); + return decimals; + })).then(_temp3)); + } catch (e) { + return Promise.reject(e); + } + } + /** + * Fetches information about a pair and constructs a pair from the given two tokens. + * @param tokenA first token + * @param tokenB second token + * @param provider the provider to use to fetch the data + */ + ; + + Fetcher.fetchPairData = function fetchPairData(tokenA, tokenB, provider) { + try { + if (provider === undefined) provider = providers.getDefaultProvider(networks.getNetwork(tokenA.chainId)); + !(tokenA.chainId === tokenB.chainId) ? "development" !== "production" ? invariant(false, 'CHAIN_ID') : invariant(false) : void 0; + var address = Pair.getAddress(tokenA, tokenB); + return Promise.resolve(new contracts.Contract(address, IUniswapV2Pair.abi, provider).getReserves()).then(function (_ref) { + var reserves0 = _ref[0], + reserves1 = _ref[1]; + var balances = tokenA.sortsBefore(tokenB) ? [reserves0, reserves1] : [reserves1, reserves0]; + return new Pair(new TokenAmount(tokenA, balances[0]), new TokenAmount(tokenB, balances[1])); + }); + } catch (e) { + return Promise.reject(e); + } + }; + + return Fetcher; +}(); + +exports.JSBI = JSBI; +exports.Currency = Currency; +exports.CurrencyAmount = CurrencyAmount; +exports.ETHER = ETHER; +exports.FACTORY_ADDRESS = FACTORY_ADDRESS; +exports.Fetcher = Fetcher; +exports.Fraction = Fraction; +exports.INIT_CODE_HASH = INIT_CODE_HASH; +exports.InsufficientInputAmountError = InsufficientInputAmountError; +exports.InsufficientReservesError = InsufficientReservesError; +exports.MINIMUM_LIQUIDITY = MINIMUM_LIQUIDITY; +exports.Pair = Pair; +exports.Percent = Percent; +exports.Price = Price; +exports.Route = Route; +exports.Router = Router; +exports.Token = Token; +exports.TokenAmount = TokenAmount; +exports.Trade = Trade; +exports.WETH = WETH; +exports.currencyEquals = currencyEquals; +exports.inputOutputComparator = inputOutputComparator; +exports.tradeComparator = tradeComparator; +//# sourceMappingURL=sdk.cjs.development.js.map diff --git a/dist/sdk.cjs.development.js.map b/dist/sdk.cjs.development.js.map new file mode 100644 index 0000000..444d796 --- /dev/null +++ b/dist/sdk.cjs.development.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sdk.cjs.development.js","sources":["../src/constants.ts","../src/errors.ts","../src/utils.ts","../src/entities/currency.ts","../src/entities/token.ts","../src/entities/fractions/fraction.ts","../src/entities/fractions/currencyAmount.ts","../src/entities/fractions/tokenAmount.ts","../src/entities/fractions/price.ts","../src/entities/pair.ts","../src/entities/route.ts","../src/entities/fractions/percent.ts","../src/entities/trade.ts","../src/router.ts","../src/fetcher.ts"],"sourcesContent":["import JSBI from 'jsbi'\n\n// exports for external consumption\nexport type BigintIsh = JSBI | bigint | string\n\nexport enum ChainId {\n ENGRAM = 131,\n MAINNET = 1,\n ROPSTEN = 3,\n RINKEBY = 4,\n GÖRLI = 5,\n KOVAN = 42,\n TECO = 188355\n}\n\nexport enum TradeType {\n EXACT_INPUT,\n EXACT_OUTPUT\n}\n\nexport enum Rounding {\n ROUND_DOWN,\n ROUND_HALF_UP,\n ROUND_UP\n}\n\nexport const FACTORY_ADDRESS = '0x548C67Cbd80e8018b9792caeA0314569505F06B9' // need change\n\nexport const INIT_CODE_HASH = '0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4'\n\nexport const MINIMUM_LIQUIDITY = JSBI.BigInt(1000)\n\n// exports for internal consumption\nexport const ZERO = JSBI.BigInt(0)\nexport const ONE = JSBI.BigInt(1)\nexport const TWO = JSBI.BigInt(2)\nexport const THREE = JSBI.BigInt(3)\nexport const FIVE = JSBI.BigInt(5)\nexport const TEN = JSBI.BigInt(10)\nexport const _100 = JSBI.BigInt(100)\nexport const _997 = JSBI.BigInt(997)\nexport const _1000 = JSBI.BigInt(1000)\n\nexport enum SolidityType {\n uint8 = 'uint8',\n uint256 = 'uint256'\n}\n\nexport const SOLIDITY_TYPE_MAXIMA = {\n [SolidityType.uint8]: JSBI.BigInt('0xff'),\n [SolidityType.uint256]: JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')\n}\n","// see https://stackoverflow.com/a/41102306\nconst CAN_SET_PROTOTYPE = 'setPrototypeOf' in Object\n\n/**\n * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be\n * obtained by sending any amount of input.\n */\nexport class InsufficientReservesError extends Error {\n public readonly isInsufficientReservesError: true = true\n\n public constructor() {\n super()\n this.name = this.constructor.name\n if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\n/**\n * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less\n * than the price of a single unit of output after fees.\n */\nexport class InsufficientInputAmountError extends Error {\n public readonly isInsufficientInputAmountError: true = true\n\n public constructor() {\n super()\n this.name = this.constructor.name\n if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n","import invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport JSBI from 'jsbi'\nimport { getAddress } from '@ethersproject/address'\n\nimport { BigintIsh, ZERO, ONE, TWO, THREE, SolidityType, SOLIDITY_TYPE_MAXIMA } from './constants'\n\nexport function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void {\n invariant(JSBI.greaterThanOrEqual(value, ZERO), `${value} is not a ${solidityType}.`)\n invariant(JSBI.lessThanOrEqual(value, SOLIDITY_TYPE_MAXIMA[solidityType]), `${value} is not a ${solidityType}.`)\n}\n\n// warns if addresses are not checksummed\nexport function validateAndParseAddress(address: string): string {\n try {\n const checksummedAddress = getAddress(address)\n warning(address === checksummedAddress, `${address} is not checksummed.`)\n return checksummedAddress\n } catch (error) {\n invariant(false, `${address} is not a valid address.`)\n }\n}\n\nexport function parseBigintIsh(bigintIsh: BigintIsh): JSBI {\n return bigintIsh instanceof JSBI\n ? bigintIsh\n : typeof bigintIsh === 'bigint'\n ? JSBI.BigInt(bigintIsh.toString())\n : JSBI.BigInt(bigintIsh)\n}\n\n// mock the on-chain sqrt function\nexport function sqrt(y: JSBI): JSBI {\n validateSolidityTypeInstance(y, SolidityType.uint256)\n let z: JSBI = ZERO\n let x: JSBI\n if (JSBI.greaterThan(y, THREE)) {\n z = y\n x = JSBI.add(JSBI.divide(y, TWO), ONE)\n while (JSBI.lessThan(x, z)) {\n z = x\n x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO)\n }\n } else if (JSBI.notEqual(y, ZERO)) {\n z = ONE\n }\n return z\n}\n\n// given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to\n// `maxSize` by removing the last item\nexport function sortedInsert(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null {\n invariant(maxSize > 0, 'MAX_SIZE_ZERO')\n // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize\n invariant(items.length <= maxSize, 'ITEMS_SIZE')\n\n // short circuit first item add\n if (items.length === 0) {\n items.push(add)\n return null\n } else {\n const isFull = items.length === maxSize\n // short circuit if full and the additional item does not come before the last item\n if (isFull && comparator(items[items.length - 1], add) <= 0) {\n return add\n }\n\n let lo = 0,\n hi = items.length\n\n while (lo < hi) {\n const mid = (lo + hi) >>> 1\n if (comparator(items[mid], add) <= 0) {\n lo = mid + 1\n } else {\n hi = mid\n }\n }\n items.splice(lo, 0, add)\n return isFull ? items.pop()! : null\n }\n}\n","import JSBI from 'jsbi'\n\nimport { SolidityType } from '../constants'\nimport { validateSolidityTypeInstance } from '../utils'\n\n/**\n * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens.\n *\n * The only instance of the base class `Currency` is Ether.\n */\nexport class Currency {\n public readonly decimals: number\n public readonly symbol?: string\n public readonly name?: string\n\n /**\n * The only instance of the base class `Currency`.\n */\n public static readonly ETHER: Currency = new Currency(18, 'ETH', 'Ether')\n\n /**\n * Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`.\n * @param decimals decimals of the currency\n * @param symbol symbol of the currency\n * @param name of the currency\n */\n protected constructor(decimals: number, symbol?: string, name?: string) {\n validateSolidityTypeInstance(JSBI.BigInt(decimals), SolidityType.uint8)\n\n this.decimals = decimals\n this.symbol = symbol\n this.name = name\n }\n}\n\nconst ETHER = Currency.ETHER\nexport { ETHER }\n","import invariant from 'tiny-invariant'\nimport { ChainId } from '../constants'\nimport { validateAndParseAddress } from '../utils'\nimport { Currency } from './currency'\n\n/**\n * Represents an ERC20 token with a unique address and some metadata.\n */\nexport class Token extends Currency {\n public readonly chainId: ChainId\n public readonly address: string\n\n public constructor(chainId: ChainId, address: string, decimals: number, symbol?: string, name?: string) {\n super(decimals, symbol, name)\n this.chainId = chainId\n this.address = validateAndParseAddress(address)\n }\n\n /**\n * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.\n * @param other other token to compare\n */\n public equals(other: Token): boolean {\n // short circuit on reference equality\n if (this === other) {\n return true\n }\n return this.chainId === other.chainId && this.address === other.address\n }\n\n /**\n * Returns true if the address of this token sorts before the address of the other token\n * @param other other token to compare\n * @throws if the tokens have the same address\n * @throws if the tokens are on different chains\n */\n public sortsBefore(other: Token): boolean {\n invariant(this.chainId === other.chainId, 'CHAIN_IDS')\n invariant(this.address !== other.address, 'ADDRESSES')\n return this.address.toLowerCase() < other.address.toLowerCase()\n }\n}\n\n/**\n * Compares two currencies for equality\n */\nexport function currencyEquals(currencyA: Currency, currencyB: Currency): boolean {\n if (currencyA instanceof Token && currencyB instanceof Token) {\n return currencyA.equals(currencyB)\n } else if (currencyA instanceof Token) {\n return false\n } else if (currencyB instanceof Token) {\n return false\n } else {\n return currencyA === currencyB\n }\n}\n\nexport const WETH = {\n [ChainId.MAINNET]: new Token(\n ChainId.MAINNET,\n '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.ROPSTEN]: new Token(\n ChainId.ROPSTEN,\n '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.RINKEBY]: new Token(\n ChainId.RINKEBY,\n '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.KOVAN]: new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.TECO]: new Token(ChainId.TECO, '0x65A98D861a1E8e9E1404EF5d19C24a70e022B935', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.ENGRAM]: new Token(ChainId.ENGRAM, '0x7E3e3C50927F78ce0D2a1699d15d342c976A49B0', 18, 'WETH', 'Wrapped Ether') // need change\n}\n","import invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport _Decimal from 'decimal.js-light'\nimport _Big, { RoundingMode } from 'big.js'\nimport toFormat from 'toformat'\n\nimport { BigintIsh, Rounding } from '../../constants'\nimport { ONE } from '../../constants'\nimport { parseBigintIsh } from '../../utils'\n\nconst Decimal = toFormat(_Decimal)\nconst Big = toFormat(_Big)\n\nconst toSignificantRounding = {\n [Rounding.ROUND_DOWN]: Decimal.ROUND_DOWN,\n [Rounding.ROUND_HALF_UP]: Decimal.ROUND_HALF_UP,\n [Rounding.ROUND_UP]: Decimal.ROUND_UP\n}\n\nconst toFixedRounding = {\n [Rounding.ROUND_DOWN]: RoundingMode.RoundDown,\n [Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp,\n [Rounding.ROUND_UP]: RoundingMode.RoundUp\n}\n\nexport class Fraction {\n public readonly numerator: JSBI\n public readonly denominator: JSBI\n\n public constructor(numerator: BigintIsh, denominator: BigintIsh = ONE) {\n this.numerator = parseBigintIsh(numerator)\n this.denominator = parseBigintIsh(denominator)\n }\n\n // performs floor division\n public get quotient(): JSBI {\n return JSBI.divide(this.numerator, this.denominator)\n }\n\n // remainder after floor division\n public get remainder(): Fraction {\n return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator)\n }\n\n public invert(): Fraction {\n return new Fraction(this.denominator, this.numerator)\n }\n\n public add(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n if (JSBI.equal(this.denominator, otherParsed.denominator)) {\n return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator)\n }\n return new Fraction(\n JSBI.add(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n ),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public subtract(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n if (JSBI.equal(this.denominator, otherParsed.denominator)) {\n return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator)\n }\n return new Fraction(\n JSBI.subtract(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n ),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public lessThan(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.lessThan(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public equalTo(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.equal(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public greaterThan(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.greaterThan(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public multiply(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return new Fraction(\n JSBI.multiply(this.numerator, otherParsed.numerator),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public divide(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return new Fraction(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(this.denominator, otherParsed.numerator)\n )\n }\n\n public toSignificant(\n significantDigits: number,\n format: object = { groupSeparator: '' },\n rounding: Rounding = Rounding.ROUND_HALF_UP\n ): string {\n invariant(Number.isInteger(significantDigits), `${significantDigits} is not an integer.`)\n invariant(significantDigits > 0, `${significantDigits} is not positive.`)\n\n Decimal.set({ precision: significantDigits + 1, rounding: toSignificantRounding[rounding] })\n const quotient = new Decimal(this.numerator.toString())\n .div(this.denominator.toString())\n .toSignificantDigits(significantDigits)\n return quotient.toFormat(quotient.decimalPlaces(), format)\n }\n\n public toFixed(\n decimalPlaces: number,\n format: object = { groupSeparator: '' },\n rounding: Rounding = Rounding.ROUND_HALF_UP\n ): string {\n invariant(Number.isInteger(decimalPlaces), `${decimalPlaces} is not an integer.`)\n invariant(decimalPlaces >= 0, `${decimalPlaces} is negative.`)\n\n Big.DP = decimalPlaces\n Big.RM = toFixedRounding[rounding]\n return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format)\n }\n}\n","import { currencyEquals } from '../token'\nimport { Currency, ETHER } from '../currency'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport _Big from 'big.js'\nimport toFormat from 'toformat'\n\nimport { BigintIsh, Rounding, TEN, SolidityType } from '../../constants'\nimport { parseBigintIsh, validateSolidityTypeInstance } from '../../utils'\nimport { Fraction } from './fraction'\n\nconst Big = toFormat(_Big)\n\nexport class CurrencyAmount extends Fraction {\n public readonly currency: Currency\n\n /**\n * Helper that calls the constructor with the ETHER currency\n * @param amount ether amount in wei\n */\n public static ether(amount: BigintIsh): CurrencyAmount {\n return new CurrencyAmount(ETHER, amount)\n }\n\n // amount _must_ be raw, i.e. in the native representation\n protected constructor(currency: Currency, amount: BigintIsh) {\n const parsedAmount = parseBigintIsh(amount)\n validateSolidityTypeInstance(parsedAmount, SolidityType.uint256)\n\n super(parsedAmount, JSBI.exponentiate(TEN, JSBI.BigInt(currency.decimals)))\n this.currency = currency\n }\n\n public get raw(): JSBI {\n return this.numerator\n }\n\n public add(other: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(this.currency, other.currency), 'TOKEN')\n return new CurrencyAmount(this.currency, JSBI.add(this.raw, other.raw))\n }\n\n public subtract(other: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(this.currency, other.currency), 'TOKEN')\n return new CurrencyAmount(this.currency, JSBI.subtract(this.raw, other.raw))\n }\n\n public toSignificant(\n significantDigits: number = 6,\n format?: object,\n rounding: Rounding = Rounding.ROUND_DOWN\n ): string {\n return super.toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(\n decimalPlaces: number = this.currency.decimals,\n format?: object,\n rounding: Rounding = Rounding.ROUND_DOWN\n ): string {\n invariant(decimalPlaces <= this.currency.decimals, 'DECIMALS')\n return super.toFixed(decimalPlaces, format, rounding)\n }\n\n public toExact(format: object = { groupSeparator: '' }): string {\n Big.DP = this.currency.decimals\n return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(format)\n }\n}\n","import { CurrencyAmount } from './currencyAmount'\nimport { Token } from '../token'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\n\nimport { BigintIsh } from '../../constants'\n\nexport class TokenAmount extends CurrencyAmount {\n public readonly token: Token\n\n // amount _must_ be raw, i.e. in the native representation\n public constructor(token: Token, amount: BigintIsh) {\n super(token, amount)\n this.token = token\n }\n\n public add(other: TokenAmount): TokenAmount {\n invariant(this.token.equals(other.token), 'TOKEN')\n return new TokenAmount(this.token, JSBI.add(this.raw, other.raw))\n }\n\n public subtract(other: TokenAmount): TokenAmount {\n invariant(this.token.equals(other.token), 'TOKEN')\n return new TokenAmount(this.token, JSBI.subtract(this.raw, other.raw))\n }\n}\n","import { Token } from '../token'\nimport { TokenAmount } from './tokenAmount'\nimport { currencyEquals } from '../token'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\n\nimport { BigintIsh, Rounding, TEN } from '../../constants'\nimport { Currency } from '../currency'\nimport { Route } from '../route'\nimport { Fraction } from './fraction'\nimport { CurrencyAmount } from './currencyAmount'\n\nexport class Price extends Fraction {\n public readonly baseCurrency: Currency // input i.e. denominator\n public readonly quoteCurrency: Currency // output i.e. numerator\n public readonly scalar: Fraction // used to adjust the raw fraction w/r/t the decimals of the {base,quote}Token\n\n public static fromRoute(route: Route): Price {\n const prices: Price[] = []\n for (const [i, pair] of route.pairs.entries()) {\n prices.push(\n route.path[i].equals(pair.token0)\n ? new Price(pair.reserve0.currency, pair.reserve1.currency, pair.reserve0.raw, pair.reserve1.raw)\n : new Price(pair.reserve1.currency, pair.reserve0.currency, pair.reserve1.raw, pair.reserve0.raw)\n )\n }\n return prices.slice(1).reduce((accumulator, currentValue) => accumulator.multiply(currentValue), prices[0])\n }\n\n // denominator and numerator _must_ be raw, i.e. in the native representation\n public constructor(baseCurrency: Currency, quoteCurrency: Currency, denominator: BigintIsh, numerator: BigintIsh) {\n super(numerator, denominator)\n\n this.baseCurrency = baseCurrency\n this.quoteCurrency = quoteCurrency\n this.scalar = new Fraction(\n JSBI.exponentiate(TEN, JSBI.BigInt(baseCurrency.decimals)),\n JSBI.exponentiate(TEN, JSBI.BigInt(quoteCurrency.decimals))\n )\n }\n\n public get raw(): Fraction {\n return new Fraction(this.numerator, this.denominator)\n }\n\n public get adjusted(): Fraction {\n return super.multiply(this.scalar)\n }\n\n public invert(): Price {\n return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator)\n }\n\n public multiply(other: Price): Price {\n invariant(currencyEquals(this.quoteCurrency, other.baseCurrency), 'TOKEN')\n const fraction = super.multiply(other)\n return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator)\n }\n\n // performs floor division on overflow\n public quote(currencyAmount: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(currencyAmount.currency, this.baseCurrency), 'TOKEN')\n if (this.quoteCurrency instanceof Token) {\n return new TokenAmount(this.quoteCurrency, super.multiply(currencyAmount.raw).quotient)\n }\n return CurrencyAmount.ether(super.multiply(currencyAmount.raw).quotient)\n }\n\n public toSignificant(significantDigits: number = 6, format?: object, rounding?: Rounding): string {\n return this.adjusted.toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(decimalPlaces: number = 4, format?: object, rounding?: Rounding): string {\n return this.adjusted.toFixed(decimalPlaces, format, rounding)\n }\n}\n","import { Price } from './fractions/price'\nimport { TokenAmount } from './fractions/tokenAmount'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport { pack, keccak256 } from '@ethersproject/solidity'\nimport { getCreate2Address } from '@ethersproject/address'\n\nimport {\n BigintIsh,\n FACTORY_ADDRESS,\n INIT_CODE_HASH,\n MINIMUM_LIQUIDITY,\n ZERO,\n ONE,\n FIVE,\n _997,\n _1000,\n ChainId\n} from '../constants'\nimport { sqrt, parseBigintIsh } from '../utils'\nimport { InsufficientReservesError, InsufficientInputAmountError } from '../errors'\nimport { Token } from './token'\n\nlet PAIR_ADDRESS_CACHE: { [token0Address: string]: { [token1Address: string]: string } } = {}\n\nexport class Pair {\n public readonly liquidityToken: Token\n private readonly tokenAmounts: [TokenAmount, TokenAmount]\n\n public static getAddress(tokenA: Token, tokenB: Token): string {\n const tokens = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA] // does safety checks\n\n if (PAIR_ADDRESS_CACHE?.[tokens[0].address]?.[tokens[1].address] === undefined) {\n PAIR_ADDRESS_CACHE = {\n ...PAIR_ADDRESS_CACHE,\n [tokens[0].address]: {\n ...PAIR_ADDRESS_CACHE?.[tokens[0].address],\n [tokens[1].address]: getCreate2Address(\n FACTORY_ADDRESS,\n keccak256(['bytes'], [pack(['address', 'address'], [tokens[0].address, tokens[1].address])]),\n INIT_CODE_HASH\n )\n }\n }\n }\n\n return PAIR_ADDRESS_CACHE[tokens[0].address][tokens[1].address]\n }\n\n public constructor(tokenAmountA: TokenAmount, tokenAmountB: TokenAmount) {\n const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks\n ? [tokenAmountA, tokenAmountB]\n : [tokenAmountB, tokenAmountA]\n this.liquidityToken = new Token(\n tokenAmounts[0].token.chainId,\n Pair.getAddress(tokenAmounts[0].token, tokenAmounts[1].token),\n 18,\n 'UNI-V2',\n 'Uniswap V2'\n )\n this.tokenAmounts = tokenAmounts as [TokenAmount, TokenAmount]\n }\n\n /**\n * Returns true if the token is either token0 or token1\n * @param token to check\n */\n public involvesToken(token: Token): boolean {\n return token.equals(this.token0) || token.equals(this.token1)\n }\n\n /**\n * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0\n */\n public get token0Price(): Price {\n return new Price(this.token0, this.token1, this.tokenAmounts[0].raw, this.tokenAmounts[1].raw)\n }\n\n /**\n * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1\n */\n public get token1Price(): Price {\n return new Price(this.token1, this.token0, this.tokenAmounts[1].raw, this.tokenAmounts[0].raw)\n }\n\n /**\n * Return the price of the given token in terms of the other token in the pair.\n * @param token token to return price of\n */\n public priceOf(token: Token): Price {\n invariant(this.involvesToken(token), 'TOKEN')\n return token.equals(this.token0) ? this.token0Price : this.token1Price\n }\n\n /**\n * Returns the chain ID of the tokens in the pair.\n */\n public get chainId(): ChainId {\n return this.token0.chainId\n }\n\n public get token0(): Token {\n return this.tokenAmounts[0].token\n }\n\n public get token1(): Token {\n return this.tokenAmounts[1].token\n }\n\n public get reserve0(): TokenAmount {\n return this.tokenAmounts[0]\n }\n\n public get reserve1(): TokenAmount {\n return this.tokenAmounts[1]\n }\n\n public reserveOf(token: Token): TokenAmount {\n invariant(this.involvesToken(token), 'TOKEN')\n return token.equals(this.token0) ? this.reserve0 : this.reserve1\n }\n\n public getOutputAmount(inputAmount: TokenAmount): [TokenAmount, Pair] {\n invariant(this.involvesToken(inputAmount.token), 'TOKEN')\n if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO)) {\n throw new InsufficientReservesError()\n }\n const inputReserve = this.reserveOf(inputAmount.token)\n const outputReserve = this.reserveOf(inputAmount.token.equals(this.token0) ? this.token1 : this.token0)\n const inputAmountWithFee = JSBI.multiply(inputAmount.raw, _997)\n const numerator = JSBI.multiply(inputAmountWithFee, outputReserve.raw)\n const denominator = JSBI.add(JSBI.multiply(inputReserve.raw, _1000), inputAmountWithFee)\n const outputAmount = new TokenAmount(\n inputAmount.token.equals(this.token0) ? this.token1 : this.token0,\n JSBI.divide(numerator, denominator)\n )\n if (JSBI.equal(outputAmount.raw, ZERO)) {\n throw new InsufficientInputAmountError()\n }\n return [outputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]\n }\n\n public getInputAmount(outputAmount: TokenAmount): [TokenAmount, Pair] {\n invariant(this.involvesToken(outputAmount.token), 'TOKEN')\n if (\n JSBI.equal(this.reserve0.raw, ZERO) ||\n JSBI.equal(this.reserve1.raw, ZERO) ||\n JSBI.greaterThanOrEqual(outputAmount.raw, this.reserveOf(outputAmount.token).raw)\n ) {\n throw new InsufficientReservesError()\n }\n\n const outputReserve = this.reserveOf(outputAmount.token)\n const inputReserve = this.reserveOf(outputAmount.token.equals(this.token0) ? this.token1 : this.token0)\n const numerator = JSBI.multiply(JSBI.multiply(inputReserve.raw, outputAmount.raw), _1000)\n const denominator = JSBI.multiply(JSBI.subtract(outputReserve.raw, outputAmount.raw), _997)\n const inputAmount = new TokenAmount(\n outputAmount.token.equals(this.token0) ? this.token1 : this.token0,\n JSBI.add(JSBI.divide(numerator, denominator), ONE)\n )\n return [inputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]\n }\n\n public getLiquidityMinted(\n totalSupply: TokenAmount,\n tokenAmountA: TokenAmount,\n tokenAmountB: TokenAmount\n ): TokenAmount {\n invariant(totalSupply.token.equals(this.liquidityToken), 'LIQUIDITY')\n const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks\n ? [tokenAmountA, tokenAmountB]\n : [tokenAmountB, tokenAmountA]\n invariant(tokenAmounts[0].token.equals(this.token0) && tokenAmounts[1].token.equals(this.token1), 'TOKEN')\n\n let liquidity: JSBI\n if (JSBI.equal(totalSupply.raw, ZERO)) {\n liquidity = JSBI.subtract(sqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY)\n } else {\n const amount0 = JSBI.divide(JSBI.multiply(tokenAmounts[0].raw, totalSupply.raw), this.reserve0.raw)\n const amount1 = JSBI.divide(JSBI.multiply(tokenAmounts[1].raw, totalSupply.raw), this.reserve1.raw)\n liquidity = JSBI.lessThanOrEqual(amount0, amount1) ? amount0 : amount1\n }\n if (!JSBI.greaterThan(liquidity, ZERO)) {\n throw new InsufficientInputAmountError()\n }\n return new TokenAmount(this.liquidityToken, liquidity)\n }\n\n public getLiquidityValue(\n token: Token,\n totalSupply: TokenAmount,\n liquidity: TokenAmount,\n feeOn: boolean = false,\n kLast?: BigintIsh\n ): TokenAmount {\n invariant(this.involvesToken(token), 'TOKEN')\n invariant(totalSupply.token.equals(this.liquidityToken), 'TOTAL_SUPPLY')\n invariant(liquidity.token.equals(this.liquidityToken), 'LIQUIDITY')\n invariant(JSBI.lessThanOrEqual(liquidity.raw, totalSupply.raw), 'LIQUIDITY')\n\n let totalSupplyAdjusted: TokenAmount\n if (!feeOn) {\n totalSupplyAdjusted = totalSupply\n } else {\n invariant(!!kLast, 'K_LAST')\n const kLastParsed = parseBigintIsh(kLast)\n if (!JSBI.equal(kLastParsed, ZERO)) {\n const rootK = sqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw))\n const rootKLast = sqrt(kLastParsed)\n if (JSBI.greaterThan(rootK, rootKLast)) {\n const numerator = JSBI.multiply(totalSupply.raw, JSBI.subtract(rootK, rootKLast))\n const denominator = JSBI.add(JSBI.multiply(rootK, FIVE), rootKLast)\n const feeLiquidity = JSBI.divide(numerator, denominator)\n totalSupplyAdjusted = totalSupply.add(new TokenAmount(this.liquidityToken, feeLiquidity))\n } else {\n totalSupplyAdjusted = totalSupply\n }\n } else {\n totalSupplyAdjusted = totalSupply\n }\n }\n\n return new TokenAmount(\n token,\n JSBI.divide(JSBI.multiply(liquidity.raw, this.reserveOf(token).raw), totalSupplyAdjusted.raw)\n )\n }\n}\n","import { ChainId } from '../constants'\nimport invariant from 'tiny-invariant'\n\nimport { Currency, ETHER } from './currency'\nimport { Token, WETH } from './token'\nimport { Pair } from './pair'\nimport { Price } from './fractions/price'\n\nexport class Route {\n public readonly pairs: Pair[]\n public readonly path: Token[]\n public readonly input: Currency\n public readonly output: Currency\n public readonly midPrice: Price\n\n public constructor(pairs: Pair[], input: Currency, output?: Currency) {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(\n pairs.every(pair => pair.chainId === pairs[0].chainId),\n 'CHAIN_IDS'\n )\n invariant(\n (input instanceof Token && pairs[0].involvesToken(input)) ||\n (input === ETHER && pairs[0].involvesToken(WETH[pairs[0].chainId])),\n 'INPUT'\n )\n invariant(\n typeof output === 'undefined' ||\n (output instanceof Token && pairs[pairs.length - 1].involvesToken(output)) ||\n (output === ETHER && pairs[pairs.length - 1].involvesToken(WETH[pairs[0].chainId])),\n 'OUTPUT'\n )\n\n const path: Token[] = [input instanceof Token ? input : WETH[pairs[0].chainId]]\n for (const [i, pair] of pairs.entries()) {\n const currentInput = path[i]\n invariant(currentInput.equals(pair.token0) || currentInput.equals(pair.token1), 'PATH')\n const output = currentInput.equals(pair.token0) ? pair.token1 : pair.token0\n path.push(output)\n }\n\n this.pairs = pairs\n this.path = path\n this.midPrice = Price.fromRoute(this)\n this.input = input\n this.output = output ?? path[path.length - 1]\n }\n\n public get chainId(): ChainId {\n return this.pairs[0].chainId\n }\n}\n","import { Rounding, _100 } from '../../constants'\nimport { Fraction } from './fraction'\n\nconst _100_PERCENT = new Fraction(_100)\n\nexport class Percent extends Fraction {\n public toSignificant(significantDigits: number = 5, format?: object, rounding?: Rounding): string {\n return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(decimalPlaces: number = 2, format?: object, rounding?: Rounding): string {\n return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding)\n }\n}\n","import invariant from 'tiny-invariant'\n\nimport { ChainId, ONE, TradeType, ZERO } from '../constants'\nimport { sortedInsert } from '../utils'\nimport { Currency, ETHER } from './currency'\nimport { CurrencyAmount } from './fractions/currencyAmount'\nimport { Fraction } from './fractions/fraction'\nimport { Percent } from './fractions/percent'\nimport { Price } from './fractions/price'\nimport { TokenAmount } from './fractions/tokenAmount'\nimport { Pair } from './pair'\nimport { Route } from './route'\nimport { currencyEquals, Token, WETH } from './token'\n\n/**\n * Returns the percent difference between the mid price and the execution price, i.e. price impact.\n * @param midPrice mid price before the trade\n * @param inputAmount the input amount of the trade\n * @param outputAmount the output amount of the trade\n */\nfunction computePriceImpact(midPrice: Price, inputAmount: CurrencyAmount, outputAmount: CurrencyAmount): Percent {\n const exactQuote = midPrice.raw.multiply(inputAmount.raw)\n // calculate slippage := (exactQuote - outputAmount) / exactQuote\n const slippage = exactQuote.subtract(outputAmount.raw).divide(exactQuote)\n return new Percent(slippage.numerator, slippage.denominator)\n}\n\n// minimal interface so the input output comparator may be shared across types\ninterface InputOutput {\n readonly inputAmount: CurrencyAmount\n readonly outputAmount: CurrencyAmount\n}\n\n// comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts\n// in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first\nexport function inputOutputComparator(a: InputOutput, b: InputOutput): number {\n // must have same input and output token for comparison\n invariant(currencyEquals(a.inputAmount.currency, b.inputAmount.currency), 'INPUT_CURRENCY')\n invariant(currencyEquals(a.outputAmount.currency, b.outputAmount.currency), 'OUTPUT_CURRENCY')\n if (a.outputAmount.equalTo(b.outputAmount)) {\n if (a.inputAmount.equalTo(b.inputAmount)) {\n return 0\n }\n // trade A requires less input than trade B, so A should come first\n if (a.inputAmount.lessThan(b.inputAmount)) {\n return -1\n } else {\n return 1\n }\n } else {\n // tradeA has less output than trade B, so should come second\n if (a.outputAmount.lessThan(b.outputAmount)) {\n return 1\n } else {\n return -1\n }\n }\n}\n\n// extension of the input output comparator that also considers other dimensions of the trade in ranking them\nexport function tradeComparator(a: Trade, b: Trade) {\n const ioComp = inputOutputComparator(a, b)\n if (ioComp !== 0) {\n return ioComp\n }\n\n // consider lowest slippage next, since these are less likely to fail\n if (a.priceImpact.lessThan(b.priceImpact)) {\n return -1\n } else if (a.priceImpact.greaterThan(b.priceImpact)) {\n return 1\n }\n\n // finally consider the number of hops since each hop costs gas\n return a.route.path.length - b.route.path.length\n}\n\nexport interface BestTradeOptions {\n // how many results to return\n maxNumResults?: number\n // the maximum number of hops a trade should contain\n maxHops?: number\n}\n\n/**\n * Given a currency amount and a chain ID, returns the equivalent representation as the token amount.\n * In other words, if the currency is ETHER, returns the WETH token amount for the given chain. Otherwise, returns\n * the input currency amount.\n */\nfunction wrappedAmount(currencyAmount: CurrencyAmount, chainId: ChainId): TokenAmount {\n if (currencyAmount instanceof TokenAmount) return currencyAmount\n if (currencyAmount.currency === ETHER) return new TokenAmount(WETH[chainId], currencyAmount.raw)\n invariant(false, 'CURRENCY')\n}\n\nfunction wrappedCurrency(currency: Currency, chainId: ChainId): Token {\n if (currency instanceof Token) return currency\n if (currency === ETHER) return WETH[chainId]\n invariant(false, 'CURRENCY')\n}\n\n/**\n * Represents a trade executed against a list of pairs.\n * Does not account for slippage, i.e. trades that front run this trade and move the price.\n */\nexport class Trade {\n /**\n * The route of the trade, i.e. which pairs the trade goes through.\n */\n public readonly route: Route\n /**\n * The type of the trade, either exact in or exact out.\n */\n public readonly tradeType: TradeType\n /**\n * The input amount for the trade assuming no slippage.\n */\n public readonly inputAmount: CurrencyAmount\n /**\n * The output amount for the trade assuming no slippage.\n */\n public readonly outputAmount: CurrencyAmount\n /**\n * The price expressed in terms of output amount/input amount.\n */\n public readonly executionPrice: Price\n /**\n * The mid price after the trade executes assuming no slippage.\n */\n public readonly nextMidPrice: Price\n /**\n * The percent difference between the mid price before the trade and the trade execution price.\n */\n public readonly priceImpact: Percent\n\n /**\n * Constructs an exact in trade with the given amount in and route\n * @param route route of the exact in trade\n * @param amountIn the amount being passed in\n */\n public static exactIn(route: Route, amountIn: CurrencyAmount): Trade {\n return new Trade(route, amountIn, TradeType.EXACT_INPUT)\n }\n\n /**\n * Constructs an exact out trade with the given amount out and route\n * @param route route of the exact out trade\n * @param amountOut the amount returned by the trade\n */\n public static exactOut(route: Route, amountOut: CurrencyAmount): Trade {\n return new Trade(route, amountOut, TradeType.EXACT_OUTPUT)\n }\n\n public constructor(route: Route, amount: CurrencyAmount, tradeType: TradeType) {\n const amounts: TokenAmount[] = new Array(route.path.length)\n const nextPairs: Pair[] = new Array(route.pairs.length)\n if (tradeType === TradeType.EXACT_INPUT) {\n invariant(currencyEquals(amount.currency, route.input), 'INPUT')\n amounts[0] = wrappedAmount(amount, route.chainId)\n for (let i = 0; i < route.path.length - 1; i++) {\n const pair = route.pairs[i]\n const [outputAmount, nextPair] = pair.getOutputAmount(amounts[i])\n amounts[i + 1] = outputAmount\n nextPairs[i] = nextPair\n }\n } else {\n invariant(currencyEquals(amount.currency, route.output), 'OUTPUT')\n amounts[amounts.length - 1] = wrappedAmount(amount, route.chainId)\n for (let i = route.path.length - 1; i > 0; i--) {\n const pair = route.pairs[i - 1]\n const [inputAmount, nextPair] = pair.getInputAmount(amounts[i])\n amounts[i - 1] = inputAmount\n nextPairs[i - 1] = nextPair\n }\n }\n\n this.route = route\n this.tradeType = tradeType\n this.inputAmount =\n tradeType === TradeType.EXACT_INPUT\n ? amount\n : route.input === ETHER\n ? CurrencyAmount.ether(amounts[0].raw)\n : amounts[0]\n this.outputAmount =\n tradeType === TradeType.EXACT_OUTPUT\n ? amount\n : route.output === ETHER\n ? CurrencyAmount.ether(amounts[amounts.length - 1].raw)\n : amounts[amounts.length - 1]\n this.executionPrice = new Price(\n this.inputAmount.currency,\n this.outputAmount.currency,\n this.inputAmount.raw,\n this.outputAmount.raw\n )\n this.nextMidPrice = Price.fromRoute(new Route(nextPairs, route.input))\n this.priceImpact = computePriceImpact(route.midPrice, this.inputAmount, this.outputAmount)\n }\n\n /**\n * Get the minimum amount that must be received from this trade for the given slippage tolerance\n * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade\n */\n public minimumAmountOut(slippageTolerance: Percent): CurrencyAmount {\n invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE')\n if (this.tradeType === TradeType.EXACT_OUTPUT) {\n return this.outputAmount\n } else {\n const slippageAdjustedAmountOut = new Fraction(ONE)\n .add(slippageTolerance)\n .invert()\n .multiply(this.outputAmount.raw).quotient\n return this.outputAmount instanceof TokenAmount\n ? new TokenAmount(this.outputAmount.token, slippageAdjustedAmountOut)\n : CurrencyAmount.ether(slippageAdjustedAmountOut)\n }\n }\n\n /**\n * Get the maximum amount in that can be spent via this trade for the given slippage tolerance\n * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade\n */\n public maximumAmountIn(slippageTolerance: Percent): CurrencyAmount {\n invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE')\n if (this.tradeType === TradeType.EXACT_INPUT) {\n return this.inputAmount\n } else {\n const slippageAdjustedAmountIn = new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.raw).quotient\n return this.inputAmount instanceof TokenAmount\n ? new TokenAmount(this.inputAmount.token, slippageAdjustedAmountIn)\n : CurrencyAmount.ether(slippageAdjustedAmountIn)\n }\n }\n\n /**\n * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token\n * amount to an output token, making at most `maxHops` hops.\n * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting\n * the amount in among multiple routes.\n * @param pairs the pairs to consider in finding the best trade\n * @param currencyAmountIn exact amount of input currency to spend\n * @param currencyOut the desired currency out\n * @param maxNumResults maximum number of results to return\n * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair\n * @param currentPairs used in recursion; the current list of pairs\n * @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter\n * @param bestTrades used in recursion; the current list of best trades\n */\n public static bestTradeExactIn(\n pairs: Pair[],\n currencyAmountIn: CurrencyAmount,\n currencyOut: Currency,\n { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {},\n // used in recursion.\n currentPairs: Pair[] = [],\n originalAmountIn: CurrencyAmount = currencyAmountIn,\n bestTrades: Trade[] = []\n ): Trade[] {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(maxHops > 0, 'MAX_HOPS')\n invariant(originalAmountIn === currencyAmountIn || currentPairs.length > 0, 'INVALID_RECURSION')\n const chainId: ChainId | undefined =\n currencyAmountIn instanceof TokenAmount\n ? currencyAmountIn.token.chainId\n : currencyOut instanceof Token\n ? currencyOut.chainId\n : undefined\n invariant(chainId !== undefined, 'CHAIN_ID')\n\n const amountIn = wrappedAmount(currencyAmountIn, chainId)\n const tokenOut = wrappedCurrency(currencyOut, chainId)\n for (let i = 0; i < pairs.length; i++) {\n const pair = pairs[i]\n // pair irrelevant\n if (!pair.token0.equals(amountIn.token) && !pair.token1.equals(amountIn.token)) continue\n if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue\n\n let amountOut: TokenAmount\n try {\n ;[amountOut] = pair.getOutputAmount(amountIn)\n } catch (error) {\n // input too low\n if (error.isInsufficientInputAmountError) {\n continue\n }\n throw error\n }\n // we have arrived at the output token, so this is the final trade of one of the paths\n if (amountOut.token.equals(tokenOut)) {\n sortedInsert(\n bestTrades,\n new Trade(\n new Route([...currentPairs, pair], originalAmountIn.currency, currencyOut),\n originalAmountIn,\n TradeType.EXACT_INPUT\n ),\n maxNumResults,\n tradeComparator\n )\n } else if (maxHops > 1 && pairs.length > 1) {\n const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length))\n\n // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops\n Trade.bestTradeExactIn(\n pairsExcludingThisPair,\n amountOut,\n currencyOut,\n {\n maxNumResults,\n maxHops: maxHops - 1\n },\n [...currentPairs, pair],\n originalAmountIn,\n bestTrades\n )\n }\n }\n\n return bestTrades\n }\n\n /**\n * similar to the above method but instead targets a fixed output amount\n * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token\n * to an output token amount, making at most `maxHops` hops\n * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting\n * the amount in among multiple routes.\n * @param pairs the pairs to consider in finding the best trade\n * @param currencyIn the currency to spend\n * @param currencyAmountOut the exact amount of currency out\n * @param maxNumResults maximum number of results to return\n * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair\n * @param currentPairs used in recursion; the current list of pairs\n * @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter\n * @param bestTrades used in recursion; the current list of best trades\n */\n public static bestTradeExactOut(\n pairs: Pair[],\n currencyIn: Currency,\n currencyAmountOut: CurrencyAmount,\n { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {},\n // used in recursion.\n currentPairs: Pair[] = [],\n originalAmountOut: CurrencyAmount = currencyAmountOut,\n bestTrades: Trade[] = []\n ): Trade[] {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(maxHops > 0, 'MAX_HOPS')\n invariant(originalAmountOut === currencyAmountOut || currentPairs.length > 0, 'INVALID_RECURSION')\n const chainId: ChainId | undefined =\n currencyAmountOut instanceof TokenAmount\n ? currencyAmountOut.token.chainId\n : currencyIn instanceof Token\n ? currencyIn.chainId\n : undefined\n invariant(chainId !== undefined, 'CHAIN_ID')\n\n const amountOut = wrappedAmount(currencyAmountOut, chainId)\n const tokenIn = wrappedCurrency(currencyIn, chainId)\n for (let i = 0; i < pairs.length; i++) {\n const pair = pairs[i]\n // pair irrelevant\n if (!pair.token0.equals(amountOut.token) && !pair.token1.equals(amountOut.token)) continue\n if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue\n\n let amountIn: TokenAmount\n try {\n ;[amountIn] = pair.getInputAmount(amountOut)\n } catch (error) {\n // not enough liquidity in this pair\n if (error.isInsufficientReservesError) {\n continue\n }\n throw error\n }\n // we have arrived at the input token, so this is the first trade of one of the paths\n if (amountIn.token.equals(tokenIn)) {\n sortedInsert(\n bestTrades,\n new Trade(\n new Route([pair, ...currentPairs], currencyIn, originalAmountOut.currency),\n originalAmountOut,\n TradeType.EXACT_OUTPUT\n ),\n maxNumResults,\n tradeComparator\n )\n } else if (maxHops > 1 && pairs.length > 1) {\n const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length))\n\n // otherwise, consider all the other paths that arrive at this token as long as we have not exceeded maxHops\n Trade.bestTradeExactOut(\n pairsExcludingThisPair,\n currencyIn,\n amountIn,\n {\n maxNumResults,\n maxHops: maxHops - 1\n },\n [pair, ...currentPairs],\n originalAmountOut,\n bestTrades\n )\n }\n }\n\n return bestTrades\n }\n}\n","import { TradeType } from './constants'\nimport invariant from 'tiny-invariant'\nimport { validateAndParseAddress } from './utils'\nimport { CurrencyAmount, ETHER, Percent, Trade } from './entities'\n\n/**\n * Options for producing the arguments to send call to the router.\n */\nexport interface TradeOptions {\n /**\n * How much the execution price is allowed to move unfavorably from the trade execution price.\n */\n allowedSlippage: Percent\n /**\n * How long the swap is valid until it expires, in seconds.\n * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters\n * are generated.\n */\n ttl: number\n /**\n * The account that should receive the output of the swap.\n */\n recipient: string\n\n /**\n * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods\n */\n feeOnTransfer?: boolean\n}\n\nexport interface TradeOptionsDeadline extends Omit {\n /**\n * When the transaction expires.\n * This is an atlernate to specifying the ttl, for when you do not want to use local time.\n */\n deadline: number\n}\n\n/**\n * The parameters to use in the call to the Uniswap V2 Router to execute a trade.\n */\nexport interface SwapParameters {\n /**\n * The method to call on the Uniswap V2 Router.\n */\n methodName: string\n /**\n * The arguments to pass to the method, all hex encoded.\n */\n args: (string | string[])[]\n /**\n * The amount of wei to send in hex.\n */\n value: string\n}\n\nfunction toHex(currencyAmount: CurrencyAmount) {\n return `0x${currencyAmount.raw.toString(16)}`\n}\n\nconst ZERO_HEX = '0x0'\n\n/**\n * Represents the Uniswap V2 Router, and has static methods for helping execute trades.\n */\nexport abstract class Router {\n /**\n * Cannot be constructed.\n */\n private constructor() {}\n /**\n * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.\n * @param trade to produce call parameters for\n * @param options options for the call parameters\n */\n public static swapCallParameters(trade: Trade, options: TradeOptions | TradeOptionsDeadline): SwapParameters {\n const etherIn = trade.inputAmount.currency === ETHER\n const etherOut = trade.outputAmount.currency === ETHER\n // the router does not support both ether in and out\n invariant(!(etherIn && etherOut), 'ETHER_IN_OUT')\n invariant(!('ttl' in options) || options.ttl > 0, 'TTL')\n\n const to: string = validateAndParseAddress(options.recipient)\n const amountIn: string = toHex(trade.maximumAmountIn(options.allowedSlippage))\n const amountOut: string = toHex(trade.minimumAmountOut(options.allowedSlippage))\n const path: string[] = trade.route.path.map(token => token.address)\n const deadline =\n 'ttl' in options\n ? `0x${(Math.floor(new Date().getTime() / 1000) + options.ttl).toString(16)}`\n : `0x${options.deadline.toString(16)}`\n\n const useFeeOnTransfer = Boolean(options.feeOnTransfer)\n\n let methodName: string\n let args: (string | string[])[]\n let value: string\n switch (trade.tradeType) {\n case TradeType.EXACT_INPUT:\n if (etherIn) {\n methodName = useFeeOnTransfer ? 'swapExactETHForTokensSupportingFeeOnTransferTokens' : 'swapExactETHForTokens'\n // (uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountOut, path, to, deadline]\n value = amountIn\n } else if (etherOut) {\n methodName = useFeeOnTransfer ? 'swapExactTokensForETHSupportingFeeOnTransferTokens' : 'swapExactTokensForETH'\n // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountIn, amountOut, path, to, deadline]\n value = ZERO_HEX\n } else {\n methodName = useFeeOnTransfer\n ? 'swapExactTokensForTokensSupportingFeeOnTransferTokens'\n : 'swapExactTokensForTokens'\n // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountIn, amountOut, path, to, deadline]\n value = ZERO_HEX\n }\n break\n case TradeType.EXACT_OUTPUT:\n invariant(!useFeeOnTransfer, 'EXACT_OUT_FOT')\n if (etherIn) {\n methodName = 'swapETHForExactTokens'\n // (uint amountOut, address[] calldata path, address to, uint deadline)\n args = [amountOut, path, to, deadline]\n value = amountIn\n } else if (etherOut) {\n methodName = 'swapTokensForExactETH'\n // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n args = [amountOut, amountIn, path, to, deadline]\n value = ZERO_HEX\n } else {\n methodName = 'swapTokensForExactTokens'\n // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n args = [amountOut, amountIn, path, to, deadline]\n value = ZERO_HEX\n }\n break\n }\n return {\n methodName,\n args,\n value\n }\n }\n}\n","import { Contract } from '@ethersproject/contracts'\nimport { getNetwork } from '@ethersproject/networks'\nimport { getDefaultProvider } from '@ethersproject/providers'\nimport { TokenAmount } from './entities/fractions/tokenAmount'\nimport { Pair } from './entities/pair'\nimport IUniswapV2Pair from '@uniswap/v2-core/build/IUniswapV2Pair.json'\nimport invariant from 'tiny-invariant'\nimport ERC20 from './abis/ERC20.json'\nimport { ChainId } from './constants'\nimport { Token } from './entities/token'\n\nlet TOKEN_DECIMALS_CACHE: { [chainId: number]: { [address: string]: number } } = {\n [ChainId.MAINNET]: {\n '0x8B8208f94Ef1AA6891463b43D30C351c9466b0f2': 18 // WGRAM\n }\n}\n\n/**\n * Contains methods for constructing instances of pairs and tokens from on-chain data.\n */\nexport abstract class Fetcher {\n /**\n * Cannot be constructed.\n */\n private constructor() {}\n\n /**\n * Fetch information for a given token on the given chain, using the given ethers provider.\n * @param chainId chain of the token\n * @param address address of the token on the chain\n * @param provider provider used to fetch the token\n * @param symbol optional symbol of the token\n * @param name optional name of the token\n */\n public static async fetchTokenData(\n chainId: ChainId,\n address: string,\n provider = getDefaultProvider(getNetwork(chainId)),\n symbol?: string,\n name?: string\n ): Promise {\n const parsedDecimals =\n typeof TOKEN_DECIMALS_CACHE?.[chainId]?.[address] === 'number'\n ? TOKEN_DECIMALS_CACHE[chainId][address]\n : await new Contract(address, ERC20, provider).decimals().then((decimals: number): number => {\n TOKEN_DECIMALS_CACHE = {\n ...TOKEN_DECIMALS_CACHE,\n [chainId]: {\n ...TOKEN_DECIMALS_CACHE?.[chainId],\n [address]: decimals\n }\n }\n return decimals\n })\n return new Token(chainId, address, parsedDecimals, symbol, name)\n }\n\n /**\n * Fetches information about a pair and constructs a pair from the given two tokens.\n * @param tokenA first token\n * @param tokenB second token\n * @param provider the provider to use to fetch the data\n */\n public static async fetchPairData(\n tokenA: Token,\n tokenB: Token,\n provider = getDefaultProvider(getNetwork(tokenA.chainId))\n ): Promise {\n invariant(tokenA.chainId === tokenB.chainId, 'CHAIN_ID')\n const address = Pair.getAddress(tokenA, tokenB)\n const [reserves0, reserves1] = await new Contract(address, IUniswapV2Pair.abi, provider).getReserves()\n const balances = tokenA.sortsBefore(tokenB) ? [reserves0, reserves1] : [reserves1, reserves0]\n return new Pair(new TokenAmount(tokenA, balances[0]), new TokenAmount(tokenB, balances[1]))\n }\n}\n"],"names":["ChainId","TradeType","Rounding","FACTORY_ADDRESS","INIT_CODE_HASH","MINIMUM_LIQUIDITY","JSBI","BigInt","ZERO","ONE","TWO","THREE","FIVE","TEN","_100","_997","_1000","SolidityType","SOLIDITY_TYPE_MAXIMA","uint8","uint256","CAN_SET_PROTOTYPE","Object","InsufficientReservesError","name","constructor","setPrototypeOf","prototype","Error","InsufficientInputAmountError","validateSolidityTypeInstance","value","solidityType","greaterThanOrEqual","invariant","lessThanOrEqual","validateAndParseAddress","address","checksummedAddress","getAddress","warning","error","parseBigintIsh","bigintIsh","toString","sqrt","y","z","x","greaterThan","add","divide","lessThan","notEqual","sortedInsert","items","maxSize","comparator","length","push","isFull","lo","hi","mid","splice","pop","Currency","decimals","symbol","ETHER","Token","chainId","equals","other","sortsBefore","toLowerCase","currencyEquals","currencyA","currencyB","WETH","MAINNET","ROPSTEN","RINKEBY","GÖRLI","KOVAN","TECO","ENGRAM","Decimal","toFormat","_Decimal","Big","_Big","toSignificantRounding","ROUND_DOWN","ROUND_HALF_UP","ROUND_UP","toFixedRounding","Fraction","numerator","denominator","invert","otherParsed","equal","multiply","subtract","equalTo","toSignificant","significantDigits","format","rounding","groupSeparator","Number","isInteger","set","precision","quotient","div","toSignificantDigits","decimalPlaces","toFixed","DP","RM","remainder","CurrencyAmount","currency","amount","parsedAmount","exponentiate","ether","raw","toExact","TokenAmount","token","Price","baseCurrency","quoteCurrency","scalar","fromRoute","route","prices","pairs","entries","i","pair","path","token0","reserve0","reserve1","slice","reduce","accumulator","currentValue","fraction","quote","currencyAmount","adjusted","PAIR_ADDRESS_CACHE","Pair","tokenAmountA","tokenAmountB","tokenAmounts","liquidityToken","tokenA","tokenB","tokens","undefined","getCreate2Address","keccak256","pack","involvesToken","token1","priceOf","token0Price","token1Price","reserveOf","getOutputAmount","inputAmount","inputReserve","outputReserve","inputAmountWithFee","outputAmount","getInputAmount","getLiquidityMinted","totalSupply","liquidity","amount0","amount1","getLiquidityValue","feeOn","kLast","totalSupplyAdjusted","kLastParsed","rootK","rootKLast","feeLiquidity","Route","input","output","every","currentInput","midPrice","_100_PERCENT","Percent","computePriceImpact","exactQuote","slippage","inputOutputComparator","a","b","tradeComparator","ioComp","priceImpact","wrappedAmount","wrappedCurrency","Trade","tradeType","amounts","Array","nextPairs","EXACT_INPUT","nextPair","EXACT_OUTPUT","executionPrice","nextMidPrice","exactIn","amountIn","exactOut","amountOut","minimumAmountOut","slippageTolerance","slippageAdjustedAmountOut","maximumAmountIn","slippageAdjustedAmountIn","bestTradeExactIn","currencyAmountIn","currencyOut","currentPairs","originalAmountIn","bestTrades","maxNumResults","maxHops","tokenOut","isInsufficientInputAmountError","pairsExcludingThisPair","concat","bestTradeExactOut","currencyIn","currencyAmountOut","originalAmountOut","tokenIn","isInsufficientReservesError","toHex","ZERO_HEX","Router","swapCallParameters","trade","options","etherIn","etherOut","ttl","to","recipient","allowedSlippage","map","deadline","Math","floor","Date","getTime","useFeeOnTransfer","Boolean","feeOnTransfer","methodName","args","TOKEN_DECIMALS_CACHE","Fetcher","fetchTokenData","provider","parsedDecimals","getDefaultProvider","getNetwork","Contract","ERC20","then","fetchPairData","IUniswapV2Pair","abi","getReserves","reserves0","reserves1","balances"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,WAAYA;AACVA,EAAAA,gCAAA,WAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,gCAAA,aAAA;AACAA,EAAAA,8BAAA,UAAA;AACAA,EAAAA,iCAAA,SAAA;AACD,CARD,EAAYA,eAAO,KAAPA,eAAO,KAAA,CAAnB;;AAUA,WAAYC;AACVA,EAAAA,uCAAA,gBAAA;AACAA,EAAAA,wCAAA,iBAAA;AACD,CAHD,EAAYA,iBAAS,KAATA,iBAAS,KAAA,CAArB;;AAKA,WAAYC;AACVA,EAAAA,oCAAA,eAAA;AACAA,EAAAA,uCAAA,kBAAA;AACAA,EAAAA,kCAAA,aAAA;AACD,CAJD,EAAYA,gBAAQ,KAARA,gBAAQ,KAAA,CAApB;;IAMaC,eAAe,GAAG;;IAElBC,cAAc,GAAG;IAEjBC,iBAAiB,gBAAGC,IAAI,CAACC,MAAL,CAAY,IAAZ;;AAG1B,IAAMC,IAAI,gBAAGF,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAb;AACA,IAAME,GAAG,gBAAGH,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAZ;AACA,IAAMG,GAAG,gBAAGJ,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAZ;AACA,IAAMI,KAAK,gBAAGL,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAd;AACA,IAAMK,IAAI,gBAAGN,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAb;AACA,IAAMM,GAAG,gBAAGP,IAAI,CAACC,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AAnB,IAA6B,CAAC6H,SAAD,EAAYC,SAAZ,CAA7B,GAAsD,CAACA,SAAD,EAAYD,SAAZ,CAAvE;AACA,eAAO,IAAInI,IAAJ,CAAS,IAAI1B,WAAJ,CAAgB+B,MAAhB,EAAwBgI,QAAQ,CAAC,CAAD,CAAhC,CAAT,EAA+C,IAAI/J,WAAJ,CAAgBgC,MAAhB,EAAwB+H,QAAQ,CAAC,CAAD,CAAhC,CAA/C,CAAP;;AACD,KArDH;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/sdk.cjs.production.min.js b/dist/sdk.cjs.production.min.js new file mode 100644 index 0000000..d37684a --- /dev/null +++ b/dist/sdk.cjs.production.min.js @@ -0,0 +1,2 @@ +"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,n,r,o,i=t(require("jsbi")),u=t(require("tiny-invariant")),a=(t(require("tiny-warning")),require("@ethersproject/address")),s=t(require("big.js")),c=t(require("toformat")),d=t(require("decimal.js-light")),p=require("@ethersproject/solidity"),f=require("@ethersproject/contracts"),l=require("@ethersproject/networks"),h=require("@ethersproject/providers"),m=t(require("@uniswap/v2-core/build/IUniswapV2Pair.json"));(n=exports.ChainId||(exports.ChainId={}))[n.ENGRAM=131]="ENGRAM",n[n.MAINNET=1]="MAINNET",n[n.ROPSTEN=3]="ROPSTEN",n[n.RINKEBY=4]="RINKEBY",n[n["GÖRLI"]=5]="GÖRLI",n[n.KOVAN=42]="KOVAN",n[n.TECO=188355]="TECO",(r=exports.TradeType||(exports.TradeType={}))[r.EXACT_INPUT=0]="EXACT_INPUT",r[r.EXACT_OUTPUT=1]="EXACT_OUTPUT",(o=exports.Rounding||(exports.Rounding={}))[o.ROUND_DOWN=0]="ROUND_DOWN",o[o.ROUND_HALF_UP=1]="ROUND_HALF_UP",o[o.ROUND_UP=2]="ROUND_UP";var v,y="0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4",w=i.BigInt(1e3),T=i.BigInt(0),g=i.BigInt(1),k=i.BigInt(2),x=i.BigInt(3),A=i.BigInt(5),I=i.BigInt(10),E=i.BigInt(100),O=i.BigInt(997),b=i.BigInt(1e3);!function(t){t.uint8="uint8",t.uint256="uint256"}(v||(v={}));var q=((e={})[v.uint8]=i.BigInt("0xff"),e[v.uint256]=i.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e);function C(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}var M="setPrototypeOf"in Object,W=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,M&&Object.setPrototypeOf(B(n),(this instanceof e?this.constructor:void 0).prototype),n}return P(e,t),e}(S(Error)),L=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,M&&Object.setPrototypeOf(B(n),(this instanceof e?this.constructor:void 0).prototype),n}return P(e,t),e}(S(Error));function X(t,e){i.greaterThanOrEqual(t,T)||u(!1),i.lessThanOrEqual(t,q[e])||u(!1)}function G(t){try{return a.getAddress(t)}catch(t){u(!1)}}function K(t){return t instanceof i?t:i.BigInt("bigint"==typeof t?t.toString():t)}function V(t){X(t,v.uint256);var e,n=T;if(i.greaterThan(t,x))for(n=t,e=i.add(i.divide(t,k),g);i.lessThan(e,n);)n=e,e=i.divide(i.add(i.divide(t,e),e),k);else i.notEqual(t,T)&&(n=g);return n}function Y(t,e,n,r){if(n>0||u(!1),t.length<=n||u(!1),0===t.length)return t.push(e),null;var o=t.length===n;if(o&&r(t[t.length-1],e)<=0)return e;for(var i=0,a=t.length;i>>1;r(t[s],e)<=0?i=s+1:a=s}return t.splice(i,0,e),o?t.pop():null}var J,Q=function(t,e,n){X(i.BigInt(t),v.uint8),this.decimals=t,this.symbol=e,this.name=n},$=Q.ETHER=new Q(18,"ETH","Ether"),z=function(t){function e(e,n,r,o,i){var u;return(u=t.call(this,r,o,i)||this).chainId=e,u.address=G(n),u}P(e,t);var n=e.prototype;return n.equals=function(t){return this===t||this.chainId===t.chainId&&this.address===t.address},n.sortsBefore=function(t){return this.chainId!==t.chainId&&u(!1),this.address===t.address&&u(!1),this.address.toLowerCase()0||u(!1),rt.set({precision:t+1,rounding:it[n]});var r=new rt(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return r.toFormat(r.decimalPlaces(),e)},e.toFixed=function(t,e,n){return void 0===e&&(e={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||u(!1),t>=0||u(!1),ot.DP=t,ot.RM=ut[n],new ot(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,e)},N(t,[{key:"quotient",get:function(){return i.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new t(i.remainder(this.numerator,this.denominator),this.denominator)}}]),t}(),st=c(s),ct=function(t){function e(e,n){var r,o=K(n);return X(o,v.uint256),(r=t.call(this,o,i.exponentiate(I,i.BigInt(e.decimals)))||this).currency=e,r}P(e,t),e.ether=function(t){return new e($,t)};var n=e.prototype;return n.add=function(t){return Z(this.currency,t.currency)||u(!1),new e(this.currency,i.add(this.raw,t.raw))},n.subtract=function(t){return Z(this.currency,t.currency)||u(!1),new e(this.currency,i.subtract(this.raw,t.raw))},n.toSignificant=function(e,n,r){return void 0===e&&(e=6),void 0===r&&(r=exports.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,e,n,r)},n.toFixed=function(e,n,r){return void 0===e&&(e=this.currency.decimals),void 0===r&&(r=exports.Rounding.ROUND_DOWN),e<=this.currency.decimals||u(!1),t.prototype.toFixed.call(this,e,n,r)},n.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),st.DP=this.currency.decimals,new st(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)},N(e,[{key:"raw",get:function(){return this.numerator}}]),e}(at),dt=function(t){function e(e,n){var r;return(r=t.call(this,e,n)||this).token=e,r}P(e,t);var n=e.prototype;return n.add=function(t){return this.token.equals(t.token)||u(!1),new e(this.token,i.add(this.raw,t.raw))},n.subtract=function(t){return this.token.equals(t.token)||u(!1),new e(this.token,i.subtract(this.raw,t.raw))},e}(ct),pt=function(t){function e(e,n,r,o){var u;return(u=t.call(this,o,r)||this).baseCurrency=e,u.quoteCurrency=n,u.scalar=new at(i.exponentiate(I,i.BigInt(e.decimals)),i.exponentiate(I,i.BigInt(n.decimals))),u}P(e,t),e.fromRoute=function(t){for(var n,r=[],o=H(t.pairs.entries());!(n=o()).done;){var i=n.value,u=i[1];r.push(t.path[i[0]].equals(u.token0)?new e(u.reserve0.currency,u.reserve1.currency,u.reserve0.raw,u.reserve1.raw):new e(u.reserve1.currency,u.reserve0.currency,u.reserve1.raw,u.reserve0.raw))}return r.slice(1).reduce((function(t,e){return t.multiply(e)}),r[0])};var n=e.prototype;return n.invert=function(){return new e(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){Z(this.quoteCurrency,n.baseCurrency)||u(!1);var r=t.prototype.multiply.call(this,n);return new e(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(e){return Z(e.currency,this.baseCurrency)||u(!1),this.quoteCurrency instanceof z?new dt(this.quoteCurrency,t.prototype.multiply.call(this,e.raw).quotient):ct.ether(t.prototype.multiply.call(this,e.raw).quotient)},n.toSignificant=function(t,e,n){return void 0===t&&(t=6),this.adjusted.toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=4),this.adjusted.toFixed(t,e,n)},N(e,[{key:"raw",get:function(){return new at(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),e}(at),ft={},lt=function(){function t(e,n){var r=e.token.sortsBefore(n.token)?[e,n]:[n,e];this.liquidityToken=new z(r[0].token.chainId,t.getAddress(r[0].token,r[1].token),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=r}t.getAddress=function(t,e){var n,r,o,i,u,s=t.sortsBefore(e)?[t,e]:[e,t];return void 0===(null===(n=ft)||void 0===n||null===(r=n[s[0].address])||void 0===r?void 0:r[s[1].address])&&(ft=R({},ft,((u={})[s[0].address]=R({},null===(o=ft)||void 0===o?void 0:o[s[0].address],((i={})[s[1].address]=a.getCreate2Address("0x548C67Cbd80e8018b9792caeA0314569505F06B9",p.keccak256(["bytes"],[p.pack(["address","address"],[s[0].address,s[1].address])]),y),i)),u))),ft[s[0].address][s[1].address]};var e=t.prototype;return e.involvesToken=function(t){return t.equals(this.token0)||t.equals(this.token1)},e.priceOf=function(t){return this.involvesToken(t)||u(!1),t.equals(this.token0)?this.token0Price:this.token1Price},e.reserveOf=function(t){return this.involvesToken(t)||u(!1),t.equals(this.token0)?this.reserve0:this.reserve1},e.getOutputAmount=function(e){if(this.involvesToken(e.token)||u(!1),i.equal(this.reserve0.raw,T)||i.equal(this.reserve1.raw,T))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),o=i.multiply(e.raw,O),a=i.multiply(o,r.raw),s=i.add(i.multiply(n.raw,b),o),c=new dt(e.token.equals(this.token0)?this.token1:this.token0,i.divide(a,s));if(i.equal(c.raw,T))throw new L;return[c,new t(n.add(e),r.subtract(c))]},e.getInputAmount=function(e){if(this.involvesToken(e.token)||u(!1),i.equal(this.reserve0.raw,T)||i.equal(this.reserve1.raw,T)||i.greaterThanOrEqual(e.raw,this.reserveOf(e.token).raw))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),o=i.multiply(i.multiply(r.raw,e.raw),b),a=i.multiply(i.subtract(n.raw,e.raw),O),s=new dt(e.token.equals(this.token0)?this.token1:this.token0,i.add(i.divide(o,a),g));return[s,new t(r.add(s),n.subtract(e))]},e.getLiquidityMinted=function(t,e,n){t.token.equals(this.liquidityToken)||u(!1);var r,o=e.token.sortsBefore(n.token)?[e,n]:[n,e];if(o[0].token.equals(this.token0)&&o[1].token.equals(this.token1)||u(!1),i.equal(t.raw,T))r=i.subtract(V(i.multiply(o[0].raw,o[1].raw)),w);else{var a=i.divide(i.multiply(o[0].raw,t.raw),this.reserve0.raw),s=i.divide(i.multiply(o[1].raw,t.raw),this.reserve1.raw);r=i.lessThanOrEqual(a,s)?a:s}if(!i.greaterThan(r,T))throw new L;return new dt(this.liquidityToken,r)},e.getLiquidityValue=function(t,e,n,r,o){var a;if(void 0===r&&(r=!1),this.involvesToken(t)||u(!1),e.token.equals(this.liquidityToken)||u(!1),n.token.equals(this.liquidityToken)||u(!1),i.lessThanOrEqual(n.raw,e.raw)||u(!1),r){o||u(!1);var s=K(o);if(i.equal(s,T))a=e;else{var c=V(i.multiply(this.reserve0.raw,this.reserve1.raw)),d=V(s);if(i.greaterThan(c,d)){var p=i.multiply(e.raw,i.subtract(c,d)),f=i.add(i.multiply(c,A),d),l=i.divide(p,f);a=e.add(new dt(this.liquidityToken,l))}else a=e}}else a=e;return new dt(t,i.divide(i.multiply(n.raw,this.reserveOf(t).raw),a.raw))},N(t,[{key:"token0Price",get:function(){return new pt(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new pt(this.token1,this.token0,this.tokenAmounts[1].raw,this.tokenAmounts[0].raw)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].token}},{key:"token1",get:function(){return this.tokenAmounts[1].token}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),t}(),ht=function(){function t(t,e,n){t.length>0||u(!1),t.every((function(e){return e.chainId===t[0].chainId}))||u(!1),e instanceof z&&t[0].involvesToken(e)||e===$&&t[0].involvesToken(nt[t[0].chainId])||u(!1),void 0===n||n instanceof z&&t[t.length-1].involvesToken(n)||n===$&&t[t.length-1].involvesToken(nt[t[0].chainId])||u(!1);for(var r,o=[e instanceof z?e:nt[t[0].chainId]],i=H(t.entries());!(r=i()).done;){var a=r.value,s=a[1],c=o[a[0]];c.equals(s.token0)||c.equals(s.token1)||u(!1);var d=c.equals(s.token0)?s.token1:s.token0;o.push(d)}this.pairs=t,this.path=o,this.midPrice=pt.fromRoute(this),this.input=e,this.output=null!=n?n:o[o.length-1]}return N(t,[{key:"chainId",get:function(){return this.pairs[0].chainId}}]),t}(),mt=new at(E),vt=function(t){function e(){return t.apply(this,arguments)||this}P(e,t);var n=e.prototype;return n.toSignificant=function(t,e,n){return void 0===t&&(t=5),this.multiply(mt).toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=2),this.multiply(mt).toFixed(t,e,n)},e}(at);function yt(t,e){return Z(t.inputAmount.currency,e.inputAmount.currency)||u(!1),Z(t.outputAmount.currency,e.outputAmount.currency)||u(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?0:t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}function wt(t,e){var n=yt(t,e);return 0!==n?n:t.priceImpact.lessThan(e.priceImpact)?-1:t.priceImpact.greaterThan(e.priceImpact)?1:t.route.path.length-e.route.path.length}function Tt(t,e){return t instanceof dt?t:t.currency===$?new dt(nt[e],t.raw):void u(!1)}function gt(t,e){return t instanceof z?t:t===$?nt[e]:void u(!1)}var kt=function(){function t(t,e,n){var r,o,i,a=new Array(t.path.length),s=new Array(t.pairs.length);if(n===exports.TradeType.EXACT_INPUT){Z(e.currency,t.input)||u(!1),a[0]=Tt(e,t.chainId);for(var c=0;c0;f--){var l=t.pairs[f-1].getInputAmount(a[f]),h=l[1];a[f-1]=l[0],s[f-1]=h}}this.route=t,this.tradeType=n,this.inputAmount=n===exports.TradeType.EXACT_INPUT?e:t.input===$?ct.ether(a[0].raw):a[0],this.outputAmount=n===exports.TradeType.EXACT_OUTPUT?e:t.output===$?ct.ether(a[a.length-1].raw):a[a.length-1],this.executionPrice=new pt(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=pt.fromRoute(new ht(s,t.input)),this.priceImpact=(r=this.outputAmount,i=(o=t.midPrice.raw.multiply(this.inputAmount.raw)).subtract(r.raw).divide(o),new vt(i.numerator,i.denominator))}t.exactIn=function(e,n){return new t(e,n,exports.TradeType.EXACT_INPUT)},t.exactOut=function(e,n){return new t(e,n,exports.TradeType.EXACT_OUTPUT)};var e=t.prototype;return e.minimumAmountOut=function(t){if(t.lessThan(T)&&u(!1),this.tradeType===exports.TradeType.EXACT_OUTPUT)return this.outputAmount;var e=new at(g).add(t).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof dt?new dt(this.outputAmount.token,e):ct.ether(e)},e.maximumAmountIn=function(t){if(t.lessThan(T)&&u(!1),this.tradeType===exports.TradeType.EXACT_INPUT)return this.inputAmount;var e=new at(g).add(t).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof dt?new dt(this.inputAmount.token,e):ct.ether(e)},t.bestTradeExactIn=function(e,n,r,o,i,a,s){var c=void 0===o?{}:o,d=c.maxNumResults,p=void 0===d?3:d,f=c.maxHops,l=void 0===f?3:f;void 0===i&&(i=[]),void 0===a&&(a=n),void 0===s&&(s=[]),e.length>0||u(!1),l>0||u(!1),a===n||i.length>0||u(!1);var h=n instanceof dt?n.token.chainId:r instanceof z?r.chainId:void 0;void 0===h&&u(!1);for(var m=Tt(n,h),v=gt(r,h),y=0;y1&&e.length>1){var k=e.slice(0,y).concat(e.slice(y+1,e.length));t.bestTradeExactIn(k,g,r,{maxNumResults:p,maxHops:l-1},[].concat(i,[w]),a,s)}}}return s},t.bestTradeExactOut=function(e,n,r,o,i,a,s){var c=void 0===o?{}:o,d=c.maxNumResults,p=void 0===d?3:d,f=c.maxHops,l=void 0===f?3:f;void 0===i&&(i=[]),void 0===a&&(a=r),void 0===s&&(s=[]),e.length>0||u(!1),l>0||u(!1),a===r||i.length>0||u(!1);var h=r instanceof dt?r.token.chainId:n instanceof z?n.chainId:void 0;void 0===h&&u(!1);for(var m=Tt(r,h),v=gt(n,h),y=0;y1&&e.length>1){var k=e.slice(0,y).concat(e.slice(y+1,e.length));t.bestTradeExactOut(k,n,g,{maxNumResults:p,maxHops:l-1},[w].concat(i),a,s)}}}return s},t}();function xt(t){return"0x"+t.raw.toString(16)}var At,It=function(){function t(){}return t.swapCallParameters=function(t,e){var n=t.inputAmount.currency===$,r=t.outputAmount.currency===$;n&&r&&u(!1),!("ttl"in e)||e.ttl>0||u(!1);var o,i,a,s=G(e.recipient),c=xt(t.maximumAmountIn(e.allowedSlippage)),d=xt(t.minimumAmountOut(e.allowedSlippage)),p=t.route.path.map((function(t){return t.address})),f="ttl"in e?"0x"+(Math.floor((new Date).getTime()/1e3)+e.ttl).toString(16):"0x"+e.deadline.toString(16),l=Boolean(e.feeOnTransfer);switch(t.tradeType){case exports.TradeType.EXACT_INPUT:n?(o=l?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",i=[d,p,s,f],a=c):r?(o=l?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",i=[c,d,p,s,f],a="0x0"):(o=l?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",i=[c,d,p,s,f],a="0x0");break;case exports.TradeType.EXACT_OUTPUT:l&&u(!1),n?(o="swapETHForExactTokens",i=[d,p,s,f],a=c):r?(o="swapTokensForExactETH",i=[d,c,p,s,f],a="0x0"):(o="swapTokensForExactTokens",i=[d,c,p,s,f],a="0x0")}return{methodName:o,args:i,value:a}},t}(),Et=[{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],Ot=((At={})[exports.ChainId.MAINNET]={"0x8B8208f94Ef1AA6891463b43D30C351c9466b0f2":18},At),bt=function(){function t(){}return t.fetchTokenData=function(t,e,n,r,o){try{var i,u,a=function(n){return new z(t,e,n,r,o)};void 0===n&&(n=h.getDefaultProvider(l.getNetwork(t)));var s="number"==typeof(null===(i=Ot)||void 0===i||null===(u=i[t])||void 0===u?void 0:u[e]);return Promise.resolve(s?a(Ot[t][e]):Promise.resolve(new f.Contract(e,Et,n).decimals().then((function(n){var r,o,i;return Ot=R({},Ot,((i={})[t]=R({},null===(r=Ot)||void 0===r?void 0:r[t],((o={})[e]=n,o)),i)),n}))).then(a))}catch(t){return Promise.reject(t)}},t.fetchPairData=function(t,e,n){try{void 0===n&&(n=h.getDefaultProvider(l.getNetwork(t.chainId))),t.chainId!==e.chainId&&u(!1);var r=lt.getAddress(t,e);return Promise.resolve(new f.Contract(r,m.abi,n).getReserves()).then((function(n){var r=n[0],o=n[1],i=t.sortsBefore(e)?[r,o]:[o,r];return new lt(new dt(t,i[0]),new dt(e,i[1]))}))}catch(t){return Promise.reject(t)}},t}();exports.JSBI=i,exports.Currency=Q,exports.CurrencyAmount=ct,exports.ETHER=$,exports.FACTORY_ADDRESS="0x548C67Cbd80e8018b9792caeA0314569505F06B9",exports.Fetcher=bt,exports.Fraction=at,exports.INIT_CODE_HASH=y,exports.InsufficientInputAmountError=L,exports.InsufficientReservesError=W,exports.MINIMUM_LIQUIDITY=w,exports.Pair=lt,exports.Percent=vt,exports.Price=pt,exports.Route=ht,exports.Router=It,exports.Token=z,exports.TokenAmount=dt,exports.Trade=kt,exports.WETH=nt,exports.currencyEquals=Z,exports.inputOutputComparator=yt,exports.tradeComparator=wt; +//# sourceMappingURL=sdk.cjs.production.min.js.map diff --git a/dist/sdk.cjs.production.min.js.map b/dist/sdk.cjs.production.min.js.map new file mode 100644 index 0000000..f55f7d1 --- /dev/null +++ b/dist/sdk.cjs.production.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sdk.cjs.production.min.js","sources":["../src/constants.ts","../src/errors.ts","../src/utils.ts","../src/entities/currency.ts","../src/entities/token.ts","../src/entities/fractions/fraction.ts","../src/entities/fractions/currencyAmount.ts","../src/entities/fractions/tokenAmount.ts","../src/entities/fractions/price.ts","../src/entities/pair.ts","../src/entities/route.ts","../src/entities/fractions/percent.ts","../src/entities/trade.ts","../src/router.ts","../src/fetcher.ts"],"sourcesContent":["import JSBI from 'jsbi'\n\n// exports for external consumption\nexport type BigintIsh = JSBI | bigint | string\n\nexport enum ChainId {\n ENGRAM = 131,\n MAINNET = 1,\n ROPSTEN = 3,\n RINKEBY = 4,\n GÖRLI = 5,\n KOVAN = 42,\n TECO = 188355\n}\n\nexport enum TradeType {\n EXACT_INPUT,\n EXACT_OUTPUT\n}\n\nexport enum Rounding {\n ROUND_DOWN,\n ROUND_HALF_UP,\n ROUND_UP\n}\n\nexport const FACTORY_ADDRESS = '0x548C67Cbd80e8018b9792caeA0314569505F06B9' // need change\n\nexport const INIT_CODE_HASH = '0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4'\n\nexport const MINIMUM_LIQUIDITY = JSBI.BigInt(1000)\n\n// exports for internal consumption\nexport const ZERO = JSBI.BigInt(0)\nexport const ONE = JSBI.BigInt(1)\nexport const TWO = JSBI.BigInt(2)\nexport const THREE = JSBI.BigInt(3)\nexport const FIVE = JSBI.BigInt(5)\nexport const TEN = JSBI.BigInt(10)\nexport const _100 = JSBI.BigInt(100)\nexport const _997 = JSBI.BigInt(997)\nexport const _1000 = JSBI.BigInt(1000)\n\nexport enum SolidityType {\n uint8 = 'uint8',\n uint256 = 'uint256'\n}\n\nexport const SOLIDITY_TYPE_MAXIMA = {\n [SolidityType.uint8]: JSBI.BigInt('0xff'),\n [SolidityType.uint256]: JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')\n}\n","// see https://stackoverflow.com/a/41102306\nconst CAN_SET_PROTOTYPE = 'setPrototypeOf' in Object\n\n/**\n * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be\n * obtained by sending any amount of input.\n */\nexport class InsufficientReservesError extends Error {\n public readonly isInsufficientReservesError: true = true\n\n public constructor() {\n super()\n this.name = this.constructor.name\n if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\n/**\n * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less\n * than the price of a single unit of output after fees.\n */\nexport class InsufficientInputAmountError extends Error {\n public readonly isInsufficientInputAmountError: true = true\n\n public constructor() {\n super()\n this.name = this.constructor.name\n if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n","import invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport JSBI from 'jsbi'\nimport { getAddress } from '@ethersproject/address'\n\nimport { BigintIsh, ZERO, ONE, TWO, THREE, SolidityType, SOLIDITY_TYPE_MAXIMA } from './constants'\n\nexport function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void {\n invariant(JSBI.greaterThanOrEqual(value, ZERO), `${value} is not a ${solidityType}.`)\n invariant(JSBI.lessThanOrEqual(value, SOLIDITY_TYPE_MAXIMA[solidityType]), `${value} is not a ${solidityType}.`)\n}\n\n// warns if addresses are not checksummed\nexport function validateAndParseAddress(address: string): string {\n try {\n const checksummedAddress = getAddress(address)\n warning(address === checksummedAddress, `${address} is not checksummed.`)\n return checksummedAddress\n } catch (error) {\n invariant(false, `${address} is not a valid address.`)\n }\n}\n\nexport function parseBigintIsh(bigintIsh: BigintIsh): JSBI {\n return bigintIsh instanceof JSBI\n ? bigintIsh\n : typeof bigintIsh === 'bigint'\n ? JSBI.BigInt(bigintIsh.toString())\n : JSBI.BigInt(bigintIsh)\n}\n\n// mock the on-chain sqrt function\nexport function sqrt(y: JSBI): JSBI {\n validateSolidityTypeInstance(y, SolidityType.uint256)\n let z: JSBI = ZERO\n let x: JSBI\n if (JSBI.greaterThan(y, THREE)) {\n z = y\n x = JSBI.add(JSBI.divide(y, TWO), ONE)\n while (JSBI.lessThan(x, z)) {\n z = x\n x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO)\n }\n } else if (JSBI.notEqual(y, ZERO)) {\n z = ONE\n }\n return z\n}\n\n// given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to\n// `maxSize` by removing the last item\nexport function sortedInsert(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null {\n invariant(maxSize > 0, 'MAX_SIZE_ZERO')\n // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize\n invariant(items.length <= maxSize, 'ITEMS_SIZE')\n\n // short circuit first item add\n if (items.length === 0) {\n items.push(add)\n return null\n } else {\n const isFull = items.length === maxSize\n // short circuit if full and the additional item does not come before the last item\n if (isFull && comparator(items[items.length - 1], add) <= 0) {\n return add\n }\n\n let lo = 0,\n hi = items.length\n\n while (lo < hi) {\n const mid = (lo + hi) >>> 1\n if (comparator(items[mid], add) <= 0) {\n lo = mid + 1\n } else {\n hi = mid\n }\n }\n items.splice(lo, 0, add)\n return isFull ? items.pop()! : null\n }\n}\n","import JSBI from 'jsbi'\n\nimport { SolidityType } from '../constants'\nimport { validateSolidityTypeInstance } from '../utils'\n\n/**\n * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens.\n *\n * The only instance of the base class `Currency` is Ether.\n */\nexport class Currency {\n public readonly decimals: number\n public readonly symbol?: string\n public readonly name?: string\n\n /**\n * The only instance of the base class `Currency`.\n */\n public static readonly ETHER: Currency = new Currency(18, 'ETH', 'Ether')\n\n /**\n * Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`.\n * @param decimals decimals of the currency\n * @param symbol symbol of the currency\n * @param name of the currency\n */\n protected constructor(decimals: number, symbol?: string, name?: string) {\n validateSolidityTypeInstance(JSBI.BigInt(decimals), SolidityType.uint8)\n\n this.decimals = decimals\n this.symbol = symbol\n this.name = name\n }\n}\n\nconst ETHER = Currency.ETHER\nexport { ETHER }\n","import invariant from 'tiny-invariant'\nimport { ChainId } from '../constants'\nimport { validateAndParseAddress } from '../utils'\nimport { Currency } from './currency'\n\n/**\n * Represents an ERC20 token with a unique address and some metadata.\n */\nexport class Token extends Currency {\n public readonly chainId: ChainId\n public readonly address: string\n\n public constructor(chainId: ChainId, address: string, decimals: number, symbol?: string, name?: string) {\n super(decimals, symbol, name)\n this.chainId = chainId\n this.address = validateAndParseAddress(address)\n }\n\n /**\n * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.\n * @param other other token to compare\n */\n public equals(other: Token): boolean {\n // short circuit on reference equality\n if (this === other) {\n return true\n }\n return this.chainId === other.chainId && this.address === other.address\n }\n\n /**\n * Returns true if the address of this token sorts before the address of the other token\n * @param other other token to compare\n * @throws if the tokens have the same address\n * @throws if the tokens are on different chains\n */\n public sortsBefore(other: Token): boolean {\n invariant(this.chainId === other.chainId, 'CHAIN_IDS')\n invariant(this.address !== other.address, 'ADDRESSES')\n return this.address.toLowerCase() < other.address.toLowerCase()\n }\n}\n\n/**\n * Compares two currencies for equality\n */\nexport function currencyEquals(currencyA: Currency, currencyB: Currency): boolean {\n if (currencyA instanceof Token && currencyB instanceof Token) {\n return currencyA.equals(currencyB)\n } else if (currencyA instanceof Token) {\n return false\n } else if (currencyB instanceof Token) {\n return false\n } else {\n return currencyA === currencyB\n }\n}\n\nexport const WETH = {\n [ChainId.MAINNET]: new Token(\n ChainId.MAINNET,\n '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.ROPSTEN]: new Token(\n ChainId.ROPSTEN,\n '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.RINKEBY]: new Token(\n ChainId.RINKEBY,\n '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.KOVAN]: new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.TECO]: new Token(ChainId.TECO, '0x65A98D861a1E8e9E1404EF5d19C24a70e022B935', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.ENGRAM]: new Token(ChainId.ENGRAM, '0x7E3e3C50927F78ce0D2a1699d15d342c976A49B0', 18, 'WETH', 'Wrapped Ether') // need change\n}\n","import invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport _Decimal from 'decimal.js-light'\nimport _Big, { RoundingMode } from 'big.js'\nimport toFormat from 'toformat'\n\nimport { BigintIsh, Rounding } from '../../constants'\nimport { ONE } from '../../constants'\nimport { parseBigintIsh } from '../../utils'\n\nconst Decimal = toFormat(_Decimal)\nconst Big = toFormat(_Big)\n\nconst toSignificantRounding = {\n [Rounding.ROUND_DOWN]: Decimal.ROUND_DOWN,\n [Rounding.ROUND_HALF_UP]: Decimal.ROUND_HALF_UP,\n [Rounding.ROUND_UP]: Decimal.ROUND_UP\n}\n\nconst toFixedRounding = {\n [Rounding.ROUND_DOWN]: RoundingMode.RoundDown,\n [Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp,\n [Rounding.ROUND_UP]: RoundingMode.RoundUp\n}\n\nexport class Fraction {\n public readonly numerator: JSBI\n public readonly denominator: JSBI\n\n public constructor(numerator: BigintIsh, denominator: BigintIsh = ONE) {\n this.numerator = parseBigintIsh(numerator)\n this.denominator = parseBigintIsh(denominator)\n }\n\n // performs floor division\n public get quotient(): JSBI {\n return JSBI.divide(this.numerator, this.denominator)\n }\n\n // remainder after floor division\n public get remainder(): Fraction {\n return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator)\n }\n\n public invert(): Fraction {\n return new Fraction(this.denominator, this.numerator)\n }\n\n public add(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n if (JSBI.equal(this.denominator, otherParsed.denominator)) {\n return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator)\n }\n return new Fraction(\n JSBI.add(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n ),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public subtract(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n if (JSBI.equal(this.denominator, otherParsed.denominator)) {\n return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator)\n }\n return new Fraction(\n JSBI.subtract(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n ),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public lessThan(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.lessThan(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public equalTo(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.equal(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public greaterThan(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.greaterThan(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public multiply(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return new Fraction(\n JSBI.multiply(this.numerator, otherParsed.numerator),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public divide(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return new Fraction(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(this.denominator, otherParsed.numerator)\n )\n }\n\n public toSignificant(\n significantDigits: number,\n format: object = { groupSeparator: '' },\n rounding: Rounding = Rounding.ROUND_HALF_UP\n ): string {\n invariant(Number.isInteger(significantDigits), `${significantDigits} is not an integer.`)\n invariant(significantDigits > 0, `${significantDigits} is not positive.`)\n\n Decimal.set({ precision: significantDigits + 1, rounding: toSignificantRounding[rounding] })\n const quotient = new Decimal(this.numerator.toString())\n .div(this.denominator.toString())\n .toSignificantDigits(significantDigits)\n return quotient.toFormat(quotient.decimalPlaces(), format)\n }\n\n public toFixed(\n decimalPlaces: number,\n format: object = { groupSeparator: '' },\n rounding: Rounding = Rounding.ROUND_HALF_UP\n ): string {\n invariant(Number.isInteger(decimalPlaces), `${decimalPlaces} is not an integer.`)\n invariant(decimalPlaces >= 0, `${decimalPlaces} is negative.`)\n\n Big.DP = decimalPlaces\n Big.RM = toFixedRounding[rounding]\n return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format)\n }\n}\n","import { currencyEquals } from '../token'\nimport { Currency, ETHER } from '../currency'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport _Big from 'big.js'\nimport toFormat from 'toformat'\n\nimport { BigintIsh, Rounding, TEN, SolidityType } from '../../constants'\nimport { parseBigintIsh, validateSolidityTypeInstance } from '../../utils'\nimport { Fraction } from './fraction'\n\nconst Big = toFormat(_Big)\n\nexport class CurrencyAmount extends Fraction {\n public readonly currency: Currency\n\n /**\n * Helper that calls the constructor with the ETHER currency\n * @param amount ether amount in wei\n */\n public static ether(amount: BigintIsh): CurrencyAmount {\n return new CurrencyAmount(ETHER, amount)\n }\n\n // amount _must_ be raw, i.e. in the native representation\n protected constructor(currency: Currency, amount: BigintIsh) {\n const parsedAmount = parseBigintIsh(amount)\n validateSolidityTypeInstance(parsedAmount, SolidityType.uint256)\n\n super(parsedAmount, JSBI.exponentiate(TEN, JSBI.BigInt(currency.decimals)))\n this.currency = currency\n }\n\n public get raw(): JSBI {\n return this.numerator\n }\n\n public add(other: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(this.currency, other.currency), 'TOKEN')\n return new CurrencyAmount(this.currency, JSBI.add(this.raw, other.raw))\n }\n\n public subtract(other: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(this.currency, other.currency), 'TOKEN')\n return new CurrencyAmount(this.currency, JSBI.subtract(this.raw, other.raw))\n }\n\n public toSignificant(\n significantDigits: number = 6,\n format?: object,\n rounding: Rounding = Rounding.ROUND_DOWN\n ): string {\n return super.toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(\n decimalPlaces: number = this.currency.decimals,\n format?: object,\n rounding: Rounding = Rounding.ROUND_DOWN\n ): string {\n invariant(decimalPlaces <= this.currency.decimals, 'DECIMALS')\n return super.toFixed(decimalPlaces, format, rounding)\n }\n\n public toExact(format: object = { groupSeparator: '' }): string {\n Big.DP = this.currency.decimals\n return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(format)\n }\n}\n","import { CurrencyAmount } from './currencyAmount'\nimport { Token } from '../token'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\n\nimport { BigintIsh } from '../../constants'\n\nexport class TokenAmount extends CurrencyAmount {\n public readonly token: Token\n\n // amount _must_ be raw, i.e. in the native representation\n public constructor(token: Token, amount: BigintIsh) {\n super(token, amount)\n this.token = token\n }\n\n public add(other: TokenAmount): TokenAmount {\n invariant(this.token.equals(other.token), 'TOKEN')\n return new TokenAmount(this.token, JSBI.add(this.raw, other.raw))\n }\n\n public subtract(other: TokenAmount): TokenAmount {\n invariant(this.token.equals(other.token), 'TOKEN')\n return new TokenAmount(this.token, JSBI.subtract(this.raw, other.raw))\n }\n}\n","import { Token } from '../token'\nimport { TokenAmount } from './tokenAmount'\nimport { currencyEquals } from '../token'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\n\nimport { BigintIsh, Rounding, TEN } from '../../constants'\nimport { Currency } from '../currency'\nimport { Route } from '../route'\nimport { Fraction } from './fraction'\nimport { CurrencyAmount } from './currencyAmount'\n\nexport class Price extends Fraction {\n public readonly baseCurrency: Currency // input i.e. denominator\n public readonly quoteCurrency: Currency // output i.e. numerator\n public readonly scalar: Fraction // used to adjust the raw fraction w/r/t the decimals of the {base,quote}Token\n\n public static fromRoute(route: Route): Price {\n const prices: Price[] = []\n for (const [i, pair] of route.pairs.entries()) {\n prices.push(\n route.path[i].equals(pair.token0)\n ? new Price(pair.reserve0.currency, pair.reserve1.currency, pair.reserve0.raw, pair.reserve1.raw)\n : new Price(pair.reserve1.currency, pair.reserve0.currency, pair.reserve1.raw, pair.reserve0.raw)\n )\n }\n return prices.slice(1).reduce((accumulator, currentValue) => accumulator.multiply(currentValue), prices[0])\n }\n\n // denominator and numerator _must_ be raw, i.e. in the native representation\n public constructor(baseCurrency: Currency, quoteCurrency: Currency, denominator: BigintIsh, numerator: BigintIsh) {\n super(numerator, denominator)\n\n this.baseCurrency = baseCurrency\n this.quoteCurrency = quoteCurrency\n this.scalar = new Fraction(\n JSBI.exponentiate(TEN, JSBI.BigInt(baseCurrency.decimals)),\n JSBI.exponentiate(TEN, JSBI.BigInt(quoteCurrency.decimals))\n )\n }\n\n public get raw(): Fraction {\n return new Fraction(this.numerator, this.denominator)\n }\n\n public get adjusted(): Fraction {\n return super.multiply(this.scalar)\n }\n\n public invert(): Price {\n return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator)\n }\n\n public multiply(other: Price): Price {\n invariant(currencyEquals(this.quoteCurrency, other.baseCurrency), 'TOKEN')\n const fraction = super.multiply(other)\n return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator)\n }\n\n // performs floor division on overflow\n public quote(currencyAmount: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(currencyAmount.currency, this.baseCurrency), 'TOKEN')\n if (this.quoteCurrency instanceof Token) {\n return new TokenAmount(this.quoteCurrency, super.multiply(currencyAmount.raw).quotient)\n }\n return CurrencyAmount.ether(super.multiply(currencyAmount.raw).quotient)\n }\n\n public toSignificant(significantDigits: number = 6, format?: object, rounding?: Rounding): string {\n return this.adjusted.toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(decimalPlaces: number = 4, format?: object, rounding?: Rounding): string {\n return this.adjusted.toFixed(decimalPlaces, format, rounding)\n }\n}\n","import { Price } from './fractions/price'\nimport { TokenAmount } from './fractions/tokenAmount'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport { pack, keccak256 } from '@ethersproject/solidity'\nimport { getCreate2Address } from '@ethersproject/address'\n\nimport {\n BigintIsh,\n FACTORY_ADDRESS,\n INIT_CODE_HASH,\n MINIMUM_LIQUIDITY,\n ZERO,\n ONE,\n FIVE,\n _997,\n _1000,\n ChainId\n} from '../constants'\nimport { sqrt, parseBigintIsh } from '../utils'\nimport { InsufficientReservesError, InsufficientInputAmountError } from '../errors'\nimport { Token } from './token'\n\nlet PAIR_ADDRESS_CACHE: { [token0Address: string]: { [token1Address: string]: string } } = {}\n\nexport class Pair {\n public readonly liquidityToken: Token\n private readonly tokenAmounts: [TokenAmount, TokenAmount]\n\n public static getAddress(tokenA: Token, tokenB: Token): string {\n const tokens = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA] // does safety checks\n\n if (PAIR_ADDRESS_CACHE?.[tokens[0].address]?.[tokens[1].address] === undefined) {\n PAIR_ADDRESS_CACHE = {\n ...PAIR_ADDRESS_CACHE,\n [tokens[0].address]: {\n ...PAIR_ADDRESS_CACHE?.[tokens[0].address],\n [tokens[1].address]: getCreate2Address(\n FACTORY_ADDRESS,\n keccak256(['bytes'], [pack(['address', 'address'], [tokens[0].address, tokens[1].address])]),\n INIT_CODE_HASH\n )\n }\n }\n }\n\n return PAIR_ADDRESS_CACHE[tokens[0].address][tokens[1].address]\n }\n\n public constructor(tokenAmountA: TokenAmount, tokenAmountB: TokenAmount) {\n const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks\n ? [tokenAmountA, tokenAmountB]\n : [tokenAmountB, tokenAmountA]\n this.liquidityToken = new Token(\n tokenAmounts[0].token.chainId,\n Pair.getAddress(tokenAmounts[0].token, tokenAmounts[1].token),\n 18,\n 'UNI-V2',\n 'Uniswap V2'\n )\n this.tokenAmounts = tokenAmounts as [TokenAmount, TokenAmount]\n }\n\n /**\n * Returns true if the token is either token0 or token1\n * @param token to check\n */\n public involvesToken(token: Token): boolean {\n return token.equals(this.token0) || token.equals(this.token1)\n }\n\n /**\n * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0\n */\n public get token0Price(): Price {\n return new Price(this.token0, this.token1, this.tokenAmounts[0].raw, this.tokenAmounts[1].raw)\n }\n\n /**\n * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1\n */\n public get token1Price(): Price {\n return new Price(this.token1, this.token0, this.tokenAmounts[1].raw, this.tokenAmounts[0].raw)\n }\n\n /**\n * Return the price of the given token in terms of the other token in the pair.\n * @param token token to return price of\n */\n public priceOf(token: Token): Price {\n invariant(this.involvesToken(token), 'TOKEN')\n return token.equals(this.token0) ? this.token0Price : this.token1Price\n }\n\n /**\n * Returns the chain ID of the tokens in the pair.\n */\n public get chainId(): ChainId {\n return this.token0.chainId\n }\n\n public get token0(): Token {\n return this.tokenAmounts[0].token\n }\n\n public get token1(): Token {\n return this.tokenAmounts[1].token\n }\n\n public get reserve0(): TokenAmount {\n return this.tokenAmounts[0]\n }\n\n public get reserve1(): TokenAmount {\n return this.tokenAmounts[1]\n }\n\n public reserveOf(token: Token): TokenAmount {\n invariant(this.involvesToken(token), 'TOKEN')\n return token.equals(this.token0) ? this.reserve0 : this.reserve1\n }\n\n public getOutputAmount(inputAmount: TokenAmount): [TokenAmount, Pair] {\n invariant(this.involvesToken(inputAmount.token), 'TOKEN')\n if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO)) {\n throw new InsufficientReservesError()\n }\n const inputReserve = this.reserveOf(inputAmount.token)\n const outputReserve = this.reserveOf(inputAmount.token.equals(this.token0) ? this.token1 : this.token0)\n const inputAmountWithFee = JSBI.multiply(inputAmount.raw, _997)\n const numerator = JSBI.multiply(inputAmountWithFee, outputReserve.raw)\n const denominator = JSBI.add(JSBI.multiply(inputReserve.raw, _1000), inputAmountWithFee)\n const outputAmount = new TokenAmount(\n inputAmount.token.equals(this.token0) ? this.token1 : this.token0,\n JSBI.divide(numerator, denominator)\n )\n if (JSBI.equal(outputAmount.raw, ZERO)) {\n throw new InsufficientInputAmountError()\n }\n return [outputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]\n }\n\n public getInputAmount(outputAmount: TokenAmount): [TokenAmount, Pair] {\n invariant(this.involvesToken(outputAmount.token), 'TOKEN')\n if (\n JSBI.equal(this.reserve0.raw, ZERO) ||\n JSBI.equal(this.reserve1.raw, ZERO) ||\n JSBI.greaterThanOrEqual(outputAmount.raw, this.reserveOf(outputAmount.token).raw)\n ) {\n throw new InsufficientReservesError()\n }\n\n const outputReserve = this.reserveOf(outputAmount.token)\n const inputReserve = this.reserveOf(outputAmount.token.equals(this.token0) ? this.token1 : this.token0)\n const numerator = JSBI.multiply(JSBI.multiply(inputReserve.raw, outputAmount.raw), _1000)\n const denominator = JSBI.multiply(JSBI.subtract(outputReserve.raw, outputAmount.raw), _997)\n const inputAmount = new TokenAmount(\n outputAmount.token.equals(this.token0) ? this.token1 : this.token0,\n JSBI.add(JSBI.divide(numerator, denominator), ONE)\n )\n return [inputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]\n }\n\n public getLiquidityMinted(\n totalSupply: TokenAmount,\n tokenAmountA: TokenAmount,\n tokenAmountB: TokenAmount\n ): TokenAmount {\n invariant(totalSupply.token.equals(this.liquidityToken), 'LIQUIDITY')\n const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks\n ? [tokenAmountA, tokenAmountB]\n : [tokenAmountB, tokenAmountA]\n invariant(tokenAmounts[0].token.equals(this.token0) && tokenAmounts[1].token.equals(this.token1), 'TOKEN')\n\n let liquidity: JSBI\n if (JSBI.equal(totalSupply.raw, ZERO)) {\n liquidity = JSBI.subtract(sqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY)\n } else {\n const amount0 = JSBI.divide(JSBI.multiply(tokenAmounts[0].raw, totalSupply.raw), this.reserve0.raw)\n const amount1 = JSBI.divide(JSBI.multiply(tokenAmounts[1].raw, totalSupply.raw), this.reserve1.raw)\n liquidity = JSBI.lessThanOrEqual(amount0, amount1) ? amount0 : amount1\n }\n if (!JSBI.greaterThan(liquidity, ZERO)) {\n throw new InsufficientInputAmountError()\n }\n return new TokenAmount(this.liquidityToken, liquidity)\n }\n\n public getLiquidityValue(\n token: Token,\n totalSupply: TokenAmount,\n liquidity: TokenAmount,\n feeOn: boolean = false,\n kLast?: BigintIsh\n ): TokenAmount {\n invariant(this.involvesToken(token), 'TOKEN')\n invariant(totalSupply.token.equals(this.liquidityToken), 'TOTAL_SUPPLY')\n invariant(liquidity.token.equals(this.liquidityToken), 'LIQUIDITY')\n invariant(JSBI.lessThanOrEqual(liquidity.raw, totalSupply.raw), 'LIQUIDITY')\n\n let totalSupplyAdjusted: TokenAmount\n if (!feeOn) {\n totalSupplyAdjusted = totalSupply\n } else {\n invariant(!!kLast, 'K_LAST')\n const kLastParsed = parseBigintIsh(kLast)\n if (!JSBI.equal(kLastParsed, ZERO)) {\n const rootK = sqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw))\n const rootKLast = sqrt(kLastParsed)\n if (JSBI.greaterThan(rootK, rootKLast)) {\n const numerator = JSBI.multiply(totalSupply.raw, JSBI.subtract(rootK, rootKLast))\n const denominator = JSBI.add(JSBI.multiply(rootK, FIVE), rootKLast)\n const feeLiquidity = JSBI.divide(numerator, denominator)\n totalSupplyAdjusted = totalSupply.add(new TokenAmount(this.liquidityToken, feeLiquidity))\n } else {\n totalSupplyAdjusted = totalSupply\n }\n } else {\n totalSupplyAdjusted = totalSupply\n }\n }\n\n return new TokenAmount(\n token,\n JSBI.divide(JSBI.multiply(liquidity.raw, this.reserveOf(token).raw), totalSupplyAdjusted.raw)\n )\n }\n}\n","import { ChainId } from '../constants'\nimport invariant from 'tiny-invariant'\n\nimport { Currency, ETHER } from './currency'\nimport { Token, WETH } from './token'\nimport { Pair } from './pair'\nimport { Price } from './fractions/price'\n\nexport class Route {\n public readonly pairs: Pair[]\n public readonly path: Token[]\n public readonly input: Currency\n public readonly output: Currency\n public readonly midPrice: Price\n\n public constructor(pairs: Pair[], input: Currency, output?: Currency) {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(\n pairs.every(pair => pair.chainId === pairs[0].chainId),\n 'CHAIN_IDS'\n )\n invariant(\n (input instanceof Token && pairs[0].involvesToken(input)) ||\n (input === ETHER && pairs[0].involvesToken(WETH[pairs[0].chainId])),\n 'INPUT'\n )\n invariant(\n typeof output === 'undefined' ||\n (output instanceof Token && pairs[pairs.length - 1].involvesToken(output)) ||\n (output === ETHER && pairs[pairs.length - 1].involvesToken(WETH[pairs[0].chainId])),\n 'OUTPUT'\n )\n\n const path: Token[] = [input instanceof Token ? input : WETH[pairs[0].chainId]]\n for (const [i, pair] of pairs.entries()) {\n const currentInput = path[i]\n invariant(currentInput.equals(pair.token0) || currentInput.equals(pair.token1), 'PATH')\n const output = currentInput.equals(pair.token0) ? pair.token1 : pair.token0\n path.push(output)\n }\n\n this.pairs = pairs\n this.path = path\n this.midPrice = Price.fromRoute(this)\n this.input = input\n this.output = output ?? path[path.length - 1]\n }\n\n public get chainId(): ChainId {\n return this.pairs[0].chainId\n }\n}\n","import { Rounding, _100 } from '../../constants'\nimport { Fraction } from './fraction'\n\nconst _100_PERCENT = new Fraction(_100)\n\nexport class Percent extends Fraction {\n public toSignificant(significantDigits: number = 5, format?: object, rounding?: Rounding): string {\n return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(decimalPlaces: number = 2, format?: object, rounding?: Rounding): string {\n return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding)\n }\n}\n","import invariant from 'tiny-invariant'\n\nimport { ChainId, ONE, TradeType, ZERO } from '../constants'\nimport { sortedInsert } from '../utils'\nimport { Currency, ETHER } from './currency'\nimport { CurrencyAmount } from './fractions/currencyAmount'\nimport { Fraction } from './fractions/fraction'\nimport { Percent } from './fractions/percent'\nimport { Price } from './fractions/price'\nimport { TokenAmount } from './fractions/tokenAmount'\nimport { Pair } from './pair'\nimport { Route } from './route'\nimport { currencyEquals, Token, WETH } from './token'\n\n/**\n * Returns the percent difference between the mid price and the execution price, i.e. price impact.\n * @param midPrice mid price before the trade\n * @param inputAmount the input amount of the trade\n * @param outputAmount the output amount of the trade\n */\nfunction computePriceImpact(midPrice: Price, inputAmount: CurrencyAmount, outputAmount: CurrencyAmount): Percent {\n const exactQuote = midPrice.raw.multiply(inputAmount.raw)\n // calculate slippage := (exactQuote - outputAmount) / exactQuote\n const slippage = exactQuote.subtract(outputAmount.raw).divide(exactQuote)\n return new Percent(slippage.numerator, slippage.denominator)\n}\n\n// minimal interface so the input output comparator may be shared across types\ninterface InputOutput {\n readonly inputAmount: CurrencyAmount\n readonly outputAmount: CurrencyAmount\n}\n\n// comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts\n// in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first\nexport function inputOutputComparator(a: InputOutput, b: InputOutput): number {\n // must have same input and output token for comparison\n invariant(currencyEquals(a.inputAmount.currency, b.inputAmount.currency), 'INPUT_CURRENCY')\n invariant(currencyEquals(a.outputAmount.currency, b.outputAmount.currency), 'OUTPUT_CURRENCY')\n if (a.outputAmount.equalTo(b.outputAmount)) {\n if (a.inputAmount.equalTo(b.inputAmount)) {\n return 0\n }\n // trade A requires less input than trade B, so A should come first\n if (a.inputAmount.lessThan(b.inputAmount)) {\n return -1\n } else {\n return 1\n }\n } else {\n // tradeA has less output than trade B, so should come second\n if (a.outputAmount.lessThan(b.outputAmount)) {\n return 1\n } else {\n return -1\n }\n }\n}\n\n// extension of the input output comparator that also considers other dimensions of the trade in ranking them\nexport function tradeComparator(a: Trade, b: Trade) {\n const ioComp = inputOutputComparator(a, b)\n if (ioComp !== 0) {\n return ioComp\n }\n\n // consider lowest slippage next, since these are less likely to fail\n if (a.priceImpact.lessThan(b.priceImpact)) {\n return -1\n } else if (a.priceImpact.greaterThan(b.priceImpact)) {\n return 1\n }\n\n // finally consider the number of hops since each hop costs gas\n return a.route.path.length - b.route.path.length\n}\n\nexport interface BestTradeOptions {\n // how many results to return\n maxNumResults?: number\n // the maximum number of hops a trade should contain\n maxHops?: number\n}\n\n/**\n * Given a currency amount and a chain ID, returns the equivalent representation as the token amount.\n * In other words, if the currency is ETHER, returns the WETH token amount for the given chain. Otherwise, returns\n * the input currency amount.\n */\nfunction wrappedAmount(currencyAmount: CurrencyAmount, chainId: ChainId): TokenAmount {\n if (currencyAmount instanceof TokenAmount) return currencyAmount\n if (currencyAmount.currency === ETHER) return new TokenAmount(WETH[chainId], currencyAmount.raw)\n invariant(false, 'CURRENCY')\n}\n\nfunction wrappedCurrency(currency: Currency, chainId: ChainId): Token {\n if (currency instanceof Token) return currency\n if (currency === ETHER) return WETH[chainId]\n invariant(false, 'CURRENCY')\n}\n\n/**\n * Represents a trade executed against a list of pairs.\n * Does not account for slippage, i.e. trades that front run this trade and move the price.\n */\nexport class Trade {\n /**\n * The route of the trade, i.e. which pairs the trade goes through.\n */\n public readonly route: Route\n /**\n * The type of the trade, either exact in or exact out.\n */\n public readonly tradeType: TradeType\n /**\n * The input amount for the trade assuming no slippage.\n */\n public readonly inputAmount: CurrencyAmount\n /**\n * The output amount for the trade assuming no slippage.\n */\n public readonly outputAmount: CurrencyAmount\n /**\n * The price expressed in terms of output amount/input amount.\n */\n public readonly executionPrice: Price\n /**\n * The mid price after the trade executes assuming no slippage.\n */\n public readonly nextMidPrice: Price\n /**\n * The percent difference between the mid price before the trade and the trade execution price.\n */\n public readonly priceImpact: Percent\n\n /**\n * Constructs an exact in trade with the given amount in and route\n * @param route route of the exact in trade\n * @param amountIn the amount being passed in\n */\n public static exactIn(route: Route, amountIn: CurrencyAmount): Trade {\n return new Trade(route, amountIn, TradeType.EXACT_INPUT)\n }\n\n /**\n * Constructs an exact out trade with the given amount out and route\n * @param route route of the exact out trade\n * @param amountOut the amount returned by the trade\n */\n public static exactOut(route: Route, amountOut: CurrencyAmount): Trade {\n return new Trade(route, amountOut, TradeType.EXACT_OUTPUT)\n }\n\n public constructor(route: Route, amount: CurrencyAmount, tradeType: TradeType) {\n const amounts: TokenAmount[] = new Array(route.path.length)\n const nextPairs: Pair[] = new Array(route.pairs.length)\n if (tradeType === TradeType.EXACT_INPUT) {\n invariant(currencyEquals(amount.currency, route.input), 'INPUT')\n amounts[0] = wrappedAmount(amount, route.chainId)\n for (let i = 0; i < route.path.length - 1; i++) {\n const pair = route.pairs[i]\n const [outputAmount, nextPair] = pair.getOutputAmount(amounts[i])\n amounts[i + 1] = outputAmount\n nextPairs[i] = nextPair\n }\n } else {\n invariant(currencyEquals(amount.currency, route.output), 'OUTPUT')\n amounts[amounts.length - 1] = wrappedAmount(amount, route.chainId)\n for (let i = route.path.length - 1; i > 0; i--) {\n const pair = route.pairs[i - 1]\n const [inputAmount, nextPair] = pair.getInputAmount(amounts[i])\n amounts[i - 1] = inputAmount\n nextPairs[i - 1] = nextPair\n }\n }\n\n this.route = route\n this.tradeType = tradeType\n this.inputAmount =\n tradeType === TradeType.EXACT_INPUT\n ? amount\n : route.input === ETHER\n ? CurrencyAmount.ether(amounts[0].raw)\n : amounts[0]\n this.outputAmount =\n tradeType === TradeType.EXACT_OUTPUT\n ? amount\n : route.output === ETHER\n ? CurrencyAmount.ether(amounts[amounts.length - 1].raw)\n : amounts[amounts.length - 1]\n this.executionPrice = new Price(\n this.inputAmount.currency,\n this.outputAmount.currency,\n this.inputAmount.raw,\n this.outputAmount.raw\n )\n this.nextMidPrice = Price.fromRoute(new Route(nextPairs, route.input))\n this.priceImpact = computePriceImpact(route.midPrice, this.inputAmount, this.outputAmount)\n }\n\n /**\n * Get the minimum amount that must be received from this trade for the given slippage tolerance\n * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade\n */\n public minimumAmountOut(slippageTolerance: Percent): CurrencyAmount {\n invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE')\n if (this.tradeType === TradeType.EXACT_OUTPUT) {\n return this.outputAmount\n } else {\n const slippageAdjustedAmountOut = new Fraction(ONE)\n .add(slippageTolerance)\n .invert()\n .multiply(this.outputAmount.raw).quotient\n return this.outputAmount instanceof TokenAmount\n ? new TokenAmount(this.outputAmount.token, slippageAdjustedAmountOut)\n : CurrencyAmount.ether(slippageAdjustedAmountOut)\n }\n }\n\n /**\n * Get the maximum amount in that can be spent via this trade for the given slippage tolerance\n * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade\n */\n public maximumAmountIn(slippageTolerance: Percent): CurrencyAmount {\n invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE')\n if (this.tradeType === TradeType.EXACT_INPUT) {\n return this.inputAmount\n } else {\n const slippageAdjustedAmountIn = new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.raw).quotient\n return this.inputAmount instanceof TokenAmount\n ? new TokenAmount(this.inputAmount.token, slippageAdjustedAmountIn)\n : CurrencyAmount.ether(slippageAdjustedAmountIn)\n }\n }\n\n /**\n * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token\n * amount to an output token, making at most `maxHops` hops.\n * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting\n * the amount in among multiple routes.\n * @param pairs the pairs to consider in finding the best trade\n * @param currencyAmountIn exact amount of input currency to spend\n * @param currencyOut the desired currency out\n * @param maxNumResults maximum number of results to return\n * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair\n * @param currentPairs used in recursion; the current list of pairs\n * @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter\n * @param bestTrades used in recursion; the current list of best trades\n */\n public static bestTradeExactIn(\n pairs: Pair[],\n currencyAmountIn: CurrencyAmount,\n currencyOut: Currency,\n { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {},\n // used in recursion.\n currentPairs: Pair[] = [],\n originalAmountIn: CurrencyAmount = currencyAmountIn,\n bestTrades: Trade[] = []\n ): Trade[] {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(maxHops > 0, 'MAX_HOPS')\n invariant(originalAmountIn === currencyAmountIn || currentPairs.length > 0, 'INVALID_RECURSION')\n const chainId: ChainId | undefined =\n currencyAmountIn instanceof TokenAmount\n ? currencyAmountIn.token.chainId\n : currencyOut instanceof Token\n ? currencyOut.chainId\n : undefined\n invariant(chainId !== undefined, 'CHAIN_ID')\n\n const amountIn = wrappedAmount(currencyAmountIn, chainId)\n const tokenOut = wrappedCurrency(currencyOut, chainId)\n for (let i = 0; i < pairs.length; i++) {\n const pair = pairs[i]\n // pair irrelevant\n if (!pair.token0.equals(amountIn.token) && !pair.token1.equals(amountIn.token)) continue\n if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue\n\n let amountOut: TokenAmount\n try {\n ;[amountOut] = pair.getOutputAmount(amountIn)\n } catch (error) {\n // input too low\n if (error.isInsufficientInputAmountError) {\n continue\n }\n throw error\n }\n // we have arrived at the output token, so this is the final trade of one of the paths\n if (amountOut.token.equals(tokenOut)) {\n sortedInsert(\n bestTrades,\n new Trade(\n new Route([...currentPairs, pair], originalAmountIn.currency, currencyOut),\n originalAmountIn,\n TradeType.EXACT_INPUT\n ),\n maxNumResults,\n tradeComparator\n )\n } else if (maxHops > 1 && pairs.length > 1) {\n const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length))\n\n // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops\n Trade.bestTradeExactIn(\n pairsExcludingThisPair,\n amountOut,\n currencyOut,\n {\n maxNumResults,\n maxHops: maxHops - 1\n },\n [...currentPairs, pair],\n originalAmountIn,\n bestTrades\n )\n }\n }\n\n return bestTrades\n }\n\n /**\n * similar to the above method but instead targets a fixed output amount\n * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token\n * to an output token amount, making at most `maxHops` hops\n * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting\n * the amount in among multiple routes.\n * @param pairs the pairs to consider in finding the best trade\n * @param currencyIn the currency to spend\n * @param currencyAmountOut the exact amount of currency out\n * @param maxNumResults maximum number of results to return\n * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair\n * @param currentPairs used in recursion; the current list of pairs\n * @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter\n * @param bestTrades used in recursion; the current list of best trades\n */\n public static bestTradeExactOut(\n pairs: Pair[],\n currencyIn: Currency,\n currencyAmountOut: CurrencyAmount,\n { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {},\n // used in recursion.\n currentPairs: Pair[] = [],\n originalAmountOut: CurrencyAmount = currencyAmountOut,\n bestTrades: Trade[] = []\n ): Trade[] {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(maxHops > 0, 'MAX_HOPS')\n invariant(originalAmountOut === currencyAmountOut || currentPairs.length > 0, 'INVALID_RECURSION')\n const chainId: ChainId | undefined =\n currencyAmountOut instanceof TokenAmount\n ? currencyAmountOut.token.chainId\n : currencyIn instanceof Token\n ? currencyIn.chainId\n : undefined\n invariant(chainId !== undefined, 'CHAIN_ID')\n\n const amountOut = wrappedAmount(currencyAmountOut, chainId)\n const tokenIn = wrappedCurrency(currencyIn, chainId)\n for (let i = 0; i < pairs.length; i++) {\n const pair = pairs[i]\n // pair irrelevant\n if (!pair.token0.equals(amountOut.token) && !pair.token1.equals(amountOut.token)) continue\n if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue\n\n let amountIn: TokenAmount\n try {\n ;[amountIn] = pair.getInputAmount(amountOut)\n } catch (error) {\n // not enough liquidity in this pair\n if (error.isInsufficientReservesError) {\n continue\n }\n throw error\n }\n // we have arrived at the input token, so this is the first trade of one of the paths\n if (amountIn.token.equals(tokenIn)) {\n sortedInsert(\n bestTrades,\n new Trade(\n new Route([pair, ...currentPairs], currencyIn, originalAmountOut.currency),\n originalAmountOut,\n TradeType.EXACT_OUTPUT\n ),\n maxNumResults,\n tradeComparator\n )\n } else if (maxHops > 1 && pairs.length > 1) {\n const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length))\n\n // otherwise, consider all the other paths that arrive at this token as long as we have not exceeded maxHops\n Trade.bestTradeExactOut(\n pairsExcludingThisPair,\n currencyIn,\n amountIn,\n {\n maxNumResults,\n maxHops: maxHops - 1\n },\n [pair, ...currentPairs],\n originalAmountOut,\n bestTrades\n )\n }\n }\n\n return bestTrades\n }\n}\n","import { TradeType } from './constants'\nimport invariant from 'tiny-invariant'\nimport { validateAndParseAddress } from './utils'\nimport { CurrencyAmount, ETHER, Percent, Trade } from './entities'\n\n/**\n * Options for producing the arguments to send call to the router.\n */\nexport interface TradeOptions {\n /**\n * How much the execution price is allowed to move unfavorably from the trade execution price.\n */\n allowedSlippage: Percent\n /**\n * How long the swap is valid until it expires, in seconds.\n * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters\n * are generated.\n */\n ttl: number\n /**\n * The account that should receive the output of the swap.\n */\n recipient: string\n\n /**\n * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods\n */\n feeOnTransfer?: boolean\n}\n\nexport interface TradeOptionsDeadline extends Omit {\n /**\n * When the transaction expires.\n * This is an atlernate to specifying the ttl, for when you do not want to use local time.\n */\n deadline: number\n}\n\n/**\n * The parameters to use in the call to the Uniswap V2 Router to execute a trade.\n */\nexport interface SwapParameters {\n /**\n * The method to call on the Uniswap V2 Router.\n */\n methodName: string\n /**\n * The arguments to pass to the method, all hex encoded.\n */\n args: (string | string[])[]\n /**\n * The amount of wei to send in hex.\n */\n value: string\n}\n\nfunction toHex(currencyAmount: CurrencyAmount) {\n return `0x${currencyAmount.raw.toString(16)}`\n}\n\nconst ZERO_HEX = '0x0'\n\n/**\n * Represents the Uniswap V2 Router, and has static methods for helping execute trades.\n */\nexport abstract class Router {\n /**\n * Cannot be constructed.\n */\n private constructor() {}\n /**\n * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.\n * @param trade to produce call parameters for\n * @param options options for the call parameters\n */\n public static swapCallParameters(trade: Trade, options: TradeOptions | TradeOptionsDeadline): SwapParameters {\n const etherIn = trade.inputAmount.currency === ETHER\n const etherOut = trade.outputAmount.currency === ETHER\n // the router does not support both ether in and out\n invariant(!(etherIn && etherOut), 'ETHER_IN_OUT')\n invariant(!('ttl' in options) || options.ttl > 0, 'TTL')\n\n const to: string = validateAndParseAddress(options.recipient)\n const amountIn: string = toHex(trade.maximumAmountIn(options.allowedSlippage))\n const amountOut: string = toHex(trade.minimumAmountOut(options.allowedSlippage))\n const path: string[] = trade.route.path.map(token => token.address)\n const deadline =\n 'ttl' in options\n ? `0x${(Math.floor(new Date().getTime() / 1000) + options.ttl).toString(16)}`\n : `0x${options.deadline.toString(16)}`\n\n const useFeeOnTransfer = Boolean(options.feeOnTransfer)\n\n let methodName: string\n let args: (string | string[])[]\n let value: string\n switch (trade.tradeType) {\n case TradeType.EXACT_INPUT:\n if (etherIn) {\n methodName = useFeeOnTransfer ? 'swapExactETHForTokensSupportingFeeOnTransferTokens' : 'swapExactETHForTokens'\n // (uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountOut, path, to, deadline]\n value = amountIn\n } else if (etherOut) {\n methodName = useFeeOnTransfer ? 'swapExactTokensForETHSupportingFeeOnTransferTokens' : 'swapExactTokensForETH'\n // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountIn, amountOut, path, to, deadline]\n value = ZERO_HEX\n } else {\n methodName = useFeeOnTransfer\n ? 'swapExactTokensForTokensSupportingFeeOnTransferTokens'\n : 'swapExactTokensForTokens'\n // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountIn, amountOut, path, to, deadline]\n value = ZERO_HEX\n }\n break\n case TradeType.EXACT_OUTPUT:\n invariant(!useFeeOnTransfer, 'EXACT_OUT_FOT')\n if (etherIn) {\n methodName = 'swapETHForExactTokens'\n // (uint amountOut, address[] calldata path, address to, uint deadline)\n args = [amountOut, path, to, deadline]\n value = amountIn\n } else if (etherOut) {\n methodName = 'swapTokensForExactETH'\n // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n args = [amountOut, amountIn, path, to, deadline]\n value = ZERO_HEX\n } else {\n methodName = 'swapTokensForExactTokens'\n // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n args = [amountOut, amountIn, path, to, deadline]\n value = ZERO_HEX\n }\n break\n }\n return {\n methodName,\n args,\n value\n }\n }\n}\n","import { Contract } from '@ethersproject/contracts'\nimport { getNetwork } from '@ethersproject/networks'\nimport { getDefaultProvider } from '@ethersproject/providers'\nimport { TokenAmount } from './entities/fractions/tokenAmount'\nimport { Pair } from './entities/pair'\nimport IUniswapV2Pair from '@uniswap/v2-core/build/IUniswapV2Pair.json'\nimport invariant from 'tiny-invariant'\nimport ERC20 from './abis/ERC20.json'\nimport { ChainId } from './constants'\nimport { Token } from './entities/token'\n\nlet TOKEN_DECIMALS_CACHE: { [chainId: number]: { [address: string]: number } } = {\n [ChainId.MAINNET]: {\n '0x8B8208f94Ef1AA6891463b43D30C351c9466b0f2': 18 // WGRAM\n }\n}\n\n/**\n * Contains methods for constructing instances of pairs and tokens from on-chain data.\n */\nexport abstract class Fetcher {\n /**\n * Cannot be constructed.\n */\n private constructor() {}\n\n /**\n * Fetch information for a given token on the given chain, using the given ethers provider.\n * @param chainId chain of the token\n * @param address address of the token on the chain\n * @param provider provider used to fetch the token\n * @param symbol optional symbol of the token\n * @param name optional name of the token\n */\n public static async fetchTokenData(\n chainId: ChainId,\n address: string,\n provider = getDefaultProvider(getNetwork(chainId)),\n symbol?: string,\n name?: string\n ): Promise {\n const parsedDecimals =\n typeof TOKEN_DECIMALS_CACHE?.[chainId]?.[address] === 'number'\n ? TOKEN_DECIMALS_CACHE[chainId][address]\n : await new Contract(address, ERC20, provider).decimals().then((decimals: number): number => {\n TOKEN_DECIMALS_CACHE = {\n ...TOKEN_DECIMALS_CACHE,\n [chainId]: {\n ...TOKEN_DECIMALS_CACHE?.[chainId],\n [address]: decimals\n }\n }\n return decimals\n })\n return new Token(chainId, address, parsedDecimals, symbol, name)\n }\n\n /**\n * Fetches information about a pair and constructs a pair from the given two tokens.\n * @param tokenA first token\n * @param tokenB second token\n * @param provider the provider to use to fetch the data\n */\n public static async fetchPairData(\n tokenA: Token,\n tokenB: Token,\n provider = getDefaultProvider(getNetwork(tokenA.chainId))\n ): Promise {\n invariant(tokenA.chainId === tokenB.chainId, 'CHAIN_ID')\n const address = Pair.getAddress(tokenA, tokenB)\n const [reserves0, reserves1] = await new Contract(address, IUniswapV2Pair.abi, provider).getReserves()\n const balances = tokenA.sortsBefore(tokenB) ? [reserves0, reserves1] : [reserves1, reserves0]\n return new Pair(new TokenAmount(tokenA, balances[0]), new TokenAmount(tokenB, balances[1]))\n }\n}\n"],"names":["ChainId","TradeType","Rounding","SolidityType","INIT_CODE_HASH","MINIMUM_LIQUIDITY","JSBI","BigInt","ZERO","ONE","TWO","THREE","FIVE","TEN","_100","_997","_1000","SOLIDITY_TYPE_MAXIMA","uint8","uint256","CAN_SET_PROTOTYPE","Object","InsufficientReservesError","name","_this","constructor","setPrototypeOf","prototype","Error","InsufficientInputAmountError","_this2","validateSolidityTypeInstance","value","solidityType","greaterThanOrEqual","invariant","lessThanOrEqual","validateAndParseAddress","address","getAddress","error","parseBigintIsh","bigintIsh","toString","sqrt","y","x","z","greaterThan","add","divide","lessThan","notEqual","sortedInsert","items","maxSize","comparator","length","push","isFull","lo","hi","mid","splice","pop","Currency","decimals","symbol","ETHER","Token","chainId","equals","other","this","sortsBefore","toLowerCase","currencyEquals","currencyA","currencyB","WETH","MAINNET","ROPSTEN","RINKEBY","GÖRLI","KOVAN","TECO","ENGRAM","Decimal","toFormat","_Decimal","Big","_Big","toSignificantRounding","ROUND_DOWN","ROUND_HALF_UP","ROUND_UP","toFixedRounding","Fraction","numerator","denominator","invert","otherParsed","equal","multiply","subtract","equalTo","toSignificant","significantDigits","format","rounding","groupSeparator","Number","isInteger","set","precision","quotient","div","toSignificantDigits","decimalPlaces","toFixed","DP","RM","remainder","CurrencyAmount","currency","amount","parsedAmount","exponentiate","ether","raw","toExact","TokenAmount","token","Price","baseCurrency","quoteCurrency","scalar","fromRoute","route","prices","pairs","entries","pair","path","token0","reserve0","reserve1","slice","reduce","accumulator","currentValue","fraction","quote","currencyAmount","_Fraction","adjusted","PAIR_ADDRESS_CACHE","Pair","tokenAmountA","tokenAmountB","tokenAmounts","liquidityToken","tokenA","tokenB","tokens","undefined","_PAIR_ADDRESS_CACHE2","getCreate2Address","keccak256","pack","involvesToken","token1","priceOf","token0Price","token1Price","reserveOf","getOutputAmount","inputAmount","inputReserve","outputReserve","inputAmountWithFee","outputAmount","getInputAmount","getLiquidityMinted","totalSupply","liquidity","amount0","amount1","getLiquidityValue","feeOn","kLast","totalSupplyAdjusted","kLastParsed","rootK","rootKLast","feeLiquidity","Route","input","output","every","currentInput","midPrice","_100_PERCENT","Percent","inputOutputComparator","a","b","tradeComparator","ioComp","priceImpact","wrappedAmount","wrappedCurrency","Trade","tradeType","exactQuote","slippage","amounts","Array","nextPairs","EXACT_INPUT","i","nextPair","EXACT_OUTPUT","executionPrice","nextMidPrice","exactIn","amountIn","exactOut","amountOut","minimumAmountOut","slippageTolerance","slippageAdjustedAmountOut","maximumAmountIn","slippageAdjustedAmountIn","bestTradeExactIn","currencyAmountIn","currencyOut","currentPairs","originalAmountIn","bestTrades","maxNumResults","maxHops","tokenOut","isInsufficientInputAmountError","pairsExcludingThisPair","concat","bestTradeExactOut","currencyIn","currencyAmountOut","originalAmountOut","tokenIn","isInsufficientReservesError","toHex","Router","swapCallParameters","trade","options","etherIn","etherOut","ttl","methodName","args","to","recipient","allowedSlippage","map","deadline","Math","floor","Date","getTime","useFeeOnTransfer","Boolean","feeOnTransfer","TOKEN_DECIMALS_CACHE","Fetcher","fetchTokenData","provider","parsedDecimals","getDefaultProvider","getNetwork","_TOKEN_DECIMALS_CACHE2","_TOKEN_DECIMALS_CACHE3","Contract","ERC20","then","_TOKEN_DECIMALS_CACHE4","fetchPairData","IUniswapV2Pair","abi","getReserves","reserves0","reserves1","balances"],"mappings":"gJAKYA,EAUAC,EAKAC,0ZAfAF,EAAAA,kBAAAA,4CAEVA,yBACAA,yBACAA,yBACAA,wBACAA,sBACAA,yBAGUC,EAAAA,oBAAAA,sDAEVA,oCAGUC,EAAAA,mBAAAA,mDAEVA,qCACAA,+BAoBUC,EAfCC,EAAiB,qEAEjBC,EAAoBC,EAAKC,OAAO,KAGhCC,EAAOF,EAAKC,OAAO,GACnBE,EAAMH,EAAKC,OAAO,GAClBG,EAAMJ,EAAKC,OAAO,GAClBI,EAAQL,EAAKC,OAAO,GACpBK,EAAON,EAAKC,OAAO,GACnBM,EAAMP,EAAKC,OAAO,IAClBO,EAAOR,EAAKC,OAAO,KACnBQ,EAAOT,EAAKC,OAAO,KACnBS,EAAQV,EAAKC,OAAO,MAEjC,SAAYJ,GACVA,gBACAA,oBAFF,CAAYA,IAAAA,OAKL,IAAMc,UACVd,EAAae,OAAQZ,EAAKC,OAAO,UACjCJ,EAAagB,SAAUb,EAAKC,OAAO,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AA,EACAC,KAAAA,EACArO,MAAAA,+RCjIFkP,YACDlR,gBAAQgF,SAAU,8CAC6B,QAO5BmM,qCAcAC,wBAClB9M,EACAhC,EACA+O,EACAlN,EACA5C,0BAEM+P,UAaC,IAAIjN,EAAMC,EAAShC,EAASgP,EAAgBnN,EAAQ5C,aAjB3D8P,IAAAA,EAAWE,qBAAmBC,aAAWlN,WAKe,2BAA/C4M,2BAAAO,EAAuBnN,uBAAvBoN,EAAkCpP,+BACrC4O,GAAqB5M,GAAShC,oBACxB,IAAIqP,WAASrP,EAASsP,GAAOP,GAAUnN,WAAW2N,MAAK,SAAC3N,oBAC5DgN,QACKA,WACF5M,kBACI4M,uBAAAY,EAAuBxN,WACzBhC,GAAU4B,UAGRA,qDAWG6N,uBAClB7H,EACAC,EACAkH,gBAAAA,IAAAA,EAAWE,qBAAmBC,aAAWtH,EAAO5F,WAEtC4F,EAAO5F,UAAY6F,EAAO7F,SAApCnC,UACMG,EAAUuH,GAAKtH,WAAW2H,EAAQC,0BACH,IAAIwH,WAASrP,EAAS0P,EAAeC,IAAKZ,GAAUa,qCAAlFC,OAAWC,OACZC,EAAWnI,EAAOxF,YAAYyF,GAAU,CAACgI,EAAWC,GAAa,CAACA,EAAWD,UAC5E,IAAItI,GAAK,IAAI1B,GAAY+B,EAAQmI,EAAS,IAAK,IAAIlK,GAAYgC,EAAQkI,EAAS,qJd9C5D"} \ No newline at end of file diff --git a/dist/sdk.esm.js b/dist/sdk.esm.js new file mode 100644 index 0000000..5390d3c --- /dev/null +++ b/dist/sdk.esm.js @@ -0,0 +1,1576 @@ +import JSBI from 'jsbi'; +export { default as JSBI } from 'jsbi'; +import invariant from 'tiny-invariant'; +import warning from 'tiny-warning'; +import { getAddress, getCreate2Address } from '@ethersproject/address'; +import _Big from 'big.js'; +import toFormat from 'toformat'; +import _Decimal from 'decimal.js-light'; +import { keccak256, pack } from '@ethersproject/solidity'; +import { Contract } from '@ethersproject/contracts'; +import { getNetwork } from '@ethersproject/networks'; +import { getDefaultProvider } from '@ethersproject/providers'; +import IUniswapV2Pair from '@uniswap/v2-core/build/IUniswapV2Pair.json'; + +var _SOLIDITY_TYPE_MAXIMA; +var ChainId; + +(function (ChainId) { + ChainId[ChainId["ENGRAM"] = 131] = "ENGRAM"; + ChainId[ChainId["MAINNET"] = 1] = "MAINNET"; + ChainId[ChainId["ROPSTEN"] = 3] = "ROPSTEN"; + ChainId[ChainId["RINKEBY"] = 4] = "RINKEBY"; + ChainId[ChainId["G\xD6RLI"] = 5] = "G\xD6RLI"; + ChainId[ChainId["KOVAN"] = 42] = "KOVAN"; + ChainId[ChainId["TECO"] = 188355] = "TECO"; +})(ChainId || (ChainId = {})); + +var TradeType; + +(function (TradeType) { + TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT"; + TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT"; +})(TradeType || (TradeType = {})); + +var Rounding; + +(function (Rounding) { + Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN"; + Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP"; + Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP"; +})(Rounding || (Rounding = {})); + +var FACTORY_ADDRESS = '0x548C67Cbd80e8018b9792caeA0314569505F06B9'; // need change + +var INIT_CODE_HASH = '0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4'; +var MINIMUM_LIQUIDITY = /*#__PURE__*/JSBI.BigInt(1000); // exports for internal consumption + +var ZERO = /*#__PURE__*/JSBI.BigInt(0); +var ONE = /*#__PURE__*/JSBI.BigInt(1); +var TWO = /*#__PURE__*/JSBI.BigInt(2); +var THREE = /*#__PURE__*/JSBI.BigInt(3); +var FIVE = /*#__PURE__*/JSBI.BigInt(5); +var TEN = /*#__PURE__*/JSBI.BigInt(10); +var _100 = /*#__PURE__*/JSBI.BigInt(100); +var _997 = /*#__PURE__*/JSBI.BigInt(997); +var _1000 = /*#__PURE__*/JSBI.BigInt(1000); +var SolidityType; + +(function (SolidityType) { + SolidityType["uint8"] = "uint8"; + SolidityType["uint256"] = "uint256"; +})(SolidityType || (SolidityType = {})); + +var SOLIDITY_TYPE_MAXIMA = (_SOLIDITY_TYPE_MAXIMA = {}, _SOLIDITY_TYPE_MAXIMA[SolidityType.uint8] = /*#__PURE__*/JSBI.BigInt('0xff'), _SOLIDITY_TYPE_MAXIMA[SolidityType.uint256] = /*#__PURE__*/JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'), _SOLIDITY_TYPE_MAXIMA); + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +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); +} + +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} + +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); +} + +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } +} + +function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); +} + +function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; +} + +function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); +} + +function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} + +function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + it = o[Symbol.iterator](); + return it.next.bind(it); +} + +// see https://stackoverflow.com/a/41102306 +var CAN_SET_PROTOTYPE = ('setPrototypeOf' in Object); +/** + * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be + * obtained by sending any amount of input. + */ + +var InsufficientReservesError = /*#__PURE__*/function (_Error) { + _inheritsLoose(InsufficientReservesError, _Error); + + function InsufficientReservesError() { + var _this; + + _this = _Error.call(this) || this; + _this.isInsufficientReservesError = true; + _this.name = _this.constructor.name; + if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof InsufficientReservesError ? this.constructor : void 0).prototype); + return _this; + } + + return InsufficientReservesError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); +/** + * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less + * than the price of a single unit of output after fees. + */ + +var InsufficientInputAmountError = /*#__PURE__*/function (_Error2) { + _inheritsLoose(InsufficientInputAmountError, _Error2); + + function InsufficientInputAmountError() { + var _this2; + + _this2 = _Error2.call(this) || this; + _this2.isInsufficientInputAmountError = true; + _this2.name = _this2.constructor.name; + if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(_assertThisInitialized(_this2), (this instanceof InsufficientInputAmountError ? this.constructor : void 0).prototype); + return _this2; + } + + return InsufficientInputAmountError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +function validateSolidityTypeInstance(value, solidityType) { + !JSBI.greaterThanOrEqual(value, ZERO) ? process.env.NODE_ENV !== "production" ? invariant(false, value + " is not a " + solidityType + ".") : invariant(false) : void 0; + !JSBI.lessThanOrEqual(value, SOLIDITY_TYPE_MAXIMA[solidityType]) ? process.env.NODE_ENV !== "production" ? invariant(false, value + " is not a " + solidityType + ".") : invariant(false) : void 0; +} // warns if addresses are not checksummed + +function validateAndParseAddress(address) { + try { + var checksummedAddress = getAddress(address); + process.env.NODE_ENV !== "production" ? warning(address === checksummedAddress, address + " is not checksummed.") : void 0; + return checksummedAddress; + } catch (error) { + process.env.NODE_ENV !== "production" ? invariant(false, address + " is not a valid address.") : invariant(false) ; + } +} +function parseBigintIsh(bigintIsh) { + return bigintIsh instanceof JSBI ? bigintIsh : typeof bigintIsh === 'bigint' ? JSBI.BigInt(bigintIsh.toString()) : JSBI.BigInt(bigintIsh); +} // mock the on-chain sqrt function + +function sqrt(y) { + validateSolidityTypeInstance(y, SolidityType.uint256); + var z = ZERO; + var x; + + if (JSBI.greaterThan(y, THREE)) { + z = y; + x = JSBI.add(JSBI.divide(y, TWO), ONE); + + while (JSBI.lessThan(x, z)) { + z = x; + x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO); + } + } else if (JSBI.notEqual(y, ZERO)) { + z = ONE; + } + + return z; +} // given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to +// `maxSize` by removing the last item + +function sortedInsert(items, add, maxSize, comparator) { + !(maxSize > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MAX_SIZE_ZERO') : invariant(false) : void 0; // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize + + !(items.length <= maxSize) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ITEMS_SIZE') : invariant(false) : void 0; // short circuit first item add + + if (items.length === 0) { + items.push(add); + return null; + } else { + var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item + + if (isFull && comparator(items[items.length - 1], add) <= 0) { + return add; + } + + var lo = 0, + hi = items.length; + + while (lo < hi) { + var mid = lo + hi >>> 1; + + if (comparator(items[mid], add) <= 0) { + lo = mid + 1; + } else { + hi = mid; + } + } + + items.splice(lo, 0, add); + return isFull ? items.pop() : null; + } +} + +/** + * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens. + * + * The only instance of the base class `Currency` is Ether. + */ + +var Currency = +/** + * Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`. + * @param decimals decimals of the currency + * @param symbol symbol of the currency + * @param name of the currency + */ +function Currency(decimals, symbol, name) { + validateSolidityTypeInstance(JSBI.BigInt(decimals), SolidityType.uint8); + this.decimals = decimals; + this.symbol = symbol; + this.name = name; +}; +/** + * The only instance of the base class `Currency`. + */ + +Currency.ETHER = /*#__PURE__*/new Currency(18, 'ETH', 'Ether'); +var ETHER = Currency.ETHER; + +var _WETH; +/** + * Represents an ERC20 token with a unique address and some metadata. + */ + +var Token = /*#__PURE__*/function (_Currency) { + _inheritsLoose(Token, _Currency); + + function Token(chainId, address, decimals, symbol, name) { + var _this; + + _this = _Currency.call(this, decimals, symbol, name) || this; + _this.chainId = chainId; + _this.address = validateAndParseAddress(address); + return _this; + } + /** + * Returns true if the two tokens are equivalent, i.e. have the same chainId and address. + * @param other other token to compare + */ + + + var _proto = Token.prototype; + + _proto.equals = function equals(other) { + // short circuit on reference equality + if (this === other) { + return true; + } + + return this.chainId === other.chainId && this.address === other.address; + } + /** + * Returns true if the address of this token sorts before the address of the other token + * @param other other token to compare + * @throws if the tokens have the same address + * @throws if the tokens are on different chains + */ + ; + + _proto.sortsBefore = function sortsBefore(other) { + !(this.chainId === other.chainId) ? process.env.NODE_ENV !== "production" ? invariant(false, 'CHAIN_IDS') : invariant(false) : void 0; + !(this.address !== other.address) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ADDRESSES') : invariant(false) : void 0; + return this.address.toLowerCase() < other.address.toLowerCase(); + }; + + return Token; +}(Currency); +/** + * Compares two currencies for equality + */ + +function currencyEquals(currencyA, currencyB) { + if (currencyA instanceof Token && currencyB instanceof Token) { + return currencyA.equals(currencyB); + } else if (currencyA instanceof Token) { + return false; + } else if (currencyB instanceof Token) { + return false; + } else { + return currencyA === currencyB; + } +} +var WETH = (_WETH = {}, _WETH[ChainId.MAINNET] = /*#__PURE__*/new Token(ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.ROPSTEN] = /*#__PURE__*/new Token(ChainId.ROPSTEN, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.RINKEBY] = /*#__PURE__*/new Token(ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.GÖRLI] = /*#__PURE__*/new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.KOVAN] = /*#__PURE__*/new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.TECO] = /*#__PURE__*/new Token(ChainId.TECO, '0x65A98D861a1E8e9E1404EF5d19C24a70e022B935', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.ENGRAM] = /*#__PURE__*/new Token(ChainId.ENGRAM, '0x7E3e3C50927F78ce0D2a1699d15d342c976A49B0', 18, 'WETH', 'Wrapped Ether'), _WETH); + +var _toSignificantRoundin, _toFixedRounding; +var Decimal = /*#__PURE__*/toFormat(_Decimal); +var Big = /*#__PURE__*/toFormat(_Big); +var toSignificantRounding = (_toSignificantRoundin = {}, _toSignificantRoundin[Rounding.ROUND_DOWN] = Decimal.ROUND_DOWN, _toSignificantRoundin[Rounding.ROUND_HALF_UP] = Decimal.ROUND_HALF_UP, _toSignificantRoundin[Rounding.ROUND_UP] = Decimal.ROUND_UP, _toSignificantRoundin); +var toFixedRounding = (_toFixedRounding = {}, _toFixedRounding[Rounding.ROUND_DOWN] = 0, _toFixedRounding[Rounding.ROUND_HALF_UP] = 1, _toFixedRounding[Rounding.ROUND_UP] = 3, _toFixedRounding); +var Fraction = /*#__PURE__*/function () { + function Fraction(numerator, denominator) { + if (denominator === void 0) { + denominator = ONE; + } + + this.numerator = parseBigintIsh(numerator); + this.denominator = parseBigintIsh(denominator); + } // performs floor division + + + var _proto = Fraction.prototype; + + _proto.invert = function invert() { + return new Fraction(this.denominator, this.numerator); + }; + + _proto.add = function add(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + + if (JSBI.equal(this.denominator, otherParsed.denominator)) { + return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator); + } + + return new Fraction(JSBI.add(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator)); + }; + + _proto.subtract = function subtract(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + + if (JSBI.equal(this.denominator, otherParsed.denominator)) { + return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator); + } + + return new Fraction(JSBI.subtract(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator)); + }; + + _proto.lessThan = function lessThan(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return JSBI.lessThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)); + }; + + _proto.equalTo = function equalTo(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return JSBI.equal(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)); + }; + + _proto.greaterThan = function greaterThan(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return JSBI.greaterThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)); + }; + + _proto.multiply = function multiply(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return new Fraction(JSBI.multiply(this.numerator, otherParsed.numerator), JSBI.multiply(this.denominator, otherParsed.denominator)); + }; + + _proto.divide = function divide(other) { + var otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)); + return new Fraction(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(this.denominator, otherParsed.numerator)); + }; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (format === void 0) { + format = { + groupSeparator: '' + }; + } + + if (rounding === void 0) { + rounding = Rounding.ROUND_HALF_UP; + } + + !Number.isInteger(significantDigits) ? process.env.NODE_ENV !== "production" ? invariant(false, significantDigits + " is not an integer.") : invariant(false) : void 0; + !(significantDigits > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, significantDigits + " is not positive.") : invariant(false) : void 0; + Decimal.set({ + precision: significantDigits + 1, + rounding: toSignificantRounding[rounding] + }); + var quotient = new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits); + return quotient.toFormat(quotient.decimalPlaces(), format); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (format === void 0) { + format = { + groupSeparator: '' + }; + } + + if (rounding === void 0) { + rounding = Rounding.ROUND_HALF_UP; + } + + !Number.isInteger(decimalPlaces) ? process.env.NODE_ENV !== "production" ? invariant(false, decimalPlaces + " is not an integer.") : invariant(false) : void 0; + !(decimalPlaces >= 0) ? process.env.NODE_ENV !== "production" ? invariant(false, decimalPlaces + " is negative.") : invariant(false) : void 0; + Big.DP = decimalPlaces; + Big.RM = toFixedRounding[rounding]; + return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format); + }; + + _createClass(Fraction, [{ + key: "quotient", + get: function get() { + return JSBI.divide(this.numerator, this.denominator); + } // remainder after floor division + + }, { + key: "remainder", + get: function get() { + return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator); + } + }]); + + return Fraction; +}(); + +var Big$1 = /*#__PURE__*/toFormat(_Big); +var CurrencyAmount = /*#__PURE__*/function (_Fraction) { + _inheritsLoose(CurrencyAmount, _Fraction); + + // amount _must_ be raw, i.e. in the native representation + function CurrencyAmount(currency, amount) { + var _this; + + var parsedAmount = parseBigintIsh(amount); + validateSolidityTypeInstance(parsedAmount, SolidityType.uint256); + _this = _Fraction.call(this, parsedAmount, JSBI.exponentiate(TEN, JSBI.BigInt(currency.decimals))) || this; + _this.currency = currency; + return _this; + } + /** + * Helper that calls the constructor with the ETHER currency + * @param amount ether amount in wei + */ + + + CurrencyAmount.ether = function ether(amount) { + return new CurrencyAmount(ETHER, amount); + }; + + var _proto = CurrencyAmount.prototype; + + _proto.add = function add(other) { + !currencyEquals(this.currency, other.currency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + return new CurrencyAmount(this.currency, JSBI.add(this.raw, other.raw)); + }; + + _proto.subtract = function subtract(other) { + !currencyEquals(this.currency, other.currency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + return new CurrencyAmount(this.currency, JSBI.subtract(this.raw, other.raw)); + }; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 6; + } + + if (rounding === void 0) { + rounding = Rounding.ROUND_DOWN; + } + + return _Fraction.prototype.toSignificant.call(this, significantDigits, format, rounding); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = this.currency.decimals; + } + + if (rounding === void 0) { + rounding = Rounding.ROUND_DOWN; + } + + !(decimalPlaces <= this.currency.decimals) ? process.env.NODE_ENV !== "production" ? invariant(false, 'DECIMALS') : invariant(false) : void 0; + return _Fraction.prototype.toFixed.call(this, decimalPlaces, format, rounding); + }; + + _proto.toExact = function toExact(format) { + if (format === void 0) { + format = { + groupSeparator: '' + }; + } + + Big$1.DP = this.currency.decimals; + return new Big$1(this.numerator.toString()).div(this.denominator.toString()).toFormat(format); + }; + + _createClass(CurrencyAmount, [{ + key: "raw", + get: function get() { + return this.numerator; + } + }]); + + return CurrencyAmount; +}(Fraction); + +var TokenAmount = /*#__PURE__*/function (_CurrencyAmount) { + _inheritsLoose(TokenAmount, _CurrencyAmount); + + // amount _must_ be raw, i.e. in the native representation + function TokenAmount(token, amount) { + var _this; + + _this = _CurrencyAmount.call(this, token, amount) || this; + _this.token = token; + return _this; + } + + var _proto = TokenAmount.prototype; + + _proto.add = function add(other) { + !this.token.equals(other.token) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + return new TokenAmount(this.token, JSBI.add(this.raw, other.raw)); + }; + + _proto.subtract = function subtract(other) { + !this.token.equals(other.token) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + return new TokenAmount(this.token, JSBI.subtract(this.raw, other.raw)); + }; + + return TokenAmount; +}(CurrencyAmount); + +var Price = /*#__PURE__*/function (_Fraction) { + _inheritsLoose(Price, _Fraction); + + // denominator and numerator _must_ be raw, i.e. in the native representation + function Price(baseCurrency, quoteCurrency, denominator, numerator) { + var _this; + + _this = _Fraction.call(this, numerator, denominator) || this; + _this.baseCurrency = baseCurrency; + _this.quoteCurrency = quoteCurrency; + _this.scalar = new Fraction(JSBI.exponentiate(TEN, JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(TEN, JSBI.BigInt(quoteCurrency.decimals))); + return _this; + } + + Price.fromRoute = function fromRoute(route) { + var prices = []; + + for (var _iterator = _createForOfIteratorHelperLoose(route.pairs.entries()), _step; !(_step = _iterator()).done;) { + var _step$value = _step.value, + i = _step$value[0], + pair = _step$value[1]; + prices.push(route.path[i].equals(pair.token0) ? new Price(pair.reserve0.currency, pair.reserve1.currency, pair.reserve0.raw, pair.reserve1.raw) : new Price(pair.reserve1.currency, pair.reserve0.currency, pair.reserve1.raw, pair.reserve0.raw)); + } + + return prices.slice(1).reduce(function (accumulator, currentValue) { + return accumulator.multiply(currentValue); + }, prices[0]); + }; + + var _proto = Price.prototype; + + _proto.invert = function invert() { + return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator); + }; + + _proto.multiply = function multiply(other) { + !currencyEquals(this.quoteCurrency, other.baseCurrency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + + var fraction = _Fraction.prototype.multiply.call(this, other); + + return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator); + } // performs floor division on overflow + ; + + _proto.quote = function quote(currencyAmount) { + !currencyEquals(currencyAmount.currency, this.baseCurrency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + + if (this.quoteCurrency instanceof Token) { + return new TokenAmount(this.quoteCurrency, _Fraction.prototype.multiply.call(this, currencyAmount.raw).quotient); + } + + return CurrencyAmount.ether(_Fraction.prototype.multiply.call(this, currencyAmount.raw).quotient); + }; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 6; + } + + return this.adjusted.toSignificant(significantDigits, format, rounding); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = 4; + } + + return this.adjusted.toFixed(decimalPlaces, format, rounding); + }; + + _createClass(Price, [{ + key: "raw", + get: function get() { + return new Fraction(this.numerator, this.denominator); + } + }, { + key: "adjusted", + get: function get() { + return _Fraction.prototype.multiply.call(this, this.scalar); + } + }]); + + return Price; +}(Fraction); + +var PAIR_ADDRESS_CACHE = {}; +var Pair = /*#__PURE__*/function () { + function Pair(tokenAmountA, tokenAmountB) { + var tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks + ? [tokenAmountA, tokenAmountB] : [tokenAmountB, tokenAmountA]; + this.liquidityToken = new Token(tokenAmounts[0].token.chainId, Pair.getAddress(tokenAmounts[0].token, tokenAmounts[1].token), 18, 'UNI-V2', 'Uniswap V2'); + this.tokenAmounts = tokenAmounts; + } + + Pair.getAddress = function getAddress(tokenA, tokenB) { + var _PAIR_ADDRESS_CACHE, _PAIR_ADDRESS_CACHE$t; + + var tokens = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA]; // does safety checks + + if (((_PAIR_ADDRESS_CACHE = PAIR_ADDRESS_CACHE) === null || _PAIR_ADDRESS_CACHE === void 0 ? void 0 : (_PAIR_ADDRESS_CACHE$t = _PAIR_ADDRESS_CACHE[tokens[0].address]) === null || _PAIR_ADDRESS_CACHE$t === void 0 ? void 0 : _PAIR_ADDRESS_CACHE$t[tokens[1].address]) === undefined) { + var _PAIR_ADDRESS_CACHE2, _extends2, _extends3; + + PAIR_ADDRESS_CACHE = _extends({}, PAIR_ADDRESS_CACHE, (_extends3 = {}, _extends3[tokens[0].address] = _extends({}, (_PAIR_ADDRESS_CACHE2 = PAIR_ADDRESS_CACHE) === null || _PAIR_ADDRESS_CACHE2 === void 0 ? void 0 : _PAIR_ADDRESS_CACHE2[tokens[0].address], (_extends2 = {}, _extends2[tokens[1].address] = getCreate2Address(FACTORY_ADDRESS, keccak256(['bytes'], [pack(['address', 'address'], [tokens[0].address, tokens[1].address])]), INIT_CODE_HASH), _extends2)), _extends3)); + } + + return PAIR_ADDRESS_CACHE[tokens[0].address][tokens[1].address]; + } + /** + * Returns true if the token is either token0 or token1 + * @param token to check + */ + ; + + var _proto = Pair.prototype; + + _proto.involvesToken = function involvesToken(token) { + return token.equals(this.token0) || token.equals(this.token1); + } + /** + * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0 + */ + ; + + /** + * Return the price of the given token in terms of the other token in the pair. + * @param token token to return price of + */ + _proto.priceOf = function priceOf(token) { + !this.involvesToken(token) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + return token.equals(this.token0) ? this.token0Price : this.token1Price; + } + /** + * Returns the chain ID of the tokens in the pair. + */ + ; + + _proto.reserveOf = function reserveOf(token) { + !this.involvesToken(token) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + return token.equals(this.token0) ? this.reserve0 : this.reserve1; + }; + + _proto.getOutputAmount = function getOutputAmount(inputAmount) { + !this.involvesToken(inputAmount.token) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + + if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO)) { + throw new InsufficientReservesError(); + } + + var inputReserve = this.reserveOf(inputAmount.token); + var outputReserve = this.reserveOf(inputAmount.token.equals(this.token0) ? this.token1 : this.token0); + var inputAmountWithFee = JSBI.multiply(inputAmount.raw, _997); + var numerator = JSBI.multiply(inputAmountWithFee, outputReserve.raw); + var denominator = JSBI.add(JSBI.multiply(inputReserve.raw, _1000), inputAmountWithFee); + var outputAmount = new TokenAmount(inputAmount.token.equals(this.token0) ? this.token1 : this.token0, JSBI.divide(numerator, denominator)); + + if (JSBI.equal(outputAmount.raw, ZERO)) { + throw new InsufficientInputAmountError(); + } + + return [outputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]; + }; + + _proto.getInputAmount = function getInputAmount(outputAmount) { + !this.involvesToken(outputAmount.token) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + + if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO) || JSBI.greaterThanOrEqual(outputAmount.raw, this.reserveOf(outputAmount.token).raw)) { + throw new InsufficientReservesError(); + } + + var outputReserve = this.reserveOf(outputAmount.token); + var inputReserve = this.reserveOf(outputAmount.token.equals(this.token0) ? this.token1 : this.token0); + var numerator = JSBI.multiply(JSBI.multiply(inputReserve.raw, outputAmount.raw), _1000); + var denominator = JSBI.multiply(JSBI.subtract(outputReserve.raw, outputAmount.raw), _997); + var inputAmount = new TokenAmount(outputAmount.token.equals(this.token0) ? this.token1 : this.token0, JSBI.add(JSBI.divide(numerator, denominator), ONE)); + return [inputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]; + }; + + _proto.getLiquidityMinted = function getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB) { + !totalSupply.token.equals(this.liquidityToken) ? process.env.NODE_ENV !== "production" ? invariant(false, 'LIQUIDITY') : invariant(false) : void 0; + var tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks + ? [tokenAmountA, tokenAmountB] : [tokenAmountB, tokenAmountA]; + !(tokenAmounts[0].token.equals(this.token0) && tokenAmounts[1].token.equals(this.token1)) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + var liquidity; + + if (JSBI.equal(totalSupply.raw, ZERO)) { + liquidity = JSBI.subtract(sqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY); + } else { + var amount0 = JSBI.divide(JSBI.multiply(tokenAmounts[0].raw, totalSupply.raw), this.reserve0.raw); + var amount1 = JSBI.divide(JSBI.multiply(tokenAmounts[1].raw, totalSupply.raw), this.reserve1.raw); + liquidity = JSBI.lessThanOrEqual(amount0, amount1) ? amount0 : amount1; + } + + if (!JSBI.greaterThan(liquidity, ZERO)) { + throw new InsufficientInputAmountError(); + } + + return new TokenAmount(this.liquidityToken, liquidity); + }; + + _proto.getLiquidityValue = function getLiquidityValue(token, totalSupply, liquidity, feeOn, kLast) { + if (feeOn === void 0) { + feeOn = false; + } + + !this.involvesToken(token) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0; + !totalSupply.token.equals(this.liquidityToken) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOTAL_SUPPLY') : invariant(false) : void 0; + !liquidity.token.equals(this.liquidityToken) ? process.env.NODE_ENV !== "production" ? invariant(false, 'LIQUIDITY') : invariant(false) : void 0; + !JSBI.lessThanOrEqual(liquidity.raw, totalSupply.raw) ? process.env.NODE_ENV !== "production" ? invariant(false, 'LIQUIDITY') : invariant(false) : void 0; + var totalSupplyAdjusted; + + if (!feeOn) { + totalSupplyAdjusted = totalSupply; + } else { + !!!kLast ? process.env.NODE_ENV !== "production" ? invariant(false, 'K_LAST') : invariant(false) : void 0; + var kLastParsed = parseBigintIsh(kLast); + + if (!JSBI.equal(kLastParsed, ZERO)) { + var rootK = sqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw)); + var rootKLast = sqrt(kLastParsed); + + if (JSBI.greaterThan(rootK, rootKLast)) { + var numerator = JSBI.multiply(totalSupply.raw, JSBI.subtract(rootK, rootKLast)); + var denominator = JSBI.add(JSBI.multiply(rootK, FIVE), rootKLast); + var feeLiquidity = JSBI.divide(numerator, denominator); + totalSupplyAdjusted = totalSupply.add(new TokenAmount(this.liquidityToken, feeLiquidity)); + } else { + totalSupplyAdjusted = totalSupply; + } + } else { + totalSupplyAdjusted = totalSupply; + } + } + + return new TokenAmount(token, JSBI.divide(JSBI.multiply(liquidity.raw, this.reserveOf(token).raw), totalSupplyAdjusted.raw)); + }; + + _createClass(Pair, [{ + key: "token0Price", + get: function get() { + return new Price(this.token0, this.token1, this.tokenAmounts[0].raw, this.tokenAmounts[1].raw); + } + /** + * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1 + */ + + }, { + key: "token1Price", + get: function get() { + return new Price(this.token1, this.token0, this.tokenAmounts[1].raw, this.tokenAmounts[0].raw); + } + }, { + key: "chainId", + get: function get() { + return this.token0.chainId; + } + }, { + key: "token0", + get: function get() { + return this.tokenAmounts[0].token; + } + }, { + key: "token1", + get: function get() { + return this.tokenAmounts[1].token; + } + }, { + key: "reserve0", + get: function get() { + return this.tokenAmounts[0]; + } + }, { + key: "reserve1", + get: function get() { + return this.tokenAmounts[1]; + } + }]); + + return Pair; +}(); + +var Route = /*#__PURE__*/function () { + function Route(pairs, input, output) { + !(pairs.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'PAIRS') : invariant(false) : void 0; + !pairs.every(function (pair) { + return pair.chainId === pairs[0].chainId; + }) ? process.env.NODE_ENV !== "production" ? invariant(false, 'CHAIN_IDS') : invariant(false) : void 0; + !(input instanceof Token && pairs[0].involvesToken(input) || input === ETHER && pairs[0].involvesToken(WETH[pairs[0].chainId])) ? process.env.NODE_ENV !== "production" ? invariant(false, 'INPUT') : invariant(false) : void 0; + !(typeof output === 'undefined' || output instanceof Token && pairs[pairs.length - 1].involvesToken(output) || output === ETHER && pairs[pairs.length - 1].involvesToken(WETH[pairs[0].chainId])) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT') : invariant(false) : void 0; + var path = [input instanceof Token ? input : WETH[pairs[0].chainId]]; + + for (var _iterator = _createForOfIteratorHelperLoose(pairs.entries()), _step; !(_step = _iterator()).done;) { + var _step$value = _step.value, + i = _step$value[0], + pair = _step$value[1]; + var currentInput = path[i]; + !(currentInput.equals(pair.token0) || currentInput.equals(pair.token1)) ? process.env.NODE_ENV !== "production" ? invariant(false, 'PATH') : invariant(false) : void 0; + + var _output = currentInput.equals(pair.token0) ? pair.token1 : pair.token0; + + path.push(_output); + } + + this.pairs = pairs; + this.path = path; + this.midPrice = Price.fromRoute(this); + this.input = input; + this.output = output !== null && output !== void 0 ? output : path[path.length - 1]; + } + + _createClass(Route, [{ + key: "chainId", + get: function get() { + return this.pairs[0].chainId; + } + }]); + + return Route; +}(); + +var _100_PERCENT = /*#__PURE__*/new Fraction(_100); + +var Percent = /*#__PURE__*/function (_Fraction) { + _inheritsLoose(Percent, _Fraction); + + function Percent() { + return _Fraction.apply(this, arguments) || this; + } + + var _proto = Percent.prototype; + + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 5; + } + + return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding); + }; + + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = 2; + } + + return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding); + }; + + return Percent; +}(Fraction); + +/** + * Returns the percent difference between the mid price and the execution price, i.e. price impact. + * @param midPrice mid price before the trade + * @param inputAmount the input amount of the trade + * @param outputAmount the output amount of the trade + */ + +function computePriceImpact(midPrice, inputAmount, outputAmount) { + var exactQuote = midPrice.raw.multiply(inputAmount.raw); // calculate slippage := (exactQuote - outputAmount) / exactQuote + + var slippage = exactQuote.subtract(outputAmount.raw).divide(exactQuote); + return new Percent(slippage.numerator, slippage.denominator); +} // comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts +// in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first + + +function inputOutputComparator(a, b) { + // must have same input and output token for comparison + !currencyEquals(a.inputAmount.currency, b.inputAmount.currency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'INPUT_CURRENCY') : invariant(false) : void 0; + !currencyEquals(a.outputAmount.currency, b.outputAmount.currency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT_CURRENCY') : invariant(false) : void 0; + + if (a.outputAmount.equalTo(b.outputAmount)) { + if (a.inputAmount.equalTo(b.inputAmount)) { + return 0; + } // trade A requires less input than trade B, so A should come first + + + if (a.inputAmount.lessThan(b.inputAmount)) { + return -1; + } else { + return 1; + } + } else { + // tradeA has less output than trade B, so should come second + if (a.outputAmount.lessThan(b.outputAmount)) { + return 1; + } else { + return -1; + } + } +} // extension of the input output comparator that also considers other dimensions of the trade in ranking them + +function tradeComparator(a, b) { + var ioComp = inputOutputComparator(a, b); + + if (ioComp !== 0) { + return ioComp; + } // consider lowest slippage next, since these are less likely to fail + + + if (a.priceImpact.lessThan(b.priceImpact)) { + return -1; + } else if (a.priceImpact.greaterThan(b.priceImpact)) { + return 1; + } // finally consider the number of hops since each hop costs gas + + + return a.route.path.length - b.route.path.length; +} +/** + * Given a currency amount and a chain ID, returns the equivalent representation as the token amount. + * In other words, if the currency is ETHER, returns the WETH token amount for the given chain. Otherwise, returns + * the input currency amount. + */ + +function wrappedAmount(currencyAmount, chainId) { + if (currencyAmount instanceof TokenAmount) return currencyAmount; + if (currencyAmount.currency === ETHER) return new TokenAmount(WETH[chainId], currencyAmount.raw); + process.env.NODE_ENV !== "production" ? invariant(false, 'CURRENCY') : invariant(false) ; +} + +function wrappedCurrency(currency, chainId) { + if (currency instanceof Token) return currency; + if (currency === ETHER) return WETH[chainId]; + process.env.NODE_ENV !== "production" ? invariant(false, 'CURRENCY') : invariant(false) ; +} +/** + * Represents a trade executed against a list of pairs. + * Does not account for slippage, i.e. trades that front run this trade and move the price. + */ + + +var Trade = /*#__PURE__*/function () { + function Trade(route, amount, tradeType) { + var amounts = new Array(route.path.length); + var nextPairs = new Array(route.pairs.length); + + if (tradeType === TradeType.EXACT_INPUT) { + !currencyEquals(amount.currency, route.input) ? process.env.NODE_ENV !== "production" ? invariant(false, 'INPUT') : invariant(false) : void 0; + amounts[0] = wrappedAmount(amount, route.chainId); + + for (var i = 0; i < route.path.length - 1; i++) { + var pair = route.pairs[i]; + + var _pair$getOutputAmount = pair.getOutputAmount(amounts[i]), + outputAmount = _pair$getOutputAmount[0], + nextPair = _pair$getOutputAmount[1]; + + amounts[i + 1] = outputAmount; + nextPairs[i] = nextPair; + } + } else { + !currencyEquals(amount.currency, route.output) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT') : invariant(false) : void 0; + amounts[amounts.length - 1] = wrappedAmount(amount, route.chainId); + + for (var _i = route.path.length - 1; _i > 0; _i--) { + var _pair = route.pairs[_i - 1]; + + var _pair$getInputAmount = _pair.getInputAmount(amounts[_i]), + inputAmount = _pair$getInputAmount[0], + _nextPair = _pair$getInputAmount[1]; + + amounts[_i - 1] = inputAmount; + nextPairs[_i - 1] = _nextPair; + } + } + + this.route = route; + this.tradeType = tradeType; + this.inputAmount = tradeType === TradeType.EXACT_INPUT ? amount : route.input === ETHER ? CurrencyAmount.ether(amounts[0].raw) : amounts[0]; + this.outputAmount = tradeType === TradeType.EXACT_OUTPUT ? amount : route.output === ETHER ? CurrencyAmount.ether(amounts[amounts.length - 1].raw) : amounts[amounts.length - 1]; + this.executionPrice = new Price(this.inputAmount.currency, this.outputAmount.currency, this.inputAmount.raw, this.outputAmount.raw); + this.nextMidPrice = Price.fromRoute(new Route(nextPairs, route.input)); + this.priceImpact = computePriceImpact(route.midPrice, this.inputAmount, this.outputAmount); + } + /** + * Constructs an exact in trade with the given amount in and route + * @param route route of the exact in trade + * @param amountIn the amount being passed in + */ + + + Trade.exactIn = function exactIn(route, amountIn) { + return new Trade(route, amountIn, TradeType.EXACT_INPUT); + } + /** + * Constructs an exact out trade with the given amount out and route + * @param route route of the exact out trade + * @param amountOut the amount returned by the trade + */ + ; + + Trade.exactOut = function exactOut(route, amountOut) { + return new Trade(route, amountOut, TradeType.EXACT_OUTPUT); + } + /** + * Get the minimum amount that must be received from this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + ; + + var _proto = Trade.prototype; + + _proto.minimumAmountOut = function minimumAmountOut(slippageTolerance) { + !!slippageTolerance.lessThan(ZERO) ? process.env.NODE_ENV !== "production" ? invariant(false, 'SLIPPAGE_TOLERANCE') : invariant(false) : void 0; + + if (this.tradeType === TradeType.EXACT_OUTPUT) { + return this.outputAmount; + } else { + var slippageAdjustedAmountOut = new Fraction(ONE).add(slippageTolerance).invert().multiply(this.outputAmount.raw).quotient; + return this.outputAmount instanceof TokenAmount ? new TokenAmount(this.outputAmount.token, slippageAdjustedAmountOut) : CurrencyAmount.ether(slippageAdjustedAmountOut); + } + } + /** + * Get the maximum amount in that can be spent via this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + ; + + _proto.maximumAmountIn = function maximumAmountIn(slippageTolerance) { + !!slippageTolerance.lessThan(ZERO) ? process.env.NODE_ENV !== "production" ? invariant(false, 'SLIPPAGE_TOLERANCE') : invariant(false) : void 0; + + if (this.tradeType === TradeType.EXACT_INPUT) { + return this.inputAmount; + } else { + var slippageAdjustedAmountIn = new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.raw).quotient; + return this.inputAmount instanceof TokenAmount ? new TokenAmount(this.inputAmount.token, slippageAdjustedAmountIn) : CurrencyAmount.ether(slippageAdjustedAmountIn); + } + } + /** + * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token + * amount to an output token, making at most `maxHops` hops. + * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyAmountIn exact amount of input currency to spend + * @param currencyOut the desired currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter + * @param bestTrades used in recursion; the current list of best trades + */ + ; + + Trade.bestTradeExactIn = function bestTradeExactIn(pairs, currencyAmountIn, currencyOut, _temp, // used in recursion. + currentPairs, originalAmountIn, bestTrades) { + var _ref = _temp === void 0 ? {} : _temp, + _ref$maxNumResults = _ref.maxNumResults, + maxNumResults = _ref$maxNumResults === void 0 ? 3 : _ref$maxNumResults, + _ref$maxHops = _ref.maxHops, + maxHops = _ref$maxHops === void 0 ? 3 : _ref$maxHops; + + if (currentPairs === void 0) { + currentPairs = []; + } + + if (originalAmountIn === void 0) { + originalAmountIn = currencyAmountIn; + } + + if (bestTrades === void 0) { + bestTrades = []; + } + + !(pairs.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'PAIRS') : invariant(false) : void 0; + !(maxHops > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MAX_HOPS') : invariant(false) : void 0; + !(originalAmountIn === currencyAmountIn || currentPairs.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'INVALID_RECURSION') : invariant(false) : void 0; + var chainId = currencyAmountIn instanceof TokenAmount ? currencyAmountIn.token.chainId : currencyOut instanceof Token ? currencyOut.chainId : undefined; + !(chainId !== undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, 'CHAIN_ID') : invariant(false) : void 0; + var amountIn = wrappedAmount(currencyAmountIn, chainId); + var tokenOut = wrappedCurrency(currencyOut, chainId); + + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; // pair irrelevant + + if (!pair.token0.equals(amountIn.token) && !pair.token1.equals(amountIn.token)) continue; + if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue; + var amountOut = void 0; + + try { + ; + + var _pair$getOutputAmount2 = pair.getOutputAmount(amountIn); + + amountOut = _pair$getOutputAmount2[0]; + } catch (error) { + // input too low + if (error.isInsufficientInputAmountError) { + continue; + } + + throw error; + } // we have arrived at the output token, so this is the final trade of one of the paths + + + if (amountOut.token.equals(tokenOut)) { + sortedInsert(bestTrades, new Trade(new Route([].concat(currentPairs, [pair]), originalAmountIn.currency, currencyOut), originalAmountIn, TradeType.EXACT_INPUT), maxNumResults, tradeComparator); + } else if (maxHops > 1 && pairs.length > 1) { + var pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)); // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops + + Trade.bestTradeExactIn(pairsExcludingThisPair, amountOut, currencyOut, { + maxNumResults: maxNumResults, + maxHops: maxHops - 1 + }, [].concat(currentPairs, [pair]), originalAmountIn, bestTrades); + } + } + + return bestTrades; + } + /** + * similar to the above method but instead targets a fixed output amount + * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token + * to an output token amount, making at most `maxHops` hops + * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyIn the currency to spend + * @param currencyAmountOut the exact amount of currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter + * @param bestTrades used in recursion; the current list of best trades + */ + ; + + Trade.bestTradeExactOut = function bestTradeExactOut(pairs, currencyIn, currencyAmountOut, _temp2, // used in recursion. + currentPairs, originalAmountOut, bestTrades) { + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$maxNumResults = _ref2.maxNumResults, + maxNumResults = _ref2$maxNumResults === void 0 ? 3 : _ref2$maxNumResults, + _ref2$maxHops = _ref2.maxHops, + maxHops = _ref2$maxHops === void 0 ? 3 : _ref2$maxHops; + + if (currentPairs === void 0) { + currentPairs = []; + } + + if (originalAmountOut === void 0) { + originalAmountOut = currencyAmountOut; + } + + if (bestTrades === void 0) { + bestTrades = []; + } + + !(pairs.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'PAIRS') : invariant(false) : void 0; + !(maxHops > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MAX_HOPS') : invariant(false) : void 0; + !(originalAmountOut === currencyAmountOut || currentPairs.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'INVALID_RECURSION') : invariant(false) : void 0; + var chainId = currencyAmountOut instanceof TokenAmount ? currencyAmountOut.token.chainId : currencyIn instanceof Token ? currencyIn.chainId : undefined; + !(chainId !== undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, 'CHAIN_ID') : invariant(false) : void 0; + var amountOut = wrappedAmount(currencyAmountOut, chainId); + var tokenIn = wrappedCurrency(currencyIn, chainId); + + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; // pair irrelevant + + if (!pair.token0.equals(amountOut.token) && !pair.token1.equals(amountOut.token)) continue; + if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue; + var amountIn = void 0; + + try { + ; + + var _pair$getInputAmount2 = pair.getInputAmount(amountOut); + + amountIn = _pair$getInputAmount2[0]; + } catch (error) { + // not enough liquidity in this pair + if (error.isInsufficientReservesError) { + continue; + } + + throw error; + } // we have arrived at the input token, so this is the first trade of one of the paths + + + if (amountIn.token.equals(tokenIn)) { + sortedInsert(bestTrades, new Trade(new Route([pair].concat(currentPairs), currencyIn, originalAmountOut.currency), originalAmountOut, TradeType.EXACT_OUTPUT), maxNumResults, tradeComparator); + } else if (maxHops > 1 && pairs.length > 1) { + var pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)); // otherwise, consider all the other paths that arrive at this token as long as we have not exceeded maxHops + + Trade.bestTradeExactOut(pairsExcludingThisPair, currencyIn, amountIn, { + maxNumResults: maxNumResults, + maxHops: maxHops - 1 + }, [pair].concat(currentPairs), originalAmountOut, bestTrades); + } + } + + return bestTrades; + }; + + return Trade; +}(); + +function toHex(currencyAmount) { + return "0x" + currencyAmount.raw.toString(16); +} + +var ZERO_HEX = '0x0'; +/** + * Represents the Uniswap V2 Router, and has static methods for helping execute trades. + */ + +var Router = /*#__PURE__*/function () { + /** + * Cannot be constructed. + */ + function Router() {} + /** + * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade. + * @param trade to produce call parameters for + * @param options options for the call parameters + */ + + + Router.swapCallParameters = function swapCallParameters(trade, options) { + var etherIn = trade.inputAmount.currency === ETHER; + var etherOut = trade.outputAmount.currency === ETHER; // the router does not support both ether in and out + + !!(etherIn && etherOut) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ETHER_IN_OUT') : invariant(false) : void 0; + !(!('ttl' in options) || options.ttl > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TTL') : invariant(false) : void 0; + var to = validateAndParseAddress(options.recipient); + var amountIn = toHex(trade.maximumAmountIn(options.allowedSlippage)); + var amountOut = toHex(trade.minimumAmountOut(options.allowedSlippage)); + var path = trade.route.path.map(function (token) { + return token.address; + }); + var deadline = 'ttl' in options ? "0x" + (Math.floor(new Date().getTime() / 1000) + options.ttl).toString(16) : "0x" + options.deadline.toString(16); + var useFeeOnTransfer = Boolean(options.feeOnTransfer); + var methodName; + var args; + var value; + + switch (trade.tradeType) { + case TradeType.EXACT_INPUT: + if (etherIn) { + methodName = useFeeOnTransfer ? 'swapExactETHForTokensSupportingFeeOnTransferTokens' : 'swapExactETHForTokens'; // (uint amountOutMin, address[] calldata path, address to, uint deadline) + + args = [amountOut, path, to, deadline]; + value = amountIn; + } else if (etherOut) { + methodName = useFeeOnTransfer ? 'swapExactTokensForETHSupportingFeeOnTransferTokens' : 'swapExactTokensForETH'; // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) + + args = [amountIn, amountOut, path, to, deadline]; + value = ZERO_HEX; + } else { + methodName = useFeeOnTransfer ? 'swapExactTokensForTokensSupportingFeeOnTransferTokens' : 'swapExactTokensForTokens'; // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) + + args = [amountIn, amountOut, path, to, deadline]; + value = ZERO_HEX; + } + + break; + + case TradeType.EXACT_OUTPUT: + !!useFeeOnTransfer ? process.env.NODE_ENV !== "production" ? invariant(false, 'EXACT_OUT_FOT') : invariant(false) : void 0; + + if (etherIn) { + methodName = 'swapETHForExactTokens'; // (uint amountOut, address[] calldata path, address to, uint deadline) + + args = [amountOut, path, to, deadline]; + value = amountIn; + } else if (etherOut) { + methodName = 'swapTokensForExactETH'; // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) + + args = [amountOut, amountIn, path, to, deadline]; + value = ZERO_HEX; + } else { + methodName = 'swapTokensForExactTokens'; // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) + + args = [amountOut, amountIn, path, to, deadline]; + value = ZERO_HEX; + } + + break; + } + + return { + methodName: methodName, + args: args, + value: value + }; + }; + + return Router; +}(); + +var ERC20 = [ + { + 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" + } +]; + +var _TOKEN_DECIMALS_CACHE; +var TOKEN_DECIMALS_CACHE = (_TOKEN_DECIMALS_CACHE = {}, _TOKEN_DECIMALS_CACHE[ChainId.MAINNET] = { + '0x8B8208f94Ef1AA6891463b43D30C351c9466b0f2': 18 // WGRAM + +}, _TOKEN_DECIMALS_CACHE); +/** + * Contains methods for constructing instances of pairs and tokens from on-chain data. + */ + +var Fetcher = /*#__PURE__*/function () { + /** + * Cannot be constructed. + */ + function Fetcher() {} + /** + * Fetch information for a given token on the given chain, using the given ethers provider. + * @param chainId chain of the token + * @param address address of the token on the chain + * @param provider provider used to fetch the token + * @param symbol optional symbol of the token + * @param name optional name of the token + */ + + + Fetcher.fetchTokenData = function fetchTokenData(chainId, address, provider, symbol, name) { + try { + var _TOKEN_DECIMALS_CACHE2, _TOKEN_DECIMALS_CACHE3; + + var _temp3 = function _temp3(parsedDecimals) { + return new Token(chainId, address, parsedDecimals, symbol, name); + }; + + if (provider === undefined) provider = getDefaultProvider(getNetwork(chainId)); + + var _temp4 = typeof ((_TOKEN_DECIMALS_CACHE2 = TOKEN_DECIMALS_CACHE) === null || _TOKEN_DECIMALS_CACHE2 === void 0 ? void 0 : (_TOKEN_DECIMALS_CACHE3 = _TOKEN_DECIMALS_CACHE2[chainId]) === null || _TOKEN_DECIMALS_CACHE3 === void 0 ? void 0 : _TOKEN_DECIMALS_CACHE3[address]) === 'number'; + + return Promise.resolve(_temp4 ? _temp3(TOKEN_DECIMALS_CACHE[chainId][address]) : Promise.resolve(new Contract(address, ERC20, provider).decimals().then(function (decimals) { + var _TOKEN_DECIMALS_CACHE4, _extends2, _extends3; + + TOKEN_DECIMALS_CACHE = _extends({}, TOKEN_DECIMALS_CACHE, (_extends3 = {}, _extends3[chainId] = _extends({}, (_TOKEN_DECIMALS_CACHE4 = TOKEN_DECIMALS_CACHE) === null || _TOKEN_DECIMALS_CACHE4 === void 0 ? void 0 : _TOKEN_DECIMALS_CACHE4[chainId], (_extends2 = {}, _extends2[address] = decimals, _extends2)), _extends3)); + return decimals; + })).then(_temp3)); + } catch (e) { + return Promise.reject(e); + } + } + /** + * Fetches information about a pair and constructs a pair from the given two tokens. + * @param tokenA first token + * @param tokenB second token + * @param provider the provider to use to fetch the data + */ + ; + + Fetcher.fetchPairData = function fetchPairData(tokenA, tokenB, provider) { + try { + if (provider === undefined) provider = getDefaultProvider(getNetwork(tokenA.chainId)); + !(tokenA.chainId === tokenB.chainId) ? process.env.NODE_ENV !== "production" ? invariant(false, 'CHAIN_ID') : invariant(false) : void 0; + var address = Pair.getAddress(tokenA, tokenB); + return Promise.resolve(new Contract(address, IUniswapV2Pair.abi, provider).getReserves()).then(function (_ref) { + var reserves0 = _ref[0], + reserves1 = _ref[1]; + var balances = tokenA.sortsBefore(tokenB) ? [reserves0, reserves1] : [reserves1, reserves0]; + return new Pair(new TokenAmount(tokenA, balances[0]), new TokenAmount(tokenB, balances[1])); + }); + } catch (e) { + return Promise.reject(e); + } + }; + + return Fetcher; +}(); + +export { ChainId, Currency, CurrencyAmount, ETHER, FACTORY_ADDRESS, Fetcher, Fraction, INIT_CODE_HASH, InsufficientInputAmountError, InsufficientReservesError, MINIMUM_LIQUIDITY, Pair, Percent, Price, Rounding, Route, Router, Token, TokenAmount, Trade, TradeType, WETH, currencyEquals, inputOutputComparator, tradeComparator }; +//# sourceMappingURL=sdk.esm.js.map diff --git a/dist/sdk.esm.js.map b/dist/sdk.esm.js.map new file mode 100644 index 0000000..bd788a1 --- /dev/null +++ b/dist/sdk.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sdk.esm.js","sources":["../src/constants.ts","../src/errors.ts","../src/utils.ts","../src/entities/currency.ts","../src/entities/token.ts","../src/entities/fractions/fraction.ts","../src/entities/fractions/currencyAmount.ts","../src/entities/fractions/tokenAmount.ts","../src/entities/fractions/price.ts","../src/entities/pair.ts","../src/entities/route.ts","../src/entities/fractions/percent.ts","../src/entities/trade.ts","../src/router.ts","../src/fetcher.ts"],"sourcesContent":["import JSBI from 'jsbi'\n\n// exports for external consumption\nexport type BigintIsh = JSBI | bigint | string\n\nexport enum ChainId {\n ENGRAM = 131,\n MAINNET = 1,\n ROPSTEN = 3,\n RINKEBY = 4,\n GÖRLI = 5,\n KOVAN = 42,\n TECO = 188355\n}\n\nexport enum TradeType {\n EXACT_INPUT,\n EXACT_OUTPUT\n}\n\nexport enum Rounding {\n ROUND_DOWN,\n ROUND_HALF_UP,\n ROUND_UP\n}\n\nexport const FACTORY_ADDRESS = '0x548C67Cbd80e8018b9792caeA0314569505F06B9' // need change\n\nexport const INIT_CODE_HASH = '0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4'\n\nexport const MINIMUM_LIQUIDITY = JSBI.BigInt(1000)\n\n// exports for internal consumption\nexport const ZERO = JSBI.BigInt(0)\nexport const ONE = JSBI.BigInt(1)\nexport const TWO = JSBI.BigInt(2)\nexport const THREE = JSBI.BigInt(3)\nexport const FIVE = JSBI.BigInt(5)\nexport const TEN = JSBI.BigInt(10)\nexport const _100 = JSBI.BigInt(100)\nexport const _997 = JSBI.BigInt(997)\nexport const _1000 = JSBI.BigInt(1000)\n\nexport enum SolidityType {\n uint8 = 'uint8',\n uint256 = 'uint256'\n}\n\nexport const SOLIDITY_TYPE_MAXIMA = {\n [SolidityType.uint8]: JSBI.BigInt('0xff'),\n [SolidityType.uint256]: JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')\n}\n","// see https://stackoverflow.com/a/41102306\nconst CAN_SET_PROTOTYPE = 'setPrototypeOf' in Object\n\n/**\n * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be\n * obtained by sending any amount of input.\n */\nexport class InsufficientReservesError extends Error {\n public readonly isInsufficientReservesError: true = true\n\n public constructor() {\n super()\n this.name = this.constructor.name\n if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\n/**\n * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less\n * than the price of a single unit of output after fees.\n */\nexport class InsufficientInputAmountError extends Error {\n public readonly isInsufficientInputAmountError: true = true\n\n public constructor() {\n super()\n this.name = this.constructor.name\n if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n","import invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport JSBI from 'jsbi'\nimport { getAddress } from '@ethersproject/address'\n\nimport { BigintIsh, ZERO, ONE, TWO, THREE, SolidityType, SOLIDITY_TYPE_MAXIMA } from './constants'\n\nexport function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void {\n invariant(JSBI.greaterThanOrEqual(value, ZERO), `${value} is not a ${solidityType}.`)\n invariant(JSBI.lessThanOrEqual(value, SOLIDITY_TYPE_MAXIMA[solidityType]), `${value} is not a ${solidityType}.`)\n}\n\n// warns if addresses are not checksummed\nexport function validateAndParseAddress(address: string): string {\n try {\n const checksummedAddress = getAddress(address)\n warning(address === checksummedAddress, `${address} is not checksummed.`)\n return checksummedAddress\n } catch (error) {\n invariant(false, `${address} is not a valid address.`)\n }\n}\n\nexport function parseBigintIsh(bigintIsh: BigintIsh): JSBI {\n return bigintIsh instanceof JSBI\n ? bigintIsh\n : typeof bigintIsh === 'bigint'\n ? JSBI.BigInt(bigintIsh.toString())\n : JSBI.BigInt(bigintIsh)\n}\n\n// mock the on-chain sqrt function\nexport function sqrt(y: JSBI): JSBI {\n validateSolidityTypeInstance(y, SolidityType.uint256)\n let z: JSBI = ZERO\n let x: JSBI\n if (JSBI.greaterThan(y, THREE)) {\n z = y\n x = JSBI.add(JSBI.divide(y, TWO), ONE)\n while (JSBI.lessThan(x, z)) {\n z = x\n x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO)\n }\n } else if (JSBI.notEqual(y, ZERO)) {\n z = ONE\n }\n return z\n}\n\n// given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to\n// `maxSize` by removing the last item\nexport function sortedInsert(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null {\n invariant(maxSize > 0, 'MAX_SIZE_ZERO')\n // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize\n invariant(items.length <= maxSize, 'ITEMS_SIZE')\n\n // short circuit first item add\n if (items.length === 0) {\n items.push(add)\n return null\n } else {\n const isFull = items.length === maxSize\n // short circuit if full and the additional item does not come before the last item\n if (isFull && comparator(items[items.length - 1], add) <= 0) {\n return add\n }\n\n let lo = 0,\n hi = items.length\n\n while (lo < hi) {\n const mid = (lo + hi) >>> 1\n if (comparator(items[mid], add) <= 0) {\n lo = mid + 1\n } else {\n hi = mid\n }\n }\n items.splice(lo, 0, add)\n return isFull ? items.pop()! : null\n }\n}\n","import JSBI from 'jsbi'\n\nimport { SolidityType } from '../constants'\nimport { validateSolidityTypeInstance } from '../utils'\n\n/**\n * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens.\n *\n * The only instance of the base class `Currency` is Ether.\n */\nexport class Currency {\n public readonly decimals: number\n public readonly symbol?: string\n public readonly name?: string\n\n /**\n * The only instance of the base class `Currency`.\n */\n public static readonly ETHER: Currency = new Currency(18, 'ETH', 'Ether')\n\n /**\n * Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`.\n * @param decimals decimals of the currency\n * @param symbol symbol of the currency\n * @param name of the currency\n */\n protected constructor(decimals: number, symbol?: string, name?: string) {\n validateSolidityTypeInstance(JSBI.BigInt(decimals), SolidityType.uint8)\n\n this.decimals = decimals\n this.symbol = symbol\n this.name = name\n }\n}\n\nconst ETHER = Currency.ETHER\nexport { ETHER }\n","import invariant from 'tiny-invariant'\nimport { ChainId } from '../constants'\nimport { validateAndParseAddress } from '../utils'\nimport { Currency } from './currency'\n\n/**\n * Represents an ERC20 token with a unique address and some metadata.\n */\nexport class Token extends Currency {\n public readonly chainId: ChainId\n public readonly address: string\n\n public constructor(chainId: ChainId, address: string, decimals: number, symbol?: string, name?: string) {\n super(decimals, symbol, name)\n this.chainId = chainId\n this.address = validateAndParseAddress(address)\n }\n\n /**\n * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.\n * @param other other token to compare\n */\n public equals(other: Token): boolean {\n // short circuit on reference equality\n if (this === other) {\n return true\n }\n return this.chainId === other.chainId && this.address === other.address\n }\n\n /**\n * Returns true if the address of this token sorts before the address of the other token\n * @param other other token to compare\n * @throws if the tokens have the same address\n * @throws if the tokens are on different chains\n */\n public sortsBefore(other: Token): boolean {\n invariant(this.chainId === other.chainId, 'CHAIN_IDS')\n invariant(this.address !== other.address, 'ADDRESSES')\n return this.address.toLowerCase() < other.address.toLowerCase()\n }\n}\n\n/**\n * Compares two currencies for equality\n */\nexport function currencyEquals(currencyA: Currency, currencyB: Currency): boolean {\n if (currencyA instanceof Token && currencyB instanceof Token) {\n return currencyA.equals(currencyB)\n } else if (currencyA instanceof Token) {\n return false\n } else if (currencyB instanceof Token) {\n return false\n } else {\n return currencyA === currencyB\n }\n}\n\nexport const WETH = {\n [ChainId.MAINNET]: new Token(\n ChainId.MAINNET,\n '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.ROPSTEN]: new Token(\n ChainId.ROPSTEN,\n '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.RINKEBY]: new Token(\n ChainId.RINKEBY,\n '0xc778417E063141139Fce010982780140Aa0cD5Ab',\n 18,\n 'WETH',\n 'Wrapped Ether'\n ),\n [ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.KOVAN]: new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.TECO]: new Token(ChainId.TECO, '0x65A98D861a1E8e9E1404EF5d19C24a70e022B935', 18, 'WETH', 'Wrapped Ether'),\n [ChainId.ENGRAM]: new Token(ChainId.ENGRAM, '0x7E3e3C50927F78ce0D2a1699d15d342c976A49B0', 18, 'WETH', 'Wrapped Ether') // need change\n}\n","import invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport _Decimal from 'decimal.js-light'\nimport _Big, { RoundingMode } from 'big.js'\nimport toFormat from 'toformat'\n\nimport { BigintIsh, Rounding } from '../../constants'\nimport { ONE } from '../../constants'\nimport { parseBigintIsh } from '../../utils'\n\nconst Decimal = toFormat(_Decimal)\nconst Big = toFormat(_Big)\n\nconst toSignificantRounding = {\n [Rounding.ROUND_DOWN]: Decimal.ROUND_DOWN,\n [Rounding.ROUND_HALF_UP]: Decimal.ROUND_HALF_UP,\n [Rounding.ROUND_UP]: Decimal.ROUND_UP\n}\n\nconst toFixedRounding = {\n [Rounding.ROUND_DOWN]: RoundingMode.RoundDown,\n [Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp,\n [Rounding.ROUND_UP]: RoundingMode.RoundUp\n}\n\nexport class Fraction {\n public readonly numerator: JSBI\n public readonly denominator: JSBI\n\n public constructor(numerator: BigintIsh, denominator: BigintIsh = ONE) {\n this.numerator = parseBigintIsh(numerator)\n this.denominator = parseBigintIsh(denominator)\n }\n\n // performs floor division\n public get quotient(): JSBI {\n return JSBI.divide(this.numerator, this.denominator)\n }\n\n // remainder after floor division\n public get remainder(): Fraction {\n return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator)\n }\n\n public invert(): Fraction {\n return new Fraction(this.denominator, this.numerator)\n }\n\n public add(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n if (JSBI.equal(this.denominator, otherParsed.denominator)) {\n return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator)\n }\n return new Fraction(\n JSBI.add(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n ),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public subtract(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n if (JSBI.equal(this.denominator, otherParsed.denominator)) {\n return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator)\n }\n return new Fraction(\n JSBI.subtract(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n ),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public lessThan(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.lessThan(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public equalTo(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.equal(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public greaterThan(other: Fraction | BigintIsh): boolean {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return JSBI.greaterThan(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(otherParsed.numerator, this.denominator)\n )\n }\n\n public multiply(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return new Fraction(\n JSBI.multiply(this.numerator, otherParsed.numerator),\n JSBI.multiply(this.denominator, otherParsed.denominator)\n )\n }\n\n public divide(other: Fraction | BigintIsh): Fraction {\n const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other))\n return new Fraction(\n JSBI.multiply(this.numerator, otherParsed.denominator),\n JSBI.multiply(this.denominator, otherParsed.numerator)\n )\n }\n\n public toSignificant(\n significantDigits: number,\n format: object = { groupSeparator: '' },\n rounding: Rounding = Rounding.ROUND_HALF_UP\n ): string {\n invariant(Number.isInteger(significantDigits), `${significantDigits} is not an integer.`)\n invariant(significantDigits > 0, `${significantDigits} is not positive.`)\n\n Decimal.set({ precision: significantDigits + 1, rounding: toSignificantRounding[rounding] })\n const quotient = new Decimal(this.numerator.toString())\n .div(this.denominator.toString())\n .toSignificantDigits(significantDigits)\n return quotient.toFormat(quotient.decimalPlaces(), format)\n }\n\n public toFixed(\n decimalPlaces: number,\n format: object = { groupSeparator: '' },\n rounding: Rounding = Rounding.ROUND_HALF_UP\n ): string {\n invariant(Number.isInteger(decimalPlaces), `${decimalPlaces} is not an integer.`)\n invariant(decimalPlaces >= 0, `${decimalPlaces} is negative.`)\n\n Big.DP = decimalPlaces\n Big.RM = toFixedRounding[rounding]\n return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format)\n }\n}\n","import { currencyEquals } from '../token'\nimport { Currency, ETHER } from '../currency'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport _Big from 'big.js'\nimport toFormat from 'toformat'\n\nimport { BigintIsh, Rounding, TEN, SolidityType } from '../../constants'\nimport { parseBigintIsh, validateSolidityTypeInstance } from '../../utils'\nimport { Fraction } from './fraction'\n\nconst Big = toFormat(_Big)\n\nexport class CurrencyAmount extends Fraction {\n public readonly currency: Currency\n\n /**\n * Helper that calls the constructor with the ETHER currency\n * @param amount ether amount in wei\n */\n public static ether(amount: BigintIsh): CurrencyAmount {\n return new CurrencyAmount(ETHER, amount)\n }\n\n // amount _must_ be raw, i.e. in the native representation\n protected constructor(currency: Currency, amount: BigintIsh) {\n const parsedAmount = parseBigintIsh(amount)\n validateSolidityTypeInstance(parsedAmount, SolidityType.uint256)\n\n super(parsedAmount, JSBI.exponentiate(TEN, JSBI.BigInt(currency.decimals)))\n this.currency = currency\n }\n\n public get raw(): JSBI {\n return this.numerator\n }\n\n public add(other: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(this.currency, other.currency), 'TOKEN')\n return new CurrencyAmount(this.currency, JSBI.add(this.raw, other.raw))\n }\n\n public subtract(other: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(this.currency, other.currency), 'TOKEN')\n return new CurrencyAmount(this.currency, JSBI.subtract(this.raw, other.raw))\n }\n\n public toSignificant(\n significantDigits: number = 6,\n format?: object,\n rounding: Rounding = Rounding.ROUND_DOWN\n ): string {\n return super.toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(\n decimalPlaces: number = this.currency.decimals,\n format?: object,\n rounding: Rounding = Rounding.ROUND_DOWN\n ): string {\n invariant(decimalPlaces <= this.currency.decimals, 'DECIMALS')\n return super.toFixed(decimalPlaces, format, rounding)\n }\n\n public toExact(format: object = { groupSeparator: '' }): string {\n Big.DP = this.currency.decimals\n return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(format)\n }\n}\n","import { CurrencyAmount } from './currencyAmount'\nimport { Token } from '../token'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\n\nimport { BigintIsh } from '../../constants'\n\nexport class TokenAmount extends CurrencyAmount {\n public readonly token: Token\n\n // amount _must_ be raw, i.e. in the native representation\n public constructor(token: Token, amount: BigintIsh) {\n super(token, amount)\n this.token = token\n }\n\n public add(other: TokenAmount): TokenAmount {\n invariant(this.token.equals(other.token), 'TOKEN')\n return new TokenAmount(this.token, JSBI.add(this.raw, other.raw))\n }\n\n public subtract(other: TokenAmount): TokenAmount {\n invariant(this.token.equals(other.token), 'TOKEN')\n return new TokenAmount(this.token, JSBI.subtract(this.raw, other.raw))\n }\n}\n","import { Token } from '../token'\nimport { TokenAmount } from './tokenAmount'\nimport { currencyEquals } from '../token'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\n\nimport { BigintIsh, Rounding, TEN } from '../../constants'\nimport { Currency } from '../currency'\nimport { Route } from '../route'\nimport { Fraction } from './fraction'\nimport { CurrencyAmount } from './currencyAmount'\n\nexport class Price extends Fraction {\n public readonly baseCurrency: Currency // input i.e. denominator\n public readonly quoteCurrency: Currency // output i.e. numerator\n public readonly scalar: Fraction // used to adjust the raw fraction w/r/t the decimals of the {base,quote}Token\n\n public static fromRoute(route: Route): Price {\n const prices: Price[] = []\n for (const [i, pair] of route.pairs.entries()) {\n prices.push(\n route.path[i].equals(pair.token0)\n ? new Price(pair.reserve0.currency, pair.reserve1.currency, pair.reserve0.raw, pair.reserve1.raw)\n : new Price(pair.reserve1.currency, pair.reserve0.currency, pair.reserve1.raw, pair.reserve0.raw)\n )\n }\n return prices.slice(1).reduce((accumulator, currentValue) => accumulator.multiply(currentValue), prices[0])\n }\n\n // denominator and numerator _must_ be raw, i.e. in the native representation\n public constructor(baseCurrency: Currency, quoteCurrency: Currency, denominator: BigintIsh, numerator: BigintIsh) {\n super(numerator, denominator)\n\n this.baseCurrency = baseCurrency\n this.quoteCurrency = quoteCurrency\n this.scalar = new Fraction(\n JSBI.exponentiate(TEN, JSBI.BigInt(baseCurrency.decimals)),\n JSBI.exponentiate(TEN, JSBI.BigInt(quoteCurrency.decimals))\n )\n }\n\n public get raw(): Fraction {\n return new Fraction(this.numerator, this.denominator)\n }\n\n public get adjusted(): Fraction {\n return super.multiply(this.scalar)\n }\n\n public invert(): Price {\n return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator)\n }\n\n public multiply(other: Price): Price {\n invariant(currencyEquals(this.quoteCurrency, other.baseCurrency), 'TOKEN')\n const fraction = super.multiply(other)\n return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator)\n }\n\n // performs floor division on overflow\n public quote(currencyAmount: CurrencyAmount): CurrencyAmount {\n invariant(currencyEquals(currencyAmount.currency, this.baseCurrency), 'TOKEN')\n if (this.quoteCurrency instanceof Token) {\n return new TokenAmount(this.quoteCurrency, super.multiply(currencyAmount.raw).quotient)\n }\n return CurrencyAmount.ether(super.multiply(currencyAmount.raw).quotient)\n }\n\n public toSignificant(significantDigits: number = 6, format?: object, rounding?: Rounding): string {\n return this.adjusted.toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(decimalPlaces: number = 4, format?: object, rounding?: Rounding): string {\n return this.adjusted.toFixed(decimalPlaces, format, rounding)\n }\n}\n","import { Price } from './fractions/price'\nimport { TokenAmount } from './fractions/tokenAmount'\nimport invariant from 'tiny-invariant'\nimport JSBI from 'jsbi'\nimport { pack, keccak256 } from '@ethersproject/solidity'\nimport { getCreate2Address } from '@ethersproject/address'\n\nimport {\n BigintIsh,\n FACTORY_ADDRESS,\n INIT_CODE_HASH,\n MINIMUM_LIQUIDITY,\n ZERO,\n ONE,\n FIVE,\n _997,\n _1000,\n ChainId\n} from '../constants'\nimport { sqrt, parseBigintIsh } from '../utils'\nimport { InsufficientReservesError, InsufficientInputAmountError } from '../errors'\nimport { Token } from './token'\n\nlet PAIR_ADDRESS_CACHE: { [token0Address: string]: { [token1Address: string]: string } } = {}\n\nexport class Pair {\n public readonly liquidityToken: Token\n private readonly tokenAmounts: [TokenAmount, TokenAmount]\n\n public static getAddress(tokenA: Token, tokenB: Token): string {\n const tokens = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA] // does safety checks\n\n if (PAIR_ADDRESS_CACHE?.[tokens[0].address]?.[tokens[1].address] === undefined) {\n PAIR_ADDRESS_CACHE = {\n ...PAIR_ADDRESS_CACHE,\n [tokens[0].address]: {\n ...PAIR_ADDRESS_CACHE?.[tokens[0].address],\n [tokens[1].address]: getCreate2Address(\n FACTORY_ADDRESS,\n keccak256(['bytes'], [pack(['address', 'address'], [tokens[0].address, tokens[1].address])]),\n INIT_CODE_HASH\n )\n }\n }\n }\n\n return PAIR_ADDRESS_CACHE[tokens[0].address][tokens[1].address]\n }\n\n public constructor(tokenAmountA: TokenAmount, tokenAmountB: TokenAmount) {\n const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks\n ? [tokenAmountA, tokenAmountB]\n : [tokenAmountB, tokenAmountA]\n this.liquidityToken = new Token(\n tokenAmounts[0].token.chainId,\n Pair.getAddress(tokenAmounts[0].token, tokenAmounts[1].token),\n 18,\n 'UNI-V2',\n 'Uniswap V2'\n )\n this.tokenAmounts = tokenAmounts as [TokenAmount, TokenAmount]\n }\n\n /**\n * Returns true if the token is either token0 or token1\n * @param token to check\n */\n public involvesToken(token: Token): boolean {\n return token.equals(this.token0) || token.equals(this.token1)\n }\n\n /**\n * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0\n */\n public get token0Price(): Price {\n return new Price(this.token0, this.token1, this.tokenAmounts[0].raw, this.tokenAmounts[1].raw)\n }\n\n /**\n * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1\n */\n public get token1Price(): Price {\n return new Price(this.token1, this.token0, this.tokenAmounts[1].raw, this.tokenAmounts[0].raw)\n }\n\n /**\n * Return the price of the given token in terms of the other token in the pair.\n * @param token token to return price of\n */\n public priceOf(token: Token): Price {\n invariant(this.involvesToken(token), 'TOKEN')\n return token.equals(this.token0) ? this.token0Price : this.token1Price\n }\n\n /**\n * Returns the chain ID of the tokens in the pair.\n */\n public get chainId(): ChainId {\n return this.token0.chainId\n }\n\n public get token0(): Token {\n return this.tokenAmounts[0].token\n }\n\n public get token1(): Token {\n return this.tokenAmounts[1].token\n }\n\n public get reserve0(): TokenAmount {\n return this.tokenAmounts[0]\n }\n\n public get reserve1(): TokenAmount {\n return this.tokenAmounts[1]\n }\n\n public reserveOf(token: Token): TokenAmount {\n invariant(this.involvesToken(token), 'TOKEN')\n return token.equals(this.token0) ? this.reserve0 : this.reserve1\n }\n\n public getOutputAmount(inputAmount: TokenAmount): [TokenAmount, Pair] {\n invariant(this.involvesToken(inputAmount.token), 'TOKEN')\n if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO)) {\n throw new InsufficientReservesError()\n }\n const inputReserve = this.reserveOf(inputAmount.token)\n const outputReserve = this.reserveOf(inputAmount.token.equals(this.token0) ? this.token1 : this.token0)\n const inputAmountWithFee = JSBI.multiply(inputAmount.raw, _997)\n const numerator = JSBI.multiply(inputAmountWithFee, outputReserve.raw)\n const denominator = JSBI.add(JSBI.multiply(inputReserve.raw, _1000), inputAmountWithFee)\n const outputAmount = new TokenAmount(\n inputAmount.token.equals(this.token0) ? this.token1 : this.token0,\n JSBI.divide(numerator, denominator)\n )\n if (JSBI.equal(outputAmount.raw, ZERO)) {\n throw new InsufficientInputAmountError()\n }\n return [outputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]\n }\n\n public getInputAmount(outputAmount: TokenAmount): [TokenAmount, Pair] {\n invariant(this.involvesToken(outputAmount.token), 'TOKEN')\n if (\n JSBI.equal(this.reserve0.raw, ZERO) ||\n JSBI.equal(this.reserve1.raw, ZERO) ||\n JSBI.greaterThanOrEqual(outputAmount.raw, this.reserveOf(outputAmount.token).raw)\n ) {\n throw new InsufficientReservesError()\n }\n\n const outputReserve = this.reserveOf(outputAmount.token)\n const inputReserve = this.reserveOf(outputAmount.token.equals(this.token0) ? this.token1 : this.token0)\n const numerator = JSBI.multiply(JSBI.multiply(inputReserve.raw, outputAmount.raw), _1000)\n const denominator = JSBI.multiply(JSBI.subtract(outputReserve.raw, outputAmount.raw), _997)\n const inputAmount = new TokenAmount(\n outputAmount.token.equals(this.token0) ? this.token1 : this.token0,\n JSBI.add(JSBI.divide(numerator, denominator), ONE)\n )\n return [inputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))]\n }\n\n public getLiquidityMinted(\n totalSupply: TokenAmount,\n tokenAmountA: TokenAmount,\n tokenAmountB: TokenAmount\n ): TokenAmount {\n invariant(totalSupply.token.equals(this.liquidityToken), 'LIQUIDITY')\n const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks\n ? [tokenAmountA, tokenAmountB]\n : [tokenAmountB, tokenAmountA]\n invariant(tokenAmounts[0].token.equals(this.token0) && tokenAmounts[1].token.equals(this.token1), 'TOKEN')\n\n let liquidity: JSBI\n if (JSBI.equal(totalSupply.raw, ZERO)) {\n liquidity = JSBI.subtract(sqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY)\n } else {\n const amount0 = JSBI.divide(JSBI.multiply(tokenAmounts[0].raw, totalSupply.raw), this.reserve0.raw)\n const amount1 = JSBI.divide(JSBI.multiply(tokenAmounts[1].raw, totalSupply.raw), this.reserve1.raw)\n liquidity = JSBI.lessThanOrEqual(amount0, amount1) ? amount0 : amount1\n }\n if (!JSBI.greaterThan(liquidity, ZERO)) {\n throw new InsufficientInputAmountError()\n }\n return new TokenAmount(this.liquidityToken, liquidity)\n }\n\n public getLiquidityValue(\n token: Token,\n totalSupply: TokenAmount,\n liquidity: TokenAmount,\n feeOn: boolean = false,\n kLast?: BigintIsh\n ): TokenAmount {\n invariant(this.involvesToken(token), 'TOKEN')\n invariant(totalSupply.token.equals(this.liquidityToken), 'TOTAL_SUPPLY')\n invariant(liquidity.token.equals(this.liquidityToken), 'LIQUIDITY')\n invariant(JSBI.lessThanOrEqual(liquidity.raw, totalSupply.raw), 'LIQUIDITY')\n\n let totalSupplyAdjusted: TokenAmount\n if (!feeOn) {\n totalSupplyAdjusted = totalSupply\n } else {\n invariant(!!kLast, 'K_LAST')\n const kLastParsed = parseBigintIsh(kLast)\n if (!JSBI.equal(kLastParsed, ZERO)) {\n const rootK = sqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw))\n const rootKLast = sqrt(kLastParsed)\n if (JSBI.greaterThan(rootK, rootKLast)) {\n const numerator = JSBI.multiply(totalSupply.raw, JSBI.subtract(rootK, rootKLast))\n const denominator = JSBI.add(JSBI.multiply(rootK, FIVE), rootKLast)\n const feeLiquidity = JSBI.divide(numerator, denominator)\n totalSupplyAdjusted = totalSupply.add(new TokenAmount(this.liquidityToken, feeLiquidity))\n } else {\n totalSupplyAdjusted = totalSupply\n }\n } else {\n totalSupplyAdjusted = totalSupply\n }\n }\n\n return new TokenAmount(\n token,\n JSBI.divide(JSBI.multiply(liquidity.raw, this.reserveOf(token).raw), totalSupplyAdjusted.raw)\n )\n }\n}\n","import { ChainId } from '../constants'\nimport invariant from 'tiny-invariant'\n\nimport { Currency, ETHER } from './currency'\nimport { Token, WETH } from './token'\nimport { Pair } from './pair'\nimport { Price } from './fractions/price'\n\nexport class Route {\n public readonly pairs: Pair[]\n public readonly path: Token[]\n public readonly input: Currency\n public readonly output: Currency\n public readonly midPrice: Price\n\n public constructor(pairs: Pair[], input: Currency, output?: Currency) {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(\n pairs.every(pair => pair.chainId === pairs[0].chainId),\n 'CHAIN_IDS'\n )\n invariant(\n (input instanceof Token && pairs[0].involvesToken(input)) ||\n (input === ETHER && pairs[0].involvesToken(WETH[pairs[0].chainId])),\n 'INPUT'\n )\n invariant(\n typeof output === 'undefined' ||\n (output instanceof Token && pairs[pairs.length - 1].involvesToken(output)) ||\n (output === ETHER && pairs[pairs.length - 1].involvesToken(WETH[pairs[0].chainId])),\n 'OUTPUT'\n )\n\n const path: Token[] = [input instanceof Token ? input : WETH[pairs[0].chainId]]\n for (const [i, pair] of pairs.entries()) {\n const currentInput = path[i]\n invariant(currentInput.equals(pair.token0) || currentInput.equals(pair.token1), 'PATH')\n const output = currentInput.equals(pair.token0) ? pair.token1 : pair.token0\n path.push(output)\n }\n\n this.pairs = pairs\n this.path = path\n this.midPrice = Price.fromRoute(this)\n this.input = input\n this.output = output ?? path[path.length - 1]\n }\n\n public get chainId(): ChainId {\n return this.pairs[0].chainId\n }\n}\n","import { Rounding, _100 } from '../../constants'\nimport { Fraction } from './fraction'\n\nconst _100_PERCENT = new Fraction(_100)\n\nexport class Percent extends Fraction {\n public toSignificant(significantDigits: number = 5, format?: object, rounding?: Rounding): string {\n return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding)\n }\n\n public toFixed(decimalPlaces: number = 2, format?: object, rounding?: Rounding): string {\n return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding)\n }\n}\n","import invariant from 'tiny-invariant'\n\nimport { ChainId, ONE, TradeType, ZERO } from '../constants'\nimport { sortedInsert } from '../utils'\nimport { Currency, ETHER } from './currency'\nimport { CurrencyAmount } from './fractions/currencyAmount'\nimport { Fraction } from './fractions/fraction'\nimport { Percent } from './fractions/percent'\nimport { Price } from './fractions/price'\nimport { TokenAmount } from './fractions/tokenAmount'\nimport { Pair } from './pair'\nimport { Route } from './route'\nimport { currencyEquals, Token, WETH } from './token'\n\n/**\n * Returns the percent difference between the mid price and the execution price, i.e. price impact.\n * @param midPrice mid price before the trade\n * @param inputAmount the input amount of the trade\n * @param outputAmount the output amount of the trade\n */\nfunction computePriceImpact(midPrice: Price, inputAmount: CurrencyAmount, outputAmount: CurrencyAmount): Percent {\n const exactQuote = midPrice.raw.multiply(inputAmount.raw)\n // calculate slippage := (exactQuote - outputAmount) / exactQuote\n const slippage = exactQuote.subtract(outputAmount.raw).divide(exactQuote)\n return new Percent(slippage.numerator, slippage.denominator)\n}\n\n// minimal interface so the input output comparator may be shared across types\ninterface InputOutput {\n readonly inputAmount: CurrencyAmount\n readonly outputAmount: CurrencyAmount\n}\n\n// comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts\n// in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first\nexport function inputOutputComparator(a: InputOutput, b: InputOutput): number {\n // must have same input and output token for comparison\n invariant(currencyEquals(a.inputAmount.currency, b.inputAmount.currency), 'INPUT_CURRENCY')\n invariant(currencyEquals(a.outputAmount.currency, b.outputAmount.currency), 'OUTPUT_CURRENCY')\n if (a.outputAmount.equalTo(b.outputAmount)) {\n if (a.inputAmount.equalTo(b.inputAmount)) {\n return 0\n }\n // trade A requires less input than trade B, so A should come first\n if (a.inputAmount.lessThan(b.inputAmount)) {\n return -1\n } else {\n return 1\n }\n } else {\n // tradeA has less output than trade B, so should come second\n if (a.outputAmount.lessThan(b.outputAmount)) {\n return 1\n } else {\n return -1\n }\n }\n}\n\n// extension of the input output comparator that also considers other dimensions of the trade in ranking them\nexport function tradeComparator(a: Trade, b: Trade) {\n const ioComp = inputOutputComparator(a, b)\n if (ioComp !== 0) {\n return ioComp\n }\n\n // consider lowest slippage next, since these are less likely to fail\n if (a.priceImpact.lessThan(b.priceImpact)) {\n return -1\n } else if (a.priceImpact.greaterThan(b.priceImpact)) {\n return 1\n }\n\n // finally consider the number of hops since each hop costs gas\n return a.route.path.length - b.route.path.length\n}\n\nexport interface BestTradeOptions {\n // how many results to return\n maxNumResults?: number\n // the maximum number of hops a trade should contain\n maxHops?: number\n}\n\n/**\n * Given a currency amount and a chain ID, returns the equivalent representation as the token amount.\n * In other words, if the currency is ETHER, returns the WETH token amount for the given chain. Otherwise, returns\n * the input currency amount.\n */\nfunction wrappedAmount(currencyAmount: CurrencyAmount, chainId: ChainId): TokenAmount {\n if (currencyAmount instanceof TokenAmount) return currencyAmount\n if (currencyAmount.currency === ETHER) return new TokenAmount(WETH[chainId], currencyAmount.raw)\n invariant(false, 'CURRENCY')\n}\n\nfunction wrappedCurrency(currency: Currency, chainId: ChainId): Token {\n if (currency instanceof Token) return currency\n if (currency === ETHER) return WETH[chainId]\n invariant(false, 'CURRENCY')\n}\n\n/**\n * Represents a trade executed against a list of pairs.\n * Does not account for slippage, i.e. trades that front run this trade and move the price.\n */\nexport class Trade {\n /**\n * The route of the trade, i.e. which pairs the trade goes through.\n */\n public readonly route: Route\n /**\n * The type of the trade, either exact in or exact out.\n */\n public readonly tradeType: TradeType\n /**\n * The input amount for the trade assuming no slippage.\n */\n public readonly inputAmount: CurrencyAmount\n /**\n * The output amount for the trade assuming no slippage.\n */\n public readonly outputAmount: CurrencyAmount\n /**\n * The price expressed in terms of output amount/input amount.\n */\n public readonly executionPrice: Price\n /**\n * The mid price after the trade executes assuming no slippage.\n */\n public readonly nextMidPrice: Price\n /**\n * The percent difference between the mid price before the trade and the trade execution price.\n */\n public readonly priceImpact: Percent\n\n /**\n * Constructs an exact in trade with the given amount in and route\n * @param route route of the exact in trade\n * @param amountIn the amount being passed in\n */\n public static exactIn(route: Route, amountIn: CurrencyAmount): Trade {\n return new Trade(route, amountIn, TradeType.EXACT_INPUT)\n }\n\n /**\n * Constructs an exact out trade with the given amount out and route\n * @param route route of the exact out trade\n * @param amountOut the amount returned by the trade\n */\n public static exactOut(route: Route, amountOut: CurrencyAmount): Trade {\n return new Trade(route, amountOut, TradeType.EXACT_OUTPUT)\n }\n\n public constructor(route: Route, amount: CurrencyAmount, tradeType: TradeType) {\n const amounts: TokenAmount[] = new Array(route.path.length)\n const nextPairs: Pair[] = new Array(route.pairs.length)\n if (tradeType === TradeType.EXACT_INPUT) {\n invariant(currencyEquals(amount.currency, route.input), 'INPUT')\n amounts[0] = wrappedAmount(amount, route.chainId)\n for (let i = 0; i < route.path.length - 1; i++) {\n const pair = route.pairs[i]\n const [outputAmount, nextPair] = pair.getOutputAmount(amounts[i])\n amounts[i + 1] = outputAmount\n nextPairs[i] = nextPair\n }\n } else {\n invariant(currencyEquals(amount.currency, route.output), 'OUTPUT')\n amounts[amounts.length - 1] = wrappedAmount(amount, route.chainId)\n for (let i = route.path.length - 1; i > 0; i--) {\n const pair = route.pairs[i - 1]\n const [inputAmount, nextPair] = pair.getInputAmount(amounts[i])\n amounts[i - 1] = inputAmount\n nextPairs[i - 1] = nextPair\n }\n }\n\n this.route = route\n this.tradeType = tradeType\n this.inputAmount =\n tradeType === TradeType.EXACT_INPUT\n ? amount\n : route.input === ETHER\n ? CurrencyAmount.ether(amounts[0].raw)\n : amounts[0]\n this.outputAmount =\n tradeType === TradeType.EXACT_OUTPUT\n ? amount\n : route.output === ETHER\n ? CurrencyAmount.ether(amounts[amounts.length - 1].raw)\n : amounts[amounts.length - 1]\n this.executionPrice = new Price(\n this.inputAmount.currency,\n this.outputAmount.currency,\n this.inputAmount.raw,\n this.outputAmount.raw\n )\n this.nextMidPrice = Price.fromRoute(new Route(nextPairs, route.input))\n this.priceImpact = computePriceImpact(route.midPrice, this.inputAmount, this.outputAmount)\n }\n\n /**\n * Get the minimum amount that must be received from this trade for the given slippage tolerance\n * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade\n */\n public minimumAmountOut(slippageTolerance: Percent): CurrencyAmount {\n invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE')\n if (this.tradeType === TradeType.EXACT_OUTPUT) {\n return this.outputAmount\n } else {\n const slippageAdjustedAmountOut = new Fraction(ONE)\n .add(slippageTolerance)\n .invert()\n .multiply(this.outputAmount.raw).quotient\n return this.outputAmount instanceof TokenAmount\n ? new TokenAmount(this.outputAmount.token, slippageAdjustedAmountOut)\n : CurrencyAmount.ether(slippageAdjustedAmountOut)\n }\n }\n\n /**\n * Get the maximum amount in that can be spent via this trade for the given slippage tolerance\n * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade\n */\n public maximumAmountIn(slippageTolerance: Percent): CurrencyAmount {\n invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE')\n if (this.tradeType === TradeType.EXACT_INPUT) {\n return this.inputAmount\n } else {\n const slippageAdjustedAmountIn = new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.raw).quotient\n return this.inputAmount instanceof TokenAmount\n ? new TokenAmount(this.inputAmount.token, slippageAdjustedAmountIn)\n : CurrencyAmount.ether(slippageAdjustedAmountIn)\n }\n }\n\n /**\n * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token\n * amount to an output token, making at most `maxHops` hops.\n * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting\n * the amount in among multiple routes.\n * @param pairs the pairs to consider in finding the best trade\n * @param currencyAmountIn exact amount of input currency to spend\n * @param currencyOut the desired currency out\n * @param maxNumResults maximum number of results to return\n * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair\n * @param currentPairs used in recursion; the current list of pairs\n * @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter\n * @param bestTrades used in recursion; the current list of best trades\n */\n public static bestTradeExactIn(\n pairs: Pair[],\n currencyAmountIn: CurrencyAmount,\n currencyOut: Currency,\n { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {},\n // used in recursion.\n currentPairs: Pair[] = [],\n originalAmountIn: CurrencyAmount = currencyAmountIn,\n bestTrades: Trade[] = []\n ): Trade[] {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(maxHops > 0, 'MAX_HOPS')\n invariant(originalAmountIn === currencyAmountIn || currentPairs.length > 0, 'INVALID_RECURSION')\n const chainId: ChainId | undefined =\n currencyAmountIn instanceof TokenAmount\n ? currencyAmountIn.token.chainId\n : currencyOut instanceof Token\n ? currencyOut.chainId\n : undefined\n invariant(chainId !== undefined, 'CHAIN_ID')\n\n const amountIn = wrappedAmount(currencyAmountIn, chainId)\n const tokenOut = wrappedCurrency(currencyOut, chainId)\n for (let i = 0; i < pairs.length; i++) {\n const pair = pairs[i]\n // pair irrelevant\n if (!pair.token0.equals(amountIn.token) && !pair.token1.equals(amountIn.token)) continue\n if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue\n\n let amountOut: TokenAmount\n try {\n ;[amountOut] = pair.getOutputAmount(amountIn)\n } catch (error) {\n // input too low\n if (error.isInsufficientInputAmountError) {\n continue\n }\n throw error\n }\n // we have arrived at the output token, so this is the final trade of one of the paths\n if (amountOut.token.equals(tokenOut)) {\n sortedInsert(\n bestTrades,\n new Trade(\n new Route([...currentPairs, pair], originalAmountIn.currency, currencyOut),\n originalAmountIn,\n TradeType.EXACT_INPUT\n ),\n maxNumResults,\n tradeComparator\n )\n } else if (maxHops > 1 && pairs.length > 1) {\n const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length))\n\n // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops\n Trade.bestTradeExactIn(\n pairsExcludingThisPair,\n amountOut,\n currencyOut,\n {\n maxNumResults,\n maxHops: maxHops - 1\n },\n [...currentPairs, pair],\n originalAmountIn,\n bestTrades\n )\n }\n }\n\n return bestTrades\n }\n\n /**\n * similar to the above method but instead targets a fixed output amount\n * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token\n * to an output token amount, making at most `maxHops` hops\n * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting\n * the amount in among multiple routes.\n * @param pairs the pairs to consider in finding the best trade\n * @param currencyIn the currency to spend\n * @param currencyAmountOut the exact amount of currency out\n * @param maxNumResults maximum number of results to return\n * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair\n * @param currentPairs used in recursion; the current list of pairs\n * @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter\n * @param bestTrades used in recursion; the current list of best trades\n */\n public static bestTradeExactOut(\n pairs: Pair[],\n currencyIn: Currency,\n currencyAmountOut: CurrencyAmount,\n { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {},\n // used in recursion.\n currentPairs: Pair[] = [],\n originalAmountOut: CurrencyAmount = currencyAmountOut,\n bestTrades: Trade[] = []\n ): Trade[] {\n invariant(pairs.length > 0, 'PAIRS')\n invariant(maxHops > 0, 'MAX_HOPS')\n invariant(originalAmountOut === currencyAmountOut || currentPairs.length > 0, 'INVALID_RECURSION')\n const chainId: ChainId | undefined =\n currencyAmountOut instanceof TokenAmount\n ? currencyAmountOut.token.chainId\n : currencyIn instanceof Token\n ? currencyIn.chainId\n : undefined\n invariant(chainId !== undefined, 'CHAIN_ID')\n\n const amountOut = wrappedAmount(currencyAmountOut, chainId)\n const tokenIn = wrappedCurrency(currencyIn, chainId)\n for (let i = 0; i < pairs.length; i++) {\n const pair = pairs[i]\n // pair irrelevant\n if (!pair.token0.equals(amountOut.token) && !pair.token1.equals(amountOut.token)) continue\n if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue\n\n let amountIn: TokenAmount\n try {\n ;[amountIn] = pair.getInputAmount(amountOut)\n } catch (error) {\n // not enough liquidity in this pair\n if (error.isInsufficientReservesError) {\n continue\n }\n throw error\n }\n // we have arrived at the input token, so this is the first trade of one of the paths\n if (amountIn.token.equals(tokenIn)) {\n sortedInsert(\n bestTrades,\n new Trade(\n new Route([pair, ...currentPairs], currencyIn, originalAmountOut.currency),\n originalAmountOut,\n TradeType.EXACT_OUTPUT\n ),\n maxNumResults,\n tradeComparator\n )\n } else if (maxHops > 1 && pairs.length > 1) {\n const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length))\n\n // otherwise, consider all the other paths that arrive at this token as long as we have not exceeded maxHops\n Trade.bestTradeExactOut(\n pairsExcludingThisPair,\n currencyIn,\n amountIn,\n {\n maxNumResults,\n maxHops: maxHops - 1\n },\n [pair, ...currentPairs],\n originalAmountOut,\n bestTrades\n )\n }\n }\n\n return bestTrades\n }\n}\n","import { TradeType } from './constants'\nimport invariant from 'tiny-invariant'\nimport { validateAndParseAddress } from './utils'\nimport { CurrencyAmount, ETHER, Percent, Trade } from './entities'\n\n/**\n * Options for producing the arguments to send call to the router.\n */\nexport interface TradeOptions {\n /**\n * How much the execution price is allowed to move unfavorably from the trade execution price.\n */\n allowedSlippage: Percent\n /**\n * How long the swap is valid until it expires, in seconds.\n * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters\n * are generated.\n */\n ttl: number\n /**\n * The account that should receive the output of the swap.\n */\n recipient: string\n\n /**\n * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods\n */\n feeOnTransfer?: boolean\n}\n\nexport interface TradeOptionsDeadline extends Omit {\n /**\n * When the transaction expires.\n * This is an atlernate to specifying the ttl, for when you do not want to use local time.\n */\n deadline: number\n}\n\n/**\n * The parameters to use in the call to the Uniswap V2 Router to execute a trade.\n */\nexport interface SwapParameters {\n /**\n * The method to call on the Uniswap V2 Router.\n */\n methodName: string\n /**\n * The arguments to pass to the method, all hex encoded.\n */\n args: (string | string[])[]\n /**\n * The amount of wei to send in hex.\n */\n value: string\n}\n\nfunction toHex(currencyAmount: CurrencyAmount) {\n return `0x${currencyAmount.raw.toString(16)}`\n}\n\nconst ZERO_HEX = '0x0'\n\n/**\n * Represents the Uniswap V2 Router, and has static methods for helping execute trades.\n */\nexport abstract class Router {\n /**\n * Cannot be constructed.\n */\n private constructor() {}\n /**\n * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.\n * @param trade to produce call parameters for\n * @param options options for the call parameters\n */\n public static swapCallParameters(trade: Trade, options: TradeOptions | TradeOptionsDeadline): SwapParameters {\n const etherIn = trade.inputAmount.currency === ETHER\n const etherOut = trade.outputAmount.currency === ETHER\n // the router does not support both ether in and out\n invariant(!(etherIn && etherOut), 'ETHER_IN_OUT')\n invariant(!('ttl' in options) || options.ttl > 0, 'TTL')\n\n const to: string = validateAndParseAddress(options.recipient)\n const amountIn: string = toHex(trade.maximumAmountIn(options.allowedSlippage))\n const amountOut: string = toHex(trade.minimumAmountOut(options.allowedSlippage))\n const path: string[] = trade.route.path.map(token => token.address)\n const deadline =\n 'ttl' in options\n ? `0x${(Math.floor(new Date().getTime() / 1000) + options.ttl).toString(16)}`\n : `0x${options.deadline.toString(16)}`\n\n const useFeeOnTransfer = Boolean(options.feeOnTransfer)\n\n let methodName: string\n let args: (string | string[])[]\n let value: string\n switch (trade.tradeType) {\n case TradeType.EXACT_INPUT:\n if (etherIn) {\n methodName = useFeeOnTransfer ? 'swapExactETHForTokensSupportingFeeOnTransferTokens' : 'swapExactETHForTokens'\n // (uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountOut, path, to, deadline]\n value = amountIn\n } else if (etherOut) {\n methodName = useFeeOnTransfer ? 'swapExactTokensForETHSupportingFeeOnTransferTokens' : 'swapExactTokensForETH'\n // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountIn, amountOut, path, to, deadline]\n value = ZERO_HEX\n } else {\n methodName = useFeeOnTransfer\n ? 'swapExactTokensForTokensSupportingFeeOnTransferTokens'\n : 'swapExactTokensForTokens'\n // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n args = [amountIn, amountOut, path, to, deadline]\n value = ZERO_HEX\n }\n break\n case TradeType.EXACT_OUTPUT:\n invariant(!useFeeOnTransfer, 'EXACT_OUT_FOT')\n if (etherIn) {\n methodName = 'swapETHForExactTokens'\n // (uint amountOut, address[] calldata path, address to, uint deadline)\n args = [amountOut, path, to, deadline]\n value = amountIn\n } else if (etherOut) {\n methodName = 'swapTokensForExactETH'\n // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n args = [amountOut, amountIn, path, to, deadline]\n value = ZERO_HEX\n } else {\n methodName = 'swapTokensForExactTokens'\n // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n args = [amountOut, amountIn, path, to, deadline]\n value = ZERO_HEX\n }\n break\n }\n return {\n methodName,\n args,\n value\n }\n }\n}\n","import { Contract } from '@ethersproject/contracts'\nimport { getNetwork } from '@ethersproject/networks'\nimport { getDefaultProvider } from '@ethersproject/providers'\nimport { TokenAmount } from './entities/fractions/tokenAmount'\nimport { Pair } from './entities/pair'\nimport IUniswapV2Pair from '@uniswap/v2-core/build/IUniswapV2Pair.json'\nimport invariant from 'tiny-invariant'\nimport ERC20 from './abis/ERC20.json'\nimport { ChainId } from './constants'\nimport { Token } from './entities/token'\n\nlet TOKEN_DECIMALS_CACHE: { [chainId: number]: { [address: string]: number } } = {\n [ChainId.MAINNET]: {\n '0x8B8208f94Ef1AA6891463b43D30C351c9466b0f2': 18 // WGRAM\n }\n}\n\n/**\n * Contains methods for constructing instances of pairs and tokens from on-chain data.\n */\nexport abstract class Fetcher {\n /**\n * Cannot be constructed.\n */\n private constructor() {}\n\n /**\n * Fetch information for a given token on the given chain, using the given ethers provider.\n * @param chainId chain of the token\n * @param address address of the token on the chain\n * @param provider provider used to fetch the token\n * @param symbol optional symbol of the token\n * @param name optional name of the token\n */\n public static async fetchTokenData(\n chainId: ChainId,\n address: string,\n provider = getDefaultProvider(getNetwork(chainId)),\n symbol?: string,\n name?: string\n ): Promise {\n const parsedDecimals =\n typeof TOKEN_DECIMALS_CACHE?.[chainId]?.[address] === 'number'\n ? TOKEN_DECIMALS_CACHE[chainId][address]\n : await new Contract(address, ERC20, provider).decimals().then((decimals: number): number => {\n TOKEN_DECIMALS_CACHE = {\n ...TOKEN_DECIMALS_CACHE,\n [chainId]: {\n ...TOKEN_DECIMALS_CACHE?.[chainId],\n [address]: decimals\n }\n }\n return decimals\n })\n return new Token(chainId, address, parsedDecimals, symbol, name)\n }\n\n /**\n * Fetches information about a pair and constructs a pair from the given two tokens.\n * @param tokenA first token\n * @param tokenB second token\n * @param provider the provider to use to fetch the data\n */\n public static async fetchPairData(\n tokenA: Token,\n tokenB: Token,\n provider = getDefaultProvider(getNetwork(tokenA.chainId))\n ): Promise {\n invariant(tokenA.chainId === tokenB.chainId, 'CHAIN_ID')\n const address = Pair.getAddress(tokenA, tokenB)\n const [reserves0, reserves1] = await new Contract(address, IUniswapV2Pair.abi, provider).getReserves()\n const balances = tokenA.sortsBefore(tokenB) ? [reserves0, reserves1] : [reserves1, reserves0]\n return new Pair(new TokenAmount(tokenA, balances[0]), new TokenAmount(tokenB, balances[1]))\n }\n}\n"],"names":["ChainId","TradeType","Rounding","FACTORY_ADDRESS","INIT_CODE_HASH","MINIMUM_LIQUIDITY","JSBI","BigInt","ZERO","ONE","TWO","THREE","FIVE","TEN","_100","_997","_1000","SolidityType","SOLIDITY_TYPE_MAXIMA","uint8","uint256","CAN_SET_PROTOTYPE","Object","InsufficientReservesError","name","constructor","setPrototypeOf","prototype","Error","InsufficientInputAmountError","validateSolidityTypeInstance","value","solidityType","greaterThanOrEqual","invariant","lessThanOrEqual","validateAndParseAddress","address","checksummedAddress","getAddress","warning","error","parseBigintIsh","bigintIsh","toString","sqrt","y","z","x","greaterThan","add","divide","lessThan","notEqual","sortedInsert","items","maxSize","comparator","length","push","isFull","lo","hi","mid","splice","pop","Currency","decimals","symbol","ETHER","Token","chainId","equals","other","sortsBefore","toLowerCase","currencyEquals","currencyA","currencyB","WETH","MAINNET","ROPSTEN","RINKEBY","GÖRLI","KOVAN","TECO","ENGRAM","Decimal","toFormat","_Decimal","Big","_Big","toSignificantRounding","ROUND_DOWN","ROUND_HALF_UP","ROUND_UP","toFixedRounding","Fraction","numerator","denominator","invert","otherParsed","equal","multiply","subtract","equalTo","toSignificant","significantDigits","format","rounding","groupSeparator","Number","isInteger","set","precision","quotient","div","toSignificantDigits","decimalPlaces","toFixed","DP","RM","remainder","CurrencyAmount","currency","amount","parsedAmount","exponentiate","ether","raw","toExact","TokenAmount","token","Price","baseCurrency","quoteCurrency","scalar","fromRoute","route","prices","pairs","entries","i","pair","path","token0","reserve0","reserve1","slice","reduce","accumulator","currentValue","fraction","quote","currencyAmount","adjusted","PAIR_ADDRESS_CACHE","Pair","tokenAmountA","tokenAmountB","tokenAmounts","liquidityToken","tokenA","tokenB","tokens","undefined","getCreate2Address","keccak256","pack","involvesToken","token1","priceOf","token0Price","token1Price","reserveOf","getOutputAmount","inputAmount","inputReserve","outputReserve","inputAmountWithFee","outputAmount","getInputAmount","getLiquidityMinted","totalSupply","liquidity","amount0","amount1","getLiquidityValue","feeOn","kLast","totalSupplyAdjusted","kLastParsed","rootK","rootKLast","feeLiquidity","Route","input","output","every","currentInput","midPrice","_100_PERCENT","Percent","computePriceImpact","exactQuote","slippage","inputOutputComparator","a","b","tradeComparator","ioComp","priceImpact","wrappedAmount","wrappedCurrency","Trade","tradeType","amounts","Array","nextPairs","EXACT_INPUT","nextPair","EXACT_OUTPUT","executionPrice","nextMidPrice","exactIn","amountIn","exactOut","amountOut","minimumAmountOut","slippageTolerance","slippageAdjustedAmountOut","maximumAmountIn","slippageAdjustedAmountIn","bestTradeExactIn","currencyAmountIn","currencyOut","currentPairs","originalAmountIn","bestTrades","maxNumResults","maxHops","tokenOut","isInsufficientInputAmountError","pairsExcludingThisPair","concat","bestTradeExactOut","currencyIn","currencyAmountOut","originalAmountOut","tokenIn","isInsufficientReservesError","toHex","ZERO_HEX","Router","swapCallParameters","trade","options","etherIn","etherOut","ttl","to","recipient","allowedSlippage","map","deadline","Math","floor","Date","getTime","useFeeOnTransfer","Boolean","feeOnTransfer","methodName","args","TOKEN_DECIMALS_CACHE","Fetcher","fetchTokenData","provider","parsedDecimals","getDefaultProvider","getNetwork","Contract","ERC20","then","fetchPairData","IUniswapV2Pair","abi","getReserves","reserves0","reserves1","balances"],"mappings":";;;;;;;;;;;;;;;IAKYA;;AAAZ,WAAYA;AACVA,EAAAA,gCAAA,WAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,gCAAA,aAAA;AACAA,EAAAA,8BAAA,UAAA;AACAA,EAAAA,iCAAA,SAAA;AACD,CARD,EAAYA,OAAO,KAAPA,OAAO,KAAA,CAAnB;;IAUYC;;AAAZ,WAAYA;AACVA,EAAAA,uCAAA,gBAAA;AACAA,EAAAA,wCAAA,iBAAA;AACD,CAHD,EAAYA,SAAS,KAATA,SAAS,KAAA,CAArB;;IAKYC;;AAAZ,WAAYA;AACVA,EAAAA,oCAAA,eAAA;AACAA,EAAAA,uCAAA,kBAAA;AACAA,EAAAA,kCAAA,aAAA;AACD,CAJD,EAAYA,QAAQ,KAARA,QAAQ,KAAA,CAApB;;IAMaC,eAAe,GAAG;;IAElBC,cAAc,GAAG;IAEjBC,iBAAiB,gBAAGC,IAAI,CAACC,MAAL,CAAY,IAAZ;;AAG1B,IAAMC,IAAI,gBAAGF,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAb;AACA,IAAME,GAAG,gBAAGH,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAZ;AACA,IAAMG,GAAG,gBAAGJ,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAZ;AACA,IAAMI,KAAK,gBAAGL,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAd;AACA,IAAMK,IAAI,gBAAGN,IAAI,CAACC,MAAL,CAAY,CAAZ,CAAb;AACA,IAAMM,GAAG,gBAAGP,IA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+M,QAAAA,oBAAoB,gBACfA,oBADe,6BAEjB3M,OAFiB,2CAGb2M,oBAHa,2DAGb,uBAAuB3M,OAAvB,CAHa,6BAIflC,OAJe,IAIL8B,QAJK,0BAApB;AAOA,eAAOA,QAAP;AACD,OATK;AAWb,KAnCH;AAAA;AAAA;AAAA;AAqCE;;;;;;AArCF;;AAAA,UA2CsByN,aA3CtB,0BA4CI1H,MA5CJ,EA6CIC,MA7CJ,EA8CIkH,QA9CJ;AAAA;UA8CIA,wBAAAA,WAAWE,kBAAkB,CAACC,UAAU,CAACtH,MAAM,CAAC3F,OAAR,CAAX;AAE7B,QAAU2F,MAAM,CAAC3F,OAAP,KAAmB4F,MAAM,CAAC5F,OAApC,4CAAArC,SAAS,QAAoC,UAApC,CAAT,GAAAA,SAAS,OAAT;AACA,UAAMG,OAAO,GAAGwH,IAAI,CAACtH,UAAL,CAAgB2H,MAAhB,EAAwBC,MAAxB,CAAhB;6BACqC,IAAIsH,QAAJ,CAAapP,OAAb,EAAsBwP,cAAc,CAACC,GAArC,EAA0CT,QAA1C,EAAoDU,WAApD;YAA9BC;YAAWC;AAClB,YAAMC,QAAQ,GAAGhI,MAAM,CAACxF,WAAP,CAAmByF,MAAnB,IAA6B,CAAC6H,SAAD,EAAYC,SAAZ,CAA7B,GAAsD,CAACA,SAAD,EAAYD,SAAZ,CAAvE;AACA,eAAO,IAAInI,IAAJ,CAAS,IAAI1B,WAAJ,CAAgB+B,MAAhB,EAAwBgI,QAAQ,CAAC,CAAD,CAAhC,CAAT,EAA+C,IAAI/J,WAAJ,CAAgBgC,MAAhB,EAAwB+H,QAAQ,CAAC,CAAD,CAAhC,CAA/C,CAAP;;AACD,KArDH;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;"} \ No newline at end of file diff --git a/dist/test/constants.test.d.ts b/dist/test/constants.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/constants.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/data.test.d.ts b/dist/test/data.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/data.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/entities.test.d.ts b/dist/test/entities.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/entities.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/fraction.test.d.ts b/dist/test/fraction.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/fraction.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/miscellaneous.test.d.ts b/dist/test/miscellaneous.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/miscellaneous.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/pair.test.d.ts b/dist/test/pair.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/pair.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/route.test.d.ts b/dist/test/route.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/route.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/router.test.d.ts b/dist/test/router.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/router.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/token.test.d.ts b/dist/test/token.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/token.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/test/trade.test.d.ts b/dist/test/trade.test.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/dist/test/trade.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/utils.d.ts b/dist/utils.d.ts new file mode 100644 index 0000000..a2773af --- /dev/null +++ b/dist/utils.d.ts @@ -0,0 +1,7 @@ +import JSBI from 'jsbi'; +import { BigintIsh, SolidityType } from './constants'; +export declare function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void; +export declare function validateAndParseAddress(address: string): string; +export declare function parseBigintIsh(bigintIsh: BigintIsh): JSBI; +export declare function sqrt(y: JSBI): JSBI; +export declare function sortedInsert(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null; diff --git a/package.json b/package.json new file mode 100644 index 0000000..d080ac3 --- /dev/null +++ b/package.json @@ -0,0 +1,59 @@ +{ + "name": "@engramnetwork/sdk", + "license": "MIT", + "version": "3.0.3", + "description": "🛠 An SDK for building applications Lyzo Swap.", + "main": "dist/index.js", + "typings": "dist/index.d.ts", + "files": [ + "dist" + ], + "repository": "https://github.com/Uniswap/uniswap-sdk.git", + "keywords": [ + "uniswap", + "ethereum" + ], + "module": "dist/sdk.esm.js", + "scripts": { + "lint": "tsdx lint src test", + "build": "tsdx build", + "start": "tsdx watch", + "test": "tsdx test", + "prepublishOnly": "tsdx build" + }, + "dependencies": { + "@uniswap/v2-core": "^1.0.0", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.1", + "tiny-invariant": "^1.1.0", + "tiny-warning": "^1.0.3", + "toformat": "^2.0.0" + }, + "peerDependencies": { + "@ethersproject/address": "^5.0.0-beta", + "@ethersproject/contracts": "^5.0.0-beta", + "@ethersproject/networks": "^5.0.0-beta", + "@ethersproject/providers": "^5.0.0-beta", + "@ethersproject/solidity": "^5.0.0-beta" + }, + "devDependencies": { + "@ethersproject/address": "^5.0.2", + "@ethersproject/contracts": "^5.0.2", + "@ethersproject/networks": "^5.0.2", + "@ethersproject/providers": "^5.0.5", + "@ethersproject/solidity": "^5.0.2", + "@types/big.js": "^4.0.5", + "@types/jest": "^24.0.25", + "babel-plugin-transform-jsbi-to-bigint": "^1.3.1", + "tsdx": "^0.12.3" + }, + "engines": { + "node": ">=10" + }, + "prettier": { + "printWidth": 120, + "semi": false, + "singleQuote": true + } +} diff --git a/src/abis/ERC20.json b/src/abis/ERC20.json new file mode 100644 index 0000000..e8a2da6 --- /dev/null +++ b/src/abis/ERC20.json @@ -0,0 +1,20 @@ +[ + { + "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" + } +] diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..0d25dce --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,52 @@ +import JSBI from 'jsbi' + +// exports for external consumption +export type BigintIsh = JSBI | bigint | string + +export enum ChainId { + ENGRAM = 131, + MAINNET = 1, + ROPSTEN = 3, + RINKEBY = 4, + GÖRLI = 5, + KOVAN = 42, + TECO = 188355 +} + +export enum TradeType { + EXACT_INPUT, + EXACT_OUTPUT +} + +export enum Rounding { + ROUND_DOWN, + ROUND_HALF_UP, + ROUND_UP +} + +export const FACTORY_ADDRESS = '0x548C67Cbd80e8018b9792caeA0314569505F06B9' // need change + +export const INIT_CODE_HASH = '0x8ce6b67d11dffc78178e3df9094bcbef2889085d183a3076b2fdfd68db8aa2b4' + +export const MINIMUM_LIQUIDITY = JSBI.BigInt(1000) + +// exports for internal consumption +export const ZERO = JSBI.BigInt(0) +export const ONE = JSBI.BigInt(1) +export const TWO = JSBI.BigInt(2) +export const THREE = JSBI.BigInt(3) +export const FIVE = JSBI.BigInt(5) +export const TEN = JSBI.BigInt(10) +export const _100 = JSBI.BigInt(100) +export const _997 = JSBI.BigInt(997) +export const _1000 = JSBI.BigInt(1000) + +export enum SolidityType { + uint8 = 'uint8', + uint256 = 'uint256' +} + +export const SOLIDITY_TYPE_MAXIMA = { + [SolidityType.uint8]: JSBI.BigInt('0xff'), + [SolidityType.uint256]: JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff') +} diff --git a/src/declarations.d.ts b/src/declarations.d.ts new file mode 100644 index 0000000..a5a6803 --- /dev/null +++ b/src/declarations.d.ts @@ -0,0 +1 @@ +declare module 'toformat' diff --git a/src/entities/currency.ts b/src/entities/currency.ts new file mode 100644 index 0000000..22d873e --- /dev/null +++ b/src/entities/currency.ts @@ -0,0 +1,37 @@ +import JSBI from 'jsbi' + +import { SolidityType } from '../constants' +import { validateSolidityTypeInstance } from '../utils' + +/** + * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens. + * + * The only instance of the base class `Currency` is Ether. + */ +export class Currency { + public readonly decimals: number + public readonly symbol?: string + public readonly name?: string + + /** + * The only instance of the base class `Currency`. + */ + public static readonly ETHER: Currency = new Currency(18, 'ETH', 'Ether') + + /** + * Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`. + * @param decimals decimals of the currency + * @param symbol symbol of the currency + * @param name of the currency + */ + protected constructor(decimals: number, symbol?: string, name?: string) { + validateSolidityTypeInstance(JSBI.BigInt(decimals), SolidityType.uint8) + + this.decimals = decimals + this.symbol = symbol + this.name = name + } +} + +const ETHER = Currency.ETHER +export { ETHER } diff --git a/src/entities/fractions/currencyAmount.ts b/src/entities/fractions/currencyAmount.ts new file mode 100644 index 0000000..a911c03 --- /dev/null +++ b/src/entities/fractions/currencyAmount.ts @@ -0,0 +1,69 @@ +import { currencyEquals } from '../token' +import { Currency, ETHER } from '../currency' +import invariant from 'tiny-invariant' +import JSBI from 'jsbi' +import _Big from 'big.js' +import toFormat from 'toformat' + +import { BigintIsh, Rounding, TEN, SolidityType } from '../../constants' +import { parseBigintIsh, validateSolidityTypeInstance } from '../../utils' +import { Fraction } from './fraction' + +const Big = toFormat(_Big) + +export class CurrencyAmount extends Fraction { + public readonly currency: Currency + + /** + * Helper that calls the constructor with the ETHER currency + * @param amount ether amount in wei + */ + public static ether(amount: BigintIsh): CurrencyAmount { + return new CurrencyAmount(ETHER, amount) + } + + // amount _must_ be raw, i.e. in the native representation + protected constructor(currency: Currency, amount: BigintIsh) { + const parsedAmount = parseBigintIsh(amount) + validateSolidityTypeInstance(parsedAmount, SolidityType.uint256) + + super(parsedAmount, JSBI.exponentiate(TEN, JSBI.BigInt(currency.decimals))) + this.currency = currency + } + + public get raw(): JSBI { + return this.numerator + } + + public add(other: CurrencyAmount): CurrencyAmount { + invariant(currencyEquals(this.currency, other.currency), 'TOKEN') + return new CurrencyAmount(this.currency, JSBI.add(this.raw, other.raw)) + } + + public subtract(other: CurrencyAmount): CurrencyAmount { + invariant(currencyEquals(this.currency, other.currency), 'TOKEN') + return new CurrencyAmount(this.currency, JSBI.subtract(this.raw, other.raw)) + } + + public toSignificant( + significantDigits: number = 6, + format?: object, + rounding: Rounding = Rounding.ROUND_DOWN + ): string { + return super.toSignificant(significantDigits, format, rounding) + } + + public toFixed( + decimalPlaces: number = this.currency.decimals, + format?: object, + rounding: Rounding = Rounding.ROUND_DOWN + ): string { + invariant(decimalPlaces <= this.currency.decimals, 'DECIMALS') + return super.toFixed(decimalPlaces, format, rounding) + } + + public toExact(format: object = { groupSeparator: '' }): string { + Big.DP = this.currency.decimals + return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(format) + } +} diff --git a/src/entities/fractions/fraction.ts b/src/entities/fractions/fraction.ts new file mode 100644 index 0000000..eab7ae4 --- /dev/null +++ b/src/entities/fractions/fraction.ts @@ -0,0 +1,144 @@ +import invariant from 'tiny-invariant' +import JSBI from 'jsbi' +import _Decimal from 'decimal.js-light' +import _Big, { RoundingMode } from 'big.js' +import toFormat from 'toformat' + +import { BigintIsh, Rounding } from '../../constants' +import { ONE } from '../../constants' +import { parseBigintIsh } from '../../utils' + +const Decimal = toFormat(_Decimal) +const Big = toFormat(_Big) + +const toSignificantRounding = { + [Rounding.ROUND_DOWN]: Decimal.ROUND_DOWN, + [Rounding.ROUND_HALF_UP]: Decimal.ROUND_HALF_UP, + [Rounding.ROUND_UP]: Decimal.ROUND_UP +} + +const toFixedRounding = { + [Rounding.ROUND_DOWN]: RoundingMode.RoundDown, + [Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp, + [Rounding.ROUND_UP]: RoundingMode.RoundUp +} + +export class Fraction { + public readonly numerator: JSBI + public readonly denominator: JSBI + + public constructor(numerator: BigintIsh, denominator: BigintIsh = ONE) { + this.numerator = parseBigintIsh(numerator) + this.denominator = parseBigintIsh(denominator) + } + + // performs floor division + public get quotient(): JSBI { + return JSBI.divide(this.numerator, this.denominator) + } + + // remainder after floor division + public get remainder(): Fraction { + return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator) + } + + public invert(): Fraction { + return new Fraction(this.denominator, this.numerator) + } + + public add(other: Fraction | BigintIsh): Fraction { + const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)) + if (JSBI.equal(this.denominator, otherParsed.denominator)) { + return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator) + } + return new Fraction( + JSBI.add( + JSBI.multiply(this.numerator, otherParsed.denominator), + JSBI.multiply(otherParsed.numerator, this.denominator) + ), + JSBI.multiply(this.denominator, otherParsed.denominator) + ) + } + + public subtract(other: Fraction | BigintIsh): Fraction { + const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)) + if (JSBI.equal(this.denominator, otherParsed.denominator)) { + return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator) + } + return new Fraction( + JSBI.subtract( + JSBI.multiply(this.numerator, otherParsed.denominator), + JSBI.multiply(otherParsed.numerator, this.denominator) + ), + JSBI.multiply(this.denominator, otherParsed.denominator) + ) + } + + public lessThan(other: Fraction | BigintIsh): boolean { + const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)) + return JSBI.lessThan( + JSBI.multiply(this.numerator, otherParsed.denominator), + JSBI.multiply(otherParsed.numerator, this.denominator) + ) + } + + public equalTo(other: Fraction | BigintIsh): boolean { + const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)) + return JSBI.equal( + JSBI.multiply(this.numerator, otherParsed.denominator), + JSBI.multiply(otherParsed.numerator, this.denominator) + ) + } + + public greaterThan(other: Fraction | BigintIsh): boolean { + const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)) + return JSBI.greaterThan( + JSBI.multiply(this.numerator, otherParsed.denominator), + JSBI.multiply(otherParsed.numerator, this.denominator) + ) + } + + public multiply(other: Fraction | BigintIsh): Fraction { + const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)) + return new Fraction( + JSBI.multiply(this.numerator, otherParsed.numerator), + JSBI.multiply(this.denominator, otherParsed.denominator) + ) + } + + public divide(other: Fraction | BigintIsh): Fraction { + const otherParsed = other instanceof Fraction ? other : new Fraction(parseBigintIsh(other)) + return new Fraction( + JSBI.multiply(this.numerator, otherParsed.denominator), + JSBI.multiply(this.denominator, otherParsed.numerator) + ) + } + + public toSignificant( + significantDigits: number, + format: object = { groupSeparator: '' }, + rounding: Rounding = Rounding.ROUND_HALF_UP + ): string { + invariant(Number.isInteger(significantDigits), `${significantDigits} is not an integer.`) + invariant(significantDigits > 0, `${significantDigits} is not positive.`) + + Decimal.set({ precision: significantDigits + 1, rounding: toSignificantRounding[rounding] }) + const quotient = new Decimal(this.numerator.toString()) + .div(this.denominator.toString()) + .toSignificantDigits(significantDigits) + return quotient.toFormat(quotient.decimalPlaces(), format) + } + + public toFixed( + decimalPlaces: number, + format: object = { groupSeparator: '' }, + rounding: Rounding = Rounding.ROUND_HALF_UP + ): string { + invariant(Number.isInteger(decimalPlaces), `${decimalPlaces} is not an integer.`) + invariant(decimalPlaces >= 0, `${decimalPlaces} is negative.`) + + Big.DP = decimalPlaces + Big.RM = toFixedRounding[rounding] + return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format) + } +} diff --git a/src/entities/fractions/index.ts b/src/entities/fractions/index.ts new file mode 100644 index 0000000..6a7689d --- /dev/null +++ b/src/entities/fractions/index.ts @@ -0,0 +1,5 @@ +export * from './fraction' +export * from './percent' +export * from './tokenAmount' +export * from './currencyAmount' +export * from './price' diff --git a/src/entities/fractions/percent.ts b/src/entities/fractions/percent.ts new file mode 100644 index 0000000..092e7aa --- /dev/null +++ b/src/entities/fractions/percent.ts @@ -0,0 +1,14 @@ +import { Rounding, _100 } from '../../constants' +import { Fraction } from './fraction' + +const _100_PERCENT = new Fraction(_100) + +export class Percent extends Fraction { + public toSignificant(significantDigits: number = 5, format?: object, rounding?: Rounding): string { + return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding) + } + + public toFixed(decimalPlaces: number = 2, format?: object, rounding?: Rounding): string { + return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding) + } +} diff --git a/src/entities/fractions/price.ts b/src/entities/fractions/price.ts new file mode 100644 index 0000000..87a5db5 --- /dev/null +++ b/src/entities/fractions/price.ts @@ -0,0 +1,76 @@ +import { Token } from '../token' +import { TokenAmount } from './tokenAmount' +import { currencyEquals } from '../token' +import invariant from 'tiny-invariant' +import JSBI from 'jsbi' + +import { BigintIsh, Rounding, TEN } from '../../constants' +import { Currency } from '../currency' +import { Route } from '../route' +import { Fraction } from './fraction' +import { CurrencyAmount } from './currencyAmount' + +export class Price extends Fraction { + public readonly baseCurrency: Currency // input i.e. denominator + public readonly quoteCurrency: Currency // output i.e. numerator + public readonly scalar: Fraction // used to adjust the raw fraction w/r/t the decimals of the {base,quote}Token + + public static fromRoute(route: Route): Price { + const prices: Price[] = [] + for (const [i, pair] of route.pairs.entries()) { + prices.push( + route.path[i].equals(pair.token0) + ? new Price(pair.reserve0.currency, pair.reserve1.currency, pair.reserve0.raw, pair.reserve1.raw) + : new Price(pair.reserve1.currency, pair.reserve0.currency, pair.reserve1.raw, pair.reserve0.raw) + ) + } + return prices.slice(1).reduce((accumulator, currentValue) => accumulator.multiply(currentValue), prices[0]) + } + + // denominator and numerator _must_ be raw, i.e. in the native representation + public constructor(baseCurrency: Currency, quoteCurrency: Currency, denominator: BigintIsh, numerator: BigintIsh) { + super(numerator, denominator) + + this.baseCurrency = baseCurrency + this.quoteCurrency = quoteCurrency + this.scalar = new Fraction( + JSBI.exponentiate(TEN, JSBI.BigInt(baseCurrency.decimals)), + JSBI.exponentiate(TEN, JSBI.BigInt(quoteCurrency.decimals)) + ) + } + + public get raw(): Fraction { + return new Fraction(this.numerator, this.denominator) + } + + public get adjusted(): Fraction { + return super.multiply(this.scalar) + } + + public invert(): Price { + return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator) + } + + public multiply(other: Price): Price { + invariant(currencyEquals(this.quoteCurrency, other.baseCurrency), 'TOKEN') + const fraction = super.multiply(other) + return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator) + } + + // performs floor division on overflow + public quote(currencyAmount: CurrencyAmount): CurrencyAmount { + invariant(currencyEquals(currencyAmount.currency, this.baseCurrency), 'TOKEN') + if (this.quoteCurrency instanceof Token) { + return new TokenAmount(this.quoteCurrency, super.multiply(currencyAmount.raw).quotient) + } + return CurrencyAmount.ether(super.multiply(currencyAmount.raw).quotient) + } + + public toSignificant(significantDigits: number = 6, format?: object, rounding?: Rounding): string { + return this.adjusted.toSignificant(significantDigits, format, rounding) + } + + public toFixed(decimalPlaces: number = 4, format?: object, rounding?: Rounding): string { + return this.adjusted.toFixed(decimalPlaces, format, rounding) + } +} diff --git a/src/entities/fractions/tokenAmount.ts b/src/entities/fractions/tokenAmount.ts new file mode 100644 index 0000000..96eba7f --- /dev/null +++ b/src/entities/fractions/tokenAmount.ts @@ -0,0 +1,26 @@ +import { CurrencyAmount } from './currencyAmount' +import { Token } from '../token' +import invariant from 'tiny-invariant' +import JSBI from 'jsbi' + +import { BigintIsh } from '../../constants' + +export class TokenAmount extends CurrencyAmount { + public readonly token: Token + + // amount _must_ be raw, i.e. in the native representation + public constructor(token: Token, amount: BigintIsh) { + super(token, amount) + this.token = token + } + + public add(other: TokenAmount): TokenAmount { + invariant(this.token.equals(other.token), 'TOKEN') + return new TokenAmount(this.token, JSBI.add(this.raw, other.raw)) + } + + public subtract(other: TokenAmount): TokenAmount { + invariant(this.token.equals(other.token), 'TOKEN') + return new TokenAmount(this.token, JSBI.subtract(this.raw, other.raw)) + } +} diff --git a/src/entities/index.ts b/src/entities/index.ts new file mode 100644 index 0000000..c217ba5 --- /dev/null +++ b/src/entities/index.ts @@ -0,0 +1,7 @@ +export * from './token' +export * from './pair' +export * from './route' +export * from './trade' +export * from './currency' + +export * from './fractions' diff --git a/src/entities/pair.ts b/src/entities/pair.ts new file mode 100644 index 0000000..564e343 --- /dev/null +++ b/src/entities/pair.ts @@ -0,0 +1,228 @@ +import { Price } from './fractions/price' +import { TokenAmount } from './fractions/tokenAmount' +import invariant from 'tiny-invariant' +import JSBI from 'jsbi' +import { pack, keccak256 } from '@ethersproject/solidity' +import { getCreate2Address } from '@ethersproject/address' + +import { + BigintIsh, + FACTORY_ADDRESS, + INIT_CODE_HASH, + MINIMUM_LIQUIDITY, + ZERO, + ONE, + FIVE, + _997, + _1000, + ChainId +} from '../constants' +import { sqrt, parseBigintIsh } from '../utils' +import { InsufficientReservesError, InsufficientInputAmountError } from '../errors' +import { Token } from './token' + +let PAIR_ADDRESS_CACHE: { [token0Address: string]: { [token1Address: string]: string } } = {} + +export class Pair { + public readonly liquidityToken: Token + private readonly tokenAmounts: [TokenAmount, TokenAmount] + + public static getAddress(tokenA: Token, tokenB: Token): string { + const tokens = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA] // does safety checks + + if (PAIR_ADDRESS_CACHE?.[tokens[0].address]?.[tokens[1].address] === undefined) { + PAIR_ADDRESS_CACHE = { + ...PAIR_ADDRESS_CACHE, + [tokens[0].address]: { + ...PAIR_ADDRESS_CACHE?.[tokens[0].address], + [tokens[1].address]: getCreate2Address( + FACTORY_ADDRESS, + keccak256(['bytes'], [pack(['address', 'address'], [tokens[0].address, tokens[1].address])]), + INIT_CODE_HASH + ) + } + } + } + + return PAIR_ADDRESS_CACHE[tokens[0].address][tokens[1].address] + } + + public constructor(tokenAmountA: TokenAmount, tokenAmountB: TokenAmount) { + const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks + ? [tokenAmountA, tokenAmountB] + : [tokenAmountB, tokenAmountA] + this.liquidityToken = new Token( + tokenAmounts[0].token.chainId, + Pair.getAddress(tokenAmounts[0].token, tokenAmounts[1].token), + 18, + 'UNI-V2', + 'Uniswap V2' + ) + this.tokenAmounts = tokenAmounts as [TokenAmount, TokenAmount] + } + + /** + * Returns true if the token is either token0 or token1 + * @param token to check + */ + public involvesToken(token: Token): boolean { + return token.equals(this.token0) || token.equals(this.token1) + } + + /** + * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0 + */ + public get token0Price(): Price { + return new Price(this.token0, this.token1, this.tokenAmounts[0].raw, this.tokenAmounts[1].raw) + } + + /** + * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1 + */ + public get token1Price(): Price { + return new Price(this.token1, this.token0, this.tokenAmounts[1].raw, this.tokenAmounts[0].raw) + } + + /** + * Return the price of the given token in terms of the other token in the pair. + * @param token token to return price of + */ + public priceOf(token: Token): Price { + invariant(this.involvesToken(token), 'TOKEN') + return token.equals(this.token0) ? this.token0Price : this.token1Price + } + + /** + * Returns the chain ID of the tokens in the pair. + */ + public get chainId(): ChainId { + return this.token0.chainId + } + + public get token0(): Token { + return this.tokenAmounts[0].token + } + + public get token1(): Token { + return this.tokenAmounts[1].token + } + + public get reserve0(): TokenAmount { + return this.tokenAmounts[0] + } + + public get reserve1(): TokenAmount { + return this.tokenAmounts[1] + } + + public reserveOf(token: Token): TokenAmount { + invariant(this.involvesToken(token), 'TOKEN') + return token.equals(this.token0) ? this.reserve0 : this.reserve1 + } + + public getOutputAmount(inputAmount: TokenAmount): [TokenAmount, Pair] { + invariant(this.involvesToken(inputAmount.token), 'TOKEN') + if (JSBI.equal(this.reserve0.raw, ZERO) || JSBI.equal(this.reserve1.raw, ZERO)) { + throw new InsufficientReservesError() + } + const inputReserve = this.reserveOf(inputAmount.token) + const outputReserve = this.reserveOf(inputAmount.token.equals(this.token0) ? this.token1 : this.token0) + const inputAmountWithFee = JSBI.multiply(inputAmount.raw, _997) + const numerator = JSBI.multiply(inputAmountWithFee, outputReserve.raw) + const denominator = JSBI.add(JSBI.multiply(inputReserve.raw, _1000), inputAmountWithFee) + const outputAmount = new TokenAmount( + inputAmount.token.equals(this.token0) ? this.token1 : this.token0, + JSBI.divide(numerator, denominator) + ) + if (JSBI.equal(outputAmount.raw, ZERO)) { + throw new InsufficientInputAmountError() + } + return [outputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))] + } + + public getInputAmount(outputAmount: TokenAmount): [TokenAmount, Pair] { + invariant(this.involvesToken(outputAmount.token), 'TOKEN') + if ( + JSBI.equal(this.reserve0.raw, ZERO) || + JSBI.equal(this.reserve1.raw, ZERO) || + JSBI.greaterThanOrEqual(outputAmount.raw, this.reserveOf(outputAmount.token).raw) + ) { + throw new InsufficientReservesError() + } + + const outputReserve = this.reserveOf(outputAmount.token) + const inputReserve = this.reserveOf(outputAmount.token.equals(this.token0) ? this.token1 : this.token0) + const numerator = JSBI.multiply(JSBI.multiply(inputReserve.raw, outputAmount.raw), _1000) + const denominator = JSBI.multiply(JSBI.subtract(outputReserve.raw, outputAmount.raw), _997) + const inputAmount = new TokenAmount( + outputAmount.token.equals(this.token0) ? this.token1 : this.token0, + JSBI.add(JSBI.divide(numerator, denominator), ONE) + ) + return [inputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount))] + } + + public getLiquidityMinted( + totalSupply: TokenAmount, + tokenAmountA: TokenAmount, + tokenAmountB: TokenAmount + ): TokenAmount { + invariant(totalSupply.token.equals(this.liquidityToken), 'LIQUIDITY') + const tokenAmounts = tokenAmountA.token.sortsBefore(tokenAmountB.token) // does safety checks + ? [tokenAmountA, tokenAmountB] + : [tokenAmountB, tokenAmountA] + invariant(tokenAmounts[0].token.equals(this.token0) && tokenAmounts[1].token.equals(this.token1), 'TOKEN') + + let liquidity: JSBI + if (JSBI.equal(totalSupply.raw, ZERO)) { + liquidity = JSBI.subtract(sqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY) + } else { + const amount0 = JSBI.divide(JSBI.multiply(tokenAmounts[0].raw, totalSupply.raw), this.reserve0.raw) + const amount1 = JSBI.divide(JSBI.multiply(tokenAmounts[1].raw, totalSupply.raw), this.reserve1.raw) + liquidity = JSBI.lessThanOrEqual(amount0, amount1) ? amount0 : amount1 + } + if (!JSBI.greaterThan(liquidity, ZERO)) { + throw new InsufficientInputAmountError() + } + return new TokenAmount(this.liquidityToken, liquidity) + } + + public getLiquidityValue( + token: Token, + totalSupply: TokenAmount, + liquidity: TokenAmount, + feeOn: boolean = false, + kLast?: BigintIsh + ): TokenAmount { + invariant(this.involvesToken(token), 'TOKEN') + invariant(totalSupply.token.equals(this.liquidityToken), 'TOTAL_SUPPLY') + invariant(liquidity.token.equals(this.liquidityToken), 'LIQUIDITY') + invariant(JSBI.lessThanOrEqual(liquidity.raw, totalSupply.raw), 'LIQUIDITY') + + let totalSupplyAdjusted: TokenAmount + if (!feeOn) { + totalSupplyAdjusted = totalSupply + } else { + invariant(!!kLast, 'K_LAST') + const kLastParsed = parseBigintIsh(kLast) + if (!JSBI.equal(kLastParsed, ZERO)) { + const rootK = sqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw)) + const rootKLast = sqrt(kLastParsed) + if (JSBI.greaterThan(rootK, rootKLast)) { + const numerator = JSBI.multiply(totalSupply.raw, JSBI.subtract(rootK, rootKLast)) + const denominator = JSBI.add(JSBI.multiply(rootK, FIVE), rootKLast) + const feeLiquidity = JSBI.divide(numerator, denominator) + totalSupplyAdjusted = totalSupply.add(new TokenAmount(this.liquidityToken, feeLiquidity)) + } else { + totalSupplyAdjusted = totalSupply + } + } else { + totalSupplyAdjusted = totalSupply + } + } + + return new TokenAmount( + token, + JSBI.divide(JSBI.multiply(liquidity.raw, this.reserveOf(token).raw), totalSupplyAdjusted.raw) + ) + } +} diff --git a/src/entities/route.ts b/src/entities/route.ts new file mode 100644 index 0000000..6aa8e6a --- /dev/null +++ b/src/entities/route.ts @@ -0,0 +1,52 @@ +import { ChainId } from '../constants' +import invariant from 'tiny-invariant' + +import { Currency, ETHER } from './currency' +import { Token, WETH } from './token' +import { Pair } from './pair' +import { Price } from './fractions/price' + +export class Route { + public readonly pairs: Pair[] + public readonly path: Token[] + public readonly input: Currency + public readonly output: Currency + public readonly midPrice: Price + + public constructor(pairs: Pair[], input: Currency, output?: Currency) { + invariant(pairs.length > 0, 'PAIRS') + invariant( + pairs.every(pair => pair.chainId === pairs[0].chainId), + 'CHAIN_IDS' + ) + invariant( + (input instanceof Token && pairs[0].involvesToken(input)) || + (input === ETHER && pairs[0].involvesToken(WETH[pairs[0].chainId])), + 'INPUT' + ) + invariant( + typeof output === 'undefined' || + (output instanceof Token && pairs[pairs.length - 1].involvesToken(output)) || + (output === ETHER && pairs[pairs.length - 1].involvesToken(WETH[pairs[0].chainId])), + 'OUTPUT' + ) + + const path: Token[] = [input instanceof Token ? input : WETH[pairs[0].chainId]] + for (const [i, pair] of pairs.entries()) { + const currentInput = path[i] + invariant(currentInput.equals(pair.token0) || currentInput.equals(pair.token1), 'PATH') + const output = currentInput.equals(pair.token0) ? pair.token1 : pair.token0 + path.push(output) + } + + this.pairs = pairs + this.path = path + this.midPrice = Price.fromRoute(this) + this.input = input + this.output = output ?? path[path.length - 1] + } + + public get chainId(): ChainId { + return this.pairs[0].chainId + } +} diff --git a/src/entities/token.ts b/src/entities/token.ts new file mode 100644 index 0000000..7751927 --- /dev/null +++ b/src/entities/token.ts @@ -0,0 +1,85 @@ +import invariant from 'tiny-invariant' +import { ChainId } from '../constants' +import { validateAndParseAddress } from '../utils' +import { Currency } from './currency' + +/** + * Represents an ERC20 token with a unique address and some metadata. + */ +export class Token extends Currency { + public readonly chainId: ChainId + public readonly address: string + + public constructor(chainId: ChainId, address: string, decimals: number, symbol?: string, name?: string) { + super(decimals, symbol, name) + this.chainId = chainId + this.address = validateAndParseAddress(address) + } + + /** + * Returns true if the two tokens are equivalent, i.e. have the same chainId and address. + * @param other other token to compare + */ + public equals(other: Token): boolean { + // short circuit on reference equality + if (this === other) { + return true + } + return this.chainId === other.chainId && this.address === other.address + } + + /** + * Returns true if the address of this token sorts before the address of the other token + * @param other other token to compare + * @throws if the tokens have the same address + * @throws if the tokens are on different chains + */ + public sortsBefore(other: Token): boolean { + invariant(this.chainId === other.chainId, 'CHAIN_IDS') + invariant(this.address !== other.address, 'ADDRESSES') + return this.address.toLowerCase() < other.address.toLowerCase() + } +} + +/** + * Compares two currencies for equality + */ +export function currencyEquals(currencyA: Currency, currencyB: Currency): boolean { + if (currencyA instanceof Token && currencyB instanceof Token) { + return currencyA.equals(currencyB) + } else if (currencyA instanceof Token) { + return false + } else if (currencyB instanceof Token) { + return false + } else { + return currencyA === currencyB + } +} + +export const WETH = { + [ChainId.MAINNET]: new Token( + ChainId.MAINNET, + '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + 18, + 'WETH', + 'Wrapped Ether' + ), + [ChainId.ROPSTEN]: new Token( + ChainId.ROPSTEN, + '0xc778417E063141139Fce010982780140Aa0cD5Ab', + 18, + 'WETH', + 'Wrapped Ether' + ), + [ChainId.RINKEBY]: new Token( + ChainId.RINKEBY, + '0xc778417E063141139Fce010982780140Aa0cD5Ab', + 18, + 'WETH', + 'Wrapped Ether' + ), + [ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'), + [ChainId.KOVAN]: new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'), + [ChainId.TECO]: new Token(ChainId.TECO, '0x65A98D861a1E8e9E1404EF5d19C24a70e022B935', 18, 'WETH', 'Wrapped Ether'), + [ChainId.ENGRAM]: new Token(ChainId.ENGRAM, '0x7E3e3C50927F78ce0D2a1699d15d342c976A49B0', 18, 'WETH', 'Wrapped Ether') // need change +} diff --git a/src/entities/trade.ts b/src/entities/trade.ts new file mode 100644 index 0000000..8eb3139 --- /dev/null +++ b/src/entities/trade.ts @@ -0,0 +1,410 @@ +import invariant from 'tiny-invariant' + +import { ChainId, ONE, TradeType, ZERO } from '../constants' +import { sortedInsert } from '../utils' +import { Currency, ETHER } from './currency' +import { CurrencyAmount } from './fractions/currencyAmount' +import { Fraction } from './fractions/fraction' +import { Percent } from './fractions/percent' +import { Price } from './fractions/price' +import { TokenAmount } from './fractions/tokenAmount' +import { Pair } from './pair' +import { Route } from './route' +import { currencyEquals, Token, WETH } from './token' + +/** + * Returns the percent difference between the mid price and the execution price, i.e. price impact. + * @param midPrice mid price before the trade + * @param inputAmount the input amount of the trade + * @param outputAmount the output amount of the trade + */ +function computePriceImpact(midPrice: Price, inputAmount: CurrencyAmount, outputAmount: CurrencyAmount): Percent { + const exactQuote = midPrice.raw.multiply(inputAmount.raw) + // calculate slippage := (exactQuote - outputAmount) / exactQuote + const slippage = exactQuote.subtract(outputAmount.raw).divide(exactQuote) + return new Percent(slippage.numerator, slippage.denominator) +} + +// minimal interface so the input output comparator may be shared across types +interface InputOutput { + readonly inputAmount: CurrencyAmount + readonly outputAmount: CurrencyAmount +} + +// comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts +// in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first +export function inputOutputComparator(a: InputOutput, b: InputOutput): number { + // must have same input and output token for comparison + invariant(currencyEquals(a.inputAmount.currency, b.inputAmount.currency), 'INPUT_CURRENCY') + invariant(currencyEquals(a.outputAmount.currency, b.outputAmount.currency), 'OUTPUT_CURRENCY') + if (a.outputAmount.equalTo(b.outputAmount)) { + if (a.inputAmount.equalTo(b.inputAmount)) { + return 0 + } + // trade A requires less input than trade B, so A should come first + if (a.inputAmount.lessThan(b.inputAmount)) { + return -1 + } else { + return 1 + } + } else { + // tradeA has less output than trade B, so should come second + if (a.outputAmount.lessThan(b.outputAmount)) { + return 1 + } else { + return -1 + } + } +} + +// extension of the input output comparator that also considers other dimensions of the trade in ranking them +export function tradeComparator(a: Trade, b: Trade) { + const ioComp = inputOutputComparator(a, b) + if (ioComp !== 0) { + return ioComp + } + + // consider lowest slippage next, since these are less likely to fail + if (a.priceImpact.lessThan(b.priceImpact)) { + return -1 + } else if (a.priceImpact.greaterThan(b.priceImpact)) { + return 1 + } + + // finally consider the number of hops since each hop costs gas + return a.route.path.length - b.route.path.length +} + +export interface BestTradeOptions { + // how many results to return + maxNumResults?: number + // the maximum number of hops a trade should contain + maxHops?: number +} + +/** + * Given a currency amount and a chain ID, returns the equivalent representation as the token amount. + * In other words, if the currency is ETHER, returns the WETH token amount for the given chain. Otherwise, returns + * the input currency amount. + */ +function wrappedAmount(currencyAmount: CurrencyAmount, chainId: ChainId): TokenAmount { + if (currencyAmount instanceof TokenAmount) return currencyAmount + if (currencyAmount.currency === ETHER) return new TokenAmount(WETH[chainId], currencyAmount.raw) + invariant(false, 'CURRENCY') +} + +function wrappedCurrency(currency: Currency, chainId: ChainId): Token { + if (currency instanceof Token) return currency + if (currency === ETHER) return WETH[chainId] + invariant(false, 'CURRENCY') +} + +/** + * Represents a trade executed against a list of pairs. + * Does not account for slippage, i.e. trades that front run this trade and move the price. + */ +export class Trade { + /** + * The route of the trade, i.e. which pairs the trade goes through. + */ + public readonly route: Route + /** + * The type of the trade, either exact in or exact out. + */ + public readonly tradeType: TradeType + /** + * The input amount for the trade assuming no slippage. + */ + public readonly inputAmount: CurrencyAmount + /** + * The output amount for the trade assuming no slippage. + */ + public readonly outputAmount: CurrencyAmount + /** + * The price expressed in terms of output amount/input amount. + */ + public readonly executionPrice: Price + /** + * The mid price after the trade executes assuming no slippage. + */ + public readonly nextMidPrice: Price + /** + * The percent difference between the mid price before the trade and the trade execution price. + */ + public readonly priceImpact: Percent + + /** + * Constructs an exact in trade with the given amount in and route + * @param route route of the exact in trade + * @param amountIn the amount being passed in + */ + public static exactIn(route: Route, amountIn: CurrencyAmount): Trade { + return new Trade(route, amountIn, TradeType.EXACT_INPUT) + } + + /** + * Constructs an exact out trade with the given amount out and route + * @param route route of the exact out trade + * @param amountOut the amount returned by the trade + */ + public static exactOut(route: Route, amountOut: CurrencyAmount): Trade { + return new Trade(route, amountOut, TradeType.EXACT_OUTPUT) + } + + public constructor(route: Route, amount: CurrencyAmount, tradeType: TradeType) { + const amounts: TokenAmount[] = new Array(route.path.length) + const nextPairs: Pair[] = new Array(route.pairs.length) + if (tradeType === TradeType.EXACT_INPUT) { + invariant(currencyEquals(amount.currency, route.input), 'INPUT') + amounts[0] = wrappedAmount(amount, route.chainId) + for (let i = 0; i < route.path.length - 1; i++) { + const pair = route.pairs[i] + const [outputAmount, nextPair] = pair.getOutputAmount(amounts[i]) + amounts[i + 1] = outputAmount + nextPairs[i] = nextPair + } + } else { + invariant(currencyEquals(amount.currency, route.output), 'OUTPUT') + amounts[amounts.length - 1] = wrappedAmount(amount, route.chainId) + for (let i = route.path.length - 1; i > 0; i--) { + const pair = route.pairs[i - 1] + const [inputAmount, nextPair] = pair.getInputAmount(amounts[i]) + amounts[i - 1] = inputAmount + nextPairs[i - 1] = nextPair + } + } + + this.route = route + this.tradeType = tradeType + this.inputAmount = + tradeType === TradeType.EXACT_INPUT + ? amount + : route.input === ETHER + ? CurrencyAmount.ether(amounts[0].raw) + : amounts[0] + this.outputAmount = + tradeType === TradeType.EXACT_OUTPUT + ? amount + : route.output === ETHER + ? CurrencyAmount.ether(amounts[amounts.length - 1].raw) + : amounts[amounts.length - 1] + this.executionPrice = new Price( + this.inputAmount.currency, + this.outputAmount.currency, + this.inputAmount.raw, + this.outputAmount.raw + ) + this.nextMidPrice = Price.fromRoute(new Route(nextPairs, route.input)) + this.priceImpact = computePriceImpact(route.midPrice, this.inputAmount, this.outputAmount) + } + + /** + * Get the minimum amount that must be received from this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + public minimumAmountOut(slippageTolerance: Percent): CurrencyAmount { + invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE') + if (this.tradeType === TradeType.EXACT_OUTPUT) { + return this.outputAmount + } else { + const slippageAdjustedAmountOut = new Fraction(ONE) + .add(slippageTolerance) + .invert() + .multiply(this.outputAmount.raw).quotient + return this.outputAmount instanceof TokenAmount + ? new TokenAmount(this.outputAmount.token, slippageAdjustedAmountOut) + : CurrencyAmount.ether(slippageAdjustedAmountOut) + } + } + + /** + * Get the maximum amount in that can be spent via this trade for the given slippage tolerance + * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade + */ + public maximumAmountIn(slippageTolerance: Percent): CurrencyAmount { + invariant(!slippageTolerance.lessThan(ZERO), 'SLIPPAGE_TOLERANCE') + if (this.tradeType === TradeType.EXACT_INPUT) { + return this.inputAmount + } else { + const slippageAdjustedAmountIn = new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.raw).quotient + return this.inputAmount instanceof TokenAmount + ? new TokenAmount(this.inputAmount.token, slippageAdjustedAmountIn) + : CurrencyAmount.ether(slippageAdjustedAmountIn) + } + } + + /** + * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token + * amount to an output token, making at most `maxHops` hops. + * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyAmountIn exact amount of input currency to spend + * @param currencyOut the desired currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountIn used in recursion; the original value of the currencyAmountIn parameter + * @param bestTrades used in recursion; the current list of best trades + */ + public static bestTradeExactIn( + pairs: Pair[], + currencyAmountIn: CurrencyAmount, + currencyOut: Currency, + { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {}, + // used in recursion. + currentPairs: Pair[] = [], + originalAmountIn: CurrencyAmount = currencyAmountIn, + bestTrades: Trade[] = [] + ): Trade[] { + invariant(pairs.length > 0, 'PAIRS') + invariant(maxHops > 0, 'MAX_HOPS') + invariant(originalAmountIn === currencyAmountIn || currentPairs.length > 0, 'INVALID_RECURSION') + const chainId: ChainId | undefined = + currencyAmountIn instanceof TokenAmount + ? currencyAmountIn.token.chainId + : currencyOut instanceof Token + ? currencyOut.chainId + : undefined + invariant(chainId !== undefined, 'CHAIN_ID') + + const amountIn = wrappedAmount(currencyAmountIn, chainId) + const tokenOut = wrappedCurrency(currencyOut, chainId) + for (let i = 0; i < pairs.length; i++) { + const pair = pairs[i] + // pair irrelevant + if (!pair.token0.equals(amountIn.token) && !pair.token1.equals(amountIn.token)) continue + if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue + + let amountOut: TokenAmount + try { + ;[amountOut] = pair.getOutputAmount(amountIn) + } catch (error) { + // input too low + if (error.isInsufficientInputAmountError) { + continue + } + throw error + } + // we have arrived at the output token, so this is the final trade of one of the paths + if (amountOut.token.equals(tokenOut)) { + sortedInsert( + bestTrades, + new Trade( + new Route([...currentPairs, pair], originalAmountIn.currency, currencyOut), + originalAmountIn, + TradeType.EXACT_INPUT + ), + maxNumResults, + tradeComparator + ) + } else if (maxHops > 1 && pairs.length > 1) { + const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)) + + // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops + Trade.bestTradeExactIn( + pairsExcludingThisPair, + amountOut, + currencyOut, + { + maxNumResults, + maxHops: maxHops - 1 + }, + [...currentPairs, pair], + originalAmountIn, + bestTrades + ) + } + } + + return bestTrades + } + + /** + * similar to the above method but instead targets a fixed output amount + * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token + * to an output token amount, making at most `maxHops` hops + * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting + * the amount in among multiple routes. + * @param pairs the pairs to consider in finding the best trade + * @param currencyIn the currency to spend + * @param currencyAmountOut the exact amount of currency out + * @param maxNumResults maximum number of results to return + * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair + * @param currentPairs used in recursion; the current list of pairs + * @param originalAmountOut used in recursion; the original value of the currencyAmountOut parameter + * @param bestTrades used in recursion; the current list of best trades + */ + public static bestTradeExactOut( + pairs: Pair[], + currencyIn: Currency, + currencyAmountOut: CurrencyAmount, + { maxNumResults = 3, maxHops = 3 }: BestTradeOptions = {}, + // used in recursion. + currentPairs: Pair[] = [], + originalAmountOut: CurrencyAmount = currencyAmountOut, + bestTrades: Trade[] = [] + ): Trade[] { + invariant(pairs.length > 0, 'PAIRS') + invariant(maxHops > 0, 'MAX_HOPS') + invariant(originalAmountOut === currencyAmountOut || currentPairs.length > 0, 'INVALID_RECURSION') + const chainId: ChainId | undefined = + currencyAmountOut instanceof TokenAmount + ? currencyAmountOut.token.chainId + : currencyIn instanceof Token + ? currencyIn.chainId + : undefined + invariant(chainId !== undefined, 'CHAIN_ID') + + const amountOut = wrappedAmount(currencyAmountOut, chainId) + const tokenIn = wrappedCurrency(currencyIn, chainId) + for (let i = 0; i < pairs.length; i++) { + const pair = pairs[i] + // pair irrelevant + if (!pair.token0.equals(amountOut.token) && !pair.token1.equals(amountOut.token)) continue + if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue + + let amountIn: TokenAmount + try { + ;[amountIn] = pair.getInputAmount(amountOut) + } catch (error) { + // not enough liquidity in this pair + if (error.isInsufficientReservesError) { + continue + } + throw error + } + // we have arrived at the input token, so this is the first trade of one of the paths + if (amountIn.token.equals(tokenIn)) { + sortedInsert( + bestTrades, + new Trade( + new Route([pair, ...currentPairs], currencyIn, originalAmountOut.currency), + originalAmountOut, + TradeType.EXACT_OUTPUT + ), + maxNumResults, + tradeComparator + ) + } else if (maxHops > 1 && pairs.length > 1) { + const pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)) + + // otherwise, consider all the other paths that arrive at this token as long as we have not exceeded maxHops + Trade.bestTradeExactOut( + pairsExcludingThisPair, + currencyIn, + amountIn, + { + maxNumResults, + maxHops: maxHops - 1 + }, + [pair, ...currentPairs], + originalAmountOut, + bestTrades + ) + } + } + + return bestTrades + } +} diff --git a/src/errors.ts b/src/errors.ts new file mode 100644 index 0000000..7d351bc --- /dev/null +++ b/src/errors.ts @@ -0,0 +1,30 @@ +// see https://stackoverflow.com/a/41102306 +const CAN_SET_PROTOTYPE = 'setPrototypeOf' in Object + +/** + * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be + * obtained by sending any amount of input. + */ +export class InsufficientReservesError extends Error { + public readonly isInsufficientReservesError: true = true + + public constructor() { + super() + this.name = this.constructor.name + if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype) + } +} + +/** + * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less + * than the price of a single unit of output after fees. + */ +export class InsufficientInputAmountError extends Error { + public readonly isInsufficientInputAmountError: true = true + + public constructor() { + super() + this.name = this.constructor.name + if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(this, new.target.prototype) + } +} diff --git a/src/fetcher.ts b/src/fetcher.ts new file mode 100644 index 0000000..92ce806 --- /dev/null +++ b/src/fetcher.ts @@ -0,0 +1,75 @@ +import { Contract } from '@ethersproject/contracts' +import { getNetwork } from '@ethersproject/networks' +import { getDefaultProvider } from '@ethersproject/providers' +import { TokenAmount } from './entities/fractions/tokenAmount' +import { Pair } from './entities/pair' +import IUniswapV2Pair from '@uniswap/v2-core/build/IUniswapV2Pair.json' +import invariant from 'tiny-invariant' +import ERC20 from './abis/ERC20.json' +import { ChainId } from './constants' +import { Token } from './entities/token' + +let TOKEN_DECIMALS_CACHE: { [chainId: number]: { [address: string]: number } } = { + [ChainId.MAINNET]: { + '0x8B8208f94Ef1AA6891463b43D30C351c9466b0f2': 18 // WGRAM + } +} + +/** + * Contains methods for constructing instances of pairs and tokens from on-chain data. + */ +export abstract class Fetcher { + /** + * Cannot be constructed. + */ + private constructor() {} + + /** + * Fetch information for a given token on the given chain, using the given ethers provider. + * @param chainId chain of the token + * @param address address of the token on the chain + * @param provider provider used to fetch the token + * @param symbol optional symbol of the token + * @param name optional name of the token + */ + public static async fetchTokenData( + chainId: ChainId, + address: string, + provider = getDefaultProvider(getNetwork(chainId)), + symbol?: string, + name?: string + ): Promise { + const parsedDecimals = + typeof TOKEN_DECIMALS_CACHE?.[chainId]?.[address] === 'number' + ? TOKEN_DECIMALS_CACHE[chainId][address] + : await new Contract(address, ERC20, provider).decimals().then((decimals: number): number => { + TOKEN_DECIMALS_CACHE = { + ...TOKEN_DECIMALS_CACHE, + [chainId]: { + ...TOKEN_DECIMALS_CACHE?.[chainId], + [address]: decimals + } + } + return decimals + }) + return new Token(chainId, address, parsedDecimals, symbol, name) + } + + /** + * Fetches information about a pair and constructs a pair from the given two tokens. + * @param tokenA first token + * @param tokenB second token + * @param provider the provider to use to fetch the data + */ + public static async fetchPairData( + tokenA: Token, + tokenB: Token, + provider = getDefaultProvider(getNetwork(tokenA.chainId)) + ): Promise { + invariant(tokenA.chainId === tokenB.chainId, 'CHAIN_ID') + const address = Pair.getAddress(tokenA, tokenB) + const [reserves0, reserves1] = await new Contract(address, IUniswapV2Pair.abi, provider).getReserves() + const balances = tokenA.sortsBefore(tokenB) ? [reserves0, reserves1] : [reserves1, reserves0] + return new Pair(new TokenAmount(tokenA, balances[0]), new TokenAmount(tokenB, balances[1])) + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..3bd8290 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,17 @@ +import JSBI from 'jsbi' +export { JSBI } + +export { + BigintIsh, + ChainId, + TradeType, + Rounding, + FACTORY_ADDRESS, + INIT_CODE_HASH, + MINIMUM_LIQUIDITY +} from './constants' + +export * from './errors' +export * from './entities' +export * from './router' +export * from './fetcher' diff --git a/src/router.ts b/src/router.ts new file mode 100644 index 0000000..058befc --- /dev/null +++ b/src/router.ts @@ -0,0 +1,144 @@ +import { TradeType } from './constants' +import invariant from 'tiny-invariant' +import { validateAndParseAddress } from './utils' +import { CurrencyAmount, ETHER, Percent, Trade } from './entities' + +/** + * Options for producing the arguments to send call to the router. + */ +export interface TradeOptions { + /** + * How much the execution price is allowed to move unfavorably from the trade execution price. + */ + allowedSlippage: Percent + /** + * How long the swap is valid until it expires, in seconds. + * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters + * are generated. + */ + ttl: number + /** + * The account that should receive the output of the swap. + */ + recipient: string + + /** + * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods + */ + feeOnTransfer?: boolean +} + +export interface TradeOptionsDeadline extends Omit { + /** + * When the transaction expires. + * This is an atlernate to specifying the ttl, for when you do not want to use local time. + */ + deadline: number +} + +/** + * The parameters to use in the call to the Uniswap V2 Router to execute a trade. + */ +export interface SwapParameters { + /** + * The method to call on the Uniswap V2 Router. + */ + methodName: string + /** + * The arguments to pass to the method, all hex encoded. + */ + args: (string | string[])[] + /** + * The amount of wei to send in hex. + */ + value: string +} + +function toHex(currencyAmount: CurrencyAmount) { + return `0x${currencyAmount.raw.toString(16)}` +} + +const ZERO_HEX = '0x0' + +/** + * Represents the Uniswap V2 Router, and has static methods for helping execute trades. + */ +export abstract class Router { + /** + * Cannot be constructed. + */ + private constructor() {} + /** + * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade. + * @param trade to produce call parameters for + * @param options options for the call parameters + */ + public static swapCallParameters(trade: Trade, options: TradeOptions | TradeOptionsDeadline): SwapParameters { + const etherIn = trade.inputAmount.currency === ETHER + const etherOut = trade.outputAmount.currency === ETHER + // the router does not support both ether in and out + invariant(!(etherIn && etherOut), 'ETHER_IN_OUT') + invariant(!('ttl' in options) || options.ttl > 0, 'TTL') + + const to: string = validateAndParseAddress(options.recipient) + const amountIn: string = toHex(trade.maximumAmountIn(options.allowedSlippage)) + const amountOut: string = toHex(trade.minimumAmountOut(options.allowedSlippage)) + const path: string[] = trade.route.path.map(token => token.address) + const deadline = + 'ttl' in options + ? `0x${(Math.floor(new Date().getTime() / 1000) + options.ttl).toString(16)}` + : `0x${options.deadline.toString(16)}` + + const useFeeOnTransfer = Boolean(options.feeOnTransfer) + + let methodName: string + let args: (string | string[])[] + let value: string + switch (trade.tradeType) { + case TradeType.EXACT_INPUT: + if (etherIn) { + methodName = useFeeOnTransfer ? 'swapExactETHForTokensSupportingFeeOnTransferTokens' : 'swapExactETHForTokens' + // (uint amountOutMin, address[] calldata path, address to, uint deadline) + args = [amountOut, path, to, deadline] + value = amountIn + } else if (etherOut) { + methodName = useFeeOnTransfer ? 'swapExactTokensForETHSupportingFeeOnTransferTokens' : 'swapExactTokensForETH' + // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) + args = [amountIn, amountOut, path, to, deadline] + value = ZERO_HEX + } else { + methodName = useFeeOnTransfer + ? 'swapExactTokensForTokensSupportingFeeOnTransferTokens' + : 'swapExactTokensForTokens' + // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) + args = [amountIn, amountOut, path, to, deadline] + value = ZERO_HEX + } + break + case TradeType.EXACT_OUTPUT: + invariant(!useFeeOnTransfer, 'EXACT_OUT_FOT') + if (etherIn) { + methodName = 'swapETHForExactTokens' + // (uint amountOut, address[] calldata path, address to, uint deadline) + args = [amountOut, path, to, deadline] + value = amountIn + } else if (etherOut) { + methodName = 'swapTokensForExactETH' + // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) + args = [amountOut, amountIn, path, to, deadline] + value = ZERO_HEX + } else { + methodName = 'swapTokensForExactTokens' + // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) + args = [amountOut, amountIn, path, to, deadline] + value = ZERO_HEX + } + break + } + return { + methodName, + args, + value + } + } +} diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..867684d --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,82 @@ +import invariant from 'tiny-invariant' +import warning from 'tiny-warning' +import JSBI from 'jsbi' +import { getAddress } from '@ethersproject/address' + +import { BigintIsh, ZERO, ONE, TWO, THREE, SolidityType, SOLIDITY_TYPE_MAXIMA } from './constants' + +export function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void { + invariant(JSBI.greaterThanOrEqual(value, ZERO), `${value} is not a ${solidityType}.`) + invariant(JSBI.lessThanOrEqual(value, SOLIDITY_TYPE_MAXIMA[solidityType]), `${value} is not a ${solidityType}.`) +} + +// warns if addresses are not checksummed +export function validateAndParseAddress(address: string): string { + try { + const checksummedAddress = getAddress(address) + warning(address === checksummedAddress, `${address} is not checksummed.`) + return checksummedAddress + } catch (error) { + invariant(false, `${address} is not a valid address.`) + } +} + +export function parseBigintIsh(bigintIsh: BigintIsh): JSBI { + return bigintIsh instanceof JSBI + ? bigintIsh + : typeof bigintIsh === 'bigint' + ? JSBI.BigInt(bigintIsh.toString()) + : JSBI.BigInt(bigintIsh) +} + +// mock the on-chain sqrt function +export function sqrt(y: JSBI): JSBI { + validateSolidityTypeInstance(y, SolidityType.uint256) + let z: JSBI = ZERO + let x: JSBI + if (JSBI.greaterThan(y, THREE)) { + z = y + x = JSBI.add(JSBI.divide(y, TWO), ONE) + while (JSBI.lessThan(x, z)) { + z = x + x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO) + } + } else if (JSBI.notEqual(y, ZERO)) { + z = ONE + } + return z +} + +// given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to +// `maxSize` by removing the last item +export function sortedInsert(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null { + invariant(maxSize > 0, 'MAX_SIZE_ZERO') + // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize + invariant(items.length <= maxSize, 'ITEMS_SIZE') + + // short circuit first item add + if (items.length === 0) { + items.push(add) + return null + } else { + const isFull = items.length === maxSize + // short circuit if full and the additional item does not come before the last item + if (isFull && comparator(items[items.length - 1], add) <= 0) { + return add + } + + let lo = 0, + hi = items.length + + while (lo < hi) { + const mid = (lo + hi) >>> 1 + if (comparator(items[mid], add) <= 0) { + lo = mid + 1 + } else { + hi = mid + } + } + items.splice(lo, 0, add) + return isFull ? items.pop()! : null + } +} diff --git a/test/constants.test.ts b/test/constants.test.ts new file mode 100644 index 0000000..33cbed6 --- /dev/null +++ b/test/constants.test.ts @@ -0,0 +1,16 @@ +import { INIT_CODE_HASH } from '../src/constants' + +import { bytecode } from '@uniswap/v2-core/build/UniswapV2Pair.json' +import { keccak256 } from '@ethersproject/solidity' + +// this _could_ go in constants, except that it would cost every consumer of the sdk the CPU to compute the hash +// and load the JSON. +const COMPUTED_INIT_CODE_HASH = keccak256(['bytes'], [`0x${bytecode}`]) + +describe('constants', () => { + describe('INIT_CODE_HASH', () => { + it('matches computed bytecode hash', () => { + expect(COMPUTED_INIT_CODE_HASH).toEqual(INIT_CODE_HASH) + }) + }) +}) diff --git a/test/data.test.ts b/test/data.test.ts new file mode 100644 index 0000000..a7ac4d8 --- /dev/null +++ b/test/data.test.ts @@ -0,0 +1,20 @@ +import { ChainId, WETH, Token, Fetcher } from '../src' + +// TODO: replace the provider in these tests +describe.skip('data', () => { + it('Token', async () => { + const token = await Fetcher.fetchTokenData(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F') // DAI + expect(token.decimals).toEqual(18) + }) + + it('Token:CACHE', async () => { + const token = await Fetcher.fetchTokenData(ChainId.MAINNET, '0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A') // DGD + expect(token.decimals).toEqual(9) + }) + + it('Pair', async () => { + const token = new Token(ChainId.RINKEBY, '0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735', 18) // DAI + const pair = await Fetcher.fetchPairData(WETH[ChainId.RINKEBY], token) + expect(pair.liquidityToken.address).toEqual('0x8B22F85d0c844Cf793690F6D9DFE9F11Ddb35449') + }) +}) diff --git a/test/entities.test.ts b/test/entities.test.ts new file mode 100644 index 0000000..6bfa853 --- /dev/null +++ b/test/entities.test.ts @@ -0,0 +1,183 @@ +import invariant from 'tiny-invariant' +import { ChainId, WETH as _WETH, TradeType, Rounding, Token, TokenAmount, Pair, Route, Trade } from '../src' + +const ADDRESSES = [ + '0x0000000000000000000000000000000000000001', + '0x0000000000000000000000000000000000000002', + '0x0000000000000000000000000000000000000003' +] +const CHAIN_ID = ChainId.RINKEBY +const WETH = _WETH[ChainId.RINKEBY] +const DECIMAL_PERMUTATIONS: [number, number, number][] = [ + [0, 0, 0], + [0, 9, 18], + [18, 18, 18] +] + +function decimalize(amount: number, decimals: number): bigint { + return BigInt(amount) * BigInt(10) ** BigInt(decimals) +} + +describe('entities', () => { + DECIMAL_PERMUTATIONS.forEach(decimals => { + describe(`decimals permutation: ${decimals}`, () => { + let tokens: Token[] + it('Token', () => { + tokens = ADDRESSES.map((address, i) => new Token(CHAIN_ID, address, decimals[i])) + tokens.forEach((token, i) => { + expect(token.chainId).toEqual(CHAIN_ID) + expect(token.address).toEqual(ADDRESSES[i]) + expect(token.decimals).toEqual(decimals[i]) + }) + }) + + let pairs: Pair[] + it('Pair', () => { + pairs = [ + new Pair( + new TokenAmount(tokens[0], decimalize(1, tokens[0].decimals)), + new TokenAmount(tokens[1], decimalize(1, tokens[1].decimals)) + ), + new Pair( + new TokenAmount(tokens[1], decimalize(1, tokens[1].decimals)), + new TokenAmount(tokens[2], decimalize(1, tokens[2].decimals)) + ), + new Pair( + new TokenAmount(tokens[2], decimalize(1, tokens[2].decimals)), + new TokenAmount(WETH, decimalize(1234, WETH.decimals)) + ) + ] + }) + + let route: Route + it('Route', () => { + route = new Route(pairs, tokens[0]) + expect(route.pairs).toEqual(pairs) + expect(route.path).toEqual(tokens.concat([WETH])) + expect(route.input).toEqual(tokens[0]) + expect(route.output).toEqual(WETH) + }) + + it('Price:Route.midPrice', () => { + invariant(route.input instanceof Token) + invariant(route.output instanceof Token) + expect(route.midPrice.quote(new TokenAmount(route.input, decimalize(1, route.input.decimals)))).toEqual( + new TokenAmount(route.output, decimalize(1234, route.output.decimals)) + ) + expect( + route.midPrice.invert().quote(new TokenAmount(route.output, decimalize(1234, route.output.decimals))) + ).toEqual(new TokenAmount(route.input, decimalize(1, route.input.decimals))) + + expect(route.midPrice.toSignificant(1)).toEqual('1000') + expect(route.midPrice.toSignificant(2)).toEqual('1200') + expect(route.midPrice.toSignificant(3)).toEqual('1230') + expect(route.midPrice.toSignificant(4)).toEqual('1234') + expect(route.midPrice.toSignificant(5)).toEqual('1234') + expect(route.midPrice.toSignificant(5, { groupSeparator: ',' })).toEqual('1,234') + expect(route.midPrice.invert().toSignificant(1)).toEqual('0.0008') + expect(route.midPrice.invert().toSignificant(2)).toEqual('0.00081') + expect(route.midPrice.invert().toSignificant(3)).toEqual('0.00081') + expect(route.midPrice.invert().toSignificant(4)).toEqual('0.0008104') + expect(route.midPrice.invert().toSignificant(4, undefined, Rounding.ROUND_DOWN)).toEqual('0.0008103') + expect(route.midPrice.invert().toSignificant(5)).toEqual('0.00081037') + + expect(route.midPrice.toFixed(0)).toEqual('1234') + expect(route.midPrice.toFixed(1)).toEqual('1234.0') + expect(route.midPrice.toFixed(2)).toEqual('1234.00') + expect(route.midPrice.toFixed(2, { groupSeparator: ',' })).toEqual('1,234.00') + expect(route.midPrice.invert().toFixed(0)).toEqual('0') + expect(route.midPrice.invert().toFixed(1)).toEqual('0.0') + expect(route.midPrice.invert().toFixed(2)).toEqual('0.00') + expect(route.midPrice.invert().toFixed(3)).toEqual('0.001') + expect(route.midPrice.invert().toFixed(4)).toEqual('0.0008') + expect(route.midPrice.invert().toFixed(5)).toEqual('0.00081') + expect(route.midPrice.invert().toFixed(6)).toEqual('0.000810') + expect(route.midPrice.invert().toFixed(7)).toEqual('0.0008104') + expect(route.midPrice.invert().toFixed(7, undefined, Rounding.ROUND_DOWN)).toEqual('0.0008103') + expect(route.midPrice.invert().toFixed(8)).toEqual('0.00081037') + }) + + describe('Trade', () => { + let route: Route + it('TradeType.EXACT_INPUT', () => { + route = new Route( + [ + new Pair( + new TokenAmount(tokens[1], decimalize(5, tokens[1].decimals)), + new TokenAmount(WETH, decimalize(10, WETH.decimals)) + ) + ], + tokens[1] + ) + const inputAmount = new TokenAmount(tokens[1], decimalize(1, tokens[1].decimals)) + const expectedOutputAmount = new TokenAmount(WETH, '1662497915624478906') + const trade = new Trade(route, inputAmount, TradeType.EXACT_INPUT) + expect(trade.route).toEqual(route) + expect(trade.tradeType).toEqual(TradeType.EXACT_INPUT) + expect(trade.inputAmount).toEqual(inputAmount) + expect(trade.outputAmount).toEqual(expectedOutputAmount) + + expect(trade.executionPrice.toSignificant(18)).toEqual('1.66249791562447891') + expect(trade.executionPrice.invert().toSignificant(18)).toEqual('0.601504513540621866') + expect(trade.executionPrice.quote(inputAmount)).toEqual(expectedOutputAmount) + expect(trade.executionPrice.invert().quote(expectedOutputAmount)).toEqual(inputAmount) + + expect(trade.nextMidPrice.toSignificant(18)).toEqual('1.38958368072925352') + expect(trade.nextMidPrice.invert().toSignificant(18)).toEqual('0.71964') + + expect(trade.priceImpact.toSignificant(18)).toEqual('16.8751042187760547') + }) + + it('TradeType.EXACT_OUTPUT', () => { + const outputAmount = new TokenAmount(WETH, '1662497915624478906') + const expectedInputAmount = new TokenAmount(tokens[1], decimalize(1, tokens[1].decimals)) + const trade = new Trade(route, outputAmount, TradeType.EXACT_OUTPUT) + expect(trade.route).toEqual(route) + expect(trade.tradeType).toEqual(TradeType.EXACT_OUTPUT) + expect(trade.outputAmount).toEqual(outputAmount) + expect(trade.inputAmount).toEqual(expectedInputAmount) + + expect(trade.executionPrice.toSignificant(18)).toEqual('1.66249791562447891') + expect(trade.executionPrice.invert().toSignificant(18)).toEqual('0.601504513540621866') + expect(trade.executionPrice.quote(expectedInputAmount)).toEqual(outputAmount) + expect(trade.executionPrice.invert().quote(outputAmount)).toEqual(expectedInputAmount) + + expect(trade.nextMidPrice.toSignificant(18)).toEqual('1.38958368072925352') + expect(trade.nextMidPrice.invert().toSignificant(18)).toEqual('0.71964') + + expect(trade.priceImpact.toSignificant(18)).toEqual('16.8751042187760547') + }) + + it('minimum TradeType.EXACT_INPUT', () => { + if ([9, 18].includes(tokens[1].decimals)) { + const route = new Route( + [ + new Pair( + new TokenAmount(tokens[1], decimalize(1, tokens[1].decimals)), + new TokenAmount( + WETH, + decimalize(10, WETH.decimals) + + (tokens[1].decimals === 9 ? BigInt('30090280812437312') : BigInt('30090270812437322')) + ) + ) + ], + tokens[1] + ) + const outputAmount = new TokenAmount(tokens[1], '1') + const trade = new Trade(route, outputAmount, TradeType.EXACT_INPUT) + + expect(trade.priceImpact.toSignificant(18)).toEqual( + tokens[1].decimals === 9 ? '0.300000099400899902' : '0.3000000000000001' + ) + } + }) + }) + + it('TokenAmount', () => { + const amount = new TokenAmount(WETH, '1234567000000000000000') + expect(amount.toExact()).toEqual('1234.567') + expect(amount.toExact({ groupSeparator: ',' })).toEqual('1,234.567') + }) + }) + }) +}) diff --git a/test/fraction.test.ts b/test/fraction.test.ts new file mode 100644 index 0000000..1a36ca7 --- /dev/null +++ b/test/fraction.test.ts @@ -0,0 +1,121 @@ +import { Fraction } from '../src' +import JSBI from 'jsbi' + +describe.only('Fraction', () => { + describe('#quotient', () => { + it('floor division', () => { + expect(new Fraction(JSBI.BigInt(8), JSBI.BigInt(3)).quotient).toEqual(JSBI.BigInt(2)) // one below + expect(new Fraction(JSBI.BigInt(12), JSBI.BigInt(4)).quotient).toEqual(JSBI.BigInt(3)) // exact + expect(new Fraction(JSBI.BigInt(16), JSBI.BigInt(5)).quotient).toEqual(JSBI.BigInt(3)) // one above + }) + }) + describe('#remainder', () => { + it('returns fraction after divison', () => { + expect(new Fraction(JSBI.BigInt(8), JSBI.BigInt(3)).remainder).toEqual( + new Fraction(JSBI.BigInt(2), JSBI.BigInt(3)) + ) + expect(new Fraction(JSBI.BigInt(12), JSBI.BigInt(4)).remainder).toEqual( + new Fraction(JSBI.BigInt(0), JSBI.BigInt(4)) + ) + expect(new Fraction(JSBI.BigInt(16), JSBI.BigInt(5)).remainder).toEqual( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(5)) + ) + }) + }) + describe('#invert', () => { + it('flips num and denom', () => { + expect(new Fraction(JSBI.BigInt(5), JSBI.BigInt(10)).invert().numerator).toEqual(JSBI.BigInt(10)) + expect(new Fraction(JSBI.BigInt(5), JSBI.BigInt(10)).invert().denominator).toEqual(JSBI.BigInt(5)) + }) + }) + describe('#add', () => { + it('multiples denoms and adds nums', () => { + expect(new Fraction(JSBI.BigInt(1), JSBI.BigInt(10)).add(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12)))).toEqual( + new Fraction(JSBI.BigInt(52), JSBI.BigInt(120)) + ) + }) + + it('same denom', () => { + expect(new Fraction(JSBI.BigInt(1), JSBI.BigInt(5)).add(new Fraction(JSBI.BigInt(2), JSBI.BigInt(5)))).toEqual( + new Fraction(JSBI.BigInt(3), JSBI.BigInt(5)) + ) + }) + }) + describe('#subtract', () => { + it('multiples denoms and subtracts nums', () => { + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(10)).subtract(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toEqual(new Fraction(JSBI.BigInt(-28), JSBI.BigInt(120))) + }) + it('same denom', () => { + expect( + new Fraction(JSBI.BigInt(3), JSBI.BigInt(5)).subtract(new Fraction(JSBI.BigInt(2), JSBI.BigInt(5))) + ).toEqual(new Fraction(JSBI.BigInt(1), JSBI.BigInt(5))) + }) + }) + describe('#lessThan', () => { + it('correct', () => { + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(10)).lessThan(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toBe(true) + expect(new Fraction(JSBI.BigInt(1), JSBI.BigInt(3)).lessThan(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12)))).toBe( + false + ) + expect( + new Fraction(JSBI.BigInt(5), JSBI.BigInt(12)).lessThan(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toBe(false) + }) + }) + describe('#equalTo', () => { + it('correct', () => { + expect(new Fraction(JSBI.BigInt(1), JSBI.BigInt(10)).equalTo(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12)))).toBe( + false + ) + expect(new Fraction(JSBI.BigInt(1), JSBI.BigInt(3)).equalTo(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12)))).toBe( + true + ) + expect(new Fraction(JSBI.BigInt(5), JSBI.BigInt(12)).equalTo(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12)))).toBe( + false + ) + }) + }) + describe('#greaterThan', () => { + it('correct', () => { + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(10)).greaterThan(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toBe(false) + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(3)).greaterThan(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toBe(false) + expect( + new Fraction(JSBI.BigInt(5), JSBI.BigInt(12)).greaterThan(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toBe(true) + }) + }) + describe('#multiplty', () => { + it('correct', () => { + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(10)).multiply(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toEqual(new Fraction(JSBI.BigInt(4), JSBI.BigInt(120))) + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(3)).multiply(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toEqual(new Fraction(JSBI.BigInt(4), JSBI.BigInt(36))) + expect( + new Fraction(JSBI.BigInt(5), JSBI.BigInt(12)).multiply(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toEqual(new Fraction(JSBI.BigInt(20), JSBI.BigInt(144))) + }) + }) + describe('#divide', () => { + it('correct', () => { + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(10)).divide(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toEqual(new Fraction(JSBI.BigInt(12), JSBI.BigInt(40))) + expect( + new Fraction(JSBI.BigInt(1), JSBI.BigInt(3)).divide(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toEqual(new Fraction(JSBI.BigInt(12), JSBI.BigInt(12))) + expect( + new Fraction(JSBI.BigInt(5), JSBI.BigInt(12)).divide(new Fraction(JSBI.BigInt(4), JSBI.BigInt(12))) + ).toEqual(new Fraction(JSBI.BigInt(60), JSBI.BigInt(48))) + }) + }) +}) diff --git a/test/miscellaneous.test.ts b/test/miscellaneous.test.ts new file mode 100644 index 0000000..a98da9f --- /dev/null +++ b/test/miscellaneous.test.ts @@ -0,0 +1,173 @@ +import { ChainId, Token, TokenAmount, Pair, InsufficientInputAmountError } from '../src' +import { sortedInsert } from '../src/utils' + +describe('miscellaneous', () => { + it('getLiquidityMinted:0', async () => { + const tokenA = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000001', 18) + const tokenB = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000002', 18) + const pair = new Pair(new TokenAmount(tokenA, '0'), new TokenAmount(tokenB, '0')) + + expect(() => { + pair.getLiquidityMinted( + new TokenAmount(pair.liquidityToken, '0'), + new TokenAmount(tokenA, '1000'), + new TokenAmount(tokenB, '1000') + ) + }).toThrow(InsufficientInputAmountError) + + expect(() => { + pair.getLiquidityMinted( + new TokenAmount(pair.liquidityToken, '0'), + new TokenAmount(tokenA, '1000000'), + new TokenAmount(tokenB, '1') + ) + }).toThrow(InsufficientInputAmountError) + + const liquidity = pair.getLiquidityMinted( + new TokenAmount(pair.liquidityToken, '0'), + new TokenAmount(tokenA, '1001'), + new TokenAmount(tokenB, '1001') + ) + + expect(liquidity.raw.toString()).toEqual('1') + }) + + it('getLiquidityMinted:!0', async () => { + const tokenA = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000001', 18) + const tokenB = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000002', 18) + const pair = new Pair(new TokenAmount(tokenA, '10000'), new TokenAmount(tokenB, '10000')) + + expect( + pair + .getLiquidityMinted( + new TokenAmount(pair.liquidityToken, '10000'), + new TokenAmount(tokenA, '2000'), + new TokenAmount(tokenB, '2000') + ) + .raw.toString() + ).toEqual('2000') + }) + + it('getLiquidityValue:!feeOn', async () => { + const tokenA = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000001', 18) + const tokenB = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000002', 18) + const pair = new Pair(new TokenAmount(tokenA, '1000'), new TokenAmount(tokenB, '1000')) + + { + const liquidityValue = pair.getLiquidityValue( + tokenA, + new TokenAmount(pair.liquidityToken, '1000'), + new TokenAmount(pair.liquidityToken, '1000'), + false + ) + expect(liquidityValue.token.equals(tokenA)).toBe(true) + expect(liquidityValue.raw.toString()).toBe('1000') + } + + // 500 + { + const liquidityValue = pair.getLiquidityValue( + tokenA, + new TokenAmount(pair.liquidityToken, '1000'), + new TokenAmount(pair.liquidityToken, '500'), + false + ) + expect(liquidityValue.token.equals(tokenA)).toBe(true) + expect(liquidityValue.raw.toString()).toBe('500') + } + + // tokenB + { + const liquidityValue = pair.getLiquidityValue( + tokenB, + new TokenAmount(pair.liquidityToken, '1000'), + new TokenAmount(pair.liquidityToken, '1000'), + false + ) + expect(liquidityValue.token.equals(tokenB)).toBe(true) + expect(liquidityValue.raw.toString()).toBe('1000') + } + }) + + it('getLiquidityValue:feeOn', async () => { + const tokenA = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000001', 18) + const tokenB = new Token(ChainId.RINKEBY, '0x0000000000000000000000000000000000000002', 18) + const pair = new Pair(new TokenAmount(tokenA, '1000'), new TokenAmount(tokenB, '1000')) + + const liquidityValue = pair.getLiquidityValue( + tokenA, + new TokenAmount(pair.liquidityToken, '500'), + new TokenAmount(pair.liquidityToken, '500'), + true, + '250000' // 500 ** 2 + ) + expect(liquidityValue.token.equals(tokenA)).toBe(true) + expect(liquidityValue.raw.toString()).toBe('917') // ceiling(1000 - (500 * (1 / 6))) + }) + + describe('#sortedInsert', () => { + const comp = (a: number, b: number) => a - b + + it('throws if maxSize is 0', () => { + expect(() => sortedInsert([], 1, 0, comp)).toThrow('MAX_SIZE_ZERO') + }) + + it('throws if items.length > maxSize', () => { + expect(() => sortedInsert([1, 2], 1, 1, comp)).toThrow('ITEMS_SIZE') + }) + + it('adds if empty', () => { + const arr: number[] = [] + expect(sortedInsert(arr, 3, 2, comp)).toEqual(null) + expect(arr).toEqual([3]) + }) + + it('adds if not full', () => { + const arr: number[] = [1, 5] + expect(sortedInsert(arr, 3, 3, comp)).toEqual(null) + expect(arr).toEqual([1, 3, 5]) + }) + + it('adds if will not be full after', () => { + const arr: number[] = [1] + expect(sortedInsert(arr, 0, 3, comp)).toEqual(null) + expect(arr).toEqual([0, 1]) + }) + + it('returns add if sorts after last', () => { + const arr = [1, 2, 3] + expect(sortedInsert(arr, 4, 3, comp)).toEqual(4) + expect(arr).toEqual([1, 2, 3]) + }) + + it('removes from end if full', () => { + const arr = [1, 3, 4] + expect(sortedInsert(arr, 2, 3, comp)).toEqual(4) + expect(arr).toEqual([1, 2, 3]) + }) + + it('uses comparator', () => { + const arr = [4, 2, 1] + expect(sortedInsert(arr, 3, 3, (a, b) => comp(a, b) * -1)).toEqual(1) + expect(arr).toEqual([4, 3, 2]) + }) + + describe('maxSize of 1', () => { + it('empty add', () => { + const arr: number[] = [] + expect(sortedInsert(arr, 3, 1, comp)).toEqual(null) + expect(arr).toEqual([3]) + }) + it('full add greater', () => { + const arr: number[] = [2] + expect(sortedInsert(arr, 3, 1, comp)).toEqual(3) + expect(arr).toEqual([2]) + }) + it('full add lesser', () => { + const arr: number[] = [4] + expect(sortedInsert(arr, 3, 1, comp)).toEqual(4) + expect(arr).toEqual([3]) + }) + }) + }) +}) diff --git a/test/pair.test.ts b/test/pair.test.ts new file mode 100644 index 0000000..2be1b5b --- /dev/null +++ b/test/pair.test.ts @@ -0,0 +1,118 @@ +import { ChainId, Token, Pair, TokenAmount, WETH, Price } from '../src' + +describe('Pair', () => { + const USDC = new Token(ChainId.MAINNET, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 18, 'USDC', 'USD Coin') + const DAI = new Token(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'DAI Stablecoin') + + describe('constructor', () => { + it('cannot be used for tokens on different chains', () => { + expect(() => new Pair(new TokenAmount(USDC, '100'), new TokenAmount(WETH[ChainId.RINKEBY], '100'))).toThrow( + 'CHAIN_IDS' + ) + }) + }) + + describe('#getAddress', () => { + it('returns the correct address', () => { + expect(Pair.getAddress(USDC, DAI)).toEqual('0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5') + }) + }) + + describe('#token0', () => { + it('always is the token that sorts before', () => { + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '100')).token0).toEqual(DAI) + expect(new Pair(new TokenAmount(DAI, '100'), new TokenAmount(USDC, '100')).token0).toEqual(DAI) + }) + }) + describe('#token1', () => { + it('always is the token that sorts after', () => { + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '100')).token1).toEqual(USDC) + expect(new Pair(new TokenAmount(DAI, '100'), new TokenAmount(USDC, '100')).token1).toEqual(USDC) + }) + }) + describe('#reserve0', () => { + it('always comes from the token that sorts before', () => { + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '101')).reserve0).toEqual( + new TokenAmount(DAI, '101') + ) + expect(new Pair(new TokenAmount(DAI, '101'), new TokenAmount(USDC, '100')).reserve0).toEqual( + new TokenAmount(DAI, '101') + ) + }) + }) + describe('#reserve1', () => { + it('always comes from the token that sorts after', () => { + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '101')).reserve1).toEqual( + new TokenAmount(USDC, '100') + ) + expect(new Pair(new TokenAmount(DAI, '101'), new TokenAmount(USDC, '100')).reserve1).toEqual( + new TokenAmount(USDC, '100') + ) + }) + }) + + describe('#token0Price', () => { + it('returns price of token0 in terms of token1', () => { + expect(new Pair(new TokenAmount(USDC, '101'), new TokenAmount(DAI, '100')).token0Price).toEqual( + new Price(DAI, USDC, '100', '101') + ) + expect(new Pair(new TokenAmount(DAI, '100'), new TokenAmount(USDC, '101')).token0Price).toEqual( + new Price(DAI, USDC, '100', '101') + ) + }) + }) + + describe('#token1Price', () => { + it('returns price of token1 in terms of token0', () => { + expect(new Pair(new TokenAmount(USDC, '101'), new TokenAmount(DAI, '100')).token1Price).toEqual( + new Price(USDC, DAI, '101', '100') + ) + expect(new Pair(new TokenAmount(DAI, '100'), new TokenAmount(USDC, '101')).token1Price).toEqual( + new Price(USDC, DAI, '101', '100') + ) + }) + }) + + describe('#priceOf', () => { + const pair = new Pair(new TokenAmount(USDC, '101'), new TokenAmount(DAI, '100')) + it('returns price of token in terms of other token', () => { + expect(pair.priceOf(DAI)).toEqual(pair.token0Price) + expect(pair.priceOf(USDC)).toEqual(pair.token1Price) + }) + + it('throws if invalid token', () => { + expect(() => pair.priceOf(WETH[ChainId.MAINNET])).toThrow('TOKEN') + }) + }) + + describe('#reserveOf', () => { + it('returns reserves of the given token', () => { + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '101')).reserveOf(USDC)).toEqual( + new TokenAmount(USDC, '100') + ) + expect(new Pair(new TokenAmount(DAI, '101'), new TokenAmount(USDC, '100')).reserveOf(USDC)).toEqual( + new TokenAmount(USDC, '100') + ) + }) + + it('throws if not in the pair', () => { + expect(() => + new Pair(new TokenAmount(DAI, '101'), new TokenAmount(USDC, '100')).reserveOf(WETH[ChainId.MAINNET]) + ).toThrow('TOKEN') + }) + }) + + describe('#chainId', () => { + it('returns the token0 chainId', () => { + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '100')).chainId).toEqual(ChainId.MAINNET) + expect(new Pair(new TokenAmount(DAI, '100'), new TokenAmount(USDC, '100')).chainId).toEqual(ChainId.MAINNET) + }) + }) + describe('#involvesToken', () => { + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '100')).involvesToken(USDC)).toEqual(true) + expect(new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '100')).involvesToken(DAI)).toEqual(true) + expect( + new Pair(new TokenAmount(USDC, '100'), new TokenAmount(DAI, '100')).involvesToken(WETH[ChainId.MAINNET]) + ).toEqual(false) + }) +}) diff --git a/test/route.test.ts b/test/route.test.ts new file mode 100644 index 0000000..02989d2 --- /dev/null +++ b/test/route.test.ts @@ -0,0 +1,40 @@ +import { Token, WETH, ChainId, Pair, TokenAmount, Route, ETHER } from '../src' + +describe('Route', () => { + const token0 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000001', 18, 't0') + const token1 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000002', 18, 't1') + const weth = WETH[ChainId.MAINNET] + const pair_0_1 = new Pair(new TokenAmount(token0, '100'), new TokenAmount(token1, '200')) + const pair_0_weth = new Pair(new TokenAmount(token0, '100'), new TokenAmount(weth, '100')) + const pair_1_weth = new Pair(new TokenAmount(token1, '175'), new TokenAmount(weth, '100')) + + it('constructs a path from the tokens', () => { + const route = new Route([pair_0_1], token0) + expect(route.pairs).toEqual([pair_0_1]) + expect(route.path).toEqual([token0, token1]) + expect(route.input).toEqual(token0) + expect(route.output).toEqual(token1) + expect(route.chainId).toEqual(ChainId.MAINNET) + }) + + it('can have a token as both input and output', () => { + const route = new Route([pair_0_weth, pair_0_1, pair_1_weth], weth) + expect(route.pairs).toEqual([pair_0_weth, pair_0_1, pair_1_weth]) + expect(route.input).toEqual(weth) + expect(route.output).toEqual(weth) + }) + + it('supports ether input', () => { + const route = new Route([pair_0_weth], ETHER) + expect(route.pairs).toEqual([pair_0_weth]) + expect(route.input).toEqual(ETHER) + expect(route.output).toEqual(token0) + }) + + it('supports ether output', () => { + const route = new Route([pair_0_weth], token0, ETHER) + expect(route.pairs).toEqual([pair_0_weth]) + expect(route.input).toEqual(token0) + expect(route.output).toEqual(ETHER) + }) +}) diff --git a/test/router.test.ts b/test/router.test.ts new file mode 100644 index 0000000..0b4caa5 --- /dev/null +++ b/test/router.test.ts @@ -0,0 +1,241 @@ +import invariant from 'tiny-invariant' +import { ChainId, CurrencyAmount, ETHER, Pair, Percent, Route, Router, Token, TokenAmount, Trade, WETH } from '../src' +import JSBI from 'jsbi' + +function checkDeadline(deadline: string[] | string): void { + expect(typeof deadline).toBe('string') + invariant(typeof deadline === 'string') + // less than 5 seconds on the deadline + expect(new Date().getTime() / 1000 - parseInt(deadline)).toBeLessThanOrEqual(5) +} + +describe('Router', () => { + const token0 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000001', 18, 't0') + const token1 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000002', 18, 't1') + + const pair_0_1 = new Pair(new TokenAmount(token0, JSBI.BigInt(1000)), new TokenAmount(token1, JSBI.BigInt(1000))) + + const pair_weth_0 = new Pair(new TokenAmount(WETH[ChainId.MAINNET], '1000'), new TokenAmount(token0, '1000')) + + describe('#swapCallParameters', () => { + describe('exact in', () => { + it('ether to token1', () => { + const result = Router.swapCallParameters( + Trade.exactIn(new Route([pair_weth_0, pair_0_1], ETHER, token1), CurrencyAmount.ether(JSBI.BigInt(100))), + { ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedSlippage: new Percent('1', '100') } + ) + expect(result.methodName).toEqual('swapExactETHForTokens') + expect(result.args.slice(0, -1)).toEqual([ + '0x51', + [WETH[ChainId.MAINNET].address, token0.address, token1.address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x64') + checkDeadline(result.args[result.args.length - 1]) + }) + + it('deadline specified', () => { + const result = Router.swapCallParameters( + Trade.exactIn(new Route([pair_weth_0, pair_0_1], ETHER, token1), CurrencyAmount.ether(JSBI.BigInt(100))), + { + deadline: 50, + recipient: '0x0000000000000000000000000000000000000004', + allowedSlippage: new Percent('1', '100') + } + ) + expect(result.methodName).toEqual('swapExactETHForTokens') + expect(result.args).toEqual([ + '0x51', + [WETH[ChainId.MAINNET].address, token0.address, token1.address], + '0x0000000000000000000000000000000000000004', + '0x32' + ]) + expect(result.value).toEqual('0x64') + }) + + it('token1 to ether', () => { + const result = Router.swapCallParameters( + Trade.exactIn(new Route([pair_0_1, pair_weth_0], token1, ETHER), new TokenAmount(token1, JSBI.BigInt(100))), + { ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedSlippage: new Percent('1', '100') } + ) + expect(result.methodName).toEqual('swapExactTokensForETH') + expect(result.args.slice(0, -1)).toEqual([ + '0x64', + '0x51', + [token1.address, token0.address, WETH[ChainId.MAINNET].address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x0') + checkDeadline(result.args[result.args.length - 1]) + }) + it('token0 to token1', () => { + const result = Router.swapCallParameters( + Trade.exactIn(new Route([pair_0_1], token0, token1), new TokenAmount(token0, JSBI.BigInt(100))), + { ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedSlippage: new Percent('1', '100') } + ) + expect(result.methodName).toEqual('swapExactTokensForTokens') + expect(result.args.slice(0, -1)).toEqual([ + '0x64', + '0x59', + [token0.address, token1.address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x0') + checkDeadline(result.args[result.args.length - 1]) + }) + }) + describe('exact out', () => { + it('ether to token1', () => { + const result = Router.swapCallParameters( + Trade.exactOut(new Route([pair_weth_0, pair_0_1], ETHER, token1), new TokenAmount(token1, JSBI.BigInt(100))), + { ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedSlippage: new Percent('1', '100') } + ) + expect(result.methodName).toEqual('swapETHForExactTokens') + expect(result.args.slice(0, -1)).toEqual([ + '0x64', + [WETH[ChainId.MAINNET].address, token0.address, token1.address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x80') + checkDeadline(result.args[result.args.length - 1]) + }) + it('token1 to ether', () => { + const result = Router.swapCallParameters( + Trade.exactOut(new Route([pair_0_1, pair_weth_0], token1, ETHER), CurrencyAmount.ether(JSBI.BigInt(100))), + { ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedSlippage: new Percent('1', '100') } + ) + expect(result.methodName).toEqual('swapTokensForExactETH') + expect(result.args.slice(0, -1)).toEqual([ + '0x64', + '0x80', + [token1.address, token0.address, WETH[ChainId.MAINNET].address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x0') + checkDeadline(result.args[result.args.length - 1]) + }) + it('token0 to token1', () => { + const result = Router.swapCallParameters( + Trade.exactOut(new Route([pair_0_1], token0, token1), new TokenAmount(token1, JSBI.BigInt(100))), + { ttl: 50, recipient: '0x0000000000000000000000000000000000000004', allowedSlippage: new Percent('1', '100') } + ) + expect(result.methodName).toEqual('swapTokensForExactTokens') + expect(result.args.slice(0, -1)).toEqual([ + '0x64', + '0x71', + [token0.address, token1.address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x0') + checkDeadline(result.args[result.args.length - 1]) + }) + }) + describe('supporting fee on transfer', () => { + describe('exact in', () => { + it('ether to token1', () => { + const result = Router.swapCallParameters( + Trade.exactIn(new Route([pair_weth_0, pair_0_1], ETHER, token1), CurrencyAmount.ether(JSBI.BigInt(100))), + { + ttl: 50, + recipient: '0x0000000000000000000000000000000000000004', + allowedSlippage: new Percent('1', '100'), + feeOnTransfer: true + } + ) + expect(result.methodName).toEqual('swapExactETHForTokensSupportingFeeOnTransferTokens') + expect(result.args.slice(0, -1)).toEqual([ + '0x51', + [WETH[ChainId.MAINNET].address, token0.address, token1.address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x64') + checkDeadline(result.args[result.args.length - 1]) + }) + it('token1 to ether', () => { + const result = Router.swapCallParameters( + Trade.exactIn(new Route([pair_0_1, pair_weth_0], token1, ETHER), new TokenAmount(token1, JSBI.BigInt(100))), + { + ttl: 50, + recipient: '0x0000000000000000000000000000000000000004', + allowedSlippage: new Percent('1', '100'), + feeOnTransfer: true + } + ) + expect(result.methodName).toEqual('swapExactTokensForETHSupportingFeeOnTransferTokens') + expect(result.args.slice(0, -1)).toEqual([ + '0x64', + '0x51', + [token1.address, token0.address, WETH[ChainId.MAINNET].address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x0') + checkDeadline(result.args[result.args.length - 1]) + }) + it('token0 to token1', () => { + const result = Router.swapCallParameters( + Trade.exactIn(new Route([pair_0_1], token0, token1), new TokenAmount(token0, JSBI.BigInt(100))), + { + ttl: 50, + recipient: '0x0000000000000000000000000000000000000004', + allowedSlippage: new Percent('1', '100'), + feeOnTransfer: true + } + ) + expect(result.methodName).toEqual('swapExactTokensForTokensSupportingFeeOnTransferTokens') + expect(result.args.slice(0, -1)).toEqual([ + '0x64', + '0x59', + [token0.address, token1.address], + '0x0000000000000000000000000000000000000004' + ]) + expect(result.value).toEqual('0x0') + checkDeadline(result.args[result.args.length - 1]) + }) + }) + describe('exact out', () => { + it('ether to token1', () => { + expect(() => + Router.swapCallParameters( + Trade.exactOut( + new Route([pair_weth_0, pair_0_1], ETHER, token1), + new TokenAmount(token1, JSBI.BigInt(100)) + ), + { + ttl: 50, + recipient: '0x0000000000000000000000000000000000000004', + allowedSlippage: new Percent('1', '100'), + feeOnTransfer: true + } + ) + ).toThrow('EXACT_OUT_FOT') + }) + it('token1 to ether', () => { + expect(() => + Router.swapCallParameters( + Trade.exactOut(new Route([pair_0_1, pair_weth_0], token1, ETHER), CurrencyAmount.ether(JSBI.BigInt(100))), + { + ttl: 50, + recipient: '0x0000000000000000000000000000000000000004', + allowedSlippage: new Percent('1', '100'), + feeOnTransfer: true + } + ) + ).toThrow('EXACT_OUT_FOT') + }) + it('token0 to token1', () => { + expect(() => + Router.swapCallParameters( + Trade.exactOut(new Route([pair_0_1], token0, token1), new TokenAmount(token1, JSBI.BigInt(100))), + { + ttl: 50, + recipient: '0x0000000000000000000000000000000000000004', + allowedSlippage: new Percent('1', '100'), + feeOnTransfer: true + } + ) + ).toThrow('EXACT_OUT_FOT') + }) + }) + }) + }) +}) diff --git a/test/token.test.ts b/test/token.test.ts new file mode 100644 index 0000000..0fc7f0c --- /dev/null +++ b/test/token.test.ts @@ -0,0 +1,39 @@ +import { ChainId, Token } from '../src' + +describe('Token', () => { + const ADDRESS_ONE = '0x0000000000000000000000000000000000000001' + const ADDRESS_TWO = '0x0000000000000000000000000000000000000002' + + describe('#equals', () => { + it('fails if address differs', () => { + expect(new Token(ChainId.MAINNET, ADDRESS_ONE, 18).equals(new Token(ChainId.MAINNET, ADDRESS_TWO, 18))).toBe( + false + ) + }) + + it('false if chain id differs', () => { + expect(new Token(ChainId.ROPSTEN, ADDRESS_ONE, 18).equals(new Token(ChainId.MAINNET, ADDRESS_ONE, 18))).toBe( + false + ) + }) + + it('true if only decimals differs', () => { + expect(new Token(ChainId.MAINNET, ADDRESS_ONE, 9).equals(new Token(ChainId.MAINNET, ADDRESS_ONE, 18))).toBe(true) + }) + + it('true if address is the same', () => { + expect(new Token(ChainId.MAINNET, ADDRESS_ONE, 18).equals(new Token(ChainId.MAINNET, ADDRESS_ONE, 18))).toBe(true) + }) + + it('true on reference equality', () => { + const token = new Token(ChainId.MAINNET, ADDRESS_ONE, 18) + expect(token.equals(token)).toBe(true) + }) + + it('true even if name/symbol/decimals differ', () => { + const tokenA = new Token(ChainId.MAINNET, ADDRESS_ONE, 9, 'abc', 'def') + const tokenB = new Token(ChainId.MAINNET, ADDRESS_ONE, 18, 'ghi', 'jkl') + expect(tokenA.equals(tokenB)).toBe(true) + }) + }) +}) diff --git a/test/trade.test.ts b/test/trade.test.ts new file mode 100644 index 0000000..5be9df6 --- /dev/null +++ b/test/trade.test.ts @@ -0,0 +1,404 @@ +import JSBI from 'jsbi' +import { + ChainId, + ETHER, + CurrencyAmount, + Pair, + Percent, + Route, + Token, + TokenAmount, + Trade, + TradeType, + WETH +} from '../src' + +describe('Trade', () => { + const token0 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000001', 18, 't0') + const token1 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000002', 18, 't1') + const token2 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000003', 18, 't2') + const token3 = new Token(ChainId.MAINNET, '0x0000000000000000000000000000000000000004', 18, 't3') + + const pair_0_1 = new Pair(new TokenAmount(token0, JSBI.BigInt(1000)), new TokenAmount(token1, JSBI.BigInt(1000))) + const pair_0_2 = new Pair(new TokenAmount(token0, JSBI.BigInt(1000)), new TokenAmount(token2, JSBI.BigInt(1100))) + const pair_0_3 = new Pair(new TokenAmount(token0, JSBI.BigInt(1000)), new TokenAmount(token3, JSBI.BigInt(900))) + const pair_1_2 = new Pair(new TokenAmount(token1, JSBI.BigInt(1200)), new TokenAmount(token2, JSBI.BigInt(1000))) + const pair_1_3 = new Pair(new TokenAmount(token1, JSBI.BigInt(1200)), new TokenAmount(token3, JSBI.BigInt(1300))) + + const pair_weth_0 = new Pair( + new TokenAmount(WETH[ChainId.MAINNET], JSBI.BigInt(1000)), + new TokenAmount(token0, JSBI.BigInt(1000)) + ) + + const empty_pair_0_1 = new Pair(new TokenAmount(token0, JSBI.BigInt(0)), new TokenAmount(token1, JSBI.BigInt(0))) + + it('can be constructed with ETHER as input', () => { + const trade = new Trade( + new Route([pair_weth_0], ETHER), + CurrencyAmount.ether(JSBI.BigInt(100)), + TradeType.EXACT_INPUT + ) + expect(trade.inputAmount.currency).toEqual(ETHER) + expect(trade.outputAmount.currency).toEqual(token0) + }) + it('can be constructed with ETHER as input for exact output', () => { + const trade = new Trade( + new Route([pair_weth_0], ETHER, token0), + new TokenAmount(token0, JSBI.BigInt(100)), + TradeType.EXACT_OUTPUT + ) + expect(trade.inputAmount.currency).toEqual(ETHER) + expect(trade.outputAmount.currency).toEqual(token0) + }) + + it('can be constructed with ETHER as output', () => { + const trade = new Trade( + new Route([pair_weth_0], token0, ETHER), + CurrencyAmount.ether(JSBI.BigInt(100)), + TradeType.EXACT_OUTPUT + ) + expect(trade.inputAmount.currency).toEqual(token0) + expect(trade.outputAmount.currency).toEqual(ETHER) + }) + it('can be constructed with ETHER as output for exact input', () => { + const trade = new Trade( + new Route([pair_weth_0], token0, ETHER), + new TokenAmount(token0, JSBI.BigInt(100)), + TradeType.EXACT_INPUT + ) + expect(trade.inputAmount.currency).toEqual(token0) + expect(trade.outputAmount.currency).toEqual(ETHER) + }) + + describe('#bestTradeExactIn', () => { + it('throws with empty pairs', () => { + expect(() => Trade.bestTradeExactIn([], new TokenAmount(token0, JSBI.BigInt(100)), token2)).toThrow('PAIRS') + }) + it('throws with max hops of 0', () => { + expect(() => + Trade.bestTradeExactIn([pair_0_2], new TokenAmount(token0, JSBI.BigInt(100)), token2, { maxHops: 0 }) + ).toThrow('MAX_HOPS') + }) + + it('provides best route', () => { + const result = Trade.bestTradeExactIn( + [pair_0_1, pair_0_2, pair_1_2], + new TokenAmount(token0, JSBI.BigInt(100)), + token2 + ) + expect(result).toHaveLength(2) + expect(result[0].route.pairs).toHaveLength(1) // 0 -> 2 at 10:11 + expect(result[0].route.path).toEqual([token0, token2]) + expect(result[0].inputAmount).toEqual(new TokenAmount(token0, JSBI.BigInt(100))) + expect(result[0].outputAmount).toEqual(new TokenAmount(token2, JSBI.BigInt(99))) + expect(result[1].route.pairs).toHaveLength(2) // 0 -> 1 -> 2 at 12:12:10 + expect(result[1].route.path).toEqual([token0, token1, token2]) + expect(result[1].inputAmount).toEqual(new TokenAmount(token0, JSBI.BigInt(100))) + expect(result[1].outputAmount).toEqual(new TokenAmount(token2, JSBI.BigInt(69))) + }) + + it('doesnt throw for zero liquidity pairs', () => { + expect(Trade.bestTradeExactIn([empty_pair_0_1], new TokenAmount(token0, JSBI.BigInt(100)), token1)).toHaveLength( + 0 + ) + }) + + it('respects maxHops', () => { + const result = Trade.bestTradeExactIn( + [pair_0_1, pair_0_2, pair_1_2], + new TokenAmount(token0, JSBI.BigInt(10)), + token2, + { maxHops: 1 } + ) + expect(result).toHaveLength(1) + expect(result[0].route.pairs).toHaveLength(1) // 0 -> 2 at 10:11 + expect(result[0].route.path).toEqual([token0, token2]) + }) + + it('insufficient input for one pair', () => { + const result = Trade.bestTradeExactIn( + [pair_0_1, pair_0_2, pair_1_2], + new TokenAmount(token0, JSBI.BigInt(1)), + token2 + ) + expect(result).toHaveLength(1) + expect(result[0].route.pairs).toHaveLength(1) // 0 -> 2 at 10:11 + expect(result[0].route.path).toEqual([token0, token2]) + expect(result[0].outputAmount).toEqual(new TokenAmount(token2, JSBI.BigInt(1))) + }) + + it('respects n', () => { + const result = Trade.bestTradeExactIn( + [pair_0_1, pair_0_2, pair_1_2], + new TokenAmount(token0, JSBI.BigInt(10)), + token2, + { maxNumResults: 1 } + ) + + expect(result).toHaveLength(1) + }) + + it('no path', () => { + const result = Trade.bestTradeExactIn( + [pair_0_1, pair_0_3, pair_1_3], + new TokenAmount(token0, JSBI.BigInt(10)), + token2 + ) + expect(result).toHaveLength(0) + }) + + it('works for ETHER currency input', () => { + const result = Trade.bestTradeExactIn( + [pair_weth_0, pair_0_1, pair_0_3, pair_1_3], + CurrencyAmount.ether(JSBI.BigInt(100)), + token3 + ) + expect(result).toHaveLength(2) + expect(result[0].inputAmount.currency).toEqual(ETHER) + expect(result[0].route.path).toEqual([WETH[ChainId.MAINNET], token0, token1, token3]) + expect(result[0].outputAmount.currency).toEqual(token3) + expect(result[1].inputAmount.currency).toEqual(ETHER) + expect(result[1].route.path).toEqual([WETH[ChainId.MAINNET], token0, token3]) + expect(result[1].outputAmount.currency).toEqual(token3) + }) + it('works for ETHER currency output', () => { + const result = Trade.bestTradeExactIn( + [pair_weth_0, pair_0_1, pair_0_3, pair_1_3], + new TokenAmount(token3, JSBI.BigInt(100)), + ETHER + ) + expect(result).toHaveLength(2) + expect(result[0].inputAmount.currency).toEqual(token3) + expect(result[0].route.path).toEqual([token3, token0, WETH[ChainId.MAINNET]]) + expect(result[0].outputAmount.currency).toEqual(ETHER) + expect(result[1].inputAmount.currency).toEqual(token3) + expect(result[1].route.path).toEqual([token3, token1, token0, WETH[ChainId.MAINNET]]) + expect(result[1].outputAmount.currency).toEqual(ETHER) + }) + }) + + describe('#maximumAmountIn', () => { + describe('tradeType = EXACT_INPUT', () => { + const exactIn = new Trade( + new Route([pair_0_1, pair_1_2], token0), + new TokenAmount(token0, JSBI.BigInt(100)), + TradeType.EXACT_INPUT + ) + it('throws if less than 0', () => { + expect(() => exactIn.maximumAmountIn(new Percent(JSBI.BigInt(-1), JSBI.BigInt(100)))).toThrow( + 'SLIPPAGE_TOLERANCE' + ) + }) + it('returns exact if 0', () => { + expect(exactIn.maximumAmountIn(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual(exactIn.inputAmount) + }) + it('returns exact if nonzero', () => { + expect(exactIn.maximumAmountIn(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token0, JSBI.BigInt(100)) + ) + expect(exactIn.maximumAmountIn(new Percent(JSBI.BigInt(5), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token0, JSBI.BigInt(100)) + ) + expect(exactIn.maximumAmountIn(new Percent(JSBI.BigInt(200), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token0, JSBI.BigInt(100)) + ) + }) + }) + describe('tradeType = EXACT_OUTPUT', () => { + const exactOut = new Trade( + new Route([pair_0_1, pair_1_2], token0), + new TokenAmount(token2, JSBI.BigInt(100)), + TradeType.EXACT_OUTPUT + ) + + it('throws if less than 0', () => { + expect(() => exactOut.maximumAmountIn(new Percent(JSBI.BigInt(-1), JSBI.BigInt(100)))).toThrow( + 'SLIPPAGE_TOLERANCE' + ) + }) + it('returns exact if 0', () => { + expect(exactOut.maximumAmountIn(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual(exactOut.inputAmount) + }) + it('returns slippage amount if nonzero', () => { + expect(exactOut.maximumAmountIn(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token0, JSBI.BigInt(156)) + ) + expect(exactOut.maximumAmountIn(new Percent(JSBI.BigInt(5), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token0, JSBI.BigInt(163)) + ) + expect(exactOut.maximumAmountIn(new Percent(JSBI.BigInt(200), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token0, JSBI.BigInt(468)) + ) + }) + }) + }) + + describe('#minimumAmountOut', () => { + describe('tradeType = EXACT_INPUT', () => { + const exactIn = new Trade( + new Route([pair_0_1, pair_1_2], token0), + new TokenAmount(token0, JSBI.BigInt(100)), + TradeType.EXACT_INPUT + ) + it('throws if less than 0', () => { + expect(() => exactIn.minimumAmountOut(new Percent(JSBI.BigInt(-1), JSBI.BigInt(100)))).toThrow( + 'SLIPPAGE_TOLERANCE' + ) + }) + it('returns exact if 0', () => { + expect(exactIn.minimumAmountOut(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual(exactIn.outputAmount) + }) + it('returns exact if nonzero', () => { + expect(exactIn.minimumAmountOut(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token2, JSBI.BigInt(69)) + ) + expect(exactIn.minimumAmountOut(new Percent(JSBI.BigInt(5), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token2, JSBI.BigInt(65)) + ) + expect(exactIn.minimumAmountOut(new Percent(JSBI.BigInt(200), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token2, JSBI.BigInt(23)) + ) + }) + }) + describe('tradeType = EXACT_OUTPUT', () => { + const exactOut = new Trade( + new Route([pair_0_1, pair_1_2], token0), + new TokenAmount(token2, JSBI.BigInt(100)), + TradeType.EXACT_OUTPUT + ) + + it('throws if less than 0', () => { + expect(() => exactOut.minimumAmountOut(new Percent(JSBI.BigInt(-1), JSBI.BigInt(100)))).toThrow( + 'SLIPPAGE_TOLERANCE' + ) + }) + it('returns exact if 0', () => { + expect(exactOut.minimumAmountOut(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual(exactOut.outputAmount) + }) + it('returns slippage amount if nonzero', () => { + expect(exactOut.minimumAmountOut(new Percent(JSBI.BigInt(0), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token2, JSBI.BigInt(100)) + ) + expect(exactOut.minimumAmountOut(new Percent(JSBI.BigInt(5), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token2, JSBI.BigInt(100)) + ) + expect(exactOut.minimumAmountOut(new Percent(JSBI.BigInt(200), JSBI.BigInt(100)))).toEqual( + new TokenAmount(token2, JSBI.BigInt(100)) + ) + }) + }) + }) + + describe('#bestTradeExactOut', () => { + it('throws with empty pairs', () => { + expect(() => Trade.bestTradeExactOut([], token0, new TokenAmount(token2, JSBI.BigInt(100)))).toThrow('PAIRS') + }) + it('throws with max hops of 0', () => { + expect(() => + Trade.bestTradeExactOut([pair_0_2], token0, new TokenAmount(token2, JSBI.BigInt(100)), { maxHops: 0 }) + ).toThrow('MAX_HOPS') + }) + + it('provides best route', () => { + const result = Trade.bestTradeExactOut( + [pair_0_1, pair_0_2, pair_1_2], + token0, + new TokenAmount(token2, JSBI.BigInt(100)) + ) + expect(result).toHaveLength(2) + expect(result[0].route.pairs).toHaveLength(1) // 0 -> 2 at 10:11 + expect(result[0].route.path).toEqual([token0, token2]) + expect(result[0].inputAmount).toEqual(new TokenAmount(token0, JSBI.BigInt(101))) + expect(result[0].outputAmount).toEqual(new TokenAmount(token2, JSBI.BigInt(100))) + expect(result[1].route.pairs).toHaveLength(2) // 0 -> 1 -> 2 at 12:12:10 + expect(result[1].route.path).toEqual([token0, token1, token2]) + expect(result[1].inputAmount).toEqual(new TokenAmount(token0, JSBI.BigInt(156))) + expect(result[1].outputAmount).toEqual(new TokenAmount(token2, JSBI.BigInt(100))) + }) + + it('doesnt throw for zero liquidity pairs', () => { + expect(Trade.bestTradeExactOut([empty_pair_0_1], token1, new TokenAmount(token1, JSBI.BigInt(100)))).toHaveLength( + 0 + ) + }) + + it('respects maxHops', () => { + const result = Trade.bestTradeExactOut( + [pair_0_1, pair_0_2, pair_1_2], + token0, + new TokenAmount(token2, JSBI.BigInt(10)), + { maxHops: 1 } + ) + expect(result).toHaveLength(1) + expect(result[0].route.pairs).toHaveLength(1) // 0 -> 2 at 10:11 + expect(result[0].route.path).toEqual([token0, token2]) + }) + + it('insufficient liquidity', () => { + const result = Trade.bestTradeExactOut( + [pair_0_1, pair_0_2, pair_1_2], + token0, + new TokenAmount(token2, JSBI.BigInt(1200)) + ) + expect(result).toHaveLength(0) + }) + + it('insufficient liquidity in one pair but not the other', () => { + const result = Trade.bestTradeExactOut( + [pair_0_1, pair_0_2, pair_1_2], + token0, + new TokenAmount(token2, JSBI.BigInt(1050)) + ) + expect(result).toHaveLength(1) + }) + + it('respects n', () => { + const result = Trade.bestTradeExactOut( + [pair_0_1, pair_0_2, pair_1_2], + token0, + new TokenAmount(token2, JSBI.BigInt(10)), + { maxNumResults: 1 } + ) + + expect(result).toHaveLength(1) + }) + + it('no path', () => { + const result = Trade.bestTradeExactOut( + [pair_0_1, pair_0_3, pair_1_3], + token0, + new TokenAmount(token2, JSBI.BigInt(10)) + ) + expect(result).toHaveLength(0) + }) + + it('works for ETHER currency input', () => { + const result = Trade.bestTradeExactOut( + [pair_weth_0, pair_0_1, pair_0_3, pair_1_3], + ETHER, + new TokenAmount(token3, JSBI.BigInt(100)) + ) + expect(result).toHaveLength(2) + expect(result[0].inputAmount.currency).toEqual(ETHER) + expect(result[0].route.path).toEqual([WETH[ChainId.MAINNET], token0, token1, token3]) + expect(result[0].outputAmount.currency).toEqual(token3) + expect(result[1].inputAmount.currency).toEqual(ETHER) + expect(result[1].route.path).toEqual([WETH[ChainId.MAINNET], token0, token3]) + expect(result[1].outputAmount.currency).toEqual(token3) + }) + it('works for ETHER currency output', () => { + const result = Trade.bestTradeExactOut( + [pair_weth_0, pair_0_1, pair_0_3, pair_1_3], + token3, + CurrencyAmount.ether(JSBI.BigInt(100)) + ) + expect(result).toHaveLength(2) + expect(result[0].inputAmount.currency).toEqual(token3) + expect(result[0].route.path).toEqual([token3, token0, WETH[ChainId.MAINNET]]) + expect(result[0].outputAmount.currency).toEqual(ETHER) + expect(result[1].inputAmount.currency).toEqual(token3) + expect(result[1].route.path).toEqual([token3, token1, token0, WETH[ChainId.MAINNET]]) + expect(result[1].outputAmount.currency).toEqual(ETHER) + }) + }) +}) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1a6d420 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "include": ["src", "test"], + "compilerOptions": { + "target": "es2018", + "module": "esnext", + "importHelpers": true, + "declaration": true, + "sourceMap": true, + "rootDir": "./", + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "baseUrl": "./", + "paths": { + "*": ["src/*", "node_modules/*"] + }, + "esModuleInterop": true, + "resolveJsonModule": true + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..6388296 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,6483 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.5.5": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" + integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== + dependencies: + "@babel/highlight" "^7.10.4" + +"@babel/compat-data@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.10.5.tgz#d38425e67ea96b1480a3f50404d1bf85676301a6" + integrity sha512-mPVoWNzIpYJHbWje0if7Ck36bpbtTvIxOi9+6WSK9wjGEXearAqlwBoTQvVjsAY2VIwgcs8V940geY3okzRCEw== + dependencies: + browserslist "^4.12.0" + invariant "^2.2.4" + semver "^5.5.0" + +"@babel/core@^7.1.0", "@babel/core@^7.4.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.5.tgz#1f15e2cca8ad9a1d78a38ddba612f5e7cdbbd330" + integrity sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/generator" "^7.10.5" + "@babel/helper-module-transforms" "^7.10.5" + "@babel/helpers" "^7.10.4" + "@babel/parser" "^7.10.5" + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.10.5" + "@babel/types" "^7.10.5" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.1" + json5 "^2.1.2" + lodash "^4.17.19" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/generator@^7.10.5", "@babel/generator@^7.4.0": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.10.5.tgz#1b903554bc8c583ee8d25f1e8969732e6b829a69" + integrity sha512-3vXxr3FEW7E7lJZiWQ3bM4+v/Vyr9C+hpolQ8BGFr9Y8Ri2tFLWTixmwKBafDujO1WVah4fhZBeU1bieKdghig== + dependencies: + "@babel/types" "^7.10.5" + jsesc "^2.5.1" + source-map "^0.5.0" + +"@babel/helper-annotate-as-pure@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz#5bf0d495a3f757ac3bda48b5bf3b3ba309c72ba3" + integrity sha512-XQlqKQP4vXFB7BN8fEEerrmYvHp3fK/rBkRFz9jaJbzK0B1DSfej9Kc7ZzE8Z/OnId1jpJdNAZ3BFQjWG68rcA== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz#bb0b75f31bf98cbf9ff143c1ae578b87274ae1a3" + integrity sha512-L0zGlFrGWZK4PbT8AszSfLTM5sDU1+Az/En9VrdT8/LmEiJt4zXt+Jve9DCAnQcbqDhCI+29y/L93mrDzddCcg== + dependencies: + "@babel/helper-explode-assignable-expression" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-compilation-targets@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.10.4.tgz#804ae8e3f04376607cc791b9d47d540276332bd2" + integrity sha512-a3rYhlsGV0UHNDvrtOXBg8/OpfV0OKTkxKPzIplS1zpx7CygDcWWxckxZeDd3gzPzC4kUT0A4nVFDK0wGMh4MQ== + dependencies: + "@babel/compat-data" "^7.10.4" + browserslist "^4.12.0" + invariant "^2.2.4" + levenary "^1.1.1" + semver "^5.5.0" + +"@babel/helper-create-class-features-plugin@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.5.tgz#9f61446ba80e8240b0a5c85c6fdac8459d6f259d" + integrity sha512-0nkdeijB7VlZoLT3r/mY3bUkw3T8WG/hNw+FATs/6+pG2039IJWjTYL0VTISqsNHMUTEnwbVnc89WIJX9Qed0A== + dependencies: + "@babel/helper-function-name" "^7.10.4" + "@babel/helper-member-expression-to-functions" "^7.10.5" + "@babel/helper-optimise-call-expression" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-replace-supers" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.10.4" + +"@babel/helper-create-regexp-features-plugin@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.10.4.tgz#fdd60d88524659a0b6959c0579925e425714f3b8" + integrity sha512-2/hu58IEPKeoLF45DBwx3XFqsbCXmkdAay4spVr2x0jYgRxrSNp+ePwvSsy9g6YSaNDcKIQVPXk1Ov8S2edk2g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.10.4" + "@babel/helper-regex" "^7.10.4" + regexpu-core "^4.7.0" + +"@babel/helper-define-map@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz#b53c10db78a640800152692b13393147acb9bb30" + integrity sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ== + dependencies: + "@babel/helper-function-name" "^7.10.4" + "@babel/types" "^7.10.5" + lodash "^4.17.19" + +"@babel/helper-explode-assignable-expression@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.10.4.tgz#40a1cd917bff1288f699a94a75b37a1a2dbd8c7c" + integrity sha512-4K71RyRQNPRrR85sr5QY4X3VwG4wtVoXZB9+L3r1Gp38DhELyHCtovqydRi7c1Ovb17eRGiQ/FD5s8JdU0Uy5A== + dependencies: + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-function-name@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a" + integrity sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ== + dependencies: + "@babel/helper-get-function-arity" "^7.10.4" + "@babel/template" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-get-function-arity@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2" + integrity sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-hoist-variables@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz#d49b001d1d5a68ca5e6604dda01a6297f7c9381e" + integrity sha512-wljroF5PgCk2juF69kanHVs6vrLwIPNp6DLD+Lrl3hoQ3PpPPikaDRNFA+0t81NOoMt2DL6WW/mdU8k4k6ZzuA== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-member-expression-to-functions@^7.10.4", "@babel/helper-member-expression-to-functions@^7.10.5": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.5.tgz#172f56e7a63e78112f3a04055f24365af702e7ee" + integrity sha512-HiqJpYD5+WopCXIAbQDG0zye5XYVvcO9w/DHp5GsaGkRUaamLj2bEtu6i8rnGGprAhHM3qidCMgp71HF4endhA== + dependencies: + "@babel/types" "^7.10.5" + +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620" + integrity sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.10.5.tgz#120c271c0b3353673fcdfd8c053db3c544a260d6" + integrity sha512-4P+CWMJ6/j1W915ITJaUkadLObmCRRSC234uctJfn/vHrsLNxsR8dwlcXv9ZhJWzl77awf+mWXSZEKt5t0OnlA== + dependencies: + "@babel/helper-module-imports" "^7.10.4" + "@babel/helper-replace-supers" "^7.10.4" + "@babel/helper-simple-access" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.10.4" + "@babel/template" "^7.10.4" + "@babel/types" "^7.10.5" + lodash "^4.17.19" + +"@babel/helper-optimise-call-expression@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673" + integrity sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.8.0": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" + integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== + +"@babel/helper-regex@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.10.5.tgz#32dfbb79899073c415557053a19bd055aae50ae0" + integrity sha512-68kdUAzDrljqBrio7DYAEgCoJHxppJOERHOgOrDN7WjOzP0ZQ1LsSDRXcemzVZaLvjaJsJEESb6qt+znNuENDg== + dependencies: + lodash "^4.17.19" + +"@babel/helper-remap-async-to-generator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.10.4.tgz#fce8bea4e9690bbe923056ded21e54b4e8b68ed5" + integrity sha512-86Lsr6NNw3qTNl+TBcF1oRZMaVzJtbWTyTko+CQL/tvNvcGYEFKbLXDPxtW0HKk3McNOk4KzY55itGWCAGK5tg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.10.4" + "@babel/helper-wrap-function" "^7.10.4" + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-replace-supers@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz#d585cd9388ea06e6031e4cd44b6713cbead9e6cf" + integrity sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.10.4" + "@babel/helper-optimise-call-expression" "^7.10.4" + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-simple-access@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz#0f5ccda2945277a2a7a2d3a821e15395edcf3461" + integrity sha512-0fMy72ej/VEvF8ULmX6yb5MtHG4uH4Dbd6I/aHDb/JVg0bbivwt9Wg+h3uMvX+QSFtwr5MeItvazbrc4jtRAXw== + dependencies: + "@babel/template" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-split-export-declaration@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz#2c70576eaa3b5609b24cb99db2888cc3fc4251d1" + integrity sha512-pySBTeoUff56fL5CBU2hWm9TesA4r/rOkI9DyJLvvgz09MB9YtfIYe3iBriVaYNaPe+Alua0vBIOVOLs2buWhg== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-validator-identifier@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" + integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + +"@babel/helper-wrap-function@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.10.4.tgz#8a6f701eab0ff39f765b5a1cfef409990e624b87" + integrity sha512-6py45WvEF0MhiLrdxtRjKjufwLL1/ob2qDJgg5JgNdojBAZSAKnAjkyOCNug6n+OBl4VW76XjvgSFTdaMcW0Ug== + dependencies: + "@babel/helper-function-name" "^7.10.4" + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helpers@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.10.4.tgz#2abeb0d721aff7c0a97376b9e1f6f65d7a475044" + integrity sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA== + dependencies: + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/highlight@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" + integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.10.5", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.5.tgz#e7c6bf5a7deff957cec9f04b551e2762909d826b" + integrity sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ== + +"@babel/plugin-proposal-async-generator-functions@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz#3491cabf2f7c179ab820606cec27fed15e0e8558" + integrity sha512-cNMCVezQbrRGvXJwm9fu/1sJj9bHdGAgKodZdLqOQIpfoH3raqmRPBM17+lh7CzhiKRRBrGtZL9WcjxSoGYUSg== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-remap-async-to-generator" "^7.10.4" + "@babel/plugin-syntax-async-generators" "^7.8.0" + +"@babel/plugin-proposal-class-properties@^7.10.4", "@babel/plugin-proposal-class-properties@^7.4.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.10.4.tgz#a33bf632da390a59c7a8c570045d1115cd778807" + integrity sha512-vhwkEROxzcHGNu2mzUC0OFFNXdZ4M23ib8aRRcJSsW8BZK9pQMD7QB7csl97NBbgGZO7ZyHUyKDnxzOaP4IrCg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-proposal-dynamic-import@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.10.4.tgz#ba57a26cb98b37741e9d5bca1b8b0ddf8291f17e" + integrity sha512-up6oID1LeidOOASNXgv/CFbgBqTuKJ0cJjz6An5tWD+NVBNlp3VNSBxv2ZdU7SYl3NxJC7agAQDApZusV6uFwQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-dynamic-import" "^7.8.0" + +"@babel/plugin-proposal-json-strings@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.10.4.tgz#593e59c63528160233bd321b1aebe0820c2341db" + integrity sha512-fCL7QF0Jo83uy1K0P2YXrfX11tj3lkpN7l4dMv9Y9VkowkhkQDwFHFd8IiwyK5MZjE8UpbgokkgtcReH88Abaw== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-json-strings" "^7.8.0" + +"@babel/plugin-proposal-nullish-coalescing-operator@^7.10.4", "@babel/plugin-proposal-nullish-coalescing-operator@^7.7.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.10.4.tgz#02a7e961fc32e6d5b2db0649e01bf80ddee7e04a" + integrity sha512-wq5n1M3ZUlHl9sqT2ok1T2/MTt6AXE0e1Lz4WzWBr95LsAZ5qDXe4KnFuauYyEyLiohvXFMdbsOTMyLZs91Zlw== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" + +"@babel/plugin-proposal-numeric-separator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.10.4.tgz#ce1590ff0a65ad12970a609d78855e9a4c1aef06" + integrity sha512-73/G7QoRoeNkLZFxsoCCvlg4ezE4eM+57PnOqgaPOozd5myfj7p0muD1mRVJvbUWbOzD+q3No2bWbaKy+DJ8DA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + +"@babel/plugin-proposal-object-rest-spread@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.10.4.tgz#50129ac216b9a6a55b3853fdd923e74bf553a4c0" + integrity sha512-6vh4SqRuLLarjgeOf4EaROJAHjvu9Gl+/346PbDH9yWbJyfnJ/ah3jmYKYtswEyCoWZiidvVHjHshd4WgjB9BA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.0" + "@babel/plugin-transform-parameters" "^7.10.4" + +"@babel/plugin-proposal-optional-catch-binding@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.10.4.tgz#31c938309d24a78a49d68fdabffaa863758554dd" + integrity sha512-LflT6nPh+GK2MnFiKDyLiqSqVHkQnVf7hdoAvyTnnKj9xB3docGRsdPuxp6qqqW19ifK3xgc9U5/FwrSaCNX5g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" + +"@babel/plugin-proposal-optional-chaining@^7.10.4", "@babel/plugin-proposal-optional-chaining@^7.7.5": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.10.4.tgz#750f1255e930a1f82d8cdde45031f81a0d0adff7" + integrity sha512-ZIhQIEeavTgouyMSdZRap4VPPHqJJ3NEs2cuHs5p0erH+iz6khB0qfgU8g7UuJkG88+fBMy23ZiU+nuHvekJeQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-syntax-optional-chaining" "^7.8.0" + +"@babel/plugin-proposal-private-methods@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.10.4.tgz#b160d972b8fdba5c7d111a145fc8c421fc2a6909" + integrity sha512-wh5GJleuI8k3emgTg5KkJK6kHNsGEr0uBTDBuQUBJwckk9xs1ez79ioheEVVxMLyPscB0LfkbVHslQqIzWV6Bw== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-proposal-unicode-property-regex@^7.10.4", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.10.4.tgz#4483cda53041ce3413b7fe2f00022665ddfaa75d" + integrity sha512-H+3fOgPnEXFL9zGYtKQe4IDOPKYlZdF1kqFDQRRb8PK4B8af1vAGK04tF5iQAAsui+mHNBQSAtd2/ndEDe9wuA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-async-generators@^7.8.0": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.10.4.tgz#6644e6a0baa55a61f9e3231f6c9eeb6ee46c124c" + integrity sha512-GCSBF7iUle6rNugfURwNmCGG3Z/2+opxAMLs1nND4bhEG5PuxTIggDBoeYYSujAlLtsupzOHYJQgPS3pivwXIA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" + integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-json-strings@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-top-level-await@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.10.4.tgz#4bbeb8917b54fcf768364e0a81f560e33a3ef57d" + integrity sha512-ni1brg4lXEmWyafKr0ccFWkJG0CeMt4WV1oyeBW6EFObF4oOHclbkj5cARxAPQyAQ2UTuplJyK4nfkXIMMFvsQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-arrow-functions@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.10.4.tgz#e22960d77e697c74f41c501d44d73dbf8a6a64cd" + integrity sha512-9J/oD1jV0ZCBcgnoFWFq1vJd4msoKb/TCpGNFyyLt0zABdcvgK3aYikZ8HjzB14c26bc7E3Q1yugpwGy2aTPNA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-async-to-generator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.10.4.tgz#41a5017e49eb6f3cda9392a51eef29405b245a37" + integrity sha512-F6nREOan7J5UXTLsDsZG3DXmZSVofr2tGNwfdrVwkDWHfQckbQXnXSPfD7iO+c/2HGqycwyLST3DnZ16n+cBJQ== + dependencies: + "@babel/helper-module-imports" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-remap-async-to-generator" "^7.10.4" + +"@babel/plugin-transform-block-scoped-functions@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.10.4.tgz#1afa595744f75e43a91af73b0d998ecfe4ebc2e8" + integrity sha512-WzXDarQXYYfjaV1szJvN3AD7rZgZzC1JtjJZ8dMHUyiK8mxPRahynp14zzNjU3VkPqPsO38CzxiWO1c9ARZ8JA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-block-scoping@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.10.5.tgz#b81b8aafefbfe68f0f65f7ef397b9ece68a6037d" + integrity sha512-6Ycw3hjpQti0qssQcA6AMSFDHeNJ++R6dIMnpRqUjFeBBTmTDPa8zgF90OVfTvAo11mXZTlVUViY1g8ffrURLg== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-classes@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.10.4.tgz#405136af2b3e218bc4a1926228bc917ab1a0adc7" + integrity sha512-2oZ9qLjt161dn1ZE0Ms66xBncQH4In8Sqw1YWgBUZuGVJJS5c0OFZXL6dP2MRHrkU/eKhWg8CzFJhRQl50rQxA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.10.4" + "@babel/helper-define-map" "^7.10.4" + "@babel/helper-function-name" "^7.10.4" + "@babel/helper-optimise-call-expression" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-replace-supers" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.10.4" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.10.4.tgz#9ded83a816e82ded28d52d4b4ecbdd810cdfc0eb" + integrity sha512-JFwVDXcP/hM/TbyzGq3l/XWGut7p46Z3QvqFMXTfk6/09m7xZHJUN9xHfsv7vqqD4YnfI5ueYdSJtXqqBLyjBw== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-destructuring@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.10.4.tgz#70ddd2b3d1bea83d01509e9bb25ddb3a74fc85e5" + integrity sha512-+WmfvyfsyF603iPa6825mq6Qrb7uLjTOsa3XOFzlYcYDHSS4QmpOWOL0NNBY5qMbvrcf3tq0Cw+v4lxswOBpgA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-dotall-regex@^7.10.4", "@babel/plugin-transform-dotall-regex@^7.4.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.10.4.tgz#469c2062105c1eb6a040eaf4fac4b488078395ee" + integrity sha512-ZEAVvUTCMlMFAbASYSVQoxIbHm2OkG2MseW6bV2JjIygOjdVv8tuxrCTzj1+Rynh7ODb8GivUy7dzEXzEhuPaA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-duplicate-keys@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.10.4.tgz#697e50c9fee14380fe843d1f306b295617431e47" + integrity sha512-GL0/fJnmgMclHiBTTWXNlYjYsA7rDrtsazHG6mglaGSTh0KsrW04qml+Bbz9FL0LcJIRwBWL5ZqlNHKTkU3xAA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-exponentiation-operator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.10.4.tgz#5ae338c57f8cf4001bdb35607ae66b92d665af2e" + integrity sha512-S5HgLVgkBcRdyQAHbKj+7KyuWx8C6t5oETmUuwz1pt3WTWJhsUV0WIIXuVvfXMxl/QQyHKlSCNNtaIamG8fysw== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-for-of@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.10.4.tgz#c08892e8819d3a5db29031b115af511dbbfebae9" + integrity sha512-ItdQfAzu9AlEqmusA/65TqJ79eRcgGmpPPFvBnGILXZH975G0LNjP1yjHvGgfuCxqrPPueXOPe+FsvxmxKiHHQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-function-name@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.10.4.tgz#6a467880e0fc9638514ba369111811ddbe2644b7" + integrity sha512-OcDCq2y5+E0dVD5MagT5X+yTRbcvFjDI2ZVAottGH6tzqjx/LKpgkUepu3hp/u4tZBzxxpNGwLsAvGBvQ2mJzg== + dependencies: + "@babel/helper-function-name" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-literals@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.10.4.tgz#9f42ba0841100a135f22712d0e391c462f571f3c" + integrity sha512-Xd/dFSTEVuUWnyZiMu76/InZxLTYilOSr1UlHV+p115Z/Le2Fi1KXkJUYz0b42DfndostYlPub3m8ZTQlMaiqQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-member-expression-literals@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.10.4.tgz#b1ec44fcf195afcb8db2c62cd8e551c881baf8b7" + integrity sha512-0bFOvPyAoTBhtcJLr9VcwZqKmSjFml1iVxvPL0ReomGU53CX53HsM4h2SzckNdkQcHox1bpAqzxBI1Y09LlBSw== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-modules-amd@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.5.tgz#1b9cddaf05d9e88b3aad339cb3e445c4f020a9b1" + integrity sha512-elm5uruNio7CTLFItVC/rIzKLfQ17+fX7EVz5W0TMgIHFo1zY0Ozzx+lgwhL4plzl8OzVn6Qasx5DeEFyoNiRw== + dependencies: + "@babel/helper-module-transforms" "^7.10.5" + "@babel/helper-plugin-utils" "^7.10.4" + babel-plugin-dynamic-import-node "^2.3.3" + +"@babel/plugin-transform-modules-commonjs@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.10.4.tgz#66667c3eeda1ebf7896d41f1f16b17105a2fbca0" + integrity sha512-Xj7Uq5o80HDLlW64rVfDBhao6OX89HKUmb+9vWYaLXBZOma4gA6tw4Ni1O5qVDoZWUV0fxMYA0aYzOawz0l+1w== + dependencies: + "@babel/helper-module-transforms" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-simple-access" "^7.10.4" + babel-plugin-dynamic-import-node "^2.3.3" + +"@babel/plugin-transform-modules-systemjs@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.5.tgz#6270099c854066681bae9e05f87e1b9cadbe8c85" + integrity sha512-f4RLO/OL14/FP1AEbcsWMzpbUz6tssRaeQg11RH1BP/XnPpRoVwgeYViMFacnkaw4k4wjRSjn3ip1Uw9TaXuMw== + dependencies: + "@babel/helper-hoist-variables" "^7.10.4" + "@babel/helper-module-transforms" "^7.10.5" + "@babel/helper-plugin-utils" "^7.10.4" + babel-plugin-dynamic-import-node "^2.3.3" + +"@babel/plugin-transform-modules-umd@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.10.4.tgz#9a8481fe81b824654b3a0b65da3df89f3d21839e" + integrity sha512-mohW5q3uAEt8T45YT7Qc5ws6mWgJAaL/8BfWD9Dodo1A3RKWli8wTS+WiQ/knF+tXlPirW/1/MqzzGfCExKECA== + dependencies: + "@babel/helper-module-transforms" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-named-capturing-groups-regex@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.10.4.tgz#78b4d978810b6f3bcf03f9e318f2fc0ed41aecb6" + integrity sha512-V6LuOnD31kTkxQPhKiVYzYC/Jgdq53irJC/xBSmqcNcqFGV+PER4l6rU5SH2Vl7bH9mLDHcc0+l9HUOe4RNGKA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.10.4" + +"@babel/plugin-transform-new-target@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.10.4.tgz#9097d753cb7b024cb7381a3b2e52e9513a9c6888" + integrity sha512-YXwWUDAH/J6dlfwqlWsztI2Puz1NtUAubXhOPLQ5gjR/qmQ5U96DY4FQO8At33JN4XPBhrjB8I4eMmLROjjLjw== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-object-super@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.10.4.tgz#d7146c4d139433e7a6526f888c667e314a093894" + integrity sha512-5iTw0JkdRdJvr7sY0vHqTpnruUpTea32JHmq/atIWqsnNussbRzjEDyWep8UNztt1B5IusBYg8Irb0bLbiEBCQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-replace-supers" "^7.10.4" + +"@babel/plugin-transform-parameters@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.5.tgz#59d339d58d0b1950435f4043e74e2510005e2c4a" + integrity sha512-xPHwUj5RdFV8l1wuYiu5S9fqWGM2DrYc24TMvUiRrPVm+SM3XeqU9BcokQX/kEUe+p2RBwy+yoiR1w/Blq6ubw== + dependencies: + "@babel/helper-get-function-arity" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-property-literals@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.10.4.tgz#f6fe54b6590352298785b83edd815d214c42e3c0" + integrity sha512-ofsAcKiUxQ8TY4sScgsGeR2vJIsfrzqvFb9GvJ5UdXDzl+MyYCaBj/FGzXuv7qE0aJcjWMILny1epqelnFlz8g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-regenerator@^7.10.4", "@babel/plugin-transform-regenerator@^7.4.5": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.10.4.tgz#2015e59d839074e76838de2159db421966fd8b63" + integrity sha512-3thAHwtor39A7C04XucbMg17RcZ3Qppfxr22wYzZNcVIkPHfpM9J0SO8zuCV6SZa265kxBJSrfKTvDCYqBFXGw== + dependencies: + regenerator-transform "^0.14.2" + +"@babel/plugin-transform-reserved-words@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.10.4.tgz#8f2682bcdcef9ed327e1b0861585d7013f8a54dd" + integrity sha512-hGsw1O6Rew1fkFbDImZIEqA8GoidwTAilwCyWqLBM9f+e/u/sQMQu7uX6dyokfOayRuuVfKOW4O7HvaBWM+JlQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-runtime@^7.6.0": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.10.5.tgz#3b39b7b24830e0c2d8ff7a4489fe5cf99fbace86" + integrity sha512-tV4V/FjElJ9lQtyjr5xD2IFFbgY46r7EeVu5a8CpEKT5laheHKSlFeHjpkPppW3PqzGLAuv5k2qZX5LgVZIX5w== + dependencies: + "@babel/helper-module-imports" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + resolve "^1.8.1" + semver "^5.5.1" + +"@babel/plugin-transform-shorthand-properties@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.10.4.tgz#9fd25ec5cdd555bb7f473e5e6ee1c971eede4dd6" + integrity sha512-AC2K/t7o07KeTIxMoHneyX90v3zkm5cjHJEokrPEAGEy3UCp8sLKfnfOIGdZ194fyN4wfX/zZUWT9trJZ0qc+Q== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-spread@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.10.4.tgz#4e2c85ea0d6abaee1b24dcfbbae426fe8d674cff" + integrity sha512-1e/51G/Ni+7uH5gktbWv+eCED9pP8ZpRhZB3jOaI3mmzfvJTWHkuyYTv0Z5PYtyM+Tr2Ccr9kUdQxn60fI5WuQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-sticky-regex@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.10.4.tgz#8f3889ee8657581130a29d9cc91d7c73b7c4a28d" + integrity sha512-Ddy3QZfIbEV0VYcVtFDCjeE4xwVTJWTmUtorAJkn6u/92Z/nWJNV+mILyqHKrUxXYKA2EoCilgoPePymKL4DvQ== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-regex" "^7.10.4" + +"@babel/plugin-transform-template-literals@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.5.tgz#78bc5d626a6642db3312d9d0f001f5e7639fde8c" + integrity sha512-V/lnPGIb+KT12OQikDvgSuesRX14ck5FfJXt6+tXhdkJ+Vsd0lDCVtF6jcB4rNClYFzaB2jusZ+lNISDk2mMMw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-typeof-symbol@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.10.4.tgz#9509f1a7eec31c4edbffe137c16cc33ff0bc5bfc" + integrity sha512-QqNgYwuuW0y0H+kUE/GWSR45t/ccRhe14Fs/4ZRouNNQsyd4o3PG4OtHiIrepbM2WKUBDAXKCAK/Lk4VhzTaGA== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-unicode-escapes@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.10.4.tgz#feae523391c7651ddac115dae0a9d06857892007" + integrity sha512-y5XJ9waMti2J+e7ij20e+aH+fho7Wb7W8rNuu72aKRwCHFqQdhkdU2lo3uZ9tQuboEJcUFayXdARhcxLQ3+6Fg== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-transform-unicode-regex@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.10.4.tgz#e56d71f9282fac6db09c82742055576d5e6d80a8" + integrity sha512-wNfsc4s8N2qnIwpO/WP2ZiSyjfpTamT2C9V9FDH/Ljub9zw6P3SjkXcFmc0RQUt96k2fmIvtla2MMjgTwIAC+A== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/polyfill@^7.4.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.10.4.tgz#915e5bfe61490ac0199008e35ca9d7d151a8e45a" + integrity sha512-8BYcnVqQ5kMD2HXoHInBH7H1b/uP3KdnwCYXOqFnXqguOyuu443WXusbIUbWEfY3Z0Txk0M1uG/8YuAMhNl6zg== + dependencies: + core-js "^2.6.5" + regenerator-runtime "^0.13.4" + +"@babel/preset-env@^7.4.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.10.4.tgz#fbf57f9a803afd97f4f32e4f798bb62e4b2bef5f" + integrity sha512-tcmuQ6vupfMZPrLrc38d0sF2OjLT3/bZ0dry5HchNCQbrokoQi4reXqclvkkAT5b+gWc23meVWpve5P/7+w/zw== + dependencies: + "@babel/compat-data" "^7.10.4" + "@babel/helper-compilation-targets" "^7.10.4" + "@babel/helper-module-imports" "^7.10.4" + "@babel/helper-plugin-utils" "^7.10.4" + "@babel/plugin-proposal-async-generator-functions" "^7.10.4" + "@babel/plugin-proposal-class-properties" "^7.10.4" + "@babel/plugin-proposal-dynamic-import" "^7.10.4" + "@babel/plugin-proposal-json-strings" "^7.10.4" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.10.4" + "@babel/plugin-proposal-numeric-separator" "^7.10.4" + "@babel/plugin-proposal-object-rest-spread" "^7.10.4" + "@babel/plugin-proposal-optional-catch-binding" "^7.10.4" + "@babel/plugin-proposal-optional-chaining" "^7.10.4" + "@babel/plugin-proposal-private-methods" "^7.10.4" + "@babel/plugin-proposal-unicode-property-regex" "^7.10.4" + "@babel/plugin-syntax-async-generators" "^7.8.0" + "@babel/plugin-syntax-class-properties" "^7.10.4" + "@babel/plugin-syntax-dynamic-import" "^7.8.0" + "@babel/plugin-syntax-json-strings" "^7.8.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" + "@babel/plugin-syntax-optional-chaining" "^7.8.0" + "@babel/plugin-syntax-top-level-await" "^7.10.4" + "@babel/plugin-transform-arrow-functions" "^7.10.4" + "@babel/plugin-transform-async-to-generator" "^7.10.4" + "@babel/plugin-transform-block-scoped-functions" "^7.10.4" + "@babel/plugin-transform-block-scoping" "^7.10.4" + "@babel/plugin-transform-classes" "^7.10.4" + "@babel/plugin-transform-computed-properties" "^7.10.4" + "@babel/plugin-transform-destructuring" "^7.10.4" + "@babel/plugin-transform-dotall-regex" "^7.10.4" + "@babel/plugin-transform-duplicate-keys" "^7.10.4" + "@babel/plugin-transform-exponentiation-operator" "^7.10.4" + "@babel/plugin-transform-for-of" "^7.10.4" + "@babel/plugin-transform-function-name" "^7.10.4" + "@babel/plugin-transform-literals" "^7.10.4" + "@babel/plugin-transform-member-expression-literals" "^7.10.4" + "@babel/plugin-transform-modules-amd" "^7.10.4" + "@babel/plugin-transform-modules-commonjs" "^7.10.4" + "@babel/plugin-transform-modules-systemjs" "^7.10.4" + "@babel/plugin-transform-modules-umd" "^7.10.4" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.10.4" + "@babel/plugin-transform-new-target" "^7.10.4" + "@babel/plugin-transform-object-super" "^7.10.4" + "@babel/plugin-transform-parameters" "^7.10.4" + "@babel/plugin-transform-property-literals" "^7.10.4" + "@babel/plugin-transform-regenerator" "^7.10.4" + "@babel/plugin-transform-reserved-words" "^7.10.4" + "@babel/plugin-transform-shorthand-properties" "^7.10.4" + "@babel/plugin-transform-spread" "^7.10.4" + "@babel/plugin-transform-sticky-regex" "^7.10.4" + "@babel/plugin-transform-template-literals" "^7.10.4" + "@babel/plugin-transform-typeof-symbol" "^7.10.4" + "@babel/plugin-transform-unicode-escapes" "^7.10.4" + "@babel/plugin-transform-unicode-regex" "^7.10.4" + "@babel/preset-modules" "^0.1.3" + "@babel/types" "^7.10.4" + browserslist "^4.12.0" + core-js-compat "^3.6.2" + invariant "^2.2.2" + levenary "^1.1.1" + semver "^5.5.0" + +"@babel/preset-modules@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.3.tgz#13242b53b5ef8c883c3cf7dddd55b36ce80fbc72" + integrity sha512-Ra3JXOHBq2xd56xSF7lMKXdjBn3T772Y1Wet3yWnkDly9zHvJki029tAFzvAAK5cf4YV3yoxuP61crYRol6SVg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/types" "^7.4.4" + esutils "^2.0.2" + +"@babel/runtime-corejs3@^7.10.2": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.10.5.tgz#a57fe6c13045ca33768a2aa527ead795146febe1" + integrity sha512-RMafpmrNB5E/bwdSphLr8a8++9TosnyJp98RZzI6VOx2R2CCMpsXXXRvmI700O9oEKpXdZat6oEK68/F0zjd4A== + dependencies: + core-js-pure "^3.0.0" + regenerator-runtime "^0.13.4" + +"@babel/runtime@^7.10.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.5.tgz#303d8bd440ecd5a491eae6117fd3367698674c5c" + integrity sha512-otddXKhdNn7d0ptoFRHtMLa8LqDxLYwTjB4nYgM1yy5N6gU/MUf8zqyyLltCH3yAVitBzmwK4us+DD0l/MauAg== + dependencies: + regenerator-runtime "^0.13.4" + +"@babel/template@^7.10.4", "@babel/template@^7.4.0": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" + integrity sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/parser" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.4", "@babel/traverse@^7.10.5", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.10.5.tgz#77ce464f5b258be265af618d8fddf0536f20b564" + integrity sha512-yc/fyv2gUjPqzTz0WHeRJH2pv7jA9kA7mBX2tXl/x5iOE81uaVPuGPtaYk7wmkx4b67mQ7NqI8rmT2pF47KYKQ== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/generator" "^7.10.5" + "@babel/helper-function-name" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.10.4" + "@babel/parser" "^7.10.5" + "@babel/types" "^7.10.5" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.19" + +"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.5.tgz#d88ae7e2fde86bfbfe851d4d81afa70a997b5d15" + integrity sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" + lodash "^4.17.19" + to-fast-properties "^2.0.0" + +"@cnakazawa/watch@^1.0.3": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" + integrity sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + +"@ethersproject/abi@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.2.tgz#7fe8f080aa1483fe32cd27bb5b8f2019266af1e2" + integrity sha512-Z+5f7xOgtRLu/W2l9Ry5xF7ehh9QVQ0m1vhynmTcS7DMfHgqTd1/PDFC62aw91ZPRCRZsYdZJu8ymokC5e1JSw== + dependencies: + "@ethersproject/address" "^5.0.0" + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/constants" "^5.0.0" + "@ethersproject/hash" "^5.0.0" + "@ethersproject/keccak256" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + "@ethersproject/strings" "^5.0.0" + +"@ethersproject/abstract-provider@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.0.2.tgz#9b4e8f4870f0691463e8d5b092c95dd5275c635d" + integrity sha512-U1s60+nG02x8FKNMoVNI6MG8SguWCoG9HJtwOqWZ38LBRMsDV4c0w4izKx98kcsN3wXw4U2/YAyJ9LlH7+/hkg== + dependencies: + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/networks" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + "@ethersproject/transactions" "^5.0.0" + "@ethersproject/web" "^5.0.0" + +"@ethersproject/abstract-signer@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.0.2.tgz#5776f888fda816de1d08ddb0e74778ecb9590f69" + integrity sha512-CzzXbeqKlgayE4YTnvvreGBG3n+HxakGXrxaGM6LjBZnOOIVSYi6HMFG8ZXls7UspRY4hvMrtnKEJKDCOngSBw== + dependencies: + "@ethersproject/abstract-provider" "^5.0.0" + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + +"@ethersproject/address@^5.0.0", "@ethersproject/address@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.0.2.tgz#80d0ddfb7d4bd0d32657747fa4bdd2defef2e00a" + integrity sha512-+rz26RKj7ujGfQynys4V9VJRbR+wpC6eL8F22q3raWMH3152Ha31GwJPWzxE/bEA+43M/zTNVwY0R53gn53L2Q== + dependencies: + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/keccak256" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/rlp" "^5.0.0" + bn.js "^4.4.0" + +"@ethersproject/base64@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.0.2.tgz#48b3bb8d640a963bd8ee196cfeacd592155a0ca8" + integrity sha512-0FE5RH5cUDddOiQEDpWtyHjkSW4D5/rdJzA3KTZo8Fk5ab/Y8vdzqbamsXPyPsXU3gS+zCE5Qq4EKVOWlWLLTA== + dependencies: + "@ethersproject/bytes" "^5.0.0" + +"@ethersproject/bignumber@^5.0.0": + version "5.0.5" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.0.5.tgz#31bd7e75aad46ace345fae69b1f5bb120906af1b" + integrity sha512-24ln7PV0g8ZzjcVZiLW9Wod0i+XCmK6zKkAaxw5enraTIT1p7gVOcSXFSzNQ9WYAwtiFQPvvA+TIO2oEITZNJA== + dependencies: + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + bn.js "^4.4.0" + +"@ethersproject/bytes@^5.0.0": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.0.3.tgz#b3769963ae0188a35713d343890a903bda20af9c" + integrity sha512-AyPMAlY+Amaw4Zfp8OAivm1xYPI8mqiUYmEnSUk1CnS2NrQGHEMmFJFiOJdS3gDDpgSOFhWIjZwxKq2VZpqNTA== + dependencies: + "@ethersproject/logger" "^5.0.0" + +"@ethersproject/constants@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.0.2.tgz#f7ac0b320e2bbec1a5950da075015f8bc4e8fed1" + integrity sha512-nNoVlNP6bgpog7pQ2EyD1xjlaXcy1Cl4kK5v1KoskHj58EtB6TK8M8AFGi3GgHTdMldfT4eN3OsoQ/CdOTVNFA== + dependencies: + "@ethersproject/bignumber" "^5.0.0" + +"@ethersproject/contracts@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.0.2.tgz#f19ed8335ceeb6abb60f5d45641f0a2a62b6fbc5" + integrity sha512-Ud3oW8mBNIWE+WHRjvwVEwfvshn7lfYWSSKG0fPSb6baRN9mLOoNguX+VIv3W5Sne9w2utnBmxLF2ESXitw64A== + dependencies: + "@ethersproject/abi" "^5.0.0" + "@ethersproject/abstract-provider" "^5.0.0" + "@ethersproject/abstract-signer" "^5.0.0" + "@ethersproject/address" "^5.0.0" + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/constants" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + +"@ethersproject/hash@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.0.2.tgz#6d69558786961836d530b8b4a8714eac5388aec7" + integrity sha512-dWGvNwmVRX2bxoQQ3ciMw46Vzl1nqfL+5R8+2ZxsRXD3Cjgw1dL2mdjJF7xMMWPvPdrlhKXWSK0gb8VLwHZ8Cw== + dependencies: + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/keccak256" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/strings" "^5.0.0" + +"@ethersproject/keccak256@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.0.2.tgz#7ed4a95bb45ee502cf4532223833740a83602797" + integrity sha512-MbroXutc0gPNYIrUjS4Aw0lDuXabdzI7+l7elRWr1G6G+W0v00e/3gbikWkCReGtt2Jnt4lQSgnflhDwQGcIhA== + dependencies: + "@ethersproject/bytes" "^5.0.0" + js-sha3 "0.5.7" + +"@ethersproject/logger@^5.0.0": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.0.4.tgz#09fa4765b5691233e3afb6617cb38a700f9dd2e4" + integrity sha512-alA2LiAy1LdQ/L1SA9ajUC7MvGAEQLsICEfKK4erX5qhkXE1LwLSPIzobtOWFsMHf2yrXGKBLnnpuVHprI3sAw== + +"@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.0.2.tgz#a49e82cf071e3618e87e3c5d69fdbcf54dc6766c" + integrity sha512-T7HVd62D4izNU2tDHf6xUDo7k4JOGX4Lk7vDmVcDKrepSWwL2OmGWrqSlkRe2a1Dnz4+1VPE6fb6+KsmSRe82g== + dependencies: + "@ethersproject/logger" "^5.0.0" + +"@ethersproject/properties@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.0.2.tgz#2facb62d2f2d968c7b3d0befa5bcc884cc565d3b" + integrity sha512-FxAisPGAOACQjMJzewl9OJG6lsGCPTm5vpUMtfeoxzAlAb2lv+kHzQPUh9h4jfAILzE8AR1jgXMzRmlhwyra1Q== + dependencies: + "@ethersproject/logger" "^5.0.0" + +"@ethersproject/providers@^5.0.5": + version "5.0.5" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.5.tgz#fa28498ce9683d1d99f6cb11e1a7fe8d4886e0ce" + integrity sha512-ZR3yFg/m8qDl7317yXOHE7tKeGfoyZIZ/imhVC4JqAH+SX1rb6bdZcSjhJfet7rLmnJSsnYLTgIiVIT85aVLgg== + dependencies: + "@ethersproject/abstract-provider" "^5.0.0" + "@ethersproject/abstract-signer" "^5.0.0" + "@ethersproject/address" "^5.0.0" + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/constants" "^5.0.0" + "@ethersproject/hash" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/networks" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + "@ethersproject/random" "^5.0.0" + "@ethersproject/rlp" "^5.0.0" + "@ethersproject/strings" "^5.0.0" + "@ethersproject/transactions" "^5.0.0" + "@ethersproject/web" "^5.0.0" + ws "7.2.3" + +"@ethersproject/random@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.0.2.tgz#bb58aca69a85e8de506686117f050d03dac69023" + integrity sha512-kLeS+6bwz37WR2zbe69gudyoGVoUzljQO0LhifnATsZ7rW0JZ9Zgt0h5aXY7tqFDo9TvdqeCwUFdp1t3T5Fkhg== + dependencies: + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + +"@ethersproject/rlp@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.0.2.tgz#d6b550a2ac5e484f15f0f63337e522004d2e78cd" + integrity sha512-oE0M5jqQ67fi2SuMcrpoewOpEuoXaD8M9JeR9md1bXRMvDYgKXUtDHs22oevpEOdnO2DPIRabp6MVHa4aDuWmw== + dependencies: + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + +"@ethersproject/sha2@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.0.2.tgz#baefc78c071be8729b180759eb29267129314252" + integrity sha512-VFl4qSStjQZaygpqoAHswaCY59qBm1Sm0rf8iv0tmgVsRf0pBg2nJaNf9NXXvcuJ9AYPyXl57dN8kozdC4z5Cg== + dependencies: + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + hash.js "1.1.3" + +"@ethersproject/signing-key@^5.0.0": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.0.3.tgz#adb84360e147bfd336cb2fe114100120732dc10a" + integrity sha512-5QPZaBRGCLzfVMbFb3LcVjNR0UbTXnwDHASnQYfbzwUOnFYHKxHsrcbl/5ONGoppgi8yXgOocKqlPCFycJJVWQ== + dependencies: + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + elliptic "6.5.3" + +"@ethersproject/solidity@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.0.2.tgz#431cee341ec51e022bd897b93fef04521f414756" + integrity sha512-RygurUe1hPW1LDYAPXy4471AklGWNnxgFWc3YUE6H11gzkit26jr6AyZH4Yyjw38eBBL6j0AOfQzMWm+NhxZ9g== + dependencies: + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/keccak256" "^5.0.0" + "@ethersproject/sha2" "^5.0.0" + "@ethersproject/strings" "^5.0.0" + +"@ethersproject/strings@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.0.2.tgz#1753408c3c889813fd0992abd76393e3e47a2619" + integrity sha512-oNa+xvSqsFU96ndzog0IBTtsRFGOqGpzrXJ7shXLBT7juVeSEyZA/sYs0DMZB5mJ9FEjHdZKxR/rTyBY91vuXg== + dependencies: + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/constants" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + +"@ethersproject/transactions@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.0.2.tgz#590ede71fc87b45be7bd46002e18ae52246a2347" + integrity sha512-jZp0ZbbJlq4JLZY6qoMzNtp2HQsX6USQposi3ns0MPUdn3OdZJBDtrcO15r/2VS5t/K1e1GE5MI1HmMKlcTbbQ== + dependencies: + "@ethersproject/address" "^5.0.0" + "@ethersproject/bignumber" "^5.0.0" + "@ethersproject/bytes" "^5.0.0" + "@ethersproject/constants" "^5.0.0" + "@ethersproject/keccak256" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + "@ethersproject/rlp" "^5.0.0" + "@ethersproject/signing-key" "^5.0.0" + +"@ethersproject/web@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.0.2.tgz#6565b4c4fe2f56de9556d0e9a966c4ccc1b7b7da" + integrity sha512-uAlcxdrAWB9PXZlb5NPzbOOt5/m9EJP2c6eLw15/PXPkNNohEIKvdXXOWdcQgTjZ0pcAaD/9mnJ6HXg7NbqXiw== + dependencies: + "@ethersproject/base64" "^5.0.0" + "@ethersproject/logger" "^5.0.0" + "@ethersproject/properties" "^5.0.0" + "@ethersproject/strings" "^5.0.0" + +"@jest/console@^24.7.1", "@jest/console@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" + integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== + dependencies: + "@jest/source-map" "^24.9.0" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" + integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== + dependencies: + "@jest/console" "^24.7.1" + "@jest/reporters" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-changed-files "^24.9.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-resolve-dependencies "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + jest-watcher "^24.9.0" + micromatch "^3.1.10" + p-each-series "^1.0.0" + realpath-native "^1.1.0" + rimraf "^2.5.4" + slash "^2.0.0" + strip-ansi "^5.0.0" + +"@jest/environment@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" + integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== + dependencies: + "@jest/fake-timers" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + +"@jest/reporters@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" + integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + istanbul-lib-coverage "^2.0.2" + istanbul-lib-instrument "^3.0.1" + istanbul-lib-report "^2.0.4" + istanbul-lib-source-maps "^3.0.1" + istanbul-reports "^2.2.6" + jest-haste-map "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.6.0" + node-notifier "^5.4.2" + slash "^2.0.0" + source-map "^0.6.0" + string-length "^2.0.0" + +"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" + integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== + dependencies: + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/istanbul-lib-coverage" "^2.0.0" + +"@jest/test-sequencer@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" + integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== + dependencies: + "@jest/test-result" "^24.9.0" + jest-haste-map "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^24.9.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" + micromatch "^3.1.10" + pirates "^4.0.1" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^1.1.1" + "@types/yargs" "^13.0.0" + +"@rollup/plugin-commonjs@^11.0.0": + version "11.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz#60636c7a722f54b41e419e1709df05c7234557ef" + integrity sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA== + dependencies: + "@rollup/pluginutils" "^3.0.8" + commondir "^1.0.1" + estree-walker "^1.0.1" + glob "^7.1.2" + is-reference "^1.1.2" + magic-string "^0.25.2" + resolve "^1.11.0" + +"@rollup/plugin-json@^4.0.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3" + integrity sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw== + dependencies: + "@rollup/pluginutils" "^3.0.8" + +"@rollup/plugin-node-resolve@^6.0.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-6.1.0.tgz#0d2909f4bf606ae34d43a9bc8be06a9b0c850cf0" + integrity sha512-Cv7PDIvxdE40SWilY5WgZpqfIUEaDxFxs89zCAHjqyRwlTSuql4M5hjIuc5QYJkOH0/vyiyNXKD72O+LhRipGA== + dependencies: + "@rollup/pluginutils" "^3.0.0" + "@types/resolve" "0.0.8" + builtin-modules "^3.1.0" + is-module "^1.0.0" + resolve "^1.11.1" + +"@rollup/plugin-replace@^2.2.1": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.3.3.tgz#cd6bae39444de119f5d905322b91ebd4078562e7" + integrity sha512-XPmVXZ7IlaoWaJLkSCDaa0Y6uVo5XQYHhiMFzOd5qSv5rE+t/UJToPIOE56flKIxBFQI27ONsxb7dqHnwSsjKQ== + dependencies: + "@rollup/pluginutils" "^3.0.8" + magic-string "^0.25.5" + +"@rollup/pluginutils@^3.0.0", "@rollup/pluginutils@^3.0.8": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" + integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== + dependencies: + "@types/estree" "0.0.39" + estree-walker "^1.0.1" + picomatch "^2.2.2" + +"@types/babel__core@^7.1.0": + version "7.1.9" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.9.tgz#77e59d438522a6fb898fa43dc3455c6e72f3963d" + integrity sha512-sY2RsIJ5rpER1u3/aQ8OFSI7qGIy8o1NEEbgb2UaJcvOtXOMpd39ko723NBpjQFg9SIX7TXtjejZVGeIMLhoOw== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.1" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.1.tgz#4901767b397e8711aeb99df8d396d7ba7b7f0e04" + integrity sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.0.13" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.13.tgz#1874914be974a492e1b4cb00585cabb274e8ba18" + integrity sha512-i+zS7t6/s9cdQvbqKDARrcbrPvtJGlbYsMkazo03nTAK3RX9FNrLllXys22uiTGJapPOTZTQ35nHh4ISph4SLQ== + dependencies: + "@babel/types" "^7.3.0" + +"@types/big.js@^4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/big.js/-/big.js-4.0.5.tgz#62c61697646269e39191f24e55e8272f05f21fc0" + integrity sha512-D9KFrAt05FDSqLo7PU9TDHfDgkarlwdkuwFsg7Zm4xl62tTNaz+zN+Tkcdx2wGLBbSMf8BnoMhOVeUGUaJfLKg== + +"@types/color-name@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" + integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== + +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + +"@types/estree@*": + version "0.0.45" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.45.tgz#e9387572998e5ecdac221950dab3e8c3b16af884" + integrity sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g== + +"@types/estree@0.0.39": + version "0.0.39" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" + integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== + +"@types/glob@*": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.3.tgz#e6ba80f36b7daad2c685acd9266382e68985c183" + integrity sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" + integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== + +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^1.1.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz#e875cc689e47bce549ec81f3df5e6f6f11cfaeb2" + integrity sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw== + dependencies: + "@types/istanbul-lib-coverage" "*" + "@types/istanbul-lib-report" "*" + +"@types/jest@^24.0.25": + version "24.9.1" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.9.1.tgz#02baf9573c78f1b9974a5f36778b366aa77bd534" + integrity sha512-Fb38HkXSVA4L8fGKEZ6le5bB8r6MRWlOCZbVuWZcmOMSCd2wCYOwN1ibj8daIoV9naq7aaOZjrLCoCMptKU/4Q== + dependencies: + jest-diff "^24.3.0" + +"@types/json-schema@^7.0.3": + version "7.0.5" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" + integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ== + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + +"@types/node@*": + version "14.0.26" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.26.tgz#22a3b8a46510da8944b67bfc27df02c34a35331c" + integrity sha512-W+fpe5s91FBGE0pEa0lnqGLL4USgpLgs4nokw16SrBBco/gQxuua7KnArSEOd5iaMqbbSHV10vUDkJYJJqpXKA== + +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + +"@types/resolve@0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" + integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== + dependencies: + "@types/node" "*" + +"@types/rimraf@^2.0.2": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-2.0.4.tgz#403887b0b53c6100a6c35d2ab24f6ccc042fec46" + integrity sha512-8gBudvllD2A/c0CcEX/BivIDorHFt5UI5m46TsNj8DjWCCTTZT74kEe4g+QsY7P/B9WdO98d82zZgXO/RQzu2Q== + dependencies: + "@types/glob" "*" + "@types/node" "*" + +"@types/shelljs@^0.8.5": + version "0.8.8" + resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.8.8.tgz#e439c69929b88a2c8123c1a55e09eb708315addf" + integrity sha512-lD3LWdg6j8r0VRBFahJVaxoW0SIcswxKaFUrmKl33RJVeeoNYQAz4uqCJ5Z6v4oIBOsC5GozX+I5SorIKiTcQA== + dependencies: + "@types/glob" "*" + "@types/node" "*" + +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/yargs-parser@*": + version "15.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d" + integrity sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw== + +"@types/yargs@^13.0.0": + version "13.0.9" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.9.tgz#44028e974343c7afcf3960f1a2b1099c39a7b5e1" + integrity sha512-xrvhZ4DZewMDhoH1utLtOAwYQy60eYFoXeje30TzM3VOvQlBwQaEpKFq5m34k1wOw2AKIi2pwtiAjdmhvlBUzg== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/eslint-plugin@^2.12.0": + version "2.34.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9" + integrity sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ== + dependencies: + "@typescript-eslint/experimental-utils" "2.34.0" + functional-red-black-tree "^1.0.1" + regexpp "^3.0.0" + tsutils "^3.17.1" + +"@typescript-eslint/experimental-utils@2.34.0": + version "2.34.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f" + integrity sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.34.0" + eslint-scope "^5.0.0" + eslint-utils "^2.0.0" + +"@typescript-eslint/parser@^2.12.0": + version "2.34.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8" + integrity sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.34.0" + "@typescript-eslint/typescript-estree" "2.34.0" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@2.34.0": + version "2.34.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5" + integrity sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^7.3.2" + tsutils "^3.17.1" + +"@uniswap/v2-core@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@uniswap/v2-core/-/v2-core-1.0.1.tgz#af8f508bf183204779938969e2e54043e147d425" + integrity sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q== + +abab@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" + integrity sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg== + +acorn-globals@^4.1.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" + integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== + dependencies: + acorn "^6.0.1" + acorn-walk "^6.0.1" + +acorn-jsx@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" + integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== + +acorn-walk@^6.0.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" + integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== + +acorn@^5.5.3: + version "5.7.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" + integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== + +acorn@^6.0.1: + version "6.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" + integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== + +acorn@^7.1.0, acorn@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.3.1.tgz#85010754db53c3fbaf3b9ea3e083aa5c5d147ffd" + integrity sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA== + +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: + version "6.12.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.3.tgz#18c5af38a111ddeb4f2697bd78d68abc1cabd706" + integrity sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-colors@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + +ansi-escapes@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + +ansi-escapes@^4.2.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" + integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== + dependencies: + type-fest "^0.11.0" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.0.0, ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" + integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== + dependencies: + "@types/color-name" "^1.1.1" + color-convert "^2.0.1" + +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +aria-query@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-4.2.2.tgz#0d2ca6c9aceb56b8977e9fed6aed7e15bbd2f83b" + integrity sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA== + dependencies: + "@babel/runtime" "^7.10.2" + "@babel/runtime-corejs3" "^7.10.2" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= + +array-includes@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.1.tgz#cdd67e6852bdf9c1215460786732255ed2459348" + integrity sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0" + is-string "^1.0.5" + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +array.prototype.flat@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz#0de82b426b0318dbfdb940089e38b043d37f6c7b" + integrity sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + +array.prototype.flatmap@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz#1c13f84a178566042dd63de4414440db9222e443" + integrity sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + function-bind "^1.1.1" + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +ast-types-flow@^0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" + integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +async-each@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" + integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== + +async-limiter@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +asyncro@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/asyncro/-/asyncro-3.0.0.tgz#3c7a732e263bc4a42499042f48d7d858e9c0134e" + integrity sha512-nEnWYfrBmA3taTiuiOoZYmgJ/CNrSoQLeLs29SeLcPu60yaw/mHDBHV0iOZ051fTvsTHxpCY+gXibqT9wbQYfg== + +atob@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.10.0.tgz#a17b3a8ea811060e74d47d306122400ad4497ae2" + integrity sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA== + +axe-core@^3.5.4: + version "3.5.5" + resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-3.5.5.tgz#84315073b53fa3c0c51676c588d59da09a192227" + integrity sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q== + +axobject-query@^2.1.2: + version "2.2.0" + resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be" + integrity sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA== + +babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-eslint@^10.0.3: + version "10.1.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" + integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" + eslint-visitor-keys "^1.0.0" + resolve "^1.12.0" + +babel-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" + integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== + dependencies: + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/babel__core" "^7.1.0" + babel-plugin-istanbul "^5.1.0" + babel-preset-jest "^24.9.0" + chalk "^2.4.2" + slash "^2.0.0" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-annotate-pure-calls@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/babel-plugin-annotate-pure-calls/-/babel-plugin-annotate-pure-calls-0.4.0.tgz#78aa00fd878c4fcde4d49f3da397fcf5defbcce8" + integrity sha512-oi4M/PWUJOU9ZyRGoPTfPMqdyMp06jbJAomd3RcyYuzUtBOddv98BqLm96Lucpi2QFoQHkdGQt0ACvw7VzVEQA== + +babel-plugin-dev-expression@^0.2.1: + version "0.2.2" + resolved "https://registry.yarnpkg.com/babel-plugin-dev-expression/-/babel-plugin-dev-expression-0.2.2.tgz#c18de18a06150f9480edd151acbb01d2e65e999b" + integrity sha512-y32lfBif+c2FIh5dwGfcc/IfX5aw/Bru7Du7W2n17sJE/GJGAsmIk5DPW/8JOoeKpXW5evJfJOvRq5xkiS6vng== + +babel-plugin-dynamic-import-node@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" + integrity sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ== + dependencies: + object.assign "^4.1.0" + +babel-plugin-istanbul@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" + integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + find-up "^3.0.0" + istanbul-lib-instrument "^3.3.0" + test-exclude "^5.2.3" + +babel-plugin-jest-hoist@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" + integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== + dependencies: + "@types/babel__traverse" "^7.0.6" + +babel-plugin-macros@^2.6.1: + version "2.8.0" + resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138" + integrity sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg== + dependencies: + "@babel/runtime" "^7.7.2" + cosmiconfig "^6.0.0" + resolve "^1.12.0" + +babel-plugin-transform-async-to-promises@^0.8.14: + version "0.8.15" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-promises/-/babel-plugin-transform-async-to-promises-0.8.15.tgz#13b6d8ef13676b4e3c576d3600b85344bb1ba346" + integrity sha512-fDXP68ZqcinZO2WCiimCL9zhGjGXOnn3D33zvbh+yheZ/qOrNVVDDIBtAaM3Faz8TRvQzHiRKsu3hfrBAhEncQ== + +babel-plugin-transform-jsbi-to-bigint@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-jsbi-to-bigint/-/babel-plugin-transform-jsbi-to-bigint-1.3.1.tgz#46af5c4446bbe931572a438d9d5a5e73ae9b2c3c" + integrity sha512-X6rGczRam63X+hLIPpDj0lmTOtRqF4hdkJDiFRfvlr8BgOwIXvz02yb5QMa8uSM2kAwMbFXsv9d6GEViufGdxw== + +babel-plugin-transform-rename-import@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-rename-import/-/babel-plugin-transform-rename-import-2.3.0.tgz#5d9d645f937b0ca5c26a24b2510a06277b6ffd9b" + integrity sha512-dPgJoT57XC0PqSnLgl2FwNvxFrWlspatX2dkk7yjKQj5HHGw071vAcOf+hqW8ClqcBDMvEbm6mevn5yHAD8mlQ== + +babel-preset-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" + integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== + dependencies: + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + babel-plugin-jest-hoist "^24.9.0" + +babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +big.js@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" + integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== + +binary-extensions@^1.0.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== + +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +bluebird@3.5.5: + version "3.5.5" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" + integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== + +bn.js@^4.4.0: + version "4.11.9" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" + integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^2.3.1, braces@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +brorand@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + +browser-process-hrtime@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" + integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== + +browser-resolve@^1.11.3: + version "1.11.3" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" + integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== + dependencies: + resolve "1.1.7" + +browserslist@^4.12.0, browserslist@^4.8.5: + version "4.13.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.13.0.tgz#42556cba011e1b0a2775b611cba6a8eca18e940d" + integrity sha512-MINatJ5ZNrLnQ6blGvePd/QOz9Xtu+Ne+x29iQSCHfkU5BugKVJwZKn/iiL8UbpIpa3JhviKjz+XxMo0m2caFQ== + dependencies: + caniuse-lite "^1.0.30001093" + electron-to-chromium "^1.3.488" + escalade "^3.0.1" + node-releases "^1.1.58" + +bs-logger@0.x: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-from@1.x, buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +builtin-modules@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" + integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camel-case@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" + integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M= + dependencies: + no-case "^2.2.0" + upper-case "^1.1.1" + +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= + +camelcase@^5.0.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +caniuse-lite@^1.0.30001093: + version "1.0.30001105" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001105.tgz#d2cb0b31e5cf2f3ce845033b61c5c01566549abf" + integrity sha512-JupOe6+dGMr7E20siZHIZQwYqrllxotAhiaej96y6x00b/48rPt42o+SzOSCPbrpsDWvRja40Hwrj0g0q6LZJg== + +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== + dependencies: + rsvp "^4.8.4" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + +chokidar-cli@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/chokidar-cli/-/chokidar-cli-1.2.3.tgz#28fe28da1c3a12b444f52ddbe8a472358a32279f" + integrity sha512-HcHjqeQaT/u0Swy4eaqqg0NhPjsXq6ZN9YzP48EYc81FXBLQuvMXBsrEMDkgH+Puup1mBc0gD0qqECDy/WiMOA== + dependencies: + bluebird "3.5.5" + chokidar "2.1.5" + lodash "4.17.15" + yargs "13.3.0" + +chokidar@2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.5.tgz#0ae8434d962281a5f56c72869e79cb6d9d86ad4d" + integrity sha512-i0TprVWp+Kj4WRPtInjexJ8Q+BqTE909VpH8xVhXrJkoc5QC8VO9TryGOqTr+2hljzc1sC62t22h5tZePodM/A== + dependencies: + anymatch "^2.0.0" + async-each "^1.0.1" + braces "^2.3.2" + glob-parent "^3.1.0" + inherits "^2.0.3" + is-binary-path "^1.0.0" + is-glob "^4.0.0" + normalize-path "^3.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.2.1" + upath "^1.1.1" + optionalDependencies: + fsevents "^1.2.7" + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cli-cursor@^2.0.0, cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + +cli-spinners@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.3.1.tgz#002c1990912d0d59580c93bd36c056de99e4259a" + integrity sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg== + +cli-spinners@^2.0.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.4.0.tgz#c6256db216b878cfba4720e719cec7cf72685d7f" + integrity sha512-sJAofoarcm76ZGpuooaO0eDy8saEy+YoZBLjC4h8srt4jeBnkYeOgqxgsJQTpyt2LjI5PTfLJHSL+41Yu4fEJA== + +cli-width@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" + integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +clone@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +confusing-browser-globals@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz#72bc13b483c0276801681871d4898516f8f54fdd" + integrity sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw== + +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= + +convert-source-map@^1.4.0, convert-source-map@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" + integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== + dependencies: + safe-buffer "~5.1.1" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js-compat@^3.6.2: + version "3.6.5" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.5.tgz#2a51d9a4e25dfd6e690251aa81f99e3c05481f1c" + integrity sha512-7ItTKOhOZbznhXAQ2g/slGg1PJV5zDO/WdkTwi7UEOJmkvsE32PWvx6mKtDjiMpjnR2CNf6BAD6sSxIlv7ptng== + dependencies: + browserslist "^4.8.5" + semver "7.0.0" + +core-js-pure@^3.0.0: + version "3.6.5" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813" + integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA== + +core-js@^2.4.0, core-js@^2.6.5: + version "2.6.11" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" + integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== + +core-util-is@1.0.2, core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +cosmiconfig@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" + integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.1.0" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.7.2" + +cross-env@6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-6.0.3.tgz#4256b71e49b3a40637a0ce70768a6ef5c72ae941" + integrity sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag== + dependencies: + cross-spawn "^7.0.0" + +cross-spawn@^6.0.0, cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^7.0.0: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" + integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== + dependencies: + cssom "0.3.x" + +damerau-levenshtein@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.6.tgz#143c1641cb3d85c60c32329e26899adea8701791" + integrity sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug== + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +data-urls@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== + dependencies: + abab "^2.0.0" + whatwg-mimetype "^2.2.0" + whatwg-url "^7.0.0" + +debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decimal.js-light@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/decimal.js-light/-/decimal.js-light-2.5.0.tgz#ca7faf504c799326df94b0ab920424fdfc125348" + integrity sha512-b3VJCbd2hwUpeRGG3Toob+CRo8W22xplipNhP3tN7TSVB/cyMX71P1vM2Xjc9H74uV6dS2hDDmo/rHq8L87Upg== + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +defaults@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= + dependencies: + clone "^1.0.2" + +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +detect-newline@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= + +diff-sequences@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" + integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== + +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +domexception@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== + dependencies: + webidl-conversions "^4.0.2" + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +electron-to-chromium@^1.3.488: + version "1.3.509" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.509.tgz#830fcb89cd66dc2984d18d794973b99e3f00584c" + integrity sha512-cN4lkjNRuTG8rtAqTOVgwpecEC2kbKA04PG6YijcKGHK/kD0xLjiqExcAOmLUwtXZRF8cBeam2I0VZcih919Ug== + +elliptic@6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" + integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== + dependencies: + bn.js "^4.4.0" + brorand "^1.0.1" + hash.js "^1.0.0" + hmac-drbg "^1.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.0" + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.0.0.tgz#48a2309cc8a1d2e9d23bc6a67c39b63032e76ea4" + integrity sha512-6p1NII1Vm62wni/VR/cUMauVQoxmLVb9csqQlvLz+hO2gk8U2UYDfXHQSUYIBKmZwAKz867IDqG7B+u0mj+M6w== + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +enquirer@^2.3.0: + version "2.3.6" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" + integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + dependencies: + ansi-colors "^4.1.1" + +error-ex@^1.2.0, error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5: + version "1.17.6" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" + integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== + dependencies: + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + is-callable "^1.2.0" + is-regex "^1.1.0" + object-inspect "^1.7.0" + object-keys "^1.1.1" + object.assign "^4.1.0" + string.prototype.trimend "^1.0.1" + string.prototype.trimstart "^1.0.1" + +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + +escalade@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.0.2.tgz#6a580d70edb87880f22b4c91d0d56078df6962c4" + integrity sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ== + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +escodegen@^1.9.1: + version "1.14.3" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503" + integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw== + dependencies: + esprima "^4.0.1" + estraverse "^4.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.6.1" + +eslint-config-prettier@^6.0.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1" + integrity sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA== + dependencies: + get-stdin "^6.0.0" + +eslint-config-react-app@^5.0.2: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-5.2.1.tgz#698bf7aeee27f0cea0139eaef261c7bf7dd623df" + integrity sha512-pGIZ8t0mFLcV+6ZirRgYK6RVqUIKRIi9MmgzUEmrIknsn3AdO0I32asO86dJgloHq+9ZPl8UIg8mYrvgP5u2wQ== + dependencies: + confusing-browser-globals "^1.0.9" + +eslint-import-resolver-node@^0.3.3: + version "0.3.4" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" + integrity sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== + dependencies: + debug "^2.6.9" + resolve "^1.13.1" + +eslint-module-utils@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" + integrity sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== + dependencies: + debug "^2.6.9" + pkg-dir "^2.0.0" + +eslint-plugin-flowtype@^3.13.0: + version "3.13.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz#e241ebd39c0ce519345a3f074ec1ebde4cf80f2c" + integrity sha512-bhewp36P+t7cEV0b6OdmoRWJCBYRiHFlqPZAG1oS3SF+Y0LQkeDvFSM4oxoxvczD1OdONCXMlJfQFiWLcV9urw== + dependencies: + lodash "^4.17.15" + +eslint-plugin-import@^2.18.2: + version "2.22.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.0.tgz#92f7736fe1fde3e2de77623c838dd992ff5ffb7e" + integrity sha512-66Fpf1Ln6aIS5Gr/55ts19eUuoDhAbZgnr6UxK5hbDx6l/QgQgx61AePq+BV4PP2uXQFClgMVzep5zZ94qqsxg== + dependencies: + array-includes "^3.1.1" + array.prototype.flat "^1.2.3" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.3" + eslint-module-utils "^2.6.0" + has "^1.0.3" + minimatch "^3.0.4" + object.values "^1.1.1" + read-pkg-up "^2.0.0" + resolve "^1.17.0" + tsconfig-paths "^3.9.0" + +eslint-plugin-jsx-a11y@^6.2.3: + version "6.3.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.3.1.tgz#99ef7e97f567cc6a5b8dd5ab95a94a67058a2660" + integrity sha512-i1S+P+c3HOlBJzMFORRbC58tHa65Kbo8b52/TwCwSKLohwvpfT5rm2GjGWzOHTEuq4xxf2aRlHHTtmExDQOP+g== + dependencies: + "@babel/runtime" "^7.10.2" + aria-query "^4.2.2" + array-includes "^3.1.1" + ast-types-flow "^0.0.7" + axe-core "^3.5.4" + axobject-query "^2.1.2" + damerau-levenshtein "^1.0.6" + emoji-regex "^9.0.0" + has "^1.0.3" + jsx-ast-utils "^2.4.1" + language-tags "^1.0.5" + +eslint-plugin-prettier@^3.1.0: + version "3.1.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" + integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-plugin-react-hooks@^2.2.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.5.1.tgz#4ef5930592588ce171abeb26f400c7fbcbc23cd0" + integrity sha512-Y2c4b55R+6ZzwtTppKwSmK/Kar8AdLiC2f9NADCuxbcTgPPg41Gyqa6b9GppgXSvCtkRw43ZE86CT5sejKC6/g== + +eslint-plugin-react@^7.14.3: + version "7.20.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.20.3.tgz#0590525e7eb83890ce71f73c2cf836284ad8c2f1" + integrity sha512-txbo090buDeyV0ugF3YMWrzLIUqpYTsWSDZV9xLSmExE1P/Kmgg9++PD931r+KEWS66O1c9R4srLVVHmeHpoAg== + dependencies: + array-includes "^3.1.1" + array.prototype.flatmap "^1.2.3" + doctrine "^2.1.0" + has "^1.0.3" + jsx-ast-utils "^2.4.1" + object.entries "^1.1.2" + object.fromentries "^2.0.2" + object.values "^1.1.1" + prop-types "^15.7.2" + resolve "^1.17.0" + string.prototype.matchall "^4.0.2" + +eslint-scope@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" + integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" + integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== + dependencies: + eslint-visitor-keys "^1.1.0" + +eslint-utils@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" + integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== + dependencies: + eslint-visitor-keys "^1.1.0" + +eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" + integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== + +eslint@^6.1.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" + integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.3" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^7.0.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.14" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.3" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" + table "^5.2.3" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^6.1.2: + version "6.2.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" + integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== + dependencies: + acorn "^7.1.1" + acorn-jsx "^5.2.0" + eslint-visitor-keys "^1.1.0" + +esprima@^4.0.0, esprima@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" + integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.1.0.tgz#374309d39fd935ae500e7b92e8a6b4c720e59642" + integrity sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw== + +estree-walker@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== + +estree-walker@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" + integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +exec-sh@^0.3.2: + version "0.3.4" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" + integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== + +execa@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-3.2.0.tgz#18326b79c7ab7fbd6610fd900c1b9e95fa48f90a" + integrity sha512-kJJfVbI/lZE1PZYDI5VPxp8zXPO9rtxOkhpZ0jMKha56AI9y2gGVC6bkukStQf0ka5Rh15BA5m7cCCH4jmHqkw== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expect@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" + integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== + dependencies: + "@jest/types" "^24.9.0" + ansi-styles "^3.2.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.9.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +fb-watchman@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" + integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg== + dependencies: + bser "2.1.1" + +figures@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" + integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +find-cache-dir@^3.0.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880" + integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ== + dependencies: + commondir "^1.0.1" + make-dir "^3.0.2" + pkg-dir "^4.1.0" + +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +find-up@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== + +for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fs-extra@8.1.0, fs-extra@^8.0.1: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@^1.2.7: + version "1.2.13" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38" + integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw== + dependencies: + bindings "^1.5.0" + nan "^2.12.1" + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + +gensync@^1.0.0-beta.1: + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" + integrity sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== + dependencies: + pump "^3.0.0" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +glob-parent@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= + dependencies: + is-glob "^3.1.0" + path-dirname "^1.0.0" + +glob-parent@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" + integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + dependencies: + is-glob "^4.0.1" + +glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^12.1.0: + version "12.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" + integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== + dependencies: + type-fest "^0.8.1" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== + +globalyzer@^0.1.0: + version "0.1.4" + resolved "https://registry.yarnpkg.com/globalyzer/-/globalyzer-0.1.4.tgz#bc8e273afe1ac7c24eea8def5b802340c5cc534f" + integrity sha512-LeguVWaxgHN0MNbWC6YljNMzHkrCny9fzjmEUdnF1kQ7wATFD1RHFRqA1qxaX2tgxGENlcxjOflopBwj3YZiXA== + +globrex@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" + integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== + +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" + integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-symbols@^1.0.0, has-symbols@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +hash.js@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846" + integrity sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.0" + +hash.js@^1.0.0, hash.js@^1.0.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +hmac-drbg@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +hosted-git-info@^2.1.4: + version "2.8.8" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" + integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + +html-encoding-sniffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== + dependencies: + whatwg-encoding "^1.0.1" + +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== + +humanize-duration@^3.15.3: + version "3.23.1" + resolved "https://registry.yarnpkg.com/humanize-duration/-/humanize-duration-3.23.1.tgz#59cb8d01287479c1aa7cd5b1efc260d799bef89b" + integrity sha512-aoOEkomAETmVuQyBx4E7/LfPlC9s8pAA/USl7vFRQpDjepo3aiyvFfOhtXSDqPowdBVPFUZ7onG/KyuolX0qPg== + +iconv-lite@0.4.24, iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +import-fresh@^3.0.0, import-fresh@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +import-local@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" + integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== + dependencies: + pkg-dir "^3.0.0" + resolve-cwd "^2.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +inquirer@^7.0.0: + version "7.3.3" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" + integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA== + dependencies: + ansi-escapes "^4.2.1" + chalk "^4.1.0" + cli-cursor "^3.1.0" + cli-width "^3.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.19" + mute-stream "0.0.8" + run-async "^2.4.0" + rxjs "^6.6.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + through "^2.3.6" + +internal-slot@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.2.tgz#9c2e9fb3cd8e5e4256c6f45fe310067fcfa378a3" + integrity sha512-2cQNfwhAfJIkU4KZPkDI+Gj5yNNnbqi40W9Gge6dfnk4TocEVm00B3bdiL+JINrbGJil2TeHvM4rETGzk/f/0g== + dependencies: + es-abstract "^1.17.0-next.1" + has "^1.0.3" + side-channel "^1.0.2" + +interpret@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" + integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== + +invariant@^2.2.2, invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= + dependencies: + binary-extensions "^1.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-callable@^1.1.4, is-callable@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" + integrity sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw== + +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-date-object@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" + integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^2.1.0, is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-glob@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= + dependencies: + is-extglob "^2.1.0" + +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-reference@^1.1.2: + 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.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.0.tgz#ece38e389e490df0dc21caea2bd596f987f767ff" + integrity sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw== + dependencies: + has-symbols "^1.0.1" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + +is-string@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" + integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== + +is-symbol@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== + dependencies: + has-symbols "^1.0.1" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" + integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== + +istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" + integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== + dependencies: + "@babel/generator" "^7.4.0" + "@babel/parser" "^7.4.3" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" + istanbul-lib-coverage "^2.0.5" + semver "^6.0.0" + +istanbul-lib-report@^2.0.4: + version "2.0.8" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" + integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== + dependencies: + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + supports-color "^6.1.0" + +istanbul-lib-source-maps@^3.0.1: + version "3.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" + integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + rimraf "^2.6.3" + source-map "^0.6.1" + +istanbul-reports@^2.2.6: + version "2.2.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.7.tgz#5d939f6237d7b48393cc0959eab40cd4fd056931" + integrity sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg== + dependencies: + html-escaper "^2.0.0" + +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== + dependencies: + "@jest/types" "^24.9.0" + execa "^1.0.0" + throat "^4.0.0" + +jest-cli@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" + integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== + dependencies: + "@jest/core" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + exit "^0.1.2" + import-local "^2.0.0" + is-ci "^2.0.0" + jest-config "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + prompts "^2.0.1" + realpath-native "^1.1.0" + yargs "^13.3.0" + +jest-config@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" + integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/test-sequencer" "^24.9.0" + "@jest/types" "^24.9.0" + babel-jest "^24.9.0" + chalk "^2.0.1" + glob "^7.1.1" + jest-environment-jsdom "^24.9.0" + jest-environment-node "^24.9.0" + jest-get-type "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + micromatch "^3.1.10" + pretty-format "^24.9.0" + realpath-native "^1.1.0" + +jest-diff@^24.3.0, jest-diff@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== + dependencies: + chalk "^2.0.1" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-docblock@^24.3.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" + integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== + dependencies: + detect-newline "^2.1.0" + +jest-each@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" + integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== + dependencies: + "@jest/types" "^24.9.0" + chalk "^2.0.1" + jest-get-type "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + +jest-environment-jsdom@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" + integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" + jsdom "^11.5.1" + +jest-environment-node@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" + integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" + +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== + +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== + dependencies: + "@jest/types" "^24.9.0" + anymatch "^2.0.0" + fb-watchman "^2.0.0" + graceful-fs "^4.1.15" + invariant "^2.2.4" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" + micromatch "^3.1.10" + sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^1.2.7" + +jest-jasmine2@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" + integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== + dependencies: + "@babel/traverse" "^7.1.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + co "^4.6.0" + expect "^24.9.0" + is-generator-fn "^2.0.0" + jest-each "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + throat "^4.0.0" + +jest-leak-detector@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" + integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== + dependencies: + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-matcher-utils@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" + integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== + dependencies: + chalk "^2.0.1" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/stack-utils" "^1.0.1" + chalk "^2.0.1" + micromatch "^3.1.10" + slash "^2.0.0" + stack-utils "^1.0.1" + +jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== + dependencies: + "@jest/types" "^24.9.0" + +jest-pnp-resolver@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" + integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== + +jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" + integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== + +jest-resolve-dependencies@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" + integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== + dependencies: + "@jest/types" "^24.9.0" + jest-regex-util "^24.3.0" + jest-snapshot "^24.9.0" + +jest-resolve@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" + integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== + dependencies: + "@jest/types" "^24.9.0" + browser-resolve "^1.11.3" + chalk "^2.0.1" + jest-pnp-resolver "^1.2.1" + realpath-native "^1.1.0" + +jest-runner@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" + integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.4.2" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-config "^24.9.0" + jest-docblock "^24.3.0" + jest-haste-map "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-leak-detector "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.6.0" + source-map-support "^0.5.6" + throat "^4.0.0" + +jest-runtime@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" + integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.9.0" + "@jest/source-map" "^24.3.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.1.15" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + realpath-native "^1.1.0" + slash "^2.0.0" + strip-bom "^3.0.0" + yargs "^13.3.0" + +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== + +jest-snapshot@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" + integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== + dependencies: + "@babel/types" "^7.0.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + expect "^24.9.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^24.9.0" + semver "^6.2.0" + +jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + callsites "^3.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.15" + is-ci "^2.0.0" + mkdirp "^0.5.1" + slash "^2.0.0" + source-map "^0.6.0" + +jest-validate@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" + integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== + dependencies: + "@jest/types" "^24.9.0" + camelcase "^5.3.1" + chalk "^2.0.1" + jest-get-type "^24.9.0" + leven "^3.1.0" + pretty-format "^24.9.0" + +jest-watch-typeahead@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-0.4.2.tgz#e5be959698a7fa2302229a5082c488c3c8780a4a" + integrity sha512-f7VpLebTdaXs81rg/oj4Vg/ObZy2QtGzAmGLNsqUS5G5KtSN68tFcIsbvNODfNyQxU78g7D8x77o3bgfBTR+2Q== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.1" + jest-regex-util "^24.9.0" + jest-watcher "^24.3.0" + slash "^3.0.0" + string-length "^3.1.0" + strip-ansi "^5.0.0" + +jest-watcher@^24.3.0, jest-watcher@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" + integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== + dependencies: + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + jest-util "^24.9.0" + string-length "^2.0.0" + +jest-worker@^24.6.0, jest-worker@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + +jest@^24.8.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" + integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== + dependencies: + import-local "^2.0.0" + jest-cli "^24.9.0" + +jpjs@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/jpjs/-/jpjs-1.2.1.tgz#f343833de8838a5beba1f42d5a219be0114c44b7" + integrity sha512-GxJWybWU4NV0RNKi6EIqk6IRPOTqd/h+U7sbtyuD7yUISUzV78LdHnq2xkevJsTlz/EImux4sWj+wfMiwKLkiw== + +js-sha3@0.5.7: + version "0.5.7" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" + integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +js-yaml@^3.13.1: + version "3.14.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsbi@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-3.1.3.tgz#f024b340032f7c7caaa6ca4b32b55e8d33f6e897" + integrity sha512-nBJqA0C6Qns+ZxurbEoIR56wyjiUszpNy70FHvxO5ervMoCbZVE3z3kxr5nKGhlxr/9MhKTSUBs7cAwwuf3g9w== + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +jsdom@^11.5.1: + version "11.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== + dependencies: + abab "^2.0.0" + acorn "^5.5.3" + acorn-globals "^4.1.0" + array-equal "^1.0.0" + cssom ">= 0.3.2 < 0.4.0" + cssstyle "^1.0.0" + data-urls "^1.0.0" + domexception "^1.0.1" + escodegen "^1.9.1" + html-encoding-sniffer "^1.0.2" + left-pad "^1.3.0" + nwsapi "^2.0.7" + parse5 "4.0.0" + pn "^1.1.0" + request "^2.87.0" + request-promise-native "^1.0.5" + sax "^1.2.4" + symbol-tree "^3.2.2" + tough-cookie "^2.3.4" + w3c-hr-time "^1.0.1" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.3" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.1" + ws "^5.2.0" + xml-name-validator "^3.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= + +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +json5@2.x, json5@^2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" + integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA== + dependencies: + minimist "^1.2.5" + +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +jsx-ast-utils@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz#1114a4c1209481db06c690c2b4f488cc665f657e" + integrity sha512-z1xSldJ6imESSzOjd3NNkieVJKRlKYSOtMG8SFyCj2FIrvSaSuli/WjpBkEzCBoR9bYYYFgqJw61Xhu7Lcgk+w== + dependencies: + array-includes "^3.1.1" + object.assign "^4.1.0" + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +language-subtag-registry@~0.3.2: + version "0.3.20" + resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.20.tgz#a00a37121894f224f763268e431c55556b0c0755" + integrity sha512-KPMwROklF4tEx283Xw0pNKtfTj1gZ4UByp4EsIFWLgBavJltF4TiYPc39k06zSTsLzxTVXXDSpbwaQXaFB4Qeg== + +language-tags@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/language-tags/-/language-tags-1.0.5.tgz#d321dbc4da30ba8bf3024e040fa5c14661f9193a" + integrity sha1-0yHbxNowuovzAk4ED6XBRmH5GTo= + dependencies: + language-subtag-registry "~0.3.2" + +left-pad@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levenary@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/levenary/-/levenary-1.1.1.tgz#842a9ee98d2075aa7faeedbe32679e9205f46f77" + integrity sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ== + dependencies: + leven "^3.1.0" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +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" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +lodash.memoize@4.x: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= + +lodash@4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.4: + version "4.17.19" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" + integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== + +log-symbols@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== + dependencies: + chalk "^2.0.1" + +log-update@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-2.3.0.tgz#88328fd7d1ce7938b29283746f0b1bc126b24708" + integrity sha1-iDKP19HOeTiykoN0bwsbwSayRwg= + dependencies: + ansi-escapes "^3.0.0" + cli-cursor "^2.0.0" + wrap-ansi "^3.0.1" + +loose-envify@^1.0.0, loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +lower-case@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" + integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= + +magic-string@^0.25.2, magic-string@^0.25.5: + version "0.25.7" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" + integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== + dependencies: + sourcemap-codec "^1.4.4" + +make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + +make-dir@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + +make-error@1.x: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= + dependencies: + tmpl "1.0.x" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +micromatch@^3.1.10, micromatch@^3.1.4: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mime-db@1.44.0: + version "1.44.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" + integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.27" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" + integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== + dependencies: + mime-db "1.44.0" + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@0.x, mkdirp@^0.5.1: + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + dependencies: + minimist "^1.2.5" + +mri@^1.1.0: + version "1.1.6" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6" + integrity sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + +nan@^2.12.1: + version "2.14.1" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01" + integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw== + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +no-case@^2.2.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" + integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== + dependencies: + lower-case "^1.1.1" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-modules-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= + +node-notifier@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== + dependencies: + growly "^1.3.0" + is-wsl "^1.1.0" + semver "^5.5.0" + shellwords "^0.1.1" + which "^1.3.0" + +node-releases@^1.1.58: + version "1.1.60" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.60.tgz#6948bdfce8286f0b5d0e5a88e8384e954dfe7084" + integrity sha512-gsO4vjEdQaTusZAEebUWp2a5d7dF5DYoIpDG7WySnk7BuZDW+GPpHXoXXuYawRBr/9t5q54tirPz79kFIWg4dA== + +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +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" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + dependencies: + path-key "^2.0.0" + +npm-run-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +nwsapi@^2.0.7: + version "2.2.0" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" + integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-inspect@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" + integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== + +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.entries@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.2.tgz#bc73f00acb6b6bb16c203434b10f9a7e797d3add" + integrity sha512-BQdB9qKmb/HyNdMNWVr7O3+z5MUIx3aiegEIJqjMBbBf0YT9RRxTJSim4mzFqtyr7PDAHigq0N9dO0m0tRakQA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + has "^1.0.3" + +object.fromentries@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.2.tgz#4a09c9b9bb3843dd0f89acdb517a794d4f355ac9" + integrity sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + function-bind "^1.1.1" + has "^1.0.3" + +object.getownpropertydescriptors@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz#369bf1f9592d8ab89d712dced5cb81c7c5352649" + integrity sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +object.values@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e" + integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + function-bind "^1.1.1" + has "^1.0.3" + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + +optionator@^0.8.1, optionator@^0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.6" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + word-wrap "~1.2.3" + +ora@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" + integrity sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg== + dependencies: + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-spinners "^2.0.0" + log-symbols "^2.2.0" + strip-ansi "^5.2.0" + wcwidth "^1.0.1" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +p-each-series@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" + integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= + dependencies: + p-reduce "^1.0.0" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + +p-limit@^2.0.0, p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-reduce@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" + integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= + dependencies: + error-ex "^1.2.0" + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +parse-json@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.1.tgz#7cfe35c1ccd641bce3981467e6c2ece61b3b3878" + integrity sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" + +parse5@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" + integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== + +pascal-case@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-2.0.1.tgz#2d578d3455f660da65eca18ef95b4e0de912761e" + integrity sha1-LVeNNFX2YNpl7KGO+VtODekSdh4= + dependencies: + camel-case "^3.0.0" + upper-case-first "^1.1.0" + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-dirname@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= + dependencies: + pify "^2.0.0" + +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== + dependencies: + pify "^3.0.0" + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +picomatch@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" + integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + +pirates@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" + integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== + dependencies: + node-modules-regexp "^1.0.0" + +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= + dependencies: + find-up "^2.1.0" + +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +pkg-dir@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + +pn@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== + +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== + dependencies: + "@jest/types" "^24.9.0" + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + react-is "^16.8.4" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +progress-estimator@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/progress-estimator/-/progress-estimator-0.2.2.tgz#1c3947a5782ea56e40c8fccc290ac7ceeb1b91cb" + integrity sha512-GF76Ac02MTJD6o2nMNtmtOFjwWCnHcvXyn5HOWPQnEMO8OTLw7LAvNmrwe8LmdsB+eZhwUu9fX/c9iQnBxWaFA== + dependencies: + chalk "^2.4.1" + cli-spinners "^1.3.1" + humanize-duration "^3.15.3" + log-update "^2.3.0" + +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + +prompts@^2.0.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.3.2.tgz#480572d89ecf39566d2bd3fe2c9fccb7c4c0b068" + integrity sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.4" + +prop-types@^15.7.2: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + +psl@^1.1.28: + version "1.8.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +react-is@^16.8.1, react-is@^16.8.4: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg-up@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" + integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== + dependencies: + find-up "^3.0.0" + read-pkg "^3.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +read-pkg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= + dependencies: + load-json-file "^4.0.0" + normalize-package-data "^2.3.2" + path-type "^3.0.0" + +readable-stream@^2.0.2: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readdirp@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" + integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== + dependencies: + graceful-fs "^4.1.11" + micromatch "^3.1.10" + readable-stream "^2.0.2" + +realpath-native@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" + integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== + dependencies: + util.promisify "^1.0.0" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= + dependencies: + resolve "^1.1.6" + +regenerate-unicode-properties@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec" + integrity sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA== + dependencies: + regenerate "^1.4.0" + +regenerate@^1.4.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.1.tgz#cad92ad8e6b591773485fbe05a485caf4f457e6f" + integrity sha512-j2+C8+NtXQgEKWk49MMP5P/u2GhnahTtVkRIHr5R5lVRlbKvmQ+oS+A5aLKWp2ma5VkT8sh6v+v4hbH0YHR66A== + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +regenerator-runtime@^0.13.4: + version "0.13.7" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" + integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== + +regenerator-transform@^0.14.2: + version "0.14.5" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.5.tgz#c98da154683671c9c4dcb16ece736517e1b7feb4" + integrity sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw== + dependencies: + "@babel/runtime" "^7.8.4" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +regexp.prototype.flags@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75" + integrity sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0-next.1" + +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + +regexpp@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" + integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== + +regexpu-core@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.0.tgz#fcbf458c50431b0bb7b45d6967b8192d91f3d938" + integrity sha512-TQ4KXRnIn6tz6tjnrXEkD/sshygKH/j5KzK86X8MkeHyZ8qst/LZ89j3X4/8HEIfHANTFIP/AbXakeRhWIl5YQ== + dependencies: + regenerate "^1.4.0" + regenerate-unicode-properties "^8.2.0" + regjsgen "^0.5.1" + regjsparser "^0.6.4" + unicode-match-property-ecmascript "^1.0.4" + unicode-match-property-value-ecmascript "^1.2.0" + +regjsgen@^0.5.1: + version "0.5.2" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.2.tgz#92ff295fb1deecbf6ecdab2543d207e91aa33733" + integrity sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A== + +regjsparser@^0.6.4: + version "0.6.4" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.4.tgz#a769f8684308401a66e9b529d2436ff4d0666272" + integrity sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw== + dependencies: + jsesc "~0.5.0" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +request-promise-core@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" + integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== + dependencies: + lodash "^4.17.19" + +request-promise-native@^1.0.5: + version "1.0.9" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.9.tgz#e407120526a5efdc9a39b28a5679bf47b9d9dc28" + integrity sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g== + dependencies: + request-promise-core "1.1.4" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" + +request@^2.87.0: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +resolve-cwd@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= + dependencies: + resolve-from "^3.0.0" + +resolve-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= + +resolve@1.12.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + +resolve@1.x, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.3.2, resolve@^1.8.1: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +rimraf@^2.5.4, rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +rimraf@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +rollup-plugin-babel@^4.3.2: + version "4.4.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz#d15bd259466a9d1accbdb2fe2fff17c52d030acb" + integrity sha512-Lek/TYp1+7g7I+uMfJnnSJ7YWoD58ajo6Oarhlex7lvUce+RCKRuGRSgztDO3/MF/PuGKmUL5iTHKf208UNszw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + rollup-pluginutils "^2.8.1" + +rollup-plugin-sourcemaps@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.4.2.tgz#62125aa94087aadf7b83ef4dfaf629b473135e87" + integrity sha1-YhJaqUCHqt97g+9N+vYptHMTXoc= + dependencies: + rollup-pluginutils "^2.0.1" + source-map-resolve "^0.5.0" + +rollup-plugin-terser@^5.1.2: + version "5.3.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-5.3.0.tgz#9c0dd33d5771df9630cd027d6a2559187f65885e" + integrity sha512-XGMJihTIO3eIBsVGq7jiNYOdDMb3pVxuzY0uhOE/FM4x/u9nQgr3+McsjzqBn3QfHIpNSZmFnpoKAwHBEcsT7g== + dependencies: + "@babel/code-frame" "^7.5.5" + jest-worker "^24.9.0" + rollup-pluginutils "^2.8.2" + serialize-javascript "^2.1.2" + terser "^4.6.2" + +rollup-plugin-typescript2@^0.25.3: + version "0.25.3" + resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.25.3.tgz#a5fb2f0f85488789334ce540abe6c7011cbdf40f" + integrity sha512-ADkSaidKBovJmf5VBnZBZe+WzaZwofuvYdzGAKTN/J4hN7QJCFYAq7IrH9caxlru6T5qhX41PNFS1S4HqhsGQg== + dependencies: + find-cache-dir "^3.0.0" + fs-extra "8.1.0" + resolve "1.12.0" + rollup-pluginutils "2.8.1" + tslib "1.10.0" + +rollup-pluginutils@2.8.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97" + integrity sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg== + dependencies: + estree-walker "^0.6.1" + +rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2: + version "2.8.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== + dependencies: + estree-walker "^0.6.1" + +rollup@^1.27.8: + version "1.32.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.32.1.tgz#4480e52d9d9e2ae4b46ba0d9ddeaf3163940f9c4" + integrity sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A== + dependencies: + "@types/estree" "*" + "@types/node" "*" + acorn "^7.1.0" + +rsvp@^4.8.4: + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== + +run-async@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" + integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== + +rxjs@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.0.tgz#af2901eedf02e3a83ffa7f886240ff9018bbec84" + integrity sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg== + dependencies: + tslib "^1.9.0" + +sade@^1.4.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/sade/-/sade-1.7.3.tgz#a217ccc4fb4abb2d271648bf48f6628b2636fa1b" + integrity sha512-m4BctppMvJ60W1dXnHq7jMmFe3hPJZDAH85kQ3ACTo7XZNVUuTItCQ+2HfyaMeV5cKrbw7l4vD/6We3GBxvdJw== + dependencies: + mri "^1.1.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sane@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== + dependencies: + "@cnakazawa/watch" "^1.0.3" + anymatch "^2.0.0" + capture-exit "^2.0.0" + exec-sh "^0.3.2" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + +sax@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + +"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" + integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== + +semver@^6.0.0, semver@^6.1.2, semver@^6.2.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +semver@^7.3.2: + version "7.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" + integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + +serialize-javascript@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61" + integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ== + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +shelljs@^0.8.3: + version "0.8.4" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2" + integrity sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ== + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== + +side-channel@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.2.tgz#df5d1abadb4e4bf4af1cd8852bf132d2f7876947" + integrity sha512-7rL9YlPHg7Ancea1S96Pa8/QWb4BtXL/TZvS6B8XFetGBeuhAsfmUspK6DokBeZ64+Kj9TCNRD/30pVz1BvQNA== + dependencies: + es-abstract "^1.17.0-next.1" + object-inspect "^1.7.0" + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" + integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + +sisteransi@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +source-map-resolve@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" + integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-support@^0.5.6, source-map-support@~0.5.12: + version "0.5.19" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + +source-map@^0.5.0, source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +sourcemap-codec@^1.4.4: + version "1.4.8" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== + +spdx-correct@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" + integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +stack-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +stealthy-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= + +string-length@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= + dependencies: + astral-regex "^1.0.0" + strip-ansi "^4.0.0" + +string-length@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-3.1.0.tgz#107ef8c23456e187a8abd4a61162ff4ac6e25837" + integrity sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA== + dependencies: + astral-regex "^1.0.0" + strip-ansi "^5.2.0" + +string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string-width@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + +string.prototype.matchall@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz#48bb510326fb9fdeb6a33ceaa81a6ea04ef7648e" + integrity sha512-N/jp6O5fMf9os0JU3E72Qhf590RSRZU/ungsL/qJUYVTNv7hTG0P/dbPjxINVN9jpscu3nzYwKESU3P3RY5tOg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.0" + has-symbols "^1.0.1" + internal-slot "^1.0.2" + regexp.prototype.flags "^1.3.0" + side-channel "^1.0.2" + +string.prototype.trimend@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" + integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + +string.prototype.trimstart@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" + integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.5" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-json-comments@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@^2.0.0: + version "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: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" + integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== + dependencies: + has-flag "^4.0.0" + +symbol-tree@^3.2.2: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== + dependencies: + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" + +terser@^4.6.2: + version "4.8.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" + integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + +test-exclude@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" + integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== + dependencies: + glob "^7.1.3" + minimatch "^3.0.4" + read-pkg-up "^4.0.0" + require-main-filename "^2.0.0" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +throat@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +tiny-glob@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.6.tgz#9e056e169d9788fe8a734dfa1ff02e9b92ed7eda" + integrity sha512-A7ewMqPu1B5PWwC3m7KVgAu96Ch5LA0w4SnEN/LbDREj/gAD0nPWboRbn8YoP9ISZXqeNAlMvKSKoEuhcfK3Pw== + dependencies: + globalyzer "^0.1.0" + globrex "^0.1.1" + +tiny-invariant@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875" + integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw== + +tiny-warning@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" + integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +toformat@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/toformat/-/toformat-2.0.0.tgz#7a043fd2dfbe9021a4e36e508835ba32056739d8" + integrity sha512-03SWBVop6nU8bpyZCx7SodpYznbZF5R4ljwNLBcTQzKOD9xuihRo/psX58llS1BMFhhAI08H3luot5GoXJz2pQ== + +tough-cookie@^2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= + dependencies: + punycode "^2.1.0" + +ts-jest@^24.0.2: + version "24.3.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.3.0.tgz#b97814e3eab359ea840a1ac112deae68aa440869" + integrity sha512-Hb94C/+QRIgjVZlJyiWwouYUF+siNJHJHknyspaOcZ+OQAIdFG/UrdQVXw/0B8Z3No34xkUXZJpOTy9alOWdVQ== + dependencies: + bs-logger "0.x" + buffer-from "1.x" + fast-json-stable-stringify "2.x" + json5 "2.x" + lodash.memoize "4.x" + make-error "1.x" + mkdirp "0.x" + resolve "1.x" + semver "^5.5" + yargs-parser "10.x" + +tsconfig-paths@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +tsdx@^0.12.3: + version "0.12.3" + resolved "https://registry.yarnpkg.com/tsdx/-/tsdx-0.12.3.tgz#688ef9c4ed8f1c5de5da94daf2e3cc02f8134c2c" + integrity sha512-BQ0oj9S5Yti6Esol+29ztiJs0kSUA57LngT0G4VF2lqTDRZcMlByCMyWa7yOih08t1wNUj8ah0ml7WJkf8PIbA== + dependencies: + "@babel/core" "^7.4.4" + "@babel/helper-module-imports" "^7.0.0" + "@babel/plugin-proposal-class-properties" "^7.4.4" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.7.4" + "@babel/plugin-proposal-optional-chaining" "^7.7.5" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-runtime" "^7.6.0" + "@babel/polyfill" "^7.4.4" + "@babel/preset-env" "^7.4.4" + "@rollup/plugin-commonjs" "^11.0.0" + "@rollup/plugin-json" "^4.0.0" + "@rollup/plugin-node-resolve" "^6.0.0" + "@rollup/plugin-replace" "^2.2.1" + "@types/rimraf" "^2.0.2" + "@types/shelljs" "^0.8.5" + "@typescript-eslint/eslint-plugin" "^2.12.0" + "@typescript-eslint/parser" "^2.12.0" + ansi-escapes "^4.2.1" + asyncro "^3.0.0" + babel-eslint "^10.0.3" + babel-plugin-annotate-pure-calls "^0.4.0" + babel-plugin-dev-expression "^0.2.1" + babel-plugin-macros "^2.6.1" + babel-plugin-transform-async-to-promises "^0.8.14" + babel-plugin-transform-rename-import "^2.3.0" + babel-traverse "^6.26.0" + babylon "^6.18.0" + camelcase "^5.0.0" + chalk "^2.4.2" + chokidar-cli "^1.2.2" + cross-env "6.0.3" + cross-spawn "^6.0.5" + enquirer "^2.3.0" + eslint "^6.1.0" + eslint-config-prettier "^6.0.0" + eslint-config-react-app "^5.0.2" + eslint-plugin-flowtype "^3.13.0" + eslint-plugin-import "^2.18.2" + eslint-plugin-jsx-a11y "^6.2.3" + eslint-plugin-prettier "^3.1.0" + eslint-plugin-react "^7.14.3" + eslint-plugin-react-hooks "^2.2.0" + execa "3.2.0" + fs-extra "^8.0.1" + jest "^24.8.0" + jest-watch-typeahead "^0.4.0" + jpjs "^1.2.1" + lodash.merge "^4.6.2" + mkdirp "^0.5.1" + ora "^3.4.0" + pascal-case "^2.0.1" + prettier "^1.19.1" + progress-estimator "^0.2.2" + rimraf "^3.0.0" + rollup "^1.27.8" + rollup-plugin-babel "^4.3.2" + rollup-plugin-sourcemaps "^0.4.2" + rollup-plugin-terser "^5.1.2" + rollup-plugin-typescript2 "^0.25.3" + sade "^1.4.2" + shelljs "^0.8.3" + tiny-glob "^0.2.6" + ts-jest "^24.0.2" + tslib "^1.9.3" + typescript "^3.7.3" + +tslib@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + +tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: + version "1.13.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" + integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== + +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +type-fest@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" + integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ== + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + +typescript@^3.7.3: + version "3.9.7" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" + integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== + +unicode-canonical-property-names-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== + +unicode-match-property-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== + dependencies: + unicode-canonical-property-names-ecmascript "^1.0.4" + unicode-property-aliases-ecmascript "^1.0.4" + +unicode-match-property-value-ecmascript@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz#0d91f600eeeb3096aa962b1d6fc88876e64ea531" + integrity sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ== + +unicode-property-aliases-ecmascript@^1.0.4: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz#dd57a99f6207bedff4628abefb94c50db941c8f4" + integrity sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg== + +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +upath@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" + integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== + +upper-case-first@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/upper-case-first/-/upper-case-first-1.1.2.tgz#5d79bedcff14419518fd2edb0a0507c9b6859115" + integrity sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU= + dependencies: + upper-case "^1.1.1" + +upper-case@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" + integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg= + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util.promisify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.1.tgz#6baf7774b80eeb0f7520d8b81d07982a59abbaee" + integrity sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.2" + has-symbols "^1.0.1" + object.getownpropertydescriptors "^2.1.0" + +uuid@^3.3.2: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +v8-compile-cache@^2.0.3: + version "2.1.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" + integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +w3c-hr-time@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" + integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== + dependencies: + browser-process-hrtime "^1.0.0" + +walker@^1.0.7, walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= + dependencies: + makeerror "1.0.x" + +wcwidth@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= + dependencies: + defaults "^1.0.3" + +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== + +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== + dependencies: + iconv-lite "0.4.24" + +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== + +whatwg-url@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +whatwg-url@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" + integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@^1.2.9, which@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +wrap-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz#288a04d87eda5c286e060dfe8f135ce8d007f8ba" + integrity sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo= + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" + +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write-file-atomic@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" + integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + +ws@7.2.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.3.tgz#a5411e1fb04d5ed0efee76d26d5c46d830c39b46" + integrity sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ== + +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== + dependencies: + async-limiter "~1.0.0" + +xml-name-validator@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== + +y18n@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + +yaml@^1.7.2: + version "1.10.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" + integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== + +yargs-parser@10.x: + version "10.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== + dependencies: + camelcase "^4.1.0" + +yargs-parser@^13.1.1, yargs-parser@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" + integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs@13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" + +yargs@^13.3.0: + version "13.3.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.2"