@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.
- package/dist/index.d.ts +1 -1
- package/dist/universal-router-sdk.cjs.development.js +137 -41
- package/dist/universal-router-sdk.cjs.development.js.map +1 -1
- package/dist/universal-router-sdk.cjs.production.min.js +1 -1
- package/dist/universal-router-sdk.cjs.production.min.js.map +1 -1
- package/dist/universal-router-sdk.esm.js +137 -41
- package/dist/universal-router-sdk.esm.js.map +1 -1
- package/dist/utils/constants.d.ts +20 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { SwapRouter } from './swapRouter';
|
|
|
2
2
|
export * from './entities';
|
|
3
3
|
export * from './utils/routerTradeAdapter';
|
|
4
4
|
export { RoutePlanner, CommandType } from './utils/routerCommands';
|
|
5
|
-
export {
|
|
5
|
+
export { UNIVERSAL_ROUTER_CREATION_BLOCK, UNIVERSAL_ROUTER_ADDRESS, PERMIT2_ADDRESS, ROUTER_AS_RECIPIENT, WETH_ADDRESS, } from './utils/constants';
|
|
@@ -210,88 +210,184 @@ function createCommand(type, parameters) {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
var _CHAIN_CONFIGS;
|
|
213
|
+
var _routerConfigs, _routerConfigs2, _routerConfigs3, _routerConfigs4, _routerConfigs5, _routerConfigs6, _routerConfigs7, _routerConfigs8, _routerConfigs9, _routerConfigs10, _routerConfigs11, _routerConfigs12, _routerConfigs13, _routerConfigs14, _routerConfigs15, _routerConfigs16, _routerConfigs17, _routerConfigs18, _CHAIN_CONFIGS;
|
|
214
|
+
var RouterVersion;
|
|
215
|
+
(function (RouterVersion) {
|
|
216
|
+
RouterVersion[RouterVersion["V1_2"] = 0] = "V1_2";
|
|
217
|
+
RouterVersion[RouterVersion["V2_0"] = 1] = "V2_0";
|
|
218
|
+
})(RouterVersion || (RouterVersion = {}));
|
|
214
219
|
var WETH_NOT_SUPPORTED_ON_CHAIN = '0x0000000000000000000000000000000000000000';
|
|
220
|
+
// Todo: Change `CHAIN_CONFIGS` to pull the UR address with v4
|
|
215
221
|
var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
216
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
217
222
|
weth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
218
|
-
|
|
223
|
+
routerConfigs: (_routerConfigs = {}, _routerConfigs[RouterVersion.V1_2] = {
|
|
224
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
225
|
+
creationBlock: 17143817
|
|
226
|
+
}, _routerConfigs[RouterVersion.V2_0] = {
|
|
227
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
228
|
+
creationBlock: 17143817
|
|
229
|
+
}, _routerConfigs)
|
|
219
230
|
}, _CHAIN_CONFIGS[5] = {
|
|
220
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
221
231
|
weth: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6',
|
|
222
|
-
|
|
232
|
+
routerConfigs: (_routerConfigs2 = {}, _routerConfigs2[RouterVersion.V1_2] = {
|
|
233
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
234
|
+
creationBlock: 8940568
|
|
235
|
+
}, _routerConfigs2[RouterVersion.V2_0] = {
|
|
236
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
237
|
+
creationBlock: 8940568
|
|
238
|
+
}, _routerConfigs2)
|
|
223
239
|
}, _CHAIN_CONFIGS[11155111] = {
|
|
224
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
225
240
|
weth: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
226
|
-
|
|
241
|
+
routerConfigs: (_routerConfigs3 = {}, _routerConfigs3[RouterVersion.V1_2] = {
|
|
242
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
243
|
+
creationBlock: 3543575
|
|
244
|
+
}, _routerConfigs3[RouterVersion.V2_0] = {
|
|
245
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
246
|
+
creationBlock: 3543575
|
|
247
|
+
}, _routerConfigs3)
|
|
227
248
|
}, _CHAIN_CONFIGS[137] = {
|
|
228
|
-
router: '0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2',
|
|
229
249
|
weth: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
|
230
|
-
|
|
250
|
+
routerConfigs: (_routerConfigs4 = {}, _routerConfigs4[RouterVersion.V1_2] = {
|
|
251
|
+
address: '0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2',
|
|
252
|
+
creationBlock: 52210153
|
|
253
|
+
}, _routerConfigs4[RouterVersion.V2_0] = {
|
|
254
|
+
address: '0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2',
|
|
255
|
+
creationBlock: 52210153
|
|
256
|
+
}, _routerConfigs4)
|
|
231
257
|
}, _CHAIN_CONFIGS[80001] = {
|
|
232
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
233
258
|
weth: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889',
|
|
234
|
-
|
|
259
|
+
routerConfigs: (_routerConfigs5 = {}, _routerConfigs5[RouterVersion.V1_2] = {
|
|
260
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
261
|
+
creationBlock: 35176052
|
|
262
|
+
}, _routerConfigs5[RouterVersion.V2_0] = {
|
|
263
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
264
|
+
creationBlock: 35176052
|
|
265
|
+
}, _routerConfigs5)
|
|
235
266
|
}, _CHAIN_CONFIGS[10] = {
|
|
236
|
-
router: '0xCb1355ff08Ab38bBCE60111F1bb2B784bE25D7e8',
|
|
237
267
|
weth: '0x4200000000000000000000000000000000000006',
|
|
238
|
-
|
|
268
|
+
routerConfigs: (_routerConfigs6 = {}, _routerConfigs6[RouterVersion.V1_2] = {
|
|
269
|
+
address: '0xCb1355ff08Ab38bBCE60111F1bb2B784bE25D7e8',
|
|
270
|
+
creationBlock: 114702266
|
|
271
|
+
}, _routerConfigs6[RouterVersion.V2_0] = {
|
|
272
|
+
address: '0xCb1355ff08Ab38bBCE60111F1bb2B784bE25D7e8',
|
|
273
|
+
creationBlock: 114702266
|
|
274
|
+
}, _routerConfigs6)
|
|
239
275
|
}, _CHAIN_CONFIGS[420] = {
|
|
240
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
241
276
|
weth: '0x4200000000000000000000000000000000000006',
|
|
242
|
-
|
|
277
|
+
routerConfigs: (_routerConfigs7 = {}, _routerConfigs7[RouterVersion.V1_2] = {
|
|
278
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
279
|
+
creationBlock: 8887728
|
|
280
|
+
}, _routerConfigs7[RouterVersion.V2_0] = {
|
|
281
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
282
|
+
creationBlock: 8887728
|
|
283
|
+
}, _routerConfigs7)
|
|
243
284
|
}, _CHAIN_CONFIGS[42161] = {
|
|
244
|
-
router: '0x5E325eDA8064b456f4781070C0738d849c824258',
|
|
245
285
|
weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
|
|
246
|
-
|
|
286
|
+
routerConfigs: (_routerConfigs8 = {}, _routerConfigs8[RouterVersion.V1_2] = {
|
|
287
|
+
address: '0x5E325eDA8064b456f4781070C0738d849c824258',
|
|
288
|
+
creationBlock: 169472836
|
|
289
|
+
}, _routerConfigs8[RouterVersion.V2_0] = {
|
|
290
|
+
address: '0x5E325eDA8064b456f4781070C0738d849c824258',
|
|
291
|
+
creationBlock: 169472836
|
|
292
|
+
}, _routerConfigs8)
|
|
247
293
|
}, _CHAIN_CONFIGS[421613] = {
|
|
248
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
249
294
|
weth: '0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3',
|
|
250
|
-
|
|
295
|
+
routerConfigs: (_routerConfigs9 = {}, _routerConfigs9[RouterVersion.V1_2] = {
|
|
296
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
297
|
+
creationBlock: 18815277
|
|
298
|
+
}, _routerConfigs9[RouterVersion.V2_0] = {
|
|
299
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
300
|
+
creationBlock: 18815277
|
|
301
|
+
}, _routerConfigs9)
|
|
251
302
|
}, _CHAIN_CONFIGS[42220] = {
|
|
252
|
-
router: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
|
|
253
303
|
weth: WETH_NOT_SUPPORTED_ON_CHAIN,
|
|
254
|
-
|
|
304
|
+
routerConfigs: (_routerConfigs10 = {}, _routerConfigs10[RouterVersion.V1_2] = {
|
|
305
|
+
address: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
|
|
306
|
+
creationBlock: 21407637
|
|
307
|
+
}, _routerConfigs10[RouterVersion.V2_0] = {
|
|
308
|
+
address: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
|
|
309
|
+
creationBlock: 21407637
|
|
310
|
+
}, _routerConfigs10)
|
|
255
311
|
}, _CHAIN_CONFIGS[44787] = {
|
|
256
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
257
312
|
weth: WETH_NOT_SUPPORTED_ON_CHAIN,
|
|
258
|
-
|
|
313
|
+
routerConfigs: (_routerConfigs11 = {}, _routerConfigs11[RouterVersion.V1_2] = {
|
|
314
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
315
|
+
creationBlock: 17566658
|
|
316
|
+
}, _routerConfigs11[RouterVersion.V2_0] = {
|
|
317
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
318
|
+
creationBlock: 17566658
|
|
319
|
+
}, _routerConfigs11)
|
|
259
320
|
}, _CHAIN_CONFIGS[56] = {
|
|
260
|
-
router: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
261
321
|
weth: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
|
|
262
|
-
|
|
322
|
+
routerConfigs: (_routerConfigs12 = {}, _routerConfigs12[RouterVersion.V1_2] = {
|
|
323
|
+
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
324
|
+
creationBlock: 35160263
|
|
325
|
+
}, _routerConfigs12[RouterVersion.V2_0] = {
|
|
326
|
+
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
327
|
+
creationBlock: 35160263
|
|
328
|
+
}, _routerConfigs12)
|
|
263
329
|
}, _CHAIN_CONFIGS[43114] = {
|
|
264
|
-
router: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
265
330
|
weth: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
|
|
266
|
-
|
|
331
|
+
routerConfigs: (_routerConfigs13 = {}, _routerConfigs13[RouterVersion.V1_2] = {
|
|
332
|
+
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
333
|
+
creationBlock: 40237257
|
|
334
|
+
}, _routerConfigs13[RouterVersion.V2_0] = {
|
|
335
|
+
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
336
|
+
creationBlock: 40237257
|
|
337
|
+
}, _routerConfigs13)
|
|
267
338
|
}, _CHAIN_CONFIGS[84531] = {
|
|
268
|
-
router: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
|
|
269
339
|
weth: '0x4200000000000000000000000000000000000006',
|
|
270
|
-
|
|
340
|
+
routerConfigs: (_routerConfigs14 = {}, _routerConfigs14[RouterVersion.V1_2] = {
|
|
341
|
+
address: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
|
|
342
|
+
creationBlock: 6915289
|
|
343
|
+
}, _routerConfigs14[RouterVersion.V2_0] = {
|
|
344
|
+
address: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
|
|
345
|
+
creationBlock: 6915289
|
|
346
|
+
}, _routerConfigs14)
|
|
271
347
|
}, _CHAIN_CONFIGS[8453] = {
|
|
272
|
-
router: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
273
348
|
weth: '0x4200000000000000000000000000000000000006',
|
|
274
|
-
|
|
349
|
+
routerConfigs: (_routerConfigs15 = {}, _routerConfigs15[RouterVersion.V1_2] = {
|
|
350
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
351
|
+
creationBlock: 9107268
|
|
352
|
+
}, _routerConfigs15[RouterVersion.V2_0] = {
|
|
353
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
354
|
+
creationBlock: 9107268
|
|
355
|
+
}, _routerConfigs15)
|
|
275
356
|
}, _CHAIN_CONFIGS[81457] = {
|
|
276
|
-
router: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
|
|
277
357
|
weth: '0x4300000000000000000000000000000000000004',
|
|
278
|
-
|
|
358
|
+
routerConfigs: (_routerConfigs16 = {}, _routerConfigs16[RouterVersion.V1_2] = {
|
|
359
|
+
address: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
|
|
360
|
+
creationBlock: 1116444
|
|
361
|
+
}, _routerConfigs16[RouterVersion.V2_0] = {
|
|
362
|
+
address: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
|
|
363
|
+
creationBlock: 1116444
|
|
364
|
+
}, _routerConfigs16)
|
|
279
365
|
}, _CHAIN_CONFIGS[7777777] = {
|
|
280
|
-
router: '0x2986d9721A49838ab4297b695858aF7F17f38014',
|
|
281
366
|
weth: '0x4200000000000000000000000000000000000006',
|
|
282
|
-
|
|
367
|
+
routerConfigs: (_routerConfigs17 = {}, _routerConfigs17[RouterVersion.V1_2] = {
|
|
368
|
+
address: '0x2986d9721A49838ab4297b695858aF7F17f38014',
|
|
369
|
+
creationBlock: 11832155
|
|
370
|
+
}, _routerConfigs17[RouterVersion.V2_0] = {
|
|
371
|
+
address: '0x2986d9721A49838ab4297b695858aF7F17f38014',
|
|
372
|
+
creationBlock: 11832155
|
|
373
|
+
}, _routerConfigs17)
|
|
283
374
|
}, _CHAIN_CONFIGS[324] = {
|
|
284
|
-
router: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
|
|
285
375
|
weth: '0x5aea5775959fbc2557cc8789bc1bf90a239d9a91',
|
|
286
|
-
|
|
376
|
+
routerConfigs: (_routerConfigs18 = {}, _routerConfigs18[RouterVersion.V1_2] = {
|
|
377
|
+
address: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
|
|
378
|
+
creationBlock: 12640979
|
|
379
|
+
}, _routerConfigs18[RouterVersion.V2_0] = {
|
|
380
|
+
address: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
|
|
381
|
+
creationBlock: 12640979
|
|
382
|
+
}, _routerConfigs18)
|
|
287
383
|
}, _CHAIN_CONFIGS);
|
|
288
|
-
var UNIVERSAL_ROUTER_ADDRESS = function UNIVERSAL_ROUTER_ADDRESS(chainId) {
|
|
384
|
+
var UNIVERSAL_ROUTER_ADDRESS = function UNIVERSAL_ROUTER_ADDRESS(version, chainId) {
|
|
289
385
|
if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);
|
|
290
|
-
return CHAIN_CONFIGS[chainId].
|
|
386
|
+
return CHAIN_CONFIGS[chainId].routerConfigs[version].address;
|
|
291
387
|
};
|
|
292
|
-
var UNIVERSAL_ROUTER_CREATION_BLOCK = function UNIVERSAL_ROUTER_CREATION_BLOCK(chainId) {
|
|
388
|
+
var UNIVERSAL_ROUTER_CREATION_BLOCK = function UNIVERSAL_ROUTER_CREATION_BLOCK(version, chainId) {
|
|
293
389
|
if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);
|
|
294
|
-
return CHAIN_CONFIGS[chainId].creationBlock;
|
|
390
|
+
return CHAIN_CONFIGS[chainId].routerConfigs[version].creationBlock;
|
|
295
391
|
};
|
|
296
392
|
var WETH_ADDRESS = function WETH_ADDRESS(chainId) {
|
|
297
393
|
if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);
|