@cofhe/react 0.0.0-beta-20260313071530 → 0.0.0-beta-20260319151718
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 +27 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3346,7 +3346,8 @@ var import_sdk5 = require("@cofhe/sdk");
|
|
|
3346
3346
|
var import_sdk4 = require("@cofhe/sdk");
|
|
3347
3347
|
var import_ts_essentials8 = __toESM(require_dist(), 1);
|
|
3348
3348
|
function useCofheDecrypt({
|
|
3349
|
-
input
|
|
3349
|
+
input,
|
|
3350
|
+
onPoll: onPoll2
|
|
3350
3351
|
}, queryOptions) {
|
|
3351
3352
|
const { client } = useCofheContext();
|
|
3352
3353
|
const isCofheErrorActive = useIsCofheErrorActive();
|
|
@@ -3357,7 +3358,9 @@ function useCofheDecrypt({
|
|
|
3357
3358
|
queryKey: ["decryptCiphertext", input?.ctHash.toString(), input?.utype],
|
|
3358
3359
|
queryFn: async () => {
|
|
3359
3360
|
(0, import_ts_essentials8.assert)(input, "input is guaranteed to be defined by enabled condition");
|
|
3360
|
-
|
|
3361
|
+
const builder = client.decryptForView(input.ctHash, input.utype);
|
|
3362
|
+
if (onPoll2) builder.onPoll(onPoll2);
|
|
3363
|
+
return builder.execute();
|
|
3361
3364
|
},
|
|
3362
3365
|
meta: {
|
|
3363
3366
|
persist: true
|
|
@@ -3370,6 +3373,21 @@ function useCofheDecrypt({
|
|
|
3370
3373
|
});
|
|
3371
3374
|
}
|
|
3372
3375
|
|
|
3376
|
+
// src/utils/isProduction.ts
|
|
3377
|
+
var import_meta = {};
|
|
3378
|
+
var isProduction = () => {
|
|
3379
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV === "development") {
|
|
3380
|
+
return false;
|
|
3381
|
+
}
|
|
3382
|
+
if (typeof import_meta !== "undefined") {
|
|
3383
|
+
const metaEnv = import_meta.env;
|
|
3384
|
+
if (metaEnv && metaEnv.MODE === "development" && metaEnv.DEV === true && metaEnv.PROD === false) {
|
|
3385
|
+
return false;
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
return true;
|
|
3389
|
+
};
|
|
3390
|
+
|
|
3373
3391
|
// src/hooks/useCofheReadContractAndDecrypt.ts
|
|
3374
3392
|
function isEncryptedValue(value) {
|
|
3375
3393
|
return typeof value === "object" && value !== null && "ctHash" in value && "utype" in value && Object.values(import_sdk5.FheTypes).includes(value.utype);
|
|
@@ -3380,6 +3398,11 @@ function convertCofheReturnTypeToEncryptedReturnType(value) {
|
|
|
3380
3398
|
"Auto-decryption now only supports a case where the contract function returns a single encrypted value"
|
|
3381
3399
|
);
|
|
3382
3400
|
}
|
|
3401
|
+
var onPoll = isProduction() ? void 0 : (context) => {
|
|
3402
|
+
console.debug(
|
|
3403
|
+
`Decryption poll attemptIndex ${context.attemptIndex}. Operation: ${context.operation}. ${context.elapsedMs}ms elapsed. Request ID: ${context.requestId}.`
|
|
3404
|
+
);
|
|
3405
|
+
};
|
|
3383
3406
|
function useCofheReadContractAndDecrypt(params, {
|
|
3384
3407
|
readQueryOptions,
|
|
3385
3408
|
decryptingQueryOptions
|
|
@@ -3390,7 +3413,8 @@ function useCofheReadContractAndDecrypt(params, {
|
|
|
3390
3413
|
const asEncryptedReturnType = encryptedData ? convertCofheReturnTypeToEncryptedReturnType(encryptedData) : void 0;
|
|
3391
3414
|
const decrypted = useCofheDecrypt(
|
|
3392
3415
|
{
|
|
3393
|
-
input: asEncryptedReturnType
|
|
3416
|
+
input: asEncryptedReturnType,
|
|
3417
|
+
onPoll
|
|
3394
3418
|
},
|
|
3395
3419
|
decryptingQueryOptions
|
|
3396
3420
|
);
|
|
@@ -6434,7 +6458,6 @@ var TransactionItem = ({ transaction }) => {
|
|
|
6434
6458
|
|
|
6435
6459
|
// src/components/FnxFloatingButton/pages/MainPage/BottomNavigation.tsx
|
|
6436
6460
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6437
|
-
var import_meta = {};
|
|
6438
6461
|
var iconClassName = "w-4 h-4";
|
|
6439
6462
|
var ShieldIcon = () => {
|
|
6440
6463
|
const { totalTokensClaimable } = useCofheClaimableTokens();
|
|
@@ -6488,18 +6511,6 @@ var debugNavItem = {
|
|
|
6488
6511
|
label: "Debug",
|
|
6489
6512
|
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_fa.FaBug, { className: iconClassName })
|
|
6490
6513
|
};
|
|
6491
|
-
var isProduction = () => {
|
|
6492
|
-
if (typeof process !== "undefined" && process.env?.NODE_ENV === "development") {
|
|
6493
|
-
return false;
|
|
6494
|
-
}
|
|
6495
|
-
if (typeof import_meta !== "undefined") {
|
|
6496
|
-
const metaEnv = import_meta.env;
|
|
6497
|
-
if (metaEnv && metaEnv.MODE === "development" && metaEnv.DEV === true && metaEnv.PROD === false) {
|
|
6498
|
-
return false;
|
|
6499
|
-
}
|
|
6500
|
-
}
|
|
6501
|
-
return true;
|
|
6502
|
-
};
|
|
6503
6514
|
var navItems = [...baseNavItems, ...!isProduction() ? [debugNavItem] : []];
|
|
6504
6515
|
var BottomNavigation = () => {
|
|
6505
6516
|
const { navigateTo } = usePortalNavigation();
|