@bench.games/opportunity-markets 0.1.0 → 0.1.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.
- package/dist/browser/index.js +325 -193
- package/dist/index.cjs +342 -193
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -49
- package/dist/index.d.ts +120 -49
- package/dist/index.js +325 -193
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -50,8 +50,8 @@ var require_bn = __commonJS({
|
|
|
50
50
|
ctor.prototype = new TempCtor();
|
|
51
51
|
ctor.prototype.constructor = ctor;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
if (
|
|
53
|
+
function BN4(number2, base, endian) {
|
|
54
|
+
if (BN4.isBN(number2)) {
|
|
55
55
|
return number2;
|
|
56
56
|
}
|
|
57
57
|
this.negative = 0;
|
|
@@ -67,12 +67,12 @@ var require_bn = __commonJS({
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
if (typeof module3 === "object") {
|
|
70
|
-
module3.exports =
|
|
70
|
+
module3.exports = BN4;
|
|
71
71
|
} else {
|
|
72
|
-
exports3.BN =
|
|
72
|
+
exports3.BN = BN4;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
BN4.BN = BN4;
|
|
75
|
+
BN4.wordSize = 26;
|
|
76
76
|
var Buffer3;
|
|
77
77
|
try {
|
|
78
78
|
if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
|
|
@@ -82,21 +82,21 @@ var require_bn = __commonJS({
|
|
|
82
82
|
}
|
|
83
83
|
} catch (e) {
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
if (num instanceof
|
|
85
|
+
BN4.isBN = function isBN(num) {
|
|
86
|
+
if (num instanceof BN4) {
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
|
-
return num !== null && typeof num === "object" && num.constructor.wordSize ===
|
|
89
|
+
return num !== null && typeof num === "object" && num.constructor.wordSize === BN4.wordSize && Array.isArray(num.words);
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
BN4.max = function max(left, right) {
|
|
92
92
|
if (left.cmp(right) > 0) return left;
|
|
93
93
|
return right;
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
BN4.min = function min(left, right) {
|
|
96
96
|
if (left.cmp(right) < 0) return left;
|
|
97
97
|
return right;
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
BN4.prototype._init = function init(number2, base, endian) {
|
|
100
100
|
if (typeof number2 === "number") {
|
|
101
101
|
return this._initNumber(number2, base, endian);
|
|
102
102
|
}
|
|
@@ -124,7 +124,7 @@ var require_bn = __commonJS({
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
|
|
127
|
+
BN4.prototype._initNumber = function _initNumber(number2, base, endian) {
|
|
128
128
|
if (number2 < 0) {
|
|
129
129
|
this.negative = 1;
|
|
130
130
|
number2 = -number2;
|
|
@@ -150,7 +150,7 @@ var require_bn = __commonJS({
|
|
|
150
150
|
if (endian !== "le") return;
|
|
151
151
|
this._initArray(this.toArray(), base, endian);
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
BN4.prototype._initArray = function _initArray(number2, base, endian) {
|
|
154
154
|
assert3(typeof number2.length === "number");
|
|
155
155
|
if (number2.length <= 0) {
|
|
156
156
|
this.words = [0];
|
|
@@ -208,7 +208,7 @@ var require_bn = __commonJS({
|
|
|
208
208
|
}
|
|
209
209
|
return r;
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
BN4.prototype._parseHex = function _parseHex(number2, start, endian) {
|
|
212
212
|
this.length = Math.ceil((number2.length - start) / 6);
|
|
213
213
|
this.words = new Array(this.length);
|
|
214
214
|
for (var i = 0; i < this.length; i++) {
|
|
@@ -264,7 +264,7 @@ var require_bn = __commonJS({
|
|
|
264
264
|
}
|
|
265
265
|
return r;
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
BN4.prototype._parseBase = function _parseBase(number2, base, start) {
|
|
268
268
|
this.words = [0];
|
|
269
269
|
this.length = 1;
|
|
270
270
|
for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
|
|
@@ -300,7 +300,7 @@ var require_bn = __commonJS({
|
|
|
300
300
|
}
|
|
301
301
|
this._strip();
|
|
302
302
|
};
|
|
303
|
-
|
|
303
|
+
BN4.prototype.copy = function copy(dest) {
|
|
304
304
|
dest.words = new Array(this.length);
|
|
305
305
|
for (var i = 0; i < this.length; i++) {
|
|
306
306
|
dest.words[i] = this.words[i];
|
|
@@ -315,27 +315,27 @@ var require_bn = __commonJS({
|
|
|
315
315
|
dest.negative = src.negative;
|
|
316
316
|
dest.red = src.red;
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
BN4.prototype._move = function _move(dest) {
|
|
319
319
|
move(dest, this);
|
|
320
320
|
};
|
|
321
|
-
|
|
322
|
-
var r = new
|
|
321
|
+
BN4.prototype.clone = function clone2() {
|
|
322
|
+
var r = new BN4(null);
|
|
323
323
|
this.copy(r);
|
|
324
324
|
return r;
|
|
325
325
|
};
|
|
326
|
-
|
|
326
|
+
BN4.prototype._expand = function _expand(size) {
|
|
327
327
|
while (this.length < size) {
|
|
328
328
|
this.words[this.length++] = 0;
|
|
329
329
|
}
|
|
330
330
|
return this;
|
|
331
331
|
};
|
|
332
|
-
|
|
332
|
+
BN4.prototype._strip = function strip() {
|
|
333
333
|
while (this.length > 1 && this.words[this.length - 1] === 0) {
|
|
334
334
|
this.length--;
|
|
335
335
|
}
|
|
336
336
|
return this._normSign();
|
|
337
337
|
};
|
|
338
|
-
|
|
338
|
+
BN4.prototype._normSign = function _normSign() {
|
|
339
339
|
if (this.length === 1 && this.words[0] === 0) {
|
|
340
340
|
this.negative = 0;
|
|
341
341
|
}
|
|
@@ -343,12 +343,12 @@ var require_bn = __commonJS({
|
|
|
343
343
|
};
|
|
344
344
|
if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
|
|
345
345
|
try {
|
|
346
|
-
|
|
346
|
+
BN4.prototype[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = inspect;
|
|
347
347
|
} catch (e) {
|
|
348
|
-
|
|
348
|
+
BN4.prototype.inspect = inspect;
|
|
349
349
|
}
|
|
350
350
|
} else {
|
|
351
|
-
|
|
351
|
+
BN4.prototype.inspect = inspect;
|
|
352
352
|
}
|
|
353
353
|
function inspect() {
|
|
354
354
|
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
|
|
@@ -459,7 +459,7 @@ var require_bn = __commonJS({
|
|
|
459
459
|
52521875,
|
|
460
460
|
60466176
|
|
461
461
|
];
|
|
462
|
-
|
|
462
|
+
BN4.prototype.toString = function toString(base, padding) {
|
|
463
463
|
base = base || 10;
|
|
464
464
|
padding = padding | 0 || 1;
|
|
465
465
|
var out;
|
|
@@ -521,7 +521,7 @@ var require_bn = __commonJS({
|
|
|
521
521
|
}
|
|
522
522
|
assert3(false, "Base should be between 2 and 36");
|
|
523
523
|
};
|
|
524
|
-
|
|
524
|
+
BN4.prototype.toNumber = function toNumber() {
|
|
525
525
|
var ret = this.words[0];
|
|
526
526
|
if (this.length === 2) {
|
|
527
527
|
ret += this.words[1] * 67108864;
|
|
@@ -532,15 +532,15 @@ var require_bn = __commonJS({
|
|
|
532
532
|
}
|
|
533
533
|
return this.negative !== 0 ? -ret : ret;
|
|
534
534
|
};
|
|
535
|
-
|
|
535
|
+
BN4.prototype.toJSON = function toJSON() {
|
|
536
536
|
return this.toString(16, 2);
|
|
537
537
|
};
|
|
538
538
|
if (Buffer3) {
|
|
539
|
-
|
|
539
|
+
BN4.prototype.toBuffer = function toBuffer2(endian, length) {
|
|
540
540
|
return this.toArrayLike(Buffer3, endian, length);
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
|
-
|
|
543
|
+
BN4.prototype.toArray = function toArray(endian, length) {
|
|
544
544
|
return this.toArrayLike(Array, endian, length);
|
|
545
545
|
};
|
|
546
546
|
var allocate = function allocate2(ArrayType, size) {
|
|
@@ -549,7 +549,7 @@ var require_bn = __commonJS({
|
|
|
549
549
|
}
|
|
550
550
|
return new ArrayType(size);
|
|
551
551
|
};
|
|
552
|
-
|
|
552
|
+
BN4.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
|
|
553
553
|
this._strip();
|
|
554
554
|
var byteLength = this.byteLength();
|
|
555
555
|
var reqLength = length || Math.max(1, byteLength);
|
|
@@ -560,7 +560,7 @@ var require_bn = __commonJS({
|
|
|
560
560
|
this["_toArrayLike" + postfix](res, byteLength);
|
|
561
561
|
return res;
|
|
562
562
|
};
|
|
563
|
-
|
|
563
|
+
BN4.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
|
|
564
564
|
var position = 0;
|
|
565
565
|
var carry = 0;
|
|
566
566
|
for (var i = 0, shift = 0; i < this.length; i++) {
|
|
@@ -590,7 +590,7 @@ var require_bn = __commonJS({
|
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
};
|
|
593
|
-
|
|
593
|
+
BN4.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {
|
|
594
594
|
var position = res.length - 1;
|
|
595
595
|
var carry = 0;
|
|
596
596
|
for (var i = 0, shift = 0; i < this.length; i++) {
|
|
@@ -621,11 +621,11 @@ var require_bn = __commonJS({
|
|
|
621
621
|
}
|
|
622
622
|
};
|
|
623
623
|
if (Math.clz32) {
|
|
624
|
-
|
|
624
|
+
BN4.prototype._countBits = function _countBits(w) {
|
|
625
625
|
return 32 - Math.clz32(w);
|
|
626
626
|
};
|
|
627
627
|
} else {
|
|
628
|
-
|
|
628
|
+
BN4.prototype._countBits = function _countBits(w) {
|
|
629
629
|
var t = w;
|
|
630
630
|
var r = 0;
|
|
631
631
|
if (t >= 4096) {
|
|
@@ -647,7 +647,7 @@ var require_bn = __commonJS({
|
|
|
647
647
|
return r + t;
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
|
|
650
|
+
BN4.prototype._zeroBits = function _zeroBits(w) {
|
|
651
651
|
if (w === 0) return 26;
|
|
652
652
|
var t = w;
|
|
653
653
|
var r = 0;
|
|
@@ -672,7 +672,7 @@ var require_bn = __commonJS({
|
|
|
672
672
|
}
|
|
673
673
|
return r;
|
|
674
674
|
};
|
|
675
|
-
|
|
675
|
+
BN4.prototype.bitLength = function bitLength() {
|
|
676
676
|
var w = this.words[this.length - 1];
|
|
677
677
|
var hi = this._countBits(w);
|
|
678
678
|
return (this.length - 1) * 26 + hi;
|
|
@@ -686,7 +686,7 @@ var require_bn = __commonJS({
|
|
|
686
686
|
}
|
|
687
687
|
return w;
|
|
688
688
|
}
|
|
689
|
-
|
|
689
|
+
BN4.prototype.zeroBits = function zeroBits() {
|
|
690
690
|
if (this.isZero()) return 0;
|
|
691
691
|
var r = 0;
|
|
692
692
|
for (var i = 0; i < this.length; i++) {
|
|
@@ -696,34 +696,34 @@ var require_bn = __commonJS({
|
|
|
696
696
|
}
|
|
697
697
|
return r;
|
|
698
698
|
};
|
|
699
|
-
|
|
699
|
+
BN4.prototype.byteLength = function byteLength() {
|
|
700
700
|
return Math.ceil(this.bitLength() / 8);
|
|
701
701
|
};
|
|
702
|
-
|
|
702
|
+
BN4.prototype.toTwos = function toTwos(width) {
|
|
703
703
|
if (this.negative !== 0) {
|
|
704
704
|
return this.abs().inotn(width).iaddn(1);
|
|
705
705
|
}
|
|
706
706
|
return this.clone();
|
|
707
707
|
};
|
|
708
|
-
|
|
708
|
+
BN4.prototype.fromTwos = function fromTwos(width) {
|
|
709
709
|
if (this.testn(width - 1)) {
|
|
710
710
|
return this.notn(width).iaddn(1).ineg();
|
|
711
711
|
}
|
|
712
712
|
return this.clone();
|
|
713
713
|
};
|
|
714
|
-
|
|
714
|
+
BN4.prototype.isNeg = function isNeg() {
|
|
715
715
|
return this.negative !== 0;
|
|
716
716
|
};
|
|
717
|
-
|
|
717
|
+
BN4.prototype.neg = function neg() {
|
|
718
718
|
return this.clone().ineg();
|
|
719
719
|
};
|
|
720
|
-
|
|
720
|
+
BN4.prototype.ineg = function ineg() {
|
|
721
721
|
if (!this.isZero()) {
|
|
722
722
|
this.negative ^= 1;
|
|
723
723
|
}
|
|
724
724
|
return this;
|
|
725
725
|
};
|
|
726
|
-
|
|
726
|
+
BN4.prototype.iuor = function iuor(num) {
|
|
727
727
|
while (this.length < num.length) {
|
|
728
728
|
this.words[this.length++] = 0;
|
|
729
729
|
}
|
|
@@ -732,19 +732,19 @@ var require_bn = __commonJS({
|
|
|
732
732
|
}
|
|
733
733
|
return this._strip();
|
|
734
734
|
};
|
|
735
|
-
|
|
735
|
+
BN4.prototype.ior = function ior(num) {
|
|
736
736
|
assert3((this.negative | num.negative) === 0);
|
|
737
737
|
return this.iuor(num);
|
|
738
738
|
};
|
|
739
|
-
|
|
739
|
+
BN4.prototype.or = function or(num) {
|
|
740
740
|
if (this.length > num.length) return this.clone().ior(num);
|
|
741
741
|
return num.clone().ior(this);
|
|
742
742
|
};
|
|
743
|
-
|
|
743
|
+
BN4.prototype.uor = function uor(num) {
|
|
744
744
|
if (this.length > num.length) return this.clone().iuor(num);
|
|
745
745
|
return num.clone().iuor(this);
|
|
746
746
|
};
|
|
747
|
-
|
|
747
|
+
BN4.prototype.iuand = function iuand(num) {
|
|
748
748
|
var b;
|
|
749
749
|
if (this.length > num.length) {
|
|
750
750
|
b = num;
|
|
@@ -757,19 +757,19 @@ var require_bn = __commonJS({
|
|
|
757
757
|
this.length = b.length;
|
|
758
758
|
return this._strip();
|
|
759
759
|
};
|
|
760
|
-
|
|
760
|
+
BN4.prototype.iand = function iand(num) {
|
|
761
761
|
assert3((this.negative | num.negative) === 0);
|
|
762
762
|
return this.iuand(num);
|
|
763
763
|
};
|
|
764
|
-
|
|
764
|
+
BN4.prototype.and = function and(num) {
|
|
765
765
|
if (this.length > num.length) return this.clone().iand(num);
|
|
766
766
|
return num.clone().iand(this);
|
|
767
767
|
};
|
|
768
|
-
|
|
768
|
+
BN4.prototype.uand = function uand(num) {
|
|
769
769
|
if (this.length > num.length) return this.clone().iuand(num);
|
|
770
770
|
return num.clone().iuand(this);
|
|
771
771
|
};
|
|
772
|
-
|
|
772
|
+
BN4.prototype.iuxor = function iuxor(num) {
|
|
773
773
|
var a;
|
|
774
774
|
var b;
|
|
775
775
|
if (this.length > num.length) {
|
|
@@ -790,19 +790,19 @@ var require_bn = __commonJS({
|
|
|
790
790
|
this.length = a.length;
|
|
791
791
|
return this._strip();
|
|
792
792
|
};
|
|
793
|
-
|
|
793
|
+
BN4.prototype.ixor = function ixor(num) {
|
|
794
794
|
assert3((this.negative | num.negative) === 0);
|
|
795
795
|
return this.iuxor(num);
|
|
796
796
|
};
|
|
797
|
-
|
|
797
|
+
BN4.prototype.xor = function xor(num) {
|
|
798
798
|
if (this.length > num.length) return this.clone().ixor(num);
|
|
799
799
|
return num.clone().ixor(this);
|
|
800
800
|
};
|
|
801
|
-
|
|
801
|
+
BN4.prototype.uxor = function uxor(num) {
|
|
802
802
|
if (this.length > num.length) return this.clone().iuxor(num);
|
|
803
803
|
return num.clone().iuxor(this);
|
|
804
804
|
};
|
|
805
|
-
|
|
805
|
+
BN4.prototype.inotn = function inotn(width) {
|
|
806
806
|
assert3(typeof width === "number" && width >= 0);
|
|
807
807
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
|
808
808
|
var bitsLeft = width % 26;
|
|
@@ -818,10 +818,10 @@ var require_bn = __commonJS({
|
|
|
818
818
|
}
|
|
819
819
|
return this._strip();
|
|
820
820
|
};
|
|
821
|
-
|
|
821
|
+
BN4.prototype.notn = function notn(width) {
|
|
822
822
|
return this.clone().inotn(width);
|
|
823
823
|
};
|
|
824
|
-
|
|
824
|
+
BN4.prototype.setn = function setn(bit, val) {
|
|
825
825
|
assert3(typeof bit === "number" && bit >= 0);
|
|
826
826
|
var off = bit / 26 | 0;
|
|
827
827
|
var wbit = bit % 26;
|
|
@@ -833,7 +833,7 @@ var require_bn = __commonJS({
|
|
|
833
833
|
}
|
|
834
834
|
return this._strip();
|
|
835
835
|
};
|
|
836
|
-
|
|
836
|
+
BN4.prototype.iadd = function iadd(num) {
|
|
837
837
|
var r;
|
|
838
838
|
if (this.negative !== 0 && num.negative === 0) {
|
|
839
839
|
this.negative = 0;
|
|
@@ -876,7 +876,7 @@ var require_bn = __commonJS({
|
|
|
876
876
|
}
|
|
877
877
|
return this;
|
|
878
878
|
};
|
|
879
|
-
|
|
879
|
+
BN4.prototype.add = function add2(num) {
|
|
880
880
|
var res;
|
|
881
881
|
if (num.negative !== 0 && this.negative === 0) {
|
|
882
882
|
num.negative = 0;
|
|
@@ -892,7 +892,7 @@ var require_bn = __commonJS({
|
|
|
892
892
|
if (this.length > num.length) return this.clone().iadd(num);
|
|
893
893
|
return num.clone().iadd(this);
|
|
894
894
|
};
|
|
895
|
-
|
|
895
|
+
BN4.prototype.isub = function isub(num) {
|
|
896
896
|
if (num.negative !== 0) {
|
|
897
897
|
num.negative = 0;
|
|
898
898
|
var r = this.iadd(num);
|
|
@@ -941,7 +941,7 @@ var require_bn = __commonJS({
|
|
|
941
941
|
}
|
|
942
942
|
return this._strip();
|
|
943
943
|
};
|
|
944
|
-
|
|
944
|
+
BN4.prototype.sub = function sub(num) {
|
|
945
945
|
return this.clone().isub(num);
|
|
946
946
|
};
|
|
947
947
|
function smallMulTo(self, num, out) {
|
|
@@ -1569,7 +1569,7 @@ var require_bn = __commonJS({
|
|
|
1569
1569
|
function jumboMulTo(self, num, out) {
|
|
1570
1570
|
return bigMulTo(self, num, out);
|
|
1571
1571
|
}
|
|
1572
|
-
|
|
1572
|
+
BN4.prototype.mulTo = function mulTo(num, out) {
|
|
1573
1573
|
var res;
|
|
1574
1574
|
var len = this.length + num.length;
|
|
1575
1575
|
if (this.length === 10 && num.length === 10) {
|
|
@@ -1589,7 +1589,7 @@ var require_bn = __commonJS({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
FFTM.prototype.makeRBT = function makeRBT(N) {
|
|
1591
1591
|
var t = new Array(N);
|
|
1592
|
-
var l =
|
|
1592
|
+
var l = BN4.prototype._countBits(N) - 1;
|
|
1593
1593
|
for (var i = 0; i < N; i++) {
|
|
1594
1594
|
t[i] = this.revBin(i, l, N);
|
|
1595
1595
|
}
|
|
@@ -1724,20 +1724,20 @@ var require_bn = __commonJS({
|
|
|
1724
1724
|
out.length = x.length + y.length;
|
|
1725
1725
|
return out._strip();
|
|
1726
1726
|
};
|
|
1727
|
-
|
|
1728
|
-
var out = new
|
|
1727
|
+
BN4.prototype.mul = function mul(num) {
|
|
1728
|
+
var out = new BN4(null);
|
|
1729
1729
|
out.words = new Array(this.length + num.length);
|
|
1730
1730
|
return this.mulTo(num, out);
|
|
1731
1731
|
};
|
|
1732
|
-
|
|
1733
|
-
var out = new
|
|
1732
|
+
BN4.prototype.mulf = function mulf(num) {
|
|
1733
|
+
var out = new BN4(null);
|
|
1734
1734
|
out.words = new Array(this.length + num.length);
|
|
1735
1735
|
return jumboMulTo(this, num, out);
|
|
1736
1736
|
};
|
|
1737
|
-
|
|
1737
|
+
BN4.prototype.imul = function imul(num) {
|
|
1738
1738
|
return this.clone().mulTo(num, this);
|
|
1739
1739
|
};
|
|
1740
|
-
|
|
1740
|
+
BN4.prototype.imuln = function imuln(num) {
|
|
1741
1741
|
var isNegNum = num < 0;
|
|
1742
1742
|
if (isNegNum) num = -num;
|
|
1743
1743
|
assert3(typeof num === "number");
|
|
@@ -1758,18 +1758,18 @@ var require_bn = __commonJS({
|
|
|
1758
1758
|
this.length = num === 0 ? 1 : this.length;
|
|
1759
1759
|
return isNegNum ? this.ineg() : this;
|
|
1760
1760
|
};
|
|
1761
|
-
|
|
1761
|
+
BN4.prototype.muln = function muln(num) {
|
|
1762
1762
|
return this.clone().imuln(num);
|
|
1763
1763
|
};
|
|
1764
|
-
|
|
1764
|
+
BN4.prototype.sqr = function sqr() {
|
|
1765
1765
|
return this.mul(this);
|
|
1766
1766
|
};
|
|
1767
|
-
|
|
1767
|
+
BN4.prototype.isqr = function isqr() {
|
|
1768
1768
|
return this.imul(this.clone());
|
|
1769
1769
|
};
|
|
1770
|
-
|
|
1770
|
+
BN4.prototype.pow = function pow(num) {
|
|
1771
1771
|
var w = toBitArray(num);
|
|
1772
|
-
if (w.length === 0) return new
|
|
1772
|
+
if (w.length === 0) return new BN4(1);
|
|
1773
1773
|
var res = this;
|
|
1774
1774
|
for (var i = 0; i < w.length; i++, res = res.sqr()) {
|
|
1775
1775
|
if (w[i] !== 0) break;
|
|
@@ -1782,7 +1782,7 @@ var require_bn = __commonJS({
|
|
|
1782
1782
|
}
|
|
1783
1783
|
return res;
|
|
1784
1784
|
};
|
|
1785
|
-
|
|
1785
|
+
BN4.prototype.iushln = function iushln(bits) {
|
|
1786
1786
|
assert3(typeof bits === "number" && bits >= 0);
|
|
1787
1787
|
var r = bits % 26;
|
|
1788
1788
|
var s = (bits - r) / 26;
|
|
@@ -1812,11 +1812,11 @@ var require_bn = __commonJS({
|
|
|
1812
1812
|
}
|
|
1813
1813
|
return this._strip();
|
|
1814
1814
|
};
|
|
1815
|
-
|
|
1815
|
+
BN4.prototype.ishln = function ishln(bits) {
|
|
1816
1816
|
assert3(this.negative === 0);
|
|
1817
1817
|
return this.iushln(bits);
|
|
1818
1818
|
};
|
|
1819
|
-
|
|
1819
|
+
BN4.prototype.iushrn = function iushrn(bits, hint, extended) {
|
|
1820
1820
|
assert3(typeof bits === "number" && bits >= 0);
|
|
1821
1821
|
var h;
|
|
1822
1822
|
if (hint) {
|
|
@@ -1861,23 +1861,23 @@ var require_bn = __commonJS({
|
|
|
1861
1861
|
}
|
|
1862
1862
|
return this._strip();
|
|
1863
1863
|
};
|
|
1864
|
-
|
|
1864
|
+
BN4.prototype.ishrn = function ishrn(bits, hint, extended) {
|
|
1865
1865
|
assert3(this.negative === 0);
|
|
1866
1866
|
return this.iushrn(bits, hint, extended);
|
|
1867
1867
|
};
|
|
1868
|
-
|
|
1868
|
+
BN4.prototype.shln = function shln(bits) {
|
|
1869
1869
|
return this.clone().ishln(bits);
|
|
1870
1870
|
};
|
|
1871
|
-
|
|
1871
|
+
BN4.prototype.ushln = function ushln(bits) {
|
|
1872
1872
|
return this.clone().iushln(bits);
|
|
1873
1873
|
};
|
|
1874
|
-
|
|
1874
|
+
BN4.prototype.shrn = function shrn(bits) {
|
|
1875
1875
|
return this.clone().ishrn(bits);
|
|
1876
1876
|
};
|
|
1877
|
-
|
|
1877
|
+
BN4.prototype.ushrn = function ushrn(bits) {
|
|
1878
1878
|
return this.clone().iushrn(bits);
|
|
1879
1879
|
};
|
|
1880
|
-
|
|
1880
|
+
BN4.prototype.testn = function testn(bit) {
|
|
1881
1881
|
assert3(typeof bit === "number" && bit >= 0);
|
|
1882
1882
|
var r = bit % 26;
|
|
1883
1883
|
var s = (bit - r) / 26;
|
|
@@ -1886,7 +1886,7 @@ var require_bn = __commonJS({
|
|
|
1886
1886
|
var w = this.words[s];
|
|
1887
1887
|
return !!(w & q);
|
|
1888
1888
|
};
|
|
1889
|
-
|
|
1889
|
+
BN4.prototype.imaskn = function imaskn(bits) {
|
|
1890
1890
|
assert3(typeof bits === "number" && bits >= 0);
|
|
1891
1891
|
var r = bits % 26;
|
|
1892
1892
|
var s = (bits - r) / 26;
|
|
@@ -1904,10 +1904,10 @@ var require_bn = __commonJS({
|
|
|
1904
1904
|
}
|
|
1905
1905
|
return this._strip();
|
|
1906
1906
|
};
|
|
1907
|
-
|
|
1907
|
+
BN4.prototype.maskn = function maskn(bits) {
|
|
1908
1908
|
return this.clone().imaskn(bits);
|
|
1909
1909
|
};
|
|
1910
|
-
|
|
1910
|
+
BN4.prototype.iaddn = function iaddn(num) {
|
|
1911
1911
|
assert3(typeof num === "number");
|
|
1912
1912
|
assert3(num < 67108864);
|
|
1913
1913
|
if (num < 0) return this.isubn(-num);
|
|
@@ -1924,7 +1924,7 @@ var require_bn = __commonJS({
|
|
|
1924
1924
|
}
|
|
1925
1925
|
return this._iaddn(num);
|
|
1926
1926
|
};
|
|
1927
|
-
|
|
1927
|
+
BN4.prototype._iaddn = function _iaddn(num) {
|
|
1928
1928
|
this.words[0] += num;
|
|
1929
1929
|
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) {
|
|
1930
1930
|
this.words[i] -= 67108864;
|
|
@@ -1937,7 +1937,7 @@ var require_bn = __commonJS({
|
|
|
1937
1937
|
this.length = Math.max(this.length, i + 1);
|
|
1938
1938
|
return this;
|
|
1939
1939
|
};
|
|
1940
|
-
|
|
1940
|
+
BN4.prototype.isubn = function isubn(num) {
|
|
1941
1941
|
assert3(typeof num === "number");
|
|
1942
1942
|
assert3(num < 67108864);
|
|
1943
1943
|
if (num < 0) return this.iaddn(-num);
|
|
@@ -1959,20 +1959,20 @@ var require_bn = __commonJS({
|
|
|
1959
1959
|
}
|
|
1960
1960
|
return this._strip();
|
|
1961
1961
|
};
|
|
1962
|
-
|
|
1962
|
+
BN4.prototype.addn = function addn(num) {
|
|
1963
1963
|
return this.clone().iaddn(num);
|
|
1964
1964
|
};
|
|
1965
|
-
|
|
1965
|
+
BN4.prototype.subn = function subn(num) {
|
|
1966
1966
|
return this.clone().isubn(num);
|
|
1967
1967
|
};
|
|
1968
|
-
|
|
1968
|
+
BN4.prototype.iabs = function iabs() {
|
|
1969
1969
|
this.negative = 0;
|
|
1970
1970
|
return this;
|
|
1971
1971
|
};
|
|
1972
|
-
|
|
1972
|
+
BN4.prototype.abs = function abs() {
|
|
1973
1973
|
return this.clone().iabs();
|
|
1974
1974
|
};
|
|
1975
|
-
|
|
1975
|
+
BN4.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {
|
|
1976
1976
|
var len = num.length + shift;
|
|
1977
1977
|
var i;
|
|
1978
1978
|
this._expand(len);
|
|
@@ -2001,7 +2001,7 @@ var require_bn = __commonJS({
|
|
|
2001
2001
|
this.negative = 1;
|
|
2002
2002
|
return this._strip();
|
|
2003
2003
|
};
|
|
2004
|
-
|
|
2004
|
+
BN4.prototype._wordDiv = function _wordDiv(num, mode) {
|
|
2005
2005
|
var shift = this.length - num.length;
|
|
2006
2006
|
var a = this.clone();
|
|
2007
2007
|
var b = num;
|
|
@@ -2016,7 +2016,7 @@ var require_bn = __commonJS({
|
|
|
2016
2016
|
var m = a.length - b.length;
|
|
2017
2017
|
var q;
|
|
2018
2018
|
if (mode !== "mod") {
|
|
2019
|
-
q = new
|
|
2019
|
+
q = new BN4(null);
|
|
2020
2020
|
q.length = m + 1;
|
|
2021
2021
|
q.words = new Array(q.length);
|
|
2022
2022
|
for (var i = 0; i < q.length; i++) {
|
|
@@ -2058,12 +2058,12 @@ var require_bn = __commonJS({
|
|
|
2058
2058
|
mod: a
|
|
2059
2059
|
};
|
|
2060
2060
|
};
|
|
2061
|
-
|
|
2061
|
+
BN4.prototype.divmod = function divmod(num, mode, positive) {
|
|
2062
2062
|
assert3(!num.isZero());
|
|
2063
2063
|
if (this.isZero()) {
|
|
2064
2064
|
return {
|
|
2065
|
-
div: new
|
|
2066
|
-
mod: new
|
|
2065
|
+
div: new BN4(0),
|
|
2066
|
+
mod: new BN4(0)
|
|
2067
2067
|
};
|
|
2068
2068
|
}
|
|
2069
2069
|
var div, mod2, res;
|
|
@@ -2108,7 +2108,7 @@ var require_bn = __commonJS({
|
|
|
2108
2108
|
}
|
|
2109
2109
|
if (num.length > this.length || this.cmp(num) < 0) {
|
|
2110
2110
|
return {
|
|
2111
|
-
div: new
|
|
2111
|
+
div: new BN4(0),
|
|
2112
2112
|
mod: this
|
|
2113
2113
|
};
|
|
2114
2114
|
}
|
|
@@ -2122,26 +2122,26 @@ var require_bn = __commonJS({
|
|
|
2122
2122
|
if (mode === "mod") {
|
|
2123
2123
|
return {
|
|
2124
2124
|
div: null,
|
|
2125
|
-
mod: new
|
|
2125
|
+
mod: new BN4(this.modrn(num.words[0]))
|
|
2126
2126
|
};
|
|
2127
2127
|
}
|
|
2128
2128
|
return {
|
|
2129
2129
|
div: this.divn(num.words[0]),
|
|
2130
|
-
mod: new
|
|
2130
|
+
mod: new BN4(this.modrn(num.words[0]))
|
|
2131
2131
|
};
|
|
2132
2132
|
}
|
|
2133
2133
|
return this._wordDiv(num, mode);
|
|
2134
2134
|
};
|
|
2135
|
-
|
|
2135
|
+
BN4.prototype.div = function div(num) {
|
|
2136
2136
|
return this.divmod(num, "div", false).div;
|
|
2137
2137
|
};
|
|
2138
|
-
|
|
2138
|
+
BN4.prototype.mod = function mod2(num) {
|
|
2139
2139
|
return this.divmod(num, "mod", false).mod;
|
|
2140
2140
|
};
|
|
2141
|
-
|
|
2141
|
+
BN4.prototype.umod = function umod(num) {
|
|
2142
2142
|
return this.divmod(num, "mod", true).mod;
|
|
2143
2143
|
};
|
|
2144
|
-
|
|
2144
|
+
BN4.prototype.divRound = function divRound(num) {
|
|
2145
2145
|
var dm = this.divmod(num);
|
|
2146
2146
|
if (dm.mod.isZero()) return dm.div;
|
|
2147
2147
|
var mod2 = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
|
|
@@ -2151,7 +2151,7 @@ var require_bn = __commonJS({
|
|
|
2151
2151
|
if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
|
|
2152
2152
|
return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
|
|
2153
2153
|
};
|
|
2154
|
-
|
|
2154
|
+
BN4.prototype.modrn = function modrn(num) {
|
|
2155
2155
|
var isNegNum = num < 0;
|
|
2156
2156
|
if (isNegNum) num = -num;
|
|
2157
2157
|
assert3(num <= 67108863);
|
|
@@ -2162,10 +2162,10 @@ var require_bn = __commonJS({
|
|
|
2162
2162
|
}
|
|
2163
2163
|
return isNegNum ? -acc : acc;
|
|
2164
2164
|
};
|
|
2165
|
-
|
|
2165
|
+
BN4.prototype.modn = function modn(num) {
|
|
2166
2166
|
return this.modrn(num);
|
|
2167
2167
|
};
|
|
2168
|
-
|
|
2168
|
+
BN4.prototype.idivn = function idivn(num) {
|
|
2169
2169
|
var isNegNum = num < 0;
|
|
2170
2170
|
if (isNegNum) num = -num;
|
|
2171
2171
|
assert3(num <= 67108863);
|
|
@@ -2178,10 +2178,10 @@ var require_bn = __commonJS({
|
|
|
2178
2178
|
this._strip();
|
|
2179
2179
|
return isNegNum ? this.ineg() : this;
|
|
2180
2180
|
};
|
|
2181
|
-
|
|
2181
|
+
BN4.prototype.divn = function divn(num) {
|
|
2182
2182
|
return this.clone().idivn(num);
|
|
2183
2183
|
};
|
|
2184
|
-
|
|
2184
|
+
BN4.prototype.egcd = function egcd(p) {
|
|
2185
2185
|
assert3(p.negative === 0);
|
|
2186
2186
|
assert3(!p.isZero());
|
|
2187
2187
|
var x = this;
|
|
@@ -2191,10 +2191,10 @@ var require_bn = __commonJS({
|
|
|
2191
2191
|
} else {
|
|
2192
2192
|
x = x.clone();
|
|
2193
2193
|
}
|
|
2194
|
-
var A = new
|
|
2195
|
-
var B = new
|
|
2196
|
-
var C = new
|
|
2197
|
-
var D = new
|
|
2194
|
+
var A = new BN4(1);
|
|
2195
|
+
var B = new BN4(0);
|
|
2196
|
+
var C = new BN4(0);
|
|
2197
|
+
var D = new BN4(1);
|
|
2198
2198
|
var g = 0;
|
|
2199
2199
|
while (x.isEven() && y.isEven()) {
|
|
2200
2200
|
x.iushrn(1);
|
|
@@ -2244,7 +2244,7 @@ var require_bn = __commonJS({
|
|
|
2244
2244
|
gcd: y.iushln(g)
|
|
2245
2245
|
};
|
|
2246
2246
|
};
|
|
2247
|
-
|
|
2247
|
+
BN4.prototype._invmp = function _invmp(p) {
|
|
2248
2248
|
assert3(p.negative === 0);
|
|
2249
2249
|
assert3(!p.isZero());
|
|
2250
2250
|
var a = this;
|
|
@@ -2254,8 +2254,8 @@ var require_bn = __commonJS({
|
|
|
2254
2254
|
} else {
|
|
2255
2255
|
a = a.clone();
|
|
2256
2256
|
}
|
|
2257
|
-
var x1 = new
|
|
2258
|
-
var x2 = new
|
|
2257
|
+
var x1 = new BN4(1);
|
|
2258
|
+
var x2 = new BN4(0);
|
|
2259
2259
|
var delta = b.clone();
|
|
2260
2260
|
while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
|
|
2261
2261
|
for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ;
|
|
@@ -2297,7 +2297,7 @@ var require_bn = __commonJS({
|
|
|
2297
2297
|
}
|
|
2298
2298
|
return res;
|
|
2299
2299
|
};
|
|
2300
|
-
|
|
2300
|
+
BN4.prototype.gcd = function gcd(num) {
|
|
2301
2301
|
if (this.isZero()) return num.abs();
|
|
2302
2302
|
if (num.isZero()) return this.abs();
|
|
2303
2303
|
var a = this.clone();
|
|
@@ -2327,19 +2327,19 @@ var require_bn = __commonJS({
|
|
|
2327
2327
|
} while (true);
|
|
2328
2328
|
return b.iushln(shift);
|
|
2329
2329
|
};
|
|
2330
|
-
|
|
2330
|
+
BN4.prototype.invm = function invm(num) {
|
|
2331
2331
|
return this.egcd(num).a.umod(num);
|
|
2332
2332
|
};
|
|
2333
|
-
|
|
2333
|
+
BN4.prototype.isEven = function isEven() {
|
|
2334
2334
|
return (this.words[0] & 1) === 0;
|
|
2335
2335
|
};
|
|
2336
|
-
|
|
2336
|
+
BN4.prototype.isOdd = function isOdd() {
|
|
2337
2337
|
return (this.words[0] & 1) === 1;
|
|
2338
2338
|
};
|
|
2339
|
-
|
|
2339
|
+
BN4.prototype.andln = function andln(num) {
|
|
2340
2340
|
return this.words[0] & num;
|
|
2341
2341
|
};
|
|
2342
|
-
|
|
2342
|
+
BN4.prototype.bincn = function bincn(bit) {
|
|
2343
2343
|
assert3(typeof bit === "number");
|
|
2344
2344
|
var r = bit % 26;
|
|
2345
2345
|
var s = (bit - r) / 26;
|
|
@@ -2363,10 +2363,10 @@ var require_bn = __commonJS({
|
|
|
2363
2363
|
}
|
|
2364
2364
|
return this;
|
|
2365
2365
|
};
|
|
2366
|
-
|
|
2366
|
+
BN4.prototype.isZero = function isZero() {
|
|
2367
2367
|
return this.length === 1 && this.words[0] === 0;
|
|
2368
2368
|
};
|
|
2369
|
-
|
|
2369
|
+
BN4.prototype.cmpn = function cmpn(num) {
|
|
2370
2370
|
var negative = num < 0;
|
|
2371
2371
|
if (this.negative !== 0 && !negative) return -1;
|
|
2372
2372
|
if (this.negative === 0 && negative) return 1;
|
|
@@ -2385,14 +2385,14 @@ var require_bn = __commonJS({
|
|
|
2385
2385
|
if (this.negative !== 0) return -res | 0;
|
|
2386
2386
|
return res;
|
|
2387
2387
|
};
|
|
2388
|
-
|
|
2388
|
+
BN4.prototype.cmp = function cmp(num) {
|
|
2389
2389
|
if (this.negative !== 0 && num.negative === 0) return -1;
|
|
2390
2390
|
if (this.negative === 0 && num.negative !== 0) return 1;
|
|
2391
2391
|
var res = this.ucmp(num);
|
|
2392
2392
|
if (this.negative !== 0) return -res | 0;
|
|
2393
2393
|
return res;
|
|
2394
2394
|
};
|
|
2395
|
-
|
|
2395
|
+
BN4.prototype.ucmp = function ucmp(num) {
|
|
2396
2396
|
if (this.length > num.length) return 1;
|
|
2397
2397
|
if (this.length < num.length) return -1;
|
|
2398
2398
|
var res = 0;
|
|
@@ -2409,112 +2409,112 @@ var require_bn = __commonJS({
|
|
|
2409
2409
|
}
|
|
2410
2410
|
return res;
|
|
2411
2411
|
};
|
|
2412
|
-
|
|
2412
|
+
BN4.prototype.gtn = function gtn(num) {
|
|
2413
2413
|
return this.cmpn(num) === 1;
|
|
2414
2414
|
};
|
|
2415
|
-
|
|
2415
|
+
BN4.prototype.gt = function gt(num) {
|
|
2416
2416
|
return this.cmp(num) === 1;
|
|
2417
2417
|
};
|
|
2418
|
-
|
|
2418
|
+
BN4.prototype.gten = function gten(num) {
|
|
2419
2419
|
return this.cmpn(num) >= 0;
|
|
2420
2420
|
};
|
|
2421
|
-
|
|
2421
|
+
BN4.prototype.gte = function gte(num) {
|
|
2422
2422
|
return this.cmp(num) >= 0;
|
|
2423
2423
|
};
|
|
2424
|
-
|
|
2424
|
+
BN4.prototype.ltn = function ltn(num) {
|
|
2425
2425
|
return this.cmpn(num) === -1;
|
|
2426
2426
|
};
|
|
2427
|
-
|
|
2427
|
+
BN4.prototype.lt = function lt(num) {
|
|
2428
2428
|
return this.cmp(num) === -1;
|
|
2429
2429
|
};
|
|
2430
|
-
|
|
2430
|
+
BN4.prototype.lten = function lten(num) {
|
|
2431
2431
|
return this.cmpn(num) <= 0;
|
|
2432
2432
|
};
|
|
2433
|
-
|
|
2433
|
+
BN4.prototype.lte = function lte(num) {
|
|
2434
2434
|
return this.cmp(num) <= 0;
|
|
2435
2435
|
};
|
|
2436
|
-
|
|
2436
|
+
BN4.prototype.eqn = function eqn(num) {
|
|
2437
2437
|
return this.cmpn(num) === 0;
|
|
2438
2438
|
};
|
|
2439
|
-
|
|
2439
|
+
BN4.prototype.eq = function eq(num) {
|
|
2440
2440
|
return this.cmp(num) === 0;
|
|
2441
2441
|
};
|
|
2442
|
-
|
|
2442
|
+
BN4.red = function red(num) {
|
|
2443
2443
|
return new Red(num);
|
|
2444
2444
|
};
|
|
2445
|
-
|
|
2445
|
+
BN4.prototype.toRed = function toRed(ctx) {
|
|
2446
2446
|
assert3(!this.red, "Already a number in reduction context");
|
|
2447
2447
|
assert3(this.negative === 0, "red works only with positives");
|
|
2448
2448
|
return ctx.convertTo(this)._forceRed(ctx);
|
|
2449
2449
|
};
|
|
2450
|
-
|
|
2450
|
+
BN4.prototype.fromRed = function fromRed() {
|
|
2451
2451
|
assert3(this.red, "fromRed works only with numbers in reduction context");
|
|
2452
2452
|
return this.red.convertFrom(this);
|
|
2453
2453
|
};
|
|
2454
|
-
|
|
2454
|
+
BN4.prototype._forceRed = function _forceRed(ctx) {
|
|
2455
2455
|
this.red = ctx;
|
|
2456
2456
|
return this;
|
|
2457
2457
|
};
|
|
2458
|
-
|
|
2458
|
+
BN4.prototype.forceRed = function forceRed(ctx) {
|
|
2459
2459
|
assert3(!this.red, "Already a number in reduction context");
|
|
2460
2460
|
return this._forceRed(ctx);
|
|
2461
2461
|
};
|
|
2462
|
-
|
|
2462
|
+
BN4.prototype.redAdd = function redAdd(num) {
|
|
2463
2463
|
assert3(this.red, "redAdd works only with red numbers");
|
|
2464
2464
|
return this.red.add(this, num);
|
|
2465
2465
|
};
|
|
2466
|
-
|
|
2466
|
+
BN4.prototype.redIAdd = function redIAdd(num) {
|
|
2467
2467
|
assert3(this.red, "redIAdd works only with red numbers");
|
|
2468
2468
|
return this.red.iadd(this, num);
|
|
2469
2469
|
};
|
|
2470
|
-
|
|
2470
|
+
BN4.prototype.redSub = function redSub(num) {
|
|
2471
2471
|
assert3(this.red, "redSub works only with red numbers");
|
|
2472
2472
|
return this.red.sub(this, num);
|
|
2473
2473
|
};
|
|
2474
|
-
|
|
2474
|
+
BN4.prototype.redISub = function redISub(num) {
|
|
2475
2475
|
assert3(this.red, "redISub works only with red numbers");
|
|
2476
2476
|
return this.red.isub(this, num);
|
|
2477
2477
|
};
|
|
2478
|
-
|
|
2478
|
+
BN4.prototype.redShl = function redShl(num) {
|
|
2479
2479
|
assert3(this.red, "redShl works only with red numbers");
|
|
2480
2480
|
return this.red.shl(this, num);
|
|
2481
2481
|
};
|
|
2482
|
-
|
|
2482
|
+
BN4.prototype.redMul = function redMul(num) {
|
|
2483
2483
|
assert3(this.red, "redMul works only with red numbers");
|
|
2484
2484
|
this.red._verify2(this, num);
|
|
2485
2485
|
return this.red.mul(this, num);
|
|
2486
2486
|
};
|
|
2487
|
-
|
|
2487
|
+
BN4.prototype.redIMul = function redIMul(num) {
|
|
2488
2488
|
assert3(this.red, "redMul works only with red numbers");
|
|
2489
2489
|
this.red._verify2(this, num);
|
|
2490
2490
|
return this.red.imul(this, num);
|
|
2491
2491
|
};
|
|
2492
|
-
|
|
2492
|
+
BN4.prototype.redSqr = function redSqr() {
|
|
2493
2493
|
assert3(this.red, "redSqr works only with red numbers");
|
|
2494
2494
|
this.red._verify1(this);
|
|
2495
2495
|
return this.red.sqr(this);
|
|
2496
2496
|
};
|
|
2497
|
-
|
|
2497
|
+
BN4.prototype.redISqr = function redISqr() {
|
|
2498
2498
|
assert3(this.red, "redISqr works only with red numbers");
|
|
2499
2499
|
this.red._verify1(this);
|
|
2500
2500
|
return this.red.isqr(this);
|
|
2501
2501
|
};
|
|
2502
|
-
|
|
2502
|
+
BN4.prototype.redSqrt = function redSqrt() {
|
|
2503
2503
|
assert3(this.red, "redSqrt works only with red numbers");
|
|
2504
2504
|
this.red._verify1(this);
|
|
2505
2505
|
return this.red.sqrt(this);
|
|
2506
2506
|
};
|
|
2507
|
-
|
|
2507
|
+
BN4.prototype.redInvm = function redInvm() {
|
|
2508
2508
|
assert3(this.red, "redInvm works only with red numbers");
|
|
2509
2509
|
this.red._verify1(this);
|
|
2510
2510
|
return this.red.invm(this);
|
|
2511
2511
|
};
|
|
2512
|
-
|
|
2512
|
+
BN4.prototype.redNeg = function redNeg() {
|
|
2513
2513
|
assert3(this.red, "redNeg works only with red numbers");
|
|
2514
2514
|
this.red._verify1(this);
|
|
2515
2515
|
return this.red.neg(this);
|
|
2516
2516
|
};
|
|
2517
|
-
|
|
2517
|
+
BN4.prototype.redPow = function redPow(num) {
|
|
2518
2518
|
assert3(this.red && !num.red, "redPow(normalNum)");
|
|
2519
2519
|
this.red._verify1(this);
|
|
2520
2520
|
return this.red.pow(this, num);
|
|
@@ -2527,13 +2527,13 @@ var require_bn = __commonJS({
|
|
|
2527
2527
|
};
|
|
2528
2528
|
function MPrime(name, p) {
|
|
2529
2529
|
this.name = name;
|
|
2530
|
-
this.p = new
|
|
2530
|
+
this.p = new BN4(p, 16);
|
|
2531
2531
|
this.n = this.p.bitLength();
|
|
2532
|
-
this.k = new
|
|
2532
|
+
this.k = new BN4(1).iushln(this.n).isub(this.p);
|
|
2533
2533
|
this.tmp = this._tmp();
|
|
2534
2534
|
}
|
|
2535
2535
|
MPrime.prototype._tmp = function _tmp() {
|
|
2536
|
-
var tmp = new
|
|
2536
|
+
var tmp = new BN4(null);
|
|
2537
2537
|
tmp.words = new Array(Math.ceil(this.n / 13));
|
|
2538
2538
|
return tmp;
|
|
2539
2539
|
};
|
|
@@ -2659,7 +2659,7 @@ var require_bn = __commonJS({
|
|
|
2659
2659
|
}
|
|
2660
2660
|
return num;
|
|
2661
2661
|
};
|
|
2662
|
-
|
|
2662
|
+
BN4._prime = function prime(name) {
|
|
2663
2663
|
if (primes[name]) return primes[name];
|
|
2664
2664
|
var prime2;
|
|
2665
2665
|
if (name === "k256") {
|
|
@@ -2678,7 +2678,7 @@ var require_bn = __commonJS({
|
|
|
2678
2678
|
};
|
|
2679
2679
|
function Red(m) {
|
|
2680
2680
|
if (typeof m === "string") {
|
|
2681
|
-
var prime =
|
|
2681
|
+
var prime = BN4._prime(m);
|
|
2682
2682
|
this.m = prime.p;
|
|
2683
2683
|
this.prime = prime;
|
|
2684
2684
|
} else {
|
|
@@ -2764,7 +2764,7 @@ var require_bn = __commonJS({
|
|
|
2764
2764
|
var mod3 = this.m.andln(3);
|
|
2765
2765
|
assert3(mod3 % 2 === 1);
|
|
2766
2766
|
if (mod3 === 3) {
|
|
2767
|
-
var pow = this.m.add(new
|
|
2767
|
+
var pow = this.m.add(new BN4(1)).iushrn(2);
|
|
2768
2768
|
return this.pow(a, pow);
|
|
2769
2769
|
}
|
|
2770
2770
|
var q = this.m.subn(1);
|
|
@@ -2774,11 +2774,11 @@ var require_bn = __commonJS({
|
|
|
2774
2774
|
q.iushrn(1);
|
|
2775
2775
|
}
|
|
2776
2776
|
assert3(!q.isZero());
|
|
2777
|
-
var one = new
|
|
2777
|
+
var one = new BN4(1).toRed(this);
|
|
2778
2778
|
var nOne = one.redNeg();
|
|
2779
2779
|
var lpow = this.m.subn(1).iushrn(1);
|
|
2780
2780
|
var z = this.m.bitLength();
|
|
2781
|
-
z = new
|
|
2781
|
+
z = new BN4(2 * z * z).toRed(this);
|
|
2782
2782
|
while (this.pow(z, lpow).cmp(nOne) !== 0) {
|
|
2783
2783
|
z.redIAdd(nOne);
|
|
2784
2784
|
}
|
|
@@ -2792,7 +2792,7 @@ var require_bn = __commonJS({
|
|
|
2792
2792
|
tmp = tmp.redSqr();
|
|
2793
2793
|
}
|
|
2794
2794
|
assert3(i < m);
|
|
2795
|
-
var b = this.pow(c, new
|
|
2795
|
+
var b = this.pow(c, new BN4(1).iushln(m - i - 1));
|
|
2796
2796
|
r = r.redMul(b);
|
|
2797
2797
|
c = b.redSqr();
|
|
2798
2798
|
t = t.redMul(c);
|
|
@@ -2810,11 +2810,11 @@ var require_bn = __commonJS({
|
|
|
2810
2810
|
}
|
|
2811
2811
|
};
|
|
2812
2812
|
Red.prototype.pow = function pow(a, num) {
|
|
2813
|
-
if (num.isZero()) return new
|
|
2813
|
+
if (num.isZero()) return new BN4(1).toRed(this);
|
|
2814
2814
|
if (num.cmpn(1) === 0) return a.clone();
|
|
2815
2815
|
var windowSize = 4;
|
|
2816
2816
|
var wnd = new Array(1 << windowSize);
|
|
2817
|
-
wnd[0] = new
|
|
2817
|
+
wnd[0] = new BN4(1).toRed(this);
|
|
2818
2818
|
wnd[1] = a;
|
|
2819
2819
|
for (var i = 2; i < wnd.length; i++) {
|
|
2820
2820
|
wnd[i] = this.mul(wnd[i - 1], a);
|
|
@@ -2858,7 +2858,7 @@ var require_bn = __commonJS({
|
|
|
2858
2858
|
res.red = null;
|
|
2859
2859
|
return res;
|
|
2860
2860
|
};
|
|
2861
|
-
|
|
2861
|
+
BN4.mont = function mont(num) {
|
|
2862
2862
|
return new Mont(num);
|
|
2863
2863
|
};
|
|
2864
2864
|
function Mont(m) {
|
|
@@ -2867,7 +2867,7 @@ var require_bn = __commonJS({
|
|
|
2867
2867
|
if (this.shift % 26 !== 0) {
|
|
2868
2868
|
this.shift += 26 - this.shift % 26;
|
|
2869
2869
|
}
|
|
2870
|
-
this.r = new
|
|
2870
|
+
this.r = new BN4(1).iushln(this.shift);
|
|
2871
2871
|
this.r2 = this.imod(this.r.sqr());
|
|
2872
2872
|
this.rinv = this.r._invmp(this.m);
|
|
2873
2873
|
this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
|
|
@@ -2901,7 +2901,7 @@ var require_bn = __commonJS({
|
|
|
2901
2901
|
return res._forceRed(this);
|
|
2902
2902
|
};
|
|
2903
2903
|
Mont.prototype.mul = function mul(a, b) {
|
|
2904
|
-
if (a.isZero() || b.isZero()) return new
|
|
2904
|
+
if (a.isZero() || b.isZero()) return new BN4(0)._forceRed(this);
|
|
2905
2905
|
var t = a.mul(b);
|
|
2906
2906
|
var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
|
|
2907
2907
|
var u = t.isub(c).iushrn(this.shift);
|
|
@@ -11619,7 +11619,25 @@ __export(index_exports, {
|
|
|
11619
11619
|
MxeStatus: () => MxeStatus,
|
|
11620
11620
|
OPEN_MARKET_DISCRIMINATOR: () => OPEN_MARKET_DISCRIMINATOR,
|
|
11621
11621
|
OPPORTUNITY_MARKET_DISCRIMINATOR: () => OPPORTUNITY_MARKET_DISCRIMINATOR,
|
|
11622
|
-
|
|
11622
|
+
OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION: () => OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION,
|
|
11623
|
+
OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED: () => OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED,
|
|
11624
|
+
OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET: () => OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET,
|
|
11625
|
+
OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE: () => OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE,
|
|
11626
|
+
OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING: () => OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING,
|
|
11627
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_MINT: () => OPPORTUNITY_MARKET_ERROR__INVALID_MINT,
|
|
11628
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX: () => OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX,
|
|
11629
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP: () => OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP,
|
|
11630
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN: () => OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN,
|
|
11631
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN: () => OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN,
|
|
11632
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED: () => OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED,
|
|
11633
|
+
OPPORTUNITY_MARKET_ERROR__NOT_REVEALED: () => OPPORTUNITY_MARKET_ERROR__NOT_REVEALED,
|
|
11634
|
+
OPPORTUNITY_MARKET_ERROR__OVERFLOW: () => OPPORTUNITY_MARKET_ERROR__OVERFLOW,
|
|
11635
|
+
OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED: () => OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED,
|
|
11636
|
+
OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED: () => OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED,
|
|
11637
|
+
OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE: () => OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE,
|
|
11638
|
+
OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED: () => OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED,
|
|
11639
|
+
OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED: () => OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED,
|
|
11640
|
+
OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED: () => OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED,
|
|
11623
11641
|
OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR: () => OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR,
|
|
11624
11642
|
OPPORTUNITY_MARKET_OPTION_SEED: () => OPPORTUNITY_MARKET_OPTION_SEED,
|
|
11625
11643
|
OPPORTUNITY_MARKET_PROGRAM_ADDRESS: () => OPPORTUNITY_MARKET_PROGRAM_ADDRESS,
|
|
@@ -13339,8 +13357,7 @@ function getMXEAccountEncoder() {
|
|
|
13339
13357
|
]
|
|
13340
13358
|
])
|
|
13341
13359
|
],
|
|
13342
|
-
["
|
|
13343
|
-
["rejectedClusters", (0, import_kit36.getArrayEncoder)((0, import_kit36.getU32Encoder)())],
|
|
13360
|
+
["lutOffsetSlot", (0, import_kit36.getU64Encoder)()],
|
|
13344
13361
|
["computationDefinitions", (0, import_kit36.getArrayEncoder)((0, import_kit36.getU32Encoder)())],
|
|
13345
13362
|
["status", getMxeStatusEncoder()],
|
|
13346
13363
|
["bump", (0, import_kit36.getU8Encoder)()]
|
|
@@ -13379,8 +13396,7 @@ function getMXEAccountDecoder() {
|
|
|
13379
13396
|
]
|
|
13380
13397
|
])
|
|
13381
13398
|
],
|
|
13382
|
-
["
|
|
13383
|
-
["rejectedClusters", (0, import_kit36.getArrayDecoder)((0, import_kit36.getU32Decoder)())],
|
|
13399
|
+
["lutOffsetSlot", (0, import_kit36.getU64Decoder)()],
|
|
13384
13400
|
["computationDefinitions", (0, import_kit36.getArrayDecoder)((0, import_kit36.getU32Decoder)())],
|
|
13385
13401
|
["status", getMxeStatusDecoder()],
|
|
13386
13402
|
["bump", (0, import_kit36.getU8Decoder)()]
|
|
@@ -13799,7 +13815,7 @@ var import_kit42 = require("@solana/kit");
|
|
|
13799
13815
|
|
|
13800
13816
|
// src/generated/programs/opportunityMarket.ts
|
|
13801
13817
|
var import_kit41 = require("@solana/kit");
|
|
13802
|
-
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "
|
|
13818
|
+
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "AFJhmrwWC4DGh88yeLTBtJRu9vKN6gnAEra4163zGHS6";
|
|
13803
13819
|
var OpportunityMarketAccount = /* @__PURE__ */ ((OpportunityMarketAccount2) => {
|
|
13804
13820
|
OpportunityMarketAccount2[OpportunityMarketAccount2["ArciumSignerAccount"] = 0] = "ArciumSignerAccount";
|
|
13805
13821
|
OpportunityMarketAccount2[OpportunityMarketAccount2["ClockAccount"] = 1] = "ClockAccount";
|
|
@@ -14180,11 +14196,47 @@ function identifyOpportunityMarketInstruction(instruction) {
|
|
|
14180
14196
|
}
|
|
14181
14197
|
|
|
14182
14198
|
// src/generated/errors/opportunityMarket.ts
|
|
14183
|
-
var
|
|
14199
|
+
var OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION = 6e3;
|
|
14200
|
+
var OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET = 6001;
|
|
14201
|
+
var OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED = 6002;
|
|
14202
|
+
var OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE = 6003;
|
|
14203
|
+
var OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING = 6004;
|
|
14204
|
+
var OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP = 6005;
|
|
14205
|
+
var OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN = 6006;
|
|
14206
|
+
var OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX = 6007;
|
|
14207
|
+
var OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN = 6008;
|
|
14208
|
+
var OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED = 6009;
|
|
14209
|
+
var OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE = 6010;
|
|
14210
|
+
var OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED = 6011;
|
|
14211
|
+
var OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED = 6012;
|
|
14212
|
+
var OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED = 6013;
|
|
14213
|
+
var OPPORTUNITY_MARKET_ERROR__NOT_REVEALED = 6014;
|
|
14214
|
+
var OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED = 6015;
|
|
14215
|
+
var OPPORTUNITY_MARKET_ERROR__OVERFLOW = 6016;
|
|
14216
|
+
var OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED = 6017;
|
|
14217
|
+
var OPPORTUNITY_MARKET_ERROR__INVALID_MINT = 6018;
|
|
14184
14218
|
var opportunityMarketErrorMessages;
|
|
14185
14219
|
if (process.env.NODE_ENV !== "production") {
|
|
14186
14220
|
opportunityMarketErrorMessages = {
|
|
14187
|
-
[
|
|
14221
|
+
[OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION]: `Computation aborted`,
|
|
14222
|
+
[OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED]: `Shares already revealed`,
|
|
14223
|
+
[OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET]: `Cluster not set`,
|
|
14224
|
+
[OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE]: `Insufficient balance`,
|
|
14225
|
+
[OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING]: `Insufficient reward funding`,
|
|
14226
|
+
[OPPORTUNITY_MARKET_ERROR__INVALID_MINT]: `Token mint does not match market mint`,
|
|
14227
|
+
[OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX]: `Invalid option index`,
|
|
14228
|
+
[OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP]: `Timestamp must be in the future`,
|
|
14229
|
+
[OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN]: `Market is already open`,
|
|
14230
|
+
[OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN]: `Market is not open`,
|
|
14231
|
+
[OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED]: `Staking period not over`,
|
|
14232
|
+
[OPPORTUNITY_MARKET_ERROR__NOT_REVEALED]: `Shares not yet revealed`,
|
|
14233
|
+
[OPPORTUNITY_MARKET_ERROR__OVERFLOW]: `Arithmetic overflow`,
|
|
14234
|
+
[OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED]: `Reveal period has already ended`,
|
|
14235
|
+
[OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED]: `Invalid option or not enough balance`,
|
|
14236
|
+
[OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE]: `Staking period is not active`,
|
|
14237
|
+
[OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED]: `Tally already incremented for this share account`,
|
|
14238
|
+
[OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED]: `Unauthorized`,
|
|
14239
|
+
[OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED]: `Market winner already selected`
|
|
14188
14240
|
};
|
|
14189
14241
|
}
|
|
14190
14242
|
function getOpportunityMarketErrorMessage(code) {
|
|
@@ -14833,10 +14885,18 @@ function getBuyOpportunityMarketSharesCompDefInstruction(input, config) {
|
|
|
14833
14885
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
14834
14886
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
14835
14887
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
14888
|
+
addressLookupTable: {
|
|
14889
|
+
value: input.addressLookupTable ?? null,
|
|
14890
|
+
isWritable: true
|
|
14891
|
+
},
|
|
14892
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
14836
14893
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
14837
14894
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
14838
14895
|
};
|
|
14839
14896
|
const accounts = originalAccounts;
|
|
14897
|
+
if (!accounts.lutProgram.value) {
|
|
14898
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
14899
|
+
}
|
|
14840
14900
|
if (!accounts.arciumProgram.value) {
|
|
14841
14901
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
14842
14902
|
}
|
|
@@ -14849,6 +14909,8 @@ function getBuyOpportunityMarketSharesCompDefInstruction(input, config) {
|
|
|
14849
14909
|
getAccountMeta(accounts.payer),
|
|
14850
14910
|
getAccountMeta(accounts.mxeAccount),
|
|
14851
14911
|
getAccountMeta(accounts.compDefAccount),
|
|
14912
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
14913
|
+
getAccountMeta(accounts.lutProgram),
|
|
14852
14914
|
getAccountMeta(accounts.arciumProgram),
|
|
14853
14915
|
getAccountMeta(accounts.systemProgram)
|
|
14854
14916
|
],
|
|
@@ -14859,7 +14921,7 @@ function getBuyOpportunityMarketSharesCompDefInstruction(input, config) {
|
|
|
14859
14921
|
});
|
|
14860
14922
|
}
|
|
14861
14923
|
function parseBuyOpportunityMarketSharesCompDefInstruction(instruction) {
|
|
14862
|
-
if (instruction.accounts.length <
|
|
14924
|
+
if (instruction.accounts.length < 7) {
|
|
14863
14925
|
throw new Error("Not enough accounts");
|
|
14864
14926
|
}
|
|
14865
14927
|
let accountIndex = 0;
|
|
@@ -14874,6 +14936,8 @@ function parseBuyOpportunityMarketSharesCompDefInstruction(instruction) {
|
|
|
14874
14936
|
payer: getNextAccount(),
|
|
14875
14937
|
mxeAccount: getNextAccount(),
|
|
14876
14938
|
compDefAccount: getNextAccount(),
|
|
14939
|
+
addressLookupTable: getNextAccount(),
|
|
14940
|
+
lutProgram: getNextAccount(),
|
|
14877
14941
|
arciumProgram: getNextAccount(),
|
|
14878
14942
|
systemProgram: getNextAccount()
|
|
14879
14943
|
},
|
|
@@ -15085,10 +15149,18 @@ function getBuyVoteTokensCompDefInstruction(input, config) {
|
|
|
15085
15149
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
15086
15150
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
15087
15151
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
15152
|
+
addressLookupTable: {
|
|
15153
|
+
value: input.addressLookupTable ?? null,
|
|
15154
|
+
isWritable: true
|
|
15155
|
+
},
|
|
15156
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
15088
15157
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
15089
15158
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
15090
15159
|
};
|
|
15091
15160
|
const accounts = originalAccounts;
|
|
15161
|
+
if (!accounts.lutProgram.value) {
|
|
15162
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
15163
|
+
}
|
|
15092
15164
|
if (!accounts.arciumProgram.value) {
|
|
15093
15165
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
15094
15166
|
}
|
|
@@ -15101,6 +15173,8 @@ function getBuyVoteTokensCompDefInstruction(input, config) {
|
|
|
15101
15173
|
getAccountMeta(accounts.payer),
|
|
15102
15174
|
getAccountMeta(accounts.mxeAccount),
|
|
15103
15175
|
getAccountMeta(accounts.compDefAccount),
|
|
15176
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
15177
|
+
getAccountMeta(accounts.lutProgram),
|
|
15104
15178
|
getAccountMeta(accounts.arciumProgram),
|
|
15105
15179
|
getAccountMeta(accounts.systemProgram)
|
|
15106
15180
|
],
|
|
@@ -15109,7 +15183,7 @@ function getBuyVoteTokensCompDefInstruction(input, config) {
|
|
|
15109
15183
|
});
|
|
15110
15184
|
}
|
|
15111
15185
|
function parseBuyVoteTokensCompDefInstruction(instruction) {
|
|
15112
|
-
if (instruction.accounts.length <
|
|
15186
|
+
if (instruction.accounts.length < 7) {
|
|
15113
15187
|
throw new Error("Not enough accounts");
|
|
15114
15188
|
}
|
|
15115
15189
|
let accountIndex = 0;
|
|
@@ -15124,6 +15198,8 @@ function parseBuyVoteTokensCompDefInstruction(instruction) {
|
|
|
15124
15198
|
payer: getNextAccount(),
|
|
15125
15199
|
mxeAccount: getNextAccount(),
|
|
15126
15200
|
compDefAccount: getNextAccount(),
|
|
15201
|
+
addressLookupTable: getNextAccount(),
|
|
15202
|
+
lutProgram: getNextAccount(),
|
|
15127
15203
|
arciumProgram: getNextAccount(),
|
|
15128
15204
|
systemProgram: getNextAccount()
|
|
15129
15205
|
},
|
|
@@ -15810,10 +15886,18 @@ function getClaimVoteTokensCompDefInstruction(input, config) {
|
|
|
15810
15886
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
15811
15887
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
15812
15888
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
15889
|
+
addressLookupTable: {
|
|
15890
|
+
value: input.addressLookupTable ?? null,
|
|
15891
|
+
isWritable: true
|
|
15892
|
+
},
|
|
15893
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
15813
15894
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
15814
15895
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
15815
15896
|
};
|
|
15816
15897
|
const accounts = originalAccounts;
|
|
15898
|
+
if (!accounts.lutProgram.value) {
|
|
15899
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
15900
|
+
}
|
|
15817
15901
|
if (!accounts.arciumProgram.value) {
|
|
15818
15902
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
15819
15903
|
}
|
|
@@ -15826,6 +15910,8 @@ function getClaimVoteTokensCompDefInstruction(input, config) {
|
|
|
15826
15910
|
getAccountMeta(accounts.payer),
|
|
15827
15911
|
getAccountMeta(accounts.mxeAccount),
|
|
15828
15912
|
getAccountMeta(accounts.compDefAccount),
|
|
15913
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
15914
|
+
getAccountMeta(accounts.lutProgram),
|
|
15829
15915
|
getAccountMeta(accounts.arciumProgram),
|
|
15830
15916
|
getAccountMeta(accounts.systemProgram)
|
|
15831
15917
|
],
|
|
@@ -15834,7 +15920,7 @@ function getClaimVoteTokensCompDefInstruction(input, config) {
|
|
|
15834
15920
|
});
|
|
15835
15921
|
}
|
|
15836
15922
|
function parseClaimVoteTokensCompDefInstruction(instruction) {
|
|
15837
|
-
if (instruction.accounts.length <
|
|
15923
|
+
if (instruction.accounts.length < 7) {
|
|
15838
15924
|
throw new Error("Not enough accounts");
|
|
15839
15925
|
}
|
|
15840
15926
|
let accountIndex = 0;
|
|
@@ -15849,6 +15935,8 @@ function parseClaimVoteTokensCompDefInstruction(instruction) {
|
|
|
15849
15935
|
payer: getNextAccount(),
|
|
15850
15936
|
mxeAccount: getNextAccount(),
|
|
15851
15937
|
compDefAccount: getNextAccount(),
|
|
15938
|
+
addressLookupTable: getNextAccount(),
|
|
15939
|
+
lutProgram: getNextAccount(),
|
|
15852
15940
|
arciumProgram: getNextAccount(),
|
|
15853
15941
|
systemProgram: getNextAccount()
|
|
15854
15942
|
},
|
|
@@ -16794,10 +16882,18 @@ function getInitMarketSharesCompDefInstruction(input, config) {
|
|
|
16794
16882
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
16795
16883
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
16796
16884
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
16885
|
+
addressLookupTable: {
|
|
16886
|
+
value: input.addressLookupTable ?? null,
|
|
16887
|
+
isWritable: true
|
|
16888
|
+
},
|
|
16889
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
16797
16890
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
16798
16891
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
16799
16892
|
};
|
|
16800
16893
|
const accounts = originalAccounts;
|
|
16894
|
+
if (!accounts.lutProgram.value) {
|
|
16895
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
16896
|
+
}
|
|
16801
16897
|
if (!accounts.arciumProgram.value) {
|
|
16802
16898
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
16803
16899
|
}
|
|
@@ -16810,6 +16906,8 @@ function getInitMarketSharesCompDefInstruction(input, config) {
|
|
|
16810
16906
|
getAccountMeta(accounts.payer),
|
|
16811
16907
|
getAccountMeta(accounts.mxeAccount),
|
|
16812
16908
|
getAccountMeta(accounts.compDefAccount),
|
|
16909
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
16910
|
+
getAccountMeta(accounts.lutProgram),
|
|
16813
16911
|
getAccountMeta(accounts.arciumProgram),
|
|
16814
16912
|
getAccountMeta(accounts.systemProgram)
|
|
16815
16913
|
],
|
|
@@ -16818,7 +16916,7 @@ function getInitMarketSharesCompDefInstruction(input, config) {
|
|
|
16818
16916
|
});
|
|
16819
16917
|
}
|
|
16820
16918
|
function parseInitMarketSharesCompDefInstruction(instruction) {
|
|
16821
|
-
if (instruction.accounts.length <
|
|
16919
|
+
if (instruction.accounts.length < 7) {
|
|
16822
16920
|
throw new Error("Not enough accounts");
|
|
16823
16921
|
}
|
|
16824
16922
|
let accountIndex = 0;
|
|
@@ -16833,6 +16931,8 @@ function parseInitMarketSharesCompDefInstruction(instruction) {
|
|
|
16833
16931
|
payer: getNextAccount(),
|
|
16834
16932
|
mxeAccount: getNextAccount(),
|
|
16835
16933
|
compDefAccount: getNextAccount(),
|
|
16934
|
+
addressLookupTable: getNextAccount(),
|
|
16935
|
+
lutProgram: getNextAccount(),
|
|
16836
16936
|
arciumProgram: getNextAccount(),
|
|
16837
16937
|
systemProgram: getNextAccount()
|
|
16838
16938
|
},
|
|
@@ -17490,10 +17590,18 @@ function getInitVoteTokenAccountCompDefInstruction(input, config) {
|
|
|
17490
17590
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
17491
17591
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
17492
17592
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
17593
|
+
addressLookupTable: {
|
|
17594
|
+
value: input.addressLookupTable ?? null,
|
|
17595
|
+
isWritable: true
|
|
17596
|
+
},
|
|
17597
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
17493
17598
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
17494
17599
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
17495
17600
|
};
|
|
17496
17601
|
const accounts = originalAccounts;
|
|
17602
|
+
if (!accounts.lutProgram.value) {
|
|
17603
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
17604
|
+
}
|
|
17497
17605
|
if (!accounts.arciumProgram.value) {
|
|
17498
17606
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
17499
17607
|
}
|
|
@@ -17506,6 +17614,8 @@ function getInitVoteTokenAccountCompDefInstruction(input, config) {
|
|
|
17506
17614
|
getAccountMeta(accounts.payer),
|
|
17507
17615
|
getAccountMeta(accounts.mxeAccount),
|
|
17508
17616
|
getAccountMeta(accounts.compDefAccount),
|
|
17617
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
17618
|
+
getAccountMeta(accounts.lutProgram),
|
|
17509
17619
|
getAccountMeta(accounts.arciumProgram),
|
|
17510
17620
|
getAccountMeta(accounts.systemProgram)
|
|
17511
17621
|
],
|
|
@@ -17514,7 +17624,7 @@ function getInitVoteTokenAccountCompDefInstruction(input, config) {
|
|
|
17514
17624
|
});
|
|
17515
17625
|
}
|
|
17516
17626
|
function parseInitVoteTokenAccountCompDefInstruction(instruction) {
|
|
17517
|
-
if (instruction.accounts.length <
|
|
17627
|
+
if (instruction.accounts.length < 7) {
|
|
17518
17628
|
throw new Error("Not enough accounts");
|
|
17519
17629
|
}
|
|
17520
17630
|
let accountIndex = 0;
|
|
@@ -17529,6 +17639,8 @@ function parseInitVoteTokenAccountCompDefInstruction(instruction) {
|
|
|
17529
17639
|
payer: getNextAccount(),
|
|
17530
17640
|
mxeAccount: getNextAccount(),
|
|
17531
17641
|
compDefAccount: getNextAccount(),
|
|
17642
|
+
addressLookupTable: getNextAccount(),
|
|
17643
|
+
lutProgram: getNextAccount(),
|
|
17532
17644
|
arciumProgram: getNextAccount(),
|
|
17533
17645
|
systemProgram: getNextAccount()
|
|
17534
17646
|
},
|
|
@@ -18409,10 +18521,18 @@ function getRevealSharesCompDefInstruction(input, config) {
|
|
|
18409
18521
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
18410
18522
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
18411
18523
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
18524
|
+
addressLookupTable: {
|
|
18525
|
+
value: input.addressLookupTable ?? null,
|
|
18526
|
+
isWritable: true
|
|
18527
|
+
},
|
|
18528
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
18412
18529
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
18413
18530
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
18414
18531
|
};
|
|
18415
18532
|
const accounts = originalAccounts;
|
|
18533
|
+
if (!accounts.lutProgram.value) {
|
|
18534
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
18535
|
+
}
|
|
18416
18536
|
if (!accounts.arciumProgram.value) {
|
|
18417
18537
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
18418
18538
|
}
|
|
@@ -18425,6 +18545,8 @@ function getRevealSharesCompDefInstruction(input, config) {
|
|
|
18425
18545
|
getAccountMeta(accounts.payer),
|
|
18426
18546
|
getAccountMeta(accounts.mxeAccount),
|
|
18427
18547
|
getAccountMeta(accounts.compDefAccount),
|
|
18548
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
18549
|
+
getAccountMeta(accounts.lutProgram),
|
|
18428
18550
|
getAccountMeta(accounts.arciumProgram),
|
|
18429
18551
|
getAccountMeta(accounts.systemProgram)
|
|
18430
18552
|
],
|
|
@@ -18433,7 +18555,7 @@ function getRevealSharesCompDefInstruction(input, config) {
|
|
|
18433
18555
|
});
|
|
18434
18556
|
}
|
|
18435
18557
|
function parseRevealSharesCompDefInstruction(instruction) {
|
|
18436
|
-
if (instruction.accounts.length <
|
|
18558
|
+
if (instruction.accounts.length < 7) {
|
|
18437
18559
|
throw new Error("Not enough accounts");
|
|
18438
18560
|
}
|
|
18439
18561
|
let accountIndex = 0;
|
|
@@ -18448,6 +18570,8 @@ function parseRevealSharesCompDefInstruction(instruction) {
|
|
|
18448
18570
|
payer: getNextAccount(),
|
|
18449
18571
|
mxeAccount: getNextAccount(),
|
|
18450
18572
|
compDefAccount: getNextAccount(),
|
|
18573
|
+
addressLookupTable: getNextAccount(),
|
|
18574
|
+
lutProgram: getNextAccount(),
|
|
18451
18575
|
arciumProgram: getNextAccount(),
|
|
18452
18576
|
systemProgram: getNextAccount()
|
|
18453
18577
|
},
|
|
@@ -28822,6 +28946,7 @@ async function createMarket(input, config) {
|
|
|
28822
28946
|
// src/instructions/initCompDef.ts
|
|
28823
28947
|
var import_kit71 = require("@solana/kit");
|
|
28824
28948
|
var import_client2 = require("@arcium-hq/client");
|
|
28949
|
+
var import_bn3 = __toESM(require_bn(), 1);
|
|
28825
28950
|
var ALL_COMP_DEF_CIRCUITS = [
|
|
28826
28951
|
"init_vote_token_account",
|
|
28827
28952
|
"buy_vote_tokens",
|
|
@@ -28833,9 +28958,10 @@ var ALL_COMP_DEF_CIRCUITS = [
|
|
|
28833
28958
|
function toAddress2(pubkey) {
|
|
28834
28959
|
return (0, import_kit71.address)(pubkey.toBase58());
|
|
28835
28960
|
}
|
|
28836
|
-
function getMxeAccount(programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
28961
|
+
async function getMxeAccount(rpc, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
28837
28962
|
const programIdLegacy = new PublicKey(programId);
|
|
28838
|
-
|
|
28963
|
+
const mxeAddress = toAddress2((0, import_client2.getMXEAccAddress)(programIdLegacy));
|
|
28964
|
+
return fetchMXEAccount(rpc, mxeAddress);
|
|
28839
28965
|
}
|
|
28840
28966
|
function getCompDefAccount(circuitName, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
28841
28967
|
const programIdLegacy = new PublicKey(programId);
|
|
@@ -28848,14 +28974,19 @@ function getCompDefOffsetNumber(circuitName) {
|
|
|
28848
28974
|
const offset2 = (0, import_client2.getCompDefAccOffset)(circuitName);
|
|
28849
28975
|
return Buffer.from(offset2).readUInt32LE();
|
|
28850
28976
|
}
|
|
28851
|
-
function getInitCompDefInstruction(payer, circuitName, config = {}) {
|
|
28977
|
+
async function getInitCompDefInstruction(rpc, payer, circuitName, config = {}) {
|
|
28852
28978
|
const programId = config.programId ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
28853
|
-
const mxeAccount = getMxeAccount(programId);
|
|
28979
|
+
const mxeAccount = await getMxeAccount(rpc, programId);
|
|
28854
28980
|
const compDefAccount = getCompDefAccount(circuitName, programId);
|
|
28981
|
+
const lutAddress = (0, import_client2.getLookupTableAddress)(
|
|
28982
|
+
new PublicKey(programId.toString()),
|
|
28983
|
+
new import_bn3.BN(mxeAccount.data.lutOffsetSlot)
|
|
28984
|
+
);
|
|
28855
28985
|
const baseInput = {
|
|
28856
28986
|
payer,
|
|
28857
|
-
mxeAccount,
|
|
28858
|
-
compDefAccount
|
|
28987
|
+
mxeAccount: mxeAccount.address,
|
|
28988
|
+
compDefAccount,
|
|
28989
|
+
addressLookupTable: toAddress2(lutAddress)
|
|
28859
28990
|
};
|
|
28860
28991
|
switch (circuitName) {
|
|
28861
28992
|
case "init_vote_token_account":
|
|
@@ -29154,7 +29285,25 @@ var awaitComputationFinalization = async (rpc, computationOffset, options) => {
|
|
|
29154
29285
|
MxeStatus,
|
|
29155
29286
|
OPEN_MARKET_DISCRIMINATOR,
|
|
29156
29287
|
OPPORTUNITY_MARKET_DISCRIMINATOR,
|
|
29157
|
-
|
|
29288
|
+
OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION,
|
|
29289
|
+
OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED,
|
|
29290
|
+
OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET,
|
|
29291
|
+
OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE,
|
|
29292
|
+
OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING,
|
|
29293
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_MINT,
|
|
29294
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX,
|
|
29295
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP,
|
|
29296
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN,
|
|
29297
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN,
|
|
29298
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED,
|
|
29299
|
+
OPPORTUNITY_MARKET_ERROR__NOT_REVEALED,
|
|
29300
|
+
OPPORTUNITY_MARKET_ERROR__OVERFLOW,
|
|
29301
|
+
OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED,
|
|
29302
|
+
OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED,
|
|
29303
|
+
OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE,
|
|
29304
|
+
OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED,
|
|
29305
|
+
OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED,
|
|
29306
|
+
OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED,
|
|
29158
29307
|
OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR,
|
|
29159
29308
|
OPPORTUNITY_MARKET_OPTION_SEED,
|
|
29160
29309
|
OPPORTUNITY_MARKET_PROGRAM_ADDRESS,
|