Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uniswap/v2-sdk

Package Overview
Dependencies
Maintainers
7
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniswap/v2-sdk - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

dist/utils/babylonianSqrt.d.ts

2

dist/entities/pair.d.ts

@@ -28,3 +28,3 @@ import { BigintIsh, ChainId, Price, Token, TokenAmount } from '@uniswap/sdk-core';

*/
get chainId(): ChainId;
get chainId(): ChainId | number;
get token0(): Token;

@@ -31,0 +31,0 @@ get token1(): Token;

@@ -10,3 +10,3 @@ import { ChainId, Currency, Price, Token } from '@uniswap/sdk-core';

constructor(pairs: Pair[], input: Currency, output?: Currency);
get chainId(): ChainId;
get chainId(): ChainId | number;
}

@@ -12,3 +12,2 @@ 'use strict';

var address = require('@ethersproject/address');
var warning = _interopDefault(require('tiny-warning'));

@@ -224,47 +223,24 @@ var FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';

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 : JSBI.BigInt(bigintIsh);
} // 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
var ZERO$1 = /*#__PURE__*/JSBI.BigInt(0);
var ONE$1 = /*#__PURE__*/JSBI.BigInt(1);
var TWO = /*#__PURE__*/JSBI.BigInt(2);
var THREE = /*#__PURE__*/JSBI.BigInt(3); // computes floor(babylonianSqrt(y)) using the babylonian method (not the fastest way)
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
function babylonianSqrt(y) {
var z = ZERO$1;
var x;
!(items.length <= maxSize) ? invariant(false, 'ITEMS_SIZE') : void 0; // short circuit first item add
if (JSBI.greaterThan(y, THREE)) {
z = y;
x = JSBI.add(JSBI.divide(y, TWO), ONE$1);
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;
while (JSBI.lessThan(x, z)) {
z = x;
x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO);
}
} else if (JSBI.notEqual(y, ZERO$1)) {
z = ONE$1;
}
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;
}
return z;
}

@@ -363,3 +339,3 @@

if (JSBI.equal(totalSupply.raw, ZERO)) {
liquidity = JSBI.subtract(sdkCore.babylonianSqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY);
liquidity = JSBI.subtract(babylonianSqrt(JSBI.multiply(tokenAmounts[0].raw, tokenAmounts[1].raw)), MINIMUM_LIQUIDITY);
} else {

@@ -393,7 +369,7 @@ var amount0 = JSBI.divide(JSBI.multiply(tokenAmounts[0].raw, totalSupply.raw), this.reserve0.raw);

!!!kLast ? invariant(false, 'K_LAST') : void 0;
var kLastParsed = parseBigintIsh(kLast);
var kLastParsed = JSBI.BigInt(kLast);
if (!JSBI.equal(kLastParsed, ZERO)) {
var rootK = sdkCore.babylonianSqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw));
var rootKLast = sdkCore.babylonianSqrt(kLastParsed);
var rootK = babylonianSqrt(JSBI.multiply(this.reserve0.raw, this.reserve1.raw));
var rootKLast = babylonianSqrt(kLastParsed);

@@ -463,8 +439,10 @@ if (JSBI.greaterThan(rootK, rootKLast)) {

!(pairs.length > 0) ? invariant(false, 'PAIRS') : void 0;
var chainId = pairs[0].chainId;
!pairs.every(function (pair) {
return pair.chainId === pairs[0].chainId;
return pair.chainId === chainId;
}) ? invariant(false, 'CHAIN_IDS') : void 0;
!(input instanceof sdkCore.Token && pairs[0].involvesToken(input) || input === sdkCore.ETHER && pairs[0].involvesToken(sdkCore.WETH9[pairs[0].chainId])) ? invariant(false, 'INPUT') : void 0;
!(typeof output === 'undefined' || output instanceof sdkCore.Token && pairs[pairs.length - 1].involvesToken(output) || output === sdkCore.ETHER && pairs[pairs.length - 1].involvesToken(sdkCore.WETH9[pairs[0].chainId])) ? invariant(false, 'OUTPUT') : void 0;
var path = [input instanceof sdkCore.Token ? input : sdkCore.WETH9[pairs[0].chainId]];
var weth = sdkCore.WETH9[chainId];
!(input instanceof sdkCore.Token && pairs[0].involvesToken(input) || input === sdkCore.ETHER && weth && pairs[0].involvesToken(weth)) ? invariant(false, 'INPUT') : void 0;
!(typeof output === 'undefined' || output instanceof sdkCore.Token && pairs[pairs.length - 1].involvesToken(output) || output === sdkCore.ETHER && weth && pairs[pairs.length - 1].involvesToken(weth)) ? invariant(false, 'OUTPUT') : void 0;
var path = [input instanceof sdkCore.Token ? input : weth];

@@ -762,3 +740,3 @@ for (var _iterator = _createForOfIteratorHelperLoose(pairs.entries()), _step; !(_step = _iterator()).done;) {

if (amountOut.token.equals(tokenOut)) {
sortedInsert(bestTrades, new Trade(new Route([].concat(currentPairs, [pair]), originalAmountIn.currency, currencyOut), originalAmountIn, sdkCore.TradeType.EXACT_INPUT), maxNumResults, tradeComparator);
sdkCore.sortedInsert(bestTrades, new Trade(new Route([].concat(currentPairs, [pair]), originalAmountIn.currency, currencyOut), originalAmountIn, sdkCore.TradeType.EXACT_INPUT), maxNumResults, tradeComparator);
} else if (maxHops > 1 && pairs.length > 1) {

@@ -845,3 +823,3 @@ 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

if (amountIn.token.equals(tokenIn)) {
sortedInsert(bestTrades, new Trade(new Route([pair].concat(currentPairs), currencyIn, originalAmountOut.currency), originalAmountOut, sdkCore.TradeType.EXACT_OUTPUT), maxNumResults, tradeComparator);
sdkCore.sortedInsert(bestTrades, new Trade(new Route([pair].concat(currentPairs), currencyIn, originalAmountOut.currency), originalAmountOut, sdkCore.TradeType.EXACT_OUTPUT), maxNumResults, tradeComparator);
} else if (maxHops > 1 && pairs.length > 1) {

@@ -890,3 +868,3 @@ 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

!(!('ttl' in options) || options.ttl > 0) ? invariant(false, 'TTL') : void 0;
var to = validateAndParseAddress(options.recipient);
var to = sdkCore.validateAndParseAddress(options.recipient);
var amountIn = toHex(trade.maximumAmountIn(options.allowedSlippage));

@@ -893,0 +871,0 @@ var amountOut = toHex(trade.minimumAmountOut(options.allowedSlippage));

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("jsbi")),n=require("@uniswap/sdk-core"),r=e(require("tiny-invariant")),o=require("@ethersproject/solidity"),i=require("@ethersproject/address"),u=(e(require("tiny-warning")),"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f"),a=t.BigInt(1e3),s=t.BigInt(0),c=t.BigInt(1),l=t.BigInt(5),p=t.BigInt(997),h=t.BigInt(1e3);function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function y(e,t,n){return(y=k()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&m(o,n.prototype),o}).apply(null,arguments)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return y(e,arguments,T(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)})(e)}function A(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function E(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[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=e[Symbol.iterator]()).next.bind(n)}var I="setPrototypeOf"in Object,q=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,I&&Object.setPrototypeOf(A(n),(this instanceof t?this.constructor:void 0).prototype),n}return v(t,e),t}(w(Error)),b=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,I&&Object.setPrototypeOf(A(n),(this instanceof t?this.constructor:void 0).prototype),n}return v(t,e),t}(w(Error));function x(e,t,n,o){if(n>0||r(!1),e.length<=n||r(!1),0===e.length)return e.push(t),null;var i=e.length===n;if(i&&o(e[e.length-1],t)<=0)return t;for(var u=0,a=e.length;u<a;){var s=u+a>>>1;o(e[s],t)<=0?u=s+1:a=s}return e.splice(u,0,t),i?e.pop():null}var O=function(){function e(t,r){var o=t.token.sortsBefore(r.token)?[t,r]:[r,t];this.liquidityToken=new n.Token(o[0].token.chainId,e.getAddress(o[0].token,o[1].token),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=o}e.getAddress=function(e,t){var n=e.sortsBefore(t)?[e,t]:[t,e];return i.getCreate2Address("0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",o.keccak256(["bytes"],[o.pack(["address","address"],[n[0].address,n[1].address])]),u)};var f=e.prototype;return f.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},f.priceOf=function(e){return this.involvesToken(e)||r(!1),e.equals(this.token0)?this.token0Price:this.token1Price},f.reserveOf=function(e){return this.involvesToken(e)||r(!1),e.equals(this.token0)?this.reserve0:this.reserve1},f.getOutputAmount=function(o){if(this.involvesToken(o.token)||r(!1),t.equal(this.reserve0.raw,s)||t.equal(this.reserve1.raw,s))throw new q;var i=this.reserveOf(o.token),u=this.reserveOf(o.token.equals(this.token0)?this.token1:this.token0),a=t.multiply(o.raw,p),c=t.multiply(a,u.raw),l=t.add(t.multiply(i.raw,h),a),f=new n.TokenAmount(o.token.equals(this.token0)?this.token1:this.token0,t.divide(c,l));if(t.equal(f.raw,s))throw new b;return[f,new e(i.add(o),u.subtract(f))]},f.getInputAmount=function(o){if(this.involvesToken(o.token)||r(!1),t.equal(this.reserve0.raw,s)||t.equal(this.reserve1.raw,s)||t.greaterThanOrEqual(o.raw,this.reserveOf(o.token).raw))throw new q;var i=this.reserveOf(o.token),u=this.reserveOf(o.token.equals(this.token0)?this.token1:this.token0),a=t.multiply(t.multiply(u.raw,o.raw),h),l=t.multiply(t.subtract(i.raw,o.raw),p),f=new n.TokenAmount(o.token.equals(this.token0)?this.token1:this.token0,t.add(t.divide(a,l),c));return[f,new e(u.add(f),i.subtract(o))]},f.getLiquidityMinted=function(e,o,i){e.token.equals(this.liquidityToken)||r(!1);var u,c=o.token.sortsBefore(i.token)?[o,i]:[i,o];if(c[0].token.equals(this.token0)&&c[1].token.equals(this.token1)||r(!1),t.equal(e.raw,s))u=t.subtract(n.babylonianSqrt(t.multiply(c[0].raw,c[1].raw)),a);else{var l=t.divide(t.multiply(c[0].raw,e.raw),this.reserve0.raw),p=t.divide(t.multiply(c[1].raw,e.raw),this.reserve1.raw);u=t.lessThanOrEqual(l,p)?l:p}if(!t.greaterThan(u,s))throw new b;return new n.TokenAmount(this.liquidityToken,u)},f.getLiquidityValue=function(e,o,i,u,a){var c,p;if(void 0===u&&(u=!1),this.involvesToken(e)||r(!1),o.token.equals(this.liquidityToken)||r(!1),i.token.equals(this.liquidityToken)||r(!1),t.lessThanOrEqual(i.raw,o.raw)||r(!1),u){a||r(!1);var h=(p=a)instanceof t?p:t.BigInt(p);if(t.equal(h,s))c=o;else{var f=n.babylonianSqrt(t.multiply(this.reserve0.raw,this.reserve1.raw)),d=n.babylonianSqrt(h);if(t.greaterThan(f,d)){var v=t.multiply(o.raw,t.subtract(f,d)),T=t.add(t.multiply(f,l),d),m=t.divide(v,T);c=o.add(new n.TokenAmount(this.liquidityToken,m))}else c=o}}else c=o;return new n.TokenAmount(e,t.divide(t.multiply(i.raw,this.reserveOf(e).raw),c.raw))},d(e,[{key:"token0Price",get:function(){return new n.Price(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new n.Price(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]}}]),e}(),P=function(){function e(e,t,o){e.length>0||r(!1),e.every((function(t){return t.chainId===e[0].chainId}))||r(!1),t instanceof n.Token&&e[0].involvesToken(t)||t===n.ETHER&&e[0].involvesToken(n.WETH9[e[0].chainId])||r(!1),void 0===o||o instanceof n.Token&&e[e.length-1].involvesToken(o)||o===n.ETHER&&e[e.length-1].involvesToken(n.WETH9[e[0].chainId])||r(!1);for(var i,u=[t instanceof n.Token?t:n.WETH9[e[0].chainId]],a=E(e.entries());!(i=a()).done;){var s=i.value,c=s[1],l=u[s[0]];l.equals(c.token0)||l.equals(c.token1)||r(!1);var p=l.equals(c.token0)?c.token1:c.token0;u.push(p)}this.pairs=e,this.path=u,this.input=t,this.output=null!=o?o:u[u.length-1]}return d(e,[{key:"midPrice",get:function(){for(var e,t=[],r=E(this.pairs.entries());!(e=r()).done;){var o=e.value,i=o[1];t.push(this.path[o[0]].equals(i.token0)?new n.Price(i.reserve0.currency,i.reserve1.currency,i.reserve0.raw,i.reserve1.raw):new n.Price(i.reserve1.currency,i.reserve0.currency,i.reserve1.raw,i.reserve0.raw))}return t.slice(1).reduce((function(e,t){return e.multiply(t)}),t[0])}},{key:"chainId",get:function(){return this.pairs[0].chainId}}]),e}();function _(e,t){return n.currencyEquals(e.inputAmount.currency,t.inputAmount.currency)||r(!1),n.currencyEquals(e.outputAmount.currency,t.outputAmount.currency)||r(!1),e.outputAmount.equalTo(t.outputAmount)?e.inputAmount.equalTo(t.inputAmount)?0:e.inputAmount.lessThan(t.inputAmount)?-1:1:e.outputAmount.lessThan(t.outputAmount)?1:-1}function C(e,t){var n=_(e,t);return 0!==n?n:e.priceImpact.lessThan(t.priceImpact)?-1:e.priceImpact.greaterThan(t.priceImpact)?1:e.route.path.length-t.route.path.length}function H(e,t){return e instanceof n.TokenAmount?e:e.currency===n.ETHER?new n.TokenAmount(n.WETH9[t],e.raw):void r(!1)}function R(e,t){return e instanceof n.Token?e:e===n.ETHER?n.WETH9[t]:void r(!1)}var S=function(){function e(e,t,o){var i,u,a,s=new Array(e.path.length),c=new Array(e.pairs.length);if(o===n.TradeType.EXACT_INPUT){n.currencyEquals(t.currency,e.input)||r(!1),s[0]=H(t,e.chainId);for(var l=0;l<e.path.length-1;l++){var p=e.pairs[l].getOutputAmount(s[l]),h=p[1];s[l+1]=p[0],c[l]=h}}else{n.currencyEquals(t.currency,e.output)||r(!1),s[s.length-1]=H(t,e.chainId);for(var f=e.path.length-1;f>0;f--){var d=e.pairs[f-1].getInputAmount(s[f]),v=d[1];s[f-1]=d[0],c[f-1]=v}}this.route=e,this.tradeType=o,this.inputAmount=o===n.TradeType.EXACT_INPUT?t:e.input===n.ETHER?n.CurrencyAmount.ether(s[0].raw):s[0],this.outputAmount=o===n.TradeType.EXACT_OUTPUT?t:e.output===n.ETHER?n.CurrencyAmount.ether(s[s.length-1].raw):s[s.length-1],this.executionPrice=new n.Price(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=new P(c,e.input).midPrice,this.priceImpact=(i=this.outputAmount,a=(u=e.midPrice.raw.multiply(this.inputAmount.raw)).subtract(i.raw).divide(u),new n.Percent(a.numerator,a.denominator))}e.exactIn=function(t,r){return new e(t,r,n.TradeType.EXACT_INPUT)},e.exactOut=function(t,r){return new e(t,r,n.TradeType.EXACT_OUTPUT)};var t=e.prototype;return t.minimumAmountOut=function(e){if(e.lessThan(s)&&r(!1),this.tradeType===n.TradeType.EXACT_OUTPUT)return this.outputAmount;var t=new n.Fraction(c).add(e).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof n.TokenAmount?new n.TokenAmount(this.outputAmount.token,t):n.CurrencyAmount.ether(t)},t.maximumAmountIn=function(e){if(e.lessThan(s)&&r(!1),this.tradeType===n.TradeType.EXACT_INPUT)return this.inputAmount;var t=new n.Fraction(c).add(e).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof n.TokenAmount?new n.TokenAmount(this.inputAmount.token,t):n.CurrencyAmount.ether(t)},e.bestTradeExactIn=function(t,o,i,u,a,c,l){var p=void 0===u?{}:u,h=p.maxNumResults,f=void 0===h?3:h,d=p.maxHops,v=void 0===d?3:d;void 0===a&&(a=[]),void 0===c&&(c=o),void 0===l&&(l=[]),t.length>0||r(!1),v>0||r(!1),c===o||a.length>0||r(!1);var T=o instanceof n.TokenAmount?o.token.chainId:i instanceof n.Token?i.chainId:void 0;void 0===T&&r(!1);for(var m=H(o,T),k=R(i,T),y=0;y<t.length;y++){var w=t[y];if((w.token0.equals(m.token)||w.token1.equals(m.token))&&!w.reserve0.equalTo(s)&&!w.reserve1.equalTo(s)){var A=void 0;try{A=w.getOutputAmount(m)[0]}catch(e){if(e.isInsufficientInputAmountError)continue;throw e}if(A.token.equals(k))x(l,new e(new P([].concat(a,[w]),c.currency,i),c,n.TradeType.EXACT_INPUT),f,C);else if(v>1&&t.length>1){var g=t.slice(0,y).concat(t.slice(y+1,t.length));e.bestTradeExactIn(g,A,i,{maxNumResults:f,maxHops:v-1},[].concat(a,[w]),c,l)}}}return l},e.bestTradeExactOut=function(t,o,i,u,a,c,l){var p=void 0===u?{}:u,h=p.maxNumResults,f=void 0===h?3:h,d=p.maxHops,v=void 0===d?3:d;void 0===a&&(a=[]),void 0===c&&(c=i),void 0===l&&(l=[]),t.length>0||r(!1),v>0||r(!1),c===i||a.length>0||r(!1);var T=i instanceof n.TokenAmount?i.token.chainId:o instanceof n.Token?o.chainId:void 0;void 0===T&&r(!1);for(var m=H(i,T),k=R(o,T),y=0;y<t.length;y++){var w=t[y];if((w.token0.equals(m.token)||w.token1.equals(m.token))&&!w.reserve0.equalTo(s)&&!w.reserve1.equalTo(s)){var A=void 0;try{A=w.getInputAmount(m)[0]}catch(e){if(e.isInsufficientReservesError)continue;throw e}if(A.token.equals(k))x(l,new e(new P([w].concat(a),o,c.currency),c,n.TradeType.EXACT_OUTPUT),f,C);else if(v>1&&t.length>1){var g=t.slice(0,y).concat(t.slice(y+1,t.length));e.bestTradeExactOut(g,o,A,{maxNumResults:f,maxHops:v-1},[w].concat(a),c,l)}}}return l},e}();function U(e){return"0x"+e.raw.toString(16)}var j=function(){function e(){}return e.swapCallParameters=function(e,t){var o=e.inputAmount.currency===n.ETHER,u=e.outputAmount.currency===n.ETHER;o&&u&&r(!1),!("ttl"in t)||t.ttl>0||r(!1);var a,s,c,l=function(e){try{return i.getAddress(e)}catch(e){r(!1)}}(t.recipient),p=U(e.maximumAmountIn(t.allowedSlippage)),h=U(e.minimumAmountOut(t.allowedSlippage)),f=e.route.path.map((function(e){return e.address})),d="ttl"in t?"0x"+(Math.floor((new Date).getTime()/1e3)+t.ttl).toString(16):"0x"+t.deadline.toString(16),v=Boolean(t.feeOnTransfer);switch(e.tradeType){case n.TradeType.EXACT_INPUT:o?(a=v?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",s=[h,f,l,d],c=p):u?(a=v?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",s=[p,h,f,l,d],c="0x0"):(a=v?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",s=[p,h,f,l,d],c="0x0");break;case n.TradeType.EXACT_OUTPUT:v&&r(!1),o?(a="swapETHForExactTokens",s=[h,f,l,d],c=p):u?(a="swapTokensForExactETH",s=[h,p,f,l,d],c="0x0"):(a="swapTokensForExactTokens",s=[h,p,f,l,d],c="0x0")}return{methodName:a,args:s,value:c}},e}();exports.JSBI=t,exports.FACTORY_ADDRESS="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",exports.INIT_CODE_HASH=u,exports.InsufficientInputAmountError=b,exports.InsufficientReservesError=q,exports.MINIMUM_LIQUIDITY=a,exports.Pair=O,exports.Route=P,exports.Router=j,exports.Trade=S,exports.inputOutputComparator=_,exports.tradeComparator=C;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("jsbi")),n=require("@uniswap/sdk-core"),r=e(require("tiny-invariant")),o=require("@ethersproject/solidity"),i=require("@ethersproject/address"),u="0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f",a=t.BigInt(1e3),s=t.BigInt(0),c=t.BigInt(1),l=t.BigInt(5),p=t.BigInt(997),h=t.BigInt(1e3);function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function y(e,t,n){return(y=k()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&m(o,n.prototype),o}).apply(null,arguments)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return y(e,arguments,T(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)})(e)}function A(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function E(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[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=e[Symbol.iterator]()).next.bind(n)}var I="setPrototypeOf"in Object,q=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,I&&Object.setPrototypeOf(A(n),(this instanceof t?this.constructor:void 0).prototype),n}return v(t,e),t}(w(Error)),x=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,I&&Object.setPrototypeOf(A(n),(this instanceof t?this.constructor:void 0).prototype),n}return v(t,e),t}(w(Error)),b=t.BigInt(0),O=t.BigInt(1),P=t.BigInt(2),_=t.BigInt(3);function C(e){var n,r=b;if(t.greaterThan(e,_))for(r=e,n=t.add(t.divide(e,P),O);t.lessThan(n,r);)r=n,n=t.divide(t.add(t.divide(e,n),n),P);else t.notEqual(e,b)&&(r=O);return r}var R=function(){function e(t,r){var o=t.token.sortsBefore(r.token)?[t,r]:[r,t];this.liquidityToken=new n.Token(o[0].token.chainId,e.getAddress(o[0].token,o[1].token),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=o}e.getAddress=function(e,t){var n=e.sortsBefore(t)?[e,t]:[t,e];return i.getCreate2Address("0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",o.keccak256(["bytes"],[o.pack(["address","address"],[n[0].address,n[1].address])]),u)};var f=e.prototype;return f.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},f.priceOf=function(e){return this.involvesToken(e)||r(!1),e.equals(this.token0)?this.token0Price:this.token1Price},f.reserveOf=function(e){return this.involvesToken(e)||r(!1),e.equals(this.token0)?this.reserve0:this.reserve1},f.getOutputAmount=function(o){if(this.involvesToken(o.token)||r(!1),t.equal(this.reserve0.raw,s)||t.equal(this.reserve1.raw,s))throw new q;var i=this.reserveOf(o.token),u=this.reserveOf(o.token.equals(this.token0)?this.token1:this.token0),a=t.multiply(o.raw,p),c=t.multiply(a,u.raw),l=t.add(t.multiply(i.raw,h),a),f=new n.TokenAmount(o.token.equals(this.token0)?this.token1:this.token0,t.divide(c,l));if(t.equal(f.raw,s))throw new x;return[f,new e(i.add(o),u.subtract(f))]},f.getInputAmount=function(o){if(this.involvesToken(o.token)||r(!1),t.equal(this.reserve0.raw,s)||t.equal(this.reserve1.raw,s)||t.greaterThanOrEqual(o.raw,this.reserveOf(o.token).raw))throw new q;var i=this.reserveOf(o.token),u=this.reserveOf(o.token.equals(this.token0)?this.token1:this.token0),a=t.multiply(t.multiply(u.raw,o.raw),h),l=t.multiply(t.subtract(i.raw,o.raw),p),f=new n.TokenAmount(o.token.equals(this.token0)?this.token1:this.token0,t.add(t.divide(a,l),c));return[f,new e(u.add(f),i.subtract(o))]},f.getLiquidityMinted=function(e,o,i){e.token.equals(this.liquidityToken)||r(!1);var u,c=o.token.sortsBefore(i.token)?[o,i]:[i,o];if(c[0].token.equals(this.token0)&&c[1].token.equals(this.token1)||r(!1),t.equal(e.raw,s))u=t.subtract(C(t.multiply(c[0].raw,c[1].raw)),a);else{var l=t.divide(t.multiply(c[0].raw,e.raw),this.reserve0.raw),p=t.divide(t.multiply(c[1].raw,e.raw),this.reserve1.raw);u=t.lessThanOrEqual(l,p)?l:p}if(!t.greaterThan(u,s))throw new x;return new n.TokenAmount(this.liquidityToken,u)},f.getLiquidityValue=function(e,o,i,u,a){var c;if(void 0===u&&(u=!1),this.involvesToken(e)||r(!1),o.token.equals(this.liquidityToken)||r(!1),i.token.equals(this.liquidityToken)||r(!1),t.lessThanOrEqual(i.raw,o.raw)||r(!1),u){a||r(!1);var p=t.BigInt(a);if(t.equal(p,s))c=o;else{var h=C(t.multiply(this.reserve0.raw,this.reserve1.raw)),f=C(p);if(t.greaterThan(h,f)){var d=t.multiply(o.raw,t.subtract(h,f)),v=t.add(t.multiply(h,l),f),T=t.divide(d,v);c=o.add(new n.TokenAmount(this.liquidityToken,T))}else c=o}}else c=o;return new n.TokenAmount(e,t.divide(t.multiply(i.raw,this.reserveOf(e).raw),c.raw))},d(e,[{key:"token0Price",get:function(){return new n.Price(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new n.Price(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]}}]),e}(),H=function(){function e(e,t,o){e.length>0||r(!1);var i=e[0].chainId;e.every((function(e){return e.chainId===i}))||r(!1);var u=n.WETH9[i];t instanceof n.Token&&e[0].involvesToken(t)||t===n.ETHER&&u&&e[0].involvesToken(u)||r(!1),void 0===o||o instanceof n.Token&&e[e.length-1].involvesToken(o)||o===n.ETHER&&u&&e[e.length-1].involvesToken(u)||r(!1);for(var a,s=[t instanceof n.Token?t:u],c=E(e.entries());!(a=c()).done;){var l=a.value,p=l[1],h=s[l[0]];h.equals(p.token0)||h.equals(p.token1)||r(!1);var f=h.equals(p.token0)?p.token1:p.token0;s.push(f)}this.pairs=e,this.path=s,this.input=t,this.output=null!=o?o:s[s.length-1]}return d(e,[{key:"midPrice",get:function(){for(var e,t=[],r=E(this.pairs.entries());!(e=r()).done;){var o=e.value,i=o[1];t.push(this.path[o[0]].equals(i.token0)?new n.Price(i.reserve0.currency,i.reserve1.currency,i.reserve0.raw,i.reserve1.raw):new n.Price(i.reserve1.currency,i.reserve0.currency,i.reserve1.raw,i.reserve0.raw))}return t.slice(1).reduce((function(e,t){return e.multiply(t)}),t[0])}},{key:"chainId",get:function(){return this.pairs[0].chainId}}]),e}();function B(e,t){return n.currencyEquals(e.inputAmount.currency,t.inputAmount.currency)||r(!1),n.currencyEquals(e.outputAmount.currency,t.outputAmount.currency)||r(!1),e.outputAmount.equalTo(t.outputAmount)?e.inputAmount.equalTo(t.inputAmount)?0:e.inputAmount.lessThan(t.inputAmount)?-1:1:e.outputAmount.lessThan(t.outputAmount)?1:-1}function S(e,t){var n=B(e,t);return 0!==n?n:e.priceImpact.lessThan(t.priceImpact)?-1:e.priceImpact.greaterThan(t.priceImpact)?1:e.route.path.length-t.route.path.length}function U(e,t){return e instanceof n.TokenAmount?e:e.currency===n.ETHER?new n.TokenAmount(n.WETH9[t],e.raw):void r(!1)}function j(e,t){return e instanceof n.Token?e:e===n.ETHER?n.WETH9[t]:void r(!1)}var F=function(){function e(e,t,o){var i,u,a,s=new Array(e.path.length),c=new Array(e.pairs.length);if(o===n.TradeType.EXACT_INPUT){n.currencyEquals(t.currency,e.input)||r(!1),s[0]=U(t,e.chainId);for(var l=0;l<e.path.length-1;l++){var p=e.pairs[l].getOutputAmount(s[l]),h=p[1];s[l+1]=p[0],c[l]=h}}else{n.currencyEquals(t.currency,e.output)||r(!1),s[s.length-1]=U(t,e.chainId);for(var f=e.path.length-1;f>0;f--){var d=e.pairs[f-1].getInputAmount(s[f]),v=d[1];s[f-1]=d[0],c[f-1]=v}}this.route=e,this.tradeType=o,this.inputAmount=o===n.TradeType.EXACT_INPUT?t:e.input===n.ETHER?n.CurrencyAmount.ether(s[0].raw):s[0],this.outputAmount=o===n.TradeType.EXACT_OUTPUT?t:e.output===n.ETHER?n.CurrencyAmount.ether(s[s.length-1].raw):s[s.length-1],this.executionPrice=new n.Price(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=new H(c,e.input).midPrice,this.priceImpact=(i=this.outputAmount,a=(u=e.midPrice.raw.multiply(this.inputAmount.raw)).subtract(i.raw).divide(u),new n.Percent(a.numerator,a.denominator))}e.exactIn=function(t,r){return new e(t,r,n.TradeType.EXACT_INPUT)},e.exactOut=function(t,r){return new e(t,r,n.TradeType.EXACT_OUTPUT)};var t=e.prototype;return t.minimumAmountOut=function(e){if(e.lessThan(s)&&r(!1),this.tradeType===n.TradeType.EXACT_OUTPUT)return this.outputAmount;var t=new n.Fraction(c).add(e).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof n.TokenAmount?new n.TokenAmount(this.outputAmount.token,t):n.CurrencyAmount.ether(t)},t.maximumAmountIn=function(e){if(e.lessThan(s)&&r(!1),this.tradeType===n.TradeType.EXACT_INPUT)return this.inputAmount;var t=new n.Fraction(c).add(e).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof n.TokenAmount?new n.TokenAmount(this.inputAmount.token,t):n.CurrencyAmount.ether(t)},e.bestTradeExactIn=function(t,o,i,u,a,c,l){var p=void 0===u?{}:u,h=p.maxNumResults,f=void 0===h?3:h,d=p.maxHops,v=void 0===d?3:d;void 0===a&&(a=[]),void 0===c&&(c=o),void 0===l&&(l=[]),t.length>0||r(!1),v>0||r(!1),c===o||a.length>0||r(!1);var T=o instanceof n.TokenAmount?o.token.chainId:i instanceof n.Token?i.chainId:void 0;void 0===T&&r(!1);for(var m=U(o,T),k=j(i,T),y=0;y<t.length;y++){var w=t[y];if((w.token0.equals(m.token)||w.token1.equals(m.token))&&!w.reserve0.equalTo(s)&&!w.reserve1.equalTo(s)){var A=void 0;try{A=w.getOutputAmount(m)[0]}catch(e){if(e.isInsufficientInputAmountError)continue;throw e}if(A.token.equals(k))n.sortedInsert(l,new e(new H([].concat(a,[w]),c.currency,i),c,n.TradeType.EXACT_INPUT),f,S);else if(v>1&&t.length>1){var g=t.slice(0,y).concat(t.slice(y+1,t.length));e.bestTradeExactIn(g,A,i,{maxNumResults:f,maxHops:v-1},[].concat(a,[w]),c,l)}}}return l},e.bestTradeExactOut=function(t,o,i,u,a,c,l){var p=void 0===u?{}:u,h=p.maxNumResults,f=void 0===h?3:h,d=p.maxHops,v=void 0===d?3:d;void 0===a&&(a=[]),void 0===c&&(c=i),void 0===l&&(l=[]),t.length>0||r(!1),v>0||r(!1),c===i||a.length>0||r(!1);var T=i instanceof n.TokenAmount?i.token.chainId:o instanceof n.Token?o.chainId:void 0;void 0===T&&r(!1);for(var m=U(i,T),k=j(o,T),y=0;y<t.length;y++){var w=t[y];if((w.token0.equals(m.token)||w.token1.equals(m.token))&&!w.reserve0.equalTo(s)&&!w.reserve1.equalTo(s)){var A=void 0;try{A=w.getInputAmount(m)[0]}catch(e){if(e.isInsufficientReservesError)continue;throw e}if(A.token.equals(k))n.sortedInsert(l,new e(new H([w].concat(a),o,c.currency),c,n.TradeType.EXACT_OUTPUT),f,S);else if(v>1&&t.length>1){var g=t.slice(0,y).concat(t.slice(y+1,t.length));e.bestTradeExactOut(g,o,A,{maxNumResults:f,maxHops:v-1},[w].concat(a),c,l)}}}return l},e}();function N(e){return"0x"+e.raw.toString(16)}var D=function(){function e(){}return e.swapCallParameters=function(e,t){var o=e.inputAmount.currency===n.ETHER,i=e.outputAmount.currency===n.ETHER;o&&i&&r(!1),!("ttl"in t)||t.ttl>0||r(!1);var u,a,s,c=n.validateAndParseAddress(t.recipient),l=N(e.maximumAmountIn(t.allowedSlippage)),p=N(e.minimumAmountOut(t.allowedSlippage)),h=e.route.path.map((function(e){return e.address})),f="ttl"in t?"0x"+(Math.floor((new Date).getTime()/1e3)+t.ttl).toString(16):"0x"+t.deadline.toString(16),d=Boolean(t.feeOnTransfer);switch(e.tradeType){case n.TradeType.EXACT_INPUT:o?(u=d?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",a=[p,h,c,f],s=l):i?(u=d?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",a=[l,p,h,c,f],s="0x0"):(u=d?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",a=[l,p,h,c,f],s="0x0");break;case n.TradeType.EXACT_OUTPUT:d&&r(!1),o?(u="swapETHForExactTokens",a=[p,h,c,f],s=l):i?(u="swapTokensForExactETH",a=[p,l,h,c,f],s="0x0"):(u="swapTokensForExactTokens",a=[p,l,h,c,f],s="0x0")}return{methodName:u,args:a,value:s}},e}();exports.JSBI=t,exports.FACTORY_ADDRESS="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",exports.INIT_CODE_HASH=u,exports.InsufficientInputAmountError=x,exports.InsufficientReservesError=q,exports.MINIMUM_LIQUIDITY=a,exports.Pair=R,exports.Route=H,exports.Router=D,exports.Trade=F,exports.inputOutputComparator=B,exports.tradeComparator=S;
//# sourceMappingURL=v2-sdk.cjs.production.min.js.map
import JSBI from 'jsbi';
export { default as JSBI } from 'jsbi';
import { TokenAmount, babylonianSqrt, Token, Price, ETHER, WETH9, currencyEquals, TradeType, Fraction, CurrencyAmount, Percent } from '@uniswap/sdk-core';
import { TokenAmount, Token, Price, ETHER, WETH9, currencyEquals, TradeType, Fraction, CurrencyAmount, Percent, sortedInsert, validateAndParseAddress } from '@uniswap/sdk-core';
import invariant from 'tiny-invariant';
import { keccak256, pack } from '@ethersproject/solidity';
import { getAddress, getCreate2Address } from '@ethersproject/address';
import warning from 'tiny-warning';
import { getCreate2Address } from '@ethersproject/address';

@@ -218,47 +217,24 @@ var FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';

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 : JSBI.BigInt(bigintIsh);
} // 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
var ZERO$1 = /*#__PURE__*/JSBI.BigInt(0);
var ONE$1 = /*#__PURE__*/JSBI.BigInt(1);
var TWO = /*#__PURE__*/JSBI.BigInt(2);
var THREE = /*#__PURE__*/JSBI.BigInt(3); // computes floor(babylonianSqrt(y)) using the babylonian method (not the fastest way)
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
function babylonianSqrt(y) {
var z = ZERO$1;
var x;
!(items.length <= maxSize) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ITEMS_SIZE') : invariant(false) : void 0; // short circuit first item add
if (JSBI.greaterThan(y, THREE)) {
z = y;
x = JSBI.add(JSBI.divide(y, TWO), ONE$1);
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;
while (JSBI.lessThan(x, z)) {
z = x;
x = JSBI.divide(JSBI.add(JSBI.divide(y, x), x), TWO);
}
} else if (JSBI.notEqual(y, ZERO$1)) {
z = ONE$1;
}
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;
}
return z;
}

@@ -386,3 +362,3 @@

!!!kLast ? process.env.NODE_ENV !== "production" ? invariant(false, 'K_LAST') : invariant(false) : void 0;
var kLastParsed = parseBigintIsh(kLast);
var kLastParsed = JSBI.BigInt(kLast);

@@ -456,8 +432,10 @@ if (!JSBI.equal(kLastParsed, ZERO)) {

!(pairs.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'PAIRS') : invariant(false) : void 0;
var chainId = pairs[0].chainId;
!pairs.every(function (pair) {
return pair.chainId === pairs[0].chainId;
return pair.chainId === 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(WETH9[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(WETH9[pairs[0].chainId])) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT') : invariant(false) : void 0;
var path = [input instanceof Token ? input : WETH9[pairs[0].chainId]];
var weth = WETH9[chainId];
!(input instanceof Token && pairs[0].involvesToken(input) || input === ETHER && weth && pairs[0].involvesToken(weth)) ? 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 && weth && pairs[pairs.length - 1].involvesToken(weth)) ? process.env.NODE_ENV !== "production" ? invariant(false, 'OUTPUT') : invariant(false) : void 0;
var path = [input instanceof Token ? input : weth];

@@ -464,0 +442,0 @@ for (var _iterator = _createForOfIteratorHelperLoose(pairs.entries()), _step; !(_step = _iterator()).done;) {

{
"name": "@uniswap/v2-sdk",
"license": "MIT",
"version": "1.0.2",
"version": "1.0.3",
"description": "🛠 An SDK for building applications on top of Uniswap V2",

@@ -25,3 +25,3 @@ "main": "dist/index.js",

"dependencies": {
"@uniswap/sdk-core": "^1.0.7",
"@uniswap/sdk-core": "^1.0.8",
"tiny-invariant": "^1.1.0",

@@ -28,0 +28,0 @@ "tiny-warning": "^1.0.3"

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