-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'michael/scroll-token-claim' of https://github.com/votea…
…gora/agora-next into michael/scroll-token-claim
- Loading branch information
Showing
14 changed files
with
122 additions
and
9,159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import prisma from "@/app/lib/prisma"; | |
import { Octokit } from "@octokit/rest"; | ||
import { renderHtml } from "../mail/VerificationCode"; | ||
import { DaoSlug } from "@prisma/client"; | ||
import { CLAIM_STATUS, CLAIM_IDENTIFIER } from "@/app/claim/types"; | ||
|
||
export async function getHardClaimForAddress(address: `0x${string}`) { | ||
return await prisma.hardClaim.findFirst({ | ||
|
@@ -18,7 +19,7 @@ export async function getSoftClaimsForAddress(address: `0x${string}`) { | |
const softClaims = await prisma.softClaim.findMany({ | ||
where: { | ||
recipient: address, | ||
claim_status: "CLAIMED", | ||
claim_status: CLAIM_STATUS.CLAIMED, | ||
}, | ||
select: { | ||
amount: true, | ||
|
@@ -77,12 +78,12 @@ function generateVerificationCode(): string { | |
export async function checkIfGithubHasClaim(githubNodeId: string) { | ||
const githubSoftClaim = await prisma.softClaim.findFirst({ | ||
where: { | ||
claim_type: "GITHUB", | ||
claim_type: CLAIM_IDENTIFIER.GITHUB, | ||
claim_identifier: githubNodeId, | ||
// do we want to do this? | ||
// It will prevent us from sending an email if the user has already tried to claim (pending state) | ||
// or if they have already claimed | ||
claim_status: "UNCLAIMED", | ||
claim_status: CLAIM_STATUS.UNCLAIMED, | ||
}, | ||
}); | ||
|
||
|
@@ -101,12 +102,12 @@ export async function checkIfGithubHasClaim(githubNodeId: string) { | |
export async function checkIfEmailHasClaim(email: string) { | ||
const emailSoftClaim = await prisma.softClaim.findFirst({ | ||
where: { | ||
claim_type: "EMAIL", | ||
claim_type: CLAIM_IDENTIFIER.EMAIL, | ||
claim_identifier: email, | ||
// do we want to do this? | ||
// It will prevent us from sending an email if the user has already tried to claim (pending state) | ||
// or if they have already claimed | ||
claim_status: "UNCLAIMED", | ||
claim_status: CLAIM_STATUS.UNCLAIMED, | ||
}, | ||
}); | ||
|
||
|
@@ -132,7 +133,7 @@ export async function checkAndSendVerificationEmail(email: string) { | |
id: claim.id, | ||
}, | ||
data: { | ||
claim_status: "SENT_CODE", | ||
claim_status: CLAIM_STATUS.SENT_CODE, | ||
verification_code: code, | ||
}, | ||
}); | ||
|
@@ -141,7 +142,7 @@ export async function checkAndSendVerificationEmail(email: string) { | |
to: email, | ||
from: "[email protected]", | ||
subject: "Verify your email", | ||
text: `Your verification code is: ${code}. This code will expire in 10 minutes.`, | ||
text: `Your verification code is: ${code}.`, | ||
html: await renderHtml(code), | ||
}); | ||
|
||
|
@@ -188,9 +189,9 @@ export async function verifyEmail( | |
) { | ||
const emailSoftClaim = await prisma.softClaim.findFirst({ | ||
where: { | ||
claim_type: "EMAIL", | ||
claim_type: CLAIM_IDENTIFIER.EMAIL, | ||
claim_identifier: email, | ||
claim_status: "SENT_CODE", | ||
claim_status: CLAIM_STATUS.SENT_CODE, | ||
verification_code: code, | ||
}, | ||
}); | ||
|
@@ -201,7 +202,7 @@ export async function verifyEmail( | |
id: emailSoftClaim.id, | ||
}, | ||
data: { | ||
claim_status: "CLAIMED", | ||
claim_status: CLAIM_STATUS.CLAIMED, | ||
recipient: address, | ||
verified_at: new Date(), | ||
}, | ||
|
@@ -228,7 +229,7 @@ export const saveHardClaim = async ( | |
id: hardClaimId, | ||
}, | ||
data: { | ||
claim_status: "CLAIMED", | ||
claim_status: CLAIM_STATUS.CLAIMED, | ||
transaction_hash: transactionHash, | ||
claimed_at: new Date(), | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.