@crisp-e3/sdk 0.15.0 → 0.17.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/README.md +6 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +150 -76
- package/dist/index.js +160 -2861
- package/dist/index.js.map +1 -1
- package/dist/workers/generateCircuitInputs.worker.js +56 -42
- package/dist/workers/generateCircuitInputs.worker.js.map +1 -1
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Hex } from 'viem';
|
|
|
6
6
|
* @param serverUrl - The base URL of the CRISP server
|
|
7
7
|
* @param e3Id - The e3Id of the round
|
|
8
8
|
*/
|
|
9
|
-
declare const getTreeData: (serverUrl: string, e3Id:
|
|
9
|
+
declare const getTreeData: (serverUrl: string, e3Id: bigint) => Promise<bigint[]>;
|
|
10
10
|
/**
|
|
11
11
|
* Get the token balance at a specific block for a given address
|
|
12
12
|
* @param voterAddress - The address of the voter
|
|
@@ -95,53 +95,71 @@ type ProofData = {
|
|
|
95
95
|
proof: Uint8Array;
|
|
96
96
|
encryptedVote: Uint8Array;
|
|
97
97
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Which circuit a ballot is built for.
|
|
100
|
+
*
|
|
101
|
+
* `merkle` proves membership of a census tree, and matches `CensusMode.TOKEN` and
|
|
102
|
+
* `CensusMode.BY_REQUESTER`. `onchain` takes voting power as a public input that the contract
|
|
103
|
+
* reads from the token, and matches `CensusMode.ONCHAIN`.
|
|
104
|
+
*/
|
|
105
|
+
type CensusVariant = 'merkle' | 'onchain';
|
|
106
|
+
type PrepareBallotInputsBase = {
|
|
103
107
|
previousCiphertext?: Uint8Array;
|
|
104
|
-
numOptions: number;
|
|
105
|
-
};
|
|
106
|
-
type MaskVoteProofRequest = {
|
|
107
|
-
e3Id: number;
|
|
108
108
|
publicKey: Uint8Array;
|
|
109
|
-
balance: bigint;
|
|
110
109
|
slotAddress: string;
|
|
111
|
-
|
|
110
|
+
isMaskVote: boolean;
|
|
112
111
|
numOptions: number;
|
|
113
|
-
};
|
|
114
|
-
type VoteProofInputs = {
|
|
115
|
-
merkleLeaves: string[] | bigint[];
|
|
116
|
-
publicKey: Uint8Array;
|
|
117
|
-
balance: bigint;
|
|
118
112
|
vote: Vote;
|
|
119
|
-
signature: `0x${string}`;
|
|
120
|
-
messageHash: `0x${string}`;
|
|
121
|
-
slotAddress: string;
|
|
122
|
-
previousCiphertext?: Uint8Array;
|
|
123
113
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Everything needed to encrypt a ballot, before the voter has signed anything.
|
|
116
|
+
*/
|
|
117
|
+
type PrepareBallotInputs = (PrepareBallotInputsBase & {
|
|
118
|
+
censusMode: 'merkle';
|
|
128
119
|
balance: bigint;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
120
|
+
merkleLeaves: string[] | bigint[];
|
|
121
|
+
}) | (PrepareBallotInputsBase & {
|
|
122
|
+
censusMode: 'onchain';
|
|
123
|
+
votingPower: bigint;
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* A ballot that is encrypted but not yet signed.
|
|
127
|
+
*
|
|
128
|
+
* `ctCommitment` is the value to pass to `CRISPProgram.ballotDigest`. Reading the digest from the
|
|
129
|
+
* contract rather than rebuilding the EIP-712 struct here keeps one implementation of the domain.
|
|
130
|
+
*/
|
|
131
|
+
type PreparedBallot = {
|
|
132
|
+
circuitInputs: any;
|
|
133
|
+
encryptedVote: Uint8Array;
|
|
134
|
+
ctCommitment: `0x${string}`;
|
|
135
|
+
censusMode: CensusVariant;
|
|
133
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* `Omit` that maps over each member of a union instead of collapsing it.
|
|
139
|
+
*
|
|
140
|
+
* A plain `Omit` on a discriminated union merges the members and loses the discriminant, which
|
|
141
|
+
* would let a caller pass `censusMode: 'onchain'` with no `votingPower`.
|
|
142
|
+
*/
|
|
143
|
+
type DistributiveOmit<T, K extends keyof never> = T extends unknown ? Omit<T, K> : never;
|
|
144
|
+
/**
|
|
145
|
+
* A {@link PrepareBallotInputs} plus the round it belongs to.
|
|
146
|
+
*
|
|
147
|
+
* The SDK resolves `previousCiphertext` from the server, so callers do not pass it.
|
|
148
|
+
*/
|
|
149
|
+
type PrepareBallotRequest = {
|
|
150
|
+
e3Id: bigint;
|
|
151
|
+
} & DistributiveOmit<PrepareBallotInputs, 'previousCiphertext'>;
|
|
134
152
|
/**
|
|
135
153
|
* Type representing the current round returned by the CRISP server (`rounds/current`)
|
|
136
154
|
*/
|
|
137
155
|
type CurrentRoundResponse = {
|
|
138
|
-
id:
|
|
156
|
+
id: string;
|
|
139
157
|
};
|
|
140
158
|
/**
|
|
141
159
|
* Type representing the lite state of a round returned by the CRISP server (`state/lite`)
|
|
142
160
|
*/
|
|
143
161
|
type E3StateLiteResponse = {
|
|
144
|
-
id:
|
|
162
|
+
id: string;
|
|
145
163
|
chain_id: number;
|
|
146
164
|
interfold_address: string;
|
|
147
165
|
status: string;
|
|
@@ -177,7 +195,7 @@ type NewRoundRequest = {
|
|
|
177
195
|
* Type representing a request to broadcast an encrypted vote (`voting/broadcast`)
|
|
178
196
|
*/
|
|
179
197
|
type BroadcastVoteRequest = {
|
|
180
|
-
e3Id:
|
|
198
|
+
e3Id: bigint;
|
|
181
199
|
encodedProof: string;
|
|
182
200
|
address: string;
|
|
183
201
|
};
|
|
@@ -198,7 +216,7 @@ type BroadcastVoteResponse = {
|
|
|
198
216
|
* Type representing the vote status of an address in a round (`voting/status`)
|
|
199
217
|
*/
|
|
200
218
|
type VoteStatusResponse = {
|
|
201
|
-
round_id:
|
|
219
|
+
round_id: string;
|
|
202
220
|
address: string;
|
|
203
221
|
has_voted: boolean;
|
|
204
222
|
round_status: string | null;
|
|
@@ -207,7 +225,7 @@ type VoteStatusResponse = {
|
|
|
207
225
|
* Type representing the result of a round (`state/result` and `state/all`)
|
|
208
226
|
*/
|
|
209
227
|
type WebResultResponse = {
|
|
210
|
-
round_id:
|
|
228
|
+
round_id: string;
|
|
211
229
|
tally: string[];
|
|
212
230
|
option_1_emoji: string;
|
|
213
231
|
option_2_emoji: string;
|
|
@@ -238,14 +256,14 @@ declare enum CreditMode {
|
|
|
238
256
|
* @param e3Id - The e3Id of the round
|
|
239
257
|
* @returns The round details
|
|
240
258
|
*/
|
|
241
|
-
declare const getRoundDetails: (serverUrl: string, e3Id:
|
|
259
|
+
declare const getRoundDetails: (serverUrl: string, e3Id: bigint) => Promise<RoundDetails>;
|
|
242
260
|
/**
|
|
243
261
|
* Get the token address, balance threshold and snapshot block for a specific round
|
|
244
262
|
* @param serverUrl - The base URL of the CRISP server
|
|
245
263
|
* @param e3Id - The e3Id of the round
|
|
246
264
|
* @returns The token address, balance threshold and snapshot block
|
|
247
265
|
*/
|
|
248
|
-
declare const getRoundTokenDetails: (serverUrl: string, e3Id:
|
|
266
|
+
declare const getRoundTokenDetails: (serverUrl: string, e3Id: bigint) => Promise<TokenDetails>;
|
|
249
267
|
/**
|
|
250
268
|
* Get the round data stored in the CRISPProgram contract, such as the merkle root
|
|
251
269
|
* of the census and the merkle root of the encrypted votes published so far.
|
|
@@ -258,7 +276,7 @@ declare const getRoundTokenDetails: (serverUrl: string, e3Id: number) => Promise
|
|
|
258
276
|
* @param chainId - The chain ID of the network the program is deployed on
|
|
259
277
|
* @returns The on chain round data
|
|
260
278
|
*/
|
|
261
|
-
declare const getOnChainRoundData: (programAddress: string, e3Id:
|
|
279
|
+
declare const getOnChainRoundData: (programAddress: string, e3Id: bigint, chainId: number) => Promise<OnChainRoundData>;
|
|
262
280
|
/**
|
|
263
281
|
* Get the previous ciphertext for a slot from the CRISP server.
|
|
264
282
|
* Returns undefined when the slot is empty (404).
|
|
@@ -268,7 +286,7 @@ declare const getOnChainRoundData: (programAddress: string, e3Id: number, chainI
|
|
|
268
286
|
* @param address - The address of the slot
|
|
269
287
|
* @returns The previous ciphertext for the slot, or undefined if the slot is empty
|
|
270
288
|
*/
|
|
271
|
-
declare const getPreviousCiphertext: (serverUrl: string, e3Id:
|
|
289
|
+
declare const getPreviousCiphertext: (serverUrl: string, e3Id: bigint, address: string) => Promise<Uint8Array | undefined>;
|
|
272
290
|
|
|
273
291
|
/**
|
|
274
292
|
* Get the current (most recent) round, optionally filtered by requester addresses.
|
|
@@ -284,14 +302,14 @@ declare const getCurrentRound: (serverUrl: string, requesters?: string[]) => Pro
|
|
|
284
302
|
* @param e3Id - The e3Id of the round
|
|
285
303
|
* @returns The committee public key bytes
|
|
286
304
|
*/
|
|
287
|
-
declare const getRoundPublicKey: (serverUrl: string, e3Id:
|
|
305
|
+
declare const getRoundPublicKey: (serverUrl: string, e3Id: bigint) => Promise<Uint8Array>;
|
|
288
306
|
/**
|
|
289
307
|
* Get the ciphertext output for a given round.
|
|
290
308
|
* @param serverUrl - The base URL of the CRISP server
|
|
291
309
|
* @param e3Id - The e3Id of the round
|
|
292
310
|
* @returns The ciphertext output bytes
|
|
293
311
|
*/
|
|
294
|
-
declare const getRoundCiphertext: (serverUrl: string, e3Id:
|
|
312
|
+
declare const getRoundCiphertext: (serverUrl: string, e3Id: bigint) => Promise<Uint8Array>;
|
|
295
313
|
/**
|
|
296
314
|
* Request a new E3 round. Requires the server's cron API key.
|
|
297
315
|
* @param serverUrl - The base URL of the CRISP server
|
|
@@ -313,14 +331,14 @@ declare const broadcastVote: (serverUrl: string, request: BroadcastVoteRequest)
|
|
|
313
331
|
* @param address - The voter address
|
|
314
332
|
* @returns The vote status for the address
|
|
315
333
|
*/
|
|
316
|
-
declare const getVoteStatus: (serverUrl: string, e3Id:
|
|
334
|
+
declare const getVoteStatus: (serverUrl: string, e3Id: bigint, address: string) => Promise<VoteStatusResponse>;
|
|
317
335
|
/**
|
|
318
336
|
* Get the result for a given round.
|
|
319
337
|
* @param serverUrl - The base URL of the CRISP server
|
|
320
338
|
* @param e3Id - The e3Id of the round
|
|
321
339
|
* @returns The round result (tally, emojis, total votes, end time and requester)
|
|
322
340
|
*/
|
|
323
|
-
declare const getRoundResult: (serverUrl: string, e3Id:
|
|
341
|
+
declare const getRoundResult: (serverUrl: string, e3Id: bigint) => Promise<WebResultResponse>;
|
|
324
342
|
/**
|
|
325
343
|
* Get the results for all rounds, optionally filtered by requester addresses.
|
|
326
344
|
* @param serverUrl - The base URL of the CRISP server
|
|
@@ -335,7 +353,7 @@ declare const getAllRoundResults: (serverUrl: string, requesters?: string[]) =>
|
|
|
335
353
|
* @param e3Id - The e3Id of the round
|
|
336
354
|
* @returns The lite round state
|
|
337
355
|
*/
|
|
338
|
-
declare const getRoundStateLite: (serverUrl: string, e3Id:
|
|
356
|
+
declare const getRoundStateLite: (serverUrl: string, e3Id: bigint) => Promise<E3StateLiteResponse>;
|
|
339
357
|
/**
|
|
340
358
|
* Get the token holder hashes (hash(address, balance)) for a given round.
|
|
341
359
|
* These are the Merkle tree leaves used for eligibility proofs.
|
|
@@ -343,14 +361,14 @@ declare const getRoundStateLite: (serverUrl: string, e3Id: number) => Promise<E3
|
|
|
343
361
|
* @param e3Id - The e3Id of the round
|
|
344
362
|
* @returns The list of token holder hashes
|
|
345
363
|
*/
|
|
346
|
-
declare const getTokenHolderHashes: (serverUrl: string, e3Id:
|
|
364
|
+
declare const getTokenHolderHashes: (serverUrl: string, e3Id: bigint) => Promise<string[]>;
|
|
347
365
|
/**
|
|
348
366
|
* Get the eligible addresses and their balances for a given round.
|
|
349
367
|
* @param serverUrl - The base URL of the CRISP server
|
|
350
368
|
* @param e3Id - The e3Id of the round
|
|
351
369
|
* @returns The list of eligible token holders
|
|
352
370
|
*/
|
|
353
|
-
declare const getEligibleAddresses: (serverUrl: string, e3Id:
|
|
371
|
+
declare const getEligibleAddresses: (serverUrl: string, e3Id: bigint) => Promise<TokenHolder[]>;
|
|
354
372
|
|
|
355
373
|
declare const MERKLE_TREE_MAX_DEPTH = 20;
|
|
356
374
|
declare const MAX_MSG_NON_ZERO_COEFFS = 100;
|
|
@@ -467,7 +485,27 @@ declare const generateBFVKeys: () => {
|
|
|
467
485
|
publicKey: Uint8Array;
|
|
468
486
|
};
|
|
469
487
|
|
|
488
|
+
/**
|
|
489
|
+
* Split a 32-byte digest into the two 16-byte halves the circuit takes as public inputs.
|
|
490
|
+
*
|
|
491
|
+
* A Keccak digest is 256 bits and a field element holds fewer than 254, so it cannot cross the
|
|
492
|
+
* circuit boundary in one piece. `crisp_lib::ecdsa::digest_from_halves` rebuilds the 32 bytes and
|
|
493
|
+
* range-checks each half, and `CRISPProgram.publishInput` splits the same way.
|
|
494
|
+
*
|
|
495
|
+
* @param digest The 32-byte ballot digest.
|
|
496
|
+
* @returns The high and low halves as hex field elements.
|
|
497
|
+
*/
|
|
498
|
+
declare const splitDigest: (digest: `0x${string}`) => {
|
|
499
|
+
digestHi: `0x${string}`;
|
|
500
|
+
digestLo: `0x${string}`;
|
|
501
|
+
};
|
|
502
|
+
|
|
470
503
|
declare const destroyBBApi: () => void;
|
|
504
|
+
/**
|
|
505
|
+
* Encrypt a ballot and build every circuit input that does not depend on the signature.
|
|
506
|
+
* Runs in a worker when available to avoid blocking the main thread.
|
|
507
|
+
*/
|
|
508
|
+
declare const prepareCircuitInputs: (inputs: PrepareBallotInputs) => Promise<PreparedBallot>;
|
|
471
509
|
/**
|
|
472
510
|
* Validate a vote.
|
|
473
511
|
* @param vote - The vote to validate.
|
|
@@ -475,23 +513,48 @@ declare const destroyBBApi: () => void;
|
|
|
475
513
|
*/
|
|
476
514
|
declare const validateVote: (vote: Vote, balance: bigint) => void;
|
|
477
515
|
/**
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
516
|
+
* Phase one: encrypt a ballot, before the voter signs anything.
|
|
517
|
+
*
|
|
518
|
+
* A ballot must be encrypted before it can be signed, because the digest binds the ciphertext.
|
|
519
|
+
* Take `ctCommitment` from the result, read the digest from `CRISPProgram.ballotDigest`, have the
|
|
520
|
+
* voter sign it, then call {@link finishBallotProof}.
|
|
521
|
+
*
|
|
522
|
+
* @param inputs - The ballot to encrypt.
|
|
523
|
+
* @returns The prepared ballot.
|
|
524
|
+
*/
|
|
525
|
+
declare const prepareBallot: (inputs: PrepareBallotInputs) => Promise<PreparedBallot>;
|
|
526
|
+
/**
|
|
527
|
+
* Phase two: prove a prepared ballot, given the signature over its digest.
|
|
528
|
+
*
|
|
529
|
+
* Get the digest from `CRISPProgram.ballotDigest(e3Id, slot, prepared.ctCommitment)` and have the
|
|
530
|
+
* voter sign it. Reading it from the contract rather than rebuilding the EIP-712 struct here means
|
|
531
|
+
* there is only one implementation of the domain to keep correct.
|
|
532
|
+
*
|
|
533
|
+
* @param prepared The output of `prepareBallot`.
|
|
534
|
+
* @param digest The ballot digest.
|
|
535
|
+
* @param signature The voter signature over that digest.
|
|
536
|
+
* @returns The proof.
|
|
481
537
|
*/
|
|
482
|
-
declare const
|
|
538
|
+
declare const finishBallotProof: (prepared: PreparedBallot, digest: `0x${string}`, signature: `0x${string}`) => Promise<ProofData>;
|
|
483
539
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
540
|
+
* Phase two for a mask.
|
|
541
|
+
*
|
|
542
|
+
* A mask carries the same digest as a real vote, because `CRISPProgram.publishInput` computes it
|
|
543
|
+
* for every input regardless of branch. Only the signature is a placeholder, and the circuit does
|
|
544
|
+
* not check it on the mask branch. Passing a real digest here is what keeps a mask and a vote
|
|
545
|
+
* indistinguishable in the published public inputs.
|
|
546
|
+
*
|
|
547
|
+
* @param prepared The output of `prepareBallot` with `isMaskVote: true`.
|
|
548
|
+
* @param digest The ballot digest, from the same contract call a real vote would use.
|
|
549
|
+
* @returns The proof.
|
|
487
550
|
*/
|
|
488
|
-
declare const
|
|
551
|
+
declare const finishMaskProof: (prepared: PreparedBallot, digest: `0x${string}`) => Promise<ProofData>;
|
|
489
552
|
/**
|
|
490
553
|
* Locally verify a Noir proof.
|
|
491
554
|
* @param proof - The proof to verify.
|
|
492
555
|
* @returns True if the proof is valid, false otherwise.
|
|
493
556
|
*/
|
|
494
|
-
declare const verifyProof: (proof: ProofData) => Promise<boolean>;
|
|
557
|
+
declare const verifyProof: (proof: ProofData, censusMode?: CensusVariant) => Promise<boolean>;
|
|
495
558
|
/**
|
|
496
559
|
* Encode the proof data into a format that can be used by the CRISP program in Solidity
|
|
497
560
|
* to validate the proof.
|
|
@@ -515,22 +578,33 @@ declare class CrispSDK {
|
|
|
515
578
|
*/
|
|
516
579
|
constructor(serverUrl: string);
|
|
517
580
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
581
|
+
* Phase one: encrypt a ballot, before the voter signs anything.
|
|
582
|
+
*
|
|
583
|
+
* A ballot has to be encrypted before it can be signed, because the digest binds the ciphertext.
|
|
584
|
+
* Take `ctCommitment` from the result, read the digest from
|
|
585
|
+
* `CRISPProgram.ballotDigest(e3Id, slot, ctCommitment)`, have the voter sign it, then call
|
|
586
|
+
* {@link finishBallot}.
|
|
587
|
+
*
|
|
588
|
+
* Masks and real votes take the same path. This method calls the same server API
|
|
589
|
+
* (previous-ciphertext) for both, so the server cannot infer the ballot type from the request
|
|
590
|
+
* pattern, and the encryption is identical either way.
|
|
591
|
+
*
|
|
592
|
+
* @param request - The ballot to encrypt.
|
|
593
|
+
* @returns A promise that resolves to the prepared ballot.
|
|
521
594
|
*/
|
|
522
|
-
|
|
595
|
+
prepareBallot(request: PrepareBallotRequest): Promise<PreparedBallot>;
|
|
523
596
|
/**
|
|
524
|
-
*
|
|
597
|
+
* Phase two: prove a prepared ballot.
|
|
525
598
|
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
* server from inferring the vote type (mask vs normal) from the client's API usage pattern.
|
|
599
|
+
* A mask passes no signature and gets the placeholder. It still carries the same digest as a
|
|
600
|
+
* real vote, because the contract computes the digest for every input.
|
|
529
601
|
*
|
|
530
|
-
* @param
|
|
602
|
+
* @param prepared - The output of {@link prepareBallot}.
|
|
603
|
+
* @param digest - The digest read from `CRISPProgram.ballotDigest`.
|
|
604
|
+
* @param signature - The voter signature, omitted for a mask.
|
|
531
605
|
* @returns A promise that resolves to the generated proof data.
|
|
532
606
|
*/
|
|
533
|
-
|
|
607
|
+
finishBallot(prepared: PreparedBallot, digest: `0x${string}`, signature?: `0x${string}`): Promise<ProofData>;
|
|
534
608
|
/**
|
|
535
609
|
* Get the current (most recent) round, optionally filtered by requester addresses.
|
|
536
610
|
* @param requesters - Optional list of requester addresses to filter by
|
|
@@ -542,13 +616,13 @@ declare class CrispSDK {
|
|
|
542
616
|
* @param e3Id - The e3Id of the round
|
|
543
617
|
* @returns The committee public key bytes
|
|
544
618
|
*/
|
|
545
|
-
getRoundPublicKey(e3Id:
|
|
619
|
+
getRoundPublicKey(e3Id: bigint): Promise<Uint8Array>;
|
|
546
620
|
/**
|
|
547
621
|
* Get the ciphertext output for a given round.
|
|
548
622
|
* @param e3Id - The e3Id of the round
|
|
549
623
|
* @returns The ciphertext output bytes
|
|
550
624
|
*/
|
|
551
|
-
getRoundCiphertext(e3Id:
|
|
625
|
+
getRoundCiphertext(e3Id: bigint): Promise<Uint8Array>;
|
|
552
626
|
/**
|
|
553
627
|
* Request a new E3 round. Requires the server's cron API key.
|
|
554
628
|
* @param request - The new round request (cron API key, token address and balance threshold)
|
|
@@ -567,13 +641,13 @@ declare class CrispSDK {
|
|
|
567
641
|
* @param address - The voter address
|
|
568
642
|
* @returns The vote status for the address
|
|
569
643
|
*/
|
|
570
|
-
getVoteStatus(e3Id:
|
|
644
|
+
getVoteStatus(e3Id: bigint, address: string): Promise<VoteStatusResponse>;
|
|
571
645
|
/**
|
|
572
646
|
* Get the result for a given round.
|
|
573
647
|
* @param e3Id - The e3Id of the round
|
|
574
648
|
* @returns The round result (tally, emojis, total votes, end time and requester)
|
|
575
649
|
*/
|
|
576
|
-
getRoundResult(e3Id:
|
|
650
|
+
getRoundResult(e3Id: bigint): Promise<WebResultResponse>;
|
|
577
651
|
/**
|
|
578
652
|
* Get the results for all rounds, optionally filtered by requester addresses.
|
|
579
653
|
* @param requesters - Optional list of requester addresses to filter by
|
|
@@ -585,13 +659,13 @@ declare class CrispSDK {
|
|
|
585
659
|
* @param e3Id - The e3Id of the round
|
|
586
660
|
* @returns The lite round state
|
|
587
661
|
*/
|
|
588
|
-
getRoundStateLite(e3Id:
|
|
662
|
+
getRoundStateLite(e3Id: bigint): Promise<E3StateLiteResponse>;
|
|
589
663
|
/**
|
|
590
664
|
* Get the details of a specific round in a camelCase convenience format.
|
|
591
665
|
* @param e3Id - The e3Id of the round
|
|
592
666
|
* @returns The round details
|
|
593
667
|
*/
|
|
594
|
-
getRoundDetails(e3Id:
|
|
668
|
+
getRoundDetails(e3Id: bigint): Promise<RoundDetails>;
|
|
595
669
|
/**
|
|
596
670
|
* Get the round data stored in the CRISPProgram contract, read directly from the chain.
|
|
597
671
|
*
|
|
@@ -602,33 +676,33 @@ declare class CrispSDK {
|
|
|
602
676
|
* @param chainId - The chain ID of the network the program is deployed on
|
|
603
677
|
* @returns The on chain round data
|
|
604
678
|
*/
|
|
605
|
-
getOnChainRoundData(programAddress: string, e3Id:
|
|
679
|
+
getOnChainRoundData(programAddress: string, e3Id: bigint, chainId?: number): Promise<OnChainRoundData>;
|
|
606
680
|
/**
|
|
607
681
|
* Get the token address, balance threshold and snapshot block for a specific round.
|
|
608
682
|
* @param e3Id - The e3Id of the round
|
|
609
683
|
* @returns The token details
|
|
610
684
|
*/
|
|
611
|
-
getRoundTokenDetails(e3Id:
|
|
685
|
+
getRoundTokenDetails(e3Id: bigint): Promise<TokenDetails>;
|
|
612
686
|
/**
|
|
613
687
|
* Get the token holder hashes (hash(address, balance)) for a given round.
|
|
614
688
|
* These are the Merkle tree leaves used for eligibility proofs.
|
|
615
689
|
* @param e3Id - The e3Id of the round
|
|
616
690
|
* @returns The list of token holder hashes
|
|
617
691
|
*/
|
|
618
|
-
getTokenHolderHashes(e3Id:
|
|
692
|
+
getTokenHolderHashes(e3Id: bigint): Promise<string[]>;
|
|
619
693
|
/**
|
|
620
694
|
* Get the eligible addresses and their balances for a given round.
|
|
621
695
|
* @param e3Id - The e3Id of the round
|
|
622
696
|
* @returns The list of eligible token holders
|
|
623
697
|
*/
|
|
624
|
-
getEligibleAddresses(e3Id:
|
|
698
|
+
getEligibleAddresses(e3Id: bigint): Promise<TokenHolder[]>;
|
|
625
699
|
/**
|
|
626
700
|
* Get the previous ciphertext input for a slot address in a given round.
|
|
627
701
|
* @param e3Id - The e3Id of the round
|
|
628
702
|
* @param address - The address of the slot
|
|
629
703
|
* @returns The previous ciphertext, or undefined if the slot is empty
|
|
630
704
|
*/
|
|
631
|
-
getPreviousCiphertext(e3Id:
|
|
705
|
+
getPreviousCiphertext(e3Id: bigint, address: string): Promise<Uint8Array | undefined>;
|
|
632
706
|
}
|
|
633
707
|
|
|
634
|
-
export { type BroadcastVoteRequest, type BroadcastVoteResponse, CreditMode, CrispSDK, type CurrentRoundResponse, type E3StateLiteResponse, type JsonResponse, MAX_MSG_NON_ZERO_COEFFS, MAX_VOTE_OPTIONS, MERKLE_TREE_MAX_DEPTH, type
|
|
708
|
+
export { type BroadcastVoteRequest, type BroadcastVoteResponse, type CensusVariant, CreditMode, CrispSDK, type CurrentRoundResponse, type E3StateLiteResponse, type JsonResponse, MAX_MSG_NON_ZERO_COEFFS, MAX_VOTE_OPTIONS, MERKLE_TREE_MAX_DEPTH, type NewRoundRequest, type OnChainRoundData, type PrepareBallotInputs, type PrepareBallotRequest, type PreparedBallot, type ProofData, type RoundDetails, SIGNATURE_MESSAGE, SIGNATURE_MESSAGE_HASH, type TallyResult, type TokenDetails, type TokenHolder, type Vote, type VoteResponseStatus, type VoteStatusResponse, type WebResultResponse, broadcastVote, decodeTally, decryptVote, destroyBBApi, encodeSolidityProof, encodeVote, encryptVote, finishBallotProof, finishMaskProof, generateBFVKeys, generateMerkleProof, generateMerkleTree, getAddressFromSignature, getAllRoundResults, getBalanceAt, getCurrentRound, getEligibleAddresses, getMaxVoteValue, getOnChainRoundData, getPreviousCiphertext, getRoundCiphertext, getRoundDetails, getRoundPublicKey, getRoundResult, getRoundStateLite, getRoundTokenDetails, getScaledBalance, getTokenHolderHashes, getTotalSupplyAt, getTreeData, getVoteStatus, getZeroVote, hashLeaf, prepareBallot, prepareCircuitInputs, requestNewRound, splitDigest, validateVote, verifyProof };
|