@uniswap/sdk-core 3.2.4 → 3.2.6

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