@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/browser/index.js
CHANGED
|
@@ -1833,8 +1833,8 @@ var require_bn = __commonJS({
|
|
|
1833
1833
|
ctor.prototype = new TempCtor();
|
|
1834
1834
|
ctor.prototype.constructor = ctor;
|
|
1835
1835
|
}
|
|
1836
|
-
function
|
|
1837
|
-
if (
|
|
1836
|
+
function BN4(number2, base, endian) {
|
|
1837
|
+
if (BN4.isBN(number2)) {
|
|
1838
1838
|
return number2;
|
|
1839
1839
|
}
|
|
1840
1840
|
this.negative = 0;
|
|
@@ -1850,12 +1850,12 @@ var require_bn = __commonJS({
|
|
|
1850
1850
|
}
|
|
1851
1851
|
}
|
|
1852
1852
|
if (typeof module2 === "object") {
|
|
1853
|
-
module2.exports =
|
|
1853
|
+
module2.exports = BN4;
|
|
1854
1854
|
} else {
|
|
1855
|
-
exports2.BN =
|
|
1855
|
+
exports2.BN = BN4;
|
|
1856
1856
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1857
|
+
BN4.BN = BN4;
|
|
1858
|
+
BN4.wordSize = 26;
|
|
1859
1859
|
var Buffer4;
|
|
1860
1860
|
try {
|
|
1861
1861
|
if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
|
|
@@ -1865,21 +1865,21 @@ var require_bn = __commonJS({
|
|
|
1865
1865
|
}
|
|
1866
1866
|
} catch (e) {
|
|
1867
1867
|
}
|
|
1868
|
-
|
|
1869
|
-
if (num instanceof
|
|
1868
|
+
BN4.isBN = function isBN(num) {
|
|
1869
|
+
if (num instanceof BN4) {
|
|
1870
1870
|
return true;
|
|
1871
1871
|
}
|
|
1872
|
-
return num !== null && typeof num === "object" && num.constructor.wordSize ===
|
|
1872
|
+
return num !== null && typeof num === "object" && num.constructor.wordSize === BN4.wordSize && Array.isArray(num.words);
|
|
1873
1873
|
};
|
|
1874
|
-
|
|
1874
|
+
BN4.max = function max(left, right) {
|
|
1875
1875
|
if (left.cmp(right) > 0) return left;
|
|
1876
1876
|
return right;
|
|
1877
1877
|
};
|
|
1878
|
-
|
|
1878
|
+
BN4.min = function min(left, right) {
|
|
1879
1879
|
if (left.cmp(right) < 0) return left;
|
|
1880
1880
|
return right;
|
|
1881
1881
|
};
|
|
1882
|
-
|
|
1882
|
+
BN4.prototype._init = function init(number2, base, endian) {
|
|
1883
1883
|
if (typeof number2 === "number") {
|
|
1884
1884
|
return this._initNumber(number2, base, endian);
|
|
1885
1885
|
}
|
|
@@ -1907,7 +1907,7 @@ var require_bn = __commonJS({
|
|
|
1907
1907
|
}
|
|
1908
1908
|
}
|
|
1909
1909
|
};
|
|
1910
|
-
|
|
1910
|
+
BN4.prototype._initNumber = function _initNumber(number2, base, endian) {
|
|
1911
1911
|
if (number2 < 0) {
|
|
1912
1912
|
this.negative = 1;
|
|
1913
1913
|
number2 = -number2;
|
|
@@ -1933,7 +1933,7 @@ var require_bn = __commonJS({
|
|
|
1933
1933
|
if (endian !== "le") return;
|
|
1934
1934
|
this._initArray(this.toArray(), base, endian);
|
|
1935
1935
|
};
|
|
1936
|
-
|
|
1936
|
+
BN4.prototype._initArray = function _initArray(number2, base, endian) {
|
|
1937
1937
|
assert3(typeof number2.length === "number");
|
|
1938
1938
|
if (number2.length <= 0) {
|
|
1939
1939
|
this.words = [0];
|
|
@@ -1991,7 +1991,7 @@ var require_bn = __commonJS({
|
|
|
1991
1991
|
}
|
|
1992
1992
|
return r;
|
|
1993
1993
|
}
|
|
1994
|
-
|
|
1994
|
+
BN4.prototype._parseHex = function _parseHex(number2, start, endian) {
|
|
1995
1995
|
this.length = Math.ceil((number2.length - start) / 6);
|
|
1996
1996
|
this.words = new Array(this.length);
|
|
1997
1997
|
for (var i = 0; i < this.length; i++) {
|
|
@@ -2047,7 +2047,7 @@ var require_bn = __commonJS({
|
|
|
2047
2047
|
}
|
|
2048
2048
|
return r;
|
|
2049
2049
|
}
|
|
2050
|
-
|
|
2050
|
+
BN4.prototype._parseBase = function _parseBase(number2, base, start) {
|
|
2051
2051
|
this.words = [0];
|
|
2052
2052
|
this.length = 1;
|
|
2053
2053
|
for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
|
|
@@ -2083,7 +2083,7 @@ var require_bn = __commonJS({
|
|
|
2083
2083
|
}
|
|
2084
2084
|
this._strip();
|
|
2085
2085
|
};
|
|
2086
|
-
|
|
2086
|
+
BN4.prototype.copy = function copy(dest) {
|
|
2087
2087
|
dest.words = new Array(this.length);
|
|
2088
2088
|
for (var i = 0; i < this.length; i++) {
|
|
2089
2089
|
dest.words[i] = this.words[i];
|
|
@@ -2098,27 +2098,27 @@ var require_bn = __commonJS({
|
|
|
2098
2098
|
dest.negative = src.negative;
|
|
2099
2099
|
dest.red = src.red;
|
|
2100
2100
|
}
|
|
2101
|
-
|
|
2101
|
+
BN4.prototype._move = function _move(dest) {
|
|
2102
2102
|
move(dest, this);
|
|
2103
2103
|
};
|
|
2104
|
-
|
|
2105
|
-
var r = new
|
|
2104
|
+
BN4.prototype.clone = function clone() {
|
|
2105
|
+
var r = new BN4(null);
|
|
2106
2106
|
this.copy(r);
|
|
2107
2107
|
return r;
|
|
2108
2108
|
};
|
|
2109
|
-
|
|
2109
|
+
BN4.prototype._expand = function _expand(size) {
|
|
2110
2110
|
while (this.length < size) {
|
|
2111
2111
|
this.words[this.length++] = 0;
|
|
2112
2112
|
}
|
|
2113
2113
|
return this;
|
|
2114
2114
|
};
|
|
2115
|
-
|
|
2115
|
+
BN4.prototype._strip = function strip() {
|
|
2116
2116
|
while (this.length > 1 && this.words[this.length - 1] === 0) {
|
|
2117
2117
|
this.length--;
|
|
2118
2118
|
}
|
|
2119
2119
|
return this._normSign();
|
|
2120
2120
|
};
|
|
2121
|
-
|
|
2121
|
+
BN4.prototype._normSign = function _normSign() {
|
|
2122
2122
|
if (this.length === 1 && this.words[0] === 0) {
|
|
2123
2123
|
this.negative = 0;
|
|
2124
2124
|
}
|
|
@@ -2126,12 +2126,12 @@ var require_bn = __commonJS({
|
|
|
2126
2126
|
};
|
|
2127
2127
|
if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
|
|
2128
2128
|
try {
|
|
2129
|
-
|
|
2129
|
+
BN4.prototype[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = inspect;
|
|
2130
2130
|
} catch (e) {
|
|
2131
|
-
|
|
2131
|
+
BN4.prototype.inspect = inspect;
|
|
2132
2132
|
}
|
|
2133
2133
|
} else {
|
|
2134
|
-
|
|
2134
|
+
BN4.prototype.inspect = inspect;
|
|
2135
2135
|
}
|
|
2136
2136
|
function inspect() {
|
|
2137
2137
|
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
|
|
@@ -2242,7 +2242,7 @@ var require_bn = __commonJS({
|
|
|
2242
2242
|
52521875,
|
|
2243
2243
|
60466176
|
|
2244
2244
|
];
|
|
2245
|
-
|
|
2245
|
+
BN4.prototype.toString = function toString(base, padding) {
|
|
2246
2246
|
base = base || 10;
|
|
2247
2247
|
padding = padding | 0 || 1;
|
|
2248
2248
|
var out;
|
|
@@ -2304,7 +2304,7 @@ var require_bn = __commonJS({
|
|
|
2304
2304
|
}
|
|
2305
2305
|
assert3(false, "Base should be between 2 and 36");
|
|
2306
2306
|
};
|
|
2307
|
-
|
|
2307
|
+
BN4.prototype.toNumber = function toNumber() {
|
|
2308
2308
|
var ret = this.words[0];
|
|
2309
2309
|
if (this.length === 2) {
|
|
2310
2310
|
ret += this.words[1] * 67108864;
|
|
@@ -2315,15 +2315,15 @@ var require_bn = __commonJS({
|
|
|
2315
2315
|
}
|
|
2316
2316
|
return this.negative !== 0 ? -ret : ret;
|
|
2317
2317
|
};
|
|
2318
|
-
|
|
2318
|
+
BN4.prototype.toJSON = function toJSON() {
|
|
2319
2319
|
return this.toString(16, 2);
|
|
2320
2320
|
};
|
|
2321
2321
|
if (Buffer4) {
|
|
2322
|
-
|
|
2322
|
+
BN4.prototype.toBuffer = function toBuffer2(endian, length) {
|
|
2323
2323
|
return this.toArrayLike(Buffer4, endian, length);
|
|
2324
2324
|
};
|
|
2325
2325
|
}
|
|
2326
|
-
|
|
2326
|
+
BN4.prototype.toArray = function toArray(endian, length) {
|
|
2327
2327
|
return this.toArrayLike(Array, endian, length);
|
|
2328
2328
|
};
|
|
2329
2329
|
var allocate = function allocate2(ArrayType, size) {
|
|
@@ -2332,7 +2332,7 @@ var require_bn = __commonJS({
|
|
|
2332
2332
|
}
|
|
2333
2333
|
return new ArrayType(size);
|
|
2334
2334
|
};
|
|
2335
|
-
|
|
2335
|
+
BN4.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
|
|
2336
2336
|
this._strip();
|
|
2337
2337
|
var byteLength = this.byteLength();
|
|
2338
2338
|
var reqLength = length || Math.max(1, byteLength);
|
|
@@ -2343,7 +2343,7 @@ var require_bn = __commonJS({
|
|
|
2343
2343
|
this["_toArrayLike" + postfix](res, byteLength);
|
|
2344
2344
|
return res;
|
|
2345
2345
|
};
|
|
2346
|
-
|
|
2346
|
+
BN4.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
|
|
2347
2347
|
var position = 0;
|
|
2348
2348
|
var carry = 0;
|
|
2349
2349
|
for (var i = 0, shift = 0; i < this.length; i++) {
|
|
@@ -2373,7 +2373,7 @@ var require_bn = __commonJS({
|
|
|
2373
2373
|
}
|
|
2374
2374
|
}
|
|
2375
2375
|
};
|
|
2376
|
-
|
|
2376
|
+
BN4.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {
|
|
2377
2377
|
var position = res.length - 1;
|
|
2378
2378
|
var carry = 0;
|
|
2379
2379
|
for (var i = 0, shift = 0; i < this.length; i++) {
|
|
@@ -2404,11 +2404,11 @@ var require_bn = __commonJS({
|
|
|
2404
2404
|
}
|
|
2405
2405
|
};
|
|
2406
2406
|
if (Math.clz32) {
|
|
2407
|
-
|
|
2407
|
+
BN4.prototype._countBits = function _countBits(w) {
|
|
2408
2408
|
return 32 - Math.clz32(w);
|
|
2409
2409
|
};
|
|
2410
2410
|
} else {
|
|
2411
|
-
|
|
2411
|
+
BN4.prototype._countBits = function _countBits(w) {
|
|
2412
2412
|
var t = w;
|
|
2413
2413
|
var r = 0;
|
|
2414
2414
|
if (t >= 4096) {
|
|
@@ -2430,7 +2430,7 @@ var require_bn = __commonJS({
|
|
|
2430
2430
|
return r + t;
|
|
2431
2431
|
};
|
|
2432
2432
|
}
|
|
2433
|
-
|
|
2433
|
+
BN4.prototype._zeroBits = function _zeroBits(w) {
|
|
2434
2434
|
if (w === 0) return 26;
|
|
2435
2435
|
var t = w;
|
|
2436
2436
|
var r = 0;
|
|
@@ -2455,7 +2455,7 @@ var require_bn = __commonJS({
|
|
|
2455
2455
|
}
|
|
2456
2456
|
return r;
|
|
2457
2457
|
};
|
|
2458
|
-
|
|
2458
|
+
BN4.prototype.bitLength = function bitLength() {
|
|
2459
2459
|
var w = this.words[this.length - 1];
|
|
2460
2460
|
var hi = this._countBits(w);
|
|
2461
2461
|
return (this.length - 1) * 26 + hi;
|
|
@@ -2469,7 +2469,7 @@ var require_bn = __commonJS({
|
|
|
2469
2469
|
}
|
|
2470
2470
|
return w;
|
|
2471
2471
|
}
|
|
2472
|
-
|
|
2472
|
+
BN4.prototype.zeroBits = function zeroBits() {
|
|
2473
2473
|
if (this.isZero()) return 0;
|
|
2474
2474
|
var r = 0;
|
|
2475
2475
|
for (var i = 0; i < this.length; i++) {
|
|
@@ -2479,34 +2479,34 @@ var require_bn = __commonJS({
|
|
|
2479
2479
|
}
|
|
2480
2480
|
return r;
|
|
2481
2481
|
};
|
|
2482
|
-
|
|
2482
|
+
BN4.prototype.byteLength = function byteLength() {
|
|
2483
2483
|
return Math.ceil(this.bitLength() / 8);
|
|
2484
2484
|
};
|
|
2485
|
-
|
|
2485
|
+
BN4.prototype.toTwos = function toTwos(width) {
|
|
2486
2486
|
if (this.negative !== 0) {
|
|
2487
2487
|
return this.abs().inotn(width).iaddn(1);
|
|
2488
2488
|
}
|
|
2489
2489
|
return this.clone();
|
|
2490
2490
|
};
|
|
2491
|
-
|
|
2491
|
+
BN4.prototype.fromTwos = function fromTwos(width) {
|
|
2492
2492
|
if (this.testn(width - 1)) {
|
|
2493
2493
|
return this.notn(width).iaddn(1).ineg();
|
|
2494
2494
|
}
|
|
2495
2495
|
return this.clone();
|
|
2496
2496
|
};
|
|
2497
|
-
|
|
2497
|
+
BN4.prototype.isNeg = function isNeg() {
|
|
2498
2498
|
return this.negative !== 0;
|
|
2499
2499
|
};
|
|
2500
|
-
|
|
2500
|
+
BN4.prototype.neg = function neg() {
|
|
2501
2501
|
return this.clone().ineg();
|
|
2502
2502
|
};
|
|
2503
|
-
|
|
2503
|
+
BN4.prototype.ineg = function ineg() {
|
|
2504
2504
|
if (!this.isZero()) {
|
|
2505
2505
|
this.negative ^= 1;
|
|
2506
2506
|
}
|
|
2507
2507
|
return this;
|
|
2508
2508
|
};
|
|
2509
|
-
|
|
2509
|
+
BN4.prototype.iuor = function iuor(num) {
|
|
2510
2510
|
while (this.length < num.length) {
|
|
2511
2511
|
this.words[this.length++] = 0;
|
|
2512
2512
|
}
|
|
@@ -2515,19 +2515,19 @@ var require_bn = __commonJS({
|
|
|
2515
2515
|
}
|
|
2516
2516
|
return this._strip();
|
|
2517
2517
|
};
|
|
2518
|
-
|
|
2518
|
+
BN4.prototype.ior = function ior(num) {
|
|
2519
2519
|
assert3((this.negative | num.negative) === 0);
|
|
2520
2520
|
return this.iuor(num);
|
|
2521
2521
|
};
|
|
2522
|
-
|
|
2522
|
+
BN4.prototype.or = function or(num) {
|
|
2523
2523
|
if (this.length > num.length) return this.clone().ior(num);
|
|
2524
2524
|
return num.clone().ior(this);
|
|
2525
2525
|
};
|
|
2526
|
-
|
|
2526
|
+
BN4.prototype.uor = function uor(num) {
|
|
2527
2527
|
if (this.length > num.length) return this.clone().iuor(num);
|
|
2528
2528
|
return num.clone().iuor(this);
|
|
2529
2529
|
};
|
|
2530
|
-
|
|
2530
|
+
BN4.prototype.iuand = function iuand(num) {
|
|
2531
2531
|
var b;
|
|
2532
2532
|
if (this.length > num.length) {
|
|
2533
2533
|
b = num;
|
|
@@ -2540,19 +2540,19 @@ var require_bn = __commonJS({
|
|
|
2540
2540
|
this.length = b.length;
|
|
2541
2541
|
return this._strip();
|
|
2542
2542
|
};
|
|
2543
|
-
|
|
2543
|
+
BN4.prototype.iand = function iand(num) {
|
|
2544
2544
|
assert3((this.negative | num.negative) === 0);
|
|
2545
2545
|
return this.iuand(num);
|
|
2546
2546
|
};
|
|
2547
|
-
|
|
2547
|
+
BN4.prototype.and = function and(num) {
|
|
2548
2548
|
if (this.length > num.length) return this.clone().iand(num);
|
|
2549
2549
|
return num.clone().iand(this);
|
|
2550
2550
|
};
|
|
2551
|
-
|
|
2551
|
+
BN4.prototype.uand = function uand(num) {
|
|
2552
2552
|
if (this.length > num.length) return this.clone().iuand(num);
|
|
2553
2553
|
return num.clone().iuand(this);
|
|
2554
2554
|
};
|
|
2555
|
-
|
|
2555
|
+
BN4.prototype.iuxor = function iuxor(num) {
|
|
2556
2556
|
var a;
|
|
2557
2557
|
var b;
|
|
2558
2558
|
if (this.length > num.length) {
|
|
@@ -2573,19 +2573,19 @@ var require_bn = __commonJS({
|
|
|
2573
2573
|
this.length = a.length;
|
|
2574
2574
|
return this._strip();
|
|
2575
2575
|
};
|
|
2576
|
-
|
|
2576
|
+
BN4.prototype.ixor = function ixor(num) {
|
|
2577
2577
|
assert3((this.negative | num.negative) === 0);
|
|
2578
2578
|
return this.iuxor(num);
|
|
2579
2579
|
};
|
|
2580
|
-
|
|
2580
|
+
BN4.prototype.xor = function xor(num) {
|
|
2581
2581
|
if (this.length > num.length) return this.clone().ixor(num);
|
|
2582
2582
|
return num.clone().ixor(this);
|
|
2583
2583
|
};
|
|
2584
|
-
|
|
2584
|
+
BN4.prototype.uxor = function uxor(num) {
|
|
2585
2585
|
if (this.length > num.length) return this.clone().iuxor(num);
|
|
2586
2586
|
return num.clone().iuxor(this);
|
|
2587
2587
|
};
|
|
2588
|
-
|
|
2588
|
+
BN4.prototype.inotn = function inotn(width) {
|
|
2589
2589
|
assert3(typeof width === "number" && width >= 0);
|
|
2590
2590
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
|
2591
2591
|
var bitsLeft = width % 26;
|
|
@@ -2601,10 +2601,10 @@ var require_bn = __commonJS({
|
|
|
2601
2601
|
}
|
|
2602
2602
|
return this._strip();
|
|
2603
2603
|
};
|
|
2604
|
-
|
|
2604
|
+
BN4.prototype.notn = function notn(width) {
|
|
2605
2605
|
return this.clone().inotn(width);
|
|
2606
2606
|
};
|
|
2607
|
-
|
|
2607
|
+
BN4.prototype.setn = function setn(bit, val) {
|
|
2608
2608
|
assert3(typeof bit === "number" && bit >= 0);
|
|
2609
2609
|
var off = bit / 26 | 0;
|
|
2610
2610
|
var wbit = bit % 26;
|
|
@@ -2616,7 +2616,7 @@ var require_bn = __commonJS({
|
|
|
2616
2616
|
}
|
|
2617
2617
|
return this._strip();
|
|
2618
2618
|
};
|
|
2619
|
-
|
|
2619
|
+
BN4.prototype.iadd = function iadd(num) {
|
|
2620
2620
|
var r;
|
|
2621
2621
|
if (this.negative !== 0 && num.negative === 0) {
|
|
2622
2622
|
this.negative = 0;
|
|
@@ -2659,7 +2659,7 @@ var require_bn = __commonJS({
|
|
|
2659
2659
|
}
|
|
2660
2660
|
return this;
|
|
2661
2661
|
};
|
|
2662
|
-
|
|
2662
|
+
BN4.prototype.add = function add2(num) {
|
|
2663
2663
|
var res;
|
|
2664
2664
|
if (num.negative !== 0 && this.negative === 0) {
|
|
2665
2665
|
num.negative = 0;
|
|
@@ -2675,7 +2675,7 @@ var require_bn = __commonJS({
|
|
|
2675
2675
|
if (this.length > num.length) return this.clone().iadd(num);
|
|
2676
2676
|
return num.clone().iadd(this);
|
|
2677
2677
|
};
|
|
2678
|
-
|
|
2678
|
+
BN4.prototype.isub = function isub(num) {
|
|
2679
2679
|
if (num.negative !== 0) {
|
|
2680
2680
|
num.negative = 0;
|
|
2681
2681
|
var r = this.iadd(num);
|
|
@@ -2724,7 +2724,7 @@ var require_bn = __commonJS({
|
|
|
2724
2724
|
}
|
|
2725
2725
|
return this._strip();
|
|
2726
2726
|
};
|
|
2727
|
-
|
|
2727
|
+
BN4.prototype.sub = function sub(num) {
|
|
2728
2728
|
return this.clone().isub(num);
|
|
2729
2729
|
};
|
|
2730
2730
|
function smallMulTo(self, num, out) {
|
|
@@ -3352,7 +3352,7 @@ var require_bn = __commonJS({
|
|
|
3352
3352
|
function jumboMulTo(self, num, out) {
|
|
3353
3353
|
return bigMulTo(self, num, out);
|
|
3354
3354
|
}
|
|
3355
|
-
|
|
3355
|
+
BN4.prototype.mulTo = function mulTo(num, out) {
|
|
3356
3356
|
var res;
|
|
3357
3357
|
var len = this.length + num.length;
|
|
3358
3358
|
if (this.length === 10 && num.length === 10) {
|
|
@@ -3372,7 +3372,7 @@ var require_bn = __commonJS({
|
|
|
3372
3372
|
}
|
|
3373
3373
|
FFTM.prototype.makeRBT = function makeRBT(N) {
|
|
3374
3374
|
var t = new Array(N);
|
|
3375
|
-
var l =
|
|
3375
|
+
var l = BN4.prototype._countBits(N) - 1;
|
|
3376
3376
|
for (var i = 0; i < N; i++) {
|
|
3377
3377
|
t[i] = this.revBin(i, l, N);
|
|
3378
3378
|
}
|
|
@@ -3507,20 +3507,20 @@ var require_bn = __commonJS({
|
|
|
3507
3507
|
out.length = x.length + y.length;
|
|
3508
3508
|
return out._strip();
|
|
3509
3509
|
};
|
|
3510
|
-
|
|
3511
|
-
var out = new
|
|
3510
|
+
BN4.prototype.mul = function mul(num) {
|
|
3511
|
+
var out = new BN4(null);
|
|
3512
3512
|
out.words = new Array(this.length + num.length);
|
|
3513
3513
|
return this.mulTo(num, out);
|
|
3514
3514
|
};
|
|
3515
|
-
|
|
3516
|
-
var out = new
|
|
3515
|
+
BN4.prototype.mulf = function mulf(num) {
|
|
3516
|
+
var out = new BN4(null);
|
|
3517
3517
|
out.words = new Array(this.length + num.length);
|
|
3518
3518
|
return jumboMulTo(this, num, out);
|
|
3519
3519
|
};
|
|
3520
|
-
|
|
3520
|
+
BN4.prototype.imul = function imul(num) {
|
|
3521
3521
|
return this.clone().mulTo(num, this);
|
|
3522
3522
|
};
|
|
3523
|
-
|
|
3523
|
+
BN4.prototype.imuln = function imuln(num) {
|
|
3524
3524
|
var isNegNum = num < 0;
|
|
3525
3525
|
if (isNegNum) num = -num;
|
|
3526
3526
|
assert3(typeof num === "number");
|
|
@@ -3541,18 +3541,18 @@ var require_bn = __commonJS({
|
|
|
3541
3541
|
this.length = num === 0 ? 1 : this.length;
|
|
3542
3542
|
return isNegNum ? this.ineg() : this;
|
|
3543
3543
|
};
|
|
3544
|
-
|
|
3544
|
+
BN4.prototype.muln = function muln(num) {
|
|
3545
3545
|
return this.clone().imuln(num);
|
|
3546
3546
|
};
|
|
3547
|
-
|
|
3547
|
+
BN4.prototype.sqr = function sqr() {
|
|
3548
3548
|
return this.mul(this);
|
|
3549
3549
|
};
|
|
3550
|
-
|
|
3550
|
+
BN4.prototype.isqr = function isqr() {
|
|
3551
3551
|
return this.imul(this.clone());
|
|
3552
3552
|
};
|
|
3553
|
-
|
|
3553
|
+
BN4.prototype.pow = function pow(num) {
|
|
3554
3554
|
var w = toBitArray(num);
|
|
3555
|
-
if (w.length === 0) return new
|
|
3555
|
+
if (w.length === 0) return new BN4(1);
|
|
3556
3556
|
var res = this;
|
|
3557
3557
|
for (var i = 0; i < w.length; i++, res = res.sqr()) {
|
|
3558
3558
|
if (w[i] !== 0) break;
|
|
@@ -3565,7 +3565,7 @@ var require_bn = __commonJS({
|
|
|
3565
3565
|
}
|
|
3566
3566
|
return res;
|
|
3567
3567
|
};
|
|
3568
|
-
|
|
3568
|
+
BN4.prototype.iushln = function iushln(bits) {
|
|
3569
3569
|
assert3(typeof bits === "number" && bits >= 0);
|
|
3570
3570
|
var r = bits % 26;
|
|
3571
3571
|
var s = (bits - r) / 26;
|
|
@@ -3595,11 +3595,11 @@ var require_bn = __commonJS({
|
|
|
3595
3595
|
}
|
|
3596
3596
|
return this._strip();
|
|
3597
3597
|
};
|
|
3598
|
-
|
|
3598
|
+
BN4.prototype.ishln = function ishln(bits) {
|
|
3599
3599
|
assert3(this.negative === 0);
|
|
3600
3600
|
return this.iushln(bits);
|
|
3601
3601
|
};
|
|
3602
|
-
|
|
3602
|
+
BN4.prototype.iushrn = function iushrn(bits, hint, extended) {
|
|
3603
3603
|
assert3(typeof bits === "number" && bits >= 0);
|
|
3604
3604
|
var h;
|
|
3605
3605
|
if (hint) {
|
|
@@ -3644,23 +3644,23 @@ var require_bn = __commonJS({
|
|
|
3644
3644
|
}
|
|
3645
3645
|
return this._strip();
|
|
3646
3646
|
};
|
|
3647
|
-
|
|
3647
|
+
BN4.prototype.ishrn = function ishrn(bits, hint, extended) {
|
|
3648
3648
|
assert3(this.negative === 0);
|
|
3649
3649
|
return this.iushrn(bits, hint, extended);
|
|
3650
3650
|
};
|
|
3651
|
-
|
|
3651
|
+
BN4.prototype.shln = function shln(bits) {
|
|
3652
3652
|
return this.clone().ishln(bits);
|
|
3653
3653
|
};
|
|
3654
|
-
|
|
3654
|
+
BN4.prototype.ushln = function ushln(bits) {
|
|
3655
3655
|
return this.clone().iushln(bits);
|
|
3656
3656
|
};
|
|
3657
|
-
|
|
3657
|
+
BN4.prototype.shrn = function shrn(bits) {
|
|
3658
3658
|
return this.clone().ishrn(bits);
|
|
3659
3659
|
};
|
|
3660
|
-
|
|
3660
|
+
BN4.prototype.ushrn = function ushrn(bits) {
|
|
3661
3661
|
return this.clone().iushrn(bits);
|
|
3662
3662
|
};
|
|
3663
|
-
|
|
3663
|
+
BN4.prototype.testn = function testn(bit) {
|
|
3664
3664
|
assert3(typeof bit === "number" && bit >= 0);
|
|
3665
3665
|
var r = bit % 26;
|
|
3666
3666
|
var s = (bit - r) / 26;
|
|
@@ -3669,7 +3669,7 @@ var require_bn = __commonJS({
|
|
|
3669
3669
|
var w = this.words[s];
|
|
3670
3670
|
return !!(w & q);
|
|
3671
3671
|
};
|
|
3672
|
-
|
|
3672
|
+
BN4.prototype.imaskn = function imaskn(bits) {
|
|
3673
3673
|
assert3(typeof bits === "number" && bits >= 0);
|
|
3674
3674
|
var r = bits % 26;
|
|
3675
3675
|
var s = (bits - r) / 26;
|
|
@@ -3687,10 +3687,10 @@ var require_bn = __commonJS({
|
|
|
3687
3687
|
}
|
|
3688
3688
|
return this._strip();
|
|
3689
3689
|
};
|
|
3690
|
-
|
|
3690
|
+
BN4.prototype.maskn = function maskn(bits) {
|
|
3691
3691
|
return this.clone().imaskn(bits);
|
|
3692
3692
|
};
|
|
3693
|
-
|
|
3693
|
+
BN4.prototype.iaddn = function iaddn(num) {
|
|
3694
3694
|
assert3(typeof num === "number");
|
|
3695
3695
|
assert3(num < 67108864);
|
|
3696
3696
|
if (num < 0) return this.isubn(-num);
|
|
@@ -3707,7 +3707,7 @@ var require_bn = __commonJS({
|
|
|
3707
3707
|
}
|
|
3708
3708
|
return this._iaddn(num);
|
|
3709
3709
|
};
|
|
3710
|
-
|
|
3710
|
+
BN4.prototype._iaddn = function _iaddn(num) {
|
|
3711
3711
|
this.words[0] += num;
|
|
3712
3712
|
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) {
|
|
3713
3713
|
this.words[i] -= 67108864;
|
|
@@ -3720,7 +3720,7 @@ var require_bn = __commonJS({
|
|
|
3720
3720
|
this.length = Math.max(this.length, i + 1);
|
|
3721
3721
|
return this;
|
|
3722
3722
|
};
|
|
3723
|
-
|
|
3723
|
+
BN4.prototype.isubn = function isubn(num) {
|
|
3724
3724
|
assert3(typeof num === "number");
|
|
3725
3725
|
assert3(num < 67108864);
|
|
3726
3726
|
if (num < 0) return this.iaddn(-num);
|
|
@@ -3742,20 +3742,20 @@ var require_bn = __commonJS({
|
|
|
3742
3742
|
}
|
|
3743
3743
|
return this._strip();
|
|
3744
3744
|
};
|
|
3745
|
-
|
|
3745
|
+
BN4.prototype.addn = function addn(num) {
|
|
3746
3746
|
return this.clone().iaddn(num);
|
|
3747
3747
|
};
|
|
3748
|
-
|
|
3748
|
+
BN4.prototype.subn = function subn(num) {
|
|
3749
3749
|
return this.clone().isubn(num);
|
|
3750
3750
|
};
|
|
3751
|
-
|
|
3751
|
+
BN4.prototype.iabs = function iabs() {
|
|
3752
3752
|
this.negative = 0;
|
|
3753
3753
|
return this;
|
|
3754
3754
|
};
|
|
3755
|
-
|
|
3755
|
+
BN4.prototype.abs = function abs() {
|
|
3756
3756
|
return this.clone().iabs();
|
|
3757
3757
|
};
|
|
3758
|
-
|
|
3758
|
+
BN4.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {
|
|
3759
3759
|
var len = num.length + shift;
|
|
3760
3760
|
var i;
|
|
3761
3761
|
this._expand(len);
|
|
@@ -3784,7 +3784,7 @@ var require_bn = __commonJS({
|
|
|
3784
3784
|
this.negative = 1;
|
|
3785
3785
|
return this._strip();
|
|
3786
3786
|
};
|
|
3787
|
-
|
|
3787
|
+
BN4.prototype._wordDiv = function _wordDiv(num, mode) {
|
|
3788
3788
|
var shift = this.length - num.length;
|
|
3789
3789
|
var a = this.clone();
|
|
3790
3790
|
var b = num;
|
|
@@ -3799,7 +3799,7 @@ var require_bn = __commonJS({
|
|
|
3799
3799
|
var m = a.length - b.length;
|
|
3800
3800
|
var q;
|
|
3801
3801
|
if (mode !== "mod") {
|
|
3802
|
-
q = new
|
|
3802
|
+
q = new BN4(null);
|
|
3803
3803
|
q.length = m + 1;
|
|
3804
3804
|
q.words = new Array(q.length);
|
|
3805
3805
|
for (var i = 0; i < q.length; i++) {
|
|
@@ -3841,12 +3841,12 @@ var require_bn = __commonJS({
|
|
|
3841
3841
|
mod: a
|
|
3842
3842
|
};
|
|
3843
3843
|
};
|
|
3844
|
-
|
|
3844
|
+
BN4.prototype.divmod = function divmod(num, mode, positive) {
|
|
3845
3845
|
assert3(!num.isZero());
|
|
3846
3846
|
if (this.isZero()) {
|
|
3847
3847
|
return {
|
|
3848
|
-
div: new
|
|
3849
|
-
mod: new
|
|
3848
|
+
div: new BN4(0),
|
|
3849
|
+
mod: new BN4(0)
|
|
3850
3850
|
};
|
|
3851
3851
|
}
|
|
3852
3852
|
var div, mod2, res;
|
|
@@ -3891,7 +3891,7 @@ var require_bn = __commonJS({
|
|
|
3891
3891
|
}
|
|
3892
3892
|
if (num.length > this.length || this.cmp(num) < 0) {
|
|
3893
3893
|
return {
|
|
3894
|
-
div: new
|
|
3894
|
+
div: new BN4(0),
|
|
3895
3895
|
mod: this
|
|
3896
3896
|
};
|
|
3897
3897
|
}
|
|
@@ -3905,26 +3905,26 @@ var require_bn = __commonJS({
|
|
|
3905
3905
|
if (mode === "mod") {
|
|
3906
3906
|
return {
|
|
3907
3907
|
div: null,
|
|
3908
|
-
mod: new
|
|
3908
|
+
mod: new BN4(this.modrn(num.words[0]))
|
|
3909
3909
|
};
|
|
3910
3910
|
}
|
|
3911
3911
|
return {
|
|
3912
3912
|
div: this.divn(num.words[0]),
|
|
3913
|
-
mod: new
|
|
3913
|
+
mod: new BN4(this.modrn(num.words[0]))
|
|
3914
3914
|
};
|
|
3915
3915
|
}
|
|
3916
3916
|
return this._wordDiv(num, mode);
|
|
3917
3917
|
};
|
|
3918
|
-
|
|
3918
|
+
BN4.prototype.div = function div(num) {
|
|
3919
3919
|
return this.divmod(num, "div", false).div;
|
|
3920
3920
|
};
|
|
3921
|
-
|
|
3921
|
+
BN4.prototype.mod = function mod2(num) {
|
|
3922
3922
|
return this.divmod(num, "mod", false).mod;
|
|
3923
3923
|
};
|
|
3924
|
-
|
|
3924
|
+
BN4.prototype.umod = function umod(num) {
|
|
3925
3925
|
return this.divmod(num, "mod", true).mod;
|
|
3926
3926
|
};
|
|
3927
|
-
|
|
3927
|
+
BN4.prototype.divRound = function divRound(num) {
|
|
3928
3928
|
var dm = this.divmod(num);
|
|
3929
3929
|
if (dm.mod.isZero()) return dm.div;
|
|
3930
3930
|
var mod2 = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
|
|
@@ -3934,7 +3934,7 @@ var require_bn = __commonJS({
|
|
|
3934
3934
|
if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
|
|
3935
3935
|
return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
|
|
3936
3936
|
};
|
|
3937
|
-
|
|
3937
|
+
BN4.prototype.modrn = function modrn(num) {
|
|
3938
3938
|
var isNegNum = num < 0;
|
|
3939
3939
|
if (isNegNum) num = -num;
|
|
3940
3940
|
assert3(num <= 67108863);
|
|
@@ -3945,10 +3945,10 @@ var require_bn = __commonJS({
|
|
|
3945
3945
|
}
|
|
3946
3946
|
return isNegNum ? -acc : acc;
|
|
3947
3947
|
};
|
|
3948
|
-
|
|
3948
|
+
BN4.prototype.modn = function modn(num) {
|
|
3949
3949
|
return this.modrn(num);
|
|
3950
3950
|
};
|
|
3951
|
-
|
|
3951
|
+
BN4.prototype.idivn = function idivn(num) {
|
|
3952
3952
|
var isNegNum = num < 0;
|
|
3953
3953
|
if (isNegNum) num = -num;
|
|
3954
3954
|
assert3(num <= 67108863);
|
|
@@ -3961,10 +3961,10 @@ var require_bn = __commonJS({
|
|
|
3961
3961
|
this._strip();
|
|
3962
3962
|
return isNegNum ? this.ineg() : this;
|
|
3963
3963
|
};
|
|
3964
|
-
|
|
3964
|
+
BN4.prototype.divn = function divn(num) {
|
|
3965
3965
|
return this.clone().idivn(num);
|
|
3966
3966
|
};
|
|
3967
|
-
|
|
3967
|
+
BN4.prototype.egcd = function egcd(p) {
|
|
3968
3968
|
assert3(p.negative === 0);
|
|
3969
3969
|
assert3(!p.isZero());
|
|
3970
3970
|
var x = this;
|
|
@@ -3974,10 +3974,10 @@ var require_bn = __commonJS({
|
|
|
3974
3974
|
} else {
|
|
3975
3975
|
x = x.clone();
|
|
3976
3976
|
}
|
|
3977
|
-
var A = new
|
|
3978
|
-
var B = new
|
|
3979
|
-
var C = new
|
|
3980
|
-
var D = new
|
|
3977
|
+
var A = new BN4(1);
|
|
3978
|
+
var B = new BN4(0);
|
|
3979
|
+
var C = new BN4(0);
|
|
3980
|
+
var D = new BN4(1);
|
|
3981
3981
|
var g = 0;
|
|
3982
3982
|
while (x.isEven() && y.isEven()) {
|
|
3983
3983
|
x.iushrn(1);
|
|
@@ -4027,7 +4027,7 @@ var require_bn = __commonJS({
|
|
|
4027
4027
|
gcd: y.iushln(g)
|
|
4028
4028
|
};
|
|
4029
4029
|
};
|
|
4030
|
-
|
|
4030
|
+
BN4.prototype._invmp = function _invmp(p) {
|
|
4031
4031
|
assert3(p.negative === 0);
|
|
4032
4032
|
assert3(!p.isZero());
|
|
4033
4033
|
var a = this;
|
|
@@ -4037,8 +4037,8 @@ var require_bn = __commonJS({
|
|
|
4037
4037
|
} else {
|
|
4038
4038
|
a = a.clone();
|
|
4039
4039
|
}
|
|
4040
|
-
var x1 = new
|
|
4041
|
-
var x2 = new
|
|
4040
|
+
var x1 = new BN4(1);
|
|
4041
|
+
var x2 = new BN4(0);
|
|
4042
4042
|
var delta = b.clone();
|
|
4043
4043
|
while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
|
|
4044
4044
|
for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ;
|
|
@@ -4080,7 +4080,7 @@ var require_bn = __commonJS({
|
|
|
4080
4080
|
}
|
|
4081
4081
|
return res;
|
|
4082
4082
|
};
|
|
4083
|
-
|
|
4083
|
+
BN4.prototype.gcd = function gcd(num) {
|
|
4084
4084
|
if (this.isZero()) return num.abs();
|
|
4085
4085
|
if (num.isZero()) return this.abs();
|
|
4086
4086
|
var a = this.clone();
|
|
@@ -4110,19 +4110,19 @@ var require_bn = __commonJS({
|
|
|
4110
4110
|
} while (true);
|
|
4111
4111
|
return b.iushln(shift);
|
|
4112
4112
|
};
|
|
4113
|
-
|
|
4113
|
+
BN4.prototype.invm = function invm(num) {
|
|
4114
4114
|
return this.egcd(num).a.umod(num);
|
|
4115
4115
|
};
|
|
4116
|
-
|
|
4116
|
+
BN4.prototype.isEven = function isEven() {
|
|
4117
4117
|
return (this.words[0] & 1) === 0;
|
|
4118
4118
|
};
|
|
4119
|
-
|
|
4119
|
+
BN4.prototype.isOdd = function isOdd() {
|
|
4120
4120
|
return (this.words[0] & 1) === 1;
|
|
4121
4121
|
};
|
|
4122
|
-
|
|
4122
|
+
BN4.prototype.andln = function andln(num) {
|
|
4123
4123
|
return this.words[0] & num;
|
|
4124
4124
|
};
|
|
4125
|
-
|
|
4125
|
+
BN4.prototype.bincn = function bincn(bit) {
|
|
4126
4126
|
assert3(typeof bit === "number");
|
|
4127
4127
|
var r = bit % 26;
|
|
4128
4128
|
var s = (bit - r) / 26;
|
|
@@ -4146,10 +4146,10 @@ var require_bn = __commonJS({
|
|
|
4146
4146
|
}
|
|
4147
4147
|
return this;
|
|
4148
4148
|
};
|
|
4149
|
-
|
|
4149
|
+
BN4.prototype.isZero = function isZero() {
|
|
4150
4150
|
return this.length === 1 && this.words[0] === 0;
|
|
4151
4151
|
};
|
|
4152
|
-
|
|
4152
|
+
BN4.prototype.cmpn = function cmpn(num) {
|
|
4153
4153
|
var negative = num < 0;
|
|
4154
4154
|
if (this.negative !== 0 && !negative) return -1;
|
|
4155
4155
|
if (this.negative === 0 && negative) return 1;
|
|
@@ -4168,14 +4168,14 @@ var require_bn = __commonJS({
|
|
|
4168
4168
|
if (this.negative !== 0) return -res | 0;
|
|
4169
4169
|
return res;
|
|
4170
4170
|
};
|
|
4171
|
-
|
|
4171
|
+
BN4.prototype.cmp = function cmp(num) {
|
|
4172
4172
|
if (this.negative !== 0 && num.negative === 0) return -1;
|
|
4173
4173
|
if (this.negative === 0 && num.negative !== 0) return 1;
|
|
4174
4174
|
var res = this.ucmp(num);
|
|
4175
4175
|
if (this.negative !== 0) return -res | 0;
|
|
4176
4176
|
return res;
|
|
4177
4177
|
};
|
|
4178
|
-
|
|
4178
|
+
BN4.prototype.ucmp = function ucmp(num) {
|
|
4179
4179
|
if (this.length > num.length) return 1;
|
|
4180
4180
|
if (this.length < num.length) return -1;
|
|
4181
4181
|
var res = 0;
|
|
@@ -4192,112 +4192,112 @@ var require_bn = __commonJS({
|
|
|
4192
4192
|
}
|
|
4193
4193
|
return res;
|
|
4194
4194
|
};
|
|
4195
|
-
|
|
4195
|
+
BN4.prototype.gtn = function gtn(num) {
|
|
4196
4196
|
return this.cmpn(num) === 1;
|
|
4197
4197
|
};
|
|
4198
|
-
|
|
4198
|
+
BN4.prototype.gt = function gt(num) {
|
|
4199
4199
|
return this.cmp(num) === 1;
|
|
4200
4200
|
};
|
|
4201
|
-
|
|
4201
|
+
BN4.prototype.gten = function gten(num) {
|
|
4202
4202
|
return this.cmpn(num) >= 0;
|
|
4203
4203
|
};
|
|
4204
|
-
|
|
4204
|
+
BN4.prototype.gte = function gte(num) {
|
|
4205
4205
|
return this.cmp(num) >= 0;
|
|
4206
4206
|
};
|
|
4207
|
-
|
|
4207
|
+
BN4.prototype.ltn = function ltn(num) {
|
|
4208
4208
|
return this.cmpn(num) === -1;
|
|
4209
4209
|
};
|
|
4210
|
-
|
|
4210
|
+
BN4.prototype.lt = function lt(num) {
|
|
4211
4211
|
return this.cmp(num) === -1;
|
|
4212
4212
|
};
|
|
4213
|
-
|
|
4213
|
+
BN4.prototype.lten = function lten(num) {
|
|
4214
4214
|
return this.cmpn(num) <= 0;
|
|
4215
4215
|
};
|
|
4216
|
-
|
|
4216
|
+
BN4.prototype.lte = function lte(num) {
|
|
4217
4217
|
return this.cmp(num) <= 0;
|
|
4218
4218
|
};
|
|
4219
|
-
|
|
4219
|
+
BN4.prototype.eqn = function eqn(num) {
|
|
4220
4220
|
return this.cmpn(num) === 0;
|
|
4221
4221
|
};
|
|
4222
|
-
|
|
4222
|
+
BN4.prototype.eq = function eq(num) {
|
|
4223
4223
|
return this.cmp(num) === 0;
|
|
4224
4224
|
};
|
|
4225
|
-
|
|
4225
|
+
BN4.red = function red(num) {
|
|
4226
4226
|
return new Red(num);
|
|
4227
4227
|
};
|
|
4228
|
-
|
|
4228
|
+
BN4.prototype.toRed = function toRed(ctx) {
|
|
4229
4229
|
assert3(!this.red, "Already a number in reduction context");
|
|
4230
4230
|
assert3(this.negative === 0, "red works only with positives");
|
|
4231
4231
|
return ctx.convertTo(this)._forceRed(ctx);
|
|
4232
4232
|
};
|
|
4233
|
-
|
|
4233
|
+
BN4.prototype.fromRed = function fromRed() {
|
|
4234
4234
|
assert3(this.red, "fromRed works only with numbers in reduction context");
|
|
4235
4235
|
return this.red.convertFrom(this);
|
|
4236
4236
|
};
|
|
4237
|
-
|
|
4237
|
+
BN4.prototype._forceRed = function _forceRed(ctx) {
|
|
4238
4238
|
this.red = ctx;
|
|
4239
4239
|
return this;
|
|
4240
4240
|
};
|
|
4241
|
-
|
|
4241
|
+
BN4.prototype.forceRed = function forceRed(ctx) {
|
|
4242
4242
|
assert3(!this.red, "Already a number in reduction context");
|
|
4243
4243
|
return this._forceRed(ctx);
|
|
4244
4244
|
};
|
|
4245
|
-
|
|
4245
|
+
BN4.prototype.redAdd = function redAdd(num) {
|
|
4246
4246
|
assert3(this.red, "redAdd works only with red numbers");
|
|
4247
4247
|
return this.red.add(this, num);
|
|
4248
4248
|
};
|
|
4249
|
-
|
|
4249
|
+
BN4.prototype.redIAdd = function redIAdd(num) {
|
|
4250
4250
|
assert3(this.red, "redIAdd works only with red numbers");
|
|
4251
4251
|
return this.red.iadd(this, num);
|
|
4252
4252
|
};
|
|
4253
|
-
|
|
4253
|
+
BN4.prototype.redSub = function redSub(num) {
|
|
4254
4254
|
assert3(this.red, "redSub works only with red numbers");
|
|
4255
4255
|
return this.red.sub(this, num);
|
|
4256
4256
|
};
|
|
4257
|
-
|
|
4257
|
+
BN4.prototype.redISub = function redISub(num) {
|
|
4258
4258
|
assert3(this.red, "redISub works only with red numbers");
|
|
4259
4259
|
return this.red.isub(this, num);
|
|
4260
4260
|
};
|
|
4261
|
-
|
|
4261
|
+
BN4.prototype.redShl = function redShl(num) {
|
|
4262
4262
|
assert3(this.red, "redShl works only with red numbers");
|
|
4263
4263
|
return this.red.shl(this, num);
|
|
4264
4264
|
};
|
|
4265
|
-
|
|
4265
|
+
BN4.prototype.redMul = function redMul(num) {
|
|
4266
4266
|
assert3(this.red, "redMul works only with red numbers");
|
|
4267
4267
|
this.red._verify2(this, num);
|
|
4268
4268
|
return this.red.mul(this, num);
|
|
4269
4269
|
};
|
|
4270
|
-
|
|
4270
|
+
BN4.prototype.redIMul = function redIMul(num) {
|
|
4271
4271
|
assert3(this.red, "redMul works only with red numbers");
|
|
4272
4272
|
this.red._verify2(this, num);
|
|
4273
4273
|
return this.red.imul(this, num);
|
|
4274
4274
|
};
|
|
4275
|
-
|
|
4275
|
+
BN4.prototype.redSqr = function redSqr() {
|
|
4276
4276
|
assert3(this.red, "redSqr works only with red numbers");
|
|
4277
4277
|
this.red._verify1(this);
|
|
4278
4278
|
return this.red.sqr(this);
|
|
4279
4279
|
};
|
|
4280
|
-
|
|
4280
|
+
BN4.prototype.redISqr = function redISqr() {
|
|
4281
4281
|
assert3(this.red, "redISqr works only with red numbers");
|
|
4282
4282
|
this.red._verify1(this);
|
|
4283
4283
|
return this.red.isqr(this);
|
|
4284
4284
|
};
|
|
4285
|
-
|
|
4285
|
+
BN4.prototype.redSqrt = function redSqrt() {
|
|
4286
4286
|
assert3(this.red, "redSqrt works only with red numbers");
|
|
4287
4287
|
this.red._verify1(this);
|
|
4288
4288
|
return this.red.sqrt(this);
|
|
4289
4289
|
};
|
|
4290
|
-
|
|
4290
|
+
BN4.prototype.redInvm = function redInvm() {
|
|
4291
4291
|
assert3(this.red, "redInvm works only with red numbers");
|
|
4292
4292
|
this.red._verify1(this);
|
|
4293
4293
|
return this.red.invm(this);
|
|
4294
4294
|
};
|
|
4295
|
-
|
|
4295
|
+
BN4.prototype.redNeg = function redNeg() {
|
|
4296
4296
|
assert3(this.red, "redNeg works only with red numbers");
|
|
4297
4297
|
this.red._verify1(this);
|
|
4298
4298
|
return this.red.neg(this);
|
|
4299
4299
|
};
|
|
4300
|
-
|
|
4300
|
+
BN4.prototype.redPow = function redPow(num) {
|
|
4301
4301
|
assert3(this.red && !num.red, "redPow(normalNum)");
|
|
4302
4302
|
this.red._verify1(this);
|
|
4303
4303
|
return this.red.pow(this, num);
|
|
@@ -4310,13 +4310,13 @@ var require_bn = __commonJS({
|
|
|
4310
4310
|
};
|
|
4311
4311
|
function MPrime(name, p) {
|
|
4312
4312
|
this.name = name;
|
|
4313
|
-
this.p = new
|
|
4313
|
+
this.p = new BN4(p, 16);
|
|
4314
4314
|
this.n = this.p.bitLength();
|
|
4315
|
-
this.k = new
|
|
4315
|
+
this.k = new BN4(1).iushln(this.n).isub(this.p);
|
|
4316
4316
|
this.tmp = this._tmp();
|
|
4317
4317
|
}
|
|
4318
4318
|
MPrime.prototype._tmp = function _tmp() {
|
|
4319
|
-
var tmp = new
|
|
4319
|
+
var tmp = new BN4(null);
|
|
4320
4320
|
tmp.words = new Array(Math.ceil(this.n / 13));
|
|
4321
4321
|
return tmp;
|
|
4322
4322
|
};
|
|
@@ -4442,7 +4442,7 @@ var require_bn = __commonJS({
|
|
|
4442
4442
|
}
|
|
4443
4443
|
return num;
|
|
4444
4444
|
};
|
|
4445
|
-
|
|
4445
|
+
BN4._prime = function prime(name) {
|
|
4446
4446
|
if (primes[name]) return primes[name];
|
|
4447
4447
|
var prime2;
|
|
4448
4448
|
if (name === "k256") {
|
|
@@ -4461,7 +4461,7 @@ var require_bn = __commonJS({
|
|
|
4461
4461
|
};
|
|
4462
4462
|
function Red(m) {
|
|
4463
4463
|
if (typeof m === "string") {
|
|
4464
|
-
var prime =
|
|
4464
|
+
var prime = BN4._prime(m);
|
|
4465
4465
|
this.m = prime.p;
|
|
4466
4466
|
this.prime = prime;
|
|
4467
4467
|
} else {
|
|
@@ -4547,7 +4547,7 @@ var require_bn = __commonJS({
|
|
|
4547
4547
|
var mod3 = this.m.andln(3);
|
|
4548
4548
|
assert3(mod3 % 2 === 1);
|
|
4549
4549
|
if (mod3 === 3) {
|
|
4550
|
-
var pow = this.m.add(new
|
|
4550
|
+
var pow = this.m.add(new BN4(1)).iushrn(2);
|
|
4551
4551
|
return this.pow(a, pow);
|
|
4552
4552
|
}
|
|
4553
4553
|
var q = this.m.subn(1);
|
|
@@ -4557,11 +4557,11 @@ var require_bn = __commonJS({
|
|
|
4557
4557
|
q.iushrn(1);
|
|
4558
4558
|
}
|
|
4559
4559
|
assert3(!q.isZero());
|
|
4560
|
-
var one = new
|
|
4560
|
+
var one = new BN4(1).toRed(this);
|
|
4561
4561
|
var nOne = one.redNeg();
|
|
4562
4562
|
var lpow = this.m.subn(1).iushrn(1);
|
|
4563
4563
|
var z = this.m.bitLength();
|
|
4564
|
-
z = new
|
|
4564
|
+
z = new BN4(2 * z * z).toRed(this);
|
|
4565
4565
|
while (this.pow(z, lpow).cmp(nOne) !== 0) {
|
|
4566
4566
|
z.redIAdd(nOne);
|
|
4567
4567
|
}
|
|
@@ -4575,7 +4575,7 @@ var require_bn = __commonJS({
|
|
|
4575
4575
|
tmp = tmp.redSqr();
|
|
4576
4576
|
}
|
|
4577
4577
|
assert3(i < m);
|
|
4578
|
-
var b = this.pow(c, new
|
|
4578
|
+
var b = this.pow(c, new BN4(1).iushln(m - i - 1));
|
|
4579
4579
|
r = r.redMul(b);
|
|
4580
4580
|
c = b.redSqr();
|
|
4581
4581
|
t = t.redMul(c);
|
|
@@ -4593,11 +4593,11 @@ var require_bn = __commonJS({
|
|
|
4593
4593
|
}
|
|
4594
4594
|
};
|
|
4595
4595
|
Red.prototype.pow = function pow(a, num) {
|
|
4596
|
-
if (num.isZero()) return new
|
|
4596
|
+
if (num.isZero()) return new BN4(1).toRed(this);
|
|
4597
4597
|
if (num.cmpn(1) === 0) return a.clone();
|
|
4598
4598
|
var windowSize = 4;
|
|
4599
4599
|
var wnd = new Array(1 << windowSize);
|
|
4600
|
-
wnd[0] = new
|
|
4600
|
+
wnd[0] = new BN4(1).toRed(this);
|
|
4601
4601
|
wnd[1] = a;
|
|
4602
4602
|
for (var i = 2; i < wnd.length; i++) {
|
|
4603
4603
|
wnd[i] = this.mul(wnd[i - 1], a);
|
|
@@ -4641,7 +4641,7 @@ var require_bn = __commonJS({
|
|
|
4641
4641
|
res.red = null;
|
|
4642
4642
|
return res;
|
|
4643
4643
|
};
|
|
4644
|
-
|
|
4644
|
+
BN4.mont = function mont(num) {
|
|
4645
4645
|
return new Mont(num);
|
|
4646
4646
|
};
|
|
4647
4647
|
function Mont(m) {
|
|
@@ -4650,7 +4650,7 @@ var require_bn = __commonJS({
|
|
|
4650
4650
|
if (this.shift % 26 !== 0) {
|
|
4651
4651
|
this.shift += 26 - this.shift % 26;
|
|
4652
4652
|
}
|
|
4653
|
-
this.r = new
|
|
4653
|
+
this.r = new BN4(1).iushln(this.shift);
|
|
4654
4654
|
this.r2 = this.imod(this.r.sqr());
|
|
4655
4655
|
this.rinv = this.r._invmp(this.m);
|
|
4656
4656
|
this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
|
|
@@ -4684,7 +4684,7 @@ var require_bn = __commonJS({
|
|
|
4684
4684
|
return res._forceRed(this);
|
|
4685
4685
|
};
|
|
4686
4686
|
Mont.prototype.mul = function mul(a, b) {
|
|
4687
|
-
if (a.isZero() || b.isZero()) return new
|
|
4687
|
+
if (a.isZero() || b.isZero()) return new BN4(0)._forceRed(this);
|
|
4688
4688
|
var t = a.mul(b);
|
|
4689
4689
|
var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
|
|
4690
4690
|
var u = t.isub(c).iushrn(this.shift);
|
|
@@ -9607,8 +9607,7 @@ function getMXEAccountEncoder() {
|
|
|
9607
9607
|
]
|
|
9608
9608
|
])
|
|
9609
9609
|
],
|
|
9610
|
-
["
|
|
9611
|
-
["rejectedClusters", getArrayEncoder14(getU32Encoder5())],
|
|
9610
|
+
["lutOffsetSlot", getU64Encoder12()],
|
|
9612
9611
|
["computationDefinitions", getArrayEncoder14(getU32Encoder5())],
|
|
9613
9612
|
["status", getMxeStatusEncoder()],
|
|
9614
9613
|
["bump", getU8Encoder18()]
|
|
@@ -9647,8 +9646,7 @@ function getMXEAccountDecoder() {
|
|
|
9647
9646
|
]
|
|
9648
9647
|
])
|
|
9649
9648
|
],
|
|
9650
|
-
["
|
|
9651
|
-
["rejectedClusters", getArrayDecoder14(getU32Decoder5())],
|
|
9649
|
+
["lutOffsetSlot", getU64Decoder12()],
|
|
9652
9650
|
["computationDefinitions", getArrayDecoder14(getU32Decoder5())],
|
|
9653
9651
|
["status", getMxeStatusDecoder()],
|
|
9654
9652
|
["bump", getU8Decoder18()]
|
|
@@ -10183,7 +10181,7 @@ import {
|
|
|
10183
10181
|
fixEncoderSize as fixEncoderSize11,
|
|
10184
10182
|
getBytesEncoder as getBytesEncoder11
|
|
10185
10183
|
} from "@solana/kit";
|
|
10186
|
-
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "
|
|
10184
|
+
var OPPORTUNITY_MARKET_PROGRAM_ADDRESS = "AFJhmrwWC4DGh88yeLTBtJRu9vKN6gnAEra4163zGHS6";
|
|
10187
10185
|
var OpportunityMarketAccount = /* @__PURE__ */ ((OpportunityMarketAccount2) => {
|
|
10188
10186
|
OpportunityMarketAccount2[OpportunityMarketAccount2["ArciumSignerAccount"] = 0] = "ArciumSignerAccount";
|
|
10189
10187
|
OpportunityMarketAccount2[OpportunityMarketAccount2["ClockAccount"] = 1] = "ClockAccount";
|
|
@@ -10564,11 +10562,47 @@ function identifyOpportunityMarketInstruction(instruction) {
|
|
|
10564
10562
|
}
|
|
10565
10563
|
|
|
10566
10564
|
// src/generated/errors/opportunityMarket.ts
|
|
10567
|
-
var
|
|
10565
|
+
var OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION = 6e3;
|
|
10566
|
+
var OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET = 6001;
|
|
10567
|
+
var OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED = 6002;
|
|
10568
|
+
var OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE = 6003;
|
|
10569
|
+
var OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING = 6004;
|
|
10570
|
+
var OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP = 6005;
|
|
10571
|
+
var OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN = 6006;
|
|
10572
|
+
var OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX = 6007;
|
|
10573
|
+
var OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN = 6008;
|
|
10574
|
+
var OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED = 6009;
|
|
10575
|
+
var OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE = 6010;
|
|
10576
|
+
var OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED = 6011;
|
|
10577
|
+
var OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED = 6012;
|
|
10578
|
+
var OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED = 6013;
|
|
10579
|
+
var OPPORTUNITY_MARKET_ERROR__NOT_REVEALED = 6014;
|
|
10580
|
+
var OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED = 6015;
|
|
10581
|
+
var OPPORTUNITY_MARKET_ERROR__OVERFLOW = 6016;
|
|
10582
|
+
var OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED = 6017;
|
|
10583
|
+
var OPPORTUNITY_MARKET_ERROR__INVALID_MINT = 6018;
|
|
10568
10584
|
var opportunityMarketErrorMessages;
|
|
10569
10585
|
if (true) {
|
|
10570
10586
|
opportunityMarketErrorMessages = {
|
|
10571
|
-
[
|
|
10587
|
+
[OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION]: `Computation aborted`,
|
|
10588
|
+
[OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED]: `Shares already revealed`,
|
|
10589
|
+
[OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET]: `Cluster not set`,
|
|
10590
|
+
[OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE]: `Insufficient balance`,
|
|
10591
|
+
[OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING]: `Insufficient reward funding`,
|
|
10592
|
+
[OPPORTUNITY_MARKET_ERROR__INVALID_MINT]: `Token mint does not match market mint`,
|
|
10593
|
+
[OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX]: `Invalid option index`,
|
|
10594
|
+
[OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP]: `Timestamp must be in the future`,
|
|
10595
|
+
[OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN]: `Market is already open`,
|
|
10596
|
+
[OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN]: `Market is not open`,
|
|
10597
|
+
[OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED]: `Staking period not over`,
|
|
10598
|
+
[OPPORTUNITY_MARKET_ERROR__NOT_REVEALED]: `Shares not yet revealed`,
|
|
10599
|
+
[OPPORTUNITY_MARKET_ERROR__OVERFLOW]: `Arithmetic overflow`,
|
|
10600
|
+
[OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED]: `Reveal period has already ended`,
|
|
10601
|
+
[OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED]: `Invalid option or not enough balance`,
|
|
10602
|
+
[OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE]: `Staking period is not active`,
|
|
10603
|
+
[OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED]: `Tally already incremented for this share account`,
|
|
10604
|
+
[OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED]: `Unauthorized`,
|
|
10605
|
+
[OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED]: `Market winner already selected`
|
|
10572
10606
|
};
|
|
10573
10607
|
}
|
|
10574
10608
|
function getOpportunityMarketErrorMessage(code) {
|
|
@@ -11288,10 +11322,18 @@ function getBuyOpportunityMarketSharesCompDefInstruction(input, config) {
|
|
|
11288
11322
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
11289
11323
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
11290
11324
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
11325
|
+
addressLookupTable: {
|
|
11326
|
+
value: input.addressLookupTable ?? null,
|
|
11327
|
+
isWritable: true
|
|
11328
|
+
},
|
|
11329
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
11291
11330
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
11292
11331
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
11293
11332
|
};
|
|
11294
11333
|
const accounts = originalAccounts;
|
|
11334
|
+
if (!accounts.lutProgram.value) {
|
|
11335
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
11336
|
+
}
|
|
11295
11337
|
if (!accounts.arciumProgram.value) {
|
|
11296
11338
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
11297
11339
|
}
|
|
@@ -11304,6 +11346,8 @@ function getBuyOpportunityMarketSharesCompDefInstruction(input, config) {
|
|
|
11304
11346
|
getAccountMeta(accounts.payer),
|
|
11305
11347
|
getAccountMeta(accounts.mxeAccount),
|
|
11306
11348
|
getAccountMeta(accounts.compDefAccount),
|
|
11349
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
11350
|
+
getAccountMeta(accounts.lutProgram),
|
|
11307
11351
|
getAccountMeta(accounts.arciumProgram),
|
|
11308
11352
|
getAccountMeta(accounts.systemProgram)
|
|
11309
11353
|
],
|
|
@@ -11314,7 +11358,7 @@ function getBuyOpportunityMarketSharesCompDefInstruction(input, config) {
|
|
|
11314
11358
|
});
|
|
11315
11359
|
}
|
|
11316
11360
|
function parseBuyOpportunityMarketSharesCompDefInstruction(instruction) {
|
|
11317
|
-
if (instruction.accounts.length <
|
|
11361
|
+
if (instruction.accounts.length < 7) {
|
|
11318
11362
|
throw new Error("Not enough accounts");
|
|
11319
11363
|
}
|
|
11320
11364
|
let accountIndex = 0;
|
|
@@ -11329,6 +11373,8 @@ function parseBuyOpportunityMarketSharesCompDefInstruction(instruction) {
|
|
|
11329
11373
|
payer: getNextAccount(),
|
|
11330
11374
|
mxeAccount: getNextAccount(),
|
|
11331
11375
|
compDefAccount: getNextAccount(),
|
|
11376
|
+
addressLookupTable: getNextAccount(),
|
|
11377
|
+
lutProgram: getNextAccount(),
|
|
11332
11378
|
arciumProgram: getNextAccount(),
|
|
11333
11379
|
systemProgram: getNextAccount()
|
|
11334
11380
|
},
|
|
@@ -11568,10 +11614,18 @@ function getBuyVoteTokensCompDefInstruction(input, config) {
|
|
|
11568
11614
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
11569
11615
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
11570
11616
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
11617
|
+
addressLookupTable: {
|
|
11618
|
+
value: input.addressLookupTable ?? null,
|
|
11619
|
+
isWritable: true
|
|
11620
|
+
},
|
|
11621
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
11571
11622
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
11572
11623
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
11573
11624
|
};
|
|
11574
11625
|
const accounts = originalAccounts;
|
|
11626
|
+
if (!accounts.lutProgram.value) {
|
|
11627
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
11628
|
+
}
|
|
11575
11629
|
if (!accounts.arciumProgram.value) {
|
|
11576
11630
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
11577
11631
|
}
|
|
@@ -11584,6 +11638,8 @@ function getBuyVoteTokensCompDefInstruction(input, config) {
|
|
|
11584
11638
|
getAccountMeta(accounts.payer),
|
|
11585
11639
|
getAccountMeta(accounts.mxeAccount),
|
|
11586
11640
|
getAccountMeta(accounts.compDefAccount),
|
|
11641
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
11642
|
+
getAccountMeta(accounts.lutProgram),
|
|
11587
11643
|
getAccountMeta(accounts.arciumProgram),
|
|
11588
11644
|
getAccountMeta(accounts.systemProgram)
|
|
11589
11645
|
],
|
|
@@ -11592,7 +11648,7 @@ function getBuyVoteTokensCompDefInstruction(input, config) {
|
|
|
11592
11648
|
});
|
|
11593
11649
|
}
|
|
11594
11650
|
function parseBuyVoteTokensCompDefInstruction(instruction) {
|
|
11595
|
-
if (instruction.accounts.length <
|
|
11651
|
+
if (instruction.accounts.length < 7) {
|
|
11596
11652
|
throw new Error("Not enough accounts");
|
|
11597
11653
|
}
|
|
11598
11654
|
let accountIndex = 0;
|
|
@@ -11607,6 +11663,8 @@ function parseBuyVoteTokensCompDefInstruction(instruction) {
|
|
|
11607
11663
|
payer: getNextAccount(),
|
|
11608
11664
|
mxeAccount: getNextAccount(),
|
|
11609
11665
|
compDefAccount: getNextAccount(),
|
|
11666
|
+
addressLookupTable: getNextAccount(),
|
|
11667
|
+
lutProgram: getNextAccount(),
|
|
11610
11668
|
arciumProgram: getNextAccount(),
|
|
11611
11669
|
systemProgram: getNextAccount()
|
|
11612
11670
|
},
|
|
@@ -12349,10 +12407,18 @@ function getClaimVoteTokensCompDefInstruction(input, config) {
|
|
|
12349
12407
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
12350
12408
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
12351
12409
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
12410
|
+
addressLookupTable: {
|
|
12411
|
+
value: input.addressLookupTable ?? null,
|
|
12412
|
+
isWritable: true
|
|
12413
|
+
},
|
|
12414
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
12352
12415
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
12353
12416
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
12354
12417
|
};
|
|
12355
12418
|
const accounts = originalAccounts;
|
|
12419
|
+
if (!accounts.lutProgram.value) {
|
|
12420
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
12421
|
+
}
|
|
12356
12422
|
if (!accounts.arciumProgram.value) {
|
|
12357
12423
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
12358
12424
|
}
|
|
@@ -12365,6 +12431,8 @@ function getClaimVoteTokensCompDefInstruction(input, config) {
|
|
|
12365
12431
|
getAccountMeta(accounts.payer),
|
|
12366
12432
|
getAccountMeta(accounts.mxeAccount),
|
|
12367
12433
|
getAccountMeta(accounts.compDefAccount),
|
|
12434
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
12435
|
+
getAccountMeta(accounts.lutProgram),
|
|
12368
12436
|
getAccountMeta(accounts.arciumProgram),
|
|
12369
12437
|
getAccountMeta(accounts.systemProgram)
|
|
12370
12438
|
],
|
|
@@ -12373,7 +12441,7 @@ function getClaimVoteTokensCompDefInstruction(input, config) {
|
|
|
12373
12441
|
});
|
|
12374
12442
|
}
|
|
12375
12443
|
function parseClaimVoteTokensCompDefInstruction(instruction) {
|
|
12376
|
-
if (instruction.accounts.length <
|
|
12444
|
+
if (instruction.accounts.length < 7) {
|
|
12377
12445
|
throw new Error("Not enough accounts");
|
|
12378
12446
|
}
|
|
12379
12447
|
let accountIndex = 0;
|
|
@@ -12388,6 +12456,8 @@ function parseClaimVoteTokensCompDefInstruction(instruction) {
|
|
|
12388
12456
|
payer: getNextAccount(),
|
|
12389
12457
|
mxeAccount: getNextAccount(),
|
|
12390
12458
|
compDefAccount: getNextAccount(),
|
|
12459
|
+
addressLookupTable: getNextAccount(),
|
|
12460
|
+
lutProgram: getNextAccount(),
|
|
12391
12461
|
arciumProgram: getNextAccount(),
|
|
12392
12462
|
systemProgram: getNextAccount()
|
|
12393
12463
|
},
|
|
@@ -13416,10 +13486,18 @@ function getInitMarketSharesCompDefInstruction(input, config) {
|
|
|
13416
13486
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
13417
13487
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
13418
13488
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
13489
|
+
addressLookupTable: {
|
|
13490
|
+
value: input.addressLookupTable ?? null,
|
|
13491
|
+
isWritable: true
|
|
13492
|
+
},
|
|
13493
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
13419
13494
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
13420
13495
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
13421
13496
|
};
|
|
13422
13497
|
const accounts = originalAccounts;
|
|
13498
|
+
if (!accounts.lutProgram.value) {
|
|
13499
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
13500
|
+
}
|
|
13423
13501
|
if (!accounts.arciumProgram.value) {
|
|
13424
13502
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
13425
13503
|
}
|
|
@@ -13432,6 +13510,8 @@ function getInitMarketSharesCompDefInstruction(input, config) {
|
|
|
13432
13510
|
getAccountMeta(accounts.payer),
|
|
13433
13511
|
getAccountMeta(accounts.mxeAccount),
|
|
13434
13512
|
getAccountMeta(accounts.compDefAccount),
|
|
13513
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
13514
|
+
getAccountMeta(accounts.lutProgram),
|
|
13435
13515
|
getAccountMeta(accounts.arciumProgram),
|
|
13436
13516
|
getAccountMeta(accounts.systemProgram)
|
|
13437
13517
|
],
|
|
@@ -13440,7 +13520,7 @@ function getInitMarketSharesCompDefInstruction(input, config) {
|
|
|
13440
13520
|
});
|
|
13441
13521
|
}
|
|
13442
13522
|
function parseInitMarketSharesCompDefInstruction(instruction) {
|
|
13443
|
-
if (instruction.accounts.length <
|
|
13523
|
+
if (instruction.accounts.length < 7) {
|
|
13444
13524
|
throw new Error("Not enough accounts");
|
|
13445
13525
|
}
|
|
13446
13526
|
let accountIndex = 0;
|
|
@@ -13455,6 +13535,8 @@ function parseInitMarketSharesCompDefInstruction(instruction) {
|
|
|
13455
13535
|
payer: getNextAccount(),
|
|
13456
13536
|
mxeAccount: getNextAccount(),
|
|
13457
13537
|
compDefAccount: getNextAccount(),
|
|
13538
|
+
addressLookupTable: getNextAccount(),
|
|
13539
|
+
lutProgram: getNextAccount(),
|
|
13458
13540
|
arciumProgram: getNextAccount(),
|
|
13459
13541
|
systemProgram: getNextAccount()
|
|
13460
13542
|
},
|
|
@@ -14172,10 +14254,18 @@ function getInitVoteTokenAccountCompDefInstruction(input, config) {
|
|
|
14172
14254
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
14173
14255
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
14174
14256
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
14257
|
+
addressLookupTable: {
|
|
14258
|
+
value: input.addressLookupTable ?? null,
|
|
14259
|
+
isWritable: true
|
|
14260
|
+
},
|
|
14261
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
14175
14262
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
14176
14263
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
14177
14264
|
};
|
|
14178
14265
|
const accounts = originalAccounts;
|
|
14266
|
+
if (!accounts.lutProgram.value) {
|
|
14267
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
14268
|
+
}
|
|
14179
14269
|
if (!accounts.arciumProgram.value) {
|
|
14180
14270
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
14181
14271
|
}
|
|
@@ -14188,6 +14278,8 @@ function getInitVoteTokenAccountCompDefInstruction(input, config) {
|
|
|
14188
14278
|
getAccountMeta(accounts.payer),
|
|
14189
14279
|
getAccountMeta(accounts.mxeAccount),
|
|
14190
14280
|
getAccountMeta(accounts.compDefAccount),
|
|
14281
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
14282
|
+
getAccountMeta(accounts.lutProgram),
|
|
14191
14283
|
getAccountMeta(accounts.arciumProgram),
|
|
14192
14284
|
getAccountMeta(accounts.systemProgram)
|
|
14193
14285
|
],
|
|
@@ -14196,7 +14288,7 @@ function getInitVoteTokenAccountCompDefInstruction(input, config) {
|
|
|
14196
14288
|
});
|
|
14197
14289
|
}
|
|
14198
14290
|
function parseInitVoteTokenAccountCompDefInstruction(instruction) {
|
|
14199
|
-
if (instruction.accounts.length <
|
|
14291
|
+
if (instruction.accounts.length < 7) {
|
|
14200
14292
|
throw new Error("Not enough accounts");
|
|
14201
14293
|
}
|
|
14202
14294
|
let accountIndex = 0;
|
|
@@ -14211,6 +14303,8 @@ function parseInitVoteTokenAccountCompDefInstruction(instruction) {
|
|
|
14211
14303
|
payer: getNextAccount(),
|
|
14212
14304
|
mxeAccount: getNextAccount(),
|
|
14213
14305
|
compDefAccount: getNextAccount(),
|
|
14306
|
+
addressLookupTable: getNextAccount(),
|
|
14307
|
+
lutProgram: getNextAccount(),
|
|
14214
14308
|
arciumProgram: getNextAccount(),
|
|
14215
14309
|
systemProgram: getNextAccount()
|
|
14216
14310
|
},
|
|
@@ -15166,10 +15260,18 @@ function getRevealSharesCompDefInstruction(input, config) {
|
|
|
15166
15260
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
15167
15261
|
mxeAccount: { value: input.mxeAccount ?? null, isWritable: true },
|
|
15168
15262
|
compDefAccount: { value: input.compDefAccount ?? null, isWritable: true },
|
|
15263
|
+
addressLookupTable: {
|
|
15264
|
+
value: input.addressLookupTable ?? null,
|
|
15265
|
+
isWritable: true
|
|
15266
|
+
},
|
|
15267
|
+
lutProgram: { value: input.lutProgram ?? null, isWritable: false },
|
|
15169
15268
|
arciumProgram: { value: input.arciumProgram ?? null, isWritable: false },
|
|
15170
15269
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
15171
15270
|
};
|
|
15172
15271
|
const accounts = originalAccounts;
|
|
15272
|
+
if (!accounts.lutProgram.value) {
|
|
15273
|
+
accounts.lutProgram.value = "AddressLookupTab1e1111111111111111111111111";
|
|
15274
|
+
}
|
|
15173
15275
|
if (!accounts.arciumProgram.value) {
|
|
15174
15276
|
accounts.arciumProgram.value = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
15175
15277
|
}
|
|
@@ -15182,6 +15284,8 @@ function getRevealSharesCompDefInstruction(input, config) {
|
|
|
15182
15284
|
getAccountMeta(accounts.payer),
|
|
15183
15285
|
getAccountMeta(accounts.mxeAccount),
|
|
15184
15286
|
getAccountMeta(accounts.compDefAccount),
|
|
15287
|
+
getAccountMeta(accounts.addressLookupTable),
|
|
15288
|
+
getAccountMeta(accounts.lutProgram),
|
|
15185
15289
|
getAccountMeta(accounts.arciumProgram),
|
|
15186
15290
|
getAccountMeta(accounts.systemProgram)
|
|
15187
15291
|
],
|
|
@@ -15190,7 +15294,7 @@ function getRevealSharesCompDefInstruction(input, config) {
|
|
|
15190
15294
|
});
|
|
15191
15295
|
}
|
|
15192
15296
|
function parseRevealSharesCompDefInstruction(instruction) {
|
|
15193
|
-
if (instruction.accounts.length <
|
|
15297
|
+
if (instruction.accounts.length < 7) {
|
|
15194
15298
|
throw new Error("Not enough accounts");
|
|
15195
15299
|
}
|
|
15196
15300
|
let accountIndex = 0;
|
|
@@ -15205,6 +15309,8 @@ function parseRevealSharesCompDefInstruction(instruction) {
|
|
|
15205
15309
|
payer: getNextAccount(),
|
|
15206
15310
|
mxeAccount: getNextAccount(),
|
|
15207
15311
|
compDefAccount: getNextAccount(),
|
|
15312
|
+
addressLookupTable: getNextAccount(),
|
|
15313
|
+
lutProgram: getNextAccount(),
|
|
15208
15314
|
arciumProgram: getNextAccount(),
|
|
15209
15315
|
systemProgram: getNextAccount()
|
|
15210
15316
|
},
|
|
@@ -24333,8 +24439,10 @@ import {
|
|
|
24333
24439
|
import {
|
|
24334
24440
|
getMXEAccAddress as getMXEAccAddress2,
|
|
24335
24441
|
getCompDefAccAddress as getCompDefAccAddress2,
|
|
24336
|
-
getCompDefAccOffset as getCompDefAccOffset2
|
|
24442
|
+
getCompDefAccOffset as getCompDefAccOffset2,
|
|
24443
|
+
getLookupTableAddress
|
|
24337
24444
|
} from "@arcium-hq/client";
|
|
24445
|
+
var import_bn3 = __toESM(require_bn(), 1);
|
|
24338
24446
|
var ALL_COMP_DEF_CIRCUITS = [
|
|
24339
24447
|
"init_vote_token_account",
|
|
24340
24448
|
"buy_vote_tokens",
|
|
@@ -24346,9 +24454,10 @@ var ALL_COMP_DEF_CIRCUITS = [
|
|
|
24346
24454
|
function toAddress2(pubkey) {
|
|
24347
24455
|
return address2(pubkey.toBase58());
|
|
24348
24456
|
}
|
|
24349
|
-
function getMxeAccount(programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
24457
|
+
async function getMxeAccount(rpc, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
24350
24458
|
const programIdLegacy = new PublicKey(programId);
|
|
24351
|
-
|
|
24459
|
+
const mxeAddress = toAddress2(getMXEAccAddress2(programIdLegacy));
|
|
24460
|
+
return fetchMXEAccount(rpc, mxeAddress);
|
|
24352
24461
|
}
|
|
24353
24462
|
function getCompDefAccount(circuitName, programId = OPPORTUNITY_MARKET_PROGRAM_ADDRESS) {
|
|
24354
24463
|
const programIdLegacy = new PublicKey(programId);
|
|
@@ -24361,14 +24470,19 @@ function getCompDefOffsetNumber(circuitName) {
|
|
|
24361
24470
|
const offset2 = getCompDefAccOffset2(circuitName);
|
|
24362
24471
|
return Buffer.from(offset2).readUInt32LE();
|
|
24363
24472
|
}
|
|
24364
|
-
function getInitCompDefInstruction(payer, circuitName, config = {}) {
|
|
24473
|
+
async function getInitCompDefInstruction(rpc, payer, circuitName, config = {}) {
|
|
24365
24474
|
const programId = config.programId ?? OPPORTUNITY_MARKET_PROGRAM_ADDRESS;
|
|
24366
|
-
const mxeAccount = getMxeAccount(programId);
|
|
24475
|
+
const mxeAccount = await getMxeAccount(rpc, programId);
|
|
24367
24476
|
const compDefAccount = getCompDefAccount(circuitName, programId);
|
|
24477
|
+
const lutAddress = getLookupTableAddress(
|
|
24478
|
+
new PublicKey(programId.toString()),
|
|
24479
|
+
new import_bn3.BN(mxeAccount.data.lutOffsetSlot)
|
|
24480
|
+
);
|
|
24368
24481
|
const baseInput = {
|
|
24369
24482
|
payer,
|
|
24370
|
-
mxeAccount,
|
|
24371
|
-
compDefAccount
|
|
24483
|
+
mxeAccount: mxeAccount.address,
|
|
24484
|
+
compDefAccount,
|
|
24485
|
+
addressLookupTable: toAddress2(lutAddress)
|
|
24372
24486
|
};
|
|
24373
24487
|
switch (circuitName) {
|
|
24374
24488
|
case "init_vote_token_account":
|
|
@@ -24676,7 +24790,25 @@ export {
|
|
|
24676
24790
|
MxeStatus,
|
|
24677
24791
|
OPEN_MARKET_DISCRIMINATOR,
|
|
24678
24792
|
OPPORTUNITY_MARKET_DISCRIMINATOR,
|
|
24679
|
-
|
|
24793
|
+
OPPORTUNITY_MARKET_ERROR__ABORTED_COMPUTATION,
|
|
24794
|
+
OPPORTUNITY_MARKET_ERROR__ALREADY_REVEALED,
|
|
24795
|
+
OPPORTUNITY_MARKET_ERROR__CLUSTER_NOT_SET,
|
|
24796
|
+
OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_BALANCE,
|
|
24797
|
+
OPPORTUNITY_MARKET_ERROR__INSUFFICIENT_REWARD_FUNDING,
|
|
24798
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_MINT,
|
|
24799
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_OPTION_INDEX,
|
|
24800
|
+
OPPORTUNITY_MARKET_ERROR__INVALID_TIMESTAMP,
|
|
24801
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_ALREADY_OPEN,
|
|
24802
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_NOT_OPEN,
|
|
24803
|
+
OPPORTUNITY_MARKET_ERROR__MARKET_NOT_RESOLVED,
|
|
24804
|
+
OPPORTUNITY_MARKET_ERROR__NOT_REVEALED,
|
|
24805
|
+
OPPORTUNITY_MARKET_ERROR__OVERFLOW,
|
|
24806
|
+
OPPORTUNITY_MARKET_ERROR__REVEAL_PERIOD_ENDED,
|
|
24807
|
+
OPPORTUNITY_MARKET_ERROR__SHARE_PURCHASE_FAILED,
|
|
24808
|
+
OPPORTUNITY_MARKET_ERROR__STAKING_NOT_ACTIVE,
|
|
24809
|
+
OPPORTUNITY_MARKET_ERROR__TALLY_ALREADY_INCREMENTED,
|
|
24810
|
+
OPPORTUNITY_MARKET_ERROR__UNAUTHORIZED,
|
|
24811
|
+
OPPORTUNITY_MARKET_ERROR__WINNER_ALREADY_SELECTED,
|
|
24680
24812
|
OPPORTUNITY_MARKET_OPTION_DISCRIMINATOR,
|
|
24681
24813
|
OPPORTUNITY_MARKET_OPTION_SEED,
|
|
24682
24814
|
OPPORTUNITY_MARKET_PROGRAM_ADDRESS,
|