@solana/web3.js 1.87.6 → 1.89.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/README.md +1 -1
- package/lib/index.browser.cjs.js +90 -31
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +90 -31
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +108 -1645
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +105 -1640
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +268 -607
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +7 -8
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +90 -31
- package/lib/index.native.js.map +1 -1
- package/package.json +29 -29
- package/src/connection.ts +4 -6
- package/src/programs/stake.ts +3 -3
- package/src/transaction/legacy.ts +37 -15
package/lib/index.iife.js
CHANGED
|
@@ -2381,30 +2381,30 @@ var solanaWeb3 = (function (exports) {
|
|
|
2381
2381
|
}
|
|
2382
2382
|
} (buffer));
|
|
2383
2383
|
|
|
2384
|
-
function number$
|
|
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
|
|
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
|
|
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$
|
|
2398
|
-
number$
|
|
2397
|
+
number$1(hash.outputLen);
|
|
2398
|
+
number$1(hash.blockLen);
|
|
2399
2399
|
}
|
|
2400
|
-
function exists
|
|
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
|
|
2407
|
-
bytes
|
|
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$
|
|
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
|
|
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
|
|
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
|
|
2431
|
-
if (!isLE
|
|
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$
|
|
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
|
|
2447
|
+
function toBytes(data) {
|
|
2447
2448
|
if (typeof data === 'string')
|
|
2448
|
-
data = utf8ToBytes$
|
|
2449
|
-
if (!u8a$
|
|
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$
|
|
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
|
-
|
|
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
|
|
2475
|
-
const hashC = (msg) => hashCons().update(toBytes
|
|
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
|
|
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
|
-
|
|
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
|
|
2519
|
+
this.view = createView(this.buffer);
|
|
2519
2520
|
}
|
|
2520
2521
|
update(data) {
|
|
2521
|
-
exists
|
|
2522
|
+
exists(this);
|
|
2522
2523
|
const { view, buffer, blockLen } = this;
|
|
2523
|
-
data = toBytes
|
|
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
|
|
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
|
|
2548
|
-
output
|
|
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
|
|
2570
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
2570
2571
|
this.process(view, 0);
|
|
2571
|
-
const oview = createView
|
|
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
|
|
2605
|
-
const _32n
|
|
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
|
|
2608
|
+
function fromBig(n, le = false) {
|
|
2608
2609
|
if (le)
|
|
2609
|
-
return { h: Number(n & U32_MASK64
|
|
2610
|
-
return { h: Number((n >> _32n
|
|
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
|
|
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
|
|
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
|
|
2622
|
+
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
|
2622
2623
|
// for Shift in [0, 32)
|
|
2623
|
-
const shrSH
|
|
2624
|
-
const shrSL
|
|
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
|
|
2627
|
-
const rotrSL
|
|
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
|
|
2630
|
-
const rotrBL
|
|
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
|
|
2633
|
-
const rotr32L
|
|
2633
|
+
const rotr32H = (_h, l) => l;
|
|
2634
|
+
const rotr32L = (h, _l) => h;
|
|
2634
2635
|
// Left rotate for Shift in [1, 32)
|
|
2635
|
-
const rotlSH
|
|
2636
|
-
const rotlSL
|
|
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
|
|
2639
|
-
const rotlBL
|
|
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
|
|
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
|
|
2648
|
-
const add3H
|
|
2649
|
-
const add4L
|
|
2650
|
-
const add4H
|
|
2651
|
-
const add5L
|
|
2652
|
-
const add5H
|
|
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$
|
|
2655
|
-
fromBig
|
|
2656
|
-
shrSH
|
|
2657
|
-
rotrSH
|
|
2658
|
-
rotr32H
|
|
2659
|
-
rotlSH
|
|
2660
|
-
add
|
|
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$
|
|
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$
|
|
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
|
|
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$
|
|
2750
|
-
const s0l = u64$
|
|
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$
|
|
2755
|
-
const s1l = u64$
|
|
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$
|
|
2758
|
-
const SUMh = u64$
|
|
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$
|
|
2767
|
-
const sigma1l = u64$
|
|
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$
|
|
2774
|
-
const T1h = u64$
|
|
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$
|
|
2778
|
-
const sigma0l = u64$
|
|
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$
|
|
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$
|
|
2795
|
-
Ah = u64$
|
|
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$
|
|
2800
|
-
({ h: Bh, l: Bl } = u64$
|
|
2801
|
-
({ h: Ch, l: Cl } = u64$
|
|
2802
|
-
({ h: Dh, l: Dl } = u64$
|
|
2803
|
-
({ h: Eh, l: El } = u64$
|
|
2804
|
-
({ h: Fh, l: Fl } = u64$
|
|
2805
|
-
({ h: Gh, l: Gl } = u64$
|
|
2806
|
-
({ h: Hh, l: Hl } = u64$
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
7761
|
-
|
|
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
|
|
7778
|
+
const Chi = (a, b, c) => (a & b) ^ (~a & c);
|
|
7980
7779
|
// Majority function, true if any two inpust is true
|
|
7981
|
-
const Maj
|
|
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
|
|
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
|
|
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
|
|
8003
|
-
|
|
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
|
|
8009
|
-
this.B = IV
|
|
8010
|
-
this.C = IV
|
|
8011
|
-
this.D = IV
|
|
8012
|
-
this.E = IV
|
|
8013
|
-
this.F = IV
|
|
8014
|
-
this.G = IV
|
|
8015
|
-
this.H = IV
|
|
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
|
|
7834
|
+
SHA256_W[i] = view.getUint32(offset, false);
|
|
8036
7835
|
for (let i = 16; i < 64; i++) {
|
|
8037
|
-
const W15 = SHA256_W
|
|
8038
|
-
const W2 = SHA256_W
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
*/
|
|
@@ -12620,20 +12405,25 @@ var solanaWeb3 = (function (exports) {
|
|
|
12620
12405
|
// For backward compatibility; an unfortunate consequence of being
|
|
12621
12406
|
// forced to over-export types by the documentation generator.
|
|
12622
12407
|
// See https://github.com/solana-labs/solana/pull/25820
|
|
12408
|
+
|
|
12623
12409
|
/**
|
|
12624
12410
|
* Blockhash-based transactions have a lifetime that are defined by
|
|
12625
12411
|
* the blockhash they include. Any transaction whose blockhash is
|
|
12626
12412
|
* too old will be rejected.
|
|
12627
12413
|
*/
|
|
12414
|
+
|
|
12628
12415
|
/**
|
|
12629
12416
|
* Use these options to construct a durable nonce transaction.
|
|
12630
12417
|
*/
|
|
12418
|
+
|
|
12631
12419
|
/**
|
|
12632
12420
|
* Nonce information to be used to build an offline Transaction.
|
|
12633
12421
|
*/
|
|
12422
|
+
|
|
12634
12423
|
/**
|
|
12635
12424
|
* @internal
|
|
12636
12425
|
*/
|
|
12426
|
+
|
|
12637
12427
|
/**
|
|
12638
12428
|
* Transaction class
|
|
12639
12429
|
*/
|
|
@@ -13146,29 +12936,31 @@ var solanaWeb3 = (function (exports) {
|
|
|
13146
12936
|
*
|
|
13147
12937
|
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
|
|
13148
12938
|
*/
|
|
13149
|
-
verifySignatures(requireAllSignatures) {
|
|
13150
|
-
|
|
12939
|
+
verifySignatures(requireAllSignatures = true) {
|
|
12940
|
+
const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
|
|
12941
|
+
return !signatureErrors;
|
|
13151
12942
|
}
|
|
13152
12943
|
|
|
13153
12944
|
/**
|
|
13154
12945
|
* @internal
|
|
13155
12946
|
*/
|
|
13156
|
-
|
|
12947
|
+
_getMessageSignednessErrors(message, requireAllSignatures) {
|
|
12948
|
+
const errors = {};
|
|
13157
12949
|
for (const {
|
|
13158
12950
|
signature,
|
|
13159
12951
|
publicKey
|
|
13160
12952
|
} of this.signatures) {
|
|
13161
12953
|
if (signature === null) {
|
|
13162
12954
|
if (requireAllSignatures) {
|
|
13163
|
-
|
|
12955
|
+
(errors.missing ||= []).push(publicKey);
|
|
13164
12956
|
}
|
|
13165
12957
|
} else {
|
|
13166
|
-
if (!verify(signature,
|
|
13167
|
-
|
|
12958
|
+
if (!verify(signature, message, publicKey.toBytes())) {
|
|
12959
|
+
(errors.invalid ||= []).push(publicKey);
|
|
13168
12960
|
}
|
|
13169
12961
|
}
|
|
13170
12962
|
}
|
|
13171
|
-
return
|
|
12963
|
+
return errors.invalid || errors.missing ? errors : undefined;
|
|
13172
12964
|
}
|
|
13173
12965
|
|
|
13174
12966
|
/**
|
|
@@ -13187,8 +12979,18 @@ var solanaWeb3 = (function (exports) {
|
|
|
13187
12979
|
verifySignatures: true
|
|
13188
12980
|
}, config);
|
|
13189
12981
|
const signData = this.serializeMessage();
|
|
13190
|
-
if (verifySignatures
|
|
13191
|
-
|
|
12982
|
+
if (verifySignatures) {
|
|
12983
|
+
const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
|
|
12984
|
+
if (sigErrors) {
|
|
12985
|
+
let errorMessage = 'Signature verification failed.';
|
|
12986
|
+
if (sigErrors.invalid) {
|
|
12987
|
+
errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
12988
|
+
}
|
|
12989
|
+
if (sigErrors.missing) {
|
|
12990
|
+
errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
12991
|
+
}
|
|
12992
|
+
throw new Error(errorMessage);
|
|
12993
|
+
}
|
|
13192
12994
|
}
|
|
13193
12995
|
return this._serialize(signData);
|
|
13194
12996
|
}
|
|
@@ -13728,7 +13530,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
13728
13530
|
};
|
|
13729
13531
|
return bigIntLayout;
|
|
13730
13532
|
};
|
|
13731
|
-
const u64
|
|
13533
|
+
const u64 = bigInt(8);
|
|
13732
13534
|
|
|
13733
13535
|
/**
|
|
13734
13536
|
* Create account system transaction params
|
|
@@ -14069,7 +13871,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
14069
13871
|
},
|
|
14070
13872
|
Transfer: {
|
|
14071
13873
|
index: 2,
|
|
14072
|
-
layout: struct([u32('instruction'), u64
|
|
13874
|
+
layout: struct([u32('instruction'), u64('lamports')])
|
|
14073
13875
|
},
|
|
14074
13876
|
CreateWithSeed: {
|
|
14075
13877
|
index: 3,
|
|
@@ -14105,7 +13907,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
14105
13907
|
},
|
|
14106
13908
|
TransferWithSeed: {
|
|
14107
13909
|
index: 11,
|
|
14108
|
-
layout: struct([u32('instruction'), u64
|
|
13910
|
+
layout: struct([u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])
|
|
14109
13911
|
},
|
|
14110
13912
|
UpgradeNonceAccount: {
|
|
14111
13913
|
index: 12,
|
|
@@ -18005,7 +17807,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18005
17807
|
}
|
|
18006
17808
|
const LookupTableMetaLayout = {
|
|
18007
17809
|
index: 1,
|
|
18008
|
-
layout: struct([u32('typeIndex'), u64
|
|
17810
|
+
layout: struct([u32('typeIndex'), u64('deactivationSlot'), nu64('lastExtendedSlot'), u8('lastExtendedStartIndex'), u8(),
|
|
18009
17811
|
// option
|
|
18010
17812
|
seq(publicKey(), offset(u8(), -1), 'authority')])
|
|
18011
17813
|
};
|
|
@@ -18254,6 +18056,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18254
18056
|
*/
|
|
18255
18057
|
|
|
18256
18058
|
// Deprecated as of v1.5.5
|
|
18059
|
+
|
|
18257
18060
|
/**
|
|
18258
18061
|
* A subset of Commitment levels, which are at least optimistically confirmed
|
|
18259
18062
|
* <pre>
|
|
@@ -18261,6 +18064,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
18261
18064
|
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
18262
18065
|
* </pre>
|
|
18263
18066
|
*/
|
|
18067
|
+
|
|
18264
18068
|
/**
|
|
18265
18069
|
* Filter for largest accounts query
|
|
18266
18070
|
* <pre>
|
|
@@ -18268,70 +18072,92 @@ var solanaWeb3 = (function (exports) {
|
|
|
18268
18072
|
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
18269
18073
|
* </pre>
|
|
18270
18074
|
*/
|
|
18075
|
+
|
|
18271
18076
|
/**
|
|
18272
18077
|
* Configuration object for changing `getAccountInfo` query behavior
|
|
18273
18078
|
*/
|
|
18079
|
+
|
|
18274
18080
|
/**
|
|
18275
18081
|
* Configuration object for changing `getBalance` query behavior
|
|
18276
18082
|
*/
|
|
18083
|
+
|
|
18277
18084
|
/**
|
|
18278
18085
|
* Configuration object for changing `getBlock` query behavior
|
|
18279
18086
|
*/
|
|
18087
|
+
|
|
18280
18088
|
/**
|
|
18281
18089
|
* Configuration object for changing `getBlock` query behavior
|
|
18282
18090
|
*/
|
|
18091
|
+
|
|
18283
18092
|
/**
|
|
18284
18093
|
* Configuration object for changing `getStakeMinimumDelegation` query behavior
|
|
18285
18094
|
*/
|
|
18095
|
+
|
|
18286
18096
|
/**
|
|
18287
18097
|
* Configuration object for changing `getBlockHeight` query behavior
|
|
18288
18098
|
*/
|
|
18099
|
+
|
|
18289
18100
|
/**
|
|
18290
18101
|
* Configuration object for changing `getEpochInfo` query behavior
|
|
18291
18102
|
*/
|
|
18103
|
+
|
|
18292
18104
|
/**
|
|
18293
18105
|
* Configuration object for changing `getInflationReward` query behavior
|
|
18294
18106
|
*/
|
|
18107
|
+
|
|
18295
18108
|
/**
|
|
18296
18109
|
* Configuration object for changing `getLatestBlockhash` query behavior
|
|
18297
18110
|
*/
|
|
18111
|
+
|
|
18298
18112
|
/**
|
|
18299
18113
|
* Configuration object for changing `isBlockhashValid` query behavior
|
|
18300
18114
|
*/
|
|
18115
|
+
|
|
18301
18116
|
/**
|
|
18302
18117
|
* Configuration object for changing `getSlot` query behavior
|
|
18303
18118
|
*/
|
|
18119
|
+
|
|
18304
18120
|
/**
|
|
18305
18121
|
* Configuration object for changing `getSlotLeader` query behavior
|
|
18306
18122
|
*/
|
|
18123
|
+
|
|
18307
18124
|
/**
|
|
18308
18125
|
* Configuration object for changing `getTransaction` query behavior
|
|
18309
18126
|
*/
|
|
18127
|
+
|
|
18310
18128
|
/**
|
|
18311
18129
|
* Configuration object for changing `getTransaction` query behavior
|
|
18312
18130
|
*/
|
|
18131
|
+
|
|
18313
18132
|
/**
|
|
18314
18133
|
* Configuration object for changing `getLargestAccounts` query behavior
|
|
18315
18134
|
*/
|
|
18135
|
+
|
|
18316
18136
|
/**
|
|
18317
18137
|
* Configuration object for changing `getSupply` request behavior
|
|
18318
18138
|
*/
|
|
18139
|
+
|
|
18319
18140
|
/**
|
|
18320
18141
|
* Configuration object for changing query behavior
|
|
18321
18142
|
*/
|
|
18143
|
+
|
|
18322
18144
|
/**
|
|
18323
18145
|
* Information describing a cluster node
|
|
18324
18146
|
*/
|
|
18147
|
+
|
|
18325
18148
|
/**
|
|
18326
18149
|
* Information describing a vote account
|
|
18327
18150
|
*/
|
|
18151
|
+
|
|
18328
18152
|
/**
|
|
18329
18153
|
* A collection of cluster vote accounts
|
|
18330
18154
|
*/
|
|
18155
|
+
|
|
18331
18156
|
/**
|
|
18332
18157
|
* Network Inflation
|
|
18333
18158
|
* (see https://docs.solana.com/implemented-proposals/ed_overview)
|
|
18334
18159
|
*/
|
|
18160
|
+
|
|
18335
18161
|
const GetInflationGovernorResult = type({
|
|
18336
18162
|
foundation: number(),
|
|
18337
18163
|
foundationTerm: number(),
|
|
@@ -20059,7 +19885,9 @@ var solanaWeb3 = (function (exports) {
|
|
|
20059
19885
|
return res.result;
|
|
20060
19886
|
}
|
|
20061
19887
|
|
|
20062
|
-
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
19888
|
+
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
19889
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
19890
|
+
|
|
20063
19891
|
// eslint-disable-next-line no-dupe-class-members
|
|
20064
19892
|
async confirmTransaction(strategy, commitment) {
|
|
20065
19893
|
let rawSignature;
|
|
@@ -20854,21 +20682,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
20854
20682
|
/**
|
|
20855
20683
|
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
20856
20684
|
* setting the `maxSupportedTransactionVersion` property.
|
|
20857
|
-
*/
|
|
20685
|
+
*/
|
|
20686
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
20687
|
+
|
|
20858
20688
|
/**
|
|
20859
20689
|
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
20860
20690
|
* setting the `maxSupportedTransactionVersion` property.
|
|
20861
20691
|
*/
|
|
20862
20692
|
// eslint-disable-next-line no-dupe-class-members
|
|
20693
|
+
|
|
20863
20694
|
/**
|
|
20864
20695
|
* Fetch a processed block from the cluster.
|
|
20865
20696
|
*/
|
|
20866
20697
|
// eslint-disable-next-line no-dupe-class-members
|
|
20698
|
+
|
|
20867
20699
|
// eslint-disable-next-line no-dupe-class-members
|
|
20700
|
+
|
|
20868
20701
|
// eslint-disable-next-line no-dupe-class-members
|
|
20702
|
+
|
|
20869
20703
|
/**
|
|
20870
20704
|
* Fetch a processed block from the cluster.
|
|
20871
|
-
*/
|
|
20705
|
+
*/
|
|
20706
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
20872
20707
|
async getBlock(slot, rawConfig) {
|
|
20873
20708
|
const {
|
|
20874
20709
|
commitment,
|
|
@@ -21007,10 +20842,13 @@ var solanaWeb3 = (function (exports) {
|
|
|
21007
20842
|
|
|
21008
20843
|
/**
|
|
21009
20844
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
21010
|
-
*/
|
|
20845
|
+
*/
|
|
20846
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
20847
|
+
|
|
21011
20848
|
/**
|
|
21012
20849
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
21013
|
-
*/
|
|
20850
|
+
*/
|
|
20851
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
21014
20852
|
async getTransaction(signature, rawConfig) {
|
|
21015
20853
|
const {
|
|
21016
20854
|
commitment,
|
|
@@ -21089,12 +20927,15 @@ var solanaWeb3 = (function (exports) {
|
|
|
21089
20927
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
21090
20928
|
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
21091
20929
|
* VersionedTransactionResponse}.
|
|
21092
|
-
*/
|
|
20930
|
+
*/
|
|
20931
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
20932
|
+
|
|
21093
20933
|
/**
|
|
21094
20934
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
21095
20935
|
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
21096
20936
|
* VersionedTransactionResponse}.
|
|
21097
|
-
*/
|
|
20937
|
+
*/
|
|
20938
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
21098
20939
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
21099
20940
|
const {
|
|
21100
20941
|
commitment,
|
|
@@ -21520,10 +21361,13 @@ var solanaWeb3 = (function (exports) {
|
|
|
21520
21361
|
|
|
21521
21362
|
/**
|
|
21522
21363
|
* Simulate a transaction
|
|
21523
|
-
*/
|
|
21364
|
+
*/
|
|
21365
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
21366
|
+
|
|
21524
21367
|
/**
|
|
21525
21368
|
* Simulate a transaction
|
|
21526
|
-
*/
|
|
21369
|
+
*/
|
|
21370
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
21527
21371
|
async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
|
|
21528
21372
|
if ('message' in transactionOrMessage) {
|
|
21529
21373
|
const versionedTx = transactionOrMessage;
|
|
@@ -21575,7 +21419,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
21575
21419
|
if (!transaction.signature) {
|
|
21576
21420
|
throw new Error('!signature'); // should never happen
|
|
21577
21421
|
}
|
|
21578
|
-
|
|
21579
21422
|
const signature = transaction.signature.toString('base64');
|
|
21580
21423
|
if (!this._blockhashInfo.simulatedSignatures.includes(signature) && !this._blockhashInfo.transactionSignatures.includes(signature)) {
|
|
21581
21424
|
// The signature of this transaction has not been seen before with the
|
|
@@ -21636,10 +21479,13 @@ var solanaWeb3 = (function (exports) {
|
|
|
21636
21479
|
|
|
21637
21480
|
/**
|
|
21638
21481
|
* Send a signed transaction
|
|
21639
|
-
*/
|
|
21482
|
+
*/
|
|
21483
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
21484
|
+
|
|
21640
21485
|
/**
|
|
21641
21486
|
* Sign and send a transaction
|
|
21642
|
-
*/
|
|
21487
|
+
*/
|
|
21488
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
21643
21489
|
async sendTransaction(transaction, signersOrOptions, options) {
|
|
21644
21490
|
if ('version' in transaction) {
|
|
21645
21491
|
if (signersOrOptions && Array.isArray(signersOrOptions)) {
|
|
@@ -21664,7 +21510,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
21664
21510
|
if (!transaction.signature) {
|
|
21665
21511
|
throw new Error('!signature'); // should never happen
|
|
21666
21512
|
}
|
|
21667
|
-
|
|
21668
21513
|
const signature = transaction.signature.toString('base64');
|
|
21669
21514
|
if (!this._blockhashInfo.transactionSignatures.includes(signature)) {
|
|
21670
21515
|
// The signature of this transaction has not been seen before with the
|
|
@@ -22048,7 +21893,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22048
21893
|
args) {
|
|
22049
21894
|
const clientSubscriptionId = this._nextClientSubscriptionId++;
|
|
22050
21895
|
const hash = fastStableStringify$1([subscriptionConfig.method, args], true /* isArrayProp */);
|
|
22051
|
-
|
|
22052
21896
|
const existingSubscription = this._subscriptionsByHash[hash];
|
|
22053
21897
|
if (existingSubscription === undefined) {
|
|
22054
21898
|
this._subscriptionsByHash[hash] = {
|
|
@@ -22131,7 +21975,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22131
21975
|
'base64' /* encoding */, filters ? {
|
|
22132
21976
|
filters: filters
|
|
22133
21977
|
} : undefined /* extra */);
|
|
22134
|
-
|
|
22135
21978
|
return this._makeSubscription({
|
|
22136
21979
|
callback,
|
|
22137
21980
|
method: 'programSubscribe',
|
|
@@ -22156,7 +21999,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22156
21999
|
mentions: [filter.toString()]
|
|
22157
22000
|
} : filter], commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
22158
22001
|
);
|
|
22159
|
-
|
|
22160
22002
|
return this._makeSubscription({
|
|
22161
22003
|
callback,
|
|
22162
22004
|
method: 'logsSubscribe',
|
|
@@ -22337,7 +22179,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22337
22179
|
onSignature(signature, callback, commitment) {
|
|
22338
22180
|
const args = this._buildArgs([signature], commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
22339
22181
|
);
|
|
22340
|
-
|
|
22341
22182
|
const clientSubscriptionId = this._makeSubscription({
|
|
22342
22183
|
callback: (notification, context) => {
|
|
22343
22184
|
if (notification.type === 'status') {
|
|
@@ -22376,7 +22217,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22376
22217
|
...options,
|
|
22377
22218
|
commitment: options && options.commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
22378
22219
|
};
|
|
22379
|
-
|
|
22380
22220
|
const args = this._buildArgs([signature], commitment, undefined /* encoding */, extra);
|
|
22381
22221
|
const clientSubscriptionId = this._makeSubscription({
|
|
22382
22222
|
callback: (notification, context) => {
|
|
@@ -22549,7 +22389,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22549
22389
|
const LOOKUP_TABLE_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
22550
22390
|
CreateLookupTable: {
|
|
22551
22391
|
index: 0,
|
|
22552
|
-
layout: struct([u32('instruction'), u64
|
|
22392
|
+
layout: struct([u32('instruction'), u64('recentSlot'), u8('bumpSeed')])
|
|
22553
22393
|
},
|
|
22554
22394
|
FreezeLookupTable: {
|
|
22555
22395
|
index: 1,
|
|
@@ -22557,7 +22397,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22557
22397
|
},
|
|
22558
22398
|
ExtendLookupTable: {
|
|
22559
22399
|
index: 2,
|
|
22560
|
-
layout: struct([u32('instruction'), u64
|
|
22400
|
+
layout: struct([u32('instruction'), u64(), seq(publicKey(), offset(u32(), -8), 'addresses')])
|
|
22561
22401
|
},
|
|
22562
22402
|
DeactivateLookupTable: {
|
|
22563
22403
|
index: 3,
|
|
@@ -22918,7 +22758,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22918
22758
|
},
|
|
22919
22759
|
SetComputeUnitPrice: {
|
|
22920
22760
|
index: 3,
|
|
22921
|
-
layout: struct([u8('instruction'), u64
|
|
22761
|
+
layout: struct([u8('instruction'), u64('microLamports')])
|
|
22922
22762
|
}
|
|
22923
22763
|
});
|
|
22924
22764
|
|
|
@@ -23072,75 +22912,16 @@ var solanaWeb3 = (function (exports) {
|
|
|
23072
22912
|
}
|
|
23073
22913
|
Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');
|
|
23074
22914
|
|
|
23075
|
-
|
|
23076
|
-
|
|
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
|
-
|
|
22915
|
+
// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.
|
|
22916
|
+
// It's called a sponge function.
|
|
23136
22917
|
// Various per round constants calculations
|
|
23137
22918
|
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);
|
|
22919
|
+
const _0n$1 = /* @__PURE__ */ BigInt(0);
|
|
22920
|
+
const _1n$2 = /* @__PURE__ */ BigInt(1);
|
|
22921
|
+
const _2n$1 = /* @__PURE__ */ BigInt(2);
|
|
22922
|
+
const _7n = /* @__PURE__ */ BigInt(7);
|
|
22923
|
+
const _256n = /* @__PURE__ */ BigInt(256);
|
|
22924
|
+
const _0x71n = /* @__PURE__ */ BigInt(0x71);
|
|
23144
22925
|
for (let round = 0, R = _1n$2, x = 1, y = 0; round < 24; round++) {
|
|
23145
22926
|
// Pi
|
|
23146
22927
|
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
@@ -23152,14 +22933,14 @@ var solanaWeb3 = (function (exports) {
|
|
|
23152
22933
|
for (let j = 0; j < 7; j++) {
|
|
23153
22934
|
R = ((R << _1n$2) ^ ((R >> _7n) * _0x71n)) % _256n;
|
|
23154
22935
|
if (R & _2n$1)
|
|
23155
|
-
t ^= _1n$2 << ((_1n$2 << BigInt(j)) - _1n$2);
|
|
22936
|
+
t ^= _1n$2 << ((_1n$2 << /* @__PURE__ */ BigInt(j)) - _1n$2);
|
|
23156
22937
|
}
|
|
23157
22938
|
_SHA3_IOTA.push(t);
|
|
23158
22939
|
}
|
|
23159
|
-
const [SHA3_IOTA_H, SHA3_IOTA_L] =
|
|
22940
|
+
const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
|
|
23160
22941
|
// Left rotation (without 0, 32, 64)
|
|
23161
|
-
const rotlH = (h, l, s) => s > 32 ?
|
|
23162
|
-
const rotlL = (h, l, s) => s > 32 ?
|
|
22942
|
+
const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
|
|
22943
|
+
const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
|
|
23163
22944
|
// Same as keccakf1600, but allows to skip some rounds
|
|
23164
22945
|
function keccakP(s, rounds = 24) {
|
|
23165
22946
|
const B = new Uint32Array(5 * 2);
|
|
@@ -23220,7 +23001,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
23220
23001
|
this.finished = false;
|
|
23221
23002
|
this.destroyed = false;
|
|
23222
23003
|
// Can be passed from user as dkLen
|
|
23223
|
-
|
|
23004
|
+
number$1(outputLen);
|
|
23224
23005
|
// 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
|
|
23225
23006
|
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
23226
23007
|
throw new Error('Sha3 supports only keccak-f1600 function');
|
|
@@ -23233,7 +23014,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
23233
23014
|
this.pos = 0;
|
|
23234
23015
|
}
|
|
23235
23016
|
update(data) {
|
|
23236
|
-
|
|
23017
|
+
exists(this);
|
|
23237
23018
|
const { blockLen, state } = this;
|
|
23238
23019
|
data = toBytes(data);
|
|
23239
23020
|
const len = data.length;
|
|
@@ -23259,8 +23040,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
23259
23040
|
this.keccak();
|
|
23260
23041
|
}
|
|
23261
23042
|
writeInto(out) {
|
|
23262
|
-
|
|
23263
|
-
|
|
23043
|
+
exists(this, false);
|
|
23044
|
+
bytes(out);
|
|
23264
23045
|
this.finish();
|
|
23265
23046
|
const bufferOut = this.state;
|
|
23266
23047
|
const { blockLen } = this;
|
|
@@ -23281,11 +23062,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
23281
23062
|
return this.writeInto(out);
|
|
23282
23063
|
}
|
|
23283
23064
|
xof(bytes) {
|
|
23284
|
-
|
|
23065
|
+
number$1(bytes);
|
|
23285
23066
|
return this.xofInto(new Uint8Array(bytes));
|
|
23286
23067
|
}
|
|
23287
23068
|
digestInto(out) {
|
|
23288
|
-
|
|
23069
|
+
output(out, this);
|
|
23289
23070
|
if (this.finished)
|
|
23290
23071
|
throw new Error('digest() was already called');
|
|
23291
23072
|
this.writeInto(out);
|
|
@@ -23316,133 +23097,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
23316
23097
|
}
|
|
23317
23098
|
}
|
|
23318
23099
|
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
23100
|
/**
|
|
23329
23101
|
* keccak-256 hash function. Different from SHA3-256.
|
|
23330
23102
|
* @param message - that would be hashed
|
|
23331
23103
|
*/
|
|
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());
|
|
23104
|
+
const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
|
|
23446
23105
|
|
|
23447
23106
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
23448
23107
|
// Short Weierstrass curve. The formula is: y² = x³ + ax + b
|
|
@@ -24375,14 +24034,14 @@ var solanaWeb3 = (function (exports) {
|
|
|
24375
24034
|
}
|
|
24376
24035
|
|
|
24377
24036
|
// HMAC (RFC 2104)
|
|
24378
|
-
class HMAC extends Hash
|
|
24379
|
-
constructor(hash, _key) {
|
|
24037
|
+
class HMAC extends Hash {
|
|
24038
|
+
constructor(hash$1, _key) {
|
|
24380
24039
|
super();
|
|
24381
24040
|
this.finished = false;
|
|
24382
24041
|
this.destroyed = false;
|
|
24383
|
-
hash$1
|
|
24384
|
-
const key = toBytes
|
|
24385
|
-
this.iHash = hash.create();
|
|
24042
|
+
hash(hash$1);
|
|
24043
|
+
const key = toBytes(_key);
|
|
24044
|
+
this.iHash = hash$1.create();
|
|
24386
24045
|
if (typeof this.iHash.update !== 'function')
|
|
24387
24046
|
throw new Error('Expected instance of class which extends utils.Hash');
|
|
24388
24047
|
this.blockLen = this.iHash.blockLen;
|
|
@@ -24390,12 +24049,12 @@ var solanaWeb3 = (function (exports) {
|
|
|
24390
24049
|
const blockLen = this.blockLen;
|
|
24391
24050
|
const pad = new Uint8Array(blockLen);
|
|
24392
24051
|
// blockLen can be bigger than outputLen
|
|
24393
|
-
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
|
24052
|
+
pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key);
|
|
24394
24053
|
for (let i = 0; i < pad.length; i++)
|
|
24395
24054
|
pad[i] ^= 0x36;
|
|
24396
24055
|
this.iHash.update(pad);
|
|
24397
24056
|
// 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();
|
|
24057
|
+
this.oHash = hash$1.create();
|
|
24399
24058
|
// Undo internal XOR && apply outer XOR
|
|
24400
24059
|
for (let i = 0; i < pad.length; i++)
|
|
24401
24060
|
pad[i] ^= 0x36 ^ 0x5c;
|
|
@@ -24403,13 +24062,13 @@ var solanaWeb3 = (function (exports) {
|
|
|
24403
24062
|
pad.fill(0);
|
|
24404
24063
|
}
|
|
24405
24064
|
update(buf) {
|
|
24406
|
-
exists
|
|
24065
|
+
exists(this);
|
|
24407
24066
|
this.iHash.update(buf);
|
|
24408
24067
|
return this;
|
|
24409
24068
|
}
|
|
24410
24069
|
digestInto(out) {
|
|
24411
|
-
exists
|
|
24412
|
-
bytes
|
|
24070
|
+
exists(this);
|
|
24071
|
+
bytes(out, this.outputLen);
|
|
24413
24072
|
this.finished = true;
|
|
24414
24073
|
this.iHash.digestInto(out);
|
|
24415
24074
|
this.oHash.update(out);
|
|
@@ -25212,7 +24871,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
25212
24871
|
if (custodianPubkey) {
|
|
25213
24872
|
keys.push({
|
|
25214
24873
|
pubkey: custodianPubkey,
|
|
25215
|
-
isSigner:
|
|
24874
|
+
isSigner: true,
|
|
25216
24875
|
isWritable: false
|
|
25217
24876
|
});
|
|
25218
24877
|
}
|
|
@@ -25260,7 +24919,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
25260
24919
|
if (custodianPubkey) {
|
|
25261
24920
|
keys.push({
|
|
25262
24921
|
pubkey: custodianPubkey,
|
|
25263
|
-
isSigner:
|
|
24922
|
+
isSigner: true,
|
|
25264
24923
|
isWritable: false
|
|
25265
24924
|
});
|
|
25266
24925
|
}
|
|
@@ -25425,7 +25084,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
25425
25084
|
if (custodianPubkey) {
|
|
25426
25085
|
keys.push({
|
|
25427
25086
|
pubkey: custodianPubkey,
|
|
25428
|
-
isSigner:
|
|
25087
|
+
isSigner: true,
|
|
25429
25088
|
isWritable: false
|
|
25430
25089
|
});
|
|
25431
25090
|
}
|
|
@@ -26116,7 +25775,9 @@ var solanaWeb3 = (function (exports) {
|
|
|
26116
25775
|
/**
|
|
26117
25776
|
* @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`
|
|
26118
25777
|
* is no longer supported and will be removed in a future version.
|
|
26119
|
-
*/
|
|
25778
|
+
*/
|
|
25779
|
+
// eslint-disable-next-line no-redeclare
|
|
25780
|
+
|
|
26120
25781
|
// eslint-disable-next-line no-redeclare
|
|
26121
25782
|
async function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) {
|
|
26122
25783
|
let confirmationStrategy;
|