@jpool/bond-sdk 0.10.1 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,7 @@
1
- import { Program, AnchorProvider, BN } from '@coral-xyz/anchor';
2
- import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes';
3
- import { getStakePoolAccount, STAKE_POOL_PROGRAM_ID, StakePoolInstruction } from '@solana/spl-stake-pool';
1
+ import { utils, Program, AnchorProvider, BN } from '@coral-xyz/anchor';
4
2
  import { TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, ACCOUNT_SIZE, AccountLayout } from '@solana/spl-token';
5
3
  import { PublicKey, Transaction, SystemProgram, LAMPORTS_PER_SOL } from '@solana/web3.js';
6
- import bs58$1 from 'bs58';
4
+ import bs58 from 'bs58';
7
5
 
8
6
  var __create = Object.create;
9
7
  var __defProp = Object.defineProperty;
@@ -1818,8 +1816,8 @@ var require_bn = __commonJS({
1818
1816
  ctor.prototype = new TempCtor();
1819
1817
  ctor.prototype.constructor = ctor;
1820
1818
  }
1821
- function BN4(number, base, endian) {
1822
- if (BN4.isBN(number)) {
1819
+ function BN3(number, base, endian) {
1820
+ if (BN3.isBN(number)) {
1823
1821
  return number;
1824
1822
  }
1825
1823
  this.negative = 0;
@@ -1835,12 +1833,12 @@ var require_bn = __commonJS({
1835
1833
  }
1836
1834
  }
1837
1835
  if (typeof module2 === "object") {
1838
- module2.exports = BN4;
1836
+ module2.exports = BN3;
1839
1837
  } else {
1840
- exports2.BN = BN4;
1838
+ exports2.BN = BN3;
1841
1839
  }
1842
- BN4.BN = BN4;
1843
- BN4.wordSize = 26;
1840
+ BN3.BN = BN3;
1841
+ BN3.wordSize = 26;
1844
1842
  var Buffer2;
1845
1843
  try {
1846
1844
  if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
@@ -1850,21 +1848,21 @@ var require_bn = __commonJS({
1850
1848
  }
1851
1849
  } catch (e) {
1852
1850
  }
1853
- BN4.isBN = function isBN(num) {
1854
- if (num instanceof BN4) {
1851
+ BN3.isBN = function isBN(num) {
1852
+ if (num instanceof BN3) {
1855
1853
  return true;
1856
1854
  }
1857
- return num !== null && typeof num === "object" && num.constructor.wordSize === BN4.wordSize && Array.isArray(num.words);
1855
+ return num !== null && typeof num === "object" && num.constructor.wordSize === BN3.wordSize && Array.isArray(num.words);
1858
1856
  };
1859
- BN4.max = function max(left, right) {
1857
+ BN3.max = function max(left, right) {
1860
1858
  if (left.cmp(right) > 0) return left;
1861
1859
  return right;
1862
1860
  };
1863
- BN4.min = function min(left, right) {
1861
+ BN3.min = function min(left, right) {
1864
1862
  if (left.cmp(right) < 0) return left;
1865
1863
  return right;
1866
1864
  };
1867
- BN4.prototype._init = function init(number, base, endian) {
1865
+ BN3.prototype._init = function init(number, base, endian) {
1868
1866
  if (typeof number === "number") {
1869
1867
  return this._initNumber(number, base, endian);
1870
1868
  }
@@ -1892,7 +1890,7 @@ var require_bn = __commonJS({
1892
1890
  }
1893
1891
  }
1894
1892
  };
1895
- BN4.prototype._initNumber = function _initNumber(number, base, endian) {
1893
+ BN3.prototype._initNumber = function _initNumber(number, base, endian) {
1896
1894
  if (number < 0) {
1897
1895
  this.negative = 1;
1898
1896
  number = -number;
@@ -1918,7 +1916,7 @@ var require_bn = __commonJS({
1918
1916
  if (endian !== "le") return;
1919
1917
  this._initArray(this.toArray(), base, endian);
1920
1918
  };
1921
- BN4.prototype._initArray = function _initArray(number, base, endian) {
1919
+ BN3.prototype._initArray = function _initArray(number, base, endian) {
1922
1920
  assert(typeof number.length === "number");
1923
1921
  if (number.length <= 0) {
1924
1922
  this.words = [0];
@@ -1976,7 +1974,7 @@ var require_bn = __commonJS({
1976
1974
  }
1977
1975
  return r;
1978
1976
  }
1979
- BN4.prototype._parseHex = function _parseHex(number, start, endian) {
1977
+ BN3.prototype._parseHex = function _parseHex(number, start, endian) {
1980
1978
  this.length = Math.ceil((number.length - start) / 6);
1981
1979
  this.words = new Array(this.length);
1982
1980
  for (var i = 0; i < this.length; i++) {
@@ -2032,7 +2030,7 @@ var require_bn = __commonJS({
2032
2030
  }
2033
2031
  return r;
2034
2032
  }
2035
- BN4.prototype._parseBase = function _parseBase(number, base, start) {
2033
+ BN3.prototype._parseBase = function _parseBase(number, base, start) {
2036
2034
  this.words = [0];
2037
2035
  this.length = 1;
2038
2036
  for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
@@ -2068,7 +2066,7 @@ var require_bn = __commonJS({
2068
2066
  }
2069
2067
  this._strip();
2070
2068
  };
2071
- BN4.prototype.copy = function copy(dest) {
2069
+ BN3.prototype.copy = function copy(dest) {
2072
2070
  dest.words = new Array(this.length);
2073
2071
  for (var i = 0; i < this.length; i++) {
2074
2072
  dest.words[i] = this.words[i];
@@ -2083,27 +2081,27 @@ var require_bn = __commonJS({
2083
2081
  dest.negative = src.negative;
2084
2082
  dest.red = src.red;
2085
2083
  }
2086
- BN4.prototype._move = function _move(dest) {
2084
+ BN3.prototype._move = function _move(dest) {
2087
2085
  move(dest, this);
2088
2086
  };
2089
- BN4.prototype.clone = function clone() {
2090
- var r = new BN4(null);
2087
+ BN3.prototype.clone = function clone() {
2088
+ var r = new BN3(null);
2091
2089
  this.copy(r);
2092
2090
  return r;
2093
2091
  };
2094
- BN4.prototype._expand = function _expand(size) {
2092
+ BN3.prototype._expand = function _expand(size) {
2095
2093
  while (this.length < size) {
2096
2094
  this.words[this.length++] = 0;
2097
2095
  }
2098
2096
  return this;
2099
2097
  };
2100
- BN4.prototype._strip = function strip() {
2098
+ BN3.prototype._strip = function strip() {
2101
2099
  while (this.length > 1 && this.words[this.length - 1] === 0) {
2102
2100
  this.length--;
2103
2101
  }
2104
2102
  return this._normSign();
2105
2103
  };
2106
- BN4.prototype._normSign = function _normSign() {
2104
+ BN3.prototype._normSign = function _normSign() {
2107
2105
  if (this.length === 1 && this.words[0] === 0) {
2108
2106
  this.negative = 0;
2109
2107
  }
@@ -2111,12 +2109,12 @@ var require_bn = __commonJS({
2111
2109
  };
2112
2110
  if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
2113
2111
  try {
2114
- BN4.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect;
2112
+ BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect;
2115
2113
  } catch (e) {
2116
- BN4.prototype.inspect = inspect;
2114
+ BN3.prototype.inspect = inspect;
2117
2115
  }
2118
2116
  } else {
2119
- BN4.prototype.inspect = inspect;
2117
+ BN3.prototype.inspect = inspect;
2120
2118
  }
2121
2119
  function inspect() {
2122
2120
  return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -2227,7 +2225,7 @@ var require_bn = __commonJS({
2227
2225
  52521875,
2228
2226
  60466176
2229
2227
  ];
2230
- BN4.prototype.toString = function toString(base, padding) {
2228
+ BN3.prototype.toString = function toString(base, padding) {
2231
2229
  base = base || 10;
2232
2230
  padding = padding | 0 || 1;
2233
2231
  var out;
@@ -2289,7 +2287,7 @@ var require_bn = __commonJS({
2289
2287
  }
2290
2288
  assert(false, "Base should be between 2 and 36");
2291
2289
  };
2292
- BN4.prototype.toNumber = function toNumber() {
2290
+ BN3.prototype.toNumber = function toNumber() {
2293
2291
  var ret = this.words[0];
2294
2292
  if (this.length === 2) {
2295
2293
  ret += this.words[1] * 67108864;
@@ -2300,15 +2298,15 @@ var require_bn = __commonJS({
2300
2298
  }
2301
2299
  return this.negative !== 0 ? -ret : ret;
2302
2300
  };
2303
- BN4.prototype.toJSON = function toJSON() {
2301
+ BN3.prototype.toJSON = function toJSON() {
2304
2302
  return this.toString(16, 2);
2305
2303
  };
2306
2304
  if (Buffer2) {
2307
- BN4.prototype.toBuffer = function toBuffer(endian, length) {
2305
+ BN3.prototype.toBuffer = function toBuffer(endian, length) {
2308
2306
  return this.toArrayLike(Buffer2, endian, length);
2309
2307
  };
2310
2308
  }
2311
- BN4.prototype.toArray = function toArray(endian, length) {
2309
+ BN3.prototype.toArray = function toArray(endian, length) {
2312
2310
  return this.toArrayLike(Array, endian, length);
2313
2311
  };
2314
2312
  var allocate = function allocate2(ArrayType, size) {
@@ -2317,7 +2315,7 @@ var require_bn = __commonJS({
2317
2315
  }
2318
2316
  return new ArrayType(size);
2319
2317
  };
2320
- BN4.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
2318
+ BN3.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
2321
2319
  this._strip();
2322
2320
  var byteLength = this.byteLength();
2323
2321
  var reqLength = length || Math.max(1, byteLength);
@@ -2328,7 +2326,7 @@ var require_bn = __commonJS({
2328
2326
  this["_toArrayLike" + postfix](res, byteLength);
2329
2327
  return res;
2330
2328
  };
2331
- BN4.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
2329
+ BN3.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
2332
2330
  var position = 0;
2333
2331
  var carry = 0;
2334
2332
  for (var i = 0, shift = 0; i < this.length; i++) {
@@ -2358,7 +2356,7 @@ var require_bn = __commonJS({
2358
2356
  }
2359
2357
  }
2360
2358
  };
2361
- BN4.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {
2359
+ BN3.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {
2362
2360
  var position = res.length - 1;
2363
2361
  var carry = 0;
2364
2362
  for (var i = 0, shift = 0; i < this.length; i++) {
@@ -2389,11 +2387,11 @@ var require_bn = __commonJS({
2389
2387
  }
2390
2388
  };
2391
2389
  if (Math.clz32) {
2392
- BN4.prototype._countBits = function _countBits(w) {
2390
+ BN3.prototype._countBits = function _countBits(w) {
2393
2391
  return 32 - Math.clz32(w);
2394
2392
  };
2395
2393
  } else {
2396
- BN4.prototype._countBits = function _countBits(w) {
2394
+ BN3.prototype._countBits = function _countBits(w) {
2397
2395
  var t = w;
2398
2396
  var r = 0;
2399
2397
  if (t >= 4096) {
@@ -2415,7 +2413,7 @@ var require_bn = __commonJS({
2415
2413
  return r + t;
2416
2414
  };
2417
2415
  }
2418
- BN4.prototype._zeroBits = function _zeroBits(w) {
2416
+ BN3.prototype._zeroBits = function _zeroBits(w) {
2419
2417
  if (w === 0) return 26;
2420
2418
  var t = w;
2421
2419
  var r = 0;
@@ -2440,7 +2438,7 @@ var require_bn = __commonJS({
2440
2438
  }
2441
2439
  return r;
2442
2440
  };
2443
- BN4.prototype.bitLength = function bitLength() {
2441
+ BN3.prototype.bitLength = function bitLength() {
2444
2442
  var w = this.words[this.length - 1];
2445
2443
  var hi = this._countBits(w);
2446
2444
  return (this.length - 1) * 26 + hi;
@@ -2454,7 +2452,7 @@ var require_bn = __commonJS({
2454
2452
  }
2455
2453
  return w;
2456
2454
  }
2457
- BN4.prototype.zeroBits = function zeroBits() {
2455
+ BN3.prototype.zeroBits = function zeroBits() {
2458
2456
  if (this.isZero()) return 0;
2459
2457
  var r = 0;
2460
2458
  for (var i = 0; i < this.length; i++) {
@@ -2464,34 +2462,34 @@ var require_bn = __commonJS({
2464
2462
  }
2465
2463
  return r;
2466
2464
  };
2467
- BN4.prototype.byteLength = function byteLength() {
2465
+ BN3.prototype.byteLength = function byteLength() {
2468
2466
  return Math.ceil(this.bitLength() / 8);
2469
2467
  };
2470
- BN4.prototype.toTwos = function toTwos(width) {
2468
+ BN3.prototype.toTwos = function toTwos(width) {
2471
2469
  if (this.negative !== 0) {
2472
2470
  return this.abs().inotn(width).iaddn(1);
2473
2471
  }
2474
2472
  return this.clone();
2475
2473
  };
2476
- BN4.prototype.fromTwos = function fromTwos(width) {
2474
+ BN3.prototype.fromTwos = function fromTwos(width) {
2477
2475
  if (this.testn(width - 1)) {
2478
2476
  return this.notn(width).iaddn(1).ineg();
2479
2477
  }
2480
2478
  return this.clone();
2481
2479
  };
2482
- BN4.prototype.isNeg = function isNeg() {
2480
+ BN3.prototype.isNeg = function isNeg() {
2483
2481
  return this.negative !== 0;
2484
2482
  };
2485
- BN4.prototype.neg = function neg() {
2483
+ BN3.prototype.neg = function neg() {
2486
2484
  return this.clone().ineg();
2487
2485
  };
2488
- BN4.prototype.ineg = function ineg() {
2486
+ BN3.prototype.ineg = function ineg() {
2489
2487
  if (!this.isZero()) {
2490
2488
  this.negative ^= 1;
2491
2489
  }
2492
2490
  return this;
2493
2491
  };
2494
- BN4.prototype.iuor = function iuor(num) {
2492
+ BN3.prototype.iuor = function iuor(num) {
2495
2493
  while (this.length < num.length) {
2496
2494
  this.words[this.length++] = 0;
2497
2495
  }
@@ -2500,19 +2498,19 @@ var require_bn = __commonJS({
2500
2498
  }
2501
2499
  return this._strip();
2502
2500
  };
2503
- BN4.prototype.ior = function ior(num) {
2501
+ BN3.prototype.ior = function ior(num) {
2504
2502
  assert((this.negative | num.negative) === 0);
2505
2503
  return this.iuor(num);
2506
2504
  };
2507
- BN4.prototype.or = function or(num) {
2505
+ BN3.prototype.or = function or(num) {
2508
2506
  if (this.length > num.length) return this.clone().ior(num);
2509
2507
  return num.clone().ior(this);
2510
2508
  };
2511
- BN4.prototype.uor = function uor(num) {
2509
+ BN3.prototype.uor = function uor(num) {
2512
2510
  if (this.length > num.length) return this.clone().iuor(num);
2513
2511
  return num.clone().iuor(this);
2514
2512
  };
2515
- BN4.prototype.iuand = function iuand(num) {
2513
+ BN3.prototype.iuand = function iuand(num) {
2516
2514
  var b;
2517
2515
  if (this.length > num.length) {
2518
2516
  b = num;
@@ -2525,19 +2523,19 @@ var require_bn = __commonJS({
2525
2523
  this.length = b.length;
2526
2524
  return this._strip();
2527
2525
  };
2528
- BN4.prototype.iand = function iand(num) {
2526
+ BN3.prototype.iand = function iand(num) {
2529
2527
  assert((this.negative | num.negative) === 0);
2530
2528
  return this.iuand(num);
2531
2529
  };
2532
- BN4.prototype.and = function and(num) {
2530
+ BN3.prototype.and = function and(num) {
2533
2531
  if (this.length > num.length) return this.clone().iand(num);
2534
2532
  return num.clone().iand(this);
2535
2533
  };
2536
- BN4.prototype.uand = function uand(num) {
2534
+ BN3.prototype.uand = function uand(num) {
2537
2535
  if (this.length > num.length) return this.clone().iuand(num);
2538
2536
  return num.clone().iuand(this);
2539
2537
  };
2540
- BN4.prototype.iuxor = function iuxor(num) {
2538
+ BN3.prototype.iuxor = function iuxor(num) {
2541
2539
  var a;
2542
2540
  var b;
2543
2541
  if (this.length > num.length) {
@@ -2558,19 +2556,19 @@ var require_bn = __commonJS({
2558
2556
  this.length = a.length;
2559
2557
  return this._strip();
2560
2558
  };
2561
- BN4.prototype.ixor = function ixor(num) {
2559
+ BN3.prototype.ixor = function ixor(num) {
2562
2560
  assert((this.negative | num.negative) === 0);
2563
2561
  return this.iuxor(num);
2564
2562
  };
2565
- BN4.prototype.xor = function xor(num) {
2563
+ BN3.prototype.xor = function xor(num) {
2566
2564
  if (this.length > num.length) return this.clone().ixor(num);
2567
2565
  return num.clone().ixor(this);
2568
2566
  };
2569
- BN4.prototype.uxor = function uxor(num) {
2567
+ BN3.prototype.uxor = function uxor(num) {
2570
2568
  if (this.length > num.length) return this.clone().iuxor(num);
2571
2569
  return num.clone().iuxor(this);
2572
2570
  };
2573
- BN4.prototype.inotn = function inotn(width) {
2571
+ BN3.prototype.inotn = function inotn(width) {
2574
2572
  assert(typeof width === "number" && width >= 0);
2575
2573
  var bytesNeeded = Math.ceil(width / 26) | 0;
2576
2574
  var bitsLeft = width % 26;
@@ -2586,10 +2584,10 @@ var require_bn = __commonJS({
2586
2584
  }
2587
2585
  return this._strip();
2588
2586
  };
2589
- BN4.prototype.notn = function notn(width) {
2587
+ BN3.prototype.notn = function notn(width) {
2590
2588
  return this.clone().inotn(width);
2591
2589
  };
2592
- BN4.prototype.setn = function setn(bit, val) {
2590
+ BN3.prototype.setn = function setn(bit, val) {
2593
2591
  assert(typeof bit === "number" && bit >= 0);
2594
2592
  var off = bit / 26 | 0;
2595
2593
  var wbit = bit % 26;
@@ -2601,7 +2599,7 @@ var require_bn = __commonJS({
2601
2599
  }
2602
2600
  return this._strip();
2603
2601
  };
2604
- BN4.prototype.iadd = function iadd(num) {
2602
+ BN3.prototype.iadd = function iadd(num) {
2605
2603
  var r;
2606
2604
  if (this.negative !== 0 && num.negative === 0) {
2607
2605
  this.negative = 0;
@@ -2644,7 +2642,7 @@ var require_bn = __commonJS({
2644
2642
  }
2645
2643
  return this;
2646
2644
  };
2647
- BN4.prototype.add = function add(num) {
2645
+ BN3.prototype.add = function add(num) {
2648
2646
  var res;
2649
2647
  if (num.negative !== 0 && this.negative === 0) {
2650
2648
  num.negative = 0;
@@ -2660,7 +2658,7 @@ var require_bn = __commonJS({
2660
2658
  if (this.length > num.length) return this.clone().iadd(num);
2661
2659
  return num.clone().iadd(this);
2662
2660
  };
2663
- BN4.prototype.isub = function isub(num) {
2661
+ BN3.prototype.isub = function isub(num) {
2664
2662
  if (num.negative !== 0) {
2665
2663
  num.negative = 0;
2666
2664
  var r = this.iadd(num);
@@ -2709,7 +2707,7 @@ var require_bn = __commonJS({
2709
2707
  }
2710
2708
  return this._strip();
2711
2709
  };
2712
- BN4.prototype.sub = function sub(num) {
2710
+ BN3.prototype.sub = function sub(num) {
2713
2711
  return this.clone().isub(num);
2714
2712
  };
2715
2713
  function smallMulTo(self, num, out) {
@@ -3337,7 +3335,7 @@ var require_bn = __commonJS({
3337
3335
  function jumboMulTo(self, num, out) {
3338
3336
  return bigMulTo(self, num, out);
3339
3337
  }
3340
- BN4.prototype.mulTo = function mulTo(num, out) {
3338
+ BN3.prototype.mulTo = function mulTo(num, out) {
3341
3339
  var res;
3342
3340
  var len = this.length + num.length;
3343
3341
  if (this.length === 10 && num.length === 10) {
@@ -3351,20 +3349,20 @@ var require_bn = __commonJS({
3351
3349
  }
3352
3350
  return res;
3353
3351
  };
3354
- BN4.prototype.mul = function mul(num) {
3355
- var out = new BN4(null);
3352
+ BN3.prototype.mul = function mul(num) {
3353
+ var out = new BN3(null);
3356
3354
  out.words = new Array(this.length + num.length);
3357
3355
  return this.mulTo(num, out);
3358
3356
  };
3359
- BN4.prototype.mulf = function mulf(num) {
3360
- var out = new BN4(null);
3357
+ BN3.prototype.mulf = function mulf(num) {
3358
+ var out = new BN3(null);
3361
3359
  out.words = new Array(this.length + num.length);
3362
3360
  return jumboMulTo(this, num, out);
3363
3361
  };
3364
- BN4.prototype.imul = function imul(num) {
3362
+ BN3.prototype.imul = function imul(num) {
3365
3363
  return this.clone().mulTo(num, this);
3366
3364
  };
3367
- BN4.prototype.imuln = function imuln(num) {
3365
+ BN3.prototype.imuln = function imuln(num) {
3368
3366
  var isNegNum = num < 0;
3369
3367
  if (isNegNum) num = -num;
3370
3368
  assert(typeof num === "number");
@@ -3385,18 +3383,18 @@ var require_bn = __commonJS({
3385
3383
  this.length = num === 0 ? 1 : this.length;
3386
3384
  return isNegNum ? this.ineg() : this;
3387
3385
  };
3388
- BN4.prototype.muln = function muln(num) {
3386
+ BN3.prototype.muln = function muln(num) {
3389
3387
  return this.clone().imuln(num);
3390
3388
  };
3391
- BN4.prototype.sqr = function sqr() {
3389
+ BN3.prototype.sqr = function sqr() {
3392
3390
  return this.mul(this);
3393
3391
  };
3394
- BN4.prototype.isqr = function isqr() {
3392
+ BN3.prototype.isqr = function isqr() {
3395
3393
  return this.imul(this.clone());
3396
3394
  };
3397
- BN4.prototype.pow = function pow(num) {
3395
+ BN3.prototype.pow = function pow(num) {
3398
3396
  var w = toBitArray(num);
3399
- if (w.length === 0) return new BN4(1);
3397
+ if (w.length === 0) return new BN3(1);
3400
3398
  var res = this;
3401
3399
  for (var i = 0; i < w.length; i++, res = res.sqr()) {
3402
3400
  if (w[i] !== 0) break;
@@ -3409,7 +3407,7 @@ var require_bn = __commonJS({
3409
3407
  }
3410
3408
  return res;
3411
3409
  };
3412
- BN4.prototype.iushln = function iushln(bits) {
3410
+ BN3.prototype.iushln = function iushln(bits) {
3413
3411
  assert(typeof bits === "number" && bits >= 0);
3414
3412
  var r = bits % 26;
3415
3413
  var s = (bits - r) / 26;
@@ -3439,11 +3437,11 @@ var require_bn = __commonJS({
3439
3437
  }
3440
3438
  return this._strip();
3441
3439
  };
3442
- BN4.prototype.ishln = function ishln(bits) {
3440
+ BN3.prototype.ishln = function ishln(bits) {
3443
3441
  assert(this.negative === 0);
3444
3442
  return this.iushln(bits);
3445
3443
  };
3446
- BN4.prototype.iushrn = function iushrn(bits, hint, extended) {
3444
+ BN3.prototype.iushrn = function iushrn(bits, hint, extended) {
3447
3445
  assert(typeof bits === "number" && bits >= 0);
3448
3446
  var h;
3449
3447
  if (hint) {
@@ -3487,23 +3485,23 @@ var require_bn = __commonJS({
3487
3485
  }
3488
3486
  return this._strip();
3489
3487
  };
3490
- BN4.prototype.ishrn = function ishrn(bits, hint, extended) {
3488
+ BN3.prototype.ishrn = function ishrn(bits, hint, extended) {
3491
3489
  assert(this.negative === 0);
3492
3490
  return this.iushrn(bits, hint, extended);
3493
3491
  };
3494
- BN4.prototype.shln = function shln(bits) {
3492
+ BN3.prototype.shln = function shln(bits) {
3495
3493
  return this.clone().ishln(bits);
3496
3494
  };
3497
- BN4.prototype.ushln = function ushln(bits) {
3495
+ BN3.prototype.ushln = function ushln(bits) {
3498
3496
  return this.clone().iushln(bits);
3499
3497
  };
3500
- BN4.prototype.shrn = function shrn(bits) {
3498
+ BN3.prototype.shrn = function shrn(bits) {
3501
3499
  return this.clone().ishrn(bits);
3502
3500
  };
3503
- BN4.prototype.ushrn = function ushrn(bits) {
3501
+ BN3.prototype.ushrn = function ushrn(bits) {
3504
3502
  return this.clone().iushrn(bits);
3505
3503
  };
3506
- BN4.prototype.testn = function testn(bit) {
3504
+ BN3.prototype.testn = function testn(bit) {
3507
3505
  assert(typeof bit === "number" && bit >= 0);
3508
3506
  var r = bit % 26;
3509
3507
  var s = (bit - r) / 26;
@@ -3512,7 +3510,7 @@ var require_bn = __commonJS({
3512
3510
  var w = this.words[s];
3513
3511
  return !!(w & q);
3514
3512
  };
3515
- BN4.prototype.imaskn = function imaskn(bits) {
3513
+ BN3.prototype.imaskn = function imaskn(bits) {
3516
3514
  assert(typeof bits === "number" && bits >= 0);
3517
3515
  var r = bits % 26;
3518
3516
  var s = (bits - r) / 26;
@@ -3530,10 +3528,10 @@ var require_bn = __commonJS({
3530
3528
  }
3531
3529
  return this._strip();
3532
3530
  };
3533
- BN4.prototype.maskn = function maskn(bits) {
3531
+ BN3.prototype.maskn = function maskn(bits) {
3534
3532
  return this.clone().imaskn(bits);
3535
3533
  };
3536
- BN4.prototype.iaddn = function iaddn(num) {
3534
+ BN3.prototype.iaddn = function iaddn(num) {
3537
3535
  assert(typeof num === "number");
3538
3536
  assert(num < 67108864);
3539
3537
  if (num < 0) return this.isubn(-num);
@@ -3550,7 +3548,7 @@ var require_bn = __commonJS({
3550
3548
  }
3551
3549
  return this._iaddn(num);
3552
3550
  };
3553
- BN4.prototype._iaddn = function _iaddn(num) {
3551
+ BN3.prototype._iaddn = function _iaddn(num) {
3554
3552
  this.words[0] += num;
3555
3553
  for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) {
3556
3554
  this.words[i] -= 67108864;
@@ -3563,7 +3561,7 @@ var require_bn = __commonJS({
3563
3561
  this.length = Math.max(this.length, i + 1);
3564
3562
  return this;
3565
3563
  };
3566
- BN4.prototype.isubn = function isubn(num) {
3564
+ BN3.prototype.isubn = function isubn(num) {
3567
3565
  assert(typeof num === "number");
3568
3566
  assert(num < 67108864);
3569
3567
  if (num < 0) return this.iaddn(-num);
@@ -3585,20 +3583,20 @@ var require_bn = __commonJS({
3585
3583
  }
3586
3584
  return this._strip();
3587
3585
  };
3588
- BN4.prototype.addn = function addn(num) {
3586
+ BN3.prototype.addn = function addn(num) {
3589
3587
  return this.clone().iaddn(num);
3590
3588
  };
3591
- BN4.prototype.subn = function subn(num) {
3589
+ BN3.prototype.subn = function subn(num) {
3592
3590
  return this.clone().isubn(num);
3593
3591
  };
3594
- BN4.prototype.iabs = function iabs() {
3592
+ BN3.prototype.iabs = function iabs() {
3595
3593
  this.negative = 0;
3596
3594
  return this;
3597
3595
  };
3598
- BN4.prototype.abs = function abs() {
3596
+ BN3.prototype.abs = function abs() {
3599
3597
  return this.clone().iabs();
3600
3598
  };
3601
- BN4.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {
3599
+ BN3.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {
3602
3600
  var len = num.length + shift;
3603
3601
  var i;
3604
3602
  this._expand(len);
@@ -3627,7 +3625,7 @@ var require_bn = __commonJS({
3627
3625
  this.negative = 1;
3628
3626
  return this._strip();
3629
3627
  };
3630
- BN4.prototype._wordDiv = function _wordDiv(num, mode) {
3628
+ BN3.prototype._wordDiv = function _wordDiv(num, mode) {
3631
3629
  var shift = this.length - num.length;
3632
3630
  var a = this.clone();
3633
3631
  var b = num;
@@ -3642,7 +3640,7 @@ var require_bn = __commonJS({
3642
3640
  var m = a.length - b.length;
3643
3641
  var q;
3644
3642
  if (mode !== "mod") {
3645
- q = new BN4(null);
3643
+ q = new BN3(null);
3646
3644
  q.length = m + 1;
3647
3645
  q.words = new Array(q.length);
3648
3646
  for (var i = 0; i < q.length; i++) {
@@ -3684,12 +3682,12 @@ var require_bn = __commonJS({
3684
3682
  mod: a
3685
3683
  };
3686
3684
  };
3687
- BN4.prototype.divmod = function divmod(num, mode, positive) {
3685
+ BN3.prototype.divmod = function divmod(num, mode, positive) {
3688
3686
  assert(!num.isZero());
3689
3687
  if (this.isZero()) {
3690
3688
  return {
3691
- div: new BN4(0),
3692
- mod: new BN4(0)
3689
+ div: new BN3(0),
3690
+ mod: new BN3(0)
3693
3691
  };
3694
3692
  }
3695
3693
  var div, mod, res;
@@ -3734,7 +3732,7 @@ var require_bn = __commonJS({
3734
3732
  }
3735
3733
  if (num.length > this.length || this.cmp(num) < 0) {
3736
3734
  return {
3737
- div: new BN4(0),
3735
+ div: new BN3(0),
3738
3736
  mod: this
3739
3737
  };
3740
3738
  }
@@ -3748,26 +3746,26 @@ var require_bn = __commonJS({
3748
3746
  if (mode === "mod") {
3749
3747
  return {
3750
3748
  div: null,
3751
- mod: new BN4(this.modrn(num.words[0]))
3749
+ mod: new BN3(this.modrn(num.words[0]))
3752
3750
  };
3753
3751
  }
3754
3752
  return {
3755
3753
  div: this.divn(num.words[0]),
3756
- mod: new BN4(this.modrn(num.words[0]))
3754
+ mod: new BN3(this.modrn(num.words[0]))
3757
3755
  };
3758
3756
  }
3759
3757
  return this._wordDiv(num, mode);
3760
3758
  };
3761
- BN4.prototype.div = function div(num) {
3759
+ BN3.prototype.div = function div(num) {
3762
3760
  return this.divmod(num, "div", false).div;
3763
3761
  };
3764
- BN4.prototype.mod = function mod(num) {
3762
+ BN3.prototype.mod = function mod(num) {
3765
3763
  return this.divmod(num, "mod", false).mod;
3766
3764
  };
3767
- BN4.prototype.umod = function umod(num) {
3765
+ BN3.prototype.umod = function umod(num) {
3768
3766
  return this.divmod(num, "mod", true).mod;
3769
3767
  };
3770
- BN4.prototype.divRound = function divRound(num) {
3768
+ BN3.prototype.divRound = function divRound(num) {
3771
3769
  var dm = this.divmod(num);
3772
3770
  if (dm.mod.isZero()) return dm.div;
3773
3771
  var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
@@ -3777,7 +3775,7 @@ var require_bn = __commonJS({
3777
3775
  if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
3778
3776
  return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
3779
3777
  };
3780
- BN4.prototype.modrn = function modrn(num) {
3778
+ BN3.prototype.modrn = function modrn(num) {
3781
3779
  var isNegNum = num < 0;
3782
3780
  if (isNegNum) num = -num;
3783
3781
  assert(num <= 67108863);
@@ -3788,10 +3786,10 @@ var require_bn = __commonJS({
3788
3786
  }
3789
3787
  return isNegNum ? -acc : acc;
3790
3788
  };
3791
- BN4.prototype.modn = function modn(num) {
3789
+ BN3.prototype.modn = function modn(num) {
3792
3790
  return this.modrn(num);
3793
3791
  };
3794
- BN4.prototype.idivn = function idivn(num) {
3792
+ BN3.prototype.idivn = function idivn(num) {
3795
3793
  var isNegNum = num < 0;
3796
3794
  if (isNegNum) num = -num;
3797
3795
  assert(num <= 67108863);
@@ -3804,10 +3802,10 @@ var require_bn = __commonJS({
3804
3802
  this._strip();
3805
3803
  return isNegNum ? this.ineg() : this;
3806
3804
  };
3807
- BN4.prototype.divn = function divn(num) {
3805
+ BN3.prototype.divn = function divn(num) {
3808
3806
  return this.clone().idivn(num);
3809
3807
  };
3810
- BN4.prototype.egcd = function egcd(p) {
3808
+ BN3.prototype.egcd = function egcd(p) {
3811
3809
  assert(p.negative === 0);
3812
3810
  assert(!p.isZero());
3813
3811
  var x = this;
@@ -3817,10 +3815,10 @@ var require_bn = __commonJS({
3817
3815
  } else {
3818
3816
  x = x.clone();
3819
3817
  }
3820
- var A = new BN4(1);
3821
- var B = new BN4(0);
3822
- var C = new BN4(0);
3823
- var D = new BN4(1);
3818
+ var A = new BN3(1);
3819
+ var B = new BN3(0);
3820
+ var C = new BN3(0);
3821
+ var D = new BN3(1);
3824
3822
  var g = 0;
3825
3823
  while (x.isEven() && y.isEven()) {
3826
3824
  x.iushrn(1);
@@ -3870,7 +3868,7 @@ var require_bn = __commonJS({
3870
3868
  gcd: y.iushln(g)
3871
3869
  };
3872
3870
  };
3873
- BN4.prototype._invmp = function _invmp(p) {
3871
+ BN3.prototype._invmp = function _invmp(p) {
3874
3872
  assert(p.negative === 0);
3875
3873
  assert(!p.isZero());
3876
3874
  var a = this;
@@ -3880,8 +3878,8 @@ var require_bn = __commonJS({
3880
3878
  } else {
3881
3879
  a = a.clone();
3882
3880
  }
3883
- var x1 = new BN4(1);
3884
- var x2 = new BN4(0);
3881
+ var x1 = new BN3(1);
3882
+ var x2 = new BN3(0);
3885
3883
  var delta = b.clone();
3886
3884
  while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
3887
3885
  for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ;
@@ -3923,7 +3921,7 @@ var require_bn = __commonJS({
3923
3921
  }
3924
3922
  return res;
3925
3923
  };
3926
- BN4.prototype.gcd = function gcd(num) {
3924
+ BN3.prototype.gcd = function gcd(num) {
3927
3925
  if (this.isZero()) return num.abs();
3928
3926
  if (num.isZero()) return this.abs();
3929
3927
  var a = this.clone();
@@ -3953,19 +3951,19 @@ var require_bn = __commonJS({
3953
3951
  } while (true);
3954
3952
  return b.iushln(shift);
3955
3953
  };
3956
- BN4.prototype.invm = function invm(num) {
3954
+ BN3.prototype.invm = function invm(num) {
3957
3955
  return this.egcd(num).a.umod(num);
3958
3956
  };
3959
- BN4.prototype.isEven = function isEven() {
3957
+ BN3.prototype.isEven = function isEven() {
3960
3958
  return (this.words[0] & 1) === 0;
3961
3959
  };
3962
- BN4.prototype.isOdd = function isOdd() {
3960
+ BN3.prototype.isOdd = function isOdd() {
3963
3961
  return (this.words[0] & 1) === 1;
3964
3962
  };
3965
- BN4.prototype.andln = function andln(num) {
3963
+ BN3.prototype.andln = function andln(num) {
3966
3964
  return this.words[0] & num;
3967
3965
  };
3968
- BN4.prototype.bincn = function bincn(bit) {
3966
+ BN3.prototype.bincn = function bincn(bit) {
3969
3967
  assert(typeof bit === "number");
3970
3968
  var r = bit % 26;
3971
3969
  var s = (bit - r) / 26;
@@ -3989,10 +3987,10 @@ var require_bn = __commonJS({
3989
3987
  }
3990
3988
  return this;
3991
3989
  };
3992
- BN4.prototype.isZero = function isZero() {
3990
+ BN3.prototype.isZero = function isZero() {
3993
3991
  return this.length === 1 && this.words[0] === 0;
3994
3992
  };
3995
- BN4.prototype.cmpn = function cmpn(num) {
3993
+ BN3.prototype.cmpn = function cmpn(num) {
3996
3994
  var negative = num < 0;
3997
3995
  if (this.negative !== 0 && !negative) return -1;
3998
3996
  if (this.negative === 0 && negative) return 1;
@@ -4011,14 +4009,14 @@ var require_bn = __commonJS({
4011
4009
  if (this.negative !== 0) return -res | 0;
4012
4010
  return res;
4013
4011
  };
4014
- BN4.prototype.cmp = function cmp(num) {
4012
+ BN3.prototype.cmp = function cmp(num) {
4015
4013
  if (this.negative !== 0 && num.negative === 0) return -1;
4016
4014
  if (this.negative === 0 && num.negative !== 0) return 1;
4017
4015
  var res = this.ucmp(num);
4018
4016
  if (this.negative !== 0) return -res | 0;
4019
4017
  return res;
4020
4018
  };
4021
- BN4.prototype.ucmp = function ucmp(num) {
4019
+ BN3.prototype.ucmp = function ucmp(num) {
4022
4020
  if (this.length > num.length) return 1;
4023
4021
  if (this.length < num.length) return -1;
4024
4022
  var res = 0;
@@ -4035,112 +4033,112 @@ var require_bn = __commonJS({
4035
4033
  }
4036
4034
  return res;
4037
4035
  };
4038
- BN4.prototype.gtn = function gtn(num) {
4036
+ BN3.prototype.gtn = function gtn(num) {
4039
4037
  return this.cmpn(num) === 1;
4040
4038
  };
4041
- BN4.prototype.gt = function gt(num) {
4039
+ BN3.prototype.gt = function gt(num) {
4042
4040
  return this.cmp(num) === 1;
4043
4041
  };
4044
- BN4.prototype.gten = function gten(num) {
4042
+ BN3.prototype.gten = function gten(num) {
4045
4043
  return this.cmpn(num) >= 0;
4046
4044
  };
4047
- BN4.prototype.gte = function gte(num) {
4045
+ BN3.prototype.gte = function gte(num) {
4048
4046
  return this.cmp(num) >= 0;
4049
4047
  };
4050
- BN4.prototype.ltn = function ltn(num) {
4048
+ BN3.prototype.ltn = function ltn(num) {
4051
4049
  return this.cmpn(num) === -1;
4052
4050
  };
4053
- BN4.prototype.lt = function lt(num) {
4051
+ BN3.prototype.lt = function lt(num) {
4054
4052
  return this.cmp(num) === -1;
4055
4053
  };
4056
- BN4.prototype.lten = function lten(num) {
4054
+ BN3.prototype.lten = function lten(num) {
4057
4055
  return this.cmpn(num) <= 0;
4058
4056
  };
4059
- BN4.prototype.lte = function lte(num) {
4057
+ BN3.prototype.lte = function lte(num) {
4060
4058
  return this.cmp(num) <= 0;
4061
4059
  };
4062
- BN4.prototype.eqn = function eqn(num) {
4060
+ BN3.prototype.eqn = function eqn(num) {
4063
4061
  return this.cmpn(num) === 0;
4064
4062
  };
4065
- BN4.prototype.eq = function eq(num) {
4063
+ BN3.prototype.eq = function eq(num) {
4066
4064
  return this.cmp(num) === 0;
4067
4065
  };
4068
- BN4.red = function red(num) {
4066
+ BN3.red = function red(num) {
4069
4067
  return new Red(num);
4070
4068
  };
4071
- BN4.prototype.toRed = function toRed(ctx) {
4069
+ BN3.prototype.toRed = function toRed(ctx) {
4072
4070
  assert(!this.red, "Already a number in reduction context");
4073
4071
  assert(this.negative === 0, "red works only with positives");
4074
4072
  return ctx.convertTo(this)._forceRed(ctx);
4075
4073
  };
4076
- BN4.prototype.fromRed = function fromRed() {
4074
+ BN3.prototype.fromRed = function fromRed() {
4077
4075
  assert(this.red, "fromRed works only with numbers in reduction context");
4078
4076
  return this.red.convertFrom(this);
4079
4077
  };
4080
- BN4.prototype._forceRed = function _forceRed(ctx) {
4078
+ BN3.prototype._forceRed = function _forceRed(ctx) {
4081
4079
  this.red = ctx;
4082
4080
  return this;
4083
4081
  };
4084
- BN4.prototype.forceRed = function forceRed(ctx) {
4082
+ BN3.prototype.forceRed = function forceRed(ctx) {
4085
4083
  assert(!this.red, "Already a number in reduction context");
4086
4084
  return this._forceRed(ctx);
4087
4085
  };
4088
- BN4.prototype.redAdd = function redAdd(num) {
4086
+ BN3.prototype.redAdd = function redAdd(num) {
4089
4087
  assert(this.red, "redAdd works only with red numbers");
4090
4088
  return this.red.add(this, num);
4091
4089
  };
4092
- BN4.prototype.redIAdd = function redIAdd(num) {
4090
+ BN3.prototype.redIAdd = function redIAdd(num) {
4093
4091
  assert(this.red, "redIAdd works only with red numbers");
4094
4092
  return this.red.iadd(this, num);
4095
4093
  };
4096
- BN4.prototype.redSub = function redSub(num) {
4094
+ BN3.prototype.redSub = function redSub(num) {
4097
4095
  assert(this.red, "redSub works only with red numbers");
4098
4096
  return this.red.sub(this, num);
4099
4097
  };
4100
- BN4.prototype.redISub = function redISub(num) {
4098
+ BN3.prototype.redISub = function redISub(num) {
4101
4099
  assert(this.red, "redISub works only with red numbers");
4102
4100
  return this.red.isub(this, num);
4103
4101
  };
4104
- BN4.prototype.redShl = function redShl(num) {
4102
+ BN3.prototype.redShl = function redShl(num) {
4105
4103
  assert(this.red, "redShl works only with red numbers");
4106
4104
  return this.red.shl(this, num);
4107
4105
  };
4108
- BN4.prototype.redMul = function redMul(num) {
4106
+ BN3.prototype.redMul = function redMul(num) {
4109
4107
  assert(this.red, "redMul works only with red numbers");
4110
4108
  this.red._verify2(this, num);
4111
4109
  return this.red.mul(this, num);
4112
4110
  };
4113
- BN4.prototype.redIMul = function redIMul(num) {
4111
+ BN3.prototype.redIMul = function redIMul(num) {
4114
4112
  assert(this.red, "redMul works only with red numbers");
4115
4113
  this.red._verify2(this, num);
4116
4114
  return this.red.imul(this, num);
4117
4115
  };
4118
- BN4.prototype.redSqr = function redSqr() {
4116
+ BN3.prototype.redSqr = function redSqr() {
4119
4117
  assert(this.red, "redSqr works only with red numbers");
4120
4118
  this.red._verify1(this);
4121
4119
  return this.red.sqr(this);
4122
4120
  };
4123
- BN4.prototype.redISqr = function redISqr() {
4121
+ BN3.prototype.redISqr = function redISqr() {
4124
4122
  assert(this.red, "redISqr works only with red numbers");
4125
4123
  this.red._verify1(this);
4126
4124
  return this.red.isqr(this);
4127
4125
  };
4128
- BN4.prototype.redSqrt = function redSqrt() {
4126
+ BN3.prototype.redSqrt = function redSqrt() {
4129
4127
  assert(this.red, "redSqrt works only with red numbers");
4130
4128
  this.red._verify1(this);
4131
4129
  return this.red.sqrt(this);
4132
4130
  };
4133
- BN4.prototype.redInvm = function redInvm() {
4131
+ BN3.prototype.redInvm = function redInvm() {
4134
4132
  assert(this.red, "redInvm works only with red numbers");
4135
4133
  this.red._verify1(this);
4136
4134
  return this.red.invm(this);
4137
4135
  };
4138
- BN4.prototype.redNeg = function redNeg() {
4136
+ BN3.prototype.redNeg = function redNeg() {
4139
4137
  assert(this.red, "redNeg works only with red numbers");
4140
4138
  this.red._verify1(this);
4141
4139
  return this.red.neg(this);
4142
4140
  };
4143
- BN4.prototype.redPow = function redPow(num) {
4141
+ BN3.prototype.redPow = function redPow(num) {
4144
4142
  assert(this.red && !num.red, "redPow(normalNum)");
4145
4143
  this.red._verify1(this);
4146
4144
  return this.red.pow(this, num);
@@ -4153,13 +4151,13 @@ var require_bn = __commonJS({
4153
4151
  };
4154
4152
  function MPrime(name, p) {
4155
4153
  this.name = name;
4156
- this.p = new BN4(p, 16);
4154
+ this.p = new BN3(p, 16);
4157
4155
  this.n = this.p.bitLength();
4158
- this.k = new BN4(1).iushln(this.n).isub(this.p);
4156
+ this.k = new BN3(1).iushln(this.n).isub(this.p);
4159
4157
  this.tmp = this._tmp();
4160
4158
  }
4161
4159
  MPrime.prototype._tmp = function _tmp() {
4162
- var tmp = new BN4(null);
4160
+ var tmp = new BN3(null);
4163
4161
  tmp.words = new Array(Math.ceil(this.n / 13));
4164
4162
  return tmp;
4165
4163
  };
@@ -4285,7 +4283,7 @@ var require_bn = __commonJS({
4285
4283
  }
4286
4284
  return num;
4287
4285
  };
4288
- BN4._prime = function prime(name) {
4286
+ BN3._prime = function prime(name) {
4289
4287
  if (primes[name]) return primes[name];
4290
4288
  var prime2;
4291
4289
  if (name === "k256") {
@@ -4304,7 +4302,7 @@ var require_bn = __commonJS({
4304
4302
  };
4305
4303
  function Red(m) {
4306
4304
  if (typeof m === "string") {
4307
- var prime = BN4._prime(m);
4305
+ var prime = BN3._prime(m);
4308
4306
  this.m = prime.p;
4309
4307
  this.prime = prime;
4310
4308
  } else {
@@ -4390,7 +4388,7 @@ var require_bn = __commonJS({
4390
4388
  var mod3 = this.m.andln(3);
4391
4389
  assert(mod3 % 2 === 1);
4392
4390
  if (mod3 === 3) {
4393
- var pow = this.m.add(new BN4(1)).iushrn(2);
4391
+ var pow = this.m.add(new BN3(1)).iushrn(2);
4394
4392
  return this.pow(a, pow);
4395
4393
  }
4396
4394
  var q = this.m.subn(1);
@@ -4400,11 +4398,11 @@ var require_bn = __commonJS({
4400
4398
  q.iushrn(1);
4401
4399
  }
4402
4400
  assert(!q.isZero());
4403
- var one = new BN4(1).toRed(this);
4401
+ var one = new BN3(1).toRed(this);
4404
4402
  var nOne = one.redNeg();
4405
4403
  var lpow = this.m.subn(1).iushrn(1);
4406
4404
  var z = this.m.bitLength();
4407
- z = new BN4(2 * z * z).toRed(this);
4405
+ z = new BN3(2 * z * z).toRed(this);
4408
4406
  while (this.pow(z, lpow).cmp(nOne) !== 0) {
4409
4407
  z.redIAdd(nOne);
4410
4408
  }
@@ -4418,7 +4416,7 @@ var require_bn = __commonJS({
4418
4416
  tmp = tmp.redSqr();
4419
4417
  }
4420
4418
  assert(i < m);
4421
- var b = this.pow(c, new BN4(1).iushln(m - i - 1));
4419
+ var b = this.pow(c, new BN3(1).iushln(m - i - 1));
4422
4420
  r = r.redMul(b);
4423
4421
  c = b.redSqr();
4424
4422
  t = t.redMul(c);
@@ -4436,11 +4434,11 @@ var require_bn = __commonJS({
4436
4434
  }
4437
4435
  };
4438
4436
  Red.prototype.pow = function pow(a, num) {
4439
- if (num.isZero()) return new BN4(1).toRed(this);
4437
+ if (num.isZero()) return new BN3(1).toRed(this);
4440
4438
  if (num.cmpn(1) === 0) return a.clone();
4441
4439
  var windowSize = 4;
4442
4440
  var wnd = new Array(1 << windowSize);
4443
- wnd[0] = new BN4(1).toRed(this);
4441
+ wnd[0] = new BN3(1).toRed(this);
4444
4442
  wnd[1] = a;
4445
4443
  for (var i = 2; i < wnd.length; i++) {
4446
4444
  wnd[i] = this.mul(wnd[i - 1], a);
@@ -4484,7 +4482,7 @@ var require_bn = __commonJS({
4484
4482
  res.red = null;
4485
4483
  return res;
4486
4484
  };
4487
- BN4.mont = function mont(num) {
4485
+ BN3.mont = function mont(num) {
4488
4486
  return new Mont(num);
4489
4487
  };
4490
4488
  function Mont(m) {
@@ -4493,7 +4491,7 @@ var require_bn = __commonJS({
4493
4491
  if (this.shift % 26 !== 0) {
4494
4492
  this.shift += 26 - this.shift % 26;
4495
4493
  }
4496
- this.r = new BN4(1).iushln(this.shift);
4494
+ this.r = new BN3(1).iushln(this.shift);
4497
4495
  this.r2 = this.imod(this.r.sqr());
4498
4496
  this.rinv = this.r._invmp(this.m);
4499
4497
  this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
@@ -4527,7 +4525,7 @@ var require_bn = __commonJS({
4527
4525
  return res._forceRed(this);
4528
4526
  };
4529
4527
  Mont.prototype.mul = function mul(a, b) {
4530
- if (a.isZero() || b.isZero()) return new BN4(0)._forceRed(this);
4528
+ if (a.isZero() || b.isZero()) return new BN3(0)._forceRed(this);
4531
4529
  var t = a.mul(b);
4532
4530
  var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
4533
4531
  var u = t.isub(c).iushrn(this.shift);
@@ -4548,7 +4546,7 @@ var require_bn = __commonJS({
4548
4546
  });
4549
4547
 
4550
4548
  // src/client.ts
4551
- var import_bn2 = __toESM(require_bn());
4549
+ var import_bn = __toESM(require_bn());
4552
4550
  var JPOOL_STAKE_POOL = new PublicKey("CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8cyGpLTo2LJzG1");
4553
4551
  var Seeds = /* @__PURE__ */ ((Seeds2) => {
4554
4552
  Seeds2["GlobalState"] = "global_state";
@@ -4587,7 +4585,7 @@ var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
4587
4585
  return SessionStatus2;
4588
4586
  })(SessionStatus || {});
4589
4587
 
4590
- // src/utils/enum-utils.ts
4588
+ // src/utils/enum.ts
4591
4589
  function getVariant(v) {
4592
4590
  const key = Object.keys(v)[0];
4593
4591
  return [key, v[key]];
@@ -4650,8 +4648,6 @@ var NodeWallet = class {
4650
4648
  return this.payer.publicKey;
4651
4649
  }
4652
4650
  };
4653
-
4654
- // src/utils/index.ts
4655
4651
  var SLOTS_PER_EPOCH_MAINNET = 432e3;
4656
4652
  var SLOTS_PER_EPOCH_DEVNET = 4e5;
4657
4653
  function slotToEpoch(slot, cluster) {
@@ -4762,12 +4758,18 @@ var HistoryManager = class {
4762
4758
  }
4763
4759
  decodeInstructionData(data) {
4764
4760
  if (!data) {
4765
- return { type: null, amount: 0 };
4761
+ return {
4762
+ type: null,
4763
+ amount: 0
4764
+ };
4766
4765
  }
4767
4766
  try {
4768
- const buf = bs58$1.decode(data);
4767
+ const buf = bs58.decode(data);
4769
4768
  if (buf.length < 16) {
4770
- return { type: null, amount: 0 };
4769
+ return {
4770
+ type: null,
4771
+ amount: 0
4772
+ };
4771
4773
  }
4772
4774
  const disc = buf.slice(0, 8);
4773
4775
  const amountBytes = buf.slice(8, 16);
@@ -5506,9 +5508,6 @@ var jbond_default = {
5506
5508
  },
5507
5509
  {
5508
5510
  name: "global_initialize",
5509
- docs: [
5510
- "----------------------------- Global Instructions ----------------------------"
5511
- ],
5512
5511
  discriminator: [
5513
5512
  30,
5514
5513
  79,
@@ -6386,57 +6385,8 @@ var jbond_default = {
6386
6385
  ]
6387
6386
  };
6388
6387
 
6389
- // src/utils/stake-pool.ts
6390
- var import_bn = __toESM(require_bn());
6391
- function createStakePoolManager(stakePoolAccount, user) {
6392
- if (!stakePoolAccount || !stakePoolAccount.account || !stakePoolAccount.account.data) {
6393
- throw new Error("Invalid stake pool account structure");
6394
- }
6395
- const stakePool = stakePoolAccount.account.data;
6396
- const userPoolTokenAccount = getAssociatedTokenAddressSync(stakePool.poolMint, user, true);
6397
- const [withdrawAuthority] = PublicKey.findProgramAddressSync(
6398
- [stakePoolAccount.pubkey.toBuffer(), Buffer.from("withdraw")],
6399
- STAKE_POOL_PROGRAM_ID
6400
- );
6401
- return {
6402
- stakePoolAddress: stakePoolAccount.pubkey,
6403
- depositSol: (lamports) => StakePoolInstruction.depositSol({
6404
- stakePool: stakePoolAccount.pubkey,
6405
- reserveStake: stakePool.reserveStake,
6406
- fundingAccount: user,
6407
- destinationPoolAccount: userPoolTokenAccount,
6408
- managerFeeAccount: stakePool.managerFeeAccount,
6409
- referralPoolAccount: userPoolTokenAccount,
6410
- poolMint: stakePool.poolMint,
6411
- lamports: lamports.toNumber(),
6412
- withdrawAuthority
6413
- }),
6414
- withdrawSol: (poolTokens) => StakePoolInstruction.withdrawSol({
6415
- stakePool: stakePoolAccount.pubkey,
6416
- withdrawAuthority,
6417
- reserveStake: stakePool.reserveStake,
6418
- sourcePoolAccount: userPoolTokenAccount,
6419
- sourceTransferAuthority: user,
6420
- destinationSystemAccount: user,
6421
- managerFeeAccount: stakePool.managerFeeAccount,
6422
- poolMint: stakePool.poolMint,
6423
- poolTokens: poolTokens.toNumber()
6424
- }),
6425
- get exchangeRate() {
6426
- const poolTokenSupply = new import_bn.default(stakePool.poolTokenSupply);
6427
- const totalLamports = new import_bn.default(stakePool.totalLamports);
6428
- if (poolTokenSupply.isZero()) {
6429
- return 0;
6430
- }
6431
- return totalLamports.toNumber() / poolTokenSupply.toNumber();
6432
- },
6433
- get withdrawSolFee() {
6434
- return stakePool.solWithdrawalFee;
6435
- }
6436
- };
6437
- }
6438
-
6439
6388
  // src/client.ts
6389
+ var { bs58: bs582 } = utils.bytes;
6440
6390
  var BondClientEnv = /* @__PURE__ */ ((BondClientEnv2) => {
6441
6391
  BondClientEnv2["DEV"] = "dev";
6442
6392
  BondClientEnv2["STAGE"] = "stage";
@@ -6867,7 +6817,7 @@ var JBondClient = class _JBondClient {
6867
6817
  }
6868
6818
  async buildBondStartIx(props) {
6869
6819
  const [bondState] = this.pda.bondState(props.bondType, props.name);
6870
- return this.program.methods.sessionStart(new import_bn2.BN(props.duration_secs)).accountsPartial({
6820
+ return this.program.methods.sessionStart(new import_bn.BN(props.duration_secs)).accountsPartial({
6871
6821
  bondState,
6872
6822
  authority: this.program.provider.wallet?.publicKey
6873
6823
  }).instruction();
@@ -7071,10 +7021,6 @@ var JBondClient = class _JBondClient {
7071
7021
  this.programId
7072
7022
  );
7073
7023
  const validatorBond = this.pda.validatorBond(bondType, bondName, vote);
7074
- console.log("Derived legacy validator bond account:", legacyValidatorBondAccount.toBase58());
7075
- console.log("Derived new validator bond account:", validatorBond[0].toBase58());
7076
- console.log("Fetching history for legacy validator bond account:", legacyValidatorBondAccount.toBase58());
7077
- console.log("Fetching history for new validator bond account:", validatorBond[0].toBase58());
7078
7024
  const legacySignatures = (await this.connection.getSignaturesForAddress(
7079
7025
  legacyValidatorBondAccount,
7080
7026
  {
@@ -7132,7 +7078,7 @@ var JBondClient = class _JBondClient {
7132
7078
  let type = null;
7133
7079
  let amount = 0;
7134
7080
  try {
7135
- const dataBuffer = bs58.decode(data);
7081
+ const dataBuffer = bs582.decode(data);
7136
7082
  if (dataBuffer.length >= 8) {
7137
7083
  const discriminator = dataBuffer.subarray(0, 8);
7138
7084
  const legacyRegisterDiscriminator = this.getInstructionDiscriminator("register");
@@ -7148,14 +7094,12 @@ var JBondClient = class _JBondClient {
7148
7094
  type = "deposit" /* Deposit */;
7149
7095
  if (dataBuffer.length >= 16 && Buffer.from(discriminator).equals(Buffer.from(legacyRegisterDiscriminator))) {
7150
7096
  const amountBytes = dataBuffer.subarray(8, 16);
7151
- const amountBN = new import_bn2.BN(amountBytes, "le");
7097
+ const amountBN = new import_bn.BN(amountBytes, "le");
7152
7098
  amount = amountBN.toNumber() / LAMPORTS_PER_SOL;
7153
- } else {
7154
- amount = 0;
7155
7099
  }
7156
7100
  } else if (dataBuffer.length >= 16) {
7157
7101
  const amountBytes = dataBuffer.subarray(8, 16);
7158
- const amountBN = new import_bn2.BN(amountBytes, "le");
7102
+ const amountBN = new import_bn.BN(amountBytes, "le");
7159
7103
  amount = amountBN.toNumber() / LAMPORTS_PER_SOL;
7160
7104
  if (Buffer.from(discriminator).equals(Buffer.from(legacyTopUpDiscriminator)) || Buffer.from(discriminator).equals(Buffer.from(bondTopUpDiscriminator))) {
7161
7105
  type = "deposit" /* Deposit */;
@@ -7256,35 +7200,8 @@ var JBondClient = class _JBondClient {
7256
7200
  status: this.getBondStateSessionStatus(state)
7257
7201
  };
7258
7202
  }
7259
- /**
7260
- * Load stake pool account and cache it if not already cached
7261
- * @private
7262
- */
7263
- async loadStakePoolAccount() {
7264
- return await getStakePoolAccount(this.provider.connection, JPOOL_STAKE_POOL);
7265
- }
7266
- /**
7267
- * Manages the interaction with a stake pool, allowing deposits and withdrawals of SOL.
7268
- */
7269
- async stakePoolManager(props) {
7270
- const user = this.ensureUser(props);
7271
- const stakePoolAccount = await this.loadStakePoolAccount();
7272
- return createStakePoolManager(stakePoolAccount, user);
7273
- }
7274
- /**
7275
- * Ensures that a valid user is provided. If a user is not explicitly passed
7276
- * in the properties, it defaults to the provider's public key.
7277
- * Throws an error if no user is available.
7278
- */
7279
- ensureUser(props) {
7280
- const user = props?.user ?? this.provider.publicKey;
7281
- if (!user) {
7282
- throw new Error("User public key is required but not provided");
7283
- }
7284
- return user;
7285
- }
7286
7203
  lamports(n) {
7287
- return new import_bn2.BN((n ?? 0) * LAMPORTS_PER_SOL);
7204
+ return new import_bn.BN((n ?? 0) * LAMPORTS_PER_SOL);
7288
7205
  }
7289
7206
  };
7290
7207
  /*! Bundled license information: