@cofhe/sdk 0.2.0 → 0.3.0
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/CHANGELOG.md +36 -0
- package/chains/defineChain.ts +2 -2
- package/chains/types.ts +3 -3
- package/core/baseBuilder.ts +18 -18
- package/core/client.test.ts +155 -41
- package/core/client.ts +72 -32
- package/core/clientTypes.ts +28 -18
- package/core/config.test.ts +40 -33
- package/core/config.ts +56 -51
- package/core/consts.ts +22 -0
- package/core/decrypt/{MockQueryDecrypterAbi.ts → MockThresholdNetworkAbi.ts} +71 -21
- package/core/decrypt/cofheMocksDecryptForTx.ts +142 -0
- package/core/decrypt/{cofheMocksSealOutput.ts → cofheMocksDecryptForView.ts} +12 -14
- package/core/decrypt/decryptForTxBuilder.ts +340 -0
- package/core/decrypt/{decryptHandleBuilder.ts → decryptForViewBuilder.ts} +75 -42
- package/core/decrypt/tnDecrypt.ts +232 -0
- package/core/decrypt/tnSealOutputV1.ts +5 -5
- package/core/decrypt/tnSealOutputV2.ts +27 -27
- package/core/encrypt/cofheMocksZkVerifySign.ts +19 -26
- package/core/encrypt/encryptInputsBuilder.test.ts +57 -61
- package/core/encrypt/encryptInputsBuilder.ts +65 -42
- package/core/encrypt/zkPackProveVerify.ts +11 -11
- package/core/error.ts +18 -18
- package/core/fetchKeys.test.ts +3 -3
- package/core/fetchKeys.ts +3 -3
- package/core/index.ts +22 -11
- package/core/permits.test.ts +5 -6
- package/core/permits.ts +5 -4
- package/core/utils.ts +10 -10
- package/dist/chains.cjs +4 -7
- package/dist/chains.d.cts +12 -12
- package/dist/chains.d.ts +12 -12
- package/dist/chains.js +1 -1
- package/dist/{chunk-WGCRJCBR.js → chunk-2TPSCOW3.js} +820 -224
- package/dist/{chunk-UGBVZNRT.js → chunk-NWDKXBIP.js} +309 -189
- package/dist/{chunk-WEAZ25JO.js → chunk-TBLR7NNE.js} +4 -7
- package/dist/{clientTypes-5_1nwtUe.d.cts → clientTypes-6aTZPQ_4.d.ts} +233 -173
- package/dist/{clientTypes-Es7fyi65.d.ts → clientTypes-Bhq7pCSA.d.cts} +233 -173
- package/dist/core.cjs +1138 -418
- package/dist/core.d.cts +37 -24
- package/dist/core.d.ts +37 -24
- package/dist/core.js +3 -3
- package/dist/node.cjs +1082 -370
- package/dist/node.d.cts +12 -12
- package/dist/node.d.ts +12 -12
- package/dist/node.js +8 -8
- package/dist/{permit-fUSe6KKq.d.cts → permit-MZ502UBl.d.cts} +30 -33
- package/dist/{permit-fUSe6KKq.d.ts → permit-MZ502UBl.d.ts} +30 -33
- package/dist/permits.cjs +305 -187
- package/dist/permits.d.cts +111 -812
- package/dist/permits.d.ts +111 -812
- package/dist/permits.js +1 -1
- package/dist/types-YiAC4gig.d.cts +33 -0
- package/dist/types-YiAC4gig.d.ts +33 -0
- package/dist/web.cjs +1085 -373
- package/dist/web.d.cts +13 -13
- package/dist/web.d.ts +13 -13
- package/dist/web.js +10 -10
- package/node/client.test.ts +34 -34
- package/node/config.test.ts +11 -11
- package/node/encryptInputs.test.ts +29 -29
- package/node/index.ts +15 -15
- package/package.json +3 -3
- package/permits/localstorage.test.ts +9 -13
- package/permits/onchain-utils.ts +221 -0
- package/permits/permit.test.ts +51 -5
- package/permits/permit.ts +28 -74
- package/permits/store.test.ts +10 -50
- package/permits/store.ts +4 -14
- package/permits/test-utils.ts +10 -2
- package/permits/types.ts +22 -9
- package/permits/utils.ts +0 -4
- package/permits/validation.test.ts +29 -32
- package/permits/validation.ts +112 -194
- package/web/client.web.test.ts +34 -34
- package/web/config.web.test.ts +11 -11
- package/web/encryptInputs.web.test.ts +29 -29
- package/web/index.ts +19 -19
- package/web/worker.builder.web.test.ts +28 -28
- package/web/worker.config.web.test.ts +47 -47
- package/web/worker.output.web.test.ts +10 -10
- package/dist/types-KImPrEIe.d.cts +0 -48
- package/dist/types-KImPrEIe.d.ts +0 -48
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletClient, PublicClient } from 'viem';
|
|
2
|
-
import { C as CofheChain } from './types-
|
|
2
|
+
import { C as CofheChain } from './types-YiAC4gig.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { P as Permit, S as SerializedPermit, C as CreateSelfPermitOptions, m as SelfPermit, d as CreateSharingPermitOptions, n as SharingPermit, I as ImportSharedPermitOptions, R as RecipientPermit, g as PermitUtils } from './permit-
|
|
4
|
+
import { P as Permit, S as SerializedPermit, C as CreateSelfPermitOptions, m as SelfPermit, d as CreateSharingPermitOptions, n as SharingPermit, I as ImportSharedPermitOptions, R as RecipientPermit, o as PermitHashFields, g as PermitUtils } from './permit-MZ502UBl.cjs';
|
|
5
5
|
import { StoreApi } from 'zustand/vanilla';
|
|
6
6
|
|
|
7
7
|
type TfheInitializer = () => Promise<boolean>;
|
|
@@ -170,18 +170,11 @@ type UnsealedItem<U extends FheTypes> = U extends FheTypes.Bool ? boolean : U ex
|
|
|
170
170
|
/**
|
|
171
171
|
* Usable config type inferred from the schema
|
|
172
172
|
*/
|
|
173
|
-
type
|
|
173
|
+
type CofheConfig = {
|
|
174
174
|
/** Environment that the SDK is running in */
|
|
175
175
|
environment: 'node' | 'hardhat' | 'web' | 'react';
|
|
176
176
|
/** List of supported chains */
|
|
177
177
|
supportedChains: CofheChain[];
|
|
178
|
-
/**
|
|
179
|
-
* How permits are generated
|
|
180
|
-
* - ON_CONNECT: Generate a permit when client.connect() is called
|
|
181
|
-
* - ON_DECRYPT_HANDLES: Generate a permit when client.decryptHandles() is called
|
|
182
|
-
* - MANUAL: Generate a permit manually using client.generatePermit()
|
|
183
|
-
*/
|
|
184
|
-
permitGeneration: 'ON_CONNECT' | 'ON_DECRYPT_HANDLES' | 'MANUAL';
|
|
185
178
|
/** Default permit expiration in seconds, default is 30 days */
|
|
186
179
|
defaultPermitExpiration: number;
|
|
187
180
|
/**
|
|
@@ -203,146 +196,84 @@ type CofhesdkConfig = {
|
|
|
203
196
|
* Default 1000ms on web
|
|
204
197
|
* Default 0ms on hardhat (will be called during tests no need for fake delay)
|
|
205
198
|
*/
|
|
206
|
-
|
|
199
|
+
decryptDelay: number;
|
|
200
|
+
/**
|
|
201
|
+
* Simulated delay(s) in milliseconds for each step of encryptInputs in mock mode.
|
|
202
|
+
* A single number applies the same delay to all five steps (InitTfhe, FetchKeys, Pack, Prove, Verify).
|
|
203
|
+
* A tuple of five numbers applies a per-step delay: [InitTfhe, FetchKeys, Pack, Prove, Verify].
|
|
204
|
+
* Default: [100, 100, 100, 500, 500]
|
|
205
|
+
*/
|
|
206
|
+
encryptDelay: number | [number, number, number, number, number];
|
|
207
207
|
};
|
|
208
|
-
_internal?:
|
|
208
|
+
_internal?: CofheInternalConfig;
|
|
209
209
|
};
|
|
210
|
-
type
|
|
210
|
+
type CofheInternalConfig = {
|
|
211
211
|
zkvWalletClient?: WalletClient;
|
|
212
212
|
};
|
|
213
213
|
/**
|
|
214
214
|
* Zod schema for configuration validation
|
|
215
215
|
*/
|
|
216
|
-
declare const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
216
|
+
declare const CofheConfigSchema: z.ZodObject<{
|
|
217
|
+
environment: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
218
|
+
hardhat: "hardhat";
|
|
219
|
+
node: "node";
|
|
220
|
+
web: "web";
|
|
221
|
+
react: "react";
|
|
222
|
+
}>>>;
|
|
223
|
+
supportedChains: z.ZodArray<z.ZodCustom<{
|
|
222
224
|
id: number;
|
|
225
|
+
name: string;
|
|
223
226
|
network: string;
|
|
224
227
|
coFheUrl: string;
|
|
225
228
|
verifierUrl: string;
|
|
226
229
|
thresholdNetworkUrl: string;
|
|
227
230
|
environment: "MOCK" | "TESTNET" | "MAINNET";
|
|
228
|
-
},
|
|
229
|
-
name: string;
|
|
231
|
+
}, {
|
|
230
232
|
id: number;
|
|
233
|
+
name: string;
|
|
231
234
|
network: string;
|
|
232
235
|
coFheUrl: string;
|
|
233
236
|
verifierUrl: string;
|
|
234
237
|
thresholdNetworkUrl: string;
|
|
235
238
|
environment: "MOCK" | "TESTNET" | "MAINNET";
|
|
236
|
-
}
|
|
237
|
-
/** How permits are generated */
|
|
238
|
-
permitGeneration: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ON_CONNECT", "ON_DECRYPT_HANDLES", "MANUAL"]>>>;
|
|
239
|
-
/** Default permit expiration in seconds, default is 30 days */
|
|
239
|
+
}>>;
|
|
240
240
|
defaultPermitExpiration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
241
|
-
/** Storage method for fhe keys (defaults to indexedDB on web, filesystem on node) */
|
|
242
241
|
fheKeyStorage: z.ZodDefault<z.ZodUnion<[z.ZodObject<{
|
|
243
|
-
getItem: z.
|
|
244
|
-
setItem: z.
|
|
245
|
-
removeItem: z.
|
|
246
|
-
},
|
|
247
|
-
getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
|
|
248
|
-
setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
|
|
249
|
-
removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
250
|
-
}, {
|
|
251
|
-
getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
|
|
252
|
-
setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
|
|
253
|
-
removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
254
|
-
}>, z.ZodNull]>>;
|
|
255
|
-
/** Whether to use Web Workers for ZK proof generation (web platform only) */
|
|
242
|
+
getItem: z.ZodCustom<(name: string) => Promise<any>, (name: string) => Promise<any>>;
|
|
243
|
+
setItem: z.ZodCustom<(name: string, value: any) => Promise<void>, (name: string, value: any) => Promise<void>>;
|
|
244
|
+
removeItem: z.ZodCustom<(name: string) => Promise<void>, (name: string) => Promise<void>>;
|
|
245
|
+
}, z.core.$strip>, z.ZodNull]>>;
|
|
256
246
|
useWorkers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
257
|
-
/** Mocks configs */
|
|
258
247
|
mocks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}, {
|
|
263
|
-
sealOutputDelay?: number | undefined;
|
|
264
|
-
}>>>;
|
|
265
|
-
/** Internal configuration */
|
|
248
|
+
decryptDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
249
|
+
encryptDelay: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>]>>>;
|
|
250
|
+
}, z.core.$strip>>>;
|
|
266
251
|
_internal: z.ZodOptional<z.ZodObject<{
|
|
267
252
|
zkvWalletClient: z.ZodOptional<z.ZodAny>;
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
}, {
|
|
271
|
-
zkvWalletClient?: any;
|
|
272
|
-
}>>;
|
|
273
|
-
}, "strip", z.ZodTypeAny, {
|
|
274
|
-
environment: "hardhat" | "node" | "web" | "react";
|
|
275
|
-
supportedChains: {
|
|
276
|
-
name: string;
|
|
277
|
-
id: number;
|
|
278
|
-
network: string;
|
|
279
|
-
coFheUrl: string;
|
|
280
|
-
verifierUrl: string;
|
|
281
|
-
thresholdNetworkUrl: string;
|
|
282
|
-
environment: "MOCK" | "TESTNET" | "MAINNET";
|
|
283
|
-
}[];
|
|
284
|
-
permitGeneration: "ON_CONNECT" | "ON_DECRYPT_HANDLES" | "MANUAL";
|
|
285
|
-
defaultPermitExpiration: number;
|
|
286
|
-
fheKeyStorage: {
|
|
287
|
-
getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
|
|
288
|
-
setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
|
|
289
|
-
removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
290
|
-
} | null;
|
|
291
|
-
useWorkers: boolean;
|
|
292
|
-
mocks: {
|
|
293
|
-
sealOutputDelay: number;
|
|
294
|
-
};
|
|
295
|
-
_internal?: {
|
|
296
|
-
zkvWalletClient?: any;
|
|
297
|
-
} | undefined;
|
|
298
|
-
}, {
|
|
299
|
-
supportedChains: {
|
|
300
|
-
name: string;
|
|
301
|
-
id: number;
|
|
302
|
-
network: string;
|
|
303
|
-
coFheUrl: string;
|
|
304
|
-
verifierUrl: string;
|
|
305
|
-
thresholdNetworkUrl: string;
|
|
306
|
-
environment: "MOCK" | "TESTNET" | "MAINNET";
|
|
307
|
-
}[];
|
|
308
|
-
environment?: "hardhat" | "node" | "web" | "react" | undefined;
|
|
309
|
-
permitGeneration?: "ON_CONNECT" | "ON_DECRYPT_HANDLES" | "MANUAL" | undefined;
|
|
310
|
-
defaultPermitExpiration?: number | undefined;
|
|
311
|
-
fheKeyStorage?: {
|
|
312
|
-
getItem: (args_0: string, ...args_1: unknown[]) => Promise<any>;
|
|
313
|
-
setItem: (args_0: string, args_1: any, ...args_2: unknown[]) => Promise<void>;
|
|
314
|
-
removeItem: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
315
|
-
} | null | undefined;
|
|
316
|
-
useWorkers?: boolean | undefined;
|
|
317
|
-
mocks?: {
|
|
318
|
-
sealOutputDelay?: number | undefined;
|
|
319
|
-
} | undefined;
|
|
320
|
-
_internal?: {
|
|
321
|
-
zkvWalletClient?: any;
|
|
322
|
-
} | undefined;
|
|
323
|
-
}>;
|
|
253
|
+
}, z.core.$strip>>;
|
|
254
|
+
}, z.core.$strip>;
|
|
324
255
|
/**
|
|
325
256
|
* Input config type inferred from the schema
|
|
326
257
|
*/
|
|
327
|
-
type
|
|
258
|
+
type CofheInputConfig = z.input<typeof CofheConfigSchema>;
|
|
328
259
|
/**
|
|
329
|
-
* Creates and validates a
|
|
260
|
+
* Creates and validates a cofhe configuration (base implementation)
|
|
330
261
|
* @param config - The configuration object to validate
|
|
331
262
|
* @returns The validated configuration
|
|
332
263
|
* @throws {Error} If the configuration is invalid
|
|
333
264
|
*/
|
|
334
|
-
declare function
|
|
265
|
+
declare function createCofheConfigBase(config: CofheInputConfig): CofheConfig;
|
|
335
266
|
/**
|
|
336
|
-
* Access the
|
|
267
|
+
* Access the CofheConfig object directly by providing the key.
|
|
337
268
|
* This is powerful when you use OnchainKit utilities outside of the React context.
|
|
338
269
|
*/
|
|
339
|
-
declare const
|
|
270
|
+
declare const getCofheConfigItem: <K extends keyof CofheConfig>(config: CofheConfig, key: K) => CofheConfig[K];
|
|
340
271
|
|
|
341
272
|
/**
|
|
342
273
|
* Base parameters that all builders need
|
|
343
274
|
*/
|
|
344
275
|
type BaseBuilderParams = {
|
|
345
|
-
config:
|
|
276
|
+
config: CofheConfig | undefined;
|
|
346
277
|
publicClient: PublicClient | undefined;
|
|
347
278
|
walletClient: WalletClient | undefined;
|
|
348
279
|
chainId: number | undefined;
|
|
@@ -354,7 +285,7 @@ type BaseBuilderParams = {
|
|
|
354
285
|
* for working with clients, config, and chain IDs
|
|
355
286
|
*/
|
|
356
287
|
declare abstract class BaseBuilder {
|
|
357
|
-
protected config:
|
|
288
|
+
protected config: CofheConfig;
|
|
358
289
|
protected publicClient: PublicClient | undefined;
|
|
359
290
|
protected walletClient: WalletClient | undefined;
|
|
360
291
|
protected chainId: number | undefined;
|
|
@@ -362,28 +293,28 @@ declare abstract class BaseBuilder {
|
|
|
362
293
|
constructor(params: BaseBuilderParams);
|
|
363
294
|
/**
|
|
364
295
|
* Asserts that this.chainId is populated
|
|
365
|
-
* @throws {
|
|
296
|
+
* @throws {CofheError} If chainId is not set
|
|
366
297
|
*/
|
|
367
298
|
protected assertChainId(): asserts this is this & {
|
|
368
299
|
chainId: number;
|
|
369
300
|
};
|
|
370
301
|
/**
|
|
371
302
|
* Asserts that this.account is populated
|
|
372
|
-
* @throws {
|
|
303
|
+
* @throws {CofheError} If account is not set
|
|
373
304
|
*/
|
|
374
305
|
protected assertAccount(): asserts this is this & {
|
|
375
306
|
account: string;
|
|
376
307
|
};
|
|
377
308
|
/**
|
|
378
309
|
* Asserts that this.publicClient is populated
|
|
379
|
-
* @throws {
|
|
310
|
+
* @throws {CofheError} If publicClient is not set
|
|
380
311
|
*/
|
|
381
312
|
protected assertPublicClient(): asserts this is this & {
|
|
382
313
|
publicClient: PublicClient;
|
|
383
314
|
};
|
|
384
315
|
/**
|
|
385
316
|
* Asserts that this.walletClient is populated
|
|
386
|
-
* @throws {
|
|
317
|
+
* @throws {CofheError} If walletClient is not set
|
|
387
318
|
*/
|
|
388
319
|
protected assertWalletClient(): asserts this is this & {
|
|
389
320
|
walletClient: WalletClient;
|
|
@@ -393,32 +324,35 @@ declare abstract class BaseBuilder {
|
|
|
393
324
|
/**
|
|
394
325
|
* API
|
|
395
326
|
*
|
|
396
|
-
* await client.
|
|
327
|
+
* await client.decryptForView(ctHash, utype)
|
|
397
328
|
* .setChainId(chainId)
|
|
398
329
|
* .setAccount(account)
|
|
399
|
-
* .
|
|
400
|
-
* .
|
|
401
|
-
* .
|
|
330
|
+
* .withPermit() // optional (active permit)
|
|
331
|
+
* // or .withPermit(permitHash) / .withPermit(permit)
|
|
332
|
+
* .execute()
|
|
402
333
|
*
|
|
403
334
|
* If chainId not set, uses client's chainId
|
|
404
335
|
* If account not set, uses client's account
|
|
405
|
-
*
|
|
406
|
-
*
|
|
336
|
+
* withPermit() uses chainId + account to get the active permit.
|
|
337
|
+
* withPermit(permitHash) fetches that permit using chainId + account.
|
|
338
|
+
* withPermit(permit) uses the provided permit regardless of chainId/account.
|
|
339
|
+
*
|
|
340
|
+
* Note: decryptForView always requires a permit (no global-allowance mode).
|
|
407
341
|
*
|
|
408
342
|
* Returns the unsealed item.
|
|
409
343
|
*/
|
|
410
|
-
type
|
|
344
|
+
type DecryptForViewBuilderParams<U extends FheTypes> = BaseBuilderParams & {
|
|
411
345
|
ctHash: bigint;
|
|
412
346
|
utype: U;
|
|
413
347
|
permitHash?: string;
|
|
414
348
|
permit?: Permit;
|
|
415
349
|
};
|
|
416
|
-
declare class
|
|
350
|
+
declare class DecryptForViewBuilder<U extends FheTypes> extends BaseBuilder {
|
|
417
351
|
private ctHash;
|
|
418
352
|
private utype;
|
|
419
353
|
private permitHash?;
|
|
420
354
|
private permit?;
|
|
421
|
-
constructor(params:
|
|
355
|
+
constructor(params: DecryptForViewBuilderParams<U>);
|
|
422
356
|
/**
|
|
423
357
|
* @param chainId - Chain to decrypt values from. Used to fetch the threshold network URL and use the correct permit.
|
|
424
358
|
*
|
|
@@ -426,14 +360,14 @@ declare class DecryptHandlesBuilder<U extends FheTypes> extends BaseBuilder {
|
|
|
426
360
|
*
|
|
427
361
|
* Example:
|
|
428
362
|
* ```typescript
|
|
429
|
-
* const unsealed = await
|
|
363
|
+
* const unsealed = await client.decryptForView(ctHash, utype)
|
|
430
364
|
* .setChainId(11155111)
|
|
431
|
-
* .
|
|
365
|
+
* .execute();
|
|
432
366
|
* ```
|
|
433
367
|
*
|
|
434
|
-
* @returns The chainable
|
|
368
|
+
* @returns The chainable DecryptForViewBuilder instance.
|
|
435
369
|
*/
|
|
436
|
-
setChainId(chainId: number):
|
|
370
|
+
setChainId(chainId: number): DecryptForViewBuilder<U>;
|
|
437
371
|
getChainId(): number | undefined;
|
|
438
372
|
/**
|
|
439
373
|
* @param account - Account to decrypt values from. Used to fetch the correct permit.
|
|
@@ -442,15 +376,25 @@ declare class DecryptHandlesBuilder<U extends FheTypes> extends BaseBuilder {
|
|
|
442
376
|
*
|
|
443
377
|
* Example:
|
|
444
378
|
* ```typescript
|
|
445
|
-
* const unsealed = await
|
|
379
|
+
* const unsealed = await client.decryptForView(ctHash, utype)
|
|
446
380
|
* .setAccount('0x1234567890123456789012345678901234567890')
|
|
447
|
-
* .
|
|
381
|
+
* .execute();
|
|
448
382
|
* ```
|
|
449
383
|
*
|
|
450
|
-
* @returns The chainable
|
|
384
|
+
* @returns The chainable DecryptForViewBuilder instance.
|
|
451
385
|
*/
|
|
452
|
-
setAccount(account: string):
|
|
386
|
+
setAccount(account: string): DecryptForViewBuilder<U>;
|
|
453
387
|
getAccount(): string | undefined;
|
|
388
|
+
/**
|
|
389
|
+
* Select "use permit" mode (optional).
|
|
390
|
+
*
|
|
391
|
+
* - `withPermit(permit)` uses the provided permit.
|
|
392
|
+
* - `withPermit(permitHash)` fetches that permit.
|
|
393
|
+
* - `withPermit()` uses the active permit for the resolved `chainId + account`.
|
|
394
|
+
*/
|
|
395
|
+
withPermit(): DecryptForViewBuilder<U>;
|
|
396
|
+
withPermit(permitHash: string): DecryptForViewBuilder<U>;
|
|
397
|
+
withPermit(permit: Permit): DecryptForViewBuilder<U>;
|
|
454
398
|
/**
|
|
455
399
|
* @param permitHash - Permit hash to decrypt values from. Used to fetch the correct permit.
|
|
456
400
|
*
|
|
@@ -459,14 +403,15 @@ declare class DecryptHandlesBuilder<U extends FheTypes> extends BaseBuilder {
|
|
|
459
403
|
*
|
|
460
404
|
* Example:
|
|
461
405
|
* ```typescript
|
|
462
|
-
* const unsealed = await
|
|
406
|
+
* const unsealed = await client.decryptForView(ctHash, utype)
|
|
463
407
|
* .setPermitHash('0x1234567890123456789012345678901234567890')
|
|
464
|
-
* .
|
|
408
|
+
* .execute();
|
|
465
409
|
* ```
|
|
466
410
|
*
|
|
467
|
-
* @returns The chainable
|
|
411
|
+
* @returns The chainable DecryptForViewBuilder instance.
|
|
468
412
|
*/
|
|
469
|
-
|
|
413
|
+
/** @deprecated Use `withPermit(permitHash)` instead. */
|
|
414
|
+
setPermitHash(permitHash: string): DecryptForViewBuilder<U>;
|
|
470
415
|
getPermitHash(): string | undefined;
|
|
471
416
|
/**
|
|
472
417
|
* @param permit - Permit to decrypt values with. If provided, it will be used regardless of chainId, account, or permitHash.
|
|
@@ -475,14 +420,15 @@ declare class DecryptHandlesBuilder<U extends FheTypes> extends BaseBuilder {
|
|
|
475
420
|
*
|
|
476
421
|
* Example:
|
|
477
422
|
* ```typescript
|
|
478
|
-
* const unsealed = await
|
|
423
|
+
* const unsealed = await client.decryptForView(ctHash, utype)
|
|
479
424
|
* .setPermit(permit)
|
|
480
|
-
* .
|
|
425
|
+
* .execute();
|
|
481
426
|
* ```
|
|
482
427
|
*
|
|
483
|
-
* @returns The chainable
|
|
428
|
+
* @returns The chainable DecryptForViewBuilder instance.
|
|
484
429
|
*/
|
|
485
|
-
|
|
430
|
+
/** @deprecated Use `withPermit(permit)` instead. */
|
|
431
|
+
setPermit(permit: Permit): DecryptForViewBuilder<U>;
|
|
486
432
|
getPermit(): Permit | undefined;
|
|
487
433
|
private getThresholdNetworkUrl;
|
|
488
434
|
private validateUtypeOrThrow;
|
|
@@ -507,15 +453,112 @@ declare class DecryptHandlesBuilder<U extends FheTypes> extends BaseBuilder {
|
|
|
507
453
|
*
|
|
508
454
|
* Example:
|
|
509
455
|
* ```typescript
|
|
510
|
-
* const unsealed = await
|
|
456
|
+
* const unsealed = await client.decryptForView(ctHash, utype)
|
|
511
457
|
* .setChainId(11155111) // optional
|
|
512
458
|
* .setAccount('0x123...890') // optional
|
|
513
|
-
* .
|
|
459
|
+
* .withPermit() // optional
|
|
460
|
+
* .execute(); // execute
|
|
514
461
|
* ```
|
|
515
462
|
*
|
|
516
463
|
* @returns The unsealed item.
|
|
517
464
|
*/
|
|
518
|
-
|
|
465
|
+
execute(): Promise<UnsealedItem<U>>;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
type DecryptForTxBuilderParams = BaseBuilderParams & {
|
|
469
|
+
ctHash: bigint;
|
|
470
|
+
};
|
|
471
|
+
type DecryptForTxResult = {
|
|
472
|
+
ctHash: bigint;
|
|
473
|
+
decryptedValue: bigint;
|
|
474
|
+
signature: string;
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* Type-level gating:
|
|
478
|
+
* - The initial builder returned from `client.decryptForTx(...)` intentionally does not expose `execute()`.
|
|
479
|
+
* - Calling `withPermit(...)` or `withoutPermit()` returns a builder that *does* expose `execute()`, but no longer
|
|
480
|
+
* exposes `withPermit/withoutPermit` (so you can't select twice, or switch modes).
|
|
481
|
+
*/
|
|
482
|
+
type DecryptForTxBuilderUnset = Omit<DecryptForTxBuilder, 'execute'>;
|
|
483
|
+
type DecryptForTxBuilderSelected = Omit<DecryptForTxBuilder, 'withPermit' | 'withoutPermit'>;
|
|
484
|
+
declare class DecryptForTxBuilder extends BaseBuilder {
|
|
485
|
+
private ctHash;
|
|
486
|
+
private permitHash?;
|
|
487
|
+
private permit?;
|
|
488
|
+
private permitSelection;
|
|
489
|
+
constructor(params: DecryptForTxBuilderParams);
|
|
490
|
+
/**
|
|
491
|
+
* @param chainId - Chain to decrypt values from. Used to fetch the threshold network URL and use the correct permit.
|
|
492
|
+
*
|
|
493
|
+
* If not provided, the chainId will be fetched from the connected publicClient.
|
|
494
|
+
*
|
|
495
|
+
* Example:
|
|
496
|
+
* ```typescript
|
|
497
|
+
* const result = await decryptForTx(ctHash)
|
|
498
|
+
* .setChainId(11155111)
|
|
499
|
+
* .execute();
|
|
500
|
+
* ```
|
|
501
|
+
*
|
|
502
|
+
* @returns The chainable DecryptForTxBuilder instance.
|
|
503
|
+
*/
|
|
504
|
+
setChainId(this: DecryptForTxBuilderUnset, chainId: number): DecryptForTxBuilderUnset;
|
|
505
|
+
setChainId(this: DecryptForTxBuilderSelected, chainId: number): DecryptForTxBuilderSelected;
|
|
506
|
+
getChainId(): number | undefined;
|
|
507
|
+
/**
|
|
508
|
+
* @param account - Account to decrypt values from. Used to fetch the correct permit.
|
|
509
|
+
*
|
|
510
|
+
* If not provided, the account will be fetched from the connected walletClient.
|
|
511
|
+
*
|
|
512
|
+
* Example:
|
|
513
|
+
* ```typescript
|
|
514
|
+
* const result = await decryptForTx(ctHash)
|
|
515
|
+
* .setAccount('0x1234567890123456789012345678901234567890')
|
|
516
|
+
* .execute();
|
|
517
|
+
* ```
|
|
518
|
+
*
|
|
519
|
+
* @returns The chainable DecryptForTxBuilder instance.
|
|
520
|
+
*/
|
|
521
|
+
setAccount(this: DecryptForTxBuilderUnset, account: string): DecryptForTxBuilderUnset;
|
|
522
|
+
setAccount(this: DecryptForTxBuilderSelected, account: string): DecryptForTxBuilderSelected;
|
|
523
|
+
getAccount(): string | undefined;
|
|
524
|
+
/**
|
|
525
|
+
* Select "use permit" mode.
|
|
526
|
+
*
|
|
527
|
+
* - `withPermit(permit)` uses the provided permit.
|
|
528
|
+
* - `withPermit(permitHash)` fetches that permit.
|
|
529
|
+
* - `withPermit()` uses the active permit for the resolved `chainId + account`.
|
|
530
|
+
*
|
|
531
|
+
* Note: "global allowance" (no permit) is ONLY available via `withoutPermit()`.
|
|
532
|
+
*/
|
|
533
|
+
withPermit(): DecryptForTxBuilderSelected;
|
|
534
|
+
withPermit(permitHash: string): DecryptForTxBuilderSelected;
|
|
535
|
+
withPermit(permit: Permit): DecryptForTxBuilderSelected;
|
|
536
|
+
/**
|
|
537
|
+
* Select "no permit" mode.
|
|
538
|
+
*
|
|
539
|
+
* This uses global allowance (no permit required) and sends an empty permission payload to `/decrypt`.
|
|
540
|
+
*/
|
|
541
|
+
withoutPermit(): DecryptForTxBuilderSelected;
|
|
542
|
+
getPermit(): Permit | undefined;
|
|
543
|
+
getPermitHash(): string | undefined;
|
|
544
|
+
private getThresholdNetworkUrl;
|
|
545
|
+
private getResolvedPermit;
|
|
546
|
+
/**
|
|
547
|
+
* On hardhat, interact with MockThresholdNetwork contract
|
|
548
|
+
*/
|
|
549
|
+
private mocksDecryptForTx;
|
|
550
|
+
/**
|
|
551
|
+
* In the production context, perform a true decryption with the CoFHE coprocessor.
|
|
552
|
+
*/
|
|
553
|
+
private productionDecryptForTx;
|
|
554
|
+
/**
|
|
555
|
+
* Final step of the decryptForTx process. MUST BE CALLED LAST IN THE CHAIN.
|
|
556
|
+
*
|
|
557
|
+
* You must explicitly choose one permit mode before calling `execute()`:
|
|
558
|
+
* - `withPermit(permit)` / `withPermit(permitHash)` / `withPermit()` (active permit)
|
|
559
|
+
* - `withoutPermit()` (global allowance)
|
|
560
|
+
*/
|
|
561
|
+
execute(): Promise<DecryptForTxResult>;
|
|
519
562
|
}
|
|
520
563
|
|
|
521
564
|
/**
|
|
@@ -606,7 +649,7 @@ type FheKeyDeserializer = (buff: string) => void;
|
|
|
606
649
|
/**
|
|
607
650
|
* Retrieves the FHE public key and the CRS from the provider.
|
|
608
651
|
* If the key/crs already exists in the store it is returned, else it is fetched, stored, and returned
|
|
609
|
-
* @param {
|
|
652
|
+
* @param {CofheConfig} config - The configuration object for the CoFHE client
|
|
610
653
|
* @param {number} chainId - The chain to fetch the FHE key for, if no chainId provided, undefined is returned
|
|
611
654
|
* @param securityZone - The security zone for which to retrieve the key (default 0).
|
|
612
655
|
* @param tfhePublicKeyDeserializer - The serializer for the FHE public key (used for validation).
|
|
@@ -614,7 +657,7 @@ type FheKeyDeserializer = (buff: string) => void;
|
|
|
614
657
|
* @param keysStorage - The keys storage instance to use (optional)
|
|
615
658
|
* @returns {Promise<[[string, boolean], [string, boolean]]>} - A promise that resolves to [[fheKey, fheKeyFetchedFromCoFHE], [crs, crsFetchedFromCoFHE]]
|
|
616
659
|
*/
|
|
617
|
-
declare const fetchKeys: (config:
|
|
660
|
+
declare const fetchKeys: (config: CofheConfig, chainId: number, securityZone: number | undefined, tfhePublicKeyDeserializer: FheKeyDeserializer, compactPkeCrsDeserializer: FheKeyDeserializer, keysStorage?: KeysStorage | null) => Promise<[[string, boolean], [string, boolean]]>;
|
|
618
661
|
|
|
619
662
|
type EncryptInputsBuilderParams<T extends EncryptableItem[]> = BaseBuilderParams & {
|
|
620
663
|
inputs: [...T];
|
|
@@ -655,7 +698,7 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
655
698
|
* ```typescript
|
|
656
699
|
* const encrypted = await encryptInputs([Encryptable.uint128(10n)])
|
|
657
700
|
* .setAccount("0x123")
|
|
658
|
-
* .
|
|
701
|
+
* .execute();
|
|
659
702
|
* ```
|
|
660
703
|
*
|
|
661
704
|
* @returns The chainable EncryptInputsBuilder instance.
|
|
@@ -671,7 +714,7 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
671
714
|
* ```typescript
|
|
672
715
|
* const encrypted = await encryptInputs([Encryptable.uint128(10n)])
|
|
673
716
|
* .setChainId(11155111)
|
|
674
|
-
* .
|
|
717
|
+
* .execute();
|
|
675
718
|
* ```
|
|
676
719
|
*
|
|
677
720
|
* @returns The chainable EncryptInputsBuilder instance.
|
|
@@ -687,7 +730,7 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
687
730
|
* ```typescript
|
|
688
731
|
* const encrypted = await encryptInputs([Encryptable.uint128(10n)])
|
|
689
732
|
* .setSecurityZone(1)
|
|
690
|
-
* .
|
|
733
|
+
* .execute();
|
|
691
734
|
* ```
|
|
692
735
|
*
|
|
693
736
|
* @returns The chainable EncryptInputsBuilder instance.
|
|
@@ -703,7 +746,7 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
703
746
|
* ```typescript
|
|
704
747
|
* const encrypted = await encryptInputs([Encryptable.uint128(10n)])
|
|
705
748
|
* .setUseWorker(false)
|
|
706
|
-
* .
|
|
749
|
+
* .execute();
|
|
707
750
|
* ```
|
|
708
751
|
*
|
|
709
752
|
* @returns The chainable EncryptInputsBuilder instance.
|
|
@@ -732,13 +775,13 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
732
775
|
* Example:
|
|
733
776
|
* ```typescript
|
|
734
777
|
* const encrypted = await encryptInputs([Encryptable.uint128(10n)])
|
|
735
|
-
* .
|
|
736
|
-
* .
|
|
778
|
+
* .onStep((step: EncryptStep) => console.log(step))
|
|
779
|
+
* .execute();
|
|
737
780
|
* ```
|
|
738
781
|
*
|
|
739
782
|
* @returns The EncryptInputsBuilder instance.
|
|
740
783
|
*/
|
|
741
|
-
|
|
784
|
+
onStep(callback: EncryptStepCallbackFunction): EncryptInputsBuilder<T>;
|
|
742
785
|
getStepCallback(): EncryptStepCallbackFunction | undefined;
|
|
743
786
|
/**
|
|
744
787
|
* Fires the step callback if set
|
|
@@ -746,12 +789,12 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
746
789
|
private fireStepStart;
|
|
747
790
|
private fireStepEnd;
|
|
748
791
|
/**
|
|
749
|
-
* zkVerifierUrl is included in the chains exported from
|
|
792
|
+
* zkVerifierUrl is included in the chains exported from @cofhe/sdk/chains for use in CofheConfig.supportedChains
|
|
750
793
|
* Users should generally not set this manually.
|
|
751
794
|
*/
|
|
752
795
|
private getZkVerifierUrl;
|
|
753
796
|
/**
|
|
754
|
-
* initTfhe is a platform-specific dependency injected into core/
|
|
797
|
+
* initTfhe is a platform-specific dependency injected into core/createCofheClientBase by web/createCofheClient and node/createCofheClient
|
|
755
798
|
* web/ uses zama "tfhe"
|
|
756
799
|
* node/ uses zama "node-tfhe"
|
|
757
800
|
* Users should not set this manually.
|
|
@@ -762,6 +805,11 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
762
805
|
* If the key/crs already exists in the store it is returned, else it is fetched, stored, and returned
|
|
763
806
|
*/
|
|
764
807
|
private fetchFheKeyAndCrs;
|
|
808
|
+
/**
|
|
809
|
+
* Resolves the encryptDelay config into an array of 5 per-step delays.
|
|
810
|
+
* A single number is broadcast to all steps; a tuple is used as-is.
|
|
811
|
+
*/
|
|
812
|
+
private resolveEncryptDelays;
|
|
765
813
|
/**
|
|
766
814
|
* @dev Encrypt against the cofheMocks instead of CoFHE
|
|
767
815
|
*
|
|
@@ -769,11 +817,11 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
769
817
|
* cofheMocksInsertPackedHashes - stores the ctHashes and their plaintext values for on-chain mocking of FHE operations.
|
|
770
818
|
* cofheMocksZkCreateProofSignatures - creates signatures to be included in the encrypted inputs. The signers address is known and verified in the mock contracts.
|
|
771
819
|
*/
|
|
772
|
-
private
|
|
820
|
+
private mocksExecute;
|
|
773
821
|
/**
|
|
774
822
|
* In the production context, perform a true encryption with the CoFHE coprocessor.
|
|
775
823
|
*/
|
|
776
|
-
private
|
|
824
|
+
private productionExecute;
|
|
777
825
|
/**
|
|
778
826
|
* Final step of the encryption process. MUST BE CALLED LAST IN THE CHAIN.
|
|
779
827
|
*
|
|
@@ -788,12 +836,12 @@ declare class EncryptInputsBuilder<T extends EncryptableItem[]> extends BaseBuil
|
|
|
788
836
|
* const encrypted = await encryptInputs([Encryptable.uint128(10n)])
|
|
789
837
|
* .setAccount('0x123...890') // optional
|
|
790
838
|
* .setChainId(11155111) // optional
|
|
791
|
-
* .
|
|
839
|
+
* .execute(); // execute
|
|
792
840
|
* ```
|
|
793
841
|
*
|
|
794
842
|
* @returns The encrypted inputs.
|
|
795
843
|
*/
|
|
796
|
-
|
|
844
|
+
execute(): Promise<[...EncryptedItemInputs<T>]>;
|
|
797
845
|
}
|
|
798
846
|
|
|
799
847
|
declare const permits: {
|
|
@@ -843,33 +891,45 @@ declare const permits: {
|
|
|
843
891
|
importShared: (options: ImportSharedPermitOptions | string, publicClient: PublicClient, walletClient: WalletClient) => Promise<RecipientPermit>;
|
|
844
892
|
getOrCreateSelfPermit: (publicClient: PublicClient, walletClient: WalletClient, chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
|
|
845
893
|
getOrCreateSharingPermit: (publicClient: PublicClient, walletClient: WalletClient, options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
|
|
846
|
-
getHash: (permit:
|
|
894
|
+
getHash: (permit: PermitHashFields) => string;
|
|
847
895
|
serialize: (permit: Permit) => SerializedPermit;
|
|
848
896
|
deserialize: (serialized: SerializedPermit) => Permit;
|
|
849
897
|
getPermit: (chainId: number, account: string, hash: string) => Promise<Permit | undefined>;
|
|
850
898
|
getPermits: (chainId: number, account: string) => Promise<Record<string, Permit>>;
|
|
851
899
|
getActivePermit: (chainId: number, account: string) => Promise<Permit | undefined>;
|
|
852
900
|
getActivePermitHash: (chainId: number, account: string) => string | undefined;
|
|
853
|
-
removePermit: (chainId: number, account: string, hash: string
|
|
901
|
+
removePermit: (chainId: number, account: string, hash: string) => Promise<void>;
|
|
854
902
|
selectActivePermit: (chainId: number, account: string, hash: string) => void;
|
|
855
903
|
removeActivePermit: (chainId: number, account: string) => Promise<void>;
|
|
856
904
|
};
|
|
857
905
|
|
|
858
|
-
type
|
|
859
|
-
getSnapshot():
|
|
906
|
+
type CofheClient<TConfig extends CofheConfig = CofheConfig> = {
|
|
907
|
+
getSnapshot(): CofheClientConnectionState;
|
|
860
908
|
subscribe(listener: Listener): () => void;
|
|
909
|
+
readonly connection: CofheClientConnectionState;
|
|
861
910
|
readonly connected: boolean;
|
|
862
911
|
readonly connecting: boolean;
|
|
863
912
|
readonly config: TConfig;
|
|
864
913
|
connect(publicClient: PublicClient, walletClient: WalletClient): Promise<void>;
|
|
914
|
+
/**
|
|
915
|
+
* Clears the current connection state (account/chainId/clients) and marks the client as disconnected.
|
|
916
|
+
*
|
|
917
|
+
* This does not delete persisted permits or stored FHE keys; it only resets the in-memory connection.
|
|
918
|
+
*/
|
|
919
|
+
disconnect(): void;
|
|
865
920
|
/**
|
|
866
921
|
* Types docstring
|
|
867
922
|
*/
|
|
868
923
|
encryptInputs<T extends EncryptableItem[]>(inputs: [...T]): EncryptInputsBuilder<[...T]>;
|
|
869
|
-
|
|
870
|
-
|
|
924
|
+
/**
|
|
925
|
+
* @deprecated Use `decryptForView` instead. Kept for backward compatibility.
|
|
926
|
+
*/
|
|
927
|
+
decryptHandle<U extends FheTypes>(ctHash: bigint, utype: U): DecryptForViewBuilder<U>;
|
|
928
|
+
decryptForView<U extends FheTypes>(ctHash: bigint, utype: U): DecryptForViewBuilder<U>;
|
|
929
|
+
decryptForTx(ctHash: bigint): DecryptForTxBuilderUnset;
|
|
930
|
+
permits: CofheClientPermits;
|
|
871
931
|
};
|
|
872
|
-
type
|
|
932
|
+
type CofheClientConnectionState = {
|
|
873
933
|
connected: boolean;
|
|
874
934
|
connecting: boolean;
|
|
875
935
|
connectError: unknown | undefined;
|
|
@@ -878,17 +938,17 @@ type CofhesdkClientConnectionState = {
|
|
|
878
938
|
publicClient: PublicClient | undefined;
|
|
879
939
|
walletClient: WalletClient | undefined;
|
|
880
940
|
};
|
|
881
|
-
type Listener = (snapshot:
|
|
882
|
-
type
|
|
941
|
+
type Listener = (snapshot: CofheClientConnectionState) => void;
|
|
942
|
+
type CofheClientPermitsClients = {
|
|
883
943
|
publicClient: PublicClient;
|
|
884
944
|
walletClient: WalletClient;
|
|
885
945
|
};
|
|
886
|
-
type
|
|
946
|
+
type CofheClientPermits = {
|
|
887
947
|
getSnapshot: typeof permits.getSnapshot;
|
|
888
948
|
subscribe: typeof permits.subscribe;
|
|
889
|
-
createSelf: (options: CreateSelfPermitOptions, clients?:
|
|
890
|
-
createSharing: (options: CreateSharingPermitOptions, clients?:
|
|
891
|
-
importShared: (options: ImportSharedPermitOptions | string, clients?:
|
|
949
|
+
createSelf: (options: CreateSelfPermitOptions, clients?: CofheClientPermitsClients) => Promise<SelfPermit>;
|
|
950
|
+
createSharing: (options: CreateSharingPermitOptions, clients?: CofheClientPermitsClients) => Promise<SharingPermit>;
|
|
951
|
+
importShared: (options: ImportSharedPermitOptions | string, clients?: CofheClientPermitsClients) => Promise<RecipientPermit>;
|
|
892
952
|
getPermit: (hash: string, chainId?: number, account?: string) => Promise<Permit | undefined>;
|
|
893
953
|
getPermits: (chainId?: number, account?: string) => Promise<Record<string, Permit>>;
|
|
894
954
|
getActivePermit: (chainId?: number, account?: string) => Promise<Permit | undefined>;
|
|
@@ -896,13 +956,13 @@ type CofhesdkClientPermits = {
|
|
|
896
956
|
getOrCreateSelfPermit: (chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
|
|
897
957
|
getOrCreateSharingPermit: (options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
|
|
898
958
|
selectActivePermit: (hash: string, chainId?: number, account?: string) => void;
|
|
899
|
-
removePermit: (hash: string, chainId?: number, account?: string
|
|
959
|
+
removePermit: (hash: string, chainId?: number, account?: string) => void;
|
|
900
960
|
removeActivePermit: (chainId?: number, account?: string) => void;
|
|
901
961
|
getHash: typeof PermitUtils.getHash;
|
|
902
962
|
serialize: typeof PermitUtils.serialize;
|
|
903
963
|
deserialize: typeof PermitUtils.deserialize;
|
|
904
964
|
};
|
|
905
|
-
type
|
|
965
|
+
type CofheClientParams<TConfig extends CofheConfig> = {
|
|
906
966
|
config: TConfig;
|
|
907
967
|
zkBuilderAndCrsGenerator: ZkBuilderAndCrsGenerator;
|
|
908
968
|
tfhePublicKeyDeserializer: FheKeyDeserializer;
|
|
@@ -911,4 +971,4 @@ type CofhesdkClientParams<TConfig extends CofhesdkConfig> = {
|
|
|
911
971
|
zkProveWorkerFn?: ZkProveWorkerFunction;
|
|
912
972
|
};
|
|
913
973
|
|
|
914
|
-
export { type
|
|
974
|
+
export { type ZkProveWorkerFunction as $, type FheTypeValue as A, type EncryptStepCallbackFunction as B, type CofheInputConfig as C, type EncryptStepCallbackContext as D, type EncryptableItem as E, FheTypes as F, FheUintUTypes as G, FheAllUTypes as H, type IStorage as I, Encryptable as J, isEncryptableItem as K, type LiteralToPrimitive as L, EncryptStep as M, isLastEncryptionStep as N, assertCorrectEncryptedItemInput as O, type Primitive as P, fetchKeys as Q, type FheKeyDeserializer as R, createKeysStore as S, type KeysStorage as T, type UnsealedItem as U, type KeysStore as V, EncryptInputsBuilder as W, DecryptForViewBuilder as X, DecryptForTxBuilder as Y, type DecryptForTxResult as Z, type ZkBuilderAndCrsGenerator as _, type CofheConfig as a, type ZkProveWorkerRequest as a0, type ZkProveWorkerResponse as a1, zkProveWithWorker as a2, type CofheClient as b, type CofheClientConnectionState as c, type CofheClientParams as d, createCofheConfigBase as e, type CofheInternalConfig as f, getCofheConfigItem as g, type CofheClientPermits as h, type EncryptableBool as i, type EncryptableUint8 as j, type EncryptableUint16 as k, type EncryptableUint32 as l, type EncryptableUint64 as m, type EncryptableUint128 as n, type EncryptableAddress as o, type EncryptedNumber as p, type EncryptedItemInput as q, type EncryptedBoolInput as r, type EncryptedUint8Input as s, type EncryptedUint16Input as t, type EncryptedUint32Input as u, type EncryptedUint64Input as v, type EncryptedUint128Input as w, type EncryptedAddressInput as x, type EncryptedItemInputs as y, type EncryptableToEncryptedItemInputMap as z };
|