Skip to content

Commit

Permalink
Switch decrypt card share to serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
arssly committed Oct 14, 2024
1 parent 7c8734a commit 32b5127
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/ts-sdk/src/Jeton/Jeton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,19 @@ export class Jeton extends EventEmitter<GameEventMap> {
const deck = getDeck(state);
if (!deck) throw new Error("Deck must exist");

const proofPromises: Promise<{
const proofsAndShares: {
proof: Proof;
decryptionCardShare: DecryptionCardShare;
}>[] = [];
cardIndex: number;
}[] = [];

for (const index of indexes) {
proofPromises.push(this.zkDeck.proveDecryptCardShare(this.secretKey, index, deck));
proofsAndShares.push(
await this.zkDeck
.proveDecryptCardShare(this.secretKey, index, deck)
.then((v) => Object.assign({ cardIndex: index as number })),
);
}
const proofsAndShares = (await Promise.all(proofPromises)).map((s, i) =>
Object.assign({ cardIndex: indexes[i] as number }, s),
);
return proofsAndShares;
}

Expand Down

0 comments on commit 32b5127

Please sign in to comment.