@kayenfi/v3-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/constants.d.ts +25 -0
  4. package/dist/entities/index.d.ts +7 -0
  5. package/dist/entities/pool.d.ts +81 -0
  6. package/dist/entities/position.d.ts +131 -0
  7. package/dist/entities/route.d.ts +26 -0
  8. package/dist/entities/tick.d.ts +13 -0
  9. package/dist/entities/tickDataProvider.d.ts +31 -0
  10. package/dist/entities/tickListDataProvider.d.ts +15 -0
  11. package/dist/entities/trade.d.ts +220 -0
  12. package/dist/index.d.ts +10 -0
  13. package/dist/index.js +8 -0
  14. package/dist/internalConstants.d.ts +6 -0
  15. package/dist/multicall.d.ts +9 -0
  16. package/dist/nonfungiblePositionManager.d.ts +146 -0
  17. package/dist/payments.d.ts +24 -0
  18. package/dist/quoter.d.ts +37 -0
  19. package/dist/selfPermit.d.ts +25 -0
  20. package/dist/staker.d.ts +101 -0
  21. package/dist/swapRouter.d.ts +51 -0
  22. package/dist/utils/calldata.d.ts +20 -0
  23. package/dist/utils/computePoolAddress.d.ts +20 -0
  24. package/dist/utils/encodeRouteToPath.d.ts +8 -0
  25. package/dist/utils/encodeSqrtRatioX96.d.ts +9 -0
  26. package/dist/utils/fullMath.d.ts +8 -0
  27. package/dist/utils/index.d.ts +18 -0
  28. package/dist/utils/isSorted.d.ts +7 -0
  29. package/dist/utils/liquidityMath.d.ts +8 -0
  30. package/dist/utils/maxLiquidityForAmounts.d.ts +14 -0
  31. package/dist/utils/mostSignificantBit.d.ts +2 -0
  32. package/dist/utils/nearestUsableTick.d.ts +6 -0
  33. package/dist/utils/position.d.ts +8 -0
  34. package/dist/utils/priceTickConversions.d.ts +15 -0
  35. package/dist/utils/sqrtPriceMath.d.ts +13 -0
  36. package/dist/utils/swapMath.d.ts +9 -0
  37. package/dist/utils/tickLibrary.d.ts +14 -0
  38. package/dist/utils/tickList.d.ts +23 -0
  39. package/dist/utils/tickMath.d.ts +34 -0
  40. package/dist/utils/v3swap.d.ts +8 -0
  41. package/dist/v3-sdk.cjs.development.js +3238 -0
  42. package/dist/v3-sdk.cjs.development.js.map +1 -0
  43. package/dist/v3-sdk.cjs.production.min.js +2 -0
  44. package/dist/v3-sdk.cjs.production.min.js.map +1 -0
  45. package/dist/v3-sdk.esm.js +3195 -0
  46. package/dist/v3-sdk.esm.js.map +1 -0
  47. package/package.json +58 -0
@@ -0,0 +1,2 @@
1
+ "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,n,r,i=require("@kayenfi/sdk-core"),o=t(require("jsbi")),a=t(require("tiny-invariant")),u=require("@ethersproject/abi"),c=require("@ethersproject/address"),s=require("@ethersproject/solidity"),p=t(require("@uniswap/v3-periphery/artifacts/contracts/interfaces/IMulticall.sol/IMulticall.json")),d=t(require("@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json")),l=t(require("@uniswap/v3-periphery/artifacts/contracts/interfaces/ISelfPermit.sol/ISelfPermit.json")),f=t(require("@uniswap/v3-periphery/artifacts/contracts/interfaces/IPeripheryPaymentsWithFee.sol/IPeripheryPaymentsWithFee.json")),h=t(require("@uniswap/v3-periphery/artifacts/contracts/lens/Quoter.sol/Quoter.json")),m=t(require("@uniswap/swap-router-contracts/artifacts/contracts/lens/QuoterV2.sol/QuoterV2.json")),v=t(require("@uniswap/v3-staker/artifacts/contracts/UniswapV3Staker.sol/UniswapV3Staker.json")),y=t(require("@uniswap/v3-periphery/artifacts/contracts/SwapRouter.sol/SwapRouter.json"));function k(){k=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=Object.create((e&&e.prototype instanceof v?e:v).prototype),a=new C(r||[]);return i(o,"_invoke",{value:b(t,n,a)}),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var l="suspendedStart",f="executing",h="completed",m={};function v(){}function y(){}function A(){}var g={};s(g,a,(function(){return this}));var T=Object.getPrototypeOf,I=T&&T(T(O([])));I&&I!==n&&r.call(I,a)&&(g=I);var x=A.prototype=v.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function q(t,e){function n(i,o,a,u){var c=d(t[i],t,o);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(p).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function b(e,n,r){var i=l;return function(o,a){if(i===f)throw new Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var u=r.delegate;if(u){var c=R(u,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===l)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var s=d(e,n,r);if("normal"===s.type){if(i=r.done?h:"suspendedYield",s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function R(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,R(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=d(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return y.prototype=A,i(x,"constructor",{value:A,configurable:!0}),i(A,"constructor",{value:y,configurable:!0}),y.displayName=s(A,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,A):(t.__proto__=A,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},w(q.prototype),s(q.prototype,u,(function(){return this})),e.AsyncIterator=q,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new q(p(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(x),s(x,c,"Generator"),s(x,a,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return u.type="throw",u.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function A(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}function g(t,e,n,r,i,o,a){try{var u=t[o](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,i)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){g(o,r,i,a,u,"next",t)}function u(t){g(o,r,i,a,u,"throw",t)}a(void 0)}))}}function I(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,A(r.key),r)}}function x(t,e,n){return e&&I(t.prototype,e),n&&I(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function w(){return(w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function q(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 b(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return q(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)?q(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.")}var R,E=((e={})[i.ChainId.CHILIZ]="0x8E994Dbd9d91dF55A711D24B14739ab410CAC1E7",e[i.ChainId.SPICY]="0x6047E9e3f651E356075f85014BB21c6a71aAEaDe",e),P="0x0000000000000000000000000000000000000000",C="0xdb96ddabce23ac2496f88ada639decf2ad1c34e5921db179ad41359ed24285e1",O=((n={})[i.ChainId.CHILIZ]="0xdb96ddabce23ac2496f88ada639decf2ad1c34e5921db179ad41359ed24285e1",n[i.ChainId.SPICY]="0xdb96ddabce23ac2496f88ada639decf2ad1c34e5921db179ad41359ed24285e1",n);function S(t){var e;return null!=(e=O[t])?e:C}(R=exports.FeeAmount||(exports.FeeAmount={}))[R.LOWEST=100]="LOWEST",R[R.LOW_200=200]="LOW_200",R[R.LOW_300=300]="LOW_300",R[R.LOW_400=400]="LOW_400",R[R.LOW=500]="LOW",R[R.MEDIUM=3e3]="MEDIUM",R[R.HIGH=1e4]="HIGH";var _=((r={})[exports.FeeAmount.LOWEST]=1,r[exports.FeeAmount.LOW_200]=4,r[exports.FeeAmount.LOW_300]=6,r[exports.FeeAmount.LOW_400]=8,r[exports.FeeAmount.LOW]=10,r[exports.FeeAmount.MEDIUM]=60,r[exports.FeeAmount.HIGH]=200,r),N=o.BigInt(-1),F=o.BigInt(0),L=o.BigInt(1),X=o.exponentiate(o.BigInt(2),o.BigInt(96)),B=o.exponentiate(X,o.BigInt(2));function D(t){var e=t.factoryAddress,n=t.tokenA,r=t.tokenB,i=t.fee,o=t.initCodeHashManualOverride,a=t.chainId,p=n.sortsBefore(r)?[n,r]:[r,n],d=s.keccak256(["bytes"],[u.defaultAbiCoder.encode(["address","address","uint24"],[p[0].address,p[1].address,i])]),l=null!=o?o:S(a);return c.getCreate2Address(e,d,l)}var U=function(){function t(){}return t.mulDivRoundingUp=function(t,e,n){var r=o.multiply(t,e),i=o.divide(r,n);return o.notEqual(o.remainder(r,n),F)&&(i=o.add(i,L)),i},t}(),M=o.subtract(o.exponentiate(o.BigInt(2),o.BigInt(160)),L);function W(t,e){var n=o.multiply(t,e);return o.bitwiseAnd(n,i.MaxUint256)}var j=function(){function t(){}return t.getAmount0Delta=function(t,e,n,r){if(o.greaterThan(t,e)){var i=[e,t];t=i[0],e=i[1]}var a=o.leftShift(n,o.BigInt(96)),u=o.subtract(e,t);return r?U.mulDivRoundingUp(U.mulDivRoundingUp(a,u,e),L,t):o.divide(o.divide(o.multiply(a,u),e),t)},t.getAmount1Delta=function(t,e,n,r){if(o.greaterThan(t,e)){var i=[e,t];t=i[0],e=i[1]}return r?U.mulDivRoundingUp(n,o.subtract(e,t),X):o.divide(o.multiply(n,o.subtract(e,t)),X)},t.getNextSqrtPriceFromInput=function(t,e,n,r){return o.greaterThan(t,F)||a(!1),o.greaterThan(e,F)||a(!1),r?this.getNextSqrtPriceFromAmount0RoundingUp(t,e,n,!0):this.getNextSqrtPriceFromAmount1RoundingDown(t,e,n,!0)},t.getNextSqrtPriceFromOutput=function(t,e,n,r){return o.greaterThan(t,F)||a(!1),o.greaterThan(e,F)||a(!1),r?this.getNextSqrtPriceFromAmount1RoundingDown(t,e,n,!1):this.getNextSqrtPriceFromAmount0RoundingUp(t,e,n,!1)},t.getNextSqrtPriceFromAmount0RoundingUp=function(t,e,n,r){if(o.equal(n,F))return t;var u=o.leftShift(e,o.BigInt(96));if(r){var c=W(n,t);if(o.equal(o.divide(c,n),t)){var s=(d=o.add(u,c),o.bitwiseAnd(d,i.MaxUint256));if(o.greaterThanOrEqual(s,u))return U.mulDivRoundingUp(u,t,s)}return U.mulDivRoundingUp(u,L,o.add(o.divide(u,t),n))}var p=W(n,t);o.equal(o.divide(p,n),t)||a(!1),o.greaterThan(u,p)||a(!1);var d,l=o.subtract(u,p);return U.mulDivRoundingUp(u,t,l)},t.getNextSqrtPriceFromAmount1RoundingDown=function(t,e,n,r){if(r){var i=o.lessThanOrEqual(n,M)?o.divide(o.leftShift(n,o.BigInt(96)),e):o.divide(o.multiply(n,X),e);return o.add(t,i)}var u=U.mulDivRoundingUp(n,X,e);return o.greaterThan(t,u)||a(!1),o.subtract(t,u)},t}(),H=o.exponentiate(o.BigInt(10),o.BigInt(6)),G=function(){function t(){}return t.computeSwapStep=function(t,e,n,r,i){var a={};i=o.BigInt(i);var u=o.greaterThanOrEqual(t,e),c=o.greaterThanOrEqual(r,F);if(c){var s=o.divide(o.multiply(r,o.subtract(H,i)),H);a.amountIn=u?j.getAmount0Delta(e,t,n,!0):j.getAmount1Delta(t,e,n,!0),a.sqrtRatioNextX96=o.greaterThanOrEqual(s,a.amountIn)?e:j.getNextSqrtPriceFromInput(t,n,s,u)}else a.amountOut=u?j.getAmount1Delta(e,t,n,!1):j.getAmount0Delta(t,e,n,!1),a.sqrtRatioNextX96=o.greaterThanOrEqual(o.multiply(r,N),a.amountOut)?e:j.getNextSqrtPriceFromOutput(t,n,o.multiply(r,N),u);var p=o.equal(e,a.sqrtRatioNextX96);return u?(a.amountIn=p&&c?a.amountIn:j.getAmount0Delta(a.sqrtRatioNextX96,t,n,!0),a.amountOut=p&&!c?a.amountOut:j.getAmount1Delta(a.sqrtRatioNextX96,t,n,!1)):(a.amountIn=p&&c?a.amountIn:j.getAmount1Delta(t,a.sqrtRatioNextX96,n,!0),a.amountOut=p&&!c?a.amountOut:j.getAmount0Delta(t,a.sqrtRatioNextX96,n,!1)),!c&&o.greaterThan(a.amountOut,o.multiply(r,N))&&(a.amountOut=o.multiply(r,N)),a.feeAmount=c&&o.notEqual(a.sqrtRatioNextX96,e)?o.subtract(r,a.amountIn):U.mulDivRoundingUp(a.amountIn,i,o.subtract(H,i)),[a.sqrtRatioNextX96,a.amountIn,a.amountOut,a.feeAmount]},t}(),K=function(){function t(){}return t.addDelta=function(t,e){return o.lessThan(e,F)?o.subtract(t,o.multiply(e,N)):o.add(t,e)},t}(),Q=o.BigInt(2),V=[128,64,32,16,8,4,2,1].map((function(t){return[t,o.exponentiate(Q,o.BigInt(t))]}));function z(t){o.greaterThan(t,F)||a(!1),o.lessThanOrEqual(t,i.MaxUint256)||a(!1);for(var e,n=0,r=b(V);!(e=r()).done;){var u=e.value,c=u[0];o.greaterThanOrEqual(t,u[1])&&(t=o.signedRightShift(t,o.BigInt(c)),n+=c)}return n}function Y(t,e){return o.signedRightShift(o.multiply(t,o.BigInt(e)),o.BigInt(128))}var Z=o.exponentiate(o.BigInt(2),o.BigInt(32)),$=function(){function t(){}return t.getSqrtRatioAtTick=function(e){e>=t.MIN_TICK&&e<=t.MAX_TICK&&Number.isInteger(e)||a(!1);var n=e<0?-1*e:e,r=o.BigInt(0!=(1&n)?"0xfffcb933bd6fad37aa2d162d1a594001":"0x100000000000000000000000000000000");return 0!=(2&n)&&(r=Y(r,"0xfff97272373d413259a46990580e213a")),0!=(4&n)&&(r=Y(r,"0xfff2e50f5f656932ef12357cf3c7fdcc")),0!=(8&n)&&(r=Y(r,"0xffe5caca7e10e4e61c3624eaa0941cd0")),0!=(16&n)&&(r=Y(r,"0xffcb9843d60f6159c9db58835c926644")),0!=(32&n)&&(r=Y(r,"0xff973b41fa98c081472e6896dfb254c0")),0!=(64&n)&&(r=Y(r,"0xff2ea16466c96a3843ec78b326b52861")),0!=(128&n)&&(r=Y(r,"0xfe5dee046a99a2a811c461f1969c3053")),0!=(256&n)&&(r=Y(r,"0xfcbe86c7900a88aedcffc83b479aa3a4")),0!=(512&n)&&(r=Y(r,"0xf987a7253ac413176f2b074cf7815e54")),0!=(1024&n)&&(r=Y(r,"0xf3392b0822b70005940c7a398e4b70f3")),0!=(2048&n)&&(r=Y(r,"0xe7159475a2c29b7443b29c7fa6e889d9")),0!=(4096&n)&&(r=Y(r,"0xd097f3bdfd2022b8845ad8f792aa5825")),0!=(8192&n)&&(r=Y(r,"0xa9f746462d870fdf8a65dc1f90e061e5")),0!=(16384&n)&&(r=Y(r,"0x70d869a156d2a1b890bb3df62baf32f7")),0!=(32768&n)&&(r=Y(r,"0x31be135f97d08fd981231505542fcfa6")),0!=(65536&n)&&(r=Y(r,"0x9aa508b5b7a84e1c677de54f3e99bc9")),0!=(131072&n)&&(r=Y(r,"0x5d6af8dedb81196699c329225ee604")),0!=(262144&n)&&(r=Y(r,"0x2216e584f5fa1ea926041bedfe98")),0!=(524288&n)&&(r=Y(r,"0x48a170391f7dc42444e8fa2")),e>0&&(r=o.divide(i.MaxUint256,r)),o.greaterThan(o.remainder(r,Z),F)?o.add(o.divide(r,Z),L):o.divide(r,Z)},t.getTickAtSqrtRatio=function(e){o.greaterThanOrEqual(e,t.MIN_SQRT_RATIO)&&o.lessThan(e,t.MAX_SQRT_RATIO)||a(!1);var n,r=o.leftShift(e,o.BigInt(32)),i=z(r);n=o.greaterThanOrEqual(o.BigInt(i),o.BigInt(128))?o.signedRightShift(r,o.BigInt(i-127)):o.leftShift(r,o.BigInt(127-i));for(var u=o.leftShift(o.subtract(o.BigInt(i),o.BigInt(128)),o.BigInt(64)),c=0;c<14;c++){n=o.signedRightShift(o.multiply(n,n),o.BigInt(127));var s=o.signedRightShift(n,o.BigInt(128));u=o.bitwiseOr(u,o.leftShift(s,o.BigInt(63-c))),n=o.signedRightShift(n,s)}var p=o.multiply(u,o.BigInt("255738958999603826347141")),d=o.toNumber(o.signedRightShift(o.subtract(p,o.BigInt("3402992956809132418596140100660247210")),o.BigInt(128))),l=o.toNumber(o.signedRightShift(o.add(p,o.BigInt("291339464771989622907027621153398088495")),o.BigInt(128)));return d===l?d:o.lessThanOrEqual(t.getSqrtRatioAtTick(l),e)?l:d},t}();function J(t,e,n,r,i,o,a,u,c){return tt.apply(this,arguments)}function tt(){return(tt=T(k().mark((function t(e,n,r,i,u,c,s,p,d){var l,f,h,m,v,y;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:d||(d=s?o.add($.MIN_SQRT_RATIO,L):o.subtract($.MAX_SQRT_RATIO,L)),s?(o.greaterThan(d,$.MIN_SQRT_RATIO)||a(!1),o.lessThan(d,n)||a(!1)):(o.lessThan(d,$.MAX_SQRT_RATIO)||a(!1),o.greaterThan(d,n)||a(!1)),l=o.greaterThanOrEqual(p,F),f={amountSpecifiedRemaining:p,amountCalculated:F,sqrtPriceX96:n,tick:r,liquidity:i};case 4:if(!o.notEqual(f.amountSpecifiedRemaining,F)||f.sqrtPriceX96===d){t.next=35;break}return(h={}).sqrtPriceStartX96=f.sqrtPriceX96,t.next=9,c.nextInitializedTickWithinOneWord(f.tick,s,u);case 9:if(h.tickNext=(m=t.sent)[0],h.initialized=m[1],h.tickNext<$.MIN_TICK?h.tickNext=$.MIN_TICK:h.tickNext>$.MAX_TICK&&(h.tickNext=$.MAX_TICK),h.sqrtPriceNextX96=$.getSqrtRatioAtTick(h.tickNext),v=G.computeSwapStep(f.sqrtPriceX96,(s?o.lessThan(h.sqrtPriceNextX96,d):o.greaterThan(h.sqrtPriceNextX96,d))?d:h.sqrtPriceNextX96,f.liquidity,f.amountSpecifiedRemaining,e),f.sqrtPriceX96=v[0],h.amountIn=v[1],h.amountOut=v[2],h.feeAmount=v[3],l?(f.amountSpecifiedRemaining=o.subtract(f.amountSpecifiedRemaining,o.add(h.amountIn,h.feeAmount)),f.amountCalculated=o.subtract(f.amountCalculated,h.amountOut)):(f.amountSpecifiedRemaining=o.add(f.amountSpecifiedRemaining,h.amountOut),f.amountCalculated=o.add(f.amountCalculated,o.add(h.amountIn,h.feeAmount))),!o.equal(f.sqrtPriceX96,h.sqrtPriceNextX96)){t.next=32;break}if(!h.initialized){t.next=29;break}return t.t0=o,t.next=25,c.getTick(h.tickNext);case 25:t.t1=t.sent.liquidityNet,y=t.t0.BigInt.call(t.t0,t.t1),s&&(y=o.multiply(y,N)),f.liquidity=K.addDelta(f.liquidity,y);case 29:f.tick=s?h.tickNext-1:h.tickNext,t.next=33;break;case 32:o.notEqual(f.sqrtPriceX96,h.sqrtPriceStartX96)&&(f.tick=$.getTickAtSqrtRatio(f.sqrtPriceX96));case 33:t.next=4;break;case 35:return t.abrupt("return",{amountCalculated:f.amountCalculated,sqrtRatioX96:f.sqrtPriceX96,liquidity:f.liquidity,tickCurrent:f.tick});case 36:case"end":return t.stop()}}),t)})))).apply(this,arguments)}$.MIN_TICK=-887272,$.MAX_TICK=-$.MIN_TICK,$.MIN_SQRT_RATIO=o.BigInt("4295128739"),$.MAX_SQRT_RATIO=o.BigInt("1461446703485210103287273052203988822378723970342");var et=function(){function t(){}var e=t.prototype;return e.getTick=function(){var e=T(k().mark((function e(n){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error(t.ERROR_MESSAGE);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.nextInitializedTickWithinOneWord=function(){var e=T(k().mark((function e(n,r,i){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error(t.ERROR_MESSAGE);case 1:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),t}();function nt(t,e){for(var n=0;n<t.length-1;n++)if(e(t[n],t[n+1])>0)return!1;return!0}function rt(t,e){return t.index-e.index}et.ERROR_MESSAGE="No tick data provider was given";var it=function(){function t(){}return t.validateList=function(t,e){e>0||a(!1),t.every((function(t){return t.index%e==0}))||a(!1),o.equal(t.reduce((function(t,e){return o.add(t,e.liquidityNet)}),F),F)||a(!1),nt(t,rt)||a(!1)},t.isBelowSmallest=function(t,e){return t.length>0||a(!1),e<t[0].index},t.isAtOrAboveLargest=function(t,e){return t.length>0||a(!1),e>=t[t.length-1].index},t.getTick=function(t,e){var n=t[this.binarySearch(t,e)];return n.index!==e&&a(!1),n},t.binarySearch=function(t,e){this.isBelowSmallest(t,e)&&a(!1);for(var n,r=0,i=t.length-1;;){if(t[n=Math.floor((r+i)/2)].index<=e&&(n===t.length-1||t[n+1].index>e))return n;t[n].index<e?r=n+1:i=n-1}},t.nextInitializedTick=function(e,n,r){return r?(t.isBelowSmallest(e,n)&&a(!1),t.isAtOrAboveLargest(e,n)?e[e.length-1]:e[this.binarySearch(e,n)]):(this.isAtOrAboveLargest(e,n)&&a(!1),this.isBelowSmallest(e,n)?e[0]:e[this.binarySearch(e,n)+1])},t.nextInitializedTickWithinOneWord=function(e,n,r,i){var o=Math.floor(n/i);if(r){var a=(o>>8<<8)*i;if(t.isBelowSmallest(e,n))return[a,!1];var u=t.nextInitializedTick(e,n,r).index,c=Math.max(a,u);return[c,c===u]}var s=((1+(o+1>>8)<<8)-1)*i;if(this.isAtOrAboveLargest(e,n))return[s,!1];var p=this.nextInitializedTick(e,n,r).index,d=Math.min(s,p);return[d,d===p]},t}();function ot(t){var e=o.BigInt(t).toString(16);return e.length%2!=0&&(e="0"+e),"0x"+e}function at(t,e){var n=t.pools.reduce((function(t,e,n){var r=t.inputToken,i=t.path,o=t.types,a=e.token0.equals(r)?e.token1:e.token0;return 0===n?{inputToken:a,types:["address","uint24","address"],path:[r.address,e.fee,a.address]}:{inputToken:a,types:[].concat(o,["uint24","address"]),path:[].concat(i,[e.fee,a.address])}}),{inputToken:t.input.wrapped,path:[],types:[]}),r=n.path,i=n.types;return e?s.pack(i.reverse(),r.reverse()):s.pack(i,r)}function ut(t,e){var n=o.leftShift(o.BigInt(t),o.BigInt(192)),r=o.BigInt(e),a=o.divide(n,r);return i.sqrt(a)}function ct(t,e,n){if(o.greaterThan(t,e)){var r=[e,t];t=r[0],e=r[1]}var i=o.divide(o.multiply(t,e),X);return o.divide(o.multiply(o.BigInt(n),i),o.subtract(e,t))}function st(t,e,n){if(o.greaterThan(t,e)){var r=[e,t];t=r[0],e=r[1]}var i=o.multiply(o.multiply(o.BigInt(n),t),e),a=o.multiply(X,o.subtract(e,t));return o.divide(i,a)}function pt(t,e,n){if(o.greaterThan(t,e)){var r=[e,t];t=r[0],e=r[1]}return o.divide(o.multiply(o.BigInt(n),X),o.subtract(e,t))}function dt(t,e,n,r,i,a){if(o.greaterThan(e,n)){var u=[n,e];e=u[0],n=u[1]}var c=a?st:ct;if(o.lessThanOrEqual(t,e))return c(e,n,r);if(o.lessThan(t,n)){var s=c(t,n,r),p=pt(e,t,i);return o.lessThan(s,p)?s:p}return pt(e,n,i)}var lt=o.exponentiate(o.BigInt(2),o.BigInt(128)),ft=function(){function t(){}return t.getTokensOwed=function(t,e,n,r,i){return[o.divide(o.multiply(vt(r,t),n),lt),o.divide(o.multiply(vt(i,e),n),lt)]},t}();function ht(t,e,n){var r=$.getSqrtRatioAtTick(n),a=o.multiply(r,r);return t.sortsBefore(e)?new i.Price(t,e,B,a):new i.Price(t,e,a,B)}var mt=o.exponentiate(o.BigInt(2),o.BigInt(256));function vt(t,e){var n=o.subtract(t,e);return o.lessThan(n,F)?o.add(mt,n):n}var yt=function(){function t(){}return t.getFeeGrowthInside=function(t,e,n,r,i,o,a){var u,c,s,p;return i>=n?(u=t.feeGrowthOutside0X128,c=t.feeGrowthOutside1X128):(u=vt(o,t.feeGrowthOutside0X128),c=vt(a,t.feeGrowthOutside1X128)),i<r?(s=e.feeGrowthOutside0X128,p=e.feeGrowthOutside1X128):(s=vt(o,e.feeGrowthOutside0X128),p=vt(a,e.feeGrowthOutside1X128)),[vt(vt(o,u),s),vt(vt(a,c),p)]},t}(),kt=function(t){var e=t.index,n=t.liquidityGross,r=t.liquidityNet;e>=$.MIN_TICK&&e<=$.MAX_TICK||a(!1),this.index=e,this.liquidityGross=o.BigInt(n),this.liquidityNet=o.BigInt(r)},At=function(){function t(t,e){var n=t.map((function(t){return t instanceof kt?t:new kt(t)}));it.validateList(n,e),this.ticks=n}var e=t.prototype;return e.getTick=function(){var t=T(k().mark((function t(e){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",it.getTick(this.ticks,e));case 1:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.nextInitializedTickWithinOneWord=function(){var t=T(k().mark((function t(e,n,r){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",it.nextInitializedTickWithinOneWord(this.ticks,e,n,r));case 1:case"end":return t.stop()}}),t,this)})));return function(e,n,r){return t.apply(this,arguments)}}(),t}(),gt=new et,Tt=function(){function t(t,e,n,r,i,u,c){void 0===c&&(c=gt),Number.isInteger(n)&&n<1e6||a(!1);var s=$.getSqrtRatioAtTick(u),p=$.getSqrtRatioAtTick(u+1);o.greaterThanOrEqual(o.BigInt(r),s)&&o.lessThanOrEqual(o.BigInt(r),p)||a(!1);var d=t.sortsBefore(e)?[t,e]:[e,t];this.token0=d[0],this.token1=d[1],this.fee=n,this.sqrtRatioX96=o.BigInt(r),this.liquidity=o.BigInt(i),this.tickCurrent=u,this.tickDataProvider=Array.isArray(c)?new At(c,_[n]):c}t.getAddress=function(t,e,n,r,i){return D({factoryAddress:null!=i?i:"0x8E994Dbd9d91dF55A711D24B14739ab410CAC1E7",fee:n,tokenA:t,tokenB:e,initCodeHashManualOverride:r})};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)||a(!1),t.equals(this.token0)?this.token0Price:this.token1Price},e.getOutputAmount=function(){var e=T(k().mark((function e(n,r){var u,c,s,p,d;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.involvesToken(n.currency)||a(!1),u=n.currency.equals(this.token0),e.next=4,this.swap(u,n.quotient,r);case 4:return s=(c=e.sent).sqrtRatioX96,p=c.liquidity,d=c.tickCurrent,e.abrupt("return",[i.CurrencyAmount.fromRawAmount(u?this.token1:this.token0,o.multiply(c.amountCalculated,N)),new t(this.token0,this.token1,this.fee,s,p,d,this.tickDataProvider)]);case 11:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),e.getInputAmount=function(){var e=T(k().mark((function e(n,r){var u,c,s,p,d;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.currency.isToken&&this.involvesToken(n.currency)||a(!1),u=n.currency.equals(this.token1),e.next=4,this.swap(u,o.multiply(n.quotient,N),r);case 4:return s=(c=e.sent).sqrtRatioX96,p=c.liquidity,d=c.tickCurrent,e.abrupt("return",[i.CurrencyAmount.fromRawAmount(u?this.token0:this.token1,c.amountCalculated),new t(this.token0,this.token1,this.fee,s,p,d,this.tickDataProvider)]);case 11:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),e.swap=function(){var t=T(k().mark((function t(e,n,r){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",J(o.BigInt(this.fee),this.sqrtRatioX96,this.tickCurrent,this.liquidity,this.tickSpacing,this.tickDataProvider,e,n,r));case 1:case"end":return t.stop()}}),t,this)})));return function(e,n,r){return t.apply(this,arguments)}}(),x(t,[{key:"token0Price",get:function(){var t;return null!=(t=this._token0Price)?t:this._token0Price=new i.Price(this.token0,this.token1,B,o.multiply(this.sqrtRatioX96,this.sqrtRatioX96))}},{key:"token1Price",get:function(){var t;return null!=(t=this._token1Price)?t:this._token1Price=new i.Price(this.token1,this.token0,o.multiply(this.sqrtRatioX96,this.sqrtRatioX96),B)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"tickSpacing",get:function(){return _[this.fee]}}]),t}(),It=function(){function t(t){var e=t.pool,n=t.liquidity,r=t.tickLower,i=t.tickUpper;this._token0Amount=null,this._token1Amount=null,this._mintAmounts=null,r<i||a(!1),r>=$.MIN_TICK&&r%e.tickSpacing==0||a(!1),i<=$.MAX_TICK&&i%e.tickSpacing==0||a(!1),this.pool=e,this.tickLower=r,this.tickUpper=i,this.liquidity=o.BigInt(n)}var e=t.prototype;return e.ratiosAfterSlippage=function(t){var e=this.pool.token0Price.asFraction.multiply(new i.Percent(1).subtract(t)),n=this.pool.token0Price.asFraction.multiply(t.add(1)),r=ut(e.numerator,e.denominator);o.lessThanOrEqual(r,$.MIN_SQRT_RATIO)&&(r=o.add($.MIN_SQRT_RATIO,o.BigInt(1)));var a=ut(n.numerator,n.denominator);return o.greaterThanOrEqual(a,$.MAX_SQRT_RATIO)&&(a=o.subtract($.MAX_SQRT_RATIO,o.BigInt(1))),{sqrtRatioX96Lower:r,sqrtRatioX96Upper:a}},e.mintAmountsWithSlippage=function(e){var n=this.ratiosAfterSlippage(e),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,o=new Tt(this.pool.token0,this.pool.token1,this.pool.fee,i,0,$.getTickAtSqrtRatio(i)),a=new Tt(this.pool.token0,this.pool.token1,this.pool.fee,r,0,$.getTickAtSqrtRatio(r)),u=t.fromAmounts(w({pool:this.pool,tickLower:this.tickLower,tickUpper:this.tickUpper},this.mintAmounts,{useFullPrecision:!1}));return{amount0:new t({pool:a,liquidity:u.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount0,amount1:new t({pool:o,liquidity:u.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount1}},e.burnAmountsWithSlippage=function(e){var n=this.ratiosAfterSlippage(e),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,o=new Tt(this.pool.token0,this.pool.token1,this.pool.fee,i,0,$.getTickAtSqrtRatio(i)),a=new t({pool:new Tt(this.pool.token0,this.pool.token1,this.pool.fee,r,0,$.getTickAtSqrtRatio(r)),liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount0,u=new t({pool:o,liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount1;return{amount0:a.quotient,amount1:u.quotient}},t.fromAmounts=function(e){var n=e.pool,r=e.tickLower,i=e.tickUpper,o=e.amount0,a=e.amount1,u=e.useFullPrecision,c=$.getSqrtRatioAtTick(r),s=$.getSqrtRatioAtTick(i);return new t({pool:n,tickLower:r,tickUpper:i,liquidity:dt(n.sqrtRatioX96,c,s,o,a,u)})},t.fromAmount0=function(e){return t.fromAmounts({pool:e.pool,tickLower:e.tickLower,tickUpper:e.tickUpper,amount0:e.amount0,amount1:i.MaxUint256,useFullPrecision:e.useFullPrecision})},t.fromAmount1=function(e){return t.fromAmounts({pool:e.pool,tickLower:e.tickLower,tickUpper:e.tickUpper,amount0:i.MaxUint256,amount1:e.amount1,useFullPrecision:!0})},x(t,[{key:"token0PriceLower",get:function(){return ht(this.pool.token0,this.pool.token1,this.tickLower)}},{key:"token0PriceUpper",get:function(){return ht(this.pool.token0,this.pool.token1,this.tickUpper)}},{key:"amount0",get:function(){return null===this._token0Amount&&(this._token0Amount=i.CurrencyAmount.fromRawAmount(this.pool.token0,this.pool.tickCurrent<this.tickLower?j.getAmount0Delta($.getSqrtRatioAtTick(this.tickLower),$.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):this.pool.tickCurrent<this.tickUpper?j.getAmount0Delta(this.pool.sqrtRatioX96,$.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):F)),this._token0Amount}},{key:"amount1",get:function(){return null===this._token1Amount&&(this._token1Amount=i.CurrencyAmount.fromRawAmount(this.pool.token1,this.pool.tickCurrent<this.tickLower?F:j.getAmount1Delta($.getSqrtRatioAtTick(this.tickLower),this.pool.tickCurrent<this.tickUpper?this.pool.sqrtRatioX96:$.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1))),this._token1Amount}},{key:"mintAmounts",get:function(){return null===this._mintAmounts?this.pool.tickCurrent<this.tickLower?{amount0:j.getAmount0Delta($.getSqrtRatioAtTick(this.tickLower),$.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:F}:this.pool.tickCurrent<this.tickUpper?{amount0:j.getAmount0Delta(this.pool.sqrtRatioX96,$.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:j.getAmount1Delta($.getSqrtRatioAtTick(this.tickLower),this.pool.sqrtRatioX96,this.liquidity,!0)}:{amount0:F,amount1:j.getAmount1Delta($.getSqrtRatioAtTick(this.tickLower),$.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0)}:this._mintAmounts}}]),t}(),xt=function(){function t(t,e,n){this._midPrice=null,t.length>0||a(!1);var r=t[0].chainId;t.every((function(t){return t.chainId===r}))||a(!1);var i=e.wrapped;t[0].involvesToken(i)||a(!1),t[t.length-1].involvesToken(n.wrapped)||a(!1);for(var o,u=[i],c=b(t.entries());!(o=c()).done;){var s=o.value,p=s[1],d=u[s[0]];d.equals(p.token0)||d.equals(p.token1)||a(!1);var l=d.equals(p.token0)?p.token1:p.token0;u.push(l)}this.pools=t,this.tokenPath=u,this.input=e,this.output=null!=n?n:u[u.length-1]}return x(t,[{key:"chainId",get:function(){return this.pools[0].chainId}},{key:"midPrice",get:function(){if(null!==this._midPrice)return this._midPrice;var t=this.pools.slice(1).reduce((function(t,e){var n=t.price;return t.nextInput.equals(e.token0)?{nextInput:e.token1,price:n.multiply(e.token0Price)}:{nextInput:e.token0,price:n.multiply(e.token1Price)}}),this.pools[0].token0.equals(this.input.wrapped)?{nextInput:this.pools[0].token1,price:this.pools[0].token0Price}:{nextInput:this.pools[0].token0,price:this.pools[0].token1Price}).price;return this._midPrice=new i.Price(this.input,this.output,t.denominator,t.numerator)}}]),t}();function wt(t,e){return t.inputAmount.currency.equals(e.inputAmount.currency)||a(!1),t.outputAmount.currency.equals(e.outputAmount.currency)||a(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?t.swaps.reduce((function(t,e){return t+e.route.tokenPath.length}),0)-e.swaps.reduce((function(t,e){return t+e.route.tokenPath.length}),0):t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}var qt=function(){function t(t){var e=t.routes,n=t.tradeType,r=e[0].inputAmount.currency,i=e[0].outputAmount.currency;e.every((function(t){return r.wrapped.equals(t.route.input.wrapped)}))||a(!1),e.every((function(t){return i.wrapped.equals(t.route.output.wrapped)}))||a(!1);for(var o,u=e.map((function(t){return t.route.pools.length})).reduce((function(t,e){return t+e}),0),c=new Set,s=b(e);!(o=s()).done;)for(var p,d=b(o.value.route.pools);!(p=d()).done;){var l=p.value;c.add(Tt.getAddress(l.token0,l.token1,l.fee))}u!==c.size&&a(!1),this.swaps=e,this.tradeType=n}t.exactIn=function(){var e=T(k().mark((function e(n,r){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.fromRoute(n,r,i.TradeType.EXACT_INPUT));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t.exactOut=function(){var e=T(k().mark((function e(n,r){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.fromRoute(n,r,i.TradeType.EXACT_OUTPUT));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t.fromRoute=function(){var e=T(k().mark((function e(n,r,o){var u,c,s,p,d,l,f;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=new Array(n.tokenPath.length),o!==i.TradeType.EXACT_INPUT){e.next=19;break}r.currency.equals(n.input)||a(!1),u[0]=r.wrapped,p=0;case 5:if(!(p<n.tokenPath.length-1)){e.next=15;break}return d=n.pools[p],e.next=9,d.getOutputAmount(u[p]);case 9:u[p+1]=e.sent[0];case 12:p++,e.next=5;break;case 15:c=i.CurrencyAmount.fromFractionalAmount(n.input,r.numerator,r.denominator),s=i.CurrencyAmount.fromFractionalAmount(n.output,u[u.length-1].numerator,u[u.length-1].denominator),e.next=34;break;case 19:r.currency.equals(n.output)||a(!1),u[u.length-1]=r.wrapped,l=n.tokenPath.length-1;case 22:if(!(l>0)){e.next=32;break}return f=n.pools[l-1],e.next=26,f.getInputAmount(u[l]);case 26:u[l-1]=e.sent[0];case 29:l--,e.next=22;break;case 32:c=i.CurrencyAmount.fromFractionalAmount(n.input,u[0].numerator,u[0].denominator),s=i.CurrencyAmount.fromFractionalAmount(n.output,r.numerator,r.denominator);case 34:return e.abrupt("return",new t({routes:[{inputAmount:c,outputAmount:s,route:n}],tradeType:o}));case 35:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.fromRoutes=function(){var e=T(k().mark((function e(n,r){var o,u,c,s,p,d,l,f,h,m,v,y,A;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=[],u=b(n);case 2:if((c=u()).done){e.next=43;break}if(p=(s=c.value).route,d=s.amount,l=new Array(p.tokenPath.length),f=void 0,h=void 0,r!==i.TradeType.EXACT_INPUT){e.next=25;break}d.currency.equals(p.input)||a(!1),f=i.CurrencyAmount.fromFractionalAmount(p.input,d.numerator,d.denominator),l[0]=i.CurrencyAmount.fromFractionalAmount(p.input.wrapped,d.numerator,d.denominator),m=0;case 12:if(!(m<p.tokenPath.length-1)){e.next=22;break}return v=p.pools[m],e.next=16,v.getOutputAmount(l[m]);case 16:l[m+1]=e.sent[0];case 19:m++,e.next=12;break;case 22:h=i.CurrencyAmount.fromFractionalAmount(p.output,l[l.length-1].numerator,l[l.length-1].denominator),e.next=40;break;case 25:d.currency.equals(p.output)||a(!1),h=i.CurrencyAmount.fromFractionalAmount(p.output,d.numerator,d.denominator),l[l.length-1]=i.CurrencyAmount.fromFractionalAmount(p.output.wrapped,d.numerator,d.denominator),y=p.tokenPath.length-1;case 29:if(!(y>0)){e.next=39;break}return A=p.pools[y-1],e.next=33,A.getInputAmount(l[y]);case 33:l[y-1]=e.sent[0];case 36:y--,e.next=29;break;case 39:f=i.CurrencyAmount.fromFractionalAmount(p.input,l[0].numerator,l[0].denominator);case 40:o.push({route:p,inputAmount:f,outputAmount:h});case 41:e.next=2;break;case 43:return e.abrupt("return",new t({routes:o,tradeType:r}));case 44:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t.createUncheckedTrade=function(e){return new t(w({},e,{routes:[{inputAmount:e.inputAmount,outputAmount:e.outputAmount,route:e.route}]}))},t.createUncheckedTradeWithMultipleRoutes=function(e){return new t(e)};var e=t.prototype;return e.minimumAmountOut=function(t,e){if(void 0===e&&(e=this.outputAmount),t.lessThan(F)&&a(!1),this.tradeType===i.TradeType.EXACT_OUTPUT)return e;var n=new i.Fraction(L).add(t).invert().multiply(e.quotient).quotient;return i.CurrencyAmount.fromRawAmount(e.currency,n)},e.maximumAmountIn=function(t,e){if(void 0===e&&(e=this.inputAmount),t.lessThan(F)&&a(!1),this.tradeType===i.TradeType.EXACT_INPUT)return e;var n=new i.Fraction(L).add(t).multiply(e.quotient).quotient;return i.CurrencyAmount.fromRawAmount(e.currency,n)},e.worstExecutionPrice=function(t){return new i.Price(this.inputAmount.currency,this.outputAmount.currency,this.maximumAmountIn(t).quotient,this.minimumAmountOut(t).quotient)},t.bestTradeExactIn=function(){var e=T(k().mark((function e(n,r,o,u,c,s,p){var d,l,f,h,m,v,y,A,g,T,I;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:f=void 0===(l=(d=void 0===u?{}:u).maxNumResults)?3:l,m=void 0===(h=d.maxHops)?3:h,void 0===c&&(c=[]),void 0===s&&(s=r),void 0===p&&(p=[]),n.length>0||a(!1),m>0||a(!1),r===s||c.length>0||a(!1),v=s.wrapped,y=o.wrapped,A=0;case 10:if(!(A<n.length)){e.next=46;break}if((g=n[A]).token0.equals(v.currency)||g.token1.equals(v.currency)){e.next=14;break}return e.abrupt("continue",43);case 14:return T=void 0,e.prev=15,e.next=19,g.getOutputAmount(v);case 19:T=e.sent[0],e.next=28;break;case 23:if(e.prev=23,e.t0=e.catch(15),!e.t0.isInsufficientInputAmountError){e.next=27;break}return e.abrupt("continue",43);case 27:throw e.t0;case 28:if(!T.currency.isToken||!T.currency.equals(y)){e.next=39;break}return e.t1=i.sortedInsert,e.t2=p,e.next=33,t.fromRoute(new xt([].concat(c,[g]),r.currency,o),r,i.TradeType.EXACT_INPUT);case 33:e.t3=e.sent,e.t4=f,e.t5=wt,(0,e.t1)(e.t2,e.t3,e.t4,e.t5),e.next=43;break;case 39:if(!(m>1&&n.length>1)){e.next=43;break}return I=n.slice(0,A).concat(n.slice(A+1,n.length)),e.next=43,t.bestTradeExactIn(I,r,o,{maxNumResults:f,maxHops:m-1},[].concat(c,[g]),T,p);case 43:A++,e.next=10;break;case 46:return e.abrupt("return",p);case 47:case"end":return e.stop()}}),e,null,[[15,23]])})));return function(t,n,r,i,o,a,u){return e.apply(this,arguments)}}(),t.bestTradeExactOut=function(){var e=T(k().mark((function e(n,r,o,u,c,s,p){var d,l,f,h,m,v,y,A,g,T,I;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:f=void 0===(l=(d=void 0===u?{}:u).maxNumResults)?3:l,m=void 0===(h=d.maxHops)?3:h,void 0===c&&(c=[]),void 0===s&&(s=o),void 0===p&&(p=[]),n.length>0||a(!1),m>0||a(!1),o===s||c.length>0||a(!1),v=s.wrapped,y=r.wrapped,A=0;case 10:if(!(A<n.length)){e.next=46;break}if((g=n[A]).token0.equals(v.currency)||g.token1.equals(v.currency)){e.next=14;break}return e.abrupt("continue",43);case 14:return T=void 0,e.prev=15,e.next=19,g.getInputAmount(v);case 19:T=e.sent[0],e.next=28;break;case 23:if(e.prev=23,e.t0=e.catch(15),!e.t0.isInsufficientReservesError){e.next=27;break}return e.abrupt("continue",43);case 27:throw e.t0;case 28:if(!T.currency.equals(y)){e.next=39;break}return e.t1=i.sortedInsert,e.t2=p,e.next=33,t.fromRoute(new xt([g].concat(c),r,o.currency),o,i.TradeType.EXACT_OUTPUT);case 33:e.t3=e.sent,e.t4=f,e.t5=wt,(0,e.t1)(e.t2,e.t3,e.t4,e.t5),e.next=43;break;case 39:if(!(m>1&&n.length>1)){e.next=43;break}return I=n.slice(0,A).concat(n.slice(A+1,n.length)),e.next=43,t.bestTradeExactOut(I,r,o,{maxNumResults:f,maxHops:m-1},[g].concat(c),T,p);case 43:A++,e.next=10;break;case 46:return e.abrupt("return",p);case 47:case"end":return e.stop()}}),e,null,[[15,23]])})));return function(t,n,r,i,o,a,u){return e.apply(this,arguments)}}(),x(t,[{key:"route",get:function(){return 1!==this.swaps.length&&a(!1),this.swaps[0].route}},{key:"inputAmount",get:function(){if(this._inputAmount)return this._inputAmount;var t=this.swaps[0].inputAmount.currency,e=this.swaps.map((function(t){return t.inputAmount})).reduce((function(t,e){return t.add(e)}),i.CurrencyAmount.fromRawAmount(t,0));return this._inputAmount=e,this._inputAmount}},{key:"outputAmount",get:function(){if(this._outputAmount)return this._outputAmount;var t=this.swaps[0].outputAmount.currency,e=this.swaps.map((function(t){return t.outputAmount})).reduce((function(t,e){return t.add(e)}),i.CurrencyAmount.fromRawAmount(t,0));return this._outputAmount=e,this._outputAmount}},{key:"executionPrice",get:function(){var t;return null!=(t=this._executionPrice)?t:this._executionPrice=new i.Price(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.quotient,this.outputAmount.quotient)}},{key:"priceImpact",get:function(){if(this._priceImpact)return this._priceImpact;for(var t,e=i.CurrencyAmount.fromRawAmount(this.outputAmount.currency,0),n=b(this.swaps);!(t=n()).done;){var r=t.value;e=e.add(r.route.midPrice.quote(r.inputAmount))}var o=e.subtract(this.outputAmount).divide(e);return this._priceImpact=new i.Percent(o.numerator,o.denominator),this._priceImpact}}]),t}(),bt=function(){function t(){}return t.encodeMulticall=function(e){return Array.isArray(e)||(e=[e]),1===e.length?e[0]:t.INTERFACE.encodeFunctionData("multicall",[e])},t}();bt.INTERFACE=new u.Interface(p.abi);var Rt=function(){function t(){}return t.encodePermit=function(e,n){return"nonce"in n?t.INTERFACE.encodeFunctionData("selfPermitAllowed",[e.address,ot(n.nonce),ot(n.expiry),n.v,n.r,n.s]):t.INTERFACE.encodeFunctionData("selfPermit",[e.address,ot(n.amount),ot(n.deadline),n.v,n.r,n.s])},t}();Rt.INTERFACE=new u.Interface(l.abi);var Et=function(){function t(){}return t.encodeFeeBips=function(t){return ot(t.multiply(1e4).quotient)},t.encodeUnwrapWETH9=function(e,n,r){if(n=i.validateAndParseAddress(n),r){var o=this.encodeFeeBips(r.fee),a=i.validateAndParseAddress(r.recipient);return t.INTERFACE.encodeFunctionData("unwrapWETH9WithFee",[ot(e),n,o,a])}return t.INTERFACE.encodeFunctionData("unwrapWETH9",[ot(e),n])},t.encodeSweepToken=function(e,n,r,o){if(r=i.validateAndParseAddress(r),o){var a=this.encodeFeeBips(o.fee),u=i.validateAndParseAddress(o.recipient);return t.INTERFACE.encodeFunctionData("sweepTokenWithFee",[e.address,ot(n),r,a,u])}return t.INTERFACE.encodeFunctionData("sweepToken",[e.address,ot(n),r])},t.encodeRefundETH=function(){return t.INTERFACE.encodeFunctionData("refundETH")},t}();Et.INTERFACE=new u.Interface(f.abi);var Pt=["expectedCurrencyOwed0","expectedCurrencyOwed1"],Ct=ot(o.subtract(o.exponentiate(o.BigInt(2),o.BigInt(128)),o.BigInt(1)));function Ot(t){return Object.keys(t).some((function(t){return"recipient"===t}))}var St=function(){function t(){}return t.encodeCreate=function(e){return t.INTERFACE.encodeFunctionData("createAndInitializePoolIfNecessary",[e.token0.address,e.token1.address,e.fee,ot(e.sqrtRatioX96)])},t.createCallParameters=function(t){return{calldata:this.encodeCreate(t),value:ot(0)}},t.addCallParameters=function(e,n){o.greaterThan(e.liquidity,F)||a(!1);var r=[],u=e.mintAmounts,c=u.amount0,s=u.amount1,p=e.mintAmountsWithSlippage(n.slippageTolerance),d=ot(p.amount0),l=ot(p.amount1),f=ot(n.deadline);if(Ot(n)&&n.createPool&&r.push(this.encodeCreate(e.pool)),n.token0Permit&&r.push(Rt.encodePermit(e.pool.token0,n.token0Permit)),n.token1Permit&&r.push(Rt.encodePermit(e.pool.token1,n.token1Permit)),Ot(n)){var h=i.validateAndParseAddress(n.recipient);r.push(t.INTERFACE.encodeFunctionData("mint",[{token0:e.pool.token0.address,token1:e.pool.token1.address,fee:e.pool.fee,tickLower:e.tickLower,tickUpper:e.tickUpper,amount0Desired:ot(c),amount1Desired:ot(s),amount0Min:d,amount1Min:l,recipient:h,deadline:f}]))}else r.push(t.INTERFACE.encodeFunctionData("increaseLiquidity",[{tokenId:ot(n.tokenId),amount0Desired:ot(c),amount1Desired:ot(s),amount0Min:d,amount1Min:l,deadline:f}]));var m=ot(0);if(n.useNative){var v=n.useNative.wrapped;e.pool.token0.equals(v)||e.pool.token1.equals(v)||a(!1);var y=e.pool.token0.equals(v)?c:s;o.greaterThan(y,F)&&r.push(Et.encodeRefundETH()),m=ot(y)}return{calldata:bt.encodeMulticall(r),value:m}},t.encodeCollect=function(e){var n=[],r=ot(e.tokenId),o=e.expectedCurrencyOwed0.currency.isNative||e.expectedCurrencyOwed1.currency.isNative,a=i.validateAndParseAddress(e.recipient);if(n.push(t.INTERFACE.encodeFunctionData("collect",[{tokenId:r,recipient:o?P:a,amount0Max:Ct,amount1Max:Ct}])),o){var u=e.expectedCurrencyOwed0.currency.isNative?e.expectedCurrencyOwed1.currency:e.expectedCurrencyOwed0.currency,c=e.expectedCurrencyOwed0.currency.isNative?e.expectedCurrencyOwed1.quotient:e.expectedCurrencyOwed0.quotient;n.push(Et.encodeUnwrapWETH9(e.expectedCurrencyOwed0.currency.isNative?e.expectedCurrencyOwed0.quotient:e.expectedCurrencyOwed1.quotient,a)),n.push(Et.encodeSweepToken(u,c,a))}return n},t.collectCallParameters=function(e){var n=t.encodeCollect(e);return{calldata:bt.encodeMulticall(n),value:ot(0)}},t.removeCallParameters=function(e,n){var r=[],u=ot(n.deadline),c=ot(n.tokenId),s=new It({pool:e.pool,liquidity:n.liquidityPercentage.multiply(e.liquidity).quotient,tickLower:e.tickLower,tickUpper:e.tickUpper});o.greaterThan(s.liquidity,F)||a(!1);var p=s.burnAmountsWithSlippage(n.slippageTolerance),d=p.amount0,l=p.amount1;n.permit&&r.push(t.INTERFACE.encodeFunctionData("permit",[i.validateAndParseAddress(n.permit.spender),c,ot(n.permit.deadline),n.permit.v,n.permit.r,n.permit.s])),r.push(t.INTERFACE.encodeFunctionData("decreaseLiquidity",[{tokenId:c,liquidity:ot(s.liquidity),amount0Min:ot(d),amount1Min:ot(l),deadline:u}]));var f=n.collectOptions,h=f.expectedCurrencyOwed0,m=f.expectedCurrencyOwed1,v=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)e.indexOf(n=o[r])>=0||(i[n]=t[n]);return i}(f,Pt);return r.push.apply(r,t.encodeCollect(w({tokenId:ot(n.tokenId),expectedCurrencyOwed0:h.add(i.CurrencyAmount.fromRawAmount(h.currency,d)),expectedCurrencyOwed1:m.add(i.CurrencyAmount.fromRawAmount(m.currency,l))},v))),n.liquidityPercentage.equalTo(L)?n.burnToken&&r.push(t.INTERFACE.encodeFunctionData("burn",[c])):!0===n.burnToken&&a(!1),{calldata:bt.encodeMulticall(r),value:ot(0)}},t.safeTransferFromParameters=function(e){var n=i.validateAndParseAddress(e.recipient),r=i.validateAndParseAddress(e.sender);return{calldata:e.data?t.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256,bytes)",[r,n,ot(e.tokenId),e.data]):t.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256)",[r,n,ot(e.tokenId)]),value:ot(0)}},t}();St.INTERFACE=new u.Interface(d.abi);var _t=function(){function t(){}return t.quoteCallParameters=function(t,e,n,r){void 0===r&&(r={});var o,u=1===t.pools.length,c=ot(e.quotient),s=r.useQuoterV2?this.V2INTERFACE:this.V1INTERFACE;if(u){var p,d,l={tokenIn:t.tokenPath[0].address,tokenOut:t.tokenPath[1].address,fee:t.pools[0].fee,sqrtPriceLimitX96:ot(null!=(p=null==(d=r)?void 0:d.sqrtPriceLimitX96)?p:0)},f=w({},l,n===i.TradeType.EXACT_INPUT?{amountIn:c}:{amount:c});o=s.encodeFunctionData(n===i.TradeType.EXACT_INPUT?"quoteExactInputSingle":"quoteExactOutputSingle",r.useQuoterV2?[f]:[l.tokenIn,l.tokenOut,l.fee,c,l.sqrtPriceLimitX96])}else{var h;void 0!==(null==(h=r)?void 0:h.sqrtPriceLimitX96)&&a(!1);var m=at(t,n===i.TradeType.EXACT_OUTPUT);o=s.encodeFunctionData(n===i.TradeType.EXACT_INPUT?"quoteExactInput":"quoteExactOutput",[m,c])}return{calldata:o,value:ot(0)}},t}();_t.V1INTERFACE=new u.Interface(h.abi),_t.V2INTERFACE=new u.Interface(m.abi);var Nt=function(){function t(){}return t.encodeClaim=function(e,n){var r,o=[];o.push(t.INTERFACE.encodeFunctionData("unstakeToken",[this._encodeIncentiveKey(e),ot(n.tokenId)]));var a=i.validateAndParseAddress(n.recipient),u=null!=(r=n.amount)?r:0;return o.push(t.INTERFACE.encodeFunctionData("claimReward",[e.rewardToken.address,a,ot(u)])),o},t.collectRewards=function(e,n){e=Array.isArray(e)?e:[e];for(var r=[],i=0;i<e.length;i++){var o=e[i];(r=r.concat(this.encodeClaim(o,n))).push(t.INTERFACE.encodeFunctionData("stakeToken",[this._encodeIncentiveKey(o),ot(n.tokenId)]))}return{calldata:bt.encodeMulticall(r),value:ot(0)}},t.withdrawToken=function(e,n){var r=[];e=Array.isArray(e)?e:[e];for(var o={tokenId:n.tokenId,recipient:n.recipient,amount:n.amount},a=0;a<e.length;a++)r=r.concat(this.encodeClaim(e[a],o));var u=i.validateAndParseAddress(n.owner);return r.push(t.INTERFACE.encodeFunctionData("withdrawToken",[ot(n.tokenId),u,n.data?n.data:ot(0)])),{calldata:bt.encodeMulticall(r),value:ot(0)}},t.encodeDeposit=function(e){var n;if((e=Array.isArray(e)?e:[e]).length>1){for(var r=[],i=0;i<e.length;i++)r.push(this._encodeIncentiveKey(e[i]));n=u.defaultAbiCoder.encode([t.INCENTIVE_KEY_ABI+"[]"],[r])}else n=u.defaultAbiCoder.encode([t.INCENTIVE_KEY_ABI],[this._encodeIncentiveKey(e[0])]);return n},t._encodeIncentiveKey=function(t){var e=t.pool,n=e.token0,r=e.token1,o=e.fee,a=i.validateAndParseAddress(t.refundee);return{rewardToken:t.rewardToken.address,pool:Tt.getAddress(n,r,o),startTime:ot(t.startTime),endTime:ot(t.endTime),refundee:a}},t}();Nt.INTERFACE=new u.Interface(v.abi),Nt.INCENTIVE_KEY_ABI="tuple(address rewardToken, address pool, uint256 startTime, uint256 endTime, address refundee)";var Ft=function(){function t(){}return t.swapCallParameters=function(e,n){Array.isArray(e)||(e=[e]);var r=e[0],o=r.inputAmount.currency.wrapped,u=r.outputAmount.currency.wrapped;e.every((function(t){return t.inputAmount.currency.wrapped.equals(o)}))||a(!1),e.every((function(t){return t.outputAmount.currency.wrapped.equals(u)}))||a(!1);var c=[],s=i.CurrencyAmount.fromRawAmount(e[0].inputAmount.currency,0),p=i.CurrencyAmount.fromRawAmount(e[0].outputAmount.currency,0),d=e.reduce((function(t,e){return t.add(e.minimumAmountOut(n.slippageTolerance))}),p),l=r.inputAmount.currency.isNative&&r.tradeType===i.TradeType.EXACT_OUTPUT,f=r.outputAmount.currency.isNative,h=f||!!n.fee,m=r.inputAmount.currency.isNative?e.reduce((function(t,e){return t.add(e.maximumAmountIn(n.slippageTolerance))}),s):s;n.inputTokenPermit&&(r.inputAmount.currency.isToken||a(!1),c.push(Rt.encodePermit(r.inputAmount.currency,n.inputTokenPermit)));for(var v,y=i.validateAndParseAddress(n.recipient),k=ot(n.deadline),A=b(e);!(v=A()).done;)for(var g,T=v.value,I=b(T.swaps);!(g=I()).done;){var x=g.value,w=x.route,q=x.outputAmount,R=ot(T.maximumAmountIn(n.slippageTolerance,x.inputAmount).quotient),E=ot(T.minimumAmountOut(n.slippageTolerance,q).quotient);if(1===w.pools.length)if(T.tradeType===i.TradeType.EXACT_INPUT){var C,O={tokenIn:w.tokenPath[0].address,tokenOut:w.tokenPath[1].address,fee:w.pools[0].fee,recipient:h?P:y,deadline:k,amountIn:R,amountOutMinimum:E,sqrtPriceLimitX96:ot(null!=(C=n.sqrtPriceLimitX96)?C:0)};c.push(t.INTERFACE.encodeFunctionData("exactInputSingle",[O]))}else{var S,_={tokenIn:w.tokenPath[0].address,tokenOut:w.tokenPath[1].address,fee:w.pools[0].fee,recipient:h?P:y,deadline:k,amountOut:E,amountInMaximum:R,sqrtPriceLimitX96:ot(null!=(S=n.sqrtPriceLimitX96)?S:0)};c.push(t.INTERFACE.encodeFunctionData("exactOutputSingle",[_]))}else{void 0!==n.sqrtPriceLimitX96&&a(!1);var N=at(w,T.tradeType===i.TradeType.EXACT_OUTPUT);c.push(T.tradeType===i.TradeType.EXACT_INPUT?t.INTERFACE.encodeFunctionData("exactInput",[{path:N,recipient:h?P:y,deadline:k,amountIn:R,amountOutMinimum:E}]):t.INTERFACE.encodeFunctionData("exactOutput",[{path:N,recipient:h?P:y,deadline:k,amountOut:E,amountInMaximum:R}]))}}return h&&c.push(n.fee?f?Et.encodeUnwrapWETH9(d.quotient,y,n.fee):Et.encodeSweepToken(r.outputAmount.currency.wrapped,d.quotient,y,n.fee):Et.encodeUnwrapWETH9(d.quotient,y)),l&&c.push(Et.encodeRefundETH()),{calldata:bt.encodeMulticall(c),value:ot(m.quotient)}},t}();Ft.INTERFACE=new u.Interface(y.abi),exports.ADDRESS_ZERO=P,exports.FACTORY_ADDRESS="0x8E994Dbd9d91dF55A711D24B14739ab410CAC1E7",exports.FACTORY_ADDRESS_BY_CHAIN_ID=E,exports.FullMath=U,exports.LiquidityMath=K,exports.Multicall=bt,exports.NoTickDataProvider=et,exports.NonfungiblePositionManager=St,exports.POOL_INIT_CODE_HASH=C,exports.POOL_INIT_CODE_HASH_BY_CHAIN_ID=O,exports.Payments=Et,exports.Pool=Tt,exports.Position=It,exports.PositionLibrary=ft,exports.Route=xt,exports.SelfPermit=Rt,exports.SqrtPriceMath=j,exports.Staker=Nt,exports.SwapMath=G,exports.SwapQuoter=_t,exports.SwapRouter=Ft,exports.TICK_SPACINGS=_,exports.Tick=kt,exports.TickLibrary=yt,exports.TickList=it,exports.TickListDataProvider=At,exports.TickMath=$,exports.Trade=qt,exports.computePoolAddress=D,exports.encodeRouteToPath=at,exports.encodeSqrtRatioX96=ut,exports.isSorted=nt,exports.maxLiquidityForAmounts=dt,exports.mostSignificantBit=z,exports.nearestUsableTick=function(t,e){Number.isInteger(t)&&Number.isInteger(e)||a(!1),e>0||a(!1),t>=$.MIN_TICK&&t<=$.MAX_TICK||a(!1);var n=Math.round(t/e)*e;return n<$.MIN_TICK?n+e:n>$.MAX_TICK?n-e:n},exports.poolInitCodeHash=S,exports.priceToClosestTick=function(t){var e=t.baseCurrency.sortsBefore(t.quoteCurrency),n=e?ut(t.numerator,t.denominator):ut(t.denominator,t.numerator),r=$.getTickAtSqrtRatio(n),i=ht(t.baseCurrency,t.quoteCurrency,r+1);return e?t.lessThan(i)||r++:t.greaterThan(i)||r++,r},exports.subIn256=vt,exports.tickToPrice=ht,exports.toHex=ot,exports.tradeComparator=wt,exports.v3Swap=J;
2
+ //# sourceMappingURL=v3-sdk.cjs.production.min.js.map