Socket
Socket
Sign inDemoInstall

@uniswap/sdk-core

Package Overview
Dependencies
Maintainers
9
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniswap/sdk-core - npm Package Compare versions

Comparing version 2.0.5 to 3.0.0-alpha.0

dist/utils/computePriceImpact.d.ts

10

dist/entities/ether.d.ts
import { BaseCurrency } from './baseCurrency';
/**
* Represents the currency Ether
*/
export declare class Ether extends BaseCurrency {

@@ -6,6 +9,11 @@ readonly isEther: true;

/**
* The only instance of the base class `Currency`.
* Only called once by this class
* @protected
*/
protected constructor();
/**
* The only instance of the class `Ether`.
*/
static readonly ETHER: Ether;
}
export declare const ETHER: Ether;

27

dist/entities/fractions/currencyAmount.d.ts
import JSBI from 'jsbi';
import { Currency } from '../currency';
import { Ether } from '../ether';
import { Fraction } from './fraction';
import { BigintIsh, Rounding } from '../../constants';
import Fraction from './fraction';
export default class CurrencyAmount<T extends Currency> extends Fraction {
export declare class CurrencyAmount<T extends Currency> extends Fraction {
readonly currency: T;
readonly decimalScale: JSBI;
/**
* Returns a new currency amount instance from the
* @param currency the currency in the amount
* @param rawAmount the raw token or ether amount
*/
static fromRawAmount<T extends Currency>(currency: T, rawAmount: BigintIsh): CurrencyAmount<T>;
/**
* Construct a currency amount with a denominator that is not equal to 1
* @param currency the currency
* @param numerator the numerator of the fractional token amount
* @param denominator the denominator of the fractional token amount
*/
static fromFractionalAmount<T extends Currency>(currency: T, numerator: BigintIsh, denominator: BigintIsh): CurrencyAmount<T>;
/**
* Helper that calls the constructor with the ETHER currency
* @param amount ether amount in wei
* @param rawAmount ether amount in wei
*/
static ether(amount: BigintIsh): CurrencyAmount<Ether>;
constructor(currency: T, amount: BigintIsh);
get raw(): JSBI;
static ether(rawAmount: BigintIsh): CurrencyAmount<Ether>;
protected constructor(currency: T, numerator: BigintIsh, denominator?: BigintIsh);
add(other: CurrencyAmount<T>): CurrencyAmount<T>;
subtract(other: CurrencyAmount<T>): CurrencyAmount<T>;
multiply(other: Fraction | BigintIsh): CurrencyAmount<T>;
divide(other: Fraction | BigintIsh): CurrencyAmount<T>;
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;

@@ -18,0 +33,0 @@ toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;

import JSBI from 'jsbi';
import { BigintIsh, Rounding } from '../../constants';
export default class Fraction {
export declare class Fraction {
readonly numerator: JSBI;

@@ -5,0 +5,0 @@ readonly denominator: JSBI;

@@ -1,5 +0,4 @@

import Fraction from './fraction';
import Percent from './percent';
import CurrencyAmount from './currencyAmount';
import Price from './price';
export { Fraction, Percent, CurrencyAmount, Price };
export { CurrencyAmount } from './currencyAmount';
export { Fraction } from './fraction';
export { Percent } from './percent';
export { Price } from './price';
import { BigintIsh, Rounding } from '../../constants';
import Fraction from './fraction';
export default class Percent extends Fraction {
import { Fraction } from './fraction';
export declare class Percent extends Fraction {
/**

@@ -5,0 +5,0 @@ * This boolean prevents a fraction from being interpreted as a Percent

import { BigintIsh, Rounding } from '../../constants';
import { Currency } from '../currency';
import Fraction from './fraction';
import CurrencyAmount from './currencyAmount';
export default class Price<TBase extends Currency, TQuote extends Currency> extends Fraction {
import { Fraction } from './fraction';
import { CurrencyAmount } from './currencyAmount';
export declare class Price<TBase extends Currency, TQuote extends Currency> extends Fraction {
readonly baseCurrency: TBase;

@@ -10,9 +10,23 @@ readonly quoteCurrency: TQuote;

constructor(baseCurrency: TBase, quoteCurrency: TQuote, denominator: BigintIsh, numerator: BigintIsh);
get raw(): Fraction;
get adjusted(): Fraction;
/**
* Flip the price, switching the base and quote currency
*/
invert(): Price<TQuote, TBase>;
/**
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
* @param other the other price
*/
multiply<TOtherQuote extends Currency>(other: Price<TQuote, TOtherQuote>): Price<TBase, TOtherQuote>;
/**
* Return the amount of quote currency corresponding to a given amount of the base currency
* @param currencyAmount the amount of base currency to quote against the price
*/
quote(currencyAmount: CurrencyAmount<TBase>): CurrencyAmount<TQuote>;
/**
* Get the value scaled by decimals for formatting
* @private
*/
private get adjustedForDecimals();
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
}

@@ -0,4 +1,4 @@

export * from './fractions';
export * from './currency';
export * from './ether';
export * from './token';
export * from './ether';
export * from './currency';
export * from './fractions';

@@ -9,6 +9,6 @@ 'use strict';

var invariant = _interopDefault(require('tiny-invariant'));
var address = require('@ethersproject/address');
var _Decimal = _interopDefault(require('decimal.js-light'));
var _Big = _interopDefault(require('big.js'));
var toFormat = _interopDefault(require('toformat'));
var address = require('@ethersproject/address');

@@ -59,11 +59,13 @@ (function (ChainId) {

/**
* Validates an address and returns the parsed (checksummed) version of that address
* @param address the unchecksummed hex address
* Compares two currencies for equality
*/
function validateAndParseAddress(address$1) {
try {
return address.getAddress(address$1);
} catch (error) {
throw new Error(address$1 + " is not a valid address.");
function currencyEquals(currencyA, currencyB) {
if (currencyA.isToken && currencyB.isToken) {
return currencyA.equals(currencyB);
} else if (currencyA.isToken) {
return false;
} else if (currencyB.isToken) {
return false;
} else {
return currencyA.isEther === currencyB.isEther;
}

@@ -92,61 +94,17 @@ }

var _WETH;
/**
* Represents an ERC20 token with a unique address and some metadata.
* Represents the currency Ether
*/
var Token = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Token, _BaseCurrency);
var Ether = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Ether, _BaseCurrency);
function Token(chainId, address, decimals, symbol, name) {
var _this;
_this = _BaseCurrency.call(this, decimals, symbol, name) || this;
_this.isEther = false;
_this.isToken = true;
_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
* Only called once by this class
* @protected
*/
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;
}(BaseCurrency);
var WETH9 = (_WETH = {}, _WETH[exports.ChainId.MAINNET] = /*#__PURE__*/new Token(exports.ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.ROPSTEN] = /*#__PURE__*/new Token(exports.ChainId.ROPSTEN, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.RINKEBY] = /*#__PURE__*/new Token(exports.ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.GÖRLI] = /*#__PURE__*/new Token(exports.ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.KOVAN] = /*#__PURE__*/new Token(exports.ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH9', 'Wrapped Ether'), _WETH);
var Ether = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Ether, _BaseCurrency);
function Ether() {
var _this;
_this = _BaseCurrency.apply(this, arguments) || this;
_this = _BaseCurrency.call(this, 18, 'ETH', 'Ether') || this;
_this.isEther = true;

@@ -160,6 +118,6 @@ _this.isToken = false;

/**
* The only instance of the base class `Currency`.
* The only instance of the class `Ether`.
*/
Ether.ETHER = /*#__PURE__*/new Ether(18, 'ETH', 'Ether');
Ether.ETHER = /*#__PURE__*/new Ether();
var ETHER = Ether.ETHER;

@@ -172,3 +130,2 @@

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 () {

@@ -291,4 +248,121 @@ function Fraction(numerator, denominator) {

var _100_PERCENT = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100));
var Big$1 = /*#__PURE__*/toFormat(_Big);
var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
_inheritsLoose(CurrencyAmount, _Fraction);
function CurrencyAmount(currency, numerator, denominator) {
var _this;
_this = _Fraction.call(this, numerator, denominator) || this;
!JSBI.lessThanOrEqual(_this.quotient, MaxUint256) ? invariant(false, 'AMOUNT') : void 0;
_this.currency = currency;
_this.decimalScale = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(currency.decimals));
return _this;
}
/**
* Returns a new currency amount instance from the
* @param currency the currency in the amount
* @param rawAmount the raw token or ether amount
*/
CurrencyAmount.fromRawAmount = function fromRawAmount(currency, rawAmount) {
return new CurrencyAmount(currency, rawAmount);
}
/**
* Construct a currency amount with a denominator that is not equal to 1
* @param currency the currency
* @param numerator the numerator of the fractional token amount
* @param denominator the denominator of the fractional token amount
*/
;
CurrencyAmount.fromFractionalAmount = function fromFractionalAmount(currency, numerator, denominator) {
return new CurrencyAmount(currency, numerator, denominator);
}
/**
* Helper that calls the constructor with the ETHER currency
* @param rawAmount ether amount in wei
*/
;
CurrencyAmount.ether = function ether(rawAmount) {
return CurrencyAmount.fromRawAmount(Ether.ETHER, rawAmount);
};
var _proto = CurrencyAmount.prototype;
_proto.add = function add(other) {
!currencyEquals(this.currency, other.currency) ? invariant(false, 'CURRENCY') : void 0;
var added = _Fraction.prototype.add.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator);
};
_proto.subtract = function subtract(other) {
!currencyEquals(this.currency, other.currency) ? invariant(false, 'CURRENCY') : void 0;
var subtracted = _Fraction.prototype.subtract.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator);
};
_proto.multiply = function multiply(other) {
var multiplied = _Fraction.prototype.multiply.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator);
};
_proto.divide = function divide(other) {
var divided = _Fraction.prototype.divide.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, divided.numerator, divided.denominator);
};
_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.divide.call(this, this.decimalScale).toSignificant(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.divide.call(this, this.decimalScale).toFixed(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.quotient.toString()).div(this.decimalScale.toString()).toFormat(format);
};
return CurrencyAmount;
}(Fraction);
var ONE_HUNDRED_PERCENT = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100));
/**
* Converts a fraction to a percent
* @param fraction the fraction to convert
*/
function toPercent(fraction) {

@@ -336,3 +410,3 @@ return new Percent(fraction.numerator, fraction.denominator);

return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding);
return _Fraction.prototype.multiply.call(this, ONE_HUNDRED_PERCENT).toSignificant(significantDigits, format, rounding);
};

@@ -345,3 +419,3 @@

return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding);
return _Fraction.prototype.multiply.call(this, ONE_HUNDRED_PERCENT).toFixed(decimalPlaces, format, rounding);
};

@@ -352,2 +426,162 @@

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(JSBI.BigInt(10), JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(quoteCurrency.decimals)));
return _this;
}
/**
* Flip the price, switching the base and quote currency
*/
var _proto = Price.prototype;
_proto.invert = function invert() {
return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator);
}
/**
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
* @param other the other price
*/
;
_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);
}
/**
* Return the amount of quote currency corresponding to a given amount of the base currency
* @param currencyAmount the amount of base currency to quote against the price
*/
;
_proto.quote = function quote(currencyAmount) {
!currencyEquals(currencyAmount.currency, this.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
var result = _Fraction.prototype.multiply.call(this, currencyAmount);
return CurrencyAmount.fromFractionalAmount(this.quoteCurrency, result.numerator, result.denominator);
}
/**
* Get the value scaled by decimals for formatting
* @private
*/
;
_proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
if (significantDigits === void 0) {
significantDigits = 6;
}
return this.adjustedForDecimals.toSignificant(significantDigits, format, rounding);
};
_proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
if (decimalPlaces === void 0) {
decimalPlaces = 4;
}
return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding);
};
_createClass(Price, [{
key: "adjustedForDecimals",
get: function get() {
return _Fraction.prototype.multiply.call(this, this.scalar);
}
}]);
return Price;
}(Fraction);
/**
* Validates an address and returns the parsed (checksummed) version of that address
* @param address the unchecksummed hex address
*/
function validateAndParseAddress(address$1) {
try {
return address.getAddress(address$1);
} catch (error) {
throw new Error(address$1 + " is not a valid address.");
}
}
var _WETH;
/**
* Represents an ERC20 token with a unique address and some metadata.
*/
var Token = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Token, _BaseCurrency);
function Token(chainId, address, decimals, symbol, name) {
var _this;
_this = _BaseCurrency.call(this, decimals, symbol, name) || this;
_this.isEther = false;
_this.isToken = true;
_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;
}(BaseCurrency);
var WETH9 = (_WETH = {}, _WETH[exports.ChainId.MAINNET] = /*#__PURE__*/new Token(exports.ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.ROPSTEN] = /*#__PURE__*/new Token(exports.ChainId.ROPSTEN, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.RINKEBY] = /*#__PURE__*/new Token(exports.ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.GÖRLI] = /*#__PURE__*/new Token(exports.ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH9', 'Wrapped Ether'), _WETH[exports.ChainId.KOVAN] = /*#__PURE__*/new Token(exports.ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH9', 'Wrapped Ether'), _WETH);
/**
* 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 quotedOutputAmount = midPrice.quote(inputAmount); // calculate price impact := (exactQuote - outputAmount) / exactQuote
var priceImpact = quotedOutputAmount.subtract(outputAmount).divide(quotedOutputAmount);
return new Percent(priceImpact.numerator, priceImpact.denominator);
}
// `maxSize` by removing the last item

@@ -418,17 +652,2 @@

/**
* Compares two currencies for equality
*/
function currencyEquals(currencyA, currencyB) {
if (currencyA.isToken && currencyB.isToken) {
return currencyA.equals(currencyB);
} else if (currencyA.isToken) {
return false;
} else if (currencyB.isToken) {
return false;
} else {
return currencyA.isEther === currencyB.isEther;
}
}
/**
* Given a currency which can be Ether or a token, return wrapped ether for ether and the token for the token

@@ -456,153 +675,5 @@ * @param currency the currency to wrap, if necessary

function wrappedCurrencyAmount(currencyAmount, chainId) {
return new CurrencyAmount(wrappedCurrency(currencyAmount.currency, chainId), currencyAmount.raw);
return CurrencyAmount.fromFractionalAmount(wrappedCurrency(currencyAmount.currency, chainId), currencyAmount.numerator, currencyAmount.denominator);
}
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 = JSBI.BigInt(amount);
!JSBI.lessThanOrEqual(parsedAmount, MaxUint256) ? invariant(false, 'AMOUNT') : void 0;
_this = _Fraction.call(this, parsedAmount, JSBI.exponentiate(JSBI.BigInt(10), 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 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(JSBI.BigInt(10), JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(quoteCurrency.decimals)));
return _this;
}
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);
} // quotes with floor division
;
_proto.quote = function quote(currencyAmount) {
!currencyEquals(currencyAmount.currency, this.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
return new CurrencyAmount(this.quoteCurrency, _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);
exports.CurrencyAmount = CurrencyAmount;

@@ -617,2 +688,3 @@ exports.ETHER = ETHER;

exports.WETH9 = WETH9;
exports.computePriceImpact = computePriceImpact;
exports.currencyEquals = currencyEquals;

@@ -619,0 +691,0 @@ exports.sortedInsert = sortedInsert;

@@ -1,2 +0,2 @@

"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var n,r,e,i=t(require("jsbi")),o=t(require("tiny-invariant")),a=require("@ethersproject/address"),u=t(require("decimal.js-light")),s=t(require("big.js")),d=t(require("toformat"));(n=exports.ChainId||(exports.ChainId={}))[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",(r=exports.TradeType||(exports.TradeType={}))[r.EXACT_INPUT=0]="EXACT_INPUT",r[r.EXACT_OUTPUT=1]="EXACT_OUTPUT",(e=exports.Rounding||(exports.Rounding={}))[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP";var c=i.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function f(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function h(t,n,r){return n&&f(t.prototype,n),r&&f(t,r),t}function p(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function l(t){try{return a.getAddress(t)}catch(n){throw new Error(t+" is not a valid address.")}}var m,y=function(t,n,r){t>=0&&t<255&&Number.isInteger(t)||o(!1),this.decimals=t,this.symbol=n,this.name=r},g=function(t){function n(n,r,e,i,o){var a;return(a=t.call(this,e,i,o)||this).isEther=!1,a.isToken=!0,a.chainId=n,a.address=l(r),a}p(n,t);var r=n.prototype;return r.equals=function(t){return this===t||this.chainId===t.chainId&&this.address===t.address},r.sortsBefore=function(t){return this.chainId!==t.chainId&&o(!1),this.address===t.address&&o(!1),this.address.toLowerCase()<t.address.toLowerCase()},n}(y),v=((m={})[exports.ChainId.MAINNET]=new g(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH9","Wrapped Ether"),m[exports.ChainId.ROPSTEN]=new g(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH9","Wrapped Ether"),m[exports.ChainId.RINKEBY]=new g(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH9","Wrapped Ether"),m[exports.ChainId.GÖRLI]=new g(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH9","Wrapped Ether"),m[exports.ChainId.KOVAN]=new g(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH9","Wrapped Ether"),m),I=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).isEther=!0,n.isToken=!1,n}return p(n,t),n}(y);I.ETHER=new I(18,"ETH","Ether");var x,E,N=I.ETHER,w=d(u),R=d(s),T=((x={})[exports.Rounding.ROUND_DOWN]=w.ROUND_DOWN,x[exports.Rounding.ROUND_HALF_UP]=w.ROUND_HALF_UP,x[exports.Rounding.ROUND_UP]=w.ROUND_UP,x),O=((E={})[exports.Rounding.ROUND_DOWN]=0,E[exports.Rounding.ROUND_HALF_UP]=1,E[exports.Rounding.ROUND_UP]=3,E),C=function(){function t(t,n){void 0===n&&(n=i.BigInt(1)),this.numerator=i.BigInt(t),this.denominator=i.BigInt(n)}var n=t.prototype;return n.invert=function(){return new t(this.denominator,this.numerator)},n.add=function(n){var r=n instanceof t?n:new t(i.BigInt(n));return i.equal(this.denominator,r.denominator)?new t(i.add(this.numerator,r.numerator),this.denominator):new t(i.add(i.multiply(this.numerator,r.denominator),i.multiply(r.numerator,this.denominator)),i.multiply(this.denominator,r.denominator))},n.subtract=function(n){var r=n instanceof t?n:new t(i.BigInt(n));return i.equal(this.denominator,r.denominator)?new t(i.subtract(this.numerator,r.numerator),this.denominator):new t(i.subtract(i.multiply(this.numerator,r.denominator),i.multiply(r.numerator,this.denominator)),i.multiply(this.denominator,r.denominator))},n.lessThan=function(n){var r=n instanceof t?n:new t(i.BigInt(n));return i.lessThan(i.multiply(this.numerator,r.denominator),i.multiply(r.numerator,this.denominator))},n.equalTo=function(n){var r=n instanceof t?n:new t(i.BigInt(n));return i.equal(i.multiply(this.numerator,r.denominator),i.multiply(r.numerator,this.denominator))},n.greaterThan=function(n){var r=n instanceof t?n:new t(i.BigInt(n));return i.greaterThan(i.multiply(this.numerator,r.denominator),i.multiply(r.numerator,this.denominator))},n.multiply=function(n){var r=n instanceof t?n:new t(i.BigInt(n));return new t(i.multiply(this.numerator,r.numerator),i.multiply(this.denominator,r.denominator))},n.divide=function(n){var r=n instanceof t?n:new t(i.BigInt(n));return new t(i.multiply(this.numerator,r.denominator),i.multiply(this.denominator,r.numerator))},n.toSignificant=function(t,n,r){void 0===n&&(n={groupSeparator:""}),void 0===r&&(r=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>0||o(!1),w.set({precision:t+1,rounding:T[r]});var e=new w(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return e.toFormat(e.decimalPlaces(),n)},n.toFixed=function(t,n,r){return void 0===n&&(n={groupSeparator:""}),void 0===r&&(r=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>=0||o(!1),R.DP=t,R.RM=O[r],new R(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)},h(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}(),U=new C(i.BigInt(100));function _(t){return new A(t.numerator,t.denominator)}var A=function(t){function n(){var n;return(n=t.apply(this,arguments)||this).isPercent=!0,n}p(n,t);var r=n.prototype;return r.add=function(n){return _(t.prototype.add.call(this,n))},r.subtract=function(n){return _(t.prototype.subtract.call(this,n))},r.multiply=function(n){return _(t.prototype.multiply.call(this,n))},r.divide=function(n){return _(t.prototype.divide.call(this,n))},r.toSignificant=function(t,n,r){return void 0===t&&(t=5),this.multiply(U).toSignificant(t,n,r)},r.toFixed=function(t,n,r){return void 0===t&&(t=2),this.multiply(U).toFixed(t,n,r)},n}(C),B=i.BigInt(Number.MAX_SAFE_INTEGER),D=i.BigInt(0),b=i.BigInt(1),P=i.BigInt(2);function F(t,n){return t.isToken&&n.isToken?t.equals(n):!t.isToken&&!n.isToken&&t.isEther===n.isEther}function q(t,n){if(t.isToken)return t.chainId!==n&&o(!1),t;if(t.isEther)return v[n];throw new Error("CURRENCY")}var S=d(s),W=function(t){function n(n,r){var e,a=i.BigInt(r);return i.lessThanOrEqual(a,c)||o(!1),(e=t.call(this,a,i.exponentiate(i.BigInt(10),i.BigInt(n.decimals)))||this).currency=n,e}p(n,t),n.ether=function(t){return new n(N,t)};var r=n.prototype;return r.add=function(t){return F(this.currency,t.currency)||o(!1),new n(this.currency,i.add(this.raw,t.raw))},r.subtract=function(t){return F(this.currency,t.currency)||o(!1),new n(this.currency,i.subtract(this.raw,t.raw))},r.toSignificant=function(n,r,e){return void 0===n&&(n=6),void 0===e&&(e=exports.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,n,r,e)},r.toFixed=function(n,r,e){return void 0===n&&(n=this.currency.decimals),void 0===e&&(e=exports.Rounding.ROUND_DOWN),n<=this.currency.decimals||o(!1),t.prototype.toFixed.call(this,n,r,e)},r.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),S.DP=this.currency.decimals,new S(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)},h(n,[{key:"raw",get:function(){return this.numerator}}]),n}(C),H=function(t){function n(n,r,e,o){var a;return(a=t.call(this,o,e)||this).baseCurrency=n,a.quoteCurrency=r,a.scalar=new C(i.exponentiate(i.BigInt(10),i.BigInt(n.decimals)),i.exponentiate(i.BigInt(10),i.BigInt(r.decimals))),a}p(n,t);var r=n.prototype;return r.invert=function(){return new n(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},r.multiply=function(r){F(this.quoteCurrency,r.baseCurrency)||o(!1);var e=t.prototype.multiply.call(this,r);return new n(this.baseCurrency,r.quoteCurrency,e.denominator,e.numerator)},r.quote=function(n){return F(n.currency,this.baseCurrency)||o(!1),new W(this.quoteCurrency,t.prototype.multiply.call(this,n.raw).quotient)},r.toSignificant=function(t,n,r){return void 0===t&&(t=6),this.adjusted.toSignificant(t,n,r)},r.toFixed=function(t,n,r){return void 0===t&&(t=4),this.adjusted.toFixed(t,n,r)},h(n,[{key:"raw",get:function(){return new C(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),n}(C);exports.CurrencyAmount=W,exports.ETHER=N,exports.Ether=I,exports.Fraction=C,exports.MaxUint256=c,exports.Percent=A,exports.Price=H,exports.Token=g,exports.WETH9=v,exports.currencyEquals=F,exports.sortedInsert=function(t,n,r,e){if(r>0||o(!1),t.length<=r||o(!1),0===t.length)return t.push(n),null;var i=t.length===r;if(i&&e(t[t.length-1],n)<=0)return n;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;e(t[s],n)<=0?a=s+1:u=s}return t.splice(a,0,n),i?t.pop():null},exports.sqrt=function(t){if(i.greaterThanOrEqual(t,D)||o(!1),i.lessThan(t,B))return i.BigInt(Math.floor(Math.sqrt(i.toNumber(t))));var n,r;for(n=t,r=i.add(i.divide(t,P),b);i.lessThan(r,n);)n=r,r=i.divide(i.add(i.divide(t,r),r),P);return n},exports.validateAndParseAddress=l,exports.wrappedCurrency=q,exports.wrappedCurrencyAmount=function(t,n){return new W(q(t.currency,n),t.raw)};
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var r,n,e,i=t(require("jsbi")),o=t(require("tiny-invariant")),a=t(require("decimal.js-light")),u=t(require("big.js")),s=t(require("toformat")),c=require("@ethersproject/address");(r=exports.ChainId||(exports.ChainId={}))[r.MAINNET=1]="MAINNET",r[r.ROPSTEN=3]="ROPSTEN",r[r.RINKEBY=4]="RINKEBY",r[r["GÖRLI"]=5]="GÖRLI",r[r.KOVAN=42]="KOVAN",(n=exports.TradeType||(exports.TradeType={}))[n.EXACT_INPUT=0]="EXACT_INPUT",n[n.EXACT_OUTPUT=1]="EXACT_OUTPUT",(e=exports.Rounding||(exports.Rounding={}))[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP";var d=i.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function f(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function l(t,r,n){return r&&f(t.prototype,r),n&&f(t,n),t}function p(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r}function m(t,r){return t.isToken&&r.isToken?t.equals(r):!t.isToken&&!r.isToken&&t.isEther===r.isEther}var h=function(t,r,n){t>=0&&t<255&&Number.isInteger(t)||o(!1),this.decimals=t,this.symbol=r,this.name=n},y=function(t){function r(){var r;return(r=t.call(this,18,"ETH","Ether")||this).isEther=!0,r.isToken=!1,r}return p(r,t),r}(h);y.ETHER=new y;var g,v,x=y.ETHER,I=s(a),E=s(u),N=((g={})[exports.Rounding.ROUND_DOWN]=I.ROUND_DOWN,g[exports.Rounding.ROUND_HALF_UP]=I.ROUND_HALF_UP,g[exports.Rounding.ROUND_UP]=I.ROUND_UP,g),R=((v={})[exports.Rounding.ROUND_DOWN]=0,v[exports.Rounding.ROUND_HALF_UP]=1,v[exports.Rounding.ROUND_UP]=3,v),T=function(){function t(t,r){void 0===r&&(r=i.BigInt(1)),this.numerator=i.BigInt(t),this.denominator=i.BigInt(r)}var r=t.prototype;return r.invert=function(){return new t(this.denominator,this.numerator)},r.add=function(r){var n=r instanceof t?r:new t(i.BigInt(r));return i.equal(this.denominator,n.denominator)?new t(i.add(this.numerator,n.numerator),this.denominator):new t(i.add(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator)),i.multiply(this.denominator,n.denominator))},r.subtract=function(r){var n=r instanceof t?r:new t(i.BigInt(r));return i.equal(this.denominator,n.denominator)?new t(i.subtract(this.numerator,n.numerator),this.denominator):new t(i.subtract(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator)),i.multiply(this.denominator,n.denominator))},r.lessThan=function(r){var n=r instanceof t?r:new t(i.BigInt(r));return i.lessThan(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator))},r.equalTo=function(r){var n=r instanceof t?r:new t(i.BigInt(r));return i.equal(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator))},r.greaterThan=function(r){var n=r instanceof t?r:new t(i.BigInt(r));return i.greaterThan(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator))},r.multiply=function(r){var n=r instanceof t?r:new t(i.BigInt(r));return new t(i.multiply(this.numerator,n.numerator),i.multiply(this.denominator,n.denominator))},r.divide=function(r){var n=r instanceof t?r:new t(i.BigInt(r));return new t(i.multiply(this.numerator,n.denominator),i.multiply(this.denominator,n.numerator))},r.toSignificant=function(t,r,n){void 0===r&&(r={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>0||o(!1),I.set({precision:t+1,rounding:N[n]});var e=new I(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return e.toFormat(e.decimalPlaces(),r)},r.toFixed=function(t,r,n){return void 0===r&&(r={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>=0||o(!1),E.DP=t,E.RM=R[n],new E(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,r)},l(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}(),A=s(u),w=function(t){function r(r,n,e){var a;return a=t.call(this,n,e)||this,i.lessThanOrEqual(a.quotient,d)||o(!1),a.currency=r,a.decimalScale=i.exponentiate(i.BigInt(10),i.BigInt(r.decimals)),a}p(r,t),r.fromRawAmount=function(t,n){return new r(t,n)},r.fromFractionalAmount=function(t,n,e){return new r(t,n,e)},r.ether=function(t){return r.fromRawAmount(y.ETHER,t)};var n=r.prototype;return n.add=function(n){m(this.currency,n.currency)||o(!1);var e=t.prototype.add.call(this,n);return r.fromFractionalAmount(this.currency,e.numerator,e.denominator)},n.subtract=function(n){m(this.currency,n.currency)||o(!1);var e=t.prototype.subtract.call(this,n);return r.fromFractionalAmount(this.currency,e.numerator,e.denominator)},n.multiply=function(n){var e=t.prototype.multiply.call(this,n);return r.fromFractionalAmount(this.currency,e.numerator,e.denominator)},n.divide=function(n){var e=t.prototype.divide.call(this,n);return r.fromFractionalAmount(this.currency,e.numerator,e.denominator)},n.toSignificant=function(r,n,e){return void 0===r&&(r=6),void 0===e&&(e=exports.Rounding.ROUND_DOWN),t.prototype.divide.call(this,this.decimalScale).toSignificant(r,n,e)},n.toFixed=function(r,n,e){return void 0===r&&(r=this.currency.decimals),void 0===e&&(e=exports.Rounding.ROUND_DOWN),r<=this.currency.decimals||o(!1),t.prototype.divide.call(this,this.decimalScale).toFixed(r,n,e)},n.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),A.DP=this.currency.decimals,new A(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(t)},r}(T),O=new T(i.BigInt(100));function C(t){return new F(t.numerator,t.denominator)}var U,F=function(t){function r(){var r;return(r=t.apply(this,arguments)||this).isPercent=!0,r}p(r,t);var n=r.prototype;return n.add=function(r){return C(t.prototype.add.call(this,r))},n.subtract=function(r){return C(t.prototype.subtract.call(this,r))},n.multiply=function(r){return C(t.prototype.multiply.call(this,r))},n.divide=function(r){return C(t.prototype.divide.call(this,r))},n.toSignificant=function(r,n,e){return void 0===r&&(r=5),t.prototype.multiply.call(this,O).toSignificant(r,n,e)},n.toFixed=function(r,n,e){return void 0===r&&(r=2),t.prototype.multiply.call(this,O).toFixed(r,n,e)},r}(T),_=function(t){function r(r,n,e,o){var a;return(a=t.call(this,o,e)||this).baseCurrency=r,a.quoteCurrency=n,a.scalar=new T(i.exponentiate(i.BigInt(10),i.BigInt(r.decimals)),i.exponentiate(i.BigInt(10),i.BigInt(n.decimals))),a}p(r,t);var n=r.prototype;return n.invert=function(){return new r(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){m(this.quoteCurrency,n.baseCurrency)||o(!1);var e=t.prototype.multiply.call(this,n);return new r(this.baseCurrency,n.quoteCurrency,e.denominator,e.numerator)},n.quote=function(r){m(r.currency,this.baseCurrency)||o(!1);var n=t.prototype.multiply.call(this,r);return w.fromFractionalAmount(this.quoteCurrency,n.numerator,n.denominator)},n.toSignificant=function(t,r,n){return void 0===t&&(t=6),this.adjustedForDecimals.toSignificant(t,r,n)},n.toFixed=function(t,r,n){return void 0===t&&(t=4),this.adjustedForDecimals.toFixed(t,r,n)},l(r,[{key:"adjustedForDecimals",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),r}(T);function D(t){try{return c.getAddress(t)}catch(r){throw new Error(t+" is not a valid address.")}}var b=function(t){function r(r,n,e,i,o){var a;return(a=t.call(this,e,i,o)||this).isEther=!1,a.isToken=!0,a.chainId=r,a.address=D(n),a}p(r,t);var n=r.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&&o(!1),this.address===t.address&&o(!1),this.address.toLowerCase()<t.address.toLowerCase()},r}(h),B=((U={})[exports.ChainId.MAINNET]=new b(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH9","Wrapped Ether"),U[exports.ChainId.ROPSTEN]=new b(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH9","Wrapped Ether"),U[exports.ChainId.RINKEBY]=new b(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH9","Wrapped Ether"),U[exports.ChainId.GÖRLI]=new b(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH9","Wrapped Ether"),U[exports.ChainId.KOVAN]=new b(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH9","Wrapped Ether"),U),P=i.BigInt(Number.MAX_SAFE_INTEGER),q=i.BigInt(0),S=i.BigInt(1),H=i.BigInt(2);function W(t,r){if(t.isToken)return t.chainId!==r&&o(!1),t;if(t.isEther)return B[r];throw new Error("CURRENCY")}exports.CurrencyAmount=w,exports.ETHER=x,exports.Ether=y,exports.Fraction=T,exports.MaxUint256=d,exports.Percent=F,exports.Price=_,exports.Token=b,exports.WETH9=B,exports.computePriceImpact=function(t,r,n){var e=t.quote(r),i=e.subtract(n).divide(e);return new F(i.numerator,i.denominator)},exports.currencyEquals=m,exports.sortedInsert=function(t,r,n,e){if(n>0||o(!1),t.length<=n||o(!1),0===t.length)return t.push(r),null;var i=t.length===n;if(i&&e(t[t.length-1],r)<=0)return r;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;e(t[s],r)<=0?a=s+1:u=s}return t.splice(a,0,r),i?t.pop():null},exports.sqrt=function(t){if(i.greaterThanOrEqual(t,q)||o(!1),i.lessThan(t,P))return i.BigInt(Math.floor(Math.sqrt(i.toNumber(t))));var r,n;for(r=t,n=i.add(i.divide(t,H),S);i.lessThan(n,r);)r=n,n=i.divide(i.add(i.divide(t,n),n),H);return r},exports.validateAndParseAddress=D,exports.wrappedCurrency=W,exports.wrappedCurrencyAmount=function(t,r){return w.fromFractionalAmount(W(t.currency,r),t.numerator,t.denominator)};
//# sourceMappingURL=sdk-core.cjs.production.min.js.map
import JSBI from 'jsbi';
import invariant from 'tiny-invariant';
import { getAddress } from '@ethersproject/address';
import _Decimal from 'decimal.js-light';
import _Big from 'big.js';
import toFormat from 'toformat';
import { getAddress } from '@ethersproject/address';

@@ -58,11 +58,13 @@ var ChainId;

/**
* Validates an address and returns the parsed (checksummed) version of that address
* @param address the unchecksummed hex address
* Compares two currencies for equality
*/
function validateAndParseAddress(address) {
try {
return getAddress(address);
} catch (error) {
throw new Error(address + " is not a valid address.");
function currencyEquals(currencyA, currencyB) {
if (currencyA.isToken && currencyB.isToken) {
return currencyA.equals(currencyB);
} else if (currencyA.isToken) {
return false;
} else if (currencyB.isToken) {
return false;
} else {
return currencyA.isEther === currencyB.isEther;
}

@@ -91,61 +93,17 @@ }

var _WETH;
/**
* Represents an ERC20 token with a unique address and some metadata.
* Represents the currency Ether
*/
var Token = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Token, _BaseCurrency);
var Ether = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Ether, _BaseCurrency);
function Token(chainId, address, decimals, symbol, name) {
var _this;
_this = _BaseCurrency.call(this, decimals, symbol, name) || this;
_this.isEther = false;
_this.isToken = true;
_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
* Only called once by this class
* @protected
*/
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;
}(BaseCurrency);
var WETH9 = (_WETH = {}, _WETH[ChainId.MAINNET] = /*#__PURE__*/new Token(ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.ROPSTEN] = /*#__PURE__*/new Token(ChainId.ROPSTEN, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.RINKEBY] = /*#__PURE__*/new Token(ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.GÖRLI] = /*#__PURE__*/new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.KOVAN] = /*#__PURE__*/new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH9', 'Wrapped Ether'), _WETH);
var Ether = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Ether, _BaseCurrency);
function Ether() {
var _this;
_this = _BaseCurrency.apply(this, arguments) || this;
_this = _BaseCurrency.call(this, 18, 'ETH', 'Ether') || this;
_this.isEther = true;

@@ -159,6 +117,6 @@ _this.isToken = false;

/**
* The only instance of the base class `Currency`.
* The only instance of the class `Ether`.
*/
Ether.ETHER = /*#__PURE__*/new Ether(18, 'ETH', 'Ether');
Ether.ETHER = /*#__PURE__*/new Ether();
var ETHER = Ether.ETHER;

@@ -171,3 +129,2 @@

var toFixedRounding = (_toFixedRounding = {}, _toFixedRounding[Rounding.ROUND_DOWN] = 0, _toFixedRounding[Rounding.ROUND_HALF_UP] = 1, _toFixedRounding[Rounding.ROUND_UP] = 3, _toFixedRounding);
var Fraction = /*#__PURE__*/function () {

@@ -290,4 +247,121 @@ function Fraction(numerator, denominator) {

var _100_PERCENT = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100));
var Big$1 = /*#__PURE__*/toFormat(_Big);
var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
_inheritsLoose(CurrencyAmount, _Fraction);
function CurrencyAmount(currency, numerator, denominator) {
var _this;
_this = _Fraction.call(this, numerator, denominator) || this;
!JSBI.lessThanOrEqual(_this.quotient, MaxUint256) ? process.env.NODE_ENV !== "production" ? invariant(false, 'AMOUNT') : invariant(false) : void 0;
_this.currency = currency;
_this.decimalScale = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(currency.decimals));
return _this;
}
/**
* Returns a new currency amount instance from the
* @param currency the currency in the amount
* @param rawAmount the raw token or ether amount
*/
CurrencyAmount.fromRawAmount = function fromRawAmount(currency, rawAmount) {
return new CurrencyAmount(currency, rawAmount);
}
/**
* Construct a currency amount with a denominator that is not equal to 1
* @param currency the currency
* @param numerator the numerator of the fractional token amount
* @param denominator the denominator of the fractional token amount
*/
;
CurrencyAmount.fromFractionalAmount = function fromFractionalAmount(currency, numerator, denominator) {
return new CurrencyAmount(currency, numerator, denominator);
}
/**
* Helper that calls the constructor with the ETHER currency
* @param rawAmount ether amount in wei
*/
;
CurrencyAmount.ether = function ether(rawAmount) {
return CurrencyAmount.fromRawAmount(Ether.ETHER, rawAmount);
};
var _proto = CurrencyAmount.prototype;
_proto.add = function add(other) {
!currencyEquals(this.currency, other.currency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'CURRENCY') : invariant(false) : void 0;
var added = _Fraction.prototype.add.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator);
};
_proto.subtract = function subtract(other) {
!currencyEquals(this.currency, other.currency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'CURRENCY') : invariant(false) : void 0;
var subtracted = _Fraction.prototype.subtract.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator);
};
_proto.multiply = function multiply(other) {
var multiplied = _Fraction.prototype.multiply.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator);
};
_proto.divide = function divide(other) {
var divided = _Fraction.prototype.divide.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, divided.numerator, divided.denominator);
};
_proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
if (significantDigits === void 0) {
significantDigits = 6;
}
if (rounding === void 0) {
rounding = Rounding.ROUND_DOWN;
}
return _Fraction.prototype.divide.call(this, this.decimalScale).toSignificant(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.divide.call(this, this.decimalScale).toFixed(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.quotient.toString()).div(this.decimalScale.toString()).toFormat(format);
};
return CurrencyAmount;
}(Fraction);
var ONE_HUNDRED_PERCENT = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100));
/**
* Converts a fraction to a percent
* @param fraction the fraction to convert
*/
function toPercent(fraction) {

@@ -335,3 +409,3 @@ return new Percent(fraction.numerator, fraction.denominator);

return this.multiply(_100_PERCENT).toSignificant(significantDigits, format, rounding);
return _Fraction.prototype.multiply.call(this, ONE_HUNDRED_PERCENT).toSignificant(significantDigits, format, rounding);
};

@@ -344,3 +418,3 @@

return this.multiply(_100_PERCENT).toFixed(decimalPlaces, format, rounding);
return _Fraction.prototype.multiply.call(this, ONE_HUNDRED_PERCENT).toFixed(decimalPlaces, format, rounding);
};

@@ -351,2 +425,162 @@

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(JSBI.BigInt(10), JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(quoteCurrency.decimals)));
return _this;
}
/**
* Flip the price, switching the base and quote currency
*/
var _proto = Price.prototype;
_proto.invert = function invert() {
return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator);
}
/**
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
* @param other the other price
*/
;
_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);
}
/**
* Return the amount of quote currency corresponding to a given amount of the base currency
* @param currencyAmount the amount of base currency to quote against the price
*/
;
_proto.quote = function quote(currencyAmount) {
!currencyEquals(currencyAmount.currency, this.baseCurrency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0;
var result = _Fraction.prototype.multiply.call(this, currencyAmount);
return CurrencyAmount.fromFractionalAmount(this.quoteCurrency, result.numerator, result.denominator);
}
/**
* Get the value scaled by decimals for formatting
* @private
*/
;
_proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
if (significantDigits === void 0) {
significantDigits = 6;
}
return this.adjustedForDecimals.toSignificant(significantDigits, format, rounding);
};
_proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
if (decimalPlaces === void 0) {
decimalPlaces = 4;
}
return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding);
};
_createClass(Price, [{
key: "adjustedForDecimals",
get: function get() {
return _Fraction.prototype.multiply.call(this, this.scalar);
}
}]);
return Price;
}(Fraction);
/**
* Validates an address and returns the parsed (checksummed) version of that address
* @param address the unchecksummed hex address
*/
function validateAndParseAddress(address) {
try {
return getAddress(address);
} catch (error) {
throw new Error(address + " is not a valid address.");
}
}
var _WETH;
/**
* Represents an ERC20 token with a unique address and some metadata.
*/
var Token = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(Token, _BaseCurrency);
function Token(chainId, address, decimals, symbol, name) {
var _this;
_this = _BaseCurrency.call(this, decimals, symbol, name) || this;
_this.isEther = false;
_this.isToken = true;
_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;
}(BaseCurrency);
var WETH9 = (_WETH = {}, _WETH[ChainId.MAINNET] = /*#__PURE__*/new Token(ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.ROPSTEN] = /*#__PURE__*/new Token(ChainId.ROPSTEN, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.RINKEBY] = /*#__PURE__*/new Token(ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.GÖRLI] = /*#__PURE__*/new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH9', 'Wrapped Ether'), _WETH[ChainId.KOVAN] = /*#__PURE__*/new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH9', 'Wrapped Ether'), _WETH);
/**
* 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 quotedOutputAmount = midPrice.quote(inputAmount); // calculate price impact := (exactQuote - outputAmount) / exactQuote
var priceImpact = quotedOutputAmount.subtract(outputAmount).divide(quotedOutputAmount);
return new Percent(priceImpact.numerator, priceImpact.denominator);
}
// `maxSize` by removing the last item

@@ -417,17 +651,2 @@

/**
* Compares two currencies for equality
*/
function currencyEquals(currencyA, currencyB) {
if (currencyA.isToken && currencyB.isToken) {
return currencyA.equals(currencyB);
} else if (currencyA.isToken) {
return false;
} else if (currencyB.isToken) {
return false;
} else {
return currencyA.isEther === currencyB.isEther;
}
}
/**
* Given a currency which can be Ether or a token, return wrapped ether for ether and the token for the token

@@ -455,154 +674,6 @@ * @param currency the currency to wrap, if necessary

function wrappedCurrencyAmount(currencyAmount, chainId) {
return new CurrencyAmount(wrappedCurrency(currencyAmount.currency, chainId), currencyAmount.raw);
return CurrencyAmount.fromFractionalAmount(wrappedCurrency(currencyAmount.currency, chainId), currencyAmount.numerator, currencyAmount.denominator);
}
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 = JSBI.BigInt(amount);
!JSBI.lessThanOrEqual(parsedAmount, MaxUint256) ? process.env.NODE_ENV !== "production" ? invariant(false, 'AMOUNT') : invariant(false) : void 0;
_this = _Fraction.call(this, parsedAmount, JSBI.exponentiate(JSBI.BigInt(10), 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 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(JSBI.BigInt(10), JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(quoteCurrency.decimals)));
return _this;
}
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);
} // quotes with floor division
;
_proto.quote = function quote(currencyAmount) {
!currencyEquals(currencyAmount.currency, this.baseCurrency) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TOKEN') : invariant(false) : void 0;
return new CurrencyAmount(this.quoteCurrency, _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);
export { ChainId, CurrencyAmount, ETHER, Ether, Fraction, MaxUint256, Percent, Price, Rounding, Token, TradeType, WETH9, currencyEquals, sortedInsert, sqrt, validateAndParseAddress, wrappedCurrency, wrappedCurrencyAmount };
export { ChainId, CurrencyAmount, ETHER, Ether, Fraction, MaxUint256, Percent, Price, Rounding, Token, TradeType, WETH9, computePriceImpact, currencyEquals, sortedInsert, sqrt, validateAndParseAddress, wrappedCurrency, wrappedCurrencyAmount };
//# sourceMappingURL=sdk-core.esm.js.map

@@ -1,7 +0,7 @@

import sortedInsert from './sortedInsert';
import validateAndParseAddress from './validateAndParseAddress';
import sqrt from './sqrt';
export { sortedInsert, validateAndParseAddress, sqrt };
export { computePriceImpact } from './computePriceImpact';
export { currencyEquals } from './currencyEquals';
export { validateAndParseAddress } from './validateAndParseAddress';
export { sortedInsert } from './sortedInsert';
export { sqrt } from './sqrt';
export { wrappedCurrency } from './wrappedCurrency';
export { wrappedCurrencyAmount } from './wrappedCurrencyAmount';

@@ -1,1 +0,1 @@

export default function sortedInsert<T>(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null;
export declare function sortedInsert<T>(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null;

@@ -7,2 +7,2 @@ import JSBI from 'jsbi';

*/
export default function sqrt(value: JSBI): JSBI;
export declare function sqrt(value: JSBI): JSBI;

@@ -5,2 +5,2 @@ /**

*/
export default function validateAndParseAddress(address: string): string;
export declare function validateAndParseAddress(address: string): string;
{
"name": "@uniswap/sdk-core",
"license": "MIT",
"version": "2.0.5",
"version": "3.0.0-alpha.0",
"description": "⚒️ An SDK for building applications on top of Uniswap V3",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc