@rash2x/bridge-widget 0.6.32 → 0.6.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/evaa-bridge.cjs +1 -1
- package/dist/evaa-bridge.mjs +1 -1
- package/dist/{index-D0iCKCsz.js → index-CO2PQtBo.js} +903 -1245
- package/dist/index-CO2PQtBo.js.map +1 -0
- package/dist/{index-BsEjYruO.cjs → index-CmbarigA.cjs} +866 -646
- package/dist/index-CmbarigA.cjs.map +1 -0
- package/dist/{index-BOtiGj6h.cjs → index-DvjGvKnp.cjs} +903 -1245
- package/dist/index-DvjGvKnp.cjs.map +1 -0
- package/dist/{index-BbLtc5UN.js → index-sU0Z-m5M.js} +866 -646
- package/dist/index-sU0Z-m5M.js.map +1 -0
- package/dist/index.html +89 -0
- package/dist/styles.css +1 -1
- package/package.json +13 -11
- package/dist/index-BOtiGj6h.cjs.map +0 -1
- package/dist/index-BbLtc5UN.js.map +0 -1
- package/dist/index-BsEjYruO.cjs.map +0 -1
- package/dist/index-D0iCKCsz.js.map +0 -1
|
@@ -350,7 +350,7 @@ const useChainsStore = create()(
|
|
|
350
350
|
if (same) return;
|
|
351
351
|
set2({ allowedToChains: data });
|
|
352
352
|
},
|
|
353
|
-
setIsLoadingToChains: (
|
|
353
|
+
setIsLoadingToChains: (v2) => set2({ isLoadingToChains: v2 }),
|
|
354
354
|
swapChains: () => set2((state2) => ({
|
|
355
355
|
fromChain: state2.toChain,
|
|
356
356
|
toChain: state2.fromChain
|
|
@@ -592,11 +592,11 @@ const useBridgeQuoteStore = create((set2) => ({
|
|
|
592
592
|
error: void 0,
|
|
593
593
|
noRoute: false,
|
|
594
594
|
refetchTrigger: 0,
|
|
595
|
-
setInputAmount: (
|
|
595
|
+
setInputAmount: (v2) => set2({ inputAmount: v2 }),
|
|
596
596
|
setLoading: () => set2({ status: "loading", error: void 0 }),
|
|
597
|
-
setQuote: (
|
|
597
|
+
setQuote: (q3) => set2({ quote: q3, status: q3 ? "success" : "idle", error: void 0 }),
|
|
598
598
|
setError: (e2) => set2({ error: e2, status: "error" }),
|
|
599
|
-
setNoRoute: (
|
|
599
|
+
setNoRoute: (v2) => set2({ noRoute: v2 }),
|
|
600
600
|
triggerRefetch: () => set2((s2) => ({ refetchTrigger: s2.refetchTrigger + 1 })),
|
|
601
601
|
reset: () => set2({
|
|
602
602
|
inputAmount: "",
|
|
@@ -1590,6 +1590,34 @@ async function getDestTokens(srcChainKey, srcTokenAddr) {
|
|
|
1590
1590
|
});
|
|
1591
1591
|
return unique.map(normalizeTokenSymbol);
|
|
1592
1592
|
}
|
|
1593
|
+
function parseBridgeUrlParams(source) {
|
|
1594
|
+
if (source && typeof source === "object") {
|
|
1595
|
+
return source;
|
|
1596
|
+
}
|
|
1597
|
+
const queryString = typeof source === "string" ? source : typeof window !== "undefined" ? window.location.search : "";
|
|
1598
|
+
const searchParams = new URLSearchParams(queryString);
|
|
1599
|
+
return {
|
|
1600
|
+
srcToken: searchParams.get("srcToken") || void 0,
|
|
1601
|
+
srcChain: searchParams.get("srcChain") || void 0,
|
|
1602
|
+
dstChain: searchParams.get("dstChain") || void 0,
|
|
1603
|
+
amount: searchParams.get("amount") || void 0
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
function buildQueryString(params) {
|
|
1607
|
+
const searchParams = new URLSearchParams();
|
|
1608
|
+
if (params.srcToken) searchParams.set("srcToken", params.srcToken);
|
|
1609
|
+
if (params.srcChain) searchParams.set("srcChain", params.srcChain);
|
|
1610
|
+
if (params.dstChain) searchParams.set("dstChain", params.dstChain);
|
|
1611
|
+
if (params.amount) searchParams.set("amount", params.amount);
|
|
1612
|
+
const queryString = searchParams.toString();
|
|
1613
|
+
return queryString ? `?${queryString}` : "";
|
|
1614
|
+
}
|
|
1615
|
+
function updateBridgeUrlNative(params) {
|
|
1616
|
+
if (typeof window === "undefined" || !window.history) return;
|
|
1617
|
+
const queryString = buildQueryString(params);
|
|
1618
|
+
const newUrl = `${window.location.pathname}${queryString}${window.location.hash}`;
|
|
1619
|
+
window.history.replaceState(null, "", newUrl);
|
|
1620
|
+
}
|
|
1593
1621
|
function resolveTokenOnChainFromMatrix$1(assetMatrix, assetSymbol, chainKey) {
|
|
1594
1622
|
if (!assetMatrix || !assetSymbol || !chainKey) return void 0;
|
|
1595
1623
|
const byChain = assetMatrix[assetSymbol.toUpperCase()];
|
|
@@ -1619,7 +1647,12 @@ const useChainDerivations = () => {
|
|
|
1619
1647
|
return result;
|
|
1620
1648
|
}, [selectedAssetSymbol, assetMatrix, chains]);
|
|
1621
1649
|
useEffect(() => {
|
|
1650
|
+
const urlParams = parseBridgeUrlParams();
|
|
1651
|
+
const hasUrlParams = !!urlParams.srcToken || !!urlParams.srcChain || !!urlParams.dstChain;
|
|
1622
1652
|
setAllowedFromChains(supportedFrom);
|
|
1653
|
+
if (hasUrlParams) {
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1623
1656
|
if (!supportedFrom.length) {
|
|
1624
1657
|
if (fromChain) setFromChain(void 0);
|
|
1625
1658
|
if (toChain) setToChain(void 0);
|
|
@@ -1751,8 +1784,8 @@ function useBalances(chainKey, address) {
|
|
|
1751
1784
|
const map = /* @__PURE__ */ new Map();
|
|
1752
1785
|
const data = query.data;
|
|
1753
1786
|
if (data) {
|
|
1754
|
-
for (const [sum,
|
|
1755
|
-
map.set(normalizeTickerSymbol$1(sum), Number(
|
|
1787
|
+
for (const [sum, v2] of Object.entries(data)) {
|
|
1788
|
+
map.set(normalizeTickerSymbol$1(sum), Number(v2.balance ?? 0));
|
|
1756
1789
|
}
|
|
1757
1790
|
}
|
|
1758
1791
|
return map;
|
|
@@ -2021,59 +2054,6 @@ const SearchIcon = (props) => {
|
|
|
2021
2054
|
}
|
|
2022
2055
|
);
|
|
2023
2056
|
};
|
|
2024
|
-
const StargateIcon = (props) => {
|
|
2025
|
-
return /* @__PURE__ */ jsxs(
|
|
2026
|
-
"svg",
|
|
2027
|
-
{
|
|
2028
|
-
width: "16",
|
|
2029
|
-
height: "16",
|
|
2030
|
-
viewBox: "0 0 16 16",
|
|
2031
|
-
fill: "none",
|
|
2032
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2033
|
-
...props,
|
|
2034
|
-
children: [
|
|
2035
|
-
/* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_13294_89003)", children: [
|
|
2036
|
-
/* @__PURE__ */ jsx(
|
|
2037
|
-
"path",
|
|
2038
|
-
{
|
|
2039
|
-
d: "M9.58707 0.636789L10.0135 1.63492C10.8488 3.59268 12.4067 5.15059 14.3644 5.98584L15.3626 6.41231C15.6232 6.52489 15.8365 6.68184 15.9994 6.87438C15.4988 3.31131 12.6851 0.494623 9.125 0C9.31455 0.1629 9.47449 0.376148 9.58707 0.636789Z",
|
|
2040
|
-
fill: "#999999"
|
|
2041
|
-
}
|
|
2042
|
-
),
|
|
2043
|
-
/* @__PURE__ */ jsx(
|
|
2044
|
-
"path",
|
|
2045
|
-
{
|
|
2046
|
-
d: "M0.636791 6.41231L1.63492 5.98584C3.59268 5.15059 5.15059 3.59268 5.98876 1.63492L6.41528 0.636789C6.52781 0.376148 6.68775 0.1629 6.8773 0C3.31131 0.494623 0.497584 3.31131 0 6.87139C0.1629 6.68184 0.37615 6.52189 0.636791 6.40937V6.41231Z",
|
|
2047
|
-
fill: "#999999"
|
|
2048
|
-
}
|
|
2049
|
-
),
|
|
2050
|
-
/* @__PURE__ */ jsx(
|
|
2051
|
-
"path",
|
|
2052
|
-
{
|
|
2053
|
-
d: "M15.3626 9.58017L14.3644 10.0067C12.4067 10.8419 10.8488 12.4028 10.0135 14.3606L9.58707 15.3557C9.47449 15.6164 9.31455 15.8296 9.125 15.9925C12.6851 15.4949 15.4988 12.6812 15.9964 9.12109C15.8335 9.31065 15.6203 9.47059 15.3596 9.58317L15.3626 9.58017Z",
|
|
2054
|
-
fill: "#999999"
|
|
2055
|
-
}
|
|
2056
|
-
),
|
|
2057
|
-
/* @__PURE__ */ jsx(
|
|
2058
|
-
"path",
|
|
2059
|
-
{
|
|
2060
|
-
d: "M6.4153 15.3587L5.98878 14.3635C5.15355 12.4057 3.59268 10.8478 1.63492 10.0096L0.636789 9.58311C0.37615 9.47059 0.1629 9.31359 0 9.12109C0.497584 12.6812 3.31131 15.4979 6.87139 15.9925C6.68184 15.8296 6.52189 15.6164 6.40937 15.3557L6.4153 15.3587Z",
|
|
2061
|
-
fill: "#999999"
|
|
2062
|
-
}
|
|
2063
|
-
),
|
|
2064
|
-
/* @__PURE__ */ jsx(
|
|
2065
|
-
"path",
|
|
2066
|
-
{
|
|
2067
|
-
d: "M4.37473 7.21715L4.86639 7.00685C5.83193 6.59514 6.59903 5.82804 7.01074 4.86248L7.22104 4.37082C7.51425 3.68368 8.49163 3.68368 8.78489 4.37082L8.99514 4.86248C9.40685 5.82804 10.1739 6.59514 11.1395 7.00685L11.6312 7.21715C12.3183 7.51036 12.3183 8.4848 11.6312 8.78095L11.1395 8.99125C10.1739 9.40296 9.40685 10.1701 8.99514 11.1356L8.78489 11.6273C8.49163 12.3144 7.51425 12.3144 7.22104 11.6273L7.01074 11.1356C6.59903 10.1701 5.83193 9.40296 4.86639 8.99125L4.37473 8.78095C3.68759 8.48774 3.68759 7.5133 4.37473 7.21715Z",
|
|
2068
|
-
fill: "currentColor"
|
|
2069
|
-
}
|
|
2070
|
-
)
|
|
2071
|
-
] }),
|
|
2072
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_13294_89003", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
2073
|
-
]
|
|
2074
|
-
}
|
|
2075
|
-
);
|
|
2076
|
-
};
|
|
2077
2057
|
const MetaMaskIcon = (props) => {
|
|
2078
2058
|
return /* @__PURE__ */ jsxs(
|
|
2079
2059
|
"svg",
|
|
@@ -2488,7 +2468,7 @@ function useModal(initial = false) {
|
|
|
2488
2468
|
const [isOpen, setOpen] = useState(initial);
|
|
2489
2469
|
const onOpen = useCallback(() => setOpen(true), []);
|
|
2490
2470
|
const onClose = useCallback(() => setOpen(false), []);
|
|
2491
|
-
const toggle = useCallback(() => setOpen((
|
|
2471
|
+
const toggle = useCallback(() => setOpen((v2) => !v2), []);
|
|
2492
2472
|
return { isOpen, onOpen, onClose, toggle };
|
|
2493
2473
|
}
|
|
2494
2474
|
const SearchInput = ({
|
|
@@ -2584,9 +2564,9 @@ const ChainSelectModal = ({
|
|
|
2584
2564
|
[chains, assetMatrix]
|
|
2585
2565
|
);
|
|
2586
2566
|
const groupedChains = useMemo(() => {
|
|
2587
|
-
const
|
|
2588
|
-
const filtered =
|
|
2589
|
-
(c2) => c2.name.toLowerCase().includes(
|
|
2567
|
+
const q3 = query.trim().toLowerCase();
|
|
2568
|
+
const filtered = q3 ? (items ?? []).filter(
|
|
2569
|
+
(c2) => c2.name.toLowerCase().includes(q3) || c2.chainKey.toLowerCase().includes(q3)
|
|
2590
2570
|
) : items ?? [];
|
|
2591
2571
|
const groups = {
|
|
2592
2572
|
available: [],
|
|
@@ -2962,7 +2942,7 @@ const SwapSection = ({
|
|
|
2962
2942
|
{
|
|
2963
2943
|
value: amount,
|
|
2964
2944
|
onAmountChange: useCallback(
|
|
2965
|
-
(
|
|
2945
|
+
(v2) => onAmountChange?.(v2),
|
|
2966
2946
|
[onAmountChange]
|
|
2967
2947
|
),
|
|
2968
2948
|
onAmountBlur,
|
|
@@ -3410,10 +3390,7 @@ const Details = () => {
|
|
|
3410
3390
|
DetailsRow,
|
|
3411
3391
|
{
|
|
3412
3392
|
label: t2("transaction.route"),
|
|
3413
|
-
value: /* @__PURE__ */
|
|
3414
|
-
/* @__PURE__ */ jsx(StargateIcon, { className: "w-4 h-4" }),
|
|
3415
|
-
/* @__PURE__ */ jsx("p", { className: "", children: routeText })
|
|
3416
|
-
] })
|
|
3393
|
+
value: /* @__PURE__ */ jsx("span", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx("p", { className: "", children: routeText }) })
|
|
3417
3394
|
}
|
|
3418
3395
|
),
|
|
3419
3396
|
/* @__PURE__ */ jsx(
|
|
@@ -6252,8 +6229,8 @@ class TronChainStrategy {
|
|
|
6252
6229
|
);
|
|
6253
6230
|
}
|
|
6254
6231
|
if (tx?.to && tx?.value && !tx?.data) {
|
|
6255
|
-
const
|
|
6256
|
-
const amountSun = Number(
|
|
6232
|
+
const v2 = BigInt(tx.value.toString());
|
|
6233
|
+
const amountSun = Number(v2);
|
|
6257
6234
|
if (!Number.isFinite(amountSun)) {
|
|
6258
6235
|
throw new InvalidTransactionDataError("tron", "Invalid TRX value");
|
|
6259
6236
|
}
|
|
@@ -6828,9 +6805,9 @@ const TokenSelectModal = ({
|
|
|
6828
6805
|
[assetMatrix, chains]
|
|
6829
6806
|
);
|
|
6830
6807
|
const groupedTokens = useMemo(() => {
|
|
6831
|
-
const
|
|
6832
|
-
const filtered =
|
|
6833
|
-
(a2) => a2.name.toLowerCase().includes(
|
|
6808
|
+
const q3 = query.trim().toLowerCase();
|
|
6809
|
+
const filtered = q3 ? items.filter(
|
|
6810
|
+
(a2) => a2.name.toLowerCase().includes(q3) || a2.symbol.toLowerCase().includes(q3)
|
|
6834
6811
|
) : items;
|
|
6835
6812
|
const groups = {
|
|
6836
6813
|
withBalance: [],
|
|
@@ -7629,7 +7606,7 @@ function requireEvents() {
|
|
|
7629
7606
|
return events.exports;
|
|
7630
7607
|
}
|
|
7631
7608
|
var eventsExports = requireEvents();
|
|
7632
|
-
const xe$
|
|
7609
|
+
const xe$3 = /* @__PURE__ */ getDefaultExportFromCjs(eventsExports);
|
|
7633
7610
|
var cjs$3 = {};
|
|
7634
7611
|
/*! *****************************************************************************
|
|
7635
7612
|
Copyright (c) Microsoft Corporation.
|
|
@@ -7731,8 +7708,8 @@ function __generator(thisArg, body) {
|
|
|
7731
7708
|
return this;
|
|
7732
7709
|
}), g2;
|
|
7733
7710
|
function verb(n3) {
|
|
7734
|
-
return function(
|
|
7735
|
-
return step([n3,
|
|
7711
|
+
return function(v2) {
|
|
7712
|
+
return step([n3, v2]);
|
|
7736
7713
|
};
|
|
7737
7714
|
}
|
|
7738
7715
|
function step(op) {
|
|
@@ -7834,35 +7811,35 @@ function __spread() {
|
|
|
7834
7811
|
function __spreadArrays() {
|
|
7835
7812
|
for (var s2 = 0, i3 = 0, il = arguments.length; i3 < il; i3++) s2 += arguments[i3].length;
|
|
7836
7813
|
for (var r2 = Array(s2), k2 = 0, i3 = 0; i3 < il; i3++)
|
|
7837
|
-
for (var a2 = arguments[i3],
|
|
7838
|
-
r2[k2] = a2[
|
|
7814
|
+
for (var a2 = arguments[i3], j2 = 0, jl = a2.length; j2 < jl; j2++, k2++)
|
|
7815
|
+
r2[k2] = a2[j2];
|
|
7839
7816
|
return r2;
|
|
7840
7817
|
}
|
|
7841
|
-
function __await(
|
|
7842
|
-
return this instanceof __await ? (this.v =
|
|
7818
|
+
function __await(v2) {
|
|
7819
|
+
return this instanceof __await ? (this.v = v2, this) : new __await(v2);
|
|
7843
7820
|
}
|
|
7844
7821
|
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
7845
7822
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
7846
|
-
var g2 = generator.apply(thisArg, _arguments || []), i3,
|
|
7823
|
+
var g2 = generator.apply(thisArg, _arguments || []), i3, q3 = [];
|
|
7847
7824
|
return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() {
|
|
7848
7825
|
return this;
|
|
7849
7826
|
}, i3;
|
|
7850
7827
|
function verb(n3) {
|
|
7851
|
-
if (g2[n3]) i3[n3] = function(
|
|
7828
|
+
if (g2[n3]) i3[n3] = function(v2) {
|
|
7852
7829
|
return new Promise(function(a2, b2) {
|
|
7853
|
-
|
|
7830
|
+
q3.push([n3, v2, a2, b2]) > 1 || resume(n3, v2);
|
|
7854
7831
|
});
|
|
7855
7832
|
};
|
|
7856
7833
|
}
|
|
7857
|
-
function resume(n3,
|
|
7834
|
+
function resume(n3, v2) {
|
|
7858
7835
|
try {
|
|
7859
|
-
step(g2[n3](
|
|
7836
|
+
step(g2[n3](v2));
|
|
7860
7837
|
} catch (e2) {
|
|
7861
|
-
settle(
|
|
7838
|
+
settle(q3[0][3], e2);
|
|
7862
7839
|
}
|
|
7863
7840
|
}
|
|
7864
7841
|
function step(r2) {
|
|
7865
|
-
r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(
|
|
7842
|
+
r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q3[0][2], r2);
|
|
7866
7843
|
}
|
|
7867
7844
|
function fulfill(value) {
|
|
7868
7845
|
resume("next", value);
|
|
@@ -7870,8 +7847,8 @@ function __asyncGenerator(thisArg, _arguments, generator) {
|
|
|
7870
7847
|
function reject(value) {
|
|
7871
7848
|
resume("throw", value);
|
|
7872
7849
|
}
|
|
7873
|
-
function settle(f4,
|
|
7874
|
-
if (f4(
|
|
7850
|
+
function settle(f4, v2) {
|
|
7851
|
+
if (f4(v2), q3.shift(), q3.length) resume(q3[0][0], q3[0][1]);
|
|
7875
7852
|
}
|
|
7876
7853
|
}
|
|
7877
7854
|
function __asyncDelegator(o3) {
|
|
@@ -7882,8 +7859,8 @@ function __asyncDelegator(o3) {
|
|
|
7882
7859
|
return this;
|
|
7883
7860
|
}, i3;
|
|
7884
7861
|
function verb(n3, f4) {
|
|
7885
|
-
i3[n3] = o3[n3] ? function(
|
|
7886
|
-
return (p2 = !p2) ? { value: __await(o3[n3](
|
|
7862
|
+
i3[n3] = o3[n3] ? function(v2) {
|
|
7863
|
+
return (p2 = !p2) ? { value: __await(o3[n3](v2)), done: n3 === "return" } : f4 ? f4(v2) : v2;
|
|
7887
7864
|
} : f4;
|
|
7888
7865
|
}
|
|
7889
7866
|
}
|
|
@@ -7894,15 +7871,15 @@ function __asyncValues(o3) {
|
|
|
7894
7871
|
return this;
|
|
7895
7872
|
}, i3);
|
|
7896
7873
|
function verb(n3) {
|
|
7897
|
-
i3[n3] = o3[n3] && function(
|
|
7874
|
+
i3[n3] = o3[n3] && function(v2) {
|
|
7898
7875
|
return new Promise(function(resolve, reject) {
|
|
7899
|
-
|
|
7876
|
+
v2 = o3[n3](v2), settle(resolve, reject, v2.done, v2.value);
|
|
7900
7877
|
});
|
|
7901
7878
|
};
|
|
7902
7879
|
}
|
|
7903
|
-
function settle(resolve, reject, d3,
|
|
7904
|
-
Promise.resolve(
|
|
7905
|
-
resolve({ value:
|
|
7880
|
+
function settle(resolve, reject, d3, v2) {
|
|
7881
|
+
Promise.resolve(v2).then(function(v3) {
|
|
7882
|
+
resolve({ value: v3, done: d3 });
|
|
7906
7883
|
}, reject);
|
|
7907
7884
|
}
|
|
7908
7885
|
}
|
|
@@ -8164,10 +8141,10 @@ let n$1 = class n extends IEvents {
|
|
|
8164
8141
|
super();
|
|
8165
8142
|
}
|
|
8166
8143
|
};
|
|
8167
|
-
const s$
|
|
8168
|
-
let i$
|
|
8144
|
+
const s$1 = cjsExports$3.FIVE_SECONDS, r$1 = { pulse: "heartbeat_pulse" };
|
|
8145
|
+
let i$1 = class i extends n$1 {
|
|
8169
8146
|
constructor(e2) {
|
|
8170
|
-
super(e2), this.events = new eventsExports.EventEmitter(), this.interval = s$
|
|
8147
|
+
super(e2), this.events = new eventsExports.EventEmitter(), this.interval = s$1, this.interval = e2?.interval || s$1;
|
|
8171
8148
|
}
|
|
8172
8149
|
static async init(e2) {
|
|
8173
8150
|
const t2 = new i(e2);
|
|
@@ -8891,7 +8868,7 @@ function safeJsonStringify(value) {
|
|
|
8891
8868
|
return typeof value === "string" ? value : JSONStringify(value) || "";
|
|
8892
8869
|
}
|
|
8893
8870
|
const x$4 = "idb-keyval";
|
|
8894
|
-
var z$
|
|
8871
|
+
var z$3 = (i3 = {}) => {
|
|
8895
8872
|
const t2 = i3.base && i3.base.length > 0 ? `${i3.base}:` : "", e2 = (s2) => t2 + s2;
|
|
8896
8873
|
let n3;
|
|
8897
8874
|
return i3.dbName && i3.storeName && (n3 = createStore(i3.dbName, i3.storeName)), { name: x$4, options: i3, async hasItem(s2) {
|
|
@@ -8908,10 +8885,10 @@ var z$4 = (i3 = {}) => {
|
|
|
8908
8885
|
return clear(n3);
|
|
8909
8886
|
} };
|
|
8910
8887
|
};
|
|
8911
|
-
const D
|
|
8912
|
-
let _$
|
|
8888
|
+
const D = "WALLET_CONNECT_V2_INDEXED_DB", E$3 = "keyvaluestorage";
|
|
8889
|
+
let _$2 = class _ {
|
|
8913
8890
|
constructor() {
|
|
8914
|
-
this.indexedDb = createStorage({ driver: z$
|
|
8891
|
+
this.indexedDb = createStorage({ driver: z$3({ dbName: D, storeName: E$3 }) });
|
|
8915
8892
|
}
|
|
8916
8893
|
async getKeys() {
|
|
8917
8894
|
return this.indexedDb.getKeys();
|
|
@@ -8930,7 +8907,7 @@ let _$3 = class _ {
|
|
|
8930
8907
|
await this.indexedDb.removeItem(t2);
|
|
8931
8908
|
}
|
|
8932
8909
|
};
|
|
8933
|
-
var l$
|
|
8910
|
+
var l$2 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, c$4 = { exports: {} };
|
|
8934
8911
|
(function() {
|
|
8935
8912
|
let i3;
|
|
8936
8913
|
function t2() {
|
|
@@ -8950,21 +8927,21 @@ var l$3 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window :
|
|
|
8950
8927
|
return e2 = e2 || 0, Object.keys(this)[e2];
|
|
8951
8928
|
}, i3.prototype.__defineGetter__("length", function() {
|
|
8952
8929
|
return Object.keys(this).length;
|
|
8953
|
-
}), typeof l$
|
|
8930
|
+
}), typeof l$2 < "u" && l$2.localStorage ? c$4.exports = l$2.localStorage : typeof window < "u" && window.localStorage ? c$4.exports = window.localStorage : c$4.exports = new t2();
|
|
8954
8931
|
})();
|
|
8955
|
-
function k$
|
|
8932
|
+
function k$2(i3) {
|
|
8956
8933
|
var t2;
|
|
8957
8934
|
return [i3[0], safeJsonParse((t2 = i3[1]) != null ? t2 : "")];
|
|
8958
8935
|
}
|
|
8959
|
-
let K$
|
|
8936
|
+
let K$5 = class K {
|
|
8960
8937
|
constructor() {
|
|
8961
|
-
this.localStorage = c$
|
|
8938
|
+
this.localStorage = c$4.exports;
|
|
8962
8939
|
}
|
|
8963
8940
|
async getKeys() {
|
|
8964
8941
|
return Object.keys(this.localStorage);
|
|
8965
8942
|
}
|
|
8966
8943
|
async getEntries() {
|
|
8967
|
-
return Object.entries(this.localStorage).map(k$
|
|
8944
|
+
return Object.entries(this.localStorage).map(k$2);
|
|
8968
8945
|
}
|
|
8969
8946
|
async getItem(t2) {
|
|
8970
8947
|
const e2 = this.localStorage.getItem(t2);
|
|
@@ -8977,7 +8954,7 @@ let K$4 = class K {
|
|
|
8977
8954
|
this.localStorage.removeItem(t2);
|
|
8978
8955
|
}
|
|
8979
8956
|
};
|
|
8980
|
-
const N$5 = "wc_storage_version", y$4 = 1, O$
|
|
8957
|
+
const N$5 = "wc_storage_version", y$4 = 1, O$2 = async (i3, t2, e2) => {
|
|
8981
8958
|
const n3 = N$5, s2 = await t2.getItem(n3);
|
|
8982
8959
|
if (s2 && s2 >= y$4) {
|
|
8983
8960
|
e2(t2);
|
|
@@ -9004,16 +8981,16 @@ const N$5 = "wc_storage_version", y$4 = 1, O$3 = async (i3, t2, e2) => {
|
|
|
9004
8981
|
await i3.removeItem(e2);
|
|
9005
8982
|
});
|
|
9006
8983
|
};
|
|
9007
|
-
let h$
|
|
8984
|
+
let h$3 = class h {
|
|
9008
8985
|
constructor() {
|
|
9009
8986
|
this.initialized = false, this.setInitialized = (e2) => {
|
|
9010
8987
|
this.storage = e2, this.initialized = true;
|
|
9011
8988
|
};
|
|
9012
|
-
const t2 = new K$
|
|
8989
|
+
const t2 = new K$5();
|
|
9013
8990
|
this.storage = t2;
|
|
9014
8991
|
try {
|
|
9015
|
-
const e2 = new _$
|
|
9016
|
-
O$
|
|
8992
|
+
const e2 = new _$2();
|
|
8993
|
+
O$2(t2, e2, this.setInitialized);
|
|
9017
8994
|
} catch {
|
|
9018
8995
|
this.initialized = true;
|
|
9019
8996
|
}
|
|
@@ -9041,566 +9018,271 @@ let h$4 = class h {
|
|
|
9041
9018
|
});
|
|
9042
9019
|
}
|
|
9043
9020
|
};
|
|
9044
|
-
var
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
var
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
case 102:
|
|
9087
|
-
if (a2 >= argLen)
|
|
9088
|
-
break;
|
|
9089
|
-
if (args[a2] == null) break;
|
|
9090
|
-
if (lastPos < i3)
|
|
9091
|
-
str += f4.slice(lastPos, i3);
|
|
9092
|
-
str += Number(args[a2]);
|
|
9093
|
-
lastPos = i3 + 2;
|
|
9094
|
-
i3++;
|
|
9095
|
-
break;
|
|
9096
|
-
case 105:
|
|
9097
|
-
if (a2 >= argLen)
|
|
9098
|
-
break;
|
|
9099
|
-
if (args[a2] == null) break;
|
|
9100
|
-
if (lastPos < i3)
|
|
9101
|
-
str += f4.slice(lastPos, i3);
|
|
9102
|
-
str += Math.floor(Number(args[a2]));
|
|
9103
|
-
lastPos = i3 + 2;
|
|
9104
|
-
i3++;
|
|
9105
|
-
break;
|
|
9106
|
-
case 79:
|
|
9107
|
-
// 'O'
|
|
9108
|
-
case 111:
|
|
9109
|
-
// 'o'
|
|
9110
|
-
case 106:
|
|
9111
|
-
if (a2 >= argLen)
|
|
9112
|
-
break;
|
|
9113
|
-
if (args[a2] === void 0) break;
|
|
9114
|
-
if (lastPos < i3)
|
|
9115
|
-
str += f4.slice(lastPos, i3);
|
|
9116
|
-
var type = typeof args[a2];
|
|
9117
|
-
if (type === "string") {
|
|
9118
|
-
str += "'" + args[a2] + "'";
|
|
9119
|
-
lastPos = i3 + 2;
|
|
9120
|
-
i3++;
|
|
9121
|
-
break;
|
|
9122
|
-
}
|
|
9123
|
-
if (type === "function") {
|
|
9124
|
-
str += args[a2].name || "<anonymous>";
|
|
9125
|
-
lastPos = i3 + 2;
|
|
9126
|
-
i3++;
|
|
9127
|
-
break;
|
|
9128
|
-
}
|
|
9129
|
-
str += ss2(args[a2]);
|
|
9130
|
-
lastPos = i3 + 2;
|
|
9131
|
-
i3++;
|
|
9132
|
-
break;
|
|
9133
|
-
case 115:
|
|
9134
|
-
if (a2 >= argLen)
|
|
9135
|
-
break;
|
|
9136
|
-
if (lastPos < i3)
|
|
9137
|
-
str += f4.slice(lastPos, i3);
|
|
9138
|
-
str += String(args[a2]);
|
|
9139
|
-
lastPos = i3 + 2;
|
|
9140
|
-
i3++;
|
|
9021
|
+
var b$4 = { exports: {} };
|
|
9022
|
+
function se$3(e2) {
|
|
9023
|
+
try {
|
|
9024
|
+
return JSON.stringify(e2);
|
|
9025
|
+
} catch {
|
|
9026
|
+
return '"[Circular]"';
|
|
9027
|
+
}
|
|
9028
|
+
}
|
|
9029
|
+
var ie$2 = oe$3;
|
|
9030
|
+
function oe$3(e2, t2, r2) {
|
|
9031
|
+
var s2 = r2 && r2.stringify || se$3, i3 = 1;
|
|
9032
|
+
if (typeof e2 == "object" && e2 !== null) {
|
|
9033
|
+
var h4 = t2.length + i3;
|
|
9034
|
+
if (h4 === 1) return e2;
|
|
9035
|
+
var f4 = new Array(h4);
|
|
9036
|
+
f4[0] = s2(e2);
|
|
9037
|
+
for (var u2 = 1; u2 < h4; u2++) f4[u2] = s2(t2[u2]);
|
|
9038
|
+
return f4.join(" ");
|
|
9039
|
+
}
|
|
9040
|
+
if (typeof e2 != "string") return e2;
|
|
9041
|
+
var c2 = t2.length;
|
|
9042
|
+
if (c2 === 0) return e2;
|
|
9043
|
+
for (var n3 = "", o3 = 1 - i3, l2 = -1, p2 = e2 && e2.length || 0, a2 = 0; a2 < p2; ) {
|
|
9044
|
+
if (e2.charCodeAt(a2) === 37 && a2 + 1 < p2) {
|
|
9045
|
+
switch (l2 = l2 > -1 ? l2 : 0, e2.charCodeAt(a2 + 1)) {
|
|
9046
|
+
case 100:
|
|
9047
|
+
case 102:
|
|
9048
|
+
if (o3 >= c2 || t2[o3] == null) break;
|
|
9049
|
+
l2 < a2 && (n3 += e2.slice(l2, a2)), n3 += Number(t2[o3]), l2 = a2 + 2, a2++;
|
|
9050
|
+
break;
|
|
9051
|
+
case 105:
|
|
9052
|
+
if (o3 >= c2 || t2[o3] == null) break;
|
|
9053
|
+
l2 < a2 && (n3 += e2.slice(l2, a2)), n3 += Math.floor(Number(t2[o3])), l2 = a2 + 2, a2++;
|
|
9054
|
+
break;
|
|
9055
|
+
case 79:
|
|
9056
|
+
case 111:
|
|
9057
|
+
case 106:
|
|
9058
|
+
if (o3 >= c2 || t2[o3] === void 0) break;
|
|
9059
|
+
l2 < a2 && (n3 += e2.slice(l2, a2));
|
|
9060
|
+
var O3 = typeof t2[o3];
|
|
9061
|
+
if (O3 === "string") {
|
|
9062
|
+
n3 += "'" + t2[o3] + "'", l2 = a2 + 2, a2++;
|
|
9141
9063
|
break;
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
str += "%";
|
|
9146
|
-
lastPos = i3 + 2;
|
|
9147
|
-
i3++;
|
|
9148
|
-
a2--;
|
|
9064
|
+
}
|
|
9065
|
+
if (O3 === "function") {
|
|
9066
|
+
n3 += t2[o3].name || "<anonymous>", l2 = a2 + 2, a2++;
|
|
9149
9067
|
break;
|
|
9150
|
-
|
|
9151
|
-
|
|
9068
|
+
}
|
|
9069
|
+
n3 += s2(t2[o3]), l2 = a2 + 2, a2++;
|
|
9070
|
+
break;
|
|
9071
|
+
case 115:
|
|
9072
|
+
if (o3 >= c2) break;
|
|
9073
|
+
l2 < a2 && (n3 += e2.slice(l2, a2)), n3 += String(t2[o3]), l2 = a2 + 2, a2++;
|
|
9074
|
+
break;
|
|
9075
|
+
case 37:
|
|
9076
|
+
l2 < a2 && (n3 += e2.slice(l2, a2)), n3 += "%", l2 = a2 + 2, a2++, o3--;
|
|
9077
|
+
break;
|
|
9152
9078
|
}
|
|
9153
|
-
++
|
|
9079
|
+
++o3;
|
|
9154
9080
|
}
|
|
9155
|
-
|
|
9156
|
-
return f4;
|
|
9157
|
-
else if (lastPos < flen) {
|
|
9158
|
-
str += f4.slice(lastPos);
|
|
9159
|
-
}
|
|
9160
|
-
return str;
|
|
9161
|
-
}
|
|
9162
|
-
return quickFormatUnescaped;
|
|
9163
|
-
}
|
|
9164
|
-
var hasRequiredBrowser;
|
|
9165
|
-
function requireBrowser() {
|
|
9166
|
-
if (hasRequiredBrowser) return browser.exports;
|
|
9167
|
-
hasRequiredBrowser = 1;
|
|
9168
|
-
const format = requireQuickFormatUnescaped();
|
|
9169
|
-
browser.exports = pino;
|
|
9170
|
-
const _console = pfGlobalThisOrFallback().console || {};
|
|
9171
|
-
const stdSerializers = {
|
|
9172
|
-
mapHttpRequest: mock,
|
|
9173
|
-
mapHttpResponse: mock,
|
|
9174
|
-
wrapRequestSerializer: passthrough,
|
|
9175
|
-
wrapResponseSerializer: passthrough,
|
|
9176
|
-
wrapErrorSerializer: passthrough,
|
|
9177
|
-
req: mock,
|
|
9178
|
-
res: mock,
|
|
9179
|
-
err: asErrValue,
|
|
9180
|
-
errWithCause: asErrValue
|
|
9181
|
-
};
|
|
9182
|
-
function levelToValue(level, logger) {
|
|
9183
|
-
return level === "silent" ? Infinity : logger.levels.values[level];
|
|
9184
|
-
}
|
|
9185
|
-
const baseLogFunctionSymbol = Symbol("pino.logFuncs");
|
|
9186
|
-
const hierarchySymbol = Symbol("pino.hierarchy");
|
|
9187
|
-
const logFallbackMap = {
|
|
9188
|
-
error: "log",
|
|
9189
|
-
fatal: "error",
|
|
9190
|
-
warn: "error",
|
|
9191
|
-
info: "log",
|
|
9192
|
-
debug: "log",
|
|
9193
|
-
trace: "log"
|
|
9194
|
-
};
|
|
9195
|
-
function appendChildLogger(parentLogger, childLogger) {
|
|
9196
|
-
const newEntry = {
|
|
9197
|
-
logger: childLogger,
|
|
9198
|
-
parent: parentLogger[hierarchySymbol]
|
|
9199
|
-
};
|
|
9200
|
-
childLogger[hierarchySymbol] = newEntry;
|
|
9081
|
+
++a2;
|
|
9201
9082
|
}
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9083
|
+
return l2 === -1 ? e2 : (l2 < p2 && (n3 += e2.slice(l2)), n3);
|
|
9084
|
+
}
|
|
9085
|
+
const G$3 = ie$2;
|
|
9086
|
+
b$4.exports = v$5;
|
|
9087
|
+
const j$4 = we$4().console || {}, le$2 = { mapHttpRequest: C$3, mapHttpResponse: C$3, wrapRequestSerializer: $$1, wrapResponseSerializer: $$1, wrapErrorSerializer: $$1, req: C$3, res: C$3, err: U$2, errWithCause: U$2 };
|
|
9088
|
+
function m$2(e2, t2) {
|
|
9089
|
+
return e2 === "silent" ? 1 / 0 : t2.levels.values[e2];
|
|
9090
|
+
}
|
|
9091
|
+
const A$2 = Symbol("pino.logFuncs"), P$4 = Symbol("pino.hierarchy"), ae$2 = { error: "log", fatal: "error", warn: "error", info: "log", debug: "log", trace: "log" };
|
|
9092
|
+
function R$2(e2, t2) {
|
|
9093
|
+
const r2 = { logger: t2, parent: e2[P$4] };
|
|
9094
|
+
t2[P$4] = r2;
|
|
9095
|
+
}
|
|
9096
|
+
function ue$2(e2, t2, r2) {
|
|
9097
|
+
const s2 = {};
|
|
9098
|
+
t2.forEach((i3) => {
|
|
9099
|
+
s2[i3] = r2[i3] ? r2[i3] : j$4[i3] || j$4[ae$2[i3] || "log"] || w$3;
|
|
9100
|
+
}), e2[A$2] = s2;
|
|
9101
|
+
}
|
|
9102
|
+
function ce$2(e2, t2) {
|
|
9103
|
+
return Array.isArray(e2) ? e2.filter(function(s2) {
|
|
9104
|
+
return s2 !== "!stdSerializers.err";
|
|
9105
|
+
}) : e2 === true ? Object.keys(t2) : false;
|
|
9106
|
+
}
|
|
9107
|
+
function v$5(e2) {
|
|
9108
|
+
e2 = e2 || {}, e2.browser = e2.browser || {};
|
|
9109
|
+
const t2 = e2.browser.transmit;
|
|
9110
|
+
if (t2 && typeof t2.send != "function") throw Error("pino: transmit option must have a send function");
|
|
9111
|
+
const r2 = e2.browser.write || j$4;
|
|
9112
|
+
e2.browser.write && (e2.browser.asObject = true);
|
|
9113
|
+
const s2 = e2.serializers || {}, i3 = ce$2(e2.browser.serialize, s2);
|
|
9114
|
+
let h4 = e2.browser.serialize;
|
|
9115
|
+
Array.isArray(e2.browser.serialize) && e2.browser.serialize.indexOf("!stdSerializers.err") > -1 && (h4 = false);
|
|
9116
|
+
const f4 = Object.keys(e2.customLevels || {}), u2 = ["error", "fatal", "warn", "info", "debug", "trace"].concat(f4);
|
|
9117
|
+
typeof r2 == "function" && u2.forEach(function(g2) {
|
|
9118
|
+
r2[g2] = r2;
|
|
9119
|
+
}), (e2.enabled === false || e2.browser.disabled) && (e2.level = "silent");
|
|
9120
|
+
const c2 = e2.level || "info", n3 = Object.create(r2);
|
|
9121
|
+
n3.log || (n3.log = w$3), ue$2(n3, u2, r2), R$2({}, n3), Object.defineProperty(n3, "levelVal", { get: l2 }), Object.defineProperty(n3, "level", { get: p2, set: a2 });
|
|
9122
|
+
const o3 = { transmit: t2, serialize: i3, asObject: e2.browser.asObject, asObjectBindingsOnly: e2.browser.asObjectBindingsOnly, formatters: e2.browser.formatters, levels: u2, timestamp: ye$4(e2), messageKey: e2.messageKey || "msg", onChild: e2.onChild || w$3 };
|
|
9123
|
+
n3.levels = he$4(e2), n3.level = c2, n3.isLevelEnabled = function(g2) {
|
|
9124
|
+
return this.levels.values[g2] ? this.levels.values[g2] >= this.levels.values[this.level] : false;
|
|
9125
|
+
}, n3.setMaxListeners = n3.getMaxListeners = n3.emit = n3.addListener = n3.on = n3.prependListener = n3.once = n3.prependOnceListener = n3.removeListener = n3.removeAllListeners = n3.listeners = n3.listenerCount = n3.eventNames = n3.write = n3.flush = w$3, n3.serializers = s2, n3._serialize = i3, n3._stdErrSerialize = h4, n3.child = function(...g2) {
|
|
9126
|
+
return O3.call(this, o3, ...g2);
|
|
9127
|
+
}, t2 && (n3._logEvent = N$4());
|
|
9128
|
+
function l2() {
|
|
9129
|
+
return m$2(this.level, this);
|
|
9130
|
+
}
|
|
9131
|
+
function p2() {
|
|
9132
|
+
return this._level;
|
|
9133
|
+
}
|
|
9134
|
+
function a2(g2) {
|
|
9135
|
+
if (g2 !== "silent" && !this.levels.values[g2]) throw Error("unknown level " + g2);
|
|
9136
|
+
this._level = g2, L$2(this, o3, n3, "error"), L$2(this, o3, n3, "fatal"), L$2(this, o3, n3, "warn"), L$2(this, o3, n3, "info"), L$2(this, o3, n3, "debug"), L$2(this, o3, n3, "trace"), f4.forEach((d3) => {
|
|
9137
|
+
L$2(this, o3, n3, d3);
|
|
9206
9138
|
});
|
|
9207
|
-
logger[baseLogFunctionSymbol] = logFunctions;
|
|
9208
9139
|
}
|
|
9209
|
-
function
|
|
9210
|
-
if (
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
return Object.keys(serializers);
|
|
9140
|
+
function O3(g2, d3, z2) {
|
|
9141
|
+
if (!d3) throw new Error("missing bindings for child Pino");
|
|
9142
|
+
z2 = z2 || {}, i3 && d3.serializers && (z2.serializers = d3.serializers);
|
|
9143
|
+
const F2 = z2.serializers;
|
|
9144
|
+
if (i3 && F2) {
|
|
9145
|
+
var E2 = Object.assign({}, s2, F2), M3 = e2.browser.serialize === true ? Object.keys(E2) : i3;
|
|
9146
|
+
delete d3.serializers, V$2([d3], M3, E2, this._stdErrSerialize);
|
|
9217
9147
|
}
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
function pino(opts) {
|
|
9221
|
-
opts = opts || {};
|
|
9222
|
-
opts.browser = opts.browser || {};
|
|
9223
|
-
const transmit2 = opts.browser.transmit;
|
|
9224
|
-
if (transmit2 && typeof transmit2.send !== "function") {
|
|
9225
|
-
throw Error("pino: transmit option must have a send function");
|
|
9226
|
-
}
|
|
9227
|
-
const proto = opts.browser.write || _console;
|
|
9228
|
-
if (opts.browser.write) opts.browser.asObject = true;
|
|
9229
|
-
const serializers = opts.serializers || {};
|
|
9230
|
-
const serialize = shouldSerialize(opts.browser.serialize, serializers);
|
|
9231
|
-
let stdErrSerialize = opts.browser.serialize;
|
|
9232
|
-
if (Array.isArray(opts.browser.serialize) && opts.browser.serialize.indexOf("!stdSerializers.err") > -1) stdErrSerialize = false;
|
|
9233
|
-
const customLevels = Object.keys(opts.customLevels || {});
|
|
9234
|
-
const levels = ["error", "fatal", "warn", "info", "debug", "trace"].concat(customLevels);
|
|
9235
|
-
if (typeof proto === "function") {
|
|
9236
|
-
levels.forEach(function(level2) {
|
|
9237
|
-
proto[level2] = proto;
|
|
9238
|
-
});
|
|
9148
|
+
function D2(k2) {
|
|
9149
|
+
this._childLevel = (k2._childLevel | 0) + 1, this.bindings = d3, E2 && (this.serializers = E2, this._serialize = M3), t2 && (this._logEvent = N$4([].concat(k2._logEvent.bindings, d3)));
|
|
9239
9150
|
}
|
|
9240
|
-
|
|
9241
|
-
const
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
appendChildLogger({}, logger);
|
|
9246
|
-
Object.defineProperty(logger, "levelVal", {
|
|
9247
|
-
get: getLevelVal
|
|
9248
|
-
});
|
|
9249
|
-
Object.defineProperty(logger, "level", {
|
|
9250
|
-
get: getLevel,
|
|
9251
|
-
set: setLevel
|
|
9252
|
-
});
|
|
9253
|
-
const setOpts = {
|
|
9254
|
-
transmit: transmit2,
|
|
9255
|
-
serialize,
|
|
9256
|
-
asObject: opts.browser.asObject,
|
|
9257
|
-
asObjectBindingsOnly: opts.browser.asObjectBindingsOnly,
|
|
9258
|
-
formatters: opts.browser.formatters,
|
|
9259
|
-
levels,
|
|
9260
|
-
timestamp: getTimeFunction(opts),
|
|
9261
|
-
messageKey: opts.messageKey || "msg",
|
|
9262
|
-
onChild: opts.onChild || noop
|
|
9263
|
-
};
|
|
9264
|
-
logger.levels = getLevels(opts);
|
|
9265
|
-
logger.level = level;
|
|
9266
|
-
logger.isLevelEnabled = function(level2) {
|
|
9267
|
-
if (!this.levels.values[level2]) {
|
|
9268
|
-
return false;
|
|
9269
|
-
}
|
|
9270
|
-
return this.levels.values[level2] >= this.levels.values[this.level];
|
|
9271
|
-
};
|
|
9272
|
-
logger.setMaxListeners = logger.getMaxListeners = logger.emit = logger.addListener = logger.on = logger.prependListener = logger.once = logger.prependOnceListener = logger.removeListener = logger.removeAllListeners = logger.listeners = logger.listenerCount = logger.eventNames = logger.write = logger.flush = noop;
|
|
9273
|
-
logger.serializers = serializers;
|
|
9274
|
-
logger._serialize = serialize;
|
|
9275
|
-
logger._stdErrSerialize = stdErrSerialize;
|
|
9276
|
-
logger.child = function(...args) {
|
|
9277
|
-
return child.call(this, setOpts, ...args);
|
|
9278
|
-
};
|
|
9279
|
-
if (transmit2) logger._logEvent = createLogEventShape();
|
|
9280
|
-
function getLevelVal() {
|
|
9281
|
-
return levelToValue(this.level, this);
|
|
9282
|
-
}
|
|
9283
|
-
function getLevel() {
|
|
9284
|
-
return this._level;
|
|
9285
|
-
}
|
|
9286
|
-
function setLevel(level2) {
|
|
9287
|
-
if (level2 !== "silent" && !this.levels.values[level2]) {
|
|
9288
|
-
throw Error("unknown level " + level2);
|
|
9289
|
-
}
|
|
9290
|
-
this._level = level2;
|
|
9291
|
-
set2(this, setOpts, logger, "error");
|
|
9292
|
-
set2(this, setOpts, logger, "fatal");
|
|
9293
|
-
set2(this, setOpts, logger, "warn");
|
|
9294
|
-
set2(this, setOpts, logger, "info");
|
|
9295
|
-
set2(this, setOpts, logger, "debug");
|
|
9296
|
-
set2(this, setOpts, logger, "trace");
|
|
9297
|
-
customLevels.forEach((level3) => {
|
|
9298
|
-
set2(this, setOpts, logger, level3);
|
|
9299
|
-
});
|
|
9300
|
-
}
|
|
9301
|
-
function child(setOpts2, bindings, childOptions) {
|
|
9302
|
-
if (!bindings) {
|
|
9303
|
-
throw new Error("missing bindings for child Pino");
|
|
9304
|
-
}
|
|
9305
|
-
childOptions = childOptions || {};
|
|
9306
|
-
if (serialize && bindings.serializers) {
|
|
9307
|
-
childOptions.serializers = bindings.serializers;
|
|
9308
|
-
}
|
|
9309
|
-
const childOptionsSerializers = childOptions.serializers;
|
|
9310
|
-
if (serialize && childOptionsSerializers) {
|
|
9311
|
-
var childSerializers = Object.assign({}, serializers, childOptionsSerializers);
|
|
9312
|
-
var childSerialize = opts.browser.serialize === true ? Object.keys(childSerializers) : serialize;
|
|
9313
|
-
delete bindings.serializers;
|
|
9314
|
-
applySerializers([bindings], childSerialize, childSerializers, this._stdErrSerialize);
|
|
9315
|
-
}
|
|
9316
|
-
function Child(parent) {
|
|
9317
|
-
this._childLevel = (parent._childLevel | 0) + 1;
|
|
9318
|
-
this.bindings = bindings;
|
|
9319
|
-
if (childSerializers) {
|
|
9320
|
-
this.serializers = childSerializers;
|
|
9321
|
-
this._serialize = childSerialize;
|
|
9322
|
-
}
|
|
9323
|
-
if (transmit2) {
|
|
9324
|
-
this._logEvent = createLogEventShape(
|
|
9325
|
-
[].concat(parent._logEvent.bindings, bindings)
|
|
9326
|
-
);
|
|
9327
|
-
}
|
|
9328
|
-
}
|
|
9329
|
-
Child.prototype = this;
|
|
9330
|
-
const newLogger = new Child(this);
|
|
9331
|
-
appendChildLogger(this, newLogger);
|
|
9332
|
-
newLogger.child = function(...args) {
|
|
9333
|
-
return child.call(this, setOpts2, ...args);
|
|
9334
|
-
};
|
|
9335
|
-
newLogger.level = childOptions.level || this.level;
|
|
9336
|
-
setOpts2.onChild(newLogger);
|
|
9337
|
-
return newLogger;
|
|
9338
|
-
}
|
|
9339
|
-
return logger;
|
|
9151
|
+
D2.prototype = this;
|
|
9152
|
+
const _3 = new D2(this);
|
|
9153
|
+
return R$2(this, _3), _3.child = function(...k2) {
|
|
9154
|
+
return O3.call(this, g2, ...k2);
|
|
9155
|
+
}, _3.level = z2.level || this.level, g2.onChild(_3), _3;
|
|
9340
9156
|
}
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9157
|
+
return n3;
|
|
9158
|
+
}
|
|
9159
|
+
function he$4(e2) {
|
|
9160
|
+
const t2 = e2.customLevels || {}, r2 = Object.assign({}, v$5.levels.values, t2), s2 = Object.assign({}, v$5.levels.labels, fe$3(t2));
|
|
9161
|
+
return { values: r2, labels: s2 };
|
|
9162
|
+
}
|
|
9163
|
+
function fe$3(e2) {
|
|
9164
|
+
const t2 = {};
|
|
9165
|
+
return Object.keys(e2).forEach(function(r2) {
|
|
9166
|
+
t2[e2[r2]] = r2;
|
|
9167
|
+
}), t2;
|
|
9168
|
+
}
|
|
9169
|
+
v$5.levels = { values: { fatal: 60, error: 50, warn: 40, info: 30, debug: 20, trace: 10 }, labels: { 10: "trace", 20: "debug", 30: "info", 40: "warn", 50: "error", 60: "fatal" } }, v$5.stdSerializers = le$2, v$5.stdTimeFunctions = Object.assign({}, { nullTime: X$2, epochTime: Y$1, unixTime: pe$3, isoTime: Le$4 });
|
|
9170
|
+
function ge$4(e2) {
|
|
9171
|
+
const t2 = [];
|
|
9172
|
+
e2.bindings && t2.push(e2.bindings);
|
|
9173
|
+
let r2 = e2[P$4];
|
|
9174
|
+
for (; r2.parent; ) r2 = r2.parent, r2.logger.bindings && t2.push(r2.logger.bindings);
|
|
9175
|
+
return t2.reverse();
|
|
9176
|
+
}
|
|
9177
|
+
function L$2(e2, t2, r2, s2) {
|
|
9178
|
+
if (Object.defineProperty(e2, s2, { value: m$2(e2.level, r2) > m$2(s2, r2) ? w$3 : r2[A$2][s2], writable: true, enumerable: true, configurable: true }), e2[s2] === w$3) {
|
|
9179
|
+
if (!t2.transmit) return;
|
|
9180
|
+
const h4 = t2.transmit.level || e2.level, f4 = m$2(h4, r2);
|
|
9181
|
+
if (m$2(s2, r2) < f4) return;
|
|
9182
|
+
}
|
|
9183
|
+
e2[s2] = de$3(e2, t2, r2, s2);
|
|
9184
|
+
const i3 = ge$4(e2);
|
|
9185
|
+
i3.length !== 0 && (e2[s2] = be$4(i3, e2[s2]));
|
|
9186
|
+
}
|
|
9187
|
+
function be$4(e2, t2) {
|
|
9188
|
+
return function() {
|
|
9189
|
+
return t2.apply(this, [...e2, ...arguments]);
|
|
9374
9190
|
};
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
const bindings = [];
|
|
9379
|
-
if (logger.bindings) {
|
|
9380
|
-
bindings.push(logger.bindings);
|
|
9381
|
-
}
|
|
9382
|
-
let hierarchy = logger[hierarchySymbol];
|
|
9383
|
-
while (hierarchy.parent) {
|
|
9384
|
-
hierarchy = hierarchy.parent;
|
|
9385
|
-
if (hierarchy.logger.bindings) {
|
|
9386
|
-
bindings.push(hierarchy.logger.bindings);
|
|
9387
|
-
}
|
|
9388
|
-
}
|
|
9389
|
-
return bindings.reverse();
|
|
9390
|
-
}
|
|
9391
|
-
function set2(self2, opts, rootLogger, level) {
|
|
9392
|
-
Object.defineProperty(self2, level, {
|
|
9393
|
-
value: levelToValue(self2.level, rootLogger) > levelToValue(level, rootLogger) ? noop : rootLogger[baseLogFunctionSymbol][level],
|
|
9394
|
-
writable: true,
|
|
9395
|
-
enumerable: true,
|
|
9396
|
-
configurable: true
|
|
9397
|
-
});
|
|
9398
|
-
if (self2[level] === noop) {
|
|
9399
|
-
if (!opts.transmit) return;
|
|
9400
|
-
const transmitLevel = opts.transmit.level || self2.level;
|
|
9401
|
-
const transmitValue = levelToValue(transmitLevel, rootLogger);
|
|
9402
|
-
const methodValue = levelToValue(level, rootLogger);
|
|
9403
|
-
if (methodValue < transmitValue) return;
|
|
9404
|
-
}
|
|
9405
|
-
self2[level] = createWrap(self2, opts, rootLogger, level);
|
|
9406
|
-
const bindings = getBindingChain(self2);
|
|
9407
|
-
if (bindings.length === 0) {
|
|
9408
|
-
return;
|
|
9409
|
-
}
|
|
9410
|
-
self2[level] = prependBindingsInArguments(bindings, self2[level]);
|
|
9411
|
-
}
|
|
9412
|
-
function prependBindingsInArguments(bindings, logFunc) {
|
|
9191
|
+
}
|
|
9192
|
+
function de$3(e2, t2, r2, s2) {
|
|
9193
|
+
return /* @__PURE__ */ (function(i3) {
|
|
9413
9194
|
return function() {
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
const args = new Array(arguments.length);
|
|
9422
|
-
const proto = Object.getPrototypeOf && Object.getPrototypeOf(this) === _console ? _console : this;
|
|
9423
|
-
for (var i3 = 0; i3 < args.length; i3++) args[i3] = arguments[i3];
|
|
9424
|
-
var argsIsSerialized = false;
|
|
9425
|
-
if (opts.serialize) {
|
|
9426
|
-
applySerializers(args, this._serialize, this.serializers, this._stdErrSerialize);
|
|
9427
|
-
argsIsSerialized = true;
|
|
9428
|
-
}
|
|
9429
|
-
if (opts.asObject || opts.formatters) {
|
|
9430
|
-
write.call(proto, ...asObject(this, level, args, ts2, opts));
|
|
9431
|
-
} else write.apply(proto, args);
|
|
9432
|
-
if (opts.transmit) {
|
|
9433
|
-
const transmitLevel = opts.transmit.level || self2._level;
|
|
9434
|
-
const transmitValue = levelToValue(transmitLevel, rootLogger);
|
|
9435
|
-
const methodValue = levelToValue(level, rootLogger);
|
|
9436
|
-
if (methodValue < transmitValue) return;
|
|
9437
|
-
transmit(this, {
|
|
9438
|
-
ts: ts2,
|
|
9439
|
-
methodLevel: level,
|
|
9440
|
-
methodValue,
|
|
9441
|
-
transmitValue: rootLogger.levels.values[opts.transmit.level || self2._level],
|
|
9442
|
-
send: opts.transmit.send,
|
|
9443
|
-
val: levelToValue(self2._level, rootLogger)
|
|
9444
|
-
}, args, argsIsSerialized);
|
|
9445
|
-
}
|
|
9446
|
-
};
|
|
9447
|
-
})(self2[baseLogFunctionSymbol][level]);
|
|
9448
|
-
}
|
|
9449
|
-
function asObject(logger, level, args, ts2, opts) {
|
|
9450
|
-
const {
|
|
9451
|
-
level: levelFormatter,
|
|
9452
|
-
log: logObjectFormatter = (obj) => obj
|
|
9453
|
-
} = opts.formatters || {};
|
|
9454
|
-
const argsCloned = args.slice();
|
|
9455
|
-
let msg = argsCloned[0];
|
|
9456
|
-
const logObject = {};
|
|
9457
|
-
let lvl = (logger._childLevel | 0) + 1;
|
|
9458
|
-
if (lvl < 1) lvl = 1;
|
|
9459
|
-
if (ts2) {
|
|
9460
|
-
logObject.time = ts2;
|
|
9461
|
-
}
|
|
9462
|
-
if (levelFormatter) {
|
|
9463
|
-
const formattedLevel = levelFormatter(level, logger.levels.values[level]);
|
|
9464
|
-
Object.assign(logObject, formattedLevel);
|
|
9465
|
-
} else {
|
|
9466
|
-
logObject.level = logger.levels.values[level];
|
|
9467
|
-
}
|
|
9468
|
-
if (opts.asObjectBindingsOnly) {
|
|
9469
|
-
if (msg !== null && typeof msg === "object") {
|
|
9470
|
-
while (lvl-- && typeof argsCloned[0] === "object") {
|
|
9471
|
-
Object.assign(logObject, argsCloned.shift());
|
|
9472
|
-
}
|
|
9473
|
-
}
|
|
9474
|
-
const formattedLogObject = logObjectFormatter(logObject);
|
|
9475
|
-
return [formattedLogObject, ...argsCloned];
|
|
9476
|
-
} else {
|
|
9477
|
-
if (msg !== null && typeof msg === "object") {
|
|
9478
|
-
while (lvl-- && typeof argsCloned[0] === "object") {
|
|
9479
|
-
Object.assign(logObject, argsCloned.shift());
|
|
9480
|
-
}
|
|
9481
|
-
msg = argsCloned.length ? format(argsCloned.shift(), argsCloned) : void 0;
|
|
9482
|
-
} else if (typeof msg === "string") msg = format(argsCloned.shift(), argsCloned);
|
|
9483
|
-
if (msg !== void 0) logObject[opts.messageKey] = msg;
|
|
9484
|
-
const formattedLogObject = logObjectFormatter(logObject);
|
|
9485
|
-
return [formattedLogObject];
|
|
9486
|
-
}
|
|
9487
|
-
}
|
|
9488
|
-
function applySerializers(args, serialize, serializers, stdErrSerialize) {
|
|
9489
|
-
for (const i3 in args) {
|
|
9490
|
-
if (stdErrSerialize && args[i3] instanceof Error) {
|
|
9491
|
-
args[i3] = pino.stdSerializers.err(args[i3]);
|
|
9492
|
-
} else if (typeof args[i3] === "object" && !Array.isArray(args[i3]) && serialize) {
|
|
9493
|
-
for (const k2 in args[i3]) {
|
|
9494
|
-
if (serialize.indexOf(k2) > -1 && k2 in serializers) {
|
|
9495
|
-
args[i3][k2] = serializers[k2](args[i3][k2]);
|
|
9496
|
-
}
|
|
9497
|
-
}
|
|
9195
|
+
const f4 = t2.timestamp(), u2 = new Array(arguments.length), c2 = Object.getPrototypeOf && Object.getPrototypeOf(this) === j$4 ? j$4 : this;
|
|
9196
|
+
for (var n3 = 0; n3 < u2.length; n3++) u2[n3] = arguments[n3];
|
|
9197
|
+
var o3 = false;
|
|
9198
|
+
if (t2.serialize && (V$2(u2, this._serialize, this.serializers, this._stdErrSerialize), o3 = true), t2.asObject || t2.formatters ? i3.call(c2, ...ve$4(this, s2, u2, f4, t2)) : i3.apply(c2, u2), t2.transmit) {
|
|
9199
|
+
const l2 = t2.transmit.level || e2._level, p2 = m$2(l2, r2), a2 = m$2(s2, r2);
|
|
9200
|
+
if (a2 < p2) return;
|
|
9201
|
+
me$4(this, { ts: f4, methodLevel: s2, methodValue: a2, transmitValue: r2.levels.values[t2.transmit.level || e2._level], send: t2.transmit.send, val: m$2(e2._level, r2) }, u2, o3);
|
|
9498
9202
|
}
|
|
9499
|
-
}
|
|
9500
|
-
}
|
|
9501
|
-
function transmit(logger, opts, args, argsIsSerialized = false) {
|
|
9502
|
-
const send = opts.send;
|
|
9503
|
-
const ts2 = opts.ts;
|
|
9504
|
-
const methodLevel = opts.methodLevel;
|
|
9505
|
-
const methodValue = opts.methodValue;
|
|
9506
|
-
const val = opts.val;
|
|
9507
|
-
const bindings = logger._logEvent.bindings;
|
|
9508
|
-
if (!argsIsSerialized) {
|
|
9509
|
-
applySerializers(
|
|
9510
|
-
args,
|
|
9511
|
-
logger._serialize || Object.keys(logger.serializers),
|
|
9512
|
-
logger.serializers,
|
|
9513
|
-
logger._stdErrSerialize === void 0 ? true : logger._stdErrSerialize
|
|
9514
|
-
);
|
|
9515
|
-
}
|
|
9516
|
-
logger._logEvent.ts = ts2;
|
|
9517
|
-
logger._logEvent.messages = args.filter(function(arg) {
|
|
9518
|
-
return bindings.indexOf(arg) === -1;
|
|
9519
|
-
});
|
|
9520
|
-
logger._logEvent.level.label = methodLevel;
|
|
9521
|
-
logger._logEvent.level.value = methodValue;
|
|
9522
|
-
send(methodLevel, logger._logEvent, val);
|
|
9523
|
-
logger._logEvent = createLogEventShape(bindings);
|
|
9524
|
-
}
|
|
9525
|
-
function createLogEventShape(bindings) {
|
|
9526
|
-
return {
|
|
9527
|
-
ts: 0,
|
|
9528
|
-
messages: [],
|
|
9529
|
-
bindings: bindings || [],
|
|
9530
|
-
level: { label: "", value: 0 }
|
|
9531
|
-
};
|
|
9532
|
-
}
|
|
9533
|
-
function asErrValue(err) {
|
|
9534
|
-
const obj = {
|
|
9535
|
-
type: err.constructor.name,
|
|
9536
|
-
msg: err.message,
|
|
9537
|
-
stack: err.stack
|
|
9538
9203
|
};
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
return a2;
|
|
9560
|
-
}
|
|
9561
|
-
function noop() {
|
|
9562
|
-
}
|
|
9563
|
-
function nullTime() {
|
|
9564
|
-
return false;
|
|
9565
|
-
}
|
|
9566
|
-
function epochTime() {
|
|
9567
|
-
return Date.now();
|
|
9568
|
-
}
|
|
9569
|
-
function unixTime() {
|
|
9570
|
-
return Math.round(Date.now() / 1e3);
|
|
9204
|
+
})(e2[A$2][s2]);
|
|
9205
|
+
}
|
|
9206
|
+
function ve$4(e2, t2, r2, s2, i3) {
|
|
9207
|
+
const { level: h4, log: f4 = (l2) => l2 } = i3.formatters || {}, u2 = r2.slice();
|
|
9208
|
+
let c2 = u2[0];
|
|
9209
|
+
const n3 = {};
|
|
9210
|
+
let o3 = (e2._childLevel | 0) + 1;
|
|
9211
|
+
if (o3 < 1 && (o3 = 1), s2 && (n3.time = s2), h4) {
|
|
9212
|
+
const l2 = h4(t2, e2.levels.values[t2]);
|
|
9213
|
+
Object.assign(n3, l2);
|
|
9214
|
+
} else n3.level = e2.levels.values[t2];
|
|
9215
|
+
if (i3.asObjectBindingsOnly) {
|
|
9216
|
+
if (c2 !== null && typeof c2 == "object") for (; o3-- && typeof u2[0] == "object"; ) Object.assign(n3, u2.shift());
|
|
9217
|
+
return [f4(n3), ...u2];
|
|
9218
|
+
} else {
|
|
9219
|
+
if (c2 !== null && typeof c2 == "object") {
|
|
9220
|
+
for (; o3-- && typeof u2[0] == "object"; ) Object.assign(n3, u2.shift());
|
|
9221
|
+
c2 = u2.length ? G$3(u2.shift(), u2) : void 0;
|
|
9222
|
+
} else typeof c2 == "string" && (c2 = G$3(u2.shift(), u2));
|
|
9223
|
+
return c2 !== void 0 && (n3[i3.messageKey] = c2), [f4(n3)];
|
|
9571
9224
|
}
|
|
9572
|
-
|
|
9573
|
-
|
|
9225
|
+
}
|
|
9226
|
+
function V$2(e2, t2, r2, s2) {
|
|
9227
|
+
for (const i3 in e2) if (s2 && e2[i3] instanceof Error) e2[i3] = v$5.stdSerializers.err(e2[i3]);
|
|
9228
|
+
else if (typeof e2[i3] == "object" && !Array.isArray(e2[i3]) && t2) for (const h4 in e2[i3]) t2.indexOf(h4) > -1 && h4 in r2 && (e2[i3][h4] = r2[h4](e2[i3][h4]));
|
|
9229
|
+
}
|
|
9230
|
+
function me$4(e2, t2, r2, s2 = false) {
|
|
9231
|
+
const i3 = t2.send, h4 = t2.ts, f4 = t2.methodLevel, u2 = t2.methodValue, c2 = t2.val, n3 = e2._logEvent.bindings;
|
|
9232
|
+
s2 || V$2(r2, e2._serialize || Object.keys(e2.serializers), e2.serializers, e2._stdErrSerialize === void 0 ? true : e2._stdErrSerialize), e2._logEvent.ts = h4, e2._logEvent.messages = r2.filter(function(o3) {
|
|
9233
|
+
return n3.indexOf(o3) === -1;
|
|
9234
|
+
}), e2._logEvent.level.label = f4, e2._logEvent.level.value = u2, i3(f4, e2._logEvent, c2), e2._logEvent = N$4(n3);
|
|
9235
|
+
}
|
|
9236
|
+
function N$4(e2) {
|
|
9237
|
+
return { ts: 0, messages: [], bindings: e2 || [], level: { label: "", value: 0 } };
|
|
9238
|
+
}
|
|
9239
|
+
function U$2(e2) {
|
|
9240
|
+
const t2 = { type: e2.constructor.name, msg: e2.message, stack: e2.stack };
|
|
9241
|
+
for (const r2 in e2) t2[r2] === void 0 && (t2[r2] = e2[r2]);
|
|
9242
|
+
return t2;
|
|
9243
|
+
}
|
|
9244
|
+
function ye$4(e2) {
|
|
9245
|
+
return typeof e2.timestamp == "function" ? e2.timestamp : e2.timestamp === false ? X$2 : Y$1;
|
|
9246
|
+
}
|
|
9247
|
+
function C$3() {
|
|
9248
|
+
return {};
|
|
9249
|
+
}
|
|
9250
|
+
function $$1(e2) {
|
|
9251
|
+
return e2;
|
|
9252
|
+
}
|
|
9253
|
+
function w$3() {
|
|
9254
|
+
}
|
|
9255
|
+
function X$2() {
|
|
9256
|
+
return false;
|
|
9257
|
+
}
|
|
9258
|
+
function Y$1() {
|
|
9259
|
+
return Date.now();
|
|
9260
|
+
}
|
|
9261
|
+
function pe$3() {
|
|
9262
|
+
return Math.round(Date.now() / 1e3);
|
|
9263
|
+
}
|
|
9264
|
+
function Le$4() {
|
|
9265
|
+
return new Date(Date.now()).toISOString();
|
|
9266
|
+
}
|
|
9267
|
+
function we$4() {
|
|
9268
|
+
function e2(t2) {
|
|
9269
|
+
return typeof t2 < "u" && t2;
|
|
9574
9270
|
}
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
return
|
|
9578
|
-
}
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
Object.defineProperty(Object.prototype, "globalThis", {
|
|
9582
|
-
get: function() {
|
|
9583
|
-
delete Object.prototype.globalThis;
|
|
9584
|
-
return this.globalThis = this;
|
|
9585
|
-
},
|
|
9586
|
-
configurable: true
|
|
9587
|
-
});
|
|
9588
|
-
return globalThis;
|
|
9589
|
-
} catch (e2) {
|
|
9590
|
-
return defd(self) || defd(window) || defd(this) || {};
|
|
9591
|
-
}
|
|
9271
|
+
try {
|
|
9272
|
+
return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", { get: function() {
|
|
9273
|
+
return delete Object.prototype.globalThis, this.globalThis = this;
|
|
9274
|
+
}, configurable: true }), globalThis;
|
|
9275
|
+
} catch {
|
|
9276
|
+
return e2(self) || e2(window) || e2(this) || {};
|
|
9592
9277
|
}
|
|
9593
|
-
browser.exports.default = pino;
|
|
9594
|
-
browser.exports.pino = pino;
|
|
9595
|
-
return browser.exports;
|
|
9596
9278
|
}
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
const
|
|
9600
|
-
var
|
|
9601
|
-
let
|
|
9602
|
-
constructor(
|
|
9603
|
-
|
|
9279
|
+
b$4.exports.default = v$5;
|
|
9280
|
+
b$4.exports.pino = v$5;
|
|
9281
|
+
const Z$1 = { level: "info" }, S$3 = "custom_context", I$1 = 1e3 * 1024;
|
|
9282
|
+
var ze$3 = Object.defineProperty, _e$4 = (e2, t2, r2) => t2 in e2 ? ze$3(e2, t2, { enumerable: true, configurable: true, writable: true, value: r2 }) : e2[t2] = r2, y$3 = (e2, t2, r2) => _e$4(e2, typeof t2 != "symbol" ? t2 + "" : t2, r2);
|
|
9283
|
+
let je$2 = class je {
|
|
9284
|
+
constructor(t2) {
|
|
9285
|
+
y$3(this, "nodeValue"), y$3(this, "sizeInBytes"), y$3(this, "next"), this.nodeValue = t2, this.sizeInBytes = new TextEncoder().encode(this.nodeValue).length, this.next = null;
|
|
9604
9286
|
}
|
|
9605
9287
|
get value() {
|
|
9606
9288
|
return this.nodeValue;
|
|
@@ -9609,26 +9291,26 @@ let S$3 = class S {
|
|
|
9609
9291
|
return this.sizeInBytes;
|
|
9610
9292
|
}
|
|
9611
9293
|
};
|
|
9612
|
-
let
|
|
9613
|
-
constructor(
|
|
9614
|
-
|
|
9294
|
+
let q$1 = class q {
|
|
9295
|
+
constructor(t2) {
|
|
9296
|
+
y$3(this, "lengthInNodes"), y$3(this, "sizeInBytes"), y$3(this, "head"), y$3(this, "tail"), y$3(this, "maxSizeInBytes"), this.head = null, this.tail = null, this.lengthInNodes = 0, this.maxSizeInBytes = t2, this.sizeInBytes = 0;
|
|
9615
9297
|
}
|
|
9616
|
-
append(
|
|
9617
|
-
const
|
|
9618
|
-
if (
|
|
9619
|
-
for (; this.size +
|
|
9620
|
-
this.head ? (this.tail && (this.tail.next =
|
|
9298
|
+
append(t2) {
|
|
9299
|
+
const r2 = new je$2(t2);
|
|
9300
|
+
if (r2.size > this.maxSizeInBytes) throw new Error(`[LinkedList] Value too big to insert into list: ${t2} with size ${r2.size}`);
|
|
9301
|
+
for (; this.size + r2.size > this.maxSizeInBytes; ) this.shift();
|
|
9302
|
+
this.head ? (this.tail && (this.tail.next = r2), this.tail = r2) : (this.head = r2, this.tail = r2), this.lengthInNodes++, this.sizeInBytes += r2.size;
|
|
9621
9303
|
}
|
|
9622
9304
|
shift() {
|
|
9623
9305
|
if (!this.head) return;
|
|
9624
|
-
const
|
|
9625
|
-
this.head = this.head.next, this.head || (this.tail = null), this.lengthInNodes--, this.sizeInBytes -=
|
|
9306
|
+
const t2 = this.head;
|
|
9307
|
+
this.head = this.head.next, this.head || (this.tail = null), this.lengthInNodes--, this.sizeInBytes -= t2.size;
|
|
9626
9308
|
}
|
|
9627
9309
|
toArray() {
|
|
9628
|
-
const
|
|
9629
|
-
let
|
|
9630
|
-
for (;
|
|
9631
|
-
return
|
|
9310
|
+
const t2 = [];
|
|
9311
|
+
let r2 = this.head;
|
|
9312
|
+
for (; r2 !== null; ) t2.push(r2.value), r2 = r2.next;
|
|
9313
|
+
return t2;
|
|
9632
9314
|
}
|
|
9633
9315
|
get length() {
|
|
9634
9316
|
return this.lengthInNodes;
|
|
@@ -9640,48 +9322,52 @@ let v$5 = class v {
|
|
|
9640
9322
|
return Array.from(this);
|
|
9641
9323
|
}
|
|
9642
9324
|
[Symbol.iterator]() {
|
|
9643
|
-
let
|
|
9325
|
+
let t2 = this.head;
|
|
9644
9326
|
return { next: () => {
|
|
9645
|
-
if (!
|
|
9646
|
-
const
|
|
9647
|
-
return
|
|
9327
|
+
if (!t2) return { done: true, value: null };
|
|
9328
|
+
const r2 = t2.value;
|
|
9329
|
+
return t2 = t2.next, { done: false, value: r2 };
|
|
9648
9330
|
} };
|
|
9649
9331
|
}
|
|
9650
9332
|
};
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9333
|
+
const Se$4 = (e2) => JSON.stringify(e2, (t2, r2) => typeof r2 == "bigint" ? r2.toString() + "n" : r2);
|
|
9334
|
+
function K$4(e2) {
|
|
9335
|
+
return typeof e2 == "string" ? e2 : Se$4(e2) || "";
|
|
9336
|
+
}
|
|
9337
|
+
var Ee$3 = Object.defineProperty, ke$3 = (e2, t2, r2) => t2 in e2 ? Ee$3(e2, t2, { enumerable: true, configurable: true, writable: true, value: r2 }) : e2[t2] = r2, T$3 = (e2, t2, r2) => ke$3(e2, typeof t2 != "symbol" ? t2 + "" : t2, r2);
|
|
9338
|
+
let J$5 = class J {
|
|
9339
|
+
constructor(t2, r2 = I$1) {
|
|
9340
|
+
T$3(this, "logs"), T$3(this, "level"), T$3(this, "levelValue"), T$3(this, "MAX_LOG_SIZE_IN_BYTES"), this.level = t2 ?? "error", this.levelValue = b$4.exports.levels.values[this.level], this.MAX_LOG_SIZE_IN_BYTES = r2, this.logs = new q$1(this.MAX_LOG_SIZE_IN_BYTES);
|
|
9655
9341
|
}
|
|
9656
|
-
forwardToConsole(
|
|
9657
|
-
|
|
9342
|
+
forwardToConsole(t2, r2) {
|
|
9343
|
+
r2 === b$4.exports.levels.values.error ? console.error(t2) : r2 === b$4.exports.levels.values.warn ? console.warn(t2) : r2 === b$4.exports.levels.values.debug ? console.debug(t2) : r2 === b$4.exports.levels.values.trace ? console.trace(t2) : console.log(t2);
|
|
9658
9344
|
}
|
|
9659
|
-
appendToLogs(
|
|
9660
|
-
this.logs.append(
|
|
9661
|
-
const
|
|
9662
|
-
|
|
9345
|
+
appendToLogs(t2) {
|
|
9346
|
+
this.logs.append(K$4({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), log: t2 }));
|
|
9347
|
+
const r2 = typeof t2 == "string" ? JSON.parse(t2).level : t2.level;
|
|
9348
|
+
r2 >= this.levelValue && this.forwardToConsole(t2, r2);
|
|
9663
9349
|
}
|
|
9664
9350
|
getLogs() {
|
|
9665
9351
|
return this.logs;
|
|
9666
9352
|
}
|
|
9667
9353
|
clearLogs() {
|
|
9668
|
-
this.logs = new
|
|
9354
|
+
this.logs = new q$1(this.MAX_LOG_SIZE_IN_BYTES);
|
|
9669
9355
|
}
|
|
9670
9356
|
getLogArray() {
|
|
9671
9357
|
return Array.from(this.logs);
|
|
9672
9358
|
}
|
|
9673
|
-
logsToBlob(
|
|
9674
|
-
const
|
|
9675
|
-
return
|
|
9359
|
+
logsToBlob(t2) {
|
|
9360
|
+
const r2 = this.getLogArray();
|
|
9361
|
+
return r2.push(K$4({ extraMetadata: t2 })), new Blob(r2, { type: "application/json" });
|
|
9676
9362
|
}
|
|
9677
9363
|
};
|
|
9678
|
-
var
|
|
9679
|
-
let
|
|
9680
|
-
constructor(
|
|
9681
|
-
|
|
9364
|
+
var Ce$3 = Object.defineProperty, Ie$4 = (e2, t2, r2) => t2 in e2 ? Ce$3(e2, t2, { enumerable: true, configurable: true, writable: true, value: r2 }) : e2[t2] = r2, Te$4 = (e2, t2, r2) => Ie$4(e2, t2 + "", r2);
|
|
9365
|
+
let xe$2 = class xe {
|
|
9366
|
+
constructor(t2, r2 = I$1) {
|
|
9367
|
+
Te$4(this, "baseChunkLogger"), this.baseChunkLogger = new J$5(t2, r2);
|
|
9682
9368
|
}
|
|
9683
|
-
write(
|
|
9684
|
-
this.baseChunkLogger.appendToLogs(
|
|
9369
|
+
write(t2) {
|
|
9370
|
+
this.baseChunkLogger.appendToLogs(t2);
|
|
9685
9371
|
}
|
|
9686
9372
|
getLogs() {
|
|
9687
9373
|
return this.baseChunkLogger.getLogs();
|
|
@@ -9692,21 +9378,21 @@ let E$3 = class E {
|
|
|
9692
9378
|
getLogArray() {
|
|
9693
9379
|
return this.baseChunkLogger.getLogArray();
|
|
9694
9380
|
}
|
|
9695
|
-
logsToBlob(
|
|
9696
|
-
return this.baseChunkLogger.logsToBlob(
|
|
9381
|
+
logsToBlob(t2) {
|
|
9382
|
+
return this.baseChunkLogger.logsToBlob(t2);
|
|
9697
9383
|
}
|
|
9698
|
-
downloadLogsBlobInBrowser(
|
|
9699
|
-
const
|
|
9700
|
-
|
|
9384
|
+
downloadLogsBlobInBrowser(t2) {
|
|
9385
|
+
const r2 = URL.createObjectURL(this.logsToBlob(t2)), s2 = document.createElement("a");
|
|
9386
|
+
s2.href = r2, s2.download = `walletconnect-logs-${(/* @__PURE__ */ new Date()).toISOString()}.txt`, document.body.appendChild(s2), s2.click(), document.body.removeChild(s2), URL.revokeObjectURL(r2);
|
|
9701
9387
|
}
|
|
9702
9388
|
};
|
|
9703
|
-
var
|
|
9704
|
-
let
|
|
9705
|
-
constructor(
|
|
9706
|
-
|
|
9389
|
+
var Be$4 = Object.defineProperty, Ae$3 = (e2, t2, r2) => t2 in e2 ? Be$4(e2, t2, { enumerable: true, configurable: true, writable: true, value: r2 }) : e2[t2] = r2, Pe$4 = (e2, t2, r2) => Ae$3(e2, t2 + "", r2);
|
|
9390
|
+
let Ve$4 = class Ve {
|
|
9391
|
+
constructor(t2, r2 = I$1) {
|
|
9392
|
+
Pe$4(this, "baseChunkLogger"), this.baseChunkLogger = new J$5(t2, r2);
|
|
9707
9393
|
}
|
|
9708
|
-
write(
|
|
9709
|
-
this.baseChunkLogger.appendToLogs(
|
|
9394
|
+
write(t2) {
|
|
9395
|
+
this.baseChunkLogger.appendToLogs(t2);
|
|
9710
9396
|
}
|
|
9711
9397
|
getLogs() {
|
|
9712
9398
|
return this.baseChunkLogger.getLogs();
|
|
@@ -9717,44 +9403,44 @@ let j$4 = class j {
|
|
|
9717
9403
|
getLogArray() {
|
|
9718
9404
|
return this.baseChunkLogger.getLogArray();
|
|
9719
9405
|
}
|
|
9720
|
-
logsToBlob(
|
|
9721
|
-
return this.baseChunkLogger.logsToBlob(
|
|
9406
|
+
logsToBlob(t2) {
|
|
9407
|
+
return this.baseChunkLogger.logsToBlob(t2);
|
|
9722
9408
|
}
|
|
9723
9409
|
};
|
|
9724
|
-
var
|
|
9725
|
-
for (var
|
|
9726
|
-
if (
|
|
9727
|
-
return
|
|
9728
|
-
},
|
|
9729
|
-
function
|
|
9730
|
-
return
|
|
9410
|
+
var Ne$2 = Object.defineProperty, $e$4 = Object.defineProperties, Fe$3 = Object.getOwnPropertyDescriptors, H$2 = Object.getOwnPropertySymbols, Me$5 = Object.prototype.hasOwnProperty, De$4 = Object.prototype.propertyIsEnumerable, W$4 = (e2, t2, r2) => t2 in e2 ? Ne$2(e2, t2, { enumerable: true, configurable: true, writable: true, value: r2 }) : e2[t2] = r2, x$3 = (e2, t2) => {
|
|
9411
|
+
for (var r2 in t2 || (t2 = {})) Me$5.call(t2, r2) && W$4(e2, r2, t2[r2]);
|
|
9412
|
+
if (H$2) for (var r2 of H$2(t2)) De$4.call(t2, r2) && W$4(e2, r2, t2[r2]);
|
|
9413
|
+
return e2;
|
|
9414
|
+
}, B$1 = (e2, t2) => $e$4(e2, Fe$3(t2));
|
|
9415
|
+
function Ge$5(e2) {
|
|
9416
|
+
return B$1(x$3({}, e2), { level: e2?.level || Z$1.level });
|
|
9731
9417
|
}
|
|
9732
|
-
function
|
|
9733
|
-
return r2
|
|
9418
|
+
function Q$2(e2, t2, r2 = S$3) {
|
|
9419
|
+
return e2[r2] = t2, e2;
|
|
9734
9420
|
}
|
|
9735
|
-
function
|
|
9736
|
-
return
|
|
9421
|
+
function ee$3(e2, t2 = S$3) {
|
|
9422
|
+
return e2[t2] || "";
|
|
9737
9423
|
}
|
|
9738
|
-
function
|
|
9739
|
-
const
|
|
9740
|
-
return
|
|
9424
|
+
function te$3(e2, t2, r2 = S$3) {
|
|
9425
|
+
const s2 = ee$3(e2, r2);
|
|
9426
|
+
return s2.trim() ? `${s2}/${t2}` : t2;
|
|
9741
9427
|
}
|
|
9742
|
-
function
|
|
9743
|
-
const
|
|
9744
|
-
return
|
|
9428
|
+
function Re$3(e2, t2, r2 = S$3) {
|
|
9429
|
+
const s2 = te$3(e2, t2, r2), i3 = e2.child({ context: s2 });
|
|
9430
|
+
return Q$2(i3, s2, r2);
|
|
9745
9431
|
}
|
|
9746
|
-
function
|
|
9747
|
-
var
|
|
9748
|
-
const
|
|
9749
|
-
return { logger:
|
|
9432
|
+
function re$2(e2) {
|
|
9433
|
+
var t2, r2;
|
|
9434
|
+
const s2 = new xe$2((t2 = e2.opts) == null ? void 0 : t2.level, e2.maxSizeInBytes);
|
|
9435
|
+
return { logger: b$4.exports(B$1(x$3({}, e2.opts), { level: "trace", browser: B$1(x$3({}, (r2 = e2.opts) == null ? void 0 : r2.browser), { write: (i3) => s2.write(i3) }) })), chunkLoggerController: s2 };
|
|
9750
9436
|
}
|
|
9751
|
-
function
|
|
9752
|
-
var
|
|
9753
|
-
const
|
|
9754
|
-
return { logger:
|
|
9437
|
+
function ne$2(e2) {
|
|
9438
|
+
var t2;
|
|
9439
|
+
const r2 = new Ve$4((t2 = e2.opts) == null ? void 0 : t2.level, e2.maxSizeInBytes);
|
|
9440
|
+
return { logger: b$4.exports(B$1(x$3({}, e2.opts), { level: "trace" }), r2), chunkLoggerController: r2 };
|
|
9755
9441
|
}
|
|
9756
|
-
function
|
|
9757
|
-
return typeof
|
|
9442
|
+
function Ue$5(e2) {
|
|
9443
|
+
return typeof e2.loggerOverride < "u" && typeof e2.loggerOverride != "string" ? { logger: e2.loggerOverride, chunkLoggerController: null } : typeof window < "u" ? re$2(e2) : ne$2(e2);
|
|
9758
9444
|
}
|
|
9759
9445
|
var a = Object.defineProperty, u = (e2, s2, r2) => s2 in e2 ? a(e2, s2, { enumerable: true, configurable: true, writable: true, value: r2 }) : e2[s2] = r2, c$3 = (e2, s2, r2) => u(e2, typeof s2 != "symbol" ? s2 + "" : s2, r2);
|
|
9760
9446
|
let h$2 = class h2 extends IEvents {
|
|
@@ -9784,7 +9470,7 @@ let d$4 = class d extends IEvents {
|
|
|
9784
9470
|
}
|
|
9785
9471
|
};
|
|
9786
9472
|
let f$3 = class f {
|
|
9787
|
-
constructor(s2, r2, t2,
|
|
9473
|
+
constructor(s2, r2, t2, q3) {
|
|
9788
9474
|
this.core = s2, this.logger = r2, this.name = t2;
|
|
9789
9475
|
}
|
|
9790
9476
|
};
|
|
@@ -9793,7 +9479,7 @@ let P$3 = class P extends IEvents {
|
|
|
9793
9479
|
super(), this.relayer = s2, this.logger = r2;
|
|
9794
9480
|
}
|
|
9795
9481
|
};
|
|
9796
|
-
let S$2 = class
|
|
9482
|
+
let S$2 = class S extends IEvents {
|
|
9797
9483
|
constructor(s2, r2) {
|
|
9798
9484
|
super(), this.core = s2, this.logger = r2;
|
|
9799
9485
|
}
|
|
@@ -9814,7 +9500,7 @@ let R$1 = class R {
|
|
|
9814
9500
|
}
|
|
9815
9501
|
};
|
|
9816
9502
|
var T$2 = Object.defineProperty, k$1 = (e2, s2, r2) => s2 in e2 ? T$2(e2, s2, { enumerable: true, configurable: true, writable: true, value: r2 }) : e2[s2] = r2, i2 = (e2, s2, r2) => k$1(e2, typeof s2 != "symbol" ? s2 + "" : s2, r2);
|
|
9817
|
-
let J$4 = class
|
|
9503
|
+
let J$4 = class J2 {
|
|
9818
9504
|
constructor(s2) {
|
|
9819
9505
|
this.opts = s2, i2(this, "protocol", "wc"), i2(this, "version", 2);
|
|
9820
9506
|
}
|
|
@@ -9937,26 +9623,26 @@ let Jn$2 = class Jn extends An$2 {
|
|
|
9937
9623
|
super(128, 64, 16, false), this.Ah = 1779033703, this.Al = -205731576, this.Bh = -1150833019, this.Bl = -2067093701, this.Ch = 1013904242, this.Cl = -23791573, this.Dh = -1521486534, this.Dl = 1595750129, this.Eh = 1359893119, this.El = -1377402159, this.Fh = -1694144372, this.Fl = 725511199, this.Gh = 528734635, this.Gl = -79577749, this.Hh = 1541459225, this.Hl = 327033209;
|
|
9938
9624
|
}
|
|
9939
9625
|
get() {
|
|
9940
|
-
const { Ah: e2, Al: n3, Bh: r2, Bl: o3, Ch: s2, Cl: a2, Dh: u2, Dl: i3, Eh: D2, El: c2, Fh: l2, Fl: p2, Gh: w2, Gl: h4, Hh: g2, Hl:
|
|
9941
|
-
return [e2, n3, r2, o3, s2, a2, u2, i3, D2, c2, l2, p2, w2, h4, g2,
|
|
9626
|
+
const { Ah: e2, Al: n3, Bh: r2, Bl: o3, Ch: s2, Cl: a2, Dh: u2, Dl: i3, Eh: D2, El: c2, Fh: l2, Fl: p2, Gh: w2, Gl: h4, Hh: g2, Hl: S3 } = this;
|
|
9627
|
+
return [e2, n3, r2, o3, s2, a2, u2, i3, D2, c2, l2, p2, w2, h4, g2, S3];
|
|
9942
9628
|
}
|
|
9943
|
-
set(e2, n3, r2, o3, s2, a2, u2, i3, D2, c2, l2, p2, w2, h4, g2,
|
|
9944
|
-
this.Ah = e2 | 0, this.Al = n3 | 0, this.Bh = r2 | 0, this.Bl = o3 | 0, this.Ch = s2 | 0, this.Cl = a2 | 0, this.Dh = u2 | 0, this.Dl = i3 | 0, this.Eh = D2 | 0, this.El = c2 | 0, this.Fh = l2 | 0, this.Fl = p2 | 0, this.Gh = w2 | 0, this.Gl = h4 | 0, this.Hh = g2 | 0, this.Hl =
|
|
9629
|
+
set(e2, n3, r2, o3, s2, a2, u2, i3, D2, c2, l2, p2, w2, h4, g2, S3) {
|
|
9630
|
+
this.Ah = e2 | 0, this.Al = n3 | 0, this.Bh = r2 | 0, this.Bl = o3 | 0, this.Ch = s2 | 0, this.Cl = a2 | 0, this.Dh = u2 | 0, this.Dl = i3 | 0, this.Eh = D2 | 0, this.El = c2 | 0, this.Fh = l2 | 0, this.Fl = p2 | 0, this.Gh = w2 | 0, this.Gl = h4 | 0, this.Hh = g2 | 0, this.Hl = S3 | 0;
|
|
9945
9631
|
}
|
|
9946
9632
|
process(e2, n3) {
|
|
9947
9633
|
for (let d3 = 0; d3 < 16; d3++, n3 += 4) P$2[d3] = e2.getUint32(n3), Q$1[d3] = e2.getUint32(n3 += 4);
|
|
9948
9634
|
for (let d3 = 16; d3 < 80; d3++) {
|
|
9949
|
-
const m3 = P$2[d3 - 15] | 0, F2 = Q$1[d3 - 15] | 0,
|
|
9635
|
+
const m3 = P$2[d3 - 15] | 0, F2 = Q$1[d3 - 15] | 0, q3 = x$2.rotrSH(m3, F2, 1) ^ x$2.rotrSH(m3, F2, 8) ^ x$2.shrSH(m3, F2, 7), z2 = x$2.rotrSL(m3, F2, 1) ^ x$2.rotrSL(m3, F2, 8) ^ x$2.shrSL(m3, F2, 7), I2 = P$2[d3 - 2] | 0, O3 = Q$1[d3 - 2] | 0, ot2 = x$2.rotrSH(I2, O3, 19) ^ x$2.rotrBH(I2, O3, 61) ^ x$2.shrSH(I2, O3, 6), tt2 = x$2.rotrSL(I2, O3, 19) ^ x$2.rotrBL(I2, O3, 61) ^ x$2.shrSL(I2, O3, 6), st2 = x$2.add4L(z2, tt2, Q$1[d3 - 7], Q$1[d3 - 16]), at2 = x$2.add4H(st2, q3, ot2, P$2[d3 - 7], P$2[d3 - 16]);
|
|
9950
9636
|
P$2[d3] = at2 | 0, Q$1[d3] = st2 | 0;
|
|
9951
9637
|
}
|
|
9952
|
-
let { Ah: r2, Al: o3, Bh: s2, Bl: a2, Ch: u2, Cl: i3, Dh: D2, Dl: c2, Eh: l2, El: p2, Fh: w2, Fl: h4, Gh: g2, Gl:
|
|
9638
|
+
let { Ah: r2, Al: o3, Bh: s2, Bl: a2, Ch: u2, Cl: i3, Dh: D2, Dl: c2, Eh: l2, El: p2, Fh: w2, Fl: h4, Gh: g2, Gl: S3, Hh: v2, Hl: L2 } = this;
|
|
9953
9639
|
for (let d3 = 0; d3 < 80; d3++) {
|
|
9954
|
-
const m3 = x$2.rotrSH(l2, p2, 14) ^ x$2.rotrSH(l2, p2, 18) ^ x$2.rotrBH(l2, p2, 41), F2 = x$2.rotrSL(l2, p2, 14) ^ x$2.rotrSL(l2, p2, 18) ^ x$2.rotrBL(l2, p2, 41),
|
|
9955
|
-
|
|
9640
|
+
const m3 = x$2.rotrSH(l2, p2, 14) ^ x$2.rotrSH(l2, p2, 18) ^ x$2.rotrBH(l2, p2, 41), F2 = x$2.rotrSL(l2, p2, 14) ^ x$2.rotrSL(l2, p2, 18) ^ x$2.rotrBL(l2, p2, 41), q3 = l2 & w2 ^ ~l2 & g2, z2 = p2 & h4 ^ ~p2 & S3, I2 = x$2.add5L(L2, F2, z2, Yn$2[d3], Q$1[d3]), O3 = x$2.add5H(I2, v2, m3, q3, Vn$2[d3], P$2[d3]), ot2 = I2 | 0, tt2 = x$2.rotrSH(r2, o3, 28) ^ x$2.rotrBH(r2, o3, 34) ^ x$2.rotrBH(r2, o3, 39), st2 = x$2.rotrSL(r2, o3, 28) ^ x$2.rotrBL(r2, o3, 34) ^ x$2.rotrBL(r2, o3, 39), at2 = r2 & s2 ^ r2 & u2 ^ s2 & u2, Ct2 = o3 & a2 ^ o3 & i3 ^ a2 & i3;
|
|
9641
|
+
v2 = g2 | 0, L2 = S3 | 0, g2 = w2 | 0, S3 = h4 | 0, w2 = l2 | 0, h4 = p2 | 0, { h: l2, l: p2 } = x$2.add(D2 | 0, c2 | 0, O3 | 0, ot2 | 0), D2 = u2 | 0, c2 = i3 | 0, u2 = s2 | 0, i3 = a2 | 0, s2 = r2 | 0, a2 = o3 | 0;
|
|
9956
9642
|
const At2 = x$2.add3L(ot2, st2, Ct2);
|
|
9957
9643
|
r2 = x$2.add3H(At2, O3, tt2, at2), o3 = At2 | 0;
|
|
9958
9644
|
}
|
|
9959
|
-
({ h: r2, l: o3 } = x$2.add(this.Ah | 0, this.Al | 0, r2 | 0, o3 | 0)), { h: s2, l: a2 } = x$2.add(this.Bh | 0, this.Bl | 0, s2 | 0, a2 | 0), { h: u2, l: i3 } = x$2.add(this.Ch | 0, this.Cl | 0, u2 | 0, i3 | 0), { h: D2, l: c2 } = x$2.add(this.Dh | 0, this.Dl | 0, D2 | 0, c2 | 0), { h: l2, l: p2 } = x$2.add(this.Eh | 0, this.El | 0, l2 | 0, p2 | 0), { h: w2, l: h4 } = x$2.add(this.Fh | 0, this.Fl | 0, w2 | 0, h4 | 0), { h: g2, l:
|
|
9645
|
+
({ h: r2, l: o3 } = x$2.add(this.Ah | 0, this.Al | 0, r2 | 0, o3 | 0)), { h: s2, l: a2 } = x$2.add(this.Bh | 0, this.Bl | 0, s2 | 0, a2 | 0), { h: u2, l: i3 } = x$2.add(this.Ch | 0, this.Cl | 0, u2 | 0, i3 | 0), { h: D2, l: c2 } = x$2.add(this.Dh | 0, this.Dl | 0, D2 | 0, c2 | 0), { h: l2, l: p2 } = x$2.add(this.Eh | 0, this.El | 0, l2 | 0, p2 | 0), { h: w2, l: h4 } = x$2.add(this.Fh | 0, this.Fl | 0, w2 | 0, h4 | 0), { h: g2, l: S3 } = x$2.add(this.Gh | 0, this.Gl | 0, g2 | 0, S3 | 0), { h: v2, l: L2 } = x$2.add(this.Hh | 0, this.Hl | 0, v2 | 0, L2 | 0), this.set(r2, o3, s2, a2, u2, i3, D2, c2, l2, p2, w2, h4, g2, S3, v2, L2);
|
|
9960
9646
|
}
|
|
9961
9647
|
roundClean() {
|
|
9962
9648
|
P$2.fill(0), Q$1.fill(0);
|
|
@@ -10243,8 +9929,8 @@ function lr$2(t2, e2) {
|
|
|
10243
9929
|
const w2 = p2 * a2;
|
|
10244
9930
|
let h4 = Number(o3 & D2);
|
|
10245
9931
|
o3 >>= l2, h4 > a2 && (h4 -= c2, o3 += gt$3);
|
|
10246
|
-
const g2 = w2,
|
|
10247
|
-
h4 === 0 ? i3 = i3.add(zt$3(
|
|
9932
|
+
const g2 = w2, S3 = w2 + Math.abs(h4) - 1, v2 = p2 % 2 !== 0, L2 = h4 < 0;
|
|
9933
|
+
h4 === 0 ? i3 = i3.add(zt$3(v2, r2[g2])) : u2 = u2.add(zt$3(L2, r2[S3]));
|
|
10248
9934
|
}
|
|
10249
9935
|
return { p: u2, f: i3 };
|
|
10250
9936
|
}, wNAFUnsafe(n3, r2, o3, s2 = t2.ZERO) {
|
|
@@ -10309,28 +9995,28 @@ function yr$2(t2) {
|
|
|
10309
9995
|
function g2(y3, f4) {
|
|
10310
9996
|
ft$3("coordinate " + y3, f4, G$2, D2);
|
|
10311
9997
|
}
|
|
10312
|
-
function
|
|
9998
|
+
function S3(y3) {
|
|
10313
9999
|
if (!(y3 instanceof d3)) throw new Error("ExtendedPoint expected");
|
|
10314
10000
|
}
|
|
10315
|
-
const
|
|
10316
|
-
const { ex: b2, ey:
|
|
10001
|
+
const v2 = xe$1((y3, f4) => {
|
|
10002
|
+
const { ex: b2, ey: E2, ez: B2 } = y3, C2 = y3.is0();
|
|
10317
10003
|
f4 == null && (f4 = C2 ? wr$2 : n3.inv(B2));
|
|
10318
|
-
const A2 = c2(b2 * f4), U2 = c2(
|
|
10004
|
+
const A2 = c2(b2 * f4), U2 = c2(E2 * f4), _3 = c2(B2 * f4);
|
|
10319
10005
|
if (C2) return { x: G$2, y: j$3 };
|
|
10320
10006
|
if (_3 !== j$3) throw new Error("invZ was invalid");
|
|
10321
10007
|
return { x: A2, y: U2 };
|
|
10322
|
-
}),
|
|
10008
|
+
}), L2 = xe$1((y3) => {
|
|
10323
10009
|
const { a: f4, d: b2 } = e2;
|
|
10324
10010
|
if (y3.is0()) throw new Error("bad point: ZERO");
|
|
10325
|
-
const { ex:
|
|
10011
|
+
const { ex: E2, ey: B2, ez: C2, et: A2 } = y3, U2 = c2(E2 * E2), _3 = c2(B2 * B2), T2 = c2(C2 * C2), $2 = c2(T2 * T2), R3 = c2(U2 * f4), V3 = c2(T2 * c2(R3 + _3)), Y2 = c2($2 + c2(b2 * c2(U2 * _3)));
|
|
10326
10012
|
if (V3 !== Y2) throw new Error("bad point: equation left != right (1)");
|
|
10327
|
-
const Z2 = c2(
|
|
10013
|
+
const Z2 = c2(E2 * B2), X2 = c2(C2 * A2);
|
|
10328
10014
|
if (Z2 !== X2) throw new Error("bad point: equation left != right (2)");
|
|
10329
10015
|
return true;
|
|
10330
10016
|
});
|
|
10331
10017
|
class d3 {
|
|
10332
|
-
constructor(f4, b2,
|
|
10333
|
-
this.ex = f4, this.ey = b2, this.ez =
|
|
10018
|
+
constructor(f4, b2, E2, B2) {
|
|
10019
|
+
this.ex = f4, this.ey = b2, this.ez = E2, this.et = B2, g2("x", f4), g2("y", b2), g2("z", E2), g2("t", B2), Object.freeze(this);
|
|
10334
10020
|
}
|
|
10335
10021
|
get x() {
|
|
10336
10022
|
return this.toAffine().x;
|
|
@@ -10340,25 +10026,25 @@ function yr$2(t2) {
|
|
|
10340
10026
|
}
|
|
10341
10027
|
static fromAffine(f4) {
|
|
10342
10028
|
if (f4 instanceof d3) throw new Error("extended point not allowed");
|
|
10343
|
-
const { x: b2, y:
|
|
10344
|
-
return g2("x", b2), g2("y",
|
|
10029
|
+
const { x: b2, y: E2 } = f4 || {};
|
|
10030
|
+
return g2("x", b2), g2("y", E2), new d3(b2, E2, j$3, c2(b2 * E2));
|
|
10345
10031
|
}
|
|
10346
10032
|
static normalizeZ(f4) {
|
|
10347
|
-
const b2 = n3.invertBatch(f4.map((
|
|
10348
|
-
return f4.map((
|
|
10033
|
+
const b2 = n3.invertBatch(f4.map((E2) => E2.ez));
|
|
10034
|
+
return f4.map((E2, B2) => E2.toAffine(b2[B2])).map(d3.fromAffine);
|
|
10349
10035
|
}
|
|
10350
10036
|
static msm(f4, b2) {
|
|
10351
10037
|
return br$2(d3, l2, f4, b2);
|
|
10352
10038
|
}
|
|
10353
10039
|
_setWindowSize(f4) {
|
|
10354
|
-
|
|
10040
|
+
q3.setWindowSize(this, f4);
|
|
10355
10041
|
}
|
|
10356
10042
|
assertValidity() {
|
|
10357
|
-
|
|
10043
|
+
L2(this);
|
|
10358
10044
|
}
|
|
10359
10045
|
equals(f4) {
|
|
10360
|
-
|
|
10361
|
-
const { ex: b2, ey:
|
|
10046
|
+
S3(f4);
|
|
10047
|
+
const { ex: b2, ey: E2, ez: B2 } = this, { ex: C2, ey: A2, ez: U2 } = f4, _3 = c2(b2 * U2), T2 = c2(C2 * B2), $2 = c2(E2 * U2), R3 = c2(A2 * B2);
|
|
10362
10048
|
return _3 === T2 && $2 === R3;
|
|
10363
10049
|
}
|
|
10364
10050
|
is0() {
|
|
@@ -10368,58 +10054,58 @@ function yr$2(t2) {
|
|
|
10368
10054
|
return new d3(c2(-this.ex), this.ey, this.ez, c2(-this.et));
|
|
10369
10055
|
}
|
|
10370
10056
|
double() {
|
|
10371
|
-
const { a: f4 } = e2, { ex: b2, ey:
|
|
10057
|
+
const { a: f4 } = e2, { ex: b2, ey: E2, ez: B2 } = this, C2 = c2(b2 * b2), A2 = c2(E2 * E2), U2 = c2(yt$3 * c2(B2 * B2)), _3 = c2(f4 * C2), T2 = b2 + E2, $2 = c2(c2(T2 * T2) - C2 - A2), R3 = _3 + A2, V3 = R3 - U2, Y2 = _3 - A2, Z2 = c2($2 * V3), X2 = c2(R3 * Y2), et2 = c2($2 * Y2), pt2 = c2(V3 * R3);
|
|
10372
10058
|
return new d3(Z2, X2, pt2, et2);
|
|
10373
10059
|
}
|
|
10374
10060
|
add(f4) {
|
|
10375
|
-
|
|
10376
|
-
const { a: b2, d:
|
|
10061
|
+
S3(f4);
|
|
10062
|
+
const { a: b2, d: E2 } = e2, { ex: B2, ey: C2, ez: A2, et: U2 } = this, { ex: _3, ey: T2, ez: $2, et: R3 } = f4;
|
|
10377
10063
|
if (b2 === BigInt(-1)) {
|
|
10378
10064
|
const re2 = c2((C2 - B2) * (T2 + _3)), oe2 = c2((C2 + B2) * (T2 - _3)), mt2 = c2(oe2 - re2);
|
|
10379
10065
|
if (mt2 === G$2) return this.double();
|
|
10380
10066
|
const se2 = c2(A2 * yt$3 * R3), ie2 = c2(U2 * yt$3 * $2), ue2 = ie2 + se2, ce2 = oe2 + re2, ae2 = ie2 - se2, Dn2 = c2(ue2 * mt2), dn3 = c2(ce2 * ae2), hn2 = c2(ue2 * ae2), ln2 = c2(mt2 * ce2);
|
|
10381
10067
|
return new d3(Dn2, dn3, ln2, hn2);
|
|
10382
10068
|
}
|
|
10383
|
-
const V3 = c2(B2 * _3), Y2 = c2(C2 * T2), Z2 = c2(U2 *
|
|
10069
|
+
const V3 = c2(B2 * _3), Y2 = c2(C2 * T2), Z2 = c2(U2 * E2 * R3), X2 = c2(A2 * $2), et2 = c2((B2 + C2) * (_3 + T2) - V3 - Y2), pt2 = X2 - Z2, ee2 = X2 + Z2, ne2 = c2(Y2 - b2 * V3), un2 = c2(et2 * pt2), cn2 = c2(ee2 * ne2), an2 = c2(et2 * ne2), fn2 = c2(pt2 * ee2);
|
|
10384
10070
|
return new d3(un2, cn2, fn2, an2);
|
|
10385
10071
|
}
|
|
10386
10072
|
subtract(f4) {
|
|
10387
10073
|
return this.add(f4.negate());
|
|
10388
10074
|
}
|
|
10389
10075
|
wNAF(f4) {
|
|
10390
|
-
return
|
|
10076
|
+
return q3.wNAFCached(this, f4, d3.normalizeZ);
|
|
10391
10077
|
}
|
|
10392
10078
|
multiply(f4) {
|
|
10393
10079
|
const b2 = f4;
|
|
10394
10080
|
ft$3("scalar", b2, j$3, r2);
|
|
10395
|
-
const { p:
|
|
10396
|
-
return d3.normalizeZ([
|
|
10081
|
+
const { p: E2, f: B2 } = this.wNAF(b2);
|
|
10082
|
+
return d3.normalizeZ([E2, B2])[0];
|
|
10397
10083
|
}
|
|
10398
10084
|
multiplyUnsafe(f4, b2 = d3.ZERO) {
|
|
10399
|
-
const
|
|
10400
|
-
return ft$3("scalar",
|
|
10085
|
+
const E2 = f4;
|
|
10086
|
+
return ft$3("scalar", E2, G$2, r2), E2 === G$2 ? F2 : this.is0() || E2 === j$3 ? this : q3.wNAFCachedUnsafe(this, E2, d3.normalizeZ, b2);
|
|
10401
10087
|
}
|
|
10402
10088
|
isSmallOrder() {
|
|
10403
10089
|
return this.multiplyUnsafe(i3).is0();
|
|
10404
10090
|
}
|
|
10405
10091
|
isTorsionFree() {
|
|
10406
|
-
return
|
|
10092
|
+
return q3.unsafeLadder(this, r2).is0();
|
|
10407
10093
|
}
|
|
10408
10094
|
toAffine(f4) {
|
|
10409
|
-
return
|
|
10095
|
+
return v2(this, f4);
|
|
10410
10096
|
}
|
|
10411
10097
|
clearCofactor() {
|
|
10412
10098
|
const { h: f4 } = e2;
|
|
10413
10099
|
return f4 === j$3 ? this : this.multiplyUnsafe(f4);
|
|
10414
10100
|
}
|
|
10415
10101
|
static fromHex(f4, b2 = false) {
|
|
10416
|
-
const { d:
|
|
10102
|
+
const { d: E2, a: B2 } = e2, C2 = n3.BYTES;
|
|
10417
10103
|
f4 = W$3("pointHex", f4, C2), Tt$3("zip215", b2);
|
|
10418
10104
|
const A2 = f4.slice(), U2 = f4[C2 - 1];
|
|
10419
10105
|
A2[C2 - 1] = U2 & -129;
|
|
10420
10106
|
const _3 = Et$4(A2), T2 = b2 ? D2 : n3.ORDER;
|
|
10421
10107
|
ft$3("pointHex.y", _3, G$2, T2);
|
|
10422
|
-
const $2 = c2(_3 * _3), R3 = c2($2 - j$3), V3 = c2(
|
|
10108
|
+
const $2 = c2(_3 * _3), R3 = c2($2 - j$3), V3 = c2(E2 * $2 - B2);
|
|
10423
10109
|
let { isValid: Y2, value: Z2 } = p2(R3, V3);
|
|
10424
10110
|
if (!Y2) throw new Error("Point.fromHex: invalid y coordinate");
|
|
10425
10111
|
const X2 = (Z2 & j$3) === j$3, et2 = (U2 & 128) !== 0;
|
|
@@ -10430,15 +10116,15 @@ function yr$2(t2) {
|
|
|
10430
10116
|
return O3(f4).point;
|
|
10431
10117
|
}
|
|
10432
10118
|
toRawBytes() {
|
|
10433
|
-
const { x: f4, y: b2 } = this.toAffine(),
|
|
10434
|
-
return
|
|
10119
|
+
const { x: f4, y: b2 } = this.toAffine(), E2 = Nt$3(b2, n3.BYTES);
|
|
10120
|
+
return E2[E2.length - 1] |= f4 & j$3 ? 128 : 0, E2;
|
|
10435
10121
|
}
|
|
10436
10122
|
toHex() {
|
|
10437
10123
|
return Ft$3(this.toRawBytes());
|
|
10438
10124
|
}
|
|
10439
10125
|
}
|
|
10440
10126
|
d3.BASE = new d3(e2.Gx, e2.Gy, j$3, c2(e2.Gx * e2.Gy)), d3.ZERO = new d3(G$2, j$3, j$3, G$2);
|
|
10441
|
-
const { BASE: m3, ZERO: F2 } = d3,
|
|
10127
|
+
const { BASE: m3, ZERO: F2 } = d3, q3 = lr$2(d3, u2 * 8);
|
|
10442
10128
|
function z2(y3) {
|
|
10443
10129
|
return H$1(y3, r2);
|
|
10444
10130
|
}
|
|
@@ -10448,8 +10134,8 @@ function yr$2(t2) {
|
|
|
10448
10134
|
function O3(y3) {
|
|
10449
10135
|
const f4 = n3.BYTES;
|
|
10450
10136
|
y3 = W$3("private key", y3, f4);
|
|
10451
|
-
const b2 = W$3("hashed private key", s2(y3), 2 * f4),
|
|
10452
|
-
return { head:
|
|
10137
|
+
const b2 = W$3("hashed private key", s2(y3), 2 * f4), E2 = w2(b2.slice(0, f4)), B2 = b2.slice(f4, 2 * f4), C2 = I2(E2), A2 = m3.multiply(C2), U2 = A2.toRawBytes();
|
|
10138
|
+
return { head: E2, prefix: B2, scalar: C2, point: A2, pointBytes: U2 };
|
|
10453
10139
|
}
|
|
10454
10140
|
function ot2(y3) {
|
|
10455
10141
|
return O3(y3).pointBytes;
|
|
@@ -10460,14 +10146,14 @@ function yr$2(t2) {
|
|
|
10460
10146
|
}
|
|
10461
10147
|
function st2(y3, f4, b2 = {}) {
|
|
10462
10148
|
y3 = W$3("message", y3), o3 && (y3 = o3(y3));
|
|
10463
|
-
const { prefix:
|
|
10149
|
+
const { prefix: E2, scalar: B2, pointBytes: C2 } = O3(f4), A2 = tt2(b2.context, E2, y3), U2 = m3.multiply(A2).toRawBytes(), _3 = tt2(b2.context, U2, C2, y3), T2 = z2(A2 + _3 * B2);
|
|
10464
10150
|
ft$3("signature.s", T2, G$2, r2);
|
|
10465
10151
|
const $2 = ye$3(U2, Nt$3(T2, n3.BYTES));
|
|
10466
10152
|
return W$3("result", $2, n3.BYTES * 2);
|
|
10467
10153
|
}
|
|
10468
10154
|
const at2 = Er$1;
|
|
10469
|
-
function Ct2(y3, f4, b2,
|
|
10470
|
-
const { context: B2, zip215: C2 } =
|
|
10155
|
+
function Ct2(y3, f4, b2, E2 = at2) {
|
|
10156
|
+
const { context: B2, zip215: C2 } = E2, A2 = n3.BYTES;
|
|
10471
10157
|
y3 = W$3("signature", y3, 2 * A2), f4 = W$3("message", f4), b2 = W$3("publicKey", b2, A2), C2 !== void 0 && Tt$3("zip215", C2), o3 && (f4 = o3(f4));
|
|
10472
10158
|
const U2 = Et$4(y3.slice(A2, 2 * A2));
|
|
10473
10159
|
let _3, T2, $2;
|
|
@@ -10491,8 +10177,8 @@ const xr$1 = BigInt(1), Te$3 = BigInt(2);
|
|
|
10491
10177
|
BigInt(3);
|
|
10492
10178
|
const Br$2 = BigInt(5), Cr$2 = BigInt(8);
|
|
10493
10179
|
function Ar$2(t2) {
|
|
10494
|
-
const e2 = BigInt(10), n3 = BigInt(20), r2 = BigInt(40), o3 = BigInt(80), s2 = kt$3, u2 = t2 * t2 % s2 * t2 % s2, i3 = J$3(u2, Te$3, s2) * u2 % s2, D2 = J$3(i3, xr$1, s2) * t2 % s2, c2 = J$3(D2, Br$2, s2) * D2 % s2, l2 = J$3(c2, e2, s2) * c2 % s2, p2 = J$3(l2, n3, s2) * l2 % s2, w2 = J$3(p2, r2, s2) * p2 % s2, h4 = J$3(w2, o3, s2) * w2 % s2, g2 = J$3(h4, o3, s2) * w2 % s2,
|
|
10495
|
-
return { pow_p_5_8: J$3(
|
|
10180
|
+
const e2 = BigInt(10), n3 = BigInt(20), r2 = BigInt(40), o3 = BigInt(80), s2 = kt$3, u2 = t2 * t2 % s2 * t2 % s2, i3 = J$3(u2, Te$3, s2) * u2 % s2, D2 = J$3(i3, xr$1, s2) * t2 % s2, c2 = J$3(D2, Br$2, s2) * D2 % s2, l2 = J$3(c2, e2, s2) * c2 % s2, p2 = J$3(l2, n3, s2) * l2 % s2, w2 = J$3(p2, r2, s2) * p2 % s2, h4 = J$3(w2, o3, s2) * w2 % s2, g2 = J$3(h4, o3, s2) * w2 % s2, S3 = J$3(g2, e2, s2) * c2 % s2;
|
|
10181
|
+
return { pow_p_5_8: J$3(S3, Te$3, s2) * t2 % s2, b2: u2 };
|
|
10496
10182
|
}
|
|
10497
10183
|
function mr$2(t2) {
|
|
10498
10184
|
return t2[0] &= 248, t2[31] &= 127, t2[31] |= 64, t2;
|
|
@@ -10529,13 +10215,13 @@ function Ir$2(t2, e2) {
|
|
|
10529
10215
|
function l2(h4) {
|
|
10530
10216
|
if (h4 instanceof Uint8Array || (ArrayBuffer.isView(h4) ? h4 = new Uint8Array(h4.buffer, h4.byteOffset, h4.byteLength) : Array.isArray(h4) && (h4 = Uint8Array.from(h4))), !(h4 instanceof Uint8Array)) throw new TypeError("Expected Uint8Array");
|
|
10531
10217
|
if (h4.length === 0) return "";
|
|
10532
|
-
for (var g2 = 0,
|
|
10533
|
-
for (var d3 = (
|
|
10534
|
-
for (var F2 = h4[
|
|
10218
|
+
for (var g2 = 0, S3 = 0, v2 = 0, L2 = h4.length; v2 !== L2 && h4[v2] === 0; ) v2++, g2++;
|
|
10219
|
+
for (var d3 = (L2 - v2) * c2 + 1 >>> 0, m3 = new Uint8Array(d3); v2 !== L2; ) {
|
|
10220
|
+
for (var F2 = h4[v2], q3 = 0, z2 = d3 - 1; (F2 !== 0 || q3 < S3) && z2 !== -1; z2--, q3++) F2 += 256 * m3[z2] >>> 0, m3[z2] = F2 % u2 >>> 0, F2 = F2 / u2 >>> 0;
|
|
10535
10221
|
if (F2 !== 0) throw new Error("Non-zero carry");
|
|
10536
|
-
|
|
10222
|
+
S3 = q3, v2++;
|
|
10537
10223
|
}
|
|
10538
|
-
for (var I2 = d3 -
|
|
10224
|
+
for (var I2 = d3 - S3; I2 !== d3 && m3[I2] === 0; ) I2++;
|
|
10539
10225
|
for (var O3 = i3.repeat(g2); I2 < d3; ++I2) O3 += t2.charAt(m3[I2]);
|
|
10540
10226
|
return O3;
|
|
10541
10227
|
}
|
|
@@ -10544,17 +10230,17 @@ function Ir$2(t2, e2) {
|
|
|
10544
10230
|
if (h4.length === 0) return new Uint8Array();
|
|
10545
10231
|
var g2 = 0;
|
|
10546
10232
|
if (h4[g2] !== " ") {
|
|
10547
|
-
for (var
|
|
10548
|
-
for (var
|
|
10233
|
+
for (var S3 = 0, v2 = 0; h4[g2] === i3; ) S3++, g2++;
|
|
10234
|
+
for (var L2 = (h4.length - g2) * D2 + 1 >>> 0, d3 = new Uint8Array(L2); h4[g2]; ) {
|
|
10549
10235
|
var m3 = n3[h4.charCodeAt(g2)];
|
|
10550
10236
|
if (m3 === 255) return;
|
|
10551
|
-
for (var F2 = 0,
|
|
10237
|
+
for (var F2 = 0, q3 = L2 - 1; (m3 !== 0 || F2 < v2) && q3 !== -1; q3--, F2++) m3 += u2 * d3[q3] >>> 0, d3[q3] = m3 % 256 >>> 0, m3 = m3 / 256 >>> 0;
|
|
10552
10238
|
if (m3 !== 0) throw new Error("Non-zero carry");
|
|
10553
|
-
|
|
10239
|
+
v2 = F2, g2++;
|
|
10554
10240
|
}
|
|
10555
10241
|
if (h4[g2] !== " ") {
|
|
10556
|
-
for (var z2 =
|
|
10557
|
-
for (var I2 = new Uint8Array(
|
|
10242
|
+
for (var z2 = L2 - v2; z2 !== L2 && d3[z2] === 0; ) z2++;
|
|
10243
|
+
for (var I2 = new Uint8Array(S3 + (L2 - z2)), O3 = S3; z2 !== L2; ) I2[O3++] = d3[z2++];
|
|
10558
10244
|
return I2;
|
|
10559
10245
|
}
|
|
10560
10246
|
}
|
|
@@ -10938,12 +10624,12 @@ function detect(userAgent) {
|
|
|
10938
10624
|
}
|
|
10939
10625
|
function matchUserAgent(ua2) {
|
|
10940
10626
|
return ua2 !== "" && userAgentRules.reduce(function(matched, _a2) {
|
|
10941
|
-
var
|
|
10627
|
+
var browser = _a2[0], regex = _a2[1];
|
|
10942
10628
|
if (matched) {
|
|
10943
10629
|
return matched;
|
|
10944
10630
|
}
|
|
10945
10631
|
var uaMatch = regex.exec(ua2);
|
|
10946
|
-
return !!uaMatch && [
|
|
10632
|
+
return !!uaMatch && [browser, uaMatch];
|
|
10947
10633
|
}, false);
|
|
10948
10634
|
}
|
|
10949
10635
|
function parseUserAgent(ua2) {
|
|
@@ -11506,10 +11192,10 @@ for (let round = 0, R3 = _1n$5, x2 = 1, y3 = 0; round < 24; round++) {
|
|
|
11506
11192
|
SHA3_PI.push(2 * (5 * y3 + x2));
|
|
11507
11193
|
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
11508
11194
|
let t2 = _0n$5;
|
|
11509
|
-
for (let
|
|
11195
|
+
for (let j2 = 0; j2 < 7; j2++) {
|
|
11510
11196
|
R3 = (R3 << _1n$5 ^ (R3 >> _7n) * _0x71n) % _256n;
|
|
11511
11197
|
if (R3 & _2n$2)
|
|
11512
|
-
t2 ^= _1n$5 << (_1n$5 << /* @__PURE__ */ BigInt(
|
|
11198
|
+
t2 ^= _1n$5 << (_1n$5 << /* @__PURE__ */ BigInt(j2)) - _1n$5;
|
|
11513
11199
|
}
|
|
11514
11200
|
_SHA3_IOTA.push(t2);
|
|
11515
11201
|
}
|
|
@@ -11751,16 +11437,16 @@ class SHA256 extends HashMD {
|
|
|
11751
11437
|
this.H = SHA256_IV[7] | 0;
|
|
11752
11438
|
}
|
|
11753
11439
|
get() {
|
|
11754
|
-
const { A: A2, B: B2, C: C2, D: D2, E:
|
|
11755
|
-
return [A2, B2, C2, D2,
|
|
11440
|
+
const { A: A2, B: B2, C: C2, D: D2, E: E2, F: F2, G: G2, H: H2 } = this;
|
|
11441
|
+
return [A2, B2, C2, D2, E2, F2, G2, H2];
|
|
11756
11442
|
}
|
|
11757
11443
|
// prettier-ignore
|
|
11758
|
-
set(A2, B2, C2, D2,
|
|
11444
|
+
set(A2, B2, C2, D2, E2, F2, G2, H2) {
|
|
11759
11445
|
this.A = A2 | 0;
|
|
11760
11446
|
this.B = B2 | 0;
|
|
11761
11447
|
this.C = C2 | 0;
|
|
11762
11448
|
this.D = D2 | 0;
|
|
11763
|
-
this.E =
|
|
11449
|
+
this.E = E2 | 0;
|
|
11764
11450
|
this.F = F2 | 0;
|
|
11765
11451
|
this.G = G2 | 0;
|
|
11766
11452
|
this.H = H2 | 0;
|
|
@@ -11775,16 +11461,16 @@ class SHA256 extends HashMD {
|
|
|
11775
11461
|
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
11776
11462
|
SHA256_W[i3] = s1 + SHA256_W[i3 - 7] + s0 + SHA256_W[i3 - 16] | 0;
|
|
11777
11463
|
}
|
|
11778
|
-
let { A: A2, B: B2, C: C2, D: D2, E:
|
|
11464
|
+
let { A: A2, B: B2, C: C2, D: D2, E: E2, F: F2, G: G2, H: H2 } = this;
|
|
11779
11465
|
for (let i3 = 0; i3 < 64; i3++) {
|
|
11780
|
-
const sigma1 = rotr(
|
|
11781
|
-
const T1 = H2 + sigma1 + Chi(
|
|
11466
|
+
const sigma1 = rotr(E2, 6) ^ rotr(E2, 11) ^ rotr(E2, 25);
|
|
11467
|
+
const T1 = H2 + sigma1 + Chi(E2, F2, G2) + SHA256_K[i3] + SHA256_W[i3] | 0;
|
|
11782
11468
|
const sigma0 = rotr(A2, 2) ^ rotr(A2, 13) ^ rotr(A2, 22);
|
|
11783
11469
|
const T2 = sigma0 + Maj(A2, B2, C2) | 0;
|
|
11784
11470
|
H2 = G2;
|
|
11785
11471
|
G2 = F2;
|
|
11786
|
-
F2 =
|
|
11787
|
-
|
|
11472
|
+
F2 = E2;
|
|
11473
|
+
E2 = D2 + T1 | 0;
|
|
11788
11474
|
D2 = C2;
|
|
11789
11475
|
C2 = B2;
|
|
11790
11476
|
B2 = A2;
|
|
@@ -11794,11 +11480,11 @@ class SHA256 extends HashMD {
|
|
|
11794
11480
|
B2 = B2 + this.B | 0;
|
|
11795
11481
|
C2 = C2 + this.C | 0;
|
|
11796
11482
|
D2 = D2 + this.D | 0;
|
|
11797
|
-
|
|
11483
|
+
E2 = E2 + this.E | 0;
|
|
11798
11484
|
F2 = F2 + this.F | 0;
|
|
11799
11485
|
G2 = G2 + this.G | 0;
|
|
11800
11486
|
H2 = H2 + this.H | 0;
|
|
11801
|
-
this.set(A2, B2, C2, D2,
|
|
11487
|
+
this.set(A2, B2, C2, D2, E2, F2, G2, H2);
|
|
11802
11488
|
}
|
|
11803
11489
|
roundClean() {
|
|
11804
11490
|
clean(SHA256_W);
|
|
@@ -11948,22 +11634,22 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
11948
11634
|
throw new Error("qByteLen must be a number");
|
|
11949
11635
|
if (typeof hmacFn !== "function")
|
|
11950
11636
|
throw new Error("hmacFn must be a function");
|
|
11951
|
-
let
|
|
11637
|
+
let v2 = u8n(hashLen);
|
|
11952
11638
|
let k2 = u8n(hashLen);
|
|
11953
11639
|
let i3 = 0;
|
|
11954
11640
|
const reset = () => {
|
|
11955
|
-
|
|
11641
|
+
v2.fill(1);
|
|
11956
11642
|
k2.fill(0);
|
|
11957
11643
|
i3 = 0;
|
|
11958
11644
|
};
|
|
11959
|
-
const h4 = (...b2) => hmacFn(k2,
|
|
11645
|
+
const h4 = (...b2) => hmacFn(k2, v2, ...b2);
|
|
11960
11646
|
const reseed = (seed = u8n(0)) => {
|
|
11961
11647
|
k2 = h4(u8fr([0]), seed);
|
|
11962
|
-
|
|
11648
|
+
v2 = h4();
|
|
11963
11649
|
if (seed.length === 0)
|
|
11964
11650
|
return;
|
|
11965
11651
|
k2 = h4(u8fr([1]), seed);
|
|
11966
|
-
|
|
11652
|
+
v2 = h4();
|
|
11967
11653
|
};
|
|
11968
11654
|
const gen2 = () => {
|
|
11969
11655
|
if (i3++ >= 1e3)
|
|
@@ -11971,10 +11657,10 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
11971
11657
|
let len = 0;
|
|
11972
11658
|
const out = [];
|
|
11973
11659
|
while (len < qByteLen) {
|
|
11974
|
-
|
|
11975
|
-
const sl =
|
|
11660
|
+
v2 = h4();
|
|
11661
|
+
const sl = v2.slice();
|
|
11976
11662
|
out.push(sl);
|
|
11977
|
-
len +=
|
|
11663
|
+
len += v2.length;
|
|
11978
11664
|
}
|
|
11979
11665
|
return concatBytes(...out);
|
|
11980
11666
|
};
|
|
@@ -12312,11 +11998,11 @@ function fromHex$2(value, options = {}) {
|
|
|
12312
11998
|
hexString = `0${hexString}`;
|
|
12313
11999
|
const length = hexString.length / 2;
|
|
12314
12000
|
const bytes = new Uint8Array(length);
|
|
12315
|
-
for (let index = 0,
|
|
12316
|
-
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(
|
|
12317
|
-
const nibbleRight = charCodeToBase16(hexString.charCodeAt(
|
|
12001
|
+
for (let index = 0, j2 = 0; index < length; index++) {
|
|
12002
|
+
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j2++));
|
|
12003
|
+
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j2++));
|
|
12318
12004
|
if (nibbleLeft === void 0 || nibbleRight === void 0) {
|
|
12319
|
-
throw new BaseError(`Invalid byte sequence ("${hexString[
|
|
12005
|
+
throw new BaseError(`Invalid byte sequence ("${hexString[j2 - 2]}${hexString[j2 - 1]}" in "${hexString}").`);
|
|
12320
12006
|
}
|
|
12321
12007
|
bytes[index] = nibbleLeft * 16 + nibbleRight;
|
|
12322
12008
|
}
|
|
@@ -12740,9 +12426,9 @@ function invert(number, modulo) {
|
|
|
12740
12426
|
let b2 = modulo;
|
|
12741
12427
|
let x2 = _0n$3, u2 = _1n$3;
|
|
12742
12428
|
while (a2 !== _0n$3) {
|
|
12743
|
-
const
|
|
12429
|
+
const q3 = b2 / a2;
|
|
12744
12430
|
const r2 = b2 % a2;
|
|
12745
|
-
const m3 = x2 - u2 *
|
|
12431
|
+
const m3 = x2 - u2 * q3;
|
|
12746
12432
|
b2 = a2, a2 = r2, x2 = u2, u2 = m3;
|
|
12747
12433
|
}
|
|
12748
12434
|
const gcd2 = b2;
|
|
@@ -12760,9 +12446,9 @@ function sqrt3mod4(Fp, n3) {
|
|
|
12760
12446
|
function sqrt5mod8(Fp, n3) {
|
|
12761
12447
|
const p5div8 = (Fp.ORDER - _5n) / _8n;
|
|
12762
12448
|
const n22 = Fp.mul(n3, _2n$1);
|
|
12763
|
-
const
|
|
12764
|
-
const nv = Fp.mul(n3,
|
|
12765
|
-
const i3 = Fp.mul(Fp.mul(nv, _2n$1),
|
|
12449
|
+
const v2 = Fp.pow(n22, p5div8);
|
|
12450
|
+
const nv = Fp.mul(n3, v2);
|
|
12451
|
+
const i3 = Fp.mul(Fp.mul(nv, _2n$1), v2);
|
|
12766
12452
|
const root = Fp.mul(nv, Fp.sub(i3, Fp.ONE));
|
|
12767
12453
|
if (!Fp.eql(Fp.sqr(root), n3))
|
|
12768
12454
|
throw new Error("Cannot find square root");
|
|
@@ -12772,10 +12458,10 @@ function tonelliShanks(P3) {
|
|
|
12772
12458
|
if (P3 < BigInt(3))
|
|
12773
12459
|
throw new Error("sqrt is not defined for small field");
|
|
12774
12460
|
let Q2 = P3 - _1n$3;
|
|
12775
|
-
let
|
|
12461
|
+
let S3 = 0;
|
|
12776
12462
|
while (Q2 % _2n$1 === _0n$3) {
|
|
12777
12463
|
Q2 /= _2n$1;
|
|
12778
|
-
|
|
12464
|
+
S3++;
|
|
12779
12465
|
}
|
|
12780
12466
|
let Z2 = _2n$1;
|
|
12781
12467
|
const _Fp = Field(P3);
|
|
@@ -12783,7 +12469,7 @@ function tonelliShanks(P3) {
|
|
|
12783
12469
|
if (Z2++ > 1e3)
|
|
12784
12470
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
12785
12471
|
}
|
|
12786
|
-
if (
|
|
12472
|
+
if (S3 === 1)
|
|
12787
12473
|
return sqrt3mod4;
|
|
12788
12474
|
let cc2 = _Fp.pow(Z2, Q2);
|
|
12789
12475
|
const Q1div2 = (Q2 + _1n$3) / _2n$1;
|
|
@@ -12792,7 +12478,7 @@ function tonelliShanks(P3) {
|
|
|
12792
12478
|
return n3;
|
|
12793
12479
|
if (FpLegendre(Fp, n3) !== 1)
|
|
12794
12480
|
throw new Error("Cannot find square root");
|
|
12795
|
-
let M3 =
|
|
12481
|
+
let M3 = S3;
|
|
12796
12482
|
let c2 = Fp.mul(Fp.ONE, cc2);
|
|
12797
12483
|
let t2 = Fp.pow(n3, Q2);
|
|
12798
12484
|
let R3 = Fp.pow(n3, Q1div2);
|
|
@@ -13182,19 +12868,19 @@ function pippenger(c2, fieldN, points, scalars) {
|
|
|
13182
12868
|
let sum = zero;
|
|
13183
12869
|
for (let i3 = lastBits; i3 >= 0; i3 -= windowSize) {
|
|
13184
12870
|
buckets.fill(zero);
|
|
13185
|
-
for (let
|
|
13186
|
-
const scalar = scalars[
|
|
12871
|
+
for (let j2 = 0; j2 < slength; j2++) {
|
|
12872
|
+
const scalar = scalars[j2];
|
|
13187
12873
|
const wbits2 = Number(scalar >> BigInt(i3) & MASK);
|
|
13188
|
-
buckets[wbits2] = buckets[wbits2].add(points[
|
|
12874
|
+
buckets[wbits2] = buckets[wbits2].add(points[j2]);
|
|
13189
12875
|
}
|
|
13190
12876
|
let resI = zero;
|
|
13191
|
-
for (let
|
|
13192
|
-
sumI = sumI.add(buckets[
|
|
12877
|
+
for (let j2 = buckets.length - 1, sumI = zero; j2 > 0; j2--) {
|
|
12878
|
+
sumI = sumI.add(buckets[j2]);
|
|
13193
12879
|
resI = resI.add(sumI);
|
|
13194
12880
|
}
|
|
13195
12881
|
sum = sum.add(resI);
|
|
13196
12882
|
if (i3 !== 0)
|
|
13197
|
-
for (let
|
|
12883
|
+
for (let j2 = 0; j2 < windowSize; j2++)
|
|
13198
12884
|
sum = sum.double();
|
|
13199
12885
|
}
|
|
13200
12886
|
return sum;
|
|
@@ -13259,27 +12945,27 @@ const DER = {
|
|
|
13259
12945
|
// Basic building block is TLV (Tag-Length-Value)
|
|
13260
12946
|
_tlv: {
|
|
13261
12947
|
encode: (tag, data) => {
|
|
13262
|
-
const { Err:
|
|
12948
|
+
const { Err: E2 } = DER;
|
|
13263
12949
|
if (tag < 0 || tag > 256)
|
|
13264
|
-
throw new
|
|
12950
|
+
throw new E2("tlv.encode: wrong tag");
|
|
13265
12951
|
if (data.length & 1)
|
|
13266
|
-
throw new
|
|
12952
|
+
throw new E2("tlv.encode: unpadded data");
|
|
13267
12953
|
const dataLen = data.length / 2;
|
|
13268
12954
|
const len = numberToHexUnpadded(dataLen);
|
|
13269
12955
|
if (len.length / 2 & 128)
|
|
13270
|
-
throw new
|
|
12956
|
+
throw new E2("tlv.encode: long form length too big");
|
|
13271
12957
|
const lenLen = dataLen > 127 ? numberToHexUnpadded(len.length / 2 | 128) : "";
|
|
13272
12958
|
const t2 = numberToHexUnpadded(tag);
|
|
13273
12959
|
return t2 + lenLen + len + data;
|
|
13274
12960
|
},
|
|
13275
12961
|
// v - value, l - left bytes (unparsed)
|
|
13276
12962
|
decode(tag, data) {
|
|
13277
|
-
const { Err:
|
|
12963
|
+
const { Err: E2 } = DER;
|
|
13278
12964
|
let pos = 0;
|
|
13279
12965
|
if (tag < 0 || tag > 256)
|
|
13280
|
-
throw new
|
|
12966
|
+
throw new E2("tlv.encode: wrong tag");
|
|
13281
12967
|
if (data.length < 2 || data[pos++] !== tag)
|
|
13282
|
-
throw new
|
|
12968
|
+
throw new E2("tlv.decode: wrong tlv");
|
|
13283
12969
|
const first = data[pos++];
|
|
13284
12970
|
const isLong = !!(first & 128);
|
|
13285
12971
|
let length = 0;
|
|
@@ -13288,24 +12974,24 @@ const DER = {
|
|
|
13288
12974
|
else {
|
|
13289
12975
|
const lenLen = first & 127;
|
|
13290
12976
|
if (!lenLen)
|
|
13291
|
-
throw new
|
|
12977
|
+
throw new E2("tlv.decode(long): indefinite length not supported");
|
|
13292
12978
|
if (lenLen > 4)
|
|
13293
|
-
throw new
|
|
12979
|
+
throw new E2("tlv.decode(long): byte length is too big");
|
|
13294
12980
|
const lengthBytes = data.subarray(pos, pos + lenLen);
|
|
13295
12981
|
if (lengthBytes.length !== lenLen)
|
|
13296
|
-
throw new
|
|
12982
|
+
throw new E2("tlv.decode: length bytes not complete");
|
|
13297
12983
|
if (lengthBytes[0] === 0)
|
|
13298
|
-
throw new
|
|
12984
|
+
throw new E2("tlv.decode(long): zero leftmost byte");
|
|
13299
12985
|
for (const b2 of lengthBytes)
|
|
13300
12986
|
length = length << 8 | b2;
|
|
13301
12987
|
pos += lenLen;
|
|
13302
12988
|
if (length < 128)
|
|
13303
|
-
throw new
|
|
12989
|
+
throw new E2("tlv.decode(long): not minimal encoding");
|
|
13304
12990
|
}
|
|
13305
|
-
const
|
|
13306
|
-
if (
|
|
13307
|
-
throw new
|
|
13308
|
-
return { v:
|
|
12991
|
+
const v2 = data.subarray(pos, pos + length);
|
|
12992
|
+
if (v2.length !== length)
|
|
12993
|
+
throw new E2("tlv.decode: wrong value length");
|
|
12994
|
+
return { v: v2, l: data.subarray(pos + length) };
|
|
13309
12995
|
}
|
|
13310
12996
|
},
|
|
13311
12997
|
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
@@ -13314,35 +13000,35 @@ const DER = {
|
|
|
13314
13000
|
// - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
|
|
13315
13001
|
_int: {
|
|
13316
13002
|
encode(num) {
|
|
13317
|
-
const { Err:
|
|
13003
|
+
const { Err: E2 } = DER;
|
|
13318
13004
|
if (num < _0n$1)
|
|
13319
|
-
throw new
|
|
13005
|
+
throw new E2("integer: negative integers are not allowed");
|
|
13320
13006
|
let hex = numberToHexUnpadded(num);
|
|
13321
13007
|
if (Number.parseInt(hex[0], 16) & 8)
|
|
13322
13008
|
hex = "00" + hex;
|
|
13323
13009
|
if (hex.length & 1)
|
|
13324
|
-
throw new
|
|
13010
|
+
throw new E2("unexpected DER parsing assertion: unpadded hex");
|
|
13325
13011
|
return hex;
|
|
13326
13012
|
},
|
|
13327
13013
|
decode(data) {
|
|
13328
|
-
const { Err:
|
|
13014
|
+
const { Err: E2 } = DER;
|
|
13329
13015
|
if (data[0] & 128)
|
|
13330
|
-
throw new
|
|
13016
|
+
throw new E2("invalid signature integer: negative");
|
|
13331
13017
|
if (data[0] === 0 && !(data[1] & 128))
|
|
13332
|
-
throw new
|
|
13018
|
+
throw new E2("invalid signature integer: unnecessary leading zero");
|
|
13333
13019
|
return bytesToNumberBE(data);
|
|
13334
13020
|
}
|
|
13335
13021
|
},
|
|
13336
13022
|
toSig(hex) {
|
|
13337
|
-
const { Err:
|
|
13023
|
+
const { Err: E2, _int: int, _tlv: tlv } = DER;
|
|
13338
13024
|
const data = ensureBytes("signature", hex);
|
|
13339
13025
|
const { v: seqBytes, l: seqLeftBytes } = tlv.decode(48, data);
|
|
13340
13026
|
if (seqLeftBytes.length)
|
|
13341
|
-
throw new
|
|
13027
|
+
throw new E2("invalid signature: left bytes after parsing");
|
|
13342
13028
|
const { v: rBytes, l: rLeftBytes } = tlv.decode(2, seqBytes);
|
|
13343
13029
|
const { v: sBytes, l: sLeftBytes } = tlv.decode(2, rLeftBytes);
|
|
13344
13030
|
if (sLeftBytes.length)
|
|
13345
|
-
throw new
|
|
13031
|
+
throw new E2("invalid signature: left bytes after parsing");
|
|
13346
13032
|
return { r: int.decode(rBytes), s: int.decode(sBytes) };
|
|
13347
13033
|
},
|
|
13348
13034
|
hexFromSig(sig) {
|
|
@@ -14011,14 +13697,14 @@ function weierstrass(curveDef) {
|
|
|
14011
13697
|
if (!isWithinCurveOrder(k2))
|
|
14012
13698
|
return;
|
|
14013
13699
|
const ik = invN(k2);
|
|
14014
|
-
const
|
|
14015
|
-
const r2 = modN(
|
|
13700
|
+
const q3 = Point.BASE.multiply(k2).toAffine();
|
|
13701
|
+
const r2 = modN(q3.x);
|
|
14016
13702
|
if (r2 === _0n$1)
|
|
14017
13703
|
return;
|
|
14018
13704
|
const s2 = modN(ik * modN(m3 + r2 * d3));
|
|
14019
13705
|
if (s2 === _0n$1)
|
|
14020
13706
|
return;
|
|
14021
|
-
let recovery = (
|
|
13707
|
+
let recovery = (q3.x === r2 ? 0 : 2) | Number(q3.y & _1n$1);
|
|
14022
13708
|
let normS = s2;
|
|
14023
13709
|
if (lowS && isBiggerThanHalfOrder(s2)) {
|
|
14024
13710
|
normS = normalizeS(s2);
|
|
@@ -14085,8 +13771,8 @@ function weierstrass(curveDef) {
|
|
|
14085
13771
|
const R3 = Point.BASE.multiplyAndAddUnsafe(P3, u1, u2)?.toAffine();
|
|
14086
13772
|
if (!R3)
|
|
14087
13773
|
return false;
|
|
14088
|
-
const
|
|
14089
|
-
return
|
|
13774
|
+
const v2 = modN(R3.x);
|
|
13775
|
+
return v2 === r2;
|
|
14090
13776
|
}
|
|
14091
13777
|
return {
|
|
14092
13778
|
CURVE,
|
|
@@ -14204,14 +13890,14 @@ function fromHex(signature) {
|
|
|
14204
13890
|
yParity
|
|
14205
13891
|
};
|
|
14206
13892
|
}
|
|
14207
|
-
function vToYParity(
|
|
14208
|
-
if (
|
|
13893
|
+
function vToYParity(v2) {
|
|
13894
|
+
if (v2 === 0 || v2 === 27)
|
|
14209
13895
|
return 0;
|
|
14210
|
-
if (
|
|
13896
|
+
if (v2 === 1 || v2 === 28)
|
|
14211
13897
|
return 1;
|
|
14212
|
-
if (
|
|
14213
|
-
return
|
|
14214
|
-
throw new InvalidVError({ value:
|
|
13898
|
+
if (v2 >= 35)
|
|
13899
|
+
return v2 % 2 === 0 ? 1 : 0;
|
|
13900
|
+
throw new InvalidVError({ value: v2 });
|
|
14215
13901
|
}
|
|
14216
13902
|
class InvalidSerializedSizeError2 extends BaseError {
|
|
14217
13903
|
constructor({ signature }) {
|
|
@@ -14443,8 +14129,8 @@ function base$1(ALPHABET2) {
|
|
|
14443
14129
|
throw new TypeError("Alphabet too long");
|
|
14444
14130
|
}
|
|
14445
14131
|
const BASE_MAP = new Uint8Array(256);
|
|
14446
|
-
for (let
|
|
14447
|
-
BASE_MAP[
|
|
14132
|
+
for (let j2 = 0; j2 < BASE_MAP.length; j2++) {
|
|
14133
|
+
BASE_MAP[j2] = 255;
|
|
14448
14134
|
}
|
|
14449
14135
|
for (let i3 = 0; i3 < ALPHABET2.length; i3++) {
|
|
14450
14136
|
const x2 = ALPHABET2.charAt(i3);
|
|
@@ -14547,9 +14233,9 @@ function base$1(ALPHABET2) {
|
|
|
14547
14233
|
it4++;
|
|
14548
14234
|
}
|
|
14549
14235
|
const vch = new Uint8Array(zeroes + (size2 - it4));
|
|
14550
|
-
let
|
|
14236
|
+
let j2 = zeroes;
|
|
14551
14237
|
while (it4 !== size2) {
|
|
14552
|
-
vch[
|
|
14238
|
+
vch[j2++] = b256[it4++];
|
|
14553
14239
|
}
|
|
14554
14240
|
return vch;
|
|
14555
14241
|
}
|
|
@@ -15300,8 +14986,8 @@ class CachedKeyDecoder {
|
|
|
15300
14986
|
const records = this.caches[byteLength - 1];
|
|
15301
14987
|
FIND_CHUNK: for (const record of records) {
|
|
15302
14988
|
const recordBytes = record.bytes;
|
|
15303
|
-
for (let
|
|
15304
|
-
if (recordBytes[
|
|
14989
|
+
for (let j2 = 0; j2 < byteLength; j2++) {
|
|
14990
|
+
if (recordBytes[j2] !== bytes[inputOffset + j2]) {
|
|
15305
14991
|
continue FIND_CHUNK;
|
|
15306
14992
|
}
|
|
15307
14993
|
}
|
|
@@ -15981,8 +15667,8 @@ function base(ALPHABET2, name) {
|
|
|
15981
15667
|
throw new TypeError("Alphabet too long");
|
|
15982
15668
|
}
|
|
15983
15669
|
var BASE_MAP = new Uint8Array(256);
|
|
15984
|
-
for (var
|
|
15985
|
-
BASE_MAP[
|
|
15670
|
+
for (var j2 = 0; j2 < BASE_MAP.length; j2++) {
|
|
15671
|
+
BASE_MAP[j2] = 255;
|
|
15986
15672
|
}
|
|
15987
15673
|
for (var i3 = 0; i3 < ALPHABET2.length; i3++) {
|
|
15988
15674
|
var x2 = ALPHABET2.charAt(i3);
|
|
@@ -16087,9 +15773,9 @@ function base(ALPHABET2, name) {
|
|
|
16087
15773
|
it4++;
|
|
16088
15774
|
}
|
|
16089
15775
|
var vch = new Uint8Array(zeroes + (size2 - it4));
|
|
16090
|
-
var
|
|
15776
|
+
var j3 = zeroes;
|
|
16091
15777
|
while (it4 !== size2) {
|
|
16092
|
-
vch[
|
|
15778
|
+
vch[j3++] = b256[it4++];
|
|
16093
15779
|
}
|
|
16094
15780
|
return vch;
|
|
16095
15781
|
}
|
|
@@ -16646,26 +16332,26 @@ function requireBlake2b() {
|
|
|
16646
16332
|
if (hasRequiredBlake2b) return blake2b_1;
|
|
16647
16333
|
hasRequiredBlake2b = 1;
|
|
16648
16334
|
const util2 = requireUtil();
|
|
16649
|
-
function ADD64AA(
|
|
16650
|
-
const o0 =
|
|
16651
|
-
let o1 =
|
|
16335
|
+
function ADD64AA(v3, a2, b2) {
|
|
16336
|
+
const o0 = v3[a2] + v3[b2];
|
|
16337
|
+
let o1 = v3[a2 + 1] + v3[b2 + 1];
|
|
16652
16338
|
if (o0 >= 4294967296) {
|
|
16653
16339
|
o1++;
|
|
16654
16340
|
}
|
|
16655
|
-
|
|
16656
|
-
|
|
16341
|
+
v3[a2] = o0;
|
|
16342
|
+
v3[a2 + 1] = o1;
|
|
16657
16343
|
}
|
|
16658
|
-
function ADD64AC(
|
|
16659
|
-
let o0 =
|
|
16344
|
+
function ADD64AC(v3, a2, b0, b1) {
|
|
16345
|
+
let o0 = v3[a2] + b0;
|
|
16660
16346
|
if (b0 < 0) {
|
|
16661
16347
|
o0 += 4294967296;
|
|
16662
16348
|
}
|
|
16663
|
-
let o1 =
|
|
16349
|
+
let o1 = v3[a2 + 1] + b1;
|
|
16664
16350
|
if (o0 >= 4294967296) {
|
|
16665
16351
|
o1++;
|
|
16666
16352
|
}
|
|
16667
|
-
|
|
16668
|
-
|
|
16353
|
+
v3[a2] = o0;
|
|
16354
|
+
v3[a2 + 1] = o1;
|
|
16669
16355
|
}
|
|
16670
16356
|
function B2B_GET32(arr, i3) {
|
|
16671
16357
|
return arr[i3] ^ arr[i3 + 1] << 8 ^ arr[i3 + 2] << 16 ^ arr[i3 + 3] << 24;
|
|
@@ -16675,28 +16361,28 @@ function requireBlake2b() {
|
|
|
16675
16361
|
const x1 = m3[ix + 1];
|
|
16676
16362
|
const y0 = m3[iy];
|
|
16677
16363
|
const y1 = m3[iy + 1];
|
|
16678
|
-
ADD64AA(
|
|
16679
|
-
ADD64AC(
|
|
16680
|
-
let xor0 =
|
|
16681
|
-
let xor1 =
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
ADD64AA(
|
|
16685
|
-
xor0 =
|
|
16686
|
-
xor1 =
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
ADD64AA(
|
|
16690
|
-
ADD64AC(
|
|
16691
|
-
xor0 =
|
|
16692
|
-
xor1 =
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
ADD64AA(
|
|
16696
|
-
xor0 =
|
|
16697
|
-
xor1 =
|
|
16698
|
-
|
|
16699
|
-
|
|
16364
|
+
ADD64AA(v2, a2, b2);
|
|
16365
|
+
ADD64AC(v2, a2, x0, x1);
|
|
16366
|
+
let xor0 = v2[d3] ^ v2[a2];
|
|
16367
|
+
let xor1 = v2[d3 + 1] ^ v2[a2 + 1];
|
|
16368
|
+
v2[d3] = xor1;
|
|
16369
|
+
v2[d3 + 1] = xor0;
|
|
16370
|
+
ADD64AA(v2, c2, d3);
|
|
16371
|
+
xor0 = v2[b2] ^ v2[c2];
|
|
16372
|
+
xor1 = v2[b2 + 1] ^ v2[c2 + 1];
|
|
16373
|
+
v2[b2] = xor0 >>> 24 ^ xor1 << 8;
|
|
16374
|
+
v2[b2 + 1] = xor1 >>> 24 ^ xor0 << 8;
|
|
16375
|
+
ADD64AA(v2, a2, b2);
|
|
16376
|
+
ADD64AC(v2, a2, y0, y1);
|
|
16377
|
+
xor0 = v2[d3] ^ v2[a2];
|
|
16378
|
+
xor1 = v2[d3 + 1] ^ v2[a2 + 1];
|
|
16379
|
+
v2[d3] = xor0 >>> 16 ^ xor1 << 16;
|
|
16380
|
+
v2[d3 + 1] = xor1 >>> 16 ^ xor0 << 16;
|
|
16381
|
+
ADD64AA(v2, c2, d3);
|
|
16382
|
+
xor0 = v2[b2] ^ v2[c2];
|
|
16383
|
+
xor1 = v2[b2 + 1] ^ v2[c2 + 1];
|
|
16384
|
+
v2[b2] = xor1 >>> 31 ^ xor0 << 1;
|
|
16385
|
+
v2[b2 + 1] = xor0 >>> 31 ^ xor1 << 1;
|
|
16700
16386
|
}
|
|
16701
16387
|
const BLAKE2B_IV32 = new Uint32Array([
|
|
16702
16388
|
4089235720,
|
|
@@ -16915,19 +16601,19 @@ function requireBlake2b() {
|
|
|
16915
16601
|
return x2 * 2;
|
|
16916
16602
|
})
|
|
16917
16603
|
);
|
|
16918
|
-
const
|
|
16604
|
+
const v2 = new Uint32Array(32);
|
|
16919
16605
|
const m3 = new Uint32Array(32);
|
|
16920
16606
|
function blake2bCompress(ctx, last) {
|
|
16921
16607
|
let i3 = 0;
|
|
16922
16608
|
for (i3 = 0; i3 < 16; i3++) {
|
|
16923
|
-
|
|
16924
|
-
|
|
16609
|
+
v2[i3] = ctx.h[i3];
|
|
16610
|
+
v2[i3 + 16] = BLAKE2B_IV32[i3];
|
|
16925
16611
|
}
|
|
16926
|
-
|
|
16927
|
-
|
|
16612
|
+
v2[24] = v2[24] ^ ctx.t;
|
|
16613
|
+
v2[25] = v2[25] ^ ctx.t / 4294967296;
|
|
16928
16614
|
if (last) {
|
|
16929
|
-
|
|
16930
|
-
|
|
16615
|
+
v2[28] = ~v2[28];
|
|
16616
|
+
v2[29] = ~v2[29];
|
|
16931
16617
|
}
|
|
16932
16618
|
for (i3 = 0; i3 < 32; i3++) {
|
|
16933
16619
|
m3[i3] = B2B_GET32(ctx.b, 4 * i3);
|
|
@@ -16943,7 +16629,7 @@ function requireBlake2b() {
|
|
|
16943
16629
|
B2B_G(6, 8, 18, 28, SIGMA82[i3 * 16 + 14], SIGMA82[i3 * 16 + 15]);
|
|
16944
16630
|
}
|
|
16945
16631
|
for (i3 = 0; i3 < 16; i3++) {
|
|
16946
|
-
ctx.h[i3] = ctx.h[i3] ^
|
|
16632
|
+
ctx.h[i3] = ctx.h[i3] ^ v2[i3] ^ v2[i3 + 16];
|
|
16947
16633
|
}
|
|
16948
16634
|
}
|
|
16949
16635
|
const parameterBlock = new Uint8Array([
|
|
@@ -17121,18 +16807,18 @@ function requireBlake2s() {
|
|
|
17121
16807
|
if (hasRequiredBlake2s) return blake2s_1;
|
|
17122
16808
|
hasRequiredBlake2s = 1;
|
|
17123
16809
|
const util2 = requireUtil();
|
|
17124
|
-
function B2S_GET32(
|
|
17125
|
-
return
|
|
16810
|
+
function B2S_GET32(v3, i3) {
|
|
16811
|
+
return v3[i3] ^ v3[i3 + 1] << 8 ^ v3[i3 + 2] << 16 ^ v3[i3 + 3] << 24;
|
|
17126
16812
|
}
|
|
17127
16813
|
function B2S_G(a2, b2, c2, d3, x2, y3) {
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
16814
|
+
v2[a2] = v2[a2] + v2[b2] + x2;
|
|
16815
|
+
v2[d3] = ROTR32(v2[d3] ^ v2[a2], 16);
|
|
16816
|
+
v2[c2] = v2[c2] + v2[d3];
|
|
16817
|
+
v2[b2] = ROTR32(v2[b2] ^ v2[c2], 12);
|
|
16818
|
+
v2[a2] = v2[a2] + v2[b2] + y3;
|
|
16819
|
+
v2[d3] = ROTR32(v2[d3] ^ v2[a2], 8);
|
|
16820
|
+
v2[c2] = v2[c2] + v2[d3];
|
|
16821
|
+
v2[b2] = ROTR32(v2[b2] ^ v2[c2], 7);
|
|
17136
16822
|
}
|
|
17137
16823
|
function ROTR32(x2, y3) {
|
|
17138
16824
|
return x2 >>> y3 ^ x2 << 32 - y3;
|
|
@@ -17309,18 +16995,18 @@ function requireBlake2s() {
|
|
|
17309
16995
|
13,
|
|
17310
16996
|
0
|
|
17311
16997
|
]);
|
|
17312
|
-
const
|
|
16998
|
+
const v2 = new Uint32Array(16);
|
|
17313
16999
|
const m3 = new Uint32Array(16);
|
|
17314
17000
|
function blake2sCompress(ctx, last) {
|
|
17315
17001
|
let i3 = 0;
|
|
17316
17002
|
for (i3 = 0; i3 < 8; i3++) {
|
|
17317
|
-
|
|
17318
|
-
|
|
17003
|
+
v2[i3] = ctx.h[i3];
|
|
17004
|
+
v2[i3 + 8] = BLAKE2S_IV[i3];
|
|
17319
17005
|
}
|
|
17320
|
-
|
|
17321
|
-
|
|
17006
|
+
v2[12] ^= ctx.t;
|
|
17007
|
+
v2[13] ^= ctx.t / 4294967296;
|
|
17322
17008
|
if (last) {
|
|
17323
|
-
|
|
17009
|
+
v2[14] = ~v2[14];
|
|
17324
17010
|
}
|
|
17325
17011
|
for (i3 = 0; i3 < 16; i3++) {
|
|
17326
17012
|
m3[i3] = B2S_GET32(ctx.b, 4 * i3);
|
|
@@ -17336,7 +17022,7 @@ function requireBlake2s() {
|
|
|
17336
17022
|
B2S_G(3, 4, 9, 14, m3[SIGMA[i3 * 16 + 14]], m3[SIGMA[i3 * 16 + 15]]);
|
|
17337
17023
|
}
|
|
17338
17024
|
for (i3 = 0; i3 < 8; i3++) {
|
|
17339
|
-
ctx.h[i3] ^=
|
|
17025
|
+
ctx.h[i3] ^= v2[i3] ^ v2[i3 + 8];
|
|
17340
17026
|
}
|
|
17341
17027
|
}
|
|
17342
17028
|
function blake2sInit(outlen, key) {
|
|
@@ -17996,12 +17682,12 @@ let dn$1 = class dn extends qr$1 {
|
|
|
17996
17682
|
process(e2, n3) {
|
|
17997
17683
|
for (let R3 = 0; R3 < 16; R3++, n3 += 4) Tt$2[R3] = e2.getUint32(n3), Ct$2[R3] = e2.getUint32(n3 += 4);
|
|
17998
17684
|
for (let R3 = 16; R3 < 80; R3++) {
|
|
17999
|
-
const Z2 = Tt$2[R3 - 15] | 0, H2 = Ct$2[R3 - 15] | 0,
|
|
17685
|
+
const Z2 = Tt$2[R3 - 15] | 0, H2 = Ct$2[R3 - 15] | 0, j2 = St$3(Z2, H2, 1) ^ St$3(Z2, H2, 8) ^ Rr$1(Z2, H2, 7), L2 = Ot$2(Z2, H2, 1) ^ Ot$2(Z2, H2, 8) ^ $r$1(Z2, H2, 7), k2 = Tt$2[R3 - 2] | 0, O3 = Ct$2[R3 - 2] | 0, T2 = St$3(k2, O3, 19) ^ de$1(k2, O3, 61) ^ Rr$1(k2, O3, 6), C2 = Ot$2(k2, O3, 19) ^ he$2(k2, O3, 61) ^ $r$1(k2, O3, 6), _3 = Zi(L2, C2, Ct$2[R3 - 7], Ct$2[R3 - 16]), p2 = Gi$1(_3, j2, T2, Tt$2[R3 - 7], Tt$2[R3 - 16]);
|
|
18000
17686
|
Tt$2[R3] = p2 | 0, Ct$2[R3] = _3 | 0;
|
|
18001
17687
|
}
|
|
18002
17688
|
let { Ah: r2, Al: o3, Bh: s2, Bl: i3, Ch: c2, Cl: f4, Dh: u2, Dl: a2, Eh: l2, El: d3, Fh: h4, Fl: y3, Gh: m3, Gl: w2, Hh: U2, Hl: F2 } = this;
|
|
18003
17689
|
for (let R3 = 0; R3 < 80; R3++) {
|
|
18004
|
-
const Z2 = St$3(l2, d3, 14) ^ St$3(l2, d3, 18) ^ de$1(l2, d3, 41), H2 = Ot$2(l2, d3, 14) ^ Ot$2(l2, d3, 18) ^ he$2(l2, d3, 41),
|
|
17690
|
+
const Z2 = St$3(l2, d3, 14) ^ St$3(l2, d3, 18) ^ de$1(l2, d3, 41), H2 = Ot$2(l2, d3, 14) ^ Ot$2(l2, d3, 18) ^ he$2(l2, d3, 41), j2 = l2 & h4 ^ ~l2 & m3, L2 = d3 & y3 ^ ~d3 & w2, k2 = zi$1(F2, H2, L2, gc[R3], Ct$2[R3]), O3 = Yi(k2, U2, Z2, j2, pc[R3], Tt$2[R3]), T2 = k2 | 0, C2 = St$3(r2, o3, 28) ^ de$1(r2, o3, 34) ^ de$1(r2, o3, 39), _3 = Ot$2(r2, o3, 28) ^ he$2(r2, o3, 34) ^ he$2(r2, o3, 39), p2 = r2 & s2 ^ r2 & c2 ^ s2 & c2, b2 = o3 & i3 ^ o3 & f4 ^ i3 & f4;
|
|
18005
17691
|
U2 = m3 | 0, F2 = w2 | 0, m3 = h4 | 0, w2 = y3 | 0, h4 = l2 | 0, y3 = d3 | 0, { h: l2, l: d3 } = dt$2(u2 | 0, a2 | 0, O3 | 0, T2 | 0), u2 = c2 | 0, a2 = f4 | 0, c2 = s2 | 0, f4 = i3 | 0, s2 = r2 | 0, i3 = o3 | 0;
|
|
18006
17692
|
const g2 = fn$1(T2, _3, b2);
|
|
18007
17693
|
r2 = an$1(g2, O3, C2, p2), o3 = g2 | 0;
|
|
@@ -18248,7 +17934,7 @@ const ro$1 = (t2, e2) => {
|
|
|
18248
17934
|
if (!t2.aud && !t2.uri) throw new Error("Either `aud` or `uri` is required to construct the message");
|
|
18249
17935
|
let s2 = t2.statement || void 0;
|
|
18250
17936
|
const i3 = `URI: ${t2.aud || t2.uri}`, c2 = `Version: ${t2.version}`, f4 = `Chain ID: ${to$1(e2)}`, u2 = `Nonce: ${t2.nonce}`, a2 = `Issued At: ${t2.iat}`, l2 = t2.exp ? `Expiration Time: ${t2.exp}` : void 0, d3 = t2.nbf ? `Not Before: ${t2.nbf}` : void 0, h4 = t2.requestId ? `Request ID: ${t2.requestId}` : void 0, y3 = t2.resources ? `Resources:${t2.resources.map((w2) => `
|
|
18251
|
-
- ${w2}`).join("")}` : void 0, m3 =
|
|
17937
|
+
- ${w2}`).join("")}` : void 0, m3 = je2(t2.resources);
|
|
18252
17938
|
if (m3) {
|
|
18253
17939
|
const w2 = kt$2(m3);
|
|
18254
17940
|
s2 = wn$1(s2, w2);
|
|
@@ -18356,7 +18042,7 @@ function Yc(t2) {
|
|
|
18356
18042
|
});
|
|
18357
18043
|
}), [...new Set(n3.flat())];
|
|
18358
18044
|
}
|
|
18359
|
-
function
|
|
18045
|
+
function je2(t2) {
|
|
18360
18046
|
if (!t2) return;
|
|
18361
18047
|
const e2 = t2?.[t2.length - 1];
|
|
18362
18048
|
return mn$1(e2) ? e2 : void 0;
|
|
@@ -18525,27 +18211,27 @@ class hf {
|
|
|
18525
18211
|
for (let a2 = 0; a2 < 8; a2++) this.pad[a2] = W$2(e2, 16 + 2 * a2);
|
|
18526
18212
|
}
|
|
18527
18213
|
process(e2, n3, r2 = false) {
|
|
18528
|
-
const o3 = r2 ? 0 : 2048, { h: s2, r: i3 } = this, c2 = i3[0], f4 = i3[1], u2 = i3[2], a2 = i3[3], l2 = i3[4], d3 = i3[5], h4 = i3[6], y3 = i3[7], m3 = i3[8], w2 = i3[9], U2 = W$2(e2, n3 + 0), F2 = W$2(e2, n3 + 2), R3 = W$2(e2, n3 + 4), Z2 = W$2(e2, n3 + 6), H2 = W$2(e2, n3 + 8),
|
|
18529
|
-
let O3 = s2[0] + (U2 & 8191), T2 = s2[1] + ((U2 >>> 13 | F2 << 3) & 8191), C2 = s2[2] + ((F2 >>> 10 | R3 << 6) & 8191), _3 = s2[3] + ((R3 >>> 7 | Z2 << 9) & 8191), p2 = s2[4] + ((Z2 >>> 4 | H2 << 12) & 8191), b2 = s2[5] + (H2 >>> 1 & 8191), g2 = s2[6] + ((H2 >>> 14 |
|
|
18530
|
-
|
|
18531
|
-
let A2 =
|
|
18532
|
-
|
|
18533
|
-
let N2 =
|
|
18534
|
-
|
|
18535
|
-
let D2 =
|
|
18536
|
-
|
|
18537
|
-
let P3 =
|
|
18538
|
-
|
|
18539
|
-
let $2 =
|
|
18540
|
-
|
|
18541
|
-
let V3 =
|
|
18542
|
-
|
|
18543
|
-
let
|
|
18544
|
-
|
|
18545
|
-
let G2 =
|
|
18546
|
-
|
|
18547
|
-
let M3 =
|
|
18548
|
-
|
|
18214
|
+
const o3 = r2 ? 0 : 2048, { h: s2, r: i3 } = this, c2 = i3[0], f4 = i3[1], u2 = i3[2], a2 = i3[3], l2 = i3[4], d3 = i3[5], h4 = i3[6], y3 = i3[7], m3 = i3[8], w2 = i3[9], U2 = W$2(e2, n3 + 0), F2 = W$2(e2, n3 + 2), R3 = W$2(e2, n3 + 4), Z2 = W$2(e2, n3 + 6), H2 = W$2(e2, n3 + 8), j2 = W$2(e2, n3 + 10), L2 = W$2(e2, n3 + 12), k2 = W$2(e2, n3 + 14);
|
|
18215
|
+
let O3 = s2[0] + (U2 & 8191), T2 = s2[1] + ((U2 >>> 13 | F2 << 3) & 8191), C2 = s2[2] + ((F2 >>> 10 | R3 << 6) & 8191), _3 = s2[3] + ((R3 >>> 7 | Z2 << 9) & 8191), p2 = s2[4] + ((Z2 >>> 4 | H2 << 12) & 8191), b2 = s2[5] + (H2 >>> 1 & 8191), g2 = s2[6] + ((H2 >>> 14 | j2 << 2) & 8191), x2 = s2[7] + ((j2 >>> 11 | L2 << 5) & 8191), E2 = s2[8] + ((L2 >>> 8 | k2 << 8) & 8191), I2 = s2[9] + (k2 >>> 5 | o3), v2 = 0, B2 = v2 + O3 * c2 + T2 * (5 * w2) + C2 * (5 * m3) + _3 * (5 * y3) + p2 * (5 * h4);
|
|
18216
|
+
v2 = B2 >>> 13, B2 &= 8191, B2 += b2 * (5 * d3) + g2 * (5 * l2) + x2 * (5 * a2) + E2 * (5 * u2) + I2 * (5 * f4), v2 += B2 >>> 13, B2 &= 8191;
|
|
18217
|
+
let A2 = v2 + O3 * f4 + T2 * c2 + C2 * (5 * w2) + _3 * (5 * m3) + p2 * (5 * y3);
|
|
18218
|
+
v2 = A2 >>> 13, A2 &= 8191, A2 += b2 * (5 * h4) + g2 * (5 * d3) + x2 * (5 * l2) + E2 * (5 * a2) + I2 * (5 * u2), v2 += A2 >>> 13, A2 &= 8191;
|
|
18219
|
+
let N2 = v2 + O3 * u2 + T2 * f4 + C2 * c2 + _3 * (5 * w2) + p2 * (5 * m3);
|
|
18220
|
+
v2 = N2 >>> 13, N2 &= 8191, N2 += b2 * (5 * y3) + g2 * (5 * h4) + x2 * (5 * d3) + E2 * (5 * l2) + I2 * (5 * a2), v2 += N2 >>> 13, N2 &= 8191;
|
|
18221
|
+
let D2 = v2 + O3 * a2 + T2 * u2 + C2 * f4 + _3 * c2 + p2 * (5 * w2);
|
|
18222
|
+
v2 = D2 >>> 13, D2 &= 8191, D2 += b2 * (5 * m3) + g2 * (5 * y3) + x2 * (5 * h4) + E2 * (5 * d3) + I2 * (5 * l2), v2 += D2 >>> 13, D2 &= 8191;
|
|
18223
|
+
let P3 = v2 + O3 * l2 + T2 * a2 + C2 * u2 + _3 * f4 + p2 * c2;
|
|
18224
|
+
v2 = P3 >>> 13, P3 &= 8191, P3 += b2 * (5 * w2) + g2 * (5 * m3) + x2 * (5 * y3) + E2 * (5 * h4) + I2 * (5 * d3), v2 += P3 >>> 13, P3 &= 8191;
|
|
18225
|
+
let $2 = v2 + O3 * d3 + T2 * l2 + C2 * a2 + _3 * u2 + p2 * f4;
|
|
18226
|
+
v2 = $2 >>> 13, $2 &= 8191, $2 += b2 * c2 + g2 * (5 * w2) + x2 * (5 * m3) + E2 * (5 * y3) + I2 * (5 * h4), v2 += $2 >>> 13, $2 &= 8191;
|
|
18227
|
+
let V3 = v2 + O3 * h4 + T2 * d3 + C2 * l2 + _3 * a2 + p2 * u2;
|
|
18228
|
+
v2 = V3 >>> 13, V3 &= 8191, V3 += b2 * f4 + g2 * c2 + x2 * (5 * w2) + E2 * (5 * m3) + I2 * (5 * y3), v2 += V3 >>> 13, V3 &= 8191;
|
|
18229
|
+
let q3 = v2 + O3 * y3 + T2 * h4 + C2 * d3 + _3 * l2 + p2 * a2;
|
|
18230
|
+
v2 = q3 >>> 13, q3 &= 8191, q3 += b2 * u2 + g2 * f4 + x2 * c2 + E2 * (5 * w2) + I2 * (5 * m3), v2 += q3 >>> 13, q3 &= 8191;
|
|
18231
|
+
let G2 = v2 + O3 * m3 + T2 * y3 + C2 * h4 + _3 * d3 + p2 * l2;
|
|
18232
|
+
v2 = G2 >>> 13, G2 &= 8191, G2 += b2 * a2 + g2 * u2 + x2 * f4 + E2 * c2 + I2 * (5 * w2), v2 += G2 >>> 13, G2 &= 8191;
|
|
18233
|
+
let M3 = v2 + O3 * w2 + T2 * m3 + C2 * y3 + _3 * h4 + p2 * d3;
|
|
18234
|
+
v2 = M3 >>> 13, M3 &= 8191, M3 += b2 * l2 + g2 * a2 + x2 * u2 + E2 * f4 + I2 * c2, v2 += M3 >>> 13, M3 &= 8191, v2 = (v2 << 2) + v2 | 0, v2 = v2 + B2 | 0, B2 = v2 & 8191, v2 = v2 >>> 13, A2 += v2, s2[0] = B2, s2[1] = A2, s2[2] = N2, s2[3] = D2, s2[4] = P3, s2[5] = $2, s2[6] = V3, s2[7] = q3, s2[8] = G2, s2[9] = M3;
|
|
18549
18235
|
}
|
|
18550
18236
|
finalize() {
|
|
18551
18237
|
const { h: e2, pad: n3 } = this, r2 = new Uint16Array(10);
|
|
@@ -18607,10 +18293,10 @@ function pf(t2) {
|
|
|
18607
18293
|
}
|
|
18608
18294
|
const gf = pf((t2) => new hf(t2));
|
|
18609
18295
|
function bf(t2, e2, n3, r2, o3, s2 = 20) {
|
|
18610
|
-
let i3 = t2[0], c2 = t2[1], f4 = t2[2], u2 = t2[3], a2 = e2[0], l2 = e2[1], d3 = e2[2], h4 = e2[3], y3 = e2[4], m3 = e2[5], w2 = e2[6], U2 = e2[7], F2 = o3, R3 = n3[0], Z2 = n3[1], H2 = n3[2],
|
|
18611
|
-
for (let D2 = 0; D2 < s2; D2 += 2)
|
|
18296
|
+
let i3 = t2[0], c2 = t2[1], f4 = t2[2], u2 = t2[3], a2 = e2[0], l2 = e2[1], d3 = e2[2], h4 = e2[3], y3 = e2[4], m3 = e2[5], w2 = e2[6], U2 = e2[7], F2 = o3, R3 = n3[0], Z2 = n3[1], H2 = n3[2], j2 = i3, L2 = c2, k2 = f4, O3 = u2, T2 = a2, C2 = l2, _3 = d3, p2 = h4, b2 = y3, g2 = m3, x2 = w2, E2 = U2, I2 = F2, v2 = R3, B2 = Z2, A2 = H2;
|
|
18297
|
+
for (let D2 = 0; D2 < s2; D2 += 2) j2 = j2 + T2 | 0, I2 = K$2(I2 ^ j2, 16), b2 = b2 + I2 | 0, T2 = K$2(T2 ^ b2, 12), j2 = j2 + T2 | 0, I2 = K$2(I2 ^ j2, 8), b2 = b2 + I2 | 0, T2 = K$2(T2 ^ b2, 7), L2 = L2 + C2 | 0, v2 = K$2(v2 ^ L2, 16), g2 = g2 + v2 | 0, C2 = K$2(C2 ^ g2, 12), L2 = L2 + C2 | 0, v2 = K$2(v2 ^ L2, 8), g2 = g2 + v2 | 0, C2 = K$2(C2 ^ g2, 7), k2 = k2 + _3 | 0, B2 = K$2(B2 ^ k2, 16), x2 = x2 + B2 | 0, _3 = K$2(_3 ^ x2, 12), k2 = k2 + _3 | 0, B2 = K$2(B2 ^ k2, 8), x2 = x2 + B2 | 0, _3 = K$2(_3 ^ x2, 7), O3 = O3 + p2 | 0, A2 = K$2(A2 ^ O3, 16), E2 = E2 + A2 | 0, p2 = K$2(p2 ^ E2, 12), O3 = O3 + p2 | 0, A2 = K$2(A2 ^ O3, 8), E2 = E2 + A2 | 0, p2 = K$2(p2 ^ E2, 7), j2 = j2 + C2 | 0, A2 = K$2(A2 ^ j2, 16), x2 = x2 + A2 | 0, C2 = K$2(C2 ^ x2, 12), j2 = j2 + C2 | 0, A2 = K$2(A2 ^ j2, 8), x2 = x2 + A2 | 0, C2 = K$2(C2 ^ x2, 7), L2 = L2 + _3 | 0, I2 = K$2(I2 ^ L2, 16), E2 = E2 + I2 | 0, _3 = K$2(_3 ^ E2, 12), L2 = L2 + _3 | 0, I2 = K$2(I2 ^ L2, 8), E2 = E2 + I2 | 0, _3 = K$2(_3 ^ E2, 7), k2 = k2 + p2 | 0, v2 = K$2(v2 ^ k2, 16), b2 = b2 + v2 | 0, p2 = K$2(p2 ^ b2, 12), k2 = k2 + p2 | 0, v2 = K$2(v2 ^ k2, 8), b2 = b2 + v2 | 0, p2 = K$2(p2 ^ b2, 7), O3 = O3 + T2 | 0, B2 = K$2(B2 ^ O3, 16), g2 = g2 + B2 | 0, T2 = K$2(T2 ^ g2, 12), O3 = O3 + T2 | 0, B2 = K$2(B2 ^ O3, 8), g2 = g2 + B2 | 0, T2 = K$2(T2 ^ g2, 7);
|
|
18612
18298
|
let N2 = 0;
|
|
18613
|
-
r2[N2++] = i3 +
|
|
18299
|
+
r2[N2++] = i3 + j2 | 0, r2[N2++] = c2 + L2 | 0, r2[N2++] = f4 + k2 | 0, r2[N2++] = u2 + O3 | 0, r2[N2++] = a2 + T2 | 0, r2[N2++] = l2 + C2 | 0, r2[N2++] = d3 + _3 | 0, r2[N2++] = h4 + p2 | 0, r2[N2++] = y3 + b2 | 0, r2[N2++] = m3 + g2 | 0, r2[N2++] = w2 + x2 | 0, r2[N2++] = U2 + E2 | 0, r2[N2++] = F2 + I2 | 0, r2[N2++] = R3 + v2 | 0, r2[N2++] = Z2 + B2 | 0, r2[N2++] = H2 + A2 | 0;
|
|
18614
18300
|
}
|
|
18615
18301
|
const yf = df(bf, { counterRight: false, counterLength: 4, allowShortKeys: false }), mf = new Uint8Array(16), xo$1 = (t2, e2) => {
|
|
18616
18302
|
t2.update(e2);
|
|
@@ -19104,33 +18790,33 @@ function Mf(t2) {
|
|
|
19104
18790
|
if (g2 === we$2) throw new Error("invalid private or public key received");
|
|
19105
18791
|
return F2(g2);
|
|
19106
18792
|
}
|
|
19107
|
-
function
|
|
18793
|
+
function j2(p2) {
|
|
19108
18794
|
return H2(p2, U2);
|
|
19109
18795
|
}
|
|
19110
|
-
function
|
|
18796
|
+
function L2(p2, b2, g2) {
|
|
19111
18797
|
const x2 = w2(p2 * (b2 - g2));
|
|
19112
18798
|
return b2 = w2(b2 - x2), g2 = w2(g2 + x2), { x_2: b2, x_3: g2 };
|
|
19113
18799
|
}
|
|
19114
18800
|
function k2(p2, b2) {
|
|
19115
18801
|
Rn$1("u", p2, we$2, n3), Rn$1("scalar", b2, h4, m3);
|
|
19116
18802
|
const g2 = b2, x2 = p2;
|
|
19117
|
-
let
|
|
18803
|
+
let E2 = ee$2, I2 = we$2, v2 = p2, B2 = ee$2, A2 = we$2;
|
|
19118
18804
|
for (let D2 = BigInt(u2 - 1); D2 >= we$2; D2--) {
|
|
19119
18805
|
const P3 = g2 >> D2 & ee$2;
|
|
19120
|
-
A2 ^= P3, { x_2:
|
|
19121
|
-
const $2 =
|
|
19122
|
-
|
|
18806
|
+
A2 ^= P3, { x_2: E2, x_3: v2 } = L2(A2, E2, v2), { x_2: I2, x_3: B2 } = L2(A2, I2, B2), A2 = P3;
|
|
18807
|
+
const $2 = E2 + I2, V3 = w2($2 * $2), q3 = E2 - I2, G2 = w2(q3 * q3), M3 = V3 - G2, Y2 = v2 + B2, Yt2 = v2 - B2, ce2 = w2(Yt2 * $2), fe2 = w2(Y2 * q3), Qn2 = ce2 + fe2, tr2 = ce2 - fe2;
|
|
18808
|
+
v2 = w2(Qn2 * Qn2), B2 = w2(x2 * w2(tr2 * tr2)), E2 = w2(V3 * G2), I2 = w2(M3 * (V3 + w2(d3 * M3)));
|
|
19123
18809
|
}
|
|
19124
|
-
({ x_2:
|
|
18810
|
+
({ x_2: E2, x_3: v2 } = L2(A2, E2, v2)), { x_2: I2, x_3: B2 } = L2(A2, I2, B2);
|
|
19125
18811
|
const N2 = s2(I2);
|
|
19126
|
-
return w2(
|
|
18812
|
+
return w2(E2 * N2);
|
|
19127
18813
|
}
|
|
19128
18814
|
const O3 = { secretKey: a2, publicKey: a2, seed: a2 }, T2 = (p2 = f4(a2)) => (ht$1(p2, O3.seed), p2);
|
|
19129
18815
|
function C2(p2) {
|
|
19130
18816
|
const b2 = T2(p2);
|
|
19131
|
-
return { secretKey: b2, publicKey:
|
|
18817
|
+
return { secretKey: b2, publicKey: j2(b2) };
|
|
19132
18818
|
}
|
|
19133
|
-
return { keygen: C2, getSharedSecret: (p2, b2) => H2(p2, b2), getPublicKey: (p2) =>
|
|
18819
|
+
return { keygen: C2, getSharedSecret: (p2, b2) => H2(p2, b2), getPublicKey: (p2) => j2(p2), scalarMult: H2, scalarMultBase: j2, utils: { randomSecretKey: T2, randomPrivateKey: T2 }, GuBytes: U2.slice(), lengths: O3 };
|
|
19134
18820
|
}
|
|
19135
18821
|
const Kf = BigInt(1), Go$1 = BigInt(2), qf = BigInt(3), Ff = BigInt(5);
|
|
19136
18822
|
BigInt(8);
|
|
@@ -19249,23 +18935,23 @@ function ta$1(t2, e2 = {}) {
|
|
|
19249
18935
|
if (!r2.isOdd) throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
19250
18936
|
}
|
|
19251
18937
|
function l2(_3, p2, b2) {
|
|
19252
|
-
const { x: g2, y: x2 } = p2.toAffine(),
|
|
18938
|
+
const { x: g2, y: x2 } = p2.toAffine(), E2 = r2.toBytes(g2);
|
|
19253
18939
|
if (He$2(b2, "isCompressed"), b2) {
|
|
19254
18940
|
a2();
|
|
19255
18941
|
const I2 = !r2.isOdd(x2);
|
|
19256
|
-
return _t$2(Xo$1(I2),
|
|
19257
|
-
} else return _t$2(Uint8Array.of(4),
|
|
18942
|
+
return _t$2(Xo$1(I2), E2);
|
|
18943
|
+
} else return _t$2(Uint8Array.of(4), E2, r2.toBytes(x2));
|
|
19258
18944
|
}
|
|
19259
18945
|
function d3(_3) {
|
|
19260
18946
|
Kt$2(_3, void 0, "Point");
|
|
19261
|
-
const { publicKey: p2, publicKeyUncompressed: b2 } = u2, g2 = _3.length, x2 = _3[0],
|
|
18947
|
+
const { publicKey: p2, publicKeyUncompressed: b2 } = u2, g2 = _3.length, x2 = _3[0], E2 = _3.subarray(1);
|
|
19262
18948
|
if (g2 === p2 && (x2 === 2 || x2 === 3)) {
|
|
19263
|
-
const I2 = r2.fromBytes(
|
|
18949
|
+
const I2 = r2.fromBytes(E2);
|
|
19264
18950
|
if (!r2.isValid(I2)) throw new Error("bad point: is not on curve, wrong x");
|
|
19265
|
-
const
|
|
18951
|
+
const v2 = m3(I2);
|
|
19266
18952
|
let B2;
|
|
19267
18953
|
try {
|
|
19268
|
-
B2 = r2.sqrt(
|
|
18954
|
+
B2 = r2.sqrt(v2);
|
|
19269
18955
|
} catch (D2) {
|
|
19270
18956
|
const P3 = D2 instanceof Error ? ": " + D2.message : "";
|
|
19271
18957
|
throw new Error("bad point: is not on curve, sqrt error" + P3);
|
|
@@ -19274,9 +18960,9 @@ function ta$1(t2, e2 = {}) {
|
|
|
19274
18960
|
const A2 = r2.isOdd(B2);
|
|
19275
18961
|
return (x2 & 1) === 1 !== A2 && (B2 = r2.neg(B2)), { x: I2, y: B2 };
|
|
19276
18962
|
} else if (g2 === b2 && x2 === 4) {
|
|
19277
|
-
const I2 = r2.BYTES,
|
|
19278
|
-
if (!w2(
|
|
19279
|
-
return { x:
|
|
18963
|
+
const I2 = r2.BYTES, v2 = r2.fromBytes(E2.subarray(0, I2)), B2 = r2.fromBytes(E2.subarray(I2, I2 * 2));
|
|
18964
|
+
if (!w2(v2, B2)) throw new Error("bad point: is not on curve");
|
|
18965
|
+
return { x: v2, y: B2 };
|
|
19280
18966
|
} else throw new Error(`bad point: got length ${g2}, expected compressed=${p2} or uncompressed=${b2}`);
|
|
19281
18967
|
}
|
|
19282
18968
|
const h4 = e2.toBytes || l2, y3 = e2.fromBytes || d3;
|
|
@@ -19302,16 +18988,16 @@ function ta$1(t2, e2 = {}) {
|
|
|
19302
18988
|
if (!f4 || !f4.basises) throw new Error("no endo");
|
|
19303
18989
|
return Xf(_3, f4.basises, o3.ORDER);
|
|
19304
18990
|
}
|
|
19305
|
-
const
|
|
18991
|
+
const j2 = No$1((_3, p2) => {
|
|
19306
18992
|
const { X: b2, Y: g2, Z: x2 } = _3;
|
|
19307
18993
|
if (r2.eql(x2, r2.ONE)) return { x: b2, y: g2 };
|
|
19308
|
-
const
|
|
19309
|
-
p2 == null && (p2 =
|
|
19310
|
-
const I2 = r2.mul(b2, p2),
|
|
19311
|
-
if (
|
|
18994
|
+
const E2 = _3.is0();
|
|
18995
|
+
p2 == null && (p2 = E2 ? r2.ONE : r2.inv(x2));
|
|
18996
|
+
const I2 = r2.mul(b2, p2), v2 = r2.mul(g2, p2), B2 = r2.mul(x2, p2);
|
|
18997
|
+
if (E2) return { x: r2.ZERO, y: r2.ZERO };
|
|
19312
18998
|
if (!r2.eql(B2, r2.ONE)) throw new Error("invZ was invalid");
|
|
19313
|
-
return { x: I2, y:
|
|
19314
|
-
}),
|
|
18999
|
+
return { x: I2, y: v2 };
|
|
19000
|
+
}), L2 = No$1((_3) => {
|
|
19315
19001
|
if (_3.is0()) {
|
|
19316
19002
|
if (e2.allowInfinityPoint && !r2.is0(_3.Y)) return;
|
|
19317
19003
|
throw new Error("bad point: ZERO");
|
|
@@ -19355,7 +19041,7 @@ function ta$1(t2, e2 = {}) {
|
|
|
19355
19041
|
return C2.createCache(this, p2), b2 || this.multiply(Ze$2), this;
|
|
19356
19042
|
}
|
|
19357
19043
|
assertValidity() {
|
|
19358
|
-
|
|
19044
|
+
L2(this);
|
|
19359
19045
|
}
|
|
19360
19046
|
hasEvenY() {
|
|
19361
19047
|
const { y: p2 } = this.toAffine();
|
|
@@ -19364,26 +19050,26 @@ function ta$1(t2, e2 = {}) {
|
|
|
19364
19050
|
}
|
|
19365
19051
|
equals(p2) {
|
|
19366
19052
|
Z2(p2);
|
|
19367
|
-
const { X: b2, Y: g2, Z: x2 } = this, { X:
|
|
19053
|
+
const { X: b2, Y: g2, Z: x2 } = this, { X: E2, Y: I2, Z: v2 } = p2, B2 = r2.eql(r2.mul(b2, v2), r2.mul(E2, x2)), A2 = r2.eql(r2.mul(g2, v2), r2.mul(I2, x2));
|
|
19368
19054
|
return B2 && A2;
|
|
19369
19055
|
}
|
|
19370
19056
|
negate() {
|
|
19371
19057
|
return new O3(this.X, r2.neg(this.Y), this.Z);
|
|
19372
19058
|
}
|
|
19373
19059
|
double() {
|
|
19374
|
-
const { a: p2, b: b2 } = s2, g2 = r2.mul(b2, Ze$2), { X: x2, Y:
|
|
19375
|
-
let
|
|
19376
|
-
return $2 = r2.add($2, $2), A2 = r2.mul(x2, I2), A2 = r2.add(A2, A2),
|
|
19060
|
+
const { a: p2, b: b2 } = s2, g2 = r2.mul(b2, Ze$2), { X: x2, Y: E2, Z: I2 } = this;
|
|
19061
|
+
let v2 = r2.ZERO, B2 = r2.ZERO, A2 = r2.ZERO, N2 = r2.mul(x2, x2), D2 = r2.mul(E2, E2), P3 = r2.mul(I2, I2), $2 = r2.mul(x2, E2);
|
|
19062
|
+
return $2 = r2.add($2, $2), A2 = r2.mul(x2, I2), A2 = r2.add(A2, A2), v2 = r2.mul(p2, A2), B2 = r2.mul(g2, P3), B2 = r2.add(v2, B2), v2 = r2.sub(D2, B2), B2 = r2.add(D2, B2), B2 = r2.mul(v2, B2), v2 = r2.mul($2, v2), A2 = r2.mul(g2, A2), P3 = r2.mul(p2, P3), $2 = r2.sub(N2, P3), $2 = r2.mul(p2, $2), $2 = r2.add($2, A2), A2 = r2.add(N2, N2), N2 = r2.add(A2, N2), N2 = r2.add(N2, P3), N2 = r2.mul(N2, $2), B2 = r2.add(B2, N2), P3 = r2.mul(E2, I2), P3 = r2.add(P3, P3), N2 = r2.mul(P3, $2), v2 = r2.sub(v2, N2), A2 = r2.mul(P3, D2), A2 = r2.add(A2, A2), A2 = r2.add(A2, A2), new O3(v2, B2, A2);
|
|
19377
19063
|
}
|
|
19378
19064
|
add(p2) {
|
|
19379
19065
|
Z2(p2);
|
|
19380
|
-
const { X: b2, Y: g2, Z: x2 } = this, { X:
|
|
19066
|
+
const { X: b2, Y: g2, Z: x2 } = this, { X: E2, Y: I2, Z: v2 } = p2;
|
|
19381
19067
|
let B2 = r2.ZERO, A2 = r2.ZERO, N2 = r2.ZERO;
|
|
19382
19068
|
const D2 = s2.a, P3 = r2.mul(s2.b, Ze$2);
|
|
19383
|
-
let $2 = r2.mul(b2,
|
|
19069
|
+
let $2 = r2.mul(b2, E2), V3 = r2.mul(g2, I2), q3 = r2.mul(x2, v2), G2 = r2.add(b2, g2), M3 = r2.add(E2, I2);
|
|
19384
19070
|
G2 = r2.mul(G2, M3), M3 = r2.add($2, V3), G2 = r2.sub(G2, M3), M3 = r2.add(b2, x2);
|
|
19385
|
-
let Y2 = r2.add(
|
|
19386
|
-
return M3 = r2.mul(M3, Y2), Y2 = r2.add($2,
|
|
19071
|
+
let Y2 = r2.add(E2, v2);
|
|
19072
|
+
return M3 = r2.mul(M3, Y2), Y2 = r2.add($2, q3), M3 = r2.sub(M3, Y2), Y2 = r2.add(g2, x2), B2 = r2.add(I2, v2), Y2 = r2.mul(Y2, B2), B2 = r2.add(V3, q3), Y2 = r2.sub(Y2, B2), N2 = r2.mul(D2, M3), B2 = r2.mul(P3, q3), N2 = r2.add(B2, N2), B2 = r2.sub(V3, N2), N2 = r2.add(V3, N2), A2 = r2.mul(B2, N2), V3 = r2.add($2, $2), V3 = r2.add(V3, $2), q3 = r2.mul(D2, q3), M3 = r2.mul(P3, M3), V3 = r2.add(V3, q3), q3 = r2.sub($2, q3), q3 = r2.mul(D2, q3), M3 = r2.add(M3, q3), $2 = r2.mul(V3, M3), A2 = r2.add(A2, $2), $2 = r2.mul(Y2, M3), B2 = r2.mul(G2, B2), B2 = r2.sub(B2, $2), $2 = r2.mul(G2, V3), N2 = r2.mul(Y2, N2), N2 = r2.add(N2, $2), new O3(B2, A2, N2);
|
|
19387
19073
|
}
|
|
19388
19074
|
subtract(p2) {
|
|
19389
19075
|
return this.add(p2.negate());
|
|
@@ -19395,13 +19081,13 @@ function ta$1(t2, e2 = {}) {
|
|
|
19395
19081
|
const { endo: b2 } = e2;
|
|
19396
19082
|
if (!o3.isValidNot0(p2)) throw new Error("invalid scalar: out of range");
|
|
19397
19083
|
let g2, x2;
|
|
19398
|
-
const
|
|
19084
|
+
const E2 = (I2) => C2.cached(this, I2, (v2) => Tn$1(O3, v2));
|
|
19399
19085
|
if (b2) {
|
|
19400
|
-
const { k1neg: I2, k1:
|
|
19086
|
+
const { k1neg: I2, k1: v2, k2neg: B2, k2: A2 } = H2(p2), { p: N2, f: D2 } = E2(v2), { p: P3, f: $2 } = E2(A2);
|
|
19401
19087
|
x2 = D2.add($2), g2 = k2(b2.beta, N2, P3, I2, B2);
|
|
19402
19088
|
} else {
|
|
19403
|
-
const { p: I2, f:
|
|
19404
|
-
g2 = I2, x2 =
|
|
19089
|
+
const { p: I2, f: v2 } = E2(p2);
|
|
19090
|
+
g2 = I2, x2 = v2;
|
|
19405
19091
|
}
|
|
19406
19092
|
return Tn$1(O3, [g2, x2])[0];
|
|
19407
19093
|
}
|
|
@@ -19412,7 +19098,7 @@ function ta$1(t2, e2 = {}) {
|
|
|
19412
19098
|
if (p2 === ne$1) return g2;
|
|
19413
19099
|
if (C2.hasCache(this)) return this.multiply(p2);
|
|
19414
19100
|
if (b2) {
|
|
19415
|
-
const { k1neg: x2, k1:
|
|
19101
|
+
const { k1neg: x2, k1: E2, k2neg: I2, k2: v2 } = H2(p2), { p1: B2, p2: A2 } = Pf(O3, g2, E2, v2);
|
|
19416
19102
|
return k2(b2.beta, B2, A2, x2, I2);
|
|
19417
19103
|
} else return C2.unsafe(g2, p2);
|
|
19418
19104
|
}
|
|
@@ -19421,7 +19107,7 @@ function ta$1(t2, e2 = {}) {
|
|
|
19421
19107
|
return x2.is0() ? void 0 : x2;
|
|
19422
19108
|
}
|
|
19423
19109
|
toAffine(p2) {
|
|
19424
|
-
return
|
|
19110
|
+
return j2(this, p2);
|
|
19425
19111
|
}
|
|
19426
19112
|
isTorsionFree() {
|
|
19427
19113
|
const { isTorsionFree: p2 } = e2;
|
|
@@ -19537,23 +19223,23 @@ function na(t2, e2, n3 = {}) {
|
|
|
19537
19223
|
}
|
|
19538
19224
|
function F2(b2, g2) {
|
|
19539
19225
|
Pn$1(g2);
|
|
19540
|
-
const x2 = h4.signature,
|
|
19541
|
-
return Kt$2(b2,
|
|
19226
|
+
const x2 = h4.signature, E2 = g2 === "compact" ? x2 : g2 === "recovered" ? x2 + 1 : void 0;
|
|
19227
|
+
return Kt$2(b2, E2, `${g2} signature`);
|
|
19542
19228
|
}
|
|
19543
19229
|
class R3 {
|
|
19544
|
-
constructor(g2, x2,
|
|
19545
|
-
this.r = U2("r", g2), this.s = U2("s", x2),
|
|
19230
|
+
constructor(g2, x2, E2) {
|
|
19231
|
+
this.r = U2("r", g2), this.s = U2("s", x2), E2 != null && (this.recovery = E2), Object.freeze(this);
|
|
19546
19232
|
}
|
|
19547
19233
|
static fromBytes(g2, x2 = m3) {
|
|
19548
19234
|
F2(g2, x2);
|
|
19549
|
-
let
|
|
19235
|
+
let E2;
|
|
19550
19236
|
if (x2 === "der") {
|
|
19551
19237
|
const { r: A2, s: N2 } = xt$2.toSig(Kt$2(g2));
|
|
19552
19238
|
return new R3(A2, N2);
|
|
19553
19239
|
}
|
|
19554
|
-
x2 === "recovered" && (
|
|
19555
|
-
const I2 = i3.BYTES,
|
|
19556
|
-
return new R3(i3.fromBytes(
|
|
19240
|
+
x2 === "recovered" && (E2 = g2[0], x2 = "compact", g2 = g2.subarray(1));
|
|
19241
|
+
const I2 = i3.BYTES, v2 = g2.subarray(0, I2), B2 = g2.subarray(I2, I2 * 2);
|
|
19242
|
+
return new R3(i3.fromBytes(v2), i3.fromBytes(B2), E2);
|
|
19557
19243
|
}
|
|
19558
19244
|
static fromHex(g2, x2) {
|
|
19559
19245
|
return this.fromBytes(Re$1(g2), x2);
|
|
@@ -19562,12 +19248,12 @@ function na(t2, e2, n3 = {}) {
|
|
|
19562
19248
|
return new R3(this.r, this.s, g2);
|
|
19563
19249
|
}
|
|
19564
19250
|
recoverPublicKey(g2) {
|
|
19565
|
-
const x2 = s2.ORDER, { r:
|
|
19566
|
-
if (
|
|
19567
|
-
if (c2 * Wo$1 < x2 &&
|
|
19568
|
-
const A2 =
|
|
19251
|
+
const x2 = s2.ORDER, { r: E2, s: I2, recovery: v2 } = this;
|
|
19252
|
+
if (v2 == null || ![0, 1, 2, 3].includes(v2)) throw new Error("recovery id invalid");
|
|
19253
|
+
if (c2 * Wo$1 < x2 && v2 > 1) throw new Error("recovery id is ambiguous for h>1 curve");
|
|
19254
|
+
const A2 = v2 === 2 || v2 === 3 ? E2 + c2 : E2;
|
|
19569
19255
|
if (!s2.isValid(A2)) throw new Error("recovery id 2 or 3 invalid");
|
|
19570
|
-
const N2 = s2.toBytes(A2), D2 = t2.fromBytes(_t$2(Xo$1((
|
|
19256
|
+
const N2 = s2.toBytes(A2), D2 = t2.fromBytes(_t$2(Xo$1((v2 & 1) === 0), N2)), P3 = i3.inv(A2), $2 = H2(tt$2("msgHash", g2)), V3 = i3.create(-$2 * P3), q3 = i3.create(I2 * P3), G2 = t2.BASE.multiplyUnsafe(V3).add(D2.multiplyUnsafe(q3));
|
|
19571
19257
|
if (G2.is0()) throw new Error("point at infinify");
|
|
19572
19258
|
return G2.assertValidity(), G2;
|
|
19573
19259
|
}
|
|
@@ -19576,12 +19262,12 @@ function na(t2, e2, n3 = {}) {
|
|
|
19576
19262
|
}
|
|
19577
19263
|
toBytes(g2 = m3) {
|
|
19578
19264
|
if (Pn$1(g2), g2 === "der") return Re$1(xt$2.hexFromSig(this));
|
|
19579
|
-
const x2 = i3.toBytes(this.r),
|
|
19265
|
+
const x2 = i3.toBytes(this.r), E2 = i3.toBytes(this.s);
|
|
19580
19266
|
if (g2 === "recovered") {
|
|
19581
19267
|
if (this.recovery == null) throw new Error("recovery bit must be present");
|
|
19582
|
-
return _t$2(Uint8Array.of(this.recovery), x2,
|
|
19268
|
+
return _t$2(Uint8Array.of(this.recovery), x2, E2);
|
|
19583
19269
|
}
|
|
19584
|
-
return _t$2(x2,
|
|
19270
|
+
return _t$2(x2, E2);
|
|
19585
19271
|
}
|
|
19586
19272
|
toHex(g2) {
|
|
19587
19273
|
return Jt$2(this.toBytes(g2));
|
|
@@ -19612,49 +19298,49 @@ function na(t2, e2, n3 = {}) {
|
|
|
19612
19298
|
}
|
|
19613
19299
|
const Z2 = n3.bits2int || function(g2) {
|
|
19614
19300
|
if (g2.length > 8192) throw new Error("input is too large");
|
|
19615
|
-
const x2 = Ve$2(g2),
|
|
19616
|
-
return
|
|
19301
|
+
const x2 = Ve$2(g2), E2 = g2.length * 8 - f4;
|
|
19302
|
+
return E2 > 0 ? x2 >> BigInt(E2) : x2;
|
|
19617
19303
|
}, H2 = n3.bits2int_modN || function(g2) {
|
|
19618
19304
|
return i3.create(Z2(g2));
|
|
19619
|
-
},
|
|
19620
|
-
function
|
|
19621
|
-
return Rn$1("num < 2^" + f4, b2, Et$3,
|
|
19305
|
+
}, j2 = me$2(f4);
|
|
19306
|
+
function L2(b2) {
|
|
19307
|
+
return Rn$1("num < 2^" + f4, b2, Et$3, j2), i3.toBytes(b2);
|
|
19622
19308
|
}
|
|
19623
19309
|
function k2(b2, g2) {
|
|
19624
19310
|
return Kt$2(b2, void 0, "message"), g2 ? Kt$2(e2(b2), void 0, "prehashed message") : b2;
|
|
19625
19311
|
}
|
|
19626
19312
|
function O3(b2, g2, x2) {
|
|
19627
19313
|
if (["recovered", "canonical"].some((V3) => V3 in x2)) throw new Error("sign() legacy options not supported");
|
|
19628
|
-
const { lowS:
|
|
19314
|
+
const { lowS: E2, prehash: I2, extraEntropy: v2 } = Hn$1(x2, y3);
|
|
19629
19315
|
b2 = k2(b2, I2);
|
|
19630
|
-
const B2 = H2(b2), A2 = re$1(i3, g2), N2 = [
|
|
19631
|
-
if (
|
|
19632
|
-
const V3 =
|
|
19316
|
+
const B2 = H2(b2), A2 = re$1(i3, g2), N2 = [L2(A2), L2(B2)];
|
|
19317
|
+
if (v2 != null && v2 !== false) {
|
|
19318
|
+
const V3 = v2 === true ? r2(h4.secretKey) : v2;
|
|
19633
19319
|
N2.push(tt$2("extraEntropy", V3));
|
|
19634
19320
|
}
|
|
19635
19321
|
const D2 = _t$2(...N2), P3 = B2;
|
|
19636
19322
|
function $2(V3) {
|
|
19637
|
-
const
|
|
19638
|
-
if (!i3.isValidNot0(
|
|
19639
|
-
const G2 = i3.inv(
|
|
19323
|
+
const q3 = Z2(V3);
|
|
19324
|
+
if (!i3.isValidNot0(q3)) return;
|
|
19325
|
+
const G2 = i3.inv(q3), M3 = t2.BASE.multiply(q3).toAffine(), Y2 = i3.create(M3.x);
|
|
19640
19326
|
if (Y2 === Et$3) return;
|
|
19641
19327
|
const Yt2 = i3.create(G2 * i3.create(P3 + Y2 * A2));
|
|
19642
19328
|
if (Yt2 === Et$3) return;
|
|
19643
19329
|
let ce2 = (M3.x === Y2 ? 0 : 2) | Number(M3.y & ne$1), fe2 = Yt2;
|
|
19644
|
-
return
|
|
19330
|
+
return E2 && w2(Yt2) && (fe2 = i3.neg(Yt2), ce2 ^= 1), new R3(Y2, fe2, ce2);
|
|
19645
19331
|
}
|
|
19646
19332
|
return { seed: D2, k2sig: $2 };
|
|
19647
19333
|
}
|
|
19648
19334
|
function T2(b2, g2, x2 = {}) {
|
|
19649
19335
|
b2 = tt$2("message", b2);
|
|
19650
|
-
const { seed:
|
|
19651
|
-
return Af(e2.outputLen, i3.BYTES, o3)(
|
|
19336
|
+
const { seed: E2, k2sig: I2 } = O3(b2, g2, x2);
|
|
19337
|
+
return Af(e2.outputLen, i3.BYTES, o3)(E2, I2);
|
|
19652
19338
|
}
|
|
19653
19339
|
function C2(b2) {
|
|
19654
19340
|
let g2;
|
|
19655
|
-
const x2 = typeof b2 == "string" || Ue$3(b2),
|
|
19656
|
-
if (!x2 && !
|
|
19657
|
-
if (
|
|
19341
|
+
const x2 = typeof b2 == "string" || Ue$3(b2), E2 = !x2 && b2 !== null && typeof b2 == "object" && typeof b2.r == "bigint" && typeof b2.s == "bigint";
|
|
19342
|
+
if (!x2 && !E2) throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
|
|
19343
|
+
if (E2) g2 = new R3(b2.r, b2.s);
|
|
19658
19344
|
else if (x2) {
|
|
19659
19345
|
try {
|
|
19660
19346
|
g2 = R3.fromBytes(tt$2("sig", b2), "der");
|
|
@@ -19669,23 +19355,23 @@ function na(t2, e2, n3 = {}) {
|
|
|
19669
19355
|
}
|
|
19670
19356
|
return g2 || false;
|
|
19671
19357
|
}
|
|
19672
|
-
function _3(b2, g2, x2,
|
|
19673
|
-
const { lowS: I2, prehash:
|
|
19674
|
-
if (x2 = tt$2("publicKey", x2), g2 = k2(tt$2("message", g2),
|
|
19358
|
+
function _3(b2, g2, x2, E2 = {}) {
|
|
19359
|
+
const { lowS: I2, prehash: v2, format: B2 } = Hn$1(E2, y3);
|
|
19360
|
+
if (x2 = tt$2("publicKey", x2), g2 = k2(tt$2("message", g2), v2), "strict" in E2) throw new Error("options.strict was renamed to lowS");
|
|
19675
19361
|
const A2 = B2 === void 0 ? C2(b2) : R3.fromBytes(tt$2("sig", b2), B2);
|
|
19676
19362
|
if (A2 === false) return false;
|
|
19677
19363
|
try {
|
|
19678
19364
|
const N2 = t2.fromBytes(x2);
|
|
19679
19365
|
if (I2 && A2.hasHighS()) return false;
|
|
19680
|
-
const { r: D2, s: P3 } = A2, $2 = H2(g2), V3 = i3.inv(P3),
|
|
19366
|
+
const { r: D2, s: P3 } = A2, $2 = H2(g2), V3 = i3.inv(P3), q3 = i3.create($2 * V3), G2 = i3.create(D2 * V3), M3 = t2.BASE.multiplyUnsafe(q3).add(N2.multiplyUnsafe(G2));
|
|
19681
19367
|
return M3.is0() ? false : i3.create(M3.x) === D2;
|
|
19682
19368
|
} catch {
|
|
19683
19369
|
return false;
|
|
19684
19370
|
}
|
|
19685
19371
|
}
|
|
19686
19372
|
function p2(b2, g2, x2 = {}) {
|
|
19687
|
-
const { prehash:
|
|
19688
|
-
return g2 = k2(g2,
|
|
19373
|
+
const { prehash: E2 } = Hn$1(x2, y3);
|
|
19374
|
+
return g2 = k2(g2, E2), R3.fromBytes(b2, "recovered").recoverPublicKey(g2).toBytes();
|
|
19689
19375
|
}
|
|
19690
19376
|
return Object.freeze({ keygen: u2, getPublicKey: a2, getSharedSecret: l2, utils: d3, lengths: h4, Point: t2, sign: T2, verify: _3, recoverPublicKey: p2, Signature: R3, hash: e2 });
|
|
19691
19377
|
}
|
|
@@ -19713,7 +19399,7 @@ function Dn$1(t2, e2) {
|
|
|
19713
19399
|
}
|
|
19714
19400
|
const Qo$1 = { p: BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"), n: BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"), h: BigInt(1), a: BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"), b: BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"), Gx: BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"), Gy: BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5") }, ts$1 = { p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"), n: BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"), h: BigInt(1), a: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"), b: BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"), Gx: BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"), Gy: BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f") }, es$1 = { p: BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), n: BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"), h: BigInt(1), a: BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"), b: BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"), Gx: BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"), Gy: BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650") }, ca = Ht$2(Qo$1.p), fa = Ht$2(ts$1.p), aa = Ht$2(es$1.p), ua = Dn$1({ ...Qo$1, Fp: ca, lowS: false }, Te$2);
|
|
19715
19401
|
Dn$1({ ...ts$1, Fp: fa, lowS: false }, wc), Dn$1({ ...es$1, Fp: aa, lowS: false, allowedPrivateKeyLengths: [130, 131, 132] }, mc);
|
|
19716
|
-
const la = ua, Vn$1 = "base10", rt$1 = "base16", oe$2 = "base64pad", Ge$3 = "base64url", se$2 = "utf8", Mn$1 = 0, ie$1 = 1, ve$2 = 2, da = 0, ns = 1,
|
|
19402
|
+
const la = ua, Vn$1 = "base10", rt$1 = "base16", oe$2 = "base64pad", Ge$3 = "base64url", se$2 = "utf8", Mn$1 = 0, ie$1 = 1, ve$2 = 2, da = 0, ns = 1, xe2 = 12, Kn$1 = 32;
|
|
19717
19403
|
function ha() {
|
|
19718
19404
|
const t2 = kn$1.utils.randomPrivateKey(), e2 = kn$1.getPublicKey(t2);
|
|
19719
19405
|
return { privateKey: toString(t2, rt$1), publicKey: toString(e2, rt$1) };
|
|
@@ -19750,7 +19436,7 @@ function os(t2) {
|
|
|
19750
19436
|
function ma(t2) {
|
|
19751
19437
|
const e2 = qn$1(typeof t2.type < "u" ? t2.type : Mn$1);
|
|
19752
19438
|
if (Zt$2(e2) === ie$1 && typeof t2.senderPublicKey > "u") throw new Error("Missing sender public key for type 1 envelope");
|
|
19753
|
-
const n3 = typeof t2.senderPublicKey < "u" ? fromString(t2.senderPublicKey, rt$1) : void 0, r2 = typeof t2.iv < "u" ? fromString(t2.iv, rt$1) : Mt$2(
|
|
19439
|
+
const n3 = typeof t2.senderPublicKey < "u" ? fromString(t2.senderPublicKey, rt$1) : void 0, r2 = typeof t2.iv < "u" ? fromString(t2.iv, rt$1) : Mt$2(xe2), o3 = fromString(t2.symKey, rt$1), s2 = Bo$1(o3, r2).encrypt(fromString(t2.message, se$2)), i3 = Fn$1({ type: e2, sealed: s2, iv: r2, senderPublicKey: n3 });
|
|
19754
19440
|
return t2.encoding === Ge$3 ? rs(i3) : i3;
|
|
19755
19441
|
}
|
|
19756
19442
|
function wa(t2) {
|
|
@@ -19759,7 +19445,7 @@ function wa(t2) {
|
|
|
19759
19445
|
return toString(o3, se$2);
|
|
19760
19446
|
}
|
|
19761
19447
|
function va(t2, e2) {
|
|
19762
|
-
const n3 = qn$1(ve$2), r2 = Mt$2(
|
|
19448
|
+
const n3 = qn$1(ve$2), r2 = Mt$2(xe2), o3 = fromString(t2, se$2), s2 = Fn$1({ type: n3, sealed: o3, iv: r2 });
|
|
19763
19449
|
return e2 === Ge$3 ? rs(s2) : s2;
|
|
19764
19450
|
}
|
|
19765
19451
|
function xa(t2, e2) {
|
|
@@ -19777,14 +19463,14 @@ function Fn$1(t2) {
|
|
|
19777
19463
|
function ze$1(t2) {
|
|
19778
19464
|
const e2 = (t2.encoding || oe$2) === Ge$3 ? os(t2.encoded) : t2.encoded, n3 = fromString(e2, oe$2), r2 = n3.slice(da, ns), o3 = ns;
|
|
19779
19465
|
if (Zt$2(r2) === ie$1) {
|
|
19780
|
-
const f4 = o3 + Kn$1, u2 = f4 +
|
|
19466
|
+
const f4 = o3 + Kn$1, u2 = f4 + xe2, a2 = n3.slice(o3, f4), l2 = n3.slice(f4, u2), d3 = n3.slice(u2);
|
|
19781
19467
|
return { type: r2, sealed: d3, iv: l2, senderPublicKey: a2 };
|
|
19782
19468
|
}
|
|
19783
19469
|
if (Zt$2(r2) === ve$2) {
|
|
19784
|
-
const f4 = n3.slice(o3), u2 = Mt$2(
|
|
19470
|
+
const f4 = n3.slice(o3), u2 = Mt$2(xe2);
|
|
19785
19471
|
return { type: r2, sealed: f4, iv: u2 };
|
|
19786
19472
|
}
|
|
19787
|
-
const s2 = o3 +
|
|
19473
|
+
const s2 = o3 + xe2, i3 = n3.slice(o3, s2), c2 = n3.slice(s2);
|
|
19788
19474
|
return { type: r2, sealed: c2, iv: i3 };
|
|
19789
19475
|
}
|
|
19790
19476
|
function Ea(t2, e2) {
|
|
@@ -20277,7 +19963,7 @@ function Bu(t2) {
|
|
|
20277
19963
|
return Hs$1(o3);
|
|
20278
19964
|
}
|
|
20279
19965
|
function Iu({ logger: t2, name: e2 }) {
|
|
20280
|
-
const n3 = typeof t2 == "string" ?
|
|
19966
|
+
const n3 = typeof t2 == "string" ? Ue$5({ opts: { level: t2, name: e2 } }).logger : t2;
|
|
20281
19967
|
return n3.level = typeof t2 == "string" ? t2 : t2.level, n3;
|
|
20282
19968
|
}
|
|
20283
19969
|
const PARSE_ERROR = "PARSE_ERROR";
|
|
@@ -20622,7 +20308,7 @@ let f$2 = class f2 {
|
|
|
20622
20308
|
return this.events.emit("register_error", t2), t2;
|
|
20623
20309
|
}
|
|
20624
20310
|
};
|
|
20625
|
-
const Ue$2 = "wc", Fe$1 = 2, ge$1 = "core", W$1 = `${Ue$2}@2:${ge$1}:`, Et$2 = { logger: "error" }, It$2 = { database: ":memory:" }, Tt$1 = "crypto", Me$2 = "client_ed25519_seed", Ct$1 = cjsExports$3.ONE_DAY, Pt$1 = "keychain", St$2 = "0.3", Ot$1 = "messages", Rt$2 = "0.3", At$1 = cjsExports$3.SIX_HOURS, xt$1 = "publisher", Nt$1 = "irn", $t$1 = "error", Ke$2 = "wss://relay.walletconnect.org", zt$1 = "relayer", C$1 = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", transport_closed: "relayer_transport_closed", publish: "relayer_publish" }, Lt$1 = "_subscription", M$1 = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, kt$1 = 0.1, Pe$1 = "2.23.
|
|
20311
|
+
const Ue$2 = "wc", Fe$1 = 2, ge$1 = "core", W$1 = `${Ue$2}@2:${ge$1}:`, Et$2 = { logger: "error" }, It$2 = { database: ":memory:" }, Tt$1 = "crypto", Me$2 = "client_ed25519_seed", Ct$1 = cjsExports$3.ONE_DAY, Pt$1 = "keychain", St$2 = "0.3", Ot$1 = "messages", Rt$2 = "0.3", At$1 = cjsExports$3.SIX_HOURS, xt$1 = "publisher", Nt$1 = "irn", $t$1 = "error", Ke$2 = "wss://relay.walletconnect.org", zt$1 = "relayer", C$1 = { message: "relayer_message", message_ack: "relayer_message_ack", connect: "relayer_connect", disconnect: "relayer_disconnect", error: "relayer_error", connection_stalled: "relayer_connection_stalled", transport_closed: "relayer_transport_closed", publish: "relayer_publish" }, Lt$1 = "_subscription", M$1 = { payload: "payload", connect: "connect", disconnect: "disconnect", error: "error" }, kt$1 = 0.1, Pe$1 = "2.23.1", ee$1 = { link_mode: "link_mode", relay: "relay" }, ye$1 = { inbound: "inbound", outbound: "outbound" }, jt$1 = "0.3", Ut$1 = "WALLETCONNECT_CLIENT_ID", Be$1 = "WALLETCONNECT_LINK_MODE_APPS", j$2 = { created: "subscription_created", deleted: "subscription_deleted", expired: "subscription_expired", disabled: "subscription_disabled", sync: "subscription_sync", resubscribed: "subscription_resubscribed" }, Ft$1 = "subscription", Mt$1 = "0.3", Kt$1 = "pairing", Bt$1 = "0.3", oe$1 = { wc_pairingDelete: { req: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1e3 }, res: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1001 } }, wc_pairingPing: { req: { ttl: cjsExports$3.THIRTY_SECONDS, prompt: false, tag: 1002 }, res: { ttl: cjsExports$3.THIRTY_SECONDS, prompt: false, tag: 1003 } }, unregistered_method: { req: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 0 }, res: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 0 } } }, ae$1 = { create: "pairing_create", expire: "pairing_expire", delete: "pairing_delete", ping: "pairing_ping" }, V2 = { created: "history_created", updated: "history_updated", deleted: "history_deleted", sync: "history_sync" }, Vt$1 = "history", qt$1 = "0.3", Gt$1 = "expirer", q2 = { created: "expirer_created", deleted: "expirer_deleted", expired: "expirer_expired", sync: "expirer_sync" }, Wt$1 = "0.3", Ht$1 = "verify-api", ir = "https://verify.walletconnect.com", Yt$1 = "https://verify.walletconnect.org", be$1 = Yt$1, Jt$1 = `${be$1}/v3`, Xt$1 = [ir, Yt$1], Zt$1 = "echo", Qt$1 = "https://echo.walletconnect.com", Y = { pairing_started: "pairing_started", pairing_uri_validation_success: "pairing_uri_validation_success", pairing_uri_not_expired: "pairing_uri_not_expired", store_new_pairing: "store_new_pairing", subscribing_pairing_topic: "subscribing_pairing_topic", subscribe_pairing_topic_success: "subscribe_pairing_topic_success", existing_pairing: "existing_pairing", pairing_not_expired: "pairing_not_expired", emit_inactive_pairing: "emit_inactive_pairing", emit_session_proposal: "emit_session_proposal", subscribing_to_pairing_topic: "subscribing_to_pairing_topic" }, X = { no_wss_connection: "no_wss_connection", no_internet_connection: "no_internet_connection", malformed_pairing_uri: "malformed_pairing_uri", active_pairing_already_exists: "active_pairing_already_exists", subscribe_pairing_topic_failure: "subscribe_pairing_topic_failure", pairing_expired: "pairing_expired", proposal_expired: "proposal_expired", proposal_listener_not_found: "proposal_listener_not_found" }, rr = { session_approve_started: "session_approve_started", proposal_not_expired: "proposal_not_expired", session_namespaces_validation_success: "session_namespaces_validation_success", create_session_topic: "create_session_topic", subscribing_session_topic: "subscribing_session_topic", subscribe_session_topic_success: "subscribe_session_topic_success", publishing_session_approve: "publishing_session_approve", session_approve_publish_success: "session_approve_publish_success", store_session: "store_session", publishing_session_settle: "publishing_session_settle", session_settle_publish_success: "session_settle_publish_success", session_request_response_started: "session_request_response_started", session_request_response_validation_success: "session_request_response_validation_success", session_request_response_publish_started: "session_request_response_publish_started" }, nr = { no_internet_connection: "no_internet_connection", no_wss_connection: "no_wss_connection", proposal_expired: "proposal_expired", subscribe_session_topic_failure: "subscribe_session_topic_failure", session_approve_publish_failure: "session_approve_publish_failure", session_settle_publish_failure: "session_settle_publish_failure", session_approve_namespace_validation_failure: "session_approve_namespace_validation_failure", proposal_not_found: "proposal_not_found", session_request_response_validation_failure: "session_request_response_validation_failure", session_request_response_publish_failure: "session_request_response_publish_failure" }, or = { authenticated_session_approve_started: "authenticated_session_approve_started", create_authenticated_session_topic: "create_authenticated_session_topic", cacaos_verified: "cacaos_verified", store_authenticated_session: "store_authenticated_session", subscribing_authenticated_session_topic: "subscribing_authenticated_session_topic", subscribe_authenticated_session_topic_success: "subscribe_authenticated_session_topic_success", publishing_authenticated_session_approve: "publishing_authenticated_session_approve" }, ar = { no_internet_connection: "no_internet_connection", invalid_cacao: "invalid_cacao", subscribe_authenticated_session_topic_failure: "subscribe_authenticated_session_topic_failure", authenticated_session_approve_publish_failure: "authenticated_session_approve_publish_failure", authenticated_session_pending_request_not_found: "authenticated_session_pending_request_not_found" }, ei = 0.1, ti = "event-client", ii = 86400, si = "https://pulse.walletconnect.org/batch";
|
|
20626
20312
|
function cr(r2, e2) {
|
|
20627
20313
|
if (r2.length >= 255) throw new TypeError("Alphabet too long");
|
|
20628
20314
|
for (var t2 = new Uint8Array(256), i3 = 0; i3 < t2.length; i3++) t2[i3] = 255;
|
|
@@ -20635,14 +20321,14 @@ function cr(r2, e2) {
|
|
|
20635
20321
|
function g2(u2) {
|
|
20636
20322
|
if (u2 instanceof Uint8Array || (ArrayBuffer.isView(u2) ? u2 = new Uint8Array(u2.buffer, u2.byteOffset, u2.byteLength) : Array.isArray(u2) && (u2 = Uint8Array.from(u2))), !(u2 instanceof Uint8Array)) throw new TypeError("Expected Uint8Array");
|
|
20637
20323
|
if (u2.length === 0) return "";
|
|
20638
|
-
for (var m3 = 0, D2 = 0, w2 = 0,
|
|
20639
|
-
for (var
|
|
20640
|
-
for (var k2 = u2[w2], T2 = 0,
|
|
20324
|
+
for (var m3 = 0, D2 = 0, w2 = 0, E2 = u2.length; w2 !== E2 && u2[w2] === 0; ) w2++, m3++;
|
|
20325
|
+
for (var L2 = (E2 - w2) * l2 + 1 >>> 0, I2 = new Uint8Array(L2); w2 !== E2; ) {
|
|
20326
|
+
for (var k2 = u2[w2], T2 = 0, S3 = L2 - 1; (k2 !== 0 || T2 < D2) && S3 !== -1; S3--, T2++) k2 += 256 * I2[S3] >>> 0, I2[S3] = k2 % a2 >>> 0, k2 = k2 / a2 >>> 0;
|
|
20641
20327
|
if (k2 !== 0) throw new Error("Non-zero carry");
|
|
20642
20328
|
D2 = T2, w2++;
|
|
20643
20329
|
}
|
|
20644
|
-
for (var O3 =
|
|
20645
|
-
for (var te2 = c2.repeat(m3); O3 <
|
|
20330
|
+
for (var O3 = L2 - D2; O3 !== L2 && I2[O3] === 0; ) O3++;
|
|
20331
|
+
for (var te2 = c2.repeat(m3); O3 < L2; ++O3) te2 += r2.charAt(I2[O3]);
|
|
20646
20332
|
return te2;
|
|
20647
20333
|
}
|
|
20648
20334
|
function y3(u2) {
|
|
@@ -20651,16 +20337,16 @@ function cr(r2, e2) {
|
|
|
20651
20337
|
var m3 = 0;
|
|
20652
20338
|
if (u2[m3] !== " ") {
|
|
20653
20339
|
for (var D2 = 0, w2 = 0; u2[m3] === c2; ) D2++, m3++;
|
|
20654
|
-
for (var
|
|
20340
|
+
for (var E2 = (u2.length - m3) * h4 + 1 >>> 0, L2 = new Uint8Array(E2); u2[m3]; ) {
|
|
20655
20341
|
var I2 = t2[u2.charCodeAt(m3)];
|
|
20656
20342
|
if (I2 === 255) return;
|
|
20657
|
-
for (var k2 = 0, T2 =
|
|
20343
|
+
for (var k2 = 0, T2 = E2 - 1; (I2 !== 0 || k2 < w2) && T2 !== -1; T2--, k2++) I2 += a2 * L2[T2] >>> 0, L2[T2] = I2 % 256 >>> 0, I2 = I2 / 256 >>> 0;
|
|
20658
20344
|
if (I2 !== 0) throw new Error("Non-zero carry");
|
|
20659
20345
|
w2 = k2, m3++;
|
|
20660
20346
|
}
|
|
20661
20347
|
if (u2[m3] !== " ") {
|
|
20662
|
-
for (var
|
|
20663
|
-
for (var O3 = new Uint8Array(D2 + (
|
|
20348
|
+
for (var S3 = E2 - w2; S3 !== E2 && L2[S3] === 0; ) S3++;
|
|
20349
|
+
for (var O3 = new Uint8Array(D2 + (E2 - S3)), te2 = D2; S3 !== E2; ) O3[te2++] = L2[S3++];
|
|
20664
20350
|
return O3;
|
|
20665
20351
|
}
|
|
20666
20352
|
}
|
|
@@ -20878,10 +20564,10 @@ class _i {
|
|
|
20878
20564
|
return s2;
|
|
20879
20565
|
}), J$1(this, "del", async (i3) => {
|
|
20880
20566
|
this.isInitialized(), this.keychain.delete(i3), await this.persist();
|
|
20881
|
-
}), this.core = e2, this.logger =
|
|
20567
|
+
}), this.core = e2, this.logger = Re$3(t2, this.name);
|
|
20882
20568
|
}
|
|
20883
20569
|
get context() {
|
|
20884
|
-
return
|
|
20570
|
+
return ee$3(this.logger);
|
|
20885
20571
|
}
|
|
20886
20572
|
get storageKey() {
|
|
20887
20573
|
return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name;
|
|
@@ -20965,10 +20651,10 @@ class wi {
|
|
|
20965
20651
|
}), R2(this, "getPayloadSenderPublicKey", (s2, n3 = oe$2) => {
|
|
20966
20652
|
const o3 = ze$1({ encoded: s2, encoding: n3 });
|
|
20967
20653
|
return o3.senderPublicKey ? toString(o3.senderPublicKey, rt$1) : void 0;
|
|
20968
|
-
}), this.core = e2, this.logger =
|
|
20654
|
+
}), this.core = e2, this.logger = Re$3(t2, this.name), this.keychain = i3 || new _i(this.core, this.logger);
|
|
20969
20655
|
}
|
|
20970
20656
|
get context() {
|
|
20971
|
-
return
|
|
20657
|
+
return ee$3(this.logger);
|
|
20972
20658
|
}
|
|
20973
20659
|
async setPrivateKey(e2, t2) {
|
|
20974
20660
|
return await this.keychain.set(e2, t2), e2;
|
|
@@ -21050,10 +20736,10 @@ class Ii extends y$2 {
|
|
|
21050
20736
|
delete n3[o3], Object.keys(n3).length === 0 ? this.messagesWithoutClientAck.delete(i3) : this.messagesWithoutClientAck.set(i3, n3), await this.persist();
|
|
21051
20737
|
}), K$1(this, "del", async (i3) => {
|
|
21052
20738
|
this.isInitialized(), this.messages.delete(i3), this.messagesWithoutClientAck.delete(i3), await this.persist();
|
|
21053
|
-
}), this.logger =
|
|
20739
|
+
}), this.logger = Re$3(e2, this.name), this.core = t2;
|
|
21054
20740
|
}
|
|
21055
20741
|
get context() {
|
|
21056
|
-
return
|
|
20742
|
+
return ee$3(this.logger);
|
|
21057
20743
|
}
|
|
21058
20744
|
get storageKey() {
|
|
21059
20745
|
return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name;
|
|
@@ -21098,15 +20784,15 @@ class Yn extends m$1 {
|
|
|
21098
20784
|
const g2 = n3?.ttl || At$1, y3 = n3?.prompt || false, _3 = n3?.tag || 0, u2 = n3?.id || getBigIntRpcId().toString(), m3 = Oa(Sa().protocol), D2 = { id: u2, method: n3?.publishMethod || m3.publish, params: ce$1({ topic: i3, message: s2, ttl: g2, prompt: y3, tag: _3, attestation: n3?.attestation }, n3?.tvf) }, w2 = `Failed to publish payload, please try again. id:${u2} tag:${_3}`;
|
|
21099
20785
|
try {
|
|
21100
20786
|
Dt$1((o3 = D2.params) == null ? void 0 : o3.prompt) && ((a2 = D2.params) == null || delete a2.prompt), Dt$1((c2 = D2.params) == null ? void 0 : c2.tag) && ((h4 = D2.params) == null || delete h4.tag);
|
|
21101
|
-
const
|
|
20787
|
+
const E2 = new Promise(async (L2) => {
|
|
21102
20788
|
const I2 = ({ id: T2 }) => {
|
|
21103
|
-
var
|
|
21104
|
-
((
|
|
20789
|
+
var S3;
|
|
20790
|
+
((S3 = D2.id) == null ? void 0 : S3.toString()) === T2.toString() && (this.removeRequestFromQueue(T2), this.relayer.events.removeListener(C$1.publish, I2), L2());
|
|
21105
20791
|
};
|
|
21106
20792
|
this.relayer.events.on(C$1.publish, I2);
|
|
21107
|
-
const k2 = Si$1(new Promise((T2,
|
|
20793
|
+
const k2 = Si$1(new Promise((T2, S3) => {
|
|
21108
20794
|
this.rpcPublish(D2, n3).then(T2).catch((O3) => {
|
|
21109
|
-
this.logger.warn(O3, O3?.message),
|
|
20795
|
+
this.logger.warn(O3, O3?.message), S3(O3);
|
|
21110
20796
|
});
|
|
21111
20797
|
}), this.initialPublishTimeout, `Failed initial publish, retrying.... id:${u2} tag:${_3}`);
|
|
21112
20798
|
try {
|
|
@@ -21115,29 +20801,29 @@ class Yn extends m$1 {
|
|
|
21115
20801
|
this.queue.set(u2, { request: D2, opts: n3, attempt: 1 }), this.logger.warn(T2, T2?.message);
|
|
21116
20802
|
}
|
|
21117
20803
|
});
|
|
21118
|
-
this.logger.trace({ type: "method", method: "publish", params: { id: u2, topic: i3, message: s2, opts: n3 } }), await Si$1(
|
|
21119
|
-
} catch (
|
|
21120
|
-
if (this.logger.debug("Failed to Publish Payload"), this.logger.error(
|
|
20804
|
+
this.logger.trace({ type: "method", method: "publish", params: { id: u2, topic: i3, message: s2, opts: n3 } }), await Si$1(E2, this.publishTimeout, w2);
|
|
20805
|
+
} catch (E2) {
|
|
20806
|
+
if (this.logger.debug("Failed to Publish Payload"), this.logger.error(E2), (l2 = n3?.internal) != null && l2.throwOnFailedPublish) throw E2;
|
|
21121
20807
|
} finally {
|
|
21122
20808
|
this.queue.delete(u2);
|
|
21123
20809
|
}
|
|
21124
20810
|
}), G$1(this, "publishCustom", async (i3) => {
|
|
21125
20811
|
var s2, n3, o3, a2, c2;
|
|
21126
20812
|
this.logger.debug("Publishing custom payload"), this.logger.trace({ type: "method", method: "publishCustom", params: i3 });
|
|
21127
|
-
const { payload: h4, opts: l2 = {} } = i3, { attestation: g2, tvf: y3, publishMethod: _3, prompt: u2, tag: m3, ttl: D2 = cjsExports$3.FIVE_MINUTES } = l2, w2 = l2.id || getBigIntRpcId().toString(),
|
|
20813
|
+
const { payload: h4, opts: l2 = {} } = i3, { attestation: g2, tvf: y3, publishMethod: _3, prompt: u2, tag: m3, ttl: D2 = cjsExports$3.FIVE_MINUTES } = l2, w2 = l2.id || getBigIntRpcId().toString(), E2 = Oa(Sa().protocol), L2 = _3 || E2.publish, I2 = { id: w2, method: L2, params: ce$1(Ci(ce$1({}, h4), { ttl: D2, prompt: u2, tag: m3, attestation: g2 }), y3) }, k2 = `Failed to publish custom payload, please try again. id:${w2} tag:${m3}`;
|
|
21128
20814
|
try {
|
|
21129
20815
|
Dt$1((s2 = I2.params) == null ? void 0 : s2.prompt) && ((n3 = I2.params) == null || delete n3.prompt), Dt$1((o3 = I2.params) == null ? void 0 : o3.tag) && ((a2 = I2.params) == null || delete a2.tag);
|
|
21130
|
-
const T2 = new Promise(async (
|
|
20816
|
+
const T2 = new Promise(async (S3) => {
|
|
21131
20817
|
const O3 = ({ id: Z2 }) => {
|
|
21132
20818
|
var we2;
|
|
21133
|
-
((we2 = I2.id) == null ? void 0 : we2.toString()) === Z2.toString() && (this.removeRequestFromQueue(Z2), this.relayer.events.removeListener(C$1.publish, O3),
|
|
20819
|
+
((we2 = I2.id) == null ? void 0 : we2.toString()) === Z2.toString() && (this.removeRequestFromQueue(Z2), this.relayer.events.removeListener(C$1.publish, O3), S3());
|
|
21134
20820
|
};
|
|
21135
20821
|
this.relayer.events.on(C$1.publish, O3);
|
|
21136
20822
|
const te2 = Si$1(new Promise((Z2, we2) => {
|
|
21137
20823
|
this.rpcPublish(I2, l2).then(Z2).catch((Ee2) => {
|
|
21138
20824
|
this.logger.warn(Ee2, Ee2?.message), we2(Ee2);
|
|
21139
20825
|
});
|
|
21140
|
-
}), this.initialPublishTimeout, `Failed initial custom payload publish, retrying.... method:${
|
|
20826
|
+
}), this.initialPublishTimeout, `Failed initial custom payload publish, retrying.... method:${L2} id:${w2} tag:${m3}`);
|
|
21141
20827
|
try {
|
|
21142
20828
|
await te2, this.events.removeListener(C$1.publish, O3);
|
|
21143
20829
|
} catch (Z2) {
|
|
@@ -21158,10 +20844,10 @@ class Yn extends m$1 {
|
|
|
21158
20844
|
this.events.off(i3, s2);
|
|
21159
20845
|
}), G$1(this, "removeListener", (i3, s2) => {
|
|
21160
20846
|
this.events.removeListener(i3, s2);
|
|
21161
|
-
}), this.relayer = e2, this.logger =
|
|
20847
|
+
}), this.relayer = e2, this.logger = Re$3(t2, this.name), this.registerEventListeners();
|
|
21162
20848
|
}
|
|
21163
20849
|
get context() {
|
|
21164
|
-
return
|
|
20850
|
+
return ee$3(this.logger);
|
|
21165
20851
|
}
|
|
21166
20852
|
async rpcPublish(e2, t2) {
|
|
21167
20853
|
this.logger.debug("Outgoing Relay Payload"), this.logger.trace({ type: "message", direction: "outgoing", request: e2 });
|
|
@@ -21274,10 +20960,10 @@ class Si extends P$3 {
|
|
|
21274
20960
|
const s2 = j$2.deleted;
|
|
21275
20961
|
this.logger.info(`Emitting ${s2}`), this.logger.debug({ type: "event", event: s2, data: i3 }), await this.persist();
|
|
21276
20962
|
});
|
|
21277
|
-
}), this.relayer = e2, this.logger =
|
|
20963
|
+
}), this.relayer = e2, this.logger = Re$3(t2, this.name), this.clientId = "";
|
|
21278
20964
|
}
|
|
21279
20965
|
get context() {
|
|
21280
|
-
return
|
|
20966
|
+
return ee$3(this.logger);
|
|
21281
20967
|
}
|
|
21282
20968
|
get storageKey() {
|
|
21283
20969
|
return this.storagePrefix + this.version + this.relayer.core.customStoragePrefix + "//" + this.name;
|
|
@@ -21536,7 +21222,7 @@ class Ai extends d$4 {
|
|
|
21536
21222
|
this.logger.trace("Initialized"), this.registerEventListeners(), await Promise.all([this.messages.init(), this.subscriber.init()]), this.initialized = true, this.transportOpen().catch((e2) => this.logger.warn(e2, e2?.message));
|
|
21537
21223
|
}
|
|
21538
21224
|
get context() {
|
|
21539
|
-
return
|
|
21225
|
+
return ee$3(this.logger);
|
|
21540
21226
|
}
|
|
21541
21227
|
get connected() {
|
|
21542
21228
|
var e2, t2, i3;
|
|
@@ -21886,10 +21572,10 @@ class ji extends f$3 {
|
|
|
21886
21572
|
this.map.set(o3, c2), await this.persist();
|
|
21887
21573
|
}), U$1(this, "delete", async (o3, a2) => {
|
|
21888
21574
|
this.isInitialized(), this.map.has(o3) && (this.logger.debug("Deleting value"), this.logger.trace({ type: "method", method: "delete", key: o3, reason: a2 }), this.map.delete(o3), this.addToRecentlyDeleted(o3), await this.persist());
|
|
21889
|
-
}), this.logger =
|
|
21575
|
+
}), this.logger = Re$3(t2, this.name), this.storagePrefix = s2, this.getKey = n3;
|
|
21890
21576
|
}
|
|
21891
21577
|
get context() {
|
|
21892
|
-
return
|
|
21578
|
+
return ee$3(this.logger);
|
|
21893
21579
|
}
|
|
21894
21580
|
get storageKey() {
|
|
21895
21581
|
return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name;
|
|
@@ -21950,7 +21636,7 @@ class ji extends f$3 {
|
|
|
21950
21636
|
var Uo = Object.defineProperty, Fo = (r2, e2, t2) => e2 in r2 ? Uo(r2, e2, { enumerable: true, configurable: true, writable: true, value: t2 }) : r2[e2] = t2, d$2 = (r2, e2, t2) => Fo(r2, typeof e2 != "symbol" ? e2 + "" : e2, t2);
|
|
21951
21637
|
class Ui {
|
|
21952
21638
|
constructor(e2, t2) {
|
|
21953
|
-
this.core = e2, this.logger = t2, d$2(this, "name", Kt$1), d$2(this, "version", Bt$1), d$2(this, "events", new xe$
|
|
21639
|
+
this.core = e2, this.logger = t2, d$2(this, "name", Kt$1), d$2(this, "version", Bt$1), d$2(this, "events", new xe$3()), d$2(this, "pairings"), d$2(this, "initialized", false), d$2(this, "storagePrefix", W$1), d$2(this, "ignoredPayloadTypes", [ie$1]), d$2(this, "registeredMethods", []), d$2(this, "init", async () => {
|
|
21954
21640
|
this.initialized || (await this.pairings.init(), await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.initialized = true, this.logger.trace("Initialized"));
|
|
21955
21641
|
}), d$2(this, "register", ({ methods: i3 }) => {
|
|
21956
21642
|
this.isInitialized(), this.registeredMethods = [.../* @__PURE__ */ new Set([...this.registeredMethods, ...i3])];
|
|
@@ -22121,10 +21807,10 @@ class Ui {
|
|
|
22121
21807
|
const { message: s2 } = Bt$2("EXPIRED", `pairing topic: ${i3}`);
|
|
22122
21808
|
throw new Error(s2);
|
|
22123
21809
|
}
|
|
22124
|
-
}), this.core = e2, this.logger =
|
|
21810
|
+
}), this.core = e2, this.logger = Re$3(t2, this.name), this.pairings = new ji(this.core, this.logger, this.name, this.storagePrefix);
|
|
22125
21811
|
}
|
|
22126
21812
|
get context() {
|
|
22127
|
-
return
|
|
21813
|
+
return ee$3(this.logger);
|
|
22128
21814
|
}
|
|
22129
21815
|
isInitialized() {
|
|
22130
21816
|
if (!this.initialized) {
|
|
@@ -22144,7 +21830,7 @@ class Ui {
|
|
|
22144
21830
|
});
|
|
22145
21831
|
}
|
|
22146
21832
|
registerExpirerEvents() {
|
|
22147
|
-
this.core.expirer.on(
|
|
21833
|
+
this.core.expirer.on(q2.expired, async (e2) => {
|
|
22148
21834
|
const { topic: t2 } = Ui$1(e2.target);
|
|
22149
21835
|
t2 && this.pairings.keys.includes(t2) && (await this.deletePairing(t2, true), this.events.emit(ae$1.expire, { topic: t2 }));
|
|
22150
21836
|
});
|
|
@@ -22178,10 +21864,10 @@ class Fi extends I {
|
|
|
22178
21864
|
this.events.off(i3, s2);
|
|
22179
21865
|
}), N$2(this, "removeListener", (i3, s2) => {
|
|
22180
21866
|
this.events.removeListener(i3, s2);
|
|
22181
|
-
}), this.logger =
|
|
21867
|
+
}), this.logger = Re$3(t2, this.name);
|
|
22182
21868
|
}
|
|
22183
21869
|
get context() {
|
|
22184
|
-
return
|
|
21870
|
+
return ee$3(this.logger);
|
|
22185
21871
|
}
|
|
22186
21872
|
get storageKey() {
|
|
22187
21873
|
return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name;
|
|
@@ -22281,7 +21967,7 @@ class Mi extends S$2 {
|
|
|
22281
21967
|
}), z$1(this, "set", (i3, s2) => {
|
|
22282
21968
|
this.isInitialized();
|
|
22283
21969
|
const n3 = this.formatTarget(i3), o3 = { target: n3, expiry: s2 };
|
|
22284
|
-
this.expirations.set(n3, o3), this.checkExpiry(n3, o3), this.events.emit(
|
|
21970
|
+
this.expirations.set(n3, o3), this.checkExpiry(n3, o3), this.events.emit(q2.created, { target: n3, expiration: o3 });
|
|
22285
21971
|
}), z$1(this, "get", (i3) => {
|
|
22286
21972
|
this.isInitialized();
|
|
22287
21973
|
const s2 = this.formatTarget(i3);
|
|
@@ -22289,7 +21975,7 @@ class Mi extends S$2 {
|
|
|
22289
21975
|
}), z$1(this, "del", (i3) => {
|
|
22290
21976
|
if (this.isInitialized(), this.has(i3)) {
|
|
22291
21977
|
const s2 = this.formatTarget(i3), n3 = this.getExpiration(s2);
|
|
22292
|
-
this.expirations.delete(s2), this.events.emit(
|
|
21978
|
+
this.expirations.delete(s2), this.events.emit(q2.deleted, { target: s2, expiration: n3 });
|
|
22293
21979
|
}
|
|
22294
21980
|
}), z$1(this, "on", (i3, s2) => {
|
|
22295
21981
|
this.events.on(i3, s2);
|
|
@@ -22299,10 +21985,10 @@ class Mi extends S$2 {
|
|
|
22299
21985
|
this.events.off(i3, s2);
|
|
22300
21986
|
}), z$1(this, "removeListener", (i3, s2) => {
|
|
22301
21987
|
this.events.removeListener(i3, s2);
|
|
22302
|
-
}), this.logger =
|
|
21988
|
+
}), this.logger = Re$3(t2, this.name);
|
|
22303
21989
|
}
|
|
22304
21990
|
get context() {
|
|
22305
|
-
return
|
|
21991
|
+
return ee$3(this.logger);
|
|
22306
21992
|
}
|
|
22307
21993
|
get storageKey() {
|
|
22308
21994
|
return this.storagePrefix + this.version + this.core.customStoragePrefix + "//" + this.name;
|
|
@@ -22329,7 +22015,7 @@ class Mi extends S$2 {
|
|
|
22329
22015
|
return await this.core.storage.getItem(this.storageKey);
|
|
22330
22016
|
}
|
|
22331
22017
|
async persist() {
|
|
22332
|
-
await this.setExpirations(this.values), this.events.emit(
|
|
22018
|
+
await this.setExpirations(this.values), this.events.emit(q2.sync);
|
|
22333
22019
|
}
|
|
22334
22020
|
async restore() {
|
|
22335
22021
|
try {
|
|
@@ -22357,20 +22043,20 @@ class Mi extends S$2 {
|
|
|
22357
22043
|
cjsExports$3.toMiliseconds(i3) - Date.now() <= 0 && this.expire(e2, t2);
|
|
22358
22044
|
}
|
|
22359
22045
|
expire(e2, t2) {
|
|
22360
|
-
this.expirations.delete(e2), this.events.emit(
|
|
22046
|
+
this.expirations.delete(e2), this.events.emit(q2.expired, { target: e2, expiration: t2 });
|
|
22361
22047
|
}
|
|
22362
22048
|
checkExpirations() {
|
|
22363
22049
|
this.core.relayer.connected && this.expirations.forEach((e2, t2) => this.checkExpiry(t2, e2));
|
|
22364
22050
|
}
|
|
22365
22051
|
registerEventListeners() {
|
|
22366
|
-
this.core.heartbeat.on(r$1.pulse, () => this.checkExpirations()), this.events.on(
|
|
22367
|
-
const t2 =
|
|
22052
|
+
this.core.heartbeat.on(r$1.pulse, () => this.checkExpirations()), this.events.on(q2.created, (e2) => {
|
|
22053
|
+
const t2 = q2.created;
|
|
22368
22054
|
this.logger.info(`Emitting ${t2}`), this.logger.debug({ type: "event", event: t2, data: e2 }), this.persist();
|
|
22369
|
-
}), this.events.on(
|
|
22370
|
-
const t2 =
|
|
22055
|
+
}), this.events.on(q2.expired, (e2) => {
|
|
22056
|
+
const t2 = q2.expired;
|
|
22371
22057
|
this.logger.info(`Emitting ${t2}`), this.logger.debug({ type: "event", event: t2, data: e2 }), this.persist();
|
|
22372
|
-
}), this.events.on(
|
|
22373
|
-
const t2 =
|
|
22058
|
+
}), this.events.on(q2.deleted, (e2) => {
|
|
22059
|
+
const t2 = q2.deleted;
|
|
22374
22060
|
this.logger.info(`Emitting ${t2}`), this.logger.debug({ type: "event", event: t2, data: e2 }), this.persist();
|
|
22375
22061
|
});
|
|
22376
22062
|
}
|
|
@@ -22400,13 +22086,13 @@ class Ki extends M$3 {
|
|
|
22400
22086
|
m3.src = c2, m3.style.display = "none", m3.addEventListener("error", u2, { signal: this.abortController.signal });
|
|
22401
22087
|
const D2 = (w2) => {
|
|
22402
22088
|
if (w2.data && typeof w2.data == "string") try {
|
|
22403
|
-
const
|
|
22404
|
-
if (
|
|
22405
|
-
if (sn$1(
|
|
22406
|
-
clearInterval(l2), h4.body.removeChild(m3), this.abortController.signal.removeEventListener("abort", u2), window.removeEventListener("message", D2), y3(
|
|
22089
|
+
const E2 = JSON.parse(w2.data);
|
|
22090
|
+
if (E2.type === "verify_attestation") {
|
|
22091
|
+
if (sn$1(E2.attestation).payload.id !== o3) return;
|
|
22092
|
+
clearInterval(l2), h4.body.removeChild(m3), this.abortController.signal.removeEventListener("abort", u2), window.removeEventListener("message", D2), y3(E2.attestation === null ? "" : E2.attestation);
|
|
22407
22093
|
}
|
|
22408
|
-
} catch (
|
|
22409
|
-
this.logger.warn(
|
|
22094
|
+
} catch (E2) {
|
|
22095
|
+
this.logger.warn(E2);
|
|
22410
22096
|
}
|
|
22411
22097
|
};
|
|
22412
22098
|
h4.body.appendChild(m3), window.addEventListener("message", D2, { signal: this.abortController.signal });
|
|
@@ -22481,13 +22167,13 @@ class Ki extends M$3 {
|
|
|
22481
22167
|
const o3 = Aa(s2, n3.publicKey), a2 = { hasExpired: cjsExports$3.toMiliseconds(o3.exp) < Date.now(), payload: o3 };
|
|
22482
22168
|
if (a2.hasExpired) throw this.logger.warn("resolve: jwt attestation expired"), new Error("JWT attestation expired");
|
|
22483
22169
|
return { origin: a2.payload.origin, isScam: a2.payload.isScam, isVerified: a2.payload.isVerified };
|
|
22484
|
-
}), this.logger =
|
|
22170
|
+
}), this.logger = Re$3(t2, this.name), this.abortController = new AbortController(), this.isDevEnv = ki$1(), this.init();
|
|
22485
22171
|
}
|
|
22486
22172
|
get storeKey() {
|
|
22487
22173
|
return this.storagePrefix + this.version + this.core.customStoragePrefix + "//verify:public:key";
|
|
22488
22174
|
}
|
|
22489
22175
|
get context() {
|
|
22490
|
-
return
|
|
22176
|
+
return ee$3(this.logger);
|
|
22491
22177
|
}
|
|
22492
22178
|
startAbortTimer(e2) {
|
|
22493
22179
|
return this.abortController = new AbortController(), setTimeout(() => this.abortController.abort(), cjsExports$3.toMiliseconds(e2));
|
|
@@ -22499,7 +22185,7 @@ class Vi extends O$1 {
|
|
|
22499
22185
|
super(e2, t2), this.projectId = e2, this.logger = t2, Bi(this, "context", Zt$1), Bi(this, "registerDeviceToken", async (i3) => {
|
|
22500
22186
|
const { clientId: s2, token: n3, notificationType: o3, enableEncrypted: a2 = false } = i3, c2 = `${Qt$1}/${this.projectId}/clients`;
|
|
22501
22187
|
await fetch(c2, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ client_id: s2, type: o3, token: n3, always_raw: a2 }) });
|
|
22502
|
-
}), this.logger =
|
|
22188
|
+
}), this.logger = Re$3(t2, this.context);
|
|
22503
22189
|
}
|
|
22504
22190
|
}
|
|
22505
22191
|
var Yo = Object.defineProperty, qi = Object.getOwnPropertySymbols, Jo = Object.prototype.hasOwnProperty, Xo = Object.prototype.propertyIsEnumerable, et$1 = (r2, e2, t2) => e2 in r2 ? Yo(r2, e2, { enumerable: true, configurable: true, writable: true, value: t2 }) : r2[e2] = t2, _e$1 = (r2, e2) => {
|
|
@@ -22563,7 +22249,7 @@ class Gi extends R$1 {
|
|
|
22563
22249
|
}), A$1(this, "sendEvent", async (s2) => {
|
|
22564
22250
|
const n3 = this.getAppDomain() ? "" : "&sp=desktop";
|
|
22565
22251
|
return await fetch(`${si}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Pe$1}${n3}`, { method: "POST", body: JSON.stringify(s2) });
|
|
22566
|
-
}), A$1(this, "getAppDomain", () => br$1().url), this.logger =
|
|
22252
|
+
}), A$1(this, "getAppDomain", () => br$1().url), this.logger = Re$3(t2, this.context), this.telemetryEnabled = i3, i3 ? this.restore().then(async () => {
|
|
22567
22253
|
await this.submit(), this.setEventListeners();
|
|
22568
22254
|
}) : this.persist();
|
|
22569
22255
|
}
|
|
@@ -22591,11 +22277,11 @@ let Oe$1 = class Oe extends h$2 {
|
|
|
22591
22277
|
console.warn("Failed to copy global core", a2);
|
|
22592
22278
|
}
|
|
22593
22279
|
this.projectId = e2?.projectId, this.relayUrl = e2?.relayUrl || Ke$2, this.customStoragePrefix = e2 != null && e2.customStoragePrefix ? `:${e2.customStoragePrefix}` : "";
|
|
22594
|
-
const s2 =
|
|
22280
|
+
const s2 = Ge$5({ level: typeof e2?.logger == "string" && e2.logger ? e2.logger : Et$2.logger, name: ge$1 }), { logger: n3, chunkLoggerController: o3 } = Ue$5({ opts: s2, maxSizeInBytes: e2?.maxLogBlobSizeInBytes, loggerOverride: e2?.logger });
|
|
22595
22281
|
this.logChunkController = o3, (t2 = this.logChunkController) != null && t2.downloadLogsBlobInBrowser && (window.downloadLogsBlobInBrowser = async () => {
|
|
22596
22282
|
var a2, c2;
|
|
22597
22283
|
(a2 = this.logChunkController) != null && a2.downloadLogsBlobInBrowser && ((c2 = this.logChunkController) == null || c2.downloadLogsBlobInBrowser({ clientId: await this.crypto.getClientId() }));
|
|
22598
|
-
}), this.logger =
|
|
22284
|
+
}), this.logger = Re$3(n3, this.name), this.heartbeat = new i$1(), this.crypto = new wi(this, this.logger, e2?.keychain), this.history = new Fi(this, this.logger), this.expirer = new Mi(this, this.logger), this.storage = e2 != null && e2.storage ? e2.storage : new h$3(Hi2(Hi2({}, It$2), e2?.storageOptions)), this.relayer = new Ai({ core: this, logger: this.logger, relayUrl: this.relayUrl, projectId: this.projectId }), this.pairing = new Ui(this, this.logger), this.verify = new Ki(this, this.logger, this.storage), this.echoClient = new Vi(this.projectId || "", this.logger), this.linkModeSupportedApps = [], this.eventClient = new Gi(this, this.logger, e2?.telemetryEnabled), this.setGlobalCore(this);
|
|
22599
22285
|
}
|
|
22600
22286
|
static async init(e2) {
|
|
22601
22287
|
const t2 = new Oe(e2);
|
|
@@ -22604,7 +22290,7 @@ let Oe$1 = class Oe extends h$2 {
|
|
|
22604
22290
|
return await t2.storage.setItem(Ut$1, i3), t2;
|
|
22605
22291
|
}
|
|
22606
22292
|
get context() {
|
|
22607
|
-
return
|
|
22293
|
+
return ee$3(this.logger);
|
|
22608
22294
|
}
|
|
22609
22295
|
async start() {
|
|
22610
22296
|
this.initialized || await this.initialize();
|
|
@@ -22654,14 +22340,14 @@ let Oe$1 = class Oe extends h$2 {
|
|
|
22654
22340
|
};
|
|
22655
22341
|
const ta = Oe$1;
|
|
22656
22342
|
const De = "wc", Le$1 = 2, Me$1 = "client", Re = `${De}@${Le$1}:${Me$1}:`, Ie$1 = { name: Me$1, logger: "error" }, $e$1 = "WALLETCONNECT_DEEPLINK_CHOICE", dt$1 = "proposal", Ke$1 = "Proposal expired", ut$1 = "session", se$1 = cjsExports$3.SEVEN_DAYS, gt$1 = "engine", N$1 = { wc_sessionPropose: { req: { ttl: cjsExports$3.FIVE_MINUTES, prompt: true, tag: 1100 }, res: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1101 }, reject: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1120 }, autoReject: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1121 } }, wc_sessionSettle: { req: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1102 }, res: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1103 } }, wc_sessionUpdate: { req: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1104 }, res: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1105 } }, wc_sessionExtend: { req: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1106 }, res: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1107 } }, wc_sessionRequest: { req: { ttl: cjsExports$3.FIVE_MINUTES, prompt: true, tag: 1108 }, res: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1109 } }, wc_sessionEvent: { req: { ttl: cjsExports$3.FIVE_MINUTES, prompt: true, tag: 1110 }, res: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1111 } }, wc_sessionDelete: { req: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1112 }, res: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1113 } }, wc_sessionPing: { req: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1114 }, res: { ttl: cjsExports$3.ONE_DAY, prompt: false, tag: 1115 } }, wc_sessionAuthenticate: { req: { ttl: cjsExports$3.ONE_HOUR, prompt: true, tag: 1116 }, res: { ttl: cjsExports$3.ONE_HOUR, prompt: false, tag: 1117 }, reject: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1118 }, autoReject: { ttl: cjsExports$3.FIVE_MINUTES, prompt: false, tag: 1119 } } }, Te$1 = { min: cjsExports$3.FIVE_MINUTES, max: cjsExports$3.SEVEN_DAYS }, K2 = { idle: "IDLE", active: "ACTIVE" }, yt$1 = { eth_sendTransaction: { key: "" }, eth_sendRawTransaction: { key: "" }, wallet_sendCalls: { key: "" }, solana_signTransaction: { key: "signature" }, solana_signAllTransactions: { key: "transactions" }, solana_signAndSendTransaction: { key: "signature" }, sui_signAndExecuteTransaction: { key: "digest" }, sui_signTransaction: { key: "" }, hedera_signAndExecuteTransaction: { key: "transactionId" }, hedera_executeTransaction: { key: "transactionId" }, near_signTransaction: { key: "" }, near_signTransactions: { key: "" }, tron_signTransaction: { key: "txID" }, xrpl_signTransaction: { key: "" }, xrpl_signTransactionFor: { key: "" }, algo_signTxn: { key: "" }, sendTransfer: { key: "txid" }, stacks_stxTransfer: { key: "txId" }, polkadot_signTransaction: { key: "" }, cosmos_signDirect: { key: "" } }, mt$1 = "request", wt$1 = ["wc_sessionPropose", "wc_sessionRequest", "wc_authRequest", "wc_sessionAuthenticate"], _t$1 = "wc", vt$1 = "auth", St$1 = "authKeys", Et$1 = "pairingTopics", ft$1 = "requests", we$1 = `${_t$1}@${1.5}:${vt$1}:`, _e = `${we$1}:PUB_KEY`;
|
|
22657
|
-
var As = Object.defineProperty, xs = Object.defineProperties, Cs = Object.getOwnPropertyDescriptors, Rt$1 = Object.getOwnPropertySymbols, Vs = Object.prototype.hasOwnProperty, ks = Object.prototype.propertyIsEnumerable, Ue$1 = (
|
|
22658
|
-
for (var e2 in o3 || (o3 = {})) Vs.call(o3, e2) && Ue$1(
|
|
22659
|
-
if (Rt$1) for (var e2 of Rt$1(o3)) ks.call(o3, e2) && Ue$1(
|
|
22660
|
-
return
|
|
22661
|
-
}, b$1 = (
|
|
22343
|
+
var As = Object.defineProperty, xs = Object.defineProperties, Cs = Object.getOwnPropertyDescriptors, Rt$1 = Object.getOwnPropertySymbols, Vs = Object.prototype.hasOwnProperty, ks = Object.prototype.propertyIsEnumerable, Ue$1 = (S3, o3, e2) => o3 in S3 ? As(S3, o3, { enumerable: true, configurable: true, writable: true, value: e2 }) : S3[o3] = e2, E$2 = (S3, o3) => {
|
|
22344
|
+
for (var e2 in o3 || (o3 = {})) Vs.call(o3, e2) && Ue$1(S3, e2, o3[e2]);
|
|
22345
|
+
if (Rt$1) for (var e2 of Rt$1(o3)) ks.call(o3, e2) && Ue$1(S3, e2, o3[e2]);
|
|
22346
|
+
return S3;
|
|
22347
|
+
}, b$1 = (S3, o3) => xs(S3, Cs(o3)), c$2 = (S3, o3, e2) => Ue$1(S3, typeof o3 != "symbol" ? o3 + "" : o3, e2);
|
|
22662
22348
|
class Ds extends V$1 {
|
|
22663
22349
|
constructor(o3) {
|
|
22664
|
-
super(o3), c$2(this, "name", gt$1), c$2(this, "events", new xe$
|
|
22350
|
+
super(o3), c$2(this, "name", gt$1), c$2(this, "events", new xe$3()), c$2(this, "initialized", false), c$2(this, "requestQueue", { state: K2.idle, queue: [] }), c$2(this, "sessionRequestQueue", { state: K2.idle, queue: [] }), c$2(this, "emittedSessionRequests", new Hi$1({ limit: 500 })), c$2(this, "requestQueueDelay", cjsExports$3.ONE_SECOND), c$2(this, "expectedPairingMethodMap", /* @__PURE__ */ new Map()), c$2(this, "recentlyDeletedMap", /* @__PURE__ */ new Map()), c$2(this, "recentlyDeletedLimit", 200), c$2(this, "relayMessageCache", []), c$2(this, "pendingSessions", /* @__PURE__ */ new Map()), c$2(this, "init", async () => {
|
|
22665
22351
|
this.initialized || (await this.cleanup(), this.registerRelayerEvents(), this.registerExpirerEvents(), this.registerPairingEvents(), await this.registerLinkModeListeners(), this.client.core.pairing.register({ methods: Object.keys(N$1) }), this.initialized = true, setTimeout(async () => {
|
|
22666
22352
|
await this.processPendingMessageEvents(), this.sessionRequestQueue.queue = this.getPendingSessionRequests(), this.processSessionRequestQueue();
|
|
22667
22353
|
}, cjsExports$3.toMiliseconds(this.requestQueueDelay)));
|
|
@@ -22682,21 +22368,21 @@ class Ds extends V$1 {
|
|
|
22682
22368
|
throw this.client.logger.error(`connect() -> pairing.get(${u2}) failed`), R3;
|
|
22683
22369
|
}
|
|
22684
22370
|
if (!u2 || !g2) {
|
|
22685
|
-
const { topic: R3, uri:
|
|
22686
|
-
u2 = R3, w2 =
|
|
22371
|
+
const { topic: R3, uri: q3 } = await this.client.core.pairing.create({ internal: { skipSubscribe: true } });
|
|
22372
|
+
u2 = R3, w2 = q3;
|
|
22687
22373
|
}
|
|
22688
22374
|
if (!u2) {
|
|
22689
22375
|
const { message: R3 } = Bt$2("NO_MATCHING_KEY", `connect() pairing topic: ${u2}`);
|
|
22690
22376
|
throw new Error(R3);
|
|
22691
22377
|
}
|
|
22692
|
-
const f4 = await this.client.core.crypto.generateKeyPair(),
|
|
22693
|
-
const { domain:
|
|
22694
|
-
return { domain:
|
|
22378
|
+
const f4 = await this.client.core.crypto.generateKeyPair(), v2 = _i$1(d3), T2 = E$2(b$1(E$2(E$2({ requiredNamespaces: r2, optionalNamespaces: n3, relays: h4 ?? [{ protocol: Nt$1 }], proposer: { publicKey: f4, metadata: this.client.metadata }, expiryTimestamp: v2, pairingTopic: u2 }, a2 && { sessionProperties: a2 }), l2 && { scopedProperties: l2 }), { id: payloadId() }), (p2 || y3) && { requests: { authentication: p2?.map((R3) => {
|
|
22379
|
+
const { domain: q3, chains: ve2, nonce: ce2, uri: Y2, exp: ie2, nbf: le2, type: J4, statement: pe2, requestId: he2, resources: C2, signatureTypes: D2 } = R3;
|
|
22380
|
+
return { domain: q3, chains: ve2, nonce: ce2, type: J4 ?? "caip122", aud: Y2, version: "1", iat: (/* @__PURE__ */ new Date()).toISOString(), exp: ie2, nbf: le2, statement: pe2, requestId: he2, resources: C2, signatureTypes: D2 };
|
|
22695
22381
|
}), walletPay: y3 } }), A2 = $i$1("session_connect", T2.id), { reject: V3, resolve: x2, done: U2 } = Ai$1(d3, Ke$1), z2 = ({ id: R3 }) => {
|
|
22696
22382
|
R3 === T2.id && (this.client.events.off("proposal_expire", z2), this.pendingSessions.delete(T2.id), this.events.emit(A2, { error: { message: Ke$1, code: 0 } }));
|
|
22697
22383
|
};
|
|
22698
|
-
return this.client.events.on("proposal_expire", z2), this.events.once(A2, ({ error: R3, session:
|
|
22699
|
-
this.client.events.off("proposal_expire", z2), R3 ? V3(R3) :
|
|
22384
|
+
return this.client.events.on("proposal_expire", z2), this.events.once(A2, ({ error: R3, session: q3 }) => {
|
|
22385
|
+
this.client.events.off("proposal_expire", z2), R3 ? V3(R3) : q3 && x2(q3);
|
|
22700
22386
|
}), await this.setProposal(T2.id, T2), await this.sendProposeSession({ proposal: T2, publishOpts: { internal: { throwOnFailedPublish: true }, tvf: { correlationId: T2.id } } }).catch((R3) => {
|
|
22701
22387
|
throw this.deleteProposal(T2.id), R3;
|
|
22702
22388
|
}), { uri: w2, approval: U2 };
|
|
@@ -22712,38 +22398,38 @@ class Ds extends V$1 {
|
|
|
22712
22398
|
const r2 = this.client.core.eventClient.createEvent({ properties: { topic: (t2 = e2?.id) == null ? void 0 : t2.toString(), trace: [rr.session_approve_started] } });
|
|
22713
22399
|
try {
|
|
22714
22400
|
this.isInitialized(), await this.confirmOnlineStateOrThrow();
|
|
22715
|
-
} catch (
|
|
22716
|
-
throw r2.setError(nr.no_internet_connection),
|
|
22401
|
+
} catch (q3) {
|
|
22402
|
+
throw r2.setError(nr.no_internet_connection), q3;
|
|
22717
22403
|
}
|
|
22718
22404
|
try {
|
|
22719
22405
|
await this.isValidProposalId(e2?.id);
|
|
22720
|
-
} catch (
|
|
22721
|
-
throw this.client.logger.error(`approve() -> proposal.get(${e2?.id}) failed`), r2.setError(nr.proposal_not_found),
|
|
22406
|
+
} catch (q3) {
|
|
22407
|
+
throw this.client.logger.error(`approve() -> proposal.get(${e2?.id}) failed`), r2.setError(nr.proposal_not_found), q3;
|
|
22722
22408
|
}
|
|
22723
22409
|
try {
|
|
22724
22410
|
await this.isValidApprove(e2);
|
|
22725
|
-
} catch (
|
|
22726
|
-
throw this.client.logger.error("approve() -> isValidApprove() failed"), r2.setError(nr.session_approve_namespace_validation_failure),
|
|
22411
|
+
} catch (q3) {
|
|
22412
|
+
throw this.client.logger.error("approve() -> isValidApprove() failed"), r2.setError(nr.session_approve_namespace_validation_failure), q3;
|
|
22727
22413
|
}
|
|
22728
22414
|
const { id: n3, relayProtocol: a2, namespaces: l2, sessionProperties: h4, scopedProperties: p2, sessionConfig: y3, proposalRequestsResponses: d3 } = e2, u2 = this.client.proposal.get(n3);
|
|
22729
22415
|
this.client.core.eventClient.deleteEvent({ eventId: r2.eventId });
|
|
22730
|
-
const { pairingTopic: w2, proposer: g2, requiredNamespaces: f4, optionalNamespaces:
|
|
22416
|
+
const { pairingTopic: w2, proposer: g2, requiredNamespaces: f4, optionalNamespaces: v2 } = u2;
|
|
22731
22417
|
let T2 = (s2 = this.client.core.eventClient) == null ? void 0 : s2.getEvent({ topic: w2 });
|
|
22732
22418
|
T2 || (T2 = (i3 = this.client.core.eventClient) == null ? void 0 : i3.createEvent({ type: rr.session_approve_started, properties: { topic: w2, trace: [rr.session_approve_started, rr.session_namespaces_validation_success] } }));
|
|
22733
22419
|
const A2 = await this.client.core.crypto.generateKeyPair(), V3 = g2.publicKey, x2 = await this.client.core.crypto.generateSharedKey(A2, V3), U2 = b$1(E$2(E$2(E$2({ relay: { protocol: a2 ?? "irn" }, namespaces: l2, controller: { publicKey: A2, metadata: this.client.metadata }, expiry: _i$1(se$1) }, h4 && { sessionProperties: h4 }), p2 && { scopedProperties: p2 }), y3 && { sessionConfig: y3 }), { proposalRequestsResponses: d3 }), z2 = ee$1.relay;
|
|
22734
22420
|
T2.addTrace(rr.subscribing_session_topic);
|
|
22735
22421
|
try {
|
|
22736
22422
|
await this.client.core.relayer.subscribe(x2, { transportType: z2, internal: { skipSubscribe: true } });
|
|
22737
|
-
} catch (
|
|
22738
|
-
throw T2.setError(nr.subscribe_session_topic_failure),
|
|
22423
|
+
} catch (q3) {
|
|
22424
|
+
throw T2.setError(nr.subscribe_session_topic_failure), q3;
|
|
22739
22425
|
}
|
|
22740
22426
|
T2.addTrace(rr.subscribe_session_topic_success);
|
|
22741
|
-
const R3 = b$1(E$2({}, U2), { topic: x2, requiredNamespaces: f4, optionalNamespaces:
|
|
22427
|
+
const R3 = b$1(E$2({}, U2), { topic: x2, requiredNamespaces: f4, optionalNamespaces: v2, pairingTopic: w2, acknowledged: false, self: U2.controller, peer: { publicKey: g2.publicKey, metadata: g2.metadata }, controller: A2, transportType: ee$1.relay, authentication: d3?.authentication, walletPayResult: d3?.walletPay });
|
|
22742
22428
|
await this.client.session.set(x2, R3), T2.addTrace(rr.store_session);
|
|
22743
22429
|
try {
|
|
22744
22430
|
await this.sendApproveSession({ sessionTopic: x2, proposal: u2, pairingProposalResponse: { relay: { protocol: a2 ?? "irn" }, responderPublicKey: A2 }, sessionSettleRequest: U2, publishOpts: { internal: { throwOnFailedPublish: true }, tvf: E$2({ correlationId: n3 }, this.getTVFApproveParams(R3)) } }), T2.addTrace(rr.session_approve_publish_success);
|
|
22745
|
-
} catch (
|
|
22746
|
-
throw this.client.logger.error(
|
|
22431
|
+
} catch (q3) {
|
|
22432
|
+
throw this.client.logger.error(q3), this.client.session.delete(x2, zt$2("USER_DISCONNECTED")), await this.client.core.relayer.unsubscribe(x2), q3;
|
|
22747
22433
|
}
|
|
22748
22434
|
return this.client.core.eventClient.deleteEvent({ eventId: T2.eventId }), await this.client.core.pairing.updateMetadata({ topic: w2, metadata: g2.metadata }), await this.deleteProposal(n3), await this.client.core.pairing.activate({ topic: w2 }), await this.setExpiry(x2, _i$1(se$1)), { topic: x2, acknowledged: () => Promise.resolve(this.client.session.get(x2)) };
|
|
22749
22435
|
}), c$2(this, "reject", async (e2) => {
|
|
@@ -22808,8 +22494,8 @@ class Ds extends V$1 {
|
|
|
22808
22494
|
}), new Promise(async (g2) => {
|
|
22809
22495
|
var f4;
|
|
22810
22496
|
if (!((f4 = n3.sessionConfig) != null && f4.disableDeepLink)) {
|
|
22811
|
-
const
|
|
22812
|
-
await Ti$1({ id: a2, topic: i3, wcDeepLink:
|
|
22497
|
+
const v2 = await Ci$1(this.client.core.storage, $e$1);
|
|
22498
|
+
await Ti$1({ id: a2, topic: i3, wcDeepLink: v2 });
|
|
22813
22499
|
}
|
|
22814
22500
|
g2();
|
|
22815
22501
|
}), h4()]).then((g2) => g2[2]);
|
|
@@ -22863,27 +22549,27 @@ class Ds extends V$1 {
|
|
|
22863
22549
|
this.isInitialized(), this.isValidAuthenticate(e2);
|
|
22864
22550
|
const i3 = t2 && this.client.core.linkModeSupportedApps.includes(t2) && ((s2 = this.client.metadata.redirect) == null ? void 0 : s2.linkMode), r2 = i3 ? ee$1.link_mode : ee$1.relay;
|
|
22865
22551
|
r2 === ee$1.relay && await this.confirmOnlineStateOrThrow();
|
|
22866
|
-
const { chains: n3, statement: a2 = "", uri: l2, domain: h4, nonce: p2, type: y3, exp: d3, nbf: u2, methods: w2 = [], expiry: g2 } = e2, f4 = [...e2.resources || []], { topic:
|
|
22867
|
-
this.client.logger.info({ message: "Generated new pairing", pairing: { topic:
|
|
22552
|
+
const { chains: n3, statement: a2 = "", uri: l2, domain: h4, nonce: p2, type: y3, exp: d3, nbf: u2, methods: w2 = [], expiry: g2 } = e2, f4 = [...e2.resources || []], { topic: v2, uri: T2 } = await this.client.core.pairing.create({ methods: ["wc_sessionAuthenticate"], transportType: r2 });
|
|
22553
|
+
this.client.logger.info({ message: "Generated new pairing", pairing: { topic: v2, uri: T2 } });
|
|
22868
22554
|
const A2 = await this.client.core.crypto.generateKeyPair(), V3 = ba(A2);
|
|
22869
|
-
if (await Promise.all([this.client.auth.authKeys.set(_e, { responseTopic: V3, publicKey: A2 }), this.client.auth.pairingTopics.set(V3, { topic: V3, pairingTopic:
|
|
22555
|
+
if (await Promise.all([this.client.auth.authKeys.set(_e, { responseTopic: V3, publicKey: A2 }), this.client.auth.pairingTopics.set(V3, { topic: V3, pairingTopic: v2 })]), await this.client.core.relayer.subscribe(V3, { transportType: r2 }), this.client.logger.info(`sending request to new pairing topic: ${v2}`), w2.length > 0) {
|
|
22870
22556
|
const { namespace: C2 } = Je$2(n3[0]);
|
|
22871
22557
|
let D2 = Zc(C2, "request", w2);
|
|
22872
|
-
|
|
22558
|
+
je2(f4) && (D2 = Gc(D2, f4.pop())), f4.push(D2);
|
|
22873
22559
|
}
|
|
22874
|
-
const x2 = g2 && g2 > N$1.wc_sessionAuthenticate.req.ttl ? g2 : N$1.wc_sessionAuthenticate.req.ttl, U2 = { authPayload: { type: y3 ?? "caip122", chains: n3, statement: a2, aud: l2, domain: h4, version: "1", nonce: p2, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: d3, nbf: u2, resources: f4 }, requester: { publicKey: A2, metadata: this.client.metadata }, expiryTimestamp: _i$1(x2) }, z2 = { eip155: { chains: n3, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...w2])], events: ["chainChanged", "accountsChanged"] } }, R3 = { requiredNamespaces: {}, optionalNamespaces: z2, relays: [{ protocol: "irn" }], pairingTopic:
|
|
22560
|
+
const x2 = g2 && g2 > N$1.wc_sessionAuthenticate.req.ttl ? g2 : N$1.wc_sessionAuthenticate.req.ttl, U2 = { authPayload: { type: y3 ?? "caip122", chains: n3, statement: a2, aud: l2, domain: h4, version: "1", nonce: p2, iat: (/* @__PURE__ */ new Date()).toISOString(), exp: d3, nbf: u2, resources: f4 }, requester: { publicKey: A2, metadata: this.client.metadata }, expiryTimestamp: _i$1(x2) }, z2 = { eip155: { chains: n3, methods: [.../* @__PURE__ */ new Set(["personal_sign", ...w2])], events: ["chainChanged", "accountsChanged"] } }, R3 = { requiredNamespaces: {}, optionalNamespaces: z2, relays: [{ protocol: "irn" }], pairingTopic: v2, proposer: { publicKey: A2, metadata: this.client.metadata }, expiryTimestamp: _i$1(N$1.wc_sessionPropose.req.ttl), id: payloadId() }, { done: q3, resolve: ve2, reject: ce2 } = Ai$1(x2, "Request expired"), Y2 = payloadId(), ie2 = $i$1("session_connect", R3.id), le2 = $i$1("session_request", Y2), J4 = async ({ error: C2, session: D2 }) => {
|
|
22875
22561
|
this.events.off(le2, pe2), C2 ? ce2(C2) : D2 && ve2({ session: D2 });
|
|
22876
22562
|
}, pe2 = async (C2) => {
|
|
22877
22563
|
var D2, je$12, Fe2;
|
|
22878
22564
|
if (await this.deletePendingAuthRequest(Y2, { message: "fulfilled", code: 0 }), C2.error) {
|
|
22879
22565
|
const ue2 = zt$2("WC_METHOD_UNSUPPORTED", "wc_sessionAuthenticate");
|
|
22880
|
-
return C2.error.code === ue2.code ? void 0 : (this.events.off(ie2,
|
|
22566
|
+
return C2.error.code === ue2.code ? void 0 : (this.events.off(ie2, J4), ce2(C2.error.message));
|
|
22881
22567
|
}
|
|
22882
|
-
await this.deleteProposal(R3.id), this.events.off(ie2,
|
|
22568
|
+
await this.deleteProposal(R3.id), this.events.off(ie2, J4);
|
|
22883
22569
|
const { cacaos: He2, responder: X2 } = C2.result, Pe2 = [], Qe2 = [];
|
|
22884
22570
|
for (const ue2 of He2) {
|
|
22885
22571
|
await Vc({ cacao: ue2, projectId: this.client.core.projectId }) || (this.client.logger.error(ue2, "Signature verification failed"), ce2(zt$2("SESSION_SETTLEMENT_FAILED", "Signature verification failed")));
|
|
22886
|
-
const { p: Ne2 } = ue2, Oe3 =
|
|
22572
|
+
const { p: Ne2 } = ue2, Oe3 = je2(Ne2.resources), ze2 = [no$1(Ne2.iss)], Tt2 = bn$1(Ne2.iss);
|
|
22887
22573
|
if (Oe3) {
|
|
22888
22574
|
const be2 = zc(Oe3), qt2 = Yc(Oe3);
|
|
22889
22575
|
Pe2.push(...be2), ze2.push(...qt2);
|
|
@@ -22892,21 +22578,21 @@ class Ds extends V$1 {
|
|
|
22892
22578
|
}
|
|
22893
22579
|
const de2 = await this.client.core.crypto.generateSharedKey(A2, X2.publicKey);
|
|
22894
22580
|
let Se2;
|
|
22895
|
-
Pe2.length > 0 && (Se2 = { topic: de2, acknowledged: true, self: { publicKey: A2, metadata: this.client.metadata }, peer: X2, controller: X2.publicKey, expiry: _i$1(se$1), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic:
|
|
22581
|
+
Pe2.length > 0 && (Se2 = { topic: de2, acknowledged: true, self: { publicKey: A2, metadata: this.client.metadata }, peer: X2, controller: X2.publicKey, expiry: _i$1(se$1), requiredNamespaces: {}, optionalNamespaces: {}, relay: { protocol: "irn" }, pairingTopic: v2, namespaces: za([...new Set(Pe2)], [...new Set(Qe2)]), transportType: r2 }, await this.client.core.relayer.subscribe(de2, { transportType: r2 }), await this.client.session.set(de2, Se2), v2 && await this.client.core.pairing.updateMetadata({ topic: v2, metadata: X2.metadata }), Se2 = this.client.session.get(de2)), (D2 = this.client.metadata.redirect) != null && D2.linkMode && (je$12 = X2.metadata.redirect) != null && je$12.linkMode && (Fe2 = X2.metadata.redirect) != null && Fe2.universal && t2 && (this.client.core.addLinkModeSupportedApp(X2.metadata.redirect.universal), this.client.session.update(de2, { transportType: ee$1.link_mode })), ve2({ auths: He2, session: Se2 });
|
|
22896
22582
|
};
|
|
22897
|
-
this.events.once(ie2,
|
|
22583
|
+
this.events.once(ie2, J4), this.events.once(le2, pe2);
|
|
22898
22584
|
let he2;
|
|
22899
22585
|
try {
|
|
22900
22586
|
if (i3) {
|
|
22901
22587
|
const C2 = formatJsonRpcRequest("wc_sessionAuthenticate", U2, Y2);
|
|
22902
|
-
this.client.core.history.set(
|
|
22588
|
+
this.client.core.history.set(v2, C2);
|
|
22903
22589
|
const D2 = await this.client.core.crypto.encode("", C2, { type: ve$2, encoding: Ge$3 });
|
|
22904
|
-
he2 = La(t2,
|
|
22905
|
-
} else await Promise.all([this.sendRequest({ topic:
|
|
22590
|
+
he2 = La(t2, v2, D2);
|
|
22591
|
+
} else await Promise.all([this.sendRequest({ topic: v2, method: "wc_sessionAuthenticate", params: U2, expiry: e2.expiry, throwOnFailedPublish: true, clientRpcId: Y2 }), this.sendRequest({ topic: v2, method: "wc_sessionPropose", params: R3, expiry: N$1.wc_sessionPropose.req.ttl, throwOnFailedPublish: true, clientRpcId: R3.id })]);
|
|
22906
22592
|
} catch (C2) {
|
|
22907
|
-
throw this.events.off(ie2,
|
|
22593
|
+
throw this.events.off(ie2, J4), this.events.off(le2, pe2), C2;
|
|
22908
22594
|
}
|
|
22909
|
-
return await this.setProposal(R3.id, R3), await this.setAuthRequest(Y2, { request: b$1(E$2({}, U2), { verifyContext: {} }), pairingTopic:
|
|
22595
|
+
return await this.setProposal(R3.id, R3), await this.setAuthRequest(Y2, { request: b$1(E$2({}, U2), { verifyContext: {} }), pairingTopic: v2, transportType: r2 }), { uri: he2 ?? T2, response: q3 };
|
|
22910
22596
|
}), c$2(this, "approveSessionAuthenticate", async (e2) => {
|
|
22911
22597
|
const { id: t2, auths: s2 } = e2, i3 = this.client.core.eventClient.createEvent({ properties: { topic: t2.toString(), trace: [or.authenticated_session_approve_started] } });
|
|
22912
22598
|
try {
|
|
@@ -22926,9 +22612,9 @@ class Ds extends V$1 {
|
|
|
22926
22612
|
throw await this.sendError({ id: t2, topic: h4, error: V3, encodeOpts: p2 }), new Error(V3.message);
|
|
22927
22613
|
}
|
|
22928
22614
|
i3.addTrace(or.cacaos_verified);
|
|
22929
|
-
const { p: f4 } = g2,
|
|
22930
|
-
if (
|
|
22931
|
-
const V3 = zc(
|
|
22615
|
+
const { p: f4 } = g2, v2 = je2(f4.resources), T2 = [no$1(f4.iss)], A2 = bn$1(f4.iss);
|
|
22616
|
+
if (v2) {
|
|
22617
|
+
const V3 = zc(v2), x2 = Yc(v2);
|
|
22932
22618
|
y3.push(...V3), T2.push(...x2);
|
|
22933
22619
|
}
|
|
22934
22620
|
for (const V3 of T2) d3.push(`${V3}:${A2}`);
|
|
@@ -23013,21 +22699,21 @@ class Ds extends V$1 {
|
|
|
23013
22699
|
let u2;
|
|
23014
22700
|
const w2 = !!h4;
|
|
23015
22701
|
try {
|
|
23016
|
-
const
|
|
23017
|
-
u2 = await this.client.core.crypto.encode(t2, d3, { encoding:
|
|
23018
|
-
} catch (
|
|
23019
|
-
throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t2} failed`),
|
|
22702
|
+
const v2 = w2 ? Ge$3 : oe$2;
|
|
22703
|
+
u2 = await this.client.core.crypto.encode(t2, d3, { encoding: v2 });
|
|
22704
|
+
} catch (v2) {
|
|
22705
|
+
throw await this.cleanup(), this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t2} failed`), v2;
|
|
23020
22706
|
}
|
|
23021
22707
|
let g2;
|
|
23022
22708
|
if (wt$1.includes(s2)) {
|
|
23023
|
-
const
|
|
23024
|
-
g2 = await this.client.core.verify.register({ id: T2, decryptedId:
|
|
22709
|
+
const v2 = ya(JSON.stringify(d3)), T2 = ya(u2);
|
|
22710
|
+
g2 = await this.client.core.verify.register({ id: T2, decryptedId: v2 });
|
|
23025
22711
|
}
|
|
23026
22712
|
const f4 = E$2(E$2({}, N$1[s2].req), y3);
|
|
23027
22713
|
if (f4.attestation = g2, r2 && (f4.ttl = r2), n3 && (f4.id = n3), this.client.core.history.set(t2, d3), w2) {
|
|
23028
|
-
const
|
|
23029
|
-
await global.Linking.openURL(
|
|
23030
|
-
} else f4.tvf = b$1(E$2({}, p2), { correlationId: d3.id }), l2 ? (f4.internal = b$1(E$2({}, f4.internal), { throwOnFailedPublish: true }), await this.client.core.relayer.publish(t2, u2, f4)) : this.client.core.relayer.publish(t2, u2, f4).catch((
|
|
22714
|
+
const v2 = La(h4, t2, u2);
|
|
22715
|
+
await global.Linking.openURL(v2, this.client.name);
|
|
22716
|
+
} else f4.tvf = b$1(E$2({}, p2), { correlationId: d3.id }), l2 ? (f4.internal = b$1(E$2({}, f4.internal), { throwOnFailedPublish: true }), await this.client.core.relayer.publish(t2, u2, f4)) : this.client.core.relayer.publish(t2, u2, f4).catch((v2) => this.client.logger.error(v2));
|
|
23031
22717
|
return d3.id;
|
|
23032
22718
|
}), c$2(this, "sendProposeSession", async (e2) => {
|
|
23033
22719
|
const { proposal: t2, publishOpts: s2 } = e2, i3 = formatJsonRpcRequest("wc_sessionPropose", t2, t2.id);
|
|
@@ -23662,7 +23348,7 @@ class Ds extends V$1 {
|
|
|
23662
23348
|
}
|
|
23663
23349
|
}
|
|
23664
23350
|
registerExpirerEvents() {
|
|
23665
|
-
this.client.core.expirer.on(
|
|
23351
|
+
this.client.core.expirer.on(q2.expired, async (o3) => {
|
|
23666
23352
|
const { topic: e2, id: t2 } = Ui$1(o3.target);
|
|
23667
23353
|
if (t2 && this.client.pendingRequest.keys.includes(t2)) return await this.deletePendingSessionRequest(t2, Bt$2("EXPIRED"), true);
|
|
23668
23354
|
if (t2 && this.client.auth.requests.keys.includes(t2)) return await this.deletePendingAuthRequest(t2, Bt$2("EXPIRED"), true);
|
|
@@ -23770,7 +23456,7 @@ class Us extends ji {
|
|
|
23770
23456
|
super(o3, e2, ft$1, we$1, (t2) => t2.id), this.core = o3, this.logger = e2;
|
|
23771
23457
|
}
|
|
23772
23458
|
}
|
|
23773
|
-
var Gs = Object.defineProperty, js = (
|
|
23459
|
+
var Gs = Object.defineProperty, js = (S3, o3, e2) => o3 in S3 ? Gs(S3, o3, { enumerable: true, configurable: true, writable: true, value: e2 }) : S3[o3] = e2, Ge$1 = (S3, o3, e2) => js(S3, typeof o3 != "symbol" ? o3 + "" : o3, e2);
|
|
23774
23460
|
class Fs {
|
|
23775
23461
|
constructor(o3, e2) {
|
|
23776
23462
|
this.core = o3, this.logger = e2, Ge$1(this, "authKeys"), Ge$1(this, "pairingTopics"), Ge$1(this, "requests"), this.authKeys = new $s(this.core, this.logger), this.pairingTopics = new Ks(this.core, this.logger), this.requests = new Us(this.core, this.logger);
|
|
@@ -23779,7 +23465,7 @@ class Fs {
|
|
|
23779
23465
|
await this.authKeys.init(), await this.pairingTopics.init(), await this.requests.init();
|
|
23780
23466
|
}
|
|
23781
23467
|
}
|
|
23782
|
-
var Hs = Object.defineProperty, Qs = (
|
|
23468
|
+
var Hs = Object.defineProperty, Qs = (S3, o3, e2) => o3 in S3 ? Hs(S3, o3, { enumerable: true, configurable: true, writable: true, value: e2 }) : S3[o3] = e2, _$1 = (S3, o3, e2) => Qs(S3, typeof o3 != "symbol" ? o3 + "" : o3, e2);
|
|
23783
23469
|
class qe extends J$4 {
|
|
23784
23470
|
constructor(o3) {
|
|
23785
23471
|
super(o3), _$1(this, "protocol", De), _$1(this, "version", Le$1), _$1(this, "name", Ie$1.name), _$1(this, "metadata"), _$1(this, "core"), _$1(this, "logger"), _$1(this, "events", new eventsExports.EventEmitter()), _$1(this, "engine"), _$1(this, "session"), _$1(this, "proposal"), _$1(this, "pendingRequest"), _$1(this, "auth"), _$1(this, "signConfig"), _$1(this, "on", (t2, s2) => this.events.on(t2, s2)), _$1(this, "once", (t2, s2) => this.events.once(t2, s2)), _$1(this, "off", (t2, s2) => this.events.off(t2, s2)), _$1(this, "removeListener", (t2, s2) => this.events.removeListener(t2, s2)), _$1(this, "removeAllListeners", (t2) => this.events.removeAllListeners(t2)), _$1(this, "connect", async (t2) => {
|
|
@@ -23893,7 +23579,7 @@ class qe extends J$4 {
|
|
|
23893
23579
|
return await e2.initialize(), e2;
|
|
23894
23580
|
}
|
|
23895
23581
|
get context() {
|
|
23896
|
-
return
|
|
23582
|
+
return ee$3(this.logger);
|
|
23897
23583
|
}
|
|
23898
23584
|
get pairing() {
|
|
23899
23585
|
return this.core.pairing.pairings;
|
|
@@ -24570,7 +24256,7 @@ function Z(t2) {
|
|
|
24570
24256
|
function T(t2) {
|
|
24571
24257
|
return t2 == null ? t2 === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(t2);
|
|
24572
24258
|
}
|
|
24573
|
-
const Fe = "[object RegExp]", ee = "[object String]", te = "[object Number]", se = "[object Boolean]", ie = "[object Arguments]", He = "[object Symbol]", Ue = "[object Date]", Be = "[object Map]", Le = "[object Set]", Me = "[object Array]", ze = "[object ArrayBuffer]", Ge = "[object Object]", We = "[object DataView]", Je = "[object Uint8Array]", Ke = "[object Uint8ClampedArray]",
|
|
24259
|
+
const Fe = "[object RegExp]", ee = "[object String]", te = "[object Number]", se = "[object Boolean]", ie = "[object Arguments]", He = "[object Symbol]", Ue = "[object Date]", Be = "[object Map]", Le = "[object Set]", Me = "[object Array]", ze = "[object ArrayBuffer]", Ge = "[object Object]", We = "[object DataView]", Je = "[object Uint8Array]", Ke = "[object Uint8ClampedArray]", Ve2 = "[object Uint16Array]", Ye = "[object Uint32Array]", Xe = "[object Int8Array]", ke = "[object Int16Array]", Qe = "[object Int32Array]", Ze = "[object Float32Array]", Te = "[object Float64Array]";
|
|
24574
24260
|
function x(t2) {
|
|
24575
24261
|
return ArrayBuffer.isView(t2) && !(t2 instanceof DataView);
|
|
24576
24262
|
}
|
|
@@ -24664,7 +24350,7 @@ function tt(t2) {
|
|
|
24664
24350
|
case He:
|
|
24665
24351
|
case Je:
|
|
24666
24352
|
case Ke:
|
|
24667
|
-
case
|
|
24353
|
+
case Ve2:
|
|
24668
24354
|
case Ye:
|
|
24669
24355
|
return true;
|
|
24670
24356
|
default:
|
|
@@ -24771,8 +24457,8 @@ function $(t2, e2, s2, i3) {
|
|
|
24771
24457
|
function ot(t2, ...e2) {
|
|
24772
24458
|
return ct(t2, ...e2, it);
|
|
24773
24459
|
}
|
|
24774
|
-
const ce = "error", ht = "wss://relay.walletconnect.org", pt = "wc", oe = "universal_provider", A = `${pt}@2:${oe}:`, he = "https://rpc.walletconnect.org/v1/", pe = "generic", lt = `${he}bundler`,
|
|
24775
|
-
var dt = Object.defineProperty, ft = Object.defineProperties, mt = Object.getOwnPropertyDescriptors, le = Object.getOwnPropertySymbols, gt = Object.prototype.hasOwnProperty, yt = Object.prototype.propertyIsEnumerable, ue = (t2, e2, s2) => e2 in t2 ? dt(t2, e2, { enumerable: true, configurable: true, writable: true, value: s2 }) : t2[e2] = s2,
|
|
24460
|
+
const ce = "error", ht = "wss://relay.walletconnect.org", pt = "wc", oe = "universal_provider", A = `${pt}@2:${oe}:`, he = "https://rpc.walletconnect.org/v1/", pe = "generic", lt = `${he}bundler`, v = "call_status", ut = 86400, F = { DEFAULT_CHAIN_CHANGED: "default_chain_changed" };
|
|
24461
|
+
var dt = Object.defineProperty, ft = Object.defineProperties, mt = Object.getOwnPropertyDescriptors, le = Object.getOwnPropertySymbols, gt = Object.prototype.hasOwnProperty, yt = Object.prototype.propertyIsEnumerable, ue = (t2, e2, s2) => e2 in t2 ? dt(t2, e2, { enumerable: true, configurable: true, writable: true, value: s2 }) : t2[e2] = s2, E = (t2, e2) => {
|
|
24776
24462
|
for (var s2 in e2 || (e2 = {})) gt.call(e2, s2) && ue(t2, s2, e2[s2]);
|
|
24777
24463
|
if (le) for (var s2 of le(e2)) yt.call(e2, s2) && ue(t2, s2, e2[s2]);
|
|
24778
24464
|
return t2;
|
|
@@ -24813,7 +24499,7 @@ function ge(t2) {
|
|
|
24813
24499
|
if (!Ye$2(t2)) return n3;
|
|
24814
24500
|
for (const [c2, o3] of Object.entries(t2)) {
|
|
24815
24501
|
const p2 = Gn$1(c2) ? [c2] : o3.chains, l2 = o3.methods || [], h4 = o3.events || [], f4 = o3.rpcMap || {}, u2 = ms(c2);
|
|
24816
|
-
n3[u2] = vt(
|
|
24502
|
+
n3[u2] = vt(E(E({}, n3[u2]), o3), { chains: ut$2(p2, (e2 = n3[u2]) == null ? void 0 : e2.chains), methods: ut$2(l2, (s2 = n3[u2]) == null ? void 0 : s2.methods), events: ut$2(h4, (i3 = n3[u2]) == null ? void 0 : i3.events) }), (Ye$2(f4) || Ye$2(((r2 = n3[u2]) == null ? void 0 : r2.rpcMap) || {})) && (n3[u2].rpcMap = E(E({}, f4), (a2 = n3[u2]) == null ? void 0 : a2.rpcMap));
|
|
24817
24503
|
}
|
|
24818
24504
|
return n3;
|
|
24819
24505
|
}
|
|
@@ -24865,8 +24551,8 @@ const Ie = "eip155", $t = ["atomic", "flow-control", "paymasterService", "sessio
|
|
|
24865
24551
|
return Object.keys(a2).length > 0 ? a2 : void 0;
|
|
24866
24552
|
};
|
|
24867
24553
|
var jt = Object.defineProperty, Nt = (t2, e2, s2) => e2 in t2 ? jt(t2, e2, { enumerable: true, configurable: true, writable: true, value: s2 }) : t2[e2] = s2, qt = (t2, e2, s2) => Nt(t2, e2 + "", s2);
|
|
24868
|
-
let
|
|
24869
|
-
class
|
|
24554
|
+
let L;
|
|
24555
|
+
class J3 {
|
|
24870
24556
|
constructor(e2) {
|
|
24871
24557
|
qt(this, "storage"), this.storage = e2;
|
|
24872
24558
|
}
|
|
@@ -24880,7 +24566,7 @@ class J2 {
|
|
|
24880
24566
|
return await this.storage.removeItem(e2);
|
|
24881
24567
|
}
|
|
24882
24568
|
static getStorage(e2) {
|
|
24883
|
-
return
|
|
24569
|
+
return L || (L = new J3(e2)), L;
|
|
24884
24570
|
}
|
|
24885
24571
|
}
|
|
24886
24572
|
var Dt = Object.defineProperty, Rt = Object.defineProperties, _t = Object.getOwnPropertyDescriptors, $e2 = Object.getOwnPropertySymbols, xt = Object.prototype.hasOwnProperty, Ft = Object.prototype.propertyIsEnumerable, Ae = (t2, e2, s2) => e2 in t2 ? Dt(t2, e2, { enumerable: true, configurable: true, writable: true, value: s2 }) : t2[e2] = s2, Ht = (t2, e2) => {
|
|
@@ -24899,19 +24585,19 @@ async function Lt(t2, e2, s2) {
|
|
|
24899
24585
|
return await s2(parseInt(t2)).request(formatJsonRpcRequest("eth_getTransactionReceipt", [e2]));
|
|
24900
24586
|
}
|
|
24901
24587
|
async function Mt({ sendCalls: t2, storage: e2 }) {
|
|
24902
|
-
const s2 = await e2.getItem(
|
|
24903
|
-
await e2.setItem(
|
|
24588
|
+
const s2 = await e2.getItem(v);
|
|
24589
|
+
await e2.setItem(v, Ut(Ht({}, s2), { [t2.result.id]: { request: t2.request, result: t2.result, expiry: _i$1(ut) } }));
|
|
24904
24590
|
}
|
|
24905
24591
|
async function zt({ resultId: t2, storage: e2 }) {
|
|
24906
|
-
const s2 = await e2.getItem(
|
|
24592
|
+
const s2 = await e2.getItem(v);
|
|
24907
24593
|
if (s2) {
|
|
24908
|
-
delete s2[t2], await e2.setItem(
|
|
24594
|
+
delete s2[t2], await e2.setItem(v, s2);
|
|
24909
24595
|
for (const i3 in s2) Ri$1(s2[i3].expiry) && delete s2[i3];
|
|
24910
|
-
await e2.setItem(
|
|
24596
|
+
await e2.setItem(v, s2);
|
|
24911
24597
|
}
|
|
24912
24598
|
}
|
|
24913
24599
|
async function Gt({ resultId: t2, storage: e2 }) {
|
|
24914
|
-
const s2 = await e2.getItem(
|
|
24600
|
+
const s2 = await e2.getItem(v), i3 = s2?.[t2];
|
|
24915
24601
|
if (i3 && !Ri$1(i3.expiry)) return i3;
|
|
24916
24602
|
await zt({ resultId: t2, storage: e2 });
|
|
24917
24603
|
}
|
|
@@ -24922,7 +24608,7 @@ var Wt = Object.defineProperty, Jt = Object.defineProperties, Kt = Object.getOwn
|
|
|
24922
24608
|
}, G = (t2, e2) => Jt(t2, Kt(e2)), g = (t2, e2, s2) => M2(t2, typeof e2 != "symbol" ? e2 + "" : e2, s2);
|
|
24923
24609
|
class Xt {
|
|
24924
24610
|
constructor(e2) {
|
|
24925
|
-
g(this, "name", "eip155"), g(this, "client"), g(this, "chainId"), g(this, "namespace"), g(this, "httpProviders"), g(this, "events"), g(this, "storage"), this.namespace = e2.namespace, this.events = w("events"), this.client = w("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()), this.storage =
|
|
24611
|
+
g(this, "name", "eip155"), g(this, "client"), g(this, "chainId"), g(this, "namespace"), g(this, "httpProviders"), g(this, "events"), g(this, "storage"), this.namespace = e2.namespace, this.events = w("events"), this.client = w("client"), this.httpProviders = this.createHttpProviders(), this.chainId = parseInt(this.getDefaultChain()), this.storage = J3.getStorage(this.client.core.storage);
|
|
24926
24612
|
}
|
|
24927
24613
|
async request(e2) {
|
|
24928
24614
|
switch (e2.request.method) {
|
|
@@ -25008,15 +24694,15 @@ class Xt {
|
|
|
25008
24694
|
let u2;
|
|
25009
24695
|
try {
|
|
25010
24696
|
u2 = Ct(p2, c2, o3);
|
|
25011
|
-
} catch (
|
|
25012
|
-
console.warn("Failed to extract capabilities from session",
|
|
24697
|
+
} catch (q3) {
|
|
24698
|
+
console.warn("Failed to extract capabilities from session", q3);
|
|
25013
24699
|
}
|
|
25014
24700
|
if (u2) return u2;
|
|
25015
24701
|
const K3 = await this.client.request(e2);
|
|
25016
24702
|
try {
|
|
25017
24703
|
await this.client.session.update(e2.topic, { sessionProperties: G(z({}, p2.sessionProperties || {}), { capabilities: G(z({}, l2 || {}), { [h4]: K3 }) }) });
|
|
25018
|
-
} catch (
|
|
25019
|
-
console.warn("Failed to update session with capabilities",
|
|
24704
|
+
} catch (q3) {
|
|
24705
|
+
console.warn("Failed to update session with capabilities", q3);
|
|
25020
24706
|
}
|
|
25021
24707
|
return K3;
|
|
25022
24708
|
}
|
|
@@ -25120,14 +24806,14 @@ class Zt {
|
|
|
25120
24806
|
return new o$1(new f3(i3, w("disableProviderPing")));
|
|
25121
24807
|
}
|
|
25122
24808
|
}
|
|
25123
|
-
var Tt = Object.defineProperty, es = Object.defineProperties, ts = Object.getOwnPropertyDescriptors, Ce = Object.getOwnPropertySymbols, ss = Object.prototype.hasOwnProperty, is = Object.prototype.propertyIsEnumerable, W = (t2, e2, s2) => e2 in t2 ? Tt(t2, e2, { enumerable: true, configurable: true, writable: true, value: s2 }) : t2[e2] = s2,
|
|
24809
|
+
var Tt = Object.defineProperty, es = Object.defineProperties, ts = Object.getOwnPropertyDescriptors, Ce = Object.getOwnPropertySymbols, ss = Object.prototype.hasOwnProperty, is = Object.prototype.propertyIsEnumerable, W = (t2, e2, s2) => e2 in t2 ? Tt(t2, e2, { enumerable: true, configurable: true, writable: true, value: s2 }) : t2[e2] = s2, S2 = (t2, e2) => {
|
|
25124
24810
|
for (var s2 in e2 || (e2 = {})) ss.call(e2, s2) && W(t2, s2, e2[s2]);
|
|
25125
24811
|
if (Ce) for (var s2 of Ce(e2)) is.call(e2, s2) && W(t2, s2, e2[s2]);
|
|
25126
24812
|
return t2;
|
|
25127
|
-
},
|
|
24813
|
+
}, j = (t2, e2) => es(t2, ts(e2)), d2 = (t2, e2, s2) => W(t2, typeof e2 != "symbol" ? e2 + "" : e2, s2);
|
|
25128
24814
|
class N {
|
|
25129
24815
|
constructor(e2) {
|
|
25130
|
-
d2(this, "client"), d2(this, "namespaces"), d2(this, "optionalNamespaces"), d2(this, "sessionProperties"), d2(this, "scopedProperties"), d2(this, "events", new xe$
|
|
24816
|
+
d2(this, "client"), d2(this, "namespaces"), d2(this, "optionalNamespaces"), d2(this, "sessionProperties"), d2(this, "scopedProperties"), d2(this, "events", new xe$3()), d2(this, "rpcProviders", {}), d2(this, "session"), d2(this, "providerOpts"), d2(this, "logger"), d2(this, "uri"), d2(this, "disableProviderPing", false), d2(this, "connectParams");
|
|
25131
24817
|
var s2, i3;
|
|
25132
24818
|
this.providerOpts = e2, this.logger = Iu({ logger: (s2 = e2.logger) != null ? s2 : ce, name: (i3 = this.providerOpts.name) != null ? i3 : oe }), this.disableProviderPing = e2?.disableProviderPing || false;
|
|
25133
24819
|
}
|
|
@@ -25138,7 +24824,7 @@ class N {
|
|
|
25138
24824
|
async request(e2, s2, i3) {
|
|
25139
24825
|
const [r2, a2] = this.validateChain(s2);
|
|
25140
24826
|
if (!this.session) throw new Error("Please call connect() before request()");
|
|
25141
|
-
return await this.getProvider(r2).request({ request:
|
|
24827
|
+
return await this.getProvider(r2).request({ request: S2({}, e2), chainId: `${r2}:${a2}`, topic: this.session.topic, expiry: i3 });
|
|
25142
24828
|
}
|
|
25143
24829
|
sendAsync(e2, s2, i3, r2) {
|
|
25144
24830
|
const a2 = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -25243,7 +24929,7 @@ class N {
|
|
|
25243
24929
|
if (!this.session) return;
|
|
25244
24930
|
const i3 = bt(s2, this.session);
|
|
25245
24931
|
if (i3?.length === 0) return;
|
|
25246
|
-
const r2 = fe(i3), a2 = C(this.namespaces, this.optionalNamespaces), n3 =
|
|
24932
|
+
const r2 = fe(i3), a2 = C(this.namespaces, this.optionalNamespaces), n3 = j(S2({}, a2[s2]), { accounts: i3, chains: r2 });
|
|
25247
24933
|
switch (s2) {
|
|
25248
24934
|
case "eip155":
|
|
25249
24935
|
this.rpcProviders[s2] = new Xt({ namespace: n3 });
|
|
@@ -25276,12 +24962,12 @@ class N {
|
|
|
25276
24962
|
var i3, r2;
|
|
25277
24963
|
if (e2 !== ((i3 = this.session) == null ? void 0 : i3.topic)) return;
|
|
25278
24964
|
const { namespaces: a2 } = s2, n3 = (r2 = this.client) == null ? void 0 : r2.session.get(e2);
|
|
25279
|
-
this.session =
|
|
24965
|
+
this.session = j(S2({}, n3), { namespaces: a2 }), this.onSessionUpdate(), this.events.emit("session_update", { topic: e2, params: s2 });
|
|
25280
24966
|
}), this.client.on("session_delete", async (e2) => {
|
|
25281
24967
|
var s2;
|
|
25282
|
-
e2.topic === ((s2 = this.session) == null ? void 0 : s2.topic) && (await this.cleanup(), this.events.emit("session_delete", e2), this.events.emit("disconnect",
|
|
24968
|
+
e2.topic === ((s2 = this.session) == null ? void 0 : s2.topic) && (await this.cleanup(), this.events.emit("session_delete", e2), this.events.emit("disconnect", j(S2({}, zt$2("USER_DISCONNECTED")), { data: e2.topic })));
|
|
25283
24969
|
}), this.on(F.DEFAULT_CHAIN_CHANGED, (e2) => {
|
|
25284
|
-
this.onChainChanged(
|
|
24970
|
+
this.onChainChanged(j(S2({}, e2), { internal: true }));
|
|
25285
24971
|
});
|
|
25286
24972
|
}
|
|
25287
24973
|
getProvider(e2) {
|
|
@@ -25520,10 +25206,10 @@ const buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) =
|
|
|
25520
25206
|
}
|
|
25521
25207
|
let nextValue = value;
|
|
25522
25208
|
if (value instanceof Promise) {
|
|
25523
|
-
value.then((
|
|
25209
|
+
value.then((v2) => {
|
|
25524
25210
|
value.status = "fulfilled";
|
|
25525
|
-
value.value =
|
|
25526
|
-
notifyUpdate(["resolve", [prop],
|
|
25211
|
+
value.value = v2;
|
|
25212
|
+
notifyUpdate(["resolve", [prop], v2]);
|
|
25527
25213
|
}).catch((e2) => {
|
|
25528
25214
|
value.status = "rejected";
|
|
25529
25215
|
value.reason = e2;
|
|
@@ -26153,7 +25839,7 @@ class WalletConnectModal {
|
|
|
26153
25839
|
}
|
|
26154
25840
|
async initUi() {
|
|
26155
25841
|
if (typeof window !== "undefined") {
|
|
26156
|
-
await import("./index-
|
|
25842
|
+
await import("./index-sU0Z-m5M.js");
|
|
26157
25843
|
const modal = document.createElement("wcm-modal");
|
|
26158
25844
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26159
25845
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26376,34 +26062,6 @@ function useTronWalletConnect(projectId) {
|
|
|
26376
26062
|
signTransaction
|
|
26377
26063
|
};
|
|
26378
26064
|
}
|
|
26379
|
-
function parseBridgeUrlParams(source) {
|
|
26380
|
-
if (source && typeof source === "object") {
|
|
26381
|
-
return source;
|
|
26382
|
-
}
|
|
26383
|
-
const queryString = typeof source === "string" ? source : typeof window !== "undefined" ? window.location.search : "";
|
|
26384
|
-
const searchParams = new URLSearchParams(queryString);
|
|
26385
|
-
return {
|
|
26386
|
-
srcToken: searchParams.get("srcToken") || void 0,
|
|
26387
|
-
srcChain: searchParams.get("srcChain") || void 0,
|
|
26388
|
-
dstChain: searchParams.get("dstChain") || void 0,
|
|
26389
|
-
amount: searchParams.get("amount") || void 0
|
|
26390
|
-
};
|
|
26391
|
-
}
|
|
26392
|
-
function buildQueryString(params) {
|
|
26393
|
-
const searchParams = new URLSearchParams();
|
|
26394
|
-
if (params.srcToken) searchParams.set("srcToken", params.srcToken);
|
|
26395
|
-
if (params.srcChain) searchParams.set("srcChain", params.srcChain);
|
|
26396
|
-
if (params.dstChain) searchParams.set("dstChain", params.dstChain);
|
|
26397
|
-
if (params.amount) searchParams.set("amount", params.amount);
|
|
26398
|
-
const queryString = searchParams.toString();
|
|
26399
|
-
return queryString ? `?${queryString}` : "";
|
|
26400
|
-
}
|
|
26401
|
-
function updateBridgeUrlNative(params) {
|
|
26402
|
-
if (typeof window === "undefined" || !window.history) return;
|
|
26403
|
-
const queryString = buildQueryString(params);
|
|
26404
|
-
const newUrl = `${window.location.pathname}${queryString}${window.location.hash}`;
|
|
26405
|
-
window.history.replaceState(null, "", newUrl);
|
|
26406
|
-
}
|
|
26407
26065
|
function useUrlSync(options) {
|
|
26408
26066
|
const {
|
|
26409
26067
|
enabled = true,
|
|
@@ -26905,4 +26563,4 @@ export {
|
|
|
26905
26563
|
getQuoteFees as y,
|
|
26906
26564
|
calculateMinReceived as z
|
|
26907
26565
|
};
|
|
26908
|
-
//# sourceMappingURL=index-
|
|
26566
|
+
//# sourceMappingURL=index-CO2PQtBo.js.map
|