@uniswap/sdk-core 4.1.4 → 4.2.1-beta.1

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