@uniswap/sdk-core 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,44 +12,62 @@ var toFormat = _interopDefault(require('toformat'));
12
12
  var bignumber = require('@ethersproject/bignumber');
13
13
  var address = require('@ethersproject/address');
14
14
 
15
+ function _toPrimitive(t, r) {
16
+ if ("object" != typeof t || !t) return t;
17
+ var e = t[Symbol.toPrimitive];
18
+ if (void 0 !== e) {
19
+ var i = e.call(t, r || "default");
20
+ if ("object" != typeof i) return i;
21
+ throw new TypeError("@@toPrimitive must return a primitive value.");
22
+ }
23
+ return ("string" === r ? String : Number)(t);
24
+ }
25
+ function _toPropertyKey(t) {
26
+ var i = _toPrimitive(t, "string");
27
+ return "symbol" == typeof i ? i : String(i);
28
+ }
15
29
  function _defineProperties(target, props) {
16
30
  for (var i = 0; i < props.length; i++) {
17
31
  var descriptor = props[i];
18
32
  descriptor.enumerable = descriptor.enumerable || false;
19
33
  descriptor.configurable = true;
20
34
  if ("value" in descriptor) descriptor.writable = true;
21
- Object.defineProperty(target, descriptor.key, descriptor);
35
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
22
36
  }
23
37
  }
24
-
25
38
  function _createClass(Constructor, protoProps, staticProps) {
26
39
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27
40
  if (staticProps) _defineProperties(Constructor, staticProps);
41
+ Object.defineProperty(Constructor, "prototype", {
42
+ writable: false
43
+ });
28
44
  return Constructor;
29
45
  }
30
-
31
46
  function _extends() {
32
- _extends = Object.assign || function (target) {
47
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
33
48
  for (var i = 1; i < arguments.length; i++) {
34
49
  var source = arguments[i];
35
-
36
50
  for (var key in source) {
37
51
  if (Object.prototype.hasOwnProperty.call(source, key)) {
38
52
  target[key] = source[key];
39
53
  }
40
54
  }
41
55
  }
42
-
43
56
  return target;
44
57
  };
45
-
46
58
  return _extends.apply(this, arguments);
47
59
  }
48
-
49
60
  function _inheritsLoose(subClass, superClass) {
50
61
  subClass.prototype = Object.create(superClass.prototype);
51
62
  subClass.prototype.constructor = subClass;
52
- subClass.__proto__ = superClass;
63
+ _setPrototypeOf(subClass, superClass);
64
+ }
65
+ function _setPrototypeOf(o, p) {
66
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
67
+ o.__proto__ = p;
68
+ return o;
69
+ };
70
+ return _setPrototypeOf(o, p);
53
71
  }
54
72
 
55
73
  (function (ChainId) {
@@ -77,9 +95,7 @@ function _inheritsLoose(subClass, superClass) {
77
95
  ChainId[ChainId["ROOTSTOCK"] = 30] = "ROOTSTOCK";
78
96
  ChainId[ChainId["BLAST"] = 81457] = "BLAST";
79
97
  })(exports.ChainId || (exports.ChainId = {}));
80
-
81
98
  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.ZORA, exports.ChainId.ZORA_SEPOLIA, exports.ChainId.ROOTSTOCK, exports.ChainId.BLAST];
82
-
83
99
  (function (NativeCurrencyName) {
84
100
  // Strings match input for CLI
85
101
  NativeCurrencyName["ETHER"] = "ETH";
@@ -94,33 +110,28 @@ var SUPPORTED_CHAINS = [exports.ChainId.MAINNET, exports.ChainId.OPTIMISM, expor
94
110
 
95
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;
96
112
  var DEFAULT_NETWORKS = [exports.ChainId.MAINNET, exports.ChainId.GOERLI, exports.ChainId.SEPOLIA];
97
-
98
113
  function constructSameAddressMap(address, additionalNetworks) {
99
114
  if (additionalNetworks === void 0) {
100
115
  additionalNetworks = [];
101
116
  }
102
-
103
117
  return DEFAULT_NETWORKS.concat(additionalNetworks).reduce(function (memo, chainId) {
104
118
  memo[chainId] = address;
105
119
  return memo;
106
120
  }, {});
107
121
  }
108
-
109
122
  var UNI_ADDRESSES = /*#__PURE__*/constructSameAddressMap('0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', [exports.ChainId.OPTIMISM, exports.ChainId.ARBITRUM_ONE, exports.ChainId.POLYGON, exports.ChainId.POLYGON_MUMBAI, exports.ChainId.SEPOLIA]);
110
123
  var UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS = '0x8B799381ac40b838BBA4131ffB26197C432AFe78';
111
124
  /**
112
125
  * @deprecated use V2_FACTORY_ADDRESSES instead
113
126
  */
114
-
115
127
  var V2_FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';
116
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] = '0xB7f907f7A9eBC822a80BD25E224be42Ce0A698A0', _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] = '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);
117
129
  /**
118
130
  * @deprecated use V2_ROUTER_ADDRESSES instead
119
131
  */
120
-
121
132
  var V2_ROUTER_ADDRESS = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D';
122
- 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.ARBITRUM_ONE] = '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24', _V2_ROUTER_ADDRESSES[exports.ChainId.OPTIMISM] = '0x4a7b5da61326a6379179b40d00f57e5bbdc962c2', _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); // Networks that share most of the same addresses i.e. Mainnet, Goerli, Optimism, Arbitrum, Polygon
123
-
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.ARBITRUM_ONE] = '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24', _V2_ROUTER_ADDRESSES[exports.ChainId.OPTIMISM] = '0x4a7b5da61326a6379179b40d00f57e5bbdc962c2', _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);
134
+ // Networks that share most of the same addresses i.e. Mainnet, Goerli, Optimism, Arbitrum, Polygon
124
135
  var DEFAULT_ADDRESSES = {
125
136
  v3CoreFactoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
126
137
  multicallAddress: '0x1F98415757620B543A52E61c46B32eB19261F984',
@@ -128,24 +139,19 @@ var DEFAULT_ADDRESSES = {
128
139
  v3MigratorAddress: '0xA5644E29708357803b5A882D272c41cC0dF92B34',
129
140
  nonfungiblePositionManagerAddress: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'
130
141
  };
131
-
132
142
  var MAINNET_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
133
143
  v1MixedRouteQuoterAddress: '0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E'
134
144
  });
135
-
136
145
  var GOERLI_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
137
146
  v1MixedRouteQuoterAddress: '0xBa60b6e6fF25488308789E6e0A65D838be34194e'
138
147
  });
139
-
140
148
  var OPTIMISM_ADDRESSES = DEFAULT_ADDRESSES;
141
-
142
149
  var ARBITRUM_ONE_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
143
150
  multicallAddress: '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB',
144
151
  tickLensAddress: '0xbfd8137f7d1516D3ea5cA83523914859ec47F573'
145
152
  });
146
-
147
- var POLYGON_ADDRESSES = DEFAULT_ADDRESSES; // celo v3 addresses
148
-
153
+ var POLYGON_ADDRESSES = DEFAULT_ADDRESSES;
154
+ // celo v3 addresses
149
155
  var CELO_ADDRESSES = {
150
156
  v3CoreFactoryAddress: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc',
151
157
  multicallAddress: '0x633987602DE5C4F337e3DbF265303A1080324204',
@@ -153,8 +159,8 @@ var CELO_ADDRESSES = {
153
159
  v3MigratorAddress: '0x3cFd4d48EDfDCC53D3f173F596f621064614C582',
154
160
  nonfungiblePositionManagerAddress: '0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A',
155
161
  tickLensAddress: '0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D'
156
- }; // BNB v3 addresses
157
-
162
+ };
163
+ // BNB v3 addresses
158
164
  var BNB_ADDRESSES = {
159
165
  v3CoreFactoryAddress: '0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7',
160
166
  multicallAddress: '0x963Df249eD09c358A4819E39d9Cd5736c3087184',
@@ -163,8 +169,8 @@ var BNB_ADDRESSES = {
163
169
  nonfungiblePositionManagerAddress: '0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613',
164
170
  tickLensAddress: '0xD9270014D396281579760619CCf4c3af0501A47C',
165
171
  swapRouter02Address: '0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2'
166
- }; // optimism goerli addresses
167
-
172
+ };
173
+ // optimism goerli addresses
168
174
  var OPTIMISM_GOERLI_ADDRESSES = {
169
175
  v3CoreFactoryAddress: '0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10',
170
176
  multicallAddress: '0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd',
@@ -172,8 +178,8 @@ var OPTIMISM_GOERLI_ADDRESSES = {
172
178
  v3MigratorAddress: '0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8',
173
179
  nonfungiblePositionManagerAddress: '0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6',
174
180
  tickLensAddress: '0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e'
175
- }; // optimism sepolia addresses
176
-
181
+ };
182
+ // optimism sepolia addresses
177
183
  var OPTIMISM_SEPOLIA_ADDRESSES = {
178
184
  v3CoreFactoryAddress: '0x8CE191193D15ea94e11d327b4c7ad8bbE520f6aF',
179
185
  multicallAddress: '0x80e4e06841bb76AA9735E0448cB8d003C0EF009a',
@@ -182,8 +188,8 @@ var OPTIMISM_SEPOLIA_ADDRESSES = {
182
188
  nonfungiblePositionManagerAddress: '0xdA75cEf1C93078e8b736FCA5D5a30adb97C8957d',
183
189
  tickLensAddress: '0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5',
184
190
  swapRouter02Address: '0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4'
185
- }; // arbitrum goerli v3 addresses
186
-
191
+ };
192
+ // arbitrum goerli v3 addresses
187
193
  var ARBITRUM_GOERLI_ADDRESSES = {
188
194
  v3CoreFactoryAddress: '0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6',
189
195
  multicallAddress: '0x8260CB40247290317a4c062F3542622367F206Ee',
@@ -191,8 +197,8 @@ var ARBITRUM_GOERLI_ADDRESSES = {
191
197
  v3MigratorAddress: '0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3',
192
198
  nonfungiblePositionManagerAddress: '0x622e4726a167799826d1E1D150b076A7725f5D81',
193
199
  tickLensAddress: '0xb52429333da969a0C79a60930a4Bf0020E5D1DE8'
194
- }; // arbitrum sepolia v3 addresses
195
-
200
+ };
201
+ // arbitrum sepolia v3 addresses
196
202
  var ARBITRUM_SEPOLIA_ADDRESSES = {
197
203
  v3CoreFactoryAddress: '0x248AB79Bbb9bC29bB72f7Cd42F17e054Fc40188e',
198
204
  multicallAddress: '0x2B718b475e385eD29F56775a66aAB1F5cC6B2A0A',
@@ -201,8 +207,8 @@ var ARBITRUM_SEPOLIA_ADDRESSES = {
201
207
  nonfungiblePositionManagerAddress: '0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65',
202
208
  tickLensAddress: '0x0fd18587734e5C2dcE2dccDcC7DD1EC89ba557d9',
203
209
  swapRouter02Address: '0x101F443B4d1b059569D643917553c771E1b9663E'
204
- }; // sepolia v3 addresses
205
-
210
+ };
211
+ // sepolia v3 addresses
206
212
  var SEPOLIA_ADDRESSES = {
207
213
  v3CoreFactoryAddress: '0x0227628f3F023bb0B980b67D528571c95c6DaC1c',
208
214
  multicallAddress: '0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07',
@@ -211,8 +217,8 @@ var SEPOLIA_ADDRESSES = {
211
217
  nonfungiblePositionManagerAddress: '0x1238536071E1c677A632429e3655c799b22cDA52',
212
218
  tickLensAddress: '0xd7f33bcdb21b359c8ee6f0251d30e94832baad07',
213
219
  swapRouter02Address: '0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E'
214
- }; // Avalanche v3 addresses
215
-
220
+ };
221
+ // Avalanche v3 addresses
216
222
  var AVALANCHE_ADDRESSES = {
217
223
  v3CoreFactoryAddress: '0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD',
218
224
  multicallAddress: '0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2',
@@ -230,8 +236,8 @@ var BASE_ADDRESSES = {
230
236
  nonfungiblePositionManagerAddress: '0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1',
231
237
  tickLensAddress: '0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d',
232
238
  swapRouter02Address: '0x2626664c2603336E57B271c5C0b26F421741e481'
233
- }; // Base Goerli v3 addresses
234
-
239
+ };
240
+ // Base Goerli v3 addresses
235
241
  var BASE_GOERLI_ADDRESSES = {
236
242
  v3CoreFactoryAddress: '0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2',
237
243
  multicallAddress: '0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439',
@@ -278,18 +284,15 @@ var BLAST_ADDRESSES = {
278
284
  };
279
285
  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.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);
280
286
  /* V3 Contract Addresses */
281
-
282
287
  var V3_CORE_FACTORY_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
283
288
  memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].v3CoreFactoryAddress;
284
289
  return memo;
285
290
  }, {}));
286
291
  var V3_MIGRATOR_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
287
292
  var v3MigratorAddress = CHAIN_TO_ADDRESSES_MAP[chainId].v3MigratorAddress;
288
-
289
293
  if (v3MigratorAddress) {
290
294
  memo[chainId] = v3MigratorAddress;
291
295
  }
292
-
293
296
  return memo;
294
297
  }, {}));
295
298
  var MULTICALL_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
@@ -299,17 +302,14 @@ var MULTICALL_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAIN
299
302
  /**
300
303
  * The oldest V0 governance address
301
304
  */
302
-
303
305
  var GOVERNANCE_ALPHA_V0_ADDRESSES = /*#__PURE__*/constructSameAddressMap('0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F');
304
306
  /**
305
307
  * The older V1 governance address
306
308
  */
307
-
308
309
  var GOVERNANCE_ALPHA_V1_ADDRESSES = (_GOVERNANCE_ALPHA_V1_ = {}, _GOVERNANCE_ALPHA_V1_[exports.ChainId.MAINNET] = '0xC4e172459f1E7939D522503B81AFAaC1014CE6F6', _GOVERNANCE_ALPHA_V1_);
309
310
  /**
310
311
  * The latest governor bravo that is currently admin of timelock
311
312
  */
312
-
313
313
  var GOVERNANCE_BRAVO_ADDRESSES = (_GOVERNANCE_BRAVO_ADD = {}, _GOVERNANCE_BRAVO_ADD[exports.ChainId.MAINNET] = '0x408ED6354d4973f66138C91495F2f2FCbd8724C3', _GOVERNANCE_BRAVO_ADD);
314
314
  var TIMELOCK_ADDRESSES = /*#__PURE__*/constructSameAddressMap('0x1a9C8182C09F50C8318d769245beA52c32BE35BC');
315
315
  var MERKLE_DISTRIBUTOR_ADDRESS = (_MERKLE_DISTRIBUTOR_A = {}, _MERKLE_DISTRIBUTOR_A[exports.ChainId.MAINNET] = '0x090D4613473dEE047c3f2706764f49E0821D256e', _MERKLE_DISTRIBUTOR_A);
@@ -320,41 +320,33 @@ var QUOTER_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.r
320
320
  }, {}));
321
321
  var NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
322
322
  var nonfungiblePositionManagerAddress = CHAIN_TO_ADDRESSES_MAP[chainId].nonfungiblePositionManagerAddress;
323
-
324
323
  if (nonfungiblePositionManagerAddress) {
325
324
  memo[chainId] = nonfungiblePositionManagerAddress;
326
325
  }
327
-
328
326
  return memo;
329
327
  }, {}));
330
328
  var ENS_REGISTRAR_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/constructSameAddressMap('0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'));
331
329
  var SOCKS_CONTROLLER_ADDRESSES = (_SOCKS_CONTROLLER_ADD = {}, _SOCKS_CONTROLLER_ADD[exports.ChainId.MAINNET] = '0x65770b5283117639760beA3F867b69b3697a91dd', _SOCKS_CONTROLLER_ADD);
332
330
  var TICK_LENS_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
333
331
  var tickLensAddress = CHAIN_TO_ADDRESSES_MAP[chainId].tickLensAddress;
334
-
335
332
  if (tickLensAddress) {
336
333
  memo[chainId] = tickLensAddress;
337
334
  }
338
-
339
335
  return memo;
340
336
  }, {}));
341
337
  var MIXED_ROUTE_QUOTER_V1_ADDRESSES = /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
342
338
  var v1MixedRouteQuoterAddress = CHAIN_TO_ADDRESSES_MAP[chainId].v1MixedRouteQuoterAddress;
343
-
344
339
  if (v1MixedRouteQuoterAddress) {
345
340
  memo[chainId] = v1MixedRouteQuoterAddress;
346
341
  }
347
-
348
342
  return memo;
349
343
  }, {});
350
344
  var SWAP_ROUTER_02_ADDRESSES = function SWAP_ROUTER_02_ADDRESSES(chainId) {
351
345
  if (SUPPORTED_CHAINS.includes(chainId)) {
352
346
  var _CHAIN_TO_ADDRESSES_M2;
353
-
354
347
  var id = chainId;
355
348
  return (_CHAIN_TO_ADDRESSES_M2 = CHAIN_TO_ADDRESSES_MAP[id].swapRouter02Address) != null ? _CHAIN_TO_ADDRESSES_M2 : '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45';
356
349
  }
357
-
358
350
  return '';
359
351
  };
360
352
 
@@ -362,13 +354,11 @@ var SWAP_ROUTER_02_ADDRESSES = function SWAP_ROUTER_02_ADDRESSES(chainId) {
362
354
  TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT";
363
355
  TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT";
364
356
  })(exports.TradeType || (exports.TradeType = {}));
365
-
366
357
  (function (Rounding) {
367
358
  Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN";
368
359
  Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP";
369
360
  Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP";
370
361
  })(exports.Rounding || (exports.Rounding = {}));
371
-
372
362
  var MaxUint256 = /*#__PURE__*/JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
373
363
 
374
364
  var _toSignificantRoundin, _toFixedRounding;
@@ -381,80 +371,63 @@ var Fraction = /*#__PURE__*/function () {
381
371
  if (denominator === void 0) {
382
372
  denominator = JSBI.BigInt(1);
383
373
  }
384
-
385
374
  this.numerator = JSBI.BigInt(numerator);
386
375
  this.denominator = JSBI.BigInt(denominator);
387
376
  }
388
-
389
377
  Fraction.tryParseFraction = function tryParseFraction(fractionish) {
390
378
  if (fractionish instanceof JSBI || typeof fractionish === 'number' || typeof fractionish === 'string') return new Fraction(fractionish);
391
379
  if ('numerator' in fractionish && 'denominator' in fractionish) return fractionish;
392
380
  throw new Error('Could not parse fraction');
393
- } // performs floor division
381
+ }
382
+ // performs floor division
394
383
  ;
395
-
396
384
  var _proto = Fraction.prototype;
397
-
398
385
  _proto.invert = function invert() {
399
386
  return new Fraction(this.denominator, this.numerator);
400
387
  };
401
-
402
388
  _proto.add = function add(other) {
403
389
  var otherParsed = Fraction.tryParseFraction(other);
404
-
405
390
  if (JSBI.equal(this.denominator, otherParsed.denominator)) {
406
391
  return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator);
407
392
  }
408
-
409
393
  return new Fraction(JSBI.add(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator));
410
394
  };
411
-
412
395
  _proto.subtract = function subtract(other) {
413
396
  var otherParsed = Fraction.tryParseFraction(other);
414
-
415
397
  if (JSBI.equal(this.denominator, otherParsed.denominator)) {
416
398
  return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator);
417
399
  }
418
-
419
400
  return new Fraction(JSBI.subtract(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator));
420
401
  };
421
-
422
402
  _proto.lessThan = function lessThan(other) {
423
403
  var otherParsed = Fraction.tryParseFraction(other);
424
404
  return JSBI.lessThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
425
405
  };
426
-
427
406
  _proto.equalTo = function equalTo(other) {
428
407
  var otherParsed = Fraction.tryParseFraction(other);
429
408
  return JSBI.equal(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
430
409
  };
431
-
432
410
  _proto.greaterThan = function greaterThan(other) {
433
411
  var otherParsed = Fraction.tryParseFraction(other);
434
412
  return JSBI.greaterThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
435
413
  };
436
-
437
414
  _proto.multiply = function multiply(other) {
438
415
  var otherParsed = Fraction.tryParseFraction(other);
439
416
  return new Fraction(JSBI.multiply(this.numerator, otherParsed.numerator), JSBI.multiply(this.denominator, otherParsed.denominator));
440
417
  };
441
-
442
418
  _proto.divide = function divide(other) {
443
419
  var otherParsed = Fraction.tryParseFraction(other);
444
420
  return new Fraction(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(this.denominator, otherParsed.numerator));
445
421
  };
446
-
447
422
  _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
448
423
  if (format === void 0) {
449
424
  format = {
450
425
  groupSeparator: ''
451
426
  };
452
427
  }
453
-
454
428
  if (rounding === void 0) {
455
429
  rounding = exports.Rounding.ROUND_HALF_UP;
456
430
  }
457
-
458
431
  !Number.isInteger(significantDigits) ? invariant(false, significantDigits + " is not an integer.") : void 0;
459
432
  !(significantDigits > 0) ? invariant(false, significantDigits + " is not positive.") : void 0;
460
433
  Decimal.set({
@@ -464,18 +437,15 @@ var Fraction = /*#__PURE__*/function () {
464
437
  var quotient = new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits);
465
438
  return quotient.toFormat(quotient.decimalPlaces(), format);
466
439
  };
467
-
468
440
  _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
469
441
  if (format === void 0) {
470
442
  format = {
471
443
  groupSeparator: ''
472
444
  };
473
445
  }
474
-
475
446
  if (rounding === void 0) {
476
447
  rounding = exports.Rounding.ROUND_HALF_UP;
477
448
  }
478
-
479
449
  !Number.isInteger(decimalPlaces) ? invariant(false, decimalPlaces + " is not an integer.") : void 0;
480
450
  !(decimalPlaces >= 0) ? invariant(false, decimalPlaces + " is negative.") : void 0;
481
451
  Big.DP = decimalPlaces;
@@ -484,15 +454,13 @@ var Fraction = /*#__PURE__*/function () {
484
454
  }
485
455
  /**
486
456
  * Helper method for converting any super class back to a fraction
487
- */
488
- ;
489
-
457
+ */;
490
458
  _createClass(Fraction, [{
491
459
  key: "quotient",
492
460
  get: function get() {
493
461
  return JSBI.divide(this.numerator, this.denominator);
494
- } // remainder after floor division
495
-
462
+ }
463
+ // remainder after floor division
496
464
  }, {
497
465
  key: "remainder",
498
466
  get: function get() {
@@ -504,17 +472,14 @@ var Fraction = /*#__PURE__*/function () {
504
472
  return new Fraction(this.numerator, this.denominator);
505
473
  }
506
474
  }]);
507
-
508
475
  return Fraction;
509
476
  }();
510
477
 
511
478
  var Big$1 = /*#__PURE__*/toFormat(_Big);
512
479
  var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
513
480
  _inheritsLoose(CurrencyAmount, _Fraction);
514
-
515
481
  function CurrencyAmount(currency, numerator, denominator) {
516
482
  var _this;
517
-
518
483
  _this = _Fraction.call(this, numerator, denominator) || this;
519
484
  !JSBI.lessThanOrEqual(_this.quotient, MaxUint256) ? invariant(false, 'AMOUNT') : void 0;
520
485
  _this.currency = currency;
@@ -526,8 +491,6 @@ var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
526
491
  * @param currency the currency in the amount
527
492
  * @param rawAmount the raw token or ether amount
528
493
  */
529
-
530
-
531
494
  CurrencyAmount.fromRawAmount = function fromRawAmount(currency, rawAmount) {
532
495
  return new CurrencyAmount(currency, rawAmount);
533
496
  }
@@ -536,79 +499,57 @@ var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
536
499
  * @param currency the currency
537
500
  * @param numerator the numerator of the fractional token amount
538
501
  * @param denominator the denominator of the fractional token amount
539
- */
540
- ;
541
-
502
+ */;
542
503
  CurrencyAmount.fromFractionalAmount = function fromFractionalAmount(currency, numerator, denominator) {
543
504
  return new CurrencyAmount(currency, numerator, denominator);
544
505
  };
545
-
546
506
  var _proto = CurrencyAmount.prototype;
547
-
548
507
  _proto.add = function add(other) {
549
508
  !this.currency.equals(other.currency) ? invariant(false, 'CURRENCY') : void 0;
550
-
551
509
  var added = _Fraction.prototype.add.call(this, other);
552
-
553
510
  return CurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator);
554
511
  };
555
-
556
512
  _proto.subtract = function subtract(other) {
557
513
  !this.currency.equals(other.currency) ? invariant(false, 'CURRENCY') : void 0;
558
-
559
514
  var subtracted = _Fraction.prototype.subtract.call(this, other);
560
-
561
515
  return CurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator);
562
516
  };
563
-
564
517
  _proto.multiply = function multiply(other) {
565
518
  var multiplied = _Fraction.prototype.multiply.call(this, other);
566
-
567
519
  return CurrencyAmount.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator);
568
520
  };
569
-
570
521
  _proto.divide = function divide(other) {
571
522
  var divided = _Fraction.prototype.divide.call(this, other);
572
-
573
523
  return CurrencyAmount.fromFractionalAmount(this.currency, divided.numerator, divided.denominator);
574
524
  };
575
-
576
525
  _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
577
526
  if (significantDigits === void 0) {
578
527
  significantDigits = 6;
579
528
  }
580
-
581
529
  if (rounding === void 0) {
582
530
  rounding = exports.Rounding.ROUND_DOWN;
583
531
  }
584
-
585
532
  return _Fraction.prototype.divide.call(this, this.decimalScale).toSignificant(significantDigits, format, rounding);
586
533
  };
587
-
588
534
  _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
589
535
  if (decimalPlaces === void 0) {
590
536
  decimalPlaces = this.currency.decimals;
591
537
  }
592
-
593
538
  if (rounding === void 0) {
594
539
  rounding = exports.Rounding.ROUND_DOWN;
595
540
  }
596
-
597
541
  !(decimalPlaces <= this.currency.decimals) ? invariant(false, 'DECIMALS') : void 0;
598
542
  return _Fraction.prototype.divide.call(this, this.decimalScale).toFixed(decimalPlaces, format, rounding);
599
543
  };
600
-
601
544
  _proto.toExact = function toExact(format) {
602
545
  if (format === void 0) {
603
546
  format = {
604
547
  groupSeparator: ''
605
548
  };
606
549
  }
607
-
608
550
  Big$1.DP = this.currency.decimals;
609
551
  return new Big$1(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(format);
610
552
  };
611
-
612
553
  _createClass(CurrencyAmount, [{
613
554
  key: "wrapped",
614
555
  get: function get() {
@@ -616,7 +557,6 @@ var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
616
557
  return CurrencyAmount.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator);
617
558
  }
618
559
  }]);
619
-
620
560
  return CurrencyAmount;
621
561
  }(Fraction);
622
562
 
@@ -625,79 +565,60 @@ var ONE_HUNDRED = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100));
625
565
  * Converts a fraction to a percent
626
566
  * @param fraction the fraction to convert
627
567
  */
628
-
629
568
  function toPercent(fraction) {
630
569
  return new Percent(fraction.numerator, fraction.denominator);
631
570
  }
632
-
633
571
  var Percent = /*#__PURE__*/function (_Fraction) {
634
572
  _inheritsLoose(Percent, _Fraction);
635
-
636
573
  function Percent() {
637
574
  var _this;
638
-
639
575
  _this = _Fraction.apply(this, arguments) || this;
640
576
  /**
641
577
  * This boolean prevents a fraction from being interpreted as a Percent
642
578
  */
643
-
644
579
  _this.isPercent = true;
645
580
  return _this;
646
581
  }
647
-
648
582
  var _proto = Percent.prototype;
649
-
650
583
  _proto.add = function add(other) {
651
584
  return toPercent(_Fraction.prototype.add.call(this, other));
652
585
  };
653
-
654
586
  _proto.subtract = function subtract(other) {
655
587
  return toPercent(_Fraction.prototype.subtract.call(this, other));
656
588
  };
657
-
658
589
  _proto.multiply = function multiply(other) {
659
590
  return toPercent(_Fraction.prototype.multiply.call(this, other));
660
591
  };
661
-
662
592
  _proto.divide = function divide(other) {
663
593
  return toPercent(_Fraction.prototype.divide.call(this, other));
664
594
  };
665
-
666
595
  _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
667
596
  if (significantDigits === void 0) {
668
597
  significantDigits = 5;
669
598
  }
670
-
671
599
  return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toSignificant(significantDigits, format, rounding);
672
600
  };
673
-
674
601
  _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
675
602
  if (decimalPlaces === void 0) {
676
603
  decimalPlaces = 2;
677
604
  }
678
-
679
605
  return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toFixed(decimalPlaces, format, rounding);
680
606
  };
681
-
682
607
  return Percent;
683
608
  }(Fraction);
684
609
 
685
610
  var Price = /*#__PURE__*/function (_Fraction) {
686
611
  _inheritsLoose(Price, _Fraction);
687
-
688
612
  /**
689
613
  * Construct a price, either with the base and quote currency amount, or the
690
614
  * @param args
691
615
  */
692
616
  function Price() {
693
617
  var _this;
694
-
695
618
  var baseCurrency, quoteCurrency, denominator, numerator;
696
-
697
619
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
698
620
  args[_key] = arguments[_key];
699
621
  }
700
-
701
622
  if (args.length === 4) {
702
623
  baseCurrency = args[0];
703
624
  quoteCurrency = args[1];
@@ -711,7 +632,6 @@ var Price = /*#__PURE__*/function (_Fraction) {
711
632
  denominator = _ref[2];
712
633
  numerator = _ref[3];
713
634
  }
714
-
715
635
  _this = _Fraction.call(this, numerator, denominator) || this;
716
636
  _this.baseCurrency = baseCurrency;
717
637
  _this.quoteCurrency = quoteCurrency;
@@ -721,75 +641,56 @@ var Price = /*#__PURE__*/function (_Fraction) {
721
641
  /**
722
642
  * Flip the price, switching the base and quote currency
723
643
  */
724
-
725
-
726
644
  var _proto = Price.prototype;
727
-
728
645
  _proto.invert = function invert() {
729
646
  return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator);
730
647
  }
731
648
  /**
732
649
  * 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
733
650
  * @param other the other price
734
- */
735
- ;
736
-
651
+ */;
737
652
  _proto.multiply = function multiply(other) {
738
653
  !this.quoteCurrency.equals(other.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
739
-
740
654
  var fraction = _Fraction.prototype.multiply.call(this, other);
741
-
742
655
  return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator);
743
656
  }
744
657
  /**
745
658
  * Return the amount of quote currency corresponding to a given amount of the base currency
746
659
  * @param currencyAmount the amount of base currency to quote against the price
747
- */
748
- ;
749
-
660
+ */;
750
661
  _proto.quote = function quote(currencyAmount) {
751
662
  !currencyAmount.currency.equals(this.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
752
-
753
663
  var result = _Fraction.prototype.multiply.call(this, currencyAmount);
754
-
755
664
  return CurrencyAmount.fromFractionalAmount(this.quoteCurrency, result.numerator, result.denominator);
756
665
  }
757
666
  /**
758
667
  * Get the value scaled by decimals for formatting
759
668
  * @private
760
- */
761
- ;
762
-
669
+ */;
763
670
  _proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
764
671
  if (significantDigits === void 0) {
765
672
  significantDigits = 6;
766
673
  }
767
-
768
674
  return this.adjustedForDecimals.toSignificant(significantDigits, format, rounding);
769
675
  };
770
-
771
676
  _proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
772
677
  if (decimalPlaces === void 0) {
773
678
  decimalPlaces = 4;
774
679
  }
775
-
776
680
  return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding);
777
681
  };
778
-
779
682
  _createClass(Price, [{
780
683
  key: "adjustedForDecimals",
781
684
  get: function get() {
782
685
  return _Fraction.prototype.multiply.call(this, this.scalar);
783
686
  }
784
687
  }]);
785
-
786
688
  return Price;
787
689
  }(Fraction);
788
690
 
789
691
  /**
790
692
  * A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
791
693
  */
792
-
793
694
  var BaseCurrency =
794
695
  /**
795
696
  * Constructs an instance of the base class `BaseCurrency`.
@@ -810,19 +711,15 @@ function BaseCurrency(chainId, decimals, symbol, name) {
810
711
  /**
811
712
  * Represents the native currency of the chain on which it resides, e.g.
812
713
  */
813
-
814
714
  var NativeCurrency = /*#__PURE__*/function (_BaseCurrency) {
815
715
  _inheritsLoose(NativeCurrency, _BaseCurrency);
816
-
817
716
  function NativeCurrency() {
818
717
  var _this;
819
-
820
718
  _this = _BaseCurrency.apply(this, arguments) || this;
821
719
  _this.isNative = true;
822
720
  _this.isToken = false;
823
721
  return _this;
824
722
  }
825
-
826
723
  return NativeCurrency;
827
724
  }(BaseCurrency);
828
725
 
@@ -830,36 +727,31 @@ var NativeCurrency = /*#__PURE__*/function (_BaseCurrency) {
830
727
  * Validates an address and returns the parsed (checksummed) version of that address
831
728
  * @param address the unchecksummed hex address
832
729
  */
833
-
834
730
  function validateAndParseAddress(address$1) {
835
731
  try {
836
732
  return address.getAddress(address$1);
837
733
  } catch (error) {
838
734
  throw new Error(address$1 + " is not a valid address.");
839
735
  }
840
- } // Checks a string starts with 0x, is 42 characters long and contains only hex characters after 0x
841
-
736
+ }
737
+ // Checks a string starts with 0x, is 42 characters long and contains only hex characters after 0x
842
738
  var startsWith0xLen42HexRegex = /^0x[0-9a-fA-F]{40}$/;
843
739
  /**
844
740
  * Checks if an address is valid by checking 0x prefix, length === 42 and hex encoding.
845
741
  * @param address the unchecksummed hex address
846
742
  */
847
-
848
743
  function checkValidAddress(address) {
849
744
  if (startsWith0xLen42HexRegex.test(address)) {
850
745
  return address;
851
746
  }
852
-
853
747
  throw new Error(address + " is not a valid address.");
854
748
  }
855
749
 
856
750
  /**
857
751
  * Represents an ERC20 token with a unique address and some metadata.
858
752
  */
859
-
860
753
  var Token = /*#__PURE__*/function (_BaseCurrency) {
861
754
  _inheritsLoose(Token, _BaseCurrency);
862
-
863
755
  /**
864
756
  *
865
757
  * @param chainId {@link BaseCurrency#chainId}
@@ -873,25 +765,20 @@ var Token = /*#__PURE__*/function (_BaseCurrency) {
873
765
  */
874
766
  function Token(chainId, address, decimals, symbol, name, bypassChecksum, buyFeeBps, sellFeeBps) {
875
767
  var _this;
876
-
877
768
  _this = _BaseCurrency.call(this, chainId, decimals, symbol, name) || this;
878
769
  _this.isNative = false;
879
770
  _this.isToken = true;
880
-
881
771
  if (bypassChecksum) {
882
772
  _this.address = checkValidAddress(address);
883
773
  } else {
884
774
  _this.address = validateAndParseAddress(address);
885
775
  }
886
-
887
776
  if (buyFeeBps) {
888
777
  !buyFeeBps.gte(bignumber.BigNumber.from(0)) ? invariant(false, 'NON-NEGATIVE FOT FEES') : void 0;
889
778
  }
890
-
891
779
  if (sellFeeBps) {
892
780
  !sellFeeBps.gte(bignumber.BigNumber.from(0)) ? invariant(false, 'NON-NEGATIVE FOT FEES') : void 0;
893
781
  }
894
-
895
782
  _this.buyFeeBps = buyFeeBps;
896
783
  _this.sellFeeBps = sellFeeBps;
897
784
  return _this;
@@ -900,10 +787,7 @@ var Token = /*#__PURE__*/function (_BaseCurrency) {
900
787
  * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
901
788
  * @param other other token to compare
902
789
  */
903
-
904
-
905
790
  var _proto = Token.prototype;
906
-
907
791
  _proto.equals = function equals(other) {
908
792
  return other.isToken && this.chainId === other.chainId && this.address.toLowerCase() === other.address.toLowerCase();
909
793
  }
@@ -912,9 +796,7 @@ var Token = /*#__PURE__*/function (_BaseCurrency) {
912
796
  * @param other other token to compare
913
797
  * @throws if the tokens have the same address
914
798
  * @throws if the tokens are on different chains
915
- */
916
- ;
917
-
799
+ */;
918
800
  _proto.sortsBefore = function sortsBefore(other) {
919
801
  !(this.chainId === other.chainId) ? invariant(false, 'CHAIN_IDS') : void 0;
920
802
  !(this.address.toLowerCase() !== other.address.toLowerCase()) ? invariant(false, 'ADDRESSES') : void 0;
@@ -922,49 +804,53 @@ var Token = /*#__PURE__*/function (_BaseCurrency) {
922
804
  }
923
805
  /**
924
806
  * Return this token, which does not need to be wrapped
925
- */
926
- ;
927
-
807
+ */;
928
808
  _createClass(Token, [{
929
809
  key: "wrapped",
930
810
  get: function get() {
931
811
  return this;
932
812
  }
933
813
  }]);
934
-
935
814
  return Token;
936
815
  }(BaseCurrency);
937
816
 
938
- var _WETH;
939
817
  /**
940
818
  * Known WETH9 implementation addresses, used in our implementation of Ether#wrapped
941
819
  */
942
-
943
- var WETH9 = (_WETH = {}, _WETH[1] = /*#__PURE__*/new Token(1, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH', 'Wrapped Ether'), _WETH[3] = /*#__PURE__*/new Token(3, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[4] = /*#__PURE__*/new Token(4, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[5] = /*#__PURE__*/new Token(5, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'), _WETH[42] = /*#__PURE__*/new Token(42, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'), _WETH[10] = /*#__PURE__*/new Token(10, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _WETH[69] = /*#__PURE__*/new Token(69, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _WETH[11155420] = /*#__PURE__*/new Token(11155420, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _WETH[42161] = /*#__PURE__*/new Token(42161, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', 18, 'WETH', 'Wrapped Ether'), _WETH[421611] = /*#__PURE__*/new Token(421611, '0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681', 18, 'WETH', 'Wrapped Ether'), _WETH[421614] = /*#__PURE__*/new Token(421614, '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73', 18, 'WETH', 'Wrapped Ether'), _WETH[8453] = /*#__PURE__*/new Token(8453, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _WETH[56] = /*#__PURE__*/new Token(56, '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 18, 'WBNB', 'Wrapped BNB'), _WETH[137] = /*#__PURE__*/new Token(137, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 18, 'WMATIC', 'Wrapped MATIC'), _WETH[43114] = /*#__PURE__*/new Token(43114, '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', 18, 'WAVAX', 'Wrapped AVAX'), _WETH);
820
+ var WETH9 = {
821
+ 1: /*#__PURE__*/new Token(1, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH', 'Wrapped Ether'),
822
+ 3: /*#__PURE__*/new Token(3, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'),
823
+ 4: /*#__PURE__*/new Token(4, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'),
824
+ 5: /*#__PURE__*/new Token(5, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'),
825
+ 42: /*#__PURE__*/new Token(42, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'),
826
+ 10: /*#__PURE__*/new Token(10, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
827
+ 69: /*#__PURE__*/new Token(69, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
828
+ 11155420: /*#__PURE__*/new Token(11155420, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
829
+ 42161: /*#__PURE__*/new Token(42161, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', 18, 'WETH', 'Wrapped Ether'),
830
+ 421611: /*#__PURE__*/new Token(421611, '0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681', 18, 'WETH', 'Wrapped Ether'),
831
+ 421614: /*#__PURE__*/new Token(421614, '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73', 18, 'WETH', 'Wrapped Ether'),
832
+ 8453: /*#__PURE__*/new Token(8453, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
833
+ 56: /*#__PURE__*/new Token(56, '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 18, 'WBNB', 'Wrapped BNB'),
834
+ 137: /*#__PURE__*/new Token(137, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 18, 'WMATIC', 'Wrapped MATIC'),
835
+ 43114: /*#__PURE__*/new Token(43114, '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', 18, 'WAVAX', 'Wrapped AVAX')
836
+ };
944
837
 
945
838
  /**
946
839
  * Ether is the main usage of a 'native' currency, i.e. for Ethereum mainnet and all testnets
947
840
  */
948
-
949
841
  var Ether = /*#__PURE__*/function (_NativeCurrency) {
950
842
  _inheritsLoose(Ether, _NativeCurrency);
951
-
952
843
  function Ether(chainId) {
953
844
  return _NativeCurrency.call(this, chainId, 18, 'ETH', 'Ether') || this;
954
845
  }
955
-
956
846
  Ether.onChain = function onChain(chainId) {
957
847
  var _this$_etherCache$cha;
958
-
959
848
  return (_this$_etherCache$cha = this._etherCache[chainId]) != null ? _this$_etherCache$cha : this._etherCache[chainId] = new Ether(chainId);
960
849
  };
961
-
962
850
  var _proto = Ether.prototype;
963
-
964
851
  _proto.equals = function equals(other) {
965
852
  return other.isNative && other.chainId === this.chainId;
966
853
  };
967
-
968
854
  _createClass(Ether, [{
969
855
  key: "wrapped",
970
856
  get: function get() {
@@ -973,7 +859,6 @@ var Ether = /*#__PURE__*/function (_NativeCurrency) {
973
859
  return weth9;
974
860
  }
975
861
  }]);
976
-
977
862
  return Ether;
978
863
  }(NativeCurrency);
979
864
  Ether._etherCache = {};
@@ -984,44 +869,39 @@ Ether._etherCache = {};
984
869
  * @param inputAmount the input amount of the trade
985
870
  * @param outputAmount the output amount of the trade
986
871
  */
987
-
988
872
  function computePriceImpact(midPrice, inputAmount, outputAmount) {
989
- var quotedOutputAmount = midPrice.quote(inputAmount); // calculate price impact := (exactQuote - outputAmount) / exactQuote
990
-
873
+ var quotedOutputAmount = midPrice.quote(inputAmount);
874
+ // calculate price impact := (exactQuote - outputAmount) / exactQuote
991
875
  var priceImpact = quotedOutputAmount.subtract(outputAmount).divide(quotedOutputAmount);
992
876
  return new Percent(priceImpact.numerator, priceImpact.denominator);
993
877
  }
994
878
 
879
+ // given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to
995
880
  // `maxSize` by removing the last item
996
-
997
881
  function sortedInsert(items, add, maxSize, comparator) {
998
- !(maxSize > 0) ? invariant(false, 'MAX_SIZE_ZERO') : void 0; // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize
999
-
1000
- !(items.length <= maxSize) ? invariant(false, 'ITEMS_SIZE') : void 0; // short circuit first item add
1001
-
882
+ !(maxSize > 0) ? invariant(false, 'MAX_SIZE_ZERO') : void 0;
883
+ // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize
884
+ !(items.length <= maxSize) ? invariant(false, 'ITEMS_SIZE') : void 0;
885
+ // short circuit first item add
1002
886
  if (items.length === 0) {
1003
887
  items.push(add);
1004
888
  return null;
1005
889
  } else {
1006
- var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item
1007
-
890
+ var isFull = items.length === maxSize;
891
+ // short circuit if full and the additional item does not come before the last item
1008
892
  if (isFull && comparator(items[items.length - 1], add) <= 0) {
1009
893
  return add;
1010
894
  }
1011
-
1012
895
  var lo = 0,
1013
- hi = items.length;
1014
-
896
+ hi = items.length;
1015
897
  while (lo < hi) {
1016
898
  var mid = lo + hi >>> 1;
1017
-
1018
899
  if (comparator(items[mid], add) <= 0) {
1019
900
  lo = mid + 1;
1020
901
  } else {
1021
902
  hi = mid;
1022
903
  }
1023
904
  }
1024
-
1025
905
  items.splice(lo, 0, add);
1026
906
  return isFull ? items.pop() : null;
1027
907
  }
@@ -1035,24 +915,20 @@ var TWO = /*#__PURE__*/JSBI.BigInt(2);
1035
915
  * Computes floor(sqrt(value))
1036
916
  * @param value the value for which to compute the square root, rounded down
1037
917
  */
1038
-
1039
918
  function sqrt(value) {
1040
- !JSBI.greaterThanOrEqual(value, ZERO) ? invariant(false, 'NEGATIVE') : void 0; // rely on built in sqrt if possible
1041
-
919
+ !JSBI.greaterThanOrEqual(value, ZERO) ? invariant(false, 'NEGATIVE') : void 0;
920
+ // rely on built in sqrt if possible
1042
921
  if (JSBI.lessThan(value, MAX_SAFE_INTEGER)) {
1043
922
  return JSBI.BigInt(Math.floor(Math.sqrt(JSBI.toNumber(value))));
1044
923
  }
1045
-
1046
924
  var z;
1047
925
  var x;
1048
926
  z = value;
1049
927
  x = JSBI.add(JSBI.divide(value, TWO), ONE);
1050
-
1051
928
  while (JSBI.lessThan(x, z)) {
1052
929
  z = x;
1053
930
  x = JSBI.divide(JSBI.add(JSBI.divide(value, x), x), TWO);
1054
931
  }
1055
-
1056
932
  return z;
1057
933
  }
1058
934