@uniswap/universal-router-sdk 4.19.6 → 4.20.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/universal-router-sdk.cjs.development.js +92 -55
- 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 +92 -55
- package/dist/universal-router-sdk.esm.js.map +1 -1
- package/package.json +5 -5
|
@@ -392,7 +392,7 @@ var RouterActionType;
|
|
|
392
392
|
RouterActionType["UnwrapWETH"] = "UnwrapWETH";
|
|
393
393
|
})(RouterActionType || (RouterActionType = {}));
|
|
394
394
|
|
|
395
|
-
var _routerConfigs, _routerConfigs2, _routerConfigs3, _routerConfigs4, _routerConfigs5, _routerConfigs6, _routerConfigs7, _routerConfigs8, _routerConfigs9, _routerConfigs10, _routerConfigs11, _routerConfigs12, _routerConfigs13, _routerConfigs14, _routerConfigs15, _routerConfigs16, _routerConfigs17, _routerConfigs18, _routerConfigs19, _routerConfigs20, _routerConfigs21, _routerConfigs22, _routerConfigs23,
|
|
395
|
+
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, _CHAIN_CONFIGS;
|
|
396
396
|
var UniversalRouterVersion;
|
|
397
397
|
(function (UniversalRouterVersion) {
|
|
398
398
|
UniversalRouterVersion["V1_2"] = "1.2";
|
|
@@ -483,139 +483,148 @@ var CHAIN_CONFIGS = (_CHAIN_CONFIGS = {}, _CHAIN_CONFIGS[1] = {
|
|
|
483
483
|
}, _routerConfigs9)
|
|
484
484
|
}, _CHAIN_CONFIGS[42220] = {
|
|
485
485
|
weth: WETH_NOT_SUPPORTED_ON_CHAIN,
|
|
486
|
-
routerConfigs: (
|
|
486
|
+
routerConfigs: (_routerConfigs0 = {}, _routerConfigs0[UniversalRouterVersion.V1_2] = {
|
|
487
487
|
address: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
|
|
488
488
|
creationBlock: 21407637
|
|
489
|
-
},
|
|
489
|
+
}, _routerConfigs0[UniversalRouterVersion.V2_0] = {
|
|
490
490
|
address: '0x643770e279d5d0733f21d6dc03a8efbabf3255b4',
|
|
491
491
|
creationBlock: 21407637
|
|
492
|
-
},
|
|
492
|
+
}, _routerConfigs0)
|
|
493
493
|
}, _CHAIN_CONFIGS[44787] = {
|
|
494
494
|
weth: WETH_NOT_SUPPORTED_ON_CHAIN,
|
|
495
|
-
routerConfigs: (
|
|
495
|
+
routerConfigs: (_routerConfigs1 = {}, _routerConfigs1[UniversalRouterVersion.V1_2] = {
|
|
496
496
|
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
497
497
|
creationBlock: 17566658
|
|
498
|
-
},
|
|
498
|
+
}, _routerConfigs1[UniversalRouterVersion.V2_0] = {
|
|
499
499
|
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
500
500
|
creationBlock: 17566658
|
|
501
|
-
},
|
|
501
|
+
}, _routerConfigs1)
|
|
502
502
|
}, _CHAIN_CONFIGS[56] = {
|
|
503
503
|
weth: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
|
|
504
|
-
routerConfigs: (
|
|
504
|
+
routerConfigs: (_routerConfigs10 = {}, _routerConfigs10[UniversalRouterVersion.V1_2] = {
|
|
505
505
|
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
506
506
|
creationBlock: 35160263
|
|
507
|
-
},
|
|
507
|
+
}, _routerConfigs10[UniversalRouterVersion.V2_0] = {
|
|
508
508
|
address: '0x1906c1d672b88cd1b9ac7593301ca990f94eae07',
|
|
509
509
|
creationBlock: 1737493275
|
|
510
|
-
},
|
|
510
|
+
}, _routerConfigs10)
|
|
511
511
|
}, _CHAIN_CONFIGS[43114] = {
|
|
512
512
|
weth: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
|
|
513
|
-
routerConfigs: (
|
|
513
|
+
routerConfigs: (_routerConfigs11 = {}, _routerConfigs11[UniversalRouterVersion.V1_2] = {
|
|
514
514
|
address: '0x4Dae2f939ACf50408e13d58534Ff8c2776d45265',
|
|
515
515
|
creationBlock: 40237257
|
|
516
|
-
},
|
|
516
|
+
}, _routerConfigs11[UniversalRouterVersion.V2_0] = {
|
|
517
517
|
address: '0x94b75331ae8d42c1b61065089b7d48fe14aa73b7',
|
|
518
518
|
creationBlock: 1737558236
|
|
519
|
-
},
|
|
519
|
+
}, _routerConfigs11)
|
|
520
520
|
}, _CHAIN_CONFIGS[84531] = {
|
|
521
521
|
weth: '0x4200000000000000000000000000000000000006',
|
|
522
|
-
routerConfigs: (
|
|
522
|
+
routerConfigs: (_routerConfigs12 = {}, _routerConfigs12[UniversalRouterVersion.V1_2] = {
|
|
523
523
|
address: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
|
|
524
524
|
creationBlock: 6915289
|
|
525
|
-
},
|
|
525
|
+
}, _routerConfigs12[UniversalRouterVersion.V2_0] = {
|
|
526
526
|
address: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',
|
|
527
527
|
creationBlock: 6915289
|
|
528
|
-
},
|
|
528
|
+
}, _routerConfigs12)
|
|
529
529
|
}, _CHAIN_CONFIGS[8453] = {
|
|
530
530
|
weth: '0x4200000000000000000000000000000000000006',
|
|
531
|
-
routerConfigs: (
|
|
531
|
+
routerConfigs: (_routerConfigs13 = {}, _routerConfigs13[UniversalRouterVersion.V1_2] = {
|
|
532
532
|
address: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',
|
|
533
533
|
creationBlock: 9107268
|
|
534
|
-
},
|
|
534
|
+
}, _routerConfigs13[UniversalRouterVersion.V2_0] = {
|
|
535
535
|
address: '0x6ff5693b99212da76ad316178a184ab56d299b43',
|
|
536
536
|
creationBlock: 1737491485
|
|
537
|
-
},
|
|
537
|
+
}, _routerConfigs13)
|
|
538
538
|
}, _CHAIN_CONFIGS[81457] = {
|
|
539
539
|
weth: '0x4300000000000000000000000000000000000004',
|
|
540
|
-
routerConfigs: (
|
|
540
|
+
routerConfigs: (_routerConfigs14 = {}, _routerConfigs14[UniversalRouterVersion.V1_2] = {
|
|
541
541
|
address: '0x643770E279d5D0733F21d6DC03A8efbABf3255B4',
|
|
542
542
|
creationBlock: 1116444
|
|
543
|
-
},
|
|
543
|
+
}, _routerConfigs14[UniversalRouterVersion.V2_0] = {
|
|
544
544
|
address: '0xeabbcb3e8e415306207ef514f660a3f820025be3',
|
|
545
545
|
creationBlock: 1737564586
|
|
546
|
-
},
|
|
546
|
+
}, _routerConfigs14)
|
|
547
547
|
}, _CHAIN_CONFIGS[7777777] = {
|
|
548
548
|
weth: '0x4200000000000000000000000000000000000006',
|
|
549
|
-
routerConfigs: (
|
|
549
|
+
routerConfigs: (_routerConfigs15 = {}, _routerConfigs15[UniversalRouterVersion.V1_2] = {
|
|
550
550
|
address: '0x2986d9721A49838ab4297b695858aF7F17f38014',
|
|
551
551
|
creationBlock: 11832155
|
|
552
|
-
},
|
|
552
|
+
}, _routerConfigs15[UniversalRouterVersion.V2_0] = {
|
|
553
553
|
address: '0x3315ef7ca28db74abadc6c44570efdf06b04b020',
|
|
554
554
|
creationBlock: 1737562927
|
|
555
|
-
},
|
|
555
|
+
}, _routerConfigs15)
|
|
556
556
|
}, _CHAIN_CONFIGS[324] = {
|
|
557
557
|
weth: '0x5aea5775959fbc2557cc8789bc1bf90a239d9a91',
|
|
558
|
-
routerConfigs: (
|
|
558
|
+
routerConfigs: (_routerConfigs16 = {}, _routerConfigs16[UniversalRouterVersion.V1_2] = {
|
|
559
559
|
address: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
|
|
560
560
|
creationBlock: 12640979
|
|
561
|
-
},
|
|
561
|
+
}, _routerConfigs16[UniversalRouterVersion.V2_0] = {
|
|
562
562
|
address: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',
|
|
563
563
|
creationBlock: 12640979
|
|
564
|
-
},
|
|
564
|
+
}, _routerConfigs16)
|
|
565
565
|
}, _CHAIN_CONFIGS[480] = {
|
|
566
566
|
weth: '0x4200000000000000000000000000000000000006',
|
|
567
|
-
routerConfigs: (
|
|
567
|
+
routerConfigs: (_routerConfigs17 = {}, _routerConfigs17[UniversalRouterVersion.V1_2] = {
|
|
568
568
|
address: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
|
|
569
569
|
creationBlock: 4063979
|
|
570
|
-
},
|
|
570
|
+
}, _routerConfigs17[UniversalRouterVersion.V2_0] = {
|
|
571
571
|
address: '0x8ac7bee993bb44dab564ea4bc9ea67bf9eb5e743',
|
|
572
572
|
creationBlock: 1737559557
|
|
573
|
-
},
|
|
573
|
+
}, _routerConfigs17)
|
|
574
574
|
}, _CHAIN_CONFIGS[1301] = {
|
|
575
575
|
weth: '0x4200000000000000000000000000000000000006',
|
|
576
|
-
routerConfigs: (
|
|
576
|
+
routerConfigs: (_routerConfigs18 = {}, _routerConfigs18[UniversalRouterVersion.V1_2] = {
|
|
577
577
|
address: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6',
|
|
578
578
|
creationBlock: 1241811
|
|
579
|
-
},
|
|
579
|
+
}, _routerConfigs18[UniversalRouterVersion.V2_0] = {
|
|
580
580
|
address: '0xf70536b3bcc1bd1a972dc186a2cf84cc6da6be5d',
|
|
581
581
|
creationBlock: 7100543
|
|
582
|
-
},
|
|
582
|
+
}, _routerConfigs18)
|
|
583
583
|
}, _CHAIN_CONFIGS[130] = {
|
|
584
584
|
weth: '0x4200000000000000000000000000000000000006',
|
|
585
|
-
routerConfigs: (
|
|
585
|
+
routerConfigs: (_routerConfigs19 = {}, _routerConfigs19[UniversalRouterVersion.V1_2] = {
|
|
586
586
|
address: '0x4D73A4411CA1c660035e4AECC8270E5DdDEC8C17',
|
|
587
587
|
creationBlock: 23678
|
|
588
|
-
},
|
|
588
|
+
}, _routerConfigs19[UniversalRouterVersion.V2_0] = {
|
|
589
589
|
address: '0xef740bf23acae26f6492b10de645d6b98dc8eaf3',
|
|
590
590
|
creationBlock: 1737568156
|
|
591
|
-
},
|
|
591
|
+
}, _routerConfigs19)
|
|
592
592
|
}, _CHAIN_CONFIGS[10143] = {
|
|
593
593
|
weth: '0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701',
|
|
594
|
-
routerConfigs: (
|
|
594
|
+
routerConfigs: (_routerConfigs20 = {}, _routerConfigs20[UniversalRouterVersion.V1_2] = {
|
|
595
595
|
address: '0x3ae6d8a282d67893e17aa70ebffb33ee5aa65893',
|
|
596
596
|
creationBlock: 23678
|
|
597
|
-
},
|
|
597
|
+
}, _routerConfigs20[UniversalRouterVersion.V2_0] = {
|
|
598
598
|
address: '0x3ae6d8a282d67893e17aa70ebffb33ee5aa65893',
|
|
599
599
|
creationBlock: 23678
|
|
600
|
-
},
|
|
600
|
+
}, _routerConfigs20)
|
|
601
601
|
}, _CHAIN_CONFIGS[84532] = {
|
|
602
602
|
weth: '0x4200000000000000000000000000000000000006',
|
|
603
|
-
routerConfigs: (
|
|
603
|
+
routerConfigs: (_routerConfigs21 = {}, _routerConfigs21[UniversalRouterVersion.V1_2] = {
|
|
604
604
|
address: '0x492e6456d9528771018deb9e87ef7750ef184104',
|
|
605
605
|
creationBlock: 20216585
|
|
606
|
-
},
|
|
606
|
+
}, _routerConfigs21[UniversalRouterVersion.V2_0] = {
|
|
607
607
|
address: '0x492e6456d9528771018deb9e87ef7750ef184104',
|
|
608
608
|
creationBlock: 20216585
|
|
609
|
-
},
|
|
609
|
+
}, _routerConfigs21)
|
|
610
610
|
}, _CHAIN_CONFIGS[1868] = {
|
|
611
611
|
weth: '0x4200000000000000000000000000000000000006',
|
|
612
|
-
routerConfigs: (
|
|
612
|
+
routerConfigs: (_routerConfigs22 = {}, _routerConfigs22[UniversalRouterVersion.V1_2] = {
|
|
613
613
|
address: '0x0e2850543f69f678257266e0907ff9a58b3f13de',
|
|
614
614
|
creationBlock: 3254782
|
|
615
|
-
},
|
|
615
|
+
}, _routerConfigs22[UniversalRouterVersion.V2_0] = {
|
|
616
616
|
address: '0x0e2850543f69f678257266e0907ff9a58b3f13de',
|
|
617
617
|
creationBlock: 3254782
|
|
618
|
-
},
|
|
618
|
+
}, _routerConfigs22)
|
|
619
|
+
}, _CHAIN_CONFIGS[143] = {
|
|
620
|
+
weth: '0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A',
|
|
621
|
+
routerConfigs: (_routerConfigs23 = {}, _routerConfigs23[UniversalRouterVersion.V1_2] = {
|
|
622
|
+
address: '0x0d97dc33264bfc1c226207428a79b26757fb9dc3',
|
|
623
|
+
creationBlock: 29255937
|
|
624
|
+
}, _routerConfigs23[UniversalRouterVersion.V2_0] = {
|
|
625
|
+
address: '0x0d97dc33264bfc1c226207428a79b26757fb9dc3',
|
|
626
|
+
creationBlock: 29255937
|
|
627
|
+
}, _routerConfigs23)
|
|
619
628
|
}, _CHAIN_CONFIGS);
|
|
620
629
|
var UNIVERSAL_ROUTER_ADDRESS = function UNIVERSAL_ROUTER_ADDRESS(version, chainId) {
|
|
621
630
|
if (!(chainId in CHAIN_CONFIGS)) throw new Error("Universal Router not deployed on chain " + chainId);
|
|
@@ -760,39 +769,67 @@ var UniswapTrade = /*#__PURE__*/function () {
|
|
|
760
769
|
}
|
|
761
770
|
return result;
|
|
762
771
|
}
|
|
772
|
+
// this.trade.swaps is an array of swaps / trades.
|
|
773
|
+
// we are iterating over one swap (trade) at a time so length is 1
|
|
774
|
+
// route is either v2, v3, v4, or mixed
|
|
775
|
+
// pathInput and pathOutput are the currencies of the input and output of the route
|
|
776
|
+
// this.trade.inputAmount is the input currency of the trade (could be different from pathInput)
|
|
777
|
+
// this.trade.outputAmount is the output currency of the trade (could be different from pathOutput)
|
|
778
|
+
// each route can have multiple pools
|
|
763
779
|
}, {
|
|
764
780
|
key: "inputRequiresWrap",
|
|
765
781
|
get: function get() {
|
|
766
|
-
|
|
782
|
+
var swap = this.trade.swaps[0];
|
|
783
|
+
var route = swap.route;
|
|
784
|
+
var firstPool = route.pools[0];
|
|
785
|
+
if (firstPool instanceof Pool) {
|
|
786
|
+
// If first pool is a v4 pool and input currency is native and the path input currency in the route is not native, we need to wrap.
|
|
767
787
|
return this.trade.inputAmount.currency.isNative && !this.trade.swaps[0].route.pathInput.isNative;
|
|
768
|
-
} else {
|
|
769
|
-
return this.trade.inputAmount.currency.isNative;
|
|
770
788
|
}
|
|
789
|
+
// If first pool is not a v4 pool and input currency is native, we need to wrap
|
|
790
|
+
return this.trade.inputAmount.currency.isNative;
|
|
771
791
|
}
|
|
772
792
|
}, {
|
|
773
793
|
key: "inputRequiresUnwrap",
|
|
774
794
|
get: function get() {
|
|
775
|
-
|
|
795
|
+
var swap = this.trade.swaps[0];
|
|
796
|
+
var route = swap.route;
|
|
797
|
+
var firstPool = route.pools[0];
|
|
798
|
+
if (firstPool instanceof Pool) {
|
|
799
|
+
// If the first pool is a v4 pool and input currency is not native and the path input currency is native, we need to unwrap
|
|
776
800
|
return !this.trade.inputAmount.currency.isNative && this.trade.swaps[0].route.pathInput.isNative;
|
|
777
801
|
}
|
|
802
|
+
// If the first pool is not a v4 pool, we don't need to unwrap.
|
|
778
803
|
return false;
|
|
779
804
|
}
|
|
780
805
|
}, {
|
|
781
806
|
key: "outputRequiresWrap",
|
|
782
807
|
get: function get() {
|
|
783
|
-
|
|
784
|
-
|
|
808
|
+
var swap = this.trade.swaps[0];
|
|
809
|
+
var lastRoute = swap.route;
|
|
810
|
+
var lastPool = lastRoute.pools[lastRoute.pools.length - 1];
|
|
811
|
+
// if last pool is v4:
|
|
812
|
+
if (lastPool instanceof Pool) {
|
|
813
|
+
// If output currency is not native but path currency output is native, we need to wrap
|
|
814
|
+
return !this.trade.outputAmount.currency.isNative && lastRoute.pathOutput.isNative;
|
|
785
815
|
}
|
|
816
|
+
// if last pool is not v4:
|
|
817
|
+
// we do not need to wrap because v2 and v3 pools already require wrapped tokens
|
|
786
818
|
return false;
|
|
787
819
|
}
|
|
788
820
|
}, {
|
|
789
821
|
key: "outputRequiresUnwrap",
|
|
790
822
|
get: function get() {
|
|
791
|
-
|
|
823
|
+
var swap = this.trade.swaps[0];
|
|
824
|
+
var lastRoute = swap.route;
|
|
825
|
+
var lastPool = lastRoute.pools[lastRoute.pools.length - 1];
|
|
826
|
+
// if last pool is v4:
|
|
827
|
+
if (lastPool instanceof Pool) {
|
|
828
|
+
// If output currency is native and path currency output is not native, we need to unwrap
|
|
792
829
|
return this.trade.outputAmount.currency.isNative && !this.trade.swaps[0].route.pathOutput.isNative;
|
|
793
|
-
} else {
|
|
794
|
-
return this.trade.outputAmount.currency.isNative;
|
|
795
830
|
}
|
|
831
|
+
// else: if path output currency is native, we need to unwrap because v2 and v3 pools already require wrapped tokens
|
|
832
|
+
return this.trade.outputAmount.currency.isNative;
|
|
796
833
|
}
|
|
797
834
|
}, {
|
|
798
835
|
key: "outputRequiresTransition",
|