@ring-protocol/universal-router-sdk 0.1.30 → 0.1.32
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/universal-router-sdk.cjs.development.js +72 -42
- 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 +72 -42
- package/dist/universal-router-sdk.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -457,7 +457,7 @@ function getPathCurrency(currency, pool) {
|
|
|
457
457
|
RouterActionType["UnwrapWETH"] = "UnwrapWETH";
|
|
458
458
|
})(exports.RouterActionType || (exports.RouterActionType = {}));
|
|
459
459
|
|
|
460
|
-
var _routerConfigs, _routerConfigs2, _routerConfigs3, _routerConfigs4, _routerConfigs5, _routerConfigs6, _routerConfigs7, _routerConfigs8, _routerConfigs9, _routerConfigs0, _routerConfigs1, _routerConfigs10, _routerConfigs11, _routerConfigs12, _routerConfigs13, _routerConfigs14, _routerConfigs15, _routerConfigs16, _routerConfigs17, _routerConfigs18, _routerConfigs19, _routerConfigs20, _routerConfigs21, _routerConfigs22, _routerConfigs23, _routerConfigs24, _CHAIN_CONFIGS;
|
|
460
|
+
var _routerConfigs, _routerConfigs2, _routerConfigs3, _routerConfigs4, _routerConfigs5, _routerConfigs6, _routerConfigs7, _routerConfigs8, _routerConfigs9, _routerConfigs0, _routerConfigs1, _routerConfigs10, _routerConfigs11, _routerConfigs12, _routerConfigs13, _routerConfigs14, _routerConfigs15, _routerConfigs16, _routerConfigs17, _routerConfigs18, _routerConfigs19, _routerConfigs20, _routerConfigs21, _routerConfigs22, _routerConfigs23, _routerConfigs24, _routerConfigs25, _routerConfigs26, _routerConfigs27, _routerConfigs28, _CHAIN_CONFIGS;
|
|
461
461
|
(function (UniversalRouterVersion) {
|
|
462
462
|
UniversalRouterVersion["V1_2"] = "1.2";
|
|
463
463
|
UniversalRouterVersion["V2_0"] = "2.0";
|
|
@@ -470,8 +470,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
470
470
|
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
471
471
|
creationBlock: 17143817
|
|
472
472
|
}, _routerConfigs[exports.UniversalRouterVersion.V2_0] = {
|
|
473
|
-
address: '
|
|
474
|
-
creationBlock:
|
|
473
|
+
address: '0x24e743CcE93235641f2be8Ce7ffC6330903ab96f',
|
|
474
|
+
creationBlock: 17143817
|
|
475
475
|
}, _routerConfigs)
|
|
476
476
|
}, _CHAIN_CONFIGS[5] = {
|
|
477
477
|
weth: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6',
|
|
@@ -479,7 +479,7 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
479
479
|
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
480
480
|
creationBlock: 8940568
|
|
481
481
|
}, _routerConfigs2[exports.UniversalRouterVersion.V2_0] = {
|
|
482
|
-
address: '
|
|
482
|
+
address: '0xEc6b9a7FE7C7c751E6490648e05C5010DDfe0469',
|
|
483
483
|
creationBlock: 8940568
|
|
484
484
|
}, _routerConfigs2)
|
|
485
485
|
}, _CHAIN_CONFIGS[11155111] = {
|
|
@@ -488,8 +488,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
488
488
|
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
489
489
|
creationBlock: 3543575
|
|
490
490
|
}, _routerConfigs3[exports.UniversalRouterVersion.V2_0] = {
|
|
491
|
-
address: '
|
|
492
|
-
creationBlock:
|
|
491
|
+
address: '0x97974e98fa4734CD2fBA2aFB4063012679a2f56A',
|
|
492
|
+
creationBlock: 9024677
|
|
493
493
|
}, _routerConfigs3)
|
|
494
494
|
}, _CHAIN_CONFIGS[137] = {
|
|
495
495
|
weth: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
|
@@ -497,8 +497,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
497
497
|
address: '0xec7BE89e9d109e7e3Fec59c222CF297125FEFda2',
|
|
498
498
|
creationBlock: 52210153
|
|
499
499
|
}, _routerConfigs4[exports.UniversalRouterVersion.V2_0] = {
|
|
500
|
-
address: '
|
|
501
|
-
creationBlock:
|
|
500
|
+
address: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
|
|
501
|
+
creationBlock: 46866777
|
|
502
502
|
}, _routerConfigs4)
|
|
503
503
|
}, _CHAIN_CONFIGS[80001] = {
|
|
504
504
|
weth: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889',
|
|
@@ -515,8 +515,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
515
515
|
address: '0xCb1355ff08Ab38bBCE60111F1bb2B784bE25D7e8',
|
|
516
516
|
creationBlock: 114702266
|
|
517
517
|
}, _routerConfigs6[exports.UniversalRouterVersion.V2_0] = {
|
|
518
|
-
address: '
|
|
519
|
-
creationBlock:
|
|
518
|
+
address: '0xeC8B0F7Ffe3ae75d7FfAb09429e3675bb63503e4',
|
|
519
|
+
creationBlock: 108825869
|
|
520
520
|
}, _routerConfigs6)
|
|
521
521
|
}, _CHAIN_CONFIGS[420] = {
|
|
522
522
|
weth: '0x4200000000000000000000000000000000000006',
|
|
@@ -533,8 +533,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
533
533
|
address: '0x5E325eDA8064b456f4781070C0738d849c824258',
|
|
534
534
|
creationBlock: 169472836
|
|
535
535
|
}, _routerConfigs8[exports.UniversalRouterVersion.V2_0] = {
|
|
536
|
-
address: '
|
|
537
|
-
creationBlock:
|
|
536
|
+
address: '0x4e30E64faeF7c9Aee835904a48DC27eDA40e2CA7',
|
|
537
|
+
creationBlock: 285583808
|
|
538
538
|
}, _routerConfigs8)
|
|
539
539
|
}, _CHAIN_CONFIGS[421613] = {
|
|
540
540
|
weth: '0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3',
|
|
@@ -551,8 +551,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
551
551
|
address: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
|
|
552
552
|
creationBlock: 21407637
|
|
553
553
|
}, _routerConfigs0[exports.UniversalRouterVersion.V2_0] = {
|
|
554
|
-
address: '
|
|
555
|
-
creationBlock:
|
|
554
|
+
address: '0x88a3ED7F21A3fCF6adb86b6F878C5B7a02D20e9b',
|
|
555
|
+
creationBlock: 21116361
|
|
556
556
|
}, _routerConfigs0)
|
|
557
557
|
}, _CHAIN_CONFIGS[44787] = {
|
|
558
558
|
weth: WETH_NOT_SUPPORTED_ON_CHAIN,
|
|
@@ -569,8 +569,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
569
569
|
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
570
570
|
creationBlock: 35160263
|
|
571
571
|
}, _routerConfigs10[exports.UniversalRouterVersion.V2_0] = {
|
|
572
|
-
address: '
|
|
573
|
-
creationBlock:
|
|
572
|
+
address: '0x1Fb6ef969D925f0B81245cE28F2cAD95b638CfCC',
|
|
573
|
+
creationBlock: 56739372
|
|
574
574
|
}, _routerConfigs10)
|
|
575
575
|
}, _CHAIN_CONFIGS[43114] = {
|
|
576
576
|
weth: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
|
|
@@ -578,8 +578,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
578
578
|
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
579
579
|
creationBlock: 40237257
|
|
580
580
|
}, _routerConfigs11[exports.UniversalRouterVersion.V2_0] = {
|
|
581
|
-
address: '
|
|
582
|
-
creationBlock:
|
|
581
|
+
address: '0x82635AF6146972cD6601161c4472ffe97237D292',
|
|
582
|
+
creationBlock: 34491144
|
|
583
583
|
}, _routerConfigs11)
|
|
584
584
|
}, _CHAIN_CONFIGS[84531] = {
|
|
585
585
|
weth: '0x4200000000000000000000000000000000000006',
|
|
@@ -596,8 +596,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
596
596
|
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
597
597
|
creationBlock: 9107268
|
|
598
598
|
}, _routerConfigs13[exports.UniversalRouterVersion.V2_0] = {
|
|
599
|
-
address: '
|
|
600
|
-
creationBlock:
|
|
599
|
+
address: '0xcc1d0c42CC672Fcb610Db8934635Acd0F605Fd86',
|
|
600
|
+
creationBlock: 23766578
|
|
601
601
|
}, _routerConfigs13)
|
|
602
602
|
}, _CHAIN_CONFIGS[81457] = {
|
|
603
603
|
weth: '0x4300000000000000000000000000000000000004',
|
|
@@ -605,8 +605,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
605
605
|
address: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
|
|
606
606
|
creationBlock: 1116444
|
|
607
607
|
}, _routerConfigs14[exports.UniversalRouterVersion.V2_0] = {
|
|
608
|
-
address: '
|
|
609
|
-
creationBlock:
|
|
608
|
+
address: '0x404Fd85edAe4501eCeB32Ca6ac603D9529df7AfB',
|
|
609
|
+
creationBlock: 165686
|
|
610
610
|
}, _routerConfigs14)
|
|
611
611
|
}, _CHAIN_CONFIGS[7777777] = {
|
|
612
612
|
weth: '0x4200000000000000000000000000000000000006',
|
|
@@ -641,8 +641,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
641
641
|
address: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6',
|
|
642
642
|
creationBlock: 1241811
|
|
643
643
|
}, _routerConfigs18[exports.UniversalRouterVersion.V2_0] = {
|
|
644
|
-
address: '
|
|
645
|
-
creationBlock:
|
|
644
|
+
address: '0xC9DD682A06dbf10D91e2adbdAC70f3Adb8a3f201',
|
|
645
|
+
creationBlock: 165686
|
|
646
646
|
}, _routerConfigs18)
|
|
647
647
|
}, _CHAIN_CONFIGS[130] = {
|
|
648
648
|
weth: '0x4200000000000000000000000000000000000006',
|
|
@@ -650,8 +650,8 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
650
650
|
address: '0x4D73A4411CA1c660035e4AECC8270E5DdDEC8C17',
|
|
651
651
|
creationBlock: 23678
|
|
652
652
|
}, _routerConfigs19[exports.UniversalRouterVersion.V2_0] = {
|
|
653
|
-
address: '
|
|
654
|
-
creationBlock:
|
|
653
|
+
address: '0xa7f0381288753e01171752483413E53f8D7faf4D',
|
|
654
|
+
creationBlock: 8799030
|
|
655
655
|
}, _routerConfigs19)
|
|
656
656
|
}, _CHAIN_CONFIGS[10143] = {
|
|
657
657
|
weth: '0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701',
|
|
@@ -680,24 +680,60 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
680
680
|
address: '0x0e2850543f69f678257266e0907ff9a58b3f13de',
|
|
681
681
|
creationBlock: 3254782
|
|
682
682
|
}, _routerConfigs22)
|
|
683
|
-
}, _CHAIN_CONFIGS[
|
|
684
|
-
weth: '
|
|
683
|
+
}, _CHAIN_CONFIGS[168587773] = {
|
|
684
|
+
weth: '0x4200000000000000000000000000000000000023',
|
|
685
685
|
routerConfigs: (_routerConfigs23 = {}, _routerConfigs23[exports.UniversalRouterVersion.V1_2] = {
|
|
686
|
-
address: '
|
|
687
|
-
creationBlock:
|
|
686
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
687
|
+
creationBlock: 3273124
|
|
688
688
|
}, _routerConfigs23[exports.UniversalRouterVersion.V2_0] = {
|
|
689
|
-
address: '
|
|
690
|
-
creationBlock:
|
|
689
|
+
address: '0x899FAeDA183A26Ae7085C82e5E057E90bdb75283',
|
|
690
|
+
creationBlock: 3273124
|
|
691
691
|
}, _routerConfigs23)
|
|
692
|
+
}, _CHAIN_CONFIGS[421614] = {
|
|
693
|
+
weth: '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
|
|
694
|
+
routerConfigs: (_routerConfigs24 = {}, _routerConfigs24[exports.UniversalRouterVersion.V1_2] = {
|
|
695
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
696
|
+
creationBlock: 104439157
|
|
697
|
+
}, _routerConfigs24[exports.UniversalRouterVersion.V2_0] = {
|
|
698
|
+
address: '0x6Db48677E616921d70fe4c88aAB62665Efffe4A8',
|
|
699
|
+
creationBlock: 104439157
|
|
700
|
+
}, _routerConfigs24)
|
|
701
|
+
}, _CHAIN_CONFIGS[1516] = {
|
|
702
|
+
weth: '0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5',
|
|
703
|
+
routerConfigs: (_routerConfigs25 = {}, _routerConfigs25[exports.UniversalRouterVersion.V1_2] = {
|
|
704
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
705
|
+
creationBlock: 2240752
|
|
706
|
+
}, _routerConfigs25[exports.UniversalRouterVersion.V2_0] = {
|
|
707
|
+
address: '0x20504f37A95eF80e3FC7476c4801fb39AaE6bAd0',
|
|
708
|
+
creationBlock: 2240752
|
|
709
|
+
}, _routerConfigs25)
|
|
710
|
+
}, _CHAIN_CONFIGS[1514] = {
|
|
711
|
+
weth: '0x1514000000000000000000000000000000000000',
|
|
712
|
+
routerConfigs: (_routerConfigs26 = {}, _routerConfigs26[exports.UniversalRouterVersion.V1_2] = {
|
|
713
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
714
|
+
creationBlock: 2305094
|
|
715
|
+
}, _routerConfigs26[exports.UniversalRouterVersion.V2_0] = {
|
|
716
|
+
address: '0x5dF345fB4e5F4791869bFD9cbCa941D931e6E781',
|
|
717
|
+
creationBlock: 2305094
|
|
718
|
+
}, _routerConfigs26)
|
|
719
|
+
}, _CHAIN_CONFIGS[196] = {
|
|
720
|
+
weth: '0xe538905cf8410324e03A5A23C1c177a474D59b2b',
|
|
721
|
+
routerConfigs: (_routerConfigs27 = {}, _routerConfigs27[exports.UniversalRouterVersion.V1_2] = {
|
|
722
|
+
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
723
|
+
creationBlock: 196
|
|
724
|
+
}, _routerConfigs27[exports.UniversalRouterVersion.V2_0] = {
|
|
725
|
+
address: '0x6ae74ec9d067c734060fc5edb66fc6d48682970e',
|
|
726
|
+
creationBlock: 196
|
|
727
|
+
}, _routerConfigs27)
|
|
692
728
|
}, _CHAIN_CONFIGS[999] = {
|
|
693
729
|
weth: '0x5555555555555555555555555555555555555555',
|
|
694
|
-
routerConfigs: (
|
|
730
|
+
routerConfigs: (_routerConfigs28 = {}, _routerConfigs28[exports.UniversalRouterVersion.V1_2] = {
|
|
695
731
|
address: '0x7d3D28dee339C17452A4d6b53C71b2557278B530',
|
|
696
732
|
creationBlock: 9273064
|
|
697
|
-
},
|
|
698
|
-
address: '
|
|
733
|
+
}, _routerConfigs28[exports.UniversalRouterVersion.V2_0] = {
|
|
734
|
+
address: '0xE65081EFa5ad4A196B1Df768716c337e6AB140E9',
|
|
699
735
|
creationBlock: 9273064
|
|
700
|
-
},
|
|
736
|
+
}, _routerConfigs28)
|
|
701
737
|
}, _CHAIN_CONFIGS);
|
|
702
738
|
var UNIVERSAL_ROUTER_ADDRESS = function UNIVERSAL_ROUTER_ADDRESS(version, chainId) {
|
|
703
739
|
if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);
|
|
@@ -969,9 +1005,7 @@ function addRingV2Swap(planner, _ref, tradeType, options, payerIsUser, routerMus
|
|
|
969
1005
|
return token.wrapped.address;
|
|
970
1006
|
}), payerIsUser]);
|
|
971
1007
|
}
|
|
972
|
-
console.log('before fewOutputToken 375', trade.outputAmount.currency.wrapped, trade.outputAmount.currency.chainId);
|
|
973
1008
|
var fewOutputToken = fewV2Sdk.getFewTokenFromOriginalToken(trade.outputAmount.currency.wrapped, trade.outputAmount.currency.chainId);
|
|
974
|
-
console.log('after fewOutputToken380', fewOutputToken, trade.outputAmount.currency.wrapped, trade.outputAmount.currency.chainId);
|
|
975
1009
|
var fwWETH = FEW_WRAPPED_NATIVE_CURRENCY[trade.inputAmount.currency.wrapped.chainId];
|
|
976
1010
|
if (outputAmount.currency.isNative) {
|
|
977
1011
|
planner.addCommand(exports.CommandType.UNWRAP_FEW_TOKEN, [fwWETH.address, ROUTER_AS_RECIPIENT, trade.minimumAmountOut(options.slippageTolerance).quotient.toString()]);
|
|
@@ -1012,9 +1046,7 @@ function addV2Swap(planner, _ref2, tradeType, options, payerIsUser, routerMustCu
|
|
|
1012
1046
|
return token.wrapped.address;
|
|
1013
1047
|
}), payerIsUser]);
|
|
1014
1048
|
}
|
|
1015
|
-
console.log('before fewOutputToken 460', trade.outputAmount.currency.wrapped, trade.outputAmount.currency.chainId);
|
|
1016
1049
|
var fewOutputToken = fewV2Sdk.getFewTokenFromOriginalToken(trade.outputAmount.currency.wrapped, trade.outputAmount.currency.chainId);
|
|
1017
|
-
console.log('after fewOutputToken465', fewOutputToken, trade.outputAmount.currency.wrapped, trade.outputAmount.currency.chainId);
|
|
1018
1050
|
if (fewV2Sdk.isFewToken(pathInput.wrapped) && fewV2Sdk.isFewToken(pathOutput.wrapped)) {
|
|
1019
1051
|
if (outputAmount.currency.isNative) {
|
|
1020
1052
|
planner.addCommand(exports.CommandType.UNWRAP_FEW_TOKEN, [fewOutputToken.address, ROUTER_AS_RECIPIENT, trade.minimumAmountOut(options.slippageTolerance).quotient.toString()]);
|
|
@@ -1110,7 +1142,6 @@ function addV4Swap(swaps, planner, _ref4, tradeType, options, payerIsUser, route
|
|
|
1110
1142
|
var v4Route = new v4Sdk.Route(pools, inputAmount.currency, outputAmount.currency);
|
|
1111
1143
|
if (fewV2Sdk.isFewToken(route.pools[0].token0.wrapped) && fewV2Sdk.isFewToken(route.pools[0].token1.wrapped)) {
|
|
1112
1144
|
var _options$recipient;
|
|
1113
|
-
console.log('isFewToken v4 633', fewV2Sdk.isFewToken(route.pools[0].token0.wrapped), fewV2Sdk.isFewToken(route.pools[0].token1.wrapped));
|
|
1114
1145
|
var fewCurrencyIn = fewV2Sdk.getFewTokenFromOriginalToken(inputAmount.currency.wrapped, inputAmount.currency.chainId);
|
|
1115
1146
|
var fewCurrencyOut = fewV2Sdk.getFewTokenFromOriginalToken(outputAmount.currency.wrapped, outputAmount.currency.chainId);
|
|
1116
1147
|
var fewV4Route = new v4Sdk.Route(pools, fewCurrencyIn, fewCurrencyOut);
|
|
@@ -1149,7 +1180,6 @@ function addV4Swap(swaps, planner, _ref4, tradeType, options, payerIsUser, route
|
|
|
1149
1180
|
}
|
|
1150
1181
|
} else {
|
|
1151
1182
|
var _options$recipient2;
|
|
1152
|
-
console.log('isFewToken v4 701', fewV2Sdk.isFewToken(route.pools[0].token0.wrapped), fewV2Sdk.isFewToken(route.pools[0].token1.wrapped));
|
|
1153
1183
|
var trade = v4Sdk.Trade.createUncheckedTrade({
|
|
1154
1184
|
route: v4Route,
|
|
1155
1185
|
inputAmount: inputAmount,
|