@cofhe/react 0.0.0-beta-20260402100620 → 0.0.0-beta-20260409102159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +364 -339
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -29
- package/dist/index.d.ts +47 -29
- package/dist/index.js +170 -146
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -768,6 +768,7 @@ __export(index_exports, {
|
|
|
768
768
|
useCofheClient: () => useCofheClient,
|
|
769
769
|
useCofheConnection: () => useCofheConnection,
|
|
770
770
|
useCofheContext: () => useCofheContext,
|
|
771
|
+
useCofheEnabled: () => useCofheEnabled,
|
|
771
772
|
useCofheEncrypt: () => useCofheEncrypt,
|
|
772
773
|
useCofheEncryptAndWriteContract: () => useCofheEncryptAndWriteContract,
|
|
773
774
|
useCofheNavigateToCreatePermit: () => useCofheNavigateToCreatePermit,
|
|
@@ -799,7 +800,7 @@ __export(index_exports, {
|
|
|
799
800
|
module.exports = __toCommonJS(index_exports);
|
|
800
801
|
|
|
801
802
|
// src/providers/CofheProvider.tsx
|
|
802
|
-
var
|
|
803
|
+
var import_react63 = require("react");
|
|
803
804
|
|
|
804
805
|
// src/providers/QueryProvider.tsx
|
|
805
806
|
var import_react_query = require("@tanstack/react-query");
|
|
@@ -1193,7 +1194,7 @@ function cofheHumanizeViemError(error) {
|
|
|
1193
1194
|
var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
|
|
1194
1195
|
|
|
1195
1196
|
// src/components/FnxFloatingButton/FnxFloatingButtonContext.tsx
|
|
1196
|
-
var
|
|
1197
|
+
var import_react36 = require("react");
|
|
1197
1198
|
|
|
1198
1199
|
// src/utils/bigintJson.ts
|
|
1199
1200
|
var BIGINT_JSON_MARKER_KEY = "__bigint__";
|
|
@@ -1501,17 +1502,6 @@ var useCofheSelectPermit = ({ onSuccess, onError } = {}) => {
|
|
|
1501
1502
|
|
|
1502
1503
|
// src/hooks/useCofheReadContract.ts
|
|
1503
1504
|
var import_ts_essentials = __toESM(require_dist(), 1);
|
|
1504
|
-
|
|
1505
|
-
// src/hooks/useIsCofheErrorActive.ts
|
|
1506
|
-
var import_sdk2 = require("@cofhe/sdk");
|
|
1507
|
-
var import_react5 = require("react");
|
|
1508
|
-
var import_react_error_boundary = require("react-error-boundary");
|
|
1509
|
-
function useIsCofheErrorActive() {
|
|
1510
|
-
const errorBoundaryContext = (0, import_react5.useContext)(import_react_error_boundary.ErrorBoundaryContext);
|
|
1511
|
-
return errorBoundaryContext?.error instanceof import_sdk2.CofheError;
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
// src/hooks/useCofheReadContract.ts
|
|
1515
1505
|
var import_abi = require("@cofhe/abi");
|
|
1516
1506
|
|
|
1517
1507
|
// src/utils/serializeBigint.ts
|
|
@@ -1563,8 +1553,8 @@ function constructCofheReadContractQueryForInvalidation({
|
|
|
1563
1553
|
return [QUERY_CACHE_PREFIX, cofheChainId, address, functionName];
|
|
1564
1554
|
}
|
|
1565
1555
|
function getEnabledForCofheReadContract(params) {
|
|
1566
|
-
const {
|
|
1567
|
-
return
|
|
1556
|
+
const { publicClient, address, abi, functionName, requiresPermit, hasActivePermit, userEnabled } = params;
|
|
1557
|
+
return !!publicClient && !!address && !!abi && !!functionName && (!requiresPermit || hasActivePermit) && (userEnabled ?? true);
|
|
1568
1558
|
}
|
|
1569
1559
|
function convertReadContractResultToCofheReturnType(value) {
|
|
1570
1560
|
return value;
|
|
@@ -1614,12 +1604,10 @@ function createCofheReadContractQueryOptions(params) {
|
|
|
1614
1604
|
}
|
|
1615
1605
|
function useCofheReadContract(params, queryOptions) {
|
|
1616
1606
|
const { address, abi, functionName, args, requiresPermit = true } = params;
|
|
1617
|
-
const isCofheErrorActive = useIsCofheErrorActive();
|
|
1618
1607
|
const publicClient = useCofhePublicClient();
|
|
1619
1608
|
const cofheChainId = useCofheChainId();
|
|
1620
1609
|
const activePermit = useCofheActivePermit();
|
|
1621
1610
|
const enabled = getEnabledForCofheReadContract({
|
|
1622
|
-
isCofheErrorActive,
|
|
1623
1611
|
publicClient,
|
|
1624
1612
|
address,
|
|
1625
1613
|
abi,
|
|
@@ -1644,7 +1632,7 @@ function useCofheReadContract(params, queryOptions) {
|
|
|
1644
1632
|
);
|
|
1645
1633
|
return {
|
|
1646
1634
|
...result,
|
|
1647
|
-
|
|
1635
|
+
disabledDueToMissingValidPermit: requiresPermit && (!activePermit || !activePermit.isValid)
|
|
1648
1636
|
};
|
|
1649
1637
|
}
|
|
1650
1638
|
|
|
@@ -1893,7 +1881,7 @@ function getTokenContractConfig(confidentialityType) {
|
|
|
1893
1881
|
|
|
1894
1882
|
// src/hooks/useCofheTokenLists.ts
|
|
1895
1883
|
var import_react_query3 = require("@tanstack/react-query");
|
|
1896
|
-
var
|
|
1884
|
+
var import_react5 = require("react");
|
|
1897
1885
|
function useCofheTokenLists({ chainId }, queryOptions) {
|
|
1898
1886
|
const widgetConfig = useCofheContext().client.config.react;
|
|
1899
1887
|
const tokensListsUrls = chainId ? widgetConfig.tokenLists?.[chainId] : [];
|
|
@@ -1920,14 +1908,14 @@ function useCofheTokenLists({ chainId }, queryOptions) {
|
|
|
1920
1908
|
},
|
|
1921
1909
|
...queryOptions
|
|
1922
1910
|
})) || [];
|
|
1923
|
-
const result =
|
|
1911
|
+
const result = useInternalQueries({
|
|
1924
1912
|
queries: queriesOptions
|
|
1925
1913
|
});
|
|
1926
1914
|
return result;
|
|
1927
1915
|
}
|
|
1928
1916
|
function useCofheTokens(chainId) {
|
|
1929
1917
|
const tokenLists = useCofheTokenLists({ chainId });
|
|
1930
|
-
const tokens = (0,
|
|
1918
|
+
const tokens = (0, import_react5.useMemo)(() => {
|
|
1931
1919
|
const map = /* @__PURE__ */ new Map();
|
|
1932
1920
|
tokenLists.forEach((result) => {
|
|
1933
1921
|
if (!result.data) return;
|
|
@@ -1945,7 +1933,7 @@ function useCofheToken({ chainId: _chainId, address }, metdataQueryOptions) {
|
|
|
1945
1933
|
const cofheChainId = useCofheChainId();
|
|
1946
1934
|
const chainId = _chainId ?? cofheChainId;
|
|
1947
1935
|
const tokens = useCofheTokens(chainId);
|
|
1948
|
-
const tokenFromList = (0,
|
|
1936
|
+
const tokenFromList = (0, import_react5.useMemo)(() => {
|
|
1949
1937
|
if (!address || !chainId) return;
|
|
1950
1938
|
return tokens.find((t) => t.chainId === chainId && t.address.toLowerCase() === address.toLowerCase());
|
|
1951
1939
|
}, [address, chainId, tokens]);
|
|
@@ -2204,18 +2192,18 @@ function decryptionAwareReadContract({
|
|
|
2204
2192
|
}
|
|
2205
2193
|
|
|
2206
2194
|
// src/hooks/useIsWaitingForDecryptionToInvalidate.ts
|
|
2207
|
-
var
|
|
2195
|
+
var import_react6 = require("react");
|
|
2208
2196
|
function useAwaitingDecryptionQueryKeySet() {
|
|
2209
2197
|
const { byKey } = useDecryptionWatchersStore();
|
|
2210
|
-
const cacheKeysAwaitingDecryption = (0,
|
|
2211
|
-
return (0,
|
|
2198
|
+
const cacheKeysAwaitingDecryption = (0, import_react6.useMemo)(() => Object.values(byKey).flatMap((item) => item.queryKeys), [byKey]);
|
|
2199
|
+
return (0, import_react6.useMemo)(
|
|
2212
2200
|
() => new Set(cacheKeysAwaitingDecryption.map((key) => JSON.stringify(key))),
|
|
2213
2201
|
[cacheKeysAwaitingDecryption]
|
|
2214
2202
|
);
|
|
2215
2203
|
}
|
|
2216
2204
|
function useIsWaitingForDecryptionToInvalidate(queryKey) {
|
|
2217
2205
|
const cacheKeySet = useAwaitingDecryptionQueryKeySet();
|
|
2218
|
-
const result = (0,
|
|
2206
|
+
const result = (0, import_react6.useMemo)(() => cacheKeySet.has(JSON.stringify(queryKey)), [cacheKeySet, queryKey]);
|
|
2219
2207
|
cofheLogger.log(`isWaitingForDecryption for queryKey ${JSON.stringify(queryKey)}:`, result);
|
|
2220
2208
|
return result;
|
|
2221
2209
|
}
|
|
@@ -2447,7 +2435,7 @@ function useTokenAllowance({ tokenAddress, ownerAddress, spenderAddress }, optio
|
|
|
2447
2435
|
}
|
|
2448
2436
|
|
|
2449
2437
|
// src/hooks/useStoredTransactions.ts
|
|
2450
|
-
var
|
|
2438
|
+
var import_react7 = require("react");
|
|
2451
2439
|
var import_ts_essentials5 = __toESM(require_dist());
|
|
2452
2440
|
function useStoredTransactions({
|
|
2453
2441
|
chainId,
|
|
@@ -2456,7 +2444,7 @@ function useStoredTransactions({
|
|
|
2456
2444
|
reducer
|
|
2457
2445
|
}) {
|
|
2458
2446
|
const transactions = useTransactionStore((state) => state.transactions);
|
|
2459
|
-
const transactionsAsArray = (0,
|
|
2447
|
+
const transactionsAsArray = (0, import_react7.useMemo)(
|
|
2460
2448
|
() => Object.values(
|
|
2461
2449
|
chainId ? (
|
|
2462
2450
|
// if chainId provided -- will filter on chain's txs first
|
|
@@ -2468,7 +2456,7 @@ function useStoredTransactions({
|
|
|
2468
2456
|
),
|
|
2469
2457
|
[transactions, chainId]
|
|
2470
2458
|
);
|
|
2471
|
-
const filtered = (0,
|
|
2459
|
+
const filtered = (0, import_react7.useMemo)(
|
|
2472
2460
|
() => transactionsAsArray.filter((tx) => {
|
|
2473
2461
|
if (account && tx.account.toLowerCase() !== account.toLowerCase()) return false;
|
|
2474
2462
|
if (filter3 && !filter3(tx)) return false;
|
|
@@ -2476,7 +2464,7 @@ function useStoredTransactions({
|
|
|
2476
2464
|
}),
|
|
2477
2465
|
[transactionsAsArray, filter3, account]
|
|
2478
2466
|
);
|
|
2479
|
-
const reduced = (0,
|
|
2467
|
+
const reduced = (0, import_react7.useMemo)(() => {
|
|
2480
2468
|
return reducer?.(filtered);
|
|
2481
2469
|
}, [filtered, reducer]);
|
|
2482
2470
|
const uniqueHashes = new Set(filtered.map((tx) => tx.hash));
|
|
@@ -2484,7 +2472,7 @@ function useStoredTransactions({
|
|
|
2484
2472
|
uniqueHashes.size === filtered.length,
|
|
2485
2473
|
"There should be no duplicate transactions with the same hash in the result"
|
|
2486
2474
|
);
|
|
2487
|
-
const filteredTxsByHash = (0,
|
|
2475
|
+
const filteredTxsByHash = (0, import_react7.useMemo)(
|
|
2488
2476
|
() => filtered.reduce((acc, tx) => {
|
|
2489
2477
|
return {
|
|
2490
2478
|
...acc,
|
|
@@ -2533,7 +2521,7 @@ var usePortalModals = (0, import_zustand3.create)()((set, get) => ({
|
|
|
2533
2521
|
}));
|
|
2534
2522
|
|
|
2535
2523
|
// src/stores/portalUIStore.tsx
|
|
2536
|
-
var
|
|
2524
|
+
var import_react8 = require("react");
|
|
2537
2525
|
var import_zustand5 = require("zustand");
|
|
2538
2526
|
|
|
2539
2527
|
// src/stores/portalStatuses.tsx
|
|
@@ -2621,7 +2609,7 @@ var usePortalUI = (0, import_zustand5.create)()((set, get) => ({
|
|
|
2621
2609
|
}));
|
|
2622
2610
|
var usePortalUIMaxContentHeight = () => {
|
|
2623
2611
|
const { contentHeights } = usePortalUI();
|
|
2624
|
-
return (0,
|
|
2612
|
+
return (0, import_react8.useMemo)(() => {
|
|
2625
2613
|
return contentHeights.reduce((max, height) => Math.max(max, height.height), 0);
|
|
2626
2614
|
}, [contentHeights]);
|
|
2627
2615
|
};
|
|
@@ -2680,10 +2668,10 @@ var usePortalCurrentPage = () => {
|
|
|
2680
2668
|
|
|
2681
2669
|
// src/components/FnxFloatingButton/components/ToastPrimitives.tsx
|
|
2682
2670
|
var import_tb = require("react-icons/tb");
|
|
2683
|
-
var
|
|
2671
|
+
var import_react10 = require("motion/react");
|
|
2684
2672
|
|
|
2685
2673
|
// src/components/FnxFloatingButton/components/HashLink.tsx
|
|
2686
|
-
var
|
|
2674
|
+
var import_react9 = require("react");
|
|
2687
2675
|
var import_lu = require("react-icons/lu");
|
|
2688
2676
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2689
2677
|
var HashLink = ({
|
|
@@ -2738,7 +2726,7 @@ var HashLink = ({
|
|
|
2738
2726
|
] });
|
|
2739
2727
|
};
|
|
2740
2728
|
var CopyButton = ({ text, size = 14, className }) => {
|
|
2741
|
-
const [copied, setCopied] = (0,
|
|
2729
|
+
const [copied, setCopied] = (0, import_react9.useState)(false);
|
|
2742
2730
|
const handleCopy = async (e) => {
|
|
2743
2731
|
e.stopPropagation();
|
|
2744
2732
|
try {
|
|
@@ -2803,7 +2791,7 @@ var ToastDurationIndicator = ({ duration, remainingMs, paused, variant }) => {
|
|
|
2803
2791
|
const progress = remainingMs / duration;
|
|
2804
2792
|
const progressColor = variantProgressBarColorMap[variant ?? "base"];
|
|
2805
2793
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute bottom-0 left-0 w-full h-1 overflow-hidden", children: paused ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cn(progressColor, "h-full origin-right"), style: { transform: `scaleX(${progress})` } }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2806
|
-
|
|
2794
|
+
import_react10.motion.div,
|
|
2807
2795
|
{
|
|
2808
2796
|
className: cn("h-full origin-right", progressColor),
|
|
2809
2797
|
initial: { scaleX: progress },
|
|
@@ -3024,7 +3012,7 @@ function useTransactionGlobalLifecycle() {
|
|
|
3024
3012
|
}
|
|
3025
3013
|
|
|
3026
3014
|
// src/hooks/useTrackPendingTransactions.ts
|
|
3027
|
-
var
|
|
3015
|
+
var import_react11 = require("react");
|
|
3028
3016
|
function invalidateConfidentialTokenBalanceQueries(token, queryClient) {
|
|
3029
3017
|
const tokenBalanceQueryKey = constructCofheReadContractQueryForInvalidation({
|
|
3030
3018
|
cofheChainId: token.chainId,
|
|
@@ -3110,7 +3098,7 @@ function useTrackPendingTransactionsBase({
|
|
|
3110
3098
|
refetchOnWindowFocus: false,
|
|
3111
3099
|
refetchOnReconnect: true
|
|
3112
3100
|
}));
|
|
3113
|
-
|
|
3101
|
+
useInternalQueries({
|
|
3114
3102
|
queries
|
|
3115
3103
|
});
|
|
3116
3104
|
}
|
|
@@ -3186,8 +3174,8 @@ function useHandleInvalidations() {
|
|
|
3186
3174
|
}
|
|
3187
3175
|
function useOnceTransactionSubmitted(onSubmit) {
|
|
3188
3176
|
const pendingTransactions = usePendingTransactions();
|
|
3189
|
-
const previousPendingTxsRef = (0,
|
|
3190
|
-
(0,
|
|
3177
|
+
const previousPendingTxsRef = (0, import_react11.useRef)([]);
|
|
3178
|
+
(0, import_react11.useEffect)(() => {
|
|
3191
3179
|
const newlySubmittedTxs = pendingTransactions.filter(
|
|
3192
3180
|
(tx) => !previousPendingTxsRef.current.some((prevTx) => prevTx.hash === tx.hash)
|
|
3193
3181
|
);
|
|
@@ -3219,10 +3207,10 @@ function useTrackPendingTransactions() {
|
|
|
3219
3207
|
}
|
|
3220
3208
|
|
|
3221
3209
|
// src/hooks/useTrackDecryptingTransactions.ts
|
|
3222
|
-
var
|
|
3210
|
+
var import_react14 = require("react");
|
|
3223
3211
|
|
|
3224
3212
|
// src/hooks/useTransactionReceiptsByHash.ts
|
|
3225
|
-
var
|
|
3213
|
+
var import_react12 = require("react");
|
|
3226
3214
|
var import_ts_essentials7 = __toESM(require_dist(), 1);
|
|
3227
3215
|
function useTransactionReceiptsByHash({ hashes, chainId: chainIdInput, enabled: enabledInput = true, queryOptions } = {
|
|
3228
3216
|
enabled: true
|
|
@@ -3231,7 +3219,7 @@ function useTransactionReceiptsByHash({ hashes, chainId: chainIdInput, enabled:
|
|
|
3231
3219
|
const cofheChainId = useCofheChainId();
|
|
3232
3220
|
const chainId = chainIdInput ?? cofheChainId;
|
|
3233
3221
|
const enabled = !!publicClient && !!chainId && enabledInput && hashes !== void 0 && hashes?.size > 0;
|
|
3234
|
-
const queries = (0,
|
|
3222
|
+
const queries = (0, import_react12.useMemo)(() => {
|
|
3235
3223
|
if (!hashes) return [];
|
|
3236
3224
|
return Array.from(hashes).map((hash) => {
|
|
3237
3225
|
const queryKey = ["tx-receipt", chainId, hash];
|
|
@@ -3250,10 +3238,10 @@ function useTransactionReceiptsByHash({ hashes, chainId: chainIdInput, enabled:
|
|
|
3250
3238
|
};
|
|
3251
3239
|
});
|
|
3252
3240
|
}, [chainId, enabled, hashes, publicClient, queryOptions]);
|
|
3253
|
-
const queriesResults =
|
|
3241
|
+
const queriesResults = useInternalQueries({
|
|
3254
3242
|
queries
|
|
3255
3243
|
});
|
|
3256
|
-
const receiptsByHash = (0,
|
|
3244
|
+
const receiptsByHash = (0, import_react12.useMemo)(() => {
|
|
3257
3245
|
cofheLogger.log("useTransactionReceiptsByHash - receiptsByHash recalculated");
|
|
3258
3246
|
if (!hashes) return {};
|
|
3259
3247
|
return Array.from(hashes).reduce((acc, hash, i) => {
|
|
@@ -3269,8 +3257,8 @@ function useTransactionReceiptsByHash({ hashes, chainId: chainIdInput, enabled:
|
|
|
3269
3257
|
var import_ts_essentials8 = __toESM(require_dist());
|
|
3270
3258
|
|
|
3271
3259
|
// src/hooks/useCofheReadDecryptionResults.ts
|
|
3272
|
-
var
|
|
3273
|
-
var
|
|
3260
|
+
var import_react13 = require("react");
|
|
3261
|
+
var import_sdk2 = require("@cofhe/sdk");
|
|
3274
3262
|
function abortError2(message = "Aborted") {
|
|
3275
3263
|
const err = new Error(message);
|
|
3276
3264
|
err.name = "AbortError";
|
|
@@ -3325,7 +3313,7 @@ var DECRYPTION_RESULT_POLLING_INTERVAL_MS = 5e3;
|
|
|
3325
3313
|
function useCofheReadDecryptionResults(ciphertexts) {
|
|
3326
3314
|
const publicClient = useCofhePublicClient();
|
|
3327
3315
|
const chainId = useCofheChainId();
|
|
3328
|
-
const queries = (0,
|
|
3316
|
+
const queries = (0, import_react13.useMemo)(() => {
|
|
3329
3317
|
return Array.from(ciphertexts).map((ct) => {
|
|
3330
3318
|
return {
|
|
3331
3319
|
queryKey: ["decryptionResult", chainId, ct],
|
|
@@ -3334,7 +3322,7 @@ function useCofheReadDecryptionResults(ciphertexts) {
|
|
|
3334
3322
|
while (!signal.aborted) {
|
|
3335
3323
|
const [res, block] = await Promise.allSettled([
|
|
3336
3324
|
publicClient.readContract({
|
|
3337
|
-
address:
|
|
3325
|
+
address: import_sdk2.TASK_MANAGER_ADDRESS,
|
|
3338
3326
|
abi: TASK_MANAGER_ABI,
|
|
3339
3327
|
functionName: "getDecryptResultSafe",
|
|
3340
3328
|
args: [BigInt(ct)]
|
|
@@ -3365,8 +3353,8 @@ function useCofheReadDecryptionResults(ciphertexts) {
|
|
|
3365
3353
|
};
|
|
3366
3354
|
});
|
|
3367
3355
|
}, [chainId, ciphertexts, publicClient]);
|
|
3368
|
-
const results =
|
|
3369
|
-
const isDecryptedByCt = (0,
|
|
3356
|
+
const results = useInternalQueries({ queries });
|
|
3357
|
+
const isDecryptedByCt = (0, import_react13.useMemo)(() => {
|
|
3370
3358
|
return results.reduce((record, res, index) => {
|
|
3371
3359
|
const ct = Array.from(ciphertexts)[index];
|
|
3372
3360
|
record[ct] = res.data;
|
|
@@ -3379,7 +3367,7 @@ function useCofheReadDecryptionResults(ciphertexts) {
|
|
|
3379
3367
|
// src/hooks/useTrackDecryptingTransactions.ts
|
|
3380
3368
|
function useHandleInvalidationsAfterDecryption() {
|
|
3381
3369
|
const queryClient = useInternalQueryClient();
|
|
3382
|
-
return (0,
|
|
3370
|
+
return (0, import_react14.useCallback)(
|
|
3383
3371
|
async (_tx, decryptionWatcher) => {
|
|
3384
3372
|
cofheLogger.log("Invalidating queries for decryption watcher:", decryptionWatcher);
|
|
3385
3373
|
for (const queryKey of decryptionWatcher.queryKeys) {
|
|
@@ -3402,7 +3390,7 @@ function useTrackDecryptingTransactionsBase({ onDecryptionResolve }) {
|
|
|
3402
3390
|
const { receiptsByHash } = useTransactionReceiptsByHash({
|
|
3403
3391
|
hashes
|
|
3404
3392
|
});
|
|
3405
|
-
const minedTxsWithCiphertextsToWatch = (0,
|
|
3393
|
+
const minedTxsWithCiphertextsToWatch = (0, import_react14.useMemo)(() => {
|
|
3406
3394
|
return Object.entries(minedTxsPendingDecryptionByHash).filter(([, tx]) => receiptsByHash[tx.hash] !== void 0).map(([, tx]) => {
|
|
3407
3395
|
const ciphertextToWatch = findDecryptRequestLog(tx.account, receiptsByHash[tx.hash].logs)?.ciphertext;
|
|
3408
3396
|
(0, import_ts_essentials8.assert)(
|
|
@@ -3416,13 +3404,13 @@ function useTrackDecryptingTransactionsBase({ onDecryptionResolve }) {
|
|
|
3416
3404
|
};
|
|
3417
3405
|
});
|
|
3418
3406
|
}, [minedTxsPendingDecryptionByHash, receiptsByHash]);
|
|
3419
|
-
const ciphertextsToWatch = (0,
|
|
3407
|
+
const ciphertextsToWatch = (0, import_react14.useMemo)(() => {
|
|
3420
3408
|
return new Set(minedTxsWithCiphertextsToWatch.map(({ ciphertextToWatch }) => ciphertextToWatch));
|
|
3421
3409
|
}, [minedTxsWithCiphertextsToWatch]);
|
|
3422
3410
|
const decryptionResults = useCofheReadDecryptionResults(ciphertextsToWatch);
|
|
3423
3411
|
const queryClient = useInternalQueryClient();
|
|
3424
3412
|
const { setDecryptionObservedAt } = useDecryptionWatchersStore();
|
|
3425
|
-
(0,
|
|
3413
|
+
(0, import_react14.useEffect)(() => {
|
|
3426
3414
|
const txsWithDecryptionResults = minedTxsWithCiphertextsToWatch.filter(({ ciphertextToWatch }) => decryptionResults[ciphertextToWatch] !== void 0).map((item) => {
|
|
3427
3415
|
const decryptionResult = decryptionResults[item.ciphertextToWatch];
|
|
3428
3416
|
(0, import_ts_essentials8.assert)(decryptionResult, "decryptionResult must be defined here");
|
|
@@ -3457,24 +3445,24 @@ function useTrackDecryptingTransactionsBase({ onDecryptionResolve }) {
|
|
|
3457
3445
|
}
|
|
3458
3446
|
function useOnDecryptionCallback({ onDecryptionResolve }) {
|
|
3459
3447
|
const { byKey } = useDecryptionWatchersStore();
|
|
3460
|
-
const watchersWithObservedDecryption = (0,
|
|
3448
|
+
const watchersWithObservedDecryption = (0, import_react14.useMemo)(
|
|
3461
3449
|
() => Object.values(byKey).filter((item) => item.decryptionObservedAt !== void 0),
|
|
3462
3450
|
[byKey]
|
|
3463
3451
|
);
|
|
3464
3452
|
cofheLogger.log("All observed decryptions:", watchersWithObservedDecryption);
|
|
3465
|
-
const handleDecryptionResolve = (0,
|
|
3453
|
+
const handleDecryptionResolve = (0, import_react14.useCallback)(async () => {
|
|
3466
3454
|
const transactionStore = useTransactionStore.getState().transactions;
|
|
3467
3455
|
for (const sch of watchersWithObservedDecryption) {
|
|
3468
3456
|
const tx = transactionStore[sch.chainId]?.[sch.triggerTxHash];
|
|
3469
3457
|
onDecryptionResolve(tx, sch);
|
|
3470
3458
|
}
|
|
3471
3459
|
}, [watchersWithObservedDecryption, onDecryptionResolve]);
|
|
3472
|
-
const stableHandleDecryptionResolve = (0,
|
|
3460
|
+
const stableHandleDecryptionResolve = (0, import_react14.useRef)(handleDecryptionResolve);
|
|
3473
3461
|
stableHandleDecryptionResolve.current = handleDecryptionResolve;
|
|
3474
|
-
(0,
|
|
3462
|
+
(0, import_react14.useEffect)(() => {
|
|
3475
3463
|
stableHandleDecryptionResolve.current = handleDecryptionResolve;
|
|
3476
3464
|
}, [handleDecryptionResolve]);
|
|
3477
|
-
(0,
|
|
3465
|
+
(0, import_react14.useEffect)(() => {
|
|
3478
3466
|
if (watchersWithObservedDecryption.length > 0) {
|
|
3479
3467
|
cofheLogger.log("All observed decryption query keys subject to invalidate:", watchersWithObservedDecryption);
|
|
3480
3468
|
stableHandleDecryptionResolve.current();
|
|
@@ -3511,6 +3499,35 @@ function useTrackDecryptingTransactions() {
|
|
|
3511
3499
|
});
|
|
3512
3500
|
}
|
|
3513
3501
|
|
|
3502
|
+
// src/hooks/useCofheEnabled.ts
|
|
3503
|
+
var import_sdk3 = require("@cofhe/sdk");
|
|
3504
|
+
var TASK_MANAGER_IS_ENABLED_ABI = [
|
|
3505
|
+
{
|
|
3506
|
+
type: "function",
|
|
3507
|
+
name: "isEnabled",
|
|
3508
|
+
inputs: [],
|
|
3509
|
+
outputs: [
|
|
3510
|
+
{
|
|
3511
|
+
name: "enabled",
|
|
3512
|
+
type: "bool",
|
|
3513
|
+
internalType: "bool"
|
|
3514
|
+
}
|
|
3515
|
+
],
|
|
3516
|
+
stateMutability: "view"
|
|
3517
|
+
}
|
|
3518
|
+
];
|
|
3519
|
+
function useCofheEnabled(options) {
|
|
3520
|
+
return useCofheReadContract(
|
|
3521
|
+
{
|
|
3522
|
+
address: import_sdk3.TASK_MANAGER_ADDRESS,
|
|
3523
|
+
abi: TASK_MANAGER_IS_ENABLED_ABI,
|
|
3524
|
+
functionName: "isEnabled",
|
|
3525
|
+
requiresPermit: false
|
|
3526
|
+
},
|
|
3527
|
+
options
|
|
3528
|
+
);
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3514
3531
|
// src/hooks/useCofheClient.ts
|
|
3515
3532
|
var useCofheClient = () => {
|
|
3516
3533
|
return useCofheContext().client;
|
|
@@ -3535,9 +3552,8 @@ function useCofheDecrypt({
|
|
|
3535
3552
|
onPoll: onPoll2
|
|
3536
3553
|
}, queryOptions) {
|
|
3537
3554
|
const { client } = useCofheContext();
|
|
3538
|
-
const isCofheErrorActive = useIsCofheErrorActive();
|
|
3539
3555
|
const { enabled: userEnabled, ...restQueryOptions } = queryOptions || {};
|
|
3540
|
-
const enabled = !!input && BigInt(input.ctHash) > 0n &&
|
|
3556
|
+
const enabled = !!input && BigInt(input.ctHash) > 0n && !!client && (userEnabled ?? true);
|
|
3541
3557
|
return useInternalQuery({
|
|
3542
3558
|
enabled,
|
|
3543
3559
|
queryKey: ["decryptCiphertext", input?.ctHash.toString(), input?.utype],
|
|
@@ -3591,7 +3607,7 @@ function useCofheReadContractAndDecrypt(params, {
|
|
|
3591
3607
|
return {
|
|
3592
3608
|
encrypted,
|
|
3593
3609
|
decrypted,
|
|
3594
|
-
|
|
3610
|
+
disabledDueToMissingValidPermit: encrypted.disabledDueToMissingValidPermit
|
|
3595
3611
|
};
|
|
3596
3612
|
}
|
|
3597
3613
|
|
|
@@ -3602,7 +3618,7 @@ function useCofheTokenDecryptedBalance({ token, accountAddress, displayDecimals
|
|
|
3602
3618
|
const {
|
|
3603
3619
|
decrypted: { data: decryptedData, isFetching: isDecryptionFetching },
|
|
3604
3620
|
encrypted: { isFetching: isEncryptedFetching, refetch: refetchCiphertext },
|
|
3605
|
-
|
|
3621
|
+
disabledDueToMissingValidPermit
|
|
3606
3622
|
} = useCofheReadContractAndDecrypt(
|
|
3607
3623
|
{
|
|
3608
3624
|
address: token?.address,
|
|
@@ -3630,7 +3646,7 @@ function useCofheTokenDecryptedBalance({ token, accountAddress, displayDecimals
|
|
|
3630
3646
|
}
|
|
3631
3647
|
);
|
|
3632
3648
|
return {
|
|
3633
|
-
|
|
3649
|
+
disabledDueToMissingValidPermit,
|
|
3634
3650
|
data: decryptedData,
|
|
3635
3651
|
isFetching: isDecryptionFetching || isEncryptedFetching,
|
|
3636
3652
|
refetch: refetchCiphertext
|
|
@@ -3650,7 +3666,7 @@ var import_ts_essentials11 = __toESM(require_dist(), 1);
|
|
|
3650
3666
|
|
|
3651
3667
|
// src/hooks/internal/useStepsState.ts
|
|
3652
3668
|
var import_sdk7 = require("@cofhe/sdk");
|
|
3653
|
-
var
|
|
3669
|
+
var import_react15 = require("react");
|
|
3654
3670
|
function validateAndCompactizeSteps(encSteps) {
|
|
3655
3671
|
const result = {};
|
|
3656
3672
|
encSteps.forEach((encStep, index) => {
|
|
@@ -3662,19 +3678,19 @@ function validateAndCompactizeSteps(encSteps) {
|
|
|
3662
3678
|
return result;
|
|
3663
3679
|
}
|
|
3664
3680
|
function useStepsState() {
|
|
3665
|
-
const [steps, setSteps] = (0,
|
|
3666
|
-
const [currentKey, setCurrentKey] = (0,
|
|
3667
|
-
const onStep = (0,
|
|
3681
|
+
const [steps, setSteps] = (0, import_react15.useState)({});
|
|
3682
|
+
const [currentKey, setCurrentKey] = (0, import_react15.useState)(null);
|
|
3683
|
+
const onStep = (0, import_react15.useCallback)((key, step, context) => {
|
|
3668
3684
|
if (step === import_sdk7.EncryptStep.InitTfhe && context?.isStart) {
|
|
3669
3685
|
setSteps((prev) => ({ ...prev, [key]: [{ step, context }] }));
|
|
3670
3686
|
} else {
|
|
3671
3687
|
setSteps((prev) => ({ ...prev, [key]: [...prev[key], { step, context }] }));
|
|
3672
3688
|
}
|
|
3673
3689
|
}, []);
|
|
3674
|
-
const onSetKey = (0,
|
|
3690
|
+
const onSetKey = (0, import_react15.useCallback)((key) => {
|
|
3675
3691
|
setCurrentKey(key);
|
|
3676
3692
|
}, []);
|
|
3677
|
-
const compactSteps = (0,
|
|
3693
|
+
const compactSteps = (0, import_react15.useMemo)(
|
|
3678
3694
|
() => validateAndCompactizeSteps(currentKey ? steps[currentKey] : []),
|
|
3679
3695
|
[steps, currentKey]
|
|
3680
3696
|
);
|
|
@@ -4105,10 +4121,10 @@ var import_viem15 = require("viem");
|
|
|
4105
4121
|
var import_ts_essentials15 = __toESM(require_dist(), 1);
|
|
4106
4122
|
|
|
4107
4123
|
// src/hooks/useStoredTransaction.ts
|
|
4108
|
-
var
|
|
4124
|
+
var import_react16 = require("react");
|
|
4109
4125
|
var import_ts_essentials14 = __toESM(require_dist(), 1);
|
|
4110
4126
|
function useStoredTransaction(txHash) {
|
|
4111
|
-
const filter3 = (0,
|
|
4127
|
+
const filter3 = (0, import_react16.useMemo)(() => {
|
|
4112
4128
|
return (tx) => tx.hash === txHash;
|
|
4113
4129
|
}, [txHash]);
|
|
4114
4130
|
const { filteredTxs } = useStoredTransactions({ filter: filter3 });
|
|
@@ -4117,7 +4133,7 @@ function useStoredTransaction(txHash) {
|
|
|
4117
4133
|
}
|
|
4118
4134
|
|
|
4119
4135
|
// src/hooks/useOnceTransactionMined.ts
|
|
4120
|
-
var
|
|
4136
|
+
var import_react17 = require("react");
|
|
4121
4137
|
function useOnceTransactionMined({
|
|
4122
4138
|
txHash,
|
|
4123
4139
|
onceMined
|
|
@@ -4140,8 +4156,8 @@ function useStoredTransactionStatusEffect({
|
|
|
4140
4156
|
onTransactionStatusChange
|
|
4141
4157
|
}) {
|
|
4142
4158
|
const transaction = useStoredTransaction(txHash);
|
|
4143
|
-
const previousTransactionRef = (0,
|
|
4144
|
-
(0,
|
|
4159
|
+
const previousTransactionRef = (0, import_react17.useRef)(void 0);
|
|
4160
|
+
(0, import_react17.useEffect)(() => {
|
|
4145
4161
|
if (!onTransactionStatusChange) return;
|
|
4146
4162
|
if (previousTransactionRef.current?.status !== transaction?.status && !!transaction) {
|
|
4147
4163
|
onTransactionStatusChange(previousTransactionRef.current?.status, transaction.status, transaction);
|
|
@@ -4154,7 +4170,7 @@ function useStoredTransactionStatusEffect({
|
|
|
4154
4170
|
}
|
|
4155
4171
|
|
|
4156
4172
|
// src/hooks/useOnceDecrypted.ts
|
|
4157
|
-
var
|
|
4173
|
+
var import_react18 = require("react");
|
|
4158
4174
|
function useOnceDecrypted({
|
|
4159
4175
|
txHash,
|
|
4160
4176
|
onceDecrypted
|
|
@@ -4177,8 +4193,8 @@ function useStoredTransactionDecryptionEffect({
|
|
|
4177
4193
|
onDecryptionPendingChange
|
|
4178
4194
|
}) {
|
|
4179
4195
|
const transaction = useStoredTransaction(txHash);
|
|
4180
|
-
const previousTransactionRef = (0,
|
|
4181
|
-
(0,
|
|
4196
|
+
const previousTransactionRef = (0, import_react18.useRef)(void 0);
|
|
4197
|
+
(0, import_react18.useEffect)(() => {
|
|
4182
4198
|
if (!onDecryptionPendingChange) return;
|
|
4183
4199
|
if (previousTransactionRef.current?.isPendingDecryption !== transaction?.isPendingDecryption && !!transaction) {
|
|
4184
4200
|
onDecryptionPendingChange(
|
|
@@ -4417,14 +4433,14 @@ function useCofheTokenClaimUnshielded(options) {
|
|
|
4417
4433
|
|
|
4418
4434
|
// src/hooks/useCofheTokensClaimable.ts
|
|
4419
4435
|
var import_react_query14 = require("@tanstack/react-query");
|
|
4420
|
-
var
|
|
4436
|
+
var import_react21 = require("react");
|
|
4421
4437
|
var import_viem18 = require("viem");
|
|
4422
4438
|
var import_ts_essentials18 = __toESM(require_dist(), 1);
|
|
4423
4439
|
|
|
4424
4440
|
// src/hooks/useNormalizedList.ts
|
|
4425
|
-
var
|
|
4441
|
+
var import_react19 = require("react");
|
|
4426
4442
|
function useNormalizedList(items, options) {
|
|
4427
|
-
return (0,
|
|
4443
|
+
return (0, import_react19.useMemo)(() => {
|
|
4428
4444
|
if (!items || items.length === 0) return [];
|
|
4429
4445
|
const filter3 = options?.filter;
|
|
4430
4446
|
const dedupeKey = options?.dedupeKey;
|
|
@@ -4448,12 +4464,12 @@ function useNormalizedList(items, options) {
|
|
|
4448
4464
|
}
|
|
4449
4465
|
|
|
4450
4466
|
// src/hooks/useIsWaitingForDecryptionByAddress.ts
|
|
4451
|
-
var
|
|
4467
|
+
var import_react20 = require("react");
|
|
4452
4468
|
var import_viem17 = require("viem");
|
|
4453
4469
|
var import_ts_essentials17 = __toESM(require_dist(), 1);
|
|
4454
4470
|
function useIsWaitingForDecryptionByAddress(entries) {
|
|
4455
4471
|
const awaitingDecryptionKeySet = useAwaitingDecryptionQueryKeySet();
|
|
4456
|
-
return (0,
|
|
4472
|
+
return (0, import_react20.useMemo)(() => {
|
|
4457
4473
|
const map = {};
|
|
4458
4474
|
for (const entry of entries) {
|
|
4459
4475
|
(0, import_ts_essentials17.assert)((0, import_viem17.isAddress)(entry.address), "address is valid");
|
|
@@ -4492,7 +4508,7 @@ function useCofheTokensClaimable({ tokens, accountAddress: account }, queryOptio
|
|
|
4492
4508
|
sort: claimableSort
|
|
4493
4509
|
});
|
|
4494
4510
|
const enabledBase = !!publicClient && !!account && normalizedTokens.length > 0;
|
|
4495
|
-
const waitingEntries = (0,
|
|
4511
|
+
const waitingEntries = (0, import_react21.useMemo)(() => {
|
|
4496
4512
|
if (!account) return [];
|
|
4497
4513
|
return normalizedTokens.map((token) => ({
|
|
4498
4514
|
address: token.address,
|
|
@@ -4518,7 +4534,7 @@ function useCofheTokensClaimable({ tokens, accountAddress: account }, queryOptio
|
|
|
4518
4534
|
filter: pendingClaimsFilter,
|
|
4519
4535
|
reducer: asBooleanByTokenAddressLowercase
|
|
4520
4536
|
});
|
|
4521
|
-
const combined =
|
|
4537
|
+
const combined = useInternalQueries({
|
|
4522
4538
|
queries: normalizedTokens.map((token) => {
|
|
4523
4539
|
const confidentialityType = token.extensions.fhenix.confidentialityType;
|
|
4524
4540
|
const queryKey = constructUnshieldClaimsQueryKey({
|
|
@@ -4599,7 +4615,7 @@ function useCofheTokensClaimable({ tokens, accountAddress: account }, queryOptio
|
|
|
4599
4615
|
}
|
|
4600
4616
|
|
|
4601
4617
|
// src/hooks/useCofheTokensWithExistingEncryptedBalances.ts
|
|
4602
|
-
var
|
|
4618
|
+
var import_react22 = require("react");
|
|
4603
4619
|
|
|
4604
4620
|
// src/hooks/useCofheReadContracts.ts
|
|
4605
4621
|
var import_react_query15 = require("@tanstack/react-query");
|
|
@@ -4619,8 +4635,8 @@ function constructCofheReadContractsQueryKey(params) {
|
|
|
4619
4635
|
return [QUERY_CACHE_PREFIX2, cofheChainId, serializedContracts, allowFailure, enabled];
|
|
4620
4636
|
}
|
|
4621
4637
|
function getEnabledForCofheReadContracts(params) {
|
|
4622
|
-
const {
|
|
4623
|
-
return
|
|
4638
|
+
const { publicClient, cofheChainId, contracts, userEnabled } = params;
|
|
4639
|
+
return !!publicClient && !!cofheChainId && !!contracts && contracts.length > 0 && (userEnabled ?? true);
|
|
4624
4640
|
}
|
|
4625
4641
|
function isViemAllowFailureResult(value) {
|
|
4626
4642
|
return !!value && typeof value === "object" && "status" in value;
|
|
@@ -4630,11 +4646,9 @@ function transformResultForContract(contract, value) {
|
|
|
4630
4646
|
}
|
|
4631
4647
|
function useCofheReadContracts(params, queryOptions) {
|
|
4632
4648
|
const { contracts, multicallOptions } = params;
|
|
4633
|
-
const isCofheErrorActive = useIsCofheErrorActive();
|
|
4634
4649
|
const publicClient = useCofhePublicClient();
|
|
4635
4650
|
const cofheChainId = useCofheChainId();
|
|
4636
4651
|
const enabled = getEnabledForCofheReadContracts({
|
|
4637
|
-
isCofheErrorActive,
|
|
4638
4652
|
publicClient,
|
|
4639
4653
|
cofheChainId,
|
|
4640
4654
|
contracts,
|
|
@@ -4646,9 +4660,7 @@ function useCofheReadContracts(params, queryOptions) {
|
|
|
4646
4660
|
queryKey: constructCofheReadContractsQueryKey({
|
|
4647
4661
|
cofheChainId,
|
|
4648
4662
|
contracts,
|
|
4649
|
-
allowFailure: multicallOptions?.allowFailure
|
|
4650
|
-
// Same rationale as in `useCofheReadContract`: guard against a blank screen when CofheError is active.
|
|
4651
|
-
enabled
|
|
4663
|
+
allowFailure: multicallOptions?.allowFailure
|
|
4652
4664
|
}),
|
|
4653
4665
|
queryFn: async () => {
|
|
4654
4666
|
(0, import_ts_essentials19.assert)(publicClient, "PublicClient should be guaranteed by enabled check");
|
|
@@ -4688,7 +4700,7 @@ function useCofheTokensWithExistingEncryptedBalances({ chainId: _chainId, accoun
|
|
|
4688
4700
|
const currentChainId = useCofheChainId();
|
|
4689
4701
|
const chainIdForTokens = _chainId ?? currentChainId;
|
|
4690
4702
|
const tokens = useCofheTokens(chainIdForTokens);
|
|
4691
|
-
const contracts = (0,
|
|
4703
|
+
const contracts = (0, import_react22.useMemo)(() => {
|
|
4692
4704
|
if (!account) return [];
|
|
4693
4705
|
return tokens.map((token) => {
|
|
4694
4706
|
const config = getTokenContractConfig(token.extensions.fhenix.confidentialityType);
|
|
@@ -4713,7 +4725,7 @@ function useCofheTokensWithExistingEncryptedBalances({ chainId: _chainId, accoun
|
|
|
4713
4725
|
enabled: (queryOptions?.enabled ?? true) && !!account && tokens.length > 0
|
|
4714
4726
|
}
|
|
4715
4727
|
);
|
|
4716
|
-
const { tokensWithExistingEncryptedBalance, ctHashByTokenAddress, error } = (0,
|
|
4728
|
+
const { tokensWithExistingEncryptedBalance, ctHashByTokenAddress, error } = (0, import_react22.useMemo)(() => {
|
|
4717
4729
|
const map = {};
|
|
4718
4730
|
const filtered = [];
|
|
4719
4731
|
const items = read.data;
|
|
@@ -4754,7 +4766,7 @@ function useCofheTokensWithExistingEncryptedBalances({ chainId: _chainId, accoun
|
|
|
4754
4766
|
}
|
|
4755
4767
|
|
|
4756
4768
|
// src/hooks/useTokensWithPublicBalances.ts
|
|
4757
|
-
var
|
|
4769
|
+
var import_react23 = require("react");
|
|
4758
4770
|
function useTokensWithPublicBalances({ chainId: _chainId, accountAddress, displayDecimals = 5 } = {}, options) {
|
|
4759
4771
|
const connectedAccount = useCofheAccount();
|
|
4760
4772
|
const account = accountAddress ?? connectedAccount;
|
|
@@ -4762,19 +4774,25 @@ function useTokensWithPublicBalances({ chainId: _chainId, accountAddress, displa
|
|
|
4762
4774
|
const chainIdForTokens = _chainId ?? currentChainId;
|
|
4763
4775
|
const publicClient = useCofhePublicClient();
|
|
4764
4776
|
const tokens = useCofheTokens(chainIdForTokens);
|
|
4765
|
-
const
|
|
4766
|
-
const
|
|
4777
|
+
const sources = (0, import_react23.useMemo)(() => {
|
|
4778
|
+
const bySourceAddress = /* @__PURE__ */ new Map();
|
|
4767
4779
|
for (const token of tokens) {
|
|
4768
4780
|
const source = getPublicTokenBalanceSource(token);
|
|
4769
4781
|
if (!source) continue;
|
|
4770
|
-
|
|
4782
|
+
const key = source.address.toLowerCase();
|
|
4783
|
+
const existing = bySourceAddress.get(key);
|
|
4784
|
+
if (existing) {
|
|
4785
|
+
existing.tokens.push(token);
|
|
4786
|
+
} else {
|
|
4787
|
+
bySourceAddress.set(key, { source, tokens: [token] });
|
|
4788
|
+
}
|
|
4771
4789
|
}
|
|
4772
|
-
return
|
|
4790
|
+
return Array.from(bySourceAddress.values());
|
|
4773
4791
|
}, [tokens]);
|
|
4774
4792
|
const { enabled: userEnabled = true, ...restOptions } = options ?? {};
|
|
4775
|
-
const enabled = userEnabled && !!publicClient && !!account &&
|
|
4776
|
-
const combined =
|
|
4777
|
-
queries:
|
|
4793
|
+
const enabled = userEnabled && !!publicClient && !!account && sources.length > 0;
|
|
4794
|
+
const combined = useInternalQueries({
|
|
4795
|
+
queries: sources.map(
|
|
4778
4796
|
({ source }) => createPublicTokenBalanceQueryOptions({
|
|
4779
4797
|
publicClient,
|
|
4780
4798
|
accountAddress: account,
|
|
@@ -4794,7 +4812,7 @@ function useTokensWithPublicBalances({ chainId: _chainId, accountAddress, displa
|
|
|
4794
4812
|
let error = null;
|
|
4795
4813
|
for (let index = 0; index < results.length; index++) {
|
|
4796
4814
|
const result = results[index];
|
|
4797
|
-
const entry =
|
|
4815
|
+
const entry = sources[index];
|
|
4798
4816
|
if (!result || !entry) continue;
|
|
4799
4817
|
isLoading = isLoading || result.isLoading;
|
|
4800
4818
|
isFetching = isFetching || result.isFetching;
|
|
@@ -4803,8 +4821,11 @@ function useTokensWithPublicBalances({ chainId: _chainId, accountAddress, displa
|
|
|
4803
4821
|
const wei = result.data;
|
|
4804
4822
|
if (typeof wei !== "bigint") continue;
|
|
4805
4823
|
if (wei <= 0n) continue;
|
|
4806
|
-
|
|
4807
|
-
|
|
4824
|
+
const formatted = formatTokenAmount(wei, entry.source.decimals, displayDecimals);
|
|
4825
|
+
for (const token of entry.tokens) {
|
|
4826
|
+
out.push(token);
|
|
4827
|
+
balanceMap[token.address.toLowerCase()] = formatted;
|
|
4828
|
+
}
|
|
4808
4829
|
}
|
|
4809
4830
|
return {
|
|
4810
4831
|
tokensWithPublicBalances: out,
|
|
@@ -4862,10 +4883,9 @@ function useCofheSimulateWriteContract(callArgs, queryOptions) {
|
|
|
4862
4883
|
const walletClient = useCofheWalletClient();
|
|
4863
4884
|
const publicClient = useCofhePublicClient();
|
|
4864
4885
|
const cofheChainId = useCofheChainId();
|
|
4865
|
-
const isCofheErrorActive = useIsCofheErrorActive();
|
|
4866
4886
|
const { enabled: userEnabled, ...restQueryOptions } = queryOptions || {};
|
|
4867
4887
|
const resolvedAccountAddress = getAccountAddress(callArgs?.account ?? walletClient?.account);
|
|
4868
|
-
const enabled =
|
|
4888
|
+
const enabled = !!publicClient && !!walletClient && !!callArgs && !!resolvedAccountAddress && (userEnabled ?? true);
|
|
4869
4889
|
return useInternalQuery({
|
|
4870
4890
|
enabled,
|
|
4871
4891
|
queryKey: constructCofheSimulateWriteContractQueryKey({
|
|
@@ -4895,10 +4915,10 @@ function useCofheSimulateWriteContract(callArgs, queryOptions) {
|
|
|
4895
4915
|
}
|
|
4896
4916
|
|
|
4897
4917
|
// src/hooks/permits/usePermitDuration.ts
|
|
4898
|
-
var
|
|
4918
|
+
var import_react24 = require("react");
|
|
4899
4919
|
function usePermitDuration(options) {
|
|
4900
4920
|
const { onDurationChange, initialSeconds = 7 * 24 * 60 * 60 } = options;
|
|
4901
|
-
const presets = (0,
|
|
4921
|
+
const presets = (0, import_react24.useMemo)(
|
|
4902
4922
|
() => [
|
|
4903
4923
|
{ label: "1 day", seconds: 1 * 24 * 60 * 60 },
|
|
4904
4924
|
{ label: "1 week", seconds: 7 * 24 * 60 * 60 },
|
|
@@ -4906,7 +4926,7 @@ function usePermitDuration(options) {
|
|
|
4906
4926
|
],
|
|
4907
4927
|
[]
|
|
4908
4928
|
);
|
|
4909
|
-
const unitSeconds = (0,
|
|
4929
|
+
const unitSeconds = (0, import_react24.useMemo)(
|
|
4910
4930
|
() => ({
|
|
4911
4931
|
hours: 60 * 60,
|
|
4912
4932
|
days: 24 * 60 * 60,
|
|
@@ -4915,17 +4935,17 @@ function usePermitDuration(options) {
|
|
|
4915
4935
|
}),
|
|
4916
4936
|
[]
|
|
4917
4937
|
);
|
|
4918
|
-
const [durationSeconds, setDurationSecondsState] = (0,
|
|
4919
|
-
const [customCount, setCustomCountState] = (0,
|
|
4920
|
-
const [customUnit, setCustomUnitState] = (0,
|
|
4921
|
-
const selectPreset = (0,
|
|
4938
|
+
const [durationSeconds, setDurationSecondsState] = (0, import_react24.useState)(initialSeconds);
|
|
4939
|
+
const [customCount, setCustomCountState] = (0, import_react24.useState)("");
|
|
4940
|
+
const [customUnit, setCustomUnitState] = (0, import_react24.useState)("days");
|
|
4941
|
+
const selectPreset = (0, import_react24.useCallback)(
|
|
4922
4942
|
(seconds) => {
|
|
4923
4943
|
setDurationSecondsState(seconds);
|
|
4924
4944
|
onDurationChange(seconds);
|
|
4925
4945
|
},
|
|
4926
4946
|
[onDurationChange]
|
|
4927
4947
|
);
|
|
4928
|
-
const applyCustom = (0,
|
|
4948
|
+
const applyCustom = (0, import_react24.useCallback)(
|
|
4929
4949
|
(count, unit) => {
|
|
4930
4950
|
setCustomCountState(count);
|
|
4931
4951
|
setCustomUnitState(unit);
|
|
@@ -4937,8 +4957,8 @@ function usePermitDuration(options) {
|
|
|
4937
4957
|
},
|
|
4938
4958
|
[unitSeconds, onDurationChange]
|
|
4939
4959
|
);
|
|
4940
|
-
const setCustomCount = (0,
|
|
4941
|
-
const setCustomUnit = (0,
|
|
4960
|
+
const setCustomCount = (0, import_react24.useCallback)((value) => applyCustom(value, customUnit), [applyCustom, customUnit]);
|
|
4961
|
+
const setCustomUnit = (0, import_react24.useCallback)((unit) => applyCustom(customCount, unit), [applyCustom, customCount]);
|
|
4942
4962
|
return {
|
|
4943
4963
|
durationSeconds,
|
|
4944
4964
|
customCount,
|
|
@@ -4954,7 +4974,7 @@ function usePermitDuration(options) {
|
|
|
4954
4974
|
}
|
|
4955
4975
|
|
|
4956
4976
|
// src/hooks/permits/usePermitForm.ts
|
|
4957
|
-
var
|
|
4977
|
+
var import_react25 = require("react");
|
|
4958
4978
|
|
|
4959
4979
|
// src/stores/portalPersisted.tsx
|
|
4960
4980
|
var import_zustand8 = require("zustand");
|
|
@@ -5007,33 +5027,33 @@ var useCofheCreatePermitMutation = ({ onSuccess, onError } = {}) => {
|
|
|
5007
5027
|
// src/hooks/permits/usePermitForm.ts
|
|
5008
5028
|
function usePermitForm(options = {}) {
|
|
5009
5029
|
const { onSuccess, onError, isDelegate = false } = options;
|
|
5010
|
-
const [permitName, setPermitName] = (0,
|
|
5011
|
-
const [receiver, setReceiver] = (0,
|
|
5012
|
-
const [error, setError] = (0,
|
|
5013
|
-
const [nameError, setNameError] = (0,
|
|
5014
|
-
const [receiverError, setReceiverError] = (0,
|
|
5015
|
-
const [durationSeconds, setDurationSeconds] = (0,
|
|
5030
|
+
const [permitName, setPermitName] = (0, import_react25.useState)("");
|
|
5031
|
+
const [receiver, setReceiver] = (0, import_react25.useState)("");
|
|
5032
|
+
const [error, setError] = (0, import_react25.useState)(null);
|
|
5033
|
+
const [nameError, setNameError] = (0, import_react25.useState)(null);
|
|
5034
|
+
const [receiverError, setReceiverError] = (0, import_react25.useState)(null);
|
|
5035
|
+
const [durationSeconds, setDurationSeconds] = (0, import_react25.useState)(7 * 24 * 60 * 60);
|
|
5016
5036
|
const { mutateAsync: createPermitMutateAsync, isPending: isPermitCreationPending } = useCofheCreatePermitMutation({
|
|
5017
5037
|
onSuccess,
|
|
5018
5038
|
onError
|
|
5019
5039
|
});
|
|
5020
5040
|
const recipientAddressValid = isDelegate ? isValidAddress(receiver) : true;
|
|
5021
5041
|
const isValid = !!permitName.trim() && recipientAddressValid;
|
|
5022
|
-
const handleNameChange = (0,
|
|
5042
|
+
const handleNameChange = (0, import_react25.useCallback)(
|
|
5023
5043
|
(e) => {
|
|
5024
5044
|
setPermitName(e.target.value);
|
|
5025
5045
|
if (nameError) setNameError(null);
|
|
5026
5046
|
},
|
|
5027
5047
|
[nameError]
|
|
5028
5048
|
);
|
|
5029
|
-
const handleReceiverChange = (0,
|
|
5049
|
+
const handleReceiverChange = (0, import_react25.useCallback)(
|
|
5030
5050
|
(e) => {
|
|
5031
5051
|
setReceiver(e.target.value);
|
|
5032
5052
|
if (receiverError) setReceiverError(null);
|
|
5033
5053
|
},
|
|
5034
5054
|
[receiverError]
|
|
5035
5055
|
);
|
|
5036
|
-
const handleSubmit = (0,
|
|
5056
|
+
const handleSubmit = (0, import_react25.useCallback)(async () => {
|
|
5037
5057
|
if (isPermitCreationPending) return;
|
|
5038
5058
|
const nameToUse = permitName.trim();
|
|
5039
5059
|
if (!nameToUse) {
|
|
@@ -5059,7 +5079,7 @@ function usePermitForm(options = {}) {
|
|
|
5059
5079
|
setError(e?.message ?? "Failed to create permit");
|
|
5060
5080
|
}
|
|
5061
5081
|
}, [isPermitCreationPending, permitName, isDelegate, receiver, durationSeconds, createPermitMutateAsync]);
|
|
5062
|
-
const reset = (0,
|
|
5082
|
+
const reset = (0, import_react25.useCallback)(() => {
|
|
5063
5083
|
setPermitName("");
|
|
5064
5084
|
setReceiver("");
|
|
5065
5085
|
setError(null);
|
|
@@ -5088,15 +5108,15 @@ function isValidAddress(address) {
|
|
|
5088
5108
|
}
|
|
5089
5109
|
|
|
5090
5110
|
// src/hooks/permits/usePermitsList.ts
|
|
5091
|
-
var
|
|
5111
|
+
var import_react27 = require("react");
|
|
5092
5112
|
var import_permits2 = require("@cofhe/sdk/permits");
|
|
5093
5113
|
|
|
5094
5114
|
// src/hooks/permits/useCofheNavigateToCreatePermit.tsx
|
|
5095
|
-
var
|
|
5115
|
+
var import_react26 = require("react");
|
|
5096
5116
|
var useCofheNavigateToCreatePermit = () => {
|
|
5097
5117
|
const { navigateTo, navigateBack } = usePortalNavigation();
|
|
5098
5118
|
const { portalOpen, openPortal } = usePortalUI();
|
|
5099
|
-
return (0,
|
|
5119
|
+
return (0, import_react26.useCallback)(
|
|
5100
5120
|
({ cause } = {}) => {
|
|
5101
5121
|
if (!portalOpen) openPortal();
|
|
5102
5122
|
navigateTo("generatePermit" /* GeneratePermits */, {
|
|
@@ -5114,20 +5134,20 @@ var usePermitsList = () => {
|
|
|
5114
5134
|
const activePermit = useCofheActivePermit();
|
|
5115
5135
|
const { navigateTo } = usePortalNavigation();
|
|
5116
5136
|
const { openModal } = usePortalModals();
|
|
5117
|
-
const activePermitHash = (0,
|
|
5137
|
+
const activePermitHash = (0, import_react27.useMemo)(() => {
|
|
5118
5138
|
return activePermit?.permit.hash;
|
|
5119
5139
|
}, [activePermit?.permit.hash]);
|
|
5120
|
-
const selfPermits = (0,
|
|
5140
|
+
const selfPermits = (0, import_react27.useMemo)(() => {
|
|
5121
5141
|
return allPermits.filter((permit) => permit.type === "self");
|
|
5122
5142
|
}, [allPermits]);
|
|
5123
|
-
const delegatedPermits = (0,
|
|
5143
|
+
const delegatedPermits = (0, import_react27.useMemo)(() => {
|
|
5124
5144
|
return allPermits.filter((permit) => permit.type === "sharing");
|
|
5125
5145
|
}, [allPermits]);
|
|
5126
|
-
const importedPermits = (0,
|
|
5146
|
+
const importedPermits = (0, import_react27.useMemo)(() => {
|
|
5127
5147
|
return allPermits.filter((permit) => permit.type === "recipient");
|
|
5128
5148
|
}, [allPermits]);
|
|
5129
5149
|
const navigateToGeneratePermit = useCofheNavigateToCreatePermit();
|
|
5130
|
-
const handlePermitAction = (0,
|
|
5150
|
+
const handlePermitAction = (0, import_react27.useCallback)(
|
|
5131
5151
|
(actionId) => {
|
|
5132
5152
|
if (actionId === "generate") {
|
|
5133
5153
|
navigateToGeneratePermit();
|
|
@@ -5143,7 +5163,7 @@ var usePermitsList = () => {
|
|
|
5143
5163
|
},
|
|
5144
5164
|
[navigateTo, navigateToGeneratePermit]
|
|
5145
5165
|
);
|
|
5146
|
-
const handleOpenPermit = (0,
|
|
5166
|
+
const handleOpenPermit = (0, import_react27.useCallback)(
|
|
5147
5167
|
(hash) => {
|
|
5148
5168
|
openModal("permitDetails" /* PermitDetails */, { hash });
|
|
5149
5169
|
},
|
|
@@ -5160,17 +5180,17 @@ var usePermitsList = () => {
|
|
|
5160
5180
|
};
|
|
5161
5181
|
|
|
5162
5182
|
// src/hooks/permits/useReceivePermit.ts
|
|
5163
|
-
var
|
|
5183
|
+
var import_react28 = require("react");
|
|
5164
5184
|
var import_permits3 = require("@cofhe/sdk/permits");
|
|
5165
5185
|
function useReceivePermit({ onSuccess, onError } = {}) {
|
|
5166
5186
|
const { client } = useCofheContext();
|
|
5167
|
-
const [importedPermit, setImportedPermit] = (0,
|
|
5168
|
-
const [permitData, setPermitData] = (0,
|
|
5169
|
-
const [permitName, setPermitName] = (0,
|
|
5170
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
5171
|
-
const [errorMsg, setErrorMsg] = (0,
|
|
5172
|
-
const [successMsg, setSuccessMsg] = (0,
|
|
5173
|
-
const submit = (0,
|
|
5187
|
+
const [importedPermit, setImportedPermit] = (0, import_react28.useState)(null);
|
|
5188
|
+
const [permitData, setPermitData] = (0, import_react28.useState)("");
|
|
5189
|
+
const [permitName, setPermitName] = (0, import_react28.useState)("");
|
|
5190
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react28.useState)(false);
|
|
5191
|
+
const [errorMsg, setErrorMsg] = (0, import_react28.useState)(null);
|
|
5192
|
+
const [successMsg, setSuccessMsg] = (0, import_react28.useState)(null);
|
|
5193
|
+
const submit = (0, import_react28.useCallback)(async () => {
|
|
5174
5194
|
setErrorMsg(null);
|
|
5175
5195
|
setSuccessMsg(null);
|
|
5176
5196
|
if (!permitData.trim()) {
|
|
@@ -5201,7 +5221,7 @@ function useReceivePermit({ onSuccess, onError } = {}) {
|
|
|
5201
5221
|
setIsSubmitting(false);
|
|
5202
5222
|
}
|
|
5203
5223
|
}, [client, permitData, permitName, onSuccess, onError]);
|
|
5204
|
-
const handleSetPermitData = (0,
|
|
5224
|
+
const handleSetPermitData = (0, import_react28.useCallback)((v) => {
|
|
5205
5225
|
setPermitData(v);
|
|
5206
5226
|
try {
|
|
5207
5227
|
const permit = import_permits3.PermitUtils.importShared(v);
|
|
@@ -5227,17 +5247,17 @@ function useReceivePermit({ onSuccess, onError } = {}) {
|
|
|
5227
5247
|
}
|
|
5228
5248
|
|
|
5229
5249
|
// src/hooks/permits/usePermitDetailsAndActions.ts
|
|
5230
|
-
var
|
|
5250
|
+
var import_react30 = require("react");
|
|
5231
5251
|
var import_viem19 = require("viem");
|
|
5232
5252
|
var import_permits4 = require("@cofhe/sdk/permits");
|
|
5233
5253
|
|
|
5234
5254
|
// src/hooks/useCopyFeedback.ts
|
|
5235
|
-
var
|
|
5255
|
+
var import_react29 = require("react");
|
|
5236
5256
|
function useCopyFeedback(defaultDurationMs = 2e3) {
|
|
5237
|
-
const [copiedKeys, setCopiedKeys] = (0,
|
|
5238
|
-
const timersRef = (0,
|
|
5239
|
-
const isCopied = (0,
|
|
5240
|
-
const clearTimer = (0,
|
|
5257
|
+
const [copiedKeys, setCopiedKeys] = (0, import_react29.useState)(/* @__PURE__ */ new Set());
|
|
5258
|
+
const timersRef = (0, import_react29.useRef)(/* @__PURE__ */ new Map());
|
|
5259
|
+
const isCopied = (0, import_react29.useCallback)((key) => copiedKeys.has(key), [copiedKeys]);
|
|
5260
|
+
const clearTimer = (0, import_react29.useCallback)((key) => {
|
|
5241
5261
|
const timers = timersRef.current;
|
|
5242
5262
|
const existing = timers.get(key);
|
|
5243
5263
|
if (existing) {
|
|
@@ -5245,7 +5265,7 @@ function useCopyFeedback(defaultDurationMs = 2e3) {
|
|
|
5245
5265
|
timers.delete(key);
|
|
5246
5266
|
}
|
|
5247
5267
|
}, []);
|
|
5248
|
-
const copyWithFeedback = (0,
|
|
5268
|
+
const copyWithFeedback = (0, import_react29.useCallback)(
|
|
5249
5269
|
async (key, text, durationMs) => {
|
|
5250
5270
|
try {
|
|
5251
5271
|
await navigator.clipboard.writeText(text);
|
|
@@ -5271,7 +5291,7 @@ function useCopyFeedback(defaultDurationMs = 2e3) {
|
|
|
5271
5291
|
},
|
|
5272
5292
|
[clearTimer, defaultDurationMs]
|
|
5273
5293
|
);
|
|
5274
|
-
(0,
|
|
5294
|
+
(0, import_react29.useEffect)(() => {
|
|
5275
5295
|
return () => {
|
|
5276
5296
|
for (const id of timersRef.current.values()) {
|
|
5277
5297
|
window.clearTimeout(id);
|
|
@@ -5323,21 +5343,21 @@ var usePermitDetailsAndActions = (permitHash) => {
|
|
|
5323
5343
|
const isActivePermit = permit != null && activePermit?.permit.hash === permitHash;
|
|
5324
5344
|
const expirationDate = permit != null ? new Date(permit.expiration * 1e3).toLocaleString() : void 0;
|
|
5325
5345
|
const isShareablePermit = permit?.type === "sharing";
|
|
5326
|
-
const permitLabel = (0,
|
|
5346
|
+
const permitLabel = (0, import_react30.useMemo)(() => {
|
|
5327
5347
|
if (!permit) return void 0;
|
|
5328
5348
|
if (permit.name?.trim()) return permit.name;
|
|
5329
5349
|
const fallbackAddress = permit.recipient && permit.recipient !== import_viem19.zeroAddress ? permit.recipient : permit.issuer || import_viem19.zeroAddress;
|
|
5330
5350
|
return truncateAddress(fallbackAddress, 4, 4) ?? fallbackAddress;
|
|
5331
5351
|
}, [permit]);
|
|
5332
|
-
const expirationInfo = (0,
|
|
5333
|
-
const permitJson = (0,
|
|
5352
|
+
const expirationInfo = (0, import_react30.useMemo)(() => formatExpirationLabel(permit?.expiration), [permit?.expiration]);
|
|
5353
|
+
const permitJson = (0, import_react30.useMemo)(() => {
|
|
5334
5354
|
if (!permit) return void 0;
|
|
5335
5355
|
return import_permits4.PermitUtils.export(permit);
|
|
5336
5356
|
}, [permit]);
|
|
5337
|
-
const handleBack = (0,
|
|
5357
|
+
const handleBack = (0, import_react30.useCallback)(() => {
|
|
5338
5358
|
navigateBack();
|
|
5339
5359
|
}, [navigateBack]);
|
|
5340
|
-
const handleCopySharablePermitData = (0,
|
|
5360
|
+
const handleCopySharablePermitData = (0, import_react30.useCallback)(() => {
|
|
5341
5361
|
if (!permitJson) return;
|
|
5342
5362
|
copyWithFeedback(COPY_KEY, permitJson);
|
|
5343
5363
|
addToast({
|
|
@@ -5346,10 +5366,10 @@ var usePermitDetailsAndActions = (permitHash) => {
|
|
|
5346
5366
|
description: "Share copied data with recipient."
|
|
5347
5367
|
});
|
|
5348
5368
|
}, [copyWithFeedback, permitJson, addToast]);
|
|
5349
|
-
const handleSelectActivePermit = (0,
|
|
5369
|
+
const handleSelectActivePermit = (0, import_react30.useCallback)(() => {
|
|
5350
5370
|
selectActivePermit(permitHash);
|
|
5351
5371
|
}, [selectActivePermit, permitHash]);
|
|
5352
|
-
const handleRemovePermit = (0,
|
|
5372
|
+
const handleRemovePermit = (0, import_react30.useCallback)(() => {
|
|
5353
5373
|
removePermit(permitHash);
|
|
5354
5374
|
}, [removePermit, permitHash]);
|
|
5355
5375
|
return {
|
|
@@ -5370,7 +5390,7 @@ var usePermitDetailsAndActions = (permitHash) => {
|
|
|
5370
5390
|
};
|
|
5371
5391
|
|
|
5372
5392
|
// src/hooks/useCofheAutoConnect.ts
|
|
5373
|
-
var
|
|
5393
|
+
var import_react32 = require("react");
|
|
5374
5394
|
|
|
5375
5395
|
// src/providers/internalQueryHooks.ts
|
|
5376
5396
|
var import_react_query17 = require("@tanstack/react-query");
|
|
@@ -5379,7 +5399,7 @@ var import_react_query17 = require("@tanstack/react-query");
|
|
|
5379
5399
|
var import_react_query16 = require("@tanstack/react-query");
|
|
5380
5400
|
var import_react_query_persist_client = require("@tanstack/react-query-persist-client");
|
|
5381
5401
|
var import_query_async_storage_persister = require("@tanstack/query-async-storage-persister");
|
|
5382
|
-
var
|
|
5402
|
+
var import_react31 = require("react");
|
|
5383
5403
|
var import_web = require("@cofhe/sdk/web");
|
|
5384
5404
|
function isPersistedQuery(options) {
|
|
5385
5405
|
const meta = options.meta;
|
|
@@ -5434,7 +5454,7 @@ function useInternalMutation(options) {
|
|
|
5434
5454
|
const qc = useInternalQueryClient();
|
|
5435
5455
|
return (0, import_react_query17.useMutation)(options, qc);
|
|
5436
5456
|
}
|
|
5437
|
-
var
|
|
5457
|
+
var useInternalQueries = (options, _ignoredQueryClient) => {
|
|
5438
5458
|
const qc = useInternalQueryClient();
|
|
5439
5459
|
if (options && typeof options === "object" && "queries" in options) {
|
|
5440
5460
|
const typedOptions = options;
|
|
@@ -5466,15 +5486,15 @@ var useCofheConnect = (options) => {
|
|
|
5466
5486
|
var useCofheAutoConnect = ({ walletClient, publicClient }) => {
|
|
5467
5487
|
const client = useCofheClient();
|
|
5468
5488
|
const connectMutationFn = useCofheConnect().mutate;
|
|
5469
|
-
const supportedChainIds = (0,
|
|
5489
|
+
const supportedChainIds = (0, import_react32.useMemo)(() => {
|
|
5470
5490
|
return new Set(client.config.supportedChains.map((chain) => chain.id));
|
|
5471
5491
|
}, [client.config.supportedChains]);
|
|
5472
|
-
const disconnectIfConnected = (0,
|
|
5492
|
+
const disconnectIfConnected = (0, import_react32.useCallback)(() => {
|
|
5473
5493
|
if (client.connected || client.connecting) {
|
|
5474
5494
|
client.disconnect();
|
|
5475
5495
|
}
|
|
5476
5496
|
}, [client]);
|
|
5477
|
-
(0,
|
|
5497
|
+
(0, import_react32.useEffect)(() => {
|
|
5478
5498
|
if (!publicClient || !walletClient) {
|
|
5479
5499
|
disconnectIfConnected();
|
|
5480
5500
|
return;
|
|
@@ -5490,10 +5510,10 @@ var useCofheAutoConnect = ({ walletClient, publicClient }) => {
|
|
|
5490
5510
|
};
|
|
5491
5511
|
|
|
5492
5512
|
// src/hooks/useReschedulableTimeout.ts
|
|
5493
|
-
var
|
|
5513
|
+
var import_react33 = require("react");
|
|
5494
5514
|
function useReschedulableTimeout(callback, defaultTimeout) {
|
|
5495
|
-
const timerRef = (0,
|
|
5496
|
-
(0,
|
|
5515
|
+
const timerRef = (0, import_react33.useRef)(null);
|
|
5516
|
+
(0, import_react33.useEffect)(() => {
|
|
5497
5517
|
return () => {
|
|
5498
5518
|
if (timerRef.current) {
|
|
5499
5519
|
clearTimeout(timerRef.current);
|
|
@@ -5707,7 +5727,7 @@ function useCoingeckoContractMarketChartRange({
|
|
|
5707
5727
|
|
|
5708
5728
|
// src/hooks/useWatchPermitStatus.ts
|
|
5709
5729
|
var import_permits5 = require("@cofhe/sdk/permits");
|
|
5710
|
-
var
|
|
5730
|
+
var import_react34 = require("react");
|
|
5711
5731
|
var STATUS_ID_MISSING_PERMIT = "missing-permit";
|
|
5712
5732
|
var STATUS_ID_PERMIT_EXPIRED = "permit-expired";
|
|
5713
5733
|
var STATUS_ID_PERMIT_EXPIRING_SOON = "permit-expiring-soon";
|
|
@@ -5778,10 +5798,10 @@ var hidePermitSharedStatus = () => {
|
|
|
5778
5798
|
usePortalStatuses.getState().removeStatus(STATUS_ID_PERMIT_SHARED);
|
|
5779
5799
|
};
|
|
5780
5800
|
var useWatchPermitStatus = () => {
|
|
5781
|
-
const intervalRef = (0,
|
|
5801
|
+
const intervalRef = (0, import_react34.useRef)(null);
|
|
5782
5802
|
const activePermit = useCofheActivePermit();
|
|
5783
5803
|
const connected = useCofheIsConnected();
|
|
5784
|
-
(0,
|
|
5804
|
+
(0, import_react34.useEffect)(() => {
|
|
5785
5805
|
const updateStatuses = (permit) => {
|
|
5786
5806
|
const hasCreatedFirstPermit = usePortalPersisted.getState().hasCreatedFirstPermit;
|
|
5787
5807
|
const missingPermitStatusShown = usePortalStatuses.getState().hasStatus(STATUS_ID_MISSING_PERMIT);
|
|
@@ -5843,7 +5863,7 @@ var useWatchPermitStatus = () => {
|
|
|
5843
5863
|
};
|
|
5844
5864
|
|
|
5845
5865
|
// src/hooks/useWatchClaimablesStatus.ts
|
|
5846
|
-
var
|
|
5866
|
+
var import_react35 = require("react");
|
|
5847
5867
|
|
|
5848
5868
|
// src/hooks/useCofheClaimableTokens.ts
|
|
5849
5869
|
function useCofheClaimableTokens() {
|
|
@@ -5879,7 +5899,7 @@ var useWatchClaimablesStatus = () => {
|
|
|
5879
5899
|
const { totalTokensClaimable } = useCofheClaimableTokens();
|
|
5880
5900
|
const { navigateTo } = usePortalNavigation();
|
|
5881
5901
|
const { openPortal } = usePortalUI();
|
|
5882
|
-
(0,
|
|
5902
|
+
(0, import_react35.useEffect)(() => {
|
|
5883
5903
|
const claimsAvailableStatusShown = usePortalStatuses.getState().hasStatus(CLAIMS_AVAILABLE_STATUS_ID);
|
|
5884
5904
|
if (totalTokensClaimable > 0 && !claimsAvailableStatusShown) {
|
|
5885
5905
|
showClaimsAvailableStatus({
|
|
@@ -5897,7 +5917,7 @@ var useWatchClaimablesStatus = () => {
|
|
|
5897
5917
|
|
|
5898
5918
|
// src/components/FnxFloatingButton/FnxFloatingButtonContext.tsx
|
|
5899
5919
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
5900
|
-
var FnxFloatingButtonContext = (0,
|
|
5920
|
+
var FnxFloatingButtonContext = (0, import_react36.createContext)(null);
|
|
5901
5921
|
var FnxFloatingButtonProvider = ({ children }) => {
|
|
5902
5922
|
const { state } = useCofheContext();
|
|
5903
5923
|
const theme = state.theme;
|
|
@@ -5922,7 +5942,7 @@ var FnxFloatingButtonProvider = ({ children }) => {
|
|
|
5922
5942
|
);
|
|
5923
5943
|
};
|
|
5924
5944
|
var useFnxFloatingButtonContext = () => {
|
|
5925
|
-
const context = (0,
|
|
5945
|
+
const context = (0, import_react36.useContext)(FnxFloatingButtonContext);
|
|
5926
5946
|
if (!context) {
|
|
5927
5947
|
throw new Error("useFnxFloatingButtonContext must be used within FnxFloatingButtonProvider");
|
|
5928
5948
|
}
|
|
@@ -5980,15 +6000,15 @@ var FloatingButtonComponent = ({ onClick }) => {
|
|
|
5980
6000
|
};
|
|
5981
6001
|
|
|
5982
6002
|
// src/components/FnxFloatingButton/StatusBarSection.tsx
|
|
5983
|
-
var
|
|
5984
|
-
var
|
|
6003
|
+
var import_react37 = require("react");
|
|
6004
|
+
var import_react38 = require("motion/react");
|
|
5985
6005
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5986
6006
|
var StatusBarSection = ({ children }) => {
|
|
5987
6007
|
const { isLeftSide } = useFnxFloatingButtonContext();
|
|
5988
6008
|
const { statuses } = usePortalStatuses();
|
|
5989
6009
|
const { statusPanelOpen } = usePortalUI();
|
|
5990
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5991
|
-
|
|
6010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react38.AnimatePresence, { children: (statusPanelOpen || statuses.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6011
|
+
import_react38.motion.div,
|
|
5992
6012
|
{
|
|
5993
6013
|
className: "relative flex flex-1 h-12 items-center justify-between",
|
|
5994
6014
|
initial: { opacity: 0, x: isLeftSide ? -10 : 10 },
|
|
@@ -6002,11 +6022,11 @@ var StatusBarSection = ({ children }) => {
|
|
|
6002
6022
|
// src/components/FnxFloatingButton/StatusBarContent.tsx
|
|
6003
6023
|
var import_md = require("react-icons/md");
|
|
6004
6024
|
var import_io = require("react-icons/io");
|
|
6005
|
-
var
|
|
6025
|
+
var import_react41 = require("react");
|
|
6006
6026
|
|
|
6007
6027
|
// src/components/primitives/AnimatedZStack.tsx
|
|
6008
|
-
var
|
|
6009
|
-
var
|
|
6028
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
6029
|
+
var import_react40 = require("motion/react");
|
|
6010
6030
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6011
6031
|
var AnimatedZStackItem = ({
|
|
6012
6032
|
children,
|
|
@@ -6032,7 +6052,7 @@ var AnimatedZStackItem = ({
|
|
|
6032
6052
|
zIndex: index
|
|
6033
6053
|
};
|
|
6034
6054
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6035
|
-
|
|
6055
|
+
import_react40.motion.div,
|
|
6036
6056
|
{
|
|
6037
6057
|
className: cn("w-full h-full absolute origin-top", invIndex === 0 && "events-none", className),
|
|
6038
6058
|
initial: entryStyle,
|
|
@@ -6048,8 +6068,8 @@ var AnimatedZStack = ({
|
|
|
6048
6068
|
stackScale = 0.05,
|
|
6049
6069
|
itemClassName
|
|
6050
6070
|
}) => {
|
|
6051
|
-
const filteredChildren =
|
|
6052
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6071
|
+
const filteredChildren = import_react39.default.Children.toArray(children).filter(Boolean);
|
|
6072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react40.AnimatePresence, { children: filteredChildren.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6053
6073
|
AnimatedZStackItem,
|
|
6054
6074
|
{
|
|
6055
6075
|
stackOffset,
|
|
@@ -6153,7 +6173,7 @@ function sortStatuses(a, b) {
|
|
|
6153
6173
|
}
|
|
6154
6174
|
var StatusBarContent = () => {
|
|
6155
6175
|
const { statuses } = usePortalStatuses();
|
|
6156
|
-
const sortedStatuses = (0,
|
|
6176
|
+
const sortedStatuses = (0, import_react41.useMemo)(() => statuses.sort(sortStatuses), [statuses]);
|
|
6157
6177
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(AnimatedZStack, { children: [
|
|
6158
6178
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ConnectionStatus, {}),
|
|
6159
6179
|
sortedStatuses.map((status) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ActiveStatusContent, { status }, status.id))
|
|
@@ -6161,17 +6181,17 @@ var StatusBarContent = () => {
|
|
|
6161
6181
|
};
|
|
6162
6182
|
|
|
6163
6183
|
// src/components/FnxFloatingButton/ContentSection.tsx
|
|
6164
|
-
var
|
|
6184
|
+
var import_react59 = require("react");
|
|
6165
6185
|
|
|
6166
6186
|
// src/components/FnxFloatingButton/pages/MainPage/WalletHeader.tsx
|
|
6167
6187
|
var import_md3 = require("react-icons/md");
|
|
6168
6188
|
|
|
6169
6189
|
// src/components/FnxFloatingButton/components/AddressButton.tsx
|
|
6170
|
-
var
|
|
6190
|
+
var import_react42 = require("react");
|
|
6171
6191
|
var import_md2 = require("react-icons/md");
|
|
6172
6192
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6173
6193
|
var AddressButton = ({ address, className, icon, showCopyIcon = true }) => {
|
|
6174
|
-
const [copied, setCopied] = (0,
|
|
6194
|
+
const [copied, setCopied] = (0, import_react42.useState)(false);
|
|
6175
6195
|
const handleCopyAddress = async () => {
|
|
6176
6196
|
if (!address) return;
|
|
6177
6197
|
try {
|
|
@@ -6273,7 +6293,7 @@ var WalletHeader = () => {
|
|
|
6273
6293
|
var import_KeyboardArrowRight = __toESM(require("@mui/icons-material/KeyboardArrowRight"), 1);
|
|
6274
6294
|
|
|
6275
6295
|
// src/components/FnxFloatingButton/components/TokenIcon.tsx
|
|
6276
|
-
var
|
|
6296
|
+
var import_react43 = require("react");
|
|
6277
6297
|
|
|
6278
6298
|
// src/assets/default-token.webp
|
|
6279
6299
|
var default_token_default = "data:image/webp;base64,UklGRrADAABXRUJQVlA4WAoAAAAQAAAAPwAAPwAAVlA4TDsDAAAvP8APEAelqJEkpfzLPf4xWCCQtLF/5p0zbtvIEftvdHPeve8xbts2kPYft6/2TrbVtm3DIFtn3gD9/9o+ao+6R92j9ii71C5lh9wmb5ObpCZpjVAhFMC+gWDo6vtrUGSD0C3AIESRYxOGwIuFh6In9xAhS7EhC3xaIYIDUQz/1pyv4S7Scs0Dz9fgkccgQQAYQ5KS9WgnPVrbtm3bNs62bQ9P3X/tmZ5UzQci+j8BwKx6X1xfHW4uyHC5Mgqah1dvvPCpIK/me7jVV+wmw57ige2HPk2O/x9O+7OJNbv//JMqTvu4W+sgdkfjwWdNkP9ys0JCldarARHqi1E3CfdMvNLY/t6sJClrbv9l8m9nk6Q5u0GW73NOkta9/Ivh27SDJHbM/orKP6eQ1I6VYBR/t50kuXvvn7Gb2SR97h1Dz6soButfG/CPUUxOhiJddjPZTUmoTzExpd2I8LGFWO3JaDSFhdq/hNH2iNUWh8YTUjmUozAfG1hscRhtvJ2BWr/oThWWBNQnW4nIkqTDRA7HJQDw9ROnGRExzkrhLTo0M9BQCOBhNku8zkaRLbpEjvwnANvEaUNETCajyYiIdgbaB98Ai0lnM2TTWTmGgi9KWJIRMYGMs5W/ueFhIYspMTmKOK70u6skpx0RMZWDtoYlMSFiPLFONMthQ0Q08XQUSGGLQ8R4O09phgzWOEREK/HmuSSwoN5MzOkSmFFvJu7MDGEm1JuJPa9AlA31VuIvbRYVr7OSwI5hQWZERDOJnFgVlISICSR087pbTDwimoSk33leIgYR0SKk7I23T5xVyFAQtsTZhOwBPMgWIjz3EcCv3lga9APASQwpFwAA3tfFTvNnnbYrIBkRMVXAIYR93xQrbZ/DwQVXbHiuQ0TvSGyMByLB03IusTUvwaB2LVO+nFtg+M+6UzbXzj9j4J1R5HIsBCHar1OKTI7pHxD91xmnPM7578DpXc+UJXvbD7y/r5TJUXHzL3CrT4dd4tyjz1UQ6D2rU8QojRd9IFZ9t1Wt8Ck1ux80EP7/7WFnBk9W1/H7/yCl9uPeWnehy5i7qGfj/k8N5FV/PL602F+d6yJy5VYPLF159lMFZgBQU0FJTgAAADhCSU0D7QAAAAAAEABIAAAAAQACAEgAAAABAAI4QklNBCgAAAAAAAwAAAACP/AAAAAAAAA4QklNBEMAAAAAAA1QYmVXARAABQEAAAAAAA==";
|
|
@@ -6293,8 +6313,8 @@ var TokenIcon = ({
|
|
|
6293
6313
|
className,
|
|
6294
6314
|
imageClassName = "w-full h-full object-cover"
|
|
6295
6315
|
}) => {
|
|
6296
|
-
const [iconError, setIconError] = (0,
|
|
6297
|
-
(0,
|
|
6316
|
+
const [iconError, setIconError] = (0, import_react43.useState)(false);
|
|
6317
|
+
(0, import_react43.useEffect)(() => {
|
|
6298
6318
|
setIconError(false);
|
|
6299
6319
|
}, [logoURI]);
|
|
6300
6320
|
const containerClassName = className || cn(sizeClasses[size], "rounded-full fnx-icon-bg flex items-center justify-center flex-shrink-0 overflow-hidden");
|
|
@@ -6390,7 +6410,7 @@ var CofheTokenConfidentialBalance = ({
|
|
|
6390
6410
|
const {
|
|
6391
6411
|
data: { formatted: confidentialBalanceFormatted } = {},
|
|
6392
6412
|
isFetching: isFetchingConfidential,
|
|
6393
|
-
|
|
6413
|
+
disabledDueToMissingValidPermit
|
|
6394
6414
|
} = useCofheTokenDecryptedBalance({
|
|
6395
6415
|
token,
|
|
6396
6416
|
accountAddress: effectiveAccountAddress,
|
|
@@ -6401,7 +6421,7 @@ var CofheTokenConfidentialBalance = ({
|
|
|
6401
6421
|
{
|
|
6402
6422
|
className,
|
|
6403
6423
|
size,
|
|
6404
|
-
hidden:
|
|
6424
|
+
hidden: disabledDueToMissingValidPermit,
|
|
6405
6425
|
isFetching: isFetchingConfidential,
|
|
6406
6426
|
formattedBalance: confidentialBalanceFormatted,
|
|
6407
6427
|
symbol: showSymbol ? token?.symbol : void 0
|
|
@@ -6674,7 +6694,7 @@ var Button = ({
|
|
|
6674
6694
|
};
|
|
6675
6695
|
|
|
6676
6696
|
// src/components/FnxFloatingButton/components/TokenPriceChart.tsx
|
|
6677
|
-
var
|
|
6697
|
+
var import_react44 = require("react");
|
|
6678
6698
|
var import_recharts = require("recharts");
|
|
6679
6699
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6680
6700
|
var formatTime = (ts) => new Date(ts).toLocaleTimeString(void 0, {
|
|
@@ -6705,8 +6725,8 @@ var themeClasses = {
|
|
|
6705
6725
|
tooltipCursor: "[&_.recharts-tooltip-cursor]:stroke-current [&_.recharts-tooltip-cursor]:stroke-opacity-35 dark:[&_.recharts-tooltip-cursor]:stroke-opacity-45"
|
|
6706
6726
|
};
|
|
6707
6727
|
var TokenPriceChart = ({ points, className, height = 150 }) => {
|
|
6708
|
-
const gradientId = (0,
|
|
6709
|
-
const { start, mid, end } = (0,
|
|
6728
|
+
const gradientId = (0, import_react44.useId)();
|
|
6729
|
+
const { start, mid, end } = (0, import_react44.useMemo)(() => {
|
|
6710
6730
|
if (!points.length) {
|
|
6711
6731
|
const now = Date.now();
|
|
6712
6732
|
return { start: now - 24 * 36e5, mid: now - 12 * 36e5, end: now };
|
|
@@ -6762,7 +6782,7 @@ var TokenPriceChart = ({ points, className, height = 150 }) => {
|
|
|
6762
6782
|
};
|
|
6763
6783
|
|
|
6764
6784
|
// src/components/FnxFloatingButton/components/PageContainer.tsx
|
|
6765
|
-
var
|
|
6785
|
+
var import_react45 = require("react");
|
|
6766
6786
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
6767
6787
|
var PageContainer = ({ isModal, header, content, footer }) => {
|
|
6768
6788
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cn("flex flex-col max-h-[500px] w-full gap-4", isModal ? "" : "h-full"), children: [
|
|
@@ -6994,22 +7014,22 @@ var SettingsPage = () => {
|
|
|
6994
7014
|
// src/components/FnxFloatingButton/pages/permits/PermitsListPage/index.tsx
|
|
6995
7015
|
var import_ArrowBack2 = __toESM(require("@mui/icons-material/ArrowBack"), 1);
|
|
6996
7016
|
var import_fa2 = require("react-icons/fa");
|
|
6997
|
-
var
|
|
7017
|
+
var import_react49 = require("react");
|
|
6998
7018
|
|
|
6999
7019
|
// src/components/FnxFloatingButton/Accordion.tsx
|
|
7000
|
-
var
|
|
7020
|
+
var import_react46 = require("react");
|
|
7001
7021
|
var import_fa6 = require("react-icons/fa6");
|
|
7002
7022
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7003
|
-
var AccordionContext = (0,
|
|
7023
|
+
var AccordionContext = (0, import_react46.createContext)(void 0);
|
|
7004
7024
|
var Accordion = ({ children, defaultActiveId = null }) => {
|
|
7005
|
-
const [activeId, setActiveId] = (0,
|
|
7006
|
-
const handleToggle = (0,
|
|
7025
|
+
const [activeId, setActiveId] = (0, import_react46.useState)(defaultActiveId);
|
|
7026
|
+
const handleToggle = (0, import_react46.useCallback)(
|
|
7007
7027
|
(id) => {
|
|
7008
7028
|
setActiveId(activeId === id ? null : id);
|
|
7009
7029
|
},
|
|
7010
7030
|
[activeId]
|
|
7011
7031
|
);
|
|
7012
|
-
const contextValue = (0,
|
|
7032
|
+
const contextValue = (0, import_react46.useMemo)(
|
|
7013
7033
|
() => ({
|
|
7014
7034
|
activeId,
|
|
7015
7035
|
toggle: handleToggle
|
|
@@ -7019,7 +7039,7 @@ var Accordion = ({ children, defaultActiveId = null }) => {
|
|
|
7019
7039
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionContext.Provider, { value: contextValue, children });
|
|
7020
7040
|
};
|
|
7021
7041
|
var useAccordionContext = () => {
|
|
7022
|
-
const context = (0,
|
|
7042
|
+
const context = (0, import_react46.useContext)(AccordionContext);
|
|
7023
7043
|
if (!context) {
|
|
7024
7044
|
throw new Error("Accordion components must be used within an Accordion");
|
|
7025
7045
|
}
|
|
@@ -7028,6 +7048,7 @@ var useAccordionContext = () => {
|
|
|
7028
7048
|
var AccordionSection = ({
|
|
7029
7049
|
id,
|
|
7030
7050
|
renderHeader,
|
|
7051
|
+
accessory,
|
|
7031
7052
|
children,
|
|
7032
7053
|
sectionClassName,
|
|
7033
7054
|
triggerClassName,
|
|
@@ -7036,20 +7057,23 @@ var AccordionSection = ({
|
|
|
7036
7057
|
const { activeId, toggle } = useAccordionContext();
|
|
7037
7058
|
const isOpen = activeId === id;
|
|
7038
7059
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("section", { className: sectionClassName, children: [
|
|
7039
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7060
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7061
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
7062
|
+
Button,
|
|
7063
|
+
{
|
|
7064
|
+
variant: "ghost",
|
|
7065
|
+
className: cn("!justify-start flex-1 text-md py-2", triggerClassName),
|
|
7066
|
+
"aria-expanded": isOpen,
|
|
7067
|
+
onClick: () => toggle(id),
|
|
7068
|
+
children: [
|
|
7069
|
+
renderHeader(isOpen),
|
|
7070
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "flex flex-1" }),
|
|
7071
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_fa6.FaChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_fa6.FaChevronDown, {})
|
|
7072
|
+
]
|
|
7073
|
+
}
|
|
7074
|
+
),
|
|
7075
|
+
accessory ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "shrink-0", children: accessory }) : null
|
|
7076
|
+
] }),
|
|
7053
7077
|
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("relative", contentClassName), children: [
|
|
7054
7078
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7055
7079
|
"span",
|
|
@@ -7125,7 +7149,7 @@ var import_viem21 = require("viem");
|
|
|
7125
7149
|
var import_permits7 = require("@cofhe/sdk/permits");
|
|
7126
7150
|
|
|
7127
7151
|
// src/components/StripedBackground.tsx
|
|
7128
|
-
var
|
|
7152
|
+
var import_react47 = require("react");
|
|
7129
7153
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7130
7154
|
function StripedBackground({
|
|
7131
7155
|
stripeColor = "rgba(255,255,255,0.18)",
|
|
@@ -7134,7 +7158,7 @@ function StripedBackground({
|
|
|
7134
7158
|
style,
|
|
7135
7159
|
children
|
|
7136
7160
|
}) {
|
|
7137
|
-
const bgImage = (0,
|
|
7161
|
+
const bgImage = (0, import_react47.useMemo)(() => {
|
|
7138
7162
|
return `repeating-linear-gradient(
|
|
7139
7163
|
45deg,
|
|
7140
7164
|
${stripeColor} 0px,
|
|
@@ -7171,7 +7195,7 @@ var PermitStripedBackground = ({ variant, className, children }) => {
|
|
|
7171
7195
|
};
|
|
7172
7196
|
|
|
7173
7197
|
// src/components/FnxFloatingButton/components/PermitCard.tsx
|
|
7174
|
-
var
|
|
7198
|
+
var import_react48 = require("react");
|
|
7175
7199
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
7176
7200
|
var PermitTypeLabel = {
|
|
7177
7201
|
self: "Self",
|
|
@@ -7189,7 +7213,7 @@ var BasePermitCard = ({
|
|
|
7189
7213
|
}) => {
|
|
7190
7214
|
const activePermitHash = useCofheActivePermitHash();
|
|
7191
7215
|
const expirationInfo = formatExpirationLabel(permit.expiration);
|
|
7192
|
-
const metadataTags = (0,
|
|
7216
|
+
const metadataTags = (0, import_react48.useMemo)(() => {
|
|
7193
7217
|
const isActivePermit = permit.hash === activePermitHash;
|
|
7194
7218
|
const tags = [];
|
|
7195
7219
|
if (expirationInfo.expired) tags.push("expired");
|
|
@@ -7326,19 +7350,21 @@ var PermitsListPage = () => {
|
|
|
7326
7350
|
PageContainer,
|
|
7327
7351
|
{
|
|
7328
7352
|
header: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
7329
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7353
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 text-base font-semibold tracking-tight text-[#0E2F3F] dark:text-white", children: [
|
|
7354
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7355
|
+
"button",
|
|
7356
|
+
{
|
|
7357
|
+
className: "inline-flex items-center gap-2 transition-opacity hover:opacity-80",
|
|
7358
|
+
onClick: navigateBack,
|
|
7359
|
+
type: "button",
|
|
7360
|
+
children: [
|
|
7361
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_ArrowBack2.default, { fontSize: "small" }),
|
|
7362
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Permits" })
|
|
7363
|
+
]
|
|
7364
|
+
}
|
|
7365
|
+
),
|
|
7366
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InfoModalButton, { onClick: () => openModal("permitInfo" /* PermitInfo */) })
|
|
7367
|
+
] }),
|
|
7342
7368
|
activePermitHash != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7343
7369
|
PermitCard,
|
|
7344
7370
|
{
|
|
@@ -7353,15 +7379,12 @@ var PermitsListPage = () => {
|
|
|
7353
7379
|
AccordionSection,
|
|
7354
7380
|
{
|
|
7355
7381
|
id: "self",
|
|
7356
|
-
renderHeader: () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
")"
|
|
7361
|
-
] }),
|
|
7362
|
-
" ",
|
|
7363
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InfoModalButton, { onClick: () => openModal("permitTypeInfo" /* PermitTypeInfo */, { type: "self" }) })
|
|
7382
|
+
renderHeader: () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
|
|
7383
|
+
"Self: (",
|
|
7384
|
+
selfPermits.length,
|
|
7385
|
+
")"
|
|
7364
7386
|
] }),
|
|
7387
|
+
accessory: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InfoModalButton, { onClick: () => openModal("permitTypeInfo" /* PermitTypeInfo */, { type: "self" }) }),
|
|
7365
7388
|
children: selfPermits.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "pl-4 text-xs p-2 px-4 italic", children: "No self permits." }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: selfPermits.map((permit2) => {
|
|
7366
7389
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7367
7390
|
PermitItem,
|
|
@@ -7379,15 +7402,12 @@ var PermitsListPage = () => {
|
|
|
7379
7402
|
AccordionSection,
|
|
7380
7403
|
{
|
|
7381
7404
|
id: "delegated",
|
|
7382
|
-
renderHeader: () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
")"
|
|
7387
|
-
] }),
|
|
7388
|
-
" ",
|
|
7389
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InfoModalButton, { onClick: () => openModal("permitTypeInfo" /* PermitTypeInfo */, { type: "sharing" }) })
|
|
7405
|
+
renderHeader: () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
|
|
7406
|
+
"Delegated: (",
|
|
7407
|
+
delegatedPermits.length,
|
|
7408
|
+
")"
|
|
7390
7409
|
] }),
|
|
7410
|
+
accessory: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InfoModalButton, { onClick: () => openModal("permitTypeInfo" /* PermitTypeInfo */, { type: "sharing" }) }),
|
|
7391
7411
|
children: delegatedPermits.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "pl-1 text-xs p-2 px-4 italic", children: "No delegated permits." }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: delegatedPermits.map((permit2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PermitItem, { permit: permit2, onClick: () => handleOpenPermit(permit2.hash) }, permit2.hash)) })
|
|
7392
7412
|
}
|
|
7393
7413
|
),
|
|
@@ -7395,15 +7415,12 @@ var PermitsListPage = () => {
|
|
|
7395
7415
|
AccordionSection,
|
|
7396
7416
|
{
|
|
7397
7417
|
id: "received",
|
|
7398
|
-
renderHeader: () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
")"
|
|
7403
|
-
] }),
|
|
7404
|
-
" ",
|
|
7405
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InfoModalButton, { onClick: () => openModal("permitTypeInfo" /* PermitTypeInfo */, { type: "recipient" }) })
|
|
7418
|
+
renderHeader: () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
|
|
7419
|
+
"Imported: (",
|
|
7420
|
+
importedPermits.length,
|
|
7421
|
+
")"
|
|
7406
7422
|
] }),
|
|
7423
|
+
accessory: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InfoModalButton, { onClick: () => openModal("permitTypeInfo" /* PermitTypeInfo */, { type: "recipient" }) }),
|
|
7407
7424
|
children: importedPermits.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "pl-1 text-xs p-2 px-4 italic", children: "No imported permits." }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: importedPermits.map((permit2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7408
7425
|
PermitItem,
|
|
7409
7426
|
{
|
|
@@ -7805,11 +7822,11 @@ var ImportPermitPage = () => {
|
|
|
7805
7822
|
|
|
7806
7823
|
// src/components/FnxFloatingButton/pages/TokenInfoPage.tsx
|
|
7807
7824
|
var import_chains3 = require("@cofhe/sdk/chains");
|
|
7808
|
-
var
|
|
7825
|
+
var import_react52 = require("react");
|
|
7809
7826
|
var import_ArrowBack6 = __toESM(require("@mui/icons-material/ArrowBack"), 1);
|
|
7810
7827
|
|
|
7811
7828
|
// src/components/FnxFloatingButton/pages/TokenInfoBalanceChart.tsx
|
|
7812
|
-
var
|
|
7829
|
+
var import_react50 = require("react");
|
|
7813
7830
|
var import_Lock = __toESM(require("@mui/icons-material/Lock"), 1);
|
|
7814
7831
|
var import_Public = __toESM(require("@mui/icons-material/Public"), 1);
|
|
7815
7832
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
@@ -7827,7 +7844,7 @@ var TokenInfoBalanceChart = ({ token, chartPoints }) => {
|
|
|
7827
7844
|
token
|
|
7828
7845
|
});
|
|
7829
7846
|
const isFetchingBalances = isFetchingConfidentialBalance || isFetchingPublicBalance;
|
|
7830
|
-
const balancePercents = (0,
|
|
7847
|
+
const balancePercents = (0, import_react50.useMemo)(() => {
|
|
7831
7848
|
if (!confidentialBalance && !publicBalance) return;
|
|
7832
7849
|
const confidentialUnit = confidentialBalance?.unit ?? null;
|
|
7833
7850
|
const publicUnit = publicBalance?.unit ?? null;
|
|
@@ -7839,7 +7856,7 @@ var TokenInfoBalanceChart = ({ token, chartPoints }) => {
|
|
|
7839
7856
|
publicPct
|
|
7840
7857
|
};
|
|
7841
7858
|
}, [confidentialBalance, publicBalance]);
|
|
7842
|
-
const price = (0,
|
|
7859
|
+
const price = (0, import_react50.useMemo)(() => {
|
|
7843
7860
|
const lastPoint = chartPoints?.[chartPoints.length - 1];
|
|
7844
7861
|
const firstPoint = chartPoints?.[0];
|
|
7845
7862
|
if (!lastPoint || !firstPoint) return;
|
|
@@ -7914,7 +7931,7 @@ var TokenInfoBalanceChart = ({ token, chartPoints }) => {
|
|
|
7914
7931
|
};
|
|
7915
7932
|
|
|
7916
7933
|
// src/components/FnxFloatingButton/pages/TokenInfoTransactionHistory.tsx
|
|
7917
|
-
var
|
|
7934
|
+
var import_react51 = require("react");
|
|
7918
7935
|
var import_viem22 = require("viem");
|
|
7919
7936
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7920
7937
|
var TokenInfoTransactionHistoryHeader = ({ token }) => {
|
|
@@ -7937,7 +7954,7 @@ var TokenInfoTransactionHistory = ({ token, priceUsd }) => {
|
|
|
7937
7954
|
account,
|
|
7938
7955
|
filter: (tx) => tx.token.address.toLowerCase() === token.address.toLowerCase()
|
|
7939
7956
|
});
|
|
7940
|
-
const activity = (0,
|
|
7957
|
+
const activity = (0, import_react51.useMemo)(() => {
|
|
7941
7958
|
return tokenTxs.slice().sort((a, b) => b.timestamp - a.timestamp).map((tx) => {
|
|
7942
7959
|
const amountToken = parseFloat((0, import_viem22.formatUnits)(tx.tokenAmount, tx.token.decimals));
|
|
7943
7960
|
const amountUsd = typeof priceUsd === "number" && Number.isFinite(amountToken) ? amountToken * priceUsd : void 0;
|
|
@@ -7989,7 +8006,7 @@ var TokenInfoPage = ({ token }) => {
|
|
|
7989
8006
|
},
|
|
7990
8007
|
rangeMs: 24 * 36e5
|
|
7991
8008
|
});
|
|
7992
|
-
const priceUsd = (0,
|
|
8009
|
+
const priceUsd = (0, import_react52.useMemo)(() => {
|
|
7993
8010
|
const lastPoint = chartPoints?.[chartPoints.length - 1];
|
|
7994
8011
|
return lastPoint?.value;
|
|
7995
8012
|
}, [chartPoints]);
|
|
@@ -8043,14 +8060,14 @@ var TokenInfoPage = ({ token }) => {
|
|
|
8043
8060
|
};
|
|
8044
8061
|
|
|
8045
8062
|
// src/components/FnxFloatingButton/pages/SendPage.tsx
|
|
8046
|
-
var
|
|
8063
|
+
var import_react53 = require("react");
|
|
8047
8064
|
var import_ArrowBack7 = __toESM(require("@mui/icons-material/ArrowBack"), 1);
|
|
8048
8065
|
var import_KeyboardArrowRight2 = __toESM(require("@mui/icons-material/KeyboardArrowRight"), 1);
|
|
8049
8066
|
var import_viem23 = require("viem");
|
|
8050
8067
|
var import_ts_essentials22 = __toESM(require_dist(), 1);
|
|
8051
8068
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8052
8069
|
var SendPage = ({ token: _token }) => {
|
|
8053
|
-
const [overriddenToken, setOverriddenToken] = (0,
|
|
8070
|
+
const [overriddenToken, setOverriddenToken] = (0, import_react53.useState)(null);
|
|
8054
8071
|
const token = overriddenToken ?? _token;
|
|
8055
8072
|
const { navigateBack } = usePortalNavigation();
|
|
8056
8073
|
const { openModal } = usePortalModals();
|
|
@@ -8094,11 +8111,11 @@ var SendPage = ({ token: _token }) => {
|
|
|
8094
8111
|
token,
|
|
8095
8112
|
accountAddress: account
|
|
8096
8113
|
});
|
|
8097
|
-
const encryptionProgressLabel = (0,
|
|
8098
|
-
const [amount, setAmount] = (0,
|
|
8099
|
-
const [recipientAddress, setRecipientAddress] = (0,
|
|
8100
|
-
const [error, setError] = (0,
|
|
8101
|
-
const [success, setSuccess] = (0,
|
|
8114
|
+
const encryptionProgressLabel = (0, import_react53.useMemo)(() => lastStep?.step && getStepConfig(lastStep).label, [lastStep]);
|
|
8115
|
+
const [amount, setAmount] = (0, import_react53.useState)("");
|
|
8116
|
+
const [recipientAddress, setRecipientAddress] = (0, import_react53.useState)("");
|
|
8117
|
+
const [error, setError] = (0, import_react53.useState)(null);
|
|
8118
|
+
const [success, setSuccess] = (0, import_react53.useState)(null);
|
|
8102
8119
|
const isValidAddress2 = (0, import_viem23.isAddress)(recipientAddress);
|
|
8103
8120
|
const isValidAmount = (amount.length > 0 && confidentialUnitBalance && confidentialUnitBalance.gte(amount)) ?? false;
|
|
8104
8121
|
const handleSend = async () => {
|
|
@@ -8247,15 +8264,15 @@ var import_ArrowBack8 = __toESM(require("@mui/icons-material/ArrowBack"), 1);
|
|
|
8247
8264
|
var import_KeyboardArrowDown = __toESM(require("@mui/icons-material/KeyboardArrowDown"), 1);
|
|
8248
8265
|
var import_tb4 = require("react-icons/tb");
|
|
8249
8266
|
var import_lu2 = require("react-icons/lu");
|
|
8250
|
-
var
|
|
8267
|
+
var import_react55 = require("react");
|
|
8251
8268
|
var import_viem24 = require("viem");
|
|
8252
8269
|
var import_ts_essentials23 = __toESM(require_dist(), 1);
|
|
8253
8270
|
|
|
8254
8271
|
// src/hooks/useIsUnshieldingMining.ts
|
|
8255
|
-
var
|
|
8272
|
+
var import_react54 = require("react");
|
|
8256
8273
|
function useIsUnshieldingMining(token) {
|
|
8257
8274
|
const account = useCofheAccount();
|
|
8258
|
-
const filter3 = (0,
|
|
8275
|
+
const filter3 = (0, import_react54.useCallback)(
|
|
8259
8276
|
(tx) => {
|
|
8260
8277
|
return tx.token.address === token.address && tx.actionType === "unshield" /* Unshield */ && tx.status === "pending" /* Pending */;
|
|
8261
8278
|
},
|
|
@@ -8274,8 +8291,8 @@ var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
|
8274
8291
|
var AUTOCLEAR_TX_STATUS_TIMEOUT = 5e3;
|
|
8275
8292
|
var DISPLAY_DECIMALS = 5;
|
|
8276
8293
|
function useLifecycleStore() {
|
|
8277
|
-
const [error, setError] = (0,
|
|
8278
|
-
const [status, setStatus] = (0,
|
|
8294
|
+
const [error, setError] = (0, import_react55.useState)(null);
|
|
8295
|
+
const [status, setStatus] = (0, import_react55.useState)(null);
|
|
8279
8296
|
return {
|
|
8280
8297
|
error,
|
|
8281
8298
|
setError,
|
|
@@ -8377,7 +8394,7 @@ function useClaimUnshieldedWithLifecycle() {
|
|
|
8377
8394
|
function useShieldWithLifecycle(token) {
|
|
8378
8395
|
const account = useCofheAccount();
|
|
8379
8396
|
const chainId = useCofheChainId();
|
|
8380
|
-
const [shieldAmount, setShieldAmount] = (0,
|
|
8397
|
+
const [shieldAmount, setShieldAmount] = (0, import_react55.useState)("");
|
|
8381
8398
|
const { setError, setStatus, error, status } = useLifecycleStore();
|
|
8382
8399
|
const { schedule: scheduleStatusClear } = useReschedulableTimeout(() => setStatus(null), AUTOCLEAR_TX_STATUS_TIMEOUT);
|
|
8383
8400
|
const tokenShield = useCofheTokenShield({
|
|
@@ -8458,7 +8475,7 @@ function useShieldWithLifecycle(token) {
|
|
|
8458
8475
|
if (publicBalanceUnit) setShieldAmount(publicBalanceUnit.toFixed());
|
|
8459
8476
|
};
|
|
8460
8477
|
const isValidShieldAmount = (shieldAmount.length > 0 && publicBalanceUnit?.gte(shieldAmount)) ?? false;
|
|
8461
|
-
const shieldAmountWei = (0,
|
|
8478
|
+
const shieldAmountWei = (0, import_react55.useMemo)(() => {
|
|
8462
8479
|
if (!isValidShieldAmount) return void 0;
|
|
8463
8480
|
try {
|
|
8464
8481
|
return unitToWei(shieldAmount, token.decimals);
|
|
@@ -8466,7 +8483,7 @@ function useShieldWithLifecycle(token) {
|
|
|
8466
8483
|
return void 0;
|
|
8467
8484
|
}
|
|
8468
8485
|
}, [isValidShieldAmount, shieldAmount, token.decimals]);
|
|
8469
|
-
const shieldTxCallArgs = (0,
|
|
8486
|
+
const shieldTxCallArgs = (0, import_react55.useMemo)(() => {
|
|
8470
8487
|
if (!account || !shieldAmountWei) return void 0;
|
|
8471
8488
|
return getCofheTokenShieldCallArgs({ token, amount: shieldAmountWei, account });
|
|
8472
8489
|
}, [account, shieldAmountWei, token]);
|
|
@@ -8493,7 +8510,7 @@ function useShieldWithLifecycle(token) {
|
|
|
8493
8510
|
const shieldSimulation = useCofheSimulateWriteContract(shieldCallArgs, {
|
|
8494
8511
|
enabled: !!shieldCallArgs && !shouldApprove
|
|
8495
8512
|
});
|
|
8496
|
-
const simulationError = (0,
|
|
8513
|
+
const simulationError = (0, import_react55.useMemo)(() => {
|
|
8497
8514
|
const relevantError = shouldApprove ? approvalSimulation.error : shieldSimulation.error;
|
|
8498
8515
|
if (!relevantError) return null;
|
|
8499
8516
|
const cofheErrorMessage = cofheHumanizeViemError(relevantError);
|
|
@@ -8526,7 +8543,7 @@ function useUnshieldWithLifecycle(token) {
|
|
|
8526
8543
|
const chainId = useCofheChainId();
|
|
8527
8544
|
const { setError, setStatus, error, status } = useLifecycleStore();
|
|
8528
8545
|
const { schedule: scheduleStatusClear } = useReschedulableTimeout(() => setStatus(null), AUTOCLEAR_TX_STATUS_TIMEOUT);
|
|
8529
|
-
const [unshieldAmount, setUnshieldAmount] = (0,
|
|
8546
|
+
const [unshieldAmount, setUnshieldAmount] = (0, import_react55.useState)("");
|
|
8530
8547
|
const tokenUnshield = useCofheTokenUnshield({
|
|
8531
8548
|
onUserSignatureRequest: (hash) => {
|
|
8532
8549
|
() => {
|
|
@@ -8589,7 +8606,7 @@ function useUnshieldWithLifecycle(token) {
|
|
|
8589
8606
|
if (confidentialBalanceUnit) setUnshieldAmount(confidentialBalanceUnit.toFixed());
|
|
8590
8607
|
};
|
|
8591
8608
|
const isValidUnshieldAmount = (unshieldAmount.length > 0 && confidentialBalanceUnit?.gte(unshieldAmount)) ?? false;
|
|
8592
|
-
const unshieldCallArgs = (0,
|
|
8609
|
+
const unshieldCallArgs = (0, import_react55.useMemo)(() => {
|
|
8593
8610
|
if (!account || !isValidUnshieldAmount) return void 0;
|
|
8594
8611
|
const amountWei = (0, import_viem24.parseUnits)(unshieldAmount, token.decimals);
|
|
8595
8612
|
return getCofheTokenUnshieldCallArgs({ token, amount: amountWei, account });
|
|
@@ -8597,7 +8614,7 @@ function useUnshieldWithLifecycle(token) {
|
|
|
8597
8614
|
const unshieldSimulation = useCofheSimulateWriteContract(unshieldCallArgs, {
|
|
8598
8615
|
enabled: !!unshieldCallArgs
|
|
8599
8616
|
});
|
|
8600
|
-
const simulationError = (0,
|
|
8617
|
+
const simulationError = (0, import_react55.useMemo)(
|
|
8601
8618
|
() => humanizeSimulationError(unshieldSimulation.error, "Failed to simulate unshield transaction"),
|
|
8602
8619
|
[unshieldSimulation.error]
|
|
8603
8620
|
);
|
|
@@ -8621,8 +8638,8 @@ function useUnshieldWithLifecycle(token) {
|
|
|
8621
8638
|
}
|
|
8622
8639
|
var shieldableTypes = /* @__PURE__ */ new Set(["dual", "wrapped"]);
|
|
8623
8640
|
var ShieldPageV2 = ({ token: _token, defaultMode }) => {
|
|
8624
|
-
const [mode, setMode] = (0,
|
|
8625
|
-
const [overriddenToken, setOverriddenToken] = (0,
|
|
8641
|
+
const [mode, setMode] = (0, import_react55.useState)(defaultMode ?? "shield");
|
|
8642
|
+
const [overriddenToken, setOverriddenToken] = (0, import_react55.useState)(null);
|
|
8626
8643
|
const token = overriddenToken ?? _token;
|
|
8627
8644
|
return mode === "shield" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ShieldTab, { token, mode, setMode, setToken: setOverriddenToken }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(UnshieldTab, { token, mode, setMode, setToken: setOverriddenToken });
|
|
8628
8645
|
};
|
|
@@ -8669,14 +8686,14 @@ function ClaimingSection({ token }) {
|
|
|
8669
8686
|
});
|
|
8670
8687
|
};
|
|
8671
8688
|
const isUnshieldingMining = useIsUnshieldingMining(token);
|
|
8672
|
-
const claimCallArgs = (0,
|
|
8689
|
+
const claimCallArgs = (0, import_react55.useMemo)(() => {
|
|
8673
8690
|
if (!account || !unshieldedClaims?.hasClaimable) return void 0;
|
|
8674
8691
|
return getCofheTokenClaimUnshieldedCallArgs({ token, account });
|
|
8675
8692
|
}, [account, token, unshieldedClaims?.hasClaimable]);
|
|
8676
8693
|
const claimSimulation = useCofheSimulateWriteContract(claimCallArgs, {
|
|
8677
8694
|
enabled: !!claimCallArgs
|
|
8678
8695
|
});
|
|
8679
|
-
const claimSimulationError = (0,
|
|
8696
|
+
const claimSimulationError = (0, import_react55.useMemo)(
|
|
8680
8697
|
() => humanizeSimulationError(claimSimulation.error, "Failed to simulate claim transaction"),
|
|
8681
8698
|
[claimSimulation.error]
|
|
8682
8699
|
);
|
|
@@ -8954,7 +8971,7 @@ var ActivityPage = () => {
|
|
|
8954
8971
|
|
|
8955
8972
|
// src/components/FnxFloatingButton/pages/DebugPage.tsx
|
|
8956
8973
|
var import_ArrowBack10 = __toESM(require("@mui/icons-material/ArrowBack"), 1);
|
|
8957
|
-
var
|
|
8974
|
+
var import_react56 = require("react");
|
|
8958
8975
|
var import_accounts = require("viem/accounts");
|
|
8959
8976
|
var import_viem25 = require("viem");
|
|
8960
8977
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
@@ -8963,8 +8980,8 @@ var DebugPage = () => {
|
|
|
8963
8980
|
const { statuses, addStatus, removeStatus } = usePortalStatuses();
|
|
8964
8981
|
const { addToast } = usePortalToasts();
|
|
8965
8982
|
const { openModal } = usePortalModals();
|
|
8966
|
-
const [modalSelection, setModalSelection] = (0,
|
|
8967
|
-
const [activeTab, setActiveTab] = (0,
|
|
8983
|
+
const [modalSelection, setModalSelection] = (0, import_react56.useState)(void 0);
|
|
8984
|
+
const [activeTab, setActiveTab] = (0, import_react56.useState)("modal");
|
|
8968
8985
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8969
8986
|
PageContainer,
|
|
8970
8987
|
{
|
|
@@ -9368,6 +9385,9 @@ var import_KeyboardArrowRight3 = __toESM(require("@mui/icons-material/KeyboardAr
|
|
|
9368
9385
|
var import_chains4 = require("@cofhe/sdk/chains");
|
|
9369
9386
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
9370
9387
|
var TokenRow = ({ token, onClick, topLabel, balanceType }) => {
|
|
9388
|
+
const publicSymbol = token.extensions.fhenix.erc20Pair?.symbol ?? token.symbol;
|
|
9389
|
+
const destinationSymbol = token.symbol;
|
|
9390
|
+
const showDestination = balanceType === "public" /* Public */ && !!publicSymbol && !!destinationSymbol && publicSymbol !== destinationSymbol;
|
|
9371
9391
|
const account = useCofheAccount();
|
|
9372
9392
|
const { data: confidentialBalance } = useCofheTokenDecryptedBalance(
|
|
9373
9393
|
{
|
|
@@ -9403,7 +9423,11 @@ var TokenRow = ({ token, onClick, topLabel, balanceType }) => {
|
|
|
9403
9423
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TokenIcon, { logoURI: token.logoURI, alt: token.name, size: "sm" }),
|
|
9404
9424
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
9405
9425
|
topLabel && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "text-xxxs opacity-70 fnx-text-primary leading-none", children: topLabel }),
|
|
9406
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "text-sm font-medium fnx-text-primary truncate leading-tight", children: balanceType === "confidential" /* Confidential */ ? token.symbol :
|
|
9426
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "text-sm font-medium fnx-text-primary truncate leading-tight", children: balanceType === "confidential" /* Confidential */ ? token.symbol : publicSymbol }),
|
|
9427
|
+
showDestination && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "text-xxxs opacity-70 fnx-text-primary truncate leading-tight", children: [
|
|
9428
|
+
"\u2192 ",
|
|
9429
|
+
destinationSymbol
|
|
9430
|
+
] })
|
|
9407
9431
|
] })
|
|
9408
9432
|
] }),
|
|
9409
9433
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
|
|
@@ -9544,7 +9568,7 @@ var PortfolioPage = () => {
|
|
|
9544
9568
|
|
|
9545
9569
|
// src/components/FnxFloatingButton/pages/ClaimableTokens.tsx
|
|
9546
9570
|
var import_ArrowBack13 = __toESM(require("@mui/icons-material/ArrowBack"), 1);
|
|
9547
|
-
var
|
|
9571
|
+
var import_react57 = require("react");
|
|
9548
9572
|
var import_ts_essentials24 = __toESM(require_dist(), 1);
|
|
9549
9573
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
9550
9574
|
function ClaimableTokens() {
|
|
@@ -9557,7 +9581,7 @@ function ClaimableTokens() {
|
|
|
9557
9581
|
const chainId = useCofheChainId();
|
|
9558
9582
|
const allTokens = useCofheTokens(chainId);
|
|
9559
9583
|
const claimMutation = useCofheTokenClaimUnshielded();
|
|
9560
|
-
const rows = (0,
|
|
9584
|
+
const rows = (0, import_react57.useMemo)(() => {
|
|
9561
9585
|
const byLower = new Map(allTokens.map((t) => [t.address.toLowerCase(), t]));
|
|
9562
9586
|
return Object.entries(claimableByTokenAddress).filter(([_t, amount]) => amount > 0n).map(([tokenAddress, claimableAmount]) => {
|
|
9563
9587
|
const token = byLower.get(tokenAddress.toLowerCase());
|
|
@@ -9644,7 +9668,7 @@ var pages = {
|
|
|
9644
9668
|
};
|
|
9645
9669
|
|
|
9646
9670
|
// src/components/FnxFloatingButton/ContentSection.tsx
|
|
9647
|
-
var
|
|
9671
|
+
var import_react60 = require("motion/react");
|
|
9648
9672
|
|
|
9649
9673
|
// src/components/FnxFloatingButton/modals/ExampleSelectionPage.tsx
|
|
9650
9674
|
var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
@@ -9707,7 +9731,7 @@ var ExampleInfoPage = ({ onClose }) => {
|
|
|
9707
9731
|
// src/components/FnxFloatingButton/modals/PermitDetailsModal.tsx
|
|
9708
9732
|
var import_fa64 = require("react-icons/fa6");
|
|
9709
9733
|
var import_Close4 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
9710
|
-
var
|
|
9734
|
+
var import_react58 = require("react");
|
|
9711
9735
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
9712
9736
|
var PermitTypeLabel2 = {
|
|
9713
9737
|
self: "Self",
|
|
@@ -9736,15 +9760,15 @@ var PermitDetailsModal = ({ hash, onClose }) => {
|
|
|
9736
9760
|
isCopyComplete
|
|
9737
9761
|
} = usePermitDetailsAndActions(hash);
|
|
9738
9762
|
const { openModal } = usePortalModals();
|
|
9739
|
-
const [confirmDelete, setConfirmDelete] = (0,
|
|
9740
|
-
const handlePermitSelect = (0,
|
|
9763
|
+
const [confirmDelete, setConfirmDelete] = (0, import_react58.useState)(false);
|
|
9764
|
+
const handlePermitSelect = (0, import_react58.useCallback)(() => {
|
|
9741
9765
|
handleSelectActivePermit();
|
|
9742
9766
|
onClose();
|
|
9743
9767
|
}, [handleSelectActivePermit, onClose]);
|
|
9744
|
-
const handlePermitShare = (0,
|
|
9768
|
+
const handlePermitShare = (0, import_react58.useCallback)(() => {
|
|
9745
9769
|
handleCopySharablePermitData();
|
|
9746
9770
|
}, [handleCopySharablePermitData]);
|
|
9747
|
-
const handlePermitDelete = (0,
|
|
9771
|
+
const handlePermitDelete = (0, import_react58.useCallback)(async () => {
|
|
9748
9772
|
if (!confirmDelete) {
|
|
9749
9773
|
setConfirmDelete(true);
|
|
9750
9774
|
return;
|
|
@@ -9920,8 +9944,8 @@ var modals = {
|
|
|
9920
9944
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
9921
9945
|
var MeasuredContentRenderer = ({ children, id, isModal, onModalOverlayClick }) => {
|
|
9922
9946
|
const { setContentHeight, removeContentHeight } = usePortalUI();
|
|
9923
|
-
const contentRef = (0,
|
|
9924
|
-
(0,
|
|
9947
|
+
const contentRef = (0, import_react59.useRef)(null);
|
|
9948
|
+
(0, import_react59.useEffect)(() => {
|
|
9925
9949
|
if (!contentRef.current) return;
|
|
9926
9950
|
const observer = new ResizeObserver((entries) => {
|
|
9927
9951
|
for (const entry of entries) {
|
|
@@ -9951,7 +9975,7 @@ var MeasuredContentRenderer = ({ children, id, isModal, onModalOverlayClick }) =
|
|
|
9951
9975
|
] });
|
|
9952
9976
|
};
|
|
9953
9977
|
var ContentRenderer = ({ page }) => {
|
|
9954
|
-
const content = (0,
|
|
9978
|
+
const content = (0, import_react59.useMemo)(() => {
|
|
9955
9979
|
const PageComp = pages[page.page];
|
|
9956
9980
|
const props = page.props ?? {};
|
|
9957
9981
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(PageComp, { ...props });
|
|
@@ -9959,7 +9983,7 @@ var ContentRenderer = ({ page }) => {
|
|
|
9959
9983
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(MeasuredContentRenderer, { id: "content", children: content });
|
|
9960
9984
|
};
|
|
9961
9985
|
var ModalRenderer = ({ modal }) => {
|
|
9962
|
-
const content = (0,
|
|
9986
|
+
const content = (0, import_react59.useMemo)(() => {
|
|
9963
9987
|
const ModalComp = modals[modal.modal];
|
|
9964
9988
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ModalComp, { ...modal });
|
|
9965
9989
|
}, [modal]);
|
|
@@ -9972,8 +9996,8 @@ var ContentSection = ({ overriddingPage }) => {
|
|
|
9972
9996
|
const maxContentHeight = usePortalUIMaxContentHeight();
|
|
9973
9997
|
const currentPage = usePortalCurrentPage();
|
|
9974
9998
|
const pageOrOverridingPage = overriddingPage ?? currentPage;
|
|
9975
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9976
|
-
|
|
9999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react60.AnimatePresence, { children: contentPanelOpen && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10000
|
+
import_react60.motion.div,
|
|
9977
10001
|
{
|
|
9978
10002
|
className: "relative flex w-full z-50",
|
|
9979
10003
|
initial: { opacity: 0, y: isTopSide ? -10 : 10 },
|
|
@@ -9990,13 +10014,13 @@ var ContentSection = ({ overriddingPage }) => {
|
|
|
9990
10014
|
};
|
|
9991
10015
|
|
|
9992
10016
|
// src/components/FnxFloatingButton/ToastsSection.tsx
|
|
9993
|
-
var
|
|
9994
|
-
var
|
|
10017
|
+
var import_react61 = require("react");
|
|
10018
|
+
var import_react62 = require("motion/react");
|
|
9995
10019
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
9996
10020
|
var ToastClearer = ({ id, paused, remainingMs }) => {
|
|
9997
10021
|
const { removeToast } = usePortalToasts();
|
|
9998
|
-
const timerRef = (0,
|
|
9999
|
-
(0,
|
|
10022
|
+
const timerRef = (0, import_react61.useRef)(null);
|
|
10023
|
+
(0, import_react61.useEffect)(() => {
|
|
10000
10024
|
if (remainingMs <= 0) {
|
|
10001
10025
|
removeToast(id);
|
|
10002
10026
|
return;
|
|
@@ -10025,7 +10049,7 @@ var ToastComponent = ({ id, duration, paused, startMs, remainingMs, content }) =
|
|
|
10025
10049
|
const handleDismiss = () => {
|
|
10026
10050
|
removeToast(id);
|
|
10027
10051
|
};
|
|
10028
|
-
const injectedContent = (0,
|
|
10052
|
+
const injectedContent = (0, import_react61.isValidElement)(content) ? (0, import_react61.cloneElement)(content, {
|
|
10029
10053
|
id,
|
|
10030
10054
|
paused,
|
|
10031
10055
|
startMs,
|
|
@@ -10036,7 +10060,7 @@ var ToastComponent = ({ id, duration, paused, startMs, remainingMs, content }) =
|
|
|
10036
10060
|
...content.props
|
|
10037
10061
|
}) : content;
|
|
10038
10062
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
10039
|
-
|
|
10063
|
+
import_react62.motion.div,
|
|
10040
10064
|
{
|
|
10041
10065
|
initial: { opacity: 0, y: isTopSide ? -4 : 4 },
|
|
10042
10066
|
animate: { opacity: 1, y: 0 },
|
|
@@ -10053,7 +10077,7 @@ var ToastComponent = ({ id, duration, paused, startMs, remainingMs, content }) =
|
|
|
10053
10077
|
};
|
|
10054
10078
|
var ToastsSection = () => {
|
|
10055
10079
|
const { toasts } = usePortalToasts();
|
|
10056
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "flex flex-col gap-3 w-full max-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
10080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "flex flex-col gap-3 w-full max-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react62.AnimatePresence, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ToastComponent, { ...toast }, toast.id)) }) });
|
|
10057
10081
|
};
|
|
10058
10082
|
|
|
10059
10083
|
// src/components/FnxFloatingButton/FnxFloatingButtonBase.tsx
|
|
@@ -10202,10 +10226,10 @@ function createCofheConfig(config) {
|
|
|
10202
10226
|
var import_chains5 = require("@cofhe/sdk/chains");
|
|
10203
10227
|
var import_ts_essentials25 = __toESM(require_dist(), 1);
|
|
10204
10228
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
10205
|
-
var CofheContext = (0,
|
|
10229
|
+
var CofheContext = (0, import_react63.createContext)(void 0);
|
|
10206
10230
|
function CofheProvider(props) {
|
|
10207
10231
|
const { children, queryClient, publicClient, walletClient } = props;
|
|
10208
|
-
const config = (0,
|
|
10232
|
+
const config = (0, import_react63.useMemo)(() => {
|
|
10209
10233
|
if (props.config) return props.config;
|
|
10210
10234
|
if (props.cofheClient) {
|
|
10211
10235
|
(0, import_ts_essentials25.assert)(props.cofheClient.config.environment === "react", "Provided cofheClient must have react config");
|
|
@@ -10213,9 +10237,9 @@ function CofheProvider(props) {
|
|
|
10213
10237
|
}
|
|
10214
10238
|
return createCofheConfig({ supportedChains: Object.values(import_chains5.chains) });
|
|
10215
10239
|
}, [props.config, props.cofheClient]);
|
|
10216
|
-
const cofheClient = (0,
|
|
10217
|
-
const [position, setPosition] = (0,
|
|
10218
|
-
const [theme, setTheme] = (0,
|
|
10240
|
+
const cofheClient = (0, import_react63.useMemo)(() => props.cofheClient ?? (0, import_web3.createCofheClient)(config), [props.cofheClient, config]);
|
|
10241
|
+
const [position, setPosition] = (0, import_react63.useState)(config.react.position);
|
|
10242
|
+
const [theme, setTheme] = (0, import_react63.useState)(config.react.initialTheme);
|
|
10219
10243
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
10220
10244
|
CofheContext.Provider,
|
|
10221
10245
|
{
|
|
@@ -10240,7 +10264,7 @@ function AutoConnect({ walletClient, publicClient }) {
|
|
|
10240
10264
|
return null;
|
|
10241
10265
|
}
|
|
10242
10266
|
function useCofheContext() {
|
|
10243
|
-
const context = (0,
|
|
10267
|
+
const context = (0, import_react63.useContext)(CofheContext);
|
|
10244
10268
|
if (context === void 0) {
|
|
10245
10269
|
throw new Error("useCofheContext must be used within a CofheProvider");
|
|
10246
10270
|
}
|
|
@@ -10248,7 +10272,7 @@ function useCofheContext() {
|
|
|
10248
10272
|
}
|
|
10249
10273
|
|
|
10250
10274
|
// src/components/FnxEncryptInput.tsx
|
|
10251
|
-
var
|
|
10275
|
+
var import_react64 = require("react");
|
|
10252
10276
|
var import_Security = __toESM(require("@mui/icons-material/Security"), 1);
|
|
10253
10277
|
var import_KeyboardArrowDown2 = __toESM(require("@mui/icons-material/KeyboardArrowDown"), 1);
|
|
10254
10278
|
var import_ContentCopy = __toESM(require("@mui/icons-material/ContentCopy"), 1);
|
|
@@ -10274,30 +10298,30 @@ var FnxEncryptInput = ({
|
|
|
10274
10298
|
onEncryptComplete,
|
|
10275
10299
|
onEncryptError
|
|
10276
10300
|
}) => {
|
|
10277
|
-
const [textValue, setTextValue] = (0,
|
|
10278
|
-
const [selectedType, setSelectedType] = (0,
|
|
10279
|
-
const [isDropdownOpen, setIsDropdownOpen] = (0,
|
|
10280
|
-
const [showProgress, setShowProgress] = (0,
|
|
10281
|
-
const [encryptedResult, setEncryptedResult] = (0,
|
|
10282
|
-
const [copySuccess, setCopySuccess] = (0,
|
|
10283
|
-
const dropdownRef = (0,
|
|
10301
|
+
const [textValue, setTextValue] = (0, import_react64.useState)(initialValue);
|
|
10302
|
+
const [selectedType, setSelectedType] = (0, import_react64.useState)(options[0]?.value || "uint32");
|
|
10303
|
+
const [isDropdownOpen, setIsDropdownOpen] = (0, import_react64.useState)(false);
|
|
10304
|
+
const [showProgress, setShowProgress] = (0, import_react64.useState)(false);
|
|
10305
|
+
const [encryptedResult, setEncryptedResult] = (0, import_react64.useState)(null);
|
|
10306
|
+
const [copySuccess, setCopySuccess] = (0, import_react64.useState)(false);
|
|
10307
|
+
const dropdownRef = (0, import_react64.useRef)(null);
|
|
10284
10308
|
const {
|
|
10285
10309
|
encryptInputsAsync: encrypt,
|
|
10286
10310
|
isEncrypting,
|
|
10287
10311
|
stepsState: { lastStep: lastEncryptionStep }
|
|
10288
10312
|
} = useCofheEncrypt();
|
|
10289
|
-
const { progress: encryptionProgress, label: encryptionProgressLabel } = (0,
|
|
10313
|
+
const { progress: encryptionProgress, label: encryptionProgressLabel } = (0, import_react64.useMemo)(() => {
|
|
10290
10314
|
return lastEncryptionStep ? getStepConfig(lastEncryptionStep) : {
|
|
10291
10315
|
progress: void 0,
|
|
10292
10316
|
label: void 0
|
|
10293
10317
|
};
|
|
10294
10318
|
}, [lastEncryptionStep]);
|
|
10295
|
-
const debouncedValidation = (0,
|
|
10319
|
+
const debouncedValidation = (0, import_react64.useRef)(
|
|
10296
10320
|
debounce((value) => {
|
|
10297
10321
|
cofheLogger.log("Debounced validation for:", value);
|
|
10298
10322
|
}, debounceMs)
|
|
10299
10323
|
).current;
|
|
10300
|
-
(0,
|
|
10324
|
+
(0, import_react64.useEffect)(() => {
|
|
10301
10325
|
if (showProgressBar && isEncrypting) {
|
|
10302
10326
|
setShowProgress(true);
|
|
10303
10327
|
} else if (!isEncrypting) {
|
|
@@ -10305,7 +10329,7 @@ var FnxEncryptInput = ({
|
|
|
10305
10329
|
return () => clearTimeout(timer);
|
|
10306
10330
|
}
|
|
10307
10331
|
}, [showProgressBar, isEncrypting]);
|
|
10308
|
-
(0,
|
|
10332
|
+
(0, import_react64.useEffect)(() => {
|
|
10309
10333
|
if (isEncrypting && lastEncryptionStep && encryptionProgress && encryptionProgressLabel) {
|
|
10310
10334
|
onEncryptProgress?.({
|
|
10311
10335
|
step: lastEncryptionStep.step,
|
|
@@ -10314,7 +10338,7 @@ var FnxEncryptInput = ({
|
|
|
10314
10338
|
});
|
|
10315
10339
|
}
|
|
10316
10340
|
}, [encryptionProgress, encryptionProgressLabel, onEncryptProgress, isEncrypting, lastEncryptionStep]);
|
|
10317
|
-
(0,
|
|
10341
|
+
(0, import_react64.useEffect)(() => {
|
|
10318
10342
|
const handleClickOutside = (event) => {
|
|
10319
10343
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
10320
10344
|
setIsDropdownOpen(false);
|
|
@@ -10596,6 +10620,7 @@ var import_web4 = require("@cofhe/sdk/web");
|
|
|
10596
10620
|
useCofheClient,
|
|
10597
10621
|
useCofheConnection,
|
|
10598
10622
|
useCofheContext,
|
|
10623
|
+
useCofheEnabled,
|
|
10599
10624
|
useCofheEncrypt,
|
|
10600
10625
|
useCofheEncryptAndWriteContract,
|
|
10601
10626
|
useCofheNavigateToCreatePermit,
|