@qidao/sdk 5.0.2 → 5.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +11 -1
- package/dist/entities/currency.d.ts +20 -0
- package/dist/entities/token.d.ts +11 -1
- package/dist/sdk.cjs.development.js +35 -16
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +35 -16
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,n,r,o,i,a,s,u,d,p,c,h=e(require("jsbi")),C=e(require("tiny-invariant")),T=(e(require("tiny-warning")),require("@ethersproject/address")),I=e(require("big.js")),x=e(require("toformat")),f=e(require("decimal.js-light")),A=require("@ethersproject/solidity"),E=require("@ethersproject/contracts"),l=require("@ethersproject/networks"),N=require("@ethersproject/providers"),O=e(require("@uniswap/v2-core/build/IUniswapV2Pair.json"));(d=exports.ChainId||(exports.ChainId={}))[d.MAINNET=1]="MAINNET",d[d.ROPSTEN=3]="ROPSTEN",d[d.RINKEBY=4]="RINKEBY",d[d["GÖRLI"]=5]="GÖRLI",d[d.KOVAN=42]="KOVAN",d[d.MATIC=137]="MATIC",d[d.MATIC_TESTNET=80001]="MATIC_TESTNET",d[d.FANTOM=250]="FANTOM",d[d.FANTOM_TESTNET=4002]="FANTOM_TESTNET",d[d.XDAI=100]="XDAI",d[d.BSC=56]="BSC",d[d.BSC_TESTNET=97]="BSC_TESTNET",d[d.ARBITRUM=42161]="ARBITRUM",d[d.MOONBASE=1287]="MOONBASE",d[d.AVALANCHE=43114]="AVALANCHE",d[d.FUJI=43113]="FUJI",d[d.HECO=128]="HECO",d[d.HECO_TESTNET=256]="HECO_TESTNET",d[d.HARMONY=16666e5]="HARMONY",d[d.HARMONY_TESTNET=16667e5]="HARMONY_TESTNET",d[d.MOONRIVER=1285]="MOONRIVER",d[d.CRONOS=25]="CRONOS",d[d.OPTIMISM=10]="OPTIMISM",(p=exports.TradeType||(exports.TradeType={}))[p.EXACT_INPUT=0]="EXACT_INPUT",p[p.EXACT_OUTPUT=1]="EXACT_OUTPUT",(c=exports.Rounding||(exports.Rounding={}))[c.ROUND_DOWN=0]="ROUND_DOWN",c[c.ROUND_HALF_UP=1]="ROUND_HALF_UP",c[c.ROUND_UP=2]="ROUND_UP";var m,v="0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303",b=((t={})[exports.ChainId.MAINNET]="0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac",t[exports.ChainId.ROPSTEN]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.RINKEBY]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.GÖRLI]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.KOVAN]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.FANTOM]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.FANTOM_TESTNET]="",t[exports.ChainId.MATIC]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.MATIC_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.XDAI]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.BSC]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.BSC_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.ARBITRUM]="",t[exports.ChainId.MOONBASE]="0x2Ce3F07dD4c62b56a502E223A7cBE38b1d77A1b5",t[exports.ChainId.AVALANCHE]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.FUJI]="0xd00ae08403B9bbb9124bB305C09058E32C39A48c",t[exports.ChainId.HECO]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.HECO_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.HARMONY]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.HARMONY_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.MOONRIVER]="",t[exports.ChainId.CRONOS]="",t[exports.ChainId.OPTIMISM]="",t),y=((n={})[exports.ChainId.MAINNET]="0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",n[exports.ChainId.RINKEBY]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.ROPSTEN]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.GÖRLI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.KOVAN]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.FANTOM]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.FANTOM_TESTNET]="",n[exports.ChainId.MATIC]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.MATIC_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.XDAI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.BSC]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.BSC_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.ARBITRUM]="",n[exports.ChainId.MOONBASE]="0xeB5c2BB5E83B51d83F3534Ae21E84336B8B376ef",n[exports.ChainId.AVALANCHE]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.FUJI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HECO]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HECO_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HARMONY]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HARMONY_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.MOONRIVER]="",n[exports.ChainId.CRONOS]="",n[exports.ChainId.OPTIMISM]="",n),D=((r={})[exports.ChainId.MAINNET]="0x6B3595068778DD592e39A122f4f5a5cF09C90fE2",r[exports.ChainId.ROPSTEN]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.RINKEBY]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.GÖRLI]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.KOVAN]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.FANTOM]="",r[exports.ChainId.FANTOM_TESTNET]="",r[exports.ChainId.MATIC]="",r[exports.ChainId.MATIC_TESTNET]="",r[exports.ChainId.XDAI]="",r[exports.ChainId.BSC]="",r[exports.ChainId.BSC_TESTNET]="",r[exports.ChainId.ARBITRUM]="",r[exports.ChainId.MOONBASE]="",r[exports.ChainId.AVALANCHE]="",r[exports.ChainId.FUJI]="",r[exports.ChainId.HECO]="",r[exports.ChainId.HECO_TESTNET]="",r[exports.ChainId.HARMONY]="",r[exports.ChainId.HARMONY_TESTNET]="",r[exports.ChainId.MOONRIVER]="",r[exports.ChainId.CRONOS]="",r[exports.ChainId.OPTIMISM]="",r),B=((o={})[exports.ChainId.MAINNET]="0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd",o[exports.ChainId.ROPSTEN]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.RINKEBY]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.GÖRLI]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.KOVAN]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.FANTOM]="",o[exports.ChainId.FANTOM_TESTNET]="",o[exports.ChainId.MATIC]="",o[exports.ChainId.MATIC_TESTNET]="",o[exports.ChainId.XDAI]="",o[exports.ChainId.BSC]="",o[exports.ChainId.BSC_TESTNET]="",o[exports.ChainId.ARBITRUM]="",o[exports.ChainId.MOONBASE]="",o[exports.ChainId.AVALANCHE]="",o[exports.ChainId.FUJI]="",o[exports.ChainId.HECO]="",o[exports.ChainId.HECO_TESTNET]="",o[exports.ChainId.HARMONY]="",o[exports.ChainId.HARMONY_TESTNET]="",o[exports.ChainId.MOONRIVER]="",o[exports.ChainId.CRONOS]="",o[exports.ChainId.OPTIMISM]="",o),w=((i={})[exports.ChainId.MAINNET]="0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272",i[exports.ChainId.ROPSTEN]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.RINKEBY]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.GÖRLI]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.KOVAN]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.FANTOM]="",i[exports.ChainId.FANTOM_TESTNET]="",i[exports.ChainId.MATIC]="",i[exports.ChainId.MATIC_TESTNET]="",i[exports.ChainId.XDAI]="",i[exports.ChainId.BSC]="",i[exports.ChainId.BSC_TESTNET]="",i[exports.ChainId.ARBITRUM]="",i[exports.ChainId.MOONBASE]="",i[exports.ChainId.AVALANCHE]="",i[exports.ChainId.FUJI]="",i[exports.ChainId.HECO]="",i[exports.ChainId.HECO_TESTNET]="",i[exports.ChainId.HARMONY]="",i[exports.ChainId.HARMONY_TESTNET]="",i[exports.ChainId.MOONRIVER]="",i[exports.ChainId.CRONOS]="",i[exports.ChainId.OPTIMISM]="",i),R=((a={})[exports.ChainId.MAINNET]="0xE11fc0B43ab98Eb91e9836129d1ee7c3Bc95df50",a[exports.ChainId.ROPSTEN]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.RINKEBY]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.GÖRLI]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.KOVAN]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.FANTOM]="",a[exports.ChainId.FANTOM_TESTNET]="",a[exports.ChainId.MATIC]="",a[exports.ChainId.MATIC_TESTNET]="",a[exports.ChainId.XDAI]="",a[exports.ChainId.BSC]="",a[exports.ChainId.BSC_TESTNET]="",a[exports.ChainId.ARBITRUM]="",a[exports.ChainId.MOONBASE]="",a[exports.ChainId.AVALANCHE]="",a[exports.ChainId.FUJI]="",a[exports.ChainId.HECO]="",a[exports.ChainId.HECO_TESTNET]="",a[exports.ChainId.HARMONY]="",a[exports.ChainId.HARMONY_TESTNET]="",a[exports.ChainId.MOONRIVER]="",a[exports.ChainId.CRONOS]="",a[exports.ChainId.OPTIMISM]="",a),M=((s={})[exports.ChainId.MAINNET]="0x9a8541Ddf3a932a9A922B607e9CF7301f1d47bD1",s[exports.ChainId.ROPSTEN]="",s[exports.ChainId.RINKEBY]="",s[exports.ChainId.GÖRLI]="",s[exports.ChainId.KOVAN]="",s[exports.ChainId.FANTOM]="",s[exports.ChainId.FANTOM_TESTNET]="",s[exports.ChainId.MATIC]="",s[exports.ChainId.MATIC_TESTNET]="",s[exports.ChainId.XDAI]="",s[exports.ChainId.BSC]="",s[exports.ChainId.BSC_TESTNET]="",s[exports.ChainId.ARBITRUM]="",s[exports.ChainId.MOONBASE]="",s[exports.ChainId.AVALANCHE]="",s[exports.ChainId.FUJI]="",s[exports.ChainId.HECO]="",s[exports.ChainId.HECO_TESTNET]="",s[exports.ChainId.HARMONY]="",s[exports.ChainId.HARMONY_TESTNET]="",s[exports.ChainId.MOONRIVER]="",s[exports.ChainId.CRONOS]="",s[exports.ChainId.OPTIMISM]="",s),S=h.BigInt(1e3),g=h.BigInt(0),k=h.BigInt(1),F=h.BigInt(2),_=h.BigInt(3),H=h.BigInt(5),P=h.BigInt(10),U=h.BigInt(100),q=h.BigInt(997),V=h.BigInt(1e3);!function(e){e.uint8="uint8",e.uint256="uint256"}(m||(m={}));var W=((u={})[m.uint8]=h.BigInt("0xff"),u[m.uint256]=h.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),u);function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function X(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Y(){return(Y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function j(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,G(e,t)}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function G(e,t){return(G=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function J(){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(e){return!1}}function Q(e,t,n){return(Q=J()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&G(o,n.prototype),o}).apply(null,arguments)}function $(e){var t="function"==typeof Map?new Map:void 0;return($=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return Q(e,arguments,K(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),G(n,e)})(e)}function z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Z(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var te,ne="setPrototypeOf"in Object,re=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,ne&&Object.setPrototypeOf(z(n),(this instanceof t?this.constructor:void 0).prototype),n}return j(t,e),t}($(Error)),oe=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,ne&&Object.setPrototypeOf(z(n),(this instanceof t?this.constructor:void 0).prototype),n}return j(t,e),t}($(Error));function ie(e,t){h.greaterThanOrEqual(e,g)||C(!1),h.lessThanOrEqual(e,W[t])||C(!1)}function ae(e){try{return T.getAddress(e)}catch(e){C(!1)}}function se(e){return e instanceof h?e:h.BigInt("bigint"==typeof e?e.toString():e)}function ue(e){ie(e,m.uint256);var t,n=g;if(h.greaterThan(e,_))for(n=e,t=h.add(h.divide(e,F),k);h.lessThan(t,n);)n=t,t=h.divide(h.add(h.divide(e,t),t),F);else h.notEqual(e,g)&&(n=k);return n}function de(e,t,n,r){if(n>0||C(!1),e.length<=n||C(!1),0===e.length)return e.push(t),null;var o=e.length===n;if(o&&r(e[e.length-1],t)<=0)return t;for(var i=0,a=e.length;i<a;){var s=i+a>>>1;r(e[s],t)<=0?i=s+1:a=s}return e.splice(i,0,t),o?e.pop():null}var pe=function(){function e(e,t,n){ie(h.BigInt(e),m.uint8),this.decimals=e,this.symbol=t,this.name=n}e.getNativeCurrency=function(t){if(!t)throw Error("No chainId "+t);if(!(t in e.NATIVE))throw Error("No native currency defined for chainId "+t);return e.NATIVE[t]},e.getNativeCurrencySymbol=function(e){return this.getNativeCurrency(e).symbol},e.getNativeCurrencyName=function(e){return this.getNativeCurrency(e).name};var t=e.prototype;return t.getSymbol=function(t){return t&&"ETH"===(null==this?void 0:this.symbol)?e.getNativeCurrencySymbol(t):null==this?void 0:this.symbol},t.getName=function(t){return t&&"Ether"===(null==this?void 0:this.name)?e.getNativeCurrencyName(t):null==this?void 0:this.name},e}();pe.ETHER=new pe(18,"ETH","Ether"),pe.BNB=new pe(18,"BNB","Binance Coin"),pe.FTM=new pe(18,"FTM","Fantom"),pe.MATIC=new pe(18,"MATIC","Matic"),pe.XDAI=new pe(18,"XDAI","xDai"),pe.GLMR=new pe(18,"GLMR","Glimmer"),pe.AVAX=new pe(18,"AVAX","Avalanche"),pe.HT=new pe(18,"HT","Heco Token"),pe.ONE=new pe(18,"ONE","Harmony"),pe.MOVR=new pe(18,"MOVR","Moonriver"),pe.CRO=new pe(18,"CRO","Cronos"),pe.NATIVE=((te={})[exports.ChainId.MAINNET]=pe.ETHER,te[exports.ChainId.ROPSTEN]=pe.ETHER,te[exports.ChainId.RINKEBY]=pe.ETHER,te[exports.ChainId.GÖRLI]=pe.ETHER,te[exports.ChainId.KOVAN]=pe.ETHER,te[exports.ChainId.FANTOM]=pe.FTM,te[exports.ChainId.FANTOM_TESTNET]=pe.FTM,te[exports.ChainId.MATIC]=pe.MATIC,te[exports.ChainId.MATIC_TESTNET]=pe.MATIC,te[exports.ChainId.XDAI]=pe.XDAI,te[exports.ChainId.BSC]=pe.BNB,te[exports.ChainId.BSC_TESTNET]=pe.BNB,te[exports.ChainId.ARBITRUM]=pe.ETHER,te[exports.ChainId.MOONBASE]=pe.GLMR,te[exports.ChainId.AVALANCHE]=pe.AVAX,te[exports.ChainId.FUJI]=pe.AVAX,te[exports.ChainId.HECO]=pe.HT,te[exports.ChainId.HECO_TESTNET]=pe.HT,te[exports.ChainId.HARMONY]=pe.ONE,te[exports.ChainId.HARMONY_TESTNET]=pe.ONE,te[exports.ChainId.CRONOS]=pe.CRO,te[exports.ChainId.MOONRIVER]=pe.MOVR,te[exports.ChainId.OPTIMISM]=pe.ETHER,te);var ce,he=pe.ETHER,Ce=function(e){function t(t,n,r,o,i){var a;return(a=e.call(this,r,o,i)||this).chainId=t,a.address=ae(n),a}j(t,e);var n=t.prototype;return n.equals=function(e){return this===e||this.chainId===e.chainId&&this.address===e.address},n.sortsBefore=function(e){return this.chainId!==e.chainId&&C(!1),this.address===e.address&&C(!1),this.address.toLowerCase()<e.address.toLowerCase()},t}(pe);function Te(e,t){return e instanceof Ce&&t instanceof Ce?e.equals(t):!(e instanceof Ce||t instanceof Ce||e!==t)}var Ie,xe,fe=((ce={})[exports.ChainId.MAINNET]=new Ce(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),ce[exports.ChainId.ROPSTEN]=new Ce(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),ce[exports.ChainId.RINKEBY]=new Ce(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),ce[exports.ChainId.GÖRLI]=new Ce(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),ce[exports.ChainId.KOVAN]=new Ce(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),ce[exports.ChainId.FANTOM]=new Ce(exports.ChainId.FANTOM,"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",18,"WFTM","Wrapped FTM"),ce[exports.ChainId.FANTOM_TESTNET]=new Ce(exports.ChainId.FANTOM_TESTNET,"0xf1277d1Ed8AD466beddF92ef448A132661956621",18,"FTM","Wrapped FTM"),ce[exports.ChainId.MATIC]=new Ce(exports.ChainId.MATIC,"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",18,"WMATIC","Wrapped Matic"),ce[exports.ChainId.MATIC_TESTNET]=new Ce(exports.ChainId.MATIC_TESTNET,"0x5B67676a984807a212b1c59eBFc9B3568a474F0a",18,"WMATIC","Wrapped Matic"),ce[exports.ChainId.XDAI]=new Ce(exports.ChainId.XDAI,"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",18,"WXDAI","Wrapped xDai"),ce[exports.ChainId.BSC]=new Ce(exports.ChainId.BSC,"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",18,"WBNB","Wrapped BNB"),ce[exports.ChainId.BSC_TESTNET]=new Ce(exports.ChainId.BSC_TESTNET,"0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd",18,"WBNB","Wrapped BNB"),ce[exports.ChainId.ARBITRUM]=new Ce(exports.ChainId.ARBITRUM,"0xf8456e5e6A225C2C1D74D8C9a4cB2B1d5dc1153b",18,"WETH","Wrapped Ether"),ce[exports.ChainId.MOONBASE]=new Ce(exports.ChainId.MOONBASE,"0xe73763DB808ecCDC0E36bC8E32510ED126910394",18,"WETH","Wrapped Ether"),ce[exports.ChainId.AVALANCHE]=new Ce(exports.ChainId.AVALANCHE,"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",18,"WAVAX","Wrapped AVAX"),ce[exports.ChainId.FUJI]=new Ce(exports.ChainId.FUJI,"0xd00ae08403B9bbb9124bB305C09058E32C39A48c",18,"WAVAX","Wrapped AVAX"),ce[exports.ChainId.HECO]=new Ce(exports.ChainId.HECO,"0x5545153CCFcA01fbd7Dd11C0b23ba694D9509A6F",18,"WHT","Wrapped HT"),ce[exports.ChainId.HECO_TESTNET]=new Ce(exports.ChainId.HECO_TESTNET,"0x5B2DA6F42CA09C77D577a12BeaD0446148830687",18,"WHT","Wrapped HT"),ce[exports.ChainId.HARMONY]=new Ce(exports.ChainId.HARMONY,"0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a",18,"WONE","Wrapped ONE"),ce[exports.ChainId.HARMONY_TESTNET]=new Ce(exports.ChainId.HARMONY_TESTNET,"0x7a2afac38517d512E55C0bCe3b6805c10a04D60F",18,"WONE","Wrapped ONE"),ce[exports.ChainId.CRONOS]=new Ce(exports.ChainId.CRONOS,"0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23",18,"WCRO","Wrapped CRO"),ce[exports.ChainId.OPTIMISM]=new Ce(exports.ChainId.OPTIMISM,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),ce[exports.ChainId.MOONRIVER]=new Ce(exports.ChainId.MOONRIVER,"0x98878B06940aE243284CA214f92Bb71a2b032B8A",18," WMOVR"," Wrapped MOVR"),ce),Ae=x(f),Ee=x(I),le=((Ie={})[exports.Rounding.ROUND_DOWN]=Ae.ROUND_DOWN,Ie[exports.Rounding.ROUND_HALF_UP]=Ae.ROUND_HALF_UP,Ie[exports.Rounding.ROUND_UP]=Ae.ROUND_UP,Ie),Ne=((xe={})[exports.Rounding.ROUND_DOWN]=0,xe[exports.Rounding.ROUND_HALF_UP]=1,xe[exports.Rounding.ROUND_UP]=3,xe),Oe=function(){function e(e,t){void 0===t&&(t=k),this.numerator=se(e),this.denominator=se(t)}var t=e.prototype;return t.invert=function(){return new e(this.denominator,this.numerator)},t.add=function(t){var n=t instanceof e?t:new e(se(t));return h.equal(this.denominator,n.denominator)?new e(h.add(this.numerator,n.numerator),this.denominator):new e(h.add(h.multiply(this.numerator,n.denominator),h.multiply(n.numerator,this.denominator)),h.multiply(this.denominator,n.denominator))},t.subtract=function(t){var n=t instanceof e?t:new e(se(t));return h.equal(this.denominator,n.denominator)?new e(h.subtract(this.numerator,n.numerator),this.denominator):new e(h.subtract(h.multiply(this.numerator,n.denominator),h.multiply(n.numerator,this.denominator)),h.multiply(this.denominator,n.denominator))},t.lessThan=function(t){var n=t instanceof e?t:new e(se(t));return h.lessThan(h.multiply(this.numerator,n.denominator),h.multiply(n.numerator,this.denominator))},t.equalTo=function(t){var n=t instanceof e?t:new e(se(t));return h.equal(h.multiply(this.numerator,n.denominator),h.multiply(n.numerator,this.denominator))},t.greaterThan=function(t){var n=t instanceof e?t:new e(se(t));return h.greaterThan(h.multiply(this.numerator,n.denominator),h.multiply(n.numerator,this.denominator))},t.multiply=function(t){var n=t instanceof e?t:new e(se(t));return new e(h.multiply(this.numerator,n.numerator),h.multiply(this.denominator,n.denominator))},t.divide=function(t){var n=t instanceof e?t:new e(se(t));return new e(h.multiply(this.numerator,n.denominator),h.multiply(this.denominator,n.numerator))},t.toSignificant=function(e,t,n){void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(e)||C(!1),e>0||C(!1),Ae.set({precision:e+1,rounding:le[n]});var r=new Ae(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)},t.toFixed=function(e,t,n){return void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(e)||C(!1),e>=0||C(!1),Ee.DP=e,Ee.RM=Ne[n],new Ee(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)},X(e,[{key:"quotient",get:function(){return h.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new e(h.remainder(this.numerator,this.denominator),this.denominator)}}]),e}(),me=x(I),ve=function(e){function t(t,n){var r,o=se(n);return ie(o,m.uint256),(r=e.call(this,o,h.exponentiate(P,h.BigInt(t.decimals)))||this).currency=t,r}j(t,e),t.ether=function(e){return new t(he,e)};var n=t.prototype;return n.add=function(e){return Te(this.currency,e.currency)||C(!1),new t(this.currency,h.add(this.raw,e.raw))},n.subtract=function(e){return Te(this.currency,e.currency)||C(!1),new t(this.currency,h.subtract(this.raw,e.raw))},n.toSignificant=function(t,n,r){return void 0===t&&(t=6),void 0===r&&(r=exports.Rounding.ROUND_DOWN),e.prototype.toSignificant.call(this,t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=this.currency.decimals),void 0===r&&(r=exports.Rounding.ROUND_DOWN),t<=this.currency.decimals||C(!1),e.prototype.toFixed.call(this,t,n,r)},n.toExact=function(e){return void 0===e&&(e={groupSeparator:""}),me.DP=this.currency.decimals,new me(this.numerator.toString()).div(this.denominator.toString()).toFormat(e)},X(t,[{key:"raw",get:function(){return this.numerator}}]),t}(Oe),be=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).token=t,r}j(t,e);var n=t.prototype;return n.add=function(e){return this.token.equals(e.token)||C(!1),new t(this.token,h.add(this.raw,e.raw))},n.subtract=function(e){return this.token.equals(e.token)||C(!1),new t(this.token,h.subtract(this.raw,e.raw))},t}(ve),ye=function(e){function t(t,n,r,o){var i;return(i=e.call(this,o,r)||this).baseCurrency=t,i.quoteCurrency=n,i.scalar=new Oe(h.exponentiate(P,h.BigInt(t.decimals)),h.exponentiate(P,h.BigInt(n.decimals))),i}j(t,e),t.fromRoute=function(e){for(var n,r=[],o=ee(e.pairs.entries());!(n=o()).done;){var i=n.value,a=i[1];r.push(e.path[i[0]].equals(a.token0)?new t(a.reserve0.currency,a.reserve1.currency,a.reserve0.raw,a.reserve1.raw):new t(a.reserve1.currency,a.reserve0.currency,a.reserve1.raw,a.reserve0.raw))}return r.slice(1).reduce((function(e,t){return e.multiply(t)}),r[0])};var n=t.prototype;return n.invert=function(){return new t(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){Te(this.quoteCurrency,n.baseCurrency)||C(!1);var r=e.prototype.multiply.call(this,n);return new t(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(t){return Te(t.currency,this.baseCurrency)||C(!1),this.quoteCurrency instanceof Ce?new be(this.quoteCurrency,e.prototype.multiply.call(this,t.raw).quotient):ve.ether(e.prototype.multiply.call(this,t.raw).quotient)},n.toSignificant=function(e,t,n){return void 0===e&&(e=6),this.adjusted.toSignificant(e,t,n)},n.toFixed=function(e,t,n){return void 0===e&&(e=4),this.adjusted.toFixed(e,t,n)},X(t,[{key:"raw",get:function(){return new Oe(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return e.prototype.multiply.call(this,this.scalar)}}]),t}(Oe),De={},Be=function(){function e(t,n){var r=t.token.sortsBefore(n.token)?[t,n]:[n,t];this.liquidityToken=new Ce(r[0].token.chainId,e.getAddress(r[0].token,r[1].token),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=r}e.getAddress=function(e,t){var n,r,o,i,a,s=e.sortsBefore(t)?[e,t]:[t,e];return void 0===(null===(n=De)||void 0===n||null===(r=n[s[0].address])||void 0===r?void 0:r[s[1].address])&&(De=Y({},De,((a={})[s[0].address]=Y({},null===(o=De)||void 0===o?void 0:o[s[0].address],((i={})[s[1].address]=T.getCreate2Address(b[e.chainId],A.keccak256(["bytes"],[A.pack(["address","address"],[s[0].address,s[1].address])]),v),i)),a))),De[s[0].address][s[1].address]};var t=e.prototype;return t.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},t.priceOf=function(e){return this.involvesToken(e)||C(!1),e.equals(this.token0)?this.token0Price:this.token1Price},t.reserveOf=function(e){return this.involvesToken(e)||C(!1),e.equals(this.token0)?this.reserve0:this.reserve1},t.getOutputAmount=function(t){if(this.involvesToken(t.token)||C(!1),h.equal(this.reserve0.raw,g)||h.equal(this.reserve1.raw,g))throw new re;var n=this.reserveOf(t.token),r=this.reserveOf(t.token.equals(this.token0)?this.token1:this.token0),o=h.multiply(t.raw,q),i=h.multiply(o,r.raw),a=h.add(h.multiply(n.raw,V),o),s=new be(t.token.equals(this.token0)?this.token1:this.token0,h.divide(i,a));if(h.equal(s.raw,g))throw new oe;return[s,new e(n.add(t),r.subtract(s))]},t.getInputAmount=function(t){if(this.involvesToken(t.token)||C(!1),h.equal(this.reserve0.raw,g)||h.equal(this.reserve1.raw,g)||h.greaterThanOrEqual(t.raw,this.reserveOf(t.token).raw))throw new re;var n=this.reserveOf(t.token),r=this.reserveOf(t.token.equals(this.token0)?this.token1:this.token0),o=h.multiply(h.multiply(r.raw,t.raw),V),i=h.multiply(h.subtract(n.raw,t.raw),q),a=new be(t.token.equals(this.token0)?this.token1:this.token0,h.add(h.divide(o,i),k));return[a,new e(r.add(a),n.subtract(t))]},t.getLiquidityMinted=function(e,t,n){e.token.equals(this.liquidityToken)||C(!1);var r,o=t.token.sortsBefore(n.token)?[t,n]:[n,t];if(o[0].token.equals(this.token0)&&o[1].token.equals(this.token1)||C(!1),h.equal(e.raw,g))r=h.subtract(ue(h.multiply(o[0].raw,o[1].raw)),S);else{var i=h.divide(h.multiply(o[0].raw,e.raw),this.reserve0.raw),a=h.divide(h.multiply(o[1].raw,e.raw),this.reserve1.raw);r=h.lessThanOrEqual(i,a)?i:a}if(!h.greaterThan(r,g))throw new oe;return new be(this.liquidityToken,r)},t.getLiquidityValue=function(e,t,n,r,o){var i;if(void 0===r&&(r=!1),this.involvesToken(e)||C(!1),t.token.equals(this.liquidityToken)||C(!1),n.token.equals(this.liquidityToken)||C(!1),h.lessThanOrEqual(n.raw,t.raw)||C(!1),r){o||C(!1);var a=se(o);if(h.equal(a,g))i=t;else{var s=ue(h.multiply(this.reserve0.raw,this.reserve1.raw)),u=ue(a);if(h.greaterThan(s,u)){var d=h.multiply(t.raw,h.subtract(s,u)),p=h.add(h.multiply(s,H),u),c=h.divide(d,p);i=t.add(new be(this.liquidityToken,c))}else i=t}}else i=t;return new be(e,h.divide(h.multiply(n.raw,this.reserveOf(e).raw),i.raw))},X(e,[{key:"token0Price",get:function(){return new ye(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new ye(this.token1,this.token0,this.tokenAmounts[1].raw,this.tokenAmounts[0].raw)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].token}},{key:"token1",get:function(){return this.tokenAmounts[1].token}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),e}(),we=function(){function e(e,t,n){e.length>0||C(!1),e.every((function(t){return t.chainId===e[0].chainId}))||C(!1),t instanceof Ce&&e[0].involvesToken(t)||t===he&&e[0].involvesToken(fe[e[0].chainId])||C(!1),void 0===n||n instanceof Ce&&e[e.length-1].involvesToken(n)||n===he&&e[e.length-1].involvesToken(fe[e[0].chainId])||C(!1);for(var r,o=[t instanceof Ce?t:fe[e[0].chainId]],i=ee(e.entries());!(r=i()).done;){var a=r.value,s=a[1],u=o[a[0]];u.equals(s.token0)||u.equals(s.token1)||C(!1);var d=u.equals(s.token0)?s.token1:s.token0;o.push(d)}this.pairs=e,this.path=o,this.midPrice=ye.fromRoute(this),this.input=t,this.output=null!=n?n:o[o.length-1]}return X(e,[{key:"chainId",get:function(){return this.pairs[0].chainId}}]),e}(),Re=new Oe(U),Me=function(e){function t(){return e.apply(this,arguments)||this}j(t,e);var n=t.prototype;return n.toSignificant=function(e,t,n){return void 0===e&&(e=5),this.multiply(Re).toSignificant(e,t,n)},n.toFixed=function(e,t,n){return void 0===e&&(e=2),this.multiply(Re).toFixed(e,t,n)},t}(Oe);function Se(e,t){return Te(e.inputAmount.currency,t.inputAmount.currency)||C(!1),Te(e.outputAmount.currency,t.outputAmount.currency)||C(!1),e.outputAmount.equalTo(t.outputAmount)?e.inputAmount.equalTo(t.inputAmount)?0:e.inputAmount.lessThan(t.inputAmount)?-1:1:e.outputAmount.lessThan(t.outputAmount)?1:-1}function ge(e,t){var n=Se(e,t);return 0!==n?n:e.priceImpact.lessThan(t.priceImpact)?-1:e.priceImpact.greaterThan(t.priceImpact)?1:e.route.path.length-t.route.path.length}function ke(e,t){return e instanceof be?e:e.currency===he?new be(fe[t],e.raw):void C(!1)}function Fe(e,t){return e instanceof Ce?e:e===he?fe[t]:void C(!1)}var _e=function(){function e(e,t,n){var r,o,i,a=new Array(e.path.length),s=new Array(e.pairs.length);if(n===exports.TradeType.EXACT_INPUT){Te(t.currency,e.input)||C(!1),a[0]=ke(t,e.chainId);for(var u=0;u<e.path.length-1;u++){var d=e.pairs[u].getOutputAmount(a[u]),p=d[1];a[u+1]=d[0],s[u]=p}}else{Te(t.currency,e.output)||C(!1),a[a.length-1]=ke(t,e.chainId);for(var c=e.path.length-1;c>0;c--){var h=e.pairs[c-1].getInputAmount(a[c]),T=h[1];a[c-1]=h[0],s[c-1]=T}}this.route=e,this.tradeType=n,this.inputAmount=n===exports.TradeType.EXACT_INPUT?t:e.input===he?ve.ether(a[0].raw):a[0],this.outputAmount=n===exports.TradeType.EXACT_OUTPUT?t:e.output===he?ve.ether(a[a.length-1].raw):a[a.length-1],this.executionPrice=new ye(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=ye.fromRoute(new we(s,e.input)),this.priceImpact=(r=this.outputAmount,i=(o=e.midPrice.raw.multiply(this.inputAmount.raw)).subtract(r.raw).divide(o),new Me(i.numerator,i.denominator))}e.exactIn=function(t,n){return new e(t,n,exports.TradeType.EXACT_INPUT)},e.exactOut=function(t,n){return new e(t,n,exports.TradeType.EXACT_OUTPUT)};var t=e.prototype;return t.minimumAmountOut=function(e){if(e.lessThan(g)&&C(!1),this.tradeType===exports.TradeType.EXACT_OUTPUT)return this.outputAmount;var t=new Oe(k).add(e).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof be?new be(this.outputAmount.token,t):ve.ether(t)},t.maximumAmountIn=function(e){if(e.lessThan(g)&&C(!1),this.tradeType===exports.TradeType.EXACT_INPUT)return this.inputAmount;var t=new Oe(k).add(e).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof be?new be(this.inputAmount.token,t):ve.ether(t)},e.bestTradeExactIn=function(t,n,r,o,i,a,s){var u=void 0===o?{}:o,d=u.maxNumResults,p=void 0===d?3:d,c=u.maxHops,h=void 0===c?3:c;void 0===i&&(i=[]),void 0===a&&(a=n),void 0===s&&(s=[]),t.length>0||C(!1),h>0||C(!1),a===n||i.length>0||C(!1);var T=n instanceof be?n.token.chainId:r instanceof Ce?r.chainId:void 0;void 0===T&&C(!1);for(var I=ke(n,T),x=Fe(r,T),f=0;f<t.length;f++){var A=t[f];if((A.token0.equals(I.token)||A.token1.equals(I.token))&&!A.reserve0.equalTo(g)&&!A.reserve1.equalTo(g)){var E=void 0;try{E=A.getOutputAmount(I)[0]}catch(e){if(e.isInsufficientInputAmountError)continue;throw e}if(E.token.equals(x))de(s,new e(new we([].concat(i,[A]),a.currency,r),a,exports.TradeType.EXACT_INPUT),p,ge);else if(h>1&&t.length>1){var l=t.slice(0,f).concat(t.slice(f+1,t.length));e.bestTradeExactIn(l,E,r,{maxNumResults:p,maxHops:h-1},[].concat(i,[A]),a,s)}}}return s},e.bestTradeExactOut=function(t,n,r,o,i,a,s){var u=void 0===o?{}:o,d=u.maxNumResults,p=void 0===d?3:d,c=u.maxHops,h=void 0===c?3:c;void 0===i&&(i=[]),void 0===a&&(a=r),void 0===s&&(s=[]),t.length>0||C(!1),h>0||C(!1),a===r||i.length>0||C(!1);var T=r instanceof be?r.token.chainId:n instanceof Ce?n.chainId:void 0;void 0===T&&C(!1);for(var I=ke(r,T),x=Fe(n,T),f=0;f<t.length;f++){var A=t[f];if((A.token0.equals(I.token)||A.token1.equals(I.token))&&!A.reserve0.equalTo(g)&&!A.reserve1.equalTo(g)){var E=void 0;try{E=A.getInputAmount(I)[0]}catch(e){if(e.isInsufficientReservesError)continue;throw e}if(E.token.equals(x))de(s,new e(new we([A].concat(i),n,a.currency),a,exports.TradeType.EXACT_OUTPUT),p,ge);else if(h>1&&t.length>1){var l=t.slice(0,f).concat(t.slice(f+1,t.length));e.bestTradeExactOut(l,n,E,{maxNumResults:p,maxHops:h-1},[A].concat(i),a,s)}}}return s},e}();function He(e){return"0x"+e.raw.toString(16)}var Pe,Ue=function(){function e(){}return e.swapCallParameters=function(e,t){var n=e.inputAmount.currency===he,r=e.outputAmount.currency===he;n&&r&&C(!1),!("ttl"in t)||t.ttl>0||C(!1);var o,i,a,s=ae(t.recipient),u=He(e.maximumAmountIn(t.allowedSlippage)),d=He(e.minimumAmountOut(t.allowedSlippage)),p=e.route.path.map((function(e){return e.address})),c="ttl"in t?"0x"+(Math.floor((new Date).getTime()/1e3)+t.ttl).toString(16):"0x"+t.deadline.toString(16),h=Boolean(t.feeOnTransfer);switch(e.tradeType){case exports.TradeType.EXACT_INPUT:n?(o=h?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",i=[d,p,s,c],a=u):r?(o=h?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",i=[u,d,p,s,c],a="0x0"):(o=h?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",i=[u,d,p,s,c],a="0x0");break;case exports.TradeType.EXACT_OUTPUT:h&&C(!1),n?(o="swapETHForExactTokens",i=[d,p,s,c],a=u):r?(o="swapTokensForExactETH",i=[d,u,p,s,c],a="0x0"):(o="swapTokensForExactTokens",i=[d,u,p,s,c],a="0x0")}return{methodName:o,args:i,value:a}},e}(),qe=[{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"}],Ve=((Pe={})[exports.ChainId.MAINNET]={"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A":9},Pe),We=function(){function e(){}return e.fetchTokenData=function(e,t,n,r,o){try{var i,a,s=function(n){return new Ce(e,t,n,r,o)};void 0===n&&(n=N.getDefaultProvider(l.getNetwork(e)));var u="number"==typeof(null===(i=Ve)||void 0===i||null===(a=i[e])||void 0===a?void 0:a[t]);return Promise.resolve(u?s(Ve[e][t]):Promise.resolve(new E.Contract(t,qe,n).decimals().then((function(n){var r,o,i;return Ve=Y({},Ve,((i={})[e]=Y({},null===(r=Ve)||void 0===r?void 0:r[e],((o={})[t]=n,o)),i)),n}))).then(s))}catch(e){return Promise.reject(e)}},e.fetchPairData=function(e,t,n){try{void 0===n&&(n=N.getDefaultProvider(l.getNetwork(e.chainId))),e.chainId!==t.chainId&&C(!1);var r=Be.getAddress(e,t);return Promise.resolve(new E.Contract(r,O.abi,n).getReserves()).then((function(n){var r=n[0],o=n[1],i=e.sortsBefore(t)?[r,o]:[o,r];return new Be(new be(e,i[0]),new be(t,i[1]))}))}catch(e){return Promise.reject(e)}},e}();exports.JSBI=h,exports.BAR_ADDRESS=w,exports.Currency=pe,exports.CurrencyAmount=ve,exports.ETHER=he,exports.FACTORY_ADDRESS=b,exports.Fetcher=We,exports.Fraction=Oe,exports.INIT_CODE_HASH=v,exports.InsufficientInputAmountError=oe,exports.InsufficientReservesError=re,exports.MAKER_ADDRESS=R,exports.MASTERCHEF_ADDRESS=B,exports.MINIMUM_LIQUIDITY=S,exports.Pair=Be,exports.Percent=Me,exports.Price=ye,exports.ROUTER_ADDRESS=y,exports.Route=we,exports.Router=Ue,exports.SUSHI_ADDRESS=D,exports.TIMELOCK_ADDRESS=M,exports.Token=Ce,exports.TokenAmount=be,exports.Trade=_e,exports.WETH=fe,exports.currencyEquals=Te,exports.inputOutputComparator=Se,exports.tradeComparator=ge;
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,n,r,o,i,a,s,d,p,u,h,C=e(require("jsbi")),c=e(require("tiny-invariant")),I=(e(require("tiny-warning")),require("@ethersproject/address")),A=require("utils"),x=e(require("big.js")),T=e(require("toformat")),E=e(require("decimal.js-light")),f=require("@ethersproject/solidity"),O=require("@ethersproject/contracts"),l=require("@ethersproject/networks"),N=require("@ethersproject/providers"),m=e(require("@uniswap/v2-core/build/IUniswapV2Pair.json"));(p=exports.ChainId||(exports.ChainId={}))[p.MAINNET=1]="MAINNET",p[p.ROPSTEN=3]="ROPSTEN",p[p.RINKEBY=4]="RINKEBY",p[p["GÖRLI"]=5]="GÖRLI",p[p.KOVAN=42]="KOVAN",p[p.MATIC=137]="MATIC",p[p.MATIC_TESTNET=80001]="MATIC_TESTNET",p[p.FANTOM=250]="FANTOM",p[p.FANTOM_TESTNET=4002]="FANTOM_TESTNET",p[p.XDAI=100]="XDAI",p[p.BSC=56]="BSC",p[p.BSC_TESTNET=97]="BSC_TESTNET",p[p.ARBITRUM=42161]="ARBITRUM",p[p.MOONBASE=1287]="MOONBASE",p[p.AVALANCHE=43114]="AVALANCHE",p[p.FUJI=43113]="FUJI",p[p.HECO=128]="HECO",p[p.HECO_TESTNET=256]="HECO_TESTNET",p[p.HARMONY=16666e5]="HARMONY",p[p.HARMONY_TESTNET=16667e5]="HARMONY_TESTNET",p[p.MOONRIVER=1285]="MOONRIVER",p[p.CRONOS=25]="CRONOS",p[p.OPTIMISM=10]="OPTIMISM",p[p.SYSCOIN=57]="SYSCOIN",p[p.METIS=1088]="METIS",p[p.MOONBEAM=1284]="MOONBEAM",p[p.MILKOMEDA=2001]="MILKOMEDA",p[p.KAVA=2222]="KAVA",p[p.IOTEX=4689]="IOTEX",p[p.KLAYTN=8217]="KLAYTN",p[p.CELO=42220]="CELO",p[p.AURORA=1313161554]="AURORA",p[p.BOBA=288]="BOBA",(u=exports.TradeType||(exports.TradeType={}))[u.EXACT_INPUT=0]="EXACT_INPUT",u[u.EXACT_OUTPUT=1]="EXACT_OUTPUT",(h=exports.Rounding||(exports.Rounding={}))[h.ROUND_DOWN=0]="ROUND_DOWN",h[h.ROUND_HALF_UP=1]="ROUND_HALF_UP",h[h.ROUND_UP=2]="ROUND_UP";var B,M="0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303",v=((t={})[exports.ChainId.MAINNET]="0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac",t[exports.ChainId.ROPSTEN]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.RINKEBY]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.GÖRLI]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.KOVAN]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.FANTOM]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.FANTOM_TESTNET]="",t[exports.ChainId.MATIC]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.MATIC_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.XDAI]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.BSC]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.BSC_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.ARBITRUM]="",t[exports.ChainId.MOONBASE]="0x2Ce3F07dD4c62b56a502E223A7cBE38b1d77A1b5",t[exports.ChainId.AVALANCHE]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.FUJI]="0xd00ae08403B9bbb9124bB305C09058E32C39A48c",t[exports.ChainId.HECO]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.HECO_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.HARMONY]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.HARMONY_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",t[exports.ChainId.MOONRIVER]="",t[exports.ChainId.CRONOS]="",t[exports.ChainId.OPTIMISM]="",t[exports.ChainId.SYSCOIN]="",t[exports.ChainId.METIS]="",t[exports.ChainId.MOONBEAM]="",t[exports.ChainId.MILKOMEDA]="",t[exports.ChainId.KAVA]="",t[exports.ChainId.IOTEX]="",t[exports.ChainId.KLAYTN]="",t[exports.ChainId.CELO]="",t[exports.ChainId.AURORA]="",t[exports.ChainId.BOBA]="",t),D=((n={})[exports.ChainId.MAINNET]="0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",n[exports.ChainId.RINKEBY]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.ROPSTEN]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.GÖRLI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.KOVAN]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.FANTOM]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.FANTOM_TESTNET]="",n[exports.ChainId.MATIC]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.MATIC_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.XDAI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.BSC]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.BSC_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.ARBITRUM]="",n[exports.ChainId.MOONBASE]="0xeB5c2BB5E83B51d83F3534Ae21E84336B8B376ef",n[exports.ChainId.AVALANCHE]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.FUJI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HECO]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HECO_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HARMONY]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.HARMONY_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",n[exports.ChainId.MOONRIVER]="",n[exports.ChainId.CRONOS]="",n[exports.ChainId.OPTIMISM]="",n[exports.ChainId.SYSCOIN]="",n[exports.ChainId.METIS]="",n[exports.ChainId.MOONBEAM]="",n[exports.ChainId.MILKOMEDA]="",n[exports.ChainId.KAVA]="",n[exports.ChainId.IOTEX]="",n[exports.ChainId.KLAYTN]="",n[exports.ChainId.CELO]="",n[exports.ChainId.AURORA]="",n[exports.ChainId.BOBA]="",n),b=((r={})[exports.ChainId.MAINNET]="0x6B3595068778DD592e39A122f4f5a5cF09C90fE2",r[exports.ChainId.ROPSTEN]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.RINKEBY]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.GÖRLI]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.KOVAN]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",r[exports.ChainId.FANTOM]="",r[exports.ChainId.FANTOM_TESTNET]="",r[exports.ChainId.MATIC]="",r[exports.ChainId.MATIC_TESTNET]="",r[exports.ChainId.XDAI]="",r[exports.ChainId.BSC]="",r[exports.ChainId.BSC_TESTNET]="",r[exports.ChainId.ARBITRUM]="",r[exports.ChainId.MOONBASE]="",r[exports.ChainId.AVALANCHE]="",r[exports.ChainId.FUJI]="",r[exports.ChainId.HECO]="",r[exports.ChainId.HECO_TESTNET]="",r[exports.ChainId.HARMONY]="",r[exports.ChainId.HARMONY_TESTNET]="",r[exports.ChainId.MOONRIVER]="",r[exports.ChainId.CRONOS]="",r[exports.ChainId.OPTIMISM]="",r[exports.ChainId.SYSCOIN]="",r[exports.ChainId.METIS]="",r[exports.ChainId.MOONBEAM]="",r[exports.ChainId.MILKOMEDA]="",r[exports.ChainId.KAVA]="",r[exports.ChainId.IOTEX]="",r[exports.ChainId.KLAYTN]="",r[exports.ChainId.CELO]="",r[exports.ChainId.AURORA]="",r[exports.ChainId.BOBA]="",r),R=((o={})[exports.ChainId.MAINNET]="0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd",o[exports.ChainId.ROPSTEN]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.RINKEBY]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.GÖRLI]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.KOVAN]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",o[exports.ChainId.FANTOM]="",o[exports.ChainId.FANTOM_TESTNET]="",o[exports.ChainId.MATIC]="",o[exports.ChainId.MATIC_TESTNET]="",o[exports.ChainId.XDAI]="",o[exports.ChainId.BSC]="",o[exports.ChainId.BSC_TESTNET]="",o[exports.ChainId.ARBITRUM]="",o[exports.ChainId.MOONBASE]="",o[exports.ChainId.AVALANCHE]="",o[exports.ChainId.FUJI]="",o[exports.ChainId.HECO]="",o[exports.ChainId.HECO_TESTNET]="",o[exports.ChainId.HARMONY]="",o[exports.ChainId.HARMONY_TESTNET]="",o[exports.ChainId.MOONRIVER]="",o[exports.ChainId.CRONOS]="",o[exports.ChainId.OPTIMISM]="",o[exports.ChainId.SYSCOIN]="",o[exports.ChainId.METIS]="",o[exports.ChainId.MOONBEAM]="",o[exports.ChainId.MILKOMEDA]="",o[exports.ChainId.KAVA]="",o[exports.ChainId.IOTEX]="",o[exports.ChainId.KLAYTN]="",o[exports.ChainId.CELO]="",o[exports.ChainId.AURORA]="",o[exports.ChainId.BOBA]="",o),S=((i={})[exports.ChainId.MAINNET]="0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272",i[exports.ChainId.ROPSTEN]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.RINKEBY]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.GÖRLI]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.KOVAN]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",i[exports.ChainId.FANTOM]="",i[exports.ChainId.FANTOM_TESTNET]="",i[exports.ChainId.MATIC]="",i[exports.ChainId.MATIC_TESTNET]="",i[exports.ChainId.XDAI]="",i[exports.ChainId.BSC]="",i[exports.ChainId.BSC_TESTNET]="",i[exports.ChainId.ARBITRUM]="",i[exports.ChainId.MOONBASE]="",i[exports.ChainId.AVALANCHE]="",i[exports.ChainId.FUJI]="",i[exports.ChainId.HECO]="",i[exports.ChainId.HECO_TESTNET]="",i[exports.ChainId.HARMONY]="",i[exports.ChainId.HARMONY_TESTNET]="",i[exports.ChainId.MOONRIVER]="",i[exports.ChainId.CRONOS]="",i[exports.ChainId.OPTIMISM]="",i[exports.ChainId.SYSCOIN]="",i[exports.ChainId.METIS]="",i[exports.ChainId.MOONBEAM]="",i[exports.ChainId.MILKOMEDA]="",i[exports.ChainId.KAVA]="",i[exports.ChainId.IOTEX]="",i[exports.ChainId.KLAYTN]="",i[exports.ChainId.CELO]="",i[exports.ChainId.AURORA]="",i[exports.ChainId.BOBA]="",i),y=((a={})[exports.ChainId.MAINNET]="0xE11fc0B43ab98Eb91e9836129d1ee7c3Bc95df50",a[exports.ChainId.ROPSTEN]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.RINKEBY]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.GÖRLI]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.KOVAN]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",a[exports.ChainId.FANTOM]="",a[exports.ChainId.FANTOM_TESTNET]="",a[exports.ChainId.MATIC]="",a[exports.ChainId.MATIC_TESTNET]="",a[exports.ChainId.XDAI]="",a[exports.ChainId.BSC]="",a[exports.ChainId.BSC_TESTNET]="",a[exports.ChainId.ARBITRUM]="",a[exports.ChainId.MOONBASE]="",a[exports.ChainId.AVALANCHE]="",a[exports.ChainId.FUJI]="",a[exports.ChainId.HECO]="",a[exports.ChainId.HECO_TESTNET]="",a[exports.ChainId.HARMONY]="",a[exports.ChainId.HARMONY_TESTNET]="",a[exports.ChainId.MOONRIVER]="",a[exports.ChainId.CRONOS]="",a[exports.ChainId.OPTIMISM]="",a[exports.ChainId.SYSCOIN]="",a[exports.ChainId.METIS]="",a[exports.ChainId.MOONBEAM]="",a[exports.ChainId.MILKOMEDA]="",a[exports.ChainId.KAVA]="",a[exports.ChainId.IOTEX]="",a[exports.ChainId.KLAYTN]="",a[exports.ChainId.CELO]="",a[exports.ChainId.AURORA]="",a[exports.ChainId.BOBA]="",a),w=((s={})[exports.ChainId.MAINNET]="0x9a8541Ddf3a932a9A922B607e9CF7301f1d47bD1",s[exports.ChainId.ROPSTEN]="",s[exports.ChainId.RINKEBY]="",s[exports.ChainId.GÖRLI]="",s[exports.ChainId.KOVAN]="",s[exports.ChainId.FANTOM]="",s[exports.ChainId.FANTOM_TESTNET]="",s[exports.ChainId.MATIC]="",s[exports.ChainId.MATIC_TESTNET]="",s[exports.ChainId.XDAI]="",s[exports.ChainId.BSC]="",s[exports.ChainId.BSC_TESTNET]="",s[exports.ChainId.ARBITRUM]="",s[exports.ChainId.MOONBASE]="",s[exports.ChainId.AVALANCHE]="",s[exports.ChainId.FUJI]="",s[exports.ChainId.HECO]="",s[exports.ChainId.HECO_TESTNET]="",s[exports.ChainId.HARMONY]="",s[exports.ChainId.HARMONY_TESTNET]="",s[exports.ChainId.MOONRIVER]="",s[exports.ChainId.CRONOS]="",s[exports.ChainId.OPTIMISM]="",s[exports.ChainId.SYSCOIN]="",s[exports.ChainId.METIS]="",s[exports.ChainId.MOONBEAM]="",s[exports.ChainId.MILKOMEDA]="",s[exports.ChainId.KAVA]="",s[exports.ChainId.IOTEX]="",s[exports.ChainId.KLAYTN]="",s[exports.ChainId.CELO]="",s[exports.ChainId.AURORA]="",s[exports.ChainId.BOBA]="",s),g=C.BigInt(1e3),k=C.BigInt(0),F=C.BigInt(1),_=C.BigInt(2),H=C.BigInt(3),U=C.BigInt(5),W=C.BigInt(10),L=C.BigInt(100),P=C.BigInt(997),q=C.BigInt(1e3);!function(e){e.uint8="uint8",e.uint256="uint256"}(B||(B={}));var K=((d={})[B.uint8]=C.BigInt("0xff"),d[B.uint256]=C.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),d);function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e,t,n){return t&&V(e.prototype,t),n&&V(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function X(){return(X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function j(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,J(e,t)}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){return(J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Q(){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(e){return!1}}function $(e,t,n){return($=Q()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&J(o,n.prototype),o}).apply(null,arguments)}function z(e){var t="function"==typeof Map?new Map:void 0;return(z=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return $(e,arguments,G(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),J(n,e)})(e)}function Z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ee(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ee(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ne,re="setPrototypeOf"in Object,oe=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,re&&Object.setPrototypeOf(Z(n),(this instanceof t?this.constructor:void 0).prototype),n}return j(t,e),t}(z(Error)),ie=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,re&&Object.setPrototypeOf(Z(n),(this instanceof t?this.constructor:void 0).prototype),n}return j(t,e),t}(z(Error));function ae(e,t){C.greaterThanOrEqual(e,k)||c(!1),C.lessThanOrEqual(e,K[t])||c(!1)}function se(e){try{return I.getAddress(e)}catch(e){c(!1)}}function de(e){return e instanceof C?e:C.BigInt("bigint"==typeof e?e.toString():e)}function pe(e){ae(e,B.uint256);var t,n=k;if(C.greaterThan(e,H))for(n=e,t=C.add(C.divide(e,_),F);C.lessThan(t,n);)n=t,t=C.divide(C.add(C.divide(e,t),t),_);else C.notEqual(e,k)&&(n=F);return n}function ue(e,t,n,r){if(n>0||c(!1),e.length<=n||c(!1),0===e.length)return e.push(t),null;var o=e.length===n;if(o&&r(e[e.length-1],t)<=0)return t;for(var i=0,a=e.length;i<a;){var s=i+a>>>1;r(e[s],t)<=0?i=s+1:a=s}return e.splice(i,0,t),o?e.pop():null}var he=function(){function e(e,t,n){A.validateSolidityTypeInstance(C.BigInt(e),B.uint8),this.decimals=e,this.symbol=t,this.name=n}e.getNativeCurrency=function(t){if(!t)throw Error("No chainId "+t);if(!(t in e.NATIVE))throw Error("No native currency defined for chainId "+t);return e.NATIVE[t]},e.getNativeCurrencySymbol=function(e){return this.getNativeCurrency(e).symbol},e.getNativeCurrencyName=function(e){return this.getNativeCurrency(e).name};var t=e.prototype;return t.getSymbol=function(t){return t&&"ETH"===(null==this?void 0:this.symbol)?e.getNativeCurrencySymbol(t):null==this?void 0:this.symbol},t.getName=function(t){return t&&"Ether"===(null==this?void 0:this.name)?e.getNativeCurrencyName(t):null==this?void 0:this.name},e}();he.ETHER=new he(18,"ETH","Ether"),he.BNB=new he(18,"BNB","Binance Coin"),he.FTM=new he(18,"FTM","Fantom"),he.MATIC=new he(18,"MATIC","Matic"),he.XDAI=new he(18,"XDAI","xDai"),he.GLMR=new he(18,"GLMR","Glimmer"),he.AVAX=new he(18,"AVAX","Avalanche"),he.HT=new he(18,"HT","Heco Token"),he.ONE=new he(18,"ONE","Harmony"),he.MOVR=new he(18,"MOVR","Moonriver"),he.CRO=new he(18,"CRO","Cronos"),he.SYSCOIN=new he(18,"WSYS","Wrapped Syscoin"),he.METIS=new he(18,"METIS","Wrapped Metis"),he.MOONBEAM=new he(18,"WGLMR","Wrapped GLMR"),he.MILKOMEDA=new he(18,"WADA","Wrapped ADA"),he.KAVA=new he(18,"WKAVA","Wrapped Kava"),he.IOTEX=new he(18,"WIOTX","Wrapped IoTeX"),he.KLAYTN=new he(18,"WKLAY","Wrapped Klaytn"),he.CELO=new he(18,"WCELO","Wrapped Celo"),he.AURORA=new he(18,"WETH","Wrapped Ether"),he.BOBA=new he(18,"WETH","Wrapped Ether"),he.NATIVE=((ne={})[exports.ChainId.MAINNET]=he.ETHER,ne[exports.ChainId.ROPSTEN]=he.ETHER,ne[exports.ChainId.RINKEBY]=he.ETHER,ne[exports.ChainId.GÖRLI]=he.ETHER,ne[exports.ChainId.KOVAN]=he.ETHER,ne[exports.ChainId.FANTOM]=he.FTM,ne[exports.ChainId.FANTOM_TESTNET]=he.FTM,ne[exports.ChainId.MATIC]=he.MATIC,ne[exports.ChainId.MATIC_TESTNET]=he.MATIC,ne[exports.ChainId.XDAI]=he.XDAI,ne[exports.ChainId.BSC]=he.BNB,ne[exports.ChainId.BSC_TESTNET]=he.BNB,ne[exports.ChainId.ARBITRUM]=he.ETHER,ne[exports.ChainId.MOONBASE]=he.GLMR,ne[exports.ChainId.AVALANCHE]=he.AVAX,ne[exports.ChainId.FUJI]=he.AVAX,ne[exports.ChainId.HECO]=he.HT,ne[exports.ChainId.HECO_TESTNET]=he.HT,ne[exports.ChainId.HARMONY]=he.ONE,ne[exports.ChainId.HARMONY_TESTNET]=he.ONE,ne[exports.ChainId.CRONOS]=he.CRO,ne[exports.ChainId.MOONRIVER]=he.MOVR,ne[exports.ChainId.OPTIMISM]=he.ETHER,ne[exports.ChainId.SYSCOIN]=he.SYSCOIN,ne[exports.ChainId.METIS]=he.METIS,ne[exports.ChainId.MOONBEAM]=he.MOONBEAM,ne[exports.ChainId.MILKOMEDA]=he.MILKOMEDA,ne[exports.ChainId.KAVA]=he.KAVA,ne[exports.ChainId.IOTEX]=he.IOTEX,ne[exports.ChainId.KLAYTN]=he.KLAYTN,ne[exports.ChainId.CELO]=he.CELO,ne[exports.ChainId.AURORA]=he.AURORA,ne[exports.ChainId.BOBA]=he.BOBA,ne);var Ce,ce=he.ETHER,Ie=function(e){function t(t,n,r,o,i){var a;return(a=e.call(this,r,o,i)||this).chainId=t,a.address=se(n),a}j(t,e);var n=t.prototype;return n.equals=function(e){return this===e||this.chainId===e.chainId&&this.address===e.address},n.sortsBefore=function(e){return this.chainId!==e.chainId&&c(!1),this.address===e.address&&c(!1),this.address.toLowerCase()<e.address.toLowerCase()},t}(he);function Ae(e,t){return e instanceof Ie&&t instanceof Ie?e.equals(t):!(e instanceof Ie||t instanceof Ie||e!==t)}var xe,Te,Ee=((Ce={})[exports.ChainId.MAINNET]=new Ie(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.ROPSTEN]=new Ie(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.RINKEBY]=new Ie(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.GÖRLI]=new Ie(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.KOVAN]=new Ie(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.FANTOM]=new Ie(exports.ChainId.FANTOM,"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",18,"WFTM","Wrapped FTM"),Ce[exports.ChainId.FANTOM_TESTNET]=new Ie(exports.ChainId.FANTOM_TESTNET,"0xf1277d1Ed8AD466beddF92ef448A132661956621",18,"FTM","Wrapped FTM"),Ce[exports.ChainId.MATIC]=new Ie(exports.ChainId.MATIC,"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",18,"WMATIC","Wrapped Matic"),Ce[exports.ChainId.MATIC_TESTNET]=new Ie(exports.ChainId.MATIC_TESTNET,"0x5B67676a984807a212b1c59eBFc9B3568a474F0a",18,"WMATIC","Wrapped Matic"),Ce[exports.ChainId.XDAI]=new Ie(exports.ChainId.XDAI,"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",18,"WXDAI","Wrapped xDai"),Ce[exports.ChainId.BSC]=new Ie(exports.ChainId.BSC,"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",18,"WBNB","Wrapped BNB"),Ce[exports.ChainId.BSC_TESTNET]=new Ie(exports.ChainId.BSC_TESTNET,"0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd",18,"WBNB","Wrapped BNB"),Ce[exports.ChainId.ARBITRUM]=new Ie(exports.ChainId.ARBITRUM,"0xf8456e5e6A225C2C1D74D8C9a4cB2B1d5dc1153b",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.MOONBASE]=new Ie(exports.ChainId.MOONBASE,"0xe73763DB808ecCDC0E36bC8E32510ED126910394",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.AVALANCHE]=new Ie(exports.ChainId.AVALANCHE,"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",18,"WAVAX","Wrapped AVAX"),Ce[exports.ChainId.FUJI]=new Ie(exports.ChainId.FUJI,"0xd00ae08403B9bbb9124bB305C09058E32C39A48c",18,"WAVAX","Wrapped AVAX"),Ce[exports.ChainId.HECO]=new Ie(exports.ChainId.HECO,"0x5545153CCFcA01fbd7Dd11C0b23ba694D9509A6F",18,"WHT","Wrapped HT"),Ce[exports.ChainId.HECO_TESTNET]=new Ie(exports.ChainId.HECO_TESTNET,"0x5B2DA6F42CA09C77D577a12BeaD0446148830687",18,"WHT","Wrapped HT"),Ce[exports.ChainId.HARMONY]=new Ie(exports.ChainId.HARMONY,"0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a",18,"WONE","Wrapped ONE"),Ce[exports.ChainId.HARMONY_TESTNET]=new Ie(exports.ChainId.HARMONY_TESTNET,"0x7a2afac38517d512E55C0bCe3b6805c10a04D60F",18,"WONE","Wrapped ONE"),Ce[exports.ChainId.MOONRIVER]=new Ie(exports.ChainId.MOONRIVER,"0x98878B06940aE243284CA214f92Bb71a2b032B8A",18,"WMOVR","Wrapped MOVR"),Ce[exports.ChainId.CRONOS]=new Ie(exports.ChainId.CRONOS,"0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23",18,"WCRO","Wrapped CRO"),Ce[exports.ChainId.OPTIMISM]=new Ie(exports.ChainId.OPTIMISM,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.SYSCOIN]=new Ie(exports.ChainId.SYSCOIN,"0xd3e822f3ef011Ca5f17D82C956D952D8d7C3A1BB",18,"WSYS","Wrapped Syscoin"),Ce[exports.ChainId.METIS]=new Ie(exports.ChainId.METIS,"0x75cb093E4D61d2A2e65D8e0BBb01DE8d89b53481",18,"WETH","Wrapped Metis"),Ce[exports.ChainId.MOONBEAM]=new Ie(exports.ChainId.MOONBEAM,"0xAcc15dC74880C9944775448304B263D191c6077F",18,"WGLMR","Wrapped GLMR"),Ce[exports.ChainId.MILKOMEDA]=new Ie(exports.ChainId.MILKOMEDA,"0xAE83571000aF4499798d1e3b0fA0070EB3A3E3F9",18,"WADA","Wrapped ADA"),Ce[exports.ChainId.KAVA]=new Ie(exports.ChainId.KAVA,"0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b",18,"WKAVA","Wrapped Kava"),Ce[exports.ChainId.IOTEX]=new Ie(exports.ChainId.IOTEX,"0xa00744882684c3e4747faefd68d283ea44099d03",18,"WIOTX","Wrapped IoTeX"),Ce[exports.ChainId.KLAYTN]=new Ie(exports.ChainId.KLAYTN,"0xfd844c2fca5e595004b17615f891620d1cb9bbb2",18,"WKLAY","Wrapped Klaytn"),Ce[exports.ChainId.CELO]=new Ie(exports.ChainId.CELO,"0x3Ad443d769A07f287806874F8E5405cE3Ac902b9",18,"WCELO","Wrapped Celo"),Ce[exports.ChainId.AURORA]=new Ie(exports.ChainId.AURORA,"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB",18,"WETH","Wrapped Ether"),Ce[exports.ChainId.BOBA]=new Ie(exports.ChainId.BOBA,"0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",18,"WETH","Wrapped Ether"),Ce),fe=T(E),Oe=T(x),le=((xe={})[exports.Rounding.ROUND_DOWN]=fe.ROUND_DOWN,xe[exports.Rounding.ROUND_HALF_UP]=fe.ROUND_HALF_UP,xe[exports.Rounding.ROUND_UP]=fe.ROUND_UP,xe),Ne=((Te={})[exports.Rounding.ROUND_DOWN]=0,Te[exports.Rounding.ROUND_HALF_UP]=1,Te[exports.Rounding.ROUND_UP]=3,Te),me=function(){function e(e,t){void 0===t&&(t=F),this.numerator=de(e),this.denominator=de(t)}var t=e.prototype;return t.invert=function(){return new e(this.denominator,this.numerator)},t.add=function(t){var n=t instanceof e?t:new e(de(t));return C.equal(this.denominator,n.denominator)?new e(C.add(this.numerator,n.numerator),this.denominator):new e(C.add(C.multiply(this.numerator,n.denominator),C.multiply(n.numerator,this.denominator)),C.multiply(this.denominator,n.denominator))},t.subtract=function(t){var n=t instanceof e?t:new e(de(t));return C.equal(this.denominator,n.denominator)?new e(C.subtract(this.numerator,n.numerator),this.denominator):new e(C.subtract(C.multiply(this.numerator,n.denominator),C.multiply(n.numerator,this.denominator)),C.multiply(this.denominator,n.denominator))},t.lessThan=function(t){var n=t instanceof e?t:new e(de(t));return C.lessThan(C.multiply(this.numerator,n.denominator),C.multiply(n.numerator,this.denominator))},t.equalTo=function(t){var n=t instanceof e?t:new e(de(t));return C.equal(C.multiply(this.numerator,n.denominator),C.multiply(n.numerator,this.denominator))},t.greaterThan=function(t){var n=t instanceof e?t:new e(de(t));return C.greaterThan(C.multiply(this.numerator,n.denominator),C.multiply(n.numerator,this.denominator))},t.multiply=function(t){var n=t instanceof e?t:new e(de(t));return new e(C.multiply(this.numerator,n.numerator),C.multiply(this.denominator,n.denominator))},t.divide=function(t){var n=t instanceof e?t:new e(de(t));return new e(C.multiply(this.numerator,n.denominator),C.multiply(this.denominator,n.numerator))},t.toSignificant=function(e,t,n){void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(e)||c(!1),e>0||c(!1),fe.set({precision:e+1,rounding:le[n]});var r=new fe(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)},t.toFixed=function(e,t,n){return void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(e)||c(!1),e>=0||c(!1),Oe.DP=e,Oe.RM=Ne[n],new Oe(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)},Y(e,[{key:"quotient",get:function(){return C.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new e(C.remainder(this.numerator,this.denominator),this.denominator)}}]),e}(),Be=T(x),Me=function(e){function t(t,n){var r,o=de(n);return ae(o,B.uint256),(r=e.call(this,o,C.exponentiate(W,C.BigInt(t.decimals)))||this).currency=t,r}j(t,e),t.ether=function(e){return new t(ce,e)};var n=t.prototype;return n.add=function(e){return Ae(this.currency,e.currency)||c(!1),new t(this.currency,C.add(this.raw,e.raw))},n.subtract=function(e){return Ae(this.currency,e.currency)||c(!1),new t(this.currency,C.subtract(this.raw,e.raw))},n.toSignificant=function(t,n,r){return void 0===t&&(t=6),void 0===r&&(r=exports.Rounding.ROUND_DOWN),e.prototype.toSignificant.call(this,t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=this.currency.decimals),void 0===r&&(r=exports.Rounding.ROUND_DOWN),t<=this.currency.decimals||c(!1),e.prototype.toFixed.call(this,t,n,r)},n.toExact=function(e){return void 0===e&&(e={groupSeparator:""}),Be.DP=this.currency.decimals,new Be(this.numerator.toString()).div(this.denominator.toString()).toFormat(e)},Y(t,[{key:"raw",get:function(){return this.numerator}}]),t}(me),ve=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).token=t,r}j(t,e);var n=t.prototype;return n.add=function(e){return this.token.equals(e.token)||c(!1),new t(this.token,C.add(this.raw,e.raw))},n.subtract=function(e){return this.token.equals(e.token)||c(!1),new t(this.token,C.subtract(this.raw,e.raw))},t}(Me),De=function(e){function t(t,n,r,o){var i;return(i=e.call(this,o,r)||this).baseCurrency=t,i.quoteCurrency=n,i.scalar=new me(C.exponentiate(W,C.BigInt(t.decimals)),C.exponentiate(W,C.BigInt(n.decimals))),i}j(t,e),t.fromRoute=function(e){for(var n,r=[],o=te(e.pairs.entries());!(n=o()).done;){var i=n.value,a=i[1];r.push(e.path[i[0]].equals(a.token0)?new t(a.reserve0.currency,a.reserve1.currency,a.reserve0.raw,a.reserve1.raw):new t(a.reserve1.currency,a.reserve0.currency,a.reserve1.raw,a.reserve0.raw))}return r.slice(1).reduce((function(e,t){return e.multiply(t)}),r[0])};var n=t.prototype;return n.invert=function(){return new t(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){Ae(this.quoteCurrency,n.baseCurrency)||c(!1);var r=e.prototype.multiply.call(this,n);return new t(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(t){return Ae(t.currency,this.baseCurrency)||c(!1),this.quoteCurrency instanceof Ie?new ve(this.quoteCurrency,e.prototype.multiply.call(this,t.raw).quotient):Me.ether(e.prototype.multiply.call(this,t.raw).quotient)},n.toSignificant=function(e,t,n){return void 0===e&&(e=6),this.adjusted.toSignificant(e,t,n)},n.toFixed=function(e,t,n){return void 0===e&&(e=4),this.adjusted.toFixed(e,t,n)},Y(t,[{key:"raw",get:function(){return new me(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return e.prototype.multiply.call(this,this.scalar)}}]),t}(me),be={},Re=function(){function e(t,n){var r=t.token.sortsBefore(n.token)?[t,n]:[n,t];this.liquidityToken=new Ie(r[0].token.chainId,e.getAddress(r[0].token,r[1].token),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=r}e.getAddress=function(e,t){var n,r,o,i,a,s=e.sortsBefore(t)?[e,t]:[t,e];return void 0===(null===(n=be)||void 0===n||null===(r=n[s[0].address])||void 0===r?void 0:r[s[1].address])&&(be=X({},be,((a={})[s[0].address]=X({},null===(o=be)||void 0===o?void 0:o[s[0].address],((i={})[s[1].address]=I.getCreate2Address(v[e.chainId],f.keccak256(["bytes"],[f.pack(["address","address"],[s[0].address,s[1].address])]),M),i)),a))),be[s[0].address][s[1].address]};var t=e.prototype;return t.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},t.priceOf=function(e){return this.involvesToken(e)||c(!1),e.equals(this.token0)?this.token0Price:this.token1Price},t.reserveOf=function(e){return this.involvesToken(e)||c(!1),e.equals(this.token0)?this.reserve0:this.reserve1},t.getOutputAmount=function(t){if(this.involvesToken(t.token)||c(!1),C.equal(this.reserve0.raw,k)||C.equal(this.reserve1.raw,k))throw new oe;var n=this.reserveOf(t.token),r=this.reserveOf(t.token.equals(this.token0)?this.token1:this.token0),o=C.multiply(t.raw,P),i=C.multiply(o,r.raw),a=C.add(C.multiply(n.raw,q),o),s=new ve(t.token.equals(this.token0)?this.token1:this.token0,C.divide(i,a));if(C.equal(s.raw,k))throw new ie;return[s,new e(n.add(t),r.subtract(s))]},t.getInputAmount=function(t){if(this.involvesToken(t.token)||c(!1),C.equal(this.reserve0.raw,k)||C.equal(this.reserve1.raw,k)||C.greaterThanOrEqual(t.raw,this.reserveOf(t.token).raw))throw new oe;var n=this.reserveOf(t.token),r=this.reserveOf(t.token.equals(this.token0)?this.token1:this.token0),o=C.multiply(C.multiply(r.raw,t.raw),q),i=C.multiply(C.subtract(n.raw,t.raw),P),a=new ve(t.token.equals(this.token0)?this.token1:this.token0,C.add(C.divide(o,i),F));return[a,new e(r.add(a),n.subtract(t))]},t.getLiquidityMinted=function(e,t,n){e.token.equals(this.liquidityToken)||c(!1);var r,o=t.token.sortsBefore(n.token)?[t,n]:[n,t];if(o[0].token.equals(this.token0)&&o[1].token.equals(this.token1)||c(!1),C.equal(e.raw,k))r=C.subtract(pe(C.multiply(o[0].raw,o[1].raw)),g);else{var i=C.divide(C.multiply(o[0].raw,e.raw),this.reserve0.raw),a=C.divide(C.multiply(o[1].raw,e.raw),this.reserve1.raw);r=C.lessThanOrEqual(i,a)?i:a}if(!C.greaterThan(r,k))throw new ie;return new ve(this.liquidityToken,r)},t.getLiquidityValue=function(e,t,n,r,o){var i;if(void 0===r&&(r=!1),this.involvesToken(e)||c(!1),t.token.equals(this.liquidityToken)||c(!1),n.token.equals(this.liquidityToken)||c(!1),C.lessThanOrEqual(n.raw,t.raw)||c(!1),r){o||c(!1);var a=de(o);if(C.equal(a,k))i=t;else{var s=pe(C.multiply(this.reserve0.raw,this.reserve1.raw)),d=pe(a);if(C.greaterThan(s,d)){var p=C.multiply(t.raw,C.subtract(s,d)),u=C.add(C.multiply(s,U),d),h=C.divide(p,u);i=t.add(new ve(this.liquidityToken,h))}else i=t}}else i=t;return new ve(e,C.divide(C.multiply(n.raw,this.reserveOf(e).raw),i.raw))},Y(e,[{key:"token0Price",get:function(){return new De(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new De(this.token1,this.token0,this.tokenAmounts[1].raw,this.tokenAmounts[0].raw)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].token}},{key:"token1",get:function(){return this.tokenAmounts[1].token}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),e}(),Se=function(){function e(e,t,n){e.length>0||c(!1),e.every((function(t){return t.chainId===e[0].chainId}))||c(!1),t instanceof Ie&&e[0].involvesToken(t)||t===ce&&e[0].involvesToken(Ee[e[0].chainId])||c(!1),void 0===n||n instanceof Ie&&e[e.length-1].involvesToken(n)||n===ce&&e[e.length-1].involvesToken(Ee[e[0].chainId])||c(!1);for(var r,o=[t instanceof Ie?t:Ee[e[0].chainId]],i=te(e.entries());!(r=i()).done;){var a=r.value,s=a[1],d=o[a[0]];d.equals(s.token0)||d.equals(s.token1)||c(!1);var p=d.equals(s.token0)?s.token1:s.token0;o.push(p)}this.pairs=e,this.path=o,this.midPrice=De.fromRoute(this),this.input=t,this.output=null!=n?n:o[o.length-1]}return Y(e,[{key:"chainId",get:function(){return this.pairs[0].chainId}}]),e}(),ye=new me(L),we=function(e){function t(){return e.apply(this,arguments)||this}j(t,e);var n=t.prototype;return n.toSignificant=function(e,t,n){return void 0===e&&(e=5),this.multiply(ye).toSignificant(e,t,n)},n.toFixed=function(e,t,n){return void 0===e&&(e=2),this.multiply(ye).toFixed(e,t,n)},t}(me);function ge(e,t){return Ae(e.inputAmount.currency,t.inputAmount.currency)||c(!1),Ae(e.outputAmount.currency,t.outputAmount.currency)||c(!1),e.outputAmount.equalTo(t.outputAmount)?e.inputAmount.equalTo(t.inputAmount)?0:e.inputAmount.lessThan(t.inputAmount)?-1:1:e.outputAmount.lessThan(t.outputAmount)?1:-1}function ke(e,t){var n=ge(e,t);return 0!==n?n:e.priceImpact.lessThan(t.priceImpact)?-1:e.priceImpact.greaterThan(t.priceImpact)?1:e.route.path.length-t.route.path.length}function Fe(e,t){return e instanceof ve?e:e.currency===ce?new ve(Ee[t],e.raw):void c(!1)}function _e(e,t){return e instanceof Ie?e:e===ce?Ee[t]:void c(!1)}var He=function(){function e(e,t,n){var r,o,i,a=new Array(e.path.length),s=new Array(e.pairs.length);if(n===exports.TradeType.EXACT_INPUT){Ae(t.currency,e.input)||c(!1),a[0]=Fe(t,e.chainId);for(var d=0;d<e.path.length-1;d++){var p=e.pairs[d].getOutputAmount(a[d]),u=p[1];a[d+1]=p[0],s[d]=u}}else{Ae(t.currency,e.output)||c(!1),a[a.length-1]=Fe(t,e.chainId);for(var h=e.path.length-1;h>0;h--){var C=e.pairs[h-1].getInputAmount(a[h]),I=C[1];a[h-1]=C[0],s[h-1]=I}}this.route=e,this.tradeType=n,this.inputAmount=n===exports.TradeType.EXACT_INPUT?t:e.input===ce?Me.ether(a[0].raw):a[0],this.outputAmount=n===exports.TradeType.EXACT_OUTPUT?t:e.output===ce?Me.ether(a[a.length-1].raw):a[a.length-1],this.executionPrice=new De(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=De.fromRoute(new Se(s,e.input)),this.priceImpact=(r=this.outputAmount,i=(o=e.midPrice.raw.multiply(this.inputAmount.raw)).subtract(r.raw).divide(o),new we(i.numerator,i.denominator))}e.exactIn=function(t,n){return new e(t,n,exports.TradeType.EXACT_INPUT)},e.exactOut=function(t,n){return new e(t,n,exports.TradeType.EXACT_OUTPUT)};var t=e.prototype;return t.minimumAmountOut=function(e){if(e.lessThan(k)&&c(!1),this.tradeType===exports.TradeType.EXACT_OUTPUT)return this.outputAmount;var t=new me(F).add(e).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof ve?new ve(this.outputAmount.token,t):Me.ether(t)},t.maximumAmountIn=function(e){if(e.lessThan(k)&&c(!1),this.tradeType===exports.TradeType.EXACT_INPUT)return this.inputAmount;var t=new me(F).add(e).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof ve?new ve(this.inputAmount.token,t):Me.ether(t)},e.bestTradeExactIn=function(t,n,r,o,i,a,s){var d=void 0===o?{}:o,p=d.maxNumResults,u=void 0===p?3:p,h=d.maxHops,C=void 0===h?3:h;void 0===i&&(i=[]),void 0===a&&(a=n),void 0===s&&(s=[]),t.length>0||c(!1),C>0||c(!1),a===n||i.length>0||c(!1);var I=n instanceof ve?n.token.chainId:r instanceof Ie?r.chainId:void 0;void 0===I&&c(!1);for(var A=Fe(n,I),x=_e(r,I),T=0;T<t.length;T++){var E=t[T];if((E.token0.equals(A.token)||E.token1.equals(A.token))&&!E.reserve0.equalTo(k)&&!E.reserve1.equalTo(k)){var f=void 0;try{f=E.getOutputAmount(A)[0]}catch(e){if(e.isInsufficientInputAmountError)continue;throw e}if(f.token.equals(x))ue(s,new e(new Se([].concat(i,[E]),a.currency,r),a,exports.TradeType.EXACT_INPUT),u,ke);else if(C>1&&t.length>1){var O=t.slice(0,T).concat(t.slice(T+1,t.length));e.bestTradeExactIn(O,f,r,{maxNumResults:u,maxHops:C-1},[].concat(i,[E]),a,s)}}}return s},e.bestTradeExactOut=function(t,n,r,o,i,a,s){var d=void 0===o?{}:o,p=d.maxNumResults,u=void 0===p?3:p,h=d.maxHops,C=void 0===h?3:h;void 0===i&&(i=[]),void 0===a&&(a=r),void 0===s&&(s=[]),t.length>0||c(!1),C>0||c(!1),a===r||i.length>0||c(!1);var I=r instanceof ve?r.token.chainId:n instanceof Ie?n.chainId:void 0;void 0===I&&c(!1);for(var A=Fe(r,I),x=_e(n,I),T=0;T<t.length;T++){var E=t[T];if((E.token0.equals(A.token)||E.token1.equals(A.token))&&!E.reserve0.equalTo(k)&&!E.reserve1.equalTo(k)){var f=void 0;try{f=E.getInputAmount(A)[0]}catch(e){if(e.isInsufficientReservesError)continue;throw e}if(f.token.equals(x))ue(s,new e(new Se([E].concat(i),n,a.currency),a,exports.TradeType.EXACT_OUTPUT),u,ke);else if(C>1&&t.length>1){var O=t.slice(0,T).concat(t.slice(T+1,t.length));e.bestTradeExactOut(O,n,f,{maxNumResults:u,maxHops:C-1},[E].concat(i),a,s)}}}return s},e}();function Ue(e){return"0x"+e.raw.toString(16)}var We,Le=function(){function e(){}return e.swapCallParameters=function(e,t){var n=e.inputAmount.currency===ce,r=e.outputAmount.currency===ce;n&&r&&c(!1),!("ttl"in t)||t.ttl>0||c(!1);var o,i,a,s=se(t.recipient),d=Ue(e.maximumAmountIn(t.allowedSlippage)),p=Ue(e.minimumAmountOut(t.allowedSlippage)),u=e.route.path.map((function(e){return e.address})),h="ttl"in t?"0x"+(Math.floor((new Date).getTime()/1e3)+t.ttl).toString(16):"0x"+t.deadline.toString(16),C=Boolean(t.feeOnTransfer);switch(e.tradeType){case exports.TradeType.EXACT_INPUT:n?(o=C?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",i=[p,u,s,h],a=d):r?(o=C?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",i=[d,p,u,s,h],a="0x0"):(o=C?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",i=[d,p,u,s,h],a="0x0");break;case exports.TradeType.EXACT_OUTPUT:C&&c(!1),n?(o="swapETHForExactTokens",i=[p,u,s,h],a=d):r?(o="swapTokensForExactETH",i=[p,d,u,s,h],a="0x0"):(o="swapTokensForExactTokens",i=[p,d,u,s,h],a="0x0")}return{methodName:o,args:i,value:a}},e}(),Pe=[{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"}],qe=((We={})[exports.ChainId.MAINNET]={"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A":9},We),Ke=function(){function e(){}return e.fetchTokenData=function(e,t,n,r,o){try{var i,a,s=function(n){return new Ie(e,t,n,r,o)};void 0===n&&(n=N.getDefaultProvider(l.getNetwork(e)));var d="number"==typeof(null===(i=qe)||void 0===i||null===(a=i[e])||void 0===a?void 0:a[t]);return Promise.resolve(d?s(qe[e][t]):Promise.resolve(new O.Contract(t,Pe,n).decimals().then((function(n){var r,o,i;return qe=X({},qe,((i={})[e]=X({},null===(r=qe)||void 0===r?void 0:r[e],((o={})[t]=n,o)),i)),n}))).then(s))}catch(e){return Promise.reject(e)}},e.fetchPairData=function(e,t,n){try{void 0===n&&(n=N.getDefaultProvider(l.getNetwork(e.chainId))),e.chainId!==t.chainId&&c(!1);var r=Re.getAddress(e,t);return Promise.resolve(new O.Contract(r,m.abi,n).getReserves()).then((function(n){var r=n[0],o=n[1],i=e.sortsBefore(t)?[r,o]:[o,r];return new Re(new ve(e,i[0]),new ve(t,i[1]))}))}catch(e){return Promise.reject(e)}},e}();exports.JSBI=C,exports.BAR_ADDRESS=S,exports.Currency=he,exports.CurrencyAmount=Me,exports.ETHER=ce,exports.FACTORY_ADDRESS=v,exports.Fetcher=Ke,exports.Fraction=me,exports.INIT_CODE_HASH=M,exports.InsufficientInputAmountError=ie,exports.InsufficientReservesError=oe,exports.MAKER_ADDRESS=y,exports.MASTERCHEF_ADDRESS=R,exports.MINIMUM_LIQUIDITY=g,exports.Pair=Re,exports.Percent=we,exports.Price=De,exports.ROUTER_ADDRESS=D,exports.Route=Se,exports.Router=Le,exports.SUSHI_ADDRESS=b,exports.TIMELOCK_ADDRESS=w,exports.Token=Ie,exports.TokenAmount=ve,exports.Trade=He,exports.WETH=Ee,exports.currencyEquals=Ae,exports.inputOutputComparator=ge,exports.tradeComparator=ke;
|
|
2
2
|
//# sourceMappingURL=sdk.cjs.production.min.js.map
|