New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uniswap/v4-sdk

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniswap/v4-sdk - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1

2

dist/v4-sdk.cjs.production.min.js

@@ -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,n=t(require("tiny-invariant")),r=require("@ethersproject/solidity"),i=require("@uniswap/sdk-core"),o=require("@uniswap/v3-sdk"),a=require("ethers/lib/utils"),u=t(require("jsbi")),s=require("ethers"),c=require("@ethersproject/abi"),p=t(require("@uniswap/v3-periphery/artifacts/contracts/interfaces/IMulticall.sol/IMulticall.json"));function y(){y=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",s=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=Object.create((e&&e.prototype instanceof T?e:T).prototype),a=new q(r||[]);return i(o,"_invoke",{value:x(t,n,a)}),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var d="suspendedStart",m="executing",h="completed",f={};function T(){}function A(){}function v(){}var k={};c(k,a,(function(){return this}));var b=Object.getPrototypeOf,g=b&&b(b(L([])));g&&g!==n&&r.call(g,a)&&(k=g);var I=v.prototype=T.prototype=Object.create(k);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(i,o,a,u){var s=l(t[i],t,o);if("throw"!==s.type){var c=s.arg,p=c.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){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(s.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 x(e,n,r){var i=d;return function(o,a){if(i===m)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 s=S(u,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var c=l(e,n,r);if("normal"===c.type){if(i=r.done?h:"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=h,r.method="throw",r.arg=c.arg)}}}function S(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,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,f;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,f):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}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 _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(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 A.prototype=v,i(I,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:A,configurable:!0}),A.displayName=c(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===A||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,s,"GeneratorFunction")),t.prototype=Object.create(I),t},e.awrap=function(t){return{__await:t}},w(P.prototype),c(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new P(p(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(I),c(I,s,"Generator"),c(I,a,(function(){return this})),c(I,"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=L,q.prototype={constructor:q,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(_),!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 s=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)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,f):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),f},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),_(n),f}},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;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),f}},e}function l(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 d(t,e,n,r,i,o,a){try{var u=t[o](a),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(r,i)}function m(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){d(o,r,i,a,u,"next",t)}function u(t){d(o,r,i,a,u,"throw",t)}a(void 0)}))}}function h(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,l(r.key),r)}}function f(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(){return(T=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 A(t,e){return(A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function v(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 k(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 v(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)?v(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.")}function b(t,e){return!!t.isNative||!e.isNative&&t.wrapped.sortsBefore(e.wrapped)}var g,I,w=s.constants.AddressZero,P=u.BigInt(-1),x=u.BigInt(0),S=u.BigInt(1),E=u.exponentiate(u.exponentiate(u.BigInt(2),u.BigInt(96)),u.BigInt(2));!function(t){t.INITIALIZE_POOL="initializePool",t.MODIFY_LIQUIDITIES="modifyLiquidities",t.PERMIT_BATCH="0x002a3e3a",t.ERC721PERMIT_PERMIT="0x0f5730f1"}(g||(g={})),function(t){t[t.LOWEST=100]="LOWEST",t[t.LOW=500]="LOW",t[t.MEDIUM=3e3]="MEDIUM",t[t.HIGH=1e4]="HIGH"}(I||(I={})),(e={})[I.LOWEST]=1,e[I.LOW]=10,e[I.MEDIUM]=60,e[I.HIGH]=200;var _=new o.NoTickDataProvider,q=function(){function t(e,r,i,s,c,p,y,l,d){void 0===d&&(d=_),a.isAddress(c)||n(!1),Number.isInteger(i)&&(8388608===i||i<1e6)||n(!1),8388608===i&&(Number(c)>0||n(!1));var m=o.TickMath.getSqrtRatioAtTick(l),h=o.TickMath.getSqrtRatioAtTick(l+1);u.greaterThanOrEqual(u.BigInt(p),m)&&u.lessThanOrEqual(u.BigInt(p),h)||n(!1);var f=b(e,r)?[e,r]:[r,e];this.currency0=f[0],this.currency1=f[1],this.fee=i,this.sqrtRatioX96=u.BigInt(p),this.tickSpacing=s,this.hooks=c,this.liquidity=u.BigInt(y),this.tickCurrent=l,this.tickDataProvider=Array.isArray(d)?new o.TickListDataProvider(d,s):d,this.poolKey=t.getPoolKey(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks),this.poolId=t.getPoolId(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks)}t.getPoolKey=function(t,e,r,i,o){a.isAddress(o)||n(!1);var u=b(t,e)?[t,e]:[e,t],s=u[0],c=u[1];return{currency0:s.isNative?w:s.wrapped.address,currency1:c.isNative?w:c.wrapped.address,fee:r,tickSpacing:i,hooks:o}},t.getPoolId=function(t,e,n,i,o){var u=b(t,e)?[t,e]:[e,t],s=u[0],c=u[1];return r.keccak256(["bytes"],[a.defaultAbiCoder.encode(["address","address","uint24","int24","address"],[s.isNative?w:s.wrapped.address,c.isNative?w:c.wrapped.address,n,i,o])])};var e=t.prototype;return e.involvesCurrency=function(t){return t.equals(this.currency0)||t.equals(this.currency1)},e.involvesToken=function(t){return this.involvesCurrency(t)},e.priceOf=function(t){return this.involvesCurrency(t)||n(!1),t.equals(this.currency0)?this.currency0Price:this.currency1Price},e.getOutputAmount=function(){var e=m(y().mark((function e(r,o){var a,s,c,p,l;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.involvesCurrency(r.currency)||n(!1),a=r.currency.equals(this.currency0),e.next=4,this.swap(a,r.quotient,o);case 4:return c=(s=e.sent).sqrtRatioX96,p=s.liquidity,l=s.tickCurrent,e.abrupt("return",[i.CurrencyAmount.fromRawAmount(a?this.currency1:this.currency0,u.multiply(s.amountCalculated,P)),new t(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks,c,p,l,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=m(y().mark((function e(r,o){var a,s,c,p,l;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.involvesCurrency(r.currency)||n(!1),a=r.currency.equals(this.currency1),e.next=4,this.swap(a,u.multiply(r.quotient,P),o);case 4:return c=(s=e.sent).sqrtRatioX96,p=s.liquidity,l=s.tickCurrent,e.abrupt("return",[i.CurrencyAmount.fromRawAmount(a?this.currency0:this.currency1,s.amountCalculated),new t(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks,c,p,l,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=m(y().mark((function t(e,n,r){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.nonImpactfulHook()){t.next=4;break}return t.abrupt("return",o.v3Swap(u.BigInt(this.fee),this.sqrtRatioX96,this.tickCurrent,this.liquidity,this.tickSpacing,this.tickDataProvider,e,n,r));case 4:throw new Error("Unsupported hook");case 5:case"end":return t.stop()}}),t,this)})));return function(e,n,r){return t.apply(this,arguments)}}(),e.nonImpactfulHook=function(){return this.hooks===w},f(t,[{key:"token0",get:function(){return this.currency0}},{key:"token1",get:function(){return this.currency1}},{key:"currency0Price",get:function(){var t;return null!=(t=this._currency0Price)?t:this._currency0Price=new i.Price(this.currency0,this.currency1,E,u.multiply(this.sqrtRatioX96,this.sqrtRatioX96))}},{key:"token0Price",get:function(){return this.currency0Price}},{key:"currency1Price",get:function(){var t;return null!=(t=this._currency1Price)?t:this._currency1Price=new i.Price(this.currency1,this.currency0,u.multiply(this.sqrtRatioX96,this.sqrtRatioX96),E)}},{key:"token1Price",get:function(){return this.currency1Price}},{key:"chainId",get:function(){return this.currency0.chainId}}]),t}(),L=function(){function t(t,e,r){this._midPrice=null,t.length>0||n(!1);var i=t[0].chainId;t.every((function(t){return t.chainId===i}))||n(!1),t[0].involvesCurrency(e)||n(!1),t[t.length-1].involvesCurrency(r)||n(!1);for(var o,a=[e],u=k(t.entries());!(o=u()).done;){var s=o.value,c=s[1],p=a[s[0]];p.equals(c.currency0)||p.equals(c.currency1)||n(!1);var y=p.equals(c.currency0)?c.currency1:c.currency0;a.push(y)}this.pools=t,this.currencyPath=a,this.input=e,this.output=null!=r?r:a[a.length-1]}return f(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.currency0)?{nextInput:e.currency1,price:n.multiply(e.currency0Price)}:{nextInput:e.currency0,price:n.multiply(e.currency1Price)}}),this.pools[0].currency0.equals(this.input)?{nextInput:this.pools[0].currency1,price:this.pools[0].currency0Price}:{nextInput:this.pools[0].currency0,price:this.pools[0].currency1Price}).price;return this._midPrice=new i.Price(this.input,this.output,t.denominator,t.numerator)}}]),t}();function M(t,e){return t.inputAmount.currency.equals(e.inputAmount.currency)||n(!1),t.outputAmount.currency.equals(e.outputAmount.currency)||n(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?t.swaps.reduce((function(t,e){return t+e.route.currencyPath.length}),0)-e.swaps.reduce((function(t,e){return t+e.route.currencyPath.length}),0):t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}var R=function(){function t(t){var e=t.routes,r=t.tradeType,i=e[0].inputAmount.currency,o=e[0].outputAmount.currency;e.every((function(t){return i.equals(t.route.input)}))||n(!1),e.every((function(t){return o.equals(t.route.output)}))||n(!1);for(var a,u=e.map((function(t){return t.route.pools.length})).reduce((function(t,e){return t+e}),0),s=new Set,c=k(e);!(a=c()).done;)for(var p,y=k(a.value.route.pools);!(p=y()).done;){var l=p.value;s.add(q.getPoolId(l.currency0,l.currency1,l.fee,l.tickSpacing,l.hooks))}u!==s.size&&n(!1),this.swaps=e,this.tradeType=r}t.exactIn=function(){var e=m(y().mark((function e(n,r){return y().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=m(y().mark((function e(n,r){return y().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=m(y().mark((function e(r,o,a){var u,s,c,p,l,d,m;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=new Array(r.currencyPath.length),a!==i.TradeType.EXACT_INPUT){e.next=19;break}o.currency.equals(r.input)||n(!1),u[0]=o,p=0;case 5:if(!(p<r.currencyPath.length-1)){e.next=15;break}return l=r.pools[p],e.next=9,l.getOutputAmount(u[p]);case 9:u[p+1]=e.sent[0];case 12:p++,e.next=5;break;case 15:s=i.CurrencyAmount.fromFractionalAmount(r.input,o.numerator,o.denominator),c=i.CurrencyAmount.fromFractionalAmount(r.output,u[u.length-1].numerator,u[u.length-1].denominator),e.next=34;break;case 19:o.currency.equals(r.output)||n(!1),u[u.length-1]=o,d=r.currencyPath.length-1;case 22:if(!(d>0)){e.next=32;break}return m=r.pools[d-1],e.next=26,m.getInputAmount(u[d]);case 26:u[d-1]=e.sent[0];case 29:d--,e.next=22;break;case 32:s=i.CurrencyAmount.fromFractionalAmount(r.input,u[0].numerator,u[0].denominator),c=i.CurrencyAmount.fromFractionalAmount(r.output,o.numerator,o.denominator);case 34:return e.abrupt("return",new t({routes:[{inputAmount:s,outputAmount:c,route:r}],tradeType:a}));case 35:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.fromRoutes=function(){var e=m(y().mark((function e(r,o){var a,u,s,c,p,l,d,m,h,f,T,A,v;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=[],u=k(r);case 2:if((s=u()).done){e.next=43;break}if(p=(c=s.value).route,l=c.amount,d=new Array(p.currencyPath.length),m=void 0,h=void 0,o!==i.TradeType.EXACT_INPUT){e.next=25;break}l.currency.equals(p.input)||n(!1),m=i.CurrencyAmount.fromFractionalAmount(p.input,l.numerator,l.denominator),d[0]=i.CurrencyAmount.fromFractionalAmount(p.input,l.numerator,l.denominator),f=0;case 12:if(!(f<p.currencyPath.length-1)){e.next=22;break}return T=p.pools[f],e.next=16,T.getOutputAmount(d[f]);case 16:d[f+1]=e.sent[0];case 19:f++,e.next=12;break;case 22:h=i.CurrencyAmount.fromFractionalAmount(p.output,d[d.length-1].numerator,d[d.length-1].denominator),e.next=40;break;case 25:l.currency.equals(p.output)||n(!1),h=i.CurrencyAmount.fromFractionalAmount(p.output,l.numerator,l.denominator),d[d.length-1]=i.CurrencyAmount.fromFractionalAmount(p.output,l.numerator,l.denominator),A=p.currencyPath.length-1;case 29:if(!(A>0)){e.next=39;break}return v=p.pools[A-1],e.next=33,v.getInputAmount(d[A]);case 33:d[A-1]=e.sent[0];case 36:A--,e.next=29;break;case 39:m=i.CurrencyAmount.fromFractionalAmount(p.input,d[0].numerator,d[0].denominator);case 40:a.push({route:p,inputAmount:m,outputAmount:h});case 41:e.next=2;break;case 43:return e.abrupt("return",new t({routes:a,tradeType:o}));case 44:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t.createUncheckedTrade=function(e){return new t(T({},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(x)&&n(!1),this.tradeType===i.TradeType.EXACT_OUTPUT)return e;var r=new i.Fraction(S).add(t).invert().multiply(e.quotient).quotient;return i.CurrencyAmount.fromRawAmount(e.currency,r)},e.maximumAmountIn=function(t,e){if(void 0===e&&(e=this.inputAmount),t.lessThan(x)&&n(!1),this.tradeType===i.TradeType.EXACT_INPUT)return e;var r=new i.Fraction(S).add(t).multiply(e.quotient).quotient;return i.CurrencyAmount.fromRawAmount(e.currency,r)},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=m(y().mark((function e(r,o,a,u,s,c,p){var l,d,m,h,f,T,A,v,k,b;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m=void 0===(d=(l=void 0===u?{}:u).maxNumResults)?3:d,f=void 0===(h=l.maxHops)?3:h,void 0===s&&(s=[]),void 0===c&&(c=o),void 0===p&&(p=[]),r.length>0||n(!1),f>0||n(!1),o===c||s.length>0||n(!1),T=c,A=0;case 9:if(!(A<r.length)){e.next=45;break}if((v=r[A]).currency0.equals(T.currency)||v.currency1.equals(T.currency)){e.next=13;break}return e.abrupt("continue",42);case 13:return k=void 0,e.prev=14,e.next=18,v.getOutputAmount(T);case 18:k=e.sent[0],e.next=27;break;case 22:if(e.prev=22,e.t0=e.catch(14),!e.t0.isInsufficientInputAmountError){e.next=26;break}return e.abrupt("continue",42);case 26:throw e.t0;case 27:if(!k.currency.equals(a)){e.next=38;break}return e.t1=i.sortedInsert,e.t2=p,e.next=32,t.fromRoute(new L([].concat(s,[v]),o.currency,a),o,i.TradeType.EXACT_INPUT);case 32:e.t3=e.sent,e.t4=m,e.t5=M,(0,e.t1)(e.t2,e.t3,e.t4,e.t5),e.next=42;break;case 38:if(!(f>1&&r.length>1)){e.next=42;break}return b=r.slice(0,A).concat(r.slice(A+1,r.length)),e.next=42,t.bestTradeExactIn(b,o,a,{maxNumResults:m,maxHops:f-1},[].concat(s,[v]),k,p);case 42:A++,e.next=9;break;case 45:return e.abrupt("return",p);case 46:case"end":return e.stop()}}),e,null,[[14,22]])})));return function(t,n,r,i,o,a,u){return e.apply(this,arguments)}}(),t.bestTradeExactOut=function(){var e=m(y().mark((function e(r,o,a,u,s,c,p){var l,d,m,h,f,T,A,v,k,b;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m=void 0===(d=(l=void 0===u?{}:u).maxNumResults)?3:d,f=void 0===(h=l.maxHops)?3:h,void 0===s&&(s=[]),void 0===c&&(c=a),void 0===p&&(p=[]),r.length>0||n(!1),f>0||n(!1),a===c||s.length>0||n(!1),T=c,A=0;case 9:if(!(A<r.length)){e.next=45;break}if((v=r[A]).currency0.equals(T.currency)||v.currency1.equals(T.currency)){e.next=13;break}return e.abrupt("continue",42);case 13:return k=void 0,e.prev=14,e.next=18,v.getInputAmount(T);case 18:k=e.sent[0],e.next=27;break;case 22:if(e.prev=22,e.t0=e.catch(14),!e.t0.isInsufficientReservesError){e.next=26;break}return e.abrupt("continue",42);case 26:throw e.t0;case 27:if(!k.currency.equals(o)){e.next=38;break}return e.t1=i.sortedInsert,e.t2=p,e.next=32,t.fromRoute(new L([v].concat(s),o,a.currency),a,i.TradeType.EXACT_OUTPUT);case 32:e.t3=e.sent,e.t4=m,e.t5=M,(0,e.t1)(e.t2,e.t3,e.t4,e.t5),e.next=42;break;case 38:if(!(f>1&&r.length>1)){e.next=42;break}return b=r.slice(0,A).concat(r.slice(A+1,r.length)),e.next=42,t.bestTradeExactOut(b,o,a,{maxNumResults:m,maxHops:f-1},[v].concat(s),k,p);case 42:A++,e.next=9;break;case 45:return e.abrupt("return",p);case 46:case"end":return e.stop()}}),e,null,[[14,22]])})));return function(t,n,r,i,o,a,u){return e.apply(this,arguments)}}(),f(t,[{key:"route",get:function(){return 1!==this.swaps.length&&n(!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=k(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}();function C(t,e,n){var r=o.TickMath.getSqrtRatioAtTick(n),a=u.multiply(r,r);return b(t,e)?new i.Price(t,e,E,a):new i.Price(t,e,a,E)}var O,N,U=function(){function t(t){var e=t.pool,r=t.liquidity,i=t.tickLower,a=t.tickUpper;this._token0Amount=null,this._token1Amount=null,this._mintAmounts=null,i<a||n(!1),i>=o.TickMath.MIN_TICK&&i%e.tickSpacing==0||n(!1),a<=o.TickMath.MAX_TICK&&a%e.tickSpacing==0||n(!1),this.pool=e,this.tickLower=i,this.tickUpper=a,this.liquidity=u.BigInt(r)}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=o.encodeSqrtRatioX96(e.numerator,e.denominator);u.lessThanOrEqual(r,o.TickMath.MIN_SQRT_RATIO)&&(r=u.add(o.TickMath.MIN_SQRT_RATIO,u.BigInt(1)));var a=o.encodeSqrtRatioX96(n.numerator,n.denominator);return u.greaterThanOrEqual(a,o.TickMath.MAX_SQRT_RATIO)&&(a=u.subtract(o.TickMath.MAX_SQRT_RATIO,u.BigInt(1))),{sqrtRatioX96Lower:r,sqrtRatioX96Upper:a}},e.mintAmountsWithSlippage=function(e){var n=this.ratiosAfterSlippage(e),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,a=new q(this.pool.token0,this.pool.token1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,i,0,o.TickMath.getTickAtSqrtRatio(i)),u=new q(this.pool.token0,this.pool.token1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,r,0,o.TickMath.getTickAtSqrtRatio(r)),s=t.fromAmounts(T({pool:this.pool,tickLower:this.tickLower,tickUpper:this.tickUpper},this.mintAmounts,{useFullPrecision:!1})),c=new t({pool:u,liquidity:s.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount1;return{amount0:new t({pool:a,liquidity:s.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount0,amount1:c}},e.burnAmountsWithSlippage=function(e){var n=this.ratiosAfterSlippage(e),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,a=new q(this.pool.currency0,this.pool.currency1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,i,0,o.TickMath.getTickAtSqrtRatio(i)),u=new t({pool:new q(this.pool.currency0,this.pool.currency1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,r,0,o.TickMath.getTickAtSqrtRatio(r)),liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount0,s=new t({pool:a,liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount1;return{amount0:u.quotient,amount1:s.quotient}},e.permitBatchData=function(t,e,n,r){var i=this.mintAmountsWithSlippage(t);return{details:[{token:this.pool.currency0.wrapped.address,amount:i.amount0,expiration:r,nonce:n},{token:this.pool.currency1.wrapped.address,amount:i.amount1,expiration:r,nonce:n}],spender:e,sigDeadline:r}},t.fromAmounts=function(e){var n=e.pool,r=e.tickLower,i=e.tickUpper,a=e.amount0,u=e.amount1,s=e.useFullPrecision,c=o.TickMath.getSqrtRatioAtTick(r),p=o.TickMath.getSqrtRatioAtTick(i);return new t({pool:n,tickLower:r,tickUpper:i,liquidity:o.maxLiquidityForAmounts(n.sqrtRatioX96,c,p,a,u,s)})},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})},f(t,[{key:"token0PriceLower",get:function(){return C(this.pool.currency0,this.pool.currency1,this.tickLower)}},{key:"token0PriceUpper",get:function(){return C(this.pool.currency0,this.pool.currency1,this.tickUpper)}},{key:"amount0",get:function(){return this._token0Amount||(this._token0Amount=i.CurrencyAmount.fromRawAmount(this.pool.currency0,this.pool.tickCurrent<this.tickLower?o.SqrtPriceMath.getAmount0Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):this.pool.tickCurrent<this.tickUpper?o.SqrtPriceMath.getAmount0Delta(this.pool.sqrtRatioX96,o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):x)),this._token0Amount}},{key:"amount1",get:function(){return this._token1Amount||(this._token1Amount=i.CurrencyAmount.fromRawAmount(this.pool.currency1,this.pool.tickCurrent<this.tickLower?x:o.SqrtPriceMath.getAmount1Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),this.pool.tickCurrent<this.tickUpper?this.pool.sqrtRatioX96:o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1))),this._token1Amount}},{key:"mintAmounts",get:function(){return null===this._mintAmounts?this.pool.tickCurrent<this.tickLower?{amount0:o.SqrtPriceMath.getAmount0Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:x}:this.pool.tickCurrent<this.tickUpper?{amount0:o.SqrtPriceMath.getAmount0Delta(this.pool.sqrtRatioX96,o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:o.SqrtPriceMath.getAmount1Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),this.pool.sqrtRatioX96,this.liquidity,!0)}:{amount0:x,amount1:o.SqrtPriceMath.getAmount1Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0)}:this._mintAmounts}}]),t}(),D=function(t,e){for(var n,r=e?t.output:t.input,i=[],o=k(e?t.pools.reverse():t.pools);!(n=o()).done;){var a=n.value,u=r.equals(a.currency0)?a.currency1:a.currency0;i.push({intermediateCurrency:u.isNative?w:u.address,fee:a.fee,tickSpacing:a.tickSpacing,hooks:a.hooks,hookData:"0x"}),r=u}return e?i.reverse():i};(N=exports.Actions||(exports.Actions={}))[N.INCREASE_LIQUIDITY=0]="INCREASE_LIQUIDITY",N[N.DECREASE_LIQUIDITY=1]="DECREASE_LIQUIDITY",N[N.MINT_POSITION=2]="MINT_POSITION",N[N.BURN_POSITION=3]="BURN_POSITION",N[N.SWAP_EXACT_IN_SINGLE=4]="SWAP_EXACT_IN_SINGLE",N[N.SWAP_EXACT_IN=5]="SWAP_EXACT_IN",N[N.SWAP_EXACT_OUT_SINGLE=6]="SWAP_EXACT_OUT_SINGLE",N[N.SWAP_EXACT_OUT=7]="SWAP_EXACT_OUT",N[N.SETTLE=9]="SETTLE",N[N.SETTLE_ALL=16]="SETTLE_ALL",N[N.SETTLE_PAIR=17]="SETTLE_PAIR",N[N.TAKE=18]="TAKE",N[N.TAKE_ALL=19]="TAKE_ALL",N[N.TAKE_PORTION=20]="TAKE_PORTION",N[N.TAKE_PAIR=21]="TAKE_PAIR",N[N.SETTLE_TAKE_PAIR=22]="SETTLE_TAKE_PAIR",N[N.CLOSE_CURRENCY=23]="CLOSE_CURRENCY",N[N.SWEEP=25]="SWEEP";var F=((O={})[exports.Actions.INCREASE_LIQUIDITY]=["uint256 tokenId","uint256 liquidity","uint128 amount0Max","uint128 amount1Max","bytes hookData"],O[exports.Actions.DECREASE_LIQUIDITY]=["uint256 tokenId","uint256 liquidity","uint128 amount0Min","uint128 amount1Min","bytes hookData"],O[exports.Actions.MINT_POSITION]=["(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)","int24 tickLower","int24 tickUpper","uint256 liquidity","uint128 amount0Max","uint128 amount1Max","address owner","bytes hookData"],O[exports.Actions.BURN_POSITION]=["uint256 tokenId","uint128 amount0Min","uint128 amount1Min","bytes hookData"],O[exports.Actions.SWAP_EXACT_IN_SINGLE]=["((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint160 sqrtPriceLimitX96,bytes hookData)"],O[exports.Actions.SWAP_EXACT_IN]=["(address currencyIn,(address intermediateCurrency,uint256 fee,int24 tickSpacing,address hooks,bytes hookData)[] path,uint128 amountIn,uint128 amountOutMinimum)"],O[exports.Actions.SWAP_EXACT_OUT_SINGLE]=["((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountOut,uint128 amountInMaximum,uint160 sqrtPriceLimitX96,bytes hookData)"],O[exports.Actions.SWAP_EXACT_OUT]=["(address currencyOut,(address intermediateCurrency,uint256 fee,int24 tickSpacing,address hooks,bytes hookData)[] path,uint128 amountOut,uint128 amountInMaximum)"],O[exports.Actions.SETTLE]=["address","uint256","bool"],O[exports.Actions.SETTLE_ALL]=["address","uint256"],O[exports.Actions.SETTLE_PAIR]=["address","address"],O[exports.Actions.TAKE]=["address","address","uint256"],O[exports.Actions.TAKE_ALL]=["address","uint256"],O[exports.Actions.TAKE_PORTION]=["address","address","uint256"],O[exports.Actions.TAKE_PAIR]=["address","address","address"],O[exports.Actions.SETTLE_TAKE_PAIR]=["address","address"],O[exports.Actions.CLOSE_CURRENCY]=["address"],O[exports.Actions.SWEEP]=["address","address"],O),X=function(){function t(){this.actions="0x",this.params=[]}var e=t.prototype;return e.addAction=function(t,e){var n=function(t,e){return{action:t,encodedInput:a.defaultAbiCoder.encode(F[t],e)}}(t,e);this.params.push(n.encodedInput),this.actions=this.actions.concat(n.action.toString(16).padStart(2,"0"))},e.addTrade=function(t,e){var r=t.tradeType===i.TradeType.EXACT_OUTPUT;r&&(e||n(!1)),1!==t.swaps.length&&n(!1);var o=r?exports.Actions.SWAP_EXACT_OUT:exports.Actions.SWAP_EXACT_IN,a=W(t.inputAmount.currency),u=W(t.outputAmount.currency);this.addAction(o,[r?{currencyOut:u,path:D(t.route,r),amountInMaximum:t.maximumAmountIn(null!=e?e:new i.Percent(0)).quotient.toString(),amountOut:t.inputAmount.quotient.toString()}:{currencyIn:a,path:D(t.route,r),amountIn:t.inputAmount.quotient.toString(),amountOutMinimum:e?t.minimumAmountOut(e).quotient.toString():0}])},e.addSettle=function(t,e,n){this.addAction(exports.Actions.SETTLE,[W(t),null!=n?n:0,e])},e.addTake=function(t,e,n){var r=e?"0x0000000000000000000000000000000000000002":"0x0000000000000000000000000000000000000001",i=null!=n?n:0;this.addAction(exports.Actions.TAKE,[W(t),r,i])},e.finalize=function(){return a.defaultAbiCoder.encode(["bytes","bytes[]"],[this.actions,this.params])},t}();function W(t){return t.isNative?w:t.wrapped.address}function j(t){return t.isNative?w:t.wrapped.address}var B=function(t){var e,n;function r(){return t.apply(this,arguments)||this}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,A(e,n);var i=r.prototype;return i.addMint=function(t,e,n,r,i,o,a,u){void 0===u&&(u="0x");var s=[q.getPoolKey(t.currency0,t.currency1,t.fee,t.tickSpacing,t.hooks),e,n,r.toString(),i.toString(),o.toString(),a,u];this.addAction(exports.Actions.MINT_POSITION,s)},i.addIncrease=function(t,e,n,r,i){void 0===i&&(i="0x");var o=[t.toString(),e.toString(),n.toString(),r.toString(),i];this.addAction(exports.Actions.INCREASE_LIQUIDITY,o)},i.addDecrease=function(t,e,n,r,i){void 0===i&&(i="0x");var o=[t.toString(),e.toString(),n.toString(),r.toString(),i];this.addAction(exports.Actions.DECREASE_LIQUIDITY,o)},i.addBurn=function(t,e,n,r){void 0===r&&(r="0x");var i=[t.toString(),e.toString(),n.toString(),r];this.addAction(exports.Actions.BURN_POSITION,i)},i.addSettlePair=function(t,e){var n=[j(t),j(e)];this.addAction(exports.Actions.SETTLE_PAIR,n)},i.addTakePair=function(t,e,n){var r=[j(t),j(e),n];this.addAction(exports.Actions.TAKE_PAIR,r)},i.addSweep=function(t,e){var n=[j(t),e];this.addAction(exports.Actions.SWEEP,n)},r}(X);function K(t){var e=u.BigInt(t).toString(16);return e.length%2!=0&&(e="0"+e),"0x"+e}var G="0x0000000000000000000000000000000000000001",H=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.decodeMulticall=function(e){return t.INTERFACE.decodeFunctionData("multicall",e)[0]},t}();H.INTERFACE=new c.Interface(p.abi);var Y=[{type:"constructor",inputs:[{name:"_poolManager",type:"address",internalType:"contract IPoolManager"},{name:"_permit2",type:"address",internalType:"contract IAllowanceTransfer"},{name:"_unsubscribeGasLimit",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getPoolAndPositionInfo",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"poolKey",type:"tuple",internalType:"struct PoolKey",components:[{name:"currency0",type:"address",internalType:"Currency"},{name:"currency1",type:"address",internalType:"Currency"},{name:"fee",type:"uint24",internalType:"uint24"},{name:"tickSpacing",type:"int24",internalType:"int24"},{name:"hooks",type:"address",internalType:"contract IHooks"}]},{name:"info",type:"uint256",internalType:"PositionInfo"}],stateMutability:"view"},{type:"function",name:"getPositionLiquidity",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"liquidity",type:"uint128",internalType:"uint128"}],stateMutability:"view"},{type:"function",name:"initializePool",inputs:[{name:"key",type:"tuple",internalType:"struct PoolKey",components:[{name:"currency0",type:"address",internalType:"Currency"},{name:"currency1",type:"address",internalType:"Currency"},{name:"fee",type:"uint24",internalType:"uint24"},{name:"tickSpacing",type:"int24",internalType:"int24"},{name:"hooks",type:"address",internalType:"contract IHooks"}]},{name:"sqrtPriceX96",type:"uint160",internalType:"uint160"},{name:"hookData",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"int24",internalType:"int24"}],stateMutability:"payable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"modifyLiquidities",inputs:[{name:"unlockData",type:"bytes",internalType:"bytes"},{name:"deadline",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"payable"},{type:"function",name:"modifyLiquiditiesWithoutUnlock",inputs:[{name:"actions",type:"bytes",internalType:"bytes"},{name:"params",type:"bytes[]",internalType:"bytes[]"}],outputs:[],stateMutability:"payable"},{type:"function",name:"msgSender",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"multicall",inputs:[{name:"data",type:"bytes[]",internalType:"bytes[]"}],outputs:[{name:"results",type:"bytes[]",internalType:"bytes[]"}],stateMutability:"payable"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"nextTokenId",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"nonces",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"word",type:"uint256",internalType:"uint256"}],outputs:[{name:"bitmap",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"id",type:"uint256",internalType:"uint256"}],outputs:[{name:"owner",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"permit",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"permit",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"permitSingle",type:"tuple",internalType:"struct IAllowanceTransfer.PermitSingle",components:[{name:"details",type:"tuple",internalType:"struct IAllowanceTransfer.PermitDetails",components:[{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint160",internalType:"uint160"},{name:"expiration",type:"uint48",internalType:"uint48"},{name:"nonce",type:"uint48",internalType:"uint48"}]},{name:"spender",type:"address",internalType:"address"},{name:"sigDeadline",type:"uint256",internalType:"uint256"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"err",type:"bytes",internalType:"bytes"}],stateMutability:"payable"},{type:"function",name:"permit2",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IAllowanceTransfer"}],stateMutability:"view"},{type:"function",name:"permitBatch",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"_permitBatch",type:"tuple",internalType:"struct IAllowanceTransfer.PermitBatch",components:[{name:"details",type:"tuple[]",internalType:"struct IAllowanceTransfer.PermitDetails[]",components:[{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint160",internalType:"uint160"},{name:"expiration",type:"uint48",internalType:"uint48"},{name:"nonce",type:"uint48",internalType:"uint48"}]},{name:"spender",type:"address",internalType:"address"},{name:"sigDeadline",type:"uint256",internalType:"uint256"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"err",type:"bytes",internalType:"bytes"}],stateMutability:"payable"},{type:"function",name:"permitForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"poolKeys",inputs:[{name:"poolId",type:"bytes25",internalType:"bytes25"}],outputs:[{name:"currency0",type:"address",internalType:"Currency"},{name:"currency1",type:"address",internalType:"Currency"},{name:"fee",type:"uint24",internalType:"uint24"},{name:"tickSpacing",type:"int24",internalType:"int24"},{name:"hooks",type:"address",internalType:"contract IHooks"}],stateMutability:"view"},{type:"function",name:"poolManager",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IPoolManager"}],stateMutability:"view"},{type:"function",name:"positionInfo",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"info",type:"uint256",internalType:"PositionInfo"}],stateMutability:"view"},{type:"function",name:"revokeNonce",inputs:[{name:"nonce",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"payable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"subscribe",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"newSubscriber",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"subscriber",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"subscriber",type:"address",internalType:"contract ISubscriber"}],stateMutability:"view"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"pure"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlockCallback",inputs:[{name:"data",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"nonpayable"},{type:"function",name:"unsubscribe",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"payable"},{type:"function",name:"unsubscribeGasLimit",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"spender",type:"address",indexed:!0,internalType:"address"},{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Subscription",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"subscriber",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Unsubscription",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"subscriber",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AlreadySubscribed",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"subscriber",type:"address",internalType:"address"}]},{type:"error",name:"ContractLocked",inputs:[]},{type:"error",name:"DeadlinePassed",inputs:[{name:"deadline",type:"uint256",internalType:"uint256"}]},{type:"error",name:"DeltaNotNegative",inputs:[{name:"currency",type:"address",internalType:"Currency"}]},{type:"error",name:"DeltaNotPositive",inputs:[{name:"currency",type:"address",internalType:"Currency"}]},{type:"error",name:"GasLimitTooLow",inputs:[]},{type:"error",name:"InputLengthMismatch",inputs:[]},{type:"error",name:"InvalidContractSignature",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"InvalidSignatureLength",inputs:[]},{type:"error",name:"InvalidSigner",inputs:[]},{type:"error",name:"MaximumAmountExceeded",inputs:[{name:"maximumAmount",type:"uint128",internalType:"uint128"},{name:"amountRequested",type:"uint128",internalType:"uint128"}]},{type:"error",name:"MinimumAmountInsufficient",inputs:[{name:"minimumAmount",type:"uint128",internalType:"uint128"},{name:"amountReceived",type:"uint128",internalType:"uint128"}]},{type:"error",name:"NoCodeSubscriber",inputs:[]},{type:"error",name:"NoSelfPermit",inputs:[]},{type:"error",name:"NonceAlreadyUsed",inputs:[]},{type:"error",name:"NotApproved",inputs:[{name:"caller",type:"address",internalType:"address"}]},{type:"error",name:"NotPoolManager",inputs:[]},{type:"error",name:"NotSubscribed",inputs:[]},{type:"error",name:"SignatureDeadlineExpired",inputs:[]},{type:"error",name:"SliceOutOfBounds",inputs:[]},{type:"error",name:"Unauthorized",inputs:[]},{type:"error",name:"UnsupportedAction",inputs:[{name:"action",type:"uint256",internalType:"uint256"}]},{type:"error",name:"Wrap__ModifyLiquidityNotificationReverted",inputs:[{name:"subscriber",type:"address",internalType:"address"},{name:"reason",type:"bytes",internalType:"bytes"}]},{type:"error",name:"Wrap__SubscriptionReverted",inputs:[{name:"subscriber",type:"address",internalType:"address"},{name:"reason",type:"bytes",internalType:"bytes"}]},{type:"error",name:"Wrap__TransferNotificationReverted",inputs:[{name:"subscriber",type:"address",internalType:"address"},{name:"reason",type:"bytes",internalType:"bytes"}]}];function Q(t){return Object.keys(t).some((function(t){return"recipient"===t}))}var z=function(){function t(){}return t.createCallParameters=function(t,e,n){return{calldata:this.encodeInitializePool(t,e,n),value:K(0)}},t.addCallParameters=function(e,r){u.greaterThan(e.liquidity,x)||n(!1);var o=[],a=new B;Q(r)&&function(t){return!!t.createPool&&(void 0===t.sqrtPriceX96&&n(!1),!0)}(r)&&o.push(t.encodeInitializePool(e.pool.poolKey,r.sqrtPriceX96,r.hookData));var s=e.mintAmountsWithSlippage(r.slippageTolerance),c=K(s.amount0),p=K(s.amount1);if(r.batchPermit&&o.push(t.encodePermitBatch(r.batchPermit.owner,r.batchPermit.permitBatch,r.batchPermit.signature)),Q(r)){var y=i.validateAndParseAddress(r.recipient);a.addMint(e.pool,e.tickLower,e.tickUpper,e.liquidity,c,p,y,r.hookData)}else a.addIncrease(r.tokenId,e.liquidity,c,p,r.hookData);a.addSettlePair(e.pool.currency0,e.pool.currency1);var l=K(0);if(r.useNative){e.pool.currency0.isNative||e.pool.currency1.isNative||n(!1);var d=e.pool.currency0.isNative?e.pool.currency0:e.pool.currency1;l=K(e.pool.currency0.isNative?c:p),a.addSweep(d,G)}return o.push(t.encodeModifyLiquidities(a.finalize(),r.deadline)),{calldata:H.encodeMulticall(o),value:l}},t.removeCallParameters=function(e,r){var i=[],o=new B,a=K(r.tokenId);if(r.burnToken){r.liquidityPercentage.equalTo(S)||n(!1),r.permit&&i.push(t.encodeERC721Permit(r.permit.spender,r.permit.tokenId,r.permit.deadline,r.permit.nonce,r.permit.signature));var s=e.burnAmountsWithSlippage(r.slippageTolerance);o.addBurn(a,s.amount0,s.amount1,r.hookData)}else{var c,p=new U({pool:e.pool,liquidity:r.liquidityPercentage.multiply(e.liquidity).quotient,tickLower:e.tickLower,tickUpper:e.tickUpper});u.greaterThan(p.liquidity,x)||n(!1);var y=p.burnAmountsWithSlippage(r.slippageTolerance),l=y.amount0,d=y.amount1;o.addDecrease(a,p.liquidity.toString(),l.toString(),d.toString(),null!=(c=r.hookData)?c:"0x")}return o.addTakePair(e.pool.currency0,e.pool.currency1,G),i.push(t.encodeModifyLiquidities(o.finalize(),r.deadline)),{calldata:H.encodeMulticall(i),value:K(0)}},t.collectCallParameters=function(e,n){var r=[],o=new B,a=K(n.tokenId),u=i.validateAndParseAddress(n.recipient);return o.addDecrease(a,"0","0","0",n.hookData),o.addTakePair(e.pool.currency0,e.pool.currency1,u),r.push(t.encodeModifyLiquidities(o.finalize(),n.deadline)),{calldata:H.encodeMulticall(r),value:K(0)}},t.encodeInitializePool=function(e,n,r){return t.INTERFACE.encodeFunctionData(g.INITIALIZE_POOL,[e,n.toString(),null!=r?r:"0x"])},t.encodeModifyLiquidities=function(e,n){return t.INTERFACE.encodeFunctionData(g.MODIFY_LIQUIDITIES,[e,n])},t.encodePermitBatch=function(e,n,r){return t.INTERFACE.encodeFunctionData(g.PERMIT_BATCH,[e,n,r])},t.encodeERC721Permit=function(e,n,r,i,o){return t.INTERFACE.encodeFunctionData(g.ERC721PERMIT_PERMIT,[e,n,r,i,o])},t}();z.INTERFACE=new c.Interface(Y),exports.DYNAMIC_FEE_FLAG=8388608,exports.Pool=q,exports.Position=U,exports.Route=L,exports.Trade=R,exports.V4Planner=X,exports.V4PositionManager=z,exports.V4PositionPlanner=B,exports.encodeRouteToPath=D,exports.toHex=K,exports.tradeComparator=M;
"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=t(require("tiny-invariant")),r=require("@ethersproject/solidity"),i=require("@uniswap/sdk-core"),o=require("@uniswap/v3-sdk"),a=require("ethers/lib/utils"),u=t(require("jsbi")),s=require("ethers"),c=require("@ethersproject/abi"),p=t(require("@uniswap/v3-periphery/artifacts/contracts/interfaces/IMulticall.sol/IMulticall.json"));function y(){y=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",s=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=Object.create((e&&e.prototype instanceof T?e:T).prototype),a=new q(r||[]);return i(o,"_invoke",{value:x(t,n,a)}),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var d="suspendedStart",m="executing",h="completed",f={};function T(){}function A(){}function v(){}var k={};c(k,a,(function(){return this}));var b=Object.getPrototypeOf,g=b&&b(b(L([])));g&&g!==n&&r.call(g,a)&&(k=g);var I=v.prototype=T.prototype=Object.create(k);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(i,o,a,u){var s=l(t[i],t,o);if("throw"!==s.type){var c=s.arg,p=c.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){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(s.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 x(e,n,r){var i=d;return function(o,a){if(i===m)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 s=S(u,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var c=l(e,n,r);if("normal"===c.type){if(i=r.done?h:"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=h,r.method="throw",r.arg=c.arg)}}}function S(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,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,f;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,f):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}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 _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(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 A.prototype=v,i(I,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:A,configurable:!0}),A.displayName=c(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===A||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,s,"GeneratorFunction")),t.prototype=Object.create(I),t},e.awrap=function(t){return{__await:t}},w(P.prototype),c(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new P(p(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(I),c(I,s,"Generator"),c(I,a,(function(){return this})),c(I,"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=L,q.prototype={constructor:q,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(_),!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 s=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)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,f):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),f},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),_(n),f}},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;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),f}},e}function l(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 d(t,e,n,r,i,o,a){try{var u=t[o](a),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(r,i)}function m(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){d(o,r,i,a,u,"next",t)}function u(t){d(o,r,i,a,u,"throw",t)}a(void 0)}))}}function h(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,l(r.key),r)}}function f(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(){return(T=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 A(t,e){return(A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function v(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 k(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 v(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)?v(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.")}function b(t,e){return!!t.isNative||!e.isNative&&t.wrapped.sortsBefore(e.wrapped)}var g,I,w=s.constants.AddressZero,P=u.BigInt(-1),x=u.BigInt(0),S=u.BigInt(1),E=u.exponentiate(u.exponentiate(u.BigInt(2),u.BigInt(96)),u.BigInt(2));!function(t){t.INITIALIZE_POOL="initializePool",t.MODIFY_LIQUIDITIES="modifyLiquidities",t.PERMIT_BATCH="0x002a3e3a",t.ERC721PERMIT_PERMIT="0x0f5730f1"}(g||(g={})),function(t){t[t.LOWEST=100]="LOWEST",t[t.LOW=500]="LOW",t[t.MEDIUM=3e3]="MEDIUM",t[t.HIGH=1e4]="HIGH"}(I||(I={})),(e={})[I.LOWEST]=1,e[I.LOW]=10,e[I.MEDIUM]=60,e[I.HIGH]=200;var _=new o.NoTickDataProvider,q=function(){function t(e,r,i,s,c,p,y,l,d){void 0===d&&(d=_),a.isAddress(c)||n(!1),Number.isInteger(i)&&(8388608===i||i<1e6)||n(!1),8388608===i&&(Number(c)>0||n(!1));var m=o.TickMath.getSqrtRatioAtTick(l),h=o.TickMath.getSqrtRatioAtTick(l+1);u.greaterThanOrEqual(u.BigInt(p),m)&&u.lessThanOrEqual(u.BigInt(p),h)||n(!1);var f=b(e,r)?[e,r]:[r,e];this.currency0=f[0],this.currency1=f[1],this.fee=i,this.sqrtRatioX96=u.BigInt(p),this.tickSpacing=s,this.hooks=c,this.liquidity=u.BigInt(y),this.tickCurrent=l,this.tickDataProvider=Array.isArray(d)?new o.TickListDataProvider(d,s):d,this.poolKey=t.getPoolKey(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks),this.poolId=t.getPoolId(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks)}t.getPoolKey=function(t,e,r,i,o){a.isAddress(o)||n(!1);var u=b(t,e)?[t,e]:[e,t],s=u[0],c=u[1];return{currency0:s.isNative?w:s.wrapped.address,currency1:c.isNative?w:c.wrapped.address,fee:r,tickSpacing:i,hooks:o}},t.getPoolId=function(t,e,n,i,o){var u=b(t,e)?[t,e]:[e,t],s=u[0],c=u[1];return r.keccak256(["bytes"],[a.defaultAbiCoder.encode(["address","address","uint24","int24","address"],[s.isNative?w:s.wrapped.address,c.isNative?w:c.wrapped.address,n,i,o])])};var e=t.prototype;return e.involvesCurrency=function(t){return t.equals(this.currency0)||t.equals(this.currency1)},e.involvesToken=function(t){return this.involvesCurrency(t)},e.priceOf=function(t){return this.involvesCurrency(t)||n(!1),t.equals(this.currency0)?this.currency0Price:this.currency1Price},e.getOutputAmount=function(){var e=m(y().mark((function e(r,o){var a,s,c,p,l;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.involvesCurrency(r.currency)||n(!1),a=r.currency.equals(this.currency0),e.next=4,this.swap(a,r.quotient,o);case 4:return c=(s=e.sent).sqrtRatioX96,p=s.liquidity,l=s.tickCurrent,e.abrupt("return",[i.CurrencyAmount.fromRawAmount(a?this.currency1:this.currency0,u.multiply(s.amountCalculated,P)),new t(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks,c,p,l,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=m(y().mark((function e(r,o){var a,s,c,p,l;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.involvesCurrency(r.currency)||n(!1),a=r.currency.equals(this.currency1),e.next=4,this.swap(a,u.multiply(r.quotient,P),o);case 4:return c=(s=e.sent).sqrtRatioX96,p=s.liquidity,l=s.tickCurrent,e.abrupt("return",[i.CurrencyAmount.fromRawAmount(a?this.currency0:this.currency1,s.amountCalculated),new t(this.currency0,this.currency1,this.fee,this.tickSpacing,this.hooks,c,p,l,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=m(y().mark((function t(e,n,r){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.nonImpactfulHook()){t.next=4;break}return t.abrupt("return",o.v3Swap(u.BigInt(this.fee),this.sqrtRatioX96,this.tickCurrent,this.liquidity,this.tickSpacing,this.tickDataProvider,e,n,r));case 4:throw new Error("Unsupported hook");case 5:case"end":return t.stop()}}),t,this)})));return function(e,n,r){return t.apply(this,arguments)}}(),e.nonImpactfulHook=function(){return this.hooks===w},f(t,[{key:"token0",get:function(){return this.currency0}},{key:"token1",get:function(){return this.currency1}},{key:"currency0Price",get:function(){var t;return null!=(t=this._currency0Price)?t:this._currency0Price=new i.Price(this.currency0,this.currency1,E,u.multiply(this.sqrtRatioX96,this.sqrtRatioX96))}},{key:"token0Price",get:function(){return this.currency0Price}},{key:"currency1Price",get:function(){var t;return null!=(t=this._currency1Price)?t:this._currency1Price=new i.Price(this.currency1,this.currency0,u.multiply(this.sqrtRatioX96,this.sqrtRatioX96),E)}},{key:"token1Price",get:function(){return this.currency1Price}},{key:"chainId",get:function(){return this.currency0.chainId}}]),t}(),L=function(){function t(t,e,r){this._midPrice=null,t.length>0||n(!1);var i=t[0].chainId;t.every((function(t){return t.chainId===i}))||n(!1),t[0].involvesCurrency(e)||n(!1),t[t.length-1].involvesCurrency(r)||n(!1);for(var o,a=[e],u=k(t.entries());!(o=u()).done;){var s=o.value,c=s[1],p=a[s[0]];p.equals(c.currency0)||p.equals(c.currency1)||n(!1);var y=p.equals(c.currency0)?c.currency1:c.currency0;a.push(y)}this.pools=t,this.currencyPath=a,this.input=e,this.output=null!=r?r:a[a.length-1]}return f(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.currency0)?{nextInput:e.currency1,price:n.multiply(e.currency0Price)}:{nextInput:e.currency0,price:n.multiply(e.currency1Price)}}),this.pools[0].currency0.equals(this.input)?{nextInput:this.pools[0].currency1,price:this.pools[0].currency0Price}:{nextInput:this.pools[0].currency0,price:this.pools[0].currency1Price}).price;return this._midPrice=new i.Price(this.input,this.output,t.denominator,t.numerator)}}]),t}();function M(t,e){return t.inputAmount.currency.equals(e.inputAmount.currency)||n(!1),t.outputAmount.currency.equals(e.outputAmount.currency)||n(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?t.swaps.reduce((function(t,e){return t+e.route.currencyPath.length}),0)-e.swaps.reduce((function(t,e){return t+e.route.currencyPath.length}),0):t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}var R=function(){function t(t){var e=t.routes,r=t.tradeType,i=e[0].inputAmount.currency,o=e[0].outputAmount.currency;e.every((function(t){return i.equals(t.route.input)}))||n(!1),e.every((function(t){return o.equals(t.route.output)}))||n(!1);for(var a,u=e.map((function(t){return t.route.pools.length})).reduce((function(t,e){return t+e}),0),s=new Set,c=k(e);!(a=c()).done;)for(var p,y=k(a.value.route.pools);!(p=y()).done;){var l=p.value;s.add(q.getPoolId(l.currency0,l.currency1,l.fee,l.tickSpacing,l.hooks))}u!==s.size&&n(!1),this.swaps=e,this.tradeType=r}t.exactIn=function(){var e=m(y().mark((function e(n,r){return y().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=m(y().mark((function e(n,r){return y().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=m(y().mark((function e(r,o,a){var u,s,c,p,l,d,m;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=new Array(r.currencyPath.length),a!==i.TradeType.EXACT_INPUT){e.next=19;break}o.currency.equals(r.input)||n(!1),u[0]=o,p=0;case 5:if(!(p<r.currencyPath.length-1)){e.next=15;break}return l=r.pools[p],e.next=9,l.getOutputAmount(u[p]);case 9:u[p+1]=e.sent[0];case 12:p++,e.next=5;break;case 15:s=i.CurrencyAmount.fromFractionalAmount(r.input,o.numerator,o.denominator),c=i.CurrencyAmount.fromFractionalAmount(r.output,u[u.length-1].numerator,u[u.length-1].denominator),e.next=34;break;case 19:o.currency.equals(r.output)||n(!1),u[u.length-1]=o,d=r.currencyPath.length-1;case 22:if(!(d>0)){e.next=32;break}return m=r.pools[d-1],e.next=26,m.getInputAmount(u[d]);case 26:u[d-1]=e.sent[0];case 29:d--,e.next=22;break;case 32:s=i.CurrencyAmount.fromFractionalAmount(r.input,u[0].numerator,u[0].denominator),c=i.CurrencyAmount.fromFractionalAmount(r.output,o.numerator,o.denominator);case 34:return e.abrupt("return",new t({routes:[{inputAmount:s,outputAmount:c,route:r}],tradeType:a}));case 35:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.fromRoutes=function(){var e=m(y().mark((function e(r,o){var a,u,s,c,p,l,d,m,h,f,T,A,v;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=[],u=k(r);case 2:if((s=u()).done){e.next=43;break}if(p=(c=s.value).route,l=c.amount,d=new Array(p.currencyPath.length),m=void 0,h=void 0,o!==i.TradeType.EXACT_INPUT){e.next=25;break}l.currency.equals(p.input)||n(!1),m=i.CurrencyAmount.fromFractionalAmount(p.input,l.numerator,l.denominator),d[0]=i.CurrencyAmount.fromFractionalAmount(p.input,l.numerator,l.denominator),f=0;case 12:if(!(f<p.currencyPath.length-1)){e.next=22;break}return T=p.pools[f],e.next=16,T.getOutputAmount(d[f]);case 16:d[f+1]=e.sent[0];case 19:f++,e.next=12;break;case 22:h=i.CurrencyAmount.fromFractionalAmount(p.output,d[d.length-1].numerator,d[d.length-1].denominator),e.next=40;break;case 25:l.currency.equals(p.output)||n(!1),h=i.CurrencyAmount.fromFractionalAmount(p.output,l.numerator,l.denominator),d[d.length-1]=i.CurrencyAmount.fromFractionalAmount(p.output,l.numerator,l.denominator),A=p.currencyPath.length-1;case 29:if(!(A>0)){e.next=39;break}return v=p.pools[A-1],e.next=33,v.getInputAmount(d[A]);case 33:d[A-1]=e.sent[0];case 36:A--,e.next=29;break;case 39:m=i.CurrencyAmount.fromFractionalAmount(p.input,d[0].numerator,d[0].denominator);case 40:a.push({route:p,inputAmount:m,outputAmount:h});case 41:e.next=2;break;case 43:return e.abrupt("return",new t({routes:a,tradeType:o}));case 44:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t.createUncheckedTrade=function(e){return new t(T({},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(x)&&n(!1),this.tradeType===i.TradeType.EXACT_OUTPUT)return e;var r=new i.Fraction(S).add(t).invert().multiply(e.quotient).quotient;return i.CurrencyAmount.fromRawAmount(e.currency,r)},e.maximumAmountIn=function(t,e){if(void 0===e&&(e=this.inputAmount),t.lessThan(x)&&n(!1),this.tradeType===i.TradeType.EXACT_INPUT)return e;var r=new i.Fraction(S).add(t).multiply(e.quotient).quotient;return i.CurrencyAmount.fromRawAmount(e.currency,r)},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=m(y().mark((function e(r,o,a,u,s,c,p){var l,d,m,h,f,T,A,v,k,b;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m=void 0===(d=(l=void 0===u?{}:u).maxNumResults)?3:d,f=void 0===(h=l.maxHops)?3:h,void 0===s&&(s=[]),void 0===c&&(c=o),void 0===p&&(p=[]),r.length>0||n(!1),f>0||n(!1),o===c||s.length>0||n(!1),T=c,A=0;case 9:if(!(A<r.length)){e.next=45;break}if((v=r[A]).currency0.equals(T.currency)||v.currency1.equals(T.currency)){e.next=13;break}return e.abrupt("continue",42);case 13:return k=void 0,e.prev=14,e.next=18,v.getOutputAmount(T);case 18:k=e.sent[0],e.next=27;break;case 22:if(e.prev=22,e.t0=e.catch(14),!e.t0.isInsufficientInputAmountError){e.next=26;break}return e.abrupt("continue",42);case 26:throw e.t0;case 27:if(!k.currency.equals(a)){e.next=38;break}return e.t1=i.sortedInsert,e.t2=p,e.next=32,t.fromRoute(new L([].concat(s,[v]),o.currency,a),o,i.TradeType.EXACT_INPUT);case 32:e.t3=e.sent,e.t4=m,e.t5=M,(0,e.t1)(e.t2,e.t3,e.t4,e.t5),e.next=42;break;case 38:if(!(f>1&&r.length>1)){e.next=42;break}return b=r.slice(0,A).concat(r.slice(A+1,r.length)),e.next=42,t.bestTradeExactIn(b,o,a,{maxNumResults:m,maxHops:f-1},[].concat(s,[v]),k,p);case 42:A++,e.next=9;break;case 45:return e.abrupt("return",p);case 46:case"end":return e.stop()}}),e,null,[[14,22]])})));return function(t,n,r,i,o,a,u){return e.apply(this,arguments)}}(),t.bestTradeExactOut=function(){var e=m(y().mark((function e(r,o,a,u,s,c,p){var l,d,m,h,f,T,A,v,k,b;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m=void 0===(d=(l=void 0===u?{}:u).maxNumResults)?3:d,f=void 0===(h=l.maxHops)?3:h,void 0===s&&(s=[]),void 0===c&&(c=a),void 0===p&&(p=[]),r.length>0||n(!1),f>0||n(!1),a===c||s.length>0||n(!1),T=c,A=0;case 9:if(!(A<r.length)){e.next=45;break}if((v=r[A]).currency0.equals(T.currency)||v.currency1.equals(T.currency)){e.next=13;break}return e.abrupt("continue",42);case 13:return k=void 0,e.prev=14,e.next=18,v.getInputAmount(T);case 18:k=e.sent[0],e.next=27;break;case 22:if(e.prev=22,e.t0=e.catch(14),!e.t0.isInsufficientReservesError){e.next=26;break}return e.abrupt("continue",42);case 26:throw e.t0;case 27:if(!k.currency.equals(o)){e.next=38;break}return e.t1=i.sortedInsert,e.t2=p,e.next=32,t.fromRoute(new L([v].concat(s),o,a.currency),a,i.TradeType.EXACT_OUTPUT);case 32:e.t3=e.sent,e.t4=m,e.t5=M,(0,e.t1)(e.t2,e.t3,e.t4,e.t5),e.next=42;break;case 38:if(!(f>1&&r.length>1)){e.next=42;break}return b=r.slice(0,A).concat(r.slice(A+1,r.length)),e.next=42,t.bestTradeExactOut(b,o,a,{maxNumResults:m,maxHops:f-1},[v].concat(s),k,p);case 42:A++,e.next=9;break;case 45:return e.abrupt("return",p);case 46:case"end":return e.stop()}}),e,null,[[14,22]])})));return function(t,n,r,i,o,a,u){return e.apply(this,arguments)}}(),f(t,[{key:"route",get:function(){return 1!==this.swaps.length&&n(!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=k(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}();function C(t,e,n){var r=o.TickMath.getSqrtRatioAtTick(n),a=u.multiply(r,r);return b(t,e)?new i.Price(t,e,E,a):new i.Price(t,e,a,E)}var O,N,U=function(){function t(t){var e=t.pool,r=t.liquidity,i=t.tickLower,a=t.tickUpper;this._token0Amount=null,this._token1Amount=null,this._mintAmounts=null,i<a||n(!1),i>=o.TickMath.MIN_TICK&&i%e.tickSpacing==0||n(!1),a<=o.TickMath.MAX_TICK&&a%e.tickSpacing==0||n(!1),this.pool=e,this.tickLower=i,this.tickUpper=a,this.liquidity=u.BigInt(r)}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=o.encodeSqrtRatioX96(e.numerator,e.denominator);u.lessThanOrEqual(r,o.TickMath.MIN_SQRT_RATIO)&&(r=u.add(o.TickMath.MIN_SQRT_RATIO,u.BigInt(1)));var a=o.encodeSqrtRatioX96(n.numerator,n.denominator);return u.greaterThanOrEqual(a,o.TickMath.MAX_SQRT_RATIO)&&(a=u.subtract(o.TickMath.MAX_SQRT_RATIO,u.BigInt(1))),{sqrtRatioX96Lower:r,sqrtRatioX96Upper:a}},e.mintAmountsWithSlippage=function(e){var n=this.ratiosAfterSlippage(e),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,a=new q(this.pool.token0,this.pool.token1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,i,0,o.TickMath.getTickAtSqrtRatio(i)),u=new q(this.pool.token0,this.pool.token1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,r,0,o.TickMath.getTickAtSqrtRatio(r)),s=t.fromAmounts(T({pool:this.pool,tickLower:this.tickLower,tickUpper:this.tickUpper},this.mintAmounts,{useFullPrecision:!1})),c=new t({pool:u,liquidity:s.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount1;return{amount0:new t({pool:a,liquidity:s.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount0,amount1:c}},e.burnAmountsWithSlippage=function(e){var n=this.ratiosAfterSlippage(e),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,a=new q(this.pool.currency0,this.pool.currency1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,i,0,o.TickMath.getTickAtSqrtRatio(i)),u=new t({pool:new q(this.pool.currency0,this.pool.currency1,this.pool.fee,this.pool.tickSpacing,this.pool.hooks,r,0,o.TickMath.getTickAtSqrtRatio(r)),liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount0,s=new t({pool:a,liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount1;return{amount0:u.quotient,amount1:s.quotient}},e.permitBatchData=function(t,e,n,r){var i=this.mintAmountsWithSlippage(t);return{details:[{token:this.pool.currency0.wrapped.address,amount:i.amount0,expiration:r,nonce:n},{token:this.pool.currency1.wrapped.address,amount:i.amount1,expiration:r,nonce:n}],spender:e,sigDeadline:r}},t.fromAmounts=function(e){var n=e.pool,r=e.tickLower,i=e.tickUpper,a=e.amount0,u=e.amount1,s=e.useFullPrecision,c=o.TickMath.getSqrtRatioAtTick(r),p=o.TickMath.getSqrtRatioAtTick(i);return new t({pool:n,tickLower:r,tickUpper:i,liquidity:o.maxLiquidityForAmounts(n.sqrtRatioX96,c,p,a,u,s)})},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})},f(t,[{key:"token0PriceLower",get:function(){return C(this.pool.currency0,this.pool.currency1,this.tickLower)}},{key:"token0PriceUpper",get:function(){return C(this.pool.currency0,this.pool.currency1,this.tickUpper)}},{key:"amount0",get:function(){return this._token0Amount||(this._token0Amount=i.CurrencyAmount.fromRawAmount(this.pool.currency0,this.pool.tickCurrent<this.tickLower?o.SqrtPriceMath.getAmount0Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):this.pool.tickCurrent<this.tickUpper?o.SqrtPriceMath.getAmount0Delta(this.pool.sqrtRatioX96,o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1):x)),this._token0Amount}},{key:"amount1",get:function(){return this._token1Amount||(this._token1Amount=i.CurrencyAmount.fromRawAmount(this.pool.currency1,this.pool.tickCurrent<this.tickLower?x:o.SqrtPriceMath.getAmount1Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),this.pool.tickCurrent<this.tickUpper?this.pool.sqrtRatioX96:o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1))),this._token1Amount}},{key:"mintAmounts",get:function(){return null===this._mintAmounts?this.pool.tickCurrent<this.tickLower?{amount0:o.SqrtPriceMath.getAmount0Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:x}:this.pool.tickCurrent<this.tickUpper?{amount0:o.SqrtPriceMath.getAmount0Delta(this.pool.sqrtRatioX96,o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:o.SqrtPriceMath.getAmount1Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),this.pool.sqrtRatioX96,this.liquidity,!0)}:{amount0:x,amount1:o.SqrtPriceMath.getAmount1Delta(o.TickMath.getSqrtRatioAtTick(this.tickLower),o.TickMath.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0)}:this._mintAmounts}}]),t}(),D=function(t,e){for(var n,r=e?t.output:t.input,i=[],o=k(e?t.pools.reverse():t.pools);!(n=o()).done;){var a=n.value,u=r.equals(a.currency0)?a.currency1:a.currency0;i.push({intermediateCurrency:u.isNative?w:u.address,fee:a.fee,tickSpacing:a.tickSpacing,hooks:a.hooks,hookData:"0x"}),r=u}return e?i.reverse():i};(N=exports.Actions||(exports.Actions={}))[N.INCREASE_LIQUIDITY=0]="INCREASE_LIQUIDITY",N[N.DECREASE_LIQUIDITY=1]="DECREASE_LIQUIDITY",N[N.MINT_POSITION=2]="MINT_POSITION",N[N.BURN_POSITION=3]="BURN_POSITION",N[N.SWAP_EXACT_IN_SINGLE=4]="SWAP_EXACT_IN_SINGLE",N[N.SWAP_EXACT_IN=5]="SWAP_EXACT_IN",N[N.SWAP_EXACT_OUT_SINGLE=6]="SWAP_EXACT_OUT_SINGLE",N[N.SWAP_EXACT_OUT=7]="SWAP_EXACT_OUT",N[N.SETTLE=9]="SETTLE",N[N.SETTLE_ALL=16]="SETTLE_ALL",N[N.SETTLE_PAIR=17]="SETTLE_PAIR",N[N.TAKE=18]="TAKE",N[N.TAKE_ALL=19]="TAKE_ALL",N[N.TAKE_PORTION=20]="TAKE_PORTION",N[N.TAKE_PAIR=21]="TAKE_PAIR",N[N.SETTLE_TAKE_PAIR=22]="SETTLE_TAKE_PAIR",N[N.CLOSE_CURRENCY=23]="CLOSE_CURRENCY",N[N.SWEEP=25]="SWEEP";var F=((O={})[exports.Actions.INCREASE_LIQUIDITY]=["uint256 tokenId","uint256 liquidity","uint128 amount0Max","uint128 amount1Max","bytes hookData"],O[exports.Actions.DECREASE_LIQUIDITY]=["uint256 tokenId","uint256 liquidity","uint128 amount0Min","uint128 amount1Min","bytes hookData"],O[exports.Actions.MINT_POSITION]=["(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks)","int24 tickLower","int24 tickUpper","uint256 liquidity","uint128 amount0Max","uint128 amount1Max","address owner","bytes hookData"],O[exports.Actions.BURN_POSITION]=["uint256 tokenId","uint128 amount0Min","uint128 amount1Min","bytes hookData"],O[exports.Actions.SWAP_EXACT_IN_SINGLE]=["((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountIn,uint128 amountOutMinimum,uint160 sqrtPriceLimitX96,bytes hookData)"],O[exports.Actions.SWAP_EXACT_IN]=["(address currencyIn,(address intermediateCurrency,uint256 fee,int24 tickSpacing,address hooks,bytes hookData)[] path,uint128 amountIn,uint128 amountOutMinimum)"],O[exports.Actions.SWAP_EXACT_OUT_SINGLE]=["((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 amountOut,uint128 amountInMaximum,uint160 sqrtPriceLimitX96,bytes hookData)"],O[exports.Actions.SWAP_EXACT_OUT]=["(address currencyOut,(address intermediateCurrency,uint256 fee,int24 tickSpacing,address hooks,bytes hookData)[] path,uint128 amountOut,uint128 amountInMaximum)"],O[exports.Actions.SETTLE]=["address","uint256","bool"],O[exports.Actions.SETTLE_ALL]=["address","uint256"],O[exports.Actions.SETTLE_PAIR]=["address","address"],O[exports.Actions.TAKE]=["address","address","uint256"],O[exports.Actions.TAKE_ALL]=["address","uint256"],O[exports.Actions.TAKE_PORTION]=["address","address","uint256"],O[exports.Actions.TAKE_PAIR]=["address","address","address"],O[exports.Actions.SETTLE_TAKE_PAIR]=["address","address"],O[exports.Actions.CLOSE_CURRENCY]=["address"],O[exports.Actions.SWEEP]=["address","address"],O),X=function(){function t(){this.actions="0x",this.params=[]}var e=t.prototype;return e.addAction=function(t,e){var n=function(t,e){return{action:t,encodedInput:a.defaultAbiCoder.encode(F[t],e)}}(t,e);this.params.push(n.encodedInput),this.actions=this.actions.concat(n.action.toString(16).padStart(2,"0"))},e.addTrade=function(t,e){var r=t.tradeType===i.TradeType.EXACT_OUTPUT;r&&(e||n(!1)),1!==t.swaps.length&&n(!1);var o=r?exports.Actions.SWAP_EXACT_OUT:exports.Actions.SWAP_EXACT_IN,a=W(t.inputAmount.currency),u=W(t.outputAmount.currency);this.addAction(o,[r?{currencyOut:u,path:D(t.route,r),amountInMaximum:t.maximumAmountIn(null!=e?e:new i.Percent(0)).quotient.toString(),amountOut:t.outputAmount.quotient.toString()}:{currencyIn:a,path:D(t.route,r),amountIn:t.inputAmount.quotient.toString(),amountOutMinimum:e?t.minimumAmountOut(e).quotient.toString():0}])},e.addSettle=function(t,e,n){this.addAction(exports.Actions.SETTLE,[W(t),null!=n?n:0,e])},e.addTake=function(t,e,n){var r=e?"0x0000000000000000000000000000000000000002":"0x0000000000000000000000000000000000000001",i=null!=n?n:0;this.addAction(exports.Actions.TAKE,[W(t),r,i])},e.finalize=function(){return a.defaultAbiCoder.encode(["bytes","bytes[]"],[this.actions,this.params])},t}();function W(t){return t.isNative?w:t.wrapped.address}function j(t){return t.isNative?w:t.wrapped.address}var B=function(t){var e,n;function r(){return t.apply(this,arguments)||this}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,A(e,n);var i=r.prototype;return i.addMint=function(t,e,n,r,i,o,a,u){void 0===u&&(u="0x");var s=[q.getPoolKey(t.currency0,t.currency1,t.fee,t.tickSpacing,t.hooks),e,n,r.toString(),i.toString(),o.toString(),a,u];this.addAction(exports.Actions.MINT_POSITION,s)},i.addIncrease=function(t,e,n,r,i){void 0===i&&(i="0x");var o=[t.toString(),e.toString(),n.toString(),r.toString(),i];this.addAction(exports.Actions.INCREASE_LIQUIDITY,o)},i.addDecrease=function(t,e,n,r,i){void 0===i&&(i="0x");var o=[t.toString(),e.toString(),n.toString(),r.toString(),i];this.addAction(exports.Actions.DECREASE_LIQUIDITY,o)},i.addBurn=function(t,e,n,r){void 0===r&&(r="0x");var i=[t.toString(),e.toString(),n.toString(),r];this.addAction(exports.Actions.BURN_POSITION,i)},i.addSettlePair=function(t,e){var n=[j(t),j(e)];this.addAction(exports.Actions.SETTLE_PAIR,n)},i.addTakePair=function(t,e,n){var r=[j(t),j(e),n];this.addAction(exports.Actions.TAKE_PAIR,r)},i.addSweep=function(t,e){var n=[j(t),e];this.addAction(exports.Actions.SWEEP,n)},r}(X);function K(t){var e=u.BigInt(t).toString(16);return e.length%2!=0&&(e="0"+e),"0x"+e}var G="0x0000000000000000000000000000000000000001",H=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.decodeMulticall=function(e){return t.INTERFACE.decodeFunctionData("multicall",e)[0]},t}();H.INTERFACE=new c.Interface(p.abi);var Y=[{type:"constructor",inputs:[{name:"_poolManager",type:"address",internalType:"contract IPoolManager"},{name:"_permit2",type:"address",internalType:"contract IAllowanceTransfer"},{name:"_unsubscribeGasLimit",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getPoolAndPositionInfo",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"poolKey",type:"tuple",internalType:"struct PoolKey",components:[{name:"currency0",type:"address",internalType:"Currency"},{name:"currency1",type:"address",internalType:"Currency"},{name:"fee",type:"uint24",internalType:"uint24"},{name:"tickSpacing",type:"int24",internalType:"int24"},{name:"hooks",type:"address",internalType:"contract IHooks"}]},{name:"info",type:"uint256",internalType:"PositionInfo"}],stateMutability:"view"},{type:"function",name:"getPositionLiquidity",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"liquidity",type:"uint128",internalType:"uint128"}],stateMutability:"view"},{type:"function",name:"initializePool",inputs:[{name:"key",type:"tuple",internalType:"struct PoolKey",components:[{name:"currency0",type:"address",internalType:"Currency"},{name:"currency1",type:"address",internalType:"Currency"},{name:"fee",type:"uint24",internalType:"uint24"},{name:"tickSpacing",type:"int24",internalType:"int24"},{name:"hooks",type:"address",internalType:"contract IHooks"}]},{name:"sqrtPriceX96",type:"uint160",internalType:"uint160"},{name:"hookData",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"int24",internalType:"int24"}],stateMutability:"payable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"modifyLiquidities",inputs:[{name:"unlockData",type:"bytes",internalType:"bytes"},{name:"deadline",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"payable"},{type:"function",name:"modifyLiquiditiesWithoutUnlock",inputs:[{name:"actions",type:"bytes",internalType:"bytes"},{name:"params",type:"bytes[]",internalType:"bytes[]"}],outputs:[],stateMutability:"payable"},{type:"function",name:"msgSender",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"multicall",inputs:[{name:"data",type:"bytes[]",internalType:"bytes[]"}],outputs:[{name:"results",type:"bytes[]",internalType:"bytes[]"}],stateMutability:"payable"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"nextTokenId",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"nonces",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"word",type:"uint256",internalType:"uint256"}],outputs:[{name:"bitmap",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"id",type:"uint256",internalType:"uint256"}],outputs:[{name:"owner",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"permit",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"permit",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"permitSingle",type:"tuple",internalType:"struct IAllowanceTransfer.PermitSingle",components:[{name:"details",type:"tuple",internalType:"struct IAllowanceTransfer.PermitDetails",components:[{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint160",internalType:"uint160"},{name:"expiration",type:"uint48",internalType:"uint48"},{name:"nonce",type:"uint48",internalType:"uint48"}]},{name:"spender",type:"address",internalType:"address"},{name:"sigDeadline",type:"uint256",internalType:"uint256"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"err",type:"bytes",internalType:"bytes"}],stateMutability:"payable"},{type:"function",name:"permit2",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IAllowanceTransfer"}],stateMutability:"view"},{type:"function",name:"permitBatch",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"_permitBatch",type:"tuple",internalType:"struct IAllowanceTransfer.PermitBatch",components:[{name:"details",type:"tuple[]",internalType:"struct IAllowanceTransfer.PermitDetails[]",components:[{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint160",internalType:"uint160"},{name:"expiration",type:"uint48",internalType:"uint48"},{name:"nonce",type:"uint48",internalType:"uint48"}]},{name:"spender",type:"address",internalType:"address"},{name:"sigDeadline",type:"uint256",internalType:"uint256"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"err",type:"bytes",internalType:"bytes"}],stateMutability:"payable"},{type:"function",name:"permitForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"poolKeys",inputs:[{name:"poolId",type:"bytes25",internalType:"bytes25"}],outputs:[{name:"currency0",type:"address",internalType:"Currency"},{name:"currency1",type:"address",internalType:"Currency"},{name:"fee",type:"uint24",internalType:"uint24"},{name:"tickSpacing",type:"int24",internalType:"int24"},{name:"hooks",type:"address",internalType:"contract IHooks"}],stateMutability:"view"},{type:"function",name:"poolManager",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IPoolManager"}],stateMutability:"view"},{type:"function",name:"positionInfo",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"info",type:"uint256",internalType:"PositionInfo"}],stateMutability:"view"},{type:"function",name:"revokeNonce",inputs:[{name:"nonce",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"payable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"subscribe",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"newSubscriber",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"subscriber",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"subscriber",type:"address",internalType:"contract ISubscriber"}],stateMutability:"view"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"pure"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"id",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlockCallback",inputs:[{name:"data",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"nonpayable"},{type:"function",name:"unsubscribe",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"payable"},{type:"function",name:"unsubscribeGasLimit",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"spender",type:"address",indexed:!0,internalType:"address"},{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Subscription",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"subscriber",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Unsubscription",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"subscriber",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AlreadySubscribed",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"subscriber",type:"address",internalType:"address"}]},{type:"error",name:"ContractLocked",inputs:[]},{type:"error",name:"DeadlinePassed",inputs:[{name:"deadline",type:"uint256",internalType:"uint256"}]},{type:"error",name:"DeltaNotNegative",inputs:[{name:"currency",type:"address",internalType:"Currency"}]},{type:"error",name:"DeltaNotPositive",inputs:[{name:"currency",type:"address",internalType:"Currency"}]},{type:"error",name:"GasLimitTooLow",inputs:[]},{type:"error",name:"InputLengthMismatch",inputs:[]},{type:"error",name:"InvalidContractSignature",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"InvalidSignatureLength",inputs:[]},{type:"error",name:"InvalidSigner",inputs:[]},{type:"error",name:"MaximumAmountExceeded",inputs:[{name:"maximumAmount",type:"uint128",internalType:"uint128"},{name:"amountRequested",type:"uint128",internalType:"uint128"}]},{type:"error",name:"MinimumAmountInsufficient",inputs:[{name:"minimumAmount",type:"uint128",internalType:"uint128"},{name:"amountReceived",type:"uint128",internalType:"uint128"}]},{type:"error",name:"NoCodeSubscriber",inputs:[]},{type:"error",name:"NoSelfPermit",inputs:[]},{type:"error",name:"NonceAlreadyUsed",inputs:[]},{type:"error",name:"NotApproved",inputs:[{name:"caller",type:"address",internalType:"address"}]},{type:"error",name:"NotPoolManager",inputs:[]},{type:"error",name:"NotSubscribed",inputs:[]},{type:"error",name:"SignatureDeadlineExpired",inputs:[]},{type:"error",name:"SliceOutOfBounds",inputs:[]},{type:"error",name:"Unauthorized",inputs:[]},{type:"error",name:"UnsupportedAction",inputs:[{name:"action",type:"uint256",internalType:"uint256"}]},{type:"error",name:"Wrap__ModifyLiquidityNotificationReverted",inputs:[{name:"subscriber",type:"address",internalType:"address"},{name:"reason",type:"bytes",internalType:"bytes"}]},{type:"error",name:"Wrap__SubscriptionReverted",inputs:[{name:"subscriber",type:"address",internalType:"address"},{name:"reason",type:"bytes",internalType:"bytes"}]},{type:"error",name:"Wrap__TransferNotificationReverted",inputs:[{name:"subscriber",type:"address",internalType:"address"},{name:"reason",type:"bytes",internalType:"bytes"}]}];function Q(t){return Object.keys(t).some((function(t){return"recipient"===t}))}var z=function(){function t(){}return t.createCallParameters=function(t,e,n){return{calldata:this.encodeInitializePool(t,e,n),value:K(0)}},t.addCallParameters=function(e,r){u.greaterThan(e.liquidity,x)||n(!1);var o=[],a=new B;Q(r)&&function(t){return!!t.createPool&&(void 0===t.sqrtPriceX96&&n(!1),!0)}(r)&&o.push(t.encodeInitializePool(e.pool.poolKey,r.sqrtPriceX96,r.hookData));var s=e.mintAmountsWithSlippage(r.slippageTolerance),c=K(s.amount0),p=K(s.amount1);if(r.batchPermit&&o.push(t.encodePermitBatch(r.batchPermit.owner,r.batchPermit.permitBatch,r.batchPermit.signature)),Q(r)){var y=i.validateAndParseAddress(r.recipient);a.addMint(e.pool,e.tickLower,e.tickUpper,e.liquidity,c,p,y,r.hookData)}else a.addIncrease(r.tokenId,e.liquidity,c,p,r.hookData);a.addSettlePair(e.pool.currency0,e.pool.currency1);var l=K(0);if(r.useNative){e.pool.currency0.isNative||e.pool.currency1.isNative||n(!1);var d=e.pool.currency0.isNative?e.pool.currency0:e.pool.currency1;l=K(e.pool.currency0.isNative?c:p),a.addSweep(d,G)}return o.push(t.encodeModifyLiquidities(a.finalize(),r.deadline)),{calldata:H.encodeMulticall(o),value:l}},t.removeCallParameters=function(e,r){var i=[],o=new B,a=K(r.tokenId);if(r.burnToken){r.liquidityPercentage.equalTo(S)||n(!1),r.permit&&i.push(t.encodeERC721Permit(r.permit.spender,r.permit.tokenId,r.permit.deadline,r.permit.nonce,r.permit.signature));var s=e.burnAmountsWithSlippage(r.slippageTolerance);o.addBurn(a,s.amount0,s.amount1,r.hookData)}else{var c,p=new U({pool:e.pool,liquidity:r.liquidityPercentage.multiply(e.liquidity).quotient,tickLower:e.tickLower,tickUpper:e.tickUpper});u.greaterThan(p.liquidity,x)||n(!1);var y=p.burnAmountsWithSlippage(r.slippageTolerance),l=y.amount0,d=y.amount1;o.addDecrease(a,p.liquidity.toString(),l.toString(),d.toString(),null!=(c=r.hookData)?c:"0x")}return o.addTakePair(e.pool.currency0,e.pool.currency1,G),i.push(t.encodeModifyLiquidities(o.finalize(),r.deadline)),{calldata:H.encodeMulticall(i),value:K(0)}},t.collectCallParameters=function(e,n){var r=[],o=new B,a=K(n.tokenId),u=i.validateAndParseAddress(n.recipient);return o.addDecrease(a,"0","0","0",n.hookData),o.addTakePair(e.pool.currency0,e.pool.currency1,u),r.push(t.encodeModifyLiquidities(o.finalize(),n.deadline)),{calldata:H.encodeMulticall(r),value:K(0)}},t.encodeInitializePool=function(e,n,r){return t.INTERFACE.encodeFunctionData(g.INITIALIZE_POOL,[e,n.toString(),null!=r?r:"0x"])},t.encodeModifyLiquidities=function(e,n){return t.INTERFACE.encodeFunctionData(g.MODIFY_LIQUIDITIES,[e,n])},t.encodePermitBatch=function(e,n,r){return t.INTERFACE.encodeFunctionData(g.PERMIT_BATCH,[e,n,r])},t.encodeERC721Permit=function(e,n,r,i,o){return t.INTERFACE.encodeFunctionData(g.ERC721PERMIT_PERMIT,[e,n,r,i,o])},t}();z.INTERFACE=new c.Interface(Y),exports.DYNAMIC_FEE_FLAG=8388608,exports.Pool=q,exports.Position=U,exports.Route=L,exports.Trade=R,exports.V4Planner=X,exports.V4PositionManager=z,exports.V4PositionPlanner=B,exports.encodeRouteToPath=D,exports.toHex=K,exports.tradeComparator=M;
//# sourceMappingURL=v4-sdk.cjs.production.min.js.map

@@ -96,3 +96,3 @@ {

},
"version": "1.6.0"
"version": "1.6.1"
}

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