@solana/web3.js 1.87.7 → 1.88.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/lib/index.iife.js CHANGED
@@ -2381,30 +2381,30 @@ var solanaWeb3 = (function (exports) {
2381
2381
  }
2382
2382
  } (buffer));
2383
2383
 
2384
- function number$2(n) {
2384
+ function number$1(n) {
2385
2385
  if (!Number.isSafeInteger(n) || n < 0)
2386
2386
  throw new Error(`Wrong positive integer: ${n}`);
2387
2387
  }
2388
- function bytes$1(b, ...lengths) {
2388
+ function bytes(b, ...lengths) {
2389
2389
  if (!(b instanceof Uint8Array))
2390
2390
  throw new Error('Expected Uint8Array');
2391
2391
  if (lengths.length > 0 && !lengths.includes(b.length))
2392
2392
  throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
2393
2393
  }
2394
- function hash$1(hash) {
2394
+ function hash(hash) {
2395
2395
  if (typeof hash !== 'function' || typeof hash.create !== 'function')
2396
2396
  throw new Error('Hash should be wrapped by utils.wrapConstructor');
2397
- number$2(hash.outputLen);
2398
- number$2(hash.blockLen);
2397
+ number$1(hash.outputLen);
2398
+ number$1(hash.blockLen);
2399
2399
  }
2400
- function exists$1(instance, checkFinished = true) {
2400
+ function exists(instance, checkFinished = true) {
2401
2401
  if (instance.destroyed)
2402
2402
  throw new Error('Hash instance has been destroyed');
2403
2403
  if (checkFinished && instance.finished)
2404
2404
  throw new Error('Hash#digest() has already been called');
2405
2405
  }
2406
- function output$1(out, instance) {
2407
- bytes$1(out);
2406
+ function output(out, instance) {
2407
+ bytes(out);
2408
2408
  const min = instance.outputLen;
2409
2409
  if (out.length < min) {
2410
2410
  throw new Error(`digestInto() expects output buffer of length at least ${min}`);
@@ -2420,20 +2420,21 @@ var solanaWeb3 = (function (exports) {
2420
2420
  // from `crypto` to `cryptoNode`, which imports native module.
2421
2421
  // Makes the utils un-importable in browsers without a bundler.
2422
2422
  // Once node.js 18 is deprecated, we can just drop the import.
2423
- const u8a$2 = (a) => a instanceof Uint8Array;
2423
+ const u8a$1 = (a) => a instanceof Uint8Array;
2424
+ const u32$1 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
2424
2425
  // Cast array to view
2425
- const createView$1 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
2426
+ const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
2426
2427
  // The rotate right (circular right shift) operation for uint32
2427
- const rotr$1 = (word, shift) => (word << (32 - shift)) | (word >>> shift);
2428
+ const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
2428
2429
  // big-endian hardware is rare. Just in case someone still decides to run hashes:
2429
2430
  // early-throw an error because we don't support BE yet.
2430
- const isLE$1 = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
2431
- if (!isLE$1)
2431
+ const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
2432
+ if (!isLE)
2432
2433
  throw new Error('Non little-endian hardware is not supported');
2433
2434
  /**
2434
2435
  * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
2435
2436
  */
2436
- function utf8ToBytes$2(str) {
2437
+ function utf8ToBytes$1(str) {
2437
2438
  if (typeof str !== 'string')
2438
2439
  throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
2439
2440
  return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
@@ -2443,10 +2444,10 @@ var solanaWeb3 = (function (exports) {
2443
2444
  * Warning: when Uint8Array is passed, it would NOT get copied.
2444
2445
  * Keep in mind for future mutable operations.
2445
2446
  */
2446
- function toBytes$1(data) {
2447
+ function toBytes(data) {
2447
2448
  if (typeof data === 'string')
2448
- data = utf8ToBytes$2(data);
2449
- if (!u8a$2(data))
2449
+ data = utf8ToBytes$1(data);
2450
+ if (!u8a$1(data))
2450
2451
  throw new Error(`expected Uint8Array, got ${typeof data}`);
2451
2452
  return data;
2452
2453
  }
@@ -2457,7 +2458,7 @@ var solanaWeb3 = (function (exports) {
2457
2458
  const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
2458
2459
  let pad = 0; // walk through each item, ensure they have proper type
2459
2460
  arrays.forEach((a) => {
2460
- if (!u8a$2(a))
2461
+ if (!u8a$1(a))
2461
2462
  throw new Error('Uint8Array expected');
2462
2463
  r.set(a, pad);
2463
2464
  pad += a.length;
@@ -2465,14 +2466,14 @@ var solanaWeb3 = (function (exports) {
2465
2466
  return r;
2466
2467
  }
2467
2468
  // For runtime check if class implements interface
2468
- let Hash$1 = class Hash {
2469
+ class Hash {
2469
2470
  // Safe version that clones internal state
2470
2471
  clone() {
2471
2472
  return this._cloneInto();
2472
2473
  }
2473
- };
2474
- function wrapConstructor$1(hashCons) {
2475
- const hashC = (msg) => hashCons().update(toBytes$1(msg)).digest();
2474
+ }
2475
+ function wrapConstructor(hashCons) {
2476
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
2476
2477
  const tmp = hashCons();
2477
2478
  hashC.outputLen = tmp.outputLen;
2478
2479
  hashC.blockLen = tmp.blockLen;
@@ -2490,7 +2491,7 @@ var solanaWeb3 = (function (exports) {
2490
2491
  }
2491
2492
 
2492
2493
  // Polyfill for Safari 14
2493
- function setBigUint64$1(view, byteOffset, value, isLE) {
2494
+ function setBigUint64(view, byteOffset, value, isLE) {
2494
2495
  if (typeof view.setBigUint64 === 'function')
2495
2496
  return view.setBigUint64(byteOffset, value, isLE);
2496
2497
  const _32n = BigInt(32);
@@ -2503,7 +2504,7 @@ var solanaWeb3 = (function (exports) {
2503
2504
  view.setUint32(byteOffset + l, wl, isLE);
2504
2505
  }
2505
2506
  // Base SHA2 class (RFC 6234)
2506
- let SHA2$1 = class SHA2 extends Hash$1 {
2507
+ class SHA2 extends Hash {
2507
2508
  constructor(blockLen, outputLen, padOffset, isLE) {
2508
2509
  super();
2509
2510
  this.blockLen = blockLen;
@@ -2515,18 +2516,18 @@ var solanaWeb3 = (function (exports) {
2515
2516
  this.pos = 0;
2516
2517
  this.destroyed = false;
2517
2518
  this.buffer = new Uint8Array(blockLen);
2518
- this.view = createView$1(this.buffer);
2519
+ this.view = createView(this.buffer);
2519
2520
  }
2520
2521
  update(data) {
2521
- exists$1(this);
2522
+ exists(this);
2522
2523
  const { view, buffer, blockLen } = this;
2523
- data = toBytes$1(data);
2524
+ data = toBytes(data);
2524
2525
  const len = data.length;
2525
2526
  for (let pos = 0; pos < len;) {
2526
2527
  const take = Math.min(blockLen - this.pos, len - pos);
2527
2528
  // Fast path: we have at least one block in input, cast it to view and process
2528
2529
  if (take === blockLen) {
2529
- const dataView = createView$1(data);
2530
+ const dataView = createView(data);
2530
2531
  for (; blockLen <= len - pos; pos += blockLen)
2531
2532
  this.process(dataView, pos);
2532
2533
  continue;
@@ -2544,8 +2545,8 @@ var solanaWeb3 = (function (exports) {
2544
2545
  return this;
2545
2546
  }
2546
2547
  digestInto(out) {
2547
- exists$1(this);
2548
- output$1(out, this);
2548
+ exists(this);
2549
+ output(out, this);
2549
2550
  this.finished = true;
2550
2551
  // Padding
2551
2552
  // We can avoid allocation of buffer for padding completely if it
@@ -2566,9 +2567,9 @@ var solanaWeb3 = (function (exports) {
2566
2567
  // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
2567
2568
  // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
2568
2569
  // So we just write lowest 64 bits of that value.
2569
- setBigUint64$1(view, blockLen - 8, BigInt(this.length * 8), isLE);
2570
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
2570
2571
  this.process(view, 0);
2571
- const oview = createView$1(out);
2572
+ const oview = createView(out);
2572
2573
  const len = this.outputLen;
2573
2574
  // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
2574
2575
  if (len % 4)
@@ -2599,71 +2600,71 @@ var solanaWeb3 = (function (exports) {
2599
2600
  to.buffer.set(buffer);
2600
2601
  return to;
2601
2602
  }
2602
- };
2603
+ }
2603
2604
 
2604
- const U32_MASK64$1 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
2605
- const _32n$1 = /* @__PURE__ */ BigInt(32);
2605
+ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
2606
+ const _32n = /* @__PURE__ */ BigInt(32);
2606
2607
  // We are not using BigUint64Array, because they are extremely slow as per 2022
2607
- function fromBig$1(n, le = false) {
2608
+ function fromBig(n, le = false) {
2608
2609
  if (le)
2609
- return { h: Number(n & U32_MASK64$1), l: Number((n >> _32n$1) & U32_MASK64$1) };
2610
- return { h: Number((n >> _32n$1) & U32_MASK64$1) | 0, l: Number(n & U32_MASK64$1) | 0 };
2610
+ return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
2611
+ return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
2611
2612
  }
2612
- function split$1(lst, le = false) {
2613
+ function split(lst, le = false) {
2613
2614
  let Ah = new Uint32Array(lst.length);
2614
2615
  let Al = new Uint32Array(lst.length);
2615
2616
  for (let i = 0; i < lst.length; i++) {
2616
- const { h, l } = fromBig$1(lst[i], le);
2617
+ const { h, l } = fromBig(lst[i], le);
2617
2618
  [Ah[i], Al[i]] = [h, l];
2618
2619
  }
2619
2620
  return [Ah, Al];
2620
2621
  }
2621
- const toBig$1 = (h, l) => (BigInt(h >>> 0) << _32n$1) | BigInt(l >>> 0);
2622
+ const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
2622
2623
  // for Shift in [0, 32)
2623
- const shrSH$1 = (h, _l, s) => h >>> s;
2624
- const shrSL$1 = (h, l, s) => (h << (32 - s)) | (l >>> s);
2624
+ const shrSH = (h, _l, s) => h >>> s;
2625
+ const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
2625
2626
  // Right rotate for Shift in [1, 32)
2626
- const rotrSH$1 = (h, l, s) => (h >>> s) | (l << (32 - s));
2627
- const rotrSL$1 = (h, l, s) => (h << (32 - s)) | (l >>> s);
2627
+ const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
2628
+ const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
2628
2629
  // Right rotate for Shift in (32, 64), NOTE: 32 is special case.
2629
- const rotrBH$1 = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
2630
- const rotrBL$1 = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
2630
+ const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
2631
+ const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
2631
2632
  // Right rotate for shift===32 (just swaps l&h)
2632
- const rotr32H$1 = (_h, l) => l;
2633
- const rotr32L$1 = (h, _l) => h;
2633
+ const rotr32H = (_h, l) => l;
2634
+ const rotr32L = (h, _l) => h;
2634
2635
  // Left rotate for Shift in [1, 32)
2635
- const rotlSH$1 = (h, l, s) => (h << s) | (l >>> (32 - s));
2636
- const rotlSL$1 = (h, l, s) => (l << s) | (h >>> (32 - s));
2636
+ const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
2637
+ const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
2637
2638
  // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
2638
- const rotlBH$1 = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
2639
- const rotlBL$1 = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
2639
+ const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
2640
+ const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
2640
2641
  // JS uses 32-bit signed integers for bitwise operations which means we cannot
2641
2642
  // simple take carry out of low bit sum by shift, we need to use division.
2642
- function add$1(Ah, Al, Bh, Bl) {
2643
+ function add(Ah, Al, Bh, Bl) {
2643
2644
  const l = (Al >>> 0) + (Bl >>> 0);
2644
2645
  return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
2645
2646
  }
2646
2647
  // Addition with more than 2 elements
2647
- const add3L$1 = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
2648
- const add3H$1 = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
2649
- const add4L$1 = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
2650
- const add4H$1 = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
2651
- const add5L$1 = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
2652
- const add5H$1 = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
2648
+ const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
2649
+ const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
2650
+ const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
2651
+ const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
2652
+ const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
2653
+ const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
2653
2654
  // prettier-ignore
2654
- const u64$3 = {
2655
- fromBig: fromBig$1, split: split$1, toBig: toBig$1,
2656
- shrSH: shrSH$1, shrSL: shrSL$1,
2657
- rotrSH: rotrSH$1, rotrSL: rotrSL$1, rotrBH: rotrBH$1, rotrBL: rotrBL$1,
2658
- rotr32H: rotr32H$1, rotr32L: rotr32L$1,
2659
- rotlSH: rotlSH$1, rotlSL: rotlSL$1, rotlBH: rotlBH$1, rotlBL: rotlBL$1,
2660
- add: add$1, add3L: add3L$1, add3H: add3H$1, add4L: add4L$1, add4H: add4H$1, add5H: add5H$1, add5L: add5L$1,
2655
+ const u64$1 = {
2656
+ fromBig, split, toBig,
2657
+ shrSH, shrSL,
2658
+ rotrSH, rotrSL, rotrBH, rotrBL,
2659
+ rotr32H, rotr32L,
2660
+ rotlSH, rotlSL, rotlBH, rotlBL,
2661
+ add, add3L, add3H, add4L, add4H, add5H, add5L,
2661
2662
  };
2662
- var u64$4 = u64$3;
2663
+ var u64$2 = u64$1;
2663
2664
 
2664
2665
  // Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):
2665
2666
  // prettier-ignore
2666
- const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64$4.split([
2667
+ const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64$2.split([
2667
2668
  '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',
2668
2669
  '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',
2669
2670
  '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',
@@ -2688,7 +2689,7 @@ var solanaWeb3 = (function (exports) {
2688
2689
  // Temporary buffer, not used to store anything between runs
2689
2690
  const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
2690
2691
  const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
2691
- class SHA512 extends SHA2$1 {
2692
+ class SHA512 extends SHA2 {
2692
2693
  constructor() {
2693
2694
  super(128, 64, 16, false);
2694
2695
  // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.
@@ -2746,16 +2747,16 @@ var solanaWeb3 = (function (exports) {
2746
2747
  // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
2747
2748
  const W15h = SHA512_W_H[i - 15] | 0;
2748
2749
  const W15l = SHA512_W_L[i - 15] | 0;
2749
- const s0h = u64$4.rotrSH(W15h, W15l, 1) ^ u64$4.rotrSH(W15h, W15l, 8) ^ u64$4.shrSH(W15h, W15l, 7);
2750
- const s0l = u64$4.rotrSL(W15h, W15l, 1) ^ u64$4.rotrSL(W15h, W15l, 8) ^ u64$4.shrSL(W15h, W15l, 7);
2750
+ const s0h = u64$2.rotrSH(W15h, W15l, 1) ^ u64$2.rotrSH(W15h, W15l, 8) ^ u64$2.shrSH(W15h, W15l, 7);
2751
+ const s0l = u64$2.rotrSL(W15h, W15l, 1) ^ u64$2.rotrSL(W15h, W15l, 8) ^ u64$2.shrSL(W15h, W15l, 7);
2751
2752
  // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
2752
2753
  const W2h = SHA512_W_H[i - 2] | 0;
2753
2754
  const W2l = SHA512_W_L[i - 2] | 0;
2754
- const s1h = u64$4.rotrSH(W2h, W2l, 19) ^ u64$4.rotrBH(W2h, W2l, 61) ^ u64$4.shrSH(W2h, W2l, 6);
2755
- const s1l = u64$4.rotrSL(W2h, W2l, 19) ^ u64$4.rotrBL(W2h, W2l, 61) ^ u64$4.shrSL(W2h, W2l, 6);
2755
+ const s1h = u64$2.rotrSH(W2h, W2l, 19) ^ u64$2.rotrBH(W2h, W2l, 61) ^ u64$2.shrSH(W2h, W2l, 6);
2756
+ const s1l = u64$2.rotrSL(W2h, W2l, 19) ^ u64$2.rotrBL(W2h, W2l, 61) ^ u64$2.shrSL(W2h, W2l, 6);
2756
2757
  // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
2757
- const SUMl = u64$4.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
2758
- const SUMh = u64$4.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
2758
+ const SUMl = u64$2.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
2759
+ const SUMh = u64$2.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
2759
2760
  SHA512_W_H[i] = SUMh | 0;
2760
2761
  SHA512_W_L[i] = SUMl | 0;
2761
2762
  }
@@ -2763,19 +2764,19 @@ var solanaWeb3 = (function (exports) {
2763
2764
  // Compression function main loop, 80 rounds
2764
2765
  for (let i = 0; i < 80; i++) {
2765
2766
  // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
2766
- const sigma1h = u64$4.rotrSH(Eh, El, 14) ^ u64$4.rotrSH(Eh, El, 18) ^ u64$4.rotrBH(Eh, El, 41);
2767
- const sigma1l = u64$4.rotrSL(Eh, El, 14) ^ u64$4.rotrSL(Eh, El, 18) ^ u64$4.rotrBL(Eh, El, 41);
2767
+ const sigma1h = u64$2.rotrSH(Eh, El, 14) ^ u64$2.rotrSH(Eh, El, 18) ^ u64$2.rotrBH(Eh, El, 41);
2768
+ const sigma1l = u64$2.rotrSL(Eh, El, 14) ^ u64$2.rotrSL(Eh, El, 18) ^ u64$2.rotrBL(Eh, El, 41);
2768
2769
  //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
2769
2770
  const CHIh = (Eh & Fh) ^ (~Eh & Gh);
2770
2771
  const CHIl = (El & Fl) ^ (~El & Gl);
2771
2772
  // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
2772
2773
  // prettier-ignore
2773
- const T1ll = u64$4.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
2774
- const T1h = u64$4.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
2774
+ const T1ll = u64$2.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
2775
+ const T1h = u64$2.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
2775
2776
  const T1l = T1ll | 0;
2776
2777
  // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
2777
- const sigma0h = u64$4.rotrSH(Ah, Al, 28) ^ u64$4.rotrBH(Ah, Al, 34) ^ u64$4.rotrBH(Ah, Al, 39);
2778
- const sigma0l = u64$4.rotrSL(Ah, Al, 28) ^ u64$4.rotrBL(Ah, Al, 34) ^ u64$4.rotrBL(Ah, Al, 39);
2778
+ const sigma0h = u64$2.rotrSH(Ah, Al, 28) ^ u64$2.rotrBH(Ah, Al, 34) ^ u64$2.rotrBH(Ah, Al, 39);
2779
+ const sigma0l = u64$2.rotrSL(Ah, Al, 28) ^ u64$2.rotrBL(Ah, Al, 34) ^ u64$2.rotrBL(Ah, Al, 39);
2779
2780
  const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);
2780
2781
  const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);
2781
2782
  Hh = Gh | 0;
@@ -2784,26 +2785,26 @@ var solanaWeb3 = (function (exports) {
2784
2785
  Gl = Fl | 0;
2785
2786
  Fh = Eh | 0;
2786
2787
  Fl = El | 0;
2787
- ({ h: Eh, l: El } = u64$4.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
2788
+ ({ h: Eh, l: El } = u64$2.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
2788
2789
  Dh = Ch | 0;
2789
2790
  Dl = Cl | 0;
2790
2791
  Ch = Bh | 0;
2791
2792
  Cl = Bl | 0;
2792
2793
  Bh = Ah | 0;
2793
2794
  Bl = Al | 0;
2794
- const All = u64$4.add3L(T1l, sigma0l, MAJl);
2795
- Ah = u64$4.add3H(All, T1h, sigma0h, MAJh);
2795
+ const All = u64$2.add3L(T1l, sigma0l, MAJl);
2796
+ Ah = u64$2.add3H(All, T1h, sigma0h, MAJh);
2796
2797
  Al = All | 0;
2797
2798
  }
2798
2799
  // Add the compressed chunk to the current hash value
2799
- ({ h: Ah, l: Al } = u64$4.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
2800
- ({ h: Bh, l: Bl } = u64$4.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
2801
- ({ h: Ch, l: Cl } = u64$4.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
2802
- ({ h: Dh, l: Dl } = u64$4.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
2803
- ({ h: Eh, l: El } = u64$4.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
2804
- ({ h: Fh, l: Fl } = u64$4.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
2805
- ({ h: Gh, l: Gl } = u64$4.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
2806
- ({ h: Hh, l: Hl } = u64$4.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
2800
+ ({ h: Ah, l: Al } = u64$2.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
2801
+ ({ h: Bh, l: Bl } = u64$2.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
2802
+ ({ h: Ch, l: Cl } = u64$2.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
2803
+ ({ h: Dh, l: Dl } = u64$2.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
2804
+ ({ h: Eh, l: El } = u64$2.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
2805
+ ({ h: Fh, l: Fl } = u64$2.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
2806
+ ({ h: Gh, l: Gl } = u64$2.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
2807
+ ({ h: Hh, l: Hl } = u64$2.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
2807
2808
  this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
2808
2809
  }
2809
2810
  roundClean() {
@@ -2815,7 +2816,7 @@ var solanaWeb3 = (function (exports) {
2815
2816
  this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
2816
2817
  }
2817
2818
  }
2818
- const sha512 = /* @__PURE__ */ wrapConstructor$1(() => new SHA512());
2819
+ const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());
2819
2820
 
2820
2821
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2821
2822
  // 100 lines of code in the file are duplicated from noble-hashes (utils).
@@ -2825,13 +2826,13 @@ var solanaWeb3 = (function (exports) {
2825
2826
  const _0n$5 = BigInt(0);
2826
2827
  const _1n$7 = BigInt(1);
2827
2828
  const _2n$5 = BigInt(2);
2828
- const u8a$1 = (a) => a instanceof Uint8Array;
2829
+ const u8a = (a) => a instanceof Uint8Array;
2829
2830
  const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
2830
2831
  /**
2831
2832
  * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
2832
2833
  */
2833
2834
  function bytesToHex(bytes) {
2834
- if (!u8a$1(bytes))
2835
+ if (!u8a(bytes))
2835
2836
  throw new Error('Uint8Array expected');
2836
2837
  // pre-caching improves the speed 6x
2837
2838
  let hex = '';
@@ -2875,7 +2876,7 @@ var solanaWeb3 = (function (exports) {
2875
2876
  return hexToNumber(bytesToHex(bytes));
2876
2877
  }
2877
2878
  function bytesToNumberLE(bytes) {
2878
- if (!u8a$1(bytes))
2879
+ if (!u8a(bytes))
2879
2880
  throw new Error('Uint8Array expected');
2880
2881
  return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
2881
2882
  }
@@ -2908,7 +2909,7 @@ var solanaWeb3 = (function (exports) {
2908
2909
  throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
2909
2910
  }
2910
2911
  }
2911
- else if (u8a$1(hex)) {
2912
+ else if (u8a(hex)) {
2912
2913
  // Uint8Array.from() instead of hash.slice() because node.js Buffer
2913
2914
  // is instance of Uint8Array, and its slice() creates **mutable** copy
2914
2915
  res = Uint8Array.from(hex);
@@ -2928,7 +2929,7 @@ var solanaWeb3 = (function (exports) {
2928
2929
  const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
2929
2930
  let pad = 0; // walk through each item, ensure they have proper type
2930
2931
  arrays.forEach((a) => {
2931
- if (!u8a$1(a))
2932
+ if (!u8a(a))
2932
2933
  throw new Error('Uint8Array expected');
2933
2934
  r.set(a, pad);
2934
2935
  pad += a.length;
@@ -2947,7 +2948,7 @@ var solanaWeb3 = (function (exports) {
2947
2948
  /**
2948
2949
  * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
2949
2950
  */
2950
- function utf8ToBytes$1(str) {
2951
+ function utf8ToBytes(str) {
2951
2952
  if (typeof str !== 'string')
2952
2953
  throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
2953
2954
  return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
@@ -3102,7 +3103,7 @@ var solanaWeb3 = (function (exports) {
3102
3103
  numberToBytesLE: numberToBytesLE,
3103
3104
  numberToHexUnpadded: numberToHexUnpadded,
3104
3105
  numberToVarBytesBE: numberToVarBytesBE,
3105
- utf8ToBytes: utf8ToBytes$1,
3106
+ utf8ToBytes: utf8ToBytes,
3106
3107
  validateObject: validateObject
3107
3108
  });
3108
3109
 
@@ -4128,6 +4129,20 @@ var solanaWeb3 = (function (exports) {
4128
4129
  uvRatio,
4129
4130
  };
4130
4131
  const ed25519 = /* @__PURE__ */ twistedEdwards(ed25519Defaults);
4132
+ function ed25519_domain(data, ctx, phflag) {
4133
+ if (ctx.length > 255)
4134
+ throw new Error('Context is too big');
4135
+ return concatBytes$1(utf8ToBytes$1('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data);
4136
+ }
4137
+ /* @__PURE__ */ twistedEdwards({
4138
+ ...ed25519Defaults,
4139
+ domain: ed25519_domain,
4140
+ });
4141
+ /* @__PURE__ */ twistedEdwards({
4142
+ ...ed25519Defaults,
4143
+ domain: ed25519_domain,
4144
+ prehash: sha512,
4145
+ });
4131
4146
  // Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator)
4132
4147
  // NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since
4133
4148
  // SageMath returns different root first and everything falls apart
@@ -7757,232 +7772,16 @@ var solanaWeb3 = (function (exports) {
7757
7772
 
7758
7773
  var bs58$1 = /*@__PURE__*/getDefaultExportFromCjs(bs58);
7759
7774
 
7760
- function number$1(n) {
7761
- if (!Number.isSafeInteger(n) || n < 0)
7762
- throw new Error(`Wrong positive integer: ${n}`);
7763
- }
7764
- function bool(b) {
7765
- if (typeof b !== 'boolean')
7766
- throw new Error(`Expected boolean, not ${b}`);
7767
- }
7768
- function bytes(b, ...lengths) {
7769
- if (!(b instanceof Uint8Array))
7770
- throw new Error('Expected Uint8Array');
7771
- if (lengths.length > 0 && !lengths.includes(b.length))
7772
- throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
7773
- }
7774
- function hash(hash) {
7775
- if (typeof hash !== 'function' || typeof hash.create !== 'function')
7776
- throw new Error('Hash should be wrapped by utils.wrapConstructor');
7777
- number$1(hash.outputLen);
7778
- number$1(hash.blockLen);
7779
- }
7780
- function exists(instance, checkFinished = true) {
7781
- if (instance.destroyed)
7782
- throw new Error('Hash instance has been destroyed');
7783
- if (checkFinished && instance.finished)
7784
- throw new Error('Hash#digest() has already been called');
7785
- }
7786
- function output(out, instance) {
7787
- bytes(out);
7788
- const min = instance.outputLen;
7789
- if (out.length < min) {
7790
- throw new Error(`digestInto() expects output buffer of length at least ${min}`);
7791
- }
7792
- }
7793
- const assert$2 = {
7794
- number: number$1,
7795
- bool,
7796
- bytes,
7797
- hash,
7798
- exists,
7799
- output,
7800
- };
7801
- var assert$3 = assert$2;
7802
-
7803
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
7804
- // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
7805
- // node.js versions earlier than v19 don't declare it in global scope.
7806
- // For node.js, package.json#exports field mapping rewrites import
7807
- // from `crypto` to `cryptoNode`, which imports native module.
7808
- // Makes the utils un-importable in browsers without a bundler.
7809
- // Once node.js 18 is deprecated, we can just drop the import.
7810
- const u8a = (a) => a instanceof Uint8Array;
7811
- const u32$1 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
7812
- // Cast array to view
7813
- const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
7814
- // The rotate right (circular right shift) operation for uint32
7815
- const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
7816
- // big-endian hardware is rare. Just in case someone still decides to run hashes:
7817
- // early-throw an error because we don't support BE yet.
7818
- const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
7819
- if (!isLE)
7820
- throw new Error('Non little-endian hardware is not supported');
7821
- Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));
7822
- /**
7823
- * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
7824
- */
7825
- function utf8ToBytes(str) {
7826
- if (typeof str !== 'string')
7827
- throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
7828
- return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
7829
- }
7830
- /**
7831
- * Normalizes (non-hex) string or Uint8Array to Uint8Array.
7832
- * Warning: when Uint8Array is passed, it would NOT get copied.
7833
- * Keep in mind for future mutable operations.
7834
- */
7835
- function toBytes(data) {
7836
- if (typeof data === 'string')
7837
- data = utf8ToBytes(data);
7838
- if (!u8a(data))
7839
- throw new Error(`expected Uint8Array, got ${typeof data}`);
7840
- return data;
7841
- }
7842
- // For runtime check if class implements interface
7843
- class Hash {
7844
- // Safe version that clones internal state
7845
- clone() {
7846
- return this._cloneInto();
7847
- }
7848
- }
7849
- function wrapConstructor(hashCons) {
7850
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
7851
- const tmp = hashCons();
7852
- hashC.outputLen = tmp.outputLen;
7853
- hashC.blockLen = tmp.blockLen;
7854
- hashC.create = () => hashCons();
7855
- return hashC;
7856
- }
7857
- function wrapXOFConstructorWithOpts(hashCons) {
7858
- const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
7859
- const tmp = hashCons({});
7860
- hashC.outputLen = tmp.outputLen;
7861
- hashC.blockLen = tmp.blockLen;
7862
- hashC.create = (opts) => hashCons(opts);
7863
- return hashC;
7864
- }
7865
-
7866
- // Polyfill for Safari 14
7867
- function setBigUint64(view, byteOffset, value, isLE) {
7868
- if (typeof view.setBigUint64 === 'function')
7869
- return view.setBigUint64(byteOffset, value, isLE);
7870
- const _32n = BigInt(32);
7871
- const _u32_max = BigInt(0xffffffff);
7872
- const wh = Number((value >> _32n) & _u32_max);
7873
- const wl = Number(value & _u32_max);
7874
- const h = isLE ? 4 : 0;
7875
- const l = isLE ? 0 : 4;
7876
- view.setUint32(byteOffset + h, wh, isLE);
7877
- view.setUint32(byteOffset + l, wl, isLE);
7878
- }
7879
- // Base SHA2 class (RFC 6234)
7880
- class SHA2 extends Hash {
7881
- constructor(blockLen, outputLen, padOffset, isLE) {
7882
- super();
7883
- this.blockLen = blockLen;
7884
- this.outputLen = outputLen;
7885
- this.padOffset = padOffset;
7886
- this.isLE = isLE;
7887
- this.finished = false;
7888
- this.length = 0;
7889
- this.pos = 0;
7890
- this.destroyed = false;
7891
- this.buffer = new Uint8Array(blockLen);
7892
- this.view = createView(this.buffer);
7893
- }
7894
- update(data) {
7895
- assert$3.exists(this);
7896
- const { view, buffer, blockLen } = this;
7897
- data = toBytes(data);
7898
- const len = data.length;
7899
- for (let pos = 0; pos < len;) {
7900
- const take = Math.min(blockLen - this.pos, len - pos);
7901
- // Fast path: we have at least one block in input, cast it to view and process
7902
- if (take === blockLen) {
7903
- const dataView = createView(data);
7904
- for (; blockLen <= len - pos; pos += blockLen)
7905
- this.process(dataView, pos);
7906
- continue;
7907
- }
7908
- buffer.set(data.subarray(pos, pos + take), this.pos);
7909
- this.pos += take;
7910
- pos += take;
7911
- if (this.pos === blockLen) {
7912
- this.process(view, 0);
7913
- this.pos = 0;
7914
- }
7915
- }
7916
- this.length += data.length;
7917
- this.roundClean();
7918
- return this;
7919
- }
7920
- digestInto(out) {
7921
- assert$3.exists(this);
7922
- assert$3.output(out, this);
7923
- this.finished = true;
7924
- // Padding
7925
- // We can avoid allocation of buffer for padding completely if it
7926
- // was previously not allocated here. But it won't change performance.
7927
- const { buffer, view, blockLen, isLE } = this;
7928
- let { pos } = this;
7929
- // append the bit '1' to the message
7930
- buffer[pos++] = 0b10000000;
7931
- this.buffer.subarray(pos).fill(0);
7932
- // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again
7933
- if (this.padOffset > blockLen - pos) {
7934
- this.process(view, 0);
7935
- pos = 0;
7936
- }
7937
- // Pad until full block byte with zeros
7938
- for (let i = pos; i < blockLen; i++)
7939
- buffer[i] = 0;
7940
- // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
7941
- // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
7942
- // So we just write lowest 64 bits of that value.
7943
- setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
7944
- this.process(view, 0);
7945
- const oview = createView(out);
7946
- const len = this.outputLen;
7947
- // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
7948
- if (len % 4)
7949
- throw new Error('_sha2: outputLen should be aligned to 32bit');
7950
- const outLen = len / 4;
7951
- const state = this.get();
7952
- if (outLen > state.length)
7953
- throw new Error('_sha2: outputLen bigger than state');
7954
- for (let i = 0; i < outLen; i++)
7955
- oview.setUint32(4 * i, state[i], isLE);
7956
- }
7957
- digest() {
7958
- const { buffer, outputLen } = this;
7959
- this.digestInto(buffer);
7960
- const res = buffer.slice(0, outputLen);
7961
- this.destroy();
7962
- return res;
7963
- }
7964
- _cloneInto(to) {
7965
- to || (to = new this.constructor());
7966
- to.set(...this.get());
7967
- const { blockLen, buffer, length, finished, destroyed, pos } = this;
7968
- to.length = length;
7969
- to.pos = pos;
7970
- to.finished = finished;
7971
- to.destroyed = destroyed;
7972
- if (length % blockLen)
7973
- to.buffer.set(buffer);
7974
- return to;
7975
- }
7976
- }
7977
-
7775
+ // SHA2-256 need to try 2^128 hashes to execute birthday attack.
7776
+ // BTC network is doing 2^67 hashes/sec as per early 2023.
7978
7777
  // Choice: a ? b : c
7979
- const Chi$1 = (a, b, c) => (a & b) ^ (~a & c);
7778
+ const Chi = (a, b, c) => (a & b) ^ (~a & c);
7980
7779
  // Majority function, true if any two inpust is true
7981
- const Maj$1 = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
7780
+ const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
7982
7781
  // Round constants:
7983
7782
  // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
7984
7783
  // prettier-ignore
7985
- const SHA256_K$1 = new Uint32Array([
7784
+ const SHA256_K = /* @__PURE__ */ new Uint32Array([
7986
7785
  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
7987
7786
  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
7988
7787
  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
@@ -7994,25 +7793,25 @@ var solanaWeb3 = (function (exports) {
7994
7793
  ]);
7995
7794
  // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):
7996
7795
  // prettier-ignore
7997
- const IV$1 = new Uint32Array([
7796
+ const IV = /* @__PURE__ */ new Uint32Array([
7998
7797
  0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
7999
7798
  ]);
8000
7799
  // Temporary buffer, not used to store anything between runs
8001
7800
  // Named this way because it matches specification.
8002
- const SHA256_W$1 = new Uint32Array(64);
8003
- let SHA256$1 = class SHA256 extends SHA2 {
7801
+ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
7802
+ class SHA256 extends SHA2 {
8004
7803
  constructor() {
8005
7804
  super(64, 32, 8, false);
8006
7805
  // We cannot use array here since array allows indexing by variable
8007
7806
  // which means optimizer/compiler cannot use registers.
8008
- this.A = IV$1[0] | 0;
8009
- this.B = IV$1[1] | 0;
8010
- this.C = IV$1[2] | 0;
8011
- this.D = IV$1[3] | 0;
8012
- this.E = IV$1[4] | 0;
8013
- this.F = IV$1[5] | 0;
8014
- this.G = IV$1[6] | 0;
8015
- this.H = IV$1[7] | 0;
7807
+ this.A = IV[0] | 0;
7808
+ this.B = IV[1] | 0;
7809
+ this.C = IV[2] | 0;
7810
+ this.D = IV[3] | 0;
7811
+ this.E = IV[4] | 0;
7812
+ this.F = IV[5] | 0;
7813
+ this.G = IV[6] | 0;
7814
+ this.H = IV[7] | 0;
8016
7815
  }
8017
7816
  get() {
8018
7817
  const { A, B, C, D, E, F, G, H } = this;
@@ -8032,21 +7831,21 @@ var solanaWeb3 = (function (exports) {
8032
7831
  process(view, offset) {
8033
7832
  // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
8034
7833
  for (let i = 0; i < 16; i++, offset += 4)
8035
- SHA256_W$1[i] = view.getUint32(offset, false);
7834
+ SHA256_W[i] = view.getUint32(offset, false);
8036
7835
  for (let i = 16; i < 64; i++) {
8037
- const W15 = SHA256_W$1[i - 15];
8038
- const W2 = SHA256_W$1[i - 2];
7836
+ const W15 = SHA256_W[i - 15];
7837
+ const W2 = SHA256_W[i - 2];
8039
7838
  const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
8040
7839
  const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
8041
- SHA256_W$1[i] = (s1 + SHA256_W$1[i - 7] + s0 + SHA256_W$1[i - 16]) | 0;
7840
+ SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
8042
7841
  }
8043
7842
  // Compression function main loop, 64 rounds
8044
7843
  let { A, B, C, D, E, F, G, H } = this;
8045
7844
  for (let i = 0; i < 64; i++) {
8046
7845
  const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
8047
- const T1 = (H + sigma1 + Chi$1(E, F, G) + SHA256_K$1[i] + SHA256_W$1[i]) | 0;
7846
+ const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
8048
7847
  const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
8049
- const T2 = (sigma0 + Maj$1(A, B, C)) | 0;
7848
+ const T2 = (sigma0 + Maj(A, B, C)) | 0;
8050
7849
  H = G;
8051
7850
  G = F;
8052
7851
  F = E;
@@ -8068,34 +7867,18 @@ var solanaWeb3 = (function (exports) {
8068
7867
  this.set(A, B, C, D, E, F, G, H);
8069
7868
  }
8070
7869
  roundClean() {
8071
- SHA256_W$1.fill(0);
7870
+ SHA256_W.fill(0);
8072
7871
  }
8073
7872
  destroy() {
8074
7873
  this.set(0, 0, 0, 0, 0, 0, 0, 0);
8075
7874
  this.buffer.fill(0);
8076
7875
  }
8077
- };
8078
- // Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
8079
- class SHA224 extends SHA256$1 {
8080
- constructor() {
8081
- super();
8082
- this.A = 0xc1059ed8 | 0;
8083
- this.B = 0x367cd507 | 0;
8084
- this.C = 0x3070dd17 | 0;
8085
- this.D = 0xf70e5939 | 0;
8086
- this.E = 0xffc00b31 | 0;
8087
- this.F = 0x68581511 | 0;
8088
- this.G = 0x64f98fa7 | 0;
8089
- this.H = 0xbefa4fa4 | 0;
8090
- this.outputLen = 28;
8091
- }
8092
7876
  }
8093
7877
  /**
8094
7878
  * SHA2-256 hash function
8095
7879
  * @param message - data that would be hashed
8096
7880
  */
8097
- const sha256$1 = wrapConstructor(() => new SHA256$1());
8098
- wrapConstructor(() => new SHA224());
7881
+ const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
8099
7882
 
8100
7883
  var lib = {};
8101
7884
 
@@ -9344,7 +9127,7 @@ var solanaWeb3 = (function (exports) {
9344
9127
  /* eslint-disable require-await */
9345
9128
  static async createWithSeed(fromPublicKey, seed, programId) {
9346
9129
  const buffer$1 = buffer.Buffer.concat([fromPublicKey.toBuffer(), buffer.Buffer.from(seed), programId.toBuffer()]);
9347
- const publicKeyBytes = sha256$1(buffer$1);
9130
+ const publicKeyBytes = sha256(buffer$1);
9348
9131
  return new PublicKey(publicKeyBytes);
9349
9132
  }
9350
9133
 
@@ -9361,7 +9144,7 @@ var solanaWeb3 = (function (exports) {
9361
9144
  buffer$1 = buffer.Buffer.concat([buffer$1, toBuffer(seed)]);
9362
9145
  });
9363
9146
  buffer$1 = buffer.Buffer.concat([buffer$1, programId.toBuffer(), buffer.Buffer.from('ProgramDerivedAddress')]);
9364
- const publicKeyBytes = sha256$1(buffer$1);
9147
+ const publicKeyBytes = sha256(buffer$1);
9365
9148
  if (isOnCurve(publicKeyBytes)) {
9366
9149
  throw new Error(`Invalid seeds, address must fall off the curve`);
9367
9150
  }
@@ -12552,6 +12335,8 @@ var solanaWeb3 = (function (exports) {
12552
12335
  }
12553
12336
  };
12554
12337
 
12338
+ /** @internal */
12339
+
12555
12340
  /**
12556
12341
  * Transaction signature as base-58 encoded string
12557
12342
  */
@@ -13167,29 +12952,31 @@ var solanaWeb3 = (function (exports) {
13167
12952
  *
13168
12953
  * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
13169
12954
  */
13170
- verifySignatures(requireAllSignatures) {
13171
- return this._verifySignatures(this.serializeMessage(), requireAllSignatures === undefined ? true : requireAllSignatures);
12955
+ verifySignatures(requireAllSignatures = true) {
12956
+ const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
12957
+ return !signatureErrors;
13172
12958
  }
13173
12959
 
13174
12960
  /**
13175
12961
  * @internal
13176
12962
  */
13177
- _verifySignatures(signData, requireAllSignatures) {
12963
+ _getMessageSignednessErrors(message, requireAllSignatures) {
12964
+ const errors = {};
13178
12965
  for (const {
13179
12966
  signature,
13180
12967
  publicKey
13181
12968
  } of this.signatures) {
13182
12969
  if (signature === null) {
13183
12970
  if (requireAllSignatures) {
13184
- return false;
12971
+ (errors.missing ||= []).push(publicKey);
13185
12972
  }
13186
12973
  } else {
13187
- if (!verify(signature, signData, publicKey.toBytes())) {
13188
- return false;
12974
+ if (!verify(signature, message, publicKey.toBytes())) {
12975
+ (errors.invalid ||= []).push(publicKey);
13189
12976
  }
13190
12977
  }
13191
12978
  }
13192
- return true;
12979
+ return errors.invalid || errors.missing ? errors : undefined;
13193
12980
  }
13194
12981
 
13195
12982
  /**
@@ -13208,8 +12995,18 @@ var solanaWeb3 = (function (exports) {
13208
12995
  verifySignatures: true
13209
12996
  }, config);
13210
12997
  const signData = this.serializeMessage();
13211
- if (verifySignatures && !this._verifySignatures(signData, requireAllSignatures)) {
13212
- throw new Error('Signature verification failed');
12998
+ if (verifySignatures) {
12999
+ const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
13000
+ if (sigErrors) {
13001
+ let errorMessage = 'Signature verification failed.';
13002
+ if (sigErrors.invalid) {
13003
+ errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
13004
+ }
13005
+ if (sigErrors.missing) {
13006
+ errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
13007
+ }
13008
+ throw new Error(errorMessage);
13009
+ }
13213
13010
  }
13214
13011
  return this._serialize(signData);
13215
13012
  }
@@ -13748,7 +13545,7 @@ var solanaWeb3 = (function (exports) {
13748
13545
  };
13749
13546
  return bigIntLayout;
13750
13547
  };
13751
- const u64$2 = bigInt(8);
13548
+ const u64 = bigInt(8);
13752
13549
 
13753
13550
  /**
13754
13551
  * Create account system transaction params
@@ -14089,7 +13886,7 @@ var solanaWeb3 = (function (exports) {
14089
13886
  },
14090
13887
  Transfer: {
14091
13888
  index: 2,
14092
- layout: struct([u32('instruction'), u64$2('lamports')])
13889
+ layout: struct([u32('instruction'), u64('lamports')])
14093
13890
  },
14094
13891
  CreateWithSeed: {
14095
13892
  index: 3,
@@ -14125,7 +13922,7 @@ var solanaWeb3 = (function (exports) {
14125
13922
  },
14126
13923
  TransferWithSeed: {
14127
13924
  index: 11,
14128
- layout: struct([u32('instruction'), u64$2('lamports'), rustString('seed'), publicKey('programId')])
13925
+ layout: struct([u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])
14129
13926
  },
14130
13927
  UpgradeNonceAccount: {
14131
13928
  index: 12,
@@ -18025,7 +17822,7 @@ var solanaWeb3 = (function (exports) {
18025
17822
  }
18026
17823
  const LookupTableMetaLayout = {
18027
17824
  index: 1,
18028
- layout: struct([u32('typeIndex'), u64$2('deactivationSlot'), nu64('lastExtendedSlot'), u8('lastExtendedStartIndex'), u8(),
17825
+ layout: struct([u32('typeIndex'), u64('deactivationSlot'), nu64('lastExtendedSlot'), u8('lastExtendedStartIndex'), u8(),
18029
17826
  // option
18030
17827
  seq(publicKey(), offset(u8(), -1), 'authority')])
18031
17828
  };
@@ -19558,7 +19355,7 @@ var solanaWeb3 = (function (exports) {
19558
19355
 
19559
19356
  /** @internal */
19560
19357
  const COMMON_HTTP_HEADERS = {
19561
- 'solana-client': `js/${"1.87.7" }`
19358
+ 'solana-client': `js/${"1.88.1" }`
19562
19359
  };
19563
19360
 
19564
19361
  /**
@@ -22569,7 +22366,7 @@ var solanaWeb3 = (function (exports) {
22569
22366
  const LOOKUP_TABLE_INSTRUCTION_LAYOUTS = Object.freeze({
22570
22367
  CreateLookupTable: {
22571
22368
  index: 0,
22572
- layout: struct([u32('instruction'), u64$2('recentSlot'), u8('bumpSeed')])
22369
+ layout: struct([u32('instruction'), u64('recentSlot'), u8('bumpSeed')])
22573
22370
  },
22574
22371
  FreezeLookupTable: {
22575
22372
  index: 1,
@@ -22577,7 +22374,7 @@ var solanaWeb3 = (function (exports) {
22577
22374
  },
22578
22375
  ExtendLookupTable: {
22579
22376
  index: 2,
22580
- layout: struct([u32('instruction'), u64$2(), seq(publicKey(), offset(u32(), -8), 'addresses')])
22377
+ layout: struct([u32('instruction'), u64(), seq(publicKey(), offset(u32(), -8), 'addresses')])
22581
22378
  },
22582
22379
  DeactivateLookupTable: {
22583
22380
  index: 3,
@@ -22938,7 +22735,7 @@ var solanaWeb3 = (function (exports) {
22938
22735
  },
22939
22736
  SetComputeUnitPrice: {
22940
22737
  index: 3,
22941
- layout: struct([u8('instruction'), u64$2('microLamports')])
22738
+ layout: struct([u8('instruction'), u64('microLamports')])
22942
22739
  }
22943
22740
  });
22944
22741
 
@@ -23092,75 +22889,16 @@ var solanaWeb3 = (function (exports) {
23092
22889
  }
23093
22890
  Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');
23094
22891
 
23095
- const U32_MASK64 = BigInt(2 ** 32 - 1);
23096
- const _32n = BigInt(32);
23097
- // We are not using BigUint64Array, because they are extremely slow as per 2022
23098
- function fromBig(n, le = false) {
23099
- if (le)
23100
- return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
23101
- return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
23102
- }
23103
- function split(lst, le = false) {
23104
- let Ah = new Uint32Array(lst.length);
23105
- let Al = new Uint32Array(lst.length);
23106
- for (let i = 0; i < lst.length; i++) {
23107
- const { h, l } = fromBig(lst[i], le);
23108
- [Ah[i], Al[i]] = [h, l];
23109
- }
23110
- return [Ah, Al];
23111
- }
23112
- const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
23113
- // for Shift in [0, 32)
23114
- const shrSH = (h, l, s) => h >>> s;
23115
- const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
23116
- // Right rotate for Shift in [1, 32)
23117
- const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
23118
- const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
23119
- // Right rotate for Shift in (32, 64), NOTE: 32 is special case.
23120
- const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
23121
- const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
23122
- // Right rotate for shift===32 (just swaps l&h)
23123
- const rotr32H = (h, l) => l;
23124
- const rotr32L = (h, l) => h;
23125
- // Left rotate for Shift in [1, 32)
23126
- const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
23127
- const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
23128
- // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
23129
- const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
23130
- const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
23131
- // JS uses 32-bit signed integers for bitwise operations which means we cannot
23132
- // simple take carry out of low bit sum by shift, we need to use division.
23133
- // Removing "export" has 5% perf penalty -_-
23134
- function add(Ah, Al, Bh, Bl) {
23135
- const l = (Al >>> 0) + (Bl >>> 0);
23136
- return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
23137
- }
23138
- // Addition with more than 2 elements
23139
- const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
23140
- const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
23141
- const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
23142
- const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
23143
- const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
23144
- const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
23145
- // prettier-ignore
23146
- const u64 = {
23147
- fromBig, split, toBig,
23148
- shrSH, shrSL,
23149
- rotrSH, rotrSL, rotrBH, rotrBL,
23150
- rotr32H, rotr32L,
23151
- rotlSH, rotlSL, rotlBH, rotlBL,
23152
- add, add3L, add3H, add4L, add4H, add5H, add5L,
23153
- };
23154
- var u64$1 = u64;
23155
-
22892
+ // SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.
22893
+ // It's called a sponge function.
23156
22894
  // Various per round constants calculations
23157
22895
  const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
23158
- const _0n$1 = BigInt(0);
23159
- const _1n$2 = BigInt(1);
23160
- const _2n$1 = BigInt(2);
23161
- const _7n = BigInt(7);
23162
- const _256n = BigInt(256);
23163
- const _0x71n = BigInt(0x71);
22896
+ const _0n$1 = /* @__PURE__ */ BigInt(0);
22897
+ const _1n$2 = /* @__PURE__ */ BigInt(1);
22898
+ const _2n$1 = /* @__PURE__ */ BigInt(2);
22899
+ const _7n = /* @__PURE__ */ BigInt(7);
22900
+ const _256n = /* @__PURE__ */ BigInt(256);
22901
+ const _0x71n = /* @__PURE__ */ BigInt(0x71);
23164
22902
  for (let round = 0, R = _1n$2, x = 1, y = 0; round < 24; round++) {
23165
22903
  // Pi
23166
22904
  [x, y] = [y, (2 * x + 3 * y) % 5];
@@ -23172,14 +22910,14 @@ var solanaWeb3 = (function (exports) {
23172
22910
  for (let j = 0; j < 7; j++) {
23173
22911
  R = ((R << _1n$2) ^ ((R >> _7n) * _0x71n)) % _256n;
23174
22912
  if (R & _2n$1)
23175
- t ^= _1n$2 << ((_1n$2 << BigInt(j)) - _1n$2);
22913
+ t ^= _1n$2 << ((_1n$2 << /* @__PURE__ */ BigInt(j)) - _1n$2);
23176
22914
  }
23177
22915
  _SHA3_IOTA.push(t);
23178
22916
  }
23179
- const [SHA3_IOTA_H, SHA3_IOTA_L] = u64$1.split(_SHA3_IOTA, true);
22917
+ const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
23180
22918
  // Left rotation (without 0, 32, 64)
23181
- const rotlH = (h, l, s) => s > 32 ? u64$1.rotlBH(h, l, s) : u64$1.rotlSH(h, l, s);
23182
- const rotlL = (h, l, s) => s > 32 ? u64$1.rotlBL(h, l, s) : u64$1.rotlSL(h, l, s);
22919
+ const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
22920
+ const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
23183
22921
  // Same as keccakf1600, but allows to skip some rounds
23184
22922
  function keccakP(s, rounds = 24) {
23185
22923
  const B = new Uint32Array(5 * 2);
@@ -23240,7 +22978,7 @@ var solanaWeb3 = (function (exports) {
23240
22978
  this.finished = false;
23241
22979
  this.destroyed = false;
23242
22980
  // Can be passed from user as dkLen
23243
- assert$3.number(outputLen);
22981
+ number$1(outputLen);
23244
22982
  // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
23245
22983
  if (0 >= this.blockLen || this.blockLen >= 200)
23246
22984
  throw new Error('Sha3 supports only keccak-f1600 function');
@@ -23253,7 +22991,7 @@ var solanaWeb3 = (function (exports) {
23253
22991
  this.pos = 0;
23254
22992
  }
23255
22993
  update(data) {
23256
- assert$3.exists(this);
22994
+ exists(this);
23257
22995
  const { blockLen, state } = this;
23258
22996
  data = toBytes(data);
23259
22997
  const len = data.length;
@@ -23279,8 +23017,8 @@ var solanaWeb3 = (function (exports) {
23279
23017
  this.keccak();
23280
23018
  }
23281
23019
  writeInto(out) {
23282
- assert$3.exists(this, false);
23283
- assert$3.bytes(out);
23020
+ exists(this, false);
23021
+ bytes(out);
23284
23022
  this.finish();
23285
23023
  const bufferOut = this.state;
23286
23024
  const { blockLen } = this;
@@ -23301,11 +23039,11 @@ var solanaWeb3 = (function (exports) {
23301
23039
  return this.writeInto(out);
23302
23040
  }
23303
23041
  xof(bytes) {
23304
- assert$3.number(bytes);
23042
+ number$1(bytes);
23305
23043
  return this.xofInto(new Uint8Array(bytes));
23306
23044
  }
23307
23045
  digestInto(out) {
23308
- assert$3.output(out, this);
23046
+ output(out, this);
23309
23047
  if (this.finished)
23310
23048
  throw new Error('digest() was already called');
23311
23049
  this.writeInto(out);
@@ -23336,133 +23074,11 @@ var solanaWeb3 = (function (exports) {
23336
23074
  }
23337
23075
  }
23338
23076
  const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
23339
- gen(0x06, 144, 224 / 8);
23340
- /**
23341
- * SHA3-256 hash function
23342
- * @param message - that would be hashed
23343
- */
23344
- gen(0x06, 136, 256 / 8);
23345
- gen(0x06, 104, 384 / 8);
23346
- gen(0x06, 72, 512 / 8);
23347
- gen(0x01, 144, 224 / 8);
23348
23077
  /**
23349
23078
  * keccak-256 hash function. Different from SHA3-256.
23350
23079
  * @param message - that would be hashed
23351
23080
  */
23352
- const keccak_256 = gen(0x01, 136, 256 / 8);
23353
- gen(0x01, 104, 384 / 8);
23354
- gen(0x01, 72, 512 / 8);
23355
- const genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
23356
- genShake(0x1f, 168, 128 / 8);
23357
- genShake(0x1f, 136, 256 / 8);
23358
-
23359
- // SHA2-256 need to try 2^128 hashes to execute birthday attack.
23360
- // BTC network is doing 2^67 hashes/sec as per early 2023.
23361
- // Choice: a ? b : c
23362
- const Chi = (a, b, c) => (a & b) ^ (~a & c);
23363
- // Majority function, true if any two inpust is true
23364
- const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
23365
- // Round constants:
23366
- // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
23367
- // prettier-ignore
23368
- const SHA256_K = /* @__PURE__ */ new Uint32Array([
23369
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
23370
- 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
23371
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
23372
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
23373
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
23374
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
23375
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
23376
- 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
23377
- ]);
23378
- // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):
23379
- // prettier-ignore
23380
- const IV = /* @__PURE__ */ new Uint32Array([
23381
- 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
23382
- ]);
23383
- // Temporary buffer, not used to store anything between runs
23384
- // Named this way because it matches specification.
23385
- const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
23386
- class SHA256 extends SHA2$1 {
23387
- constructor() {
23388
- super(64, 32, 8, false);
23389
- // We cannot use array here since array allows indexing by variable
23390
- // which means optimizer/compiler cannot use registers.
23391
- this.A = IV[0] | 0;
23392
- this.B = IV[1] | 0;
23393
- this.C = IV[2] | 0;
23394
- this.D = IV[3] | 0;
23395
- this.E = IV[4] | 0;
23396
- this.F = IV[5] | 0;
23397
- this.G = IV[6] | 0;
23398
- this.H = IV[7] | 0;
23399
- }
23400
- get() {
23401
- const { A, B, C, D, E, F, G, H } = this;
23402
- return [A, B, C, D, E, F, G, H];
23403
- }
23404
- // prettier-ignore
23405
- set(A, B, C, D, E, F, G, H) {
23406
- this.A = A | 0;
23407
- this.B = B | 0;
23408
- this.C = C | 0;
23409
- this.D = D | 0;
23410
- this.E = E | 0;
23411
- this.F = F | 0;
23412
- this.G = G | 0;
23413
- this.H = H | 0;
23414
- }
23415
- process(view, offset) {
23416
- // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
23417
- for (let i = 0; i < 16; i++, offset += 4)
23418
- SHA256_W[i] = view.getUint32(offset, false);
23419
- for (let i = 16; i < 64; i++) {
23420
- const W15 = SHA256_W[i - 15];
23421
- const W2 = SHA256_W[i - 2];
23422
- const s0 = rotr$1(W15, 7) ^ rotr$1(W15, 18) ^ (W15 >>> 3);
23423
- const s1 = rotr$1(W2, 17) ^ rotr$1(W2, 19) ^ (W2 >>> 10);
23424
- SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
23425
- }
23426
- // Compression function main loop, 64 rounds
23427
- let { A, B, C, D, E, F, G, H } = this;
23428
- for (let i = 0; i < 64; i++) {
23429
- const sigma1 = rotr$1(E, 6) ^ rotr$1(E, 11) ^ rotr$1(E, 25);
23430
- const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
23431
- const sigma0 = rotr$1(A, 2) ^ rotr$1(A, 13) ^ rotr$1(A, 22);
23432
- const T2 = (sigma0 + Maj(A, B, C)) | 0;
23433
- H = G;
23434
- G = F;
23435
- F = E;
23436
- E = (D + T1) | 0;
23437
- D = C;
23438
- C = B;
23439
- B = A;
23440
- A = (T1 + T2) | 0;
23441
- }
23442
- // Add the compressed chunk to the current hash value
23443
- A = (A + this.A) | 0;
23444
- B = (B + this.B) | 0;
23445
- C = (C + this.C) | 0;
23446
- D = (D + this.D) | 0;
23447
- E = (E + this.E) | 0;
23448
- F = (F + this.F) | 0;
23449
- G = (G + this.G) | 0;
23450
- H = (H + this.H) | 0;
23451
- this.set(A, B, C, D, E, F, G, H);
23452
- }
23453
- roundClean() {
23454
- SHA256_W.fill(0);
23455
- }
23456
- destroy() {
23457
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
23458
- this.buffer.fill(0);
23459
- }
23460
- }
23461
- /**
23462
- * SHA2-256 hash function
23463
- * @param message - data that would be hashed
23464
- */
23465
- const sha256 = /* @__PURE__ */ wrapConstructor$1(() => new SHA256());
23081
+ const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
23466
23082
 
23467
23083
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
23468
23084
  // Short Weierstrass curve. The formula is: y² = x³ + ax + b
@@ -24395,14 +24011,14 @@ var solanaWeb3 = (function (exports) {
24395
24011
  }
24396
24012
 
24397
24013
  // HMAC (RFC 2104)
24398
- class HMAC extends Hash$1 {
24399
- constructor(hash, _key) {
24014
+ class HMAC extends Hash {
24015
+ constructor(hash$1, _key) {
24400
24016
  super();
24401
24017
  this.finished = false;
24402
24018
  this.destroyed = false;
24403
- hash$1(hash);
24404
- const key = toBytes$1(_key);
24405
- this.iHash = hash.create();
24019
+ hash(hash$1);
24020
+ const key = toBytes(_key);
24021
+ this.iHash = hash$1.create();
24406
24022
  if (typeof this.iHash.update !== 'function')
24407
24023
  throw new Error('Expected instance of class which extends utils.Hash');
24408
24024
  this.blockLen = this.iHash.blockLen;
@@ -24410,12 +24026,12 @@ var solanaWeb3 = (function (exports) {
24410
24026
  const blockLen = this.blockLen;
24411
24027
  const pad = new Uint8Array(blockLen);
24412
24028
  // blockLen can be bigger than outputLen
24413
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
24029
+ pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key);
24414
24030
  for (let i = 0; i < pad.length; i++)
24415
24031
  pad[i] ^= 0x36;
24416
24032
  this.iHash.update(pad);
24417
24033
  // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
24418
- this.oHash = hash.create();
24034
+ this.oHash = hash$1.create();
24419
24035
  // Undo internal XOR && apply outer XOR
24420
24036
  for (let i = 0; i < pad.length; i++)
24421
24037
  pad[i] ^= 0x36 ^ 0x5c;
@@ -24423,13 +24039,13 @@ var solanaWeb3 = (function (exports) {
24423
24039
  pad.fill(0);
24424
24040
  }
24425
24041
  update(buf) {
24426
- exists$1(this);
24042
+ exists(this);
24427
24043
  this.iHash.update(buf);
24428
24044
  return this;
24429
24045
  }
24430
24046
  digestInto(out) {
24431
- exists$1(this);
24432
- bytes$1(out, this.outputLen);
24047
+ exists(this);
24048
+ bytes(out, this.outputLen);
24433
24049
  this.finished = true;
24434
24050
  this.iHash.digestInto(out);
24435
24051
  this.oHash.update(out);
@@ -25232,7 +24848,7 @@ var solanaWeb3 = (function (exports) {
25232
24848
  if (custodianPubkey) {
25233
24849
  keys.push({
25234
24850
  pubkey: custodianPubkey,
25235
- isSigner: false,
24851
+ isSigner: true,
25236
24852
  isWritable: false
25237
24853
  });
25238
24854
  }
@@ -25280,7 +24896,7 @@ var solanaWeb3 = (function (exports) {
25280
24896
  if (custodianPubkey) {
25281
24897
  keys.push({
25282
24898
  pubkey: custodianPubkey,
25283
- isSigner: false,
24899
+ isSigner: true,
25284
24900
  isWritable: false
25285
24901
  });
25286
24902
  }
@@ -25445,7 +25061,7 @@ var solanaWeb3 = (function (exports) {
25445
25061
  if (custodianPubkey) {
25446
25062
  keys.push({
25447
25063
  pubkey: custodianPubkey,
25448
- isSigner: false,
25064
+ isSigner: true,
25449
25065
  isWritable: false
25450
25066
  });
25451
25067
  }