@cetusprotocol/aggregator-sdk 0.2.0 → 0.2.2

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.mjs CHANGED
@@ -85,8 +85,8 @@ var require_bn = __commonJS({
85
85
  ctor.prototype = new TempCtor();
86
86
  ctor.prototype.constructor = ctor;
87
87
  }
88
- function BN6(number, base, endian) {
89
- if (BN6.isBN(number)) {
88
+ function BN7(number, base, endian) {
89
+ if (BN7.isBN(number)) {
90
90
  return number;
91
91
  }
92
92
  this.negative = 0;
@@ -102,12 +102,12 @@ var require_bn = __commonJS({
102
102
  }
103
103
  }
104
104
  if (typeof module2 === "object") {
105
- module2.exports = BN6;
105
+ module2.exports = BN7;
106
106
  } else {
107
- exports2.BN = BN6;
107
+ exports2.BN = BN7;
108
108
  }
109
- BN6.BN = BN6;
110
- BN6.wordSize = 26;
109
+ BN7.BN = BN7;
110
+ BN7.wordSize = 26;
111
111
  var Buffer2;
112
112
  try {
113
113
  if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
@@ -117,21 +117,21 @@ var require_bn = __commonJS({
117
117
  }
118
118
  } catch (e) {
119
119
  }
120
- BN6.isBN = function isBN(num) {
121
- if (num instanceof BN6) {
120
+ BN7.isBN = function isBN(num) {
121
+ if (num instanceof BN7) {
122
122
  return true;
123
123
  }
124
- return num !== null && typeof num === "object" && num.constructor.wordSize === BN6.wordSize && Array.isArray(num.words);
124
+ return num !== null && typeof num === "object" && num.constructor.wordSize === BN7.wordSize && Array.isArray(num.words);
125
125
  };
126
- BN6.max = function max2(left, right) {
126
+ BN7.max = function max2(left, right) {
127
127
  if (left.cmp(right) > 0) return left;
128
128
  return right;
129
129
  };
130
- BN6.min = function min2(left, right) {
130
+ BN7.min = function min2(left, right) {
131
131
  if (left.cmp(right) < 0) return left;
132
132
  return right;
133
133
  };
134
- BN6.prototype._init = function init(number, base, endian) {
134
+ BN7.prototype._init = function init(number, base, endian) {
135
135
  if (typeof number === "number") {
136
136
  return this._initNumber(number, base, endian);
137
137
  }
@@ -159,7 +159,7 @@ var require_bn = __commonJS({
159
159
  }
160
160
  }
161
161
  };
162
- BN6.prototype._initNumber = function _initNumber(number, base, endian) {
162
+ BN7.prototype._initNumber = function _initNumber(number, base, endian) {
163
163
  if (number < 0) {
164
164
  this.negative = 1;
165
165
  number = -number;
@@ -185,7 +185,7 @@ var require_bn = __commonJS({
185
185
  if (endian !== "le") return;
186
186
  this._initArray(this.toArray(), base, endian);
187
187
  };
188
- BN6.prototype._initArray = function _initArray(number, base, endian) {
188
+ BN7.prototype._initArray = function _initArray(number, base, endian) {
189
189
  assert(typeof number.length === "number");
190
190
  if (number.length <= 0) {
191
191
  this.words = [0];
@@ -243,7 +243,7 @@ var require_bn = __commonJS({
243
243
  }
244
244
  return r;
245
245
  }
246
- BN6.prototype._parseHex = function _parseHex(number, start, endian) {
246
+ BN7.prototype._parseHex = function _parseHex(number, start, endian) {
247
247
  this.length = Math.ceil((number.length - start) / 6);
248
248
  this.words = new Array(this.length);
249
249
  for (var i = 0; i < this.length; i++) {
@@ -299,7 +299,7 @@ var require_bn = __commonJS({
299
299
  }
300
300
  return r;
301
301
  }
302
- BN6.prototype._parseBase = function _parseBase(number, base, start) {
302
+ BN7.prototype._parseBase = function _parseBase(number, base, start) {
303
303
  this.words = [0];
304
304
  this.length = 1;
305
305
  for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
@@ -335,7 +335,7 @@ var require_bn = __commonJS({
335
335
  }
336
336
  this._strip();
337
337
  };
338
- BN6.prototype.copy = function copy(dest) {
338
+ BN7.prototype.copy = function copy(dest) {
339
339
  dest.words = new Array(this.length);
340
340
  for (var i = 0; i < this.length; i++) {
341
341
  dest.words[i] = this.words[i];
@@ -350,27 +350,27 @@ var require_bn = __commonJS({
350
350
  dest.negative = src.negative;
351
351
  dest.red = src.red;
352
352
  }
353
- BN6.prototype._move = function _move(dest) {
353
+ BN7.prototype._move = function _move(dest) {
354
354
  move(dest, this);
355
355
  };
356
- BN6.prototype.clone = function clone2() {
357
- var r = new BN6(null);
356
+ BN7.prototype.clone = function clone2() {
357
+ var r = new BN7(null);
358
358
  this.copy(r);
359
359
  return r;
360
360
  };
361
- BN6.prototype._expand = function _expand(size) {
361
+ BN7.prototype._expand = function _expand(size) {
362
362
  while (this.length < size) {
363
363
  this.words[this.length++] = 0;
364
364
  }
365
365
  return this;
366
366
  };
367
- BN6.prototype._strip = function strip() {
367
+ BN7.prototype._strip = function strip() {
368
368
  while (this.length > 1 && this.words[this.length - 1] === 0) {
369
369
  this.length--;
370
370
  }
371
371
  return this._normSign();
372
372
  };
373
- BN6.prototype._normSign = function _normSign() {
373
+ BN7.prototype._normSign = function _normSign() {
374
374
  if (this.length === 1 && this.words[0] === 0) {
375
375
  this.negative = 0;
376
376
  }
@@ -378,12 +378,12 @@ var require_bn = __commonJS({
378
378
  };
379
379
  if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
380
380
  try {
381
- BN6.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect;
381
+ BN7.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect;
382
382
  } catch (e) {
383
- BN6.prototype.inspect = inspect;
383
+ BN7.prototype.inspect = inspect;
384
384
  }
385
385
  } else {
386
- BN6.prototype.inspect = inspect;
386
+ BN7.prototype.inspect = inspect;
387
387
  }
388
388
  function inspect() {
389
389
  return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -494,7 +494,7 @@ var require_bn = __commonJS({
494
494
  52521875,
495
495
  60466176
496
496
  ];
497
- BN6.prototype.toString = function toString(base, padding) {
497
+ BN7.prototype.toString = function toString(base, padding) {
498
498
  base = base || 10;
499
499
  padding = padding | 0 || 1;
500
500
  var out;
@@ -556,7 +556,7 @@ var require_bn = __commonJS({
556
556
  }
557
557
  assert(false, "Base should be between 2 and 36");
558
558
  };
559
- BN6.prototype.toNumber = function toNumber() {
559
+ BN7.prototype.toNumber = function toNumber() {
560
560
  var ret = this.words[0];
561
561
  if (this.length === 2) {
562
562
  ret += this.words[1] * 67108864;
@@ -567,15 +567,15 @@ var require_bn = __commonJS({
567
567
  }
568
568
  return this.negative !== 0 ? -ret : ret;
569
569
  };
570
- BN6.prototype.toJSON = function toJSON() {
570
+ BN7.prototype.toJSON = function toJSON() {
571
571
  return this.toString(16, 2);
572
572
  };
573
573
  if (Buffer2) {
574
- BN6.prototype.toBuffer = function toBuffer(endian, length) {
574
+ BN7.prototype.toBuffer = function toBuffer(endian, length) {
575
575
  return this.toArrayLike(Buffer2, endian, length);
576
576
  };
577
577
  }
578
- BN6.prototype.toArray = function toArray(endian, length) {
578
+ BN7.prototype.toArray = function toArray(endian, length) {
579
579
  return this.toArrayLike(Array, endian, length);
580
580
  };
581
581
  var allocate = function allocate2(ArrayType, size) {
@@ -584,7 +584,7 @@ var require_bn = __commonJS({
584
584
  }
585
585
  return new ArrayType(size);
586
586
  };
587
- BN6.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
587
+ BN7.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
588
588
  this._strip();
589
589
  var byteLength = this.byteLength();
590
590
  var reqLength = length || Math.max(1, byteLength);
@@ -595,7 +595,7 @@ var require_bn = __commonJS({
595
595
  this["_toArrayLike" + postfix](res, byteLength);
596
596
  return res;
597
597
  };
598
- BN6.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
598
+ BN7.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
599
599
  var position = 0;
600
600
  var carry = 0;
601
601
  for (var i = 0, shift = 0; i < this.length; i++) {
@@ -625,7 +625,7 @@ var require_bn = __commonJS({
625
625
  }
626
626
  }
627
627
  };
628
- BN6.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {
628
+ BN7.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {
629
629
  var position = res.length - 1;
630
630
  var carry = 0;
631
631
  for (var i = 0, shift = 0; i < this.length; i++) {
@@ -656,11 +656,11 @@ var require_bn = __commonJS({
656
656
  }
657
657
  };
658
658
  if (Math.clz32) {
659
- BN6.prototype._countBits = function _countBits(w) {
659
+ BN7.prototype._countBits = function _countBits(w) {
660
660
  return 32 - Math.clz32(w);
661
661
  };
662
662
  } else {
663
- BN6.prototype._countBits = function _countBits(w) {
663
+ BN7.prototype._countBits = function _countBits(w) {
664
664
  var t = w;
665
665
  var r = 0;
666
666
  if (t >= 4096) {
@@ -682,7 +682,7 @@ var require_bn = __commonJS({
682
682
  return r + t;
683
683
  };
684
684
  }
685
- BN6.prototype._zeroBits = function _zeroBits(w) {
685
+ BN7.prototype._zeroBits = function _zeroBits(w) {
686
686
  if (w === 0) return 26;
687
687
  var t = w;
688
688
  var r = 0;
@@ -707,7 +707,7 @@ var require_bn = __commonJS({
707
707
  }
708
708
  return r;
709
709
  };
710
- BN6.prototype.bitLength = function bitLength() {
710
+ BN7.prototype.bitLength = function bitLength() {
711
711
  var w = this.words[this.length - 1];
712
712
  var hi = this._countBits(w);
713
713
  return (this.length - 1) * 26 + hi;
@@ -721,7 +721,7 @@ var require_bn = __commonJS({
721
721
  }
722
722
  return w;
723
723
  }
724
- BN6.prototype.zeroBits = function zeroBits() {
724
+ BN7.prototype.zeroBits = function zeroBits() {
725
725
  if (this.isZero()) return 0;
726
726
  var r = 0;
727
727
  for (var i = 0; i < this.length; i++) {
@@ -731,34 +731,34 @@ var require_bn = __commonJS({
731
731
  }
732
732
  return r;
733
733
  };
734
- BN6.prototype.byteLength = function byteLength() {
734
+ BN7.prototype.byteLength = function byteLength() {
735
735
  return Math.ceil(this.bitLength() / 8);
736
736
  };
737
- BN6.prototype.toTwos = function toTwos(width) {
737
+ BN7.prototype.toTwos = function toTwos(width) {
738
738
  if (this.negative !== 0) {
739
739
  return this.abs().inotn(width).iaddn(1);
740
740
  }
741
741
  return this.clone();
742
742
  };
743
- BN6.prototype.fromTwos = function fromTwos(width) {
743
+ BN7.prototype.fromTwos = function fromTwos(width) {
744
744
  if (this.testn(width - 1)) {
745
745
  return this.notn(width).iaddn(1).ineg();
746
746
  }
747
747
  return this.clone();
748
748
  };
749
- BN6.prototype.isNeg = function isNeg() {
749
+ BN7.prototype.isNeg = function isNeg() {
750
750
  return this.negative !== 0;
751
751
  };
752
- BN6.prototype.neg = function neg() {
752
+ BN7.prototype.neg = function neg() {
753
753
  return this.clone().ineg();
754
754
  };
755
- BN6.prototype.ineg = function ineg() {
755
+ BN7.prototype.ineg = function ineg() {
756
756
  if (!this.isZero()) {
757
757
  this.negative ^= 1;
758
758
  }
759
759
  return this;
760
760
  };
761
- BN6.prototype.iuor = function iuor(num) {
761
+ BN7.prototype.iuor = function iuor(num) {
762
762
  while (this.length < num.length) {
763
763
  this.words[this.length++] = 0;
764
764
  }
@@ -767,19 +767,19 @@ var require_bn = __commonJS({
767
767
  }
768
768
  return this._strip();
769
769
  };
770
- BN6.prototype.ior = function ior(num) {
770
+ BN7.prototype.ior = function ior(num) {
771
771
  assert((this.negative | num.negative) === 0);
772
772
  return this.iuor(num);
773
773
  };
774
- BN6.prototype.or = function or(num) {
774
+ BN7.prototype.or = function or(num) {
775
775
  if (this.length > num.length) return this.clone().ior(num);
776
776
  return num.clone().ior(this);
777
777
  };
778
- BN6.prototype.uor = function uor(num) {
778
+ BN7.prototype.uor = function uor(num) {
779
779
  if (this.length > num.length) return this.clone().iuor(num);
780
780
  return num.clone().iuor(this);
781
781
  };
782
- BN6.prototype.iuand = function iuand(num) {
782
+ BN7.prototype.iuand = function iuand(num) {
783
783
  var b;
784
784
  if (this.length > num.length) {
785
785
  b = num;
@@ -792,19 +792,19 @@ var require_bn = __commonJS({
792
792
  this.length = b.length;
793
793
  return this._strip();
794
794
  };
795
- BN6.prototype.iand = function iand(num) {
795
+ BN7.prototype.iand = function iand(num) {
796
796
  assert((this.negative | num.negative) === 0);
797
797
  return this.iuand(num);
798
798
  };
799
- BN6.prototype.and = function and(num) {
799
+ BN7.prototype.and = function and(num) {
800
800
  if (this.length > num.length) return this.clone().iand(num);
801
801
  return num.clone().iand(this);
802
802
  };
803
- BN6.prototype.uand = function uand(num) {
803
+ BN7.prototype.uand = function uand(num) {
804
804
  if (this.length > num.length) return this.clone().iuand(num);
805
805
  return num.clone().iuand(this);
806
806
  };
807
- BN6.prototype.iuxor = function iuxor(num) {
807
+ BN7.prototype.iuxor = function iuxor(num) {
808
808
  var a;
809
809
  var b;
810
810
  if (this.length > num.length) {
@@ -825,19 +825,19 @@ var require_bn = __commonJS({
825
825
  this.length = a.length;
826
826
  return this._strip();
827
827
  };
828
- BN6.prototype.ixor = function ixor(num) {
828
+ BN7.prototype.ixor = function ixor(num) {
829
829
  assert((this.negative | num.negative) === 0);
830
830
  return this.iuxor(num);
831
831
  };
832
- BN6.prototype.xor = function xor(num) {
832
+ BN7.prototype.xor = function xor(num) {
833
833
  if (this.length > num.length) return this.clone().ixor(num);
834
834
  return num.clone().ixor(this);
835
835
  };
836
- BN6.prototype.uxor = function uxor(num) {
836
+ BN7.prototype.uxor = function uxor(num) {
837
837
  if (this.length > num.length) return this.clone().iuxor(num);
838
838
  return num.clone().iuxor(this);
839
839
  };
840
- BN6.prototype.inotn = function inotn(width) {
840
+ BN7.prototype.inotn = function inotn(width) {
841
841
  assert(typeof width === "number" && width >= 0);
842
842
  var bytesNeeded = Math.ceil(width / 26) | 0;
843
843
  var bitsLeft = width % 26;
@@ -853,10 +853,10 @@ var require_bn = __commonJS({
853
853
  }
854
854
  return this._strip();
855
855
  };
856
- BN6.prototype.notn = function notn(width) {
856
+ BN7.prototype.notn = function notn(width) {
857
857
  return this.clone().inotn(width);
858
858
  };
859
- BN6.prototype.setn = function setn(bit, val) {
859
+ BN7.prototype.setn = function setn(bit, val) {
860
860
  assert(typeof bit === "number" && bit >= 0);
861
861
  var off = bit / 26 | 0;
862
862
  var wbit = bit % 26;
@@ -868,7 +868,7 @@ var require_bn = __commonJS({
868
868
  }
869
869
  return this._strip();
870
870
  };
871
- BN6.prototype.iadd = function iadd(num) {
871
+ BN7.prototype.iadd = function iadd(num) {
872
872
  var r;
873
873
  if (this.negative !== 0 && num.negative === 0) {
874
874
  this.negative = 0;
@@ -911,7 +911,7 @@ var require_bn = __commonJS({
911
911
  }
912
912
  return this;
913
913
  };
914
- BN6.prototype.add = function add2(num) {
914
+ BN7.prototype.add = function add2(num) {
915
915
  var res;
916
916
  if (num.negative !== 0 && this.negative === 0) {
917
917
  num.negative = 0;
@@ -927,7 +927,7 @@ var require_bn = __commonJS({
927
927
  if (this.length > num.length) return this.clone().iadd(num);
928
928
  return num.clone().iadd(this);
929
929
  };
930
- BN6.prototype.isub = function isub(num) {
930
+ BN7.prototype.isub = function isub(num) {
931
931
  if (num.negative !== 0) {
932
932
  num.negative = 0;
933
933
  var r = this.iadd(num);
@@ -976,7 +976,7 @@ var require_bn = __commonJS({
976
976
  }
977
977
  return this._strip();
978
978
  };
979
- BN6.prototype.sub = function sub2(num) {
979
+ BN7.prototype.sub = function sub2(num) {
980
980
  return this.clone().isub(num);
981
981
  };
982
982
  function smallMulTo(self, num, out) {
@@ -1604,7 +1604,7 @@ var require_bn = __commonJS({
1604
1604
  function jumboMulTo(self, num, out) {
1605
1605
  return bigMulTo(self, num, out);
1606
1606
  }
1607
- BN6.prototype.mulTo = function mulTo(num, out) {
1607
+ BN7.prototype.mulTo = function mulTo(num, out) {
1608
1608
  var res;
1609
1609
  var len = this.length + num.length;
1610
1610
  if (this.length === 10 && num.length === 10) {
@@ -1618,20 +1618,20 @@ var require_bn = __commonJS({
1618
1618
  }
1619
1619
  return res;
1620
1620
  };
1621
- BN6.prototype.mul = function mul2(num) {
1622
- var out = new BN6(null);
1621
+ BN7.prototype.mul = function mul2(num) {
1622
+ var out = new BN7(null);
1623
1623
  out.words = new Array(this.length + num.length);
1624
1624
  return this.mulTo(num, out);
1625
1625
  };
1626
- BN6.prototype.mulf = function mulf(num) {
1627
- var out = new BN6(null);
1626
+ BN7.prototype.mulf = function mulf(num) {
1627
+ var out = new BN7(null);
1628
1628
  out.words = new Array(this.length + num.length);
1629
1629
  return jumboMulTo(this, num, out);
1630
1630
  };
1631
- BN6.prototype.imul = function imul(num) {
1631
+ BN7.prototype.imul = function imul(num) {
1632
1632
  return this.clone().mulTo(num, this);
1633
1633
  };
1634
- BN6.prototype.imuln = function imuln(num) {
1634
+ BN7.prototype.imuln = function imuln(num) {
1635
1635
  var isNegNum = num < 0;
1636
1636
  if (isNegNum) num = -num;
1637
1637
  assert(typeof num === "number");
@@ -1651,18 +1651,18 @@ var require_bn = __commonJS({
1651
1651
  }
1652
1652
  return isNegNum ? this.ineg() : this;
1653
1653
  };
1654
- BN6.prototype.muln = function muln(num) {
1654
+ BN7.prototype.muln = function muln(num) {
1655
1655
  return this.clone().imuln(num);
1656
1656
  };
1657
- BN6.prototype.sqr = function sqr() {
1657
+ BN7.prototype.sqr = function sqr() {
1658
1658
  return this.mul(this);
1659
1659
  };
1660
- BN6.prototype.isqr = function isqr() {
1660
+ BN7.prototype.isqr = function isqr() {
1661
1661
  return this.imul(this.clone());
1662
1662
  };
1663
- BN6.prototype.pow = function pow2(num) {
1663
+ BN7.prototype.pow = function pow2(num) {
1664
1664
  var w = toBitArray(num);
1665
- if (w.length === 0) return new BN6(1);
1665
+ if (w.length === 0) return new BN7(1);
1666
1666
  var res = this;
1667
1667
  for (var i = 0; i < w.length; i++, res = res.sqr()) {
1668
1668
  if (w[i] !== 0) break;
@@ -1675,7 +1675,7 @@ var require_bn = __commonJS({
1675
1675
  }
1676
1676
  return res;
1677
1677
  };
1678
- BN6.prototype.iushln = function iushln(bits) {
1678
+ BN7.prototype.iushln = function iushln(bits) {
1679
1679
  assert(typeof bits === "number" && bits >= 0);
1680
1680
  var r = bits % 26;
1681
1681
  var s = (bits - r) / 26;
@@ -1705,11 +1705,11 @@ var require_bn = __commonJS({
1705
1705
  }
1706
1706
  return this._strip();
1707
1707
  };
1708
- BN6.prototype.ishln = function ishln(bits) {
1708
+ BN7.prototype.ishln = function ishln(bits) {
1709
1709
  assert(this.negative === 0);
1710
1710
  return this.iushln(bits);
1711
1711
  };
1712
- BN6.prototype.iushrn = function iushrn(bits, hint, extended) {
1712
+ BN7.prototype.iushrn = function iushrn(bits, hint, extended) {
1713
1713
  assert(typeof bits === "number" && bits >= 0);
1714
1714
  var h;
1715
1715
  if (hint) {
@@ -1753,23 +1753,23 @@ var require_bn = __commonJS({
1753
1753
  }
1754
1754
  return this._strip();
1755
1755
  };
1756
- BN6.prototype.ishrn = function ishrn(bits, hint, extended) {
1756
+ BN7.prototype.ishrn = function ishrn(bits, hint, extended) {
1757
1757
  assert(this.negative === 0);
1758
1758
  return this.iushrn(bits, hint, extended);
1759
1759
  };
1760
- BN6.prototype.shln = function shln(bits) {
1760
+ BN7.prototype.shln = function shln(bits) {
1761
1761
  return this.clone().ishln(bits);
1762
1762
  };
1763
- BN6.prototype.ushln = function ushln(bits) {
1763
+ BN7.prototype.ushln = function ushln(bits) {
1764
1764
  return this.clone().iushln(bits);
1765
1765
  };
1766
- BN6.prototype.shrn = function shrn(bits) {
1766
+ BN7.prototype.shrn = function shrn(bits) {
1767
1767
  return this.clone().ishrn(bits);
1768
1768
  };
1769
- BN6.prototype.ushrn = function ushrn(bits) {
1769
+ BN7.prototype.ushrn = function ushrn(bits) {
1770
1770
  return this.clone().iushrn(bits);
1771
1771
  };
1772
- BN6.prototype.testn = function testn(bit) {
1772
+ BN7.prototype.testn = function testn(bit) {
1773
1773
  assert(typeof bit === "number" && bit >= 0);
1774
1774
  var r = bit % 26;
1775
1775
  var s = (bit - r) / 26;
@@ -1778,7 +1778,7 @@ var require_bn = __commonJS({
1778
1778
  var w = this.words[s];
1779
1779
  return !!(w & q);
1780
1780
  };
1781
- BN6.prototype.imaskn = function imaskn(bits) {
1781
+ BN7.prototype.imaskn = function imaskn(bits) {
1782
1782
  assert(typeof bits === "number" && bits >= 0);
1783
1783
  var r = bits % 26;
1784
1784
  var s = (bits - r) / 26;
@@ -1796,10 +1796,10 @@ var require_bn = __commonJS({
1796
1796
  }
1797
1797
  return this._strip();
1798
1798
  };
1799
- BN6.prototype.maskn = function maskn(bits) {
1799
+ BN7.prototype.maskn = function maskn(bits) {
1800
1800
  return this.clone().imaskn(bits);
1801
1801
  };
1802
- BN6.prototype.iaddn = function iaddn(num) {
1802
+ BN7.prototype.iaddn = function iaddn(num) {
1803
1803
  assert(typeof num === "number");
1804
1804
  assert(num < 67108864);
1805
1805
  if (num < 0) return this.isubn(-num);
@@ -1816,7 +1816,7 @@ var require_bn = __commonJS({
1816
1816
  }
1817
1817
  return this._iaddn(num);
1818
1818
  };
1819
- BN6.prototype._iaddn = function _iaddn(num) {
1819
+ BN7.prototype._iaddn = function _iaddn(num) {
1820
1820
  this.words[0] += num;
1821
1821
  for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) {
1822
1822
  this.words[i] -= 67108864;
@@ -1829,7 +1829,7 @@ var require_bn = __commonJS({
1829
1829
  this.length = Math.max(this.length, i + 1);
1830
1830
  return this;
1831
1831
  };
1832
- BN6.prototype.isubn = function isubn(num) {
1832
+ BN7.prototype.isubn = function isubn(num) {
1833
1833
  assert(typeof num === "number");
1834
1834
  assert(num < 67108864);
1835
1835
  if (num < 0) return this.iaddn(-num);
@@ -1851,20 +1851,20 @@ var require_bn = __commonJS({
1851
1851
  }
1852
1852
  return this._strip();
1853
1853
  };
1854
- BN6.prototype.addn = function addn(num) {
1854
+ BN7.prototype.addn = function addn(num) {
1855
1855
  return this.clone().iaddn(num);
1856
1856
  };
1857
- BN6.prototype.subn = function subn(num) {
1857
+ BN7.prototype.subn = function subn(num) {
1858
1858
  return this.clone().isubn(num);
1859
1859
  };
1860
- BN6.prototype.iabs = function iabs() {
1860
+ BN7.prototype.iabs = function iabs() {
1861
1861
  this.negative = 0;
1862
1862
  return this;
1863
1863
  };
1864
- BN6.prototype.abs = function abs2() {
1864
+ BN7.prototype.abs = function abs2() {
1865
1865
  return this.clone().iabs();
1866
1866
  };
1867
- BN6.prototype._ishlnsubmul = function _ishlnsubmul(num, mul2, shift) {
1867
+ BN7.prototype._ishlnsubmul = function _ishlnsubmul(num, mul2, shift) {
1868
1868
  var len = num.length + shift;
1869
1869
  var i;
1870
1870
  this._expand(len);
@@ -1893,7 +1893,7 @@ var require_bn = __commonJS({
1893
1893
  this.negative = 1;
1894
1894
  return this._strip();
1895
1895
  };
1896
- BN6.prototype._wordDiv = function _wordDiv(num, mode) {
1896
+ BN7.prototype._wordDiv = function _wordDiv(num, mode) {
1897
1897
  var shift = this.length - num.length;
1898
1898
  var a = this.clone();
1899
1899
  var b = num;
@@ -1908,7 +1908,7 @@ var require_bn = __commonJS({
1908
1908
  var m = a.length - b.length;
1909
1909
  var q;
1910
1910
  if (mode !== "mod") {
1911
- q = new BN6(null);
1911
+ q = new BN7(null);
1912
1912
  q.length = m + 1;
1913
1913
  q.words = new Array(q.length);
1914
1914
  for (var i = 0; i < q.length; i++) {
@@ -1950,12 +1950,12 @@ var require_bn = __commonJS({
1950
1950
  mod: a
1951
1951
  };
1952
1952
  };
1953
- BN6.prototype.divmod = function divmod(num, mode, positive) {
1953
+ BN7.prototype.divmod = function divmod(num, mode, positive) {
1954
1954
  assert(!num.isZero());
1955
1955
  if (this.isZero()) {
1956
1956
  return {
1957
- div: new BN6(0),
1958
- mod: new BN6(0)
1957
+ div: new BN7(0),
1958
+ mod: new BN7(0)
1959
1959
  };
1960
1960
  }
1961
1961
  var div2, mod2, res;
@@ -2000,7 +2000,7 @@ var require_bn = __commonJS({
2000
2000
  }
2001
2001
  if (num.length > this.length || this.cmp(num) < 0) {
2002
2002
  return {
2003
- div: new BN6(0),
2003
+ div: new BN7(0),
2004
2004
  mod: this
2005
2005
  };
2006
2006
  }
@@ -2014,26 +2014,26 @@ var require_bn = __commonJS({
2014
2014
  if (mode === "mod") {
2015
2015
  return {
2016
2016
  div: null,
2017
- mod: new BN6(this.modrn(num.words[0]))
2017
+ mod: new BN7(this.modrn(num.words[0]))
2018
2018
  };
2019
2019
  }
2020
2020
  return {
2021
2021
  div: this.divn(num.words[0]),
2022
- mod: new BN6(this.modrn(num.words[0]))
2022
+ mod: new BN7(this.modrn(num.words[0]))
2023
2023
  };
2024
2024
  }
2025
2025
  return this._wordDiv(num, mode);
2026
2026
  };
2027
- BN6.prototype.div = function div2(num) {
2027
+ BN7.prototype.div = function div2(num) {
2028
2028
  return this.divmod(num, "div", false).div;
2029
2029
  };
2030
- BN6.prototype.mod = function mod2(num) {
2030
+ BN7.prototype.mod = function mod2(num) {
2031
2031
  return this.divmod(num, "mod", false).mod;
2032
2032
  };
2033
- BN6.prototype.umod = function umod(num) {
2033
+ BN7.prototype.umod = function umod(num) {
2034
2034
  return this.divmod(num, "mod", true).mod;
2035
2035
  };
2036
- BN6.prototype.divRound = function divRound(num) {
2036
+ BN7.prototype.divRound = function divRound(num) {
2037
2037
  var dm = this.divmod(num);
2038
2038
  if (dm.mod.isZero()) return dm.div;
2039
2039
  var mod2 = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
@@ -2043,7 +2043,7 @@ var require_bn = __commonJS({
2043
2043
  if (cmp2 < 0 || r2 === 1 && cmp2 === 0) return dm.div;
2044
2044
  return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
2045
2045
  };
2046
- BN6.prototype.modrn = function modrn(num) {
2046
+ BN7.prototype.modrn = function modrn(num) {
2047
2047
  var isNegNum = num < 0;
2048
2048
  if (isNegNum) num = -num;
2049
2049
  assert(num <= 67108863);
@@ -2054,10 +2054,10 @@ var require_bn = __commonJS({
2054
2054
  }
2055
2055
  return isNegNum ? -acc : acc;
2056
2056
  };
2057
- BN6.prototype.modn = function modn(num) {
2057
+ BN7.prototype.modn = function modn(num) {
2058
2058
  return this.modrn(num);
2059
2059
  };
2060
- BN6.prototype.idivn = function idivn(num) {
2060
+ BN7.prototype.idivn = function idivn(num) {
2061
2061
  var isNegNum = num < 0;
2062
2062
  if (isNegNum) num = -num;
2063
2063
  assert(num <= 67108863);
@@ -2070,10 +2070,10 @@ var require_bn = __commonJS({
2070
2070
  this._strip();
2071
2071
  return isNegNum ? this.ineg() : this;
2072
2072
  };
2073
- BN6.prototype.divn = function divn(num) {
2073
+ BN7.prototype.divn = function divn(num) {
2074
2074
  return this.clone().idivn(num);
2075
2075
  };
2076
- BN6.prototype.egcd = function egcd(p) {
2076
+ BN7.prototype.egcd = function egcd(p) {
2077
2077
  assert(p.negative === 0);
2078
2078
  assert(!p.isZero());
2079
2079
  var x = this;
@@ -2083,10 +2083,10 @@ var require_bn = __commonJS({
2083
2083
  } else {
2084
2084
  x = x.clone();
2085
2085
  }
2086
- var A = new BN6(1);
2087
- var B = new BN6(0);
2088
- var C = new BN6(0);
2089
- var D = new BN6(1);
2086
+ var A = new BN7(1);
2087
+ var B = new BN7(0);
2088
+ var C = new BN7(0);
2089
+ var D = new BN7(1);
2090
2090
  var g = 0;
2091
2091
  while (x.isEven() && y.isEven()) {
2092
2092
  x.iushrn(1);
@@ -2136,7 +2136,7 @@ var require_bn = __commonJS({
2136
2136
  gcd: y.iushln(g)
2137
2137
  };
2138
2138
  };
2139
- BN6.prototype._invmp = function _invmp(p) {
2139
+ BN7.prototype._invmp = function _invmp(p) {
2140
2140
  assert(p.negative === 0);
2141
2141
  assert(!p.isZero());
2142
2142
  var a = this;
@@ -2146,8 +2146,8 @@ var require_bn = __commonJS({
2146
2146
  } else {
2147
2147
  a = a.clone();
2148
2148
  }
2149
- var x1 = new BN6(1);
2150
- var x2 = new BN6(0);
2149
+ var x1 = new BN7(1);
2150
+ var x2 = new BN7(0);
2151
2151
  var delta = b.clone();
2152
2152
  while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
2153
2153
  for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ;
@@ -2189,7 +2189,7 @@ var require_bn = __commonJS({
2189
2189
  }
2190
2190
  return res;
2191
2191
  };
2192
- BN6.prototype.gcd = function gcd(num) {
2192
+ BN7.prototype.gcd = function gcd(num) {
2193
2193
  if (this.isZero()) return num.abs();
2194
2194
  if (num.isZero()) return this.abs();
2195
2195
  var a = this.clone();
@@ -2219,19 +2219,19 @@ var require_bn = __commonJS({
2219
2219
  } while (true);
2220
2220
  return b.iushln(shift);
2221
2221
  };
2222
- BN6.prototype.invm = function invm(num) {
2222
+ BN7.prototype.invm = function invm(num) {
2223
2223
  return this.egcd(num).a.umod(num);
2224
2224
  };
2225
- BN6.prototype.isEven = function isEven() {
2225
+ BN7.prototype.isEven = function isEven() {
2226
2226
  return (this.words[0] & 1) === 0;
2227
2227
  };
2228
- BN6.prototype.isOdd = function isOdd2() {
2228
+ BN7.prototype.isOdd = function isOdd2() {
2229
2229
  return (this.words[0] & 1) === 1;
2230
2230
  };
2231
- BN6.prototype.andln = function andln(num) {
2231
+ BN7.prototype.andln = function andln(num) {
2232
2232
  return this.words[0] & num;
2233
2233
  };
2234
- BN6.prototype.bincn = function bincn(bit) {
2234
+ BN7.prototype.bincn = function bincn(bit) {
2235
2235
  assert(typeof bit === "number");
2236
2236
  var r = bit % 26;
2237
2237
  var s = (bit - r) / 26;
@@ -2255,10 +2255,10 @@ var require_bn = __commonJS({
2255
2255
  }
2256
2256
  return this;
2257
2257
  };
2258
- BN6.prototype.isZero = function isZero() {
2258
+ BN7.prototype.isZero = function isZero() {
2259
2259
  return this.length === 1 && this.words[0] === 0;
2260
2260
  };
2261
- BN6.prototype.cmpn = function cmpn(num) {
2261
+ BN7.prototype.cmpn = function cmpn(num) {
2262
2262
  var negative = num < 0;
2263
2263
  if (this.negative !== 0 && !negative) return -1;
2264
2264
  if (this.negative === 0 && negative) return 1;
@@ -2277,14 +2277,14 @@ var require_bn = __commonJS({
2277
2277
  if (this.negative !== 0) return -res | 0;
2278
2278
  return res;
2279
2279
  };
2280
- BN6.prototype.cmp = function cmp2(num) {
2280
+ BN7.prototype.cmp = function cmp2(num) {
2281
2281
  if (this.negative !== 0 && num.negative === 0) return -1;
2282
2282
  if (this.negative === 0 && num.negative !== 0) return 1;
2283
2283
  var res = this.ucmp(num);
2284
2284
  if (this.negative !== 0) return -res | 0;
2285
2285
  return res;
2286
2286
  };
2287
- BN6.prototype.ucmp = function ucmp(num) {
2287
+ BN7.prototype.ucmp = function ucmp(num) {
2288
2288
  if (this.length > num.length) return 1;
2289
2289
  if (this.length < num.length) return -1;
2290
2290
  var res = 0;
@@ -2301,112 +2301,112 @@ var require_bn = __commonJS({
2301
2301
  }
2302
2302
  return res;
2303
2303
  };
2304
- BN6.prototype.gtn = function gtn(num) {
2304
+ BN7.prototype.gtn = function gtn(num) {
2305
2305
  return this.cmpn(num) === 1;
2306
2306
  };
2307
- BN6.prototype.gt = function gt(num) {
2307
+ BN7.prototype.gt = function gt(num) {
2308
2308
  return this.cmp(num) === 1;
2309
2309
  };
2310
- BN6.prototype.gten = function gten(num) {
2310
+ BN7.prototype.gten = function gten(num) {
2311
2311
  return this.cmpn(num) >= 0;
2312
2312
  };
2313
- BN6.prototype.gte = function gte(num) {
2313
+ BN7.prototype.gte = function gte(num) {
2314
2314
  return this.cmp(num) >= 0;
2315
2315
  };
2316
- BN6.prototype.ltn = function ltn(num) {
2316
+ BN7.prototype.ltn = function ltn(num) {
2317
2317
  return this.cmpn(num) === -1;
2318
2318
  };
2319
- BN6.prototype.lt = function lt(num) {
2319
+ BN7.prototype.lt = function lt(num) {
2320
2320
  return this.cmp(num) === -1;
2321
2321
  };
2322
- BN6.prototype.lten = function lten(num) {
2322
+ BN7.prototype.lten = function lten(num) {
2323
2323
  return this.cmpn(num) <= 0;
2324
2324
  };
2325
- BN6.prototype.lte = function lte(num) {
2325
+ BN7.prototype.lte = function lte(num) {
2326
2326
  return this.cmp(num) <= 0;
2327
2327
  };
2328
- BN6.prototype.eqn = function eqn(num) {
2328
+ BN7.prototype.eqn = function eqn(num) {
2329
2329
  return this.cmpn(num) === 0;
2330
2330
  };
2331
- BN6.prototype.eq = function eq(num) {
2331
+ BN7.prototype.eq = function eq(num) {
2332
2332
  return this.cmp(num) === 0;
2333
2333
  };
2334
- BN6.red = function red(num) {
2334
+ BN7.red = function red(num) {
2335
2335
  return new Red(num);
2336
2336
  };
2337
- BN6.prototype.toRed = function toRed(ctx) {
2337
+ BN7.prototype.toRed = function toRed(ctx) {
2338
2338
  assert(!this.red, "Already a number in reduction context");
2339
2339
  assert(this.negative === 0, "red works only with positives");
2340
2340
  return ctx.convertTo(this)._forceRed(ctx);
2341
2341
  };
2342
- BN6.prototype.fromRed = function fromRed() {
2342
+ BN7.prototype.fromRed = function fromRed() {
2343
2343
  assert(this.red, "fromRed works only with numbers in reduction context");
2344
2344
  return this.red.convertFrom(this);
2345
2345
  };
2346
- BN6.prototype._forceRed = function _forceRed(ctx) {
2346
+ BN7.prototype._forceRed = function _forceRed(ctx) {
2347
2347
  this.red = ctx;
2348
2348
  return this;
2349
2349
  };
2350
- BN6.prototype.forceRed = function forceRed(ctx) {
2350
+ BN7.prototype.forceRed = function forceRed(ctx) {
2351
2351
  assert(!this.red, "Already a number in reduction context");
2352
2352
  return this._forceRed(ctx);
2353
2353
  };
2354
- BN6.prototype.redAdd = function redAdd(num) {
2354
+ BN7.prototype.redAdd = function redAdd(num) {
2355
2355
  assert(this.red, "redAdd works only with red numbers");
2356
2356
  return this.red.add(this, num);
2357
2357
  };
2358
- BN6.prototype.redIAdd = function redIAdd(num) {
2358
+ BN7.prototype.redIAdd = function redIAdd(num) {
2359
2359
  assert(this.red, "redIAdd works only with red numbers");
2360
2360
  return this.red.iadd(this, num);
2361
2361
  };
2362
- BN6.prototype.redSub = function redSub(num) {
2362
+ BN7.prototype.redSub = function redSub(num) {
2363
2363
  assert(this.red, "redSub works only with red numbers");
2364
2364
  return this.red.sub(this, num);
2365
2365
  };
2366
- BN6.prototype.redISub = function redISub(num) {
2366
+ BN7.prototype.redISub = function redISub(num) {
2367
2367
  assert(this.red, "redISub works only with red numbers");
2368
2368
  return this.red.isub(this, num);
2369
2369
  };
2370
- BN6.prototype.redShl = function redShl(num) {
2370
+ BN7.prototype.redShl = function redShl(num) {
2371
2371
  assert(this.red, "redShl works only with red numbers");
2372
2372
  return this.red.shl(this, num);
2373
2373
  };
2374
- BN6.prototype.redMul = function redMul(num) {
2374
+ BN7.prototype.redMul = function redMul(num) {
2375
2375
  assert(this.red, "redMul works only with red numbers");
2376
2376
  this.red._verify2(this, num);
2377
2377
  return this.red.mul(this, num);
2378
2378
  };
2379
- BN6.prototype.redIMul = function redIMul(num) {
2379
+ BN7.prototype.redIMul = function redIMul(num) {
2380
2380
  assert(this.red, "redMul works only with red numbers");
2381
2381
  this.red._verify2(this, num);
2382
2382
  return this.red.imul(this, num);
2383
2383
  };
2384
- BN6.prototype.redSqr = function redSqr() {
2384
+ BN7.prototype.redSqr = function redSqr() {
2385
2385
  assert(this.red, "redSqr works only with red numbers");
2386
2386
  this.red._verify1(this);
2387
2387
  return this.red.sqr(this);
2388
2388
  };
2389
- BN6.prototype.redISqr = function redISqr() {
2389
+ BN7.prototype.redISqr = function redISqr() {
2390
2390
  assert(this.red, "redISqr works only with red numbers");
2391
2391
  this.red._verify1(this);
2392
2392
  return this.red.isqr(this);
2393
2393
  };
2394
- BN6.prototype.redSqrt = function redSqrt() {
2394
+ BN7.prototype.redSqrt = function redSqrt() {
2395
2395
  assert(this.red, "redSqrt works only with red numbers");
2396
2396
  this.red._verify1(this);
2397
2397
  return this.red.sqrt(this);
2398
2398
  };
2399
- BN6.prototype.redInvm = function redInvm() {
2399
+ BN7.prototype.redInvm = function redInvm() {
2400
2400
  assert(this.red, "redInvm works only with red numbers");
2401
2401
  this.red._verify1(this);
2402
2402
  return this.red.invm(this);
2403
2403
  };
2404
- BN6.prototype.redNeg = function redNeg() {
2404
+ BN7.prototype.redNeg = function redNeg() {
2405
2405
  assert(this.red, "redNeg works only with red numbers");
2406
2406
  this.red._verify1(this);
2407
2407
  return this.red.neg(this);
2408
2408
  };
2409
- BN6.prototype.redPow = function redPow(num) {
2409
+ BN7.prototype.redPow = function redPow(num) {
2410
2410
  assert(this.red && !num.red, "redPow(normalNum)");
2411
2411
  this.red._verify1(this);
2412
2412
  return this.red.pow(this, num);
@@ -2419,13 +2419,13 @@ var require_bn = __commonJS({
2419
2419
  };
2420
2420
  function MPrime(name, p) {
2421
2421
  this.name = name;
2422
- this.p = new BN6(p, 16);
2422
+ this.p = new BN7(p, 16);
2423
2423
  this.n = this.p.bitLength();
2424
- this.k = new BN6(1).iushln(this.n).isub(this.p);
2424
+ this.k = new BN7(1).iushln(this.n).isub(this.p);
2425
2425
  this.tmp = this._tmp();
2426
2426
  }
2427
2427
  MPrime.prototype._tmp = function _tmp() {
2428
- var tmp = new BN6(null);
2428
+ var tmp = new BN7(null);
2429
2429
  tmp.words = new Array(Math.ceil(this.n / 13));
2430
2430
  return tmp;
2431
2431
  };
@@ -2551,7 +2551,7 @@ var require_bn = __commonJS({
2551
2551
  }
2552
2552
  return num;
2553
2553
  };
2554
- BN6._prime = function prime(name) {
2554
+ BN7._prime = function prime(name) {
2555
2555
  if (primes[name]) return primes[name];
2556
2556
  var prime2;
2557
2557
  if (name === "k256") {
@@ -2570,7 +2570,7 @@ var require_bn = __commonJS({
2570
2570
  };
2571
2571
  function Red(m) {
2572
2572
  if (typeof m === "string") {
2573
- var prime = BN6._prime(m);
2573
+ var prime = BN7._prime(m);
2574
2574
  this.m = prime.p;
2575
2575
  this.prime = prime;
2576
2576
  } else {
@@ -2656,7 +2656,7 @@ var require_bn = __commonJS({
2656
2656
  var mod3 = this.m.andln(3);
2657
2657
  assert(mod3 % 2 === 1);
2658
2658
  if (mod3 === 3) {
2659
- var pow2 = this.m.add(new BN6(1)).iushrn(2);
2659
+ var pow2 = this.m.add(new BN7(1)).iushrn(2);
2660
2660
  return this.pow(a, pow2);
2661
2661
  }
2662
2662
  var q = this.m.subn(1);
@@ -2666,11 +2666,11 @@ var require_bn = __commonJS({
2666
2666
  q.iushrn(1);
2667
2667
  }
2668
2668
  assert(!q.isZero());
2669
- var one = new BN6(1).toRed(this);
2669
+ var one = new BN7(1).toRed(this);
2670
2670
  var nOne = one.redNeg();
2671
2671
  var lpow = this.m.subn(1).iushrn(1);
2672
2672
  var z = this.m.bitLength();
2673
- z = new BN6(2 * z * z).toRed(this);
2673
+ z = new BN7(2 * z * z).toRed(this);
2674
2674
  while (this.pow(z, lpow).cmp(nOne) !== 0) {
2675
2675
  z.redIAdd(nOne);
2676
2676
  }
@@ -2684,7 +2684,7 @@ var require_bn = __commonJS({
2684
2684
  tmp = tmp.redSqr();
2685
2685
  }
2686
2686
  assert(i < m);
2687
- var b = this.pow(c, new BN6(1).iushln(m - i - 1));
2687
+ var b = this.pow(c, new BN7(1).iushln(m - i - 1));
2688
2688
  r = r.redMul(b);
2689
2689
  c = b.redSqr();
2690
2690
  t = t.redMul(c);
@@ -2702,11 +2702,11 @@ var require_bn = __commonJS({
2702
2702
  }
2703
2703
  };
2704
2704
  Red.prototype.pow = function pow2(a, num) {
2705
- if (num.isZero()) return new BN6(1).toRed(this);
2705
+ if (num.isZero()) return new BN7(1).toRed(this);
2706
2706
  if (num.cmpn(1) === 0) return a.clone();
2707
2707
  var windowSize = 4;
2708
2708
  var wnd = new Array(1 << windowSize);
2709
- wnd[0] = new BN6(1).toRed(this);
2709
+ wnd[0] = new BN7(1).toRed(this);
2710
2710
  wnd[1] = a;
2711
2711
  for (var i = 2; i < wnd.length; i++) {
2712
2712
  wnd[i] = this.mul(wnd[i - 1], a);
@@ -2750,7 +2750,7 @@ var require_bn = __commonJS({
2750
2750
  res.red = null;
2751
2751
  return res;
2752
2752
  };
2753
- BN6.mont = function mont(num) {
2753
+ BN7.mont = function mont(num) {
2754
2754
  return new Mont(num);
2755
2755
  };
2756
2756
  function Mont(m) {
@@ -2759,7 +2759,7 @@ var require_bn = __commonJS({
2759
2759
  if (this.shift % 26 !== 0) {
2760
2760
  this.shift += 26 - this.shift % 26;
2761
2761
  }
2762
- this.r = new BN6(1).iushln(this.shift);
2762
+ this.r = new BN7(1).iushln(this.shift);
2763
2763
  this.r2 = this.imod(this.r.sqr());
2764
2764
  this.rinv = this.r._invmp(this.m);
2765
2765
  this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
@@ -2793,7 +2793,7 @@ var require_bn = __commonJS({
2793
2793
  return res._forceRed(this);
2794
2794
  };
2795
2795
  Mont.prototype.mul = function mul2(a, b) {
2796
- if (a.isZero() || b.isZero()) return new BN6(0)._forceRed(this);
2796
+ if (a.isZero() || b.isZero()) return new BN7(0)._forceRed(this);
2797
2797
  var t = a.mul(b);
2798
2798
  var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
2799
2799
  var u = t.isub(c).iushrn(this.shift);
@@ -5205,7 +5205,7 @@ var Turbos = class {
5205
5205
  var Cetus = class {
5206
5206
  constructor(env, partner) {
5207
5207
  this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
5208
- this.partner = partner != null ? partner : "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b";
5208
+ this.partner = (partner != null ? partner : env === 0 /* Mainnet */) ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x8e0b7668a79592f70fbfb1ae0aebaf9e2019a7049783b9a4b6fe7c6ae038b528";
5209
5209
  }
5210
5210
  flash_swap(client, txb, path, by_amount_in) {
5211
5211
  const { direction, from, target } = path;
@@ -5795,7 +5795,10 @@ function swapInPools(client, params, sender) {
5795
5795
  target: targetCoin,
5796
5796
  feeRate: event.fee_rate,
5797
5797
  amountIn: event.amount_in,
5798
- amountOut: event.amount_out
5798
+ amountOut: event.amount_out,
5799
+ extendedDetails: {
5800
+ afterSqrtPrice: event.after_sqrt_price
5801
+ }
5799
5802
  }
5800
5803
  ],
5801
5804
  amountIn: new import_bn4.BN((_d = event.amount_in) != null ? _d : 0),
@@ -6215,7 +6218,7 @@ var AggregatorClient6 = class {
6215
6218
  if (this.env === 0 /* Mainnet */) {
6216
6219
  return "0xeffc8ae61f439bb34c9b905ff8f29ec56873dcedf81c7123ff2f1f67c45ec302";
6217
6220
  } else {
6218
- return "0x0";
6221
+ return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
6219
6222
  }
6220
6223
  }
6221
6224
  transferOrDestoryCoin(txb, coin, coinType) {
@@ -6313,16 +6316,17 @@ function parseRouterResponse(data) {
6313
6316
  routes: data.routes.map((route) => {
6314
6317
  return {
6315
6318
  path: route.path.map((path) => {
6316
- var _a, _b;
6319
+ var _a, _b, _c;
6317
6320
  let version;
6318
6321
  if (path.provider === AFTERMATH) {
6319
6322
  version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
6320
6323
  }
6321
6324
  let extendedDetails;
6322
- if (path.provider === TURBOS || path.provider === AFTERMATH) {
6325
+ if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS) {
6323
6326
  extendedDetails = {
6324
6327
  aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
6325
- turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type
6328
+ turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
6329
+ afterSqrtPrice: (_c = path.extended_details) == null ? void 0 : _c.after_sqrt_price
6326
6330
  };
6327
6331
  }
6328
6332
  return {
@@ -6349,41 +6353,43 @@ function parseRouterResponse(data) {
6349
6353
  // src/transaction/index.ts
6350
6354
  var CLOCK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000006";
6351
6355
 
6356
+ // src/utils/msafe.ts
6357
+ var import_bn6 = __toESM(require_bn());
6358
+ var dealWithFastRouterSwapParamsForMsafe = (data) => {
6359
+ const result = data.map((route) => {
6360
+ return __spreadProps(__spreadValues({}, route), {
6361
+ amountIn: route.amountIn.toString(),
6362
+ amountOut: route.amountOut.toString(),
6363
+ initialPrice: route.initialPrice.toString(),
6364
+ path: route.path
6365
+ });
6366
+ });
6367
+ return result;
6368
+ };
6369
+ var restituteMsafeFastRouterSwapParams = (data) => {
6370
+ const result = data.map((route) => {
6371
+ return __spreadProps(__spreadValues({}, route), {
6372
+ amountIn: new import_bn6.default(route.amountIn),
6373
+ amountOut: new import_bn6.default(route.amountOut),
6374
+ initialPrice: new decimal_default(route.initialPrice.toString()),
6375
+ path: route.path
6376
+ });
6377
+ });
6378
+ return result;
6379
+ };
6380
+
6352
6381
  // src/api.ts
6353
6382
  function getRouterResult(endpoint, params) {
6354
6383
  return __async(this, null, function* () {
6355
- const {
6356
- from,
6357
- target,
6358
- amount,
6359
- byAmountIn,
6360
- depth,
6361
- splitAlgorithm,
6362
- splitFactor,
6363
- splitCount,
6364
- providers
6365
- } = params;
6366
- const fromCoin = completionCoin(from);
6367
- const targetCoin = completionCoin(target);
6368
- let url = `${endpoint}?from=${fromCoin}&target=${targetCoin}&amount=${amount.toString()}&by_amount_in=${byAmountIn}`;
6369
- if (depth) {
6370
- url += `&depth=${depth}`;
6371
- }
6372
- if (splitAlgorithm) {
6373
- url += `&split_algorithm=${splitAlgorithm}`;
6374
- }
6375
- if (splitFactor) {
6376
- url += `&split_factor=${splitFactor}`;
6377
- }
6378
- if (splitCount) {
6379
- url += `&split_count=${splitCount}`;
6384
+ let response;
6385
+ if (params.liquidityChanges && params.liquidityChanges.length > 0) {
6386
+ response = yield postRouterWithLiquidityChanges(endpoint, params);
6387
+ } else {
6388
+ response = yield getRouter(endpoint, params);
6380
6389
  }
6381
- if (providers) {
6382
- if (providers.length > 0) {
6383
- url += `&providers=${providers.join(",")}`;
6384
- }
6390
+ if (!response) {
6391
+ return null;
6385
6392
  }
6386
- const response = yield fetch(url);
6387
6393
  if (!response.ok) {
6388
6394
  return {
6389
6395
  amountIn: ZERO,
@@ -6418,6 +6424,99 @@ function getRouterResult(endpoint, params) {
6418
6424
  };
6419
6425
  });
6420
6426
  }
6427
+ function getRouter(endpoint, params) {
6428
+ return __async(this, null, function* () {
6429
+ try {
6430
+ const {
6431
+ from,
6432
+ target,
6433
+ amount,
6434
+ byAmountIn,
6435
+ depth,
6436
+ splitAlgorithm,
6437
+ splitFactor,
6438
+ splitCount,
6439
+ providers
6440
+ } = params;
6441
+ const fromCoin = completionCoin(from);
6442
+ const targetCoin = completionCoin(target);
6443
+ let url = `${endpoint}?from=${fromCoin}&target=${targetCoin}&amount=${amount.toString()}&by_amount_in=${byAmountIn}`;
6444
+ if (depth) {
6445
+ url += `&depth=${depth}`;
6446
+ }
6447
+ if (splitAlgorithm) {
6448
+ url += `&split_algorithm=${splitAlgorithm}`;
6449
+ }
6450
+ if (splitFactor) {
6451
+ url += `&split_factor=${splitFactor}`;
6452
+ }
6453
+ if (splitCount) {
6454
+ url += `&split_count=${splitCount}`;
6455
+ }
6456
+ if (providers) {
6457
+ if (providers.length > 0) {
6458
+ url += `&providers=${providers.join(",")}`;
6459
+ }
6460
+ }
6461
+ const response = yield fetch(url);
6462
+ return response;
6463
+ } catch (error) {
6464
+ console.error(error);
6465
+ return null;
6466
+ }
6467
+ });
6468
+ }
6469
+ function postRouterWithLiquidityChanges(endpoint, params) {
6470
+ return __async(this, null, function* () {
6471
+ const {
6472
+ from,
6473
+ target,
6474
+ amount,
6475
+ byAmountIn,
6476
+ depth,
6477
+ splitAlgorithm,
6478
+ splitFactor,
6479
+ splitCount,
6480
+ providers,
6481
+ liquidityChanges
6482
+ } = params;
6483
+ const fromCoin = completionCoin(from);
6484
+ const targetCoin = completionCoin(target);
6485
+ const url = `${endpoint}`;
6486
+ const providersStr = providers == null ? void 0 : providers.join(",");
6487
+ const requestData = {
6488
+ from: fromCoin,
6489
+ target: targetCoin,
6490
+ amount: Number(amount.toString()),
6491
+ by_amount_in: byAmountIn,
6492
+ depth,
6493
+ split_algorithm: splitAlgorithm,
6494
+ split_factor: splitFactor,
6495
+ split_count: splitCount,
6496
+ providers: providersStr,
6497
+ liquidity_changes: liquidityChanges.map((change) => ({
6498
+ pool: change.poolID,
6499
+ tick_lower: change.ticklower,
6500
+ tick_upper: change.tickUpper,
6501
+ delta_liquidity: change.deltaLiquidity
6502
+ }))
6503
+ };
6504
+ console.log("requestData", JSON.stringify(requestData, null, 2));
6505
+ try {
6506
+ const response = yield fetch(url, {
6507
+ method: "POST",
6508
+ headers: {
6509
+ "Content-Type": "application/json"
6510
+ },
6511
+ body: JSON.stringify(requestData)
6512
+ });
6513
+ return response;
6514
+ } catch (error) {
6515
+ console.error("Error:", error);
6516
+ return null;
6517
+ }
6518
+ });
6519
+ }
6421
6520
 
6422
6521
  // src/index.ts
6423
6522
  var Env = /* @__PURE__ */ ((Env2) => {
@@ -6437,4 +6536,4 @@ decimal.js/decimal.mjs:
6437
6536
  *)
6438
6537
  */
6439
6538
 
6440
- export { AFSUI, AFTERMATH, AggregatorClient6 as AggregatorClient, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, Env, FLOWXV2, FLOWXV3, HAEDAL, KRIYA, KRIYAV3, ONE, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId };
6539
+ export { AFSUI, AFTERMATH, AggregatorClient6 as AggregatorClient, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, Env, FLOWXV2, FLOWXV3, HAEDAL, KRIYA, KRIYAV3, ONE, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };