@pooflabs/web 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +697 -691
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +696 -690
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -4851,176 +4851,6 @@ function requireNaclFast () {
|
|
|
4851
4851
|
var naclFastExports = requireNaclFast();
|
|
4852
4852
|
var nacl = /*@__PURE__*/getDefaultExportFromCjs$1(naclFastExports);
|
|
4853
4853
|
|
|
4854
|
-
// base-x encoding / decoding
|
|
4855
|
-
// Copyright (c) 2018 base-x contributors
|
|
4856
|
-
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
4857
|
-
// Distributed under the MIT software license, see the accompanying
|
|
4858
|
-
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
4859
|
-
function base$1 (ALPHABET) {
|
|
4860
|
-
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
4861
|
-
const BASE_MAP = new Uint8Array(256);
|
|
4862
|
-
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
4863
|
-
BASE_MAP[j] = 255;
|
|
4864
|
-
}
|
|
4865
|
-
for (let i = 0; i < ALPHABET.length; i++) {
|
|
4866
|
-
const x = ALPHABET.charAt(i);
|
|
4867
|
-
const xc = x.charCodeAt(0);
|
|
4868
|
-
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
4869
|
-
BASE_MAP[xc] = i;
|
|
4870
|
-
}
|
|
4871
|
-
const BASE = ALPHABET.length;
|
|
4872
|
-
const LEADER = ALPHABET.charAt(0);
|
|
4873
|
-
const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
4874
|
-
const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
4875
|
-
function encode (source) {
|
|
4876
|
-
// eslint-disable-next-line no-empty
|
|
4877
|
-
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
4878
|
-
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
4879
|
-
} else if (Array.isArray(source)) {
|
|
4880
|
-
source = Uint8Array.from(source);
|
|
4881
|
-
}
|
|
4882
|
-
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
4883
|
-
if (source.length === 0) { return '' }
|
|
4884
|
-
// Skip & count leading zeroes.
|
|
4885
|
-
let zeroes = 0;
|
|
4886
|
-
let length = 0;
|
|
4887
|
-
let pbegin = 0;
|
|
4888
|
-
const pend = source.length;
|
|
4889
|
-
while (pbegin !== pend && source[pbegin] === 0) {
|
|
4890
|
-
pbegin++;
|
|
4891
|
-
zeroes++;
|
|
4892
|
-
}
|
|
4893
|
-
// Allocate enough space in big-endian base58 representation.
|
|
4894
|
-
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
4895
|
-
const b58 = new Uint8Array(size);
|
|
4896
|
-
// Process the bytes.
|
|
4897
|
-
while (pbegin !== pend) {
|
|
4898
|
-
let carry = source[pbegin];
|
|
4899
|
-
// Apply "b58 = b58 * 256 + ch".
|
|
4900
|
-
let i = 0;
|
|
4901
|
-
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
4902
|
-
carry += (256 * b58[it1]) >>> 0;
|
|
4903
|
-
b58[it1] = (carry % BASE) >>> 0;
|
|
4904
|
-
carry = (carry / BASE) >>> 0;
|
|
4905
|
-
}
|
|
4906
|
-
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
4907
|
-
length = i;
|
|
4908
|
-
pbegin++;
|
|
4909
|
-
}
|
|
4910
|
-
// Skip leading zeroes in base58 result.
|
|
4911
|
-
let it2 = size - length;
|
|
4912
|
-
while (it2 !== size && b58[it2] === 0) {
|
|
4913
|
-
it2++;
|
|
4914
|
-
}
|
|
4915
|
-
// Translate the result into a string.
|
|
4916
|
-
let str = LEADER.repeat(zeroes);
|
|
4917
|
-
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
4918
|
-
return str
|
|
4919
|
-
}
|
|
4920
|
-
function decodeUnsafe (source) {
|
|
4921
|
-
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
4922
|
-
if (source.length === 0) { return new Uint8Array() }
|
|
4923
|
-
let psz = 0;
|
|
4924
|
-
// Skip and count leading '1's.
|
|
4925
|
-
let zeroes = 0;
|
|
4926
|
-
let length = 0;
|
|
4927
|
-
while (source[psz] === LEADER) {
|
|
4928
|
-
zeroes++;
|
|
4929
|
-
psz++;
|
|
4930
|
-
}
|
|
4931
|
-
// Allocate enough space in big-endian base256 representation.
|
|
4932
|
-
const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
4933
|
-
const b256 = new Uint8Array(size);
|
|
4934
|
-
// Process the characters.
|
|
4935
|
-
while (psz < source.length) {
|
|
4936
|
-
// Find code of next character
|
|
4937
|
-
const charCode = source.charCodeAt(psz);
|
|
4938
|
-
// Base map can not be indexed using char code
|
|
4939
|
-
if (charCode > 255) { return }
|
|
4940
|
-
// Decode character
|
|
4941
|
-
let carry = BASE_MAP[charCode];
|
|
4942
|
-
// Invalid character
|
|
4943
|
-
if (carry === 255) { return }
|
|
4944
|
-
let i = 0;
|
|
4945
|
-
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
4946
|
-
carry += (BASE * b256[it3]) >>> 0;
|
|
4947
|
-
b256[it3] = (carry % 256) >>> 0;
|
|
4948
|
-
carry = (carry / 256) >>> 0;
|
|
4949
|
-
}
|
|
4950
|
-
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
4951
|
-
length = i;
|
|
4952
|
-
psz++;
|
|
4953
|
-
}
|
|
4954
|
-
// Skip leading zeroes in b256.
|
|
4955
|
-
let it4 = size - length;
|
|
4956
|
-
while (it4 !== size && b256[it4] === 0) {
|
|
4957
|
-
it4++;
|
|
4958
|
-
}
|
|
4959
|
-
const vch = new Uint8Array(zeroes + (size - it4));
|
|
4960
|
-
let j = zeroes;
|
|
4961
|
-
while (it4 !== size) {
|
|
4962
|
-
vch[j++] = b256[it4++];
|
|
4963
|
-
}
|
|
4964
|
-
return vch
|
|
4965
|
-
}
|
|
4966
|
-
function decode (string) {
|
|
4967
|
-
const buffer = decodeUnsafe(string);
|
|
4968
|
-
if (buffer) { return buffer }
|
|
4969
|
-
throw new Error('Non-base' + BASE + ' character')
|
|
4970
|
-
}
|
|
4971
|
-
return {
|
|
4972
|
-
encode,
|
|
4973
|
-
decodeUnsafe,
|
|
4974
|
-
decode
|
|
4975
|
-
}
|
|
4976
|
-
}
|
|
4977
|
-
|
|
4978
|
-
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
4979
|
-
var ue$3 = base$1(ALPHABET);
|
|
4980
|
-
|
|
4981
|
-
/**
|
|
4982
|
-
* Check if a given instruction is a SetComputeUnitLimit instruction
|
|
4983
|
-
* See https://github.com/solana-program/compute-budget/blob/main/clients/js/src/generated/programs/computeBudget.ts#L29
|
|
4984
|
-
*/
|
|
4985
|
-
function isSetComputeLimitInstruction(ix) {
|
|
4986
|
-
return (ix.programId.equals(web3_js.ComputeBudgetProgram.programId) && ix.data[0] === 2 // opcode for setComputeUnitLimit is 2
|
|
4987
|
-
);
|
|
4988
|
-
}
|
|
4989
|
-
// Was getSimulationUnits
|
|
4990
|
-
// Credit https://twitter.com/stegabob, originally from
|
|
4991
|
-
// https://x.com/stegaBOB/status/1766662289392889920
|
|
4992
|
-
const getSimulationComputeUnits = async (connection, instructions, payer, lookupTables, commitment = "confirmed") => {
|
|
4993
|
-
const simulationInstructions = [...instructions];
|
|
4994
|
-
// Replace or add compute limit instruction
|
|
4995
|
-
const computeLimitIndex = simulationInstructions.findIndex(isSetComputeLimitInstruction);
|
|
4996
|
-
const simulationLimitIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
4997
|
-
units: 1_400_000,
|
|
4998
|
-
});
|
|
4999
|
-
if (computeLimitIndex >= 0) {
|
|
5000
|
-
simulationInstructions[computeLimitIndex] = simulationLimitIx;
|
|
5001
|
-
}
|
|
5002
|
-
else {
|
|
5003
|
-
simulationInstructions.unshift(simulationLimitIx);
|
|
5004
|
-
}
|
|
5005
|
-
const testTransaction = new web3_js.VersionedTransaction(new web3_js.TransactionMessage({
|
|
5006
|
-
instructions: simulationInstructions,
|
|
5007
|
-
payerKey: payer,
|
|
5008
|
-
// RecentBlockhash can by any public key during simulation
|
|
5009
|
-
// since 'replaceRecentBlockhash' is set to 'true' below
|
|
5010
|
-
recentBlockhash: web3_js.PublicKey.default.toString(),
|
|
5011
|
-
}).compileToV0Message(lookupTables));
|
|
5012
|
-
const rpcResponse = await connection.simulateTransaction(testTransaction, {
|
|
5013
|
-
replaceRecentBlockhash: true,
|
|
5014
|
-
sigVerify: false,
|
|
5015
|
-
commitment,
|
|
5016
|
-
});
|
|
5017
|
-
if (rpcResponse?.value?.err) {
|
|
5018
|
-
const logs = rpcResponse.value.logs?.join("\n • ") || "No logs available";
|
|
5019
|
-
throw new Error(`Transaction simulation failed:\n •${logs}` + JSON.stringify(rpcResponse?.value?.err));
|
|
5020
|
-
}
|
|
5021
|
-
return rpcResponse.value.unitsConsumed || null;
|
|
5022
|
-
};
|
|
5023
|
-
|
|
5024
4854
|
var bn$3 = {exports: {}};
|
|
5025
4855
|
|
|
5026
4856
|
var bn$2 = bn$3.exports;
|
|
@@ -8387,431 +8217,6 @@ function requireBn () {
|
|
|
8387
8217
|
var bnExports = requireBn();
|
|
8388
8218
|
var BN = /*@__PURE__*/getDefaultExportFromCjs$1(bnExports);
|
|
8389
8219
|
|
|
8390
|
-
const crypto$3 = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
8391
|
-
|
|
8392
|
-
/**
|
|
8393
|
-
* Utilities for hex, bytes, CSPRNG.
|
|
8394
|
-
* @module
|
|
8395
|
-
*/
|
|
8396
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
8397
|
-
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
8398
|
-
// node.js versions earlier than v19 don't declare it in global scope.
|
|
8399
|
-
// For node.js, package.json#exports field mapping rewrites import
|
|
8400
|
-
// from `crypto` to `cryptoNode`, which imports native module.
|
|
8401
|
-
// Makes the utils un-importable in browsers without a bundler.
|
|
8402
|
-
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
|
8403
|
-
/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
|
|
8404
|
-
function isBytes$2(a) {
|
|
8405
|
-
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
|
8406
|
-
}
|
|
8407
|
-
/** Asserts something is positive integer. */
|
|
8408
|
-
function anumber$1(n) {
|
|
8409
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
8410
|
-
throw new Error('positive integer expected, got ' + n);
|
|
8411
|
-
}
|
|
8412
|
-
/** Asserts something is Uint8Array. */
|
|
8413
|
-
function abytes$2(b, ...lengths) {
|
|
8414
|
-
if (!isBytes$2(b))
|
|
8415
|
-
throw new Error('Uint8Array expected');
|
|
8416
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
8417
|
-
throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
|
|
8418
|
-
}
|
|
8419
|
-
/** Asserts something is hash */
|
|
8420
|
-
function ahash(h) {
|
|
8421
|
-
if (typeof h !== 'function' || typeof h.create !== 'function')
|
|
8422
|
-
throw new Error('Hash should be wrapped by utils.createHasher');
|
|
8423
|
-
anumber$1(h.outputLen);
|
|
8424
|
-
anumber$1(h.blockLen);
|
|
8425
|
-
}
|
|
8426
|
-
/** Asserts a hash instance has not been destroyed / finished */
|
|
8427
|
-
function aexists(instance, checkFinished = true) {
|
|
8428
|
-
if (instance.destroyed)
|
|
8429
|
-
throw new Error('Hash instance has been destroyed');
|
|
8430
|
-
if (checkFinished && instance.finished)
|
|
8431
|
-
throw new Error('Hash#digest() has already been called');
|
|
8432
|
-
}
|
|
8433
|
-
/** Asserts output is properly-sized byte array */
|
|
8434
|
-
function aoutput(out, instance) {
|
|
8435
|
-
abytes$2(out);
|
|
8436
|
-
const min = instance.outputLen;
|
|
8437
|
-
if (out.length < min) {
|
|
8438
|
-
throw new Error('digestInto() expects output buffer of length at least ' + min);
|
|
8439
|
-
}
|
|
8440
|
-
}
|
|
8441
|
-
/** Cast u8 / u16 / u32 to u32. */
|
|
8442
|
-
function u32$1(arr) {
|
|
8443
|
-
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
8444
|
-
}
|
|
8445
|
-
/** Zeroize a byte array. Warning: JS provides no guarantees. */
|
|
8446
|
-
function clean(...arrays) {
|
|
8447
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
8448
|
-
arrays[i].fill(0);
|
|
8449
|
-
}
|
|
8450
|
-
}
|
|
8451
|
-
/** Create DataView of an array for easy byte-level manipulation. */
|
|
8452
|
-
function createView$1(arr) {
|
|
8453
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
8454
|
-
}
|
|
8455
|
-
/** The rotate right (circular right shift) operation for uint32 */
|
|
8456
|
-
function rotr$1(word, shift) {
|
|
8457
|
-
return (word << (32 - shift)) | (word >>> shift);
|
|
8458
|
-
}
|
|
8459
|
-
/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
|
|
8460
|
-
const isLE$1 = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
|
|
8461
|
-
/** The byte swap operation for uint32 */
|
|
8462
|
-
function byteSwap(word) {
|
|
8463
|
-
return (((word << 24) & 0xff000000) |
|
|
8464
|
-
((word << 8) & 0xff0000) |
|
|
8465
|
-
((word >>> 8) & 0xff00) |
|
|
8466
|
-
((word >>> 24) & 0xff));
|
|
8467
|
-
}
|
|
8468
|
-
/** In place byte swap for Uint32Array */
|
|
8469
|
-
function byteSwap32(arr) {
|
|
8470
|
-
for (let i = 0; i < arr.length; i++) {
|
|
8471
|
-
arr[i] = byteSwap(arr[i]);
|
|
8472
|
-
}
|
|
8473
|
-
return arr;
|
|
8474
|
-
}
|
|
8475
|
-
const swap32IfBE = isLE$1
|
|
8476
|
-
? (u) => u
|
|
8477
|
-
: byteSwap32;
|
|
8478
|
-
/**
|
|
8479
|
-
* Converts string to bytes using UTF8 encoding.
|
|
8480
|
-
* @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
|
|
8481
|
-
*/
|
|
8482
|
-
function utf8ToBytes$2(str) {
|
|
8483
|
-
if (typeof str !== 'string')
|
|
8484
|
-
throw new Error('string expected');
|
|
8485
|
-
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
8486
|
-
}
|
|
8487
|
-
/**
|
|
8488
|
-
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
8489
|
-
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
8490
|
-
* Keep in mind for future mutable operations.
|
|
8491
|
-
*/
|
|
8492
|
-
function toBytes$1(data) {
|
|
8493
|
-
if (typeof data === 'string')
|
|
8494
|
-
data = utf8ToBytes$2(data);
|
|
8495
|
-
abytes$2(data);
|
|
8496
|
-
return data;
|
|
8497
|
-
}
|
|
8498
|
-
/** Copies several Uint8Arrays into one. */
|
|
8499
|
-
function concatBytes$3(...arrays) {
|
|
8500
|
-
let sum = 0;
|
|
8501
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
8502
|
-
const a = arrays[i];
|
|
8503
|
-
abytes$2(a);
|
|
8504
|
-
sum += a.length;
|
|
8505
|
-
}
|
|
8506
|
-
const res = new Uint8Array(sum);
|
|
8507
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
8508
|
-
const a = arrays[i];
|
|
8509
|
-
res.set(a, pad);
|
|
8510
|
-
pad += a.length;
|
|
8511
|
-
}
|
|
8512
|
-
return res;
|
|
8513
|
-
}
|
|
8514
|
-
/** For runtime check if class implements interface */
|
|
8515
|
-
let Hash$1 = class Hash {
|
|
8516
|
-
};
|
|
8517
|
-
/** Wraps hash function, creating an interface on top of it */
|
|
8518
|
-
function createHasher(hashCons) {
|
|
8519
|
-
const hashC = (msg) => hashCons().update(toBytes$1(msg)).digest();
|
|
8520
|
-
const tmp = hashCons();
|
|
8521
|
-
hashC.outputLen = tmp.outputLen;
|
|
8522
|
-
hashC.blockLen = tmp.blockLen;
|
|
8523
|
-
hashC.create = () => hashCons();
|
|
8524
|
-
return hashC;
|
|
8525
|
-
}
|
|
8526
|
-
/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
|
|
8527
|
-
function randomBytes$1(bytesLength = 32) {
|
|
8528
|
-
if (crypto$3 && typeof crypto$3.getRandomValues === 'function') {
|
|
8529
|
-
return crypto$3.getRandomValues(new Uint8Array(bytesLength));
|
|
8530
|
-
}
|
|
8531
|
-
// Legacy Node.js compatibility
|
|
8532
|
-
if (crypto$3 && typeof crypto$3.randomBytes === 'function') {
|
|
8533
|
-
return Uint8Array.from(crypto$3.randomBytes(bytesLength));
|
|
8534
|
-
}
|
|
8535
|
-
throw new Error('crypto.getRandomValues must be defined');
|
|
8536
|
-
}
|
|
8537
|
-
|
|
8538
|
-
/**
|
|
8539
|
-
* Internal Merkle-Damgard hash utils.
|
|
8540
|
-
* @module
|
|
8541
|
-
*/
|
|
8542
|
-
/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
|
|
8543
|
-
function setBigUint64$1(view, byteOffset, value, isLE) {
|
|
8544
|
-
if (typeof view.setBigUint64 === 'function')
|
|
8545
|
-
return view.setBigUint64(byteOffset, value, isLE);
|
|
8546
|
-
const _32n = BigInt(32);
|
|
8547
|
-
const _u32_max = BigInt(0xffffffff);
|
|
8548
|
-
const wh = Number((value >> _32n) & _u32_max);
|
|
8549
|
-
const wl = Number(value & _u32_max);
|
|
8550
|
-
const h = isLE ? 4 : 0;
|
|
8551
|
-
const l = isLE ? 0 : 4;
|
|
8552
|
-
view.setUint32(byteOffset + h, wh, isLE);
|
|
8553
|
-
view.setUint32(byteOffset + l, wl, isLE);
|
|
8554
|
-
}
|
|
8555
|
-
/** Choice: a ? b : c */
|
|
8556
|
-
function Chi$1(a, b, c) {
|
|
8557
|
-
return (a & b) ^ (~a & c);
|
|
8558
|
-
}
|
|
8559
|
-
/** Majority function, true if any two inputs is true. */
|
|
8560
|
-
function Maj$1(a, b, c) {
|
|
8561
|
-
return (a & b) ^ (a & c) ^ (b & c);
|
|
8562
|
-
}
|
|
8563
|
-
/**
|
|
8564
|
-
* Merkle-Damgard hash construction base class.
|
|
8565
|
-
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
|
|
8566
|
-
*/
|
|
8567
|
-
class HashMD extends Hash$1 {
|
|
8568
|
-
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
8569
|
-
super();
|
|
8570
|
-
this.finished = false;
|
|
8571
|
-
this.length = 0;
|
|
8572
|
-
this.pos = 0;
|
|
8573
|
-
this.destroyed = false;
|
|
8574
|
-
this.blockLen = blockLen;
|
|
8575
|
-
this.outputLen = outputLen;
|
|
8576
|
-
this.padOffset = padOffset;
|
|
8577
|
-
this.isLE = isLE;
|
|
8578
|
-
this.buffer = new Uint8Array(blockLen);
|
|
8579
|
-
this.view = createView$1(this.buffer);
|
|
8580
|
-
}
|
|
8581
|
-
update(data) {
|
|
8582
|
-
aexists(this);
|
|
8583
|
-
data = toBytes$1(data);
|
|
8584
|
-
abytes$2(data);
|
|
8585
|
-
const { view, buffer, blockLen } = this;
|
|
8586
|
-
const len = data.length;
|
|
8587
|
-
for (let pos = 0; pos < len;) {
|
|
8588
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
8589
|
-
// Fast path: we have at least one block in input, cast it to view and process
|
|
8590
|
-
if (take === blockLen) {
|
|
8591
|
-
const dataView = createView$1(data);
|
|
8592
|
-
for (; blockLen <= len - pos; pos += blockLen)
|
|
8593
|
-
this.process(dataView, pos);
|
|
8594
|
-
continue;
|
|
8595
|
-
}
|
|
8596
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
8597
|
-
this.pos += take;
|
|
8598
|
-
pos += take;
|
|
8599
|
-
if (this.pos === blockLen) {
|
|
8600
|
-
this.process(view, 0);
|
|
8601
|
-
this.pos = 0;
|
|
8602
|
-
}
|
|
8603
|
-
}
|
|
8604
|
-
this.length += data.length;
|
|
8605
|
-
this.roundClean();
|
|
8606
|
-
return this;
|
|
8607
|
-
}
|
|
8608
|
-
digestInto(out) {
|
|
8609
|
-
aexists(this);
|
|
8610
|
-
aoutput(out, this);
|
|
8611
|
-
this.finished = true;
|
|
8612
|
-
// Padding
|
|
8613
|
-
// We can avoid allocation of buffer for padding completely if it
|
|
8614
|
-
// was previously not allocated here. But it won't change performance.
|
|
8615
|
-
const { buffer, view, blockLen, isLE } = this;
|
|
8616
|
-
let { pos } = this;
|
|
8617
|
-
// append the bit '1' to the message
|
|
8618
|
-
buffer[pos++] = 0b10000000;
|
|
8619
|
-
clean(this.buffer.subarray(pos));
|
|
8620
|
-
// we have less than padOffset left in buffer, so we cannot put length in
|
|
8621
|
-
// current block, need process it and pad again
|
|
8622
|
-
if (this.padOffset > blockLen - pos) {
|
|
8623
|
-
this.process(view, 0);
|
|
8624
|
-
pos = 0;
|
|
8625
|
-
}
|
|
8626
|
-
// Pad until full block byte with zeros
|
|
8627
|
-
for (let i = pos; i < blockLen; i++)
|
|
8628
|
-
buffer[i] = 0;
|
|
8629
|
-
// Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
|
|
8630
|
-
// You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
|
|
8631
|
-
// So we just write lowest 64 bits of that value.
|
|
8632
|
-
setBigUint64$1(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
8633
|
-
this.process(view, 0);
|
|
8634
|
-
const oview = createView$1(out);
|
|
8635
|
-
const len = this.outputLen;
|
|
8636
|
-
// NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
|
|
8637
|
-
if (len % 4)
|
|
8638
|
-
throw new Error('_sha2: outputLen should be aligned to 32bit');
|
|
8639
|
-
const outLen = len / 4;
|
|
8640
|
-
const state = this.get();
|
|
8641
|
-
if (outLen > state.length)
|
|
8642
|
-
throw new Error('_sha2: outputLen bigger than state');
|
|
8643
|
-
for (let i = 0; i < outLen; i++)
|
|
8644
|
-
oview.setUint32(4 * i, state[i], isLE);
|
|
8645
|
-
}
|
|
8646
|
-
digest() {
|
|
8647
|
-
const { buffer, outputLen } = this;
|
|
8648
|
-
this.digestInto(buffer);
|
|
8649
|
-
const res = buffer.slice(0, outputLen);
|
|
8650
|
-
this.destroy();
|
|
8651
|
-
return res;
|
|
8652
|
-
}
|
|
8653
|
-
_cloneInto(to) {
|
|
8654
|
-
to || (to = new this.constructor());
|
|
8655
|
-
to.set(...this.get());
|
|
8656
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
8657
|
-
to.destroyed = destroyed;
|
|
8658
|
-
to.finished = finished;
|
|
8659
|
-
to.length = length;
|
|
8660
|
-
to.pos = pos;
|
|
8661
|
-
if (length % blockLen)
|
|
8662
|
-
to.buffer.set(buffer);
|
|
8663
|
-
return to;
|
|
8664
|
-
}
|
|
8665
|
-
clone() {
|
|
8666
|
-
return this._cloneInto();
|
|
8667
|
-
}
|
|
8668
|
-
}
|
|
8669
|
-
/**
|
|
8670
|
-
* Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
|
|
8671
|
-
* Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
|
|
8672
|
-
*/
|
|
8673
|
-
/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
|
|
8674
|
-
const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
8675
|
-
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
8676
|
-
]);
|
|
8677
|
-
|
|
8678
|
-
/**
|
|
8679
|
-
* Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
|
|
8680
|
-
* @todo re-check https://issues.chromium.org/issues/42212588
|
|
8681
|
-
* @module
|
|
8682
|
-
*/
|
|
8683
|
-
const U32_MASK64$1 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
8684
|
-
const _32n$1 = /* @__PURE__ */ BigInt(32);
|
|
8685
|
-
function fromBig$1(n, le = false) {
|
|
8686
|
-
if (le)
|
|
8687
|
-
return { h: Number(n & U32_MASK64$1), l: Number((n >> _32n$1) & U32_MASK64$1) };
|
|
8688
|
-
return { h: Number((n >> _32n$1) & U32_MASK64$1) | 0, l: Number(n & U32_MASK64$1) | 0 };
|
|
8689
|
-
}
|
|
8690
|
-
function split$1(lst, le = false) {
|
|
8691
|
-
const len = lst.length;
|
|
8692
|
-
let Ah = new Uint32Array(len);
|
|
8693
|
-
let Al = new Uint32Array(len);
|
|
8694
|
-
for (let i = 0; i < len; i++) {
|
|
8695
|
-
const { h, l } = fromBig$1(lst[i], le);
|
|
8696
|
-
[Ah[i], Al[i]] = [h, l];
|
|
8697
|
-
}
|
|
8698
|
-
return [Ah, Al];
|
|
8699
|
-
}
|
|
8700
|
-
// Left rotate for Shift in [1, 32)
|
|
8701
|
-
const rotlSH$1 = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
8702
|
-
const rotlSL$1 = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
8703
|
-
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
8704
|
-
const rotlBH$1 = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
8705
|
-
const rotlBL$1 = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
8706
|
-
|
|
8707
|
-
/**
|
|
8708
|
-
* SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
|
|
8709
|
-
* SHA256 is the fastest hash implementable in JS, even faster than Blake3.
|
|
8710
|
-
* Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
|
|
8711
|
-
* [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
|
|
8712
|
-
* @module
|
|
8713
|
-
*/
|
|
8714
|
-
/**
|
|
8715
|
-
* Round constants:
|
|
8716
|
-
* First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
|
|
8717
|
-
*/
|
|
8718
|
-
// prettier-ignore
|
|
8719
|
-
const SHA256_K$1 = /* @__PURE__ */ Uint32Array.from([
|
|
8720
|
-
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
8721
|
-
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
8722
|
-
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
8723
|
-
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
8724
|
-
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
8725
|
-
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
8726
|
-
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
8727
|
-
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
8728
|
-
]);
|
|
8729
|
-
/** Reusable temporary buffer. "W" comes straight from spec. */
|
|
8730
|
-
const SHA256_W$1 = /* @__PURE__ */ new Uint32Array(64);
|
|
8731
|
-
let SHA256$1 = class SHA256 extends HashMD {
|
|
8732
|
-
constructor(outputLen = 32) {
|
|
8733
|
-
super(64, outputLen, 8, false);
|
|
8734
|
-
// We cannot use array here since array allows indexing by variable
|
|
8735
|
-
// which means optimizer/compiler cannot use registers.
|
|
8736
|
-
this.A = SHA256_IV[0] | 0;
|
|
8737
|
-
this.B = SHA256_IV[1] | 0;
|
|
8738
|
-
this.C = SHA256_IV[2] | 0;
|
|
8739
|
-
this.D = SHA256_IV[3] | 0;
|
|
8740
|
-
this.E = SHA256_IV[4] | 0;
|
|
8741
|
-
this.F = SHA256_IV[5] | 0;
|
|
8742
|
-
this.G = SHA256_IV[6] | 0;
|
|
8743
|
-
this.H = SHA256_IV[7] | 0;
|
|
8744
|
-
}
|
|
8745
|
-
get() {
|
|
8746
|
-
const { A, B, C, D, E, F, G, H } = this;
|
|
8747
|
-
return [A, B, C, D, E, F, G, H];
|
|
8748
|
-
}
|
|
8749
|
-
// prettier-ignore
|
|
8750
|
-
set(A, B, C, D, E, F, G, H) {
|
|
8751
|
-
this.A = A | 0;
|
|
8752
|
-
this.B = B | 0;
|
|
8753
|
-
this.C = C | 0;
|
|
8754
|
-
this.D = D | 0;
|
|
8755
|
-
this.E = E | 0;
|
|
8756
|
-
this.F = F | 0;
|
|
8757
|
-
this.G = G | 0;
|
|
8758
|
-
this.H = H | 0;
|
|
8759
|
-
}
|
|
8760
|
-
process(view, offset) {
|
|
8761
|
-
// Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
|
|
8762
|
-
for (let i = 0; i < 16; i++, offset += 4)
|
|
8763
|
-
SHA256_W$1[i] = view.getUint32(offset, false);
|
|
8764
|
-
for (let i = 16; i < 64; i++) {
|
|
8765
|
-
const W15 = SHA256_W$1[i - 15];
|
|
8766
|
-
const W2 = SHA256_W$1[i - 2];
|
|
8767
|
-
const s0 = rotr$1(W15, 7) ^ rotr$1(W15, 18) ^ (W15 >>> 3);
|
|
8768
|
-
const s1 = rotr$1(W2, 17) ^ rotr$1(W2, 19) ^ (W2 >>> 10);
|
|
8769
|
-
SHA256_W$1[i] = (s1 + SHA256_W$1[i - 7] + s0 + SHA256_W$1[i - 16]) | 0;
|
|
8770
|
-
}
|
|
8771
|
-
// Compression function main loop, 64 rounds
|
|
8772
|
-
let { A, B, C, D, E, F, G, H } = this;
|
|
8773
|
-
for (let i = 0; i < 64; i++) {
|
|
8774
|
-
const sigma1 = rotr$1(E, 6) ^ rotr$1(E, 11) ^ rotr$1(E, 25);
|
|
8775
|
-
const T1 = (H + sigma1 + Chi$1(E, F, G) + SHA256_K$1[i] + SHA256_W$1[i]) | 0;
|
|
8776
|
-
const sigma0 = rotr$1(A, 2) ^ rotr$1(A, 13) ^ rotr$1(A, 22);
|
|
8777
|
-
const T2 = (sigma0 + Maj$1(A, B, C)) | 0;
|
|
8778
|
-
H = G;
|
|
8779
|
-
G = F;
|
|
8780
|
-
F = E;
|
|
8781
|
-
E = (D + T1) | 0;
|
|
8782
|
-
D = C;
|
|
8783
|
-
C = B;
|
|
8784
|
-
B = A;
|
|
8785
|
-
A = (T1 + T2) | 0;
|
|
8786
|
-
}
|
|
8787
|
-
// Add the compressed chunk to the current hash value
|
|
8788
|
-
A = (A + this.A) | 0;
|
|
8789
|
-
B = (B + this.B) | 0;
|
|
8790
|
-
C = (C + this.C) | 0;
|
|
8791
|
-
D = (D + this.D) | 0;
|
|
8792
|
-
E = (E + this.E) | 0;
|
|
8793
|
-
F = (F + this.F) | 0;
|
|
8794
|
-
G = (G + this.G) | 0;
|
|
8795
|
-
H = (H + this.H) | 0;
|
|
8796
|
-
this.set(A, B, C, D, E, F, G, H);
|
|
8797
|
-
}
|
|
8798
|
-
roundClean() {
|
|
8799
|
-
clean(SHA256_W$1);
|
|
8800
|
-
}
|
|
8801
|
-
destroy() {
|
|
8802
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
8803
|
-
clean(this.buffer);
|
|
8804
|
-
}
|
|
8805
|
-
};
|
|
8806
|
-
/**
|
|
8807
|
-
* SHA2-256 hash function from RFC 4634.
|
|
8808
|
-
*
|
|
8809
|
-
* It is the fastest JS hash, even faster than Blake3.
|
|
8810
|
-
* To break sha256 using birthday attack, attackers need to try 2^128 hashes.
|
|
8811
|
-
* BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
|
8812
|
-
*/
|
|
8813
|
-
const sha256$2 = /* @__PURE__ */ createHasher(() => new SHA256$1());
|
|
8814
|
-
|
|
8815
8220
|
/*! *****************************************************************************
|
|
8816
8221
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8817
8222
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -12173,6 +11578,57 @@ function requireBs58$1 () {
|
|
|
12173
11578
|
var bs58Exports = requireBs58$1();
|
|
12174
11579
|
var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
|
|
12175
11580
|
|
|
11581
|
+
// ─────────────────────────────────────────────────────────────
|
|
11582
|
+
// Local implementation of getSimulationComputeUnits
|
|
11583
|
+
// (Replaces @solana-developers/helpers to avoid Wallet import issue in browser/ESM builds)
|
|
11584
|
+
// Source: https://github.com/solana-developers/helpers/blob/main/src/lib/transaction.ts
|
|
11585
|
+
// ─────────────────────────────────────────────────────────────
|
|
11586
|
+
/**
|
|
11587
|
+
* Check if a given instruction is a SetComputeUnitLimit instruction
|
|
11588
|
+
* See https://github.com/solana-program/compute-budget/blob/main/clients/js/src/generated/programs/computeBudget.ts#L29
|
|
11589
|
+
*/
|
|
11590
|
+
function isSetComputeLimitInstruction(ix) {
|
|
11591
|
+
return (ix.programId.equals(web3_js.ComputeBudgetProgram.programId) &&
|
|
11592
|
+
ix.data[0] === 2 // opcode for setComputeUnitLimit is 2
|
|
11593
|
+
);
|
|
11594
|
+
}
|
|
11595
|
+
/**
|
|
11596
|
+
* Get the compute units required for a set of instructions via simulation.
|
|
11597
|
+
* Credit https://twitter.com/stegabob, originally from https://x.com/stegaBOB/status/1766662289392889920
|
|
11598
|
+
*/
|
|
11599
|
+
async function getSimulationComputeUnits(connection, instructions, payer, lookupTables, commitment = "confirmed") {
|
|
11600
|
+
var _a, _b, _c;
|
|
11601
|
+
const simulationInstructions = [...instructions];
|
|
11602
|
+
// Replace or add compute limit instruction
|
|
11603
|
+
const computeLimitIndex = simulationInstructions.findIndex(isSetComputeLimitInstruction);
|
|
11604
|
+
const simulationLimitIx = web3_js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
11605
|
+
units: 1400000,
|
|
11606
|
+
});
|
|
11607
|
+
if (computeLimitIndex >= 0) {
|
|
11608
|
+
simulationInstructions[computeLimitIndex] = simulationLimitIx;
|
|
11609
|
+
}
|
|
11610
|
+
else {
|
|
11611
|
+
simulationInstructions.unshift(simulationLimitIx);
|
|
11612
|
+
}
|
|
11613
|
+
const testTransaction = new web3_js.VersionedTransaction(new web3_js.TransactionMessage({
|
|
11614
|
+
instructions: simulationInstructions,
|
|
11615
|
+
payerKey: payer,
|
|
11616
|
+
// RecentBlockhash can by any public key during simulation
|
|
11617
|
+
// since 'replaceRecentBlockhash' is set to 'true' below
|
|
11618
|
+
recentBlockhash: web3_js.PublicKey.default.toString(),
|
|
11619
|
+
}).compileToV0Message(lookupTables));
|
|
11620
|
+
const rpcResponse = await connection.simulateTransaction(testTransaction, {
|
|
11621
|
+
replaceRecentBlockhash: true,
|
|
11622
|
+
sigVerify: false,
|
|
11623
|
+
commitment,
|
|
11624
|
+
});
|
|
11625
|
+
if ((_a = rpcResponse === null || rpcResponse === void 0 ? void 0 : rpcResponse.value) === null || _a === void 0 ? void 0 : _a.err) {
|
|
11626
|
+
const logs = ((_b = rpcResponse.value.logs) === null || _b === void 0 ? void 0 : _b.join("\n • ")) || "No logs available";
|
|
11627
|
+
throw new Error(`Transaction simulation failed:\n •${logs}` +
|
|
11628
|
+
JSON.stringify((_c = rpcResponse === null || rpcResponse === void 0 ? void 0 : rpcResponse.value) === null || _c === void 0 ? void 0 : _c.err));
|
|
11629
|
+
}
|
|
11630
|
+
return rpcResponse.value.unitsConsumed || null;
|
|
11631
|
+
}
|
|
12176
11632
|
/* ------------------------------------------------------------------ */
|
|
12177
11633
|
/* RFC-4501 message */
|
|
12178
11634
|
/* ------------------------------------------------------------------ */
|
|
@@ -12488,7 +11944,6 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
12488
11944
|
// Signal to backend that client supports offchain transaction signing
|
|
12489
11945
|
if (typeof window !== "undefined" &&
|
|
12490
11946
|
window.TAROBASE_SUPPORTS_OFFCHAIN_SIGNING) {
|
|
12491
|
-
console.log("X-Supports-Offchain-Signing", "true");
|
|
12492
11947
|
headers["X-Supports-Offchain-Signing"] = "true";
|
|
12493
11948
|
}
|
|
12494
11949
|
const requestConfig = {
|
|
@@ -16882,7 +16337,7 @@ function output(out, instance) {
|
|
|
16882
16337
|
}
|
|
16883
16338
|
}
|
|
16884
16339
|
|
|
16885
|
-
const crypto$
|
|
16340
|
+
const crypto$3 = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
16886
16341
|
|
|
16887
16342
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
16888
16343
|
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
@@ -16892,20 +16347,20 @@ const crypto$2 = typeof globalThis === 'object' && 'crypto' in globalThis ? glob
|
|
|
16892
16347
|
// Makes the utils un-importable in browsers without a bundler.
|
|
16893
16348
|
// Once node.js 18 is deprecated, we can just drop the import.
|
|
16894
16349
|
const u8a$1 = (a) => a instanceof Uint8Array;
|
|
16895
|
-
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
16350
|
+
const u32$1 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
16896
16351
|
// Cast array to view
|
|
16897
|
-
const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
16352
|
+
const createView$1 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
16898
16353
|
// The rotate right (circular right shift) operation for uint32
|
|
16899
|
-
const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
|
|
16354
|
+
const rotr$1 = (word, shift) => (word << (32 - shift)) | (word >>> shift);
|
|
16900
16355
|
// big-endian hardware is rare. Just in case someone still decides to run hashes:
|
|
16901
16356
|
// early-throw an error because we don't support BE yet.
|
|
16902
|
-
const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
|
16903
|
-
if (!isLE)
|
|
16357
|
+
const isLE$1 = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
|
16358
|
+
if (!isLE$1)
|
|
16904
16359
|
throw new Error('Non little-endian hardware is not supported');
|
|
16905
16360
|
/**
|
|
16906
16361
|
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
16907
16362
|
*/
|
|
16908
|
-
function utf8ToBytes$
|
|
16363
|
+
function utf8ToBytes$2(str) {
|
|
16909
16364
|
if (typeof str !== 'string')
|
|
16910
16365
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
16911
16366
|
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
@@ -16915,9 +16370,9 @@ function utf8ToBytes$1(str) {
|
|
|
16915
16370
|
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
16916
16371
|
* Keep in mind for future mutable operations.
|
|
16917
16372
|
*/
|
|
16918
|
-
function toBytes(data) {
|
|
16373
|
+
function toBytes$1(data) {
|
|
16919
16374
|
if (typeof data === 'string')
|
|
16920
|
-
data = utf8ToBytes$
|
|
16375
|
+
data = utf8ToBytes$2(data);
|
|
16921
16376
|
if (!u8a$1(data))
|
|
16922
16377
|
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
|
16923
16378
|
return data;
|
|
@@ -16925,7 +16380,7 @@ function toBytes(data) {
|
|
|
16925
16380
|
/**
|
|
16926
16381
|
* Copies several Uint8Arrays into one.
|
|
16927
16382
|
*/
|
|
16928
|
-
function concatBytes$
|
|
16383
|
+
function concatBytes$3(...arrays) {
|
|
16929
16384
|
const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
|
|
16930
16385
|
let pad = 0; // walk through each item, ensure they have proper type
|
|
16931
16386
|
arrays.forEach((a) => {
|
|
@@ -16937,14 +16392,14 @@ function concatBytes$2(...arrays) {
|
|
|
16937
16392
|
return r;
|
|
16938
16393
|
}
|
|
16939
16394
|
// For runtime check if class implements interface
|
|
16940
|
-
class Hash {
|
|
16395
|
+
let Hash$1 = class Hash {
|
|
16941
16396
|
// Safe version that clones internal state
|
|
16942
16397
|
clone() {
|
|
16943
16398
|
return this._cloneInto();
|
|
16944
16399
|
}
|
|
16945
|
-
}
|
|
16400
|
+
};
|
|
16946
16401
|
function wrapConstructor(hashCons) {
|
|
16947
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
16402
|
+
const hashC = (msg) => hashCons().update(toBytes$1(msg)).digest();
|
|
16948
16403
|
const tmp = hashCons();
|
|
16949
16404
|
hashC.outputLen = tmp.outputLen;
|
|
16950
16405
|
hashC.blockLen = tmp.blockLen;
|
|
@@ -16954,21 +16409,21 @@ function wrapConstructor(hashCons) {
|
|
|
16954
16409
|
/**
|
|
16955
16410
|
* Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
|
|
16956
16411
|
*/
|
|
16957
|
-
function randomBytes(bytesLength = 32) {
|
|
16958
|
-
if (crypto$
|
|
16959
|
-
return crypto$
|
|
16412
|
+
function randomBytes$1(bytesLength = 32) {
|
|
16413
|
+
if (crypto$3 && typeof crypto$3.getRandomValues === 'function') {
|
|
16414
|
+
return crypto$3.getRandomValues(new Uint8Array(bytesLength));
|
|
16960
16415
|
}
|
|
16961
16416
|
throw new Error('crypto.getRandomValues must be defined');
|
|
16962
16417
|
}
|
|
16963
16418
|
|
|
16964
16419
|
// HMAC (RFC 2104)
|
|
16965
|
-
let HMAC$1 = class HMAC extends Hash {
|
|
16420
|
+
let HMAC$1 = class HMAC extends Hash$1 {
|
|
16966
16421
|
constructor(hash$1, _key) {
|
|
16967
16422
|
super();
|
|
16968
16423
|
this.finished = false;
|
|
16969
16424
|
this.destroyed = false;
|
|
16970
16425
|
hash(hash$1);
|
|
16971
|
-
const key = toBytes(_key);
|
|
16426
|
+
const key = toBytes$1(_key);
|
|
16972
16427
|
this.iHash = hash$1.create();
|
|
16973
16428
|
if (typeof this.iHash.update !== 'function')
|
|
16974
16429
|
throw new Error('Expected instance of class which extends utils.Hash');
|
|
@@ -17037,7 +16492,7 @@ const hmac$1 = (hash, key, message) => new HMAC$1(hash, key).update(message).dig
|
|
|
17037
16492
|
hmac$1.create = (hash, key) => new HMAC$1(hash, key);
|
|
17038
16493
|
|
|
17039
16494
|
// Polyfill for Safari 14
|
|
17040
|
-
function setBigUint64(view, byteOffset, value, isLE) {
|
|
16495
|
+
function setBigUint64$1(view, byteOffset, value, isLE) {
|
|
17041
16496
|
if (typeof view.setBigUint64 === 'function')
|
|
17042
16497
|
return view.setBigUint64(byteOffset, value, isLE);
|
|
17043
16498
|
const _32n = BigInt(32);
|
|
@@ -17050,7 +16505,7 @@ function setBigUint64(view, byteOffset, value, isLE) {
|
|
|
17050
16505
|
view.setUint32(byteOffset + l, wl, isLE);
|
|
17051
16506
|
}
|
|
17052
16507
|
// Base SHA2 class (RFC 6234)
|
|
17053
|
-
class SHA2 extends Hash {
|
|
16508
|
+
class SHA2 extends Hash$1 {
|
|
17054
16509
|
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
17055
16510
|
super();
|
|
17056
16511
|
this.blockLen = blockLen;
|
|
@@ -17062,18 +16517,18 @@ class SHA2 extends Hash {
|
|
|
17062
16517
|
this.pos = 0;
|
|
17063
16518
|
this.destroyed = false;
|
|
17064
16519
|
this.buffer = new Uint8Array(blockLen);
|
|
17065
|
-
this.view = createView(this.buffer);
|
|
16520
|
+
this.view = createView$1(this.buffer);
|
|
17066
16521
|
}
|
|
17067
16522
|
update(data) {
|
|
17068
16523
|
exists(this);
|
|
17069
16524
|
const { view, buffer, blockLen } = this;
|
|
17070
|
-
data = toBytes(data);
|
|
16525
|
+
data = toBytes$1(data);
|
|
17071
16526
|
const len = data.length;
|
|
17072
16527
|
for (let pos = 0; pos < len;) {
|
|
17073
16528
|
const take = Math.min(blockLen - this.pos, len - pos);
|
|
17074
16529
|
// Fast path: we have at least one block in input, cast it to view and process
|
|
17075
16530
|
if (take === blockLen) {
|
|
17076
|
-
const dataView = createView(data);
|
|
16531
|
+
const dataView = createView$1(data);
|
|
17077
16532
|
for (; blockLen <= len - pos; pos += blockLen)
|
|
17078
16533
|
this.process(dataView, pos);
|
|
17079
16534
|
continue;
|
|
@@ -17113,9 +16568,9 @@ class SHA2 extends Hash {
|
|
|
17113
16568
|
// Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
|
|
17114
16569
|
// You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
|
|
17115
16570
|
// So we just write lowest 64 bits of that value.
|
|
17116
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
16571
|
+
setBigUint64$1(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
17117
16572
|
this.process(view, 0);
|
|
17118
|
-
const oview = createView(out);
|
|
16573
|
+
const oview = createView$1(out);
|
|
17119
16574
|
const len = this.outputLen;
|
|
17120
16575
|
// NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
|
|
17121
16576
|
if (len % 4)
|
|
@@ -17151,13 +16606,13 @@ class SHA2 extends Hash {
|
|
|
17151
16606
|
// SHA2-256 need to try 2^128 hashes to execute birthday attack.
|
|
17152
16607
|
// BTC network is doing 2^67 hashes/sec as per early 2023.
|
|
17153
16608
|
// Choice: a ? b : c
|
|
17154
|
-
const Chi = (a, b, c) => (a & b) ^ (~a & c);
|
|
16609
|
+
const Chi$1 = (a, b, c) => (a & b) ^ (~a & c);
|
|
17155
16610
|
// Majority function, true if any two inpust is true
|
|
17156
|
-
const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
|
|
16611
|
+
const Maj$1 = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
|
|
17157
16612
|
// Round constants:
|
|
17158
16613
|
// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
|
|
17159
16614
|
// prettier-ignore
|
|
17160
|
-
const SHA256_K = /* @__PURE__ */ new Uint32Array([
|
|
16615
|
+
const SHA256_K$1 = /* @__PURE__ */ new Uint32Array([
|
|
17161
16616
|
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
17162
16617
|
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
17163
16618
|
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
@@ -17174,8 +16629,8 @@ const IV = /* @__PURE__ */ new Uint32Array([
|
|
|
17174
16629
|
]);
|
|
17175
16630
|
// Temporary buffer, not used to store anything between runs
|
|
17176
16631
|
// Named this way because it matches specification.
|
|
17177
|
-
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
17178
|
-
class SHA256 extends SHA2 {
|
|
16632
|
+
const SHA256_W$1 = /* @__PURE__ */ new Uint32Array(64);
|
|
16633
|
+
let SHA256$1 = class SHA256 extends SHA2 {
|
|
17179
16634
|
constructor() {
|
|
17180
16635
|
super(64, 32, 8, false);
|
|
17181
16636
|
// We cannot use array here since array allows indexing by variable
|
|
@@ -17207,21 +16662,21 @@ class SHA256 extends SHA2 {
|
|
|
17207
16662
|
process(view, offset) {
|
|
17208
16663
|
// Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
|
|
17209
16664
|
for (let i = 0; i < 16; i++, offset += 4)
|
|
17210
|
-
SHA256_W[i] = view.getUint32(offset, false);
|
|
16665
|
+
SHA256_W$1[i] = view.getUint32(offset, false);
|
|
17211
16666
|
for (let i = 16; i < 64; i++) {
|
|
17212
|
-
const W15 = SHA256_W[i - 15];
|
|
17213
|
-
const W2 = SHA256_W[i - 2];
|
|
17214
|
-
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
|
|
17215
|
-
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
|
|
17216
|
-
SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
|
|
16667
|
+
const W15 = SHA256_W$1[i - 15];
|
|
16668
|
+
const W2 = SHA256_W$1[i - 2];
|
|
16669
|
+
const s0 = rotr$1(W15, 7) ^ rotr$1(W15, 18) ^ (W15 >>> 3);
|
|
16670
|
+
const s1 = rotr$1(W2, 17) ^ rotr$1(W2, 19) ^ (W2 >>> 10);
|
|
16671
|
+
SHA256_W$1[i] = (s1 + SHA256_W$1[i - 7] + s0 + SHA256_W$1[i - 16]) | 0;
|
|
17217
16672
|
}
|
|
17218
16673
|
// Compression function main loop, 64 rounds
|
|
17219
16674
|
let { A, B, C, D, E, F, G, H } = this;
|
|
17220
16675
|
for (let i = 0; i < 64; i++) {
|
|
17221
|
-
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
17222
|
-
const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
|
|
17223
|
-
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
17224
|
-
const T2 = (sigma0 + Maj(A, B, C)) | 0;
|
|
16676
|
+
const sigma1 = rotr$1(E, 6) ^ rotr$1(E, 11) ^ rotr$1(E, 25);
|
|
16677
|
+
const T1 = (H + sigma1 + Chi$1(E, F, G) + SHA256_K$1[i] + SHA256_W$1[i]) | 0;
|
|
16678
|
+
const sigma0 = rotr$1(A, 2) ^ rotr$1(A, 13) ^ rotr$1(A, 22);
|
|
16679
|
+
const T2 = (sigma0 + Maj$1(A, B, C)) | 0;
|
|
17225
16680
|
H = G;
|
|
17226
16681
|
G = F;
|
|
17227
16682
|
F = E;
|
|
@@ -17243,37 +16698,37 @@ class SHA256 extends SHA2 {
|
|
|
17243
16698
|
this.set(A, B, C, D, E, F, G, H);
|
|
17244
16699
|
}
|
|
17245
16700
|
roundClean() {
|
|
17246
|
-
SHA256_W.fill(0);
|
|
16701
|
+
SHA256_W$1.fill(0);
|
|
17247
16702
|
}
|
|
17248
16703
|
destroy() {
|
|
17249
16704
|
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
17250
16705
|
this.buffer.fill(0);
|
|
17251
16706
|
}
|
|
17252
|
-
}
|
|
16707
|
+
};
|
|
17253
16708
|
/**
|
|
17254
16709
|
* SHA2-256 hash function
|
|
17255
16710
|
* @param message - data that would be hashed
|
|
17256
16711
|
*/
|
|
17257
|
-
const sha256$
|
|
16712
|
+
const sha256$2 = /* @__PURE__ */ wrapConstructor(() => new SHA256$1());
|
|
17258
16713
|
|
|
17259
|
-
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
17260
|
-
const _32n = /* @__PURE__ */ BigInt(32);
|
|
16714
|
+
const U32_MASK64$1 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
16715
|
+
const _32n$1 = /* @__PURE__ */ BigInt(32);
|
|
17261
16716
|
// We are not using BigUint64Array, because they are extremely slow as per 2022
|
|
17262
|
-
function fromBig(n, le = false) {
|
|
16717
|
+
function fromBig$1(n, le = false) {
|
|
17263
16718
|
if (le)
|
|
17264
|
-
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
17265
|
-
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
16719
|
+
return { h: Number(n & U32_MASK64$1), l: Number((n >> _32n$1) & U32_MASK64$1) };
|
|
16720
|
+
return { h: Number((n >> _32n$1) & U32_MASK64$1) | 0, l: Number(n & U32_MASK64$1) | 0 };
|
|
17266
16721
|
}
|
|
17267
|
-
function split(lst, le = false) {
|
|
16722
|
+
function split$1(lst, le = false) {
|
|
17268
16723
|
let Ah = new Uint32Array(lst.length);
|
|
17269
16724
|
let Al = new Uint32Array(lst.length);
|
|
17270
16725
|
for (let i = 0; i < lst.length; i++) {
|
|
17271
|
-
const { h, l } = fromBig(lst[i], le);
|
|
16726
|
+
const { h, l } = fromBig$1(lst[i], le);
|
|
17272
16727
|
[Ah[i], Al[i]] = [h, l];
|
|
17273
16728
|
}
|
|
17274
16729
|
return [Ah, Al];
|
|
17275
16730
|
}
|
|
17276
|
-
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
|
16731
|
+
const toBig = (h, l) => (BigInt(h >>> 0) << _32n$1) | BigInt(l >>> 0);
|
|
17277
16732
|
// for Shift in [0, 32)
|
|
17278
16733
|
const shrSH = (h, _l, s) => h >>> s;
|
|
17279
16734
|
const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
|
@@ -17287,11 +16742,11 @@ const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
|
|
|
17287
16742
|
const rotr32H = (_h, l) => l;
|
|
17288
16743
|
const rotr32L = (h, _l) => h;
|
|
17289
16744
|
// Left rotate for Shift in [1, 32)
|
|
17290
|
-
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
17291
|
-
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
16745
|
+
const rotlSH$1 = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
16746
|
+
const rotlSL$1 = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
17292
16747
|
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
17293
|
-
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
17294
|
-
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
16748
|
+
const rotlBH$1 = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
16749
|
+
const rotlBL$1 = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
17295
16750
|
// JS uses 32-bit signed integers for bitwise operations which means we cannot
|
|
17296
16751
|
// simple take carry out of low bit sum by shift, we need to use division.
|
|
17297
16752
|
function add(Ah, Al, Bh, Bl) {
|
|
@@ -17307,11 +16762,11 @@ const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl
|
|
|
17307
16762
|
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
|
|
17308
16763
|
// prettier-ignore
|
|
17309
16764
|
const u64 = {
|
|
17310
|
-
fromBig, split, toBig,
|
|
16765
|
+
fromBig: fromBig$1, split: split$1, toBig,
|
|
17311
16766
|
shrSH, shrSL,
|
|
17312
16767
|
rotrSH, rotrSL, rotrBH, rotrBL,
|
|
17313
16768
|
rotr32H, rotr32L,
|
|
17314
|
-
rotlSH, rotlSL, rotlBH, rotlBL,
|
|
16769
|
+
rotlSH: rotlSH$1, rotlSL: rotlSL$1, rotlBH: rotlBH$1, rotlBL: rotlBL$1,
|
|
17315
16770
|
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
|
17316
16771
|
};
|
|
17317
16772
|
|
|
@@ -17488,7 +16943,7 @@ const anyGlobal = getGlobal();
|
|
|
17488
16943
|
anyGlobal.crypto || anyGlobal.msCrypto;
|
|
17489
16944
|
function createHash(algo) {
|
|
17490
16945
|
switch (algo) {
|
|
17491
|
-
case "sha256": return sha256$
|
|
16946
|
+
case "sha256": return sha256$2.create();
|
|
17492
16947
|
case "sha512": return sha512.create();
|
|
17493
16948
|
}
|
|
17494
16949
|
assertArgument(false, "invalid hashing algorithm name", "algorithm", algo);
|
|
@@ -17519,10 +16974,10 @@ for (let round = 0, R = _1n$b, x = 1, y = 0; round < 24; round++) {
|
|
|
17519
16974
|
}
|
|
17520
16975
|
_SHA3_IOTA$1.push(t);
|
|
17521
16976
|
}
|
|
17522
|
-
const [SHA3_IOTA_H$1, SHA3_IOTA_L$1] = /* @__PURE__ */ split(_SHA3_IOTA$1, true);
|
|
16977
|
+
const [SHA3_IOTA_H$1, SHA3_IOTA_L$1] = /* @__PURE__ */ split$1(_SHA3_IOTA$1, true);
|
|
17523
16978
|
// Left rotation (without 0, 32, 64)
|
|
17524
|
-
const rotlH$1 = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
|
|
17525
|
-
const rotlL$1 = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
|
|
16979
|
+
const rotlH$1 = (h, l, s) => (s > 32 ? rotlBH$1(h, l, s) : rotlSH$1(h, l, s));
|
|
16980
|
+
const rotlL$1 = (h, l, s) => (s > 32 ? rotlBL$1(h, l, s) : rotlSL$1(h, l, s));
|
|
17526
16981
|
// Same as keccakf1600, but allows to skip some rounds
|
|
17527
16982
|
function keccakP$1(s, rounds = 24) {
|
|
17528
16983
|
const B = new Uint32Array(5 * 2);
|
|
@@ -17569,7 +17024,7 @@ function keccakP$1(s, rounds = 24) {
|
|
|
17569
17024
|
}
|
|
17570
17025
|
B.fill(0);
|
|
17571
17026
|
}
|
|
17572
|
-
let Keccak$1 = class Keccak extends Hash {
|
|
17027
|
+
let Keccak$1 = class Keccak extends Hash$1 {
|
|
17573
17028
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
17574
17029
|
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
17575
17030
|
super();
|
|
@@ -17588,7 +17043,7 @@ let Keccak$1 = class Keccak extends Hash {
|
|
|
17588
17043
|
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
17589
17044
|
throw new Error('Sha3 supports only keccak-f1600 function');
|
|
17590
17045
|
this.state = new Uint8Array(200);
|
|
17591
|
-
this.state32 = u32(this.state);
|
|
17046
|
+
this.state32 = u32$1(this.state);
|
|
17592
17047
|
}
|
|
17593
17048
|
keccak() {
|
|
17594
17049
|
keccakP$1(this.state32, this.rounds);
|
|
@@ -17598,7 +17053,7 @@ let Keccak$1 = class Keccak extends Hash {
|
|
|
17598
17053
|
update(data) {
|
|
17599
17054
|
exists(this);
|
|
17600
17055
|
const { blockLen, state } = this;
|
|
17601
|
-
data = toBytes(data);
|
|
17056
|
+
data = toBytes$1(data);
|
|
17602
17057
|
const len = data.length;
|
|
17603
17058
|
for (let pos = 0; pos < len;) {
|
|
17604
17059
|
const take = Math.min(blockLen - this.pos, len - pos);
|
|
@@ -17753,20 +17208,20 @@ let locked256 = false;
|
|
|
17753
17208
|
* //_result:
|
|
17754
17209
|
*
|
|
17755
17210
|
*/
|
|
17756
|
-
function sha256(_data) {
|
|
17211
|
+
function sha256$1(_data) {
|
|
17757
17212
|
const data = getBytes(_data, "data");
|
|
17758
17213
|
return hexlify(__sha256(data));
|
|
17759
17214
|
}
|
|
17760
|
-
sha256._ = _sha256;
|
|
17761
|
-
sha256.lock = function () { locked256 = true; };
|
|
17762
|
-
sha256.register = function (func) {
|
|
17215
|
+
sha256$1._ = _sha256;
|
|
17216
|
+
sha256$1.lock = function () { locked256 = true; };
|
|
17217
|
+
sha256$1.register = function (func) {
|
|
17763
17218
|
if (locked256) {
|
|
17764
17219
|
throw new Error("sha256 is locked");
|
|
17765
17220
|
}
|
|
17766
17221
|
__sha256 = func;
|
|
17767
17222
|
};
|
|
17768
|
-
Object.freeze(sha256);
|
|
17769
|
-
Object.freeze(sha256);
|
|
17223
|
+
Object.freeze(sha256$1);
|
|
17224
|
+
Object.freeze(sha256$1);
|
|
17770
17225
|
|
|
17771
17226
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
17772
17227
|
// 100 lines of code in the file are duplicated from noble-hashes (utils).
|
|
@@ -17875,7 +17330,7 @@ function ensureBytes$1(title, hex, expectedLength) {
|
|
|
17875
17330
|
/**
|
|
17876
17331
|
* Copies several Uint8Arrays into one.
|
|
17877
17332
|
*/
|
|
17878
|
-
function concatBytes$
|
|
17333
|
+
function concatBytes$2(...arrays) {
|
|
17879
17334
|
const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
|
|
17880
17335
|
let pad = 0; // walk through each item, ensure they have proper type
|
|
17881
17336
|
arrays.forEach((a) => {
|
|
@@ -17898,7 +17353,7 @@ function equalBytes(b1, b2) {
|
|
|
17898
17353
|
/**
|
|
17899
17354
|
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
17900
17355
|
*/
|
|
17901
|
-
function utf8ToBytes(str) {
|
|
17356
|
+
function utf8ToBytes$1(str) {
|
|
17902
17357
|
if (typeof str !== 'string')
|
|
17903
17358
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
17904
17359
|
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
@@ -17981,7 +17436,7 @@ function createHmacDrbg$1(hashLen, qByteLen, hmacFn) {
|
|
|
17981
17436
|
out.push(sl);
|
|
17982
17437
|
len += v.length;
|
|
17983
17438
|
}
|
|
17984
|
-
return concatBytes$
|
|
17439
|
+
return concatBytes$2(...out);
|
|
17985
17440
|
};
|
|
17986
17441
|
const genUntil = (seed, pred) => {
|
|
17987
17442
|
reset();
|
|
@@ -18043,7 +17498,7 @@ var ut$4 = /*#__PURE__*/Object.freeze({
|
|
|
18043
17498
|
bytesToHex: bytesToHex$1,
|
|
18044
17499
|
bytesToNumberBE: bytesToNumberBE$1,
|
|
18045
17500
|
bytesToNumberLE: bytesToNumberLE$1,
|
|
18046
|
-
concatBytes: concatBytes$
|
|
17501
|
+
concatBytes: concatBytes$2,
|
|
18047
17502
|
createHmacDrbg: createHmacDrbg$1,
|
|
18048
17503
|
ensureBytes: ensureBytes$1,
|
|
18049
17504
|
equalBytes: equalBytes,
|
|
@@ -18053,7 +17508,7 @@ var ut$4 = /*#__PURE__*/Object.freeze({
|
|
|
18053
17508
|
numberToBytesLE: numberToBytesLE$1,
|
|
18054
17509
|
numberToHexUnpadded: numberToHexUnpadded$1,
|
|
18055
17510
|
numberToVarBytesBE: numberToVarBytesBE,
|
|
18056
|
-
utf8ToBytes: utf8ToBytes,
|
|
17511
|
+
utf8ToBytes: utf8ToBytes$1,
|
|
18057
17512
|
validateObject: validateObject$1
|
|
18058
17513
|
});
|
|
18059
17514
|
|
|
@@ -18661,7 +18116,7 @@ function weierstrassPoints$1(opts) {
|
|
|
18661
18116
|
const toBytes = CURVE.toBytes ||
|
|
18662
18117
|
((_c, point, _isCompressed) => {
|
|
18663
18118
|
const a = point.toAffine();
|
|
18664
|
-
return concatBytes$
|
|
18119
|
+
return concatBytes$2(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y));
|
|
18665
18120
|
});
|
|
18666
18121
|
const fromBytes = CURVE.fromBytes ||
|
|
18667
18122
|
((bytes) => {
|
|
@@ -19114,7 +18569,7 @@ function weierstrass$1(curveDef) {
|
|
|
19114
18569
|
toBytes(_c, point, isCompressed) {
|
|
19115
18570
|
const a = point.toAffine();
|
|
19116
18571
|
const x = Fp.toBytes(a.x);
|
|
19117
|
-
const cat = concatBytes$
|
|
18572
|
+
const cat = concatBytes$2;
|
|
19118
18573
|
if (isCompressed) {
|
|
19119
18574
|
return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);
|
|
19120
18575
|
}
|
|
@@ -19364,7 +18819,7 @@ function weierstrass$1(curveDef) {
|
|
|
19364
18819
|
const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is
|
|
19365
18820
|
seedArgs.push(ensureBytes$1('extraEntropy', e)); // check for being bytes
|
|
19366
18821
|
}
|
|
19367
|
-
const seed = concatBytes$
|
|
18822
|
+
const seed = concatBytes$2(...seedArgs); // Step D of RFC6979 3.2
|
|
19368
18823
|
const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!
|
|
19369
18824
|
// Converts signature params into point w r/s, checks result for validity.
|
|
19370
18825
|
function k2sig(kBytes) {
|
|
@@ -19498,8 +18953,8 @@ function weierstrass$1(curveDef) {
|
|
|
19498
18953
|
function getHash$1(hash) {
|
|
19499
18954
|
return {
|
|
19500
18955
|
hash,
|
|
19501
|
-
hmac: (key, ...msgs) => hmac$1(hash, key, concatBytes$
|
|
19502
|
-
randomBytes,
|
|
18956
|
+
hmac: (key, ...msgs) => hmac$1(hash, key, concatBytes$3(...msgs)),
|
|
18957
|
+
randomBytes: randomBytes$1,
|
|
19503
18958
|
};
|
|
19504
18959
|
}
|
|
19505
18960
|
function createCurve$1(curveDef, defHash) {
|
|
@@ -19583,7 +19038,7 @@ const secp256k1$1 = createCurve$1({
|
|
|
19583
19038
|
return { k1neg, k1, k2neg, k2 };
|
|
19584
19039
|
},
|
|
19585
19040
|
},
|
|
19586
|
-
}, sha256$
|
|
19041
|
+
}, sha256$2);
|
|
19587
19042
|
// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.
|
|
19588
19043
|
// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
|
|
19589
19044
|
BigInt(0);
|
|
@@ -20319,7 +19774,7 @@ function getVersionedHash(version, hash) {
|
|
|
20319
19774
|
while (versioned.length < 2) {
|
|
20320
19775
|
versioned = "0" + versioned;
|
|
20321
19776
|
}
|
|
20322
|
-
versioned += sha256(hash).substring(4);
|
|
19777
|
+
versioned += sha256$1(hash).substring(4);
|
|
20323
19778
|
return "0x" + versioned;
|
|
20324
19779
|
}
|
|
20325
19780
|
function handleAddress(value) {
|
|
@@ -21408,6 +20863,133 @@ class Transaction {
|
|
|
21408
20863
|
}
|
|
21409
20864
|
}
|
|
21410
20865
|
|
|
20866
|
+
// base-x encoding / decoding
|
|
20867
|
+
// Copyright (c) 2018 base-x contributors
|
|
20868
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
20869
|
+
// Distributed under the MIT software license, see the accompanying
|
|
20870
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
20871
|
+
function base$1 (ALPHABET) {
|
|
20872
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
20873
|
+
const BASE_MAP = new Uint8Array(256);
|
|
20874
|
+
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
20875
|
+
BASE_MAP[j] = 255;
|
|
20876
|
+
}
|
|
20877
|
+
for (let i = 0; i < ALPHABET.length; i++) {
|
|
20878
|
+
const x = ALPHABET.charAt(i);
|
|
20879
|
+
const xc = x.charCodeAt(0);
|
|
20880
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
20881
|
+
BASE_MAP[xc] = i;
|
|
20882
|
+
}
|
|
20883
|
+
const BASE = ALPHABET.length;
|
|
20884
|
+
const LEADER = ALPHABET.charAt(0);
|
|
20885
|
+
const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
20886
|
+
const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
20887
|
+
function encode (source) {
|
|
20888
|
+
// eslint-disable-next-line no-empty
|
|
20889
|
+
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
20890
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
20891
|
+
} else if (Array.isArray(source)) {
|
|
20892
|
+
source = Uint8Array.from(source);
|
|
20893
|
+
}
|
|
20894
|
+
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
20895
|
+
if (source.length === 0) { return '' }
|
|
20896
|
+
// Skip & count leading zeroes.
|
|
20897
|
+
let zeroes = 0;
|
|
20898
|
+
let length = 0;
|
|
20899
|
+
let pbegin = 0;
|
|
20900
|
+
const pend = source.length;
|
|
20901
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
20902
|
+
pbegin++;
|
|
20903
|
+
zeroes++;
|
|
20904
|
+
}
|
|
20905
|
+
// Allocate enough space in big-endian base58 representation.
|
|
20906
|
+
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
20907
|
+
const b58 = new Uint8Array(size);
|
|
20908
|
+
// Process the bytes.
|
|
20909
|
+
while (pbegin !== pend) {
|
|
20910
|
+
let carry = source[pbegin];
|
|
20911
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
20912
|
+
let i = 0;
|
|
20913
|
+
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
20914
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
20915
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
20916
|
+
carry = (carry / BASE) >>> 0;
|
|
20917
|
+
}
|
|
20918
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20919
|
+
length = i;
|
|
20920
|
+
pbegin++;
|
|
20921
|
+
}
|
|
20922
|
+
// Skip leading zeroes in base58 result.
|
|
20923
|
+
let it2 = size - length;
|
|
20924
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
20925
|
+
it2++;
|
|
20926
|
+
}
|
|
20927
|
+
// Translate the result into a string.
|
|
20928
|
+
let str = LEADER.repeat(zeroes);
|
|
20929
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
20930
|
+
return str
|
|
20931
|
+
}
|
|
20932
|
+
function decodeUnsafe (source) {
|
|
20933
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
20934
|
+
if (source.length === 0) { return new Uint8Array() }
|
|
20935
|
+
let psz = 0;
|
|
20936
|
+
// Skip and count leading '1's.
|
|
20937
|
+
let zeroes = 0;
|
|
20938
|
+
let length = 0;
|
|
20939
|
+
while (source[psz] === LEADER) {
|
|
20940
|
+
zeroes++;
|
|
20941
|
+
psz++;
|
|
20942
|
+
}
|
|
20943
|
+
// Allocate enough space in big-endian base256 representation.
|
|
20944
|
+
const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
20945
|
+
const b256 = new Uint8Array(size);
|
|
20946
|
+
// Process the characters.
|
|
20947
|
+
while (psz < source.length) {
|
|
20948
|
+
// Find code of next character
|
|
20949
|
+
const charCode = source.charCodeAt(psz);
|
|
20950
|
+
// Base map can not be indexed using char code
|
|
20951
|
+
if (charCode > 255) { return }
|
|
20952
|
+
// Decode character
|
|
20953
|
+
let carry = BASE_MAP[charCode];
|
|
20954
|
+
// Invalid character
|
|
20955
|
+
if (carry === 255) { return }
|
|
20956
|
+
let i = 0;
|
|
20957
|
+
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
20958
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
20959
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
20960
|
+
carry = (carry / 256) >>> 0;
|
|
20961
|
+
}
|
|
20962
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20963
|
+
length = i;
|
|
20964
|
+
psz++;
|
|
20965
|
+
}
|
|
20966
|
+
// Skip leading zeroes in b256.
|
|
20967
|
+
let it4 = size - length;
|
|
20968
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
20969
|
+
it4++;
|
|
20970
|
+
}
|
|
20971
|
+
const vch = new Uint8Array(zeroes + (size - it4));
|
|
20972
|
+
let j = zeroes;
|
|
20973
|
+
while (it4 !== size) {
|
|
20974
|
+
vch[j++] = b256[it4++];
|
|
20975
|
+
}
|
|
20976
|
+
return vch
|
|
20977
|
+
}
|
|
20978
|
+
function decode (string) {
|
|
20979
|
+
const buffer = decodeUnsafe(string);
|
|
20980
|
+
if (buffer) { return buffer }
|
|
20981
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
20982
|
+
}
|
|
20983
|
+
return {
|
|
20984
|
+
encode,
|
|
20985
|
+
decodeUnsafe,
|
|
20986
|
+
decode
|
|
20987
|
+
}
|
|
20988
|
+
}
|
|
20989
|
+
|
|
20990
|
+
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
20991
|
+
var ue$3 = base$1(ALPHABET);
|
|
20992
|
+
|
|
21411
20993
|
// src/index.ts
|
|
21412
20994
|
function parseSignMessageResponse(base64Response, networkId) {
|
|
21413
20995
|
const networkPrefix = networkId.split(":")[0].toLowerCase();
|
|
@@ -25702,6 +25284,183 @@ class PhantomWalletProvider {
|
|
|
25702
25284
|
}
|
|
25703
25285
|
}
|
|
25704
25286
|
|
|
25287
|
+
/**
|
|
25288
|
+
* Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
|
|
25289
|
+
* @todo re-check https://issues.chromium.org/issues/42212588
|
|
25290
|
+
* @module
|
|
25291
|
+
*/
|
|
25292
|
+
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
25293
|
+
const _32n = /* @__PURE__ */ BigInt(32);
|
|
25294
|
+
function fromBig(n, le = false) {
|
|
25295
|
+
if (le)
|
|
25296
|
+
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
25297
|
+
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
25298
|
+
}
|
|
25299
|
+
function split(lst, le = false) {
|
|
25300
|
+
const len = lst.length;
|
|
25301
|
+
let Ah = new Uint32Array(len);
|
|
25302
|
+
let Al = new Uint32Array(len);
|
|
25303
|
+
for (let i = 0; i < len; i++) {
|
|
25304
|
+
const { h, l } = fromBig(lst[i], le);
|
|
25305
|
+
[Ah[i], Al[i]] = [h, l];
|
|
25306
|
+
}
|
|
25307
|
+
return [Ah, Al];
|
|
25308
|
+
}
|
|
25309
|
+
// Left rotate for Shift in [1, 32)
|
|
25310
|
+
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
25311
|
+
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
25312
|
+
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
25313
|
+
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
25314
|
+
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
25315
|
+
|
|
25316
|
+
const crypto$2 = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
25317
|
+
|
|
25318
|
+
/**
|
|
25319
|
+
* Utilities for hex, bytes, CSPRNG.
|
|
25320
|
+
* @module
|
|
25321
|
+
*/
|
|
25322
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
25323
|
+
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
25324
|
+
// node.js versions earlier than v19 don't declare it in global scope.
|
|
25325
|
+
// For node.js, package.json#exports field mapping rewrites import
|
|
25326
|
+
// from `crypto` to `cryptoNode`, which imports native module.
|
|
25327
|
+
// Makes the utils un-importable in browsers without a bundler.
|
|
25328
|
+
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
|
25329
|
+
/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
|
|
25330
|
+
function isBytes$2(a) {
|
|
25331
|
+
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
|
25332
|
+
}
|
|
25333
|
+
/** Asserts something is positive integer. */
|
|
25334
|
+
function anumber$1(n) {
|
|
25335
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
25336
|
+
throw new Error('positive integer expected, got ' + n);
|
|
25337
|
+
}
|
|
25338
|
+
/** Asserts something is Uint8Array. */
|
|
25339
|
+
function abytes$2(b, ...lengths) {
|
|
25340
|
+
if (!isBytes$2(b))
|
|
25341
|
+
throw new Error('Uint8Array expected');
|
|
25342
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
25343
|
+
throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
|
|
25344
|
+
}
|
|
25345
|
+
/** Asserts something is hash */
|
|
25346
|
+
function ahash(h) {
|
|
25347
|
+
if (typeof h !== 'function' || typeof h.create !== 'function')
|
|
25348
|
+
throw new Error('Hash should be wrapped by utils.createHasher');
|
|
25349
|
+
anumber$1(h.outputLen);
|
|
25350
|
+
anumber$1(h.blockLen);
|
|
25351
|
+
}
|
|
25352
|
+
/** Asserts a hash instance has not been destroyed / finished */
|
|
25353
|
+
function aexists(instance, checkFinished = true) {
|
|
25354
|
+
if (instance.destroyed)
|
|
25355
|
+
throw new Error('Hash instance has been destroyed');
|
|
25356
|
+
if (checkFinished && instance.finished)
|
|
25357
|
+
throw new Error('Hash#digest() has already been called');
|
|
25358
|
+
}
|
|
25359
|
+
/** Asserts output is properly-sized byte array */
|
|
25360
|
+
function aoutput(out, instance) {
|
|
25361
|
+
abytes$2(out);
|
|
25362
|
+
const min = instance.outputLen;
|
|
25363
|
+
if (out.length < min) {
|
|
25364
|
+
throw new Error('digestInto() expects output buffer of length at least ' + min);
|
|
25365
|
+
}
|
|
25366
|
+
}
|
|
25367
|
+
/** Cast u8 / u16 / u32 to u32. */
|
|
25368
|
+
function u32(arr) {
|
|
25369
|
+
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
25370
|
+
}
|
|
25371
|
+
/** Zeroize a byte array. Warning: JS provides no guarantees. */
|
|
25372
|
+
function clean(...arrays) {
|
|
25373
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
25374
|
+
arrays[i].fill(0);
|
|
25375
|
+
}
|
|
25376
|
+
}
|
|
25377
|
+
/** Create DataView of an array for easy byte-level manipulation. */
|
|
25378
|
+
function createView(arr) {
|
|
25379
|
+
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
25380
|
+
}
|
|
25381
|
+
/** The rotate right (circular right shift) operation for uint32 */
|
|
25382
|
+
function rotr(word, shift) {
|
|
25383
|
+
return (word << (32 - shift)) | (word >>> shift);
|
|
25384
|
+
}
|
|
25385
|
+
/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
|
|
25386
|
+
const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
|
|
25387
|
+
/** The byte swap operation for uint32 */
|
|
25388
|
+
function byteSwap(word) {
|
|
25389
|
+
return (((word << 24) & 0xff000000) |
|
|
25390
|
+
((word << 8) & 0xff0000) |
|
|
25391
|
+
((word >>> 8) & 0xff00) |
|
|
25392
|
+
((word >>> 24) & 0xff));
|
|
25393
|
+
}
|
|
25394
|
+
/** In place byte swap for Uint32Array */
|
|
25395
|
+
function byteSwap32(arr) {
|
|
25396
|
+
for (let i = 0; i < arr.length; i++) {
|
|
25397
|
+
arr[i] = byteSwap(arr[i]);
|
|
25398
|
+
}
|
|
25399
|
+
return arr;
|
|
25400
|
+
}
|
|
25401
|
+
const swap32IfBE = isLE
|
|
25402
|
+
? (u) => u
|
|
25403
|
+
: byteSwap32;
|
|
25404
|
+
/**
|
|
25405
|
+
* Converts string to bytes using UTF8 encoding.
|
|
25406
|
+
* @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
|
|
25407
|
+
*/
|
|
25408
|
+
function utf8ToBytes(str) {
|
|
25409
|
+
if (typeof str !== 'string')
|
|
25410
|
+
throw new Error('string expected');
|
|
25411
|
+
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
25412
|
+
}
|
|
25413
|
+
/**
|
|
25414
|
+
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
25415
|
+
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
25416
|
+
* Keep in mind for future mutable operations.
|
|
25417
|
+
*/
|
|
25418
|
+
function toBytes(data) {
|
|
25419
|
+
if (typeof data === 'string')
|
|
25420
|
+
data = utf8ToBytes(data);
|
|
25421
|
+
abytes$2(data);
|
|
25422
|
+
return data;
|
|
25423
|
+
}
|
|
25424
|
+
/** Copies several Uint8Arrays into one. */
|
|
25425
|
+
function concatBytes$1(...arrays) {
|
|
25426
|
+
let sum = 0;
|
|
25427
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
25428
|
+
const a = arrays[i];
|
|
25429
|
+
abytes$2(a);
|
|
25430
|
+
sum += a.length;
|
|
25431
|
+
}
|
|
25432
|
+
const res = new Uint8Array(sum);
|
|
25433
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
25434
|
+
const a = arrays[i];
|
|
25435
|
+
res.set(a, pad);
|
|
25436
|
+
pad += a.length;
|
|
25437
|
+
}
|
|
25438
|
+
return res;
|
|
25439
|
+
}
|
|
25440
|
+
/** For runtime check if class implements interface */
|
|
25441
|
+
class Hash {
|
|
25442
|
+
}
|
|
25443
|
+
/** Wraps hash function, creating an interface on top of it */
|
|
25444
|
+
function createHasher(hashCons) {
|
|
25445
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
25446
|
+
const tmp = hashCons();
|
|
25447
|
+
hashC.outputLen = tmp.outputLen;
|
|
25448
|
+
hashC.blockLen = tmp.blockLen;
|
|
25449
|
+
hashC.create = () => hashCons();
|
|
25450
|
+
return hashC;
|
|
25451
|
+
}
|
|
25452
|
+
/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
|
|
25453
|
+
function randomBytes(bytesLength = 32) {
|
|
25454
|
+
if (crypto$2 && typeof crypto$2.getRandomValues === 'function') {
|
|
25455
|
+
return crypto$2.getRandomValues(new Uint8Array(bytesLength));
|
|
25456
|
+
}
|
|
25457
|
+
// Legacy Node.js compatibility
|
|
25458
|
+
if (crypto$2 && typeof crypto$2.randomBytes === 'function') {
|
|
25459
|
+
return Uint8Array.from(crypto$2.randomBytes(bytesLength));
|
|
25460
|
+
}
|
|
25461
|
+
throw new Error('crypto.getRandomValues must be defined');
|
|
25462
|
+
}
|
|
25463
|
+
|
|
25705
25464
|
/**
|
|
25706
25465
|
* SHA3 (keccak) hash function, based on a new "Sponge function" design.
|
|
25707
25466
|
* Different from older hashes, the internal state is bigger than output size.
|
|
@@ -25740,12 +25499,12 @@ for (let round = 0, R = _1n$5, x = 1, y = 0; round < 24; round++) {
|
|
|
25740
25499
|
}
|
|
25741
25500
|
_SHA3_IOTA.push(t);
|
|
25742
25501
|
}
|
|
25743
|
-
const IOTAS = split
|
|
25502
|
+
const IOTAS = split(_SHA3_IOTA, true);
|
|
25744
25503
|
const SHA3_IOTA_H = IOTAS[0];
|
|
25745
25504
|
const SHA3_IOTA_L = IOTAS[1];
|
|
25746
25505
|
// Left rotation (without 0, 32, 64)
|
|
25747
|
-
const rotlH = (h, l, s) => (s > 32 ? rotlBH
|
|
25748
|
-
const rotlL = (h, l, s) => (s > 32 ? rotlBL
|
|
25506
|
+
const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
|
|
25507
|
+
const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
|
|
25749
25508
|
/** `keccakf1600` internal function, additionally allows to adjust round count. */
|
|
25750
25509
|
function keccakP(s, rounds = 24) {
|
|
25751
25510
|
const B = new Uint32Array(5 * 2);
|
|
@@ -25793,7 +25552,7 @@ function keccakP(s, rounds = 24) {
|
|
|
25793
25552
|
clean(B);
|
|
25794
25553
|
}
|
|
25795
25554
|
/** Keccak sponge function. */
|
|
25796
|
-
class Keccak extends Hash
|
|
25555
|
+
class Keccak extends Hash {
|
|
25797
25556
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
25798
25557
|
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
25799
25558
|
super();
|
|
@@ -25814,7 +25573,7 @@ class Keccak extends Hash$1 {
|
|
|
25814
25573
|
if (!(0 < blockLen && blockLen < 200))
|
|
25815
25574
|
throw new Error('only keccak-f1600 function is supported');
|
|
25816
25575
|
this.state = new Uint8Array(200);
|
|
25817
|
-
this.state32 = u32
|
|
25576
|
+
this.state32 = u32(this.state);
|
|
25818
25577
|
}
|
|
25819
25578
|
clone() {
|
|
25820
25579
|
return this._cloneInto();
|
|
@@ -25828,7 +25587,7 @@ class Keccak extends Hash$1 {
|
|
|
25828
25587
|
}
|
|
25829
25588
|
update(data) {
|
|
25830
25589
|
aexists(this);
|
|
25831
|
-
data = toBytes
|
|
25590
|
+
data = toBytes(data);
|
|
25832
25591
|
abytes$2(data);
|
|
25833
25592
|
const { blockLen, state } = this;
|
|
25834
25593
|
const len = data.length;
|
|
@@ -25914,17 +25673,265 @@ const gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(block
|
|
|
25914
25673
|
/** keccak-256 hash function. Different from SHA3-256. */
|
|
25915
25674
|
const keccak_256 = /* @__PURE__ */ (() => gen(0x01, 136, 256 / 8))();
|
|
25916
25675
|
|
|
25676
|
+
/**
|
|
25677
|
+
* Internal Merkle-Damgard hash utils.
|
|
25678
|
+
* @module
|
|
25679
|
+
*/
|
|
25680
|
+
/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
|
|
25681
|
+
function setBigUint64(view, byteOffset, value, isLE) {
|
|
25682
|
+
if (typeof view.setBigUint64 === 'function')
|
|
25683
|
+
return view.setBigUint64(byteOffset, value, isLE);
|
|
25684
|
+
const _32n = BigInt(32);
|
|
25685
|
+
const _u32_max = BigInt(0xffffffff);
|
|
25686
|
+
const wh = Number((value >> _32n) & _u32_max);
|
|
25687
|
+
const wl = Number(value & _u32_max);
|
|
25688
|
+
const h = isLE ? 4 : 0;
|
|
25689
|
+
const l = isLE ? 0 : 4;
|
|
25690
|
+
view.setUint32(byteOffset + h, wh, isLE);
|
|
25691
|
+
view.setUint32(byteOffset + l, wl, isLE);
|
|
25692
|
+
}
|
|
25693
|
+
/** Choice: a ? b : c */
|
|
25694
|
+
function Chi(a, b, c) {
|
|
25695
|
+
return (a & b) ^ (~a & c);
|
|
25696
|
+
}
|
|
25697
|
+
/** Majority function, true if any two inputs is true. */
|
|
25698
|
+
function Maj(a, b, c) {
|
|
25699
|
+
return (a & b) ^ (a & c) ^ (b & c);
|
|
25700
|
+
}
|
|
25701
|
+
/**
|
|
25702
|
+
* Merkle-Damgard hash construction base class.
|
|
25703
|
+
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
|
|
25704
|
+
*/
|
|
25705
|
+
class HashMD extends Hash {
|
|
25706
|
+
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
25707
|
+
super();
|
|
25708
|
+
this.finished = false;
|
|
25709
|
+
this.length = 0;
|
|
25710
|
+
this.pos = 0;
|
|
25711
|
+
this.destroyed = false;
|
|
25712
|
+
this.blockLen = blockLen;
|
|
25713
|
+
this.outputLen = outputLen;
|
|
25714
|
+
this.padOffset = padOffset;
|
|
25715
|
+
this.isLE = isLE;
|
|
25716
|
+
this.buffer = new Uint8Array(blockLen);
|
|
25717
|
+
this.view = createView(this.buffer);
|
|
25718
|
+
}
|
|
25719
|
+
update(data) {
|
|
25720
|
+
aexists(this);
|
|
25721
|
+
data = toBytes(data);
|
|
25722
|
+
abytes$2(data);
|
|
25723
|
+
const { view, buffer, blockLen } = this;
|
|
25724
|
+
const len = data.length;
|
|
25725
|
+
for (let pos = 0; pos < len;) {
|
|
25726
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
25727
|
+
// Fast path: we have at least one block in input, cast it to view and process
|
|
25728
|
+
if (take === blockLen) {
|
|
25729
|
+
const dataView = createView(data);
|
|
25730
|
+
for (; blockLen <= len - pos; pos += blockLen)
|
|
25731
|
+
this.process(dataView, pos);
|
|
25732
|
+
continue;
|
|
25733
|
+
}
|
|
25734
|
+
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
25735
|
+
this.pos += take;
|
|
25736
|
+
pos += take;
|
|
25737
|
+
if (this.pos === blockLen) {
|
|
25738
|
+
this.process(view, 0);
|
|
25739
|
+
this.pos = 0;
|
|
25740
|
+
}
|
|
25741
|
+
}
|
|
25742
|
+
this.length += data.length;
|
|
25743
|
+
this.roundClean();
|
|
25744
|
+
return this;
|
|
25745
|
+
}
|
|
25746
|
+
digestInto(out) {
|
|
25747
|
+
aexists(this);
|
|
25748
|
+
aoutput(out, this);
|
|
25749
|
+
this.finished = true;
|
|
25750
|
+
// Padding
|
|
25751
|
+
// We can avoid allocation of buffer for padding completely if it
|
|
25752
|
+
// was previously not allocated here. But it won't change performance.
|
|
25753
|
+
const { buffer, view, blockLen, isLE } = this;
|
|
25754
|
+
let { pos } = this;
|
|
25755
|
+
// append the bit '1' to the message
|
|
25756
|
+
buffer[pos++] = 0b10000000;
|
|
25757
|
+
clean(this.buffer.subarray(pos));
|
|
25758
|
+
// we have less than padOffset left in buffer, so we cannot put length in
|
|
25759
|
+
// current block, need process it and pad again
|
|
25760
|
+
if (this.padOffset > blockLen - pos) {
|
|
25761
|
+
this.process(view, 0);
|
|
25762
|
+
pos = 0;
|
|
25763
|
+
}
|
|
25764
|
+
// Pad until full block byte with zeros
|
|
25765
|
+
for (let i = pos; i < blockLen; i++)
|
|
25766
|
+
buffer[i] = 0;
|
|
25767
|
+
// Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
|
|
25768
|
+
// You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
|
|
25769
|
+
// So we just write lowest 64 bits of that value.
|
|
25770
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
25771
|
+
this.process(view, 0);
|
|
25772
|
+
const oview = createView(out);
|
|
25773
|
+
const len = this.outputLen;
|
|
25774
|
+
// NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
|
|
25775
|
+
if (len % 4)
|
|
25776
|
+
throw new Error('_sha2: outputLen should be aligned to 32bit');
|
|
25777
|
+
const outLen = len / 4;
|
|
25778
|
+
const state = this.get();
|
|
25779
|
+
if (outLen > state.length)
|
|
25780
|
+
throw new Error('_sha2: outputLen bigger than state');
|
|
25781
|
+
for (let i = 0; i < outLen; i++)
|
|
25782
|
+
oview.setUint32(4 * i, state[i], isLE);
|
|
25783
|
+
}
|
|
25784
|
+
digest() {
|
|
25785
|
+
const { buffer, outputLen } = this;
|
|
25786
|
+
this.digestInto(buffer);
|
|
25787
|
+
const res = buffer.slice(0, outputLen);
|
|
25788
|
+
this.destroy();
|
|
25789
|
+
return res;
|
|
25790
|
+
}
|
|
25791
|
+
_cloneInto(to) {
|
|
25792
|
+
to || (to = new this.constructor());
|
|
25793
|
+
to.set(...this.get());
|
|
25794
|
+
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
25795
|
+
to.destroyed = destroyed;
|
|
25796
|
+
to.finished = finished;
|
|
25797
|
+
to.length = length;
|
|
25798
|
+
to.pos = pos;
|
|
25799
|
+
if (length % blockLen)
|
|
25800
|
+
to.buffer.set(buffer);
|
|
25801
|
+
return to;
|
|
25802
|
+
}
|
|
25803
|
+
clone() {
|
|
25804
|
+
return this._cloneInto();
|
|
25805
|
+
}
|
|
25806
|
+
}
|
|
25807
|
+
/**
|
|
25808
|
+
* Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
|
|
25809
|
+
* Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
|
|
25810
|
+
*/
|
|
25811
|
+
/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
|
|
25812
|
+
const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
25813
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
25814
|
+
]);
|
|
25815
|
+
|
|
25816
|
+
/**
|
|
25817
|
+
* SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
|
|
25818
|
+
* SHA256 is the fastest hash implementable in JS, even faster than Blake3.
|
|
25819
|
+
* Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
|
|
25820
|
+
* [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
|
|
25821
|
+
* @module
|
|
25822
|
+
*/
|
|
25823
|
+
/**
|
|
25824
|
+
* Round constants:
|
|
25825
|
+
* First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
|
|
25826
|
+
*/
|
|
25827
|
+
// prettier-ignore
|
|
25828
|
+
const SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
25829
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
25830
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
25831
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
25832
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
25833
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
25834
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
25835
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
25836
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
25837
|
+
]);
|
|
25838
|
+
/** Reusable temporary buffer. "W" comes straight from spec. */
|
|
25839
|
+
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
25840
|
+
class SHA256 extends HashMD {
|
|
25841
|
+
constructor(outputLen = 32) {
|
|
25842
|
+
super(64, outputLen, 8, false);
|
|
25843
|
+
// We cannot use array here since array allows indexing by variable
|
|
25844
|
+
// which means optimizer/compiler cannot use registers.
|
|
25845
|
+
this.A = SHA256_IV[0] | 0;
|
|
25846
|
+
this.B = SHA256_IV[1] | 0;
|
|
25847
|
+
this.C = SHA256_IV[2] | 0;
|
|
25848
|
+
this.D = SHA256_IV[3] | 0;
|
|
25849
|
+
this.E = SHA256_IV[4] | 0;
|
|
25850
|
+
this.F = SHA256_IV[5] | 0;
|
|
25851
|
+
this.G = SHA256_IV[6] | 0;
|
|
25852
|
+
this.H = SHA256_IV[7] | 0;
|
|
25853
|
+
}
|
|
25854
|
+
get() {
|
|
25855
|
+
const { A, B, C, D, E, F, G, H } = this;
|
|
25856
|
+
return [A, B, C, D, E, F, G, H];
|
|
25857
|
+
}
|
|
25858
|
+
// prettier-ignore
|
|
25859
|
+
set(A, B, C, D, E, F, G, H) {
|
|
25860
|
+
this.A = A | 0;
|
|
25861
|
+
this.B = B | 0;
|
|
25862
|
+
this.C = C | 0;
|
|
25863
|
+
this.D = D | 0;
|
|
25864
|
+
this.E = E | 0;
|
|
25865
|
+
this.F = F | 0;
|
|
25866
|
+
this.G = G | 0;
|
|
25867
|
+
this.H = H | 0;
|
|
25868
|
+
}
|
|
25869
|
+
process(view, offset) {
|
|
25870
|
+
// Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
|
|
25871
|
+
for (let i = 0; i < 16; i++, offset += 4)
|
|
25872
|
+
SHA256_W[i] = view.getUint32(offset, false);
|
|
25873
|
+
for (let i = 16; i < 64; i++) {
|
|
25874
|
+
const W15 = SHA256_W[i - 15];
|
|
25875
|
+
const W2 = SHA256_W[i - 2];
|
|
25876
|
+
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
|
|
25877
|
+
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
|
|
25878
|
+
SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
|
|
25879
|
+
}
|
|
25880
|
+
// Compression function main loop, 64 rounds
|
|
25881
|
+
let { A, B, C, D, E, F, G, H } = this;
|
|
25882
|
+
for (let i = 0; i < 64; i++) {
|
|
25883
|
+
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
25884
|
+
const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
|
|
25885
|
+
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
25886
|
+
const T2 = (sigma0 + Maj(A, B, C)) | 0;
|
|
25887
|
+
H = G;
|
|
25888
|
+
G = F;
|
|
25889
|
+
F = E;
|
|
25890
|
+
E = (D + T1) | 0;
|
|
25891
|
+
D = C;
|
|
25892
|
+
C = B;
|
|
25893
|
+
B = A;
|
|
25894
|
+
A = (T1 + T2) | 0;
|
|
25895
|
+
}
|
|
25896
|
+
// Add the compressed chunk to the current hash value
|
|
25897
|
+
A = (A + this.A) | 0;
|
|
25898
|
+
B = (B + this.B) | 0;
|
|
25899
|
+
C = (C + this.C) | 0;
|
|
25900
|
+
D = (D + this.D) | 0;
|
|
25901
|
+
E = (E + this.E) | 0;
|
|
25902
|
+
F = (F + this.F) | 0;
|
|
25903
|
+
G = (G + this.G) | 0;
|
|
25904
|
+
H = (H + this.H) | 0;
|
|
25905
|
+
this.set(A, B, C, D, E, F, G, H);
|
|
25906
|
+
}
|
|
25907
|
+
roundClean() {
|
|
25908
|
+
clean(SHA256_W);
|
|
25909
|
+
}
|
|
25910
|
+
destroy() {
|
|
25911
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
25912
|
+
clean(this.buffer);
|
|
25913
|
+
}
|
|
25914
|
+
}
|
|
25915
|
+
/**
|
|
25916
|
+
* SHA2-256 hash function from RFC 4634.
|
|
25917
|
+
*
|
|
25918
|
+
* It is the fastest JS hash, even faster than Blake3.
|
|
25919
|
+
* To break sha256 using birthday attack, attackers need to try 2^128 hashes.
|
|
25920
|
+
* BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
|
25921
|
+
*/
|
|
25922
|
+
const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
|
|
25923
|
+
|
|
25917
25924
|
/**
|
|
25918
25925
|
* HMAC: RFC2104 message authentication code.
|
|
25919
25926
|
* @module
|
|
25920
25927
|
*/
|
|
25921
|
-
class HMAC extends Hash
|
|
25928
|
+
class HMAC extends Hash {
|
|
25922
25929
|
constructor(hash, _key) {
|
|
25923
25930
|
super();
|
|
25924
25931
|
this.finished = false;
|
|
25925
25932
|
this.destroyed = false;
|
|
25926
25933
|
ahash(hash);
|
|
25927
|
-
const key = toBytes
|
|
25934
|
+
const key = toBytes(_key);
|
|
25928
25935
|
this.iHash = hash.create();
|
|
25929
25936
|
if (typeof this.iHash.update !== 'function')
|
|
25930
25937
|
throw new Error('Expected instance of class which extends utils.Hash');
|
|
@@ -37258,8 +37265,8 @@ function weierstrass(curveDef) {
|
|
|
37258
37265
|
function getHash(hash) {
|
|
37259
37266
|
return {
|
|
37260
37267
|
hash,
|
|
37261
|
-
hmac: (key, ...msgs) => hmac(hash, key, concatBytes$
|
|
37262
|
-
randomBytes
|
|
37268
|
+
hmac: (key, ...msgs) => hmac(hash, key, concatBytes$1(...msgs)),
|
|
37269
|
+
randomBytes,
|
|
37263
37270
|
};
|
|
37264
37271
|
}
|
|
37265
37272
|
function createCurve(curveDef, defHash) {
|
|
@@ -37365,7 +37372,7 @@ const secp256k1 = createCurve({
|
|
|
37365
37372
|
return { k1neg, k1, k2neg, k2 };
|
|
37366
37373
|
},
|
|
37367
37374
|
},
|
|
37368
|
-
}, sha256
|
|
37375
|
+
}, sha256);
|
|
37369
37376
|
|
|
37370
37377
|
/**
|
|
37371
37378
|
* Deserializes a {@link ox#Hex.Hex} signature into a structured {@link ox#Signature.Signature}.
|
|
@@ -42796,7 +42803,6 @@ class OffchainAuthProvider {
|
|
|
42796
42803
|
this.config = config;
|
|
42797
42804
|
// Signal to API layer that this client supports offchain transaction signing
|
|
42798
42805
|
if (typeof window !== "undefined") {
|
|
42799
|
-
console.log("TAROBASE_SUPPORTS_OFFCHAIN_SIGNING", "true");
|
|
42800
42806
|
window.TAROBASE_SUPPORTS_OFFCHAIN_SIGNING = true;
|
|
42801
42807
|
}
|
|
42802
42808
|
}
|