Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions actions/rewardContributorForIssue.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// --- REAL SOLANA LOGIC GOES HERE ---
import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache"

async function sendSplTokenReward(recipientAddress, amount, issueNumber) {
// --- REAL SOLANA LOGIC GOES HERE ---
// 1. Initialize connection to Solana cluster.
// 2. Load your app's wallet from a secure environment variable.
// 3. Construct and send the SPL token transfer transaction.
// 4. Wait for confirmation.
// 5. Return the transaction signature.
// For now, we'll return a dummy signature.
async function sendSplTokenReward(recipientAddress, amount, issueNumber) {
console.log(`Sending ${amount} tokens for issue #${issueNumber} to ${recipientAddress}`);

const dummySignature = `dummy_tx_${Date.now()}`;
Expand Down
10 changes: 5 additions & 5 deletions actions/userProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function upsertUser(data) {

// Updates the wallet address for the current user.
export async function updateUserWallet(walletAddress) {
const { userId } = auth();
const { userId } =await auth();
if (!userId) return { error: "Not authenticated" };

try {
Expand All @@ -53,7 +53,7 @@ export async function updateUserWallet(walletAddress) {

// Gets all profile data for the current user.
export async function getUserProfileData() {
const { userId } = auth();
const { userId } = await auth();
if (!userId) return { error: "Not authenticated" };

try {
Expand Down Expand Up @@ -140,7 +140,7 @@ export async function getLeaderboard() {

// Creates an org and sets the current user as admin.
export async function createOrganization(data) {
const { userId } = auth();
const { userId } =await auth();
if (!userId) return { error: "Not authenticated" };

try {
Expand All @@ -167,7 +167,7 @@ export async function createOrganization(data) {

// Registers a new repository for an organization.
export async function registerRepo(data, repoOwner, userGithubToken) {
const { userId } = auth();
const { userId } =await auth();
if (!userId) return { error: "Not authenticated" };

try {
Expand Down Expand Up @@ -197,7 +197,7 @@ export async function registerRepo(data, repoOwner, userGithubToken) {

// Sets or updates the token bounty for an issue.
export async function setIssueBounty(data) {
const { userId } = auth();
const { userId } =await auth();
if (!userId) return { error: "Not authenticated" };

try {
Expand Down
11 changes: 10 additions & 1 deletion api/webhooks/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function getClosingIssueId(body) {
}

export default async function handler(req, res) {

// IMPORTANT: You must verify the webhook signature in a real app!
// This ensures the request is actually from GitHub.
// For the hackathon, we might skip this, but it's critical for production.
Expand Down Expand Up @@ -48,4 +49,12 @@ export default async function handler(req, res) {
console.error('Webhook error:', error);
res.status(500).json({ message: 'Internal Server Error' });
}
}
}








Loading