@ghost-nft/eth-ghost-sdk
Advanced tools
Comparing version 1.0.27 to 1.0.29
@@ -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,r,i,a=t(require("jsbi")),o=t(require("tiny-invariant")),u=(t(require("tiny-warning")),require("@ethersproject/address")),s=t(require("big.js")),p=t(require("toformat")),d=t(require("decimal.js-light")),c=require("@ethersproject/solidity"),l=require("@ethersproject/contracts"),y=require("@ethersproject/networks"),f=require("@ethersproject/providers");(n=exports.ChainId||(exports.ChainId={}))[n.MAINNET=1]="MAINNET",n[n.TESTNET=3]="TESTNET",n[n.LOCALNET=1337]="LOCALNET",n[n.GHOSTNET=9234]="GHOSTNET",(r=exports.TradeType||(exports.TradeType={}))[r.EXACT_INPUT=0]="EXACT_INPUT",r[r.EXACT_OUTPUT=1]="EXACT_OUTPUT",(i=exports.Rounding||(exports.Rounding={}))[i.ROUND_DOWN=0]="ROUND_DOWN",i[i.ROUND_HALF_UP=1]="ROUND_HALF_UP",i[i.ROUND_UP=2]="ROUND_UP";var m,h={1:"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",3:"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",1337:"0xeaF396356dB4673Fa2F199a63078276FF6d363A0",9234:"0xeaF396356dB4673Fa2F199a63078276FF6d363A0"},T={1:"0xb55e24556c85fc3e614cefca9f291dd0b68ae979f8fb3170a912cf9ff8460507",3:"0xb55e24556c85fc3e614cefca9f291dd0b68ae979f8fb3170a912cf9ff8460507",1337:"0x303170fa7e30812b1d48ae4bee04621ac0f596815fa36c40a8670e6536e021c2",9234:"0x303170fa7e30812b1d48ae4bee04621ac0f596815fa36c40a8670e6536e021c2"},v={1:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",3:"0xa7DDE2DbB0D5454e458383d4E8659a825ADc25e1",1337:"0xB140c3FD3f8D597d24cFE09fee64fC41CD67F578",9234:"0xB140c3FD3f8D597d24cFE09fee64fC41CD67F578"},w=a.BigInt(1e3),g=a.BigInt(0),b=a.BigInt(1),k=a.BigInt(2),x=a.BigInt(3),A=a.BigInt(5),I=a.BigInt(10),E=a.BigInt(100),O=a.BigInt(9975),q=a.BigInt(1e4);!function(t){t.uint8="uint8",t.uint256="uint256"}(m||(m={}));var N=((e={})[m.uint8]=a.BigInt("0xff"),e[m.uint256]=a.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e);function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function P(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _(){return(_=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 D(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,U(t,e)}function R(t){return(R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function U(t,e){return(U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function S(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function F(t,e,n){return(F=S()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&U(i,n.prototype),i}).apply(null,arguments)}function M(t){var e="function"==typeof Map?new Map:void 0;return(M=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return F(t,arguments,R(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,t)})(t)}function H(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function B(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 j(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 B(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)?B(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var L="setPrototypeOf"in Object,W=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,L&&Object.setPrototypeOf(H(n),(this instanceof e?this.constructor:void 0).prototype),n}return D(e,t),e}(M(Error)),X=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,L&&Object.setPrototypeOf(H(n),(this instanceof e?this.constructor:void 0).prototype),n}return D(e,t),e}(M(Error));function G(t,e){a.greaterThanOrEqual(t,g)||o(!1),a.lessThanOrEqual(t,N[e])||o(!1)}function Y(t){try{return u.getAddress(t)}catch(t){o(!1)}}function Q(t){return t instanceof a?t:a.BigInt("bigint"==typeof t?t.toString():t)}function z(t){G(t,m.uint256);var e,n=g;if(a.greaterThan(t,x))for(n=t,e=a.add(a.divide(t,k),b);a.lessThan(e,n);)n=e,e=a.divide(a.add(a.divide(t,e),e),k);else a.notEqual(t,g)&&(n=b);return n}function J(t,e,n,r){if(n>0||o(!1),t.length<=n||o(!1),0===t.length)return t.push(e),null;var i=t.length===n;if(i&&r(t[t.length-1],e)<=0)return e;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;r(t[s],e)<=0?a=s+1:u=s}return t.splice(a,0,e),i?t.pop():null}var V,$=function(t,e,n){G(a.BigInt(t),m.uint8),this.decimals=t,this.symbol=e,this.name=n},K=$.ETHER=new $(18,"BNB","BNB"),Z=function(t){function e(e,n,r,i,a,o){var u;return(u=t.call(this,r,i,a)||this).chainId=e,u.address=Y(n),u.projectLink=o,u}D(e,t);var n=e.prototype;return n.equals=function(t){return this===t||this.chainId===t.chainId&&this.address===t.address},n.sortsBefore=function(t){return this.chainId!==t.chainId&&o(!1),this.address===t.address&&o(!1),this.address.toLowerCase()<t.address.toLowerCase()},e}($);function tt(t,e){return t instanceof Z&&e instanceof Z?t.equals(e):!(t instanceof Z||e instanceof Z||t!==e)}var et,nt,rt=((V={})[exports.ChainId.MAINNET]=new Z(exports.ChainId.MAINNET,v[exports.ChainId.MAINNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V[exports.ChainId.TESTNET]=new Z(exports.ChainId.TESTNET,v[exports.ChainId.TESTNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V[exports.ChainId.LOCALNET]=new Z(exports.ChainId.LOCALNET,v[exports.ChainId.LOCALNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V[exports.ChainId.GHOSTNET]=new Z(exports.ChainId.GHOSTNET,v[exports.ChainId.GHOSTNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V),it=p(d),at=p(s),ot=((et={})[exports.Rounding.ROUND_DOWN]=it.ROUND_DOWN,et[exports.Rounding.ROUND_HALF_UP]=it.ROUND_HALF_UP,et[exports.Rounding.ROUND_UP]=it.ROUND_UP,et),ut=((nt={})[exports.Rounding.ROUND_DOWN]=0,nt[exports.Rounding.ROUND_HALF_UP]=1,nt[exports.Rounding.ROUND_UP]=3,nt),st=function(){function t(t,e){void 0===e&&(e=b),this.numerator=Q(t),this.denominator=Q(e)}var e=t.prototype;return e.invert=function(){return new t(this.denominator,this.numerator)},e.add=function(e){var n=e instanceof t?e:new t(Q(e));return a.equal(this.denominator,n.denominator)?new t(a.add(this.numerator,n.numerator),this.denominator):new t(a.add(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator)),a.multiply(this.denominator,n.denominator))},e.subtract=function(e){var n=e instanceof t?e:new t(Q(e));return a.equal(this.denominator,n.denominator)?new t(a.subtract(this.numerator,n.numerator),this.denominator):new t(a.subtract(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator)),a.multiply(this.denominator,n.denominator))},e.lessThan=function(e){var n=e instanceof t?e:new t(Q(e));return a.lessThan(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator))},e.equalTo=function(e){var n=e instanceof t?e:new t(Q(e));return a.equal(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator))},e.greaterThan=function(e){var n=e instanceof t?e:new t(Q(e));return a.greaterThan(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator))},e.multiply=function(e){var n=e instanceof t?e:new t(Q(e));return new t(a.multiply(this.numerator,n.numerator),a.multiply(this.denominator,n.denominator))},e.divide=function(e){var n=e instanceof t?e:new t(Q(e));return new t(a.multiply(this.numerator,n.denominator),a.multiply(this.denominator,n.numerator))},e.toSignificant=function(t,e,n){void 0===e&&(e={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>0||o(!1),it.set({precision:t+1,rounding:ot[n]});var r=new it(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return r.toFormat(r.decimalPlaces(),e)},e.toFixed=function(t,e,n){return void 0===e&&(e={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>=0||o(!1),at.DP=t,at.RM=ut[n],new at(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,e)},P(t,[{key:"quotient",get:function(){return a.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new t(a.remainder(this.numerator,this.denominator),this.denominator)}}]),t}(),pt=p(s),dt=function(t){function e(e,n){var r,i=Q(n);return G(i,m.uint256),(r=t.call(this,i,a.exponentiate(I,a.BigInt(e.decimals)))||this).currency=e,r}D(e,t),e.ether=function(t){return new e(K,t)};var n=e.prototype;return n.add=function(t){return tt(this.currency,t.currency)||o(!1),new e(this.currency,a.add(this.raw,t.raw))},n.subtract=function(t){return tt(this.currency,t.currency)||o(!1),new e(this.currency,a.subtract(this.raw,t.raw))},n.toSignificant=function(e,n,r){return void 0===e&&(e=6),void 0===r&&(r=exports.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,e,n,r)},n.toFixed=function(e,n,r){return void 0===e&&(e=this.currency.decimals),void 0===r&&(r=exports.Rounding.ROUND_DOWN),e<=this.currency.decimals||o(!1),t.prototype.toFixed.call(this,e,n,r)},n.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),pt.DP=this.currency.decimals,new pt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)},P(e,[{key:"raw",get:function(){return this.numerator}}]),e}(st),ct=function(t){function e(e,n){var r;return(r=t.call(this,e,n)||this).token=e,r}D(e,t);var n=e.prototype;return n.add=function(t){return this.token.equals(t.token)||o(!1),new e(this.token,a.add(this.raw,t.raw))},n.subtract=function(t){return this.token.equals(t.token)||o(!1),new e(this.token,a.subtract(this.raw,t.raw))},e}(dt),lt=function(t){function e(e,n,r,i){var o;return(o=t.call(this,i,r)||this).baseCurrency=e,o.quoteCurrency=n,o.scalar=new st(a.exponentiate(I,a.BigInt(e.decimals)),a.exponentiate(I,a.BigInt(n.decimals))),o}D(e,t),e.fromRoute=function(t){for(var n,r=[],i=j(t.pairs.entries());!(n=i()).done;){var a=n.value,o=a[1];r.push(t.path[a[0]].equals(o.token0)?new e(o.reserve0.currency,o.reserve1.currency,o.reserve0.raw,o.reserve1.raw):new e(o.reserve1.currency,o.reserve0.currency,o.reserve1.raw,o.reserve0.raw))}return r.slice(1).reduce((function(t,e){return t.multiply(e)}),r[0])};var n=e.prototype;return n.invert=function(){return new e(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){tt(this.quoteCurrency,n.baseCurrency)||o(!1);var r=t.prototype.multiply.call(this,n);return new e(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(e){return tt(e.currency,this.baseCurrency)||o(!1),this.quoteCurrency instanceof Z?new ct(this.quoteCurrency,t.prototype.multiply.call(this,e.raw).quotient):dt.ether(t.prototype.multiply.call(this,e.raw).quotient)},n.toSignificant=function(t,e,n){return void 0===t&&(t=6),this.adjusted.toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=4),this.adjusted.toFixed(t,e,n)},P(e,[{key:"raw",get:function(){return new st(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),e}(st),yt={},ft=function(){function t(e,n){var r=e.token.sortsBefore(n.token)?[e,n]:[n,e];this.liquidityToken=new Z(r[0].token.chainId,t.getAddress(r[0].token,r[1].token),18,"GHOST-LP","Ghost LPs"),this.tokenAmounts=r}t.getAddress=function(t,e){var n,r,i,a,o,s=t.sortsBefore(e)?[t,e]:[e,t];return console.log("CHAIN_INIT_CODE_HASH[tokens[0].chainId]",T[s[0].chainId]),void 0===(null===(n=yt)||void 0===n||null===(r=n[s[0].address])||void 0===r?void 0:r[s[1].address])&&(yt=_({},yt,((o={})[s[0].address]=_({},null===(i=yt)||void 0===i?void 0:i[s[0].address],((a={})[s[1].address]=u.getCreate2Address(h[s[0].chainId],c.keccak256(["bytes"],[c.pack(["address","address"],[s[0].address,s[1].address])]),T[s[0].chainId]),a)),o))),yt[s[0].address][s[1].address]};var e=t.prototype;return e.involvesToken=function(t){return t.equals(this.token0)||t.equals(this.token1)},e.priceOf=function(t){return this.involvesToken(t)||o(!1),t.equals(this.token0)?this.token0Price:this.token1Price},e.reserveOf=function(t){return this.involvesToken(t)||o(!1),t.equals(this.token0)?this.reserve0:this.reserve1},e.getOutputAmount=function(e){if(this.involvesToken(e.token)||o(!1),a.equal(this.reserve0.raw,g)||a.equal(this.reserve1.raw,g))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),i=a.multiply(e.raw,O),u=a.multiply(i,r.raw),s=a.add(a.multiply(n.raw,q),i),p=new ct(e.token.equals(this.token0)?this.token1:this.token0,a.divide(u,s));if(a.equal(p.raw,g))throw new X;return[p,new t(n.add(e),r.subtract(p))]},e.getInputAmount=function(e){if(this.involvesToken(e.token)||o(!1),a.equal(this.reserve0.raw,g)||a.equal(this.reserve1.raw,g)||a.greaterThanOrEqual(e.raw,this.reserveOf(e.token).raw))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),i=a.multiply(a.multiply(r.raw,e.raw),q),u=a.multiply(a.subtract(n.raw,e.raw),O),s=new ct(e.token.equals(this.token0)?this.token1:this.token0,a.add(a.divide(i,u),b));return[s,new t(r.add(s),n.subtract(e))]},e.getLiquidityMinted=function(t,e,n){t.token.equals(this.liquidityToken)||o(!1);var r,i=e.token.sortsBefore(n.token)?[e,n]:[n,e];if(i[0].token.equals(this.token0)&&i[1].token.equals(this.token1)||o(!1),a.equal(t.raw,g))r=a.subtract(z(a.multiply(i[0].raw,i[1].raw)),w);else{var u=a.divide(a.multiply(i[0].raw,t.raw),this.reserve0.raw),s=a.divide(a.multiply(i[1].raw,t.raw),this.reserve1.raw);r=a.lessThanOrEqual(u,s)?u:s}if(!a.greaterThan(r,g))throw new X;return new ct(this.liquidityToken,r)},e.getLiquidityValue=function(t,e,n,r,i){var u;if(void 0===r&&(r=!1),this.involvesToken(t)||o(!1),e.token.equals(this.liquidityToken)||o(!1),n.token.equals(this.liquidityToken)||o(!1),a.lessThanOrEqual(n.raw,e.raw)||o(!1),r){i||o(!1);var s=Q(i);if(a.equal(s,g))u=e;else{var p=z(a.multiply(this.reserve0.raw,this.reserve1.raw)),d=z(s);if(a.greaterThan(p,d)){var c=a.multiply(e.raw,a.subtract(p,d)),l=a.add(a.multiply(p,A),d),y=a.divide(c,l);u=e.add(new ct(this.liquidityToken,y))}else u=e}}else u=e;return new ct(t,a.divide(a.multiply(n.raw,this.reserveOf(t).raw),u.raw))},P(t,[{key:"token0Price",get:function(){return new lt(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new lt(this.token1,this.token0,this.tokenAmounts[1].raw,this.tokenAmounts[0].raw)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].token}},{key:"token1",get:function(){return this.tokenAmounts[1].token}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),t}(),mt=function(){function t(t,e,n){t.length>0||o(!1),t.every((function(e){return e.chainId===t[0].chainId}))||o(!1),e instanceof Z&&t[0].involvesToken(e)||e===K&&t[0].involvesToken(rt[t[0].chainId])||o(!1),void 0===n||n instanceof Z&&t[t.length-1].involvesToken(n)||n===K&&t[t.length-1].involvesToken(rt[t[0].chainId])||o(!1);for(var r,i=[e instanceof Z?e:rt[t[0].chainId]],a=j(t.entries());!(r=a()).done;){var u=r.value,s=u[1],p=i[u[0]];p.equals(s.token0)||p.equals(s.token1)||o(!1);var d=p.equals(s.token0)?s.token1:s.token0;i.push(d)}this.pairs=t,this.path=i,this.midPrice=lt.fromRoute(this),this.input=e,this.output=null!=n?n:i[i.length-1]}return P(t,[{key:"chainId",get:function(){return this.pairs[0].chainId}}]),t}(),ht=new st(E),Tt=function(t){function e(){return t.apply(this,arguments)||this}D(e,t);var n=e.prototype;return n.toSignificant=function(t,e,n){return void 0===t&&(t=5),this.multiply(ht).toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=2),this.multiply(ht).toFixed(t,e,n)},e}(st);function vt(t,e){return tt(t.inputAmount.currency,e.inputAmount.currency)||o(!1),tt(t.outputAmount.currency,e.outputAmount.currency)||o(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?0:t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}function wt(t,e){var n=vt(t,e);return 0!==n?n:t.priceImpact.lessThan(e.priceImpact)?-1:t.priceImpact.greaterThan(e.priceImpact)?1:t.route.path.length-e.route.path.length}function gt(t,e){return t instanceof ct?t:t.currency===K?new ct(rt[e],t.raw):void o(!1)}function bt(t,e){return t instanceof Z?t:t===K?rt[e]:void o(!1)}var kt=function(){function t(t,e,n){var r,i,a,u=new Array(t.path.length),s=new Array(t.pairs.length);if(n===exports.TradeType.EXACT_INPUT){tt(e.currency,t.input)||o(!1),u[0]=gt(e,t.chainId);for(var p=0;p<t.path.length-1;p++){var d=t.pairs[p].getOutputAmount(u[p]),c=d[1];u[p+1]=d[0],s[p]=c}}else{tt(e.currency,t.output)||o(!1),u[u.length-1]=gt(e,t.chainId);for(var l=t.path.length-1;l>0;l--){var y=t.pairs[l-1].getInputAmount(u[l]),f=y[1];u[l-1]=y[0],s[l-1]=f}}this.route=t,this.tradeType=n,this.inputAmount=n===exports.TradeType.EXACT_INPUT?e:t.input===K?dt.ether(u[0].raw):u[0],this.outputAmount=n===exports.TradeType.EXACT_OUTPUT?e:t.output===K?dt.ether(u[u.length-1].raw):u[u.length-1],this.executionPrice=new lt(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=lt.fromRoute(new mt(s,t.input)),this.priceImpact=(r=this.outputAmount,a=(i=t.midPrice.raw.multiply(this.inputAmount.raw)).subtract(r.raw).divide(i),new Tt(a.numerator,a.denominator))}t.exactIn=function(e,n){return new t(e,n,exports.TradeType.EXACT_INPUT)},t.exactOut=function(e,n){return new t(e,n,exports.TradeType.EXACT_OUTPUT)};var e=t.prototype;return e.minimumAmountOut=function(t){if(t.lessThan(g)&&o(!1),this.tradeType===exports.TradeType.EXACT_OUTPUT)return this.outputAmount;var e=new st(b).add(t).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof ct?new ct(this.outputAmount.token,e):dt.ether(e)},e.maximumAmountIn=function(t){if(t.lessThan(g)&&o(!1),this.tradeType===exports.TradeType.EXACT_INPUT)return this.inputAmount;var e=new st(b).add(t).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof ct?new ct(this.inputAmount.token,e):dt.ether(e)},t.bestTradeExactIn=function(e,n,r,i,a,u,s){var p=void 0===i?{}:i,d=p.maxNumResults,c=void 0===d?3:d,l=p.maxHops,y=void 0===l?3:l;void 0===a&&(a=[]),void 0===u&&(u=n),void 0===s&&(s=[]),e.length>0||o(!1),y>0||o(!1),u===n||a.length>0||o(!1);var f=n instanceof ct?n.token.chainId:r instanceof Z?r.chainId:void 0;void 0===f&&o(!1);for(var m=gt(n,f),h=bt(r,f),T=0;T<e.length;T++){var v=e[T];if((v.token0.equals(m.token)||v.token1.equals(m.token))&&!v.reserve0.equalTo(g)&&!v.reserve1.equalTo(g)){var w=void 0;try{w=v.getOutputAmount(m)[0]}catch(t){if(t.isInsufficientInputAmountError)continue;throw t}if(w.token.equals(h))J(s,new t(new mt([].concat(a,[v]),u.currency,r),u,exports.TradeType.EXACT_INPUT),c,wt);else if(y>1&&e.length>1){var b=e.slice(0,T).concat(e.slice(T+1,e.length));t.bestTradeExactIn(b,w,r,{maxNumResults:c,maxHops:y-1},[].concat(a,[v]),u,s)}}}return s},t.bestTradeExactOut=function(e,n,r,i,a,u,s){var p=void 0===i?{}:i,d=p.maxNumResults,c=void 0===d?3:d,l=p.maxHops,y=void 0===l?3:l;void 0===a&&(a=[]),void 0===u&&(u=r),void 0===s&&(s=[]),e.length>0||o(!1),y>0||o(!1),u===r||a.length>0||o(!1);var f=r instanceof ct?r.token.chainId:n instanceof Z?n.chainId:void 0;void 0===f&&o(!1);for(var m=gt(r,f),h=bt(n,f),T=0;T<e.length;T++){var v=e[T];if((v.token0.equals(m.token)||v.token1.equals(m.token))&&!v.reserve0.equalTo(g)&&!v.reserve1.equalTo(g)){var w=void 0;try{w=v.getInputAmount(m)[0]}catch(t){if(t.isInsufficientReservesError)continue;throw t}if(w.token.equals(h))J(s,new t(new mt([v].concat(a),n,u.currency),u,exports.TradeType.EXACT_OUTPUT),c,wt);else if(y>1&&e.length>1){var b=e.slice(0,T).concat(e.slice(T+1,e.length));t.bestTradeExactOut(b,n,w,{maxNumResults:c,maxHops:y-1},[v].concat(a),u,s)}}}return s},t}();function xt(t){return"0x"+t.raw.toString(16)}var At,It=function(){function t(){}return t.swapCallParameters=function(t,e){var n=t.inputAmount.currency===K,r=t.outputAmount.currency===K;n&&r&&o(!1),!("ttl"in e)||e.ttl>0||o(!1);var i,a,u,s=Y(e.recipient),p=xt(t.maximumAmountIn(e.allowedSlippage)),d=xt(t.minimumAmountOut(e.allowedSlippage)),c=t.route.path.map((function(t){return t.address})),l="ttl"in e?"0x"+(Math.floor((new Date).getTime()/1e3)+e.ttl).toString(16):"0x"+e.deadline.toString(16),y=Boolean(e.feeOnTransfer);switch(t.tradeType){case exports.TradeType.EXACT_INPUT:n?(i=y?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",a=[d,c,s,l],u=p):r?(i=y?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",a=[p,d,c,s,l],u="0x0"):(i=y?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",a=[p,d,c,s,l],u="0x0");break;case exports.TradeType.EXACT_OUTPUT:y&&o(!1),n?(i="swapETHForExactTokens",a=[d,c,s,l],u=p):r?(i="swapTokensForExactETH",a=[d,p,c,s,l],u="0x0"):(i="swapTokensForExactTokens",a=[d,p,c,s,l],u="0x0")}return{methodName:i,args:a,value:u}},t}(),Et=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Burn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0In",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1In",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount0Out",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1Out",type:"uint256"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Swap",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint112",name:"reserve0",type:"uint112"},{indexed:!1,internalType:"uint112",name:"reserve1",type:"uint112"}],name:"Sync",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MINIMUM_LIQUIDITY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserves",outputs:[{internalType:"uint112",name:"reserve0",type:"uint112"},{internalType:"uint112",name:"reserve1",type:"uint112"},{internalType:"uint32",name:"blockTimestampLast",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"kLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[{internalType:"uint256",name:"liquidity",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"price0CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"price1CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"skim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount0Out",type:"uint256"},{internalType:"uint256",name:"amount1Out",type:"uint256"},{internalType:"address",name:"to",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"sync",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Ot=[{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],qt=((At={})[exports.ChainId.MAINNET]={"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A":9},At),Nt=function(){function t(){}return t.fetchTokenData=function(t,e,n,r,i){try{var a,o,u=function(n){return new Z(t,e,n,r,i)};void 0===n&&(n=f.getDefaultProvider(y.getNetwork(t)));var s="number"==typeof(null===(a=qt)||void 0===a||null===(o=a[t])||void 0===o?void 0:o[e]);return Promise.resolve(s?u(qt[t][e]):Promise.resolve(new l.Contract(e,Ot,n).decimals().then((function(n){var r,i,a;return qt=_({},qt,((a={})[t]=_({},null===(r=qt)||void 0===r?void 0:r[t],((i={})[e]=n,i)),a)),n}))).then(u))}catch(t){return Promise.reject(t)}},t.fetchPairData=function(t,e,n){try{void 0===n&&(n=f.getDefaultProvider(y.getNetwork(t.chainId))),t.chainId!==e.chainId&&o(!1);var r=ft.getAddress(t,e);return Promise.resolve(new l.Contract(r,Et,n).getReserves()).then((function(n){var r=n[0],i=n[1],a=t.sortsBefore(e)?[r,i]:[i,r];return new ft(new ct(t,a[0]),new ct(e,a[1]))}))}catch(t){return Promise.reject(t)}},t}();exports.JSBI=a,exports.CHAIN_FACTORY_ADDRESS=h,exports.CHAIN_INIT_CODE_HASH=T,exports.CHAIN_WETH_ADDRESS=v,exports.Currency=$,exports.CurrencyAmount=dt,exports.ETHER=K,exports.Fetcher=Nt,exports.Fraction=st,exports.InsufficientInputAmountError=X,exports.InsufficientReservesError=W,exports.MINIMUM_LIQUIDITY=w,exports.Pair=ft,exports.Percent=Tt,exports.Price=lt,exports.Route=mt,exports.Router=It,exports.Token=Z,exports.TokenAmount=ct,exports.Trade=kt,exports.WETH=rt,exports.currencyEquals=tt,exports.inputOutputComparator=vt,exports.tradeComparator=wt; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,n,r,i,a=t(require("jsbi")),o=t(require("tiny-invariant")),u=(t(require("tiny-warning")),require("@ethersproject/address")),s=t(require("big.js")),p=t(require("toformat")),c=t(require("decimal.js-light")),d=require("@ethersproject/solidity"),l=require("@ethersproject/contracts"),y=require("@ethersproject/networks"),f=require("@ethersproject/providers");(n=exports.ChainId||(exports.ChainId={}))[n.MAINNET=1]="MAINNET",n[n.TESTNET=3]="TESTNET",n[n.LOCALNET=1337]="LOCALNET",n[n.GHOSTNET=9234]="GHOSTNET",(r=exports.TradeType||(exports.TradeType={}))[r.EXACT_INPUT=0]="EXACT_INPUT",r[r.EXACT_OUTPUT=1]="EXACT_OUTPUT",(i=exports.Rounding||(exports.Rounding={}))[i.ROUND_DOWN=0]="ROUND_DOWN",i[i.ROUND_HALF_UP=1]="ROUND_HALF_UP",i[i.ROUND_UP=2]="ROUND_UP";var m,h={1:"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",3:"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",1337:"0xc04E3a20989b52f0d915038336329227d6301fe9",9234:"0xc04E3a20989b52f0d915038336329227d6301fe9"},T={1:"0xb55e24556c85fc3e614cefca9f291dd0b68ae979f8fb3170a912cf9ff8460507",3:"0xb55e24556c85fc3e614cefca9f291dd0b68ae979f8fb3170a912cf9ff8460507",1337:"0x303170fa7e30812b1d48ae4bee04621ac0f596815fa36c40a8670e6536e021c2",9234:"0x303170fa7e30812b1d48ae4bee04621ac0f596815fa36c40a8670e6536e021c2"},v={1:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",3:"0xa7DDE2DbB0D5454e458383d4E8659a825ADc25e1",1337:"0xD5CEc5CffDce43fAFD3492fa1035DfC69E15f52A",9234:"0xD5CEc5CffDce43fAFD3492fa1035DfC69E15f52A"},w=a.BigInt(1e3),g=a.BigInt(0),b=a.BigInt(1),k=a.BigInt(2),x=a.BigInt(3),A=a.BigInt(5),I=a.BigInt(10),E=a.BigInt(100),O=a.BigInt(9975),q=a.BigInt(1e4);!function(t){t.uint8="uint8",t.uint256="uint256"}(m||(m={}));var C=((e={})[m.uint8]=a.BigInt("0xff"),e[m.uint256]=a.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e);function N(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function P(t,e,n){return e&&N(t.prototype,e),n&&N(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _(){return(_=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 D(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,U(t,e)}function R(t){return(R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function U(t,e){return(U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function S(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function M(t,e,n){return(M=S()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&U(i,n.prototype),i}).apply(null,arguments)}function H(t){var e="function"==typeof Map?new Map:void 0;return(H=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return M(t,arguments,R(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,t)})(t)}function F(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function B(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 j(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 B(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)?B(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var L="setPrototypeOf"in Object,W=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,L&&Object.setPrototypeOf(F(n),(this instanceof e?this.constructor:void 0).prototype),n}return D(e,t),e}(H(Error)),X=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,L&&Object.setPrototypeOf(F(n),(this instanceof e?this.constructor:void 0).prototype),n}return D(e,t),e}(H(Error));function G(t,e){a.greaterThanOrEqual(t,g)||o(!1),a.lessThanOrEqual(t,C[e])||o(!1)}function Y(t){try{return u.getAddress(t)}catch(t){o(!1)}}function Q(t){return t instanceof a?t:a.BigInt("bigint"==typeof t?t.toString():t)}function z(t){G(t,m.uint256);var e,n=g;if(a.greaterThan(t,x))for(n=t,e=a.add(a.divide(t,k),b);a.lessThan(e,n);)n=e,e=a.divide(a.add(a.divide(t,e),e),k);else a.notEqual(t,g)&&(n=b);return n}function J(t,e,n,r){if(n>0||o(!1),t.length<=n||o(!1),0===t.length)return t.push(e),null;var i=t.length===n;if(i&&r(t[t.length-1],e)<=0)return e;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;r(t[s],e)<=0?a=s+1:u=s}return t.splice(a,0,e),i?t.pop():null}var V,$=function(t,e,n){G(a.BigInt(t),m.uint8),this.decimals=t,this.symbol=e,this.name=n},K=$.ETHER=new $(18,"BNB","BNB"),Z=function(t){function e(e,n,r,i,a,o){var u;return(u=t.call(this,r,i,a)||this).chainId=e,u.address=Y(n),u.projectLink=o,u}D(e,t);var n=e.prototype;return n.equals=function(t){return this===t||this.chainId===t.chainId&&this.address===t.address},n.sortsBefore=function(t){return this.chainId!==t.chainId&&o(!1),this.address===t.address&&o(!1),this.address.toLowerCase()<t.address.toLowerCase()},e}($);function tt(t,e){return t instanceof Z&&e instanceof Z?t.equals(e):!(t instanceof Z||e instanceof Z||t!==e)}var et,nt,rt=((V={})[exports.ChainId.MAINNET]=new Z(exports.ChainId.MAINNET,v[exports.ChainId.MAINNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V[exports.ChainId.TESTNET]=new Z(exports.ChainId.TESTNET,v[exports.ChainId.TESTNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V[exports.ChainId.LOCALNET]=new Z(exports.ChainId.LOCALNET,v[exports.ChainId.LOCALNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V[exports.ChainId.GHOSTNET]=new Z(exports.ChainId.GHOSTNET,v[exports.ChainId.GHOSTNET],18,"WETH","Wrapped ETH","https://ethereum.org"),V),it=p(c),at=p(s),ot=((et={})[exports.Rounding.ROUND_DOWN]=it.ROUND_DOWN,et[exports.Rounding.ROUND_HALF_UP]=it.ROUND_HALF_UP,et[exports.Rounding.ROUND_UP]=it.ROUND_UP,et),ut=((nt={})[exports.Rounding.ROUND_DOWN]=0,nt[exports.Rounding.ROUND_HALF_UP]=1,nt[exports.Rounding.ROUND_UP]=3,nt),st=function(){function t(t,e){void 0===e&&(e=b),this.numerator=Q(t),this.denominator=Q(e)}var e=t.prototype;return e.invert=function(){return new t(this.denominator,this.numerator)},e.add=function(e){var n=e instanceof t?e:new t(Q(e));return a.equal(this.denominator,n.denominator)?new t(a.add(this.numerator,n.numerator),this.denominator):new t(a.add(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator)),a.multiply(this.denominator,n.denominator))},e.subtract=function(e){var n=e instanceof t?e:new t(Q(e));return a.equal(this.denominator,n.denominator)?new t(a.subtract(this.numerator,n.numerator),this.denominator):new t(a.subtract(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator)),a.multiply(this.denominator,n.denominator))},e.lessThan=function(e){var n=e instanceof t?e:new t(Q(e));return a.lessThan(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator))},e.equalTo=function(e){var n=e instanceof t?e:new t(Q(e));return a.equal(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator))},e.greaterThan=function(e){var n=e instanceof t?e:new t(Q(e));return a.greaterThan(a.multiply(this.numerator,n.denominator),a.multiply(n.numerator,this.denominator))},e.multiply=function(e){var n=e instanceof t?e:new t(Q(e));return new t(a.multiply(this.numerator,n.numerator),a.multiply(this.denominator,n.denominator))},e.divide=function(e){var n=e instanceof t?e:new t(Q(e));return new t(a.multiply(this.numerator,n.denominator),a.multiply(this.denominator,n.numerator))},e.toSignificant=function(t,e,n){void 0===e&&(e={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>0||o(!1),it.set({precision:t+1,rounding:ot[n]});var r=new it(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return r.toFormat(r.decimalPlaces(),e)},e.toFixed=function(t,e,n){return void 0===e&&(e={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||o(!1),t>=0||o(!1),at.DP=t,at.RM=ut[n],new at(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,e)},P(t,[{key:"quotient",get:function(){return a.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new t(a.remainder(this.numerator,this.denominator),this.denominator)}}]),t}(),pt=p(s),ct=function(t){function e(e,n){var r,i=Q(n);return G(i,m.uint256),(r=t.call(this,i,a.exponentiate(I,a.BigInt(e.decimals)))||this).currency=e,r}D(e,t),e.ether=function(t){return new e(K,t)};var n=e.prototype;return n.add=function(t){return tt(this.currency,t.currency)||o(!1),new e(this.currency,a.add(this.raw,t.raw))},n.subtract=function(t){return tt(this.currency,t.currency)||o(!1),new e(this.currency,a.subtract(this.raw,t.raw))},n.toSignificant=function(e,n,r){return void 0===e&&(e=6),void 0===r&&(r=exports.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,e,n,r)},n.toFixed=function(e,n,r){return void 0===e&&(e=this.currency.decimals),void 0===r&&(r=exports.Rounding.ROUND_DOWN),e<=this.currency.decimals||o(!1),t.prototype.toFixed.call(this,e,n,r)},n.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),pt.DP=this.currency.decimals,new pt(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)},P(e,[{key:"raw",get:function(){return this.numerator}}]),e}(st),dt=function(t){function e(e,n){var r;return(r=t.call(this,e,n)||this).token=e,r}D(e,t);var n=e.prototype;return n.add=function(t){return this.token.equals(t.token)||o(!1),new e(this.token,a.add(this.raw,t.raw))},n.subtract=function(t){return this.token.equals(t.token)||o(!1),new e(this.token,a.subtract(this.raw,t.raw))},e}(ct),lt=function(t){function e(e,n,r,i){var o;return(o=t.call(this,i,r)||this).baseCurrency=e,o.quoteCurrency=n,o.scalar=new st(a.exponentiate(I,a.BigInt(e.decimals)),a.exponentiate(I,a.BigInt(n.decimals))),o}D(e,t),e.fromRoute=function(t){for(var n,r=[],i=j(t.pairs.entries());!(n=i()).done;){var a=n.value,o=a[1];r.push(t.path[a[0]].equals(o.token0)?new e(o.reserve0.currency,o.reserve1.currency,o.reserve0.raw,o.reserve1.raw):new e(o.reserve1.currency,o.reserve0.currency,o.reserve1.raw,o.reserve0.raw))}return r.slice(1).reduce((function(t,e){return t.multiply(e)}),r[0])};var n=e.prototype;return n.invert=function(){return new e(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){tt(this.quoteCurrency,n.baseCurrency)||o(!1);var r=t.prototype.multiply.call(this,n);return new e(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(e){return tt(e.currency,this.baseCurrency)||o(!1),this.quoteCurrency instanceof Z?new dt(this.quoteCurrency,t.prototype.multiply.call(this,e.raw).quotient):ct.ether(t.prototype.multiply.call(this,e.raw).quotient)},n.toSignificant=function(t,e,n){return void 0===t&&(t=6),this.adjusted.toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=4),this.adjusted.toFixed(t,e,n)},P(e,[{key:"raw",get:function(){return new st(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),e}(st),yt={},ft=function(){function t(e,n){var r=e.token.sortsBefore(n.token)?[e,n]:[n,e];this.liquidityToken=new Z(r[0].token.chainId,t.getAddress(r[0].token,r[1].token),18,"GHOST-LP","Ghost LPs"),this.tokenAmounts=r}t.getAddress=function(t,e){var n,r,i,a,o,s=t.sortsBefore(e)?[t,e]:[e,t];return console.log("CHAIN_INIT_CODE_HASH[tokens[0].chainId]",T[s[0].chainId]),void 0===(null===(n=yt)||void 0===n||null===(r=n[s[0].address])||void 0===r?void 0:r[s[1].address])&&(yt=_({},yt,((o={})[s[0].address]=_({},null===(i=yt)||void 0===i?void 0:i[s[0].address],((a={})[s[1].address]=u.getCreate2Address(h[s[0].chainId],d.keccak256(["bytes"],[d.pack(["address","address"],[s[0].address,s[1].address])]),T[s[0].chainId]),a)),o))),yt[s[0].address][s[1].address]};var e=t.prototype;return e.involvesToken=function(t){return t.equals(this.token0)||t.equals(this.token1)},e.priceOf=function(t){return this.involvesToken(t)||o(!1),t.equals(this.token0)?this.token0Price:this.token1Price},e.reserveOf=function(t){return this.involvesToken(t)||o(!1),t.equals(this.token0)?this.reserve0:this.reserve1},e.getOutputAmount=function(e){if(this.involvesToken(e.token)||o(!1),a.equal(this.reserve0.raw,g)||a.equal(this.reserve1.raw,g))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),i=a.multiply(e.raw,O),u=a.multiply(i,r.raw),s=a.add(a.multiply(n.raw,q),i),p=new dt(e.token.equals(this.token0)?this.token1:this.token0,a.divide(u,s));if(a.equal(p.raw,g))throw new X;return[p,new t(n.add(e),r.subtract(p))]},e.getInputAmount=function(e){if(this.involvesToken(e.token)||o(!1),a.equal(this.reserve0.raw,g)||a.equal(this.reserve1.raw,g)||a.greaterThanOrEqual(e.raw,this.reserveOf(e.token).raw))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),i=a.multiply(a.multiply(r.raw,e.raw),q),u=a.multiply(a.subtract(n.raw,e.raw),O),s=new dt(e.token.equals(this.token0)?this.token1:this.token0,a.add(a.divide(i,u),b));return[s,new t(r.add(s),n.subtract(e))]},e.getLiquidityMinted=function(t,e,n){t.token.equals(this.liquidityToken)||o(!1);var r,i=e.token.sortsBefore(n.token)?[e,n]:[n,e];if(i[0].token.equals(this.token0)&&i[1].token.equals(this.token1)||o(!1),a.equal(t.raw,g))r=a.subtract(z(a.multiply(i[0].raw,i[1].raw)),w);else{var u=a.divide(a.multiply(i[0].raw,t.raw),this.reserve0.raw),s=a.divide(a.multiply(i[1].raw,t.raw),this.reserve1.raw);r=a.lessThanOrEqual(u,s)?u:s}if(!a.greaterThan(r,g))throw new X;return new dt(this.liquidityToken,r)},e.getLiquidityValue=function(t,e,n,r,i){var u;if(void 0===r&&(r=!1),this.involvesToken(t)||o(!1),e.token.equals(this.liquidityToken)||o(!1),n.token.equals(this.liquidityToken)||o(!1),a.lessThanOrEqual(n.raw,e.raw)||o(!1),r){i||o(!1);var s=Q(i);if(a.equal(s,g))u=e;else{var p=z(a.multiply(this.reserve0.raw,this.reserve1.raw)),c=z(s);if(a.greaterThan(p,c)){var d=a.multiply(e.raw,a.subtract(p,c)),l=a.add(a.multiply(p,A),c),y=a.divide(d,l);u=e.add(new dt(this.liquidityToken,y))}else u=e}}else u=e;return new dt(t,a.divide(a.multiply(n.raw,this.reserveOf(t).raw),u.raw))},P(t,[{key:"token0Price",get:function(){return new lt(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new lt(this.token1,this.token0,this.tokenAmounts[1].raw,this.tokenAmounts[0].raw)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].token}},{key:"token1",get:function(){return this.tokenAmounts[1].token}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),t}(),mt=function(){function t(t,e,n){t.length>0||o(!1),t.every((function(e){return e.chainId===t[0].chainId}))||o(!1),e instanceof Z&&t[0].involvesToken(e)||e===K&&t[0].involvesToken(rt[t[0].chainId])||o(!1),void 0===n||n instanceof Z&&t[t.length-1].involvesToken(n)||n===K&&t[t.length-1].involvesToken(rt[t[0].chainId])||o(!1);for(var r,i=[e instanceof Z?e:rt[t[0].chainId]],a=j(t.entries());!(r=a()).done;){var u=r.value,s=u[1],p=i[u[0]];p.equals(s.token0)||p.equals(s.token1)||o(!1);var c=p.equals(s.token0)?s.token1:s.token0;i.push(c)}this.pairs=t,this.path=i,this.midPrice=lt.fromRoute(this),this.input=e,this.output=null!=n?n:i[i.length-1]}return P(t,[{key:"chainId",get:function(){return this.pairs[0].chainId}}]),t}(),ht=new st(E),Tt=function(t){function e(){return t.apply(this,arguments)||this}D(e,t);var n=e.prototype;return n.toSignificant=function(t,e,n){return void 0===t&&(t=5),this.multiply(ht).toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=2),this.multiply(ht).toFixed(t,e,n)},e}(st);function vt(t,e){return tt(t.inputAmount.currency,e.inputAmount.currency)||o(!1),tt(t.outputAmount.currency,e.outputAmount.currency)||o(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?0:t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}function wt(t,e){var n=vt(t,e);return 0!==n?n:t.priceImpact.lessThan(e.priceImpact)?-1:t.priceImpact.greaterThan(e.priceImpact)?1:t.route.path.length-e.route.path.length}function gt(t,e){return t instanceof dt?t:t.currency===K?new dt(rt[e],t.raw):void o(!1)}function bt(t,e){return t instanceof Z?t:t===K?rt[e]:void o(!1)}var kt=function(){function t(t,e,n){var r,i,a,u=new Array(t.path.length),s=new Array(t.pairs.length);if(n===exports.TradeType.EXACT_INPUT){tt(e.currency,t.input)||o(!1),u[0]=gt(e,t.chainId);for(var p=0;p<t.path.length-1;p++){var c=t.pairs[p].getOutputAmount(u[p]),d=c[1];u[p+1]=c[0],s[p]=d}}else{tt(e.currency,t.output)||o(!1),u[u.length-1]=gt(e,t.chainId);for(var l=t.path.length-1;l>0;l--){var y=t.pairs[l-1].getInputAmount(u[l]),f=y[1];u[l-1]=y[0],s[l-1]=f}}this.route=t,this.tradeType=n,this.inputAmount=n===exports.TradeType.EXACT_INPUT?e:t.input===K?ct.ether(u[0].raw):u[0],this.outputAmount=n===exports.TradeType.EXACT_OUTPUT?e:t.output===K?ct.ether(u[u.length-1].raw):u[u.length-1],this.executionPrice=new lt(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=lt.fromRoute(new mt(s,t.input)),this.priceImpact=(r=this.outputAmount,a=(i=t.midPrice.raw.multiply(this.inputAmount.raw)).subtract(r.raw).divide(i),new Tt(a.numerator,a.denominator))}t.exactIn=function(e,n){return new t(e,n,exports.TradeType.EXACT_INPUT)},t.exactOut=function(e,n){return new t(e,n,exports.TradeType.EXACT_OUTPUT)};var e=t.prototype;return e.minimumAmountOut=function(t){if(t.lessThan(g)&&o(!1),this.tradeType===exports.TradeType.EXACT_OUTPUT)return this.outputAmount;var e=new st(b).add(t).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof dt?new dt(this.outputAmount.token,e):ct.ether(e)},e.maximumAmountIn=function(t){if(t.lessThan(g)&&o(!1),this.tradeType===exports.TradeType.EXACT_INPUT)return this.inputAmount;var e=new st(b).add(t).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof dt?new dt(this.inputAmount.token,e):ct.ether(e)},t.bestTradeExactIn=function(e,n,r,i,a,u,s){var p=void 0===i?{}:i,c=p.maxNumResults,d=void 0===c?3:c,l=p.maxHops,y=void 0===l?3:l;void 0===a&&(a=[]),void 0===u&&(u=n),void 0===s&&(s=[]),e.length>0||o(!1),y>0||o(!1),u===n||a.length>0||o(!1);var f=n instanceof dt?n.token.chainId:r instanceof Z?r.chainId:void 0;void 0===f&&o(!1);for(var m=gt(n,f),h=bt(r,f),T=0;T<e.length;T++){var v=e[T];if((v.token0.equals(m.token)||v.token1.equals(m.token))&&!v.reserve0.equalTo(g)&&!v.reserve1.equalTo(g)){var w=void 0;try{w=v.getOutputAmount(m)[0]}catch(t){if(t.isInsufficientInputAmountError)continue;throw t}if(w.token.equals(h))J(s,new t(new mt([].concat(a,[v]),u.currency,r),u,exports.TradeType.EXACT_INPUT),d,wt);else if(y>1&&e.length>1){var b=e.slice(0,T).concat(e.slice(T+1,e.length));t.bestTradeExactIn(b,w,r,{maxNumResults:d,maxHops:y-1},[].concat(a,[v]),u,s)}}}return s},t.bestTradeExactOut=function(e,n,r,i,a,u,s){var p=void 0===i?{}:i,c=p.maxNumResults,d=void 0===c?3:c,l=p.maxHops,y=void 0===l?3:l;void 0===a&&(a=[]),void 0===u&&(u=r),void 0===s&&(s=[]),e.length>0||o(!1),y>0||o(!1),u===r||a.length>0||o(!1);var f=r instanceof dt?r.token.chainId:n instanceof Z?n.chainId:void 0;void 0===f&&o(!1);for(var m=gt(r,f),h=bt(n,f),T=0;T<e.length;T++){var v=e[T];if((v.token0.equals(m.token)||v.token1.equals(m.token))&&!v.reserve0.equalTo(g)&&!v.reserve1.equalTo(g)){var w=void 0;try{w=v.getInputAmount(m)[0]}catch(t){if(t.isInsufficientReservesError)continue;throw t}if(w.token.equals(h))J(s,new t(new mt([v].concat(a),n,u.currency),u,exports.TradeType.EXACT_OUTPUT),d,wt);else if(y>1&&e.length>1){var b=e.slice(0,T).concat(e.slice(T+1,e.length));t.bestTradeExactOut(b,n,w,{maxNumResults:d,maxHops:y-1},[v].concat(a),u,s)}}}return s},t}();function xt(t){return"0x"+t.raw.toString(16)}var At,It=function(){function t(){}return t.swapCallParameters=function(t,e){var n=t.inputAmount.currency===K,r=t.outputAmount.currency===K;n&&r&&o(!1),!("ttl"in e)||e.ttl>0||o(!1);var i,a,u,s=Y(e.recipient),p=xt(t.maximumAmountIn(e.allowedSlippage)),c=xt(t.minimumAmountOut(e.allowedSlippage)),d=t.route.path.map((function(t){return t.address})),l="ttl"in e?"0x"+(Math.floor((new Date).getTime()/1e3)+e.ttl).toString(16):"0x"+e.deadline.toString(16),y=Boolean(e.feeOnTransfer);switch(t.tradeType){case exports.TradeType.EXACT_INPUT:n?(i=y?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",a=[c,d,s,l],u=p):r?(i=y?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",a=[p,c,d,s,l],u="0x0"):(i=y?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",a=[p,c,d,s,l],u="0x0");break;case exports.TradeType.EXACT_OUTPUT:y&&o(!1),n?(i="swapETHForExactTokens",a=[c,d,s,l],u=p):r?(i="swapTokensForExactETH",a=[c,p,d,s,l],u="0x0"):(i="swapTokensForExactTokens",a=[c,p,d,s,l],u="0x0")}return{methodName:i,args:a,value:u}},t}(),Et=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Burn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0In",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1In",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount0Out",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1Out",type:"uint256"},{indexed:!0,internalType:"address",name:"to",type:"address"}],name:"Swap",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint112",name:"reserve0",type:"uint112"},{indexed:!1,internalType:"uint112",name:"reserve1",type:"uint112"}],name:"Sync",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MINIMUM_LIQUIDITY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserves",outputs:[{internalType:"uint112",name:"reserve0",type:"uint112"},{internalType:"uint112",name:"reserve1",type:"uint112"},{internalType:"uint32",name:"blockTimestampLast",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"kLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[{internalType:"uint256",name:"liquidity",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"price0CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"price1CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"skim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount0Out",type:"uint256"},{internalType:"uint256",name:"amount1Out",type:"uint256"},{internalType:"address",name:"to",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"sync",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],Ot=[{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],qt=((At={})[exports.ChainId.MAINNET]={"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A":9},At),Ct=function(){function t(){}return t.fetchTokenData=function(t,e,n,r,i){try{var a,o,u=function(n){return new Z(t,e,n,r,i)};void 0===n&&(n=f.getDefaultProvider(y.getNetwork(t)));var s="number"==typeof(null===(a=qt)||void 0===a||null===(o=a[t])||void 0===o?void 0:o[e]);return Promise.resolve(s?u(qt[t][e]):Promise.resolve(new l.Contract(e,Ot,n).decimals().then((function(n){var r,i,a;return qt=_({},qt,((a={})[t]=_({},null===(r=qt)||void 0===r?void 0:r[t],((i={})[e]=n,i)),a)),n}))).then(u))}catch(t){return Promise.reject(t)}},t.fetchPairData=function(t,e,n){try{void 0===n&&(n=f.getDefaultProvider(y.getNetwork(t.chainId))),t.chainId!==e.chainId&&o(!1);var r=ft.getAddress(t,e);return Promise.resolve(new l.Contract(r,Et,n).getReserves()).then((function(n){var r=n[0],i=n[1],a=t.sortsBefore(e)?[r,i]:[i,r];return new ft(new dt(t,a[0]),new dt(e,a[1]))}))}catch(t){return Promise.reject(t)}},t}();exports.JSBI=a,exports.CHAIN_FACTORY_ADDRESS=h,exports.CHAIN_INIT_CODE_HASH=T,exports.CHAIN_WETH_ADDRESS=v,exports.Currency=$,exports.CurrencyAmount=ct,exports.ETHER=K,exports.Fetcher=Ct,exports.Fraction=st,exports.InsufficientInputAmountError=X,exports.InsufficientReservesError=W,exports.MINIMUM_LIQUIDITY=w,exports.Pair=ft,exports.Percent=Tt,exports.Price=lt,exports.Route=mt,exports.Router=It,exports.Token=Z,exports.TokenAmount=dt,exports.Trade=kt,exports.WETH=rt,exports.currencyEquals=tt,exports.inputOutputComparator=vt,exports.tradeComparator=wt; | ||
//# sourceMappingURL=eth-ghost-sdk.cjs.production.min.js.map |
{ | ||
"name": "@ghost-nft/eth-ghost-sdk", | ||
"license": "MIT", | ||
"version": "1.0.27", | ||
"version": "1.0.29", | ||
"description": "🛠 An SDK for building applications on top of Pancakeswap.", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package