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

@uniswap/v3-sdk

Package Overview
Dependencies
Maintainers
8
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniswap/v3-sdk - npm Package Compare versions

Comparing version 1.0.0-alpha.7 to 1.0.0-alpha.8

LICENSE

10

dist/constants.d.ts
export declare const FACTORY_ADDRESS = "0x1F98431c8aD98523631AE4a59f267346ea31F984";
export declare const SWAP_ROUTER_ADDRESS = "0x1F98431c8aD98523631AE4a59f267346ea31F984";
export declare const POOL_INIT_CODE_HASH = "0x01d4d358e07707f4db84b6a7527455b06f95ee89b5d059b4a1298ada7b6c7d67";
export declare const POOL_INIT_CODE_HASH = "0xa8180af292c6986c74fa300a542e049db8a89221e2452e431c3d8103b610c568";
/**
* The default factory enabled fee amounts, denominated in hundredths of bips.
*/
export declare enum FeeAmount {

@@ -9,6 +12,7 @@ LOW = 500,

}
/**
* The default factory tick spacings by fee amount.
*/
export declare const TICK_SPACINGS: {
[amount in FeeAmount]: number;
};
export declare function MIN_TICK(tickSpacing: number): number;
export declare function MAX_TICK(tickSpacing: number): number;

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

import { BigintIsh, Percent, Price, TokenAmount } from '@uniswap/sdk-core';
import { BigintIsh, Price, TokenAmount } from '@uniswap/sdk-core';
import JSBI from 'jsbi';

@@ -18,2 +18,4 @@ import { Pool } from './pool';

readonly liquidity: JSBI;
private _token0Amount;
private _token1Amount;
constructor({ pool, liquidity, tickLower, tickUpper }: PositionConstructorArgs);

@@ -37,3 +39,4 @@ /**

/**
* Returns the amount of token0 that this position's liquidity could be burned for at the current pool price
* Returns the amount of token0 that this position's liquidity could be burned for at the current pool price.
* To get the minimum amount that must be spent to mint the same amount of liquidity, add one.
*/

@@ -46,17 +49,2 @@ get amount0(): TokenAmount;

/**
* Compute the maximum amount of token0 that should be spent to produce the amount of liquidity in this position, given
* some tolerance of price movement
*/
maxAmount0(_slippageTolerance: Percent): TokenAmount;
/**
* Compute the maximum amount of token1 that should be spent to produce the amount of liquidity in this position, given
* some tolerance of price movement
*/
maxAmount1(_slippageTolerance: Percent): TokenAmount;
/**
* Returns a number representing the amount of capital required to produce this position relative to amount of capital
* required for a V2 position
*/
get capitalEfficiency(): number;
/**
* Computes the maximum amount of liquidity received for a given amount of token0, token1,

@@ -63,0 +51,0 @@ * and the prices at the tick boundaries.

import { BigintIsh } from '@uniswap/sdk-core';
import JSBI from 'jsbi';
export declare function maxLiquidityForAmount0(sqrtRatioAX96: JSBI, sqrtRatioBX96: JSBI, amount0: BigintIsh): JSBI;
export declare function maxLiquidityForAmount1(sqrtRatioAX96: JSBI, sqrtRatioBX96: JSBI, amount1: BigintIsh): JSBI;
/**

@@ -6,0 +4,0 @@ * Computes the maximum amount of liquidity received for a given amount of token0, token1,

@@ -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 e=require("@uniswap/sdk-core"),n=t(require("jsbi")),r=t(require("tiny-invariant")),i=require("@ethersproject/abi"),o=require("@ethersproject/address"),u=require("@ethersproject/solidity");function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),t}function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(){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(t){return!1}}function p(t,e,n){return(p=d()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function h(t){var e="function"==typeof Map?new Map:void 0;return(h=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return p(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,t)})(t)}function m(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function T(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function k(t){var e=t.factoryAddress,n=t.tokenA,r=t.tokenB,a=t.fee,s=n.sortsBefore(r)?[n,r]:[r,n];return o.getCreate2Address(e,u.keccak256(["bytes"],[i.defaultAbiCoder.encode(["address","address","uint24"],[s[0].address,s[1].address,a])]),U)}function v(t,r){var i=n.leftShift(n.BigInt(t),n.BigInt(192)),o=n.BigInt(r),u=n.divide(i,o);return e.sqrt(u)}var I=n.BigInt(-1),A=n.BigInt(0),x=n.BigInt(1),y=n.exponentiate(n.BigInt(2),n.BigInt(96)),q=n.exponentiate(y,n.BigInt(2));function b(t,e,r){if(n.greaterThan(t,e)){var i=[e,t];t=i[0],e=i[1]}var o=n.divide(n.multiply(t,e),y);return n.divide(n.multiply(n.BigInt(r),o),n.subtract(e,t))}function w(t,e,r){if(n.greaterThan(t,e)){var i=[e,t];t=i[0],e=i[1]}return n.divide(n.multiply(n.BigInt(r),y),n.subtract(e,t))}function R(t,e,r,i,o){if(n.greaterThan(e,r)){var u=[r,e];e=u[0],r=u[1]}if(n.lessThan(t,e))return b(e,r,i);if(n.lessThan(t,r)){var a=b(t,r,i),s=w(e,t,o);return n.lessThan(a,s)?a:s}return w(e,r,o)}var E=n.BigInt(2),S=[128,64,32,16,8,4,2,1].map((function(t){return[t,n.exponentiate(E,n.BigInt(t))]}));function O(t){n.greaterThan(t,A)||r(!1),n.lessThanOrEqual(t,e.MaxUint256)||r(!1);for(var i,o=0,u=T(S);!(i=u()).done;){var a=i.value,s=a[0];n.greaterThanOrEqual(t,a[1])&&(t=n.signedRightShift(t,n.BigInt(s)),o+=s)}return o}function P(t,e){return n.signedRightShift(n.multiply(t,n.BigInt(e)),n.BigInt(128))}var _=n.exponentiate(n.BigInt(2),n.BigInt(32)),N=function(){function t(){}return t.getSqrtRatioAtTick=function(i){i>=t.MIN_TICK&&i<=t.MAX_TICK&&Number.isInteger(i)||r(!1);var o=i<0?-1*i:i,u=n.BigInt(0!=(1&o)?"0xfffcb933bd6fad37aa2d162d1a594001":"0x100000000000000000000000000000000");return 0!=(2&o)&&(u=P(u,"0xfff97272373d413259a46990580e213a")),0!=(4&o)&&(u=P(u,"0xfff2e50f5f656932ef12357cf3c7fdcc")),0!=(8&o)&&(u=P(u,"0xffe5caca7e10e4e61c3624eaa0941cd0")),0!=(16&o)&&(u=P(u,"0xffcb9843d60f6159c9db58835c926644")),0!=(32&o)&&(u=P(u,"0xff973b41fa98c081472e6896dfb254c0")),0!=(64&o)&&(u=P(u,"0xff2ea16466c96a3843ec78b326b52861")),0!=(128&o)&&(u=P(u,"0xfe5dee046a99a2a811c461f1969c3053")),0!=(256&o)&&(u=P(u,"0xfcbe86c7900a88aedcffc83b479aa3a4")),0!=(512&o)&&(u=P(u,"0xf987a7253ac413176f2b074cf7815e54")),0!=(1024&o)&&(u=P(u,"0xf3392b0822b70005940c7a398e4b70f3")),0!=(2048&o)&&(u=P(u,"0xe7159475a2c29b7443b29c7fa6e889d9")),0!=(4096&o)&&(u=P(u,"0xd097f3bdfd2022b8845ad8f792aa5825")),0!=(8192&o)&&(u=P(u,"0xa9f746462d870fdf8a65dc1f90e061e5")),0!=(16384&o)&&(u=P(u,"0x70d869a156d2a1b890bb3df62baf32f7")),0!=(32768&o)&&(u=P(u,"0x31be135f97d08fd981231505542fcfa6")),0!=(65536&o)&&(u=P(u,"0x9aa508b5b7a84e1c677de54f3e99bc9")),0!=(131072&o)&&(u=P(u,"0x5d6af8dedb81196699c329225ee604")),0!=(262144&o)&&(u=P(u,"0x2216e584f5fa1ea926041bedfe98")),0!=(524288&o)&&(u=P(u,"0x48a170391f7dc42444e8fa2")),i>0&&(u=n.divide(e.MaxUint256,u)),n.greaterThan(n.remainder(u,_),A)?n.add(n.divide(u,_),x):n.divide(u,_)},t.getTickAtSqrtRatio=function(e){n.greaterThanOrEqual(e,t.MIN_SQRT_RATIO)&&n.lessThan(e,t.MAX_SQRT_RATIO)||r(!1);var i,o=n.leftShift(e,n.BigInt(32)),u=O(o);i=n.greaterThanOrEqual(n.BigInt(u),n.BigInt(128))?n.signedRightShift(o,n.BigInt(u-127)):n.leftShift(o,n.BigInt(127-u));for(var a=n.leftShift(n.subtract(n.BigInt(u),n.BigInt(128)),n.BigInt(64)),s=0;s<14;s++){i=n.signedRightShift(n.multiply(i,i),n.BigInt(127));var c=n.signedRightShift(i,n.BigInt(128));a=n.bitwiseOr(a,n.leftShift(c,n.BigInt(63-s))),i=n.signedRightShift(i,c)}var f=n.multiply(a,n.BigInt("255738958999603826347141")),l=n.toNumber(n.signedRightShift(n.subtract(f,n.BigInt("3402992956809132418596140100660247210")),n.BigInt(128))),d=n.toNumber(n.signedRightShift(n.add(f,n.BigInt("291339464771989622907027621153398088495")),n.BigInt(128)));return l===d?l:n.lessThanOrEqual(t.getSqrtRatioAtTick(d),e)?d:l},t}();function B(t,r,i){var o=N.getSqrtRatioAtTick(i),u=n.multiply(o,o);return t.sortsBefore(r)?new e.Price(t,r,q,u):new e.Price(t,r,u,q)}function C(t){return"0x"+t.raw.toString(16)}N.MIN_TICK=-887272,N.MAX_TICK=-N.MIN_TICK,N.MIN_SQRT_RATIO=n.BigInt("4295128739"),N.MAX_SQRT_RATIO=n.BigInt("1461446703485210103287273052203988822378723970342");var X,M,U="0x01d4d358e07707f4db84b6a7527455b06f95ee89b5d059b4a1298ada7b6c7d67";(M=exports.FeeAmount||(exports.FeeAmount={}))[M.LOW=500]="LOW",M[M.MEDIUM=3e3]="MEDIUM",M[M.HIGH=1e4]="HIGH";var F=((X={})[exports.FeeAmount.LOW]=10,X[exports.FeeAmount.MEDIUM]=60,X[exports.FeeAmount.HIGH]=200,X),D=function(){function t(){}return t.addDelta=function(t,e){return n.lessThan(e,A)?n.subtract(t,n.multiply(e,I)):n.add(t,e)},t}(),H=function(){function t(){}return t.mulDivRoundingUp=function(t,e,r){var i=n.multiply(t,e),o=n.divide(i,r);return n.notEqual(n.remainder(i,r),A)&&(o=n.add(o,x)),o},t}(),L=n.subtract(n.exponentiate(n.BigInt(2),n.BigInt(160)),x);function K(t,r){var i=n.multiply(t,r);return n.bitwiseAnd(i,e.MaxUint256)}var j=function(){function t(){}return t.getAmount0Delta=function(t,e,r,i){if(n.greaterThan(t,e)){var o=[e,t];t=o[0],e=o[1]}var u=n.leftShift(r,n.BigInt(96)),a=n.subtract(e,t);return i?H.mulDivRoundingUp(H.mulDivRoundingUp(u,a,e),x,t):n.divide(n.divide(n.multiply(u,a),e),t)},t.getAmount1Delta=function(t,e,r,i){if(n.greaterThan(t,e)){var o=[e,t];t=o[0],e=o[1]}return i?H.mulDivRoundingUp(r,n.subtract(e,t),y):n.divide(n.multiply(r,n.subtract(e,t)),y)},t.getNextSqrtPriceFromInput=function(t,e,i,o){return n.greaterThan(t,A)||r(!1),n.greaterThan(e,A)||r(!1),o?this.getNextSqrtPriceFromAmount0RoundingUp(t,e,i,!0):this.getNextSqrtPriceFromAmount1RoundingDown(t,e,i,!0)},t.getNextSqrtPriceFromOutput=function(t,e,i,o){return n.greaterThan(t,A)||r(!1),n.greaterThan(e,A)||r(!1),o?this.getNextSqrtPriceFromAmount1RoundingDown(t,e,i,!1):this.getNextSqrtPriceFromAmount0RoundingUp(t,e,i,!1)},t.getNextSqrtPriceFromAmount0RoundingUp=function(t,i,o,u){if(n.equal(o,A))return t;var a=n.leftShift(i,n.BigInt(96));if(u){var s=K(o,t);if(n.equal(n.divide(s,o),t)){var c=(l=n.add(a,s),n.bitwiseAnd(l,e.MaxUint256));if(n.greaterThanOrEqual(c,a))return H.mulDivRoundingUp(a,t,c)}return H.mulDivRoundingUp(a,x,n.add(n.divide(a,t),o))}var f=K(o,t);n.equal(n.divide(f,o),t)||r(!1),n.greaterThan(a,f)||r(!1);var l,d=n.subtract(a,f);return H.mulDivRoundingUp(a,t,d)},t.getNextSqrtPriceFromAmount1RoundingDown=function(t,e,i,o){if(o){var u=n.lessThanOrEqual(i,L)?n.divide(n.leftShift(i,n.BigInt(96)),e):n.divide(n.multiply(i,y),e);return n.add(t,u)}var a=H.mulDivRoundingUp(i,y,e);return n.greaterThan(t,a)||r(!1),n.subtract(t,a)},t}(),W=n.exponentiate(n.BigInt(10),n.BigInt(6)),G=function(){function t(){}return t.computeSwapStep=function(t,e,r,i,o){var u={},a=n.greaterThanOrEqual(t,e),s=n.greaterThanOrEqual(i,A);if(s){var c=n.divide(n.multiply(i,n.subtract(W,n.BigInt(o))),W);u.amountIn=a?j.getAmount0Delta(e,t,r,!0):j.getAmount1Delta(t,e,r,!0),u.sqrtRatioNextX96=n.greaterThanOrEqual(c,u.amountIn)?e:j.getNextSqrtPriceFromInput(t,r,c,a)}else u.amountOut=a?j.getAmount1Delta(e,t,r,!1):j.getAmount0Delta(t,e,r,!1),u.sqrtRatioNextX96=n.greaterThanOrEqual(n.multiply(i,I),u.amountOut)?e:j.getNextSqrtPriceFromOutput(t,r,n.multiply(i,I),a);var f=n.equal(e,u.sqrtRatioNextX96);return a?(u.amountIn=f&&s?u.amountIn:j.getAmount0Delta(u.sqrtRatioNextX96,t,r,!0),u.amountOut=f&&!s?u.amountOut:j.getAmount1Delta(u.sqrtRatioNextX96,t,r,!1)):(u.amountIn=f&&s?u.amountIn:j.getAmount1Delta(t,u.sqrtRatioNextX96,r,!0),u.amountOut=f&&!s?u.amountOut:j.getAmount0Delta(t,u.sqrtRatioNextX96,r,!1)),!s&&n.greaterThan(u.amountOut,n.multiply(i,I))&&(u.amountOut=n.multiply(i,I)),u.feeAmount=s&&n.notEqual(u.sqrtRatioNextX96,e)?n.subtract(i,u.amountIn):H.mulDivRoundingUp(u.amountIn,n.BigInt(o),n.subtract(W,n.BigInt(o))),[u.sqrtRatioNextX96,u.amountIn,u.amountOut,u.feeAmount]},t}(),Q=function(){function t(t,e,i,o,u,a,s){Number.isInteger(i)&&i<1e6||r(!1);var c=N.getSqrtRatioAtTick(a),f=N.getSqrtRatioAtTick(a+1);n.greaterThanOrEqual(n.BigInt(o),c)&&n.lessThanOrEqual(n.BigInt(o),f)||r(!1);var l=t.sortsBefore(e)?[t,e]:[e,t];this.token0=l[0],this.token1=l[1],this.fee=i,this.sqrtRatioX96=n.BigInt(o),this.liquidity=n.BigInt(u),this.tickCurrent=a,this.ticks=s}t.getAddress=function(t,e,n){return k({factoryAddress:"0x1F98431c8aD98523631AE4a59f267346ea31F984",fee:n,tokenA:t,tokenB:e})};var i=t.prototype;return i.involvesToken=function(t){return t.equals(this.token0)||t.equals(this.token1)},i.priceOf=function(t){return this.involvesToken(t)||r(!1),t.equals(this.token0)?this.token0Price:this.token1Price},i.getOutputAmount=function(i){this.involvesToken(i.token)||r(!1);var o=i.token.equals(this.token0),u=this.swap(o,i.raw),a=u.sqrtRatioX96,s=u.liquidity,c=u.tickCurrent;return[new e.TokenAmount(o?this.token1:this.token0,n.multiply(u.amountCalculated,I)),new t(this.token0,this.token1,this.fee,a,s,c,this.ticks)]},i.getInputAmount=function(i){this.involvesToken(i.token)||r(!1);var o=i.token.equals(this.token1),u=this.swap(o,n.multiply(i.raw,I)),a=u.sqrtRatioX96,s=u.liquidity,c=u.tickCurrent;return[new e.TokenAmount(o?this.token0:this.token1,u.amountCalculated),new t(this.token0,this.token1,this.fee,a,s,c,this.ticks)]},i.swap=function(t,e,i){n.notEqual(e,A)||r(!1),i||(i=t?n.add(N.MIN_SQRT_RATIO,x):n.subtract(N.MAX_SQRT_RATIO,x)),t?(n.greaterThan(i,N.MIN_SQRT_RATIO)||r(!1),n.lessThan(i,this.sqrtRatioX96)||r(!1)):(n.lessThan(i,N.MAX_SQRT_RATIO)||r(!1),n.greaterThan(i,this.sqrtRatioX96)||r(!1));for(var o=n.greaterThan(e,A),u={amountSpecifiedRemaining:e,amountCalculated:A,sqrtPriceX96:this.sqrtRatioX96,tick:this.tickCurrent,liquidity:this.liquidity};n.notEqual(u.amountSpecifiedRemaining,A)&&u.sqrtPriceX96!=i;){var a={};a.sqrtPriceStartX96=u.sqrtPriceX96;var s=this.ticks.nextInitializedTickWithinOneWord(u.tick,t);a.tickNext=s[0],a.initialized=s[1],a.tickNext<N.MIN_TICK?a.tickNext=N.MIN_TICK:a.tickNext>N.MAX_TICK&&(a.tickNext=N.MAX_TICK),a.sqrtPriceNextX96=N.getSqrtRatioAtTick(a.tickNext);var c=G.computeSwapStep(u.sqrtPriceX96,(t?n.lessThan(a.sqrtPriceNextX96,i):n.greaterThan(a.sqrtPriceNextX96,i))?i:a.sqrtPriceNextX96,u.liquidity,u.amountSpecifiedRemaining,this.fee);if(u.sqrtPriceX96=c[0],a.amountIn=c[1],a.amountOut=c[2],a.feeAmount=c[3],o?(u.amountSpecifiedRemaining=n.subtract(u.amountSpecifiedRemaining,n.add(a.amountIn,a.feeAmount)),u.amountCalculated=n.subtract(u.amountCalculated,a.amountOut)):(u.amountSpecifiedRemaining=n.add(u.amountSpecifiedRemaining,a.amountOut),u.amountCalculated=n.add(u.amountCalculated,n.add(a.amountIn,a.feeAmount))),n.equal(u.sqrtPriceX96,a.sqrtPriceNextX96)){if(a.initialized){var f=this.ticks.getTick(a.tickNext).liquidityNet;t&&(f=n.multiply(f,I)),u.liquidity=D.addDelta(u.liquidity,f)}u.tick=t?a.tickNext-1:a.tickNext}else u.sqrtPriceX96!=a.sqrtPriceStartX96&&(u.tick=N.getTickAtSqrtRatio(u.sqrtPriceX96))}return{amountCalculated:u.amountCalculated,sqrtRatioX96:u.sqrtPriceX96,liquidity:u.liquidity,tickCurrent:u.tick}},s(t,[{key:"token0Price",get:function(){var t;return null!=(t=this._token0Price)?t:this._token0Price=new e.Price(this.token0,this.token1,q,n.multiply(this.sqrtRatioX96,this.sqrtRatioX96))}},{key:"token1Price",get:function(){var t;return null!=(t=this._token1Price)?t:this._token1Price=new e.Price(this.token1,this.token0,n.multiply(this.sqrtRatioX96,this.sqrtRatioX96),q)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"tickSpacing",get:function(){return F[this.fee]}}]),t}(),z=function(){function t(t){var e=t.pool,i=t.liquidity,o=t.tickLower,u=t.tickUpper;o<u||r(!1),o>=N.MIN_TICK&&o%e.tickSpacing==0||r(!1),u<=N.MAX_TICK&&u%e.tickSpacing==0||r(!1),this.pool=e,this.tickLower=o,this.tickUpper=u,this.liquidity=n.BigInt(i)}var i=t.prototype;return i.maxAmount0=function(t){throw new Error("todo")},i.maxAmount1=function(t){throw new Error("todo")},t.fromAmounts=function(e){var n=e.pool,r=e.tickLower,i=e.tickUpper,o=e.amount0,u=e.amount1,a=N.getSqrtRatioAtTick(r),s=N.getSqrtRatioAtTick(i);return new t({pool:n,tickLower:r,tickUpper:i,liquidity:R(n.sqrtRatioX96,a,s,o,u)})},t.fromAmount0=function(n){return t.fromAmounts({pool:n.pool,tickLower:n.tickLower,tickUpper:n.tickUpper,amount0:n.amount0,amount1:e.MaxUint256})},t.fromAmount1=function(n){return t.fromAmounts({pool:n.pool,tickLower:n.tickLower,tickUpper:n.tickUpper,amount0:e.MaxUint256,amount1:n.amount1})},s(t,[{key:"token0PriceLower",get:function(){return B(this.pool.token0,this.pool.token1,this.tickLower)}},{key:"token1PriceLower",get:function(){return B(this.pool.token1,this.pool.token0,this.tickLower)}},{key:"token0PriceUpper",get:function(){return B(this.pool.token0,this.pool.token1,this.tickUpper)}},{key:"token1PriceUpper",get:function(){return B(this.pool.token1,this.pool.token0,this.tickUpper)}},{key:"amount0",get:function(){throw new Error("todo")}},{key:"amount1",get:function(){throw new Error("todo")}},{key:"capitalEfficiency",get:function(){throw new Error("todo")}}]),t}(),Y=function(){function t(t,n,i){t.length>0||r(!1);var o=t[0].chainId;t.every((function(t){return t.chainId===o}))||r(!1);var u=e.WETH9[o],a=n instanceof e.Token&&t[0].involvesToken(n),s=n===e.ETHER&&u&&t[0].involvesToken(u);a||s||r(!1);var c=void 0===i,f=i instanceof e.Token&&t[t.length-1].involvesToken(i),l=i===e.ETHER&&u&&t[t.length-1].involvesToken(u);c||f||l||r(!1);for(var d,p=[n instanceof e.Token?n:u],h=T(t.entries());!(d=h()).done;){var m=d.value,g=m[1],k=p[m[0]];k.equals(g.token0)||k.equals(g.token1)||r(!1);var v=k.equals(g.token0)?g.token1:g.token0;p.push(v)}this.pools=t,this.tokenPath=p,this.input=n,this.output=null!=i?i:p[p.length-1]}return s(t,[{key:"chainId",get:function(){return this.pools[0].chainId}}]),t}(),Z=function(){function t(t,e){void 0===e&&(e=1),t.length>=2||r(!1),t.every((function(t){return t.index%e==0}))||r(!1),n.equal(t.reduce((function(t,e){return n.add(t,e.liquidityNet)}),A),A)||r(!1),this.tickSpacing=e,this.ticks=t.slice().sort((function(t,e){return t.index<e.index?-1:1}))}var e=t.prototype;return e.isBelowSmallest=function(t){return t<this.ticks[0].index},e.isAtOrAboveLargest=function(t){return t>=this.ticks[this.ticks.length-1].index},e.getTick=function(t){var e=this.ticks[this.binarySearch(t)];return e.index!==t&&r(!1),e},e.binarySearch=function(t){this.isBelowSmallest(t)&&r(!1),this.isAtOrAboveLargest(t)&&r(!1);for(var e,n=0,i=this.ticks.length-1;;){if(e=Math.floor((n+i)/2),this.ticks[e].index<=t&&this.ticks[e+1].index>t)return e;this.ticks[e].index<t?n=e+1:i=e-1}},e.nextInitializedTick=function(t,e){if(e){if(this.isBelowSmallest(t)&&r(!1),this.isAtOrAboveLargest(t))return this.ticks[this.ticks.length-1];var n=this.binarySearch(t);return this.ticks[n]}if(this.isAtOrAboveLargest(t)&&r(!1),this.isBelowSmallest(t))return this.ticks[0];var i=this.binarySearch(t);return this.ticks[i+1]},e.nextInitializedTickWithinOneWord=function(t,e){var n=Math.floor(t/this.tickSpacing);if(e){var r=(n>>8<<8)*this.tickSpacing;if(this.isBelowSmallest(t))return[r,!1];var i=this.nextInitializedTick(t,e).index,o=Math.max(r,i);return[o,o===i]}var u=(1+(n+1>>8)<<8)*this.tickSpacing-1;if(this.isAtOrAboveLargest(t))return[u,!1];var a=this.nextInitializedTick(t,e).index,s=Math.min(u,a);return[s,s===a]},t}();function $(t,n){return e.currencyEquals(t.inputAmount.currency,n.inputAmount.currency)||r(!1),e.currencyEquals(t.outputAmount.currency,n.outputAmount.currency)||r(!1),t.outputAmount.equalTo(n.outputAmount)?t.inputAmount.equalTo(n.inputAmount)?0:t.inputAmount.lessThan(n.inputAmount)?-1:1:t.outputAmount.lessThan(n.outputAmount)?1:-1}function J(t,e){var n=$(t,e);return 0!==n?n:t.priceImpact.lessThan(e.priceImpact)?-1:t.priceImpact.greaterThan(e.priceImpact)?1:t.route.tokenPath.length-e.route.tokenPath.length}function V(t,n){return t instanceof e.TokenAmount?t:t.currency===e.ETHER?new e.TokenAmount(e.WETH9[n],t.raw):void r(!1)}function tt(t,n){return t instanceof e.Token?t:t===e.ETHER?e.WETH9[n]:void r(!1)}var et=function(){function t(t,n,i){var o,u,a,s=new Array(t.tokenPath.length),c=new Array(t.pools.length);if(i===e.TradeType.EXACT_INPUT){e.currencyEquals(n.currency,t.input)||r(!1),s[0]=V(n,t.chainId);for(var f=0;f<t.tokenPath.length-1;f++){var l=t.pools[f].getOutputAmount(s[f]),d=l[1];s[f+1]=l[0],c[f]=d}}else{e.currencyEquals(n.currency,t.output)||r(!1),s[s.length-1]=V(n,t.chainId);for(var p=t.tokenPath.length-1;p>0;p--){var h=t.pools[p-1].getInputAmount(s[p]),m=h[1];s[p-1]=h[0],c[p-1]=m}}this.route=t,this.tradeType=i,this.inputAmount=i===e.TradeType.EXACT_INPUT?n:t.input===e.ETHER?e.CurrencyAmount.ether(s[0].raw):s[0],this.outputAmount=i===e.TradeType.EXACT_OUTPUT?n:t.output===e.ETHER?e.CurrencyAmount.ether(s[s.length-1].raw):s[s.length-1],this.executionPrice=new e.Price(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.priceImpact=(o=this.outputAmount,a=(u=this.executionPrice.raw.multiply(this.inputAmount.raw)).subtract(o.raw).divide(u),new e.Percent(a.numerator,a.denominator))}t.exactIn=function(n,r){return new t(n,r,e.TradeType.EXACT_INPUT)},t.exactOut=function(n,r){return new t(n,r,e.TradeType.EXACT_OUTPUT)};var n=t.prototype;return n.minimumAmountOut=function(t){if(t.lessThan(A)&&r(!1),this.tradeType===e.TradeType.EXACT_OUTPUT)return this.outputAmount;var n=new e.Fraction(x).add(t).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof e.TokenAmount?new e.TokenAmount(this.outputAmount.token,n):e.CurrencyAmount.ether(n)},n.maximumAmountIn=function(t){if(t.lessThan(A)&&r(!1),this.tradeType===e.TradeType.EXACT_INPUT)return this.inputAmount;var n=new e.Fraction(x).add(t).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof e.TokenAmount?new e.TokenAmount(this.inputAmount.token,n):e.CurrencyAmount.ether(n)},t.bestTradeExactIn=function(n,i,o,u,a,s,c){var f=void 0===u?{}:u,l=f.maxNumResults,d=void 0===l?3:l,p=f.maxHops,h=void 0===p?3:p;void 0===a&&(a=[]),void 0===s&&(s=i),void 0===c&&(c=[]),n.length>0||r(!1),h>0||r(!1),s===i||a.length>0||r(!1);var m=i instanceof e.TokenAmount?i.token.chainId:o instanceof e.Token?o.chainId:void 0;void 0===m&&r(!1);for(var g=V(i,m),T=tt(o,m),k=0;k<n.length;k++){var v=n[k];if(v.token0.equals(g.token)||v.token1.equals(g.token)){var I=void 0;try{I=v.getOutputAmount(g)[0]}catch(t){if(t.isInsufficientInputAmountError)continue;throw t}if(I.token.equals(T))e.sortedInsert(c,new t(new Y([].concat(a,[v]),s.currency,o),s,e.TradeType.EXACT_INPUT),d,J);else if(h>1&&n.length>1){var A=n.slice(0,k).concat(n.slice(k+1,n.length));t.bestTradeExactIn(A,I,o,{maxNumResults:d,maxHops:h-1},[].concat(a,[v]),s,c)}}}return c},t.bestTradeExactOut=function(n,i,o,u,a,s,c){var f=void 0===u?{}:u,l=f.maxNumResults,d=void 0===l?3:l,p=f.maxHops,h=void 0===p?3:p;void 0===a&&(a=[]),void 0===s&&(s=o),void 0===c&&(c=[]),n.length>0||r(!1),h>0||r(!1),s===o||a.length>0||r(!1);var m=o instanceof e.TokenAmount?o.token.chainId:i instanceof e.Token?i.chainId:void 0;void 0===m&&r(!1);for(var g=V(o,m),T=tt(i,m),k=0;k<n.length;k++){var v=n[k];if(v.token0.equals(g.token)||v.token1.equals(g.token)){var I=void 0;try{I=v.getInputAmount(g)[0]}catch(t){if(t.isInsufficientReservesError)continue;throw t}if(I.token.equals(T))e.sortedInsert(c,new t(new Y([v].concat(a),i,s.currency),s,e.TradeType.EXACT_OUTPUT),d,J);else if(h>1&&n.length>1){var A=n.slice(0,k).concat(n.slice(k+1,n.length));t.bestTradeExactOut(A,i,I,{maxNumResults:d,maxHops:h-1},[v].concat(a),s,c)}}}return c},t}(),nt="setPrototypeOf"in Object,rt=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,nt&&Object.setPrototypeOf(m(n),(this instanceof e?this.constructor:void 0).prototype),n}return c(e,t),e}(h(Error)),it=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,nt&&Object.setPrototypeOf(m(n),(this instanceof e?this.constructor:void 0).prototype),n}return c(e,t),e}(h(Error)),ot=function(){function t(){}return t.mintCallParameters=function(t,e){r(!1)},t}(),ut=function(){function t(){}return t.swapCallParameters=function(t,n){var i=t.inputAmount.currency===e.ETHER,o=t.outputAmount.currency===e.ETHER;i&&o&&r(!1);var u,a,s,c=e.validateAndParseAddress(n.recipient),f=C(t.maximumAmountIn(n.allowedSlippage)),l=C(t.minimumAmountOut(n.allowedSlippage)),d=t.route.tokenPath.map((function(t){return t.address})),p="0x"+n.deadline.toString(16),h=Boolean(n.feeOnTransfer);switch(t.tradeType){case e.TradeType.EXACT_INPUT:i?(u=h?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",a=[l,d,c,p],s=f):o?(u=h?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",a=[f,l,d,c,p],s="0x0"):(u=h?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",a=[f,l,d,c,p],s="0x0");break;case e.TradeType.EXACT_OUTPUT:h&&r(!1),i?(u="swapETHForExactTokens",a=[l,d,c,p],s=f):o?(u="swapTokensForExactETH",a=[l,f,d,c,p],s="0x0"):(u="swapTokensForExactTokens",a=[l,f,d,c,p],s="0x0");break;default:throw new Error("invalid trade type")}return{methodName:u,args:a,value:s,address:"0x1F98431c8aD98523631AE4a59f267346ea31F984"}},t}();exports.FACTORY_ADDRESS="0x1F98431c8aD98523631AE4a59f267346ea31F984",exports.InsufficientInputAmountError=it,exports.InsufficientReservesError=rt,exports.MAX_TICK=function(t){return Math.floor(N.MAX_TICK/t)*t},exports.MIN_TICK=function(t){return Math.ceil(N.MIN_TICK/t)*t},exports.NonfungiblePositionManager=ot,exports.POOL_INIT_CODE_HASH=U,exports.Pool=Q,exports.Position=z,exports.Route=Y,exports.SWAP_ROUTER_ADDRESS="0x1F98431c8aD98523631AE4a59f267346ea31F984",exports.SwapRouter=ut,exports.TICK_SPACINGS=F,exports.Tick=function(t){var e=t.index,i=t.feeGrowthOutside0X128,o=t.feeGrowthOutside1X128,u=t.liquidityGross,a=t.liquidityNet;e>=N.MIN_TICK&&e<=N.MAX_TICK||r(!1),this.index=e,i&&(this.feeGrowthOutside0X128=n.BigInt(i)),o&&(this.feeGrowthOutside1X128=n.BigInt(o)),this.liquidityGross=n.BigInt(u),this.liquidityNet=n.BigInt(a)},exports.TickList=Z,exports.TickMath=N,exports.Trade=et,exports.ZERO_HEX="0x0",exports.computePoolAddress=k,exports.encodeSqrtRatioX96=v,exports.inputOutputComparator=$,exports.maxLiquidityForAmount0=b,exports.maxLiquidityForAmount1=w,exports.maxLiquidityForAmounts=R,exports.mostSignificantBit=O,exports.nearestUsableTick=function(t,e){Number.isInteger(t)&&Number.isInteger(e)||r(!1),e>0||r(!1),t>=N.MIN_TICK&&t<=N.MAX_TICK||r(!1);var n=Math.round(t/e)*e;return n<N.MIN_TICK?n+e:n>N.MAX_TICK?n-e:n},exports.priceToClosestTick=function(t){t.baseCurrency instanceof e.Token&&t.quoteCurrency instanceof e.Token||r(!1);var n=t.baseCurrency.sortsBefore(t.quoteCurrency),i=n?v(t.raw.numerator,t.raw.denominator):v(t.raw.denominator,t.raw.numerator),o=N.getTickAtSqrtRatio(i),u=B(t.baseCurrency,t.quoteCurrency,o+1);return n?t.lessThan(u)||o++:t.greaterThan(u)||o++,o},exports.tickToPrice=B,exports.toHex=C,exports.tradeComparator=J;
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require("@uniswap/sdk-core"),i=t(require("jsbi")),r=t(require("tiny-invariant")),o=require("@ethersproject/abi"),u=require("@ethersproject/address"),a=require("@ethersproject/solidity");function s(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function c(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(){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(t){return!1}}function d(t,e,n){return(d=h()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&p(r,n.prototype),r}).apply(null,arguments)}function m(t){var e="function"==typeof Map?new Map:void 0;return(m=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return d(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,t)})(t)}function k(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function T(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}var v,A="0xa8180af292c6986c74fa300a542e049db8a89221e2452e431c3d8103b610c568";(v=exports.FeeAmount||(exports.FeeAmount={}))[v.LOW=500]="LOW",v[v.MEDIUM=3e3]="MEDIUM",v[v.HIGH=1e4]="HIGH";var I=((e={})[exports.FeeAmount.LOW]=10,e[exports.FeeAmount.MEDIUM]=60,e[exports.FeeAmount.HIGH]=200,e),y=i.BigInt(-1),x=i.BigInt(0),q=i.BigInt(1),b=i.exponentiate(i.BigInt(2),i.BigInt(96)),R=i.exponentiate(b,i.BigInt(2));function w(t){var e=t.factoryAddress,n=t.tokenA,i=t.tokenB,r=t.fee,s=n.sortsBefore(i)?[n,i]:[i,n];return u.getCreate2Address(e,a.keccak256(["bytes"],[o.defaultAbiCoder.encode(["address","address","uint24"],[s[0].address,s[1].address,r])]),A)}var S=function(){function t(){}return t.addDelta=function(t,e){return i.lessThan(e,x)?i.subtract(t,i.multiply(e,y)):i.add(t,e)},t}(),O=function(){function t(){}return t.mulDivRoundingUp=function(t,e,n){var r=i.multiply(t,e),o=i.divide(r,n);return i.notEqual(i.remainder(r,n),x)&&(o=i.add(o,q)),o},t}(),E=i.subtract(i.exponentiate(i.BigInt(2),i.BigInt(160)),q);function P(t,e){var r=i.multiply(t,e);return i.bitwiseAnd(r,n.MaxUint256)}var _=function(){function t(){}return t.getAmount0Delta=function(t,e,n,r){if(i.greaterThan(t,e)){var o=[e,t];t=o[0],e=o[1]}var u=i.leftShift(n,i.BigInt(96)),a=i.subtract(e,t);return r?O.mulDivRoundingUp(O.mulDivRoundingUp(u,a,e),q,t):i.divide(i.divide(i.multiply(u,a),e),t)},t.getAmount1Delta=function(t,e,n,r){if(i.greaterThan(t,e)){var o=[e,t];t=o[0],e=o[1]}return r?O.mulDivRoundingUp(n,i.subtract(e,t),b):i.divide(i.multiply(n,i.subtract(e,t)),b)},t.getNextSqrtPriceFromInput=function(t,e,n,o){return i.greaterThan(t,x)||r(!1),i.greaterThan(e,x)||r(!1),o?this.getNextSqrtPriceFromAmount0RoundingUp(t,e,n,!0):this.getNextSqrtPriceFromAmount1RoundingDown(t,e,n,!0)},t.getNextSqrtPriceFromOutput=function(t,e,n,o){return i.greaterThan(t,x)||r(!1),i.greaterThan(e,x)||r(!1),o?this.getNextSqrtPriceFromAmount1RoundingDown(t,e,n,!1):this.getNextSqrtPriceFromAmount0RoundingUp(t,e,n,!1)},t.getNextSqrtPriceFromAmount0RoundingUp=function(t,e,o,u){if(i.equal(o,x))return t;var a=i.leftShift(e,i.BigInt(96));if(u){var s=P(o,t);if(i.equal(i.divide(s,o),t)){var c=(f=i.add(a,s),i.bitwiseAnd(f,n.MaxUint256));if(i.greaterThanOrEqual(c,a))return O.mulDivRoundingUp(a,t,c)}return O.mulDivRoundingUp(a,q,i.add(i.divide(a,t),o))}var l=P(o,t);i.equal(i.divide(l,o),t)||r(!1),i.greaterThan(a,l)||r(!1);var f,p=i.subtract(a,l);return O.mulDivRoundingUp(a,t,p)},t.getNextSqrtPriceFromAmount1RoundingDown=function(t,e,n,o){if(o){var u=i.lessThanOrEqual(n,E)?i.divide(i.leftShift(n,i.BigInt(96)),e):i.divide(i.multiply(n,b),e);return i.add(t,u)}var a=O.mulDivRoundingUp(n,b,e);return i.greaterThan(t,a)||r(!1),i.subtract(t,a)},t}(),N=i.exponentiate(i.BigInt(10),i.BigInt(6)),B=function(){function t(){}return t.computeSwapStep=function(t,e,n,r,o){var u={},a=i.greaterThanOrEqual(t,e),s=i.greaterThanOrEqual(r,x);if(s){var c=i.divide(i.multiply(r,i.subtract(N,i.BigInt(o))),N);u.amountIn=a?_.getAmount0Delta(e,t,n,!0):_.getAmount1Delta(t,e,n,!0),u.sqrtRatioNextX96=i.greaterThanOrEqual(c,u.amountIn)?e:_.getNextSqrtPriceFromInput(t,n,c,a)}else u.amountOut=a?_.getAmount1Delta(e,t,n,!1):_.getAmount0Delta(t,e,n,!1),u.sqrtRatioNextX96=i.greaterThanOrEqual(i.multiply(r,y),u.amountOut)?e:_.getNextSqrtPriceFromOutput(t,n,i.multiply(r,y),a);var l=i.equal(e,u.sqrtRatioNextX96);return a?(u.amountIn=l&&s?u.amountIn:_.getAmount0Delta(u.sqrtRatioNextX96,t,n,!0),u.amountOut=l&&!s?u.amountOut:_.getAmount1Delta(u.sqrtRatioNextX96,t,n,!1)):(u.amountIn=l&&s?u.amountIn:_.getAmount1Delta(t,u.sqrtRatioNextX96,n,!0),u.amountOut=l&&!s?u.amountOut:_.getAmount0Delta(t,u.sqrtRatioNextX96,n,!1)),!s&&i.greaterThan(u.amountOut,i.multiply(r,y))&&(u.amountOut=i.multiply(r,y)),u.feeAmount=s&&i.notEqual(u.sqrtRatioNextX96,e)?i.subtract(r,u.amountIn):O.mulDivRoundingUp(u.amountIn,i.BigInt(o),i.subtract(N,i.BigInt(o))),[u.sqrtRatioNextX96,u.amountIn,u.amountOut,u.feeAmount]},t}(),C=i.BigInt(2),X=[128,64,32,16,8,4,2,1].map((function(t){return[t,i.exponentiate(C,i.BigInt(t))]}));function U(t){i.greaterThan(t,x)||r(!1),i.lessThanOrEqual(t,n.MaxUint256)||r(!1);for(var e,o=0,u=T(X);!(e=u()).done;){var a=e.value,s=a[0];i.greaterThanOrEqual(t,a[1])&&(t=i.signedRightShift(t,i.BigInt(s)),o+=s)}return o}function M(t,e){return i.signedRightShift(i.multiply(t,i.BigInt(e)),i.BigInt(128))}var D=i.exponentiate(i.BigInt(2),i.BigInt(32)),F=function(){function t(){}return t.getSqrtRatioAtTick=function(e){e>=t.MIN_TICK&&e<=t.MAX_TICK&&Number.isInteger(e)||r(!1);var o=e<0?-1*e:e,u=i.BigInt(0!=(1&o)?"0xfffcb933bd6fad37aa2d162d1a594001":"0x100000000000000000000000000000000");return 0!=(2&o)&&(u=M(u,"0xfff97272373d413259a46990580e213a")),0!=(4&o)&&(u=M(u,"0xfff2e50f5f656932ef12357cf3c7fdcc")),0!=(8&o)&&(u=M(u,"0xffe5caca7e10e4e61c3624eaa0941cd0")),0!=(16&o)&&(u=M(u,"0xffcb9843d60f6159c9db58835c926644")),0!=(32&o)&&(u=M(u,"0xff973b41fa98c081472e6896dfb254c0")),0!=(64&o)&&(u=M(u,"0xff2ea16466c96a3843ec78b326b52861")),0!=(128&o)&&(u=M(u,"0xfe5dee046a99a2a811c461f1969c3053")),0!=(256&o)&&(u=M(u,"0xfcbe86c7900a88aedcffc83b479aa3a4")),0!=(512&o)&&(u=M(u,"0xf987a7253ac413176f2b074cf7815e54")),0!=(1024&o)&&(u=M(u,"0xf3392b0822b70005940c7a398e4b70f3")),0!=(2048&o)&&(u=M(u,"0xe7159475a2c29b7443b29c7fa6e889d9")),0!=(4096&o)&&(u=M(u,"0xd097f3bdfd2022b8845ad8f792aa5825")),0!=(8192&o)&&(u=M(u,"0xa9f746462d870fdf8a65dc1f90e061e5")),0!=(16384&o)&&(u=M(u,"0x70d869a156d2a1b890bb3df62baf32f7")),0!=(32768&o)&&(u=M(u,"0x31be135f97d08fd981231505542fcfa6")),0!=(65536&o)&&(u=M(u,"0x9aa508b5b7a84e1c677de54f3e99bc9")),0!=(131072&o)&&(u=M(u,"0x5d6af8dedb81196699c329225ee604")),0!=(262144&o)&&(u=M(u,"0x2216e584f5fa1ea926041bedfe98")),0!=(524288&o)&&(u=M(u,"0x48a170391f7dc42444e8fa2")),e>0&&(u=i.divide(n.MaxUint256,u)),i.greaterThan(i.remainder(u,D),x)?i.add(i.divide(u,D),q):i.divide(u,D)},t.getTickAtSqrtRatio=function(e){i.greaterThanOrEqual(e,t.MIN_SQRT_RATIO)&&i.lessThan(e,t.MAX_SQRT_RATIO)||r(!1);var n,o=i.leftShift(e,i.BigInt(32)),u=U(o);n=i.greaterThanOrEqual(i.BigInt(u),i.BigInt(128))?i.signedRightShift(o,i.BigInt(u-127)):i.leftShift(o,i.BigInt(127-u));for(var a=i.leftShift(i.subtract(i.BigInt(u),i.BigInt(128)),i.BigInt(64)),s=0;s<14;s++){n=i.signedRightShift(i.multiply(n,n),i.BigInt(127));var c=i.signedRightShift(n,i.BigInt(128));a=i.bitwiseOr(a,i.leftShift(c,i.BigInt(63-s))),n=i.signedRightShift(n,c)}var l=i.multiply(a,i.BigInt("255738958999603826347141")),f=i.toNumber(i.signedRightShift(i.subtract(l,i.BigInt("3402992956809132418596140100660247210")),i.BigInt(128))),p=i.toNumber(i.signedRightShift(i.add(l,i.BigInt("291339464771989622907027621153398088495")),i.BigInt(128)));return f===p?f:i.lessThanOrEqual(t.getSqrtRatioAtTick(p),e)?p:f},t}();F.MIN_TICK=-887272,F.MAX_TICK=-F.MIN_TICK,F.MIN_SQRT_RATIO=i.BigInt("4295128739"),F.MAX_SQRT_RATIO=i.BigInt("1461446703485210103287273052203988822378723970342");var H=function(){function t(t,e,n,o,u,a,s){Number.isInteger(n)&&n<1e6||r(!1);var c=F.getSqrtRatioAtTick(a),l=F.getSqrtRatioAtTick(a+1);i.greaterThanOrEqual(i.BigInt(o),c)&&i.lessThanOrEqual(i.BigInt(o),l)||r(!1);var f=t.sortsBefore(e)?[t,e]:[e,t];this.token0=f[0],this.token1=f[1],this.fee=n,this.sqrtRatioX96=i.BigInt(o),this.liquidity=i.BigInt(u),this.tickCurrent=a,this.ticks=s}t.getAddress=function(t,e,n){return w({factoryAddress:"0x1F98431c8aD98523631AE4a59f267346ea31F984",fee:n,tokenA:t,tokenB:e})};var e=t.prototype;return e.involvesToken=function(t){return t.equals(this.token0)||t.equals(this.token1)},e.priceOf=function(t){return this.involvesToken(t)||r(!1),t.equals(this.token0)?this.token0Price:this.token1Price},e.getOutputAmount=function(e){this.involvesToken(e.token)||r(!1);var o=e.token.equals(this.token0),u=this.swap(o,e.raw),a=u.sqrtRatioX96,s=u.liquidity,c=u.tickCurrent;return[new n.TokenAmount(o?this.token1:this.token0,i.multiply(u.amountCalculated,y)),new t(this.token0,this.token1,this.fee,a,s,c,this.ticks)]},e.getInputAmount=function(e){this.involvesToken(e.token)||r(!1);var o=e.token.equals(this.token1),u=this.swap(o,i.multiply(e.raw,y)),a=u.sqrtRatioX96,s=u.liquidity,c=u.tickCurrent;return[new n.TokenAmount(o?this.token0:this.token1,u.amountCalculated),new t(this.token0,this.token1,this.fee,a,s,c,this.ticks)]},e.swap=function(t,e,n){i.notEqual(e,x)||r(!1),n||(n=t?i.add(F.MIN_SQRT_RATIO,q):i.subtract(F.MAX_SQRT_RATIO,q)),t?(i.greaterThan(n,F.MIN_SQRT_RATIO)||r(!1),i.lessThan(n,this.sqrtRatioX96)||r(!1)):(i.lessThan(n,F.MAX_SQRT_RATIO)||r(!1),i.greaterThan(n,this.sqrtRatioX96)||r(!1));for(var o=i.greaterThan(e,x),u={amountSpecifiedRemaining:e,amountCalculated:x,sqrtPriceX96:this.sqrtRatioX96,tick:this.tickCurrent,liquidity:this.liquidity};i.notEqual(u.amountSpecifiedRemaining,x)&&u.sqrtPriceX96!=n;){var a={};a.sqrtPriceStartX96=u.sqrtPriceX96;var s=this.ticks.nextInitializedTickWithinOneWord(u.tick,t);a.tickNext=s[0],a.initialized=s[1],a.tickNext<F.MIN_TICK?a.tickNext=F.MIN_TICK:a.tickNext>F.MAX_TICK&&(a.tickNext=F.MAX_TICK),a.sqrtPriceNextX96=F.getSqrtRatioAtTick(a.tickNext);var c=B.computeSwapStep(u.sqrtPriceX96,(t?i.lessThan(a.sqrtPriceNextX96,n):i.greaterThan(a.sqrtPriceNextX96,n))?n:a.sqrtPriceNextX96,u.liquidity,u.amountSpecifiedRemaining,this.fee);if(u.sqrtPriceX96=c[0],a.amountIn=c[1],a.amountOut=c[2],a.feeAmount=c[3],o?(u.amountSpecifiedRemaining=i.subtract(u.amountSpecifiedRemaining,i.add(a.amountIn,a.feeAmount)),u.amountCalculated=i.subtract(u.amountCalculated,a.amountOut)):(u.amountSpecifiedRemaining=i.add(u.amountSpecifiedRemaining,a.amountOut),u.amountCalculated=i.add(u.amountCalculated,i.add(a.amountIn,a.feeAmount))),i.equal(u.sqrtPriceX96,a.sqrtPriceNextX96)){if(a.initialized){var l=this.ticks.getTick(a.tickNext).liquidityNet;t&&(l=i.multiply(l,y)),u.liquidity=S.addDelta(u.liquidity,l)}u.tick=t?a.tickNext-1:a.tickNext}else u.sqrtPriceX96!=a.sqrtPriceStartX96&&(u.tick=F.getTickAtSqrtRatio(u.sqrtPriceX96))}return{amountCalculated:u.amountCalculated,sqrtRatioX96:u.sqrtPriceX96,liquidity:u.liquidity,tickCurrent:u.tick}},c(t,[{key:"token0Price",get:function(){var t;return null!=(t=this._token0Price)?t:this._token0Price=new n.Price(this.token0,this.token1,R,i.multiply(this.sqrtRatioX96,this.sqrtRatioX96))}},{key:"token1Price",get:function(){var t;return null!=(t=this._token1Price)?t:this._token1Price=new n.Price(this.token1,this.token0,i.multiply(this.sqrtRatioX96,this.sqrtRatioX96),R)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"tickSpacing",get:function(){return I[this.fee]}}]),t}();function L(t,e,n){if(i.greaterThan(t,e)){var r=[e,t];t=r[0],e=r[1]}var o=i.divide(i.multiply(t,e),b);return i.divide(i.multiply(i.BigInt(n),o),i.subtract(e,t))}function j(t,e,n){if(i.greaterThan(t,e)){var r=[e,t];t=r[0],e=r[1]}return i.divide(i.multiply(i.BigInt(n),b),i.subtract(e,t))}function K(t,e,n,r,o){if(i.greaterThan(e,n)){var u=[n,e];e=u[0],n=u[1]}if(i.lessThan(t,e))return L(e,n,r);if(i.lessThan(t,n)){var a=L(t,n,r),s=j(e,t,o);return i.lessThan(a,s)?a:s}return j(e,n,o)}function W(t,e){var r=i.leftShift(i.BigInt(t),i.BigInt(192)),o=i.BigInt(e),u=i.divide(r,o);return n.sqrt(u)}function G(t,e,r){var o=F.getSqrtRatioAtTick(r),u=i.multiply(o,o);return t.sortsBefore(e)?new n.Price(t,e,R,u):new n.Price(t,e,u,R)}var Q=function(){function t(t){var e=t.pool,n=t.liquidity,o=t.tickLower,u=t.tickUpper;this._token0Amount=null,this._token1Amount=null,o<u||r(!1),o>=F.MIN_TICK&&o%e.tickSpacing==0||r(!1),u<=F.MAX_TICK&&u%e.tickSpacing==0||r(!1),this.pool=e,this.tickLower=o,this.tickUpper=u,this.liquidity=i.BigInt(n)}return t.fromAmounts=function(e){var n=e.pool,i=e.tickLower,r=e.tickUpper,o=e.amount0,u=e.amount1,a=F.getSqrtRatioAtTick(i),s=F.getSqrtRatioAtTick(r);return new t({pool:n,tickLower:i,tickUpper:r,liquidity:K(n.sqrtRatioX96,a,s,o,u)})},t.fromAmount0=function(e){return t.fromAmounts({pool:e.pool,tickLower:e.tickLower,tickUpper:e.tickUpper,amount0:e.amount0,amount1:n.MaxUint256})},t.fromAmount1=function(e){return t.fromAmounts({pool:e.pool,tickLower:e.tickLower,tickUpper:e.tickUpper,amount0:n.MaxUint256,amount1:e.amount1})},c(t,[{key:"token0PriceLower",get:function(){return G(this.pool.token0,this.pool.token1,this.tickLower)}},{key:"token1PriceLower",get:function(){return G(this.pool.token1,this.pool.token0,this.tickLower)}},{key:"token0PriceUpper",get:function(){return G(this.pool.token0,this.pool.token1,this.tickUpper)}},{key:"token1PriceUpper",get:function(){return G(this.pool.token1,this.pool.token0,this.tickUpper)}},{key:"amount0",get:function(){return null!==this._token0Amount||(this._token0Amount=new n.TokenAmount(this.pool.token0,this.pool.tickCurrent<this.tickLower?_.getAmount0Delta(F.getSqrtRatioAtTick(this.tickLower),F.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):this.pool.tickCurrent<this.tickUpper?_.getAmount0Delta(this.pool.sqrtRatioX96,F.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):x)),this._token0Amount}},{key:"amount1",get:function(){return null!==this._token1Amount||(this._token1Amount=this.pool.tickCurrent<this.tickLower?new n.TokenAmount(this.pool.token0,x):new n.TokenAmount(this.pool.token1,_.getAmount1Delta(F.getSqrtRatioAtTick(this.tickLower),this.pool.tickCurrent<this.tickUpper?this.pool.sqrtRatioX96:F.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1))),this._token1Amount}}]),t}(),z=function(){function t(t,e,i){t.length>0||r(!1);var o=t[0].chainId;t.every((function(t){return t.chainId===o}))||r(!1);var u=n.WETH9[o],a=e instanceof n.Token&&t[0].involvesToken(e),s=e===n.ETHER&&u&&t[0].involvesToken(u);a||s||r(!1);var c=void 0===i,l=i instanceof n.Token&&t[t.length-1].involvesToken(i),f=i===n.ETHER&&u&&t[t.length-1].involvesToken(u);c||l||f||r(!1);for(var p,h=[e instanceof n.Token?e:u],d=T(t.entries());!(p=d()).done;){var m=p.value,k=m[1],g=h[m[0]];g.equals(k.token0)||g.equals(k.token1)||r(!1);var v=g.equals(k.token0)?k.token1:k.token0;h.push(v)}this.pools=t,this.tokenPath=h,this.input=e,this.output=null!=i?i:h[h.length-1]}return c(t,[{key:"chainId",get:function(){return this.pools[0].chainId}}]),t}();function Y(t){return"0x"+t.raw.toString(16)}var Z=function(){function t(t,e){void 0===e&&(e=1),t.length>=2||r(!1),t.every((function(t){return t.index%e==0}))||r(!1),i.equal(t.reduce((function(t,e){return i.add(t,e.liquidityNet)}),x),x)||r(!1),this.tickSpacing=e,this.ticks=t.slice().sort((function(t,e){return t.index<e.index?-1:1}))}var e=t.prototype;return e.isBelowSmallest=function(t){return t<this.ticks[0].index},e.isAtOrAboveLargest=function(t){return t>=this.ticks[this.ticks.length-1].index},e.getTick=function(t){var e=this.ticks[this.binarySearch(t)];return e.index!==t&&r(!1),e},e.binarySearch=function(t){this.isBelowSmallest(t)&&r(!1),this.isAtOrAboveLargest(t)&&r(!1);for(var e,n=0,i=this.ticks.length-1;;){if(e=Math.floor((n+i)/2),this.ticks[e].index<=t&&this.ticks[e+1].index>t)return e;this.ticks[e].index<t?n=e+1:i=e-1}},e.nextInitializedTick=function(t,e){if(e){if(this.isBelowSmallest(t)&&r(!1),this.isAtOrAboveLargest(t))return this.ticks[this.ticks.length-1];var n=this.binarySearch(t);return this.ticks[n]}if(this.isAtOrAboveLargest(t)&&r(!1),this.isBelowSmallest(t))return this.ticks[0];var i=this.binarySearch(t);return this.ticks[i+1]},e.nextInitializedTickWithinOneWord=function(t,e){var n=Math.floor(t/this.tickSpacing);if(e){var i=(n>>8<<8)*this.tickSpacing;if(this.isBelowSmallest(t))return[i,!1];var r=this.nextInitializedTick(t,e).index,o=Math.max(i,r);return[o,o===r]}var u=(1+(n+1>>8)<<8)*this.tickSpacing-1;if(this.isAtOrAboveLargest(t))return[u,!1];var a=this.nextInitializedTick(t,e).index,s=Math.min(u,a);return[s,s===a]},t}();function $(t,e){return n.currencyEquals(t.inputAmount.currency,e.inputAmount.currency)||r(!1),n.currencyEquals(t.outputAmount.currency,e.outputAmount.currency)||r(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?0:t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}function J(t,e){var n=$(t,e);return 0!==n?n:t.priceImpact.lessThan(e.priceImpact)?-1:t.priceImpact.greaterThan(e.priceImpact)?1:t.route.tokenPath.length-e.route.tokenPath.length}function V(t,e){return t instanceof n.TokenAmount?t:t.currency===n.ETHER?new n.TokenAmount(n.WETH9[e],t.raw):void r(!1)}function tt(t,e){return t instanceof n.Token?t:t===n.ETHER?n.WETH9[e]:void r(!1)}var et=function(){function t(t,e,i){var o,u,a,s=new Array(t.tokenPath.length),c=new Array(t.pools.length);if(i===n.TradeType.EXACT_INPUT){n.currencyEquals(e.currency,t.input)||r(!1),s[0]=V(e,t.chainId);for(var l=0;l<t.tokenPath.length-1;l++){var f=t.pools[l].getOutputAmount(s[l]),p=f[1];s[l+1]=f[0],c[l]=p}}else{n.currencyEquals(e.currency,t.output)||r(!1),s[s.length-1]=V(e,t.chainId);for(var h=t.tokenPath.length-1;h>0;h--){var d=t.pools[h-1].getInputAmount(s[h]),m=d[1];s[h-1]=d[0],c[h-1]=m}}this.route=t,this.tradeType=i,this.inputAmount=i===n.TradeType.EXACT_INPUT?e:t.input===n.ETHER?n.CurrencyAmount.ether(s[0].raw):s[0],this.outputAmount=i===n.TradeType.EXACT_OUTPUT?e:t.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.priceImpact=(o=this.outputAmount,a=(u=this.executionPrice.raw.multiply(this.inputAmount.raw)).subtract(o.raw).divide(u),new n.Percent(a.numerator,a.denominator))}t.exactIn=function(e,i){return new t(e,i,n.TradeType.EXACT_INPUT)},t.exactOut=function(e,i){return new t(e,i,n.TradeType.EXACT_OUTPUT)};var e=t.prototype;return e.minimumAmountOut=function(t){if(t.lessThan(x)&&r(!1),this.tradeType===n.TradeType.EXACT_OUTPUT)return this.outputAmount;var e=new n.Fraction(q).add(t).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof n.TokenAmount?new n.TokenAmount(this.outputAmount.token,e):n.CurrencyAmount.ether(e)},e.maximumAmountIn=function(t){if(t.lessThan(x)&&r(!1),this.tradeType===n.TradeType.EXACT_INPUT)return this.inputAmount;var e=new n.Fraction(q).add(t).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof n.TokenAmount?new n.TokenAmount(this.inputAmount.token,e):n.CurrencyAmount.ether(e)},t.bestTradeExactIn=function(e,i,o,u,a,s,c){var l=void 0===u?{}:u,f=l.maxNumResults,p=void 0===f?3:f,h=l.maxHops,d=void 0===h?3:h;void 0===a&&(a=[]),void 0===s&&(s=i),void 0===c&&(c=[]),e.length>0||r(!1),d>0||r(!1),s===i||a.length>0||r(!1);var m=i instanceof n.TokenAmount?i.token.chainId:o instanceof n.Token?o.chainId:void 0;void 0===m&&r(!1);for(var k=V(i,m),g=tt(o,m),T=0;T<e.length;T++){var v=e[T];if(v.token0.equals(k.token)||v.token1.equals(k.token)){var A=void 0;try{A=v.getOutputAmount(k)[0]}catch(t){if(t.isInsufficientInputAmountError)continue;throw t}if(A.token.equals(g))n.sortedInsert(c,new t(new z([].concat(a,[v]),s.currency,o),s,n.TradeType.EXACT_INPUT),p,J);else if(d>1&&e.length>1){var I=e.slice(0,T).concat(e.slice(T+1,e.length));t.bestTradeExactIn(I,A,o,{maxNumResults:p,maxHops:d-1},[].concat(a,[v]),s,c)}}}return c},t.bestTradeExactOut=function(e,i,o,u,a,s,c){var l=void 0===u?{}:u,f=l.maxNumResults,p=void 0===f?3:f,h=l.maxHops,d=void 0===h?3:h;void 0===a&&(a=[]),void 0===s&&(s=o),void 0===c&&(c=[]),e.length>0||r(!1),d>0||r(!1),s===o||a.length>0||r(!1);var m=o instanceof n.TokenAmount?o.token.chainId:i instanceof n.Token?i.chainId:void 0;void 0===m&&r(!1);for(var k=V(o,m),g=tt(i,m),T=0;T<e.length;T++){var v=e[T];if(v.token0.equals(k.token)||v.token1.equals(k.token)){var A=void 0;try{A=v.getInputAmount(k)[0]}catch(t){if(t.isInsufficientReservesError)continue;throw t}if(A.token.equals(g))n.sortedInsert(c,new t(new z([v].concat(a),i,s.currency),s,n.TradeType.EXACT_OUTPUT),p,J);else if(d>1&&e.length>1){var I=e.slice(0,T).concat(e.slice(T+1,e.length));t.bestTradeExactOut(I,i,A,{maxNumResults:p,maxHops:d-1},[v].concat(a),s,c)}}}return c},t}(),nt="setPrototypeOf"in Object,it=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,nt&&Object.setPrototypeOf(k(n),(this instanceof e?this.constructor:void 0).prototype),n}return l(e,t),e}(m(Error)),rt=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,nt&&Object.setPrototypeOf(k(n),(this instanceof e?this.constructor:void 0).prototype),n}return l(e,t),e}(m(Error)),ot=function(){function t(){}return t.mintCallParameters=function(t,e){r(!1)},t}(),ut=function(){function t(){}return t.swapCallParameters=function(t,e){var i=t.inputAmount.currency===n.ETHER,o=t.outputAmount.currency===n.ETHER;i&&o&&r(!1);var u,a,s,c=n.validateAndParseAddress(e.recipient),l=Y(t.maximumAmountIn(e.allowedSlippage)),f=Y(t.minimumAmountOut(e.allowedSlippage)),p=t.route.tokenPath.map((function(t){return t.address})),h="0x"+e.deadline.toString(16),d=Boolean(e.feeOnTransfer);switch(t.tradeType){case n.TradeType.EXACT_INPUT:i?(u=d?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",a=[f,p,c,h],s=l):o?(u=d?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",a=[l,f,p,c,h],s="0x0"):(u=d?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",a=[l,f,p,c,h],s="0x0");break;case n.TradeType.EXACT_OUTPUT:d&&r(!1),i?(u="swapETHForExactTokens",a=[f,p,c,h],s=l):o?(u="swapTokensForExactETH",a=[f,l,p,c,h],s="0x0"):(u="swapTokensForExactTokens",a=[f,l,p,c,h],s="0x0");break;default:throw new Error("invalid trade type")}return{methodName:u,args:a,value:s,address:"0x1F98431c8aD98523631AE4a59f267346ea31F984"}},t}();exports.FACTORY_ADDRESS="0x1F98431c8aD98523631AE4a59f267346ea31F984",exports.InsufficientInputAmountError=rt,exports.InsufficientReservesError=it,exports.NonfungiblePositionManager=ot,exports.POOL_INIT_CODE_HASH=A,exports.Pool=H,exports.Position=Q,exports.Route=z,exports.SWAP_ROUTER_ADDRESS="0x1F98431c8aD98523631AE4a59f267346ea31F984",exports.SwapRouter=ut,exports.TICK_SPACINGS=I,exports.Tick=function(t){var e=t.index,n=t.feeGrowthOutside0X128,o=t.feeGrowthOutside1X128,u=t.liquidityGross,a=t.liquidityNet;e>=F.MIN_TICK&&e<=F.MAX_TICK||r(!1),this.index=e,n&&(this.feeGrowthOutside0X128=i.BigInt(n)),o&&(this.feeGrowthOutside1X128=i.BigInt(o)),this.liquidityGross=i.BigInt(u),this.liquidityNet=i.BigInt(a)},exports.TickList=Z,exports.TickMath=F,exports.Trade=et,exports.ZERO_HEX="0x0",exports.computePoolAddress=w,exports.encodeSqrtRatioX96=W,exports.inputOutputComparator=$,exports.maxLiquidityForAmounts=K,exports.mostSignificantBit=U,exports.nearestUsableTick=function(t,e){Number.isInteger(t)&&Number.isInteger(e)||r(!1),e>0||r(!1),t>=F.MIN_TICK&&t<=F.MAX_TICK||r(!1);var n=Math.round(t/e)*e;return n<F.MIN_TICK?n+e:n>F.MAX_TICK?n-e:n},exports.priceToClosestTick=function(t){t.baseCurrency instanceof n.Token&&t.quoteCurrency instanceof n.Token||r(!1);var e=t.baseCurrency.sortsBefore(t.quoteCurrency),i=e?W(t.raw.numerator,t.raw.denominator):W(t.raw.denominator,t.raw.numerator),o=F.getTickAtSqrtRatio(i),u=G(t.baseCurrency,t.quoteCurrency,o+1);return e?t.lessThan(u)||o++:t.greaterThan(u)||o++,o},exports.tickToPrice=G,exports.toHex=Y,exports.tradeComparator=J;
//# sourceMappingURL=v3-sdk.cjs.production.min.js.map
{
"name": "@uniswap/v3-sdk",
"license": "UNLICENSED",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"version": "1.0.0-alpha.7",
"version": "1.0.0-alpha.8",
"description": "⚒️ An SDK for building applications on top of Uniswap V3",

@@ -35,4 +35,4 @@ "main": "dist/index.js",

"@types/jest": "^24.0.25",
"@uniswap/v3-core": "^1.0.0-rc.0",
"@uniswap/v3-periphery": "^1.0.0-beta.11",
"@uniswap/v3-core": "^1.0.0-rc.1",
"@uniswap/v3-periphery": "^1.0.0-beta.14",
"tsdx": "^0.14.1"

@@ -39,0 +39,0 @@ },

Sorry, the diff of this file is too big to display

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 too big to display

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