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