@uniswap/universal-router-sdk 2.2.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -213,88 +213,184 @@ function createCommand(type, parameters) {
213
213
  };
214
214
  }
215
215
 
216
- var _CHAIN_CONFIGS;
216
+ var _routerConfigs, _routerConfigs2, _routerConfigs3, _routerConfigs4, _routerConfigs5, _routerConfigs6, _routerConfigs7, _routerConfigs8, _routerConfigs9, _routerConfigs10, _routerConfigs11, _routerConfigs12, _routerConfigs13, _routerConfigs14, _routerConfigs15, _routerConfigs16, _routerConfigs17, _routerConfigs18, _CHAIN_CONFIGS;
217
+ var RouterVersion;
218
+ (function (RouterVersion) {
219
+ RouterVersion[RouterVersion["V1_2"] = 0] = "V1_2";
220
+ RouterVersion[RouterVersion["V2_0"] = 1] = "V2_0";
221
+ })(RouterVersion || (RouterVersion = {}));
217
222
  var WETH_NOT_SUPPORTED_ON_CHAIN = '0x0000000000000000000000000000000000000000';
223
+ // Todo: Change `CHAIN_CONFIGS` to pull the UR address with v4
218
224
  var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
219
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
220
225
  weth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
221
- creationBlock: 17143817
226
+ routerConfigs: (_routerConfigs = {}, _routerConfigs[RouterVersion.V1_2] = {
227
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
228
+ creationBlock: 17143817
229
+ }, _routerConfigs[RouterVersion.V2_0] = {
230
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
231
+ creationBlock: 17143817
232
+ }, _routerConfigs)
222
233
  }, _CHAIN_CONFIGS[5] = {
223
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
224
234
  weth: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6',
225
- creationBlock: 8940568
235
+ routerConfigs: (_routerConfigs2 = {}, _routerConfigs2[RouterVersion.V1_2] = {
236
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
237
+ creationBlock: 8940568
238
+ }, _routerConfigs2[RouterVersion.V2_0] = {
239
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
240
+ creationBlock: 8940568
241
+ }, _routerConfigs2)
226
242
  }, _CHAIN_CONFIGS[11155111] = {
227
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
228
243
  weth: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
229
- creationBlock: 3543575
244
+ routerConfigs: (_routerConfigs3 = {}, _routerConfigs3[RouterVersion.V1_2] = {
245
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
246
+ creationBlock: 3543575
247
+ }, _routerConfigs3[RouterVersion.V2_0] = {
248
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
249
+ creationBlock: 3543575
250
+ }, _routerConfigs3)
230
251
  }, _CHAIN_CONFIGS[137] = {
231
- router: '0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2',
232
252
  weth: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
233
- creationBlock: 52210153
253
+ routerConfigs: (_routerConfigs4 = {}, _routerConfigs4[RouterVersion.V1_2] = {
254
+ address: '0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2',
255
+ creationBlock: 52210153
256
+ }, _routerConfigs4[RouterVersion.V2_0] = {
257
+ address: '0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2',
258
+ creationBlock: 52210153
259
+ }, _routerConfigs4)
234
260
  }, _CHAIN_CONFIGS[80001] = {
235
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
236
261
  weth: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889',
237
- creationBlock: 35176052
262
+ routerConfigs: (_routerConfigs5 = {}, _routerConfigs5[RouterVersion.V1_2] = {
263
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
264
+ creationBlock: 35176052
265
+ }, _routerConfigs5[RouterVersion.V2_0] = {
266
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
267
+ creationBlock: 35176052
268
+ }, _routerConfigs5)
238
269
  }, _CHAIN_CONFIGS[10] = {
239
- router: '0xCb1355ff08Ab38bBCE60111F1bb2B784bE25D7e8',
240
270
  weth: '0x4200000000000000000000000000000000000006',
241
- creationBlock: 114702266
271
+ routerConfigs: (_routerConfigs6 = {}, _routerConfigs6[RouterVersion.V1_2] = {
272
+ address: '0xCb1355ff08Ab38bBCE60111F1bb2B784bE25D7e8',
273
+ creationBlock: 114702266
274
+ }, _routerConfigs6[RouterVersion.V2_0] = {
275
+ address: '0xCb1355ff08Ab38bBCE60111F1bb2B784bE25D7e8',
276
+ creationBlock: 114702266
277
+ }, _routerConfigs6)
242
278
  }, _CHAIN_CONFIGS[420] = {
243
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
244
279
  weth: '0x4200000000000000000000000000000000000006',
245
- creationBlock: 8887728
280
+ routerConfigs: (_routerConfigs7 = {}, _routerConfigs7[RouterVersion.V1_2] = {
281
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
282
+ creationBlock: 8887728
283
+ }, _routerConfigs7[RouterVersion.V2_0] = {
284
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
285
+ creationBlock: 8887728
286
+ }, _routerConfigs7)
246
287
  }, _CHAIN_CONFIGS[42161] = {
247
- router: '0x5E325eDA8064b456f4781070C0738d849c824258',
248
288
  weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
249
- creationBlock: 169472836
289
+ routerConfigs: (_routerConfigs8 = {}, _routerConfigs8[RouterVersion.V1_2] = {
290
+ address: '0x5E325eDA8064b456f4781070C0738d849c824258',
291
+ creationBlock: 169472836
292
+ }, _routerConfigs8[RouterVersion.V2_0] = {
293
+ address: '0x5E325eDA8064b456f4781070C0738d849c824258',
294
+ creationBlock: 169472836
295
+ }, _routerConfigs8)
250
296
  }, _CHAIN_CONFIGS[421613] = {
251
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
252
297
  weth: '0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3',
253
- creationBlock: 18815277
298
+ routerConfigs: (_routerConfigs9 = {}, _routerConfigs9[RouterVersion.V1_2] = {
299
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
300
+ creationBlock: 18815277
301
+ }, _routerConfigs9[RouterVersion.V2_0] = {
302
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
303
+ creationBlock: 18815277
304
+ }, _routerConfigs9)
254
305
  }, _CHAIN_CONFIGS[42220] = {
255
- router: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
256
306
  weth: WETH_NOT_SUPPORTED_ON_CHAIN,
257
- creationBlock: 21407637
307
+ routerConfigs: (_routerConfigs10 = {}, _routerConfigs10[RouterVersion.V1_2] = {
308
+ address: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
309
+ creationBlock: 21407637
310
+ }, _routerConfigs10[RouterVersion.V2_0] = {
311
+ address: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
312
+ creationBlock: 21407637
313
+ }, _routerConfigs10)
258
314
  }, _CHAIN_CONFIGS[44787] = {
259
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
260
315
  weth: WETH_NOT_SUPPORTED_ON_CHAIN,
261
- creationBlock: 17566658
316
+ routerConfigs: (_routerConfigs11 = {}, _routerConfigs11[RouterVersion.V1_2] = {
317
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
318
+ creationBlock: 17566658
319
+ }, _routerConfigs11[RouterVersion.V2_0] = {
320
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
321
+ creationBlock: 17566658
322
+ }, _routerConfigs11)
262
323
  }, _CHAIN_CONFIGS[56] = {
263
- router: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
264
324
  weth: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
265
- creationBlock: 35160263
325
+ routerConfigs: (_routerConfigs12 = {}, _routerConfigs12[RouterVersion.V1_2] = {
326
+ address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
327
+ creationBlock: 35160263
328
+ }, _routerConfigs12[RouterVersion.V2_0] = {
329
+ address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
330
+ creationBlock: 35160263
331
+ }, _routerConfigs12)
266
332
  }, _CHAIN_CONFIGS[43114] = {
267
- router: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
268
333
  weth: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
269
- creationBlock: 40237257
334
+ routerConfigs: (_routerConfigs13 = {}, _routerConfigs13[RouterVersion.V1_2] = {
335
+ address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
336
+ creationBlock: 40237257
337
+ }, _routerConfigs13[RouterVersion.V2_0] = {
338
+ address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
339
+ creationBlock: 40237257
340
+ }, _routerConfigs13)
270
341
  }, _CHAIN_CONFIGS[84531] = {
271
- router: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
272
342
  weth: '0x4200000000000000000000000000000000000006',
273
- creationBlock: 6915289
343
+ routerConfigs: (_routerConfigs14 = {}, _routerConfigs14[RouterVersion.V1_2] = {
344
+ address: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
345
+ creationBlock: 6915289
346
+ }, _routerConfigs14[RouterVersion.V2_0] = {
347
+ address: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
348
+ creationBlock: 6915289
349
+ }, _routerConfigs14)
274
350
  }, _CHAIN_CONFIGS[8453] = {
275
- router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
276
351
  weth: '0x4200000000000000000000000000000000000006',
277
- creationBlock: 9107268
352
+ routerConfigs: (_routerConfigs15 = {}, _routerConfigs15[RouterVersion.V1_2] = {
353
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
354
+ creationBlock: 9107268
355
+ }, _routerConfigs15[RouterVersion.V2_0] = {
356
+ address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
357
+ creationBlock: 9107268
358
+ }, _routerConfigs15)
278
359
  }, _CHAIN_CONFIGS[81457] = {
279
- router: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
280
360
  weth: '0x4300000000000000000000000000000000000004',
281
- creationBlock: 1116444
361
+ routerConfigs: (_routerConfigs16 = {}, _routerConfigs16[RouterVersion.V1_2] = {
362
+ address: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
363
+ creationBlock: 1116444
364
+ }, _routerConfigs16[RouterVersion.V2_0] = {
365
+ address: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
366
+ creationBlock: 1116444
367
+ }, _routerConfigs16)
282
368
  }, _CHAIN_CONFIGS[7777777] = {
283
- router: '0x2986d9721A49838ab4297b695858aF7F17f38014',
284
369
  weth: '0x4200000000000000000000000000000000000006',
285
- creationBlock: 11832155
370
+ routerConfigs: (_routerConfigs17 = {}, _routerConfigs17[RouterVersion.V1_2] = {
371
+ address: '0x2986d9721A49838ab4297b695858aF7F17f38014',
372
+ creationBlock: 11832155
373
+ }, _routerConfigs17[RouterVersion.V2_0] = {
374
+ address: '0x2986d9721A49838ab4297b695858aF7F17f38014',
375
+ creationBlock: 11832155
376
+ }, _routerConfigs17)
286
377
  }, _CHAIN_CONFIGS[324] = {
287
- router: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
288
378
  weth: '0x5aea5775959fbc2557cc8789bc1bf90a239d9a91',
289
- creationBlock: 12640979
379
+ routerConfigs: (_routerConfigs18 = {}, _routerConfigs18[RouterVersion.V1_2] = {
380
+ address: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
381
+ creationBlock: 12640979
382
+ }, _routerConfigs18[RouterVersion.V2_0] = {
383
+ address: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
384
+ creationBlock: 12640979
385
+ }, _routerConfigs18)
290
386
  }, _CHAIN_CONFIGS);
291
- var UNIVERSAL_ROUTER_ADDRESS = function UNIVERSAL_ROUTER_ADDRESS(chainId) {
387
+ var UNIVERSAL_ROUTER_ADDRESS = function UNIVERSAL_ROUTER_ADDRESS(version, chainId) {
292
388
  if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);
293
- return CHAIN_CONFIGS[chainId].router;
389
+ return CHAIN_CONFIGS[chainId].routerConfigs[version].address;
294
390
  };
295
- var UNIVERSAL_ROUTER_CREATION_BLOCK = function UNIVERSAL_ROUTER_CREATION_BLOCK(chainId) {
391
+ var UNIVERSAL_ROUTER_CREATION_BLOCK = function UNIVERSAL_ROUTER_CREATION_BLOCK(version, chainId) {
296
392
  if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);
297
- return CHAIN_CONFIGS[chainId].creationBlock;
393
+ return CHAIN_CONFIGS[chainId].routerConfigs[version].creationBlock;
298
394
  };
299
395
  var WETH_ADDRESS = function WETH_ADDRESS(chainId) {
300
396
  if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);