@hskswap/sdk-core 1.0.0

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.
@@ -0,0 +1,1176 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var JSBI = _interopDefault(require('jsbi'));
8
+ var invariant = _interopDefault(require('tiny-invariant'));
9
+ var _Decimal = _interopDefault(require('decimal.js-light'));
10
+ var _Big = _interopDefault(require('big.js'));
11
+ var toFormat = _interopDefault(require('toformat'));
12
+ var bignumber = require('@ethersproject/bignumber');
13
+ var address = require('@ethersproject/address');
14
+ var bytes = require('@ethersproject/bytes');
15
+ var keccak256 = require('@ethersproject/keccak256');
16
+ var strings = require('@ethersproject/strings');
17
+
18
+ function _defineProperties(e, r) {
19
+ for (var t = 0; t < r.length; t++) {
20
+ var o = r[t];
21
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
22
+ }
23
+ }
24
+ function _createClass(e, r, t) {
25
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
26
+ writable: !1
27
+ }), e;
28
+ }
29
+ function _extends() {
30
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
31
+ for (var e = 1; e < arguments.length; e++) {
32
+ var t = arguments[e];
33
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
34
+ }
35
+ return n;
36
+ }, _extends.apply(null, arguments);
37
+ }
38
+ function _inheritsLoose(t, o) {
39
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
40
+ }
41
+ function _setPrototypeOf(t, e) {
42
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
43
+ return t.__proto__ = e, t;
44
+ }, _setPrototypeOf(t, e);
45
+ }
46
+ function _toPrimitive(t, r) {
47
+ if ("object" != typeof t || !t) return t;
48
+ var e = t[Symbol.toPrimitive];
49
+ if (void 0 !== e) {
50
+ var i = e.call(t, r || "default");
51
+ if ("object" != typeof i) return i;
52
+ throw new TypeError("@@toPrimitive must return a primitive value.");
53
+ }
54
+ return ("string" === r ? String : Number)(t);
55
+ }
56
+ function _toPropertyKey(t) {
57
+ var i = _toPrimitive(t, "string");
58
+ return "symbol" == typeof i ? i : i + "";
59
+ }
60
+
61
+ (function (ChainId) {
62
+ ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
63
+ ChainId[ChainId["GOERLI"] = 5] = "GOERLI";
64
+ ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
65
+ ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM";
66
+ ChainId[ChainId["OPTIMISM_GOERLI"] = 420] = "OPTIMISM_GOERLI";
67
+ ChainId[ChainId["OPTIMISM_SEPOLIA"] = 11155420] = "OPTIMISM_SEPOLIA";
68
+ ChainId[ChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
69
+ ChainId[ChainId["ARBITRUM_GOERLI"] = 421613] = "ARBITRUM_GOERLI";
70
+ ChainId[ChainId["ARBITRUM_SEPOLIA"] = 421614] = "ARBITRUM_SEPOLIA";
71
+ ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
72
+ ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI";
73
+ ChainId[ChainId["CELO"] = 42220] = "CELO";
74
+ ChainId[ChainId["CELO_ALFAJORES"] = 44787] = "CELO_ALFAJORES";
75
+ ChainId[ChainId["GNOSIS"] = 100] = "GNOSIS";
76
+ ChainId[ChainId["MOONBEAM"] = 1284] = "MOONBEAM";
77
+ ChainId[ChainId["BNB"] = 56] = "BNB";
78
+ ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE";
79
+ ChainId[ChainId["BASE_GOERLI"] = 84531] = "BASE_GOERLI";
80
+ ChainId[ChainId["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA";
81
+ ChainId[ChainId["BASE"] = 8453] = "BASE";
82
+ ChainId[ChainId["ZORA"] = 7777777] = "ZORA";
83
+ ChainId[ChainId["ZORA_SEPOLIA"] = 999999999] = "ZORA_SEPOLIA";
84
+ ChainId[ChainId["ROOTSTOCK"] = 30] = "ROOTSTOCK";
85
+ ChainId[ChainId["BLAST"] = 81457] = "BLAST";
86
+ ChainId[ChainId["ZKSYNC"] = 324] = "ZKSYNC";
87
+ ChainId[ChainId["WORLDCHAIN"] = 480] = "WORLDCHAIN";
88
+ ChainId[ChainId["UNICHAIN_SEPOLIA"] = 1301] = "UNICHAIN_SEPOLIA";
89
+ ChainId[ChainId["UNICHAIN"] = 130] = "UNICHAIN";
90
+ ChainId[ChainId["MONAD_TESTNET"] = 10143] = "MONAD_TESTNET";
91
+ ChainId[ChainId["SONEIUM"] = 1868] = "SONEIUM";
92
+ ChainId[ChainId["MONAD"] = 143] = "MONAD";
93
+ ChainId[ChainId["XLAYER"] = 196] = "XLAYER";
94
+ ChainId[ChainId["HASHKEY_TESTNET"] = 133] = "HASHKEY_TESTNET";
95
+ ChainId[ChainId["HASHKEY_MAINNET"] = 177] = "HASHKEY_MAINNET";
96
+ })(exports.ChainId || (exports.ChainId = {}));
97
+ var SUPPORTED_CHAINS = [exports.ChainId.MAINNET, exports.ChainId.OPTIMISM, exports.ChainId.OPTIMISM_GOERLI, exports.ChainId.OPTIMISM_SEPOLIA, exports.ChainId.ARBITRUM_ONE, exports.ChainId.ARBITRUM_GOERLI, exports.ChainId.ARBITRUM_SEPOLIA, exports.ChainId.POLYGON, exports.ChainId.POLYGON_MUMBAI, exports.ChainId.GOERLI, exports.ChainId.SEPOLIA, exports.ChainId.CELO_ALFAJORES, exports.ChainId.CELO, exports.ChainId.BNB, exports.ChainId.AVALANCHE, exports.ChainId.BASE, exports.ChainId.BASE_GOERLI, exports.ChainId.BASE_SEPOLIA, exports.ChainId.ZORA, exports.ChainId.ZORA_SEPOLIA, exports.ChainId.ROOTSTOCK, exports.ChainId.BLAST, exports.ChainId.ZKSYNC, exports.ChainId.WORLDCHAIN, exports.ChainId.UNICHAIN_SEPOLIA, exports.ChainId.UNICHAIN, exports.ChainId.MONAD_TESTNET, exports.ChainId.SONEIUM, exports.ChainId.MONAD, exports.ChainId.XLAYER, exports.ChainId.HASHKEY_TESTNET, exports.ChainId.HASHKEY_MAINNET];
98
+ (function (NativeCurrencyName) {
99
+ // Strings match input for CLI
100
+ NativeCurrencyName["ETHER"] = "ETH";
101
+ NativeCurrencyName["MATIC"] = "MATIC";
102
+ NativeCurrencyName["CELO"] = "CELO";
103
+ NativeCurrencyName["GNOSIS"] = "XDAI";
104
+ NativeCurrencyName["MOONBEAM"] = "GLMR";
105
+ NativeCurrencyName["BNB"] = "BNB";
106
+ NativeCurrencyName["AVAX"] = "AVAX";
107
+ NativeCurrencyName["ROOTSTOCK"] = "RBTC";
108
+ NativeCurrencyName["HSK"] = "HSK";
109
+ })(exports.NativeCurrencyName || (exports.NativeCurrencyName = {}));
110
+
111
+ var _V2_FACTORY_ADDRESSES, _V2_ROUTER_ADDRESSES, _CHAIN_TO_ADDRESSES_M, _GOVERNANCE_ALPHA_V1_, _GOVERNANCE_BRAVO_ADD, _MERKLE_DISTRIBUTOR_A, _ARGENT_WALLET_DETECT, _SOCKS_CONTROLLER_ADD;
112
+ var DEFAULT_NETWORKS = [exports.ChainId.MAINNET, exports.ChainId.GOERLI, exports.ChainId.SEPOLIA];
113
+ function constructSameAddressMap(address, additionalNetworks) {
114
+ if (additionalNetworks === void 0) {
115
+ additionalNetworks = [];
116
+ }
117
+ return DEFAULT_NETWORKS.concat(additionalNetworks).reduce(function (memo, chainId) {
118
+ memo[chainId] = address;
119
+ return memo;
120
+ }, {});
121
+ }
122
+ var UNI_ADDRESSES = /*#__PURE__*/constructSameAddressMap('0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', [exports.ChainId.OPTIMISM, exports.ChainId.ARBITRUM_ONE, exports.ChainId.POLYGON, exports.ChainId.POLYGON_MUMBAI, exports.ChainId.SEPOLIA]);
123
+ var UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS = '0x8B799381ac40b838BBA4131ffB26197C432AFe78';
124
+ /**
125
+ * @deprecated use V2_FACTORY_ADDRESSES instead
126
+ */
127
+ var V2_FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';
128
+ var V2_FACTORY_ADDRESSES = (_V2_FACTORY_ADDRESSES = {}, _V2_FACTORY_ADDRESSES[exports.ChainId.MAINNET] = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', _V2_FACTORY_ADDRESSES[exports.ChainId.GOERLI] = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', _V2_FACTORY_ADDRESSES[exports.ChainId.SEPOLIA] = '0xF62c03E08ada871A0bEb309762E260a7a6a880E6', _V2_FACTORY_ADDRESSES[exports.ChainId.OPTIMISM] = '0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf', _V2_FACTORY_ADDRESSES[exports.ChainId.ARBITRUM_ONE] = '0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9', _V2_FACTORY_ADDRESSES[exports.ChainId.AVALANCHE] = '0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C', _V2_FACTORY_ADDRESSES[exports.ChainId.BASE_SEPOLIA] = '0x7Ae58f10f7849cA6F5fB71b7f45CB416c9204b1e', _V2_FACTORY_ADDRESSES[exports.ChainId.BASE] = '0x8909dc15e40173ff4699343b6eb8132c65e18ec6', _V2_FACTORY_ADDRESSES[exports.ChainId.BNB] = '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6', _V2_FACTORY_ADDRESSES[exports.ChainId.POLYGON] = '0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C', _V2_FACTORY_ADDRESSES[exports.ChainId.CELO] = '0x79a530c8e2fA8748B7B40dd3629C0520c2cCf03f', _V2_FACTORY_ADDRESSES[exports.ChainId.BLAST] = '0x5C346464d33F90bABaf70dB6388507CC889C1070', _V2_FACTORY_ADDRESSES[exports.ChainId.WORLDCHAIN] = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', _V2_FACTORY_ADDRESSES[exports.ChainId.UNICHAIN_SEPOLIA] = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', _V2_FACTORY_ADDRESSES[exports.ChainId.UNICHAIN] = '0x1f98400000000000000000000000000000000002', _V2_FACTORY_ADDRESSES[exports.ChainId.MONAD_TESTNET] = '0x733e88f248b742db6c14c0b1713af5ad7fdd59d0', _V2_FACTORY_ADDRESSES[exports.ChainId.SONEIUM] = '0x97febbc2adbd5644ba22736e962564b23f5828ce', _V2_FACTORY_ADDRESSES[exports.ChainId.MONAD] = '0x182a927119d56008d921126764bf884221b10f59', _V2_FACTORY_ADDRESSES[exports.ChainId.XLAYER] = '0xdf38f24fe153761634be942f9d859f3dba857e95', _V2_FACTORY_ADDRESSES);
129
+ /**
130
+ * @deprecated use V2_ROUTER_ADDRESSES instead
131
+ */
132
+ var V2_ROUTER_ADDRESS = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D';
133
+ var V2_ROUTER_ADDRESSES = (_V2_ROUTER_ADDRESSES = {}, _V2_ROUTER_ADDRESSES[exports.ChainId.MAINNET] = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', _V2_ROUTER_ADDRESSES[exports.ChainId.GOERLI] = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', _V2_ROUTER_ADDRESSES[exports.ChainId.SEPOLIA] = '0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3', _V2_ROUTER_ADDRESSES[exports.ChainId.ARBITRUM_ONE] = '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24', _V2_ROUTER_ADDRESSES[exports.ChainId.OPTIMISM] = '0x4a7b5da61326a6379179b40d00f57e5bbdc962c2', _V2_ROUTER_ADDRESSES[exports.ChainId.BASE_SEPOLIA] = '0x1689E7B1F10000AE47eBfE339a4f69dECd19F602', _V2_ROUTER_ADDRESSES[exports.ChainId.BASE] = '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24', _V2_ROUTER_ADDRESSES[exports.ChainId.AVALANCHE] = '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24', _V2_ROUTER_ADDRESSES[exports.ChainId.BNB] = '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24', _V2_ROUTER_ADDRESSES[exports.ChainId.POLYGON] = '0xedf6066a2b290c185783862c7f4776a2c8077ad1', _V2_ROUTER_ADDRESSES[exports.ChainId.BLAST] = '0xBB66Eb1c5e875933D44DAe661dbD80e5D9B03035', _V2_ROUTER_ADDRESSES[exports.ChainId.WORLDCHAIN] = '0x541aB7c31A119441eF3575F6973277DE0eF460bd', _V2_ROUTER_ADDRESSES[exports.ChainId.UNICHAIN_SEPOLIA] = '0x920b806E40A00E02E7D2b94fFc89860fDaEd3640', _V2_ROUTER_ADDRESSES[exports.ChainId.UNICHAIN] = '0x284f11109359a7e1306c3e447ef14d38400063ff', _V2_ROUTER_ADDRESSES[exports.ChainId.MONAD_TESTNET] = '0xfb8e1c3b833f9e67a71c859a132cf783b645e436', _V2_ROUTER_ADDRESSES[exports.ChainId.SONEIUM] = '0x273f68c234fa55b550b40e563c4a488e0d334320', _V2_ROUTER_ADDRESSES[exports.ChainId.MONAD] = '0x4b2ab38dbf28d31d467aa8993f6c2585981d6804', _V2_ROUTER_ADDRESSES[exports.ChainId.XLAYER] = '0x182a927119d56008d921126764bf884221b10f59', _V2_ROUTER_ADDRESSES);
134
+ // Networks that share most of the same addresses i.e. Mainnet, Goerli, Optimism, Arbitrum, Polygon
135
+ var DEFAULT_ADDRESSES = {
136
+ v3CoreFactoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
137
+ multicallAddress: '0x1F98415757620B543A52E61c46B32eB19261F984',
138
+ quoterAddress: '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6',
139
+ v3MigratorAddress: '0xA5644E29708357803b5A882D272c41cC0dF92B34',
140
+ nonfungiblePositionManagerAddress: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'
141
+ };
142
+ var MAINNET_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
143
+ mixedRouteQuoterV1Address: '0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E',
144
+ v4PoolManagerAddress: '0x000000000004444c5dc75cB358380D2e3dE08A90',
145
+ v4PositionManagerAddress: '0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e',
146
+ v4StateView: '0x7ffe42c4a5deea5b0fec41c94c136cf115597227',
147
+ v4QuoterAddress: '0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203'
148
+ });
149
+ var GOERLI_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
150
+ mixedRouteQuoterV1Address: '0xBa60b6e6fF25488308789E6e0A65D838be34194e'
151
+ });
152
+ var OPTIMISM_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
153
+ v4PoolManagerAddress: '0x9a13f98cb987694c9f086b1f5eb990eea8264ec3',
154
+ v4PositionManagerAddress: '0x3c3ea4b57a46241e54610e5f022e5c45859a1017',
155
+ v4StateView: '0xc18a3169788f4f75a170290584eca6395c75ecdb',
156
+ v4QuoterAddress: '0x1f3131a13296fb91c90870043742c3cdbff1a8d7'
157
+ });
158
+ var ARBITRUM_ONE_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
159
+ multicallAddress: '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB',
160
+ tickLensAddress: '0xbfd8137f7d1516D3ea5cA83523914859ec47F573',
161
+ v4PoolManagerAddress: '0x360e68faccca8ca495c1b759fd9eee466db9fb32',
162
+ v4PositionManagerAddress: '0xd88f38f930b7952f2db2432cb002e7abbf3dd869',
163
+ v4StateView: '0x76fd297e2d437cd7f76d50f01afe6160f86e9990',
164
+ v4QuoterAddress: '0x3972c00f7ed4885e145823eb7c655375d275a1c5'
165
+ });
166
+ var POLYGON_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
167
+ v4PoolManagerAddress: '0x67366782805870060151383f4bbff9dab53e5cd6',
168
+ v4PositionManagerAddress: '0x1ec2ebf4f37e7363fdfe3551602425af0b3ceef9',
169
+ v4StateView: '0x5ea1bd7974c8a611cbab0bdcafcb1d9cc9b3ba5a',
170
+ v4QuoterAddress: '0xb3d5c3dfc3a7aebff71895a7191796bffc2c81b9'
171
+ });
172
+ // celo v3 and v4 addresses
173
+ var CELO_ADDRESSES = {
174
+ v3CoreFactoryAddress: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc',
175
+ multicallAddress: '0x633987602DE5C4F337e3DbF265303A1080324204',
176
+ quoterAddress: '0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8',
177
+ v3MigratorAddress: '0x3cFd4d48EDfDCC53D3f173F596f621064614C582',
178
+ nonfungiblePositionManagerAddress: '0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A',
179
+ tickLensAddress: '0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D',
180
+ v4PoolManagerAddress: '0x288dc841A52FCA2707c6947B3A777c5E56cd87BC',
181
+ v4PositionManagerAddress: '0xf7965f3981e4d5bc383bfbcb61501763e9068ca9',
182
+ v4StateView: '0xbc21f8720babf4b20d195ee5c6e99c52b76f2bfb',
183
+ v4QuoterAddress: '0x28566da1093609182dff2cb2a91cfd72e61d66cd'
184
+ };
185
+ // BNB v3 addresses
186
+ var BNB_ADDRESSES = {
187
+ v3CoreFactoryAddress: '0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7',
188
+ multicallAddress: '0x963Df249eD09c358A4819E39d9Cd5736c3087184',
189
+ quoterAddress: '0x78D78E420Da98ad378D7799bE8f4AF69033EB077',
190
+ v3MigratorAddress: '0x32681814957e0C13117ddc0c2aba232b5c9e760f',
191
+ nonfungiblePositionManagerAddress: '0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613',
192
+ tickLensAddress: '0xD9270014D396281579760619CCf4c3af0501A47C',
193
+ swapRouter02Address: '0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2',
194
+ v4PoolManagerAddress: '0x28e2ea090877bf75740558f6bfb36a5ffee9e9df',
195
+ v4PositionManagerAddress: '0x7a4a5c919ae2541aed11041a1aeee68f1287f95b',
196
+ v4StateView: '0xd13dd3d6e93f276fafc9db9e6bb47c1180aee0c4',
197
+ v4QuoterAddress: '0x9f75dd27d6664c475b90e105573e550ff69437b0'
198
+ };
199
+ // optimism goerli addresses
200
+ var OPTIMISM_GOERLI_ADDRESSES = {
201
+ v3CoreFactoryAddress: '0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10',
202
+ multicallAddress: '0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd',
203
+ quoterAddress: '0x9569CbA925c8ca2248772A9A4976A516743A246F',
204
+ v3MigratorAddress: '0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8',
205
+ nonfungiblePositionManagerAddress: '0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6',
206
+ tickLensAddress: '0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e'
207
+ };
208
+ // optimism sepolia addresses
209
+ var OPTIMISM_SEPOLIA_ADDRESSES = {
210
+ v3CoreFactoryAddress: '0x8CE191193D15ea94e11d327b4c7ad8bbE520f6aF',
211
+ multicallAddress: '0x80e4e06841bb76AA9735E0448cB8d003C0EF009a',
212
+ quoterAddress: '0x0FBEa6cf957d95ee9313490050F6A0DA68039404',
213
+ v3MigratorAddress: '0xE7EcbAAaA54D007A00dbb6c1d2f150066D69dA07',
214
+ nonfungiblePositionManagerAddress: '0xdA75cEf1C93078e8b736FCA5D5a30adb97C8957d',
215
+ tickLensAddress: '0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5',
216
+ swapRouter02Address: '0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4'
217
+ };
218
+ // arbitrum goerli v3 addresses
219
+ var ARBITRUM_GOERLI_ADDRESSES = {
220
+ v3CoreFactoryAddress: '0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6',
221
+ multicallAddress: '0x8260CB40247290317a4c062F3542622367F206Ee',
222
+ quoterAddress: '0x1dd92b83591781D0C6d98d07391eea4b9a6008FA',
223
+ v3MigratorAddress: '0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3',
224
+ nonfungiblePositionManagerAddress: '0x622e4726a167799826d1E1D150b076A7725f5D81',
225
+ tickLensAddress: '0xb52429333da969a0C79a60930a4Bf0020E5D1DE8'
226
+ };
227
+ // arbitrum sepolia v3 addresses
228
+ var ARBITRUM_SEPOLIA_ADDRESSES = {
229
+ v3CoreFactoryAddress: '0x248AB79Bbb9bC29bB72f7Cd42F17e054Fc40188e',
230
+ multicallAddress: '0x2B718b475e385eD29F56775a66aAB1F5cC6B2A0A',
231
+ quoterAddress: '0x2779a0CC1c3e0E44D2542EC3e79e3864Ae93Ef0B',
232
+ v3MigratorAddress: '0x398f43ef2c67B941147157DA1c5a868E906E043D',
233
+ nonfungiblePositionManagerAddress: '0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65',
234
+ tickLensAddress: '0x0fd18587734e5C2dcE2dccDcC7DD1EC89ba557d9',
235
+ swapRouter02Address: '0x101F443B4d1b059569D643917553c771E1b9663E',
236
+ v4PoolManagerAddress: '0xFB3e0C6F74eB1a21CC1Da29aeC80D2Dfe6C9a317',
237
+ v4PositionManagerAddress: '0xAc631556d3d4019C95769033B5E719dD77124BAc',
238
+ v4StateView: '0x9d467fa9062b6e9b1a46e26007ad82db116c67cb',
239
+ v4QuoterAddress: '0x7de51022d70a725b508085468052e25e22b5c4c9'
240
+ };
241
+ // sepolia v3 addresses
242
+ var SEPOLIA_ADDRESSES = {
243
+ v3CoreFactoryAddress: '0x0227628f3F023bb0B980b67D528571c95c6DaC1c',
244
+ multicallAddress: '0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07',
245
+ quoterAddress: '0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3',
246
+ v3MigratorAddress: '0x729004182cF005CEC8Bd85df140094b6aCbe8b15',
247
+ nonfungiblePositionManagerAddress: '0x1238536071E1c677A632429e3655c799b22cDA52',
248
+ tickLensAddress: '0xd7f33bcdb21b359c8ee6f0251d30e94832baad07',
249
+ swapRouter02Address: '0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E',
250
+ // TODO: update mixedRouteQuoterV2Address once v4 on sepolia redeployed
251
+ mixedRouteQuoterV2Address: '0x4745f77b56a0e2294426e3936dc4fab68d9543cd',
252
+ // TODO: update all below once v4 on sepolia redeployed
253
+ v4PoolManagerAddress: '0xE03A1074c86CFeDd5C142C4F04F1a1536e203543',
254
+ v4PositionManagerAddress: '0x429ba70129df741B2Ca2a85BC3A2a3328e5c09b4',
255
+ v4StateView: '0xe1dd9c3fa50edb962e442f60dfbc432e24537e4c',
256
+ v4QuoterAddress: '0x61b3f2011a92d183c7dbadbda940a7555ccf9227'
257
+ };
258
+ // Avalanche v3 addresses
259
+ var AVALANCHE_ADDRESSES = {
260
+ v3CoreFactoryAddress: '0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD',
261
+ multicallAddress: '0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2',
262
+ quoterAddress: '0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F',
263
+ v3MigratorAddress: '0x44f5f1f5E452ea8d29C890E8F6e893fC0f1f0f97',
264
+ nonfungiblePositionManagerAddress: '0x655C406EBFa14EE2006250925e54ec43AD184f8B',
265
+ tickLensAddress: '0xEB9fFC8bf81b4fFd11fb6A63a6B0f098c6e21950',
266
+ swapRouter02Address: '0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE',
267
+ v4PoolManagerAddress: '0x06380c0e0912312b5150364b9dc4542ba0dbbc85',
268
+ v4PositionManagerAddress: '0xb74b1f14d2754acfcbbe1a221023a5cf50ab8acd',
269
+ v4StateView: '0xc3c9e198c735a4b97e3e683f391ccbdd60b69286',
270
+ v4QuoterAddress: '0xbe40675bb704506a3c2ccfb762dcfd1e979845c2'
271
+ };
272
+ var BASE_ADDRESSES = {
273
+ v3CoreFactoryAddress: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD',
274
+ multicallAddress: '0x091e99cb1C49331a94dD62755D168E941AbD0693',
275
+ quoterAddress: '0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a',
276
+ v3MigratorAddress: '0x23cF10b1ee3AdfCA73B0eF17C07F7577e7ACd2d7',
277
+ nonfungiblePositionManagerAddress: '0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1',
278
+ tickLensAddress: '0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d',
279
+ swapRouter02Address: '0x2626664c2603336E57B271c5C0b26F421741e481',
280
+ mixedRouteQuoterV1Address: '0xe544efae946f0008ae9a8d64493efa7886b73776',
281
+ v4PoolManagerAddress: '0x498581ff718922c3f8e6a244956af099b2652b2b',
282
+ v4PositionManagerAddress: '0x7c5f5a4bbd8fd63184577525326123b519429bdc',
283
+ v4StateView: '0xa3c0c9b65bad0b08107aa264b0f3db444b867a71',
284
+ v4QuoterAddress: '0x0d5e0f971ed27fbff6c2837bf31316121532048d'
285
+ };
286
+ // Base Goerli v3 addresses
287
+ var BASE_GOERLI_ADDRESSES = {
288
+ v3CoreFactoryAddress: '0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2',
289
+ multicallAddress: '0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439',
290
+ quoterAddress: '0xedf539058e28E5937dAef3f69cEd0b25fbE66Ae9',
291
+ v3MigratorAddress: '0x3efe5d02a04b7351D671Db7008ec6eBA9AD9e3aE',
292
+ nonfungiblePositionManagerAddress: '0x3c61369ef0D1D2AFa70d8feC2F31C5D6Ce134F30',
293
+ tickLensAddress: '0x1acB873Ee909D0c98adB18e4474943249F931b92',
294
+ swapRouter02Address: '0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d'
295
+ };
296
+ // Base Sepolia v3 addresses
297
+ var BASE_SEPOLIA_ADDRESSES = {
298
+ v3CoreFactoryAddress: '0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24',
299
+ multicallAddress: '0xd867e273eAbD6c853fCd0Ca0bFB6a3aE6491d2C1',
300
+ quoterAddress: '0xC5290058841028F1614F3A6F0F5816cAd0df5E27',
301
+ v3MigratorAddress: '0xCbf8b7f80800bd4888Fbc7bf1713B80FE4E23E10',
302
+ nonfungiblePositionManagerAddress: '0x27F971cb582BF9E50F397e4d29a5C7A34f11faA2',
303
+ tickLensAddress: '0xedf6066a2b290C185783862C7F4776A2C8077AD1',
304
+ swapRouter02Address: '0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4',
305
+ // v4
306
+ v4PoolManagerAddress: '0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408',
307
+ v4PositionManagerAddress: '0x4b2c77d209d3405f41a037ec6c77f7f5b8e2ca80',
308
+ v4StateView: '0x571291b572ed32ce6751a2cb2486ebee8defb9b4',
309
+ v4QuoterAddress: '0x4a6513c898fe1b2d0e78d3b0e0a4a151589b1cba'
310
+ };
311
+ var ZORA_ADDRESSES = {
312
+ v3CoreFactoryAddress: '0x7145F8aeef1f6510E92164038E1B6F8cB2c42Cbb',
313
+ multicallAddress: '0xA51c76bEE6746cB487a7e9312E43e2b8f4A37C15',
314
+ quoterAddress: '0x11867e1b3348F3ce4FcC170BC5af3d23E07E64Df',
315
+ v3MigratorAddress: '0x048352d8dCF13686982C799da63fA6426a9D0b60',
316
+ nonfungiblePositionManagerAddress: '0xbC91e8DfA3fF18De43853372A3d7dfe585137D78',
317
+ tickLensAddress: '0x209AAda09D74Ad3B8D0E92910Eaf85D2357e3044',
318
+ swapRouter02Address: '0x7De04c96BE5159c3b5CeffC82aa176dc81281557',
319
+ v4PoolManagerAddress: '0x0575338e4c17006ae181b47900a84404247ca30f',
320
+ v4PositionManagerAddress: '0xf66c7b99e2040f0d9b326b3b7c152e9663543d63',
321
+ v4StateView: '0x385785af07d63b50d0a0ea57c4ff89d06adf7328',
322
+ v4QuoterAddress: '0x5edaccc0660e0a2c44b06e07ce8b915e625dc2c6'
323
+ };
324
+ var ZORA_SEPOLIA_ADDRESSES = {
325
+ v3CoreFactoryAddress: '0x4324A677D74764f46f33ED447964252441aA8Db6',
326
+ multicallAddress: '0xA1E7e3A69671C4494EC59Dbd442de930a93F911A',
327
+ quoterAddress: '0xC195976fEF0985886E37036E2DF62bF371E12Df0',
328
+ v3MigratorAddress: '0x65ef259b31bf1d977c37e9434658694267674897',
329
+ nonfungiblePositionManagerAddress: '0xB8458EaAe43292e3c1F7994EFd016bd653d23c20',
330
+ tickLensAddress: '0x23C0F71877a1Fc4e20A78018f9831365c85f3064'
331
+ };
332
+ var ROOTSTOCK_ADDRESSES = {
333
+ v3CoreFactoryAddress: '0xaF37EC98A00FD63689CF3060BF3B6784E00caD82',
334
+ multicallAddress: '0x996a9858cDfa45Ad68E47c9A30a7201E29c6a386',
335
+ quoterAddress: '0xb51727c996C68E60F598A923a5006853cd2fEB31',
336
+ v3MigratorAddress: '0x16678977CA4ec3DAD5efc7b15780295FE5f56162',
337
+ nonfungiblePositionManagerAddress: '0x9d9386c042F194B460Ec424a1e57ACDE25f5C4b1',
338
+ tickLensAddress: '0x55B9dF5bF68ADe972191a91980459f48ecA16afC',
339
+ swapRouter02Address: '0x0B14ff67f0014046b4b99057Aec4509640b3947A'
340
+ };
341
+ var BLAST_ADDRESSES = {
342
+ v3CoreFactoryAddress: '0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd',
343
+ multicallAddress: '0xdC7f370de7631cE9e2c2e1DCDA6B3B5744Cf4705',
344
+ quoterAddress: '0x6Cdcd65e03c1CEc3730AeeCd45bc140D57A25C77',
345
+ v3MigratorAddress: '0x15CA7043CD84C5D21Ae76Ba0A1A967d42c40ecE0',
346
+ nonfungiblePositionManagerAddress: '0xB218e4f7cF0533d4696fDfC419A0023D33345F28',
347
+ tickLensAddress: '0x2E95185bCdD928a3e984B7e2D6560Ab1b17d7274',
348
+ swapRouter02Address: '0x549FEB8c9bd4c12Ad2AB27022dA12492aC452B66',
349
+ v4PoolManagerAddress: '0x1631559198a9e474033433b2958dabc135ab6446',
350
+ v4PositionManagerAddress: '0x4ad2f4cca2682cbb5b950d660dd458a1d3f1baad',
351
+ v4StateView: '0x12a88ae16f46dce4e8b15368008ab3380885df30',
352
+ v4QuoterAddress: '0x6f71cdcb0d119ff72c6eb501abceb576fbf62bcf'
353
+ };
354
+ var ZKSYNC_ADDRESSES = {
355
+ v3CoreFactoryAddress: '0x8FdA5a7a8dCA67BBcDd10F02Fa0649A937215422',
356
+ multicallAddress: '0x0c68a7C72f074d1c45C16d41fa74eEbC6D16a65C',
357
+ quoterAddress: '0x8Cb537fc92E26d8EBBb760E632c95484b6Ea3e28',
358
+ v3MigratorAddress: '0x611841b24E43C4ACfd290B427a3D6cf1A59dac8E',
359
+ nonfungiblePositionManagerAddress: '0x0616e5762c1E7Dc3723c50663dF10a162D690a86',
360
+ tickLensAddress: '0xe10FF11b809f8EE07b056B452c3B2caa7FE24f89',
361
+ swapRouter02Address: '0x99c56385daBCE3E81d8499d0b8d0257aBC07E8A3'
362
+ };
363
+ var WORLDCHAIN_ADDRESSES = {
364
+ v3CoreFactoryAddress: '0x7a5028BDa40e7B173C278C5342087826455ea25a',
365
+ multicallAddress: '0x0a22c04215c97E3F532F4eF30e0aD9458792dAB9',
366
+ quoterAddress: '0x10158D43e6cc414deE1Bd1eB0EfC6a5cBCfF244c',
367
+ v3MigratorAddress: '0x9EBDdCBa71C9027E1eB45135672a30bcFEec9de3',
368
+ nonfungiblePositionManagerAddress: '0xec12a9F9a09f50550686363766Cc153D03c27b5e',
369
+ tickLensAddress: '0xE61df0CaC9d85876aCE5E3037005D80943570623',
370
+ swapRouter02Address: '0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6',
371
+ v4PoolManagerAddress: '0xb1860d529182ac3bc1f51fa2abd56662b7d13f33',
372
+ v4PositionManagerAddress: '0xc585e0f504613b5fbf874f21af14c65260fb41fa',
373
+ v4StateView: '0x51d394718bc09297262e368c1a481217fdeb71eb',
374
+ v4QuoterAddress: '0x55d235b3ff2daf7c3ede0defc9521f1d6fe6c5c0'
375
+ };
376
+ var UNICHAIN_SEPOLIA_ADDRESSES = {
377
+ v3CoreFactoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
378
+ multicallAddress: '0x9D0F15f2cf58655fDDcD1EE6129C547fDaeD01b1',
379
+ quoterAddress: '0x6Dd37329A1A225a6Fca658265D460423DCafBF89',
380
+ v3MigratorAddress: '0xb5FA244C9d6D04B2FBac84418b3c4910ED1Ae5f2',
381
+ nonfungiblePositionManagerAddress: '0xB7F724d6dDDFd008eFf5cc2834edDE5F9eF0d075',
382
+ tickLensAddress: '0x5f739c790a48E97eec0efb81bab5D152c0A0ecA0',
383
+ swapRouter02Address: '0xd1AAE39293221B77B0C71fBD6dCb7Ea29Bb5B166',
384
+ v4PoolManagerAddress: '0x00b036b58a818b1bc34d502d3fe730db729e62ac',
385
+ v4PositionManagerAddress: '0xf969aee60879c54baaed9f3ed26147db216fd664',
386
+ v4StateView: '0xc199f1072a74d4e905aba1a84d9a45e2546b6222',
387
+ v4QuoterAddress: '0x56dcd40a3f2d466f48e7f48bdbe5cc9b92ae4472'
388
+ };
389
+ var UNICHAIN_ADDRESSES = {
390
+ v3CoreFactoryAddress: '0x1f98400000000000000000000000000000000003',
391
+ multicallAddress: '0xb7610f9b733e7d45184be3a1bc966960ccc54f0b',
392
+ quoterAddress: '0x565ac8c7863d9bb16d07e809ff49fe5cd467634c',
393
+ v3MigratorAddress: '0xb9d0c246f306b1aaf02ae6ba112d5ef25e5b60dc',
394
+ nonfungiblePositionManagerAddress: '0x943e6e07a7e8e791dafc44083e54041d743c46e9',
395
+ tickLensAddress: '0xd5d76fa166ab8d8ad4c9f61aaa81457b66cbe443',
396
+ swapRouter02Address: '0x73855d06de49d0fe4a9c42636ba96c62da12ff9c',
397
+ v4PoolManagerAddress: '0x1f98400000000000000000000000000000000004',
398
+ v4PositionManagerAddress: '0x4529a01c7a0410167c5740c487a8de60232617bf',
399
+ v4StateView: '0x86e8631a016f9068c3f085faf484ee3f5fdee8f2',
400
+ v4QuoterAddress: '0x333e3c607b141b18ff6de9f258db6e77fe7491e0'
401
+ };
402
+ var MONAD_TESTNET_ADDRESSES = {
403
+ v3CoreFactoryAddress: '0x961235a9020b05c44df1026d956d1f4d78014276',
404
+ multicallAddress: '0xa707ceb989cc3728551ed0e6e44b718dd114cf44',
405
+ quoterAddress: '0x1ba215c17565de7b0cb7ecab971bcf540c24a862',
406
+ v3MigratorAddress: '0x0a78348b71f8ae8caff2f8f9d4d74a2f36516661',
407
+ nonfungiblePositionManagerAddress: '0x3dcc735c74f10fe2b9db2bb55c40fbbbf24490f7',
408
+ tickLensAddress: '0x337478eb6058455ecb3696184b30dd6a29e3a893',
409
+ swapRouter02Address: '0x4c4eabd5fb1d1a7234a48692551eaecff8194ca7'
410
+ };
411
+ var MONAD_ADDRESSES = {
412
+ v3CoreFactoryAddress: '0x204faca1764b154221e35c0d20abb3c525710498',
413
+ multicallAddress: '0xd1b797d92d87b688193a2b976efc8d577d204343',
414
+ quoterAddress: '0x2d01411773c8c24805306e89a41f7855c3c4fe65',
415
+ v3MigratorAddress: '0x7078c4537c04c2b2e52ddba06074dbdacf23ca15',
416
+ nonfungiblePositionManagerAddress: '0x7197e214c0b767cfb76fb734ab638e2c192f4e53',
417
+ tickLensAddress: '0xf025e0fe9e331a0ef05c2ad3c4e9c64b625cda6f',
418
+ swapRouter02Address: '0xfe31f71c1b106eac32f1a19239c9a9a72ddfb900',
419
+ // v4
420
+ v4PoolManagerAddress: '0x188d586ddcf52439676ca21a244753fa19f9ea8e',
421
+ v4PositionManagerAddress: '0x5b7ec4a94ff9bedb700fb82ab09d5846972f4016',
422
+ v4StateView: '0x77395f3b2e73ae90843717371294fa97cc419d64',
423
+ v4QuoterAddress: '0xa222dd357a9076d1091ed6aa2e16c9742dd26891'
424
+ };
425
+ var SONEIUM_ADDRESSES = {
426
+ v3CoreFactoryAddress: '0x42ae7ec7ff020412639d443e245d936429fbe717',
427
+ multicallAddress: '0x8ad5ef2f2508288d2de66f04dd883ad5f4ef62b2',
428
+ quoterAddress: '0x3e6c707d0125226ff60f291b6bd1404634f00aba',
429
+ v3MigratorAddress: '0xa107580f73bd797bd8b87ff24e98346d99f93ddb',
430
+ nonfungiblePositionManagerAddress: '0x56c1205b0244332011c1e866f4ea5384eb6bfa2c',
431
+ tickLensAddress: '0xcd08eefb928c86499e6235ac155906bb7c4dc41a',
432
+ swapRouter02Address: '0x7e40db01736f88464e5f4e42394f3d5bbb6705b9',
433
+ v4PoolManagerAddress: '0x360e68faccca8ca495c1b759fd9eee466db9fb32',
434
+ v4PositionManagerAddress: '0x1b35d13a2e2528f192637f14b05f0dc0e7deb566',
435
+ v4StateView: '0x76fd297e2d437cd7f76d50f01afe6160f86e9990',
436
+ v4QuoterAddress: '0x3972c00f7ed4885e145823eb7c655375d275a1c5'
437
+ };
438
+ var XLAYER_ADDRESSES = {
439
+ v3CoreFactoryAddress: '0x4b2ab38dbf28d31d467aa8993f6c2585981d6804',
440
+ multicallAddress: '0xe2023f3fa515cf070e07fd9d51c1d236e07843f4',
441
+ quoterAddress: '0x976183ac3d09840d243a88c0268badb3b3e3259f',
442
+ v3MigratorAddress: '0x7197e214c0b767cfb76fb734ab638e2c192f4e53',
443
+ nonfungiblePositionManagerAddress: '0x315e413a11ab0df498ef83873012430ca36638ae',
444
+ tickLensAddress: '0x661e93cca42afacb172121ef892830ca3b70f08d',
445
+ swapRouter02Address: '0x4f0c28f5926afda16bf2506d5d9e57ea190f9bca',
446
+ mixedRouteQuoterV2Address: '0x2d01411773c8c24805306e89a41f7855c3c4fe65',
447
+ v4PoolManagerAddress: '0x360e68faccca8ca495c1b759fd9eee466db9fb32',
448
+ v4PositionManagerAddress: '0xcF1EAFC6928dC385A342E7C6491d371d2871458b',
449
+ v4StateView: '0x76fd297e2d437cd7f76d50f01afe6160f86e9990',
450
+ v4QuoterAddress: '0x8928074ca1b241d8ec02815881c1af11e8bc5219'
451
+ };
452
+ var HASHKEY_TESTNET_ADDRESSES = {
453
+ v3CoreFactoryAddress: '0x2dC2c21D1049F786C535bF9d45F999dB5474f3A0',
454
+ multicallAddress: '0x47F625Ec29637445AA1570d7008Cf78692CdA096',
455
+ quoterAddress: '0x9576241e23629cF8ad3d8ad7b12993935b24fA9d',
456
+ v3MigratorAddress: '0x0bb37eD33c163c46DEef0F6D14d262D0bc57B130',
457
+ nonfungiblePositionManagerAddress: '0x3c8816a838966b8b0927546A1630113F612B1553',
458
+ tickLensAddress: '0x73942976823088508a2C6c8055DF71107DB1d8db',
459
+ swapRouter02Address: '0x46cBccE3c74E95d1761435d52B0b9Abc9e2FEAC0'
460
+ };
461
+ var HASHKEY_MAINNET_ADDRESSES = {
462
+ v3CoreFactoryAddress: '0x972cA9D1662F5e029cD18327D29026532E84c742',
463
+ multicallAddress: '0x7D0CBa43EbDD69ec2CE3B5AeAD3b0FbC796c565B',
464
+ quoterAddress: '0x603f70466fDdbE3F238220B9a74FFF419a2BbFDD',
465
+ v3MigratorAddress: '0x4DaA3DaD4fe453767C5aeEFf2e2A15b0e85Fe62D',
466
+ nonfungiblePositionManagerAddress: '0xDF0A9b833Db0E4CeEa103A4408f3B68e7FC0cad5',
467
+ tickLensAddress: '0x0BA7274A183d9f91a0387d45853613B2d626A590',
468
+ swapRouter02Address: '0x2c16f75b95Cf1390c328aB70e2CEE7f4b80bD8F3'
469
+ };
470
+ var CHAIN_TO_ADDRESSES_MAP = (_CHAIN_TO_ADDRESSES_M = {}, _CHAIN_TO_ADDRESSES_M[exports.ChainId.MAINNET] = MAINNET_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.OPTIMISM] = OPTIMISM_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ARBITRUM_ONE] = ARBITRUM_ONE_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.POLYGON] = POLYGON_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.POLYGON_MUMBAI] = POLYGON_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.GOERLI] = GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.CELO] = CELO_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.CELO_ALFAJORES] = CELO_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.BNB] = BNB_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.OPTIMISM_GOERLI] = OPTIMISM_GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.OPTIMISM_SEPOLIA] = OPTIMISM_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ARBITRUM_GOERLI] = ARBITRUM_GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ARBITRUM_SEPOLIA] = ARBITRUM_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.SEPOLIA] = SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.AVALANCHE] = AVALANCHE_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.BASE] = BASE_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.BASE_GOERLI] = BASE_GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.BASE_SEPOLIA] = BASE_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ZORA] = ZORA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ZORA_SEPOLIA] = ZORA_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ROOTSTOCK] = ROOTSTOCK_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.BLAST] = BLAST_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ZKSYNC] = ZKSYNC_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.WORLDCHAIN] = WORLDCHAIN_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.UNICHAIN_SEPOLIA] = UNICHAIN_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.UNICHAIN] = UNICHAIN_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.MONAD_TESTNET] = MONAD_TESTNET_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.SONEIUM] = SONEIUM_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.MONAD] = MONAD_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.XLAYER] = XLAYER_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.HASHKEY_TESTNET] = HASHKEY_TESTNET_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.HASHKEY_MAINNET] = HASHKEY_MAINNET_ADDRESSES, _CHAIN_TO_ADDRESSES_M);
471
+ /* V3 Contract Addresses */
472
+ var V3_CORE_FACTORY_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
473
+ memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].v3CoreFactoryAddress;
474
+ return memo;
475
+ }, {}));
476
+ var V3_MIGRATOR_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
477
+ var v3MigratorAddress = CHAIN_TO_ADDRESSES_MAP[chainId].v3MigratorAddress;
478
+ if (v3MigratorAddress) {
479
+ memo[chainId] = v3MigratorAddress;
480
+ }
481
+ return memo;
482
+ }, {}));
483
+ var MULTICALL_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
484
+ memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].multicallAddress;
485
+ return memo;
486
+ }, {}));
487
+ /**
488
+ * The oldest V0 governance address
489
+ */
490
+ var GOVERNANCE_ALPHA_V0_ADDRESSES = /*#__PURE__*/constructSameAddressMap('0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F');
491
+ /**
492
+ * The older V1 governance address
493
+ */
494
+ var GOVERNANCE_ALPHA_V1_ADDRESSES = (_GOVERNANCE_ALPHA_V1_ = {}, _GOVERNANCE_ALPHA_V1_[exports.ChainId.MAINNET] = '0xC4e172459f1E7939D522503B81AFAaC1014CE6F6', _GOVERNANCE_ALPHA_V1_);
495
+ /**
496
+ * The latest governor bravo that is currently admin of timelock
497
+ */
498
+ var GOVERNANCE_BRAVO_ADDRESSES = (_GOVERNANCE_BRAVO_ADD = {}, _GOVERNANCE_BRAVO_ADD[exports.ChainId.MAINNET] = '0x408ED6354d4973f66138C91495F2f2FCbd8724C3', _GOVERNANCE_BRAVO_ADD);
499
+ var TIMELOCK_ADDRESSES = /*#__PURE__*/constructSameAddressMap('0x1a9C8182C09F50C8318d769245beA52c32BE35BC');
500
+ var MERKLE_DISTRIBUTOR_ADDRESS = (_MERKLE_DISTRIBUTOR_A = {}, _MERKLE_DISTRIBUTOR_A[exports.ChainId.MAINNET] = '0x090D4613473dEE047c3f2706764f49E0821D256e', _MERKLE_DISTRIBUTOR_A);
501
+ var ARGENT_WALLET_DETECTOR_ADDRESS = (_ARGENT_WALLET_DETECT = {}, _ARGENT_WALLET_DETECT[exports.ChainId.MAINNET] = '0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8', _ARGENT_WALLET_DETECT);
502
+ var QUOTER_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
503
+ memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].quoterAddress;
504
+ return memo;
505
+ }, {}));
506
+ var NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
507
+ var nonfungiblePositionManagerAddress = CHAIN_TO_ADDRESSES_MAP[chainId].nonfungiblePositionManagerAddress;
508
+ if (nonfungiblePositionManagerAddress) {
509
+ memo[chainId] = nonfungiblePositionManagerAddress;
510
+ }
511
+ return memo;
512
+ }, {}));
513
+ var ENS_REGISTRAR_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/constructSameAddressMap('0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'));
514
+ var SOCKS_CONTROLLER_ADDRESSES = (_SOCKS_CONTROLLER_ADD = {}, _SOCKS_CONTROLLER_ADD[exports.ChainId.MAINNET] = '0x65770b5283117639760beA3F867b69b3697a91dd', _SOCKS_CONTROLLER_ADD);
515
+ var TICK_LENS_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
516
+ var tickLensAddress = CHAIN_TO_ADDRESSES_MAP[chainId].tickLensAddress;
517
+ if (tickLensAddress) {
518
+ memo[chainId] = tickLensAddress;
519
+ }
520
+ return memo;
521
+ }, {}));
522
+ var MIXED_ROUTE_QUOTER_V1_ADDRESSES = /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
523
+ var mixedRouteQuoterV1Address = CHAIN_TO_ADDRESSES_MAP[chainId].mixedRouteQuoterV1Address;
524
+ if (mixedRouteQuoterV1Address) {
525
+ memo[chainId] = mixedRouteQuoterV1Address;
526
+ }
527
+ return memo;
528
+ }, {});
529
+ var SWAP_ROUTER_02_ADDRESSES = function SWAP_ROUTER_02_ADDRESSES(chainId) {
530
+ if (SUPPORTED_CHAINS.includes(chainId)) {
531
+ var _CHAIN_TO_ADDRESSES_M2;
532
+ var id = chainId;
533
+ return (_CHAIN_TO_ADDRESSES_M2 = CHAIN_TO_ADDRESSES_MAP[id].swapRouter02Address) != null ? _CHAIN_TO_ADDRESSES_M2 : '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45';
534
+ }
535
+ return '';
536
+ };
537
+
538
+ (function (TradeType) {
539
+ TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT";
540
+ TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT";
541
+ })(exports.TradeType || (exports.TradeType = {}));
542
+ (function (Rounding) {
543
+ Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN";
544
+ Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP";
545
+ Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP";
546
+ })(exports.Rounding || (exports.Rounding = {}));
547
+ var MaxUint256 = /*#__PURE__*/JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
548
+
549
+ var _toSignificantRoundin, _toFixedRounding;
550
+ var Decimal = /*#__PURE__*/toFormat(_Decimal);
551
+ var Big = /*#__PURE__*/toFormat(_Big);
552
+ var toSignificantRounding = (_toSignificantRoundin = {}, _toSignificantRoundin[exports.Rounding.ROUND_DOWN] = Decimal.ROUND_DOWN, _toSignificantRoundin[exports.Rounding.ROUND_HALF_UP] = Decimal.ROUND_HALF_UP, _toSignificantRoundin[exports.Rounding.ROUND_UP] = Decimal.ROUND_UP, _toSignificantRoundin);
553
+ var toFixedRounding = (_toFixedRounding = {}, _toFixedRounding[exports.Rounding.ROUND_DOWN] = 0, _toFixedRounding[exports.Rounding.ROUND_HALF_UP] = 1, _toFixedRounding[exports.Rounding.ROUND_UP] = 3, _toFixedRounding);
554
+ var Fraction = /*#__PURE__*/function () {
555
+ function Fraction(numerator, denominator) {
556
+ if (denominator === void 0) {
557
+ denominator = JSBI.BigInt(1);
558
+ }
559
+ this.numerator = JSBI.BigInt(numerator);
560
+ this.denominator = JSBI.BigInt(denominator);
561
+ }
562
+ Fraction.tryParseFraction = function tryParseFraction(fractionish) {
563
+ if (fractionish instanceof JSBI || typeof fractionish === 'number' || typeof fractionish === 'string') return new Fraction(fractionish);
564
+ if ('numerator' in fractionish && 'denominator' in fractionish) return fractionish;
565
+ throw new Error('Could not parse fraction');
566
+ }
567
+ // performs floor division
568
+ ;
569
+ var _proto = Fraction.prototype;
570
+ _proto.invert = function invert() {
571
+ return new Fraction(this.denominator, this.numerator);
572
+ };
573
+ _proto.add = function add(other) {
574
+ var otherParsed = Fraction.tryParseFraction(other);
575
+ if (JSBI.equal(this.denominator, otherParsed.denominator)) {
576
+ return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator);
577
+ }
578
+ return new Fraction(JSBI.add(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator));
579
+ };
580
+ _proto.subtract = function subtract(other) {
581
+ var otherParsed = Fraction.tryParseFraction(other);
582
+ if (JSBI.equal(this.denominator, otherParsed.denominator)) {
583
+ return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator);
584
+ }
585
+ return new Fraction(JSBI.subtract(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator));
586
+ };
587
+ _proto.lessThan = function lessThan(other) {
588
+ var otherParsed = Fraction.tryParseFraction(other);
589
+ return JSBI.lessThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
590
+ };
591
+ _proto.equalTo = function equalTo(other) {
592
+ var otherParsed = Fraction.tryParseFraction(other);
593
+ return JSBI.equal(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
594
+ };
595
+ _proto.greaterThan = function greaterThan(other) {
596
+ var otherParsed = Fraction.tryParseFraction(other);
597
+ return JSBI.greaterThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
598
+ };
599
+ _proto.multiply = function multiply(other) {
600
+ var otherParsed = Fraction.tryParseFraction(other);
601
+ return new Fraction(JSBI.multiply(this.numerator, otherParsed.numerator), JSBI.multiply(this.denominator, otherParsed.denominator));
602
+ };
603
+ _proto.divide = function divide(other) {
604
+ var otherParsed = Fraction.tryParseFraction(other);
605
+ return new Fraction(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(this.denominator, otherParsed.numerator));
606
+ };
607
+ _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
608
+ if (format === void 0) {
609
+ format = {
610
+ groupSeparator: ''
611
+ };
612
+ }
613
+ if (rounding === void 0) {
614
+ rounding = exports.Rounding.ROUND_HALF_UP;
615
+ }
616
+ !Number.isInteger(significantDigits) ? invariant(false, significantDigits + " is not an integer.") : void 0;
617
+ !(significantDigits > 0) ? invariant(false, significantDigits + " is not positive.") : void 0;
618
+ Decimal.set({
619
+ precision: significantDigits + 1,
620
+ rounding: toSignificantRounding[rounding]
621
+ });
622
+ var quotient = new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits);
623
+ return quotient.toFormat(quotient.decimalPlaces(), format);
624
+ };
625
+ _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
626
+ if (format === void 0) {
627
+ format = {
628
+ groupSeparator: ''
629
+ };
630
+ }
631
+ if (rounding === void 0) {
632
+ rounding = exports.Rounding.ROUND_HALF_UP;
633
+ }
634
+ !Number.isInteger(decimalPlaces) ? invariant(false, decimalPlaces + " is not an integer.") : void 0;
635
+ !(decimalPlaces >= 0) ? invariant(false, decimalPlaces + " is negative.") : void 0;
636
+ Big.DP = decimalPlaces;
637
+ Big.RM = toFixedRounding[rounding];
638
+ return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format);
639
+ }
640
+ /**
641
+ * Helper method for converting any super class back to a fraction
642
+ */;
643
+ return _createClass(Fraction, [{
644
+ key: "quotient",
645
+ get: function get() {
646
+ return JSBI.divide(this.numerator, this.denominator);
647
+ }
648
+ // remainder after floor division
649
+ }, {
650
+ key: "remainder",
651
+ get: function get() {
652
+ return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator);
653
+ }
654
+ }, {
655
+ key: "asFraction",
656
+ get: function get() {
657
+ return new Fraction(this.numerator, this.denominator);
658
+ }
659
+ }]);
660
+ }();
661
+
662
+ var Big$1 = /*#__PURE__*/toFormat(_Big);
663
+ var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
664
+ function CurrencyAmount(currency, numerator, denominator) {
665
+ var _this;
666
+ _this = _Fraction.call(this, numerator, denominator) || this;
667
+ !JSBI.lessThanOrEqual(_this.quotient, MaxUint256) ? invariant(false, 'AMOUNT') : void 0;
668
+ _this.currency = currency;
669
+ _this.decimalScale = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(currency.decimals));
670
+ return _this;
671
+ }
672
+ /**
673
+ * Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
674
+ * @param currency the currency in the amount
675
+ * @param rawAmount the raw token or ether amount
676
+ */
677
+ _inheritsLoose(CurrencyAmount, _Fraction);
678
+ CurrencyAmount.fromRawAmount = function fromRawAmount(currency, rawAmount) {
679
+ return new CurrencyAmount(currency, rawAmount);
680
+ }
681
+ /**
682
+ * Construct a currency amount with a denominator that is not equal to 1
683
+ * @param currency the currency
684
+ * @param numerator the numerator of the fractional token amount
685
+ * @param denominator the denominator of the fractional token amount
686
+ */;
687
+ CurrencyAmount.fromFractionalAmount = function fromFractionalAmount(currency, numerator, denominator) {
688
+ return new CurrencyAmount(currency, numerator, denominator);
689
+ };
690
+ var _proto = CurrencyAmount.prototype;
691
+ _proto.add = function add(other) {
692
+ !this.currency.equals(other.currency) ? invariant(false, 'CURRENCY') : void 0;
693
+ var added = _Fraction.prototype.add.call(this, other);
694
+ return CurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator);
695
+ };
696
+ _proto.subtract = function subtract(other) {
697
+ !this.currency.equals(other.currency) ? invariant(false, 'CURRENCY') : void 0;
698
+ var subtracted = _Fraction.prototype.subtract.call(this, other);
699
+ return CurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator);
700
+ };
701
+ _proto.multiply = function multiply(other) {
702
+ var multiplied = _Fraction.prototype.multiply.call(this, other);
703
+ return CurrencyAmount.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator);
704
+ };
705
+ _proto.divide = function divide(other) {
706
+ var divided = _Fraction.prototype.divide.call(this, other);
707
+ return CurrencyAmount.fromFractionalAmount(this.currency, divided.numerator, divided.denominator);
708
+ };
709
+ _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
710
+ if (significantDigits === void 0) {
711
+ significantDigits = 6;
712
+ }
713
+ if (rounding === void 0) {
714
+ rounding = exports.Rounding.ROUND_DOWN;
715
+ }
716
+ return _Fraction.prototype.divide.call(this, this.decimalScale).toSignificant(significantDigits, format, rounding);
717
+ };
718
+ _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
719
+ if (decimalPlaces === void 0) {
720
+ decimalPlaces = this.currency.decimals;
721
+ }
722
+ if (rounding === void 0) {
723
+ rounding = exports.Rounding.ROUND_DOWN;
724
+ }
725
+ !(decimalPlaces <= this.currency.decimals) ? invariant(false, 'DECIMALS') : void 0;
726
+ return _Fraction.prototype.divide.call(this, this.decimalScale).toFixed(decimalPlaces, format, rounding);
727
+ };
728
+ _proto.toExact = function toExact(format) {
729
+ if (format === void 0) {
730
+ format = {
731
+ groupSeparator: ''
732
+ };
733
+ }
734
+ Big$1.DP = this.currency.decimals;
735
+ return new Big$1(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(format);
736
+ };
737
+ return _createClass(CurrencyAmount, [{
738
+ key: "wrapped",
739
+ get: function get() {
740
+ if (this.currency.isToken) return this;
741
+ return CurrencyAmount.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator);
742
+ }
743
+ }]);
744
+ }(Fraction);
745
+
746
+ var ONE_HUNDRED = /*#__PURE__*/new Fraction(/*#__PURE__*/JSBI.BigInt(100));
747
+ /**
748
+ * Converts a fraction to a percent
749
+ * @param fraction the fraction to convert
750
+ */
751
+ function toPercent(fraction) {
752
+ return new Percent(fraction.numerator, fraction.denominator);
753
+ }
754
+ var Percent = /*#__PURE__*/function (_Fraction) {
755
+ function Percent() {
756
+ var _this;
757
+ _this = _Fraction.apply(this, arguments) || this;
758
+ /**
759
+ * This boolean prevents a fraction from being interpreted as a Percent
760
+ */
761
+ _this.isPercent = true;
762
+ return _this;
763
+ }
764
+ _inheritsLoose(Percent, _Fraction);
765
+ var _proto = Percent.prototype;
766
+ _proto.add = function add(other) {
767
+ return toPercent(_Fraction.prototype.add.call(this, other));
768
+ };
769
+ _proto.subtract = function subtract(other) {
770
+ return toPercent(_Fraction.prototype.subtract.call(this, other));
771
+ };
772
+ _proto.multiply = function multiply(other) {
773
+ return toPercent(_Fraction.prototype.multiply.call(this, other));
774
+ };
775
+ _proto.divide = function divide(other) {
776
+ return toPercent(_Fraction.prototype.divide.call(this, other));
777
+ };
778
+ _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
779
+ if (significantDigits === void 0) {
780
+ significantDigits = 5;
781
+ }
782
+ return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toSignificant(significantDigits, format, rounding);
783
+ };
784
+ _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
785
+ if (decimalPlaces === void 0) {
786
+ decimalPlaces = 2;
787
+ }
788
+ return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toFixed(decimalPlaces, format, rounding);
789
+ };
790
+ return Percent;
791
+ }(Fraction);
792
+
793
+ var Price = /*#__PURE__*/function (_Fraction) {
794
+ /**
795
+ * Construct a price, either with the base and quote currency amount, or the
796
+ * @param args
797
+ */
798
+ function Price() {
799
+ var _this;
800
+ var baseCurrency, quoteCurrency, denominator, numerator;
801
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
802
+ args[_key] = arguments[_key];
803
+ }
804
+ if (args.length === 4) {
805
+ baseCurrency = args[0];
806
+ quoteCurrency = args[1];
807
+ denominator = args[2];
808
+ numerator = args[3];
809
+ } else {
810
+ var result = args[0].quoteAmount.divide(args[0].baseAmount);
811
+ var _ref = [args[0].baseAmount.currency, args[0].quoteAmount.currency, result.denominator, result.numerator];
812
+ baseCurrency = _ref[0];
813
+ quoteCurrency = _ref[1];
814
+ denominator = _ref[2];
815
+ numerator = _ref[3];
816
+ }
817
+ _this = _Fraction.call(this, numerator, denominator) || this;
818
+ _this.baseCurrency = baseCurrency;
819
+ _this.quoteCurrency = quoteCurrency;
820
+ _this.scalar = new Fraction(JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(quoteCurrency.decimals)));
821
+ return _this;
822
+ }
823
+ /**
824
+ * Flip the price, switching the base and quote currency
825
+ */
826
+ _inheritsLoose(Price, _Fraction);
827
+ var _proto = Price.prototype;
828
+ _proto.invert = function invert() {
829
+ return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator);
830
+ }
831
+ /**
832
+ * Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
833
+ * @param other the other price
834
+ */;
835
+ _proto.multiply = function multiply(other) {
836
+ !this.quoteCurrency.equals(other.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
837
+ var fraction = _Fraction.prototype.multiply.call(this, other);
838
+ return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator);
839
+ }
840
+ /**
841
+ * Return the amount of quote currency corresponding to a given amount of the base currency
842
+ * @param currencyAmount the amount of base currency to quote against the price
843
+ */;
844
+ _proto.quote = function quote(currencyAmount) {
845
+ !currencyAmount.currency.equals(this.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
846
+ var result = _Fraction.prototype.multiply.call(this, currencyAmount);
847
+ return CurrencyAmount.fromFractionalAmount(this.quoteCurrency, result.numerator, result.denominator);
848
+ }
849
+ /**
850
+ * Get the value scaled by decimals for formatting
851
+ * @private
852
+ */;
853
+ _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
854
+ if (significantDigits === void 0) {
855
+ significantDigits = 6;
856
+ }
857
+ return this.adjustedForDecimals.toSignificant(significantDigits, format, rounding);
858
+ };
859
+ _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
860
+ if (decimalPlaces === void 0) {
861
+ decimalPlaces = 4;
862
+ }
863
+ return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding);
864
+ };
865
+ return _createClass(Price, [{
866
+ key: "adjustedForDecimals",
867
+ get: function get() {
868
+ return _Fraction.prototype.multiply.call(this, this.scalar);
869
+ }
870
+ }]);
871
+ }(Fraction);
872
+
873
+ /**
874
+ * A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
875
+ */
876
+ var BaseCurrency =
877
+ /**
878
+ * Constructs an instance of the base class `BaseCurrency`.
879
+ * @param chainId the chain ID on which this currency resides
880
+ * @param decimals decimals of the currency
881
+ * @param symbol symbol of the currency
882
+ * @param name of the currency
883
+ */
884
+ function BaseCurrency(chainId, decimals, symbol, name) {
885
+ !Number.isSafeInteger(chainId) ? invariant(false, 'CHAIN_ID') : void 0;
886
+ !(decimals >= 0 && decimals < 255 && Number.isInteger(decimals)) ? invariant(false, 'DECIMALS') : void 0;
887
+ this.chainId = chainId;
888
+ this.decimals = decimals;
889
+ this.symbol = symbol;
890
+ this.name = name;
891
+ };
892
+
893
+ /**
894
+ * Represents the native currency of the chain on which it resides, e.g.
895
+ */
896
+ var NativeCurrency = /*#__PURE__*/function (_BaseCurrency) {
897
+ function NativeCurrency() {
898
+ var _this;
899
+ _this = _BaseCurrency.apply(this, arguments) || this;
900
+ _this.isNative = true;
901
+ _this.isToken = false;
902
+ return _this;
903
+ }
904
+ _inheritsLoose(NativeCurrency, _BaseCurrency);
905
+ return NativeCurrency;
906
+ }(BaseCurrency);
907
+
908
+ /**
909
+ * Validates an address and returns the parsed (checksummed) version of that address
910
+ * @param address the unchecksummed hex address
911
+ */
912
+ function validateAndParseAddress(address$1) {
913
+ try {
914
+ return address.getAddress(address$1);
915
+ } catch (error) {
916
+ throw new Error(address$1 + " is not a valid address.");
917
+ }
918
+ }
919
+ // Checks a string starts with 0x, is 42 characters long and contains only hex characters after 0x
920
+ var startsWith0xLen42HexRegex = /^0x[0-9a-fA-F]{40}$/;
921
+ /**
922
+ * Checks if an address is valid by checking 0x prefix, length === 42 and hex encoding.
923
+ * @param address the unchecksummed hex address
924
+ */
925
+ function checkValidAddress(address) {
926
+ if (startsWith0xLen42HexRegex.test(address)) {
927
+ return address;
928
+ }
929
+ throw new Error(address + " is not a valid address.");
930
+ }
931
+
932
+ /**
933
+ * Represents an ERC20 token with a unique address and some metadata.
934
+ */
935
+ var Token = /*#__PURE__*/function (_BaseCurrency) {
936
+ /**
937
+ *
938
+ * @param chainId {@link BaseCurrency#chainId}
939
+ * @param address The contract address on the chain on which this token lives
940
+ * @param decimals {@link BaseCurrency#decimals}
941
+ * @param symbol {@link BaseCurrency#symbol}
942
+ * @param name {@link BaseCurrency#name}
943
+ * @param bypassChecksum If true it only checks for length === 42, startsWith 0x and contains only hex characters
944
+ * @param buyFeeBps Buy fee tax for FOT tokens, in basis points
945
+ * @param sellFeeBps Sell fee tax for FOT tokens, in basis points
946
+ */
947
+ function Token(chainId, address, decimals, symbol, name, bypassChecksum, buyFeeBps, sellFeeBps) {
948
+ var _this;
949
+ _this = _BaseCurrency.call(this, chainId, decimals, symbol, name) || this;
950
+ _this.isNative = false;
951
+ _this.isToken = true;
952
+ if (bypassChecksum) {
953
+ _this.address = checkValidAddress(address);
954
+ } else {
955
+ _this.address = validateAndParseAddress(address);
956
+ }
957
+ if (buyFeeBps) {
958
+ !buyFeeBps.gte(bignumber.BigNumber.from(0)) ? invariant(false, 'NON-NEGATIVE FOT FEES') : void 0;
959
+ }
960
+ if (sellFeeBps) {
961
+ !sellFeeBps.gte(bignumber.BigNumber.from(0)) ? invariant(false, 'NON-NEGATIVE FOT FEES') : void 0;
962
+ }
963
+ _this.buyFeeBps = buyFeeBps;
964
+ _this.sellFeeBps = sellFeeBps;
965
+ return _this;
966
+ }
967
+ /**
968
+ * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
969
+ * @param other other token to compare
970
+ */
971
+ _inheritsLoose(Token, _BaseCurrency);
972
+ var _proto = Token.prototype;
973
+ _proto.equals = function equals(other) {
974
+ return other.isToken && this.chainId === other.chainId && this.address.toLowerCase() === other.address.toLowerCase();
975
+ }
976
+ /**
977
+ * Returns true if the address of this token sorts before the address of the other token
978
+ * @param other other token to compare
979
+ * @throws if the tokens have the same address
980
+ * @throws if the tokens are on different chains
981
+ */;
982
+ _proto.sortsBefore = function sortsBefore(other) {
983
+ !(this.chainId === other.chainId) ? invariant(false, 'CHAIN_IDS') : void 0;
984
+ !(this.address.toLowerCase() !== other.address.toLowerCase()) ? invariant(false, 'ADDRESSES') : void 0;
985
+ return this.address.toLowerCase() < other.address.toLowerCase();
986
+ }
987
+ /**
988
+ * Return this token, which does not need to be wrapped
989
+ */;
990
+ return _createClass(Token, [{
991
+ key: "wrapped",
992
+ get: function get() {
993
+ return this;
994
+ }
995
+ }]);
996
+ }(BaseCurrency);
997
+
998
+ /**
999
+ * Known WETH9 implementation addresses, used in our implementation of Ether#wrapped
1000
+ */
1001
+ var WETH9 = {
1002
+ 1: /*#__PURE__*/new Token(1, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH', 'Wrapped Ether'),
1003
+ 11155111: /*#__PURE__*/new Token(11155111, '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14', 18, 'WETH', 'Wrapped Ether'),
1004
+ 3: /*#__PURE__*/new Token(3, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'),
1005
+ 4: /*#__PURE__*/new Token(4, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'),
1006
+ 5: /*#__PURE__*/new Token(5, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'),
1007
+ 42: /*#__PURE__*/new Token(42, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'),
1008
+ 10: /*#__PURE__*/new Token(10, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1009
+ 69: /*#__PURE__*/new Token(69, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1010
+ 11155420: /*#__PURE__*/new Token(11155420, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1011
+ 42161: /*#__PURE__*/new Token(42161, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', 18, 'WETH', 'Wrapped Ether'),
1012
+ 421611: /*#__PURE__*/new Token(421611, '0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681', 18, 'WETH', 'Wrapped Ether'),
1013
+ 421614: /*#__PURE__*/new Token(421614, '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73', 18, 'WETH', 'Wrapped Ether'),
1014
+ 8453: /*#__PURE__*/new Token(8453, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1015
+ 84532: /*#__PURE__*/new Token(84532, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1016
+ 56: /*#__PURE__*/new Token(56, '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 18, 'WBNB', 'Wrapped BNB'),
1017
+ 137: /*#__PURE__*/new Token(137, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 18, 'WMATIC', 'Wrapped MATIC'),
1018
+ 43114: /*#__PURE__*/new Token(43114, '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', 18, 'WAVAX', 'Wrapped AVAX'),
1019
+ 7777777: /*#__PURE__*/new Token(7777777, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1020
+ 81457: /*#__PURE__*/new Token(81457, '0x4300000000000000000000000000000000000004', 18, 'WETH', 'Wrapped Ether'),
1021
+ 324: /*#__PURE__*/new Token(324, '0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91', 18, 'WETH', 'Wrapped Ether'),
1022
+ 480: /*#__PURE__*/new Token(480, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1023
+ 1301: /*#__PURE__*/new Token(1301, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1024
+ 130: /*#__PURE__*/new Token(130, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1025
+ 10143: /*#__PURE__*/new Token(10143, '0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701', 18, 'WMON', 'Wrapped Monad'),
1026
+ 1868: /*#__PURE__*/new Token(1868, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
1027
+ 143: /*#__PURE__*/new Token(143, '0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A', 18, 'WMON', 'Wrapped Monad'),
1028
+ 133: /*#__PURE__*/new Token(133, '0xCA8aAceEC5Db1e91B9Ed3a344bA026c4a2B3ebF6', 18, 'WHSK', 'Wrapped HSK'),
1029
+ 177: /*#__PURE__*/new Token(177, '0xB210D2120d57b758EE163cFfb43e73728c471Cf1', 18, 'WHSK', 'Wrapped HSK')
1030
+ };
1031
+
1032
+ /**
1033
+ * Ether is the main usage of a 'native' currency, i.e. for Ethereum mainnet and all testnets
1034
+ */
1035
+ var Ether = /*#__PURE__*/function (_NativeCurrency) {
1036
+ function Ether(chainId) {
1037
+ return _NativeCurrency.call(this, chainId, 18, 'ETH', 'Ether') || this;
1038
+ }
1039
+ _inheritsLoose(Ether, _NativeCurrency);
1040
+ Ether.onChain = function onChain(chainId) {
1041
+ var _this$_etherCache$cha;
1042
+ return (_this$_etherCache$cha = this._etherCache[chainId]) != null ? _this$_etherCache$cha : this._etherCache[chainId] = new Ether(chainId);
1043
+ };
1044
+ var _proto = Ether.prototype;
1045
+ _proto.equals = function equals(other) {
1046
+ return other.isNative && other.chainId === this.chainId;
1047
+ };
1048
+ return _createClass(Ether, [{
1049
+ key: "wrapped",
1050
+ get: function get() {
1051
+ var weth9 = WETH9[this.chainId];
1052
+ !!!weth9 ? invariant(false, 'WRAPPED') : void 0;
1053
+ return weth9;
1054
+ }
1055
+ }]);
1056
+ }(NativeCurrency);
1057
+ Ether._etherCache = {};
1058
+
1059
+ /**
1060
+ * Returns the percent difference between the mid price and the execution price, i.e. price impact.
1061
+ * @param midPrice mid price before the trade
1062
+ * @param inputAmount the input amount of the trade
1063
+ * @param outputAmount the output amount of the trade
1064
+ */
1065
+ function computePriceImpact(midPrice, inputAmount, outputAmount) {
1066
+ var quotedOutputAmount = midPrice.quote(inputAmount);
1067
+ // calculate price impact := (exactQuote - outputAmount) / exactQuote
1068
+ var priceImpact = quotedOutputAmount.subtract(outputAmount).divide(quotedOutputAmount);
1069
+ return new Percent(priceImpact.numerator, priceImpact.denominator);
1070
+ }
1071
+
1072
+ function computeZksyncCreate2Address(sender, bytecodeHash, salt, input) {
1073
+ if (input === void 0) {
1074
+ input = '0x';
1075
+ }
1076
+ var prefix = keccak256.keccak256(strings.toUtf8Bytes('zksyncCreate2'));
1077
+ var inputHash = keccak256.keccak256(input);
1078
+ var addressBytes = keccak256.keccak256(bytes.concat([prefix, bytes.hexZeroPad(sender, 32), salt, bytecodeHash, inputHash])).slice(26);
1079
+ return address.getAddress(addressBytes);
1080
+ }
1081
+
1082
+ // given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to
1083
+ // `maxSize` by removing the last item
1084
+ function sortedInsert(items, add, maxSize, comparator) {
1085
+ !(maxSize > 0) ? invariant(false, 'MAX_SIZE_ZERO') : void 0;
1086
+ // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize
1087
+ !(items.length <= maxSize) ? invariant(false, 'ITEMS_SIZE') : void 0;
1088
+ // short circuit first item add
1089
+ if (items.length === 0) {
1090
+ items.push(add);
1091
+ return null;
1092
+ } else {
1093
+ var isFull = items.length === maxSize;
1094
+ // short circuit if full and the additional item does not come before the last item
1095
+ if (isFull && comparator(items[items.length - 1], add) <= 0) {
1096
+ return add;
1097
+ }
1098
+ var lo = 0,
1099
+ hi = items.length;
1100
+ while (lo < hi) {
1101
+ var mid = lo + hi >>> 1;
1102
+ if (comparator(items[mid], add) <= 0) {
1103
+ lo = mid + 1;
1104
+ } else {
1105
+ hi = mid;
1106
+ }
1107
+ }
1108
+ items.splice(lo, 0, add);
1109
+ return isFull ? items.pop() : null;
1110
+ }
1111
+ }
1112
+
1113
+ var MAX_SAFE_INTEGER = /*#__PURE__*/JSBI.BigInt(Number.MAX_SAFE_INTEGER);
1114
+ var ZERO = /*#__PURE__*/JSBI.BigInt(0);
1115
+ var ONE = /*#__PURE__*/JSBI.BigInt(1);
1116
+ var TWO = /*#__PURE__*/JSBI.BigInt(2);
1117
+ /**
1118
+ * Computes floor(sqrt(value))
1119
+ * @param value the value for which to compute the square root, rounded down
1120
+ */
1121
+ function sqrt(value) {
1122
+ !JSBI.greaterThanOrEqual(value, ZERO) ? invariant(false, 'NEGATIVE') : void 0;
1123
+ // rely on built in sqrt if possible
1124
+ if (JSBI.lessThan(value, MAX_SAFE_INTEGER)) {
1125
+ return JSBI.BigInt(Math.floor(Math.sqrt(JSBI.toNumber(value))));
1126
+ }
1127
+ var z;
1128
+ var x;
1129
+ z = value;
1130
+ x = JSBI.add(JSBI.divide(value, TWO), ONE);
1131
+ while (JSBI.lessThan(x, z)) {
1132
+ z = x;
1133
+ x = JSBI.divide(JSBI.add(JSBI.divide(value, x), x), TWO);
1134
+ }
1135
+ return z;
1136
+ }
1137
+
1138
+ exports.ARGENT_WALLET_DETECTOR_ADDRESS = ARGENT_WALLET_DETECTOR_ADDRESS;
1139
+ exports.CHAIN_TO_ADDRESSES_MAP = CHAIN_TO_ADDRESSES_MAP;
1140
+ exports.CurrencyAmount = CurrencyAmount;
1141
+ exports.ENS_REGISTRAR_ADDRESSES = ENS_REGISTRAR_ADDRESSES;
1142
+ exports.Ether = Ether;
1143
+ exports.Fraction = Fraction;
1144
+ exports.GOVERNANCE_ALPHA_V0_ADDRESSES = GOVERNANCE_ALPHA_V0_ADDRESSES;
1145
+ exports.GOVERNANCE_ALPHA_V1_ADDRESSES = GOVERNANCE_ALPHA_V1_ADDRESSES;
1146
+ exports.GOVERNANCE_BRAVO_ADDRESSES = GOVERNANCE_BRAVO_ADDRESSES;
1147
+ exports.MERKLE_DISTRIBUTOR_ADDRESS = MERKLE_DISTRIBUTOR_ADDRESS;
1148
+ exports.MIXED_ROUTE_QUOTER_V1_ADDRESSES = MIXED_ROUTE_QUOTER_V1_ADDRESSES;
1149
+ exports.MULTICALL_ADDRESSES = MULTICALL_ADDRESSES;
1150
+ exports.MaxUint256 = MaxUint256;
1151
+ exports.NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = NONFUNGIBLE_POSITION_MANAGER_ADDRESSES;
1152
+ exports.NativeCurrency = NativeCurrency;
1153
+ exports.Percent = Percent;
1154
+ exports.Price = Price;
1155
+ exports.QUOTER_ADDRESSES = QUOTER_ADDRESSES;
1156
+ exports.SOCKS_CONTROLLER_ADDRESSES = SOCKS_CONTROLLER_ADDRESSES;
1157
+ exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS;
1158
+ exports.SWAP_ROUTER_02_ADDRESSES = SWAP_ROUTER_02_ADDRESSES;
1159
+ exports.TICK_LENS_ADDRESSES = TICK_LENS_ADDRESSES;
1160
+ exports.TIMELOCK_ADDRESSES = TIMELOCK_ADDRESSES;
1161
+ exports.Token = Token;
1162
+ exports.UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS = UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS;
1163
+ exports.UNI_ADDRESSES = UNI_ADDRESSES;
1164
+ exports.V2_FACTORY_ADDRESS = V2_FACTORY_ADDRESS;
1165
+ exports.V2_FACTORY_ADDRESSES = V2_FACTORY_ADDRESSES;
1166
+ exports.V2_ROUTER_ADDRESS = V2_ROUTER_ADDRESS;
1167
+ exports.V2_ROUTER_ADDRESSES = V2_ROUTER_ADDRESSES;
1168
+ exports.V3_CORE_FACTORY_ADDRESSES = V3_CORE_FACTORY_ADDRESSES;
1169
+ exports.V3_MIGRATOR_ADDRESSES = V3_MIGRATOR_ADDRESSES;
1170
+ exports.WETH9 = WETH9;
1171
+ exports.computePriceImpact = computePriceImpact;
1172
+ exports.computeZksyncCreate2Address = computeZksyncCreate2Address;
1173
+ exports.sortedInsert = sortedInsert;
1174
+ exports.sqrt = sqrt;
1175
+ exports.validateAndParseAddress = validateAndParseAddress;
1176
+ //# sourceMappingURL=sdk-core.cjs.development.js.map