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