@cofhe/sdk 0.2.0 → 0.2.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/CHANGELOG.md +8 -0
- package/chains/defineChain.ts +2 -2
- package/chains/types.ts +3 -3
- package/core/client.test.ts +111 -0
- package/core/client.ts +22 -2
- package/core/clientTypes.ts +7 -1
- package/core/config.test.ts +8 -0
- package/core/config.ts +10 -4
- package/core/consts.ts +18 -0
- package/core/decrypt/cofheMocksSealOutput.ts +2 -4
- package/core/encrypt/cofheMocksZkVerifySign.ts +4 -11
- package/core/index.ts +9 -1
- package/core/permits.test.ts +5 -6
- package/core/permits.ts +5 -4
- 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-I5WFEYXX.js} +33 -19
- package/dist/{chunk-UGBVZNRT.js → chunk-R3B5TMVX.js} +308 -189
- package/dist/{chunk-WEAZ25JO.js → chunk-TBLR7NNE.js} +4 -7
- package/dist/{clientTypes-Es7fyi65.d.ts → clientTypes-RqkgkV2i.d.ts} +34 -93
- package/dist/{clientTypes-5_1nwtUe.d.cts → clientTypes-e4filDzK.d.cts} +34 -93
- package/dist/core.cjs +343 -208
- package/dist/core.d.cts +17 -6
- package/dist/core.d.ts +17 -6
- package/dist/core.js +3 -3
- package/dist/node.cjs +337 -208
- package/dist/node.d.cts +3 -3
- package/dist/node.d.ts +3 -3
- package/dist/node.js +3 -3
- 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 +337 -208
- package/dist/web.d.cts +3 -3
- package/dist/web.d.ts +3 -3
- package/dist/web.js +3 -3
- 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/dist/types-KImPrEIe.d.cts +0 -48
- package/dist/types-KImPrEIe.d.ts +0 -48
|
@@ -10,21 +10,18 @@ var CofheChainSchema = z.object({
|
|
|
10
10
|
/** Network identifier */
|
|
11
11
|
network: z.string().min(1),
|
|
12
12
|
/** coFhe service URL */
|
|
13
|
-
coFheUrl: z.
|
|
13
|
+
coFheUrl: z.url(),
|
|
14
14
|
/** Verifier service URL */
|
|
15
|
-
verifierUrl: z.
|
|
15
|
+
verifierUrl: z.url(),
|
|
16
16
|
/** Threshold network service URL */
|
|
17
|
-
thresholdNetworkUrl: z.
|
|
17
|
+
thresholdNetworkUrl: z.url(),
|
|
18
18
|
/** Environment type */
|
|
19
19
|
environment: EnvironmentSchema
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
// chains/defineChain.ts
|
|
23
21
|
function defineChain(chainConfig) {
|
|
24
22
|
const result = CofheChainSchema.safeParse(chainConfig);
|
|
25
23
|
if (!result.success) {
|
|
26
|
-
|
|
27
|
-
throw new Error(`Invalid chain configuration: ${errorMessages.join(", ")}`);
|
|
24
|
+
throw new Error(`Invalid chain configuration: ${z.prettifyError(result.error)}`, { cause: result.error });
|
|
28
25
|
}
|
|
29
26
|
return result.data;
|
|
30
27
|
}
|
|
@@ -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.js';
|
|
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.js';
|
|
5
5
|
import { StoreApi } from 'zustand/vanilla';
|
|
6
6
|
|
|
7
7
|
type TfheInitializer = () => Promise<boolean>;
|
|
@@ -214,113 +214,48 @@ type CofhesdkInternalConfig = {
|
|
|
214
214
|
* Zod schema for configuration validation
|
|
215
215
|
*/
|
|
216
216
|
declare const CofhesdkConfigSchema: z.ZodObject<{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
}>>;
|
|
240
|
+
permitGeneration: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
241
|
+
ON_CONNECT: "ON_CONNECT";
|
|
242
|
+
ON_DECRYPT_HANDLES: "ON_DECRYPT_HANDLES";
|
|
243
|
+
MANUAL: "MANUAL";
|
|
244
|
+
}>>>;
|
|
240
245
|
defaultPermitExpiration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
241
|
-
/** Storage method for fhe keys (defaults to indexedDB on web, filesystem on node) */
|
|
242
246
|
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) */
|
|
247
|
+
getItem: z.ZodCustom<(name: string) => Promise<any>, (name: string) => Promise<any>>;
|
|
248
|
+
setItem: z.ZodCustom<(name: string, value: any) => Promise<void>, (name: string, value: any) => Promise<void>>;
|
|
249
|
+
removeItem: z.ZodCustom<(name: string) => Promise<void>, (name: string) => Promise<void>>;
|
|
250
|
+
}, z.core.$strip>, z.ZodNull]>>;
|
|
256
251
|
useWorkers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
257
|
-
/** Mocks configs */
|
|
258
252
|
mocks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
259
253
|
sealOutputDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
260
|
-
},
|
|
261
|
-
sealOutputDelay: number;
|
|
262
|
-
}, {
|
|
263
|
-
sealOutputDelay?: number | undefined;
|
|
264
|
-
}>>>;
|
|
265
|
-
/** Internal configuration */
|
|
254
|
+
}, z.core.$strip>>>;
|
|
266
255
|
_internal: z.ZodOptional<z.ZodObject<{
|
|
267
256
|
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
|
-
}>;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
}, z.core.$strip>;
|
|
324
259
|
/**
|
|
325
260
|
* Input config type inferred from the schema
|
|
326
261
|
*/
|
|
@@ -843,14 +778,14 @@ declare const permits: {
|
|
|
843
778
|
importShared: (options: ImportSharedPermitOptions | string, publicClient: PublicClient, walletClient: WalletClient) => Promise<RecipientPermit>;
|
|
844
779
|
getOrCreateSelfPermit: (publicClient: PublicClient, walletClient: WalletClient, chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
|
|
845
780
|
getOrCreateSharingPermit: (publicClient: PublicClient, walletClient: WalletClient, options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
|
|
846
|
-
getHash: (permit:
|
|
781
|
+
getHash: (permit: PermitHashFields) => string;
|
|
847
782
|
serialize: (permit: Permit) => SerializedPermit;
|
|
848
783
|
deserialize: (serialized: SerializedPermit) => Permit;
|
|
849
784
|
getPermit: (chainId: number, account: string, hash: string) => Promise<Permit | undefined>;
|
|
850
785
|
getPermits: (chainId: number, account: string) => Promise<Record<string, Permit>>;
|
|
851
786
|
getActivePermit: (chainId: number, account: string) => Promise<Permit | undefined>;
|
|
852
787
|
getActivePermitHash: (chainId: number, account: string) => string | undefined;
|
|
853
|
-
removePermit: (chainId: number, account: string, hash: string
|
|
788
|
+
removePermit: (chainId: number, account: string, hash: string) => Promise<void>;
|
|
854
789
|
selectActivePermit: (chainId: number, account: string, hash: string) => void;
|
|
855
790
|
removeActivePermit: (chainId: number, account: string) => Promise<void>;
|
|
856
791
|
};
|
|
@@ -862,6 +797,12 @@ type CofhesdkClient<TConfig extends CofhesdkConfig = CofhesdkConfig> = {
|
|
|
862
797
|
readonly connecting: boolean;
|
|
863
798
|
readonly config: TConfig;
|
|
864
799
|
connect(publicClient: PublicClient, walletClient: WalletClient): Promise<void>;
|
|
800
|
+
/**
|
|
801
|
+
* Clears the current connection state (account/chainId/clients) and marks the client as disconnected.
|
|
802
|
+
*
|
|
803
|
+
* This does not delete persisted permits or stored FHE keys; it only resets the in-memory connection.
|
|
804
|
+
*/
|
|
805
|
+
disconnect(): void;
|
|
865
806
|
/**
|
|
866
807
|
* Types docstring
|
|
867
808
|
*/
|
|
@@ -896,7 +837,7 @@ type CofhesdkClientPermits = {
|
|
|
896
837
|
getOrCreateSelfPermit: (chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
|
|
897
838
|
getOrCreateSharingPermit: (options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
|
|
898
839
|
selectActivePermit: (hash: string, chainId?: number, account?: string) => void;
|
|
899
|
-
removePermit: (hash: string, chainId?: number, account?: string
|
|
840
|
+
removePermit: (hash: string, chainId?: number, account?: string) => void;
|
|
900
841
|
removeActivePermit: (chainId?: number, account?: string) => void;
|
|
901
842
|
getHash: typeof PermitUtils.getHash;
|
|
902
843
|
serialize: typeof PermitUtils.serialize;
|
|
@@ -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>;
|
|
@@ -214,113 +214,48 @@ type CofhesdkInternalConfig = {
|
|
|
214
214
|
* Zod schema for configuration validation
|
|
215
215
|
*/
|
|
216
216
|
declare const CofhesdkConfigSchema: z.ZodObject<{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
}>>;
|
|
240
|
+
permitGeneration: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
241
|
+
ON_CONNECT: "ON_CONNECT";
|
|
242
|
+
ON_DECRYPT_HANDLES: "ON_DECRYPT_HANDLES";
|
|
243
|
+
MANUAL: "MANUAL";
|
|
244
|
+
}>>>;
|
|
240
245
|
defaultPermitExpiration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
241
|
-
/** Storage method for fhe keys (defaults to indexedDB on web, filesystem on node) */
|
|
242
246
|
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) */
|
|
247
|
+
getItem: z.ZodCustom<(name: string) => Promise<any>, (name: string) => Promise<any>>;
|
|
248
|
+
setItem: z.ZodCustom<(name: string, value: any) => Promise<void>, (name: string, value: any) => Promise<void>>;
|
|
249
|
+
removeItem: z.ZodCustom<(name: string) => Promise<void>, (name: string) => Promise<void>>;
|
|
250
|
+
}, z.core.$strip>, z.ZodNull]>>;
|
|
256
251
|
useWorkers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
257
|
-
/** Mocks configs */
|
|
258
252
|
mocks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
259
253
|
sealOutputDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
260
|
-
},
|
|
261
|
-
sealOutputDelay: number;
|
|
262
|
-
}, {
|
|
263
|
-
sealOutputDelay?: number | undefined;
|
|
264
|
-
}>>>;
|
|
265
|
-
/** Internal configuration */
|
|
254
|
+
}, z.core.$strip>>>;
|
|
266
255
|
_internal: z.ZodOptional<z.ZodObject<{
|
|
267
256
|
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
|
-
}>;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
}, z.core.$strip>;
|
|
324
259
|
/**
|
|
325
260
|
* Input config type inferred from the schema
|
|
326
261
|
*/
|
|
@@ -843,14 +778,14 @@ declare const permits: {
|
|
|
843
778
|
importShared: (options: ImportSharedPermitOptions | string, publicClient: PublicClient, walletClient: WalletClient) => Promise<RecipientPermit>;
|
|
844
779
|
getOrCreateSelfPermit: (publicClient: PublicClient, walletClient: WalletClient, chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
|
|
845
780
|
getOrCreateSharingPermit: (publicClient: PublicClient, walletClient: WalletClient, options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
|
|
846
|
-
getHash: (permit:
|
|
781
|
+
getHash: (permit: PermitHashFields) => string;
|
|
847
782
|
serialize: (permit: Permit) => SerializedPermit;
|
|
848
783
|
deserialize: (serialized: SerializedPermit) => Permit;
|
|
849
784
|
getPermit: (chainId: number, account: string, hash: string) => Promise<Permit | undefined>;
|
|
850
785
|
getPermits: (chainId: number, account: string) => Promise<Record<string, Permit>>;
|
|
851
786
|
getActivePermit: (chainId: number, account: string) => Promise<Permit | undefined>;
|
|
852
787
|
getActivePermitHash: (chainId: number, account: string) => string | undefined;
|
|
853
|
-
removePermit: (chainId: number, account: string, hash: string
|
|
788
|
+
removePermit: (chainId: number, account: string, hash: string) => Promise<void>;
|
|
854
789
|
selectActivePermit: (chainId: number, account: string, hash: string) => void;
|
|
855
790
|
removeActivePermit: (chainId: number, account: string) => Promise<void>;
|
|
856
791
|
};
|
|
@@ -862,6 +797,12 @@ type CofhesdkClient<TConfig extends CofhesdkConfig = CofhesdkConfig> = {
|
|
|
862
797
|
readonly connecting: boolean;
|
|
863
798
|
readonly config: TConfig;
|
|
864
799
|
connect(publicClient: PublicClient, walletClient: WalletClient): Promise<void>;
|
|
800
|
+
/**
|
|
801
|
+
* Clears the current connection state (account/chainId/clients) and marks the client as disconnected.
|
|
802
|
+
*
|
|
803
|
+
* This does not delete persisted permits or stored FHE keys; it only resets the in-memory connection.
|
|
804
|
+
*/
|
|
805
|
+
disconnect(): void;
|
|
865
806
|
/**
|
|
866
807
|
* Types docstring
|
|
867
808
|
*/
|
|
@@ -896,7 +837,7 @@ type CofhesdkClientPermits = {
|
|
|
896
837
|
getOrCreateSelfPermit: (chainId?: number, account?: string, options?: CreateSelfPermitOptions) => Promise<Permit>;
|
|
897
838
|
getOrCreateSharingPermit: (options: CreateSharingPermitOptions, chainId?: number, account?: string) => Promise<Permit>;
|
|
898
839
|
selectActivePermit: (hash: string, chainId?: number, account?: string) => void;
|
|
899
|
-
removePermit: (hash: string, chainId?: number, account?: string
|
|
840
|
+
removePermit: (hash: string, chainId?: number, account?: string) => void;
|
|
900
841
|
removeActivePermit: (chainId?: number, account?: string) => void;
|
|
901
842
|
getHash: typeof PermitUtils.getHash;
|
|
902
843
|
serialize: typeof PermitUtils.serialize;
|