Skip to content

Commit

Permalink
Merge pull request #89 from martillansky/testnets
Browse files Browse the repository at this point in the history
fix: missing registration for vouchers when profile has been transferred
  • Loading branch information
martillansky authored Oct 15, 2024
2 parents be4eeb9 + 31f5a45 commit 0a501eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@
"wagmi": "wagmi generate",
"tsc": "tsc --noEmit && next lint",
"func": "netlify dev"
}
},
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
16 changes: 12 additions & 4 deletions src/data/sanitizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const sanitizeRequest = async (request: RequestQuery['request'], chainId:
request.humanity.winnerClaim[0].evidenceGroup.evidence = transferringRequest?.evidenceGroup.evidence as any;
} else {
//request.humanity = transferringRequestComplete?.humanity as any;
request.claimer = transferringRequestComplete?.claimer as any;
request.claimer.name = transferringRequestComplete?.claimer.name as any;
request.evidenceGroup = transferringRequestComplete?.evidenceGroup as any;
//request.challenges = transferringRequestComplete?.challenges as any;
}
Expand Down Expand Up @@ -295,8 +295,9 @@ export const sanitizeClaimerData = async (out: Record<SupportedChainId, ClaimerQ

if (voucherEvidenceChain) {
const isClaimerIncomplete =
out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim.length > 0 &&
out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim.at(0)!.evidenceGroup.evidence.length===0;
out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim.length == 0 ||
(out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim.length > 0 &&
out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim.at(0)!.evidenceGroup.evidence.length===0);

if (isClaimerIncomplete) {
const lastTransf = await getProfileLastTransferringRequest(voucherEvidenceChain.id, id);
Expand All @@ -318,7 +319,14 @@ export const sanitizeClaimerData = async (out: Record<SupportedChainId, ClaimerQ
: '';

if (!!lastTransf?.transferringRequest?.evidenceGroup.evidence) {
out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim.at(0)!.evidenceGroup.evidence = JSON.parse(JSON.stringify(lastTransf?.transferringRequest?.evidenceGroup.evidence));
//out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim.at(0)!.evidenceGroup.evidence = JSON.parse(JSON.stringify(lastTransf?.transferringRequest?.evidenceGroup.evidence));
out[voucherEvidenceChain.id].claimer!.registration!.humanity.winnerClaim = [
{
'index': lastTransf?.transferringRequest?.index,
'resolutionTime': lastTransf?.transferringRequest?.lastStatusChange,
'evidenceGroup': lastTransf?.transferringRequest?.evidenceGroup
}
]
}
}
} else { // If profile has been bridged, we need to look for the crossChainRegistration
Expand Down

0 comments on commit 0a501eb

Please sign in to comment.