Skip to content
Merged
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
28 changes: 28 additions & 0 deletions lib/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,33 @@ export interface Database {
};
Relationships: [];
};
pl_airdrop_proofs: {
Row: {
address: string;
amount: string;
proof: string;
merkle_root: string;
created_at: string;
updated_at: string;
};
Insert: {
address: string;
amount: string;
proof: string;
merkle_root: string;
created_at?: string;
updated_at?: string;
};
Update: {
address?: string;
amount?: string;
proof?: string;
merkle_root?: string;
created_at?: string;
updated_at?: string;
};
Relationships: [];
};
pl_weekly_snapshots: {
Row: {
id: number;
Expand Down Expand Up @@ -721,3 +748,4 @@ export type PlReferralCode = Database["public"]["Tables"]["pl_referral_codes"]["
export type PlStreak = Database["public"]["Tables"]["pl_streaks"]["Row"];
export type PlDailyPrice = Database["public"]["Tables"]["pl_daily_prices"]["Row"];
export type PlWeeklySnapshot = Database["public"]["Tables"]["pl_weekly_snapshots"]["Row"];
export type PlAirdropProof = Database["public"]["Tables"]["pl_airdrop_proofs"]["Row"];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlink",
"version": "0.1.27",
"version": "0.1.28",
"private": true,
"workspaces": [
"packages/*"
Expand Down
6 changes: 3 additions & 3 deletions src/app/api/airdrop/proof/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export async function GET(req: NextRequest) {
}

const { data, error } = await supabase
.from("pl_airdrop_proofs" as never)
.from("pl_airdrop_proofs")
.select("amount, proof, merkle_root")
.eq("address" as never, address)
.single() as { data: { amount: string; proof: string; merkle_root: string } | null; error: unknown };
.eq("address", address)
.single();

if (error || !data) {
return NextResponse.json({ eligible: false, amount: null, proof: null, claimed: false });
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/airdrop/results/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export async function GET() {

// Read all finalized proof amounts
const { data, error } = await supabase
.from("pl_airdrop_proofs" as never)
.select("amount") as { data: { amount: string }[] | null; error: unknown };
.from("pl_airdrop_proofs")
.select("amount");

if (error || !data || data.length === 0) {
return NextResponse.json({ finalized: false });
Expand Down
11 changes: 11 additions & 0 deletions supabase/migrations/00036_airdrop_proofs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Airdrop proof storage (#914)
-- Stores finalized Merkle proofs generated by airdrop-finalize script

CREATE TABLE pl_airdrop_proofs (
address TEXT PRIMARY KEY,
amount TEXT NOT NULL, -- wei amount as string (bigint precision)
proof TEXT NOT NULL, -- JSON-stringified array of bytes32 hashes
merkle_root TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
Loading