@tokenops/sdk 1.1.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -8
- package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
- package/dist/{chunk-FXCW7LVB.js → chunk-2PWNH3UE.js} +35 -6
- package/dist/{chunk-FPQBFIUW.cjs → chunk-4WPGQSNT.cjs} +3 -3
- package/dist/{chunk-OYLZEEHF.cjs → chunk-5X5WL5CU.cjs} +265 -101
- package/dist/{chunk-56UI7LUR.cjs → chunk-67OV5CX2.cjs} +19 -0
- package/dist/{chunk-WRCUDSUJ.js → chunk-6BMP4ICG.js} +2 -2
- package/dist/{chunk-XXXDQSHE.js → chunk-6R4KNAPK.js} +5 -3
- package/dist/{chunk-XSNLAS5M.js → chunk-AOP6HMPW.js} +1 -1
- package/dist/{chunk-SAGJIEQK.cjs → chunk-C7BRZXJA.cjs} +14 -14
- package/dist/{chunk-OQZAZIAS.js → chunk-DUZIIRPF.js} +174 -5
- package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
- package/dist/chunk-FT4LNBOS.js +11 -0
- package/dist/{chunk-QE7ZONJ2.js → chunk-IJFQ5L4I.js} +4 -4
- package/dist/{chunk-X56UVEXS.js → chunk-IXLO7GO5.js} +209 -45
- package/dist/{chunk-CQIPRNS7.cjs → chunk-JK4XMMKM.cjs} +3 -3
- package/dist/{chunk-ITQ7WKVC.cjs → chunk-JYOTGRSO.cjs} +8 -8
- package/dist/{chunk-VDXVNZCO.cjs → chunk-KLKI352M.cjs} +85 -29
- package/dist/{chunk-5SA2HF2W.cjs → chunk-MCRBVJGZ.cjs} +24 -22
- package/dist/{chunk-3PQ2RFPC.js → chunk-NTZY6IB7.js} +4 -4
- package/dist/{chunk-JJ4R5QXF.js → chunk-ODLTEGHB.js} +1 -1
- package/dist/{chunk-XWDVPV42.js → chunk-ORFTDNFZ.js} +4 -4
- package/dist/{chunk-IR5AK5U5.js → chunk-OXTLPTO3.js} +4 -4
- package/dist/{chunk-23F7JIK5.cjs → chunk-PFXURMBZ.cjs} +77 -48
- package/dist/{chunk-3ZRHDTEX.cjs → chunk-PUPKNW3R.cjs} +2 -2
- package/dist/{chunk-IVE3QEGD.js → chunk-QBJ7O2B4.js} +18 -1
- package/dist/{chunk-JFLEEXKP.js → chunk-SG65XWH7.js} +58 -2
- package/dist/{chunk-G7G75C46.cjs → chunk-T46YXSBP.cjs} +11 -11
- package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
- package/dist/{chunk-SYHXDHWX.cjs → chunk-TIUKIY5V.cjs} +193 -24
- package/dist/{chunk-W7JHOK7G.cjs → chunk-V2PXZVBF.cjs} +4 -4
- package/dist/{chunk-SEKC7H5Y.cjs → chunk-W7IGCOVL.cjs} +11 -11
- package/dist/{chunk-5KHIQG7Y.cjs → chunk-WENHUPZC.cjs} +31 -31
- package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
- package/dist/{chunk-M7V2EDPB.js → chunk-XGGTQQFH.js} +1 -1
- package/dist/{chunk-ITQBDRWX.js → chunk-YQIBBEFJ.js} +1 -1
- package/dist/{chunk-BE2AIZ3K.js → chunk-ZA673I3O.js} +1 -1
- package/dist/chunk-ZQUE2B3Q.cjs +33 -0
- package/dist/{chunk-FYQ2UW4T.js → chunk-ZWXJTBZO.js} +1 -1
- package/dist/core/errors.d.ts +41 -1
- package/dist/core/revert-mapper.d.ts +77 -0
- package/dist/core/wagmi-compat.d.ts +40 -0
- package/dist/fhe/index.cjs +112 -66
- package/dist/fhe/index.d.cts +1 -1
- package/dist/fhe/index.d.ts +1 -1
- package/dist/fhe/index.js +50 -8
- package/dist/fhe/react/index.cjs +7 -7
- package/dist/fhe/react/index.js +2 -2
- package/dist/fhe/sepolia-encryptor-web.d.ts +27 -1
- package/dist/fhe/sepolia-encryptor.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/index.cjs +9 -8
- package/dist/fhe-airdrop/advanced/index.js +7 -6
- package/dist/fhe-airdrop/advanced/react/index.cjs +14 -13
- package/dist/fhe-airdrop/advanced/react/index.js +10 -9
- package/dist/fhe-airdrop/airdrop.d.ts +2 -0
- package/dist/fhe-airdrop/encryption.d.ts +8 -0
- package/dist/fhe-airdrop/factory.d.ts +86 -1
- package/dist/fhe-airdrop/index.cjs +61 -57
- package/dist/fhe-airdrop/index.d.cts +3 -3
- package/dist/fhe-airdrop/index.d.ts +3 -3
- package/dist/fhe-airdrop/index.js +7 -7
- package/dist/fhe-airdrop/react/index.cjs +163 -133
- package/dist/fhe-airdrop/react/index.d.cts +4 -3
- package/dist/fhe-airdrop/react/index.d.ts +4 -3
- package/dist/fhe-airdrop/react/index.js +38 -13
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +2 -0
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
- package/dist/fhe-airdrop/react/useClaim.d.ts +2 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
- package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
- package/dist/fhe-airdrop/types.d.ts +45 -0
- package/dist/fhe-disperse/encryption.d.ts +8 -0
- package/dist/fhe-disperse/index.cjs +69 -65
- package/dist/fhe-disperse/index.d.cts +1 -1
- package/dist/fhe-disperse/index.d.ts +1 -1
- package/dist/fhe-disperse/index.js +8 -8
- package/dist/fhe-disperse/react/index.cjs +90 -86
- package/dist/fhe-disperse/react/index.d.cts +1 -1
- package/dist/fhe-disperse/react/index.d.ts +1 -1
- package/dist/fhe-disperse/react/index.js +10 -10
- package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
- package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
- package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
- package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
- package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-disperse/singleton.d.ts +29 -0
- package/dist/fhe-disperse/subtotals.d.ts +6 -0
- package/dist/fhe-vesting/advanced/index.cjs +8 -8
- package/dist/fhe-vesting/advanced/index.js +6 -6
- package/dist/fhe-vesting/advanced/react/index.cjs +15 -14
- package/dist/fhe-vesting/advanced/react/index.js +12 -11
- package/dist/fhe-vesting/encryption.d.ts +8 -0
- package/dist/fhe-vesting/index.cjs +79 -75
- package/dist/fhe-vesting/index.d.cts +2 -2
- package/dist/fhe-vesting/index.d.ts +2 -2
- package/dist/fhe-vesting/index.js +9 -9
- package/dist/fhe-vesting/manager.d.ts +100 -1
- package/dist/fhe-vesting/react/index.cjs +241 -219
- package/dist/fhe-vesting/react/index.d.cts +3 -2
- package/dist/fhe-vesting/react/index.d.ts +3 -2
- package/dist/fhe-vesting/react/index.js +29 -12
- package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-vesting/react/usePartialClaim.d.ts +8 -0
- package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
- package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
- package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-vesting/types.d.ts +34 -0
- package/dist/index.cjs +61 -53
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/testnet-faucet/index.cjs +58 -54
- package/dist/testnet-faucet/index.d.cts +1 -1
- package/dist/testnet-faucet/index.d.ts +1 -1
- package/dist/testnet-faucet/index.js +5 -5
- package/dist/testnet-faucet/react/index.cjs +60 -55
- package/dist/testnet-faucet/react/index.d.cts +3 -2
- package/dist/testnet-faucet/react/index.d.ts +3 -2
- package/dist/testnet-faucet/react/index.js +11 -10
- package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +3 -2
- package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +2 -2
- package/package.json +3 -2
package/dist/fhe/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJYOTGRSO_cjs = require('../chunk-JYOTGRSO.cjs');
|
|
4
|
+
var chunk2NCLOQ56_cjs = require('../chunk-2NCLOQ56.cjs');
|
|
5
|
+
var chunkFAXIIH5R_cjs = require('../chunk-FAXIIH5R.cjs');
|
|
4
6
|
var chunkFWHYQZ5E_cjs = require('../chunk-FWHYQZ5E.cjs');
|
|
5
|
-
var
|
|
6
|
-
var chunkQ7ARQSUH_cjs = require('../chunk-Q7ARQSUH.cjs');
|
|
7
|
-
var chunkCQIPRNS7_cjs = require('../chunk-CQIPRNS7.cjs');
|
|
7
|
+
var chunkJK4XMMKM_cjs = require('../chunk-JK4XMMKM.cjs');
|
|
8
8
|
var chunkVJKZWYYJ_cjs = require('../chunk-VJKZWYYJ.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunk67OV5CX2_cjs = require('../chunk-67OV5CX2.cjs');
|
|
10
10
|
var sdk = require('@zama-fhe/sdk');
|
|
11
11
|
|
|
12
12
|
// src/fhe/mock-encryptor.ts
|
|
@@ -216,18 +216,18 @@ var MOCK_ERC7984_MINT_ABI = [
|
|
|
216
216
|
var UINT64_MAX = (1n << 64n) - 1n;
|
|
217
217
|
async function mintMockERC7984(args) {
|
|
218
218
|
const { publicClient, walletClient, account, waitForReceipt = true, telemetry } = args;
|
|
219
|
-
const token =
|
|
220
|
-
const to =
|
|
219
|
+
const token = chunkJK4XMMKM_cjs.normaliseAddress(args.token);
|
|
220
|
+
const to = chunkJK4XMMKM_cjs.normaliseAddress(args.to);
|
|
221
221
|
return chunkVJKZWYYJ_cjs.withTelemetry(telemetry, "fhe.mintMockERC7984", async () => {
|
|
222
222
|
const fromAccount = account ?? walletClient.account;
|
|
223
223
|
if (!fromAccount) {
|
|
224
|
-
throw new
|
|
224
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
225
225
|
"mintMockERC7984: no account available \u2014 pass `account` explicitly or attach an account to the walletClient",
|
|
226
226
|
{ contract: "ERC7984", call: "mint" }
|
|
227
227
|
);
|
|
228
228
|
}
|
|
229
229
|
if (args.amount < 0n || args.amount > UINT64_MAX) {
|
|
230
|
-
throw new
|
|
230
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
231
231
|
`mintMockERC7984: amount ${args.amount} out of uint64 range [0, ${UINT64_MAX}]`,
|
|
232
232
|
{ contract: "ERC7984", call: "mint", amount: args.amount.toString() }
|
|
233
233
|
);
|
|
@@ -245,7 +245,7 @@ async function mintMockERC7984(args) {
|
|
|
245
245
|
chain: walletClient.chain
|
|
246
246
|
});
|
|
247
247
|
} catch (err) {
|
|
248
|
-
throw new
|
|
248
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
249
249
|
`mintMockERC7984: writeContract failed (token=${token}, to=${to})`,
|
|
250
250
|
{
|
|
251
251
|
contract: "ERC7984",
|
|
@@ -262,7 +262,7 @@ async function mintMockERC7984(args) {
|
|
|
262
262
|
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
263
263
|
blockNumber = receipt.blockNumber;
|
|
264
264
|
} catch (err) {
|
|
265
|
-
throw new
|
|
265
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(`mintMockERC7984: receipt wait failed (tx=${hash})`, {
|
|
266
266
|
contract: "ERC7984",
|
|
267
267
|
call: "mint",
|
|
268
268
|
tx: hash,
|
|
@@ -274,7 +274,7 @@ async function mintMockERC7984(args) {
|
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
function createMockErc7984Client(args) {
|
|
277
|
-
const address =
|
|
277
|
+
const address = chunkJK4XMMKM_cjs.normaliseAddress(args.address);
|
|
278
278
|
const { publicClient, walletClient, telemetry } = args;
|
|
279
279
|
return {
|
|
280
280
|
address,
|
|
@@ -309,6 +309,14 @@ async function requirePeerDep2(spec, hint) {
|
|
|
309
309
|
}
|
|
310
310
|
async function createSepoliaEncryptor(options = {}) {
|
|
311
311
|
const chainId = options.chainId ?? SEPOLIA_CHAIN_ID;
|
|
312
|
+
const firePhase = (phase) => {
|
|
313
|
+
if (!options.onPhase) return;
|
|
314
|
+
try {
|
|
315
|
+
options.onPhase(phase);
|
|
316
|
+
} catch {
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
firePhase("initializing");
|
|
312
320
|
const zamaSdkNode = await requirePeerDep2(
|
|
313
321
|
"@zama-fhe/sdk/node",
|
|
314
322
|
"pnpm add @zama-fhe/sdk@^3"
|
|
@@ -337,11 +345,29 @@ async function createSepoliaEncryptor(options = {}) {
|
|
|
337
345
|
fheArtifactStorage: options.fheArtifactStorage,
|
|
338
346
|
fheArtifactCacheTTL: options.fheArtifactCacheTTL
|
|
339
347
|
});
|
|
348
|
+
let initState = "idle";
|
|
340
349
|
return {
|
|
341
350
|
instance,
|
|
342
351
|
chainId,
|
|
343
352
|
async encrypt({ values, contractAddress, userAddress }) {
|
|
344
|
-
|
|
353
|
+
const startedInit = initState === "idle";
|
|
354
|
+
if (startedInit) {
|
|
355
|
+
initState = "in-flight";
|
|
356
|
+
firePhase("downloading-params");
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
const result = await instance.encrypt({ values, contractAddress, userAddress });
|
|
360
|
+
if (initState !== "ready") {
|
|
361
|
+
initState = "ready";
|
|
362
|
+
firePhase("ready");
|
|
363
|
+
}
|
|
364
|
+
return result;
|
|
365
|
+
} catch (err) {
|
|
366
|
+
if (startedInit && initState === "in-flight") {
|
|
367
|
+
initState = "idle";
|
|
368
|
+
}
|
|
369
|
+
throw err;
|
|
370
|
+
}
|
|
345
371
|
},
|
|
346
372
|
terminate() {
|
|
347
373
|
instance.terminate();
|
|
@@ -375,10 +401,26 @@ function createSepoliaEncryptorWeb(opts) {
|
|
|
375
401
|
},
|
|
376
402
|
...opts.logger
|
|
377
403
|
} : void 0;
|
|
404
|
+
const firePhase = (phase) => {
|
|
405
|
+
if (!opts.onPhase) return;
|
|
406
|
+
try {
|
|
407
|
+
opts.onPhase(phase);
|
|
408
|
+
} catch {
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
firePhase("initializing");
|
|
412
|
+
const onStatusChange = opts.onPhase ? (status) => {
|
|
413
|
+
if (status === "initializing") {
|
|
414
|
+
firePhase("downloading-params");
|
|
415
|
+
} else if (status === "ready") {
|
|
416
|
+
firePhase("ready");
|
|
417
|
+
}
|
|
418
|
+
} : void 0;
|
|
378
419
|
const instance = new sdk.RelayerWeb({
|
|
379
420
|
transports: { [chainId]: transportConfig },
|
|
380
421
|
getChainId: () => Promise.resolve(chainId),
|
|
381
|
-
logger: safeLogger
|
|
422
|
+
logger: safeLogger,
|
|
423
|
+
onStatusChange
|
|
382
424
|
});
|
|
383
425
|
return Promise.resolve({
|
|
384
426
|
instance,
|
|
@@ -394,199 +436,203 @@ function createSepoliaEncryptorWeb(opts) {
|
|
|
394
436
|
|
|
395
437
|
Object.defineProperty(exports, "ERC7984_OPERATOR_MAX_DEADLINE", {
|
|
396
438
|
enumerable: true,
|
|
397
|
-
get: function () { return
|
|
439
|
+
get: function () { return chunkJYOTGRSO_cjs.ERC7984_OPERATOR_MAX_DEADLINE; }
|
|
398
440
|
});
|
|
399
441
|
Object.defineProperty(exports, "ERC7984_SET_OPERATOR_ABI", {
|
|
400
442
|
enumerable: true,
|
|
401
|
-
get: function () { return
|
|
443
|
+
get: function () { return chunkJYOTGRSO_cjs.ERC7984_SET_OPERATOR_ABI; }
|
|
402
444
|
});
|
|
403
445
|
Object.defineProperty(exports, "revokeOperator", {
|
|
404
446
|
enumerable: true,
|
|
405
|
-
get: function () { return
|
|
447
|
+
get: function () { return chunkJYOTGRSO_cjs.revokeOperator; }
|
|
406
448
|
});
|
|
407
449
|
Object.defineProperty(exports, "setOperator", {
|
|
408
450
|
enumerable: true,
|
|
409
|
-
get: function () { return
|
|
410
|
-
});
|
|
411
|
-
Object.defineProperty(exports, "erc7984OperatorAbi", {
|
|
412
|
-
enumerable: true,
|
|
413
|
-
get: function () { return chunkFWHYQZ5E_cjs.erc7984OperatorAbi; }
|
|
451
|
+
get: function () { return chunkJYOTGRSO_cjs.setOperator; }
|
|
414
452
|
});
|
|
415
453
|
Object.defineProperty(exports, "FHE_SPLIT_DENOMINATOR", {
|
|
416
454
|
enumerable: true,
|
|
417
|
-
get: function () { return
|
|
455
|
+
get: function () { return chunk2NCLOQ56_cjs.FHE_SPLIT_DENOMINATOR; }
|
|
418
456
|
});
|
|
419
457
|
Object.defineProperty(exports, "scaleRatio", {
|
|
420
458
|
enumerable: true,
|
|
421
|
-
get: function () { return
|
|
459
|
+
get: function () { return chunk2NCLOQ56_cjs.scaleRatio; }
|
|
422
460
|
});
|
|
423
461
|
Object.defineProperty(exports, "share", {
|
|
424
462
|
enumerable: true,
|
|
425
|
-
get: function () { return
|
|
463
|
+
get: function () { return chunk2NCLOQ56_cjs.share; }
|
|
426
464
|
});
|
|
427
465
|
Object.defineProperty(exports, "ACL_ALLOWED_EVENT", {
|
|
428
466
|
enumerable: true,
|
|
429
|
-
get: function () { return
|
|
467
|
+
get: function () { return chunkFAXIIH5R_cjs.ACL_ALLOWED_EVENT; }
|
|
430
468
|
});
|
|
431
469
|
Object.defineProperty(exports, "FHEVM_ACL_ADDRESS_BY_CHAIN", {
|
|
432
470
|
enumerable: true,
|
|
433
|
-
get: function () { return
|
|
471
|
+
get: function () { return chunkFAXIIH5R_cjs.FHEVM_ACL_ADDRESS_BY_CHAIN; }
|
|
434
472
|
});
|
|
435
473
|
Object.defineProperty(exports, "getFhevmAclAddress", {
|
|
436
474
|
enumerable: true,
|
|
437
|
-
get: function () { return
|
|
475
|
+
get: function () { return chunkFAXIIH5R_cjs.getFhevmAclAddress; }
|
|
438
476
|
});
|
|
439
477
|
Object.defineProperty(exports, "requireFhevmAclAddress", {
|
|
440
478
|
enumerable: true,
|
|
441
|
-
get: function () { return
|
|
479
|
+
get: function () { return chunkFAXIIH5R_cjs.requireFhevmAclAddress; }
|
|
480
|
+
});
|
|
481
|
+
Object.defineProperty(exports, "erc7984OperatorAbi", {
|
|
482
|
+
enumerable: true,
|
|
483
|
+
get: function () { return chunkFWHYQZ5E_cjs.erc7984OperatorAbi; }
|
|
442
484
|
});
|
|
443
485
|
Object.defineProperty(exports, "AccessDeniedError", {
|
|
444
486
|
enumerable: true,
|
|
445
|
-
get: function () { return
|
|
487
|
+
get: function () { return chunk67OV5CX2_cjs.AccessDeniedError; }
|
|
446
488
|
});
|
|
447
489
|
Object.defineProperty(exports, "AlreadyInitializedError", {
|
|
448
490
|
enumerable: true,
|
|
449
|
-
get: function () { return
|
|
491
|
+
get: function () { return chunk67OV5CX2_cjs.AlreadyInitializedError; }
|
|
450
492
|
});
|
|
451
493
|
Object.defineProperty(exports, "BatchTooLargeError", {
|
|
452
494
|
enumerable: true,
|
|
453
|
-
get: function () { return
|
|
495
|
+
get: function () { return chunk67OV5CX2_cjs.BatchTooLargeError; }
|
|
454
496
|
});
|
|
455
497
|
Object.defineProperty(exports, "ContractRevertError", {
|
|
456
498
|
enumerable: true,
|
|
457
|
-
get: function () { return
|
|
499
|
+
get: function () { return chunk67OV5CX2_cjs.ContractRevertError; }
|
|
458
500
|
});
|
|
459
501
|
Object.defineProperty(exports, "DecryptionFailedError", {
|
|
460
502
|
enumerable: true,
|
|
461
|
-
get: function () { return
|
|
503
|
+
get: function () { return chunk67OV5CX2_cjs.DecryptionFailedError; }
|
|
462
504
|
});
|
|
463
505
|
Object.defineProperty(exports, "DeploymentAddressUnavailableError", {
|
|
464
506
|
enumerable: true,
|
|
465
|
-
get: function () { return
|
|
507
|
+
get: function () { return chunk67OV5CX2_cjs.DeploymentAddressUnavailableError; }
|
|
466
508
|
});
|
|
467
509
|
Object.defineProperty(exports, "EncryptionFailedError", {
|
|
468
510
|
enumerable: true,
|
|
469
|
-
get: function () { return
|
|
511
|
+
get: function () { return chunk67OV5CX2_cjs.EncryptionFailedError; }
|
|
470
512
|
});
|
|
471
513
|
Object.defineProperty(exports, "FeatureDisabledError", {
|
|
472
514
|
enumerable: true,
|
|
473
|
-
get: function () { return
|
|
515
|
+
get: function () { return chunk67OV5CX2_cjs.FeatureDisabledError; }
|
|
474
516
|
});
|
|
475
517
|
Object.defineProperty(exports, "FheHandleNotAllowedError", {
|
|
476
518
|
enumerable: true,
|
|
477
|
-
get: function () { return
|
|
519
|
+
get: function () { return chunk67OV5CX2_cjs.FheHandleNotAllowedError; }
|
|
478
520
|
});
|
|
479
521
|
Object.defineProperty(exports, "InsufficientBalanceError", {
|
|
480
522
|
enumerable: true,
|
|
481
|
-
get: function () { return
|
|
523
|
+
get: function () { return chunk67OV5CX2_cjs.InsufficientBalanceError; }
|
|
482
524
|
});
|
|
483
525
|
Object.defineProperty(exports, "InsufficientFeeError", {
|
|
484
526
|
enumerable: true,
|
|
485
|
-
get: function () { return
|
|
527
|
+
get: function () { return chunk67OV5CX2_cjs.InsufficientFeeError; }
|
|
486
528
|
});
|
|
487
529
|
Object.defineProperty(exports, "InsufficientGasFundsError", {
|
|
488
530
|
enumerable: true,
|
|
489
|
-
get: function () { return
|
|
531
|
+
get: function () { return chunk67OV5CX2_cjs.InsufficientGasFundsError; }
|
|
490
532
|
});
|
|
491
533
|
Object.defineProperty(exports, "InvalidArgumentError", {
|
|
492
534
|
enumerable: true,
|
|
493
|
-
get: function () { return
|
|
535
|
+
get: function () { return chunk67OV5CX2_cjs.InvalidArgumentError; }
|
|
494
536
|
});
|
|
495
537
|
Object.defineProperty(exports, "InvalidSignatureError", {
|
|
496
538
|
enumerable: true,
|
|
497
|
-
get: function () { return
|
|
539
|
+
get: function () { return chunk67OV5CX2_cjs.InvalidSignatureError; }
|
|
498
540
|
});
|
|
499
541
|
Object.defineProperty(exports, "MissingAccountError", {
|
|
500
542
|
enumerable: true,
|
|
501
|
-
get: function () { return
|
|
543
|
+
get: function () { return chunk67OV5CX2_cjs.MissingAccountError; }
|
|
502
544
|
});
|
|
503
545
|
Object.defineProperty(exports, "MissingClientError", {
|
|
504
546
|
enumerable: true,
|
|
505
|
-
get: function () { return
|
|
547
|
+
get: function () { return chunk67OV5CX2_cjs.MissingClientError; }
|
|
506
548
|
});
|
|
507
549
|
Object.defineProperty(exports, "MissingEncryptorError", {
|
|
508
550
|
enumerable: true,
|
|
509
|
-
get: function () { return
|
|
551
|
+
get: function () { return chunk67OV5CX2_cjs.MissingEncryptorError; }
|
|
510
552
|
});
|
|
511
553
|
Object.defineProperty(exports, "MissingPublicClientError", {
|
|
512
554
|
enumerable: true,
|
|
513
|
-
get: function () { return
|
|
555
|
+
get: function () { return chunk67OV5CX2_cjs.MissingPublicClientError; }
|
|
514
556
|
});
|
|
515
557
|
Object.defineProperty(exports, "MissingWalletClientError", {
|
|
516
558
|
enumerable: true,
|
|
517
|
-
get: function () { return
|
|
559
|
+
get: function () { return chunk67OV5CX2_cjs.MissingWalletClientError; }
|
|
518
560
|
});
|
|
519
561
|
Object.defineProperty(exports, "NetworkError", {
|
|
520
562
|
enumerable: true,
|
|
521
|
-
get: function () { return
|
|
563
|
+
get: function () { return chunk67OV5CX2_cjs.NetworkError; }
|
|
564
|
+
});
|
|
565
|
+
Object.defineProperty(exports, "OperatorNotApprovedError", {
|
|
566
|
+
enumerable: true,
|
|
567
|
+
get: function () { return chunk67OV5CX2_cjs.OperatorNotApprovedError; }
|
|
522
568
|
});
|
|
523
569
|
Object.defineProperty(exports, "PausedError", {
|
|
524
570
|
enumerable: true,
|
|
525
|
-
get: function () { return
|
|
571
|
+
get: function () { return chunk67OV5CX2_cjs.PausedError; }
|
|
526
572
|
});
|
|
527
573
|
Object.defineProperty(exports, "ReceiptEventAmbiguousError", {
|
|
528
574
|
enumerable: true,
|
|
529
|
-
get: function () { return
|
|
575
|
+
get: function () { return chunk67OV5CX2_cjs.ReceiptEventAmbiguousError; }
|
|
530
576
|
});
|
|
531
577
|
Object.defineProperty(exports, "ReceiptEventNotFoundError", {
|
|
532
578
|
enumerable: true,
|
|
533
|
-
get: function () { return
|
|
579
|
+
get: function () { return chunk67OV5CX2_cjs.ReceiptEventNotFoundError; }
|
|
534
580
|
});
|
|
535
581
|
Object.defineProperty(exports, "ReentrancyError", {
|
|
536
582
|
enumerable: true,
|
|
537
|
-
get: function () { return
|
|
583
|
+
get: function () { return chunk67OV5CX2_cjs.ReentrancyError; }
|
|
538
584
|
});
|
|
539
585
|
Object.defineProperty(exports, "RelayerUnreachableError", {
|
|
540
586
|
enumerable: true,
|
|
541
|
-
get: function () { return
|
|
587
|
+
get: function () { return chunk67OV5CX2_cjs.RelayerUnreachableError; }
|
|
542
588
|
});
|
|
543
589
|
Object.defineProperty(exports, "SigningFailedError", {
|
|
544
590
|
enumerable: true,
|
|
545
|
-
get: function () { return
|
|
591
|
+
get: function () { return chunk67OV5CX2_cjs.SigningFailedError; }
|
|
546
592
|
});
|
|
547
593
|
Object.defineProperty(exports, "TokenOpsContractError", {
|
|
548
594
|
enumerable: true,
|
|
549
|
-
get: function () { return
|
|
595
|
+
get: function () { return chunk67OV5CX2_cjs.TokenOpsContractError; }
|
|
550
596
|
});
|
|
551
597
|
Object.defineProperty(exports, "TokenOpsSdkError", {
|
|
552
598
|
enumerable: true,
|
|
553
|
-
get: function () { return
|
|
599
|
+
get: function () { return chunk67OV5CX2_cjs.TokenOpsSdkError; }
|
|
554
600
|
});
|
|
555
601
|
Object.defineProperty(exports, "TokenOpsValidationError", {
|
|
556
602
|
enumerable: true,
|
|
557
|
-
get: function () { return
|
|
603
|
+
get: function () { return chunk67OV5CX2_cjs.TokenOpsValidationError; }
|
|
558
604
|
});
|
|
559
605
|
Object.defineProperty(exports, "TransferFailedError", {
|
|
560
606
|
enumerable: true,
|
|
561
|
-
get: function () { return
|
|
607
|
+
get: function () { return chunk67OV5CX2_cjs.TransferFailedError; }
|
|
562
608
|
});
|
|
563
609
|
Object.defineProperty(exports, "UnknownWriteFailureError", {
|
|
564
610
|
enumerable: true,
|
|
565
|
-
get: function () { return
|
|
611
|
+
get: function () { return chunk67OV5CX2_cjs.UnknownWriteFailureError; }
|
|
566
612
|
});
|
|
567
613
|
Object.defineProperty(exports, "UnsupportedChainError", {
|
|
568
614
|
enumerable: true,
|
|
569
|
-
get: function () { return
|
|
615
|
+
get: function () { return chunk67OV5CX2_cjs.UnsupportedChainError; }
|
|
570
616
|
});
|
|
571
617
|
Object.defineProperty(exports, "UserDecryptNotAllowedError", {
|
|
572
618
|
enumerable: true,
|
|
573
|
-
get: function () { return
|
|
619
|
+
get: function () { return chunk67OV5CX2_cjs.UserDecryptNotAllowedError; }
|
|
574
620
|
});
|
|
575
621
|
Object.defineProperty(exports, "UserRejectedSignatureError", {
|
|
576
622
|
enumerable: true,
|
|
577
|
-
get: function () { return
|
|
623
|
+
get: function () { return chunk67OV5CX2_cjs.UserRejectedSignatureError; }
|
|
578
624
|
});
|
|
579
625
|
Object.defineProperty(exports, "WalletChainMismatchError", {
|
|
580
626
|
enumerable: true,
|
|
581
|
-
get: function () { return
|
|
627
|
+
get: function () { return chunk67OV5CX2_cjs.WalletChainMismatchError; }
|
|
582
628
|
});
|
|
583
629
|
Object.defineProperty(exports, "WalletRejectedError", {
|
|
584
630
|
enumerable: true,
|
|
585
|
-
get: function () { return
|
|
631
|
+
get: function () { return chunk67OV5CX2_cjs.WalletRejectedError; }
|
|
586
632
|
});
|
|
587
633
|
Object.defineProperty(exports, "isTokenOpsSdkError", {
|
|
588
634
|
enumerable: true,
|
|
589
|
-
get: function () { return
|
|
635
|
+
get: function () { return chunk67OV5CX2_cjs.isTokenOpsSdkError; }
|
|
590
636
|
});
|
|
591
637
|
exports.MAINNET_CHAIN_ID = MAINNET_CHAIN_ID;
|
|
592
638
|
exports.MOCK_ERC7984_MINT_ABI = MOCK_ERC7984_MINT_ABI;
|
package/dist/fhe/index.d.cts
CHANGED
|
@@ -7,5 +7,5 @@ export * from "./sepolia-encryptor.js";
|
|
|
7
7
|
export * from "./sepolia-encryptor-web.js";
|
|
8
8
|
export * from "./types.js";
|
|
9
9
|
export { erc7984OperatorAbi } from "./erc7984-abi.js";
|
|
10
|
-
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, TokenOpsValidationError, ContractRevertError, TokenOpsContractError, PausedError, AccessDeniedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../core/errors.js";
|
|
10
|
+
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, TokenOpsValidationError, ContractRevertError, TokenOpsContractError, PausedError, AccessDeniedError, OperatorNotApprovedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../core/errors.js";
|
|
11
11
|
export { type PreflightResult } from "../core/preflight.js";
|
package/dist/fhe/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export * from "./sepolia-encryptor.js";
|
|
|
7
7
|
export * from "./sepolia-encryptor-web.js";
|
|
8
8
|
export * from "./types.js";
|
|
9
9
|
export { erc7984OperatorAbi } from "./erc7984-abi.js";
|
|
10
|
-
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, TokenOpsValidationError, ContractRevertError, TokenOpsContractError, PausedError, AccessDeniedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../core/errors.js";
|
|
10
|
+
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, TokenOpsValidationError, ContractRevertError, TokenOpsContractError, PausedError, AccessDeniedError, OperatorNotApprovedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../core/errors.js";
|
|
11
11
|
export { type PreflightResult } from "../core/preflight.js";
|
package/dist/fhe/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { ERC7984_OPERATOR_MAX_DEADLINE, ERC7984_SET_OPERATOR_ABI, revokeOperator, setOperator } from '../chunk-
|
|
1
|
+
export { ERC7984_OPERATOR_MAX_DEADLINE, ERC7984_SET_OPERATOR_ABI, revokeOperator, setOperator } from '../chunk-6BMP4ICG.js';
|
|
2
|
+
export { FHE_SPLIT_DENOMINATOR, scaleRatio, share } from '../chunk-AOP6HMPW.js';
|
|
3
|
+
export { ACL_ALLOWED_EVENT, FHEVM_ACL_ADDRESS_BY_CHAIN, getFhevmAclAddress, requireFhevmAclAddress } from '../chunk-ZWXJTBZO.js';
|
|
2
4
|
export { erc7984OperatorAbi } from '../chunk-7VELUOMI.js';
|
|
3
|
-
|
|
4
|
-
export { ACL_ALLOWED_EVENT, FHEVM_ACL_ADDRESS_BY_CHAIN, getFhevmAclAddress, requireFhevmAclAddress } from '../chunk-FYQ2UW4T.js';
|
|
5
|
-
import { normaliseAddress } from '../chunk-BE2AIZ3K.js';
|
|
5
|
+
import { normaliseAddress } from '../chunk-ZA673I3O.js';
|
|
6
6
|
import { withTelemetry } from '../chunk-Q2GP5UDC.js';
|
|
7
|
-
import { TokenOpsContractError } from '../chunk-
|
|
8
|
-
export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../chunk-
|
|
7
|
+
import { TokenOpsContractError } from '../chunk-QBJ7O2B4.js';
|
|
8
|
+
export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../chunk-QBJ7O2B4.js';
|
|
9
9
|
import { RelayerWeb, MainnetConfig, SepoliaConfig } from '@zama-fhe/sdk';
|
|
10
10
|
|
|
11
11
|
// src/fhe/mock-encryptor.ts
|
|
@@ -308,6 +308,14 @@ async function requirePeerDep2(spec, hint) {
|
|
|
308
308
|
}
|
|
309
309
|
async function createSepoliaEncryptor(options = {}) {
|
|
310
310
|
const chainId = options.chainId ?? SEPOLIA_CHAIN_ID;
|
|
311
|
+
const firePhase = (phase) => {
|
|
312
|
+
if (!options.onPhase) return;
|
|
313
|
+
try {
|
|
314
|
+
options.onPhase(phase);
|
|
315
|
+
} catch {
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
firePhase("initializing");
|
|
311
319
|
const zamaSdkNode = await requirePeerDep2(
|
|
312
320
|
"@zama-fhe/sdk/node",
|
|
313
321
|
"pnpm add @zama-fhe/sdk@^3"
|
|
@@ -336,11 +344,29 @@ async function createSepoliaEncryptor(options = {}) {
|
|
|
336
344
|
fheArtifactStorage: options.fheArtifactStorage,
|
|
337
345
|
fheArtifactCacheTTL: options.fheArtifactCacheTTL
|
|
338
346
|
});
|
|
347
|
+
let initState = "idle";
|
|
339
348
|
return {
|
|
340
349
|
instance,
|
|
341
350
|
chainId,
|
|
342
351
|
async encrypt({ values, contractAddress, userAddress }) {
|
|
343
|
-
|
|
352
|
+
const startedInit = initState === "idle";
|
|
353
|
+
if (startedInit) {
|
|
354
|
+
initState = "in-flight";
|
|
355
|
+
firePhase("downloading-params");
|
|
356
|
+
}
|
|
357
|
+
try {
|
|
358
|
+
const result = await instance.encrypt({ values, contractAddress, userAddress });
|
|
359
|
+
if (initState !== "ready") {
|
|
360
|
+
initState = "ready";
|
|
361
|
+
firePhase("ready");
|
|
362
|
+
}
|
|
363
|
+
return result;
|
|
364
|
+
} catch (err) {
|
|
365
|
+
if (startedInit && initState === "in-flight") {
|
|
366
|
+
initState = "idle";
|
|
367
|
+
}
|
|
368
|
+
throw err;
|
|
369
|
+
}
|
|
344
370
|
},
|
|
345
371
|
terminate() {
|
|
346
372
|
instance.terminate();
|
|
@@ -374,10 +400,26 @@ function createSepoliaEncryptorWeb(opts) {
|
|
|
374
400
|
},
|
|
375
401
|
...opts.logger
|
|
376
402
|
} : void 0;
|
|
403
|
+
const firePhase = (phase) => {
|
|
404
|
+
if (!opts.onPhase) return;
|
|
405
|
+
try {
|
|
406
|
+
opts.onPhase(phase);
|
|
407
|
+
} catch {
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
firePhase("initializing");
|
|
411
|
+
const onStatusChange = opts.onPhase ? (status) => {
|
|
412
|
+
if (status === "initializing") {
|
|
413
|
+
firePhase("downloading-params");
|
|
414
|
+
} else if (status === "ready") {
|
|
415
|
+
firePhase("ready");
|
|
416
|
+
}
|
|
417
|
+
} : void 0;
|
|
377
418
|
const instance = new RelayerWeb({
|
|
378
419
|
transports: { [chainId]: transportConfig },
|
|
379
420
|
getChainId: () => Promise.resolve(chainId),
|
|
380
|
-
logger: safeLogger
|
|
421
|
+
logger: safeLogger,
|
|
422
|
+
onStatusChange
|
|
381
423
|
});
|
|
382
424
|
return Promise.resolve({
|
|
383
425
|
instance,
|
package/dist/fhe/react/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../../chunk-66IHPTOK.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunk67OV5CX2_cjs = require('../../chunk-67OV5CX2.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
|
|
7
7
|
function resolveUserDecryptor(source) {
|
|
@@ -35,7 +35,7 @@ function useDecryptedHandle(opts) {
|
|
|
35
35
|
setState({
|
|
36
36
|
status: "error",
|
|
37
37
|
value: void 0,
|
|
38
|
-
error: new
|
|
38
|
+
error: new chunk67OV5CX2_cjs.TokenOpsValidationError(
|
|
39
39
|
"useDecryptedHandle: no `userDecryptor` resolved \u2014 pass `userDecryptor: () => useZamaSDK().relayer` (or an eager RelayerSDK / MockFhevmInstance).",
|
|
40
40
|
{ method: "useDecryptedHandle" }
|
|
41
41
|
)
|
|
@@ -52,7 +52,7 @@ function useDecryptedHandle(opts) {
|
|
|
52
52
|
});
|
|
53
53
|
const plain = result[handleStr];
|
|
54
54
|
if (plain === void 0) {
|
|
55
|
-
throw new
|
|
55
|
+
throw new chunk67OV5CX2_cjs.TokenOpsValidationError(
|
|
56
56
|
`useDecryptedHandle: relayer returned no value for handle ${handleStr} on contract ${contractStr} \u2014 check ACL grant + (handle, contractAddress, userAddress) triple`,
|
|
57
57
|
{ method: "useDecryptedHandle", contractAddress: contractStr }
|
|
58
58
|
);
|
|
@@ -85,18 +85,18 @@ function serializableSlice(v) {
|
|
|
85
85
|
|
|
86
86
|
Object.defineProperty(exports, "TokenOpsContractError", {
|
|
87
87
|
enumerable: true,
|
|
88
|
-
get: function () { return
|
|
88
|
+
get: function () { return chunk67OV5CX2_cjs.TokenOpsContractError; }
|
|
89
89
|
});
|
|
90
90
|
Object.defineProperty(exports, "TokenOpsSdkError", {
|
|
91
91
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunk67OV5CX2_cjs.TokenOpsSdkError; }
|
|
93
93
|
});
|
|
94
94
|
Object.defineProperty(exports, "TokenOpsValidationError", {
|
|
95
95
|
enumerable: true,
|
|
96
|
-
get: function () { return
|
|
96
|
+
get: function () { return chunk67OV5CX2_cjs.TokenOpsValidationError; }
|
|
97
97
|
});
|
|
98
98
|
Object.defineProperty(exports, "isTokenOpsSdkError", {
|
|
99
99
|
enumerable: true,
|
|
100
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunk67OV5CX2_cjs.isTokenOpsSdkError; }
|
|
101
101
|
});
|
|
102
102
|
exports.useDecryptedHandle = useDecryptedHandle;
|
package/dist/fhe/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../chunk-KWFFIJYX.js';
|
|
2
|
-
import { TokenOpsValidationError } from '../../chunk-
|
|
3
|
-
export { TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, isTokenOpsSdkError } from '../../chunk-
|
|
2
|
+
import { TokenOpsValidationError } from '../../chunk-QBJ7O2B4.js';
|
|
3
|
+
export { TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, isTokenOpsSdkError } from '../../chunk-QBJ7O2B4.js';
|
|
4
4
|
import { useState, useRef, useEffect } from 'react';
|
|
5
5
|
|
|
6
6
|
function resolveUserDecryptor(source) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PublicClient, WalletClient } from "viem";
|
|
2
2
|
import type { Encryptor } from "../fhe-vesting/encryption.js";
|
|
3
|
-
import { type SepoliaEncryptorLogger } from "./sepolia-encryptor.js";
|
|
3
|
+
import { type EncryptorInitPhase, type SepoliaEncryptorLogger } from "./sepolia-encryptor.js";
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for {@link createSepoliaEncryptorWeb}. Minimal by design:
|
|
6
6
|
* the browser path doesn't expose worker pool sizing or storage knobs (the
|
|
@@ -42,6 +42,32 @@ export interface CreateSepoliaEncryptorWebOpts {
|
|
|
42
42
|
* background on why).
|
|
43
43
|
*/
|
|
44
44
|
logger?: SepoliaEncryptorLogger;
|
|
45
|
+
/**
|
|
46
|
+
* Observe the encryptor's initialization lifecycle (see
|
|
47
|
+
* {@link EncryptorInitPhase}) — the signal to drive a loading state around
|
|
48
|
+
* the first in-browser encryption, which downloads several MB of FHE
|
|
49
|
+
* public material.
|
|
50
|
+
*
|
|
51
|
+
* `RelayerWeb` initializes lazily (Web Worker spawn + FHE param fetch
|
|
52
|
+
* happen inside the first operation), so phases map onto its REAL status
|
|
53
|
+
* events, not timers:
|
|
54
|
+
*
|
|
55
|
+
* - `"initializing"` fires synchronously while this helper constructs the
|
|
56
|
+
* `RelayerWeb` instance.
|
|
57
|
+
* - `"downloading-params"` fires when the worker's lazy init actually
|
|
58
|
+
* starts (upstream status `"initializing"`) — worker bring-up plus the
|
|
59
|
+
* FHE public key + params fetch. Near-instant when the IndexedDB
|
|
60
|
+
* artifact cache is warm.
|
|
61
|
+
* - `"ready"` fires when upstream reports `"ready"`.
|
|
62
|
+
*
|
|
63
|
+
* `"downloading-params"` / `"ready"` can fire again if the underlying
|
|
64
|
+
* relayer re-initializes (chain switch, stale artifact cache). Init
|
|
65
|
+
* failures surface as rejections from the pending operation — there is no
|
|
66
|
+
* error phase. No fake progress: no percentages, byte counts, or timers —
|
|
67
|
+
* upstream exposes no download-progress API. Callback exceptions are
|
|
68
|
+
* swallowed so a UI observer can never break encryption.
|
|
69
|
+
*/
|
|
70
|
+
onPhase?: (phase: EncryptorInitPhase) => void;
|
|
45
71
|
}
|
|
46
72
|
/**
|
|
47
73
|
* Returned by {@link createSepoliaEncryptorWeb}. Same structural
|