@heyamiko/amiko-cli 0.14.0-beta.16 → 0.14.0-beta.17
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 +11 -2
- package/dist/index.js +1288 -3392
- package/package.json +1 -1
- package/skills/SKILL.md +6 -5
package/dist/index.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -843,7 +861,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
843
861
|
this._exitCallback = (err) => {
|
|
844
862
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
845
863
|
throw err;
|
|
846
|
-
}
|
|
864
|
+
}
|
|
847
865
|
};
|
|
848
866
|
}
|
|
849
867
|
return this;
|
|
@@ -3578,7 +3596,7 @@ function getHumanReadableErrorMessage(code, context = {}) {
|
|
|
3578
3596
|
function getErrorMessage(code, context = {}) {
|
|
3579
3597
|
if (true) {
|
|
3580
3598
|
return getHumanReadableErrorMessage(code, context);
|
|
3581
|
-
}
|
|
3599
|
+
}
|
|
3582
3600
|
}
|
|
3583
3601
|
function isSolanaError(e, code) {
|
|
3584
3602
|
const isSolanaError2 = e instanceof Error && e.name === "SolanaError";
|
|
@@ -7642,8 +7660,20 @@ var init_src3 = __esm(() => {
|
|
|
7642
7660
|
}
|
|
7643
7661
|
});
|
|
7644
7662
|
|
|
7645
|
-
// node_modules/mppx/node_modules/ox/
|
|
7646
|
-
|
|
7663
|
+
// node_modules/mppx/node_modules/ox/node_modules/@noble/curves/esm/abstract/utils.js
|
|
7664
|
+
function equalBytes(a, b) {
|
|
7665
|
+
if (a.length !== b.length)
|
|
7666
|
+
return false;
|
|
7667
|
+
let diff = 0;
|
|
7668
|
+
for (let i = 0;i < a.length; i++)
|
|
7669
|
+
diff |= a[i] ^ b[i];
|
|
7670
|
+
return diff === 0;
|
|
7671
|
+
}
|
|
7672
|
+
var hasHexBuiltin;
|
|
7673
|
+
var init_utils = __esm(() => {
|
|
7674
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
7675
|
+
hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
|
|
7676
|
+
});
|
|
7647
7677
|
|
|
7648
7678
|
// node_modules/mppx/node_modules/ox/_esm/core/version.js
|
|
7649
7679
|
var version = "0.1.1";
|
|
@@ -7788,1182 +7818,384 @@ var init_Errors = __esm(() => {
|
|
|
7788
7818
|
})();
|
|
7789
7819
|
});
|
|
7790
7820
|
|
|
7791
|
-
// node_modules
|
|
7792
|
-
function
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
}
|
|
7799
|
-
function abytes(b, ...lengths) {
|
|
7800
|
-
if (!isBytes(b))
|
|
7801
|
-
throw new Error("Uint8Array expected");
|
|
7802
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
7803
|
-
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
7804
|
-
}
|
|
7805
|
-
function ahash(h) {
|
|
7806
|
-
if (typeof h !== "function" || typeof h.create !== "function")
|
|
7807
|
-
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
7808
|
-
anumber(h.outputLen);
|
|
7809
|
-
anumber(h.blockLen);
|
|
7821
|
+
// node_modules/mppx/node_modules/ox/_esm/core/internal/bytes.js
|
|
7822
|
+
function assertSize(bytes, size_) {
|
|
7823
|
+
if (size(bytes) > size_)
|
|
7824
|
+
throw new SizeOverflowError({
|
|
7825
|
+
givenSize: size(bytes),
|
|
7826
|
+
maxSize: size_
|
|
7827
|
+
});
|
|
7810
7828
|
}
|
|
7811
|
-
function
|
|
7812
|
-
if (
|
|
7813
|
-
throw new
|
|
7814
|
-
|
|
7815
|
-
|
|
7829
|
+
function assertStartOffset(value, start) {
|
|
7830
|
+
if (typeof start === "number" && start > 0 && start > size(value) - 1)
|
|
7831
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
7832
|
+
offset: start,
|
|
7833
|
+
position: "start",
|
|
7834
|
+
size: size(value)
|
|
7835
|
+
});
|
|
7816
7836
|
}
|
|
7817
|
-
function
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7837
|
+
function assertEndOffset(value, start, end) {
|
|
7838
|
+
if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
|
|
7839
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
7840
|
+
offset: end,
|
|
7841
|
+
position: "end",
|
|
7842
|
+
size: size(value)
|
|
7843
|
+
});
|
|
7822
7844
|
}
|
|
7823
7845
|
}
|
|
7824
|
-
function
|
|
7825
|
-
|
|
7846
|
+
function charCodeToBase16(char) {
|
|
7847
|
+
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
|
7848
|
+
return char - charCodeMap.zero;
|
|
7849
|
+
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
|
7850
|
+
return char - (charCodeMap.A - 10);
|
|
7851
|
+
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
|
7852
|
+
return char - (charCodeMap.a - 10);
|
|
7853
|
+
return;
|
|
7826
7854
|
}
|
|
7827
|
-
function
|
|
7828
|
-
|
|
7829
|
-
|
|
7855
|
+
function pad2(bytes, options2 = {}) {
|
|
7856
|
+
const { dir, size: size2 = 32 } = options2;
|
|
7857
|
+
if (size2 === 0)
|
|
7858
|
+
return bytes;
|
|
7859
|
+
if (bytes.length > size2)
|
|
7860
|
+
throw new SizeExceedsPaddingSizeError({
|
|
7861
|
+
size: bytes.length,
|
|
7862
|
+
targetSize: size2,
|
|
7863
|
+
type: "Bytes"
|
|
7864
|
+
});
|
|
7865
|
+
const paddedBytes = new Uint8Array(size2);
|
|
7866
|
+
for (let i = 0;i < size2; i++) {
|
|
7867
|
+
const padEnd = dir === "right";
|
|
7868
|
+
paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
7830
7869
|
}
|
|
7870
|
+
return paddedBytes;
|
|
7831
7871
|
}
|
|
7832
|
-
function
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7872
|
+
function trim(value, options2 = {}) {
|
|
7873
|
+
const { dir = "left" } = options2;
|
|
7874
|
+
let data = value;
|
|
7875
|
+
let sliceLength = 0;
|
|
7876
|
+
for (let i = 0;i < data.length - 1; i++) {
|
|
7877
|
+
if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
|
|
7878
|
+
sliceLength++;
|
|
7879
|
+
else
|
|
7880
|
+
break;
|
|
7881
|
+
}
|
|
7882
|
+
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
|
|
7883
|
+
return data;
|
|
7837
7884
|
}
|
|
7838
|
-
|
|
7839
|
-
|
|
7885
|
+
var charCodeMap;
|
|
7886
|
+
var init_bytes = __esm(() => {
|
|
7887
|
+
init_Bytes();
|
|
7888
|
+
charCodeMap = {
|
|
7889
|
+
zero: 48,
|
|
7890
|
+
nine: 57,
|
|
7891
|
+
A: 65,
|
|
7892
|
+
F: 70,
|
|
7893
|
+
a: 97,
|
|
7894
|
+
f: 102
|
|
7895
|
+
};
|
|
7896
|
+
});
|
|
7897
|
+
|
|
7898
|
+
// node_modules/mppx/node_modules/ox/_esm/core/internal/hex.js
|
|
7899
|
+
function assertSize2(hex, size_) {
|
|
7900
|
+
if (size2(hex) > size_)
|
|
7901
|
+
throw new SizeOverflowError2({
|
|
7902
|
+
givenSize: size2(hex),
|
|
7903
|
+
maxSize: size_
|
|
7904
|
+
});
|
|
7840
7905
|
}
|
|
7841
|
-
function
|
|
7842
|
-
|
|
7906
|
+
function pad3(hex_, options2 = {}) {
|
|
7907
|
+
const { dir, size: size3 = 32 } = options2;
|
|
7908
|
+
if (size3 === 0)
|
|
7909
|
+
return hex_;
|
|
7910
|
+
const hex = hex_.replace("0x", "");
|
|
7911
|
+
if (hex.length > size3 * 2)
|
|
7912
|
+
throw new SizeExceedsPaddingSizeError2({
|
|
7913
|
+
size: Math.ceil(hex.length / 2),
|
|
7914
|
+
targetSize: size3,
|
|
7915
|
+
type: "Hex"
|
|
7916
|
+
});
|
|
7917
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size3 * 2, "0")}`;
|
|
7843
7918
|
}
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7919
|
+
var init_hex = __esm(() => {
|
|
7920
|
+
init_Hex();
|
|
7921
|
+
});
|
|
7922
|
+
|
|
7923
|
+
// node_modules/mppx/node_modules/ox/_esm/core/Json.js
|
|
7924
|
+
var exports_Json = {};
|
|
7925
|
+
__export(exports_Json, {
|
|
7926
|
+
stringify: () => stringify2,
|
|
7927
|
+
parse: () => parse,
|
|
7928
|
+
canonicalize: () => canonicalize
|
|
7929
|
+
});
|
|
7930
|
+
function canonicalize(value) {
|
|
7931
|
+
if (value === null || typeof value === "boolean" || typeof value === "string")
|
|
7932
|
+
return JSON.stringify(value);
|
|
7933
|
+
if (typeof value === "number") {
|
|
7934
|
+
if (!Number.isFinite(value))
|
|
7935
|
+
throw new TypeError("Cannot canonicalize non-finite number");
|
|
7936
|
+
return Object.is(value, -0) ? "0" : JSON.stringify(value);
|
|
7847
7937
|
}
|
|
7848
|
-
|
|
7938
|
+
if (typeof value === "bigint")
|
|
7939
|
+
throw new TypeError("Cannot canonicalize bigint");
|
|
7940
|
+
if (Array.isArray(value))
|
|
7941
|
+
return `[${value.map((item) => canonicalize(item)).join(",")}]`;
|
|
7942
|
+
if (typeof value === "object") {
|
|
7943
|
+
const entries = Object.keys(value).sort().reduce((acc, key) => {
|
|
7944
|
+
const v = value[key];
|
|
7945
|
+
if (v !== undefined)
|
|
7946
|
+
acc.push(`${JSON.stringify(key)}:${canonicalize(v)}`);
|
|
7947
|
+
return acc;
|
|
7948
|
+
}, []);
|
|
7949
|
+
return `{${entries.join(",")}}`;
|
|
7950
|
+
}
|
|
7951
|
+
return;
|
|
7849
7952
|
}
|
|
7850
|
-
function
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7953
|
+
function parse(string, reviver) {
|
|
7954
|
+
return JSON.parse(string, (key, value_) => {
|
|
7955
|
+
const value = value_;
|
|
7956
|
+
if (typeof value === "string" && value.endsWith(bigIntSuffix))
|
|
7957
|
+
return BigInt(value.slice(0, -bigIntSuffix.length));
|
|
7958
|
+
return typeof reviver === "function" ? reviver(key, value) : value;
|
|
7959
|
+
});
|
|
7854
7960
|
}
|
|
7855
|
-
function
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7961
|
+
function stringify2(value, replacer, space) {
|
|
7962
|
+
return JSON.stringify(value, (key, value2) => {
|
|
7963
|
+
if (typeof replacer === "function")
|
|
7964
|
+
return replacer(key, value2);
|
|
7965
|
+
if (typeof value2 === "bigint")
|
|
7966
|
+
return value2.toString() + bigIntSuffix;
|
|
7967
|
+
return value2;
|
|
7968
|
+
}, space);
|
|
7860
7969
|
}
|
|
7970
|
+
var bigIntSuffix = "#__bigint";
|
|
7861
7971
|
|
|
7862
|
-
|
|
7972
|
+
// node_modules/mppx/node_modules/ox/_esm/core/Hex.js
|
|
7973
|
+
function assert(value, options2 = {}) {
|
|
7974
|
+
const { strict = false } = options2;
|
|
7975
|
+
if (!value)
|
|
7976
|
+
throw new InvalidHexTypeError(value);
|
|
7977
|
+
if (typeof value !== "string")
|
|
7978
|
+
throw new InvalidHexTypeError(value);
|
|
7979
|
+
if (strict) {
|
|
7980
|
+
if (!/^0x[0-9a-fA-F]*$/.test(value))
|
|
7981
|
+
throw new InvalidHexValueError(value);
|
|
7982
|
+
}
|
|
7983
|
+
if (!value.startsWith("0x"))
|
|
7984
|
+
throw new InvalidHexValueError(value);
|
|
7863
7985
|
}
|
|
7864
|
-
function
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7986
|
+
function fromBytes(value, options2 = {}) {
|
|
7987
|
+
let string = "";
|
|
7988
|
+
for (let i = 0;i < value.length; i++)
|
|
7989
|
+
string += hexes[value[i]];
|
|
7990
|
+
const hex = `0x${string}`;
|
|
7991
|
+
if (typeof options2.size === "number") {
|
|
7992
|
+
assertSize2(hex, options2.size);
|
|
7993
|
+
return padRight(hex, options2.size);
|
|
7994
|
+
}
|
|
7995
|
+
return hex;
|
|
7871
7996
|
}
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7997
|
+
function fromNumber(value, options2 = {}) {
|
|
7998
|
+
const { signed, size: size3 } = options2;
|
|
7999
|
+
const value_ = BigInt(value);
|
|
8000
|
+
let maxValue;
|
|
8001
|
+
if (size3) {
|
|
8002
|
+
if (signed)
|
|
8003
|
+
maxValue = (1n << BigInt(size3) * 8n - 1n) - 1n;
|
|
8004
|
+
else
|
|
8005
|
+
maxValue = 2n ** (BigInt(size3) * 8n) - 1n;
|
|
8006
|
+
} else if (typeof value === "number") {
|
|
8007
|
+
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
8008
|
+
}
|
|
8009
|
+
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
8010
|
+
if (maxValue && value_ > maxValue || value_ < minValue) {
|
|
8011
|
+
const suffix = typeof value === "bigint" ? "n" : "";
|
|
8012
|
+
throw new IntegerOutOfRangeError({
|
|
8013
|
+
max: maxValue ? `${maxValue}${suffix}` : undefined,
|
|
8014
|
+
min: `${minValue}${suffix}`,
|
|
8015
|
+
signed,
|
|
8016
|
+
size: size3,
|
|
8017
|
+
value: `${value}${suffix}`
|
|
8018
|
+
});
|
|
8019
|
+
}
|
|
8020
|
+
const stringValue = (signed && value_ < 0 ? BigInt.asUintN(size3 * 8, BigInt(value_)) : value_).toString(16);
|
|
8021
|
+
const hex = `0x${stringValue}`;
|
|
8022
|
+
if (size3)
|
|
8023
|
+
return padLeft(hex, size3);
|
|
8024
|
+
return hex;
|
|
8025
|
+
}
|
|
8026
|
+
function padLeft(value, size3) {
|
|
8027
|
+
return pad3(value, { dir: "left", size: size3 });
|
|
8028
|
+
}
|
|
8029
|
+
function padRight(value, size3) {
|
|
8030
|
+
return pad3(value, { dir: "right", size: size3 });
|
|
8031
|
+
}
|
|
8032
|
+
function size2(value) {
|
|
8033
|
+
return Math.ceil((value.length - 2) / 2);
|
|
8034
|
+
}
|
|
8035
|
+
function toBigInt(hex, options2 = {}) {
|
|
8036
|
+
const { signed } = options2;
|
|
8037
|
+
if (options2.size)
|
|
8038
|
+
assertSize2(hex, options2.size);
|
|
8039
|
+
const value = BigInt(hex);
|
|
8040
|
+
if (!signed)
|
|
8041
|
+
return value;
|
|
8042
|
+
const size3 = (hex.length - 2) / 2;
|
|
8043
|
+
const max_unsigned = (1n << BigInt(size3) * 8n) - 1n;
|
|
8044
|
+
const max_signed = max_unsigned >> 1n;
|
|
8045
|
+
if (value <= max_signed)
|
|
8046
|
+
return value;
|
|
8047
|
+
return value - max_unsigned - 1n;
|
|
8048
|
+
}
|
|
8049
|
+
function toNumber(hex, options2 = {}) {
|
|
8050
|
+
const { signed, size: size3 } = options2;
|
|
8051
|
+
if (!signed && !size3)
|
|
8052
|
+
return Number(hex);
|
|
8053
|
+
return Number(toBigInt(hex, options2));
|
|
8054
|
+
}
|
|
8055
|
+
function validate2(value, options2 = {}) {
|
|
8056
|
+
const { strict = false } = options2;
|
|
8057
|
+
try {
|
|
8058
|
+
assert(value, { strict });
|
|
8059
|
+
return true;
|
|
8060
|
+
} catch {
|
|
8061
|
+
return false;
|
|
8062
|
+
}
|
|
8063
|
+
}
|
|
8064
|
+
var hexes, IntegerOutOfRangeError, InvalidHexTypeError, InvalidHexValueError, SizeOverflowError2, SizeExceedsPaddingSizeError2;
|
|
8065
|
+
var init_Hex = __esm(() => {
|
|
8066
|
+
init_Errors();
|
|
8067
|
+
init_hex();
|
|
8068
|
+
hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
8069
|
+
IntegerOutOfRangeError = class IntegerOutOfRangeError extends BaseError {
|
|
8070
|
+
constructor({ max, min, signed, size: size3, value }) {
|
|
8071
|
+
super(`Number \`${value}\` is not in safe${size3 ? ` ${size3 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
|
|
8072
|
+
Object.defineProperty(this, "name", {
|
|
8073
|
+
enumerable: true,
|
|
8074
|
+
configurable: true,
|
|
8075
|
+
writable: true,
|
|
8076
|
+
value: "Hex.IntegerOutOfRangeError"
|
|
8077
|
+
});
|
|
7920
8078
|
}
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
8079
|
+
};
|
|
8080
|
+
InvalidHexTypeError = class InvalidHexTypeError extends BaseError {
|
|
8081
|
+
constructor(value) {
|
|
8082
|
+
super(`Value \`${typeof value === "object" ? stringify2(value) : value}\` of type \`${typeof value}\` is an invalid hex type.`, {
|
|
8083
|
+
metaMessages: ['Hex types must be represented as `"0x${string}"`.']
|
|
8084
|
+
});
|
|
8085
|
+
Object.defineProperty(this, "name", {
|
|
8086
|
+
enumerable: true,
|
|
8087
|
+
configurable: true,
|
|
8088
|
+
writable: true,
|
|
8089
|
+
value: "Hex.InvalidHexTypeError"
|
|
8090
|
+
});
|
|
7925
8091
|
}
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
8092
|
+
};
|
|
8093
|
+
InvalidHexValueError = class InvalidHexValueError extends BaseError {
|
|
8094
|
+
constructor(value) {
|
|
8095
|
+
super(`Value \`${value}\` is an invalid hex value.`, {
|
|
8096
|
+
metaMessages: [
|
|
8097
|
+
'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
|
|
8098
|
+
]
|
|
8099
|
+
});
|
|
8100
|
+
Object.defineProperty(this, "name", {
|
|
8101
|
+
enumerable: true,
|
|
8102
|
+
configurable: true,
|
|
8103
|
+
writable: true,
|
|
8104
|
+
value: "Hex.InvalidHexValueError"
|
|
8105
|
+
});
|
|
7937
8106
|
}
|
|
7938
|
-
|
|
7939
|
-
|
|
8107
|
+
};
|
|
8108
|
+
SizeOverflowError2 = class SizeOverflowError2 extends BaseError {
|
|
8109
|
+
constructor({ givenSize, maxSize }) {
|
|
8110
|
+
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
|
|
8111
|
+
Object.defineProperty(this, "name", {
|
|
8112
|
+
enumerable: true,
|
|
8113
|
+
configurable: true,
|
|
8114
|
+
writable: true,
|
|
8115
|
+
value: "Hex.SizeOverflowError"
|
|
8116
|
+
});
|
|
7940
8117
|
}
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
8118
|
+
};
|
|
8119
|
+
SizeExceedsPaddingSizeError2 = class SizeExceedsPaddingSizeError2 extends BaseError {
|
|
8120
|
+
constructor({ size: size3, targetSize, type }) {
|
|
8121
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size3}\`) exceeds padding size (\`${targetSize}\`).`);
|
|
8122
|
+
Object.defineProperty(this, "name", {
|
|
8123
|
+
enumerable: true,
|
|
8124
|
+
configurable: true,
|
|
8125
|
+
writable: true,
|
|
8126
|
+
value: "Hex.SizeExceedsPaddingSizeError"
|
|
8127
|
+
});
|
|
7945
8128
|
}
|
|
7946
8129
|
};
|
|
7947
|
-
hmac.create = (hash, key) => new HMAC(hash, key);
|
|
7948
8130
|
});
|
|
7949
8131
|
|
|
7950
|
-
// node_modules
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
8132
|
+
// node_modules/mppx/node_modules/ox/_esm/core/Bytes.js
|
|
8133
|
+
var exports_Bytes = {};
|
|
8134
|
+
__export(exports_Bytes, {
|
|
8135
|
+
validate: () => validate3,
|
|
8136
|
+
trimRight: () => trimRight,
|
|
8137
|
+
trimLeft: () => trimLeft,
|
|
8138
|
+
toString: () => toString,
|
|
8139
|
+
toNumber: () => toNumber2,
|
|
8140
|
+
toHex: () => toHex,
|
|
8141
|
+
toBoolean: () => toBoolean,
|
|
8142
|
+
toBigInt: () => toBigInt2,
|
|
8143
|
+
slice: () => slice,
|
|
8144
|
+
size: () => size,
|
|
8145
|
+
random: () => random,
|
|
8146
|
+
padRight: () => padRight2,
|
|
8147
|
+
padLeft: () => padLeft2,
|
|
8148
|
+
isEqual: () => isEqual,
|
|
8149
|
+
fromString: () => fromString,
|
|
8150
|
+
fromNumber: () => fromNumber2,
|
|
8151
|
+
fromHex: () => fromHex,
|
|
8152
|
+
fromBoolean: () => fromBoolean,
|
|
8153
|
+
fromArray: () => fromArray,
|
|
8154
|
+
from: () => from,
|
|
8155
|
+
concat: () => concat,
|
|
8156
|
+
assert: () => assert2,
|
|
8157
|
+
SliceOffsetOutOfBoundsError: () => SliceOffsetOutOfBoundsError,
|
|
8158
|
+
SizeOverflowError: () => SizeOverflowError,
|
|
8159
|
+
SizeExceedsPaddingSizeError: () => SizeExceedsPaddingSizeError,
|
|
8160
|
+
InvalidBytesTypeError: () => InvalidBytesTypeError,
|
|
8161
|
+
InvalidBytesBooleanError: () => InvalidBytesBooleanError
|
|
8162
|
+
});
|
|
8163
|
+
function assert2(value) {
|
|
8164
|
+
if (value instanceof Uint8Array)
|
|
8165
|
+
return;
|
|
8166
|
+
if (!value)
|
|
8167
|
+
throw new InvalidBytesTypeError(value);
|
|
8168
|
+
if (typeof value !== "object")
|
|
8169
|
+
throw new InvalidBytesTypeError(value);
|
|
8170
|
+
if (!("BYTES_PER_ELEMENT" in value))
|
|
8171
|
+
throw new InvalidBytesTypeError(value);
|
|
8172
|
+
if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array")
|
|
8173
|
+
throw new InvalidBytesTypeError(value);
|
|
7962
8174
|
}
|
|
7963
|
-
function
|
|
7964
|
-
|
|
8175
|
+
function concat(...values) {
|
|
8176
|
+
let length = 0;
|
|
8177
|
+
for (const arr of values) {
|
|
8178
|
+
length += arr.length;
|
|
8179
|
+
}
|
|
8180
|
+
const result = new Uint8Array(length);
|
|
8181
|
+
for (let i = 0, index = 0;i < values.length; i++) {
|
|
8182
|
+
const arr = values[i];
|
|
8183
|
+
result.set(arr, index);
|
|
8184
|
+
index += arr.length;
|
|
8185
|
+
}
|
|
8186
|
+
return result;
|
|
7965
8187
|
}
|
|
7966
|
-
function
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
HashMD = class HashMD extends Hash {
|
|
7973
|
-
constructor(blockLen, outputLen, padOffset, isLE2) {
|
|
7974
|
-
super();
|
|
7975
|
-
this.finished = false;
|
|
7976
|
-
this.length = 0;
|
|
7977
|
-
this.pos = 0;
|
|
7978
|
-
this.destroyed = false;
|
|
7979
|
-
this.blockLen = blockLen;
|
|
7980
|
-
this.outputLen = outputLen;
|
|
7981
|
-
this.padOffset = padOffset;
|
|
7982
|
-
this.isLE = isLE2;
|
|
7983
|
-
this.buffer = new Uint8Array(blockLen);
|
|
7984
|
-
this.view = createView(this.buffer);
|
|
7985
|
-
}
|
|
7986
|
-
update(data) {
|
|
7987
|
-
aexists(this);
|
|
7988
|
-
data = toBytes(data);
|
|
7989
|
-
abytes(data);
|
|
7990
|
-
const { view, buffer, blockLen } = this;
|
|
7991
|
-
const len = data.length;
|
|
7992
|
-
for (let pos = 0;pos < len; ) {
|
|
7993
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
7994
|
-
if (take === blockLen) {
|
|
7995
|
-
const dataView = createView(data);
|
|
7996
|
-
for (;blockLen <= len - pos; pos += blockLen)
|
|
7997
|
-
this.process(dataView, pos);
|
|
7998
|
-
continue;
|
|
7999
|
-
}
|
|
8000
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
8001
|
-
this.pos += take;
|
|
8002
|
-
pos += take;
|
|
8003
|
-
if (this.pos === blockLen) {
|
|
8004
|
-
this.process(view, 0);
|
|
8005
|
-
this.pos = 0;
|
|
8006
|
-
}
|
|
8007
|
-
}
|
|
8008
|
-
this.length += data.length;
|
|
8009
|
-
this.roundClean();
|
|
8010
|
-
return this;
|
|
8011
|
-
}
|
|
8012
|
-
digestInto(out) {
|
|
8013
|
-
aexists(this);
|
|
8014
|
-
aoutput(out, this);
|
|
8015
|
-
this.finished = true;
|
|
8016
|
-
const { buffer, view, blockLen, isLE: isLE2 } = this;
|
|
8017
|
-
let { pos } = this;
|
|
8018
|
-
buffer[pos++] = 128;
|
|
8019
|
-
clean(this.buffer.subarray(pos));
|
|
8020
|
-
if (this.padOffset > blockLen - pos) {
|
|
8021
|
-
this.process(view, 0);
|
|
8022
|
-
pos = 0;
|
|
8023
|
-
}
|
|
8024
|
-
for (let i = pos;i < blockLen; i++)
|
|
8025
|
-
buffer[i] = 0;
|
|
8026
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
|
|
8027
|
-
this.process(view, 0);
|
|
8028
|
-
const oview = createView(out);
|
|
8029
|
-
const len = this.outputLen;
|
|
8030
|
-
if (len % 4)
|
|
8031
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
8032
|
-
const outLen = len / 4;
|
|
8033
|
-
const state = this.get();
|
|
8034
|
-
if (outLen > state.length)
|
|
8035
|
-
throw new Error("_sha2: outputLen bigger than state");
|
|
8036
|
-
for (let i = 0;i < outLen; i++)
|
|
8037
|
-
oview.setUint32(4 * i, state[i], isLE2);
|
|
8038
|
-
}
|
|
8039
|
-
digest() {
|
|
8040
|
-
const { buffer, outputLen } = this;
|
|
8041
|
-
this.digestInto(buffer);
|
|
8042
|
-
const res = buffer.slice(0, outputLen);
|
|
8043
|
-
this.destroy();
|
|
8044
|
-
return res;
|
|
8045
|
-
}
|
|
8046
|
-
_cloneInto(to) {
|
|
8047
|
-
to || (to = new this.constructor);
|
|
8048
|
-
to.set(...this.get());
|
|
8049
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
8050
|
-
to.destroyed = destroyed;
|
|
8051
|
-
to.finished = finished;
|
|
8052
|
-
to.length = length;
|
|
8053
|
-
to.pos = pos;
|
|
8054
|
-
if (length % blockLen)
|
|
8055
|
-
to.buffer.set(buffer);
|
|
8056
|
-
return to;
|
|
8057
|
-
}
|
|
8058
|
-
clone() {
|
|
8059
|
-
return this._cloneInto();
|
|
8060
|
-
}
|
|
8061
|
-
};
|
|
8062
|
-
SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
8063
|
-
1779033703,
|
|
8064
|
-
3144134277,
|
|
8065
|
-
1013904242,
|
|
8066
|
-
2773480762,
|
|
8067
|
-
1359893119,
|
|
8068
|
-
2600822924,
|
|
8069
|
-
528734635,
|
|
8070
|
-
1541459225
|
|
8071
|
-
]);
|
|
8072
|
-
});
|
|
8073
|
-
|
|
8074
|
-
// node_modules/@noble/hashes/esm/legacy.js
|
|
8075
|
-
function ripemd_f(group, x, y, z) {
|
|
8076
|
-
if (group === 0)
|
|
8077
|
-
return x ^ y ^ z;
|
|
8078
|
-
if (group === 1)
|
|
8079
|
-
return x & y | ~x & z;
|
|
8080
|
-
if (group === 2)
|
|
8081
|
-
return (x | ~y) ^ z;
|
|
8082
|
-
if (group === 3)
|
|
8083
|
-
return x & z | y & ~z;
|
|
8084
|
-
return x ^ (y | ~z);
|
|
8085
|
-
}
|
|
8086
|
-
var Rho160, Id160, Pi160, idxLR, idxL, idxR, shifts160, shiftsL160, shiftsR160, Kl160, Kr160, BUF_160, RIPEMD160, ripemd160;
|
|
8087
|
-
var init_legacy = __esm(() => {
|
|
8088
|
-
init__md();
|
|
8089
|
-
init_utils();
|
|
8090
|
-
Rho160 = /* @__PURE__ */ Uint8Array.from([
|
|
8091
|
-
7,
|
|
8092
|
-
4,
|
|
8093
|
-
13,
|
|
8094
|
-
1,
|
|
8095
|
-
10,
|
|
8096
|
-
6,
|
|
8097
|
-
15,
|
|
8098
|
-
3,
|
|
8099
|
-
12,
|
|
8100
|
-
0,
|
|
8101
|
-
9,
|
|
8102
|
-
5,
|
|
8103
|
-
2,
|
|
8104
|
-
14,
|
|
8105
|
-
11,
|
|
8106
|
-
8
|
|
8107
|
-
]);
|
|
8108
|
-
Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))();
|
|
8109
|
-
Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))();
|
|
8110
|
-
idxLR = /* @__PURE__ */ (() => {
|
|
8111
|
-
const L = [Id160];
|
|
8112
|
-
const R = [Pi160];
|
|
8113
|
-
const res = [L, R];
|
|
8114
|
-
for (let i = 0;i < 4; i++)
|
|
8115
|
-
for (let j of res)
|
|
8116
|
-
j.push(j[i].map((k) => Rho160[k]));
|
|
8117
|
-
return res;
|
|
8118
|
-
})();
|
|
8119
|
-
idxL = /* @__PURE__ */ (() => idxLR[0])();
|
|
8120
|
-
idxR = /* @__PURE__ */ (() => idxLR[1])();
|
|
8121
|
-
shifts160 = /* @__PURE__ */ [
|
|
8122
|
-
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
8123
|
-
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
8124
|
-
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
8125
|
-
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
8126
|
-
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
8127
|
-
].map((i) => Uint8Array.from(i));
|
|
8128
|
-
shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));
|
|
8129
|
-
shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));
|
|
8130
|
-
Kl160 = /* @__PURE__ */ Uint32Array.from([
|
|
8131
|
-
0,
|
|
8132
|
-
1518500249,
|
|
8133
|
-
1859775393,
|
|
8134
|
-
2400959708,
|
|
8135
|
-
2840853838
|
|
8136
|
-
]);
|
|
8137
|
-
Kr160 = /* @__PURE__ */ Uint32Array.from([
|
|
8138
|
-
1352829926,
|
|
8139
|
-
1548603684,
|
|
8140
|
-
1836072691,
|
|
8141
|
-
2053994217,
|
|
8142
|
-
0
|
|
8143
|
-
]);
|
|
8144
|
-
BUF_160 = /* @__PURE__ */ new Uint32Array(16);
|
|
8145
|
-
RIPEMD160 = class RIPEMD160 extends HashMD {
|
|
8146
|
-
constructor() {
|
|
8147
|
-
super(64, 20, 8, true);
|
|
8148
|
-
this.h0 = 1732584193 | 0;
|
|
8149
|
-
this.h1 = 4023233417 | 0;
|
|
8150
|
-
this.h2 = 2562383102 | 0;
|
|
8151
|
-
this.h3 = 271733878 | 0;
|
|
8152
|
-
this.h4 = 3285377520 | 0;
|
|
8153
|
-
}
|
|
8154
|
-
get() {
|
|
8155
|
-
const { h0, h1, h2, h3, h4 } = this;
|
|
8156
|
-
return [h0, h1, h2, h3, h4];
|
|
8157
|
-
}
|
|
8158
|
-
set(h0, h1, h2, h3, h4) {
|
|
8159
|
-
this.h0 = h0 | 0;
|
|
8160
|
-
this.h1 = h1 | 0;
|
|
8161
|
-
this.h2 = h2 | 0;
|
|
8162
|
-
this.h3 = h3 | 0;
|
|
8163
|
-
this.h4 = h4 | 0;
|
|
8164
|
-
}
|
|
8165
|
-
process(view, offset) {
|
|
8166
|
-
for (let i = 0;i < 16; i++, offset += 4)
|
|
8167
|
-
BUF_160[i] = view.getUint32(offset, true);
|
|
8168
|
-
let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
|
|
8169
|
-
for (let group = 0;group < 5; group++) {
|
|
8170
|
-
const rGroup = 4 - group;
|
|
8171
|
-
const hbl = Kl160[group], hbr = Kr160[group];
|
|
8172
|
-
const rl = idxL[group], rr = idxR[group];
|
|
8173
|
-
const sl = shiftsL160[group], sr = shiftsR160[group];
|
|
8174
|
-
for (let i = 0;i < 16; i++) {
|
|
8175
|
-
const tl = rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el | 0;
|
|
8176
|
-
al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl;
|
|
8177
|
-
}
|
|
8178
|
-
for (let i = 0;i < 16; i++) {
|
|
8179
|
-
const tr = rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er | 0;
|
|
8180
|
-
ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr;
|
|
8181
|
-
}
|
|
8182
|
-
}
|
|
8183
|
-
this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0);
|
|
8184
|
-
}
|
|
8185
|
-
roundClean() {
|
|
8186
|
-
clean(BUF_160);
|
|
8187
|
-
}
|
|
8188
|
-
destroy() {
|
|
8189
|
-
this.destroyed = true;
|
|
8190
|
-
clean(this.buffer);
|
|
8191
|
-
this.set(0, 0, 0, 0, 0);
|
|
8192
|
-
}
|
|
8193
|
-
};
|
|
8194
|
-
ripemd160 = /* @__PURE__ */ createHasher(() => new RIPEMD160);
|
|
8195
|
-
});
|
|
8196
|
-
|
|
8197
|
-
// node_modules/@noble/hashes/esm/ripemd160.js
|
|
8198
|
-
var ripemd1602;
|
|
8199
|
-
var init_ripemd160 = __esm(() => {
|
|
8200
|
-
init_legacy();
|
|
8201
|
-
ripemd1602 = ripemd160;
|
|
8202
|
-
});
|
|
8203
|
-
|
|
8204
|
-
// node_modules/@noble/hashes/esm/_u64.js
|
|
8205
|
-
function fromBig(n, le = false) {
|
|
8206
|
-
if (le)
|
|
8207
|
-
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
8208
|
-
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
8209
|
-
}
|
|
8210
|
-
function split(lst, le = false) {
|
|
8211
|
-
const len = lst.length;
|
|
8212
|
-
let Ah = new Uint32Array(len);
|
|
8213
|
-
let Al = new Uint32Array(len);
|
|
8214
|
-
for (let i = 0;i < len; i++) {
|
|
8215
|
-
const { h, l } = fromBig(lst[i], le);
|
|
8216
|
-
[Ah[i], Al[i]] = [h, l];
|
|
8217
|
-
}
|
|
8218
|
-
return [Ah, Al];
|
|
8219
|
-
}
|
|
8220
|
-
var U32_MASK64, _32n, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
8221
|
-
var init__u64 = __esm(() => {
|
|
8222
|
-
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
8223
|
-
_32n = /* @__PURE__ */ BigInt(32);
|
|
8224
|
-
});
|
|
8225
|
-
|
|
8226
|
-
// node_modules/@noble/hashes/esm/sha3.js
|
|
8227
|
-
function keccakP(s, rounds = 24) {
|
|
8228
|
-
const B = new Uint32Array(5 * 2);
|
|
8229
|
-
for (let round = 24 - rounds;round < 24; round++) {
|
|
8230
|
-
for (let x = 0;x < 10; x++)
|
|
8231
|
-
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
8232
|
-
for (let x = 0;x < 10; x += 2) {
|
|
8233
|
-
const idx1 = (x + 8) % 10;
|
|
8234
|
-
const idx0 = (x + 2) % 10;
|
|
8235
|
-
const B0 = B[idx0];
|
|
8236
|
-
const B1 = B[idx0 + 1];
|
|
8237
|
-
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
8238
|
-
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
8239
|
-
for (let y = 0;y < 50; y += 10) {
|
|
8240
|
-
s[x + y] ^= Th;
|
|
8241
|
-
s[x + y + 1] ^= Tl;
|
|
8242
|
-
}
|
|
8243
|
-
}
|
|
8244
|
-
let curH = s[2];
|
|
8245
|
-
let curL = s[3];
|
|
8246
|
-
for (let t = 0;t < 24; t++) {
|
|
8247
|
-
const shift = SHA3_ROTL[t];
|
|
8248
|
-
const Th = rotlH(curH, curL, shift);
|
|
8249
|
-
const Tl = rotlL(curH, curL, shift);
|
|
8250
|
-
const PI = SHA3_PI[t];
|
|
8251
|
-
curH = s[PI];
|
|
8252
|
-
curL = s[PI + 1];
|
|
8253
|
-
s[PI] = Th;
|
|
8254
|
-
s[PI + 1] = Tl;
|
|
8255
|
-
}
|
|
8256
|
-
for (let y = 0;y < 50; y += 10) {
|
|
8257
|
-
for (let x = 0;x < 10; x++)
|
|
8258
|
-
B[x] = s[y + x];
|
|
8259
|
-
for (let x = 0;x < 10; x++)
|
|
8260
|
-
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
8261
|
-
}
|
|
8262
|
-
s[0] ^= SHA3_IOTA_H[round];
|
|
8263
|
-
s[1] ^= SHA3_IOTA_L[round];
|
|
8264
|
-
}
|
|
8265
|
-
clean(B);
|
|
8266
|
-
}
|
|
8267
|
-
var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s), rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s), Keccak, gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen)), keccak_256;
|
|
8268
|
-
var init_sha3 = __esm(() => {
|
|
8269
|
-
init__u64();
|
|
8270
|
-
init_utils();
|
|
8271
|
-
_0n = BigInt(0);
|
|
8272
|
-
_1n = BigInt(1);
|
|
8273
|
-
_2n = BigInt(2);
|
|
8274
|
-
_7n = BigInt(7);
|
|
8275
|
-
_256n = BigInt(256);
|
|
8276
|
-
_0x71n = BigInt(113);
|
|
8277
|
-
SHA3_PI = [];
|
|
8278
|
-
SHA3_ROTL = [];
|
|
8279
|
-
_SHA3_IOTA = [];
|
|
8280
|
-
for (let round = 0, R = _1n, x = 1, y = 0;round < 24; round++) {
|
|
8281
|
-
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
8282
|
-
SHA3_PI.push(2 * (5 * y + x));
|
|
8283
|
-
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
8284
|
-
let t = _0n;
|
|
8285
|
-
for (let j = 0;j < 7; j++) {
|
|
8286
|
-
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
8287
|
-
if (R & _2n)
|
|
8288
|
-
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
8289
|
-
}
|
|
8290
|
-
_SHA3_IOTA.push(t);
|
|
8291
|
-
}
|
|
8292
|
-
IOTAS = split(_SHA3_IOTA, true);
|
|
8293
|
-
SHA3_IOTA_H = IOTAS[0];
|
|
8294
|
-
SHA3_IOTA_L = IOTAS[1];
|
|
8295
|
-
Keccak = class Keccak extends Hash {
|
|
8296
|
-
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
8297
|
-
super();
|
|
8298
|
-
this.pos = 0;
|
|
8299
|
-
this.posOut = 0;
|
|
8300
|
-
this.finished = false;
|
|
8301
|
-
this.destroyed = false;
|
|
8302
|
-
this.enableXOF = false;
|
|
8303
|
-
this.blockLen = blockLen;
|
|
8304
|
-
this.suffix = suffix;
|
|
8305
|
-
this.outputLen = outputLen;
|
|
8306
|
-
this.enableXOF = enableXOF;
|
|
8307
|
-
this.rounds = rounds;
|
|
8308
|
-
anumber(outputLen);
|
|
8309
|
-
if (!(0 < blockLen && blockLen < 200))
|
|
8310
|
-
throw new Error("only keccak-f1600 function is supported");
|
|
8311
|
-
this.state = new Uint8Array(200);
|
|
8312
|
-
this.state32 = u32(this.state);
|
|
8313
|
-
}
|
|
8314
|
-
clone() {
|
|
8315
|
-
return this._cloneInto();
|
|
8316
|
-
}
|
|
8317
|
-
keccak() {
|
|
8318
|
-
swap32IfBE(this.state32);
|
|
8319
|
-
keccakP(this.state32, this.rounds);
|
|
8320
|
-
swap32IfBE(this.state32);
|
|
8321
|
-
this.posOut = 0;
|
|
8322
|
-
this.pos = 0;
|
|
8323
|
-
}
|
|
8324
|
-
update(data) {
|
|
8325
|
-
aexists(this);
|
|
8326
|
-
data = toBytes(data);
|
|
8327
|
-
abytes(data);
|
|
8328
|
-
const { blockLen, state } = this;
|
|
8329
|
-
const len = data.length;
|
|
8330
|
-
for (let pos = 0;pos < len; ) {
|
|
8331
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
8332
|
-
for (let i = 0;i < take; i++)
|
|
8333
|
-
state[this.pos++] ^= data[pos++];
|
|
8334
|
-
if (this.pos === blockLen)
|
|
8335
|
-
this.keccak();
|
|
8336
|
-
}
|
|
8337
|
-
return this;
|
|
8338
|
-
}
|
|
8339
|
-
finish() {
|
|
8340
|
-
if (this.finished)
|
|
8341
|
-
return;
|
|
8342
|
-
this.finished = true;
|
|
8343
|
-
const { state, suffix, pos, blockLen } = this;
|
|
8344
|
-
state[pos] ^= suffix;
|
|
8345
|
-
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
8346
|
-
this.keccak();
|
|
8347
|
-
state[blockLen - 1] ^= 128;
|
|
8348
|
-
this.keccak();
|
|
8349
|
-
}
|
|
8350
|
-
writeInto(out) {
|
|
8351
|
-
aexists(this, false);
|
|
8352
|
-
abytes(out);
|
|
8353
|
-
this.finish();
|
|
8354
|
-
const bufferOut = this.state;
|
|
8355
|
-
const { blockLen } = this;
|
|
8356
|
-
for (let pos = 0, len = out.length;pos < len; ) {
|
|
8357
|
-
if (this.posOut >= blockLen)
|
|
8358
|
-
this.keccak();
|
|
8359
|
-
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
8360
|
-
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
8361
|
-
this.posOut += take;
|
|
8362
|
-
pos += take;
|
|
8363
|
-
}
|
|
8364
|
-
return out;
|
|
8365
|
-
}
|
|
8366
|
-
xofInto(out) {
|
|
8367
|
-
if (!this.enableXOF)
|
|
8368
|
-
throw new Error("XOF is not possible for this instance");
|
|
8369
|
-
return this.writeInto(out);
|
|
8370
|
-
}
|
|
8371
|
-
xof(bytes) {
|
|
8372
|
-
anumber(bytes);
|
|
8373
|
-
return this.xofInto(new Uint8Array(bytes));
|
|
8374
|
-
}
|
|
8375
|
-
digestInto(out) {
|
|
8376
|
-
aoutput(out, this);
|
|
8377
|
-
if (this.finished)
|
|
8378
|
-
throw new Error("digest() was already called");
|
|
8379
|
-
this.writeInto(out);
|
|
8380
|
-
this.destroy();
|
|
8381
|
-
return out;
|
|
8382
|
-
}
|
|
8383
|
-
digest() {
|
|
8384
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
|
8385
|
-
}
|
|
8386
|
-
destroy() {
|
|
8387
|
-
this.destroyed = true;
|
|
8388
|
-
clean(this.state);
|
|
8389
|
-
}
|
|
8390
|
-
_cloneInto(to) {
|
|
8391
|
-
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
8392
|
-
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
8393
|
-
to.state32.set(this.state32);
|
|
8394
|
-
to.pos = this.pos;
|
|
8395
|
-
to.posOut = this.posOut;
|
|
8396
|
-
to.finished = this.finished;
|
|
8397
|
-
to.rounds = rounds;
|
|
8398
|
-
to.suffix = suffix;
|
|
8399
|
-
to.outputLen = outputLen;
|
|
8400
|
-
to.enableXOF = enableXOF;
|
|
8401
|
-
to.destroyed = this.destroyed;
|
|
8402
|
-
return to;
|
|
8403
|
-
}
|
|
8404
|
-
};
|
|
8405
|
-
keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
8406
|
-
});
|
|
8407
|
-
|
|
8408
|
-
// node_modules/@noble/hashes/esm/sha2.js
|
|
8409
|
-
var SHA256_K, SHA256_W, SHA256, sha256;
|
|
8410
|
-
var init_sha2 = __esm(() => {
|
|
8411
|
-
init__md();
|
|
8412
|
-
init_utils();
|
|
8413
|
-
SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
8414
|
-
1116352408,
|
|
8415
|
-
1899447441,
|
|
8416
|
-
3049323471,
|
|
8417
|
-
3921009573,
|
|
8418
|
-
961987163,
|
|
8419
|
-
1508970993,
|
|
8420
|
-
2453635748,
|
|
8421
|
-
2870763221,
|
|
8422
|
-
3624381080,
|
|
8423
|
-
310598401,
|
|
8424
|
-
607225278,
|
|
8425
|
-
1426881987,
|
|
8426
|
-
1925078388,
|
|
8427
|
-
2162078206,
|
|
8428
|
-
2614888103,
|
|
8429
|
-
3248222580,
|
|
8430
|
-
3835390401,
|
|
8431
|
-
4022224774,
|
|
8432
|
-
264347078,
|
|
8433
|
-
604807628,
|
|
8434
|
-
770255983,
|
|
8435
|
-
1249150122,
|
|
8436
|
-
1555081692,
|
|
8437
|
-
1996064986,
|
|
8438
|
-
2554220882,
|
|
8439
|
-
2821834349,
|
|
8440
|
-
2952996808,
|
|
8441
|
-
3210313671,
|
|
8442
|
-
3336571891,
|
|
8443
|
-
3584528711,
|
|
8444
|
-
113926993,
|
|
8445
|
-
338241895,
|
|
8446
|
-
666307205,
|
|
8447
|
-
773529912,
|
|
8448
|
-
1294757372,
|
|
8449
|
-
1396182291,
|
|
8450
|
-
1695183700,
|
|
8451
|
-
1986661051,
|
|
8452
|
-
2177026350,
|
|
8453
|
-
2456956037,
|
|
8454
|
-
2730485921,
|
|
8455
|
-
2820302411,
|
|
8456
|
-
3259730800,
|
|
8457
|
-
3345764771,
|
|
8458
|
-
3516065817,
|
|
8459
|
-
3600352804,
|
|
8460
|
-
4094571909,
|
|
8461
|
-
275423344,
|
|
8462
|
-
430227734,
|
|
8463
|
-
506948616,
|
|
8464
|
-
659060556,
|
|
8465
|
-
883997877,
|
|
8466
|
-
958139571,
|
|
8467
|
-
1322822218,
|
|
8468
|
-
1537002063,
|
|
8469
|
-
1747873779,
|
|
8470
|
-
1955562222,
|
|
8471
|
-
2024104815,
|
|
8472
|
-
2227730452,
|
|
8473
|
-
2361852424,
|
|
8474
|
-
2428436474,
|
|
8475
|
-
2756734187,
|
|
8476
|
-
3204031479,
|
|
8477
|
-
3329325298
|
|
8478
|
-
]);
|
|
8479
|
-
SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
8480
|
-
SHA256 = class SHA256 extends HashMD {
|
|
8481
|
-
constructor(outputLen = 32) {
|
|
8482
|
-
super(64, outputLen, 8, false);
|
|
8483
|
-
this.A = SHA256_IV[0] | 0;
|
|
8484
|
-
this.B = SHA256_IV[1] | 0;
|
|
8485
|
-
this.C = SHA256_IV[2] | 0;
|
|
8486
|
-
this.D = SHA256_IV[3] | 0;
|
|
8487
|
-
this.E = SHA256_IV[4] | 0;
|
|
8488
|
-
this.F = SHA256_IV[5] | 0;
|
|
8489
|
-
this.G = SHA256_IV[6] | 0;
|
|
8490
|
-
this.H = SHA256_IV[7] | 0;
|
|
8491
|
-
}
|
|
8492
|
-
get() {
|
|
8493
|
-
const { A, B, C, D: D2, E, F, G, H } = this;
|
|
8494
|
-
return [A, B, C, D2, E, F, G, H];
|
|
8495
|
-
}
|
|
8496
|
-
set(A, B, C, D2, E, F, G, H) {
|
|
8497
|
-
this.A = A | 0;
|
|
8498
|
-
this.B = B | 0;
|
|
8499
|
-
this.C = C | 0;
|
|
8500
|
-
this.D = D2 | 0;
|
|
8501
|
-
this.E = E | 0;
|
|
8502
|
-
this.F = F | 0;
|
|
8503
|
-
this.G = G | 0;
|
|
8504
|
-
this.H = H | 0;
|
|
8505
|
-
}
|
|
8506
|
-
process(view, offset) {
|
|
8507
|
-
for (let i = 0;i < 16; i++, offset += 4)
|
|
8508
|
-
SHA256_W[i] = view.getUint32(offset, false);
|
|
8509
|
-
for (let i = 16;i < 64; i++) {
|
|
8510
|
-
const W15 = SHA256_W[i - 15];
|
|
8511
|
-
const W2 = SHA256_W[i - 2];
|
|
8512
|
-
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
8513
|
-
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
8514
|
-
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
8515
|
-
}
|
|
8516
|
-
let { A, B, C, D: D2, E, F, G, H } = this;
|
|
8517
|
-
for (let i = 0;i < 64; i++) {
|
|
8518
|
-
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
8519
|
-
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
8520
|
-
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
8521
|
-
const T2 = sigma0 + Maj(A, B, C) | 0;
|
|
8522
|
-
H = G;
|
|
8523
|
-
G = F;
|
|
8524
|
-
F = E;
|
|
8525
|
-
E = D2 + T1 | 0;
|
|
8526
|
-
D2 = C;
|
|
8527
|
-
C = B;
|
|
8528
|
-
B = A;
|
|
8529
|
-
A = T1 + T2 | 0;
|
|
8530
|
-
}
|
|
8531
|
-
A = A + this.A | 0;
|
|
8532
|
-
B = B + this.B | 0;
|
|
8533
|
-
C = C + this.C | 0;
|
|
8534
|
-
D2 = D2 + this.D | 0;
|
|
8535
|
-
E = E + this.E | 0;
|
|
8536
|
-
F = F + this.F | 0;
|
|
8537
|
-
G = G + this.G | 0;
|
|
8538
|
-
H = H + this.H | 0;
|
|
8539
|
-
this.set(A, B, C, D2, E, F, G, H);
|
|
8540
|
-
}
|
|
8541
|
-
roundClean() {
|
|
8542
|
-
clean(SHA256_W);
|
|
8543
|
-
}
|
|
8544
|
-
destroy() {
|
|
8545
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
8546
|
-
clean(this.buffer);
|
|
8547
|
-
}
|
|
8548
|
-
};
|
|
8549
|
-
sha256 = /* @__PURE__ */ createHasher(() => new SHA256);
|
|
8550
|
-
});
|
|
8551
|
-
|
|
8552
|
-
// node_modules/@noble/hashes/esm/sha256.js
|
|
8553
|
-
var sha2562;
|
|
8554
|
-
var init_sha256 = __esm(() => {
|
|
8555
|
-
init_sha2();
|
|
8556
|
-
sha2562 = sha256;
|
|
8557
|
-
});
|
|
8558
|
-
|
|
8559
|
-
// node_modules/mppx/node_modules/ox/node_modules/@noble/curves/esm/abstract/utils.js
|
|
8560
|
-
function equalBytes(a, b) {
|
|
8561
|
-
if (a.length !== b.length)
|
|
8562
|
-
return false;
|
|
8563
|
-
let diff = 0;
|
|
8564
|
-
for (let i = 0;i < a.length; i++)
|
|
8565
|
-
diff |= a[i] ^ b[i];
|
|
8566
|
-
return diff === 0;
|
|
8567
|
-
}
|
|
8568
|
-
var hasHexBuiltin;
|
|
8569
|
-
var init_utils2 = __esm(() => {
|
|
8570
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
8571
|
-
hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
|
|
8572
|
-
});
|
|
8573
|
-
|
|
8574
|
-
// node_modules/mppx/node_modules/ox/_esm/core/internal/bytes.js
|
|
8575
|
-
function assertSize(bytes, size_) {
|
|
8576
|
-
if (size(bytes) > size_)
|
|
8577
|
-
throw new SizeOverflowError({
|
|
8578
|
-
givenSize: size(bytes),
|
|
8579
|
-
maxSize: size_
|
|
8580
|
-
});
|
|
8581
|
-
}
|
|
8582
|
-
function assertStartOffset(value, start) {
|
|
8583
|
-
if (typeof start === "number" && start > 0 && start > size(value) - 1)
|
|
8584
|
-
throw new SliceOffsetOutOfBoundsError({
|
|
8585
|
-
offset: start,
|
|
8586
|
-
position: "start",
|
|
8587
|
-
size: size(value)
|
|
8588
|
-
});
|
|
8589
|
-
}
|
|
8590
|
-
function assertEndOffset(value, start, end) {
|
|
8591
|
-
if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
|
|
8592
|
-
throw new SliceOffsetOutOfBoundsError({
|
|
8593
|
-
offset: end,
|
|
8594
|
-
position: "end",
|
|
8595
|
-
size: size(value)
|
|
8596
|
-
});
|
|
8597
|
-
}
|
|
8598
|
-
}
|
|
8599
|
-
function charCodeToBase16(char) {
|
|
8600
|
-
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
|
8601
|
-
return char - charCodeMap.zero;
|
|
8602
|
-
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
|
8603
|
-
return char - (charCodeMap.A - 10);
|
|
8604
|
-
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
|
8605
|
-
return char - (charCodeMap.a - 10);
|
|
8606
|
-
return;
|
|
8607
|
-
}
|
|
8608
|
-
function pad2(bytes, options2 = {}) {
|
|
8609
|
-
const { dir, size: size2 = 32 } = options2;
|
|
8610
|
-
if (size2 === 0)
|
|
8611
|
-
return bytes;
|
|
8612
|
-
if (bytes.length > size2)
|
|
8613
|
-
throw new SizeExceedsPaddingSizeError({
|
|
8614
|
-
size: bytes.length,
|
|
8615
|
-
targetSize: size2,
|
|
8616
|
-
type: "Bytes"
|
|
8617
|
-
});
|
|
8618
|
-
const paddedBytes = new Uint8Array(size2);
|
|
8619
|
-
for (let i = 0;i < size2; i++) {
|
|
8620
|
-
const padEnd = dir === "right";
|
|
8621
|
-
paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
8622
|
-
}
|
|
8623
|
-
return paddedBytes;
|
|
8624
|
-
}
|
|
8625
|
-
function trim(value, options2 = {}) {
|
|
8626
|
-
const { dir = "left" } = options2;
|
|
8627
|
-
let data = value;
|
|
8628
|
-
let sliceLength = 0;
|
|
8629
|
-
for (let i = 0;i < data.length - 1; i++) {
|
|
8630
|
-
if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
|
|
8631
|
-
sliceLength++;
|
|
8632
|
-
else
|
|
8633
|
-
break;
|
|
8634
|
-
}
|
|
8635
|
-
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
|
|
8636
|
-
return data;
|
|
8637
|
-
}
|
|
8638
|
-
var charCodeMap;
|
|
8639
|
-
var init_bytes = __esm(() => {
|
|
8640
|
-
init_Bytes();
|
|
8641
|
-
charCodeMap = {
|
|
8642
|
-
zero: 48,
|
|
8643
|
-
nine: 57,
|
|
8644
|
-
A: 65,
|
|
8645
|
-
F: 70,
|
|
8646
|
-
a: 97,
|
|
8647
|
-
f: 102
|
|
8648
|
-
};
|
|
8649
|
-
});
|
|
8650
|
-
|
|
8651
|
-
// node_modules/mppx/node_modules/ox/_esm/core/internal/hex.js
|
|
8652
|
-
function assertSize2(hex, size_) {
|
|
8653
|
-
if (size2(hex) > size_)
|
|
8654
|
-
throw new SizeOverflowError2({
|
|
8655
|
-
givenSize: size2(hex),
|
|
8656
|
-
maxSize: size_
|
|
8657
|
-
});
|
|
8658
|
-
}
|
|
8659
|
-
function pad3(hex_, options2 = {}) {
|
|
8660
|
-
const { dir, size: size3 = 32 } = options2;
|
|
8661
|
-
if (size3 === 0)
|
|
8662
|
-
return hex_;
|
|
8663
|
-
const hex = hex_.replace("0x", "");
|
|
8664
|
-
if (hex.length > size3 * 2)
|
|
8665
|
-
throw new SizeExceedsPaddingSizeError2({
|
|
8666
|
-
size: Math.ceil(hex.length / 2),
|
|
8667
|
-
targetSize: size3,
|
|
8668
|
-
type: "Hex"
|
|
8669
|
-
});
|
|
8670
|
-
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size3 * 2, "0")}`;
|
|
8671
|
-
}
|
|
8672
|
-
var init_hex = __esm(() => {
|
|
8673
|
-
init_Hex();
|
|
8674
|
-
});
|
|
8675
|
-
|
|
8676
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Json.js
|
|
8677
|
-
var exports_Json = {};
|
|
8678
|
-
__export(exports_Json, {
|
|
8679
|
-
stringify: () => stringify2,
|
|
8680
|
-
parse: () => parse,
|
|
8681
|
-
canonicalize: () => canonicalize
|
|
8682
|
-
});
|
|
8683
|
-
function canonicalize(value) {
|
|
8684
|
-
if (value === null || typeof value === "boolean" || typeof value === "string")
|
|
8685
|
-
return JSON.stringify(value);
|
|
8686
|
-
if (typeof value === "number") {
|
|
8687
|
-
if (!Number.isFinite(value))
|
|
8688
|
-
throw new TypeError("Cannot canonicalize non-finite number");
|
|
8689
|
-
return Object.is(value, -0) ? "0" : JSON.stringify(value);
|
|
8690
|
-
}
|
|
8691
|
-
if (typeof value === "bigint")
|
|
8692
|
-
throw new TypeError("Cannot canonicalize bigint");
|
|
8693
|
-
if (Array.isArray(value))
|
|
8694
|
-
return `[${value.map((item) => canonicalize(item)).join(",")}]`;
|
|
8695
|
-
if (typeof value === "object") {
|
|
8696
|
-
const entries = Object.keys(value).sort().reduce((acc, key) => {
|
|
8697
|
-
const v = value[key];
|
|
8698
|
-
if (v !== undefined)
|
|
8699
|
-
acc.push(`${JSON.stringify(key)}:${canonicalize(v)}`);
|
|
8700
|
-
return acc;
|
|
8701
|
-
}, []);
|
|
8702
|
-
return `{${entries.join(",")}}`;
|
|
8703
|
-
}
|
|
8704
|
-
return;
|
|
8705
|
-
}
|
|
8706
|
-
function parse(string, reviver) {
|
|
8707
|
-
return JSON.parse(string, (key, value_) => {
|
|
8708
|
-
const value = value_;
|
|
8709
|
-
if (typeof value === "string" && value.endsWith(bigIntSuffix))
|
|
8710
|
-
return BigInt(value.slice(0, -bigIntSuffix.length));
|
|
8711
|
-
return typeof reviver === "function" ? reviver(key, value) : value;
|
|
8712
|
-
});
|
|
8713
|
-
}
|
|
8714
|
-
function stringify2(value, replacer, space) {
|
|
8715
|
-
return JSON.stringify(value, (key, value2) => {
|
|
8716
|
-
if (typeof replacer === "function")
|
|
8717
|
-
return replacer(key, value2);
|
|
8718
|
-
if (typeof value2 === "bigint")
|
|
8719
|
-
return value2.toString() + bigIntSuffix;
|
|
8720
|
-
return value2;
|
|
8721
|
-
}, space);
|
|
8722
|
-
}
|
|
8723
|
-
var bigIntSuffix = "#__bigint";
|
|
8724
|
-
|
|
8725
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Hex.js
|
|
8726
|
-
function assert(value, options2 = {}) {
|
|
8727
|
-
const { strict = false } = options2;
|
|
8728
|
-
if (!value)
|
|
8729
|
-
throw new InvalidHexTypeError(value);
|
|
8730
|
-
if (typeof value !== "string")
|
|
8731
|
-
throw new InvalidHexTypeError(value);
|
|
8732
|
-
if (strict) {
|
|
8733
|
-
if (!/^0x[0-9a-fA-F]*$/.test(value))
|
|
8734
|
-
throw new InvalidHexValueError(value);
|
|
8735
|
-
}
|
|
8736
|
-
if (!value.startsWith("0x"))
|
|
8737
|
-
throw new InvalidHexValueError(value);
|
|
8738
|
-
}
|
|
8739
|
-
function concat(...values) {
|
|
8740
|
-
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
8741
|
-
}
|
|
8742
|
-
function fromBoolean(value, options2 = {}) {
|
|
8743
|
-
const hex = `0x${Number(value)}`;
|
|
8744
|
-
if (typeof options2.size === "number") {
|
|
8745
|
-
assertSize2(hex, options2.size);
|
|
8746
|
-
return padLeft(hex, options2.size);
|
|
8747
|
-
}
|
|
8748
|
-
return hex;
|
|
8749
|
-
}
|
|
8750
|
-
function fromBytes(value, options2 = {}) {
|
|
8751
|
-
let string = "";
|
|
8752
|
-
for (let i = 0;i < value.length; i++)
|
|
8753
|
-
string += hexes[value[i]];
|
|
8754
|
-
const hex = `0x${string}`;
|
|
8755
|
-
if (typeof options2.size === "number") {
|
|
8756
|
-
assertSize2(hex, options2.size);
|
|
8757
|
-
return padRight(hex, options2.size);
|
|
8758
|
-
}
|
|
8759
|
-
return hex;
|
|
8760
|
-
}
|
|
8761
|
-
function fromNumber(value, options2 = {}) {
|
|
8762
|
-
const { signed, size: size3 } = options2;
|
|
8763
|
-
const value_ = BigInt(value);
|
|
8764
|
-
let maxValue;
|
|
8765
|
-
if (size3) {
|
|
8766
|
-
if (signed)
|
|
8767
|
-
maxValue = (1n << BigInt(size3) * 8n - 1n) - 1n;
|
|
8768
|
-
else
|
|
8769
|
-
maxValue = 2n ** (BigInt(size3) * 8n) - 1n;
|
|
8770
|
-
} else if (typeof value === "number") {
|
|
8771
|
-
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
8772
|
-
}
|
|
8773
|
-
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
8774
|
-
if (maxValue && value_ > maxValue || value_ < minValue) {
|
|
8775
|
-
const suffix = typeof value === "bigint" ? "n" : "";
|
|
8776
|
-
throw new IntegerOutOfRangeError({
|
|
8777
|
-
max: maxValue ? `${maxValue}${suffix}` : undefined,
|
|
8778
|
-
min: `${minValue}${suffix}`,
|
|
8779
|
-
signed,
|
|
8780
|
-
size: size3,
|
|
8781
|
-
value: `${value}${suffix}`
|
|
8782
|
-
});
|
|
8783
|
-
}
|
|
8784
|
-
const stringValue = (signed && value_ < 0 ? BigInt.asUintN(size3 * 8, BigInt(value_)) : value_).toString(16);
|
|
8785
|
-
const hex = `0x${stringValue}`;
|
|
8786
|
-
if (size3)
|
|
8787
|
-
return padLeft(hex, size3);
|
|
8788
|
-
return hex;
|
|
8789
|
-
}
|
|
8790
|
-
function fromString(value, options2 = {}) {
|
|
8791
|
-
return fromBytes(encoder.encode(value), options2);
|
|
8792
|
-
}
|
|
8793
|
-
function padLeft(value, size3) {
|
|
8794
|
-
return pad3(value, { dir: "left", size: size3 });
|
|
8795
|
-
}
|
|
8796
|
-
function padRight(value, size3) {
|
|
8797
|
-
return pad3(value, { dir: "right", size: size3 });
|
|
8798
|
-
}
|
|
8799
|
-
function size2(value) {
|
|
8800
|
-
return Math.ceil((value.length - 2) / 2);
|
|
8801
|
-
}
|
|
8802
|
-
function toBigInt(hex, options2 = {}) {
|
|
8803
|
-
const { signed } = options2;
|
|
8804
|
-
if (options2.size)
|
|
8805
|
-
assertSize2(hex, options2.size);
|
|
8806
|
-
const value = BigInt(hex);
|
|
8807
|
-
if (!signed)
|
|
8808
|
-
return value;
|
|
8809
|
-
const size3 = (hex.length - 2) / 2;
|
|
8810
|
-
const max_unsigned = (1n << BigInt(size3) * 8n) - 1n;
|
|
8811
|
-
const max_signed = max_unsigned >> 1n;
|
|
8812
|
-
if (value <= max_signed)
|
|
8813
|
-
return value;
|
|
8814
|
-
return value - max_unsigned - 1n;
|
|
8815
|
-
}
|
|
8816
|
-
function toNumber(hex, options2 = {}) {
|
|
8817
|
-
const { signed, size: size3 } = options2;
|
|
8818
|
-
if (!signed && !size3)
|
|
8819
|
-
return Number(hex);
|
|
8820
|
-
return Number(toBigInt(hex, options2));
|
|
8821
|
-
}
|
|
8822
|
-
function validate2(value, options2 = {}) {
|
|
8823
|
-
const { strict = false } = options2;
|
|
8824
|
-
try {
|
|
8825
|
-
assert(value, { strict });
|
|
8826
|
-
return true;
|
|
8827
|
-
} catch {
|
|
8828
|
-
return false;
|
|
8829
|
-
}
|
|
8830
|
-
}
|
|
8831
|
-
var encoder, hexes, IntegerOutOfRangeError, InvalidHexTypeError, InvalidHexValueError, SizeOverflowError2, SizeExceedsPaddingSizeError2;
|
|
8832
|
-
var init_Hex = __esm(() => {
|
|
8833
|
-
init_Errors();
|
|
8834
|
-
init_hex();
|
|
8835
|
-
encoder = /* @__PURE__ */ new TextEncoder;
|
|
8836
|
-
hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
8837
|
-
IntegerOutOfRangeError = class IntegerOutOfRangeError extends BaseError {
|
|
8838
|
-
constructor({ max, min, signed, size: size3, value }) {
|
|
8839
|
-
super(`Number \`${value}\` is not in safe${size3 ? ` ${size3 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
|
|
8840
|
-
Object.defineProperty(this, "name", {
|
|
8841
|
-
enumerable: true,
|
|
8842
|
-
configurable: true,
|
|
8843
|
-
writable: true,
|
|
8844
|
-
value: "Hex.IntegerOutOfRangeError"
|
|
8845
|
-
});
|
|
8846
|
-
}
|
|
8847
|
-
};
|
|
8848
|
-
InvalidHexTypeError = class InvalidHexTypeError extends BaseError {
|
|
8849
|
-
constructor(value) {
|
|
8850
|
-
super(`Value \`${typeof value === "object" ? stringify2(value) : value}\` of type \`${typeof value}\` is an invalid hex type.`, {
|
|
8851
|
-
metaMessages: ['Hex types must be represented as `"0x${string}"`.']
|
|
8852
|
-
});
|
|
8853
|
-
Object.defineProperty(this, "name", {
|
|
8854
|
-
enumerable: true,
|
|
8855
|
-
configurable: true,
|
|
8856
|
-
writable: true,
|
|
8857
|
-
value: "Hex.InvalidHexTypeError"
|
|
8858
|
-
});
|
|
8859
|
-
}
|
|
8860
|
-
};
|
|
8861
|
-
InvalidHexValueError = class InvalidHexValueError extends BaseError {
|
|
8862
|
-
constructor(value) {
|
|
8863
|
-
super(`Value \`${value}\` is an invalid hex value.`, {
|
|
8864
|
-
metaMessages: [
|
|
8865
|
-
'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
|
|
8866
|
-
]
|
|
8867
|
-
});
|
|
8868
|
-
Object.defineProperty(this, "name", {
|
|
8869
|
-
enumerable: true,
|
|
8870
|
-
configurable: true,
|
|
8871
|
-
writable: true,
|
|
8872
|
-
value: "Hex.InvalidHexValueError"
|
|
8873
|
-
});
|
|
8874
|
-
}
|
|
8875
|
-
};
|
|
8876
|
-
SizeOverflowError2 = class SizeOverflowError2 extends BaseError {
|
|
8877
|
-
constructor({ givenSize, maxSize }) {
|
|
8878
|
-
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
|
|
8879
|
-
Object.defineProperty(this, "name", {
|
|
8880
|
-
enumerable: true,
|
|
8881
|
-
configurable: true,
|
|
8882
|
-
writable: true,
|
|
8883
|
-
value: "Hex.SizeOverflowError"
|
|
8884
|
-
});
|
|
8885
|
-
}
|
|
8886
|
-
};
|
|
8887
|
-
SizeExceedsPaddingSizeError2 = class SizeExceedsPaddingSizeError2 extends BaseError {
|
|
8888
|
-
constructor({ size: size3, targetSize, type }) {
|
|
8889
|
-
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size3}\`) exceeds padding size (\`${targetSize}\`).`);
|
|
8890
|
-
Object.defineProperty(this, "name", {
|
|
8891
|
-
enumerable: true,
|
|
8892
|
-
configurable: true,
|
|
8893
|
-
writable: true,
|
|
8894
|
-
value: "Hex.SizeExceedsPaddingSizeError"
|
|
8895
|
-
});
|
|
8896
|
-
}
|
|
8897
|
-
};
|
|
8898
|
-
});
|
|
8899
|
-
|
|
8900
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Bytes.js
|
|
8901
|
-
var exports_Bytes = {};
|
|
8902
|
-
__export(exports_Bytes, {
|
|
8903
|
-
validate: () => validate3,
|
|
8904
|
-
trimRight: () => trimRight,
|
|
8905
|
-
trimLeft: () => trimLeft,
|
|
8906
|
-
toString: () => toString,
|
|
8907
|
-
toNumber: () => toNumber2,
|
|
8908
|
-
toHex: () => toHex,
|
|
8909
|
-
toBoolean: () => toBoolean,
|
|
8910
|
-
toBigInt: () => toBigInt2,
|
|
8911
|
-
slice: () => slice,
|
|
8912
|
-
size: () => size,
|
|
8913
|
-
random: () => random,
|
|
8914
|
-
padRight: () => padRight2,
|
|
8915
|
-
padLeft: () => padLeft2,
|
|
8916
|
-
isEqual: () => isEqual,
|
|
8917
|
-
fromString: () => fromString2,
|
|
8918
|
-
fromNumber: () => fromNumber2,
|
|
8919
|
-
fromHex: () => fromHex,
|
|
8920
|
-
fromBoolean: () => fromBoolean2,
|
|
8921
|
-
fromArray: () => fromArray,
|
|
8922
|
-
from: () => from,
|
|
8923
|
-
concat: () => concat2,
|
|
8924
|
-
assert: () => assert2,
|
|
8925
|
-
SliceOffsetOutOfBoundsError: () => SliceOffsetOutOfBoundsError,
|
|
8926
|
-
SizeOverflowError: () => SizeOverflowError,
|
|
8927
|
-
SizeExceedsPaddingSizeError: () => SizeExceedsPaddingSizeError,
|
|
8928
|
-
InvalidBytesTypeError: () => InvalidBytesTypeError,
|
|
8929
|
-
InvalidBytesBooleanError: () => InvalidBytesBooleanError
|
|
8930
|
-
});
|
|
8931
|
-
function assert2(value) {
|
|
8932
|
-
if (value instanceof Uint8Array)
|
|
8933
|
-
return;
|
|
8934
|
-
if (!value)
|
|
8935
|
-
throw new InvalidBytesTypeError(value);
|
|
8936
|
-
if (typeof value !== "object")
|
|
8937
|
-
throw new InvalidBytesTypeError(value);
|
|
8938
|
-
if (!("BYTES_PER_ELEMENT" in value))
|
|
8939
|
-
throw new InvalidBytesTypeError(value);
|
|
8940
|
-
if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array")
|
|
8941
|
-
throw new InvalidBytesTypeError(value);
|
|
8942
|
-
}
|
|
8943
|
-
function concat2(...values) {
|
|
8944
|
-
let length = 0;
|
|
8945
|
-
for (const arr of values) {
|
|
8946
|
-
length += arr.length;
|
|
8947
|
-
}
|
|
8948
|
-
const result = new Uint8Array(length);
|
|
8949
|
-
for (let i = 0, index = 0;i < values.length; i++) {
|
|
8950
|
-
const arr = values[i];
|
|
8951
|
-
result.set(arr, index);
|
|
8952
|
-
index += arr.length;
|
|
8953
|
-
}
|
|
8954
|
-
return result;
|
|
8955
|
-
}
|
|
8956
|
-
function from(value) {
|
|
8957
|
-
if (value instanceof Uint8Array)
|
|
8958
|
-
return value;
|
|
8959
|
-
if (typeof value === "string")
|
|
8960
|
-
return fromHex(value);
|
|
8961
|
-
return fromArray(value);
|
|
8188
|
+
function from(value) {
|
|
8189
|
+
if (value instanceof Uint8Array)
|
|
8190
|
+
return value;
|
|
8191
|
+
if (typeof value === "string")
|
|
8192
|
+
return fromHex(value);
|
|
8193
|
+
return fromArray(value);
|
|
8962
8194
|
}
|
|
8963
8195
|
function fromArray(value) {
|
|
8964
8196
|
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
8965
8197
|
}
|
|
8966
|
-
function
|
|
8198
|
+
function fromBoolean(value, options2 = {}) {
|
|
8967
8199
|
const { size: size3 } = options2;
|
|
8968
8200
|
const bytes = new Uint8Array(1);
|
|
8969
8201
|
bytes[0] = Number(value);
|
|
@@ -8999,9 +8231,9 @@ function fromNumber2(value, options2) {
|
|
|
8999
8231
|
const hex = fromNumber(value, options2);
|
|
9000
8232
|
return fromHex(hex);
|
|
9001
8233
|
}
|
|
9002
|
-
function
|
|
8234
|
+
function fromString(value, options2 = {}) {
|
|
9003
8235
|
const { size: size3 } = options2;
|
|
9004
|
-
const bytes =
|
|
8236
|
+
const bytes = encoder.encode(value);
|
|
9005
8237
|
if (typeof size3 === "number") {
|
|
9006
8238
|
assertSize(bytes, size3);
|
|
9007
8239
|
return padRight2(bytes, size3);
|
|
@@ -9082,15 +8314,15 @@ function validate3(value) {
|
|
|
9082
8314
|
return false;
|
|
9083
8315
|
}
|
|
9084
8316
|
}
|
|
9085
|
-
var decoder,
|
|
8317
|
+
var decoder, encoder, InvalidBytesBooleanError, InvalidBytesTypeError, SizeOverflowError, SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
|
|
9086
8318
|
var init_Bytes = __esm(() => {
|
|
9087
|
-
|
|
8319
|
+
init_utils();
|
|
9088
8320
|
init_Errors();
|
|
9089
8321
|
init_Hex();
|
|
9090
8322
|
init_bytes();
|
|
9091
8323
|
init_hex();
|
|
9092
8324
|
decoder = /* @__PURE__ */ new TextDecoder;
|
|
9093
|
-
|
|
8325
|
+
encoder = /* @__PURE__ */ new TextEncoder;
|
|
9094
8326
|
InvalidBytesBooleanError = class InvalidBytesBooleanError extends BaseError {
|
|
9095
8327
|
constructor(bytes) {
|
|
9096
8328
|
super(`Bytes value \`${bytes}\` is not a valid boolean.`, {
|
|
@@ -9154,441 +8386,13 @@ var init_Bytes = __esm(() => {
|
|
|
9154
8386
|
};
|
|
9155
8387
|
});
|
|
9156
8388
|
|
|
9157
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Hash.js
|
|
9158
|
-
var exports_Hash = {};
|
|
9159
|
-
__export(exports_Hash, {
|
|
9160
|
-
validate: () => validate4,
|
|
9161
|
-
sha256: () => sha2563,
|
|
9162
|
-
ripemd160: () => ripemd1603,
|
|
9163
|
-
keccak256: () => keccak256,
|
|
9164
|
-
hmac256: () => hmac256
|
|
9165
|
-
});
|
|
9166
|
-
function keccak256(value, options2 = {}) {
|
|
9167
|
-
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9168
|
-
const bytes = keccak_256(from(value));
|
|
9169
|
-
if (as === "Bytes")
|
|
9170
|
-
return bytes;
|
|
9171
|
-
return fromBytes(bytes);
|
|
9172
|
-
}
|
|
9173
|
-
function hmac256(key, value, options2 = {}) {
|
|
9174
|
-
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9175
|
-
const bytes = hmac(sha2562, from(key), from(value));
|
|
9176
|
-
if (as === "Bytes")
|
|
9177
|
-
return bytes;
|
|
9178
|
-
return fromBytes(bytes);
|
|
9179
|
-
}
|
|
9180
|
-
function ripemd1603(value, options2 = {}) {
|
|
9181
|
-
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9182
|
-
const bytes = ripemd1602(from(value));
|
|
9183
|
-
if (as === "Bytes")
|
|
9184
|
-
return bytes;
|
|
9185
|
-
return fromBytes(bytes);
|
|
9186
|
-
}
|
|
9187
|
-
function sha2563(value, options2 = {}) {
|
|
9188
|
-
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9189
|
-
const bytes = sha2562(from(value));
|
|
9190
|
-
if (as === "Bytes")
|
|
9191
|
-
return bytes;
|
|
9192
|
-
return fromBytes(bytes);
|
|
9193
|
-
}
|
|
9194
|
-
function validate4(value) {
|
|
9195
|
-
return validate2(value) && size2(value) === 32;
|
|
9196
|
-
}
|
|
9197
|
-
var init_Hash = __esm(() => {
|
|
9198
|
-
init_hmac();
|
|
9199
|
-
init_ripemd160();
|
|
9200
|
-
init_sha3();
|
|
9201
|
-
init_sha256();
|
|
9202
|
-
init_Bytes();
|
|
9203
|
-
init_Hex();
|
|
9204
|
-
});
|
|
9205
|
-
|
|
9206
|
-
// node_modules/mppx/node_modules/ox/_esm/core/internal/lru.js
|
|
9207
|
-
var LruMap;
|
|
9208
|
-
var init_lru = __esm(() => {
|
|
9209
|
-
LruMap = class LruMap extends Map {
|
|
9210
|
-
constructor(size3) {
|
|
9211
|
-
super();
|
|
9212
|
-
Object.defineProperty(this, "maxSize", {
|
|
9213
|
-
enumerable: true,
|
|
9214
|
-
configurable: true,
|
|
9215
|
-
writable: true,
|
|
9216
|
-
value: undefined
|
|
9217
|
-
});
|
|
9218
|
-
this.maxSize = size3;
|
|
9219
|
-
}
|
|
9220
|
-
get(key) {
|
|
9221
|
-
const value = super.get(key);
|
|
9222
|
-
if (super.has(key) && value !== undefined) {
|
|
9223
|
-
this.delete(key);
|
|
9224
|
-
super.set(key, value);
|
|
9225
|
-
}
|
|
9226
|
-
return value;
|
|
9227
|
-
}
|
|
9228
|
-
set(key, value) {
|
|
9229
|
-
super.set(key, value);
|
|
9230
|
-
if (this.maxSize && this.size > this.maxSize) {
|
|
9231
|
-
const firstKey = this.keys().next().value;
|
|
9232
|
-
if (firstKey)
|
|
9233
|
-
this.delete(firstKey);
|
|
9234
|
-
}
|
|
9235
|
-
return this;
|
|
9236
|
-
}
|
|
9237
|
-
};
|
|
9238
|
-
});
|
|
9239
|
-
|
|
9240
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Caches.js
|
|
9241
|
-
var caches, checksum;
|
|
9242
|
-
var init_Caches = __esm(() => {
|
|
9243
|
-
init_lru();
|
|
9244
|
-
caches = {
|
|
9245
|
-
checksum: /* @__PURE__ */ new LruMap(8192)
|
|
9246
|
-
};
|
|
9247
|
-
checksum = caches.checksum;
|
|
9248
|
-
});
|
|
9249
|
-
|
|
9250
|
-
// node_modules/mppx/node_modules/ox/_esm/core/PublicKey.js
|
|
9251
|
-
var init_PublicKey = () => {};
|
|
9252
|
-
|
|
9253
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Address.js
|
|
9254
|
-
function assert3(value, options2 = {}) {
|
|
9255
|
-
const { strict = true } = options2;
|
|
9256
|
-
if (!addressRegex.test(value))
|
|
9257
|
-
throw new InvalidAddressError({
|
|
9258
|
-
address: value,
|
|
9259
|
-
cause: new InvalidInputError
|
|
9260
|
-
});
|
|
9261
|
-
if (strict) {
|
|
9262
|
-
if (value.toLowerCase() === value)
|
|
9263
|
-
return;
|
|
9264
|
-
if (checksum2(value) !== value)
|
|
9265
|
-
throw new InvalidAddressError({
|
|
9266
|
-
address: value,
|
|
9267
|
-
cause: new InvalidChecksumError
|
|
9268
|
-
});
|
|
9269
|
-
}
|
|
9270
|
-
}
|
|
9271
|
-
function checksum2(address2) {
|
|
9272
|
-
if (checksum.has(address2))
|
|
9273
|
-
return checksum.get(address2);
|
|
9274
|
-
assert3(address2, { strict: false });
|
|
9275
|
-
const hexAddress = address2.substring(2).toLowerCase();
|
|
9276
|
-
const hash = keccak256(fromString2(hexAddress), { as: "Bytes" });
|
|
9277
|
-
const characters = hexAddress.split("");
|
|
9278
|
-
for (let i = 0;i < 40; i += 2) {
|
|
9279
|
-
if (hash[i >> 1] >> 4 >= 8 && characters[i]) {
|
|
9280
|
-
characters[i] = characters[i].toUpperCase();
|
|
9281
|
-
}
|
|
9282
|
-
if ((hash[i >> 1] & 15) >= 8 && characters[i + 1]) {
|
|
9283
|
-
characters[i + 1] = characters[i + 1].toUpperCase();
|
|
9284
|
-
}
|
|
9285
|
-
}
|
|
9286
|
-
const result = `0x${characters.join("")}`;
|
|
9287
|
-
checksum.set(address2, result);
|
|
9288
|
-
return result;
|
|
9289
|
-
}
|
|
9290
|
-
var addressRegex, InvalidAddressError, InvalidInputError, InvalidChecksumError;
|
|
9291
|
-
var init_Address = __esm(() => {
|
|
9292
|
-
init_Bytes();
|
|
9293
|
-
init_Caches();
|
|
9294
|
-
init_Errors();
|
|
9295
|
-
init_Hash();
|
|
9296
|
-
addressRegex = /^0x[a-fA-F0-9]{40}$/;
|
|
9297
|
-
InvalidAddressError = class InvalidAddressError extends BaseError {
|
|
9298
|
-
constructor({ address: address2, cause }) {
|
|
9299
|
-
super(`Address "${address2}" is invalid.`, {
|
|
9300
|
-
cause
|
|
9301
|
-
});
|
|
9302
|
-
Object.defineProperty(this, "name", {
|
|
9303
|
-
enumerable: true,
|
|
9304
|
-
configurable: true,
|
|
9305
|
-
writable: true,
|
|
9306
|
-
value: "Address.InvalidAddressError"
|
|
9307
|
-
});
|
|
9308
|
-
}
|
|
9309
|
-
};
|
|
9310
|
-
InvalidInputError = class InvalidInputError extends BaseError {
|
|
9311
|
-
constructor() {
|
|
9312
|
-
super("Address is not a 20 byte (40 hexadecimal character) value.");
|
|
9313
|
-
Object.defineProperty(this, "name", {
|
|
9314
|
-
enumerable: true,
|
|
9315
|
-
configurable: true,
|
|
9316
|
-
writable: true,
|
|
9317
|
-
value: "Address.InvalidInputError"
|
|
9318
|
-
});
|
|
9319
|
-
}
|
|
9320
|
-
};
|
|
9321
|
-
InvalidChecksumError = class InvalidChecksumError extends BaseError {
|
|
9322
|
-
constructor() {
|
|
9323
|
-
super("Address does not match its checksum counterpart.");
|
|
9324
|
-
Object.defineProperty(this, "name", {
|
|
9325
|
-
enumerable: true,
|
|
9326
|
-
configurable: true,
|
|
9327
|
-
writable: true,
|
|
9328
|
-
value: "Address.InvalidChecksumError"
|
|
9329
|
-
});
|
|
9330
|
-
}
|
|
9331
|
-
};
|
|
9332
|
-
});
|
|
9333
|
-
|
|
9334
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AbiItem.js
|
|
9335
|
-
var init_AbiItem = () => {};
|
|
9336
|
-
|
|
9337
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Solidity.js
|
|
9338
|
-
var arrayRegex, bytesRegex, integerRegex, maxInt8, maxInt16, maxInt24, maxInt32, maxInt40, maxInt48, maxInt56, maxInt64, maxInt72, maxInt80, maxInt88, maxInt96, maxInt104, maxInt112, maxInt120, maxInt128, maxInt136, maxInt144, maxInt152, maxInt160, maxInt168, maxInt176, maxInt184, maxInt192, maxInt200, maxInt208, maxInt216, maxInt224, maxInt232, maxInt240, maxInt248, maxInt256, minInt8, minInt16, minInt24, minInt32, minInt40, minInt48, minInt56, minInt64, minInt72, minInt80, minInt88, minInt96, minInt104, minInt112, minInt120, minInt128, minInt136, minInt144, minInt152, minInt160, minInt168, minInt176, minInt184, minInt192, minInt200, minInt208, minInt216, minInt224, minInt232, minInt240, minInt248, minInt256, maxUint8, maxUint16, maxUint24, maxUint32, maxUint40, maxUint48, maxUint56, maxUint64, maxUint72, maxUint80, maxUint88, maxUint96, maxUint104, maxUint112, maxUint120, maxUint128, maxUint136, maxUint144, maxUint152, maxUint160, maxUint168, maxUint176, maxUint184, maxUint192, maxUint200, maxUint208, maxUint216, maxUint224, maxUint232, maxUint240, maxUint248, maxUint256;
|
|
9339
|
-
var init_Solidity = __esm(() => {
|
|
9340
|
-
arrayRegex = /^(.*)\[([0-9]*)\]$/;
|
|
9341
|
-
bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
|
|
9342
|
-
integerRegex = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
9343
|
-
maxInt8 = 2n ** (8n - 1n) - 1n;
|
|
9344
|
-
maxInt16 = 2n ** (16n - 1n) - 1n;
|
|
9345
|
-
maxInt24 = 2n ** (24n - 1n) - 1n;
|
|
9346
|
-
maxInt32 = 2n ** (32n - 1n) - 1n;
|
|
9347
|
-
maxInt40 = 2n ** (40n - 1n) - 1n;
|
|
9348
|
-
maxInt48 = 2n ** (48n - 1n) - 1n;
|
|
9349
|
-
maxInt56 = 2n ** (56n - 1n) - 1n;
|
|
9350
|
-
maxInt64 = 2n ** (64n - 1n) - 1n;
|
|
9351
|
-
maxInt72 = 2n ** (72n - 1n) - 1n;
|
|
9352
|
-
maxInt80 = 2n ** (80n - 1n) - 1n;
|
|
9353
|
-
maxInt88 = 2n ** (88n - 1n) - 1n;
|
|
9354
|
-
maxInt96 = 2n ** (96n - 1n) - 1n;
|
|
9355
|
-
maxInt104 = 2n ** (104n - 1n) - 1n;
|
|
9356
|
-
maxInt112 = 2n ** (112n - 1n) - 1n;
|
|
9357
|
-
maxInt120 = 2n ** (120n - 1n) - 1n;
|
|
9358
|
-
maxInt128 = 2n ** (128n - 1n) - 1n;
|
|
9359
|
-
maxInt136 = 2n ** (136n - 1n) - 1n;
|
|
9360
|
-
maxInt144 = 2n ** (144n - 1n) - 1n;
|
|
9361
|
-
maxInt152 = 2n ** (152n - 1n) - 1n;
|
|
9362
|
-
maxInt160 = 2n ** (160n - 1n) - 1n;
|
|
9363
|
-
maxInt168 = 2n ** (168n - 1n) - 1n;
|
|
9364
|
-
maxInt176 = 2n ** (176n - 1n) - 1n;
|
|
9365
|
-
maxInt184 = 2n ** (184n - 1n) - 1n;
|
|
9366
|
-
maxInt192 = 2n ** (192n - 1n) - 1n;
|
|
9367
|
-
maxInt200 = 2n ** (200n - 1n) - 1n;
|
|
9368
|
-
maxInt208 = 2n ** (208n - 1n) - 1n;
|
|
9369
|
-
maxInt216 = 2n ** (216n - 1n) - 1n;
|
|
9370
|
-
maxInt224 = 2n ** (224n - 1n) - 1n;
|
|
9371
|
-
maxInt232 = 2n ** (232n - 1n) - 1n;
|
|
9372
|
-
maxInt240 = 2n ** (240n - 1n) - 1n;
|
|
9373
|
-
maxInt248 = 2n ** (248n - 1n) - 1n;
|
|
9374
|
-
maxInt256 = 2n ** (256n - 1n) - 1n;
|
|
9375
|
-
minInt8 = -(2n ** (8n - 1n));
|
|
9376
|
-
minInt16 = -(2n ** (16n - 1n));
|
|
9377
|
-
minInt24 = -(2n ** (24n - 1n));
|
|
9378
|
-
minInt32 = -(2n ** (32n - 1n));
|
|
9379
|
-
minInt40 = -(2n ** (40n - 1n));
|
|
9380
|
-
minInt48 = -(2n ** (48n - 1n));
|
|
9381
|
-
minInt56 = -(2n ** (56n - 1n));
|
|
9382
|
-
minInt64 = -(2n ** (64n - 1n));
|
|
9383
|
-
minInt72 = -(2n ** (72n - 1n));
|
|
9384
|
-
minInt80 = -(2n ** (80n - 1n));
|
|
9385
|
-
minInt88 = -(2n ** (88n - 1n));
|
|
9386
|
-
minInt96 = -(2n ** (96n - 1n));
|
|
9387
|
-
minInt104 = -(2n ** (104n - 1n));
|
|
9388
|
-
minInt112 = -(2n ** (112n - 1n));
|
|
9389
|
-
minInt120 = -(2n ** (120n - 1n));
|
|
9390
|
-
minInt128 = -(2n ** (128n - 1n));
|
|
9391
|
-
minInt136 = -(2n ** (136n - 1n));
|
|
9392
|
-
minInt144 = -(2n ** (144n - 1n));
|
|
9393
|
-
minInt152 = -(2n ** (152n - 1n));
|
|
9394
|
-
minInt160 = -(2n ** (160n - 1n));
|
|
9395
|
-
minInt168 = -(2n ** (168n - 1n));
|
|
9396
|
-
minInt176 = -(2n ** (176n - 1n));
|
|
9397
|
-
minInt184 = -(2n ** (184n - 1n));
|
|
9398
|
-
minInt192 = -(2n ** (192n - 1n));
|
|
9399
|
-
minInt200 = -(2n ** (200n - 1n));
|
|
9400
|
-
minInt208 = -(2n ** (208n - 1n));
|
|
9401
|
-
minInt216 = -(2n ** (216n - 1n));
|
|
9402
|
-
minInt224 = -(2n ** (224n - 1n));
|
|
9403
|
-
minInt232 = -(2n ** (232n - 1n));
|
|
9404
|
-
minInt240 = -(2n ** (240n - 1n));
|
|
9405
|
-
minInt248 = -(2n ** (248n - 1n));
|
|
9406
|
-
minInt256 = -(2n ** (256n - 1n));
|
|
9407
|
-
maxUint8 = 2n ** 8n - 1n;
|
|
9408
|
-
maxUint16 = 2n ** 16n - 1n;
|
|
9409
|
-
maxUint24 = 2n ** 24n - 1n;
|
|
9410
|
-
maxUint32 = 2n ** 32n - 1n;
|
|
9411
|
-
maxUint40 = 2n ** 40n - 1n;
|
|
9412
|
-
maxUint48 = 2n ** 48n - 1n;
|
|
9413
|
-
maxUint56 = 2n ** 56n - 1n;
|
|
9414
|
-
maxUint64 = 2n ** 64n - 1n;
|
|
9415
|
-
maxUint72 = 2n ** 72n - 1n;
|
|
9416
|
-
maxUint80 = 2n ** 80n - 1n;
|
|
9417
|
-
maxUint88 = 2n ** 88n - 1n;
|
|
9418
|
-
maxUint96 = 2n ** 96n - 1n;
|
|
9419
|
-
maxUint104 = 2n ** 104n - 1n;
|
|
9420
|
-
maxUint112 = 2n ** 112n - 1n;
|
|
9421
|
-
maxUint120 = 2n ** 120n - 1n;
|
|
9422
|
-
maxUint128 = 2n ** 128n - 1n;
|
|
9423
|
-
maxUint136 = 2n ** 136n - 1n;
|
|
9424
|
-
maxUint144 = 2n ** 144n - 1n;
|
|
9425
|
-
maxUint152 = 2n ** 152n - 1n;
|
|
9426
|
-
maxUint160 = 2n ** 160n - 1n;
|
|
9427
|
-
maxUint168 = 2n ** 168n - 1n;
|
|
9428
|
-
maxUint176 = 2n ** 176n - 1n;
|
|
9429
|
-
maxUint184 = 2n ** 184n - 1n;
|
|
9430
|
-
maxUint192 = 2n ** 192n - 1n;
|
|
9431
|
-
maxUint200 = 2n ** 200n - 1n;
|
|
9432
|
-
maxUint208 = 2n ** 208n - 1n;
|
|
9433
|
-
maxUint216 = 2n ** 216n - 1n;
|
|
9434
|
-
maxUint224 = 2n ** 224n - 1n;
|
|
9435
|
-
maxUint232 = 2n ** 232n - 1n;
|
|
9436
|
-
maxUint240 = 2n ** 240n - 1n;
|
|
9437
|
-
maxUint248 = 2n ** 248n - 1n;
|
|
9438
|
-
maxUint256 = 2n ** 256n - 1n;
|
|
9439
|
-
});
|
|
9440
|
-
|
|
9441
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AbiParameters.js
|
|
9442
|
-
function encodePacked(types, values) {
|
|
9443
|
-
if (types.length !== values.length)
|
|
9444
|
-
throw new LengthMismatchError({
|
|
9445
|
-
expectedLength: types.length,
|
|
9446
|
-
givenLength: values.length
|
|
9447
|
-
});
|
|
9448
|
-
const data = [];
|
|
9449
|
-
for (let i = 0;i < types.length; i++) {
|
|
9450
|
-
const type = types[i];
|
|
9451
|
-
const value = values[i];
|
|
9452
|
-
data.push(encodePacked.encode(type, value));
|
|
9453
|
-
}
|
|
9454
|
-
return concat(...data);
|
|
9455
|
-
}
|
|
9456
|
-
var BytesSizeMismatchError, LengthMismatchError, InvalidTypeError;
|
|
9457
|
-
var init_AbiParameters = __esm(() => {
|
|
9458
|
-
init_Address();
|
|
9459
|
-
init_Errors();
|
|
9460
|
-
init_Hex();
|
|
9461
|
-
init_Solidity();
|
|
9462
|
-
(function(encodePacked2) {
|
|
9463
|
-
function encode(type, value, isArray = false) {
|
|
9464
|
-
if (type === "address") {
|
|
9465
|
-
const address2 = value;
|
|
9466
|
-
assert3(address2);
|
|
9467
|
-
return padLeft(address2.toLowerCase(), isArray ? 32 : 0);
|
|
9468
|
-
}
|
|
9469
|
-
if (type === "string")
|
|
9470
|
-
return fromString(value);
|
|
9471
|
-
if (type === "bytes")
|
|
9472
|
-
return value;
|
|
9473
|
-
if (type === "bool")
|
|
9474
|
-
return padLeft(fromBoolean(value), isArray ? 32 : 1);
|
|
9475
|
-
const intMatch = type.match(integerRegex);
|
|
9476
|
-
if (intMatch) {
|
|
9477
|
-
const [_type, baseType, bits = "256"] = intMatch;
|
|
9478
|
-
const size3 = Number.parseInt(bits, 10) / 8;
|
|
9479
|
-
return fromNumber(value, {
|
|
9480
|
-
size: isArray ? 32 : size3,
|
|
9481
|
-
signed: baseType === "int"
|
|
9482
|
-
});
|
|
9483
|
-
}
|
|
9484
|
-
const bytesMatch = type.match(bytesRegex);
|
|
9485
|
-
if (bytesMatch) {
|
|
9486
|
-
const [_type, size3] = bytesMatch;
|
|
9487
|
-
if (Number.parseInt(size3, 10) !== (value.length - 2) / 2)
|
|
9488
|
-
throw new BytesSizeMismatchError({
|
|
9489
|
-
expectedSize: Number.parseInt(size3, 10),
|
|
9490
|
-
value
|
|
9491
|
-
});
|
|
9492
|
-
return padRight(value, isArray ? 32 : 0);
|
|
9493
|
-
}
|
|
9494
|
-
const arrayMatch = type.match(arrayRegex);
|
|
9495
|
-
if (arrayMatch && Array.isArray(value)) {
|
|
9496
|
-
const [_type, childType] = arrayMatch;
|
|
9497
|
-
const data = [];
|
|
9498
|
-
for (let i = 0;i < value.length; i++) {
|
|
9499
|
-
data.push(encode(childType, value[i], true));
|
|
9500
|
-
}
|
|
9501
|
-
if (data.length === 0)
|
|
9502
|
-
return "0x";
|
|
9503
|
-
return concat(...data);
|
|
9504
|
-
}
|
|
9505
|
-
throw new InvalidTypeError(type);
|
|
9506
|
-
}
|
|
9507
|
-
encodePacked2.encode = encode;
|
|
9508
|
-
})(encodePacked || (encodePacked = {}));
|
|
9509
|
-
BytesSizeMismatchError = class BytesSizeMismatchError extends BaseError {
|
|
9510
|
-
constructor({ expectedSize, value }) {
|
|
9511
|
-
super(`Size of bytes "${value}" (bytes${size2(value)}) does not match expected size (bytes${expectedSize}).`);
|
|
9512
|
-
Object.defineProperty(this, "name", {
|
|
9513
|
-
enumerable: true,
|
|
9514
|
-
configurable: true,
|
|
9515
|
-
writable: true,
|
|
9516
|
-
value: "AbiParameters.BytesSizeMismatchError"
|
|
9517
|
-
});
|
|
9518
|
-
}
|
|
9519
|
-
};
|
|
9520
|
-
LengthMismatchError = class LengthMismatchError extends BaseError {
|
|
9521
|
-
constructor({ expectedLength, givenLength }) {
|
|
9522
|
-
super([
|
|
9523
|
-
"ABI encoding parameters/values length mismatch.",
|
|
9524
|
-
`Expected length (parameters): ${expectedLength}`,
|
|
9525
|
-
`Given length (values): ${givenLength}`
|
|
9526
|
-
].join(`
|
|
9527
|
-
`));
|
|
9528
|
-
Object.defineProperty(this, "name", {
|
|
9529
|
-
enumerable: true,
|
|
9530
|
-
configurable: true,
|
|
9531
|
-
writable: true,
|
|
9532
|
-
value: "AbiParameters.LengthMismatchError"
|
|
9533
|
-
});
|
|
9534
|
-
}
|
|
9535
|
-
};
|
|
9536
|
-
InvalidTypeError = class InvalidTypeError extends BaseError {
|
|
9537
|
-
constructor(type) {
|
|
9538
|
-
super(`Type \`${type}\` is not a valid ABI Type.`);
|
|
9539
|
-
Object.defineProperty(this, "name", {
|
|
9540
|
-
enumerable: true,
|
|
9541
|
-
configurable: true,
|
|
9542
|
-
writable: true,
|
|
9543
|
-
value: "AbiParameters.InvalidTypeError"
|
|
9544
|
-
});
|
|
9545
|
-
}
|
|
9546
|
-
};
|
|
9547
|
-
});
|
|
9548
|
-
|
|
9549
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AbiConstructor.js
|
|
9550
|
-
var init_AbiConstructor = () => {};
|
|
9551
|
-
|
|
9552
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AbiError.js
|
|
9553
|
-
var init_AbiError = () => {};
|
|
9554
|
-
|
|
9555
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AbiEvent.js
|
|
9556
|
-
var init_AbiEvent = () => {};
|
|
9557
|
-
|
|
9558
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AbiFunction.js
|
|
9559
|
-
var init_AbiFunction = () => {};
|
|
9560
|
-
|
|
9561
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AccessList.js
|
|
9562
|
-
var init_AccessList = () => {};
|
|
9563
|
-
|
|
9564
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AccountProof.js
|
|
9565
|
-
var init_AccountProof = () => {};
|
|
9566
|
-
|
|
9567
|
-
// node_modules/mppx/node_modules/ox/_esm/core/AesGcm.js
|
|
9568
|
-
var init_AesGcm = () => {};
|
|
9569
|
-
|
|
9570
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Rlp.js
|
|
9571
|
-
var init_Rlp = () => {};
|
|
9572
|
-
|
|
9573
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Signature.js
|
|
9574
|
-
var init_Signature = () => {};
|
|
9575
|
-
|
|
9576
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Authorization.js
|
|
9577
|
-
var init_Authorization = () => {};
|
|
9578
|
-
|
|
9579
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Base32.js
|
|
9580
|
-
var init_Base32 = () => {};
|
|
9581
|
-
|
|
9582
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Base58.js
|
|
9583
|
-
var init_Base58 = () => {};
|
|
9584
|
-
|
|
9585
8389
|
// node_modules/mppx/node_modules/ox/_esm/core/Base64.js
|
|
9586
8390
|
var exports_Base64 = {};
|
|
9587
8391
|
__export(exports_Base64, {
|
|
9588
8392
|
toString: () => toString2,
|
|
9589
8393
|
toHex: () => toHex2,
|
|
9590
|
-
toBytes: () =>
|
|
9591
|
-
fromString: () =>
|
|
8394
|
+
toBytes: () => toBytes,
|
|
8395
|
+
fromString: () => fromString2,
|
|
9592
8396
|
fromHex: () => fromHex2,
|
|
9593
8397
|
fromBytes: () => fromBytes2
|
|
9594
8398
|
});
|
|
@@ -9616,14 +8420,14 @@ function fromBytes2(value, options2 = {}) {
|
|
|
9616
8420
|
function fromHex2(value, options2 = {}) {
|
|
9617
8421
|
return fromBytes2(fromHex(value), options2);
|
|
9618
8422
|
}
|
|
9619
|
-
function
|
|
9620
|
-
return fromBytes2(
|
|
8423
|
+
function fromString2(value, options2 = {}) {
|
|
8424
|
+
return fromBytes2(fromString(value), options2);
|
|
9621
8425
|
}
|
|
9622
|
-
function
|
|
8426
|
+
function toBytes(value) {
|
|
9623
8427
|
const base64 = value.replace(/=+$/, "");
|
|
9624
8428
|
const size3 = base64.length;
|
|
9625
8429
|
const decoded = new Uint8Array(size3 + 3);
|
|
9626
|
-
|
|
8430
|
+
encoder2.encodeInto(base64 + "===", decoded);
|
|
9627
8431
|
for (let i = 0, j = 0;i < base64.length; i += 4, j += 3) {
|
|
9628
8432
|
const x = (characterToInteger[decoded[i]] << 18) + (characterToInteger[decoded[i + 1]] << 12) + (characterToInteger[decoded[i + 2]] << 6) + characterToInteger[decoded[i + 3]];
|
|
9629
8433
|
decoded[j] = x >> 16;
|
|
@@ -9634,1830 +8438,851 @@ function toBytes2(value) {
|
|
|
9634
8438
|
return new Uint8Array(decoded.buffer, 0, decodedSize);
|
|
9635
8439
|
}
|
|
9636
8440
|
function toHex2(value) {
|
|
9637
|
-
return fromBytes(
|
|
8441
|
+
return fromBytes(toBytes(value));
|
|
9638
8442
|
}
|
|
9639
8443
|
function toString2(value) {
|
|
9640
|
-
return toString(
|
|
8444
|
+
return toString(toBytes(value));
|
|
9641
8445
|
}
|
|
9642
|
-
var
|
|
8446
|
+
var encoder2, decoder2, integerToCharacter, characterToInteger;
|
|
9643
8447
|
var init_Base64 = __esm(() => {
|
|
9644
8448
|
init_Bytes();
|
|
9645
8449
|
init_Hex();
|
|
9646
|
-
|
|
8450
|
+
encoder2 = /* @__PURE__ */ new TextEncoder;
|
|
9647
8451
|
decoder2 = /* @__PURE__ */ new TextDecoder;
|
|
9648
8452
|
integerToCharacter = /* @__PURE__ */ Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((a, i) => [i, a.charCodeAt(0)]));
|
|
9649
8453
|
characterToInteger = {
|
|
9650
8454
|
...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((a, i) => [a.charCodeAt(0), i])),
|
|
9651
8455
|
[61]: 0,
|
|
9652
8456
|
[45]: 62,
|
|
9653
|
-
[95]: 63
|
|
9654
|
-
};
|
|
9655
|
-
});
|
|
9656
|
-
|
|
9657
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Bech32m.js
|
|
9658
|
-
var init_Bech32m = () => {};
|
|
9659
|
-
|
|
9660
|
-
// node_modules/mppx/node_modules/ox/_esm/core/BinaryStateTree.js
|
|
9661
|
-
var init_BinaryStateTree = () => {};
|
|
9662
|
-
|
|
9663
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Blobs.js
|
|
9664
|
-
var blobsPerTransaction = 6, bytesPerFieldElement = 32, fieldElementsPerBlob = 4096, bytesPerBlob, maxBytesPerTransaction;
|
|
9665
|
-
var init_Blobs = __esm(() => {
|
|
9666
|
-
bytesPerBlob = bytesPerFieldElement * fieldElementsPerBlob;
|
|
9667
|
-
maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - 1 - 1 * fieldElementsPerBlob * blobsPerTransaction;
|
|
9668
|
-
});
|
|
9669
|
-
|
|
9670
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Transaction.js
|
|
9671
|
-
var init_Transaction = () => {};
|
|
9672
|
-
|
|
9673
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Withdrawal.js
|
|
9674
|
-
var init_Withdrawal = () => {};
|
|
9675
|
-
|
|
9676
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Block.js
|
|
9677
|
-
var init_Block = () => {};
|
|
9678
|
-
|
|
9679
|
-
// node_modules/mppx/node_modules/ox/_esm/core/BlockOverrides.js
|
|
9680
|
-
var init_BlockOverrides = () => {};
|
|
9681
|
-
|
|
9682
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Bloom.js
|
|
9683
|
-
var init_Bloom = () => {};
|
|
9684
|
-
|
|
9685
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Bls.js
|
|
9686
|
-
var init_Bls = () => {};
|
|
9687
|
-
|
|
9688
|
-
// node_modules/mppx/node_modules/ox/_esm/core/BlsPoint.js
|
|
9689
|
-
var init_BlsPoint = () => {};
|
|
9690
|
-
|
|
9691
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Cbor.js
|
|
9692
|
-
function getEncodable(value) {
|
|
9693
|
-
if (typeof value === "undefined")
|
|
9694
|
-
return { length: 1, encode: (cursor) => cursor.pushUint8(247) };
|
|
9695
|
-
if (value === null)
|
|
9696
|
-
return { length: 1, encode: (cursor) => cursor.pushUint8(246) };
|
|
9697
|
-
if (typeof value === "boolean")
|
|
9698
|
-
return {
|
|
9699
|
-
length: 1,
|
|
9700
|
-
encode: (cursor) => cursor.pushUint8(value ? 245 : 244)
|
|
9701
|
-
};
|
|
9702
|
-
if (typeof value === "number")
|
|
9703
|
-
return getEncodable.number(value);
|
|
9704
|
-
if (typeof value === "bigint")
|
|
9705
|
-
throw new UnsupportedBigIntError;
|
|
9706
|
-
if (typeof value === "string")
|
|
9707
|
-
return getEncodable.string(value);
|
|
9708
|
-
if (Array.isArray(value))
|
|
9709
|
-
return getEncodable.array(value);
|
|
9710
|
-
if (value instanceof Uint8Array)
|
|
9711
|
-
return getEncodable.byteString(value);
|
|
9712
|
-
if (value instanceof ArrayBuffer)
|
|
9713
|
-
return getEncodable.byteString(new Uint8Array(value));
|
|
9714
|
-
if (ArrayBuffer.isView(value))
|
|
9715
|
-
return getEncodable.byteString(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
|
|
9716
|
-
if (value instanceof Map)
|
|
9717
|
-
return getEncodable.map(value);
|
|
9718
|
-
if (typeof value === "object")
|
|
9719
|
-
return getEncodable.object(value);
|
|
9720
|
-
throw new UnexpectedTokenError({ token: String(value) });
|
|
9721
|
-
}
|
|
9722
|
-
function decodeCursor(cursor) {
|
|
9723
|
-
const initialByte = cursor.readUint8();
|
|
9724
|
-
const majorType = initialByte >> 5;
|
|
9725
|
-
const additionalInfo = initialByte & 31;
|
|
9726
|
-
switch (majorType) {
|
|
9727
|
-
case 0:
|
|
9728
|
-
return decodeCursor.readUnsignedInteger(cursor, additionalInfo);
|
|
9729
|
-
case 1:
|
|
9730
|
-
return decodeCursor.readNegativeInteger(cursor, additionalInfo);
|
|
9731
|
-
case 2:
|
|
9732
|
-
return decodeCursor.readByteString(cursor, additionalInfo);
|
|
9733
|
-
case 3:
|
|
9734
|
-
return decodeCursor.readTextString(cursor, additionalInfo);
|
|
9735
|
-
case 4:
|
|
9736
|
-
return decodeCursor.readArray(cursor, additionalInfo);
|
|
9737
|
-
case 5:
|
|
9738
|
-
return decodeCursor.readMap(cursor, additionalInfo);
|
|
9739
|
-
case 6:
|
|
9740
|
-
throw new UnsupportedTagError({ tag: additionalInfo });
|
|
9741
|
-
case 7:
|
|
9742
|
-
return decodeCursor.readSimpleOrFloat(cursor, additionalInfo);
|
|
9743
|
-
default:
|
|
9744
|
-
throw new InvalidMajorTypeError({ majorType });
|
|
9745
|
-
}
|
|
9746
|
-
}
|
|
9747
|
-
var InvalidMajorTypeError, InvalidAdditionalInfoError, Unsupported64BitIntegerError, UnsupportedTagError, InvalidIndefiniteLengthChunkError, InvalidSimpleValueError, UnsupportedBigIntError, UnexpectedTokenError, NumberTooLargeError, StringTooLargeError, ArrayTooLargeError, ObjectTooLargeError, ByteStringTooLargeError;
|
|
9748
|
-
var init_Cbor = __esm(() => {
|
|
9749
|
-
init_Bytes();
|
|
9750
|
-
init_Errors();
|
|
9751
|
-
InvalidMajorTypeError = class InvalidMajorTypeError extends BaseError {
|
|
9752
|
-
constructor({ majorType }) {
|
|
9753
|
-
super(`Invalid CBOR major type: ${majorType}`);
|
|
9754
|
-
Object.defineProperty(this, "name", {
|
|
9755
|
-
enumerable: true,
|
|
9756
|
-
configurable: true,
|
|
9757
|
-
writable: true,
|
|
9758
|
-
value: "Cbor.InvalidMajorTypeError"
|
|
9759
|
-
});
|
|
9760
|
-
}
|
|
9761
|
-
};
|
|
9762
|
-
InvalidAdditionalInfoError = class InvalidAdditionalInfoError extends BaseError {
|
|
9763
|
-
constructor({ additionalInfo }) {
|
|
9764
|
-
super(`Invalid CBOR additional info: ${additionalInfo}`);
|
|
9765
|
-
Object.defineProperty(this, "name", {
|
|
9766
|
-
enumerable: true,
|
|
9767
|
-
configurable: true,
|
|
9768
|
-
writable: true,
|
|
9769
|
-
value: "Cbor.InvalidAdditionalInfoError"
|
|
9770
|
-
});
|
|
9771
|
-
}
|
|
9772
|
-
};
|
|
9773
|
-
Unsupported64BitIntegerError = class Unsupported64BitIntegerError extends BaseError {
|
|
9774
|
-
constructor() {
|
|
9775
|
-
super("64-bit integers are not supported in CBOR decoding.");
|
|
9776
|
-
Object.defineProperty(this, "name", {
|
|
9777
|
-
enumerable: true,
|
|
9778
|
-
configurable: true,
|
|
9779
|
-
writable: true,
|
|
9780
|
-
value: "Cbor.Unsupported64BitIntegerError"
|
|
9781
|
-
});
|
|
9782
|
-
}
|
|
9783
|
-
};
|
|
9784
|
-
UnsupportedTagError = class UnsupportedTagError extends BaseError {
|
|
9785
|
-
constructor({ tag }) {
|
|
9786
|
-
super(`CBOR tagged data (tag ${tag}) is not yet supported.`);
|
|
9787
|
-
Object.defineProperty(this, "name", {
|
|
9788
|
-
enumerable: true,
|
|
9789
|
-
configurable: true,
|
|
9790
|
-
writable: true,
|
|
9791
|
-
value: "Cbor.UnsupportedTagError"
|
|
9792
|
-
});
|
|
9793
|
-
}
|
|
9794
|
-
};
|
|
9795
|
-
InvalidIndefiniteLengthChunkError = class InvalidIndefiniteLengthChunkError extends BaseError {
|
|
9796
|
-
constructor({ type }) {
|
|
9797
|
-
super(`Invalid chunk type in indefinite-length ${type}`);
|
|
9798
|
-
Object.defineProperty(this, "name", {
|
|
9799
|
-
enumerable: true,
|
|
9800
|
-
configurable: true,
|
|
9801
|
-
writable: true,
|
|
9802
|
-
value: "Cbor.InvalidIndefiniteLengthChunkError"
|
|
9803
|
-
});
|
|
9804
|
-
}
|
|
9805
|
-
};
|
|
9806
|
-
InvalidSimpleValueError = class InvalidSimpleValueError extends BaseError {
|
|
9807
|
-
constructor({ value }) {
|
|
9808
|
-
super(`Invalid CBOR simple value: ${value}`);
|
|
9809
|
-
Object.defineProperty(this, "name", {
|
|
9810
|
-
enumerable: true,
|
|
9811
|
-
configurable: true,
|
|
9812
|
-
writable: true,
|
|
9813
|
-
value: "Cbor.InvalidSimpleValueError"
|
|
9814
|
-
});
|
|
9815
|
-
}
|
|
9816
|
-
};
|
|
9817
|
-
UnsupportedBigIntError = class UnsupportedBigIntError extends BaseError {
|
|
9818
|
-
constructor() {
|
|
9819
|
-
super("BigInt values are not supported in CBOR encoding.");
|
|
9820
|
-
Object.defineProperty(this, "name", {
|
|
9821
|
-
enumerable: true,
|
|
9822
|
-
configurable: true,
|
|
9823
|
-
writable: true,
|
|
9824
|
-
value: "Cbor.UnsupportedBigIntError"
|
|
9825
|
-
});
|
|
9826
|
-
}
|
|
9827
|
-
};
|
|
9828
|
-
UnexpectedTokenError = class UnexpectedTokenError extends BaseError {
|
|
9829
|
-
constructor({ token }) {
|
|
9830
|
-
super(`Unexpected token: ${token}`);
|
|
9831
|
-
Object.defineProperty(this, "name", {
|
|
9832
|
-
enumerable: true,
|
|
9833
|
-
configurable: true,
|
|
9834
|
-
writable: true,
|
|
9835
|
-
value: "Cbor.UnexpectedTokenError"
|
|
9836
|
-
});
|
|
9837
|
-
}
|
|
9838
|
-
};
|
|
9839
|
-
NumberTooLargeError = class NumberTooLargeError extends BaseError {
|
|
9840
|
-
constructor({ number }) {
|
|
9841
|
-
super(`Number exceeds maximum safe integer (${Number.MAX_SAFE_INTEGER}): ${number}`);
|
|
9842
|
-
Object.defineProperty(this, "name", {
|
|
9843
|
-
enumerable: true,
|
|
9844
|
-
configurable: true,
|
|
9845
|
-
writable: true,
|
|
9846
|
-
value: "Cbor.NumberTooLargeError"
|
|
9847
|
-
});
|
|
9848
|
-
}
|
|
9849
|
-
};
|
|
9850
|
-
StringTooLargeError = class StringTooLargeError extends BaseError {
|
|
9851
|
-
constructor({ size: size3 }) {
|
|
9852
|
-
super(`String length exceeds maximum (4294967295): ${size3}`);
|
|
9853
|
-
Object.defineProperty(this, "name", {
|
|
9854
|
-
enumerable: true,
|
|
9855
|
-
configurable: true,
|
|
9856
|
-
writable: true,
|
|
9857
|
-
value: "Cbor.StringTooLargeError"
|
|
9858
|
-
});
|
|
9859
|
-
}
|
|
9860
|
-
};
|
|
9861
|
-
ArrayTooLargeError = class ArrayTooLargeError extends BaseError {
|
|
9862
|
-
constructor({ size: size3 }) {
|
|
9863
|
-
super(`Array length exceeds maximum (4294967295): ${size3}`);
|
|
9864
|
-
Object.defineProperty(this, "name", {
|
|
9865
|
-
enumerable: true,
|
|
9866
|
-
configurable: true,
|
|
9867
|
-
writable: true,
|
|
9868
|
-
value: "Cbor.ArrayTooLargeError"
|
|
9869
|
-
});
|
|
9870
|
-
}
|
|
9871
|
-
};
|
|
9872
|
-
ObjectTooLargeError = class ObjectTooLargeError extends BaseError {
|
|
9873
|
-
constructor({ size: size3 }) {
|
|
9874
|
-
super(`Object size exceeds maximum (4294967295): ${size3}`);
|
|
9875
|
-
Object.defineProperty(this, "name", {
|
|
9876
|
-
enumerable: true,
|
|
9877
|
-
configurable: true,
|
|
9878
|
-
writable: true,
|
|
9879
|
-
value: "Cbor.ObjectTooLargeError"
|
|
9880
|
-
});
|
|
9881
|
-
}
|
|
9882
|
-
};
|
|
9883
|
-
ByteStringTooLargeError = class ByteStringTooLargeError extends BaseError {
|
|
9884
|
-
constructor({ size: size3 }) {
|
|
9885
|
-
super(`Byte string length exceeds maximum (4294967295): ${size3}`);
|
|
9886
|
-
Object.defineProperty(this, "name", {
|
|
9887
|
-
enumerable: true,
|
|
9888
|
-
configurable: true,
|
|
9889
|
-
writable: true,
|
|
9890
|
-
value: "Cbor.ByteStringTooLargeError"
|
|
9891
|
-
});
|
|
9892
|
-
}
|
|
9893
|
-
};
|
|
9894
|
-
(function(getEncodable2) {
|
|
9895
|
-
function number(value) {
|
|
9896
|
-
if (!Number.isSafeInteger(value)) {
|
|
9897
|
-
const float32 = Math.fround(value);
|
|
9898
|
-
if (Number.isNaN(value) || value === float32)
|
|
9899
|
-
return {
|
|
9900
|
-
length: 5,
|
|
9901
|
-
encode(cursor) {
|
|
9902
|
-
cursor.pushUint8(250);
|
|
9903
|
-
cursor.dataView.setFloat32(cursor.position, value, false);
|
|
9904
|
-
cursor.position += 4;
|
|
9905
|
-
}
|
|
9906
|
-
};
|
|
9907
|
-
return {
|
|
9908
|
-
length: 9,
|
|
9909
|
-
encode(cursor) {
|
|
9910
|
-
cursor.pushUint8(251);
|
|
9911
|
-
cursor.dataView.setFloat64(cursor.position, value, false);
|
|
9912
|
-
cursor.position += 8;
|
|
9913
|
-
}
|
|
9914
|
-
};
|
|
9915
|
-
}
|
|
9916
|
-
if (value >= 0) {
|
|
9917
|
-
if (value <= 23)
|
|
9918
|
-
return { length: 1, encode: (cursor) => cursor.pushUint8(value) };
|
|
9919
|
-
if (value <= 255)
|
|
9920
|
-
return {
|
|
9921
|
-
length: 2,
|
|
9922
|
-
encode: (cursor) => {
|
|
9923
|
-
cursor.pushUint8(24);
|
|
9924
|
-
cursor.pushUint8(value);
|
|
9925
|
-
}
|
|
9926
|
-
};
|
|
9927
|
-
if (value <= 65535)
|
|
9928
|
-
return {
|
|
9929
|
-
length: 3,
|
|
9930
|
-
encode: (cursor) => {
|
|
9931
|
-
cursor.pushUint8(25);
|
|
9932
|
-
cursor.pushUint16(value);
|
|
9933
|
-
}
|
|
9934
|
-
};
|
|
9935
|
-
if (value <= 4294967295)
|
|
9936
|
-
return {
|
|
9937
|
-
length: 5,
|
|
9938
|
-
encode: (cursor) => {
|
|
9939
|
-
cursor.pushUint8(26);
|
|
9940
|
-
cursor.pushUint32(value);
|
|
9941
|
-
}
|
|
9942
|
-
};
|
|
9943
|
-
throw new NumberTooLargeError({ number: value.toString(10) });
|
|
9944
|
-
}
|
|
9945
|
-
const positiveNumber = -1 - value;
|
|
9946
|
-
if (value >= -24)
|
|
9947
|
-
return {
|
|
9948
|
-
length: 1,
|
|
9949
|
-
encode: (cursor) => cursor.pushUint8(32 + positiveNumber)
|
|
9950
|
-
};
|
|
9951
|
-
if (positiveNumber <= 255)
|
|
9952
|
-
return {
|
|
9953
|
-
length: 2,
|
|
9954
|
-
encode: (cursor) => {
|
|
9955
|
-
cursor.pushUint8(56);
|
|
9956
|
-
cursor.pushUint8(positiveNumber);
|
|
9957
|
-
}
|
|
9958
|
-
};
|
|
9959
|
-
if (positiveNumber <= 65535)
|
|
9960
|
-
return {
|
|
9961
|
-
length: 3,
|
|
9962
|
-
encode: (cursor) => {
|
|
9963
|
-
cursor.pushUint8(57);
|
|
9964
|
-
cursor.pushUint16(positiveNumber);
|
|
9965
|
-
}
|
|
9966
|
-
};
|
|
9967
|
-
if (positiveNumber <= 4294967295)
|
|
9968
|
-
return {
|
|
9969
|
-
length: 5,
|
|
9970
|
-
encode: (cursor) => {
|
|
9971
|
-
cursor.pushUint8(58);
|
|
9972
|
-
cursor.pushUint32(positiveNumber);
|
|
9973
|
-
}
|
|
9974
|
-
};
|
|
9975
|
-
throw new NumberTooLargeError({ number: value.toString(10) });
|
|
9976
|
-
}
|
|
9977
|
-
getEncodable2.number = number;
|
|
9978
|
-
function string(value) {
|
|
9979
|
-
const encoded = fromString2(value);
|
|
9980
|
-
const size3 = encoded.length;
|
|
9981
|
-
if (size3 <= 23)
|
|
9982
|
-
return {
|
|
9983
|
-
length: 1 + size3,
|
|
9984
|
-
encode(cursor) {
|
|
9985
|
-
cursor.pushUint8(96 + size3);
|
|
9986
|
-
if (size3 > 0)
|
|
9987
|
-
cursor.pushBytes(encoded);
|
|
9988
|
-
}
|
|
9989
|
-
};
|
|
9990
|
-
if (size3 <= 255)
|
|
9991
|
-
return {
|
|
9992
|
-
length: 2 + size3,
|
|
9993
|
-
encode(cursor) {
|
|
9994
|
-
cursor.pushUint8(120);
|
|
9995
|
-
cursor.pushUint8(size3);
|
|
9996
|
-
cursor.pushBytes(encoded);
|
|
9997
|
-
}
|
|
9998
|
-
};
|
|
9999
|
-
if (size3 <= 65535)
|
|
10000
|
-
return {
|
|
10001
|
-
length: 3 + size3,
|
|
10002
|
-
encode(cursor) {
|
|
10003
|
-
cursor.pushUint8(121);
|
|
10004
|
-
cursor.pushUint16(size3);
|
|
10005
|
-
cursor.pushBytes(encoded);
|
|
10006
|
-
}
|
|
10007
|
-
};
|
|
10008
|
-
if (size3 <= 4294967295)
|
|
10009
|
-
return {
|
|
10010
|
-
length: 5 + size3,
|
|
10011
|
-
encode(cursor) {
|
|
10012
|
-
cursor.pushUint8(122);
|
|
10013
|
-
cursor.pushUint32(size3);
|
|
10014
|
-
cursor.pushBytes(encoded);
|
|
10015
|
-
}
|
|
10016
|
-
};
|
|
10017
|
-
throw new StringTooLargeError({ size: size3 });
|
|
10018
|
-
}
|
|
10019
|
-
getEncodable2.string = string;
|
|
10020
|
-
function array(value) {
|
|
10021
|
-
const items = value.map((item) => getEncodable2(item));
|
|
10022
|
-
const bodyLength = items.reduce((acc, item) => acc + item.length, 0);
|
|
10023
|
-
const size3 = value.length;
|
|
10024
|
-
if (size3 <= 23)
|
|
10025
|
-
return {
|
|
10026
|
-
length: 1 + bodyLength,
|
|
10027
|
-
encode(cursor) {
|
|
10028
|
-
cursor.pushUint8(128 + size3);
|
|
10029
|
-
for (const item of items)
|
|
10030
|
-
item.encode(cursor);
|
|
10031
|
-
}
|
|
10032
|
-
};
|
|
10033
|
-
if (size3 <= 255)
|
|
10034
|
-
return {
|
|
10035
|
-
length: 2 + bodyLength,
|
|
10036
|
-
encode(cursor) {
|
|
10037
|
-
cursor.pushUint8(152);
|
|
10038
|
-
cursor.pushUint8(size3);
|
|
10039
|
-
for (const item of items)
|
|
10040
|
-
item.encode(cursor);
|
|
10041
|
-
}
|
|
10042
|
-
};
|
|
10043
|
-
if (size3 <= 65535)
|
|
10044
|
-
return {
|
|
10045
|
-
length: 3 + bodyLength,
|
|
10046
|
-
encode(cursor) {
|
|
10047
|
-
cursor.pushUint8(153);
|
|
10048
|
-
cursor.pushUint16(size3);
|
|
10049
|
-
for (const item of items)
|
|
10050
|
-
item.encode(cursor);
|
|
10051
|
-
}
|
|
10052
|
-
};
|
|
10053
|
-
if (size3 <= 4294967295)
|
|
10054
|
-
return {
|
|
10055
|
-
length: 5 + bodyLength,
|
|
10056
|
-
encode(cursor) {
|
|
10057
|
-
cursor.pushUint8(154);
|
|
10058
|
-
cursor.pushUint32(size3);
|
|
10059
|
-
for (const item of items)
|
|
10060
|
-
item.encode(cursor);
|
|
10061
|
-
}
|
|
10062
|
-
};
|
|
10063
|
-
throw new ArrayTooLargeError({ size: size3 });
|
|
10064
|
-
}
|
|
10065
|
-
getEncodable2.array = array;
|
|
10066
|
-
function byteString(value) {
|
|
10067
|
-
const size3 = value.byteLength;
|
|
10068
|
-
if (size3 <= 23)
|
|
10069
|
-
return {
|
|
10070
|
-
length: 1 + size3,
|
|
10071
|
-
encode(cursor) {
|
|
10072
|
-
cursor.pushUint8(64 + size3);
|
|
10073
|
-
cursor.pushBytes(value);
|
|
10074
|
-
}
|
|
10075
|
-
};
|
|
10076
|
-
if (size3 <= 255)
|
|
10077
|
-
return {
|
|
10078
|
-
length: 2 + size3,
|
|
10079
|
-
encode(cursor) {
|
|
10080
|
-
cursor.pushUint8(88);
|
|
10081
|
-
cursor.pushUint8(size3);
|
|
10082
|
-
cursor.pushBytes(value);
|
|
10083
|
-
}
|
|
10084
|
-
};
|
|
10085
|
-
if (size3 <= 65535)
|
|
10086
|
-
return {
|
|
10087
|
-
length: 3 + size3,
|
|
10088
|
-
encode(cursor) {
|
|
10089
|
-
cursor.pushUint8(89);
|
|
10090
|
-
cursor.pushUint16(size3);
|
|
10091
|
-
cursor.pushBytes(value);
|
|
10092
|
-
}
|
|
10093
|
-
};
|
|
10094
|
-
if (size3 <= 4294967295)
|
|
10095
|
-
return {
|
|
10096
|
-
length: 5 + size3,
|
|
10097
|
-
encode(cursor) {
|
|
10098
|
-
cursor.pushUint8(90);
|
|
10099
|
-
cursor.pushUint32(size3);
|
|
10100
|
-
cursor.pushBytes(value);
|
|
10101
|
-
}
|
|
10102
|
-
};
|
|
10103
|
-
throw new ByteStringTooLargeError({ size: size3 });
|
|
10104
|
-
}
|
|
10105
|
-
getEncodable2.byteString = byteString;
|
|
10106
|
-
function object(value) {
|
|
10107
|
-
const keys2 = Object.keys(value);
|
|
10108
|
-
const entries = keys2.map((key) => ({
|
|
10109
|
-
key: getEncodable2(key),
|
|
10110
|
-
value: getEncodable2(value[key])
|
|
10111
|
-
}));
|
|
10112
|
-
const bodyLength = entries.reduce((acc, entry) => acc + entry.key.length + entry.value.length, 0);
|
|
10113
|
-
const size3 = keys2.length;
|
|
10114
|
-
if (size3 <= 23)
|
|
10115
|
-
return {
|
|
10116
|
-
length: 1 + bodyLength,
|
|
10117
|
-
encode(cursor) {
|
|
10118
|
-
cursor.pushUint8(160 + size3);
|
|
10119
|
-
for (const entry of entries) {
|
|
10120
|
-
entry.key.encode(cursor);
|
|
10121
|
-
entry.value.encode(cursor);
|
|
10122
|
-
}
|
|
10123
|
-
}
|
|
10124
|
-
};
|
|
10125
|
-
if (size3 <= 255)
|
|
10126
|
-
return {
|
|
10127
|
-
length: 2 + bodyLength,
|
|
10128
|
-
encode(cursor) {
|
|
10129
|
-
cursor.pushUint8(184);
|
|
10130
|
-
cursor.pushUint8(size3);
|
|
10131
|
-
for (const entry of entries) {
|
|
10132
|
-
entry.key.encode(cursor);
|
|
10133
|
-
entry.value.encode(cursor);
|
|
10134
|
-
}
|
|
10135
|
-
}
|
|
10136
|
-
};
|
|
10137
|
-
if (size3 <= 65535)
|
|
10138
|
-
return {
|
|
10139
|
-
length: 3 + bodyLength,
|
|
10140
|
-
encode(cursor) {
|
|
10141
|
-
cursor.pushUint8(185);
|
|
10142
|
-
cursor.pushUint16(size3);
|
|
10143
|
-
for (const entry of entries) {
|
|
10144
|
-
entry.key.encode(cursor);
|
|
10145
|
-
entry.value.encode(cursor);
|
|
10146
|
-
}
|
|
10147
|
-
}
|
|
10148
|
-
};
|
|
10149
|
-
if (size3 <= 4294967295)
|
|
10150
|
-
return {
|
|
10151
|
-
length: 5 + bodyLength,
|
|
10152
|
-
encode(cursor) {
|
|
10153
|
-
cursor.pushUint8(186);
|
|
10154
|
-
cursor.pushUint32(size3);
|
|
10155
|
-
for (const entry of entries) {
|
|
10156
|
-
entry.key.encode(cursor);
|
|
10157
|
-
entry.value.encode(cursor);
|
|
10158
|
-
}
|
|
10159
|
-
}
|
|
10160
|
-
};
|
|
10161
|
-
throw new ObjectTooLargeError({ size: size3 });
|
|
10162
|
-
}
|
|
10163
|
-
getEncodable2.object = object;
|
|
10164
|
-
function map(value) {
|
|
10165
|
-
const entries = [];
|
|
10166
|
-
for (const [k, v] of value)
|
|
10167
|
-
entries.push({ key: getEncodable2(k), value: getEncodable2(v) });
|
|
10168
|
-
const bodyLength = entries.reduce((acc, entry) => acc + entry.key.length + entry.value.length, 0);
|
|
10169
|
-
const size3 = value.size;
|
|
10170
|
-
if (size3 <= 23)
|
|
10171
|
-
return {
|
|
10172
|
-
length: 1 + bodyLength,
|
|
10173
|
-
encode(cursor) {
|
|
10174
|
-
cursor.pushUint8(160 + size3);
|
|
10175
|
-
for (const entry of entries) {
|
|
10176
|
-
entry.key.encode(cursor);
|
|
10177
|
-
entry.value.encode(cursor);
|
|
10178
|
-
}
|
|
10179
|
-
}
|
|
10180
|
-
};
|
|
10181
|
-
if (size3 <= 255)
|
|
10182
|
-
return {
|
|
10183
|
-
length: 2 + bodyLength,
|
|
10184
|
-
encode(cursor) {
|
|
10185
|
-
cursor.pushUint8(184);
|
|
10186
|
-
cursor.pushUint8(size3);
|
|
10187
|
-
for (const entry of entries) {
|
|
10188
|
-
entry.key.encode(cursor);
|
|
10189
|
-
entry.value.encode(cursor);
|
|
10190
|
-
}
|
|
10191
|
-
}
|
|
10192
|
-
};
|
|
10193
|
-
if (size3 <= 65535)
|
|
10194
|
-
return {
|
|
10195
|
-
length: 3 + bodyLength,
|
|
10196
|
-
encode(cursor) {
|
|
10197
|
-
cursor.pushUint8(185);
|
|
10198
|
-
cursor.pushUint16(size3);
|
|
10199
|
-
for (const entry of entries) {
|
|
10200
|
-
entry.key.encode(cursor);
|
|
10201
|
-
entry.value.encode(cursor);
|
|
10202
|
-
}
|
|
10203
|
-
}
|
|
10204
|
-
};
|
|
10205
|
-
if (size3 <= 4294967295)
|
|
10206
|
-
return {
|
|
10207
|
-
length: 5 + bodyLength,
|
|
10208
|
-
encode(cursor) {
|
|
10209
|
-
cursor.pushUint8(186);
|
|
10210
|
-
cursor.pushUint32(size3);
|
|
10211
|
-
for (const entry of entries) {
|
|
10212
|
-
entry.key.encode(cursor);
|
|
10213
|
-
entry.value.encode(cursor);
|
|
10214
|
-
}
|
|
10215
|
-
}
|
|
10216
|
-
};
|
|
10217
|
-
throw new ObjectTooLargeError({ size: size3 });
|
|
10218
|
-
}
|
|
10219
|
-
getEncodable2.map = map;
|
|
10220
|
-
})(getEncodable || (getEncodable = {}));
|
|
10221
|
-
(function(decodeCursor2) {
|
|
10222
|
-
function readLength(cursor, additionalInfo) {
|
|
10223
|
-
if (additionalInfo < 24)
|
|
10224
|
-
return additionalInfo;
|
|
10225
|
-
if (additionalInfo === 24)
|
|
10226
|
-
return cursor.readUint8();
|
|
10227
|
-
if (additionalInfo === 25)
|
|
10228
|
-
return cursor.readUint16();
|
|
10229
|
-
if (additionalInfo === 26)
|
|
10230
|
-
return cursor.readUint32();
|
|
10231
|
-
if (additionalInfo === 27)
|
|
10232
|
-
throw new Unsupported64BitIntegerError;
|
|
10233
|
-
throw new InvalidAdditionalInfoError({ additionalInfo });
|
|
10234
|
-
}
|
|
10235
|
-
function readUnsignedInteger(cursor, additionalInfo) {
|
|
10236
|
-
return readLength(cursor, additionalInfo);
|
|
10237
|
-
}
|
|
10238
|
-
decodeCursor2.readUnsignedInteger = readUnsignedInteger;
|
|
10239
|
-
function readNegativeInteger(cursor, additionalInfo) {
|
|
10240
|
-
const value = readLength(cursor, additionalInfo);
|
|
10241
|
-
return -1 - value;
|
|
10242
|
-
}
|
|
10243
|
-
decodeCursor2.readNegativeInteger = readNegativeInteger;
|
|
10244
|
-
function readByteString(cursor, additionalInfo) {
|
|
10245
|
-
if (additionalInfo === 31) {
|
|
10246
|
-
const chunks = [];
|
|
10247
|
-
let totalLength = 0;
|
|
10248
|
-
while (true) {
|
|
10249
|
-
const byte = cursor.inspectUint8();
|
|
10250
|
-
if (byte === 255) {
|
|
10251
|
-
cursor.readUint8();
|
|
10252
|
-
break;
|
|
10253
|
-
}
|
|
10254
|
-
const chunk = decodeCursor2(cursor);
|
|
10255
|
-
if (!(chunk instanceof Uint8Array))
|
|
10256
|
-
throw new InvalidIndefiniteLengthChunkError({ type: "byte string" });
|
|
10257
|
-
chunks.push(chunk);
|
|
10258
|
-
totalLength += chunk.length;
|
|
10259
|
-
}
|
|
10260
|
-
const result = new Uint8Array(totalLength);
|
|
10261
|
-
let offset = 0;
|
|
10262
|
-
for (const chunk of chunks) {
|
|
10263
|
-
result.set(chunk, offset);
|
|
10264
|
-
offset += chunk.length;
|
|
10265
|
-
}
|
|
10266
|
-
return result;
|
|
10267
|
-
}
|
|
10268
|
-
const length = readLength(cursor, additionalInfo);
|
|
10269
|
-
return cursor.readBytes(length);
|
|
10270
|
-
}
|
|
10271
|
-
decodeCursor2.readByteString = readByteString;
|
|
10272
|
-
function readTextString(cursor, additionalInfo) {
|
|
10273
|
-
if (additionalInfo === 31) {
|
|
10274
|
-
const chunks = [];
|
|
10275
|
-
while (true) {
|
|
10276
|
-
const byte = cursor.inspectUint8();
|
|
10277
|
-
if (byte === 255) {
|
|
10278
|
-
cursor.readUint8();
|
|
10279
|
-
break;
|
|
10280
|
-
}
|
|
10281
|
-
const chunk = decodeCursor2(cursor);
|
|
10282
|
-
if (typeof chunk !== "string")
|
|
10283
|
-
throw new InvalidIndefiniteLengthChunkError({ type: "text string" });
|
|
10284
|
-
chunks.push(chunk);
|
|
10285
|
-
}
|
|
10286
|
-
return chunks.join("");
|
|
10287
|
-
}
|
|
10288
|
-
const length = readLength(cursor, additionalInfo);
|
|
10289
|
-
const bytes = cursor.readBytes(length);
|
|
10290
|
-
return toString(bytes);
|
|
10291
|
-
}
|
|
10292
|
-
decodeCursor2.readTextString = readTextString;
|
|
10293
|
-
function readArray(cursor, additionalInfo) {
|
|
10294
|
-
if (additionalInfo === 31) {
|
|
10295
|
-
const result2 = [];
|
|
10296
|
-
while (true) {
|
|
10297
|
-
const byte = cursor.inspectUint8();
|
|
10298
|
-
if (byte === 255) {
|
|
10299
|
-
cursor.readUint8();
|
|
10300
|
-
break;
|
|
10301
|
-
}
|
|
10302
|
-
result2.push(decodeCursor2(cursor));
|
|
10303
|
-
}
|
|
10304
|
-
return result2;
|
|
10305
|
-
}
|
|
10306
|
-
const length = readLength(cursor, additionalInfo);
|
|
10307
|
-
const result = [];
|
|
10308
|
-
for (let i = 0;i < length; i++) {
|
|
10309
|
-
result.push(decodeCursor2(cursor));
|
|
10310
|
-
}
|
|
10311
|
-
return result;
|
|
10312
|
-
}
|
|
10313
|
-
decodeCursor2.readArray = readArray;
|
|
10314
|
-
function readMap(cursor, additionalInfo) {
|
|
10315
|
-
if (additionalInfo === 31) {
|
|
10316
|
-
const result2 = {};
|
|
10317
|
-
while (true) {
|
|
10318
|
-
const byte = cursor.inspectUint8();
|
|
10319
|
-
if (byte === 255) {
|
|
10320
|
-
cursor.readUint8();
|
|
10321
|
-
break;
|
|
10322
|
-
}
|
|
10323
|
-
const key = decodeCursor2(cursor);
|
|
10324
|
-
const keyStr = typeof key === "string" ? key : typeof key === "number" ? String(key) : String(key);
|
|
10325
|
-
const value = decodeCursor2(cursor);
|
|
10326
|
-
result2[keyStr] = value;
|
|
10327
|
-
}
|
|
10328
|
-
return result2;
|
|
10329
|
-
}
|
|
10330
|
-
const length = readLength(cursor, additionalInfo);
|
|
10331
|
-
const result = {};
|
|
10332
|
-
for (let i = 0;i < length; i++) {
|
|
10333
|
-
const key = decodeCursor2(cursor);
|
|
10334
|
-
const keyStr = typeof key === "string" ? key : typeof key === "number" ? String(key) : String(key);
|
|
10335
|
-
const value = decodeCursor2(cursor);
|
|
10336
|
-
result[keyStr] = value;
|
|
10337
|
-
}
|
|
10338
|
-
return result;
|
|
10339
|
-
}
|
|
10340
|
-
decodeCursor2.readMap = readMap;
|
|
10341
|
-
function readSimpleOrFloat(cursor, additionalInfo) {
|
|
10342
|
-
if (additionalInfo === 20)
|
|
10343
|
-
return false;
|
|
10344
|
-
if (additionalInfo === 21)
|
|
10345
|
-
return true;
|
|
10346
|
-
if (additionalInfo === 22)
|
|
10347
|
-
return null;
|
|
10348
|
-
if (additionalInfo === 23)
|
|
10349
|
-
return;
|
|
10350
|
-
if (additionalInfo === 25) {
|
|
10351
|
-
const bits = cursor.readUint16();
|
|
10352
|
-
return getFloat16(bits);
|
|
10353
|
-
}
|
|
10354
|
-
if (additionalInfo === 26) {
|
|
10355
|
-
const value = cursor.dataView.getFloat32(cursor.position, false);
|
|
10356
|
-
cursor.position += 4;
|
|
10357
|
-
return value;
|
|
10358
|
-
}
|
|
10359
|
-
if (additionalInfo === 27) {
|
|
10360
|
-
const value = cursor.dataView.getFloat64(cursor.position, false);
|
|
10361
|
-
cursor.position += 8;
|
|
10362
|
-
return value;
|
|
10363
|
-
}
|
|
10364
|
-
if (additionalInfo === 24) {
|
|
10365
|
-
const simpleValue = cursor.readUint8();
|
|
10366
|
-
if (simpleValue < 32)
|
|
10367
|
-
throw new InvalidSimpleValueError({ value: simpleValue });
|
|
10368
|
-
return;
|
|
10369
|
-
}
|
|
10370
|
-
throw new InvalidAdditionalInfoError({ additionalInfo });
|
|
10371
|
-
}
|
|
10372
|
-
decodeCursor2.readSimpleOrFloat = readSimpleOrFloat;
|
|
10373
|
-
function getFloat16(bits) {
|
|
10374
|
-
const sign = bits >> 15 & 1;
|
|
10375
|
-
const exponent = bits >> 10 & 31;
|
|
10376
|
-
const fraction = bits & 1023;
|
|
10377
|
-
if (exponent === 0) {
|
|
10378
|
-
if (fraction === 0)
|
|
10379
|
-
return sign ? -0 : 0;
|
|
10380
|
-
const value2 = 2 ** -14 * (fraction / 1024);
|
|
10381
|
-
return sign ? -value2 : value2;
|
|
10382
|
-
}
|
|
10383
|
-
if (exponent === 31) {
|
|
10384
|
-
if (fraction === 0)
|
|
10385
|
-
return sign ? -Infinity : Infinity;
|
|
10386
|
-
return NaN;
|
|
10387
|
-
}
|
|
10388
|
-
const value = 2 ** (exponent - 15) * (1 + fraction / 1024);
|
|
10389
|
-
return sign ? -value : value;
|
|
10390
|
-
}
|
|
10391
|
-
})(decodeCursor || (decodeCursor = {}));
|
|
8457
|
+
[95]: 63
|
|
8458
|
+
};
|
|
10392
8459
|
});
|
|
10393
8460
|
|
|
10394
|
-
// node_modules/
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
8461
|
+
// node_modules/@noble/hashes/esm/utils.js
|
|
8462
|
+
function isBytes(a) {
|
|
8463
|
+
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
8464
|
+
}
|
|
8465
|
+
function anumber(n) {
|
|
8466
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
8467
|
+
throw new Error("positive integer expected, got " + n);
|
|
8468
|
+
}
|
|
8469
|
+
function abytes(b, ...lengths) {
|
|
8470
|
+
if (!isBytes(b))
|
|
8471
|
+
throw new Error("Uint8Array expected");
|
|
8472
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
8473
|
+
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
8474
|
+
}
|
|
8475
|
+
function ahash(h) {
|
|
8476
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
|
8477
|
+
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
8478
|
+
anumber(h.outputLen);
|
|
8479
|
+
anumber(h.blockLen);
|
|
8480
|
+
}
|
|
8481
|
+
function aexists(instance, checkFinished = true) {
|
|
8482
|
+
if (instance.destroyed)
|
|
8483
|
+
throw new Error("Hash instance has been destroyed");
|
|
8484
|
+
if (checkFinished && instance.finished)
|
|
8485
|
+
throw new Error("Hash#digest() has already been called");
|
|
8486
|
+
}
|
|
8487
|
+
function aoutput(out, instance) {
|
|
8488
|
+
abytes(out);
|
|
8489
|
+
const min = instance.outputLen;
|
|
8490
|
+
if (out.length < min) {
|
|
8491
|
+
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
8492
|
+
}
|
|
8493
|
+
}
|
|
8494
|
+
function u32(arr) {
|
|
8495
|
+
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
8496
|
+
}
|
|
8497
|
+
function clean(...arrays) {
|
|
8498
|
+
for (let i = 0;i < arrays.length; i++) {
|
|
8499
|
+
arrays[i].fill(0);
|
|
8500
|
+
}
|
|
8501
|
+
}
|
|
8502
|
+
function createView(arr) {
|
|
8503
|
+
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
8504
|
+
}
|
|
8505
|
+
function rotr(word, shift) {
|
|
8506
|
+
return word << 32 - shift | word >>> shift;
|
|
8507
|
+
}
|
|
8508
|
+
function rotl(word, shift) {
|
|
8509
|
+
return word << shift | word >>> 32 - shift >>> 0;
|
|
8510
|
+
}
|
|
8511
|
+
function byteSwap(word) {
|
|
8512
|
+
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
8513
|
+
}
|
|
8514
|
+
function byteSwap32(arr) {
|
|
8515
|
+
for (let i = 0;i < arr.length; i++) {
|
|
8516
|
+
arr[i] = byteSwap(arr[i]);
|
|
8517
|
+
}
|
|
8518
|
+
return arr;
|
|
8519
|
+
}
|
|
8520
|
+
function utf8ToBytes(str) {
|
|
8521
|
+
if (typeof str !== "string")
|
|
8522
|
+
throw new Error("string expected");
|
|
8523
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
8524
|
+
}
|
|
8525
|
+
function toBytes2(data) {
|
|
8526
|
+
if (typeof data === "string")
|
|
8527
|
+
data = utf8ToBytes(data);
|
|
8528
|
+
abytes(data);
|
|
8529
|
+
return data;
|
|
8530
|
+
}
|
|
10417
8531
|
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
8532
|
+
class Hash {
|
|
8533
|
+
}
|
|
8534
|
+
function createHasher(hashCons) {
|
|
8535
|
+
const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
|
|
8536
|
+
const tmp = hashCons();
|
|
8537
|
+
hashC.outputLen = tmp.outputLen;
|
|
8538
|
+
hashC.blockLen = tmp.blockLen;
|
|
8539
|
+
hashC.create = () => hashCons();
|
|
8540
|
+
return hashC;
|
|
8541
|
+
}
|
|
8542
|
+
var isLE, swap32IfBE;
|
|
8543
|
+
var init_utils2 = __esm(() => {
|
|
8544
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
8545
|
+
isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
8546
|
+
swap32IfBE = isLE ? (u) => u : byteSwap32;
|
|
10421
8547
|
});
|
|
10422
8548
|
|
|
10423
|
-
// node_modules/
|
|
10424
|
-
var
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
// node_modules/eventemitter3/index.js
|
|
10451
|
-
var require_eventemitter3 = __commonJS((exports, module) => {
|
|
10452
|
-
var has = Object.prototype.hasOwnProperty;
|
|
10453
|
-
var prefix = "~";
|
|
10454
|
-
function Events() {}
|
|
10455
|
-
if (Object.create) {
|
|
10456
|
-
Events.prototype = Object.create(null);
|
|
10457
|
-
if (!new Events().__proto__)
|
|
10458
|
-
prefix = false;
|
|
10459
|
-
}
|
|
10460
|
-
function EE(fn, context, once) {
|
|
10461
|
-
this.fn = fn;
|
|
10462
|
-
this.context = context;
|
|
10463
|
-
this.once = once || false;
|
|
10464
|
-
}
|
|
10465
|
-
function addListener(emitter, event, fn, context, once) {
|
|
10466
|
-
if (typeof fn !== "function") {
|
|
10467
|
-
throw new TypeError("The listener must be a function");
|
|
8549
|
+
// node_modules/@noble/hashes/esm/hmac.js
|
|
8550
|
+
var HMAC, hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
|
|
8551
|
+
var init_hmac = __esm(() => {
|
|
8552
|
+
init_utils2();
|
|
8553
|
+
HMAC = class HMAC extends Hash {
|
|
8554
|
+
constructor(hash, _key) {
|
|
8555
|
+
super();
|
|
8556
|
+
this.finished = false;
|
|
8557
|
+
this.destroyed = false;
|
|
8558
|
+
ahash(hash);
|
|
8559
|
+
const key = toBytes2(_key);
|
|
8560
|
+
this.iHash = hash.create();
|
|
8561
|
+
if (typeof this.iHash.update !== "function")
|
|
8562
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
8563
|
+
this.blockLen = this.iHash.blockLen;
|
|
8564
|
+
this.outputLen = this.iHash.outputLen;
|
|
8565
|
+
const blockLen = this.blockLen;
|
|
8566
|
+
const pad4 = new Uint8Array(blockLen);
|
|
8567
|
+
pad4.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
|
8568
|
+
for (let i = 0;i < pad4.length; i++)
|
|
8569
|
+
pad4[i] ^= 54;
|
|
8570
|
+
this.iHash.update(pad4);
|
|
8571
|
+
this.oHash = hash.create();
|
|
8572
|
+
for (let i = 0;i < pad4.length; i++)
|
|
8573
|
+
pad4[i] ^= 54 ^ 92;
|
|
8574
|
+
this.oHash.update(pad4);
|
|
8575
|
+
clean(pad4);
|
|
10468
8576
|
}
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
emitter._events[evt].push(listener);
|
|
10474
|
-
else
|
|
10475
|
-
emitter._events[evt] = [emitter._events[evt], listener];
|
|
10476
|
-
return emitter;
|
|
10477
|
-
}
|
|
10478
|
-
function clearEvent(emitter, evt) {
|
|
10479
|
-
if (--emitter._eventsCount === 0)
|
|
10480
|
-
emitter._events = new Events;
|
|
10481
|
-
else
|
|
10482
|
-
delete emitter._events[evt];
|
|
10483
|
-
}
|
|
10484
|
-
function EventEmitter() {
|
|
10485
|
-
this._events = new Events;
|
|
10486
|
-
this._eventsCount = 0;
|
|
10487
|
-
}
|
|
10488
|
-
EventEmitter.prototype.eventNames = function eventNames() {
|
|
10489
|
-
var names = [], events, name;
|
|
10490
|
-
if (this._eventsCount === 0)
|
|
10491
|
-
return names;
|
|
10492
|
-
for (name in events = this._events) {
|
|
10493
|
-
if (has.call(events, name))
|
|
10494
|
-
names.push(prefix ? name.slice(1) : name);
|
|
8577
|
+
update(buf) {
|
|
8578
|
+
aexists(this);
|
|
8579
|
+
this.iHash.update(buf);
|
|
8580
|
+
return this;
|
|
10495
8581
|
}
|
|
10496
|
-
|
|
10497
|
-
|
|
8582
|
+
digestInto(out) {
|
|
8583
|
+
aexists(this);
|
|
8584
|
+
abytes(out, this.outputLen);
|
|
8585
|
+
this.finished = true;
|
|
8586
|
+
this.iHash.digestInto(out);
|
|
8587
|
+
this.oHash.update(out);
|
|
8588
|
+
this.oHash.digestInto(out);
|
|
8589
|
+
this.destroy();
|
|
10498
8590
|
}
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
8591
|
+
digest() {
|
|
8592
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
|
8593
|
+
this.digestInto(out);
|
|
8594
|
+
return out;
|
|
8595
|
+
}
|
|
8596
|
+
_cloneInto(to) {
|
|
8597
|
+
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
8598
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
8599
|
+
to = to;
|
|
8600
|
+
to.finished = finished;
|
|
8601
|
+
to.destroyed = destroyed;
|
|
8602
|
+
to.blockLen = blockLen;
|
|
8603
|
+
to.outputLen = outputLen;
|
|
8604
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
|
8605
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
|
8606
|
+
return to;
|
|
8607
|
+
}
|
|
8608
|
+
clone() {
|
|
8609
|
+
return this._cloneInto();
|
|
8610
|
+
}
|
|
8611
|
+
destroy() {
|
|
8612
|
+
this.destroyed = true;
|
|
8613
|
+
this.oHash.destroy();
|
|
8614
|
+
this.iHash.destroy();
|
|
10509
8615
|
}
|
|
10510
|
-
return ee;
|
|
10511
|
-
};
|
|
10512
|
-
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
10513
|
-
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
10514
|
-
if (!listeners)
|
|
10515
|
-
return 0;
|
|
10516
|
-
if (listeners.fn)
|
|
10517
|
-
return 1;
|
|
10518
|
-
return listeners.length;
|
|
10519
8616
|
};
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
8617
|
+
hmac.create = (hash, key) => new HMAC(hash, key);
|
|
8618
|
+
});
|
|
8619
|
+
|
|
8620
|
+
// node_modules/@noble/hashes/esm/_md.js
|
|
8621
|
+
function setBigUint64(view, byteOffset, value, isLE2) {
|
|
8622
|
+
if (typeof view.setBigUint64 === "function")
|
|
8623
|
+
return view.setBigUint64(byteOffset, value, isLE2);
|
|
8624
|
+
const _32n = BigInt(32);
|
|
8625
|
+
const _u32_max = BigInt(4294967295);
|
|
8626
|
+
const wh = Number(value >> _32n & _u32_max);
|
|
8627
|
+
const wl = Number(value & _u32_max);
|
|
8628
|
+
const h = isLE2 ? 4 : 0;
|
|
8629
|
+
const l = isLE2 ? 0 : 4;
|
|
8630
|
+
view.setUint32(byteOffset + h, wh, isLE2);
|
|
8631
|
+
view.setUint32(byteOffset + l, wl, isLE2);
|
|
8632
|
+
}
|
|
8633
|
+
function Chi(a, b, c) {
|
|
8634
|
+
return a & b ^ ~a & c;
|
|
8635
|
+
}
|
|
8636
|
+
function Maj(a, b, c) {
|
|
8637
|
+
return a & b ^ a & c ^ b & c;
|
|
8638
|
+
}
|
|
8639
|
+
var HashMD, SHA256_IV;
|
|
8640
|
+
var init__md = __esm(() => {
|
|
8641
|
+
init_utils2();
|
|
8642
|
+
HashMD = class HashMD extends Hash {
|
|
8643
|
+
constructor(blockLen, outputLen, padOffset, isLE2) {
|
|
8644
|
+
super();
|
|
8645
|
+
this.finished = false;
|
|
8646
|
+
this.length = 0;
|
|
8647
|
+
this.pos = 0;
|
|
8648
|
+
this.destroyed = false;
|
|
8649
|
+
this.blockLen = blockLen;
|
|
8650
|
+
this.outputLen = outputLen;
|
|
8651
|
+
this.padOffset = padOffset;
|
|
8652
|
+
this.isLE = isLE2;
|
|
8653
|
+
this.buffer = new Uint8Array(blockLen);
|
|
8654
|
+
this.view = createView(this.buffer);
|
|
8655
|
+
}
|
|
8656
|
+
update(data) {
|
|
8657
|
+
aexists(this);
|
|
8658
|
+
data = toBytes2(data);
|
|
8659
|
+
abytes(data);
|
|
8660
|
+
const { view, buffer, blockLen } = this;
|
|
8661
|
+
const len = data.length;
|
|
8662
|
+
for (let pos = 0;pos < len; ) {
|
|
8663
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
8664
|
+
if (take === blockLen) {
|
|
8665
|
+
const dataView = createView(data);
|
|
8666
|
+
for (;blockLen <= len - pos; pos += blockLen)
|
|
8667
|
+
this.process(dataView, pos);
|
|
8668
|
+
continue;
|
|
10570
8669
|
}
|
|
8670
|
+
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
8671
|
+
this.pos += take;
|
|
8672
|
+
pos += take;
|
|
8673
|
+
if (this.pos === blockLen) {
|
|
8674
|
+
this.process(view, 0);
|
|
8675
|
+
this.pos = 0;
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
this.length += data.length;
|
|
8679
|
+
this.roundClean();
|
|
8680
|
+
return this;
|
|
8681
|
+
}
|
|
8682
|
+
digestInto(out) {
|
|
8683
|
+
aexists(this);
|
|
8684
|
+
aoutput(out, this);
|
|
8685
|
+
this.finished = true;
|
|
8686
|
+
const { buffer, view, blockLen, isLE: isLE2 } = this;
|
|
8687
|
+
let { pos } = this;
|
|
8688
|
+
buffer[pos++] = 128;
|
|
8689
|
+
clean(this.buffer.subarray(pos));
|
|
8690
|
+
if (this.padOffset > blockLen - pos) {
|
|
8691
|
+
this.process(view, 0);
|
|
8692
|
+
pos = 0;
|
|
10571
8693
|
}
|
|
8694
|
+
for (let i = pos;i < blockLen; i++)
|
|
8695
|
+
buffer[i] = 0;
|
|
8696
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
|
|
8697
|
+
this.process(view, 0);
|
|
8698
|
+
const oview = createView(out);
|
|
8699
|
+
const len = this.outputLen;
|
|
8700
|
+
if (len % 4)
|
|
8701
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
8702
|
+
const outLen = len / 4;
|
|
8703
|
+
const state = this.get();
|
|
8704
|
+
if (outLen > state.length)
|
|
8705
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
8706
|
+
for (let i = 0;i < outLen; i++)
|
|
8707
|
+
oview.setUint32(4 * i, state[i], isLE2);
|
|
10572
8708
|
}
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
return addListener(this, event, fn, context, true);
|
|
10580
|
-
};
|
|
10581
|
-
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
10582
|
-
var evt = prefix ? prefix + event : event;
|
|
10583
|
-
if (!this._events[evt])
|
|
10584
|
-
return this;
|
|
10585
|
-
if (!fn) {
|
|
10586
|
-
clearEvent(this, evt);
|
|
10587
|
-
return this;
|
|
8709
|
+
digest() {
|
|
8710
|
+
const { buffer, outputLen } = this;
|
|
8711
|
+
this.digestInto(buffer);
|
|
8712
|
+
const res = buffer.slice(0, outputLen);
|
|
8713
|
+
this.destroy();
|
|
8714
|
+
return res;
|
|
10588
8715
|
}
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
if (events.length)
|
|
10601
|
-
this._events[evt] = events.length === 1 ? events[0] : events;
|
|
10602
|
-
else
|
|
10603
|
-
clearEvent(this, evt);
|
|
8716
|
+
_cloneInto(to) {
|
|
8717
|
+
to || (to = new this.constructor);
|
|
8718
|
+
to.set(...this.get());
|
|
8719
|
+
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
8720
|
+
to.destroyed = destroyed;
|
|
8721
|
+
to.finished = finished;
|
|
8722
|
+
to.length = length;
|
|
8723
|
+
to.pos = pos;
|
|
8724
|
+
if (length % blockLen)
|
|
8725
|
+
to.buffer.set(buffer);
|
|
8726
|
+
return to;
|
|
10604
8727
|
}
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
10608
|
-
var evt;
|
|
10609
|
-
if (event) {
|
|
10610
|
-
evt = prefix ? prefix + event : event;
|
|
10611
|
-
if (this._events[evt])
|
|
10612
|
-
clearEvent(this, evt);
|
|
10613
|
-
} else {
|
|
10614
|
-
this._events = new Events;
|
|
10615
|
-
this._eventsCount = 0;
|
|
8728
|
+
clone() {
|
|
8729
|
+
return this._cloneInto();
|
|
10616
8730
|
}
|
|
10617
|
-
return this;
|
|
10618
8731
|
};
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
var import__2;
|
|
10630
|
-
var init_eventemitter3 = __esm(() => {
|
|
10631
|
-
import__2 = __toESM(require_eventemitter3(), 1);
|
|
8732
|
+
SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
8733
|
+
1779033703,
|
|
8734
|
+
3144134277,
|
|
8735
|
+
1013904242,
|
|
8736
|
+
2773480762,
|
|
8737
|
+
1359893119,
|
|
8738
|
+
2600822924,
|
|
8739
|
+
528734635,
|
|
8740
|
+
1541459225
|
|
8741
|
+
]);
|
|
10632
8742
|
});
|
|
10633
8743
|
|
|
10634
|
-
// node_modules/
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
8744
|
+
// node_modules/@noble/hashes/esm/legacy.js
|
|
8745
|
+
function ripemd_f(group, x, y, z) {
|
|
8746
|
+
if (group === 0)
|
|
8747
|
+
return x ^ y ^ z;
|
|
8748
|
+
if (group === 1)
|
|
8749
|
+
return x & y | ~x & z;
|
|
8750
|
+
if (group === 2)
|
|
8751
|
+
return (x | ~y) ^ z;
|
|
8752
|
+
if (group === 3)
|
|
8753
|
+
return x & z | y & ~z;
|
|
8754
|
+
return x ^ (y | ~z);
|
|
8755
|
+
}
|
|
8756
|
+
var Rho160, Id160, Pi160, idxLR, idxL, idxR, shifts160, shiftsL160, shiftsR160, Kl160, Kr160, BUF_160, RIPEMD160, ripemd160;
|
|
8757
|
+
var init_legacy = __esm(() => {
|
|
8758
|
+
init__md();
|
|
8759
|
+
init_utils2();
|
|
8760
|
+
Rho160 = /* @__PURE__ */ Uint8Array.from([
|
|
8761
|
+
7,
|
|
8762
|
+
4,
|
|
8763
|
+
13,
|
|
8764
|
+
1,
|
|
8765
|
+
10,
|
|
8766
|
+
6,
|
|
8767
|
+
15,
|
|
8768
|
+
3,
|
|
8769
|
+
12,
|
|
8770
|
+
0,
|
|
8771
|
+
9,
|
|
8772
|
+
5,
|
|
8773
|
+
2,
|
|
8774
|
+
14,
|
|
8775
|
+
11,
|
|
8776
|
+
8
|
|
8777
|
+
]);
|
|
8778
|
+
Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))();
|
|
8779
|
+
Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))();
|
|
8780
|
+
idxLR = /* @__PURE__ */ (() => {
|
|
8781
|
+
const L = [Id160];
|
|
8782
|
+
const R = [Pi160];
|
|
8783
|
+
const res = [L, R];
|
|
8784
|
+
for (let i = 0;i < 4; i++)
|
|
8785
|
+
for (let j of res)
|
|
8786
|
+
j.push(j[i].map((k) => Rho160[k]));
|
|
8787
|
+
return res;
|
|
8788
|
+
})();
|
|
8789
|
+
idxL = /* @__PURE__ */ (() => idxLR[0])();
|
|
8790
|
+
idxR = /* @__PURE__ */ (() => idxLR[1])();
|
|
8791
|
+
shifts160 = /* @__PURE__ */ [
|
|
8792
|
+
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
8793
|
+
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
8794
|
+
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
8795
|
+
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
8796
|
+
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
8797
|
+
].map((i) => Uint8Array.from(i));
|
|
8798
|
+
shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));
|
|
8799
|
+
shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));
|
|
8800
|
+
Kl160 = /* @__PURE__ */ Uint32Array.from([
|
|
8801
|
+
0,
|
|
8802
|
+
1518500249,
|
|
8803
|
+
1859775393,
|
|
8804
|
+
2400959708,
|
|
8805
|
+
2840853838
|
|
8806
|
+
]);
|
|
8807
|
+
Kr160 = /* @__PURE__ */ Uint32Array.from([
|
|
8808
|
+
1352829926,
|
|
8809
|
+
1548603684,
|
|
8810
|
+
1836072691,
|
|
8811
|
+
2053994217,
|
|
8812
|
+
0
|
|
8813
|
+
]);
|
|
8814
|
+
BUF_160 = /* @__PURE__ */ new Uint32Array(16);
|
|
8815
|
+
RIPEMD160 = class RIPEMD160 extends HashMD {
|
|
8816
|
+
constructor() {
|
|
8817
|
+
super(64, 20, 8, true);
|
|
8818
|
+
this.h0 = 1732584193 | 0;
|
|
8819
|
+
this.h1 = 4023233417 | 0;
|
|
8820
|
+
this.h2 = 2562383102 | 0;
|
|
8821
|
+
this.h3 = 271733878 | 0;
|
|
8822
|
+
this.h4 = 3285377520 | 0;
|
|
10696
8823
|
}
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
configurable: true,
|
|
10701
|
-
writable: true,
|
|
10702
|
-
value: -32000
|
|
10703
|
-
});
|
|
10704
|
-
ResourceNotFoundError = class ResourceNotFoundError extends BaseError2 {
|
|
10705
|
-
constructor(parameters = {}) {
|
|
10706
|
-
super({
|
|
10707
|
-
code: ResourceNotFoundError.code,
|
|
10708
|
-
data: parameters.data,
|
|
10709
|
-
message: parameters.message ?? "Requested resource not found."
|
|
10710
|
-
});
|
|
10711
|
-
Object.defineProperty(this, "code", {
|
|
10712
|
-
enumerable: true,
|
|
10713
|
-
configurable: true,
|
|
10714
|
-
writable: true,
|
|
10715
|
-
value: -32001
|
|
10716
|
-
});
|
|
10717
|
-
Object.defineProperty(this, "name", {
|
|
10718
|
-
enumerable: true,
|
|
10719
|
-
configurable: true,
|
|
10720
|
-
writable: true,
|
|
10721
|
-
value: "RpcResponse.ResourceNotFoundError"
|
|
10722
|
-
});
|
|
8824
|
+
get() {
|
|
8825
|
+
const { h0, h1, h2, h3, h4 } = this;
|
|
8826
|
+
return [h0, h1, h2, h3, h4];
|
|
10723
8827
|
}
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
});
|
|
10731
|
-
ResourceUnavailableError = class ResourceUnavailableError extends BaseError2 {
|
|
10732
|
-
constructor(parameters = {}) {
|
|
10733
|
-
super({
|
|
10734
|
-
code: ResourceUnavailableError.code,
|
|
10735
|
-
data: parameters.data,
|
|
10736
|
-
message: parameters.message ?? "Requested resource not available."
|
|
10737
|
-
});
|
|
10738
|
-
Object.defineProperty(this, "code", {
|
|
10739
|
-
enumerable: true,
|
|
10740
|
-
configurable: true,
|
|
10741
|
-
writable: true,
|
|
10742
|
-
value: -32002
|
|
10743
|
-
});
|
|
10744
|
-
Object.defineProperty(this, "name", {
|
|
10745
|
-
enumerable: true,
|
|
10746
|
-
configurable: true,
|
|
10747
|
-
writable: true,
|
|
10748
|
-
value: "RpcResponse.ResourceUnavailableError"
|
|
10749
|
-
});
|
|
8828
|
+
set(h0, h1, h2, h3, h4) {
|
|
8829
|
+
this.h0 = h0 | 0;
|
|
8830
|
+
this.h1 = h1 | 0;
|
|
8831
|
+
this.h2 = h2 | 0;
|
|
8832
|
+
this.h3 = h3 | 0;
|
|
8833
|
+
this.h4 = h4 | 0;
|
|
10750
8834
|
}
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
});
|
|
10771
|
-
Object.defineProperty(this, "name", {
|
|
10772
|
-
enumerable: true,
|
|
10773
|
-
configurable: true,
|
|
10774
|
-
writable: true,
|
|
10775
|
-
value: "RpcResponse.TransactionRejectedError"
|
|
10776
|
-
});
|
|
8835
|
+
process(view, offset) {
|
|
8836
|
+
for (let i = 0;i < 16; i++, offset += 4)
|
|
8837
|
+
BUF_160[i] = view.getUint32(offset, true);
|
|
8838
|
+
let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
|
|
8839
|
+
for (let group = 0;group < 5; group++) {
|
|
8840
|
+
const rGroup = 4 - group;
|
|
8841
|
+
const hbl = Kl160[group], hbr = Kr160[group];
|
|
8842
|
+
const rl = idxL[group], rr = idxR[group];
|
|
8843
|
+
const sl = shiftsL160[group], sr = shiftsR160[group];
|
|
8844
|
+
for (let i = 0;i < 16; i++) {
|
|
8845
|
+
const tl = rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el | 0;
|
|
8846
|
+
al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl;
|
|
8847
|
+
}
|
|
8848
|
+
for (let i = 0;i < 16; i++) {
|
|
8849
|
+
const tr = rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er | 0;
|
|
8850
|
+
ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr;
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0);
|
|
10777
8854
|
}
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
enumerable: true,
|
|
10781
|
-
configurable: true,
|
|
10782
|
-
writable: true,
|
|
10783
|
-
value: -32003
|
|
10784
|
-
});
|
|
10785
|
-
MethodNotSupportedError = class MethodNotSupportedError extends BaseError2 {
|
|
10786
|
-
constructor(parameters = {}) {
|
|
10787
|
-
super({
|
|
10788
|
-
code: MethodNotSupportedError.code,
|
|
10789
|
-
data: parameters.data,
|
|
10790
|
-
message: parameters.message ?? "Method is not implemented."
|
|
10791
|
-
});
|
|
10792
|
-
Object.defineProperty(this, "code", {
|
|
10793
|
-
enumerable: true,
|
|
10794
|
-
configurable: true,
|
|
10795
|
-
writable: true,
|
|
10796
|
-
value: -32004
|
|
10797
|
-
});
|
|
10798
|
-
Object.defineProperty(this, "name", {
|
|
10799
|
-
enumerable: true,
|
|
10800
|
-
configurable: true,
|
|
10801
|
-
writable: true,
|
|
10802
|
-
value: "RpcResponse.MethodNotSupportedError"
|
|
10803
|
-
});
|
|
8855
|
+
roundClean() {
|
|
8856
|
+
clean(BUF_160);
|
|
10804
8857
|
}
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
writable: true,
|
|
10810
|
-
value: -32004
|
|
10811
|
-
});
|
|
10812
|
-
LimitExceededError = class LimitExceededError extends BaseError2 {
|
|
10813
|
-
constructor(parameters = {}) {
|
|
10814
|
-
super({
|
|
10815
|
-
code: LimitExceededError.code,
|
|
10816
|
-
data: parameters.data,
|
|
10817
|
-
message: parameters.message ?? "Rate limit exceeded."
|
|
10818
|
-
});
|
|
10819
|
-
Object.defineProperty(this, "code", {
|
|
10820
|
-
enumerable: true,
|
|
10821
|
-
configurable: true,
|
|
10822
|
-
writable: true,
|
|
10823
|
-
value: -32005
|
|
10824
|
-
});
|
|
10825
|
-
Object.defineProperty(this, "name", {
|
|
10826
|
-
enumerable: true,
|
|
10827
|
-
configurable: true,
|
|
10828
|
-
writable: true,
|
|
10829
|
-
value: "RpcResponse.LimitExceededError"
|
|
10830
|
-
});
|
|
8858
|
+
destroy() {
|
|
8859
|
+
this.destroyed = true;
|
|
8860
|
+
clean(this.buffer);
|
|
8861
|
+
this.set(0, 0, 0, 0, 0);
|
|
10831
8862
|
}
|
|
10832
8863
|
};
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
8864
|
+
ripemd160 = /* @__PURE__ */ createHasher(() => new RIPEMD160);
|
|
8865
|
+
});
|
|
8866
|
+
|
|
8867
|
+
// node_modules/@noble/hashes/esm/ripemd160.js
|
|
8868
|
+
var ripemd1602;
|
|
8869
|
+
var init_ripemd160 = __esm(() => {
|
|
8870
|
+
init_legacy();
|
|
8871
|
+
ripemd1602 = ripemd160;
|
|
8872
|
+
});
|
|
8873
|
+
|
|
8874
|
+
// node_modules/@noble/hashes/esm/_u64.js
|
|
8875
|
+
function fromBig(n, le = false) {
|
|
8876
|
+
if (le)
|
|
8877
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
8878
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
8879
|
+
}
|
|
8880
|
+
function split(lst, le = false) {
|
|
8881
|
+
const len = lst.length;
|
|
8882
|
+
let Ah = new Uint32Array(len);
|
|
8883
|
+
let Al = new Uint32Array(len);
|
|
8884
|
+
for (let i = 0;i < len; i++) {
|
|
8885
|
+
const { h, l } = fromBig(lst[i], le);
|
|
8886
|
+
[Ah[i], Al[i]] = [h, l];
|
|
8887
|
+
}
|
|
8888
|
+
return [Ah, Al];
|
|
8889
|
+
}
|
|
8890
|
+
var U32_MASK64, _32n, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
8891
|
+
var init__u64 = __esm(() => {
|
|
8892
|
+
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
8893
|
+
_32n = /* @__PURE__ */ BigInt(32);
|
|
8894
|
+
});
|
|
8895
|
+
|
|
8896
|
+
// node_modules/@noble/hashes/esm/sha3.js
|
|
8897
|
+
function keccakP(s, rounds = 24) {
|
|
8898
|
+
const B = new Uint32Array(5 * 2);
|
|
8899
|
+
for (let round = 24 - rounds;round < 24; round++) {
|
|
8900
|
+
for (let x = 0;x < 10; x++)
|
|
8901
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
8902
|
+
for (let x = 0;x < 10; x += 2) {
|
|
8903
|
+
const idx1 = (x + 8) % 10;
|
|
8904
|
+
const idx0 = (x + 2) % 10;
|
|
8905
|
+
const B0 = B[idx0];
|
|
8906
|
+
const B1 = B[idx0 + 1];
|
|
8907
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
8908
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
8909
|
+
for (let y = 0;y < 50; y += 10) {
|
|
8910
|
+
s[x + y] ^= Th;
|
|
8911
|
+
s[x + y + 1] ^= Tl;
|
|
8912
|
+
}
|
|
10858
8913
|
}
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
data: parameters.data,
|
|
10871
|
-
message: parameters.message ?? "Input is not a valid JSON-RPC request."
|
|
10872
|
-
});
|
|
10873
|
-
Object.defineProperty(this, "code", {
|
|
10874
|
-
enumerable: true,
|
|
10875
|
-
configurable: true,
|
|
10876
|
-
writable: true,
|
|
10877
|
-
value: -32600
|
|
10878
|
-
});
|
|
10879
|
-
Object.defineProperty(this, "name", {
|
|
10880
|
-
enumerable: true,
|
|
10881
|
-
configurable: true,
|
|
10882
|
-
writable: true,
|
|
10883
|
-
value: "RpcResponse.InvalidRequestError"
|
|
10884
|
-
});
|
|
8914
|
+
let curH = s[2];
|
|
8915
|
+
let curL = s[3];
|
|
8916
|
+
for (let t = 0;t < 24; t++) {
|
|
8917
|
+
const shift = SHA3_ROTL[t];
|
|
8918
|
+
const Th = rotlH(curH, curL, shift);
|
|
8919
|
+
const Tl = rotlL(curH, curL, shift);
|
|
8920
|
+
const PI = SHA3_PI[t];
|
|
8921
|
+
curH = s[PI];
|
|
8922
|
+
curL = s[PI + 1];
|
|
8923
|
+
s[PI] = Th;
|
|
8924
|
+
s[PI + 1] = Tl;
|
|
10885
8925
|
}
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
value: -32600
|
|
10892
|
-
});
|
|
10893
|
-
MethodNotFoundError = class MethodNotFoundError extends BaseError2 {
|
|
10894
|
-
constructor(parameters = {}) {
|
|
10895
|
-
super({
|
|
10896
|
-
code: MethodNotFoundError.code,
|
|
10897
|
-
data: parameters.data,
|
|
10898
|
-
message: parameters.message ?? "Method does not exist."
|
|
10899
|
-
});
|
|
10900
|
-
Object.defineProperty(this, "code", {
|
|
10901
|
-
enumerable: true,
|
|
10902
|
-
configurable: true,
|
|
10903
|
-
writable: true,
|
|
10904
|
-
value: -32601
|
|
10905
|
-
});
|
|
10906
|
-
Object.defineProperty(this, "name", {
|
|
10907
|
-
enumerable: true,
|
|
10908
|
-
configurable: true,
|
|
10909
|
-
writable: true,
|
|
10910
|
-
value: "RpcResponse.MethodNotFoundError"
|
|
10911
|
-
});
|
|
8926
|
+
for (let y = 0;y < 50; y += 10) {
|
|
8927
|
+
for (let x = 0;x < 10; x++)
|
|
8928
|
+
B[x] = s[y + x];
|
|
8929
|
+
for (let x = 0;x < 10; x++)
|
|
8930
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
10912
8931
|
}
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
8932
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
8933
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
8934
|
+
}
|
|
8935
|
+
clean(B);
|
|
8936
|
+
}
|
|
8937
|
+
var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s), rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s), Keccak, gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen)), keccak_256;
|
|
8938
|
+
var init_sha3 = __esm(() => {
|
|
8939
|
+
init__u64();
|
|
8940
|
+
init_utils2();
|
|
8941
|
+
_0n = BigInt(0);
|
|
8942
|
+
_1n = BigInt(1);
|
|
8943
|
+
_2n = BigInt(2);
|
|
8944
|
+
_7n = BigInt(7);
|
|
8945
|
+
_256n = BigInt(256);
|
|
8946
|
+
_0x71n = BigInt(113);
|
|
8947
|
+
SHA3_PI = [];
|
|
8948
|
+
SHA3_ROTL = [];
|
|
8949
|
+
_SHA3_IOTA = [];
|
|
8950
|
+
for (let round = 0, R = _1n, x = 1, y = 0;round < 24; round++) {
|
|
8951
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
8952
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
8953
|
+
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
8954
|
+
let t = _0n;
|
|
8955
|
+
for (let j = 0;j < 7; j++) {
|
|
8956
|
+
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
8957
|
+
if (R & _2n)
|
|
8958
|
+
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
10939
8959
|
}
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
enumerable: true,
|
|
10964
|
-
configurable: true,
|
|
10965
|
-
writable: true,
|
|
10966
|
-
value: "RpcResponse.InternalError"
|
|
10967
|
-
});
|
|
8960
|
+
_SHA3_IOTA.push(t);
|
|
8961
|
+
}
|
|
8962
|
+
IOTAS = split(_SHA3_IOTA, true);
|
|
8963
|
+
SHA3_IOTA_H = IOTAS[0];
|
|
8964
|
+
SHA3_IOTA_L = IOTAS[1];
|
|
8965
|
+
Keccak = class Keccak extends Hash {
|
|
8966
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
8967
|
+
super();
|
|
8968
|
+
this.pos = 0;
|
|
8969
|
+
this.posOut = 0;
|
|
8970
|
+
this.finished = false;
|
|
8971
|
+
this.destroyed = false;
|
|
8972
|
+
this.enableXOF = false;
|
|
8973
|
+
this.blockLen = blockLen;
|
|
8974
|
+
this.suffix = suffix;
|
|
8975
|
+
this.outputLen = outputLen;
|
|
8976
|
+
this.enableXOF = enableXOF;
|
|
8977
|
+
this.rounds = rounds;
|
|
8978
|
+
anumber(outputLen);
|
|
8979
|
+
if (!(0 < blockLen && blockLen < 200))
|
|
8980
|
+
throw new Error("only keccak-f1600 function is supported");
|
|
8981
|
+
this.state = new Uint8Array(200);
|
|
8982
|
+
this.state32 = u32(this.state);
|
|
10968
8983
|
}
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
enumerable: true,
|
|
10972
|
-
configurable: true,
|
|
10973
|
-
writable: true,
|
|
10974
|
-
value: -32603
|
|
10975
|
-
});
|
|
10976
|
-
ParseError = class ParseError extends BaseError2 {
|
|
10977
|
-
constructor(parameters = {}) {
|
|
10978
|
-
super({
|
|
10979
|
-
code: ParseError.code,
|
|
10980
|
-
data: parameters.data,
|
|
10981
|
-
message: parameters.message ?? "Failed to parse JSON-RPC response."
|
|
10982
|
-
});
|
|
10983
|
-
Object.defineProperty(this, "code", {
|
|
10984
|
-
enumerable: true,
|
|
10985
|
-
configurable: true,
|
|
10986
|
-
writable: true,
|
|
10987
|
-
value: -32700
|
|
10988
|
-
});
|
|
10989
|
-
Object.defineProperty(this, "name", {
|
|
10990
|
-
enumerable: true,
|
|
10991
|
-
configurable: true,
|
|
10992
|
-
writable: true,
|
|
10993
|
-
value: "RpcResponse.ParseError"
|
|
10994
|
-
});
|
|
8984
|
+
clone() {
|
|
8985
|
+
return this._cloneInto();
|
|
10995
8986
|
}
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
});
|
|
11018
|
-
Object.defineProperty(this, "code", {
|
|
11019
|
-
enumerable: true,
|
|
11020
|
-
configurable: true,
|
|
11021
|
-
writable: true,
|
|
11022
|
-
value: undefined
|
|
11023
|
-
});
|
|
11024
|
-
Object.defineProperty(this, "details", {
|
|
11025
|
-
enumerable: true,
|
|
11026
|
-
configurable: true,
|
|
11027
|
-
writable: true,
|
|
11028
|
-
value: undefined
|
|
11029
|
-
});
|
|
11030
|
-
this.code = code;
|
|
11031
|
-
this.details = message;
|
|
8987
|
+
keccak() {
|
|
8988
|
+
swap32IfBE(this.state32);
|
|
8989
|
+
keccakP(this.state32, this.rounds);
|
|
8990
|
+
swap32IfBE(this.state32);
|
|
8991
|
+
this.posOut = 0;
|
|
8992
|
+
this.pos = 0;
|
|
8993
|
+
}
|
|
8994
|
+
update(data) {
|
|
8995
|
+
aexists(this);
|
|
8996
|
+
data = toBytes2(data);
|
|
8997
|
+
abytes(data);
|
|
8998
|
+
const { blockLen, state } = this;
|
|
8999
|
+
const len = data.length;
|
|
9000
|
+
for (let pos = 0;pos < len; ) {
|
|
9001
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
9002
|
+
for (let i = 0;i < take; i++)
|
|
9003
|
+
state[this.pos++] ^= data[pos++];
|
|
9004
|
+
if (this.pos === blockLen)
|
|
9005
|
+
this.keccak();
|
|
9006
|
+
}
|
|
9007
|
+
return this;
|
|
11032
9008
|
}
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
Object.defineProperty(this, "name", {
|
|
11044
|
-
enumerable: true,
|
|
11045
|
-
configurable: true,
|
|
11046
|
-
writable: true,
|
|
11047
|
-
value: "Provider.UserRejectedRequestError"
|
|
11048
|
-
});
|
|
9009
|
+
finish() {
|
|
9010
|
+
if (this.finished)
|
|
9011
|
+
return;
|
|
9012
|
+
this.finished = true;
|
|
9013
|
+
const { state, suffix, pos, blockLen } = this;
|
|
9014
|
+
state[pos] ^= suffix;
|
|
9015
|
+
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
9016
|
+
this.keccak();
|
|
9017
|
+
state[blockLen - 1] ^= 128;
|
|
9018
|
+
this.keccak();
|
|
11049
9019
|
}
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
});
|
|
11066
|
-
Object.defineProperty(this, "name", {
|
|
11067
|
-
enumerable: true,
|
|
11068
|
-
configurable: true,
|
|
11069
|
-
writable: true,
|
|
11070
|
-
value: "Provider.UnauthorizedError"
|
|
11071
|
-
});
|
|
9020
|
+
writeInto(out) {
|
|
9021
|
+
aexists(this, false);
|
|
9022
|
+
abytes(out);
|
|
9023
|
+
this.finish();
|
|
9024
|
+
const bufferOut = this.state;
|
|
9025
|
+
const { blockLen } = this;
|
|
9026
|
+
for (let pos = 0, len = out.length;pos < len; ) {
|
|
9027
|
+
if (this.posOut >= blockLen)
|
|
9028
|
+
this.keccak();
|
|
9029
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
9030
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
9031
|
+
this.posOut += take;
|
|
9032
|
+
pos += take;
|
|
9033
|
+
}
|
|
9034
|
+
return out;
|
|
11072
9035
|
}
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
writable: true,
|
|
11078
|
-
value: 4100
|
|
11079
|
-
});
|
|
11080
|
-
UnsupportedMethodError = class UnsupportedMethodError extends ProviderRpcError {
|
|
11081
|
-
constructor({ message = "The provider does not support the requested method." } = {}) {
|
|
11082
|
-
super(4200, message);
|
|
11083
|
-
Object.defineProperty(this, "code", {
|
|
11084
|
-
enumerable: true,
|
|
11085
|
-
configurable: true,
|
|
11086
|
-
writable: true,
|
|
11087
|
-
value: 4200
|
|
11088
|
-
});
|
|
11089
|
-
Object.defineProperty(this, "name", {
|
|
11090
|
-
enumerable: true,
|
|
11091
|
-
configurable: true,
|
|
11092
|
-
writable: true,
|
|
11093
|
-
value: "Provider.UnsupportedMethodError"
|
|
11094
|
-
});
|
|
9036
|
+
xofInto(out) {
|
|
9037
|
+
if (!this.enableXOF)
|
|
9038
|
+
throw new Error("XOF is not possible for this instance");
|
|
9039
|
+
return this.writeInto(out);
|
|
11095
9040
|
}
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
|
|
11099
|
-
configurable: true,
|
|
11100
|
-
writable: true,
|
|
11101
|
-
value: 4200
|
|
11102
|
-
});
|
|
11103
|
-
DisconnectedError = class DisconnectedError extends ProviderRpcError {
|
|
11104
|
-
constructor({ message = "The provider is disconnected from all chains." } = {}) {
|
|
11105
|
-
super(4900, message);
|
|
11106
|
-
Object.defineProperty(this, "code", {
|
|
11107
|
-
enumerable: true,
|
|
11108
|
-
configurable: true,
|
|
11109
|
-
writable: true,
|
|
11110
|
-
value: 4900
|
|
11111
|
-
});
|
|
11112
|
-
Object.defineProperty(this, "name", {
|
|
11113
|
-
enumerable: true,
|
|
11114
|
-
configurable: true,
|
|
11115
|
-
writable: true,
|
|
11116
|
-
value: "Provider.DisconnectedError"
|
|
11117
|
-
});
|
|
9041
|
+
xof(bytes) {
|
|
9042
|
+
anumber(bytes);
|
|
9043
|
+
return this.xofInto(new Uint8Array(bytes));
|
|
11118
9044
|
}
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
ChainDisconnectedError = class ChainDisconnectedError extends ProviderRpcError {
|
|
11127
|
-
constructor({ message = "The provider is not connected to the requested chain." } = {}) {
|
|
11128
|
-
super(4901, message);
|
|
11129
|
-
Object.defineProperty(this, "code", {
|
|
11130
|
-
enumerable: true,
|
|
11131
|
-
configurable: true,
|
|
11132
|
-
writable: true,
|
|
11133
|
-
value: 4901
|
|
11134
|
-
});
|
|
11135
|
-
Object.defineProperty(this, "name", {
|
|
11136
|
-
enumerable: true,
|
|
11137
|
-
configurable: true,
|
|
11138
|
-
writable: true,
|
|
11139
|
-
value: "Provider.ChainDisconnectedError"
|
|
11140
|
-
});
|
|
9045
|
+
digestInto(out) {
|
|
9046
|
+
aoutput(out, this);
|
|
9047
|
+
if (this.finished)
|
|
9048
|
+
throw new Error("digest() was already called");
|
|
9049
|
+
this.writeInto(out);
|
|
9050
|
+
this.destroy();
|
|
9051
|
+
return out;
|
|
11141
9052
|
}
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
enumerable: true,
|
|
11145
|
-
configurable: true,
|
|
11146
|
-
writable: true,
|
|
11147
|
-
value: 4901
|
|
11148
|
-
});
|
|
11149
|
-
SwitchChainError = class SwitchChainError extends ProviderRpcError {
|
|
11150
|
-
constructor({ message = "An error occurred when attempting to switch chain." } = {}) {
|
|
11151
|
-
super(4902, message);
|
|
11152
|
-
Object.defineProperty(this, "code", {
|
|
11153
|
-
enumerable: true,
|
|
11154
|
-
configurable: true,
|
|
11155
|
-
writable: true,
|
|
11156
|
-
value: 4902
|
|
11157
|
-
});
|
|
11158
|
-
Object.defineProperty(this, "name", {
|
|
11159
|
-
enumerable: true,
|
|
11160
|
-
configurable: true,
|
|
11161
|
-
writable: true,
|
|
11162
|
-
value: "Provider.SwitchChainError"
|
|
11163
|
-
});
|
|
9053
|
+
digest() {
|
|
9054
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
11164
9055
|
}
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
enumerable: true,
|
|
11183
|
-
configurable: true,
|
|
11184
|
-
writable: true,
|
|
11185
|
-
value: "Provider.UnsupportedNonOptionalCapabilityError"
|
|
11186
|
-
});
|
|
9056
|
+
destroy() {
|
|
9057
|
+
this.destroyed = true;
|
|
9058
|
+
clean(this.state);
|
|
9059
|
+
}
|
|
9060
|
+
_cloneInto(to) {
|
|
9061
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
9062
|
+
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
9063
|
+
to.state32.set(this.state32);
|
|
9064
|
+
to.pos = this.pos;
|
|
9065
|
+
to.posOut = this.posOut;
|
|
9066
|
+
to.finished = this.finished;
|
|
9067
|
+
to.rounds = rounds;
|
|
9068
|
+
to.suffix = suffix;
|
|
9069
|
+
to.outputLen = outputLen;
|
|
9070
|
+
to.enableXOF = enableXOF;
|
|
9071
|
+
to.destroyed = this.destroyed;
|
|
9072
|
+
return to;
|
|
11187
9073
|
}
|
|
11188
9074
|
};
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
9075
|
+
keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
9076
|
+
});
|
|
9077
|
+
|
|
9078
|
+
// node_modules/@noble/hashes/esm/sha2.js
|
|
9079
|
+
var SHA256_K, SHA256_W, SHA256, sha256;
|
|
9080
|
+
var init_sha2 = __esm(() => {
|
|
9081
|
+
init__md();
|
|
9082
|
+
init_utils2();
|
|
9083
|
+
SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
9084
|
+
1116352408,
|
|
9085
|
+
1899447441,
|
|
9086
|
+
3049323471,
|
|
9087
|
+
3921009573,
|
|
9088
|
+
961987163,
|
|
9089
|
+
1508970993,
|
|
9090
|
+
2453635748,
|
|
9091
|
+
2870763221,
|
|
9092
|
+
3624381080,
|
|
9093
|
+
310598401,
|
|
9094
|
+
607225278,
|
|
9095
|
+
1426881987,
|
|
9096
|
+
1925078388,
|
|
9097
|
+
2162078206,
|
|
9098
|
+
2614888103,
|
|
9099
|
+
3248222580,
|
|
9100
|
+
3835390401,
|
|
9101
|
+
4022224774,
|
|
9102
|
+
264347078,
|
|
9103
|
+
604807628,
|
|
9104
|
+
770255983,
|
|
9105
|
+
1249150122,
|
|
9106
|
+
1555081692,
|
|
9107
|
+
1996064986,
|
|
9108
|
+
2554220882,
|
|
9109
|
+
2821834349,
|
|
9110
|
+
2952996808,
|
|
9111
|
+
3210313671,
|
|
9112
|
+
3336571891,
|
|
9113
|
+
3584528711,
|
|
9114
|
+
113926993,
|
|
9115
|
+
338241895,
|
|
9116
|
+
666307205,
|
|
9117
|
+
773529912,
|
|
9118
|
+
1294757372,
|
|
9119
|
+
1396182291,
|
|
9120
|
+
1695183700,
|
|
9121
|
+
1986661051,
|
|
9122
|
+
2177026350,
|
|
9123
|
+
2456956037,
|
|
9124
|
+
2730485921,
|
|
9125
|
+
2820302411,
|
|
9126
|
+
3259730800,
|
|
9127
|
+
3345764771,
|
|
9128
|
+
3516065817,
|
|
9129
|
+
3600352804,
|
|
9130
|
+
4094571909,
|
|
9131
|
+
275423344,
|
|
9132
|
+
430227734,
|
|
9133
|
+
506948616,
|
|
9134
|
+
659060556,
|
|
9135
|
+
883997877,
|
|
9136
|
+
958139571,
|
|
9137
|
+
1322822218,
|
|
9138
|
+
1537002063,
|
|
9139
|
+
1747873779,
|
|
9140
|
+
1955562222,
|
|
9141
|
+
2024104815,
|
|
9142
|
+
2227730452,
|
|
9143
|
+
2361852424,
|
|
9144
|
+
2428436474,
|
|
9145
|
+
2756734187,
|
|
9146
|
+
3204031479,
|
|
9147
|
+
3329325298
|
|
9148
|
+
]);
|
|
9149
|
+
SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
9150
|
+
SHA256 = class SHA256 extends HashMD {
|
|
9151
|
+
constructor(outputLen = 32) {
|
|
9152
|
+
super(64, outputLen, 8, false);
|
|
9153
|
+
this.A = SHA256_IV[0] | 0;
|
|
9154
|
+
this.B = SHA256_IV[1] | 0;
|
|
9155
|
+
this.C = SHA256_IV[2] | 0;
|
|
9156
|
+
this.D = SHA256_IV[3] | 0;
|
|
9157
|
+
this.E = SHA256_IV[4] | 0;
|
|
9158
|
+
this.F = SHA256_IV[5] | 0;
|
|
9159
|
+
this.G = SHA256_IV[6] | 0;
|
|
9160
|
+
this.H = SHA256_IV[7] | 0;
|
|
11210
9161
|
}
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
configurable: true,
|
|
11215
|
-
writable: true,
|
|
11216
|
-
value: 5710
|
|
11217
|
-
});
|
|
11218
|
-
DuplicateIdError = class DuplicateIdError extends ProviderRpcError {
|
|
11219
|
-
constructor({ message = "There is already a bundle submitted with this ID." } = {}) {
|
|
11220
|
-
super(5720, message);
|
|
11221
|
-
Object.defineProperty(this, "code", {
|
|
11222
|
-
enumerable: true,
|
|
11223
|
-
configurable: true,
|
|
11224
|
-
writable: true,
|
|
11225
|
-
value: 5720
|
|
11226
|
-
});
|
|
11227
|
-
Object.defineProperty(this, "name", {
|
|
11228
|
-
enumerable: true,
|
|
11229
|
-
configurable: true,
|
|
11230
|
-
writable: true,
|
|
11231
|
-
value: "Provider.DuplicateIdError"
|
|
11232
|
-
});
|
|
9162
|
+
get() {
|
|
9163
|
+
const { A, B, C, D: D2, E, F, G, H } = this;
|
|
9164
|
+
return [A, B, C, D2, E, F, G, H];
|
|
11233
9165
|
}
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
super(5730, message);
|
|
11244
|
-
Object.defineProperty(this, "code", {
|
|
11245
|
-
enumerable: true,
|
|
11246
|
-
configurable: true,
|
|
11247
|
-
writable: true,
|
|
11248
|
-
value: 5730
|
|
11249
|
-
});
|
|
11250
|
-
Object.defineProperty(this, "name", {
|
|
11251
|
-
enumerable: true,
|
|
11252
|
-
configurable: true,
|
|
11253
|
-
writable: true,
|
|
11254
|
-
value: "Provider.UnknownBundleIdError"
|
|
11255
|
-
});
|
|
9166
|
+
set(A, B, C, D2, E, F, G, H) {
|
|
9167
|
+
this.A = A | 0;
|
|
9168
|
+
this.B = B | 0;
|
|
9169
|
+
this.C = C | 0;
|
|
9170
|
+
this.D = D2 | 0;
|
|
9171
|
+
this.E = E | 0;
|
|
9172
|
+
this.F = F | 0;
|
|
9173
|
+
this.G = G | 0;
|
|
9174
|
+
this.H = H | 0;
|
|
11256
9175
|
}
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
9176
|
+
process(view, offset) {
|
|
9177
|
+
for (let i = 0;i < 16; i++, offset += 4)
|
|
9178
|
+
SHA256_W[i] = view.getUint32(offset, false);
|
|
9179
|
+
for (let i = 16;i < 64; i++) {
|
|
9180
|
+
const W15 = SHA256_W[i - 15];
|
|
9181
|
+
const W2 = SHA256_W[i - 2];
|
|
9182
|
+
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
9183
|
+
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
9184
|
+
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
9185
|
+
}
|
|
9186
|
+
let { A, B, C, D: D2, E, F, G, H } = this;
|
|
9187
|
+
for (let i = 0;i < 64; i++) {
|
|
9188
|
+
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
9189
|
+
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
9190
|
+
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
9191
|
+
const T2 = sigma0 + Maj(A, B, C) | 0;
|
|
9192
|
+
H = G;
|
|
9193
|
+
G = F;
|
|
9194
|
+
F = E;
|
|
9195
|
+
E = D2 + T1 | 0;
|
|
9196
|
+
D2 = C;
|
|
9197
|
+
C = B;
|
|
9198
|
+
B = A;
|
|
9199
|
+
A = T1 + T2 | 0;
|
|
9200
|
+
}
|
|
9201
|
+
A = A + this.A | 0;
|
|
9202
|
+
B = B + this.B | 0;
|
|
9203
|
+
C = C + this.C | 0;
|
|
9204
|
+
D2 = D2 + this.D | 0;
|
|
9205
|
+
E = E + this.E | 0;
|
|
9206
|
+
F = F + this.F | 0;
|
|
9207
|
+
G = G + this.G | 0;
|
|
9208
|
+
H = H + this.H | 0;
|
|
9209
|
+
this.set(A, B, C, D2, E, F, G, H);
|
|
11279
9210
|
}
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
enumerable: true,
|
|
11283
|
-
configurable: true,
|
|
11284
|
-
writable: true,
|
|
11285
|
-
value: 5740
|
|
11286
|
-
});
|
|
11287
|
-
AtomicReadyWalletRejectedUpgradeError = class AtomicReadyWalletRejectedUpgradeError extends ProviderRpcError {
|
|
11288
|
-
constructor({ message = "The Wallet can support atomicity after an upgrade, but the user rejected the upgrade." } = {}) {
|
|
11289
|
-
super(5750, message);
|
|
11290
|
-
Object.defineProperty(this, "code", {
|
|
11291
|
-
enumerable: true,
|
|
11292
|
-
configurable: true,
|
|
11293
|
-
writable: true,
|
|
11294
|
-
value: 5750
|
|
11295
|
-
});
|
|
11296
|
-
Object.defineProperty(this, "name", {
|
|
11297
|
-
enumerable: true,
|
|
11298
|
-
configurable: true,
|
|
11299
|
-
writable: true,
|
|
11300
|
-
value: "Provider.AtomicReadyWalletRejectedUpgradeError"
|
|
11301
|
-
});
|
|
9211
|
+
roundClean() {
|
|
9212
|
+
clean(SHA256_W);
|
|
11302
9213
|
}
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
configurable: true,
|
|
11307
|
-
writable: true,
|
|
11308
|
-
value: 5750
|
|
11309
|
-
});
|
|
11310
|
-
AtomicityNotSupportedError = class AtomicityNotSupportedError extends ProviderRpcError {
|
|
11311
|
-
constructor({ message = "The wallet does not support atomic execution but the request requires it." } = {}) {
|
|
11312
|
-
super(5760, message);
|
|
11313
|
-
Object.defineProperty(this, "code", {
|
|
11314
|
-
enumerable: true,
|
|
11315
|
-
configurable: true,
|
|
11316
|
-
writable: true,
|
|
11317
|
-
value: 5760
|
|
11318
|
-
});
|
|
11319
|
-
Object.defineProperty(this, "name", {
|
|
11320
|
-
enumerable: true,
|
|
11321
|
-
configurable: true,
|
|
11322
|
-
writable: true,
|
|
11323
|
-
value: "Provider.AtomicityNotSupportedError"
|
|
11324
|
-
});
|
|
9214
|
+
destroy() {
|
|
9215
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
9216
|
+
clean(this.buffer);
|
|
11325
9217
|
}
|
|
11326
9218
|
};
|
|
11327
|
-
|
|
11328
|
-
enumerable: true,
|
|
11329
|
-
configurable: true,
|
|
11330
|
-
writable: true,
|
|
11331
|
-
value: 5760
|
|
11332
|
-
});
|
|
9219
|
+
sha256 = /* @__PURE__ */ createHasher(() => new SHA256);
|
|
11333
9220
|
});
|
|
11334
9221
|
|
|
11335
|
-
// node_modules/
|
|
11336
|
-
var
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
// node_modules/mppx/node_modules/ox/_esm/core/StateOverrides.js
|
|
11342
|
-
var init_StateOverrides = () => {};
|
|
11343
|
-
|
|
11344
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TransactionReceipt.js
|
|
11345
|
-
var init_TransactionReceipt = () => {};
|
|
11346
|
-
|
|
11347
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TransactionRequest.js
|
|
11348
|
-
var init_TransactionRequest = () => {};
|
|
11349
|
-
|
|
11350
|
-
// node_modules/mppx/node_modules/ox/_esm/core/Value.js
|
|
11351
|
-
var init_Value = () => {};
|
|
11352
|
-
|
|
11353
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TxEnvelope.js
|
|
11354
|
-
var init_TxEnvelope = () => {};
|
|
11355
|
-
|
|
11356
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TxEnvelopeEip1559.js
|
|
11357
|
-
var init_TxEnvelopeEip1559 = () => {};
|
|
11358
|
-
|
|
11359
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TxEnvelopeEip2930.js
|
|
11360
|
-
var init_TxEnvelopeEip2930 = () => {};
|
|
11361
|
-
|
|
11362
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TxEnvelopeEip4844.js
|
|
11363
|
-
var init_TxEnvelopeEip4844 = () => {};
|
|
11364
|
-
|
|
11365
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TxEnvelopeEip7702.js
|
|
11366
|
-
var init_TxEnvelopeEip7702 = () => {};
|
|
11367
|
-
|
|
11368
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TxEnvelopeLegacy.js
|
|
11369
|
-
var init_TxEnvelopeLegacy = () => {};
|
|
11370
|
-
|
|
11371
|
-
// node_modules/mppx/node_modules/ox/_esm/core/TypedData.js
|
|
11372
|
-
var init_TypedData = () => {};
|
|
11373
|
-
|
|
11374
|
-
// node_modules/mppx/node_modules/ox/_esm/core/ValidatorData.js
|
|
11375
|
-
var init_ValidatorData = () => {};
|
|
11376
|
-
|
|
11377
|
-
// node_modules/mppx/node_modules/ox/_esm/core/WebAuthnP256.js
|
|
11378
|
-
var init_WebAuthnP256 = () => {};
|
|
11379
|
-
|
|
11380
|
-
// node_modules/mppx/node_modules/ox/_esm/core/WebCryptoP256.js
|
|
11381
|
-
var init_WebCryptoP256 = () => {};
|
|
9222
|
+
// node_modules/@noble/hashes/esm/sha256.js
|
|
9223
|
+
var sha2562;
|
|
9224
|
+
var init_sha256 = __esm(() => {
|
|
9225
|
+
init_sha2();
|
|
9226
|
+
sha2562 = sha256;
|
|
9227
|
+
});
|
|
11382
9228
|
|
|
11383
|
-
// node_modules/mppx/node_modules/ox/_esm/core/
|
|
11384
|
-
var
|
|
9229
|
+
// node_modules/mppx/node_modules/ox/_esm/core/Hash.js
|
|
9230
|
+
var exports_Hash = {};
|
|
9231
|
+
__export(exports_Hash, {
|
|
9232
|
+
validate: () => validate4,
|
|
9233
|
+
sha256: () => sha2563,
|
|
9234
|
+
ripemd160: () => ripemd1603,
|
|
9235
|
+
keccak256: () => keccak256,
|
|
9236
|
+
hmac256: () => hmac256
|
|
9237
|
+
});
|
|
9238
|
+
function keccak256(value, options2 = {}) {
|
|
9239
|
+
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9240
|
+
const bytes = keccak_256(from(value));
|
|
9241
|
+
if (as === "Bytes")
|
|
9242
|
+
return bytes;
|
|
9243
|
+
return fromBytes(bytes);
|
|
9244
|
+
}
|
|
9245
|
+
function hmac256(key, value, options2 = {}) {
|
|
9246
|
+
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9247
|
+
const bytes = hmac(sha2562, from(key), from(value));
|
|
9248
|
+
if (as === "Bytes")
|
|
9249
|
+
return bytes;
|
|
9250
|
+
return fromBytes(bytes);
|
|
9251
|
+
}
|
|
9252
|
+
function ripemd1603(value, options2 = {}) {
|
|
9253
|
+
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9254
|
+
const bytes = ripemd1602(from(value));
|
|
9255
|
+
if (as === "Bytes")
|
|
9256
|
+
return bytes;
|
|
9257
|
+
return fromBytes(bytes);
|
|
9258
|
+
}
|
|
9259
|
+
function sha2563(value, options2 = {}) {
|
|
9260
|
+
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options2;
|
|
9261
|
+
const bytes = sha2562(from(value));
|
|
9262
|
+
if (as === "Bytes")
|
|
9263
|
+
return bytes;
|
|
9264
|
+
return fromBytes(bytes);
|
|
9265
|
+
}
|
|
9266
|
+
function validate4(value) {
|
|
9267
|
+
return validate2(value) && size2(value) === 32;
|
|
9268
|
+
}
|
|
9269
|
+
var init_Hash = __esm(() => {
|
|
9270
|
+
init_hmac();
|
|
9271
|
+
init_ripemd160();
|
|
9272
|
+
init_sha3();
|
|
9273
|
+
init_sha256();
|
|
9274
|
+
init_Bytes();
|
|
9275
|
+
init_Hex();
|
|
9276
|
+
});
|
|
11385
9277
|
|
|
11386
9278
|
// node_modules/mppx/node_modules/ox/_esm/index.js
|
|
11387
9279
|
var init__esm = __esm(() => {
|
|
11388
|
-
init_Abi();
|
|
11389
|
-
init_AbiConstructor();
|
|
11390
|
-
init_AbiError();
|
|
11391
|
-
init_AbiEvent();
|
|
11392
|
-
init_AbiFunction();
|
|
11393
|
-
init_AbiItem();
|
|
11394
|
-
init_AbiParameters();
|
|
11395
|
-
init_AccessList();
|
|
11396
|
-
init_AccountProof();
|
|
11397
|
-
init_Address();
|
|
11398
|
-
init_AesGcm();
|
|
11399
|
-
init_Authorization();
|
|
11400
|
-
init_Base32();
|
|
11401
|
-
init_Base58();
|
|
11402
9280
|
init_Base64();
|
|
11403
|
-
init_Bech32m();
|
|
11404
|
-
init_BinaryStateTree();
|
|
11405
|
-
init_Blobs();
|
|
11406
|
-
init_Block();
|
|
11407
|
-
init_BlockOverrides();
|
|
11408
|
-
init_Bloom();
|
|
11409
|
-
init_Bls();
|
|
11410
|
-
init_BlsPoint();
|
|
11411
9281
|
init_Bytes();
|
|
11412
|
-
init_Caches();
|
|
11413
|
-
init_Cbor();
|
|
11414
|
-
init_CompactSize();
|
|
11415
|
-
init_ContractAddress();
|
|
11416
|
-
init_CoseKey();
|
|
11417
|
-
init_Ed25519();
|
|
11418
|
-
init_Ens();
|
|
11419
|
-
init_Errors();
|
|
11420
|
-
init_Fee();
|
|
11421
|
-
init_Filter();
|
|
11422
9282
|
init_Hash();
|
|
11423
|
-
init_HdKey();
|
|
11424
9283
|
init_Hex();
|
|
11425
|
-
init_Keystore();
|
|
11426
|
-
init_Log();
|
|
11427
|
-
init_Mnemonic();
|
|
11428
|
-
init_P256();
|
|
11429
|
-
init_PersonalMessage();
|
|
11430
|
-
init_Provider();
|
|
11431
|
-
init_PublicKey();
|
|
11432
|
-
init_Rlp();
|
|
11433
|
-
init_RpcResponse();
|
|
11434
|
-
init_RpcTransport();
|
|
11435
|
-
init_Secp256k1();
|
|
11436
|
-
init_Signature();
|
|
11437
|
-
init_Siwe();
|
|
11438
|
-
init_Solidity();
|
|
11439
|
-
init_StateOverrides();
|
|
11440
|
-
init_Transaction();
|
|
11441
|
-
init_TransactionReceipt();
|
|
11442
|
-
init_TransactionRequest();
|
|
11443
|
-
init_TxEnvelope();
|
|
11444
|
-
init_TxEnvelopeEip1559();
|
|
11445
|
-
init_TxEnvelopeEip2930();
|
|
11446
|
-
init_TxEnvelopeEip4844();
|
|
11447
|
-
init_TxEnvelopeEip7702();
|
|
11448
|
-
init_TxEnvelopeLegacy();
|
|
11449
|
-
init_TypedData();
|
|
11450
|
-
init_ValidatorData();
|
|
11451
|
-
init_Value();
|
|
11452
|
-
init_WebAuthnP256();
|
|
11453
|
-
init_WebCryptoP256();
|
|
11454
|
-
init_Withdrawal();
|
|
11455
|
-
init_X25519();
|
|
11456
9284
|
});
|
|
11457
9285
|
|
|
11458
|
-
// node_modules/mppx/dist/BodyDigest.js
|
|
11459
|
-
var init_BodyDigest = () => {};
|
|
11460
|
-
|
|
11461
9286
|
// node_modules/mppx/dist/PaymentRequest.js
|
|
11462
9287
|
function deserialize(encoded) {
|
|
11463
9288
|
const json = exports_Base64.toString(encoded);
|
|
@@ -11608,7 +9433,7 @@ __export(exports_util, {
|
|
|
11608
9433
|
assertNever: () => assertNever,
|
|
11609
9434
|
assertIs: () => assertIs,
|
|
11610
9435
|
assertEqual: () => assertEqual,
|
|
11611
|
-
assert: () =>
|
|
9436
|
+
assert: () => assert3,
|
|
11612
9437
|
allowsEval: () => allowsEval,
|
|
11613
9438
|
aborted: () => aborted,
|
|
11614
9439
|
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
@@ -11625,7 +9450,7 @@ function assertIs(_arg) {}
|
|
|
11625
9450
|
function assertNever(_x) {
|
|
11626
9451
|
throw new Error("Unexpected value in exhaustive check");
|
|
11627
9452
|
}
|
|
11628
|
-
function
|
|
9453
|
+
function assert3(_) {}
|
|
11629
9454
|
function getEnumValues(entries) {
|
|
11630
9455
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
11631
9456
|
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -22167,7 +19992,7 @@ function finalize(ctx, schema) {
|
|
|
22167
19992
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
22168
19993
|
} else if (ctx.target === "draft-04") {
|
|
22169
19994
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
22170
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
19995
|
+
} else if (ctx.target === "openapi-3.0") {}
|
|
22171
19996
|
if (ctx.external?.uri) {
|
|
22172
19997
|
const id = ctx.external.registry.get(schema)?.id;
|
|
22173
19998
|
if (!id)
|
|
@@ -22432,7 +20257,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
22432
20257
|
if (val === undefined) {
|
|
22433
20258
|
if (ctx.unrepresentable === "throw") {
|
|
22434
20259
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
22435
|
-
}
|
|
20260
|
+
}
|
|
22436
20261
|
} else if (typeof val === "bigint") {
|
|
22437
20262
|
if (ctx.unrepresentable === "throw") {
|
|
22438
20263
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -24845,12 +22670,6 @@ var init_Credential = __esm(() => {
|
|
|
24845
22670
|
};
|
|
24846
22671
|
});
|
|
24847
22672
|
|
|
24848
|
-
// node_modules/mppx/dist/Errors.js
|
|
24849
|
-
var init_Errors2 = () => {};
|
|
24850
|
-
|
|
24851
|
-
// node_modules/mppx/dist/Expires.js
|
|
24852
|
-
var init_Expires = () => {};
|
|
24853
|
-
|
|
24854
22673
|
// node_modules/mppx/dist/Method.js
|
|
24855
22674
|
var exports_Method = {};
|
|
24856
22675
|
__export(exports_Method, {
|
|
@@ -24882,32 +22701,9 @@ function toServer(method, options2) {
|
|
|
24882
22701
|
};
|
|
24883
22702
|
}
|
|
24884
22703
|
|
|
24885
|
-
// node_modules/mppx/dist/Receipt.js
|
|
24886
|
-
var Schema2;
|
|
24887
|
-
var init_Receipt = __esm(() => {
|
|
24888
|
-
init_zod();
|
|
24889
|
-
Schema2 = object({
|
|
24890
|
-
method: string2(),
|
|
24891
|
-
reference: string2(),
|
|
24892
|
-
externalId: optional(string2()),
|
|
24893
|
-
status: literal("success"),
|
|
24894
|
-
timestamp: datetime3()
|
|
24895
|
-
});
|
|
24896
|
-
});
|
|
24897
|
-
|
|
24898
|
-
// node_modules/mppx/dist/Store.js
|
|
24899
|
-
var init_Store = () => {};
|
|
24900
|
-
|
|
24901
22704
|
// node_modules/mppx/dist/index.js
|
|
24902
|
-
var
|
|
24903
|
-
init_BodyDigest();
|
|
24904
|
-
init_Challenge();
|
|
22705
|
+
var init_dist = __esm(() => {
|
|
24905
22706
|
init_Credential();
|
|
24906
|
-
init_Errors2();
|
|
24907
|
-
init_Expires();
|
|
24908
|
-
init_PaymentRequest();
|
|
24909
|
-
init_Receipt();
|
|
24910
|
-
init_Store();
|
|
24911
22707
|
init_zod();
|
|
24912
22708
|
});
|
|
24913
22709
|
|
|
@@ -24924,7 +22720,7 @@ var init_constants = __esm(() => {
|
|
|
24924
22720
|
// node_modules/@solana/mpp/dist/Methods.js
|
|
24925
22721
|
var charge;
|
|
24926
22722
|
var init_Methods = __esm(() => {
|
|
24927
|
-
|
|
22723
|
+
init_dist();
|
|
24928
22724
|
charge = exports_Method.from({
|
|
24929
22725
|
intent: "charge",
|
|
24930
22726
|
name: "solana",
|
|
@@ -25115,7 +22911,7 @@ var init_Charge = __esm(() => {
|
|
|
25115
22911
|
init_src();
|
|
25116
22912
|
init_src2();
|
|
25117
22913
|
init_src3();
|
|
25118
|
-
|
|
22914
|
+
init_dist();
|
|
25119
22915
|
init_constants();
|
|
25120
22916
|
init_Methods();
|
|
25121
22917
|
});
|
|
@@ -25299,9 +23095,7 @@ var init_Mppx = __esm(() => {
|
|
|
25299
23095
|
|
|
25300
23096
|
// node_modules/mppx/dist/client/index.js
|
|
25301
23097
|
var init_client = __esm(() => {
|
|
25302
|
-
init_Expires();
|
|
25303
23098
|
init_Mppx();
|
|
25304
|
-
init_Transport();
|
|
25305
23099
|
});
|
|
25306
23100
|
|
|
25307
23101
|
// node_modules/@solana/mpp/dist/client/index.js
|
|
@@ -29402,6 +27196,36 @@ async function resolveGroup(auth, target) {
|
|
|
29402
27196
|
return fetchConversationById(auth, matches[0].id);
|
|
29403
27197
|
}
|
|
29404
27198
|
|
|
27199
|
+
// src/lib/mentions.ts
|
|
27200
|
+
var MENTION_ALL_TOKEN = "@[all](all:all)";
|
|
27201
|
+
var MENTION_ALL_LITERAL_SRC = String.raw`(^|[^\w@])@all\b`;
|
|
27202
|
+
function hasMentionAllToken(content) {
|
|
27203
|
+
return content.includes(MENTION_ALL_TOKEN);
|
|
27204
|
+
}
|
|
27205
|
+
function hasMentionAllLiteral(content) {
|
|
27206
|
+
return new RegExp(MENTION_ALL_LITERAL_SRC, "i").test(content);
|
|
27207
|
+
}
|
|
27208
|
+
function rewriteMentionAllLiteral(content) {
|
|
27209
|
+
return content.replace(new RegExp(MENTION_ALL_LITERAL_SRC, "gi"), `$1${MENTION_ALL_TOKEN}`);
|
|
27210
|
+
}
|
|
27211
|
+
function applyMentionAll(content) {
|
|
27212
|
+
if (hasMentionAllToken(content))
|
|
27213
|
+
return content;
|
|
27214
|
+
return content ? `${MENTION_ALL_TOKEN} ${content}` : MENTION_ALL_TOKEN;
|
|
27215
|
+
}
|
|
27216
|
+
function mentionMarkupToPlainText(content) {
|
|
27217
|
+
return content.replace(/@\[([^\]]+)\]\(([^:()\s]+):(user|agent|all)\)/g, "@$1");
|
|
27218
|
+
}
|
|
27219
|
+
function canMentionAll(conv, selfUserId) {
|
|
27220
|
+
if (conv.conversation_type !== "group" || !selfUserId)
|
|
27221
|
+
return false;
|
|
27222
|
+
const me = normalizeUserId(selfUserId);
|
|
27223
|
+
const self = (conv.participants ?? []).find((p) => p.participant_type === "user" && normalizeUserId(p.participant_id) === me && !p.left_at);
|
|
27224
|
+
if (!self)
|
|
27225
|
+
return false;
|
|
27226
|
+
return self.role === "admin" || self.role === "owner" || conv.allow_everyone_mention_all === true;
|
|
27227
|
+
}
|
|
27228
|
+
|
|
29405
27229
|
// src/lib/reactions.ts
|
|
29406
27230
|
var EMOJI_MAX = 32;
|
|
29407
27231
|
function validateEmoji(raw) {
|
|
@@ -29587,7 +27411,7 @@ function registerChatGroupCommand(group) {
|
|
|
29587
27411
|
g.id,
|
|
29588
27412
|
String(g.participants?.length ?? "-"),
|
|
29589
27413
|
g.unread_count ? String(g.unread_count) : "-",
|
|
29590
|
-
g.last_message?.content
|
|
27414
|
+
g.last_message?.content ? mentionMarkupToPlainText(g.last_message.content).slice(0, 40) : "-"
|
|
29591
27415
|
])
|
|
29592
27416
|
];
|
|
29593
27417
|
console.log(table(rows));
|
|
@@ -29604,6 +27428,7 @@ function registerChatGroupCommand(group) {
|
|
|
29604
27428
|
console.log(heading(conv.title ?? "(untitled group)"));
|
|
29605
27429
|
console.log(label("ID", conv.id));
|
|
29606
27430
|
console.log(label("Members", String(active.length)));
|
|
27431
|
+
console.log(label("@all mentions", conv.allow_everyone_mention_all ? "everyone" : "admins only"));
|
|
29607
27432
|
console.log("");
|
|
29608
27433
|
const rows = [
|
|
29609
27434
|
[dim("NAME"), dim("HANDLE"), dim("USER ID"), dim("TYPE"), dim("ROLE")],
|
|
@@ -29809,6 +27634,41 @@ function registerChatGroupCommand(group) {
|
|
|
29809
27634
|
}
|
|
29810
27635
|
console.log(success(`${memberLabel(member)} is now an admin.`));
|
|
29811
27636
|
});
|
|
27637
|
+
group.command("mention-all <group> <state>").description("Allow everyone (on) or only admins (off, the default) to use @all in a group (admins only)").option("--yes", "Skip the confirmation (required in non-interactive shells)").option("--raw", "Output raw JSON").action(async (target, stateArg, opts) => {
|
|
27638
|
+
const state = stateArg.trim().toLowerCase();
|
|
27639
|
+
if (state !== "on" && state !== "off") {
|
|
27640
|
+
console.error(error(`Pass "on" or "off" (got "${stateArg}"): on lets every member use @all, off restricts it to admins.`));
|
|
27641
|
+
process.exit(1);
|
|
27642
|
+
}
|
|
27643
|
+
const enable = state === "on";
|
|
27644
|
+
const auth = authOrExit();
|
|
27645
|
+
const conv = await resolveGroupOrExit(auth, target);
|
|
27646
|
+
await confirmDestructive({
|
|
27647
|
+
action: enable ? `Allow EVERYONE in "${conv.title ?? conv.id}" to use @all (notifies every member)` : `Restrict @all in "${conv.title ?? conv.id}" to group admins only`,
|
|
27648
|
+
yes: opts.yes,
|
|
27649
|
+
commandExample: `amiko chat group mention-all ${JSON.stringify(target)} ${state}`
|
|
27650
|
+
});
|
|
27651
|
+
let data;
|
|
27652
|
+
try {
|
|
27653
|
+
data = await amikoWebFetch(auth, `/api/conversations/${encodeURIComponent(conv.id)}/mention-all-permission`, {
|
|
27654
|
+
method: "PATCH",
|
|
27655
|
+
body: { allow_everyone_mention_all: enable },
|
|
27656
|
+
timeoutMs: 20000
|
|
27657
|
+
});
|
|
27658
|
+
} catch (e5) {
|
|
27659
|
+
if (statusOf2(e5) === 403) {
|
|
27660
|
+
console.error(error(`Changing the @all setting failed. ${ADMIN_TIP}`));
|
|
27661
|
+
process.exit(1);
|
|
27662
|
+
}
|
|
27663
|
+
exitWithError(e5, "Failed to update the @all setting");
|
|
27664
|
+
}
|
|
27665
|
+
if (opts.raw) {
|
|
27666
|
+
console.log(JSON.stringify(data, null, 2));
|
|
27667
|
+
return;
|
|
27668
|
+
}
|
|
27669
|
+
const now = data.conversation?.allow_everyone_mention_all ?? enable;
|
|
27670
|
+
console.log(success(`@all in "${conv.title ?? conv.id}": ${now ? "everyone can use it" : "admins only"}`) + dim(` (${conv.id})`));
|
|
27671
|
+
});
|
|
29812
27672
|
}
|
|
29813
27673
|
|
|
29814
27674
|
// src/commands/chat.ts
|
|
@@ -29885,7 +27745,8 @@ async function resolveConversation(auth, target) {
|
|
|
29885
27745
|
return {
|
|
29886
27746
|
kind: "conversation",
|
|
29887
27747
|
id: conv.id,
|
|
29888
|
-
label: conv.conversation_type === "direct" ? `DM with ${convLabel(conv, auth.userId)}` : `group "${convLabel(conv, auth.userId)}"
|
|
27748
|
+
label: conv.conversation_type === "direct" ? `DM with ${convLabel(conv, auth.userId)}` : `group "${convLabel(conv, auth.userId)}"`,
|
|
27749
|
+
conversation: conv
|
|
29889
27750
|
};
|
|
29890
27751
|
} catch (e5) {
|
|
29891
27752
|
const status = e5.status;
|
|
@@ -29992,7 +27853,8 @@ function registerChatCommand(chat) {
|
|
|
29992
27853
|
console.log(label(`[${kind}] ${convLabel(c, auth.userId)}`, dim(c.id)));
|
|
29993
27854
|
if (c.last_message?.content) {
|
|
29994
27855
|
const who = c.last_message.name ? `${c.last_message.name}: ` : "";
|
|
29995
|
-
|
|
27856
|
+
const preview = mentionMarkupToPlainText(c.last_message.content);
|
|
27857
|
+
console.log(dim(` ${who}${preview.slice(0, 80)}`));
|
|
29996
27858
|
}
|
|
29997
27859
|
if (unread)
|
|
29998
27860
|
console.log(dim(` ${unread.trim()}`));
|
|
@@ -30037,7 +27899,7 @@ function registerChatCommand(chat) {
|
|
|
30037
27899
|
for (const m of msgs) {
|
|
30038
27900
|
const who = m.sender?.name ?? m.name ?? (m.sender_id ? m.sender_id.slice(0, 8) : "?");
|
|
30039
27901
|
const when = m.created_at ? m.created_at.slice(0, 19).replace("T", " ") : "";
|
|
30040
|
-
console.log(label(who, m.content));
|
|
27902
|
+
console.log(label(who, mentionMarkupToPlainText(m.content ?? "")));
|
|
30041
27903
|
const meta3 = [when, `id ${m.id}`].filter(Boolean).join(" ");
|
|
30042
27904
|
console.log(dim(` ${meta3}`));
|
|
30043
27905
|
if (m.reactions?.length) {
|
|
@@ -30045,7 +27907,7 @@ function registerChatCommand(chat) {
|
|
|
30045
27907
|
}
|
|
30046
27908
|
}
|
|
30047
27909
|
});
|
|
30048
|
-
chat.command("send <target> <message>").description("Send a message as yourself (the owner) to a conversation or person (conversation id, user id, @handle, or name — DMs are opened automatically)").option("--image <pathOrUrl>", "Attach an image: local file (jpg/png/webp/gif, ≤10MB) or an Amiko URL (e.g. from `amiko create`)").option("--audio <pathOrUrl>", "Attach audio as a voice note: local file (≤25MB) or an Amiko URL").option("--yes", "Skip the confirmation (required in non-interactive shells)").option("--raw", "Output raw JSON").action(async (target, message, opts) => {
|
|
27910
|
+
chat.command("send <target> <message>").description("Send a message as yourself (the owner) to a conversation or person (conversation id, user id, @handle, or name — DMs are opened automatically)").option("--image <pathOrUrl>", "Attach an image: local file (jpg/png/webp/gif, ≤10MB) or an Amiko URL (e.g. from `amiko create`)").option("--audio <pathOrUrl>", "Attach audio as a voice note: local file (≤25MB) or an Amiko URL").option("--all", "Mention @all — notifies every member of the group (admins/owners always; others only when enabled via `amiko chat group mention-all`)").option("--yes", "Skip the confirmation (required in non-interactive shells)").option("--raw", "Output raw JSON").action(async (target, message, opts) => {
|
|
30049
27911
|
const auth = authOrExit();
|
|
30050
27912
|
if (opts.image && opts.audio) {
|
|
30051
27913
|
console.error(error("Attach either --image or --audio, not both (one media block per message)."));
|
|
@@ -30058,12 +27920,46 @@ function registerChatCommand(chat) {
|
|
|
30058
27920
|
console.error(error(e5 instanceof Error ? e5.message : "Could not resolve target"));
|
|
30059
27921
|
process.exit(1);
|
|
30060
27922
|
}
|
|
27923
|
+
const wantsAll = Boolean(opts.all);
|
|
27924
|
+
let outgoing = message;
|
|
27925
|
+
let mentionAllActive = false;
|
|
27926
|
+
if (wantsAll || hasMentionAllLiteral(message) || hasMentionAllToken(message)) {
|
|
27927
|
+
const plainTextNote = "Note: @all only notifies people in group chats — sending it as plain text.";
|
|
27928
|
+
let conv = null;
|
|
27929
|
+
if (resolved.kind === "conversation") {
|
|
27930
|
+
try {
|
|
27931
|
+
conv = resolved.conversation ?? await fetchConversationById(auth, resolved.id);
|
|
27932
|
+
} catch (e5) {
|
|
27933
|
+
console.error(error(e5 instanceof Error ? e5.message : "Could not load the conversation"));
|
|
27934
|
+
process.exit(1);
|
|
27935
|
+
}
|
|
27936
|
+
}
|
|
27937
|
+
if (!conv || conv.conversation_type !== "group") {
|
|
27938
|
+
if (wantsAll) {
|
|
27939
|
+
console.error(error("@all only works in group chats — this target is a direct message."));
|
|
27940
|
+
process.exit(1);
|
|
27941
|
+
}
|
|
27942
|
+
console.log(dim(plainTextNote));
|
|
27943
|
+
} else if (!canMentionAll(conv, auth.userId)) {
|
|
27944
|
+
if (wantsAll) {
|
|
27945
|
+
console.error(error(`You can't @all in "${conv.title ?? conv.id}" — only group admins can, unless an admin allows everyone with \`amiko chat group mention-all ${JSON.stringify(target)} on\`.`));
|
|
27946
|
+
process.exit(1);
|
|
27947
|
+
}
|
|
27948
|
+
console.log(dim('Note: you don\'t have @all permission in this group — "@all" goes out as plain text. An admin can enable it with `amiko chat group mention-all <group> on`.'));
|
|
27949
|
+
} else {
|
|
27950
|
+
outgoing = rewriteMentionAllLiteral(message);
|
|
27951
|
+
if (wantsAll)
|
|
27952
|
+
outgoing = applyMentionAll(outgoing);
|
|
27953
|
+
mentionAllActive = true;
|
|
27954
|
+
}
|
|
27955
|
+
}
|
|
30061
27956
|
const media = opts.image ? `image ${opts.image}` : opts.audio ? `audio ${opts.audio}` : "";
|
|
27957
|
+
const shown = mentionMarkupToPlainText(outgoing);
|
|
30062
27958
|
await requireApproval({
|
|
30063
27959
|
free: "sends a message as you (the owner) — the recipients see it",
|
|
30064
|
-
summary: `Send to ${resolved.label}${media ? ` [+${media}]` : ""}: ${
|
|
27960
|
+
summary: `Send to ${resolved.label}${media ? ` [+${media}]` : ""}${mentionAllActive ? " [@all — notifies every member]" : ""}: ${shown.slice(0, 80)}${shown.length > 80 ? "…" : ""}`,
|
|
30065
27961
|
yes: opts.yes,
|
|
30066
|
-
commandExample: `amiko chat send ${JSON.stringify(target)} ${JSON.stringify(message)}`
|
|
27962
|
+
commandExample: `amiko chat send ${JSON.stringify(target)} ${JSON.stringify(message)}${opts.all ? " --all" : ""}`
|
|
30067
27963
|
});
|
|
30068
27964
|
let convId;
|
|
30069
27965
|
try {
|
|
@@ -30082,20 +27978,20 @@ function registerChatCommand(chat) {
|
|
|
30082
27978
|
try {
|
|
30083
27979
|
if (opts.image) {
|
|
30084
27980
|
const img = HTTPS_RE.test(opts.image) ? { url: opts.image, name: urlName(opts.image) } : await uploadChatImage(auth, convId, opts.image);
|
|
30085
|
-
data = await post({ content:
|
|
27981
|
+
data = await post({ content: outgoing, metadata: { images: [img] } });
|
|
30086
27982
|
} else if (opts.audio) {
|
|
30087
27983
|
if (HTTPS_RE.test(opts.audio)) {
|
|
30088
27984
|
data = await post({
|
|
30089
|
-
content:
|
|
27985
|
+
content: outgoing,
|
|
30090
27986
|
message_type: "voice",
|
|
30091
27987
|
metadata: { audioUrl: opts.audio }
|
|
30092
27988
|
});
|
|
30093
27989
|
} else {
|
|
30094
|
-
data = await post({ content:
|
|
27990
|
+
data = await post({ content: outgoing });
|
|
30095
27991
|
await uploadChatVoice(auth, convId, opts.audio);
|
|
30096
27992
|
}
|
|
30097
27993
|
} else {
|
|
30098
|
-
data = await post({ content:
|
|
27994
|
+
data = await post({ content: outgoing });
|
|
30099
27995
|
}
|
|
30100
27996
|
} catch (e5) {
|
|
30101
27997
|
console.error(error(e5 instanceof Error ? e5.message : "Send failed"));
|
|
@@ -30215,7 +28111,7 @@ function registerChatCommand(chat) {
|
|
|
30215
28111
|
console.log(label(emoji3, `×${count}`) + you);
|
|
30216
28112
|
}
|
|
30217
28113
|
});
|
|
30218
|
-
const group = chat.command("group").description("Group chats — create, list, info, rename, add/remove members, leave");
|
|
28114
|
+
const group = chat.command("group").description("Group chats — create, list, info, rename, add/remove members, @all permission, leave");
|
|
30219
28115
|
registerChatGroupCommand(group);
|
|
30220
28116
|
}
|
|
30221
28117
|
|