@uniswap/sdk-core 7.6.0 → 7.7.1

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.
@@ -15,6 +15,34 @@ var bytes = require('@ethersproject/bytes');
15
15
  var keccak256 = require('@ethersproject/keccak256');
16
16
  var strings = require('@ethersproject/strings');
17
17
 
18
+ function _defineProperties(e, r) {
19
+ for (var t = 0; t < r.length; t++) {
20
+ var o = r[t];
21
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
22
+ }
23
+ }
24
+ function _createClass(e, r, t) {
25
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
26
+ writable: !1
27
+ }), e;
28
+ }
29
+ function _extends() {
30
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
31
+ for (var e = 1; e < arguments.length; e++) {
32
+ var t = arguments[e];
33
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
34
+ }
35
+ return n;
36
+ }, _extends.apply(null, arguments);
37
+ }
38
+ function _inheritsLoose(t, o) {
39
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
40
+ }
41
+ function _setPrototypeOf(t, e) {
42
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
43
+ return t.__proto__ = e, t;
44
+ }, _setPrototypeOf(t, e);
45
+ }
18
46
  function _toPrimitive(t, r) {
19
47
  if ("object" != typeof t || !t) return t;
20
48
  var e = t[Symbol.toPrimitive];
@@ -27,50 +55,7 @@ function _toPrimitive(t, r) {
27
55
  }
28
56
  function _toPropertyKey(t) {
29
57
  var i = _toPrimitive(t, "string");
30
- return "symbol" == typeof i ? i : String(i);
31
- }
32
- function _defineProperties(target, props) {
33
- for (var i = 0; i < props.length; i++) {
34
- var descriptor = props[i];
35
- descriptor.enumerable = descriptor.enumerable || false;
36
- descriptor.configurable = true;
37
- if ("value" in descriptor) descriptor.writable = true;
38
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
39
- }
40
- }
41
- function _createClass(Constructor, protoProps, staticProps) {
42
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
43
- if (staticProps) _defineProperties(Constructor, staticProps);
44
- Object.defineProperty(Constructor, "prototype", {
45
- writable: false
46
- });
47
- return Constructor;
48
- }
49
- function _extends() {
50
- _extends = Object.assign ? Object.assign.bind() : function (target) {
51
- for (var i = 1; i < arguments.length; i++) {
52
- var source = arguments[i];
53
- for (var key in source) {
54
- if (Object.prototype.hasOwnProperty.call(source, key)) {
55
- target[key] = source[key];
56
- }
57
- }
58
- }
59
- return target;
60
- };
61
- return _extends.apply(this, arguments);
62
- }
63
- function _inheritsLoose(subClass, superClass) {
64
- subClass.prototype = Object.create(superClass.prototype);
65
- subClass.prototype.constructor = subClass;
66
- _setPrototypeOf(subClass, superClass);
67
- }
68
- function _setPrototypeOf(o, p) {
69
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
70
- o.__proto__ = p;
71
- return o;
72
- };
73
- return _setPrototypeOf(o, p);
58
+ return "symbol" == typeof i ? i : i + "";
74
59
  }
75
60
 
76
61
  (function (ChainId) {
@@ -600,7 +585,7 @@ var Fraction = /*#__PURE__*/function () {
600
585
  /**
601
586
  * Helper method for converting any super class back to a fraction
602
587
  */;
603
- _createClass(Fraction, [{
588
+ return _createClass(Fraction, [{
604
589
  key: "quotient",
605
590
  get: function get() {
606
591
  return JSBI.divide(this.numerator, this.denominator);
@@ -617,12 +602,10 @@ var Fraction = /*#__PURE__*/function () {
617
602
  return new Fraction(this.numerator, this.denominator);
618
603
  }
619
604
  }]);
620
- return Fraction;
621
605
  }();
622
606
 
623
607
  var Big$1 = /*#__PURE__*/toFormat(_Big);
624
608
  var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
625
- _inheritsLoose(CurrencyAmount, _Fraction);
626
609
  function CurrencyAmount(currency, numerator, denominator) {
627
610
  var _this;
628
611
  _this = _Fraction.call(this, numerator, denominator) || this;
@@ -636,6 +619,7 @@ var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
636
619
  * @param currency the currency in the amount
637
620
  * @param rawAmount the raw token or ether amount
638
621
  */
622
+ _inheritsLoose(CurrencyAmount, _Fraction);
639
623
  CurrencyAmount.fromRawAmount = function fromRawAmount(currency, rawAmount) {
640
624
  return new CurrencyAmount(currency, rawAmount);
641
625
  }
@@ -695,17 +679,16 @@ var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
695
679
  Big$1.DP = this.currency.decimals;
696
680
  return new Big$1(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(format);
697
681
  };
698
- _createClass(CurrencyAmount, [{
682
+ return _createClass(CurrencyAmount, [{
699
683
  key: "wrapped",
700
684
  get: function get() {
701
685
  if (this.currency.isToken) return this;
702
686
  return CurrencyAmount.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator);
703
687
  }
704
688
  }]);
705
- return CurrencyAmount;
706
689
  }(Fraction);
707
690
 
708
- var ONE_HUNDRED = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100));
691
+ var ONE_HUNDRED = /*#__PURE__*/new Fraction(/*#__PURE__*/JSBI.BigInt(100));
709
692
  /**
710
693
  * Converts a fraction to a percent
711
694
  * @param fraction the fraction to convert
@@ -714,7 +697,6 @@ function toPercent(fraction) {
714
697
  return new Percent(fraction.numerator, fraction.denominator);
715
698
  }
716
699
  var Percent = /*#__PURE__*/function (_Fraction) {
717
- _inheritsLoose(Percent, _Fraction);
718
700
  function Percent() {
719
701
  var _this;
720
702
  _this = _Fraction.apply(this, arguments) || this;
@@ -724,6 +706,7 @@ var Percent = /*#__PURE__*/function (_Fraction) {
724
706
  _this.isPercent = true;
725
707
  return _this;
726
708
  }
709
+ _inheritsLoose(Percent, _Fraction);
727
710
  var _proto = Percent.prototype;
728
711
  _proto.add = function add(other) {
729
712
  return toPercent(_Fraction.prototype.add.call(this, other));
@@ -753,7 +736,6 @@ var Percent = /*#__PURE__*/function (_Fraction) {
753
736
  }(Fraction);
754
737
 
755
738
  var Price = /*#__PURE__*/function (_Fraction) {
756
- _inheritsLoose(Price, _Fraction);
757
739
  /**
758
740
  * Construct a price, either with the base and quote currency amount, or the
759
741
  * @param args
@@ -786,6 +768,7 @@ var Price = /*#__PURE__*/function (_Fraction) {
786
768
  /**
787
769
  * Flip the price, switching the base and quote currency
788
770
  */
771
+ _inheritsLoose(Price, _Fraction);
789
772
  var _proto = Price.prototype;
790
773
  _proto.invert = function invert() {
791
774
  return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator);
@@ -824,13 +807,12 @@ var Price = /*#__PURE__*/function (_Fraction) {
824
807
  }
825
808
  return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding);
826
809
  };
827
- _createClass(Price, [{
810
+ return _createClass(Price, [{
828
811
  key: "adjustedForDecimals",
829
812
  get: function get() {
830
813
  return _Fraction.prototype.multiply.call(this, this.scalar);
831
814
  }
832
815
  }]);
833
- return Price;
834
816
  }(Fraction);
835
817
 
836
818
  /**
@@ -857,7 +839,6 @@ function BaseCurrency(chainId, decimals, symbol, name) {
857
839
  * Represents the native currency of the chain on which it resides, e.g.
858
840
  */
859
841
  var NativeCurrency = /*#__PURE__*/function (_BaseCurrency) {
860
- _inheritsLoose(NativeCurrency, _BaseCurrency);
861
842
  function NativeCurrency() {
862
843
  var _this;
863
844
  _this = _BaseCurrency.apply(this, arguments) || this;
@@ -865,6 +846,7 @@ var NativeCurrency = /*#__PURE__*/function (_BaseCurrency) {
865
846
  _this.isToken = false;
866
847
  return _this;
867
848
  }
849
+ _inheritsLoose(NativeCurrency, _BaseCurrency);
868
850
  return NativeCurrency;
869
851
  }(BaseCurrency);
870
852
 
@@ -896,7 +878,6 @@ function checkValidAddress(address) {
896
878
  * Represents an ERC20 token with a unique address and some metadata.
897
879
  */
898
880
  var Token = /*#__PURE__*/function (_BaseCurrency) {
899
- _inheritsLoose(Token, _BaseCurrency);
900
881
  /**
901
882
  *
902
883
  * @param chainId {@link BaseCurrency#chainId}
@@ -932,6 +913,7 @@ var Token = /*#__PURE__*/function (_BaseCurrency) {
932
913
  * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
933
914
  * @param other other token to compare
934
915
  */
916
+ _inheritsLoose(Token, _BaseCurrency);
935
917
  var _proto = Token.prototype;
936
918
  _proto.equals = function equals(other) {
937
919
  return other.isToken && this.chainId === other.chainId && this.address.toLowerCase() === other.address.toLowerCase();
@@ -950,13 +932,12 @@ var Token = /*#__PURE__*/function (_BaseCurrency) {
950
932
  /**
951
933
  * Return this token, which does not need to be wrapped
952
934
  */;
953
- _createClass(Token, [{
935
+ return _createClass(Token, [{
954
936
  key: "wrapped",
955
937
  get: function get() {
956
938
  return this;
957
939
  }
958
940
  }]);
959
- return Token;
960
941
  }(BaseCurrency);
961
942
 
962
943
  /**
@@ -994,10 +975,10 @@ var WETH9 = {
994
975
  * Ether is the main usage of a 'native' currency, i.e. for Ethereum mainnet and all testnets
995
976
  */
996
977
  var Ether = /*#__PURE__*/function (_NativeCurrency) {
997
- _inheritsLoose(Ether, _NativeCurrency);
998
978
  function Ether(chainId) {
999
979
  return _NativeCurrency.call(this, chainId, 18, 'ETH', 'Ether') || this;
1000
980
  }
981
+ _inheritsLoose(Ether, _NativeCurrency);
1001
982
  Ether.onChain = function onChain(chainId) {
1002
983
  var _this$_etherCache$cha;
1003
984
  return (_this$_etherCache$cha = this._etherCache[chainId]) != null ? _this$_etherCache$cha : this._etherCache[chainId] = new Ether(chainId);
@@ -1006,7 +987,7 @@ var Ether = /*#__PURE__*/function (_NativeCurrency) {
1006
987
  _proto.equals = function equals(other) {
1007
988
  return other.isNative && other.chainId === this.chainId;
1008
989
  };
1009
- _createClass(Ether, [{
990
+ return _createClass(Ether, [{
1010
991
  key: "wrapped",
1011
992
  get: function get() {
1012
993
  var weth9 = WETH9[this.chainId];
@@ -1014,7 +995,6 @@ var Ether = /*#__PURE__*/function (_NativeCurrency) {
1014
995
  return weth9;
1015
996
  }
1016
997
  }]);
1017
- return Ether;
1018
998
  }(NativeCurrency);
1019
999
  Ether._etherCache = {};
1020
1000