@crisp-e3/sdk 0.6.0 → 0.7.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 +4 -6
- package/dist/index.d.ts +12 -12
- package/dist/index.js +173 -165
- package/dist/index.js.map +1 -1
- package/dist/workers/generateCircuitInputs.worker.js.map +1 -1
- package/package.json +2 -2
- package/dist/.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -149,10 +149,10 @@ const address = await getAddressFromSignature(signature, messageHash)
|
|
|
149
149
|
#### State Utilities
|
|
150
150
|
|
|
151
151
|
```typescript
|
|
152
|
-
import { getPreviousCiphertext
|
|
152
|
+
import { getPreviousCiphertext } from '@crisp-e3/sdk'
|
|
153
153
|
|
|
154
154
|
const previousCiphertext = await getPreviousCiphertext(serverUrl, e3Id, slotAddress)
|
|
155
|
-
|
|
155
|
+
// Returns undefined when the slot is empty (404)
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
## API
|
|
@@ -170,10 +170,8 @@ const isEmpty = await getIsSlotEmpty(serverUrl, e3Id, slotAddress)
|
|
|
170
170
|
- `getRoundDetails(serverUrl: string, e3Id: number): Promise<RoundDetails>` - Get round details
|
|
171
171
|
- `getRoundTokenDetails(serverUrl: string, e3Id: number): Promise<TokenDetails>` - Get token details
|
|
172
172
|
for a round
|
|
173
|
-
- `getPreviousCiphertext(serverUrl: string, e3Id: number, address: string): Promise<Uint8Array>` -
|
|
174
|
-
Get previous ciphertext for a slot
|
|
175
|
-
- `getIsSlotEmpty(serverUrl: string, e3Id: number, address: string): Promise<boolean>` - Check if a
|
|
176
|
-
slot is empty
|
|
173
|
+
- `getPreviousCiphertext(serverUrl: string, e3Id: number, address: string): Promise<Uint8Array | undefined>` -
|
|
174
|
+
Get previous ciphertext for a slot (undefined when slot is empty)
|
|
177
175
|
|
|
178
176
|
### Token Functions
|
|
179
177
|
|
package/dist/index.d.ts
CHANGED
|
@@ -146,21 +146,15 @@ declare const getRoundDetails: (serverUrl: string, e3Id: number) => Promise<Roun
|
|
|
146
146
|
*/
|
|
147
147
|
declare const getRoundTokenDetails: (serverUrl: string, e3Id: number) => Promise<TokenDetails>;
|
|
148
148
|
/**
|
|
149
|
-
* Get the previous ciphertext for a slot from the CRISP server
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* @param address - The address of the slot
|
|
153
|
-
* @returns The previous ciphertext for the slot
|
|
154
|
-
*/
|
|
155
|
-
declare const getPreviousCiphertext: (serverUrl: string, e3Id: number, address: string) => Promise<Uint8Array>;
|
|
156
|
-
/**
|
|
157
|
-
* Check if a slot is empty for a given E3 ID and slot address
|
|
149
|
+
* Get the previous ciphertext for a slot from the CRISP server.
|
|
150
|
+
* Returns undefined when the slot is empty (404).
|
|
151
|
+
*
|
|
158
152
|
* @param serverUrl - The base URL of the CRISP server
|
|
159
153
|
* @param e3Id - The e3Id of the round
|
|
160
154
|
* @param address - The address of the slot
|
|
161
|
-
* @returns
|
|
155
|
+
* @returns The previous ciphertext for the slot, or undefined if the slot is empty
|
|
162
156
|
*/
|
|
163
|
-
declare const
|
|
157
|
+
declare const getPreviousCiphertext: (serverUrl: string, e3Id: number, address: string) => Promise<Uint8Array | undefined>;
|
|
164
158
|
|
|
165
159
|
declare const MERKLE_TREE_MAX_DEPTH = 20;
|
|
166
160
|
/**
|
|
@@ -241,6 +235,7 @@ declare const generateBFVKeys: () => {
|
|
|
241
235
|
publicKey: Uint8Array;
|
|
242
236
|
};
|
|
243
237
|
|
|
238
|
+
declare const destroyBBApi: () => void;
|
|
244
239
|
/**
|
|
245
240
|
* Validate a vote.
|
|
246
241
|
* @param vote - The vote to validate.
|
|
@@ -295,10 +290,15 @@ declare class CrispSDK {
|
|
|
295
290
|
generateMaskVoteProof(maskProofInputs: MaskVoteProofRequest): Promise<ProofData>;
|
|
296
291
|
/**
|
|
297
292
|
* Generate a proof for a vote.
|
|
293
|
+
*
|
|
294
|
+
* Note: The previous ciphertext is not used in the proof computation. This method still calls
|
|
295
|
+
* the same server API (previous-ciphertext) as {@link generateMaskVoteProof} to prevent the
|
|
296
|
+
* server from inferring the vote type (mask vs normal) from the client's API usage pattern.
|
|
297
|
+
*
|
|
298
298
|
* @param voteProofInputs - The inputs required to generate the vote proof.
|
|
299
299
|
* @returns A promise that resolves to the generated proof data.
|
|
300
300
|
*/
|
|
301
301
|
generateVoteProof(voteProofInputs: VoteProofRequest): Promise<ProofData>;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
export { CreditMode, CrispSDK, MERKLE_TREE_MAX_DEPTH, type MaskVoteProofInputs, type RoundDetails, type RoundDetailsResponse, SIGNATURE_MESSAGE, SIGNATURE_MESSAGE_HASH, type TokenDetails, type Vote, type VoteProofInputs, decodeTally, encodeSolidityProof, encryptVote, generateBFVKeys, generateMaskVoteProof, generateMerkleProof, generateMerkleTree, generateVoteProof, getAddressFromSignature, getBalanceAt,
|
|
304
|
+
export { CreditMode, CrispSDK, MERKLE_TREE_MAX_DEPTH, type MaskVoteProofInputs, type ProofData, type RoundDetails, type RoundDetailsResponse, SIGNATURE_MESSAGE, SIGNATURE_MESSAGE_HASH, type TokenDetails, type Vote, type VoteProofInputs, decodeTally, destroyBBApi, encodeSolidityProof, encryptVote, generateBFVKeys, generateMaskVoteProof, generateMerkleProof, generateMerkleTree, generateVoteProof, getAddressFromSignature, getBalanceAt, getMaxVoteValue, getPreviousCiphertext, getRoundDetails, getRoundTokenDetails, getTotalSupplyAt, getTreeData, getZeroVote, hashLeaf, validateVote, verifyProof };
|