Skip to content

Commit

Permalink
feat(claim reputation in background): add ReportStatus enum and use i…
Browse files Browse the repository at this point in the history
…t (UST-138)

Summary:
- Add ReportStatus enum to types/Report and use it in ReportService
- Remove dependency on relay package in api.ts
- This allows claiming reputation in the background without blocking UI

Body:
- Update genReportNonNullifierProof to stringify BigInts in circuitInputs
- Update genReportNullifierProof to stringify BigInts in circuitInputs
- In useReportAdjicatorsReputation, update result.body.message.txHash
  to result.message.txHash
- In useReportEpochKeyRepuation, update result.body.message.txHash
  to result.message.txHash
  • Loading branch information
UranusLin committed Sep 9, 2024
1 parent e80b387 commit 3eea12d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ export async function genReportNonNullifierProof(

const circuitInputs = {
reportedEpochKey: params.reportedEpochKey,
identitySecret,
identitySecret: identitySecret,
reportedEpoch: params.reportedEpoch,
currentEpoch: epoch,
currentNonce: params.nonce,
attesterId,
attesterId: attesterId,
chainId: userState.chainId,
}

const results = await userState.prover.genProofAndPublicSignals(
UnirepSocialCircuit.reportNonNullifierProof,
circuitInputs,
stringifyBigInts(circuitInputs),
)

return new ReportNonNullifierProof(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ export async function genReportNullifierProof(
const reportNullifier = genReportNullifier(identitySecret, reportId)

const circuitInputs = {
reportNullifier,
identitySecret,
reportId,
reportNullifier: reportNullifier,
identitySecret: identitySecret,
reportId: reportId,
currentEpoch: epoch,
currentNonce: params.nonce,
attesterId,
attesterId: attesterId,
chainId: userState.chainId,
}

const results = await userState.prover.genProofAndPublicSignals(
UnirepSocialCircuit.reportNullifierProof,
circuitInputs,
stringifyBigInts(circuitInputs),
)

return new ReportNullifierProof(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function useReportAdjucatorsReputation() {
proof,
)
const provider = getGuaranteedProvider()
await provider.waitForTransaction(result.body.message.txHash)
await provider.waitForTransaction(result.message.txHash)
await userState.waitForSync()

return result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function useReportEpochKeyRepuation() {
proof,
)
const provider = getGuaranteedProvider()
await provider.waitForTransaction(result.body.message.txHash)
await provider.waitForTransaction(result.message.txHash)
await userState.waitForSync()

return result
Expand Down

0 comments on commit 3eea12d

Please sign in to comment.