@solana/web3.js 1.87.6 → 1.88.0

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
  }
@@ -12531,6 +12314,8 @@ var solanaWeb3 = (function (exports) {
12531
12314
  }
12532
12315
  };
12533
12316
 
12317
+ /** @internal */
12318
+
12534
12319
  /**
12535
12320
  * Transaction signature as base-58 encoded string
12536
12321
  */
@@ -13146,29 +12931,31 @@ var solanaWeb3 = (function (exports) {
13146
12931
  *
13147
12932
  * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
13148
12933
  */
13149
- verifySignatures(requireAllSignatures) {
13150
- return this._verifySignatures(this.serializeMessage(), requireAllSignatures === undefined ? true : requireAllSignatures);
12934
+ verifySignatures(requireAllSignatures = true) {
12935
+ const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
12936
+ return !signatureErrors;
13151
12937
  }
13152
12938
 
13153
12939
  /**
13154
12940
  * @internal
13155
12941
  */
13156
- _verifySignatures(signData, requireAllSignatures) {
12942
+ _getMessageSignednessErrors(message, requireAllSignatures) {
12943
+ const errors = {};
13157
12944
  for (const {
13158
12945
  signature,
13159
12946
  publicKey
13160
12947
  } of this.signatures) {
13161
12948
  if (signature === null) {
13162
12949
  if (requireAllSignatures) {
13163
- return false;
12950
+ (errors.missing ||= []).push(publicKey);
13164
12951
  }
13165
12952
  } else {
13166
- if (!verify(signature, signData, publicKey.toBytes())) {
13167
- return false;
12953
+ if (!verify(signature, message, publicKey.toBytes())) {
12954
+ (errors.invalid ||= []).push(publicKey);
13168
12955
  }
13169
12956
  }
13170
12957
  }
13171
- return true;
12958
+ return errors.invalid || errors.missing ? errors : undefined;
13172
12959
  }
13173
12960
 
13174
12961
  /**
@@ -13187,8 +12974,18 @@ var solanaWeb3 = (function (exports) {
13187
12974
  verifySignatures: true
13188
12975
  }, config);
13189
12976
  const signData = this.serializeMessage();
13190
- if (verifySignatures && !this._verifySignatures(signData, requireAllSignatures)) {
13191
- throw new Error('Signature verification failed');
12977
+ if (verifySignatures) {
12978
+ const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
12979
+ if (sigErrors) {
12980
+ let errorMessage = 'Signature verification failed.';
12981
+ if (sigErrors.invalid) {
12982
+ errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
12983
+ }
12984
+ if (sigErrors.missing) {
12985
+ errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
12986
+ }
12987
+ throw new Error(errorMessage);
12988
+ }
13192
12989
  }
13193
12990
  return this._serialize(signData);
13194
12991
  }
@@ -13728,7 +13525,7 @@ var solanaWeb3 = (function (exports) {
13728
13525
  };
13729
13526
  return bigIntLayout;
13730
13527
  };
13731
- const u64$2 = bigInt(8);
13528
+ const u64 = bigInt(8);
13732
13529
 
13733
13530
  /**
13734
13531
  * Create account system transaction params
@@ -14069,7 +13866,7 @@ var solanaWeb3 = (function (exports) {
14069
13866
  },
14070
13867
  Transfer: {
14071
13868
  index: 2,
14072
- layout: struct([u32('instruction'), u64$2('lamports')])
13869
+ layout: struct([u32('instruction'), u64('lamports')])
14073
13870
  },
14074
13871
  CreateWithSeed: {
14075
13872
  index: 3,
@@ -14105,7 +13902,7 @@ var solanaWeb3 = (function (exports) {
14105
13902
  },
14106
13903
  TransferWithSeed: {
14107
13904
  index: 11,
14108
- layout: struct([u32('instruction'), u64$2('lamports'), rustString('seed'), publicKey('programId')])
13905
+ layout: struct([u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])
14109
13906
  },
14110
13907
  UpgradeNonceAccount: {
14111
13908
  index: 12,
@@ -18005,7 +17802,7 @@ var solanaWeb3 = (function (exports) {
18005
17802
  }
18006
17803
  const LookupTableMetaLayout = {
18007
17804
  index: 1,
18008
- layout: struct([u32('typeIndex'), u64$2('deactivationSlot'), nu64('lastExtendedSlot'), u8('lastExtendedStartIndex'), u8(),
17805
+ layout: struct([u32('typeIndex'), u64('deactivationSlot'), nu64('lastExtendedSlot'), u8('lastExtendedStartIndex'), u8(),
18009
17806
  // option
18010
17807
  seq(publicKey(), offset(u8(), -1), 'authority')])
18011
17808
  };
@@ -22549,7 +22346,7 @@ var solanaWeb3 = (function (exports) {
22549
22346
  const LOOKUP_TABLE_INSTRUCTION_LAYOUTS = Object.freeze({
22550
22347
  CreateLookupTable: {
22551
22348
  index: 0,
22552
- layout: struct([u32('instruction'), u64$2('recentSlot'), u8('bumpSeed')])
22349
+ layout: struct([u32('instruction'), u64('recentSlot'), u8('bumpSeed')])
22553
22350
  },
22554
22351
  FreezeLookupTable: {
22555
22352
  index: 1,
@@ -22557,7 +22354,7 @@ var solanaWeb3 = (function (exports) {
22557
22354
  },
22558
22355
  ExtendLookupTable: {
22559
22356
  index: 2,
22560
- layout: struct([u32('instruction'), u64$2(), seq(publicKey(), offset(u32(), -8), 'addresses')])
22357
+ layout: struct([u32('instruction'), u64(), seq(publicKey(), offset(u32(), -8), 'addresses')])
22561
22358
  },
22562
22359
  DeactivateLookupTable: {
22563
22360
  index: 3,
@@ -22918,7 +22715,7 @@ var solanaWeb3 = (function (exports) {
22918
22715
  },
22919
22716
  SetComputeUnitPrice: {
22920
22717
  index: 3,
22921
- layout: struct([u8('instruction'), u64$2('microLamports')])
22718
+ layout: struct([u8('instruction'), u64('microLamports')])
22922
22719
  }
22923
22720
  });
22924
22721
 
@@ -23072,75 +22869,16 @@ var solanaWeb3 = (function (exports) {
23072
22869
  }
23073
22870
  Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');
23074
22871
 
23075
- const U32_MASK64 = BigInt(2 ** 32 - 1);
23076
- const _32n = BigInt(32);
23077
- // We are not using BigUint64Array, because they are extremely slow as per 2022
23078
- function fromBig(n, le = false) {
23079
- if (le)
23080
- return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
23081
- return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
23082
- }
23083
- function split(lst, le = false) {
23084
- let Ah = new Uint32Array(lst.length);
23085
- let Al = new Uint32Array(lst.length);
23086
- for (let i = 0; i < lst.length; i++) {
23087
- const { h, l } = fromBig(lst[i], le);
23088
- [Ah[i], Al[i]] = [h, l];
23089
- }
23090
- return [Ah, Al];
23091
- }
23092
- const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
23093
- // for Shift in [0, 32)
23094
- const shrSH = (h, l, s) => h >>> s;
23095
- const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
23096
- // Right rotate for Shift in [1, 32)
23097
- const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
23098
- const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
23099
- // Right rotate for Shift in (32, 64), NOTE: 32 is special case.
23100
- const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
23101
- const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
23102
- // Right rotate for shift===32 (just swaps l&h)
23103
- const rotr32H = (h, l) => l;
23104
- const rotr32L = (h, l) => h;
23105
- // Left rotate for Shift in [1, 32)
23106
- const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
23107
- const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
23108
- // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
23109
- const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
23110
- const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
23111
- // JS uses 32-bit signed integers for bitwise operations which means we cannot
23112
- // simple take carry out of low bit sum by shift, we need to use division.
23113
- // Removing "export" has 5% perf penalty -_-
23114
- function add(Ah, Al, Bh, Bl) {
23115
- const l = (Al >>> 0) + (Bl >>> 0);
23116
- return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
23117
- }
23118
- // Addition with more than 2 elements
23119
- const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
23120
- const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
23121
- const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
23122
- const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
23123
- const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
23124
- const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
23125
- // prettier-ignore
23126
- const u64 = {
23127
- fromBig, split, toBig,
23128
- shrSH, shrSL,
23129
- rotrSH, rotrSL, rotrBH, rotrBL,
23130
- rotr32H, rotr32L,
23131
- rotlSH, rotlSL, rotlBH, rotlBL,
23132
- add, add3L, add3H, add4L, add4H, add5H, add5L,
23133
- };
23134
- var u64$1 = u64;
23135
-
22872
+ // SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.
22873
+ // It's called a sponge function.
23136
22874
  // Various per round constants calculations
23137
22875
  const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
23138
- const _0n$1 = BigInt(0);
23139
- const _1n$2 = BigInt(1);
23140
- const _2n$1 = BigInt(2);
23141
- const _7n = BigInt(7);
23142
- const _256n = BigInt(256);
23143
- const _0x71n = BigInt(0x71);
22876
+ const _0n$1 = /* @__PURE__ */ BigInt(0);
22877
+ const _1n$2 = /* @__PURE__ */ BigInt(1);
22878
+ const _2n$1 = /* @__PURE__ */ BigInt(2);
22879
+ const _7n = /* @__PURE__ */ BigInt(7);
22880
+ const _256n = /* @__PURE__ */ BigInt(256);
22881
+ const _0x71n = /* @__PURE__ */ BigInt(0x71);
23144
22882
  for (let round = 0, R = _1n$2, x = 1, y = 0; round < 24; round++) {
23145
22883
  // Pi
23146
22884
  [x, y] = [y, (2 * x + 3 * y) % 5];
@@ -23152,14 +22890,14 @@ var solanaWeb3 = (function (exports) {
23152
22890
  for (let j = 0; j < 7; j++) {
23153
22891
  R = ((R << _1n$2) ^ ((R >> _7n) * _0x71n)) % _256n;
23154
22892
  if (R & _2n$1)
23155
- t ^= _1n$2 << ((_1n$2 << BigInt(j)) - _1n$2);
22893
+ t ^= _1n$2 << ((_1n$2 << /* @__PURE__ */ BigInt(j)) - _1n$2);
23156
22894
  }
23157
22895
  _SHA3_IOTA.push(t);
23158
22896
  }
23159
- const [SHA3_IOTA_H, SHA3_IOTA_L] = u64$1.split(_SHA3_IOTA, true);
22897
+ const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
23160
22898
  // Left rotation (without 0, 32, 64)
23161
- const rotlH = (h, l, s) => s > 32 ? u64$1.rotlBH(h, l, s) : u64$1.rotlSH(h, l, s);
23162
- const rotlL = (h, l, s) => s > 32 ? u64$1.rotlBL(h, l, s) : u64$1.rotlSL(h, l, s);
22899
+ const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
22900
+ const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
23163
22901
  // Same as keccakf1600, but allows to skip some rounds
23164
22902
  function keccakP(s, rounds = 24) {
23165
22903
  const B = new Uint32Array(5 * 2);
@@ -23220,7 +22958,7 @@ var solanaWeb3 = (function (exports) {
23220
22958
  this.finished = false;
23221
22959
  this.destroyed = false;
23222
22960
  // Can be passed from user as dkLen
23223
- assert$3.number(outputLen);
22961
+ number$1(outputLen);
23224
22962
  // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
23225
22963
  if (0 >= this.blockLen || this.blockLen >= 200)
23226
22964
  throw new Error('Sha3 supports only keccak-f1600 function');
@@ -23233,7 +22971,7 @@ var solanaWeb3 = (function (exports) {
23233
22971
  this.pos = 0;
23234
22972
  }
23235
22973
  update(data) {
23236
- assert$3.exists(this);
22974
+ exists(this);
23237
22975
  const { blockLen, state } = this;
23238
22976
  data = toBytes(data);
23239
22977
  const len = data.length;
@@ -23259,8 +22997,8 @@ var solanaWeb3 = (function (exports) {
23259
22997
  this.keccak();
23260
22998
  }
23261
22999
  writeInto(out) {
23262
- assert$3.exists(this, false);
23263
- assert$3.bytes(out);
23000
+ exists(this, false);
23001
+ bytes(out);
23264
23002
  this.finish();
23265
23003
  const bufferOut = this.state;
23266
23004
  const { blockLen } = this;
@@ -23281,11 +23019,11 @@ var solanaWeb3 = (function (exports) {
23281
23019
  return this.writeInto(out);
23282
23020
  }
23283
23021
  xof(bytes) {
23284
- assert$3.number(bytes);
23022
+ number$1(bytes);
23285
23023
  return this.xofInto(new Uint8Array(bytes));
23286
23024
  }
23287
23025
  digestInto(out) {
23288
- assert$3.output(out, this);
23026
+ output(out, this);
23289
23027
  if (this.finished)
23290
23028
  throw new Error('digest() was already called');
23291
23029
  this.writeInto(out);
@@ -23316,133 +23054,11 @@ var solanaWeb3 = (function (exports) {
23316
23054
  }
23317
23055
  }
23318
23056
  const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
23319
- gen(0x06, 144, 224 / 8);
23320
- /**
23321
- * SHA3-256 hash function
23322
- * @param message - that would be hashed
23323
- */
23324
- gen(0x06, 136, 256 / 8);
23325
- gen(0x06, 104, 384 / 8);
23326
- gen(0x06, 72, 512 / 8);
23327
- gen(0x01, 144, 224 / 8);
23328
23057
  /**
23329
23058
  * keccak-256 hash function. Different from SHA3-256.
23330
23059
  * @param message - that would be hashed
23331
23060
  */
23332
- const keccak_256 = gen(0x01, 136, 256 / 8);
23333
- gen(0x01, 104, 384 / 8);
23334
- gen(0x01, 72, 512 / 8);
23335
- const genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
23336
- genShake(0x1f, 168, 128 / 8);
23337
- genShake(0x1f, 136, 256 / 8);
23338
-
23339
- // SHA2-256 need to try 2^128 hashes to execute birthday attack.
23340
- // BTC network is doing 2^67 hashes/sec as per early 2023.
23341
- // Choice: a ? b : c
23342
- const Chi = (a, b, c) => (a & b) ^ (~a & c);
23343
- // Majority function, true if any two inpust is true
23344
- const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
23345
- // Round constants:
23346
- // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
23347
- // prettier-ignore
23348
- const SHA256_K = /* @__PURE__ */ new Uint32Array([
23349
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
23350
- 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
23351
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
23352
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
23353
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
23354
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
23355
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
23356
- 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
23357
- ]);
23358
- // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):
23359
- // prettier-ignore
23360
- const IV = /* @__PURE__ */ new Uint32Array([
23361
- 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
23362
- ]);
23363
- // Temporary buffer, not used to store anything between runs
23364
- // Named this way because it matches specification.
23365
- const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
23366
- class SHA256 extends SHA2$1 {
23367
- constructor() {
23368
- super(64, 32, 8, false);
23369
- // We cannot use array here since array allows indexing by variable
23370
- // which means optimizer/compiler cannot use registers.
23371
- this.A = IV[0] | 0;
23372
- this.B = IV[1] | 0;
23373
- this.C = IV[2] | 0;
23374
- this.D = IV[3] | 0;
23375
- this.E = IV[4] | 0;
23376
- this.F = IV[5] | 0;
23377
- this.G = IV[6] | 0;
23378
- this.H = IV[7] | 0;
23379
- }
23380
- get() {
23381
- const { A, B, C, D, E, F, G, H } = this;
23382
- return [A, B, C, D, E, F, G, H];
23383
- }
23384
- // prettier-ignore
23385
- set(A, B, C, D, E, F, G, H) {
23386
- this.A = A | 0;
23387
- this.B = B | 0;
23388
- this.C = C | 0;
23389
- this.D = D | 0;
23390
- this.E = E | 0;
23391
- this.F = F | 0;
23392
- this.G = G | 0;
23393
- this.H = H | 0;
23394
- }
23395
- process(view, offset) {
23396
- // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
23397
- for (let i = 0; i < 16; i++, offset += 4)
23398
- SHA256_W[i] = view.getUint32(offset, false);
23399
- for (let i = 16; i < 64; i++) {
23400
- const W15 = SHA256_W[i - 15];
23401
- const W2 = SHA256_W[i - 2];
23402
- const s0 = rotr$1(W15, 7) ^ rotr$1(W15, 18) ^ (W15 >>> 3);
23403
- const s1 = rotr$1(W2, 17) ^ rotr$1(W2, 19) ^ (W2 >>> 10);
23404
- SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
23405
- }
23406
- // Compression function main loop, 64 rounds
23407
- let { A, B, C, D, E, F, G, H } = this;
23408
- for (let i = 0; i < 64; i++) {
23409
- const sigma1 = rotr$1(E, 6) ^ rotr$1(E, 11) ^ rotr$1(E, 25);
23410
- const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
23411
- const sigma0 = rotr$1(A, 2) ^ rotr$1(A, 13) ^ rotr$1(A, 22);
23412
- const T2 = (sigma0 + Maj(A, B, C)) | 0;
23413
- H = G;
23414
- G = F;
23415
- F = E;
23416
- E = (D + T1) | 0;
23417
- D = C;
23418
- C = B;
23419
- B = A;
23420
- A = (T1 + T2) | 0;
23421
- }
23422
- // Add the compressed chunk to the current hash value
23423
- A = (A + this.A) | 0;
23424
- B = (B + this.B) | 0;
23425
- C = (C + this.C) | 0;
23426
- D = (D + this.D) | 0;
23427
- E = (E + this.E) | 0;
23428
- F = (F + this.F) | 0;
23429
- G = (G + this.G) | 0;
23430
- H = (H + this.H) | 0;
23431
- this.set(A, B, C, D, E, F, G, H);
23432
- }
23433
- roundClean() {
23434
- SHA256_W.fill(0);
23435
- }
23436
- destroy() {
23437
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
23438
- this.buffer.fill(0);
23439
- }
23440
- }
23441
- /**
23442
- * SHA2-256 hash function
23443
- * @param message - data that would be hashed
23444
- */
23445
- const sha256 = /* @__PURE__ */ wrapConstructor$1(() => new SHA256());
23061
+ const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
23446
23062
 
23447
23063
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
23448
23064
  // Short Weierstrass curve. The formula is: y² = x³ + ax + b
@@ -24375,14 +23991,14 @@ var solanaWeb3 = (function (exports) {
24375
23991
  }
24376
23992
 
24377
23993
  // HMAC (RFC 2104)
24378
- class HMAC extends Hash$1 {
24379
- constructor(hash, _key) {
23994
+ class HMAC extends Hash {
23995
+ constructor(hash$1, _key) {
24380
23996
  super();
24381
23997
  this.finished = false;
24382
23998
  this.destroyed = false;
24383
- hash$1(hash);
24384
- const key = toBytes$1(_key);
24385
- this.iHash = hash.create();
23999
+ hash(hash$1);
24000
+ const key = toBytes(_key);
24001
+ this.iHash = hash$1.create();
24386
24002
  if (typeof this.iHash.update !== 'function')
24387
24003
  throw new Error('Expected instance of class which extends utils.Hash');
24388
24004
  this.blockLen = this.iHash.blockLen;
@@ -24390,12 +24006,12 @@ var solanaWeb3 = (function (exports) {
24390
24006
  const blockLen = this.blockLen;
24391
24007
  const pad = new Uint8Array(blockLen);
24392
24008
  // blockLen can be bigger than outputLen
24393
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
24009
+ pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key);
24394
24010
  for (let i = 0; i < pad.length; i++)
24395
24011
  pad[i] ^= 0x36;
24396
24012
  this.iHash.update(pad);
24397
24013
  // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
24398
- this.oHash = hash.create();
24014
+ this.oHash = hash$1.create();
24399
24015
  // Undo internal XOR && apply outer XOR
24400
24016
  for (let i = 0; i < pad.length; i++)
24401
24017
  pad[i] ^= 0x36 ^ 0x5c;
@@ -24403,13 +24019,13 @@ var solanaWeb3 = (function (exports) {
24403
24019
  pad.fill(0);
24404
24020
  }
24405
24021
  update(buf) {
24406
- exists$1(this);
24022
+ exists(this);
24407
24023
  this.iHash.update(buf);
24408
24024
  return this;
24409
24025
  }
24410
24026
  digestInto(out) {
24411
- exists$1(this);
24412
- bytes$1(out, this.outputLen);
24027
+ exists(this);
24028
+ bytes(out, this.outputLen);
24413
24029
  this.finished = true;
24414
24030
  this.iHash.digestInto(out);
24415
24031
  this.oHash.update(out);
@@ -25212,7 +24828,7 @@ var solanaWeb3 = (function (exports) {
25212
24828
  if (custodianPubkey) {
25213
24829
  keys.push({
25214
24830
  pubkey: custodianPubkey,
25215
- isSigner: false,
24831
+ isSigner: true,
25216
24832
  isWritable: false
25217
24833
  });
25218
24834
  }
@@ -25260,7 +24876,7 @@ var solanaWeb3 = (function (exports) {
25260
24876
  if (custodianPubkey) {
25261
24877
  keys.push({
25262
24878
  pubkey: custodianPubkey,
25263
- isSigner: false,
24879
+ isSigner: true,
25264
24880
  isWritable: false
25265
24881
  });
25266
24882
  }
@@ -25425,7 +25041,7 @@ var solanaWeb3 = (function (exports) {
25425
25041
  if (custodianPubkey) {
25426
25042
  keys.push({
25427
25043
  pubkey: custodianPubkey,
25428
- isSigner: false,
25044
+ isSigner: true,
25429
25045
  isWritable: false
25430
25046
  });
25431
25047
  }